コード例 #1
0
  /**
   * Constructs an anchor for the given node by copying all information from the given anchor
   *
   * @param a Another anchor
   * @param n The node to which the anchor must be attached
   * @throws BadAnchorException if the given anchor is null
   */
  public Anchor(Anchor a, SGNode n) throws BadAnchorException {
    if (a == null)
      throw new BadAnchorException("Failed attempt to make an anchor out of a null object");

    reader = a.getReader();
    node = n;
    query = a.isQuery();
    compulsory.addAll(a.getCompulsory());
    optional.addAll(a.getOptional());
    sort(query);
    redAnchor = a.isRed();
    reader = a.getReader();
    id = a.getID();
    uri = a.getURI();
    n.setAnchor(this);
  }
コード例 #2
0
  /**
   * Constructs an anchor by copying all information from the given anchor
   *
   * @param a Another anchor
   * @throws BadAnchorException if the given anchor is null
   */
  public Anchor(Anchor a) throws BadAnchorException {
    if (a == null)
      throw new BadAnchorException("Failed attempt to make an anchor out of a null object");
    merge(a);
    query = a.isQuery();
    redAnchor = a.isRed();
    // datatype = a.isDataType();
    reader = a.getReader();
    id = a.getID();
    uri = a.getURI();

    if (a.getNode() != null) {
      node = a.getNode();
      node.setAnchor(this);
    }
  }