예제 #1
0
파일: XMLNode.java 프로젝트: paxnil/spindle
  /*
   * (non-Javadoc)
   *
   * @see java.lang.Comparable#compareTo(java.lang.Object)
   */
  public int compareTo(Object obj) {
    if (this == obj) return 0;

    if (!(obj instanceof XMLNode)) return 0;

    XMLNode other = (XMLNode) obj;
    return (getOffset() > other.getOffset()) ? 1 : ((getOffset() < other.getOffset()) ? -1 : 0);
  }
예제 #2
0
파일: XMLNode.java 프로젝트: paxnil/spindle
 public XMLNode getAttributeAt(int offset) {
   List attrs = getAttributes();
   for (Iterator it = attrs.iterator(); it.hasNext(); ) {
     XMLNode artifact = (XMLNode) it.next();
     if (artifact.getOffset() <= offset && offset <= artifact.getOffset() + artifact.getLength())
       return artifact;
   }
   return null;
 }
예제 #3
0
파일: XMLNode.java 프로젝트: paxnil/spindle
 public synchronized void addChild(XMLNode childArtifact) {
   for (int i = 0; i < children.size(); i++) {
     if (((XMLNode) children.get(i)).getOffset() > childArtifact.getOffset()) {
       children.add(i, childArtifact);
       break;
     }
   }
   if (!children.contains(childArtifact)) children.add(childArtifact);
 }
예제 #4
0
파일: XMLNode.java 프로젝트: paxnil/spindle
  public List getChildrenAfter(XMLNode child) {
    List result = new ArrayList();
    for (int i = 0; i < children.size(); i++) {
      if (((XMLNode) children.get(i)).getOffset() > child.getOffset()) {
        result.add(child);
      }
    }

    return result;
  }