本文整理汇总了Java中org.hawk.core.model.IHawkClass类的典型用法代码示例。如果您正苦于以下问题:Java IHawkClass类的具体用法?Java IHawkClass怎么用?Java IHawkClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IHawkClass类属于org.hawk.core.model包,在下文中一共展示了IHawkClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allClassesHaveParentRef
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Test
public void allClassesHaveParentRef() {
for (IHawkObject o : r.getAllContents()) {
if (o instanceof IHawkClass) {
IHawkClass hawkClass = (IHawkClass)o;
boolean bHasPIDReference = false;
for (IHawkReference ref : hawkClass.getAllReferences()) {
if (ref.getName().equals(ModelioClass.REF_PARENT)) {
assertTrue("OID-PID reference should be a container reference", ref.isContainer());
assertFalse("OID-PID reference should not be a containment reference", ref.isContainment());
bHasPIDReference = true;
} else {
assertFalse("Other references should not be container nor containment", ref.isContainer() || ref.isContainment());
}
}
assertTrue("Class " + hawkClass.getName() + " should have an OID-PID reference", bHasPIDReference);
}
}
}
示例2: bpmnCatchEvent
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Test
public void bpmnCatchEvent() throws Exception {
ModelioModelResourceFactory factory = new ModelioModelResourceFactory();
IHawkModelResource resource = factory.parse(new DummyFileImporter(), new File(BPMNCATCH_PATH));
assertEquals(5, resource.getAllContentsSet().size());
boolean found = false;
for (IHawkObject element : resource.getAllContentsSet()) {
final IHawkClass type = (IHawkClass) element.getType();
final IHawkAttribute attrName = (IHawkAttribute)type.getStructuralFeature("Name");
if (attrName != null) {
final String name = element.get(attrName) + "";
if ("BpmnCatchEvent".equals(name)) {
assertEquals("BpmnCatchEvent should be a Class", "Class", element.getType().getName());
found = true;
}
}
}
assertTrue("The .exml file should contain a BpmnCatchEvent element", found);
}
示例3: getAllSuperTypes
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Override
public Set<IHawkClass> getAllSuperTypes() {
final Set<IHawkClass> ret = super.getAllSuperTypes();
for (ProfileApplication app : umlPackage.getProfileApplications()) {
final EAnnotation ann = app.getEAnnotation(UMLUtil.UML2_UML_PACKAGE_2_0_NS_URI);
if (ann != null) {
for (EObject ref : ann.getReferences()) {
if (ref instanceof EPackage) {
final EPackage appEPackage = (EPackage) ref;
final UMLProfile umlProfile = new UMLProfile(appEPackage, wf, null);
ret.add(umlProfile.getVirtualProfileClass());
}
}
}
}
return ret;
}
示例4: addEClasses
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
private boolean addEClasses(IHawkPackage ePackage) {
boolean success = true;
for (IHawkClassifier child : ePackage.getClasses()) {
if (!success)
break;
if (child instanceof IHawkClass) {
success = success && addMetaClass((IHawkClass) child);
} else if (child instanceof IHawkDataType) {
// FIXME need to handle datatypes?
// System.err.println("datatype! (" + child.getName() +
// ") -- handle it.");
} else {
LOGGER.error("Unknown classifier: ({}): {}", child.getName(), child.getClass());
}
}
return success;
}
示例5: expectedRootMClasses
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Test
public void expectedRootMClasses() {
final List<String> rootClasses = new ArrayList<>();
for (IHawkObject o : r.getAllContents()) {
if (o instanceof IHawkClass) {
IHawkClass hc = (IHawkClass)o;
if (hc.getAllSuperTypes().isEmpty()) {
rootClasses.add(hc.getName());
}
}
}
assertTrue("Should contain the meta type", rootClasses.contains(ModelioMetaModelResource.META_TYPE_NAME));
assertTrue("Should contain the meta type", rootClasses.contains("SmObject"));
assertEquals("There should be exactly three root ModelioClasses", 2, rootClasses.size());
}
示例6: checkModuleComponentHierarchy
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Test
public void checkModuleComponentHierarchy() {
final Set<String> names = new HashSet<>();
for (IHawkClass hc : MetamodelRegister.INSTANCE.getModelioClass("ModuleComponent", null).getAllSuperTypes()) {
names.add(hc.getName());
}
assertTrue(names.contains("AbstractProject"));
assertTrue(names.contains("ModelElement"));
assertTrue(names.contains("Element"));
assertTrue(names.contains("SmObject"));
}
示例7: getAllAttributesMap
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
public Map<String, ModelioAttribute> getAllAttributesMap() {
if (allAttributes == null) {
allAttributes = new HashMap<>();
allAttributes.putAll(getOwnAttributesMap());
for (IHawkClass cSuper : getAllSuperTypes()) {
final ModelioClass mcSuper = (ModelioClass)cSuper;
allAttributes.putAll(mcSuper.getOwnAttributesMap());
}
}
return allAttributes;
}
示例8: getAllReferencesMap
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
/**
* Returns a map with all the references in this class (own and inherited).
*/
public Map<String, ModelioReference> getAllReferencesMap() {
if (allReferences == null) {
allReferences = new HashMap<>();
allReferences.putAll(getOwnReferencesMap());
for (IHawkClass cSuper : getAllSuperTypes()) {
final ModelioClass mcSuper = (ModelioClass)cSuper;
allReferences.putAll(mcSuper.getOwnReferencesMap());
}
}
return allReferences;
}
示例9: getOwnSuperTypes
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
/**
* Returns only the direct supertypes.
*/
public Set<IHawkClass> getOwnSuperTypes() {
final Set<IHawkClass> superClasses = new HashSet<>();
for (MClass superRawClass : rawClass.getMSuperType()) {
ModelioClass superClass = mPackage.getResource().getModelioClassById(superRawClass.getId());
superClasses.add(superClass);
}
return superClasses;
}
示例10: classAddition
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Override
public void classAddition(IHawkClass cls, IGraphNode clsNode) {
if (cls instanceof ModelioClass) {
// Used to get back an EMF-compatible containment reference based on .exml PID container references
final String name = cls.getName();
modelIndexer.addDerivedAttribute(cls.getPackageNSURI(), name, ModelioClass.REF_CHILDREN,
name, true, true, false, EOLQueryEngine.TYPE,
"return self.revRefNav_hawkParent;");
}
}
示例11: classAddition
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Override
public void classAddition(IHawkClass cls, IGraphNode clsNode) {
for (IGraphChangeListener l : this) {
try {
l.classAddition(cls, clsNode);
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例12: getClassifier
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Override
public IHawkClass getClassifier(String string) {
EClassifier e = ep.getEClassifier(string);
if (e instanceof EClass) {
return wf.createClass((EClass) e);
} else {
System.err
.println("attempt to call getEClassifier(String string) on a non-eclass, debug");
return null;
}
}
示例13: getAllSuperTypes
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Override
public Set<IHawkClass> getAllSuperTypes() {
Set<IHawkClass> c = new HashSet<IHawkClass>();
for (EClass e : eClass.getEAllSuperTypes()) {
c.add(wf.createClass(e));
}
return c;
}
示例14: getAllSuperTypes
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
@Override
public Set<IHawkClass> getAllSuperTypes() {
Set<IHawkClass> c = new HashSet<IHawkClass>();
for (EClass e : eclass.getEAllSuperTypes()) {
c.add(new BPMNClass(e));
}
return c;
}
示例15: eClassNSURI
import org.hawk.core.model.IHawkClass; //导入依赖的package包/类
/**
* SLOW - ONLY USE FOR ERRORS
*
* @param node
* @return the class (kindOf) of the modelElement as a String
*/
// public String kindOfName(Node node) {
//
// String s = "";
// ArrayList<String> ar = new ArrayList<String>();
//
// Iterator<Relationship> it = node.getRelationships(Direction.OUTGOING,
// new RelationshipType() {
//
// @Override
// public String name() {
// return ModelElementNode.EDGE_LABEL_OFKIND;
// }
// }).iterator();
//
// while (it.hasNext()) {
// Node nn = it.next().getOtherNode(node);
// ar.add(nn.getProperty(GraphWrapper.IDENTIFIER_PROPERTY).toString());
// }
//
// for (String ss : ar)
// s += ss + "\n\t\t\t";
//
// return s.trim();
//
// }
// public boolean isOfType(Node node, String type) {
//
// return node.getRelationships(Direction.OUTGOING,
// new RelationshipUtil().getNewRelationshipType(ModelElementNode.EDGE_LABEL_OFTYPE))
// .iterator().next().getEndNode().getProperty(GraphWrapper.IDENTIFIER_PROPERTY).toString().equals(type);
//
// }
public static String eClassNSURI(IHawkClass e) {
// return e.getEPackage().getNsURI() + "/" +
return e.getName();
}