예제 #1
0
  /** Object output methods */
  public String internalGraphToString() {
    String out = new String();

    VertexCollection sortedVertices = values.topologicalSort();

    for (int i = 0; i < sortedVertices.size(); i++) {
      out += ((DiscreteAttributeItem) sortedVertices.get(i).getContent()).getValue();

      // As long as we're not on the last attribute
      if (i < sortedVertices.size() - 1) {
        if (Graph.relativePreference(sortedVertices.get(i), sortedVertices.get(i + 1))
            == Graph.NATURALLY_EQUAL) {
          out += " - ";
        } else if (Graph.relativePreference(sortedVertices.get(i), sortedVertices.get(i + 1))
            == Graph.NATURALLY_DIRECTED) {
          out += " >> ";
        } else if (Graph.relativePreference(sortedVertices.get(i), sortedVertices.get(i + 1))
            == Graph.ARTIFICIALLY_DIRECTED) {
          out += " > ";
        }
      }
    }

    return out;
  }
예제 #2
0
 public DiscreteAttributeItem getItemAt(int indexOfItem) {
   VertexCollection sortedVertices = values.topologicalSort();
   return (DiscreteAttributeItem) sortedVertices.get(indexOfItem).getContent();
 }