Search in sources :

Example 1 with Encoding

use of com.vaticle.typedb.core.graph.common.Encoding in project grakn by graknlabs.

the class TypeAdjacencyImpl method put.

@Override
public TypeEdge put(Encoding.Edge.Type encoding, TypeVertex adjacent) {
    assert !owner.isDeleted();
    TypeVertex from = isOut() ? owner : adjacent;
    TypeVertex to = isOut() ? adjacent : owner;
    TypeEdgeImpl edge = new TypeEdgeImpl.Buffered(encoding, from, to);
    edges.computeIfAbsent(encoding, e -> new ConcurrentSkipListSet<>()).add(getView(edge));
    if (isOut())
        ((TypeAdjacencyImpl<?>) to.ins()).putNonRecursive(edge);
    else
        ((TypeAdjacencyImpl<?>) from.outs()).putNonRecursive(edge);
    owner.setModified();
    return edge;
}
Also used : EdgeViewIID(com.vaticle.typedb.core.graph.iid.EdgeViewIID) ConcurrentSet(com.vaticle.typedb.common.collection.ConcurrentSet) KeyValue(com.vaticle.typedb.core.common.collection.KeyValue) TypeEdge(com.vaticle.typedb.core.graph.edge.TypeEdge) Predicate(java.util.function.Predicate) Order(com.vaticle.typedb.core.common.iterator.sorted.SortedIterator.Order) InfixIID(com.vaticle.typedb.core.graph.iid.InfixIID) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Forwardable(com.vaticle.typedb.core.common.iterator.sorted.SortedIterator.Forwardable) ASC(com.vaticle.typedb.core.common.iterator.sorted.SortedIterator.ASC) Forwardable.iterateSorted(com.vaticle.typedb.core.common.iterator.sorted.SortedIterators.Forwardable.iterateSorted) InEdgeIteratorImpl(com.vaticle.typedb.core.graph.adjacency.impl.TypeEdgeIterator.InEdgeIteratorImpl) ConcurrentMap(java.util.concurrent.ConcurrentMap) OutEdgeIteratorImpl(com.vaticle.typedb.core.graph.adjacency.impl.TypeEdgeIterator.OutEdgeIteratorImpl) Forwardable.emptySorted(com.vaticle.typedb.core.common.iterator.sorted.SortedIterators.Forwardable.emptySorted) ConcurrentSkipListSet(java.util.concurrent.ConcurrentSkipListSet) VertexIID(com.vaticle.typedb.core.graph.iid.VertexIID) TypeAdjacency(com.vaticle.typedb.core.graph.adjacency.TypeAdjacency) Optional(java.util.Optional) TypeEdgeImpl(com.vaticle.typedb.core.graph.edge.impl.TypeEdgeImpl) Key(com.vaticle.typedb.core.graph.common.Storage.Key) TypeVertex(com.vaticle.typedb.core.graph.vertex.TypeVertex) ByteArray(com.vaticle.typedb.core.common.collection.ByteArray) Encoding(com.vaticle.typedb.core.graph.common.Encoding) ConcurrentSkipListSet(java.util.concurrent.ConcurrentSkipListSet) TypeVertex(com.vaticle.typedb.core.graph.vertex.TypeVertex) TypeEdgeImpl(com.vaticle.typedb.core.graph.edge.impl.TypeEdgeImpl)

Aggregations

ConcurrentSet (com.vaticle.typedb.common.collection.ConcurrentSet)1 ByteArray (com.vaticle.typedb.core.common.collection.ByteArray)1 KeyValue (com.vaticle.typedb.core.common.collection.KeyValue)1 ASC (com.vaticle.typedb.core.common.iterator.sorted.SortedIterator.ASC)1 Forwardable (com.vaticle.typedb.core.common.iterator.sorted.SortedIterator.Forwardable)1 Order (com.vaticle.typedb.core.common.iterator.sorted.SortedIterator.Order)1 Forwardable.emptySorted (com.vaticle.typedb.core.common.iterator.sorted.SortedIterators.Forwardable.emptySorted)1 Forwardable.iterateSorted (com.vaticle.typedb.core.common.iterator.sorted.SortedIterators.Forwardable.iterateSorted)1 TypeAdjacency (com.vaticle.typedb.core.graph.adjacency.TypeAdjacency)1 InEdgeIteratorImpl (com.vaticle.typedb.core.graph.adjacency.impl.TypeEdgeIterator.InEdgeIteratorImpl)1 OutEdgeIteratorImpl (com.vaticle.typedb.core.graph.adjacency.impl.TypeEdgeIterator.OutEdgeIteratorImpl)1 Encoding (com.vaticle.typedb.core.graph.common.Encoding)1 Key (com.vaticle.typedb.core.graph.common.Storage.Key)1 TypeEdge (com.vaticle.typedb.core.graph.edge.TypeEdge)1 TypeEdgeImpl (com.vaticle.typedb.core.graph.edge.impl.TypeEdgeImpl)1 EdgeViewIID (com.vaticle.typedb.core.graph.iid.EdgeViewIID)1 InfixIID (com.vaticle.typedb.core.graph.iid.InfixIID)1 VertexIID (com.vaticle.typedb.core.graph.iid.VertexIID)1 TypeVertex (com.vaticle.typedb.core.graph.vertex.TypeVertex)1 Optional (java.util.Optional)1