是否含有相同的转移函数
@param node1
@param node2
@return
496472
public static boolean haveSameTransitions(MDAGNode node1, MDAGNode node2)
    {
        TreeMap<Character, MDAGNode> outgoingTransitionTreeMap1 = node1.outgoingTransitionTreeMap;
        TreeMap<Character, MDAGNode> outgoingTransitionTreeMap2 = node2.outgoingTransitionTreeMap;
        
        if(outgoingTransitionTreeMap1.size() == outgoingTransitionTreeMap2.size())
        {
            //For each _transition in outgoingTransitionTreeMap1, get the identically lableed _transition
            //in outgoingTransitionTreeMap2 (if present), and test the equality of the transitions' target nodes
            for(Entry<Character, MDAGNode> transitionKeyValuePair : outgoingTransitionTreeMap1.entrySet())
            {
                Character currentCharKey = transitionKeyValuePair.getKey();
                MDAGNode currentTargetNode = transitionKeyValuePair.getValue();
                
                if(!outgoingTransitionTreeMap2.containsKey(currentCharKey) || !outgoingTransitionTreeMap2.get(currentCharKey).equals(currentTargetNode))
                    return false;
            }
            /////
        }
        else
            return false;
        
        return true;
    }
1046137
private static int compareObject(Object a, Object b, final ASTNode node1, final ASTNode node2, String type)
	{
		if (a instanceof Comparable && b instanceof Comparable)
		{
			Comparable ac = (Comparable) a;
			try
			{
				int result = ac.compareTo(b);
				if (result > 0)
					return 1;
				else if (result < 0)
					return -1;
				return result;
			}

			catch (RuntimeException e)
			{
				BeetlException ex = new BeetlException(BeetlException.EXPRESSION_NOT_COMPATIBLE, e);
				GrammarToken token = GrammarToken.createToken(node1.token.text + " " + node2.token.text,
						node1.token.line);
				ex.pushToken(token);
				throw ex;
			}

		}
		else
		{
			return -2;
		}
	}
699681
function(node1, node2) {
			node1 = node1 instanceof gui.Spirit ? node1.element : node1;
			node2 = node2 instanceof gui.Spirit ? node2.element : node2;
			return node1.compareDocumentPosition(node2);
		}
373103
public Difference<BaseType> compareObjects(List<String> field1,
                                               ObjectType node1,
                                               List<String> field2,
                                               ObjectType node2)
            throws InvalidArrayIdentity, DuplicateArrayIdentity {
        Difference<BaseType> ret = new Difference<>();
        // Field by field comparison of obj1 to obj2. 
        for (Iterator<Map.Entry<String, BaseType>> fields = getFields(node1); fields.hasNext();) {
            Map.Entry<String, BaseType> field = fields.next();
            String fieldName = field.getKey();
            field1.add(fieldName);
            BaseType value1 = field.getValue();

            if (hasField(node2, fieldName)) {
                // If both obj1 and obj2 have the same field, compare recursively
                field2.add(fieldName);
                BaseType value2 = getField(node2, fieldName);
                ret.add(compareNodes(field1, value1, field2, value2));
                pop(field2);
            } else {
                // obj1.field1 exists, obj2.field1 does not, so it is removed
                ret.add(new Removal(field1, value1));
            }
            pop(field1);
        }
        // Now compare any new nodes added to obj2
        for (Iterator<Map.Entry<String, BaseType>> fields = getFields(node2); fields.hasNext();) {
            Map.Entry<String, BaseType> field = fields.next();
            String fieldName = field.getKey();
            if (!hasField(node1, fieldName)) {
                field2.add(fieldName);
                ret.add(new Addition(field2, field.getValue()));
                pop(field2);
            }
        }
        return ret;
    }
614956
public static String node2String(final Node node) throws UnsupportedEncodingException
   {
      return node2String(node, true, Constants.DEFAULT_XML_CHARSET);
   }
1166523
def _are_cmd_nodes_same(node1, node2):
  

  # Everything in node1 should be in node2
  for propertytype in node1:
    if (not propertytype in node2 or
        node1[propertytype] != node2[propertytype]):
      return False
  return True
1177220
@Pure
	public static Rectangle2d getNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node) {
		assert node != null;
		final double w = node.nodeWidth / 2.;
		final double h = node.nodeHeight / 2.;
		final IcosepQuadTreeZone zone = node.getZone();
		final double lx;
		final double ly;
		if (zone == null) {
			// Is root node
			lx = node.verticalSplit - w;
			ly = node.horizontalSplit - h;
		} else {
			switch (zone) {
			case SOUTH_EAST:
				lx = node.verticalSplit;
				ly = node.horizontalSplit - h;
				break;
			case SOUTH_WEST:
				lx = node.verticalSplit - w;
				ly = node.horizontalSplit - h;
				break;
			case NORTH_EAST:
				lx = node.verticalSplit;
				ly = node.horizontalSplit;
				break;
			case NORTH_WEST:
				lx = node.verticalSplit - w;
				ly = node.horizontalSplit;
				break;
			case ICOSEP:
				return getNodeBuildingBounds(node.getParentNode());
			default:
				throw new IllegalStateException();
			}
		}
		return new Rectangle2d(lx, ly, node.nodeWidth, node.nodeHeight);
	}
755773
public Set<Annotation> getSubTreeNodes(@NonNull Annotation node, String... childRelations) {
      Set<Annotation> children = new HashSet<>();
      Set<String> targetRel = childRelations == null ? Collections.emptySet() : Sets.asSet(
         Arrays.asList(childRelations));
      Predicate<RelationEdge> keep = edge -> targetRel.size() == 0 || targetRel.contains(edge.getRelation());

      Queue<RelationEdge> queue = new LinkedList<>(getInEdges(node).stream().filter(keep).collect(Collectors.toList()));
      while (!queue.isEmpty()) {
         RelationEdge n = queue.remove();
         if (!"relcl".equals(n.getRelation()) && !"parataxis".equals(n.getRelation())) {
            children.add(n.getFirstVertex());
            queue.addAll(getInEdges(n.getFirstVertex())
                            .stream()
                            .filter(e -> !children.contains(e.getFirstVertex()))
                            .collect(Collectors.toSet()));
         }
      }
      return children;
   }
676286
KamNode[] concat(KamNode[] nodes1, KamNode[] nodes2) {
        KamNode[] ret = new KamNode[nodes1.length + nodes2.length];
        arraycopy(nodes1, 0, ret, 0, nodes1.length);
        arraycopy(nodes2, 0, ret, nodes1.length, nodes2.length);
        return ret;
    }
71465
@Override
    boolean checkNodes(final INodeReadTrx paramFirstRtx, final INodeReadTrx paramSecondRtx)
        throws TTIOException {
        assert paramFirstRtx != null;
        assert paramSecondRtx != null;

        boolean found = false;

        if (paramFirstRtx.getNode().getDataKey() == paramSecondRtx.getNode().getDataKey()
            && paramFirstRtx.getNode().equals(paramSecondRtx.getNode())) {
            final long nodeKey = paramFirstRtx.getNode().getDataKey();

            if (paramFirstRtx.getNode().getKind() == IConstants.ELEMENT) {
                if (((ElementNode)paramFirstRtx.getNode()).getNamespaceCount() == 0
                    && ((ElementNode)paramFirstRtx.getNode()).getAttributeCount() == 0
                    && ((ElementNode)paramSecondRtx.getNode()).getAttributeCount() == 0
                    && ((ElementNode)paramSecondRtx.getNode()).getNamespaceCount() == 0) {
                    found = true;
                } else {
                    if (((ElementNode)paramFirstRtx.getNode()).getNamespaceCount() == 0) {
                        found = true;
                    } else {
                        for (int i = 0; i < ((ElementNode)paramFirstRtx.getNode()).getNamespaceCount(); i++) {
                            paramFirstRtx.moveToNamespace(i);
                            for (int j = 0; j < ((ElementNode)paramSecondRtx.getNode()).getNamespaceCount(); j++) {
                                paramSecondRtx.moveToNamespace(i);

                                if (paramFirstRtx.getNode().equals(paramSecondRtx.getNode())) {
                                    found = true;
                                    break;
                                }
                            }
                            paramFirstRtx.moveTo(nodeKey);
                            paramSecondRtx.moveTo(nodeKey);
                        }
                    }

                    if (found) {
                        for (int i = 0; i < ((ElementNode)paramFirstRtx.getNode()).getAttributeCount(); i++) {
                            paramFirstRtx.moveToAttribute(i);
                            for (int j = 0; j < ((ElementNode)paramSecondRtx.getNode()).getAttributeCount(); j++) {
                                paramSecondRtx.moveToAttribute(i);

                                if (paramFirstRtx.getNode().equals(paramSecondRtx.getNode())) {
                                    found = true;
                                    break;
                                }
                            }
                            paramFirstRtx.moveTo(nodeKey);
                            paramSecondRtx.moveTo(nodeKey);
                        }
                    }
                }
            } else {
                found = true;
            }
        }

        return found;
    }
804897
protected Node<K, V> unionWithComparator(Node<K, V> root1, Node<K, V> root2) {
        if (root1 == null) {
            return root2;
        } else if (root2 == null) {
            return root1;
        }

        Node<K, V> newRoot;
        Node<K, V> cur;

        // find initial
        int c = comparator.compare(root1.key, root2.key);
        if (c <= 0) {
            newRoot = root1;
            root1 = unlinkRightChild(root1);
        } else {
            newRoot = root2;
            root2 = unlinkRightChild(root2);
        }
        cur = newRoot;

        // merge
        while (root1 != null && root2 != null) {
            c = comparator.compare(root1.key, root2.key);
            if (c <= 0) {
                // link as left child of cur
                if (cur.o_c == null) {
                    root1.y_s = cur;
                } else {
                    root1.y_s = cur.o_c;
                }
                cur.o_c = root1;
                cur = root1;
                root1 = unlinkRightChild(root1);
            } else {
                // link as left child of cur
                if (cur.o_c == null) {
                    root2.y_s = cur;
                } else {
                    root2.y_s = cur.o_c;
                }
                cur.o_c = root2;
                cur = root2;
                root2 = unlinkRightChild(root2);
            }
        }

        while (root1 != null) {
            // link as left child of cur
            if (cur.o_c == null) {
                root1.y_s = cur;
            } else {
                root1.y_s = cur.o_c;
            }
            cur.o_c = root1;
            cur = root1;
            root1 = unlinkRightChild(root1);
        }

        while (root2 != null) {
            // link as left child of cur
            if (cur.o_c == null) {
                root2.y_s = cur;
            } else {
                root2.y_s = cur.o_c;
            }
            cur.o_c = root2;
            cur = root2;
            root2 = unlinkRightChild(root2);
        }

        return newRoot;
    }
507848
public List<Node> getNodes(Collection<Long> nodeIds)
	{
		if(nodeIds.isEmpty()) return Collections.emptyList();
		return getSomeElements(NODE + "s?" + NODE + "s=" + toCommaList(nodeIds), Node.class);
	}
1125456
public Difference<BaseType> compareArraysNoId(List<String> field1,
                                                  ArrayType node1,
                                                  List<String> field2,
                                                  ArrayType node2)
            throws InvalidArrayIdentity, DuplicateArrayIdentity {
        Difference<BaseType> ret = new Difference<>();
        IndexAssoc assoc = new IndexAssoc(size(node1), size(node2));
        HashSet<Pair> comparedPairs = new HashSet<>();

        // First associate exact matches
        // We loop through the unassociated elements of node1, and node2
        // If the nodes are equal, we associate them
        // if they are not, we note the distance between the two, so later
        // we don't need to re-compare them
        for (assoc.start1(); assoc.hasNext1();) {
            int index1 = assoc.next1();
            BaseType element1 = getElement(node1, index1);
            field1.add(Integer.toString(index1));

            for (assoc.start2(); assoc.hasNext2();) {
                int index2 = assoc.next2();
                BaseType element2 = getElement(node2, index2);
                field2.add(Integer.toString(index2));

                comparedPairs.add(new Pair(index1, index2));

                Difference diff = compareNodes(field1, element1, field2, element2);
                if (diff.same()) {
                    assoc.associate(index1, index2);
                    pop(field2);
                    break;
                } else {
                    assoc.recordDistance(index1, index2, diff);
                }
                pop(field2);
            }
            pop(field1);
        }

        // Here, we associated all exact matching nodes
        // All remaining nodes need to be compared to each other
        // First compare all node1 elements to node2 elements
        for (assoc.start1(); assoc.hasNext1();) {
            int index1 = assoc.next1();
            BaseType element1 = getElement(node1, index1);
            field1.add(Integer.toString(index1));

            for (assoc.start2(); assoc.hasNext2();) {
                int index2 = assoc.next2();
                BaseType element2 = getElement(node2, index2);
                field2.add(Integer.toString(index2));

                Pair p = new Pair(index1, index2);
                // Do we have a distance recorded for these nodes?
                if (comparedPairs.contains(p)) {
                    // No distance: compare the nodes
                    Difference diff = compareNodes(field1, element1, field2, element2);
                    assoc.recordDistance(index1, index2, diff);
                    comparedPairs.add(p);
                }
                pop(field2);
            }
            IxDiff ixdiff = assoc.getMin(index1);
            // If an object has changed more that 0.5 (more than half
            // of its fields are changed), then it is not a match
            if (ixdiff == null || ixdiff.change > 0.5) {
                // No matching node for node1
                ret.add(new Removal(field1, element1));
                assoc.remove1(index1);
            } else {
                // Matching node
                assoc.associate(index1, ixdiff.index2);
                ret.add(ixdiff.diff);
            }
            pop(field1);
        }
        // Anything remaining on node2 are nodes that are added
        for (assoc.start2(); assoc.hasNext2();) {
            int index = assoc.next2();
            BaseType element2 = getElement(node2, index);
            field2.add(Integer.toString(index));
            ret.add(new Addition(field2, element2));
            pop(field2);
        }
        // Look at associations for moved nodes
        for (Map.Entry<Integer, Integer> entry : assoc.assoc.entrySet()) {
            if (entry.getKey() != entry.getValue()) {
                field1.add(Integer.toString(entry.getKey()));
                field2.add(Integer.toString(entry.getValue()));
                BaseType node = getElement(node1, entry.getKey());
                ret.add(new Move(field1, field2, node));
                pop(field2);
                pop(field1);
            }
        }
        return ret;
    }
359721
public static List<Object> getChildren(TreeModel treeModel, Object node)
    {
        List<Object> children = new ArrayList<Object>();
        int n = treeModel.getChildCount(node);
        for (int i=0; i<n; i++)
        {
            Object child = treeModel.getChild(node, i);
            children.add(child);
        }
        return children;
    }
134806
public static <E> List<E> intersection(final List<E> list1, final List<E> list2) {
        final List<E> result = newArrayList();
        for (final E item : list1) {
            if (list2.contains(item)) {
                result.add(item);
            }
        }
        return result;
    }
1260945
public List<Node> findSiblings(Node node) {
      Preconditions.checkNotNull(node);
    
      Node parent = node.parent();
      if (null == parent) return null;

      return parent.childNodes();               
  }
1015058
function nodeValue(node1, node2) {
    return (node1.dist + heuristic(node1.point)) - (node2.dist + heuristic(node2.point));
  }