コード例 #1
0
  private void processMemoryNode(Leaf node, Node parent) {

    // Deprecated in 1.4
    String id = node.getProperty("id");

    // Added to 1.4
    String nm = node.getProperty("name", id);
    String access = node.getProperty("access");
    String alias = node.getProperty("alias");

    // Either name or id required

    String start = node.getProperty("start");
    String size = node.getProperty("size");

    // -
    String Pname = node.getProperty("Pname");

    // Optional
    String startup = node.getProperty("startup");

    Leaf memoryNode = Leaf.addUniqueChild(parent, Type.MEMORY, nm);

    // memoryNode.putProperty(Property.ID, id);
    memoryNode.putProperty(Property.START, start);
    memoryNode.putProperty(Property.SIZE, size);

    memoryNode.putNonEmptyProperty(Property.PNAME, Pname);
    memoryNode.putNonEmptyProperty(Property.STARTUP, startup);

    memoryNode.putProperty(Property.ACCESS, access);
    memoryNode.putProperty(Property.ALIAS, alias);
  }
コード例 #2
0
  private void processBookNode(Leaf node, Node parent) {

    // Required
    String bookName = node.getProperty("name");
    String title = node.getProperty("title");

    // Optional
    String category = node.getProperty("category");

    Leaf bookNode = Leaf.addNewChild(parent, Type.BOOK);
    bookNode.setName(title);

    String posixName = updatePosixSeparators(bookName);
    if (bookName.startsWith("http://")
        || bookName.startsWith("https://")
        || bookName.startsWith("ftp://")) {
      bookNode.putNonEmptyProperty(Property.URL, bookName);
    } else {
      bookNode.putNonEmptyProperty(Property.FILE, posixName);
    }

    bookNode.putNonEmptyProperty(Property.CATEGORY, category);
  }