// Path: src/libra/common/json/JsonSerializer.java
// public class JsonSerializer {
//     
//     private ObjectMapper mapper;
//             
//     public JsonSerializer() {
//         this.mapper = new ObjectMapper();
//     }
//     
//     public JsonSerializer(boolean prettyformat) {
//         this.mapper = new ObjectMapper();
//         this.mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, prettyformat);
//     }
//     
//     public String toJson(Object obj) throws IOException {
//         StringWriter writer = new StringWriter();
//         this.mapper.writeValue(writer, obj);
//         return writer.getBuffer().toString();
//     }
//     
//     public void toJsonConfiguration(Configuration conf, String key, Object obj) throws IOException {
//         String jsonString = toJson(obj);
//         
//         conf.set(key, jsonString);
//     }
//     
//     public void toJsonFile(File f, Object obj) throws IOException {
//         this.mapper.writeValue(f, obj);
//     }
//     
//     public void toJsonFile(FileSystem fs, Path file, Object obj) throws IOException {
//         if(!fs.exists(file.getParent())) {
//             fs.mkdirs(file.getParent());
//         }
//         
//         DataOutputStream ostream = fs.create(file, true, 64 * 1024, (short)3, 1024 * 1024);
//         this.mapper.writeValue(ostream, obj);
//         ostream.close();
//     }
//     
//     public Object fromJson(String json, Class<?> cls) throws IOException {
//         if(json == null) {
//             return null;
//         }
//         StringReader reader = new StringReader(json);
//         return this.mapper.readValue(reader, cls);
//     }
//     
//     public Object fromJsonConfiguration(Configuration conf, String key, Class<?> cls) throws IOException {
//         String jsonString = conf.get(key);
//         
//         if(jsonString == null) {
//             return null;
//         }
//         
//         return fromJson(jsonString, cls);
//     }
//     
//     public Object fromJsonFile(File f, Class<?> cls) throws IOException {
//         return this.mapper.readValue(f, cls);
//     }
//     
//     public Object fromJsonFile(FileSystem fs, Path file, Class<?> cls) throws IOException {
//         DataInputStream istream = fs.open(file);
//         Object obj = this.mapper.readValue(istream, cls);
//         
//         istream.close();
//         return obj;
//     }
// }


import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import libra.common.json.JsonSerializer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
    
    public static KmerIndexTable createInstance(Configuration conf) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        return (KmerIndexTable) serializer.fromJsonConfiguration(conf, HADOOP_CONFIG_KEY, KmerIndexTable.class);
    }
    
    public static KmerIndexTable createInstance(FileSystem fs, Path file) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        return (KmerIndexTable) serializer.fromJsonFile(fs, file, KmerIndexTable.class);
    }
    
    public KmerIndexTable() {
    }
    
    public KmerIndexTable(String name) {
        this.name = name;
    }
    
    @JsonProperty("name")
    public String getName() {
        return this.name;
    }
    
    @JsonProperty("name")
    public void setName(String name) {
        this.name = name;
    }
    
    @JsonIgnore
    public void addRecord(KmerIndexTableRecord record) {
// Path: src/libra/common/json/JsonSerializer.java
// public class JsonSerializer {
//     
//     private ObjectMapper mapper;
//             
//     public JsonSerializer() {
//         this.mapper = new ObjectMapper();
//     }
//     
//     public JsonSerializer(boolean prettyformat) {
//         this.mapper = new ObjectMapper();
//         this.mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, prettyformat);
//     }
//     
//     public String toJson(Object obj) throws IOException {
//         StringWriter writer = new StringWriter();
//         this.mapper.writeValue(writer, obj);
//         return writer.getBuffer().toString();
//     }
//     
//     public void toJsonConfiguration(Configuration conf, String key, Object obj) throws IOException {
//         String jsonString = toJson(obj);
//         
//         conf.set(key, jsonString);
//     }
//     
//     public void toJsonFile(File f, Object obj) throws IOException {
//         this.mapper.writeValue(f, obj);
//     }
//     
//     public void toJsonFile(FileSystem fs, Path file, Object obj) throws IOException {
//         if(!fs.exists(file.getParent())) {
//             fs.mkdirs(file.getParent());
//         }
//         
//         DataOutputStream ostream = fs.create(file, true, 64 * 1024, (short)3, 1024 * 1024);
//         this.mapper.writeValue(ostream, obj);
//         ostream.close();
//     }
//     
//     public Object fromJson(String json, Class<?> cls) throws IOException {
//         if(json == null) {
//             return null;
//         }
//         StringReader reader = new StringReader(json);
//         return this.mapper.readValue(reader, cls);
//     }
//     
//     public Object fromJsonConfiguration(Configuration conf, String key, Class<?> cls) throws IOException {
//         String jsonString = conf.get(key);
//         
//         if(jsonString == null) {
//             return null;
//         }
//         
//         return fromJson(jsonString, cls);
//     }
//     
//     public Object fromJsonFile(File f, Class<?> cls) throws IOException {
//         return this.mapper.readValue(f, cls);
//     }
//     
//     public Object fromJsonFile(FileSystem fs, Path file, Class<?> cls) throws IOException {
//         DataInputStream istream = fs.open(file);
//         Object obj = this.mapper.readValue(istream, cls);
//         
//         istream.close();
//         return obj;
//     }
// }


// Path: src/libra/preprocess/common/kmerindex/KmerIndexTable.java
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import libra.common.json.JsonSerializer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;

    
    public static KmerIndexTable createInstance(Configuration conf) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        return (KmerIndexTable) serializer.fromJsonConfiguration(conf, HADOOP_CONFIG_KEY, KmerIndexTable.class);
    }
    
    public static KmerIndexTable createInstance(FileSystem fs, Path file) throws IOException {
        JsonSerializer serializer = new JsonSerializer();
        return (KmerIndexTable) serializer.fromJsonFile(fs, file, KmerIndexTable.class);
    }
    
    public KmerIndexTable() {
    }
    
    public KmerIndexTable(String name) {
        this.name = name;
    }
    
    @JsonProperty("name")
    public String getName() {
        return this.name;
    }
    
    @JsonProperty("name")
    public void setName(String name) {
        this.name = name;
    }
    
    @JsonIgnore
    public void addRecord(KmerIndexTableRecord record) {
        this.records.add(record);