org.umlg.testocl.meta.OclTest1Meta Maven / Gradle / Ivy
package org.umlg.testocl.meta;
import java.util.Iterator;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.umlg.runtime.adaptor.UMLG;
import org.umlg.runtime.adaptor.UmlgLabelConverterFactory;
import org.umlg.runtime.domain.BaseMetaNode;
import org.umlg.runtime.domain.UmlgMetaNode;
public class OclTest1Meta extends BaseMetaNode implements UmlgMetaNode {
/**
* constructor for OclTest1Meta
*
* @param vertex
*/
public OclTest1Meta(Vertex vertex) {
this.vertex= vertex;
}
/**
* default constructor for OclTest1Meta
*/
public OclTest1Meta() {
this.vertex = UMLG.get().addVertex(this.getClass().getName());
this.vertex.property("className", getClass().getName());
defaultCreate();
UMLG.get().getRoot().addEdge(getEdgeToRootLabel(), this.vertex);
}
@Override
public void defaultCreate() {
getUid();
}
public String getEdgeToRootLabel() {
return UmlgLabelConverterFactory.getUmlgLabelConverter().convert("rootOclTest1Meta");
}
synchronized static public OclTest1Meta getInstance() {
OclTest1Meta result;
Iterator iter = UMLG.get().getRoot().edges(Direction.OUT, UmlgLabelConverterFactory.getUmlgLabelConverter().convert("rootOclTest1Meta"));
if ( iter.hasNext() ) {
result = new OclTest1Meta(iter.next().inVertex());
} else {
iter = UMLG.get().getRoot().edges(Direction.OUT, UmlgLabelConverterFactory.getUmlgLabelConverter().convert("rootOclTest1Meta"));
if ( !iter.hasNext() ) {
result = new OclTest1Meta();
} else {
result = new OclTest1Meta(iter.next().inVertex());
}
}
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy