Example #1
0
  @Override
  public void read(String filename, Graph graph) {
    Filereader fr = new Filereader(filename);

    // CLASS
    fr.readLine();

    // KEY
    String key = fr.readLine();

    // # MUDULUS
    this.modulus = Double.parseDouble(fr.readLine());

    // # WRAP-AROUND
    this.wrapAround = Boolean.parseBoolean(fr.readLine());

    // # PARTITIONS
    int partitions = Integer.parseInt(fr.readLine());
    this.partitions = new RingPartition[partitions];

    this.maxDistance = this.wrapAround ? this.modulus / 2.0 : this.modulus;

    // PARTITIONS
    String line = null;
    while ((line = fr.readLine()) != null) {
      String[] temp = line.split(":");
      int index = Integer.parseInt(temp[0]);
      this.partitions[index] = new RingPartition(temp[1], this);
    }

    fr.close();

    graph.addProperty(key, this);
  }