@JsonIgnore default Object getAdjacentMatchedVertexValue() { return MatchedVertex.DESTINATION == getMatchedVertex() ? getSource() : getDestination(); }
/** * Note this does not include the matchedVertex field. * * @param that the reference EdgeId with which to compare. * @return {@code true} if this object is the same as the edge * argument; {@code false} otherwise. */ default boolean isEqual(final EdgeId that) { return null != that && (new EqualsBuilder() .append(getDirectedType(), that.getDirectedType()) .append(getSource(), that.getSource()) .append(getDestination(), that.getDestination()) .isEquals()); }
/** * This is related to an {@link ElementId} if either the ElementId is equal * to this EdgeId or it is an EntityId and its identifier matches this * EdgeId's source or destination. * * @param that the {@link ElementId} to compare * @return An instance of {@link ElementId.Matches} to describe how the ids are related. */ @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "If an element is not an Edge it must be an Entity") @Override default Matches isRelated(final ElementId that) { if (that instanceof EdgeId) { if (isEqual(that)) { return Matches.BOTH; } return Matches.NONE; } return isRelated((EntityId) that); }
void setIdentifiers(final Object source, final Object destination, final DirectedType directedType, final MatchedVertex matchedVertex);
@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "element provided should always be an Edge") @Override public void loadIdentifiers(final Element edge) { final EdgeId edgeId = (EdgeId) elementConverter.getElementId(key, includeMatchedVertex); ((Edge) edge).setIdentifiers(edgeId.getSource(), edgeId.getDestination(), edgeId.isDirected(), edgeId.getMatchedVertex()); } }
/** * This is related to an {@link EntityId} if the EntityId's identifier * matches this EdgeId's source or destination. * * @param that the {@link ElementId} to compare * @return An instance of {@link ElementId.Matches} to describe how the ids are related. */ default Matches isRelated(final EntityId that) { boolean matchesSource = (null == getSource()) ? null == that.getVertex() : getSource().equals(that.getVertex()); boolean matchesDestination = (null == getDestination()) ? null == that.getVertex() : getDestination().equals(that.getVertex()); if (matchesSource) { if (matchesDestination) { return Matches.BOTH; } return Matches.SOURCE; } if (matchesDestination) { return Matches.DESTINATION; } return Matches.NONE; }
/** * @return true if directed is UNDIRECTED, EITHER or null. Otherwise false. */ @JsonIgnore default boolean isUndirected() { return DirectedType.DIRECTED != getDirectedType(); }
@Override default boolean isEqual(final ElementId that) { return that instanceof EdgeId && isEqual((EdgeId) that); }
/** * This is related to an {@link EdgeId} if either the EdgeId's source or * destination matches this EntityId's vertex. * * @param that the {@link EdgeId} to compare * @return An instance of {@link ElementId.Matches} to describe how the seeds are related. */ default Matches isRelated(final EdgeId that) { boolean matchesSource = (null == getVertex()) ? null == that.getSource() : getVertex().equals(that.getSource()); boolean matchesDestination = (null == getVertex()) ? null == that.getDestination() : getVertex().equals(that.getDestination()); if (matchesSource) { if (matchesDestination) { return Matches.BOTH; } return Matches.SOURCE; } if (matchesDestination) { return Matches.DESTINATION; } return Matches.NONE; } }
/** * @return true if directed is DIRECTED, EITHER or null. Otherwise false. */ @JsonIgnore default boolean isDirected() { return DirectedType.UNDIRECTED != getDirectedType(); }
void setIdentifiers(final Object source, final Object destination, final DirectedType directedType, final MatchedVertex matchedVertex);
@Override default boolean isEqual(final ElementId that) { return that instanceof EdgeId && isEqual((EdgeId) that); }
@JsonIgnore default Object getMatchedVertexValue() { return MatchedVertex.DESTINATION == getMatchedVertex() ? getDestination() : getSource(); }
/** * Note this does not include the matchedVertex field. * * @param that the reference EdgeId with which to compare. * @return {@code true} if this object is the same as the edge * argument; {@code false} otherwise. */ default boolean isEqual(final EdgeId that) { return null != that && (new EqualsBuilder() .append(getDirectedType(), that.getDirectedType()) .append(getSource(), that.getSource()) .append(getDestination(), that.getDestination()) .isEquals()); }
/** * This is related to an {@link EntityId} if the EntityId's identifier * matches this EdgeId's source or destination. * * @param that the {@link ElementId} to compare * @return An instance of {@link ElementId.Matches} to describe how the ids are related. */ default Matches isRelated(final EntityId that) { boolean matchesSource = (null == getSource()) ? null == that.getVertex() : getSource().equals(that.getVertex()); boolean matchesDestination = (null == getDestination()) ? null == that.getVertex() : getDestination().equals(that.getVertex()); if (matchesSource) { if (matchesDestination) { return Matches.BOTH; } return Matches.SOURCE; } if (matchesDestination) { return Matches.DESTINATION; } return Matches.NONE; }
/** * @return true if directed is DIRECTED, EITHER or null. Otherwise false. */ @JsonIgnore default boolean isDirected() { return DirectedType.UNDIRECTED != getDirectedType(); }
/** * This is related to an {@link ElementId} if either the ElementId is equal * to this EdgeId or it is an EntityId and its identifier matches this * EdgeId's source or destination. * * @param that the {@link ElementId} to compare * @return An instance of {@link ElementId.Matches} to describe how the ids are related. */ @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification = "If an element is not an Edge it must be an Entity") @Override default Matches isRelated(final ElementId that) { if (that instanceof EdgeId) { if (isEqual(that)) { return Matches.BOTH; } return Matches.NONE; } return isRelated((EntityId) that); }
@JsonIgnore default Object getMatchedVertexValue() { return MatchedVertex.DESTINATION == getMatchedVertex() ? getDestination() : getSource(); }
private List<Range> getRange(final ElementId elementId, final GraphFilters operation, final SeededGraphFilters.IncludeIncomingOutgoingType inOutType) throws RangeFactoryException { if (elementId instanceof EntityId) { return getRange(((EntityId) elementId).getVertex(), operation, operation.getView().hasEdges()); } else { final EdgeId edgeId = (EdgeId) elementId; final List<Range> ranges = new ArrayList<>(); if (operation.getView().hasEdges() && DirectedType.areCompatible(operation.getDirectedType(), edgeId.getDirectedType())) { // EQUALS and RELATED seed matching. final DirectedType directed = DirectedType.and(operation.getDirectedType(), edgeId.getDirectedType()); ranges.addAll(getRange(edgeId.getSource(), edgeId.getDestination(), directed, operation, inOutType)); } // Do related - if operation doesn't have seed matching or it has seed matching equal to RELATED final boolean doRelated = !(operation instanceof SeedMatching) || !SeedMatching.SeedMatchingType.EQUAL.equals(((SeedMatching) operation).getSeedMatching()); if (doRelated && operation.getView().hasEntities()) { // Get Entities related to EdgeIds ranges.addAll(getRange(edgeId.getSource(), operation, false)); ranges.addAll(getRange(edgeId.getDestination(), operation, false)); } return ranges; } }
/** * This is related to an {@link EdgeId} if either the EdgeId's source or * destination matches this EntityId's vertex. * * @param that the {@link EdgeId} to compare * @return An instance of {@link ElementId.Matches} to describe how the seeds are related. */ default Matches isRelated(final EdgeId that) { boolean matchesSource = (null == getVertex()) ? null == that.getSource() : getVertex().equals(that.getSource()); boolean matchesDestination = (null == getVertex()) ? null == that.getDestination() : getVertex().equals(that.getDestination()); if (matchesSource) { if (matchesDestination) { return Matches.BOTH; } return Matches.SOURCE; } if (matchesDestination) { return Matches.DESTINATION; } return Matches.NONE; } }