Package com.tinkerpop.gremlin.structure

Examples of com.tinkerpop.gremlin.structure.Element$Iterators


    @Test
    public void shouldDeterminePropertiesAreEqual() {
        final Property mockPropertyA = mock(Property.class);
        final Property mockPropertyB = mock(Property.class);
        final Element mockElement = mock(Element.class);
        when(mockPropertyA.isPresent()).thenReturn(true);
        when(mockPropertyB.isPresent()).thenReturn(true);
        when(mockPropertyA.element()).thenReturn(mockElement);
        when(mockPropertyB.element()).thenReturn(mockElement);
        when(mockPropertyA.key()).thenReturn("k");
View Full Code Here


    @Test
    public void shouldDeterminePropertiesAreNotEqualWhenElementsAreDifferent() {
        final Property mockPropertyA = mock(Property.class);
        final Property mockPropertyB = mock(Property.class);
        final Element mockElement = mock(Element.class);
        final Element mockElementDifferent = mock(Element.class);
        when(mockPropertyA.isPresent()).thenReturn(true);
        when(mockPropertyB.isPresent()).thenReturn(true);
        when(mockPropertyA.element()).thenReturn(mockElement);
        when(mockPropertyB.element()).thenReturn(mockElementDifferent);
        when(mockPropertyA.key()).thenReturn("k");
View Full Code Here

    @Test
    public void shouldDeterminePropertiesAreNotEqualWhenKeysAreDifferent() {
        final Property mockPropertyA = mock(Property.class);
        final Property mockPropertyB = mock(Property.class);
        final Element mockElement = mock(Element.class);
        when(mockPropertyA.isPresent()).thenReturn(true);
        when(mockPropertyB.isPresent()).thenReturn(true);
        when(mockPropertyA.element()).thenReturn(mockElement);
        when(mockPropertyB.element()).thenReturn(mockElement);
        when(mockPropertyA.key()).thenReturn("k");
View Full Code Here

    @Test
    public void shouldDeterminePropertiesAreNotEqualWhenValuesAreDifferent() {
        final Property mockPropertyA = mock(Property.class);
        final Property mockPropertyB = mock(Property.class);
        final Element mockElement = mock(Element.class);
        when(mockPropertyA.isPresent()).thenReturn(true);
        when(mockPropertyB.isPresent()).thenReturn(true);
        when(mockPropertyA.element()).thenReturn(mockElement);
        when(mockPropertyB.element()).thenReturn(mockElement);
        when(mockPropertyA.key()).thenReturn("k");
View Full Code Here

        if (engine.equals(TraversalEngine.STANDARD))
            return;

        final StartStep<Element> startStep = (StartStep) TraversalHelper.getStart(traversal);
        if (startStep.startAssignableTo(Vertex.class, Edge.class)) {
            final Element element = ((StartStep<?>) startStep).getStart();
            final String label = startStep.getLabel();
            TraversalHelper.removeStep(startStep, traversal);
            if (TraversalHelper.isLabeled(label)) {
                final Step identityStep = new IdentityStep(traversal);
                identityStep.setLabel(label);
                TraversalHelper.insertStep(identityStep, 0, traversal);
            }
            TraversalHelper.insertStep(new HasStep(traversal, new HasContainer(T.id, Compare.eq, element.id())), 0, traversal);
            TraversalHelper.insertStep(new TinkerGraphStep<>(traversal, element.getClass()), 0, traversal);
        }
    }
View Full Code Here

        return this.baseProperty.isPresent();
    }

    @Override
    public Element element() {
        final Element baseElement = this.baseProperty.element();
        return (baseElement instanceof Vertex ? new StrategyWrappedVertex((Vertex) baseElement, strategyWrappedGraph) :
                new StrategyWrappedEdge((Edge) baseElement, strategyWrappedGraph));
    }
View Full Code Here

    public IntervalStep(final Traversal traversal, final HasContainer startContainer, final HasContainer endContainer) {
        super(traversal);
        this.startContainer = startContainer;
        this.endContainer = endContainer;
        this.setPredicate(traverser -> {
            final Element element = traverser.get();
            return startContainer.test(element) && endContainer.test(element);
        });
    }
View Full Code Here

        }
        this.low = low;
        this.high = high;

        this.setPredicate(traverser -> {
            Element previousElement = null;
            final Element element = traverser.get();
            if (element instanceof Edge) {
                if (this.direction.equals(Direction.BOTH)) {
                    final List<Object> objects = traverser.path().objects();
                    for (int i = objects.size() - 2; i >= 0; i--) {
                        if (objects.get(i) instanceof Vertex) {
View Full Code Here

    private DetachedProperty(final Property property) {
        if (null == property) throw Graph.Exceptions.argumentCanNotBeNull("property");

        this.key = property.isHidden() ? Graph.Key.hide(property.key()) : property.key();
        this.value = (V) property.value();
        final Element element = property.element();

        if (element instanceof Vertex)
            this.element = DetachedVertex.detach((Vertex) element);
        else if (element instanceof VertexProperty)
            this.element = DetachedVertexProperty.detach((VertexProperty) element);
View Full Code Here

        return this.element.id.hashCode() + this.key.hashCode() + this.value.hashCode();
    }

    @Override
    public Property<V> attach(final Vertex hostVertex) {
        final Element hostElement = (Element) ((DetachedElement) this.element()).attach(hostVertex);
        final Property<V> property = hostElement.property(this.isHidden() ? Graph.Key.hide(this.key) : this.key);
        if (property.isPresent()) // && property.value().equals(this.value))
            return property;
        else
            throw new IllegalStateException("The detached property could not be be found at the provided vertex: " + this);
    }
View Full Code Here

TOP

Related Classes of com.tinkerpop.gremlin.structure.Element$Iterators

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.