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 java.io.Serializable;
import java.util.Map;

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

    protected Element element;
    protected GiraphGraph graph;

    protected GiraphElement() {
    }

    protected GiraphElement(final Element element, final GiraphGraph graph) {
        this.element = element;
        this.graph = graph;
    }

    public Object id() {
        return this.element.id();
    }

    public String label() {
        return this.element.label();
    }

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

    public Map properties() {
        return this.element.properties();
    }

    public Map hiddens() {
        return this.element.hiddens();
    }

    public  Property property(final String key) {
        return this.element.property(key);
    }

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

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

    public int hashCode() {
        return this.element.hashCode();
    }

    public String toString() {
        return this.element.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy