コード例 #1
0
ファイル: Printer.java プロジェクト: JUrban/flyspeck-git-svn
  /** Prints a generic Caml object */
  public static SelectionTree print(CamlObject obj) {
    if (obj instanceof Term) return print((Term) obj);

    if (obj instanceof Theorem) return print((Theorem) obj);

    if (obj instanceof HOLType) return print((HOLType) obj);

    // Default
    SelectionTree tree = new SelectionTree(obj, obj.toCommandString());
    return tree;
  }
コード例 #2
0
  @Override
  public Object getValueAt(int rowIndex, int columnIndex) {
    if (rowIndex >= objects.size()) return null;

    CamlObjectComponent.Element e = objects.get(rowIndex);

    try {
      switch (columnIndex) {
          // Column 1
        case 0:
          return e;

          // Column 2
        case 1:
          CamlObject obj = e.object;
          if (obj instanceof Term) {
            return TypePrinter.printType(((Term) obj).type());
          }
          if (obj instanceof HOLType) {
            return TypePrinter.printType((HOLType) obj);
          }
          if (obj instanceof Theorem) {
            String name = ((Theorem) obj).name();
            return name != null ? name : "%TMP_THEOREM%";
          } else if (obj != null) {
            return obj.camlType();
          }
          break;
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      return null;
    }

    return null;
  }