use of uk.gov.gchq.gaffer.operation.data.ElementSeed.Matches in project Gaffer by gchq.
the class GetElementsHandler method isSeedRelated.
private boolean isSeedRelated(final GetElements<ElementSeed, Element> operation, final Edge edge) {
final Matches seedMatches = isSeedRelated(ElementSeed.createSeed(edge), operation.getSeeds());
final IncludeEdgeType includeEdgeType = operation.getIncludeEdges();
final IncludeIncomingOutgoingType inOutType = operation.getIncludeIncomingOutGoing();
if (IncludeEdgeType.ALL == includeEdgeType) {
if (IncludeIncomingOutgoingType.BOTH == inOutType) {
return seedMatches.isMatch();
}
if (IncludeIncomingOutgoingType.INCOMING == inOutType) {
if (edge.isDirected()) {
return seedMatches.isDestination();
}
return seedMatches.isMatch();
}
if (IncludeIncomingOutgoingType.OUTGOING == inOutType) {
if (edge.isDirected()) {
return seedMatches.isSource();
}
return seedMatches.isMatch();
}
}
if (IncludeEdgeType.DIRECTED == includeEdgeType) {
if (!edge.isDirected()) {
return false;
}
if (IncludeIncomingOutgoingType.BOTH == inOutType) {
return seedMatches.isMatch();
}
if (IncludeIncomingOutgoingType.INCOMING == inOutType) {
return seedMatches.isDestination();
}
if (IncludeIncomingOutgoingType.OUTGOING == inOutType) {
return seedMatches.isSource();
}
}
if (IncludeEdgeType.UNDIRECTED == includeEdgeType) {
if (edge.isDirected()) {
return false;
}
if (IncludeIncomingOutgoingType.BOTH == inOutType) {
return seedMatches.isMatch();
}
if (IncludeIncomingOutgoingType.INCOMING == inOutType) {
return seedMatches.isMatch();
}
if (IncludeIncomingOutgoingType.OUTGOING == inOutType) {
return seedMatches.isMatch();
}
}
return false;
}
Aggregations