Search in sources :

Example 1 with Matches

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;
}
Also used : Matches(uk.gov.gchq.gaffer.operation.data.ElementSeed.Matches) IncludeEdgeType(uk.gov.gchq.gaffer.operation.GetOperation.IncludeEdgeType) IncludeIncomingOutgoingType(uk.gov.gchq.gaffer.operation.GetOperation.IncludeIncomingOutgoingType)

Aggregations

IncludeEdgeType (uk.gov.gchq.gaffer.operation.GetOperation.IncludeEdgeType)1 IncludeIncomingOutgoingType (uk.gov.gchq.gaffer.operation.GetOperation.IncludeIncomingOutgoingType)1 Matches (uk.gov.gchq.gaffer.operation.data.ElementSeed.Matches)1