All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tinkerpop.gremlin.giraph.structure.GiraphElement Maven / Gradle / Ivy

package com.tinkerpop.gremlin.giraph.structure;

import com.tinkerpop.gremlin.structure.Edge;
import com.tinkerpop.gremlin.structure.Element;
import com.tinkerpop.gremlin.structure.Property;
import com.tinkerpop.gremlin.structure.Vertex;
import com.tinkerpop.gremlin.structure.util.ElementHelper;
import com.tinkerpop.gremlin.tinkergraph.structure.TinkerElement;

import java.io.Serializable;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public abstract class GiraphElement implements Element, Serializable {

    protected TinkerElement tinkerElement;
    protected GiraphGraph graph;

    protected GiraphElement() {
    }

    protected GiraphElement(final TinkerElement tinkerElement, final GiraphGraph graph) {
        this.tinkerElement = tinkerElement;
        this.graph = graph;
    }

    @Override
    public Object id() {
        return this.tinkerElement.id();
    }

    @Override
    public String label() {
        return this.tinkerElement.label();
    }

    @Override
    public void remove() {
        if (this.tinkerElement instanceof Vertex)
            throw Vertex.Exceptions.vertexRemovalNotSupported();
        else
            throw Edge.Exceptions.edgeRemovalNotSupported();
    }


    @Override
    public  Property property(final String key) {
        return this.tinkerElement.property(key);
    }

    @Override
    public  Property property(final String key, final V value) {
        throw Element.Exceptions.propertyAdditionNotSupported();
    }

    @Override
    public boolean equals(final Object object) {
        return ElementHelper.areEqual(this, object);
    }

    @Override
    public int hashCode() {
        return this.tinkerElement.hashCode();
    }

    @Override
    public String toString() {
        return this.tinkerElement.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy