Java Code Examples for com.tinkerpop.blueprints.Direction#OUT

The following examples show how to use com.tinkerpop.blueprints.Direction#OUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractEdgeHelper.java    From org.openntf.domino with Apache License 2.0 6 votes vote down vote up
@Override
public Set<? extends Vertex> getOtherVertexes(final Vertex vertex) {
	Set<Vertex> result = new LinkedHashSet<Vertex>();
	Class<?> vclass = vertex.getClass();
	Direction od = null;
	if (getInType().equals(vclass))
		od = Direction.OUT;
	if (od == null && getOutType().equals(vclass))
		od = Direction.IN;
	if (od == null && getInType().isAssignableFrom(vclass))
		od = Direction.OUT;
	if (od == null && getOutType().isAssignableFrom(vclass))
		od = Direction.IN;
	if (od == null) {
		throw new EdgeHelperException(vertex.getClass().getName() + " is not a participating type in edge " + getLabel());
	} else {
		Set<? extends Edge> edges = getEdges(vertex);
		for (Edge edge : edges) {
			result.add(edge.getVertex(od));
		}
		return Collections.unmodifiableSet(result);
	}
}
 
Example 2
Source File: TitanObjectFactory.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieves the titan direction corresponding to the given
 * AtlasEdgeDirection.
 *
 * @param dir
 * @return
 */
public static Direction createDirection(AtlasEdgeDirection dir) {

    switch(dir) {
    case IN:
        return Direction.IN;
    case OUT:
        return Direction.OUT;
    case BOTH:
        return Direction.BOTH;
    default:
        throw new RuntimeException("Unrecognized direction: " + dir);
    }
}
 
Example 3
Source File: Graph2DataModel.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@Adjacency(label = spawns, direction = Direction.OUT)
public void removeSpawns(Character spawn);
 
Example 4
Source File: Graph2DataModel.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@Incidence(label = spawns, direction = Direction.OUT)
public Spawns addSpawns(Character character);
 
Example 5
Source File: Graph2Demo.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@AdjacencyUnique(label = kills, direction = Direction.OUT)
public Iterable<Character> getKillsCharacters();
 
Example 6
Source File: Graph2Demo.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@AdjacencyUnique(label = spawns, direction = Direction.OUT)
public Iterable<Character> getSpawnsCharacters();
 
Example 7
Source File: ViewVertex.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@Incidence(label = "contents", direction = Direction.OUT)
public List<Contains> getContents();
 
Example 8
Source File: Graph2DataModel.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@Incidence(label = kills, direction = Direction.OUT)
public Kills addKills(Character character);
 
Example 9
Source File: Graph2Demo.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = KILLS, direction = Direction.OUT)
public void removeKills(Kills kill);
 
Example 10
Source File: Person.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = ReportsTo.LABEL, direction = Direction.OUT)
public int countReportsToSubs();
 
Example 11
Source File: Graph2Test.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@AdjacencyUnique(label = spawns, direction = Direction.OUT)
public void removeSpawns(Character spawn);
 
Example 12
Source File: FramedElement.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public FramedElement(final FramedGraph framedGraph, final Element element) {
	this(framedGraph, element, Direction.OUT);
}
 
Example 13
Source File: OutVertexPipe.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public OutVertexPipe() {
    super(Direction.OUT);
}
 
Example 14
Source File: Graph2Demo.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = KILLS, direction = Direction.OUT)
public Kills addKills(Character character);
 
Example 15
Source File: Graph2Test.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = kills, direction = Direction.OUT)
public Iterable<Kills> getKills();
 
Example 16
Source File: Person.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = ReportsTo.LABEL, direction = Direction.OUT)
public ReportsTo getReportsTo();
 
Example 17
Source File: Person.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@AdjacencyUnique(label = ReportsTo.LABEL, direction = Direction.OUT)
public void removeReportsToSupervisor(Person supervisor);
 
Example 18
Source File: DefaultVertexQuery.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
public Iterator<T> iterator() {
    return new Iterator<T>() {
        Edge nextEdge = null;
        final Iterator<Edge> itty = iterable.iterator();
        long count = 0;

        public boolean hasNext() {
            if (null != this.nextEdge) {
                return true;
            } else {
                return this.loadNext();
            }
        }

        public T next() {
            while (true) {
                if (this.nextEdge != null) {
                    final Edge temp = this.nextEdge;
                    this.nextEdge = null;
                    if (forVertex) {
                        if (direction == Direction.OUT)
                            return (T) temp.getVertex(Direction.IN);
                        else if (direction == Direction.IN)
                            return (T) temp.getVertex(Direction.OUT);
                        else {
                            if (temp.getVertex(Direction.OUT).equals(vertex)) {
                                return (T) temp.getVertex(Direction.IN);
                            } else {
                                return (T) temp.getVertex(Direction.OUT);
                            }
                        }

                    } else {
                        return (T) temp;
                    }
                }

                if (!this.loadNext())
                    throw new NoSuchElementException();
            }
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }

        private boolean loadNext() {
            this.nextEdge = null;
            if (this.count > limit) return false;

            while (this.itty.hasNext()) {
                final Edge edge = this.itty.next();
                boolean filter = false;
                for (final HasContainer hasContainer : hasContainers) {
                    if (!hasContainer.isLegal(edge)) {
                        filter = true;
                        break;
                    }
                }

                if (!filter) {
                    if (++this.count <= limit) {
                        this.nextEdge = edge;
                        return true;
                    }
                }
            }
            return false;
        }
    };
}
 
Example 19
Source File: Graph2Demo.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = kills, direction = Direction.OUT)
public Kills addKills(Character character);
 
Example 20
Source File: Person.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = ReportsTo.LABEL, direction = Direction.OUT)
public List<ReportsTo> getReportsToSubs();