コード例 #1
0
ファイル: DiscreteAttribute.java プロジェクト: nghoang/PEEPs
  /** 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
ファイル: DiscreteAttribute.java プロジェクト: nghoang/PEEPs
 public DiscreteAttributeItem getItemAt(int indexOfItem) {
   VertexCollection sortedVertices = values.topologicalSort();
   return (DiscreteAttributeItem) sortedVertices.get(indexOfItem).getContent();
 }