NOTE: don't use for edgeRuleTarget
353658
private int id(Node node){
        return node==null || node.outgoing.size()==0 ? -1 : node.stateID;
    }
842361
protected void removeEdgeWithoutCallback(EdgeBean eBean) {
        if (eBean == null) {
            return;
        }

        // Update in and out vertices
        VertexBean outV = eBean.outVertex;
        VertexBean inV = eBean.inVertex;

        outV.outEdges = removeEdgeFromAdjList(outV.outEdges, eBean); // CompactSet.<EdgeBean>remove(outV.outEdges, eBean);
        inV.inEdges = removeEdgeFromAdjList(inV.inEdges, eBean);; // CompactSet.<EdgeBean>remove(inV.inEdges, eBean);
    }
370499
function edgeStringify(edge) {
        var stream = new Tinkerpop.ByteArrayOutputStream();
        var builder = Tinkerpop.GraphSONWriter.build();
        var writer = builder.create();
        writer.writeEdge(stream, edge);
        return stream.toString(Tinkerpop.UTF8);
    }
181086
private List<AtlasEdge> removeUnusedEntries(AtlasVertex instanceVertex, String edgeLabel,
                                             Collection<AtlasEdge> currentEntries,
                                             Collection<AtlasEdge> newEntries,
                                             IDataType entryType, AttributeInfo attributeInfo) throws AtlasException {
        if (currentEntries != null && !currentEntries.isEmpty()) {
            LOG.debug("Removing unused entries from the old collection");
            if (entryType.getTypeCategory() == TypeCategory.STRUCT
                    || entryType.getTypeCategory() == TypeCategory.CLASS) {

                //Remove the edges for (current edges - new edges)
                List<AtlasEdge> cloneElements = new ArrayList<>(currentEntries);
                cloneElements.removeAll(newEntries);
                List<AtlasEdge> additionalElements = new ArrayList<>();

                if (LOG.isDebugEnabled()) {
                    LOG.debug("Removing unused entries from the old collection - {}", cloneElements);
                }

                if (!cloneElements.isEmpty()) {
                    for (AtlasEdge edge : cloneElements) {
                        boolean deleted = deleteHandler.deleteEdgeReference(edge, entryType.getTypeCategory(),
                                attributeInfo.isComposite, true);
                        if (!deleted) {
                            additionalElements.add(edge);
                        }
                    }
                }
                return additionalElements;
            }
        }
        return new ArrayList<>();
    }
29173
def _validate_non_abstract_edge_has_defined_endpoint_types(class_name, properties):
    """"""
    edge_source = properties.get(EDGE_SOURCE_PROPERTY_NAME, None)
    edge_destination = properties.get(EDGE_DESTINATION_PROPERTY_NAME, None)
    has_defined_endpoint_types = all((
        edge_source is not None and edge_source.type_id == PROPERTY_TYPE_LINK_ID,
        edge_destination is not None and edge_destination.type_id == PROPERTY_TYPE_LINK_ID,
    ))
    if not has_defined_endpoint_types:
        raise IllegalSchemaStateError(u'Found a non-abstract edge class with undefined or illegal '
                                      u'in/out properties: {} {}'.format(class_name, properties))
129716
static SquareNode pickNot( SquareNode target , SquareNode child0 , SquareNode child1 ) {
		for (int i = 0; i < 4; i++) {
			SquareEdge e = target.edges[i];
			if( e == null ) continue;
			SquareNode c = e.destination(target);
			if( c != child0 && c != child1 )
				return c;
		}
		throw new RuntimeException("There was no odd one out some how");
	}
1328998
private static String getBoundedSourceName(String token, Type[] bounds, String direction)
      throws NoSourceNameException {
    List<String> boundNames = new ArrayList<String>();
    for (Type boundary : bounds) {
      boundNames.add(getSourceName(boundary));
    }
    return String.format("%s %s %s", token, direction, join(" & ", boundNames));
  }
1219014
private static List<Type> removeRedundantBounds(final Type[] bounds) {
        if (bounds.length == 1) {
            return Collections.singletonList(bounds[0]);
        }
        // if TypeVariable S has a bound T that is a TypeVariable, than S cannot have any other bounds, i.e. bounds.lenght == 1

        List<Type> result = new LinkedList<Type>();
        for (int i = 0; i < bounds.length; i++) {
            boolean isRedundant = false;
            for (int j = 0; j < bounds.length && i != j; j++) {
                if (Reflections.getRawType(bounds[i]).isAssignableFrom(Reflections.getRawType(bounds[j]))) {
                    isRedundant = true;
                    break;
                }
            }
            if (!isRedundant) {
                result.add(bounds[i]);
            }
        }

        return result;
    }
32932
@Override
  public MappeableContainer not(final int firstOfRange, final int lastOfRange) {
    // TODO: may need to convert to a RunContainer
    // TODO: this can be optimized for performance
    if (firstOfRange >= lastOfRange) {
      return clone(); // empty range
    }

    // determine the span of array indices to be affected
    int startIndex = BufferUtil.unsignedBinarySearch(content, 0, cardinality, (short) firstOfRange);
    if (startIndex < 0) {
      startIndex = -startIndex - 1;
    }
    int lastIndex =
        BufferUtil.unsignedBinarySearch(content, 0, cardinality, (short) (lastOfRange - 1));
    if (lastIndex < 0) {
      lastIndex = -lastIndex - 2;
    }
    final int currentValuesInRange = lastIndex - startIndex + 1;
    final int spanToBeFlipped = lastOfRange - firstOfRange;
    final int newValuesInRange = spanToBeFlipped - currentValuesInRange;
    final int cardinalityChange = newValuesInRange - currentValuesInRange;
    final int newCardinality = cardinality + cardinalityChange;

    if (newCardinality > DEFAULT_MAX_SIZE) {
      return toBitmapContainer().not(firstOfRange, lastOfRange);
    }

    final MappeableArrayContainer answer = new MappeableArrayContainer(newCardinality);
    if (!BufferUtil.isBackedBySimpleArray(answer.content)) {
      throw new RuntimeException("Should not happen. Internal bug.");
    }
    short[] sarray = answer.content.array();

    for (int i = 0; i < startIndex; ++i) {
      // copy stuff before the active area
      sarray[i] = content.get(i);
    }

    int outPos = startIndex;
    int inPos = startIndex; // item at inPos always >= valInRange

    int valInRange = firstOfRange;
    for (; valInRange < lastOfRange && inPos <= lastIndex; ++valInRange) {
      if ((short) valInRange != content.get(inPos)) {
        sarray[outPos++] = (short) valInRange;
      } else {
        ++inPos;
      }
    }

    for (; valInRange < lastOfRange; ++valInRange) {
      answer.content.put(outPos++, (short) valInRange);
    }

    // content after the active range
    for (int i = lastIndex + 1; i < cardinality; ++i) {
      answer.content.put(outPos++, content.get(i));
    }
    answer.cardinality = newCardinality;
    return answer;
  }
1242969
private Iterator<Edge> logicalPredecessorEdgeIterator(BasicBlock block) {
        return isForwards ? cfg.incomingEdgeIterator(block) : cfg.outgoingEdgeIterator(block);
    }
120893
private void eliminateParamsAfter(Node fnNode, int argIndex) {
    Node formalArgPtr = NodeUtil.getFunctionParameters(fnNode).getFirstChild();
    while (argIndex != 0 && formalArgPtr != null) {
      formalArgPtr = formalArgPtr.getNext();
      argIndex--;
    }
    eliminateParamsAfter(fnNode, formalArgPtr);
  }
823988
public boolean isEdge(final ODocument iRecord) {
    return iRecord != null ? iRecord.getSchemaClass().isSubClassOf(edgeBaseClass) : false;
  }
637272
@SuppressWarnings("unchecked")
	public Iterable<OutgoingEdge<VertexKey, EdgeValue>> getOutgoingEdges() {
		if (edgesUsed) {
			throw new IllegalStateException("Can use either 'getOutgoingEdges()' or 'sendMessageToAllTargets()' exactly once.");
		}
		edgesUsed = true;
		
		if (this.edgeWithValueIter != null) {
			this.edgeWithValueIter.set((Iterator<Tuple3<VertexKey, VertexKey, EdgeValue>>) edges);
			return this.edgeWithValueIter;
		} else {
			this.edgeNoValueIter.set((Iterator<Tuple2<VertexKey, VertexKey>>) edges);
			return this.edgeNoValueIter;
		}
	}
590980
private static <T, ET> boolean hasNullValueEdges(DataSet<Edge<T, ET>> edges) {
		TypeInformation<?> genericTypeInfo = edges.getType();
		@SuppressWarnings("unchecked")
		TupleTypeInfo<Tuple3<T, T, ET>> tupleTypeInfo = (TupleTypeInfo<Tuple3<T, T, ET>>) genericTypeInfo;

		return tupleTypeInfo.getTypeAt(2).equals(ValueTypeInfo.NULL_VALUE_TYPE_INFO);
	}
148942
protected void selectBoundaryCorners() {
		List<Point2D_F64> layout = detector.getLayout();

		Polygon2D_F64 hull = new Polygon2D_F64();
		UtilPolygons2D_F64.convexHull(layout,hull);
		UtilPolygons2D_F64.removeAlmostParallel(hull,0.02);

		boundaryIndexes = new int[hull.size()];
		for (int i = 0; i < hull.size(); i++) {
			Point2D_F64 h = hull.get(i);
			boolean matched = false;
			for (int j = 0; j < layout.size(); j++) {
				if( h.isIdentical(layout.get(j),1e-6)) {
					matched = true;
					boundaryIndexes[i] = j;
					break;
				}
			}
			if( !matched )
				throw new RuntimeException("Bug!");
		}

	}
240728
public ExceptionSet getEdgeExceptionSet(Edge edge) {
        CachedExceptionSet cachedExceptionSet = thrownExceptionSetMap.get(edge.getSource());
        return cachedExceptionSet.getEdgeExceptionSet(edge);
    }
107729
def _validate_non_edges_do_not_have_edge_like_properties(class_name, properties):
    """"""
    has_source = EDGE_SOURCE_PROPERTY_NAME in properties
    has_destination = EDGE_DESTINATION_PROPERTY_NAME in properties

    if has_source or has_destination:
        raise IllegalSchemaStateError(u'Found a non-edge class that defines edge-like "in" or '
                                      u'"out" properties: {} {}'.format(class_name, properties))

    for property_name, property_descriptor in six.iteritems(properties):
        if property_descriptor.type_id == PROPERTY_TYPE_LINK_ID:
            raise IllegalSchemaStateError(u'Non-edge class "{}" has a property of type Link, this '
                                          u'is not allowed: {}'.format(class_name, property_name))