Beispiel #1
0
  @Override
  public void serializeParse(BdsSerializer serializer) {
    // Nothing to do
    id = (int) serializer.getNextFieldInt();
    parentNodeId = serializer.getNextFieldString();
    int nodeId = serializer.getNextFieldNodeId();

    if (nodeId != 0) {
      // Node is not null
      node = new ParentNode();
      node.setFakeId(nodeId);
    }

    if (id > scopeNum) scopeNum = id + 1;
  }
Beispiel #2
0
  @Override
  public String serializeSave(BdsSerializer serializer) {
    StringBuilder out = new StringBuilder();
    out.append("Scope");
    out.append("\t" + serializer.serializeSaveValue(id));
    out.append("\t" + serializer.serializeSaveValue(parent != null ? parent.getNodeId() : ""));
    out.append("\t" + serializer.serializeSaveValue(node));
    out.append("\n");

    for (ScopeSymbol ss : symbols.values()) {
      if (ss.getType().isNative()) {; // Do not save native functions
      } else out.append(serializer.serializeSave(ss));
    }

    if (parent != null) out.append(serializer.serializeSave(parent));

    return out.toString();
  }