예제 #1
0
  public JSONArray getJSONArrayRepresentation(RepFactory f) throws JSONException {
    JSONArray arr = new JSONArray();
    Stack<HNode> st = new Stack<HNode>();
    st.push(this);
    HTable t = f.getHTable(hTableId);
    HNode parentNode = t.getParentHNode();
    while (parentNode != null) {
      st.push(parentNode);
      t = f.getHTable(parentNode.getHTableId());
      parentNode = t.getParentHNode();
    }

    while (!st.isEmpty()) {
      HNode node = st.pop();
      JSONObject obj = new JSONObject();
      obj.put("columnName", node.getColumnName());
      arr.put(obj);
    }
    return arr;
  }
예제 #2
0
 public int compareTo(HNode other) {
   return columnName.compareTo(other.getColumnName());
 }