本文整理匯總了Java中org.eclipse.emf.ecore.EReference.getUpperBound方法的典型用法代碼示例。如果您正苦於以下問題:Java EReference.getUpperBound方法的具體用法?Java EReference.getUpperBound怎麽用?Java EReference.getUpperBound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.emf.ecore.EReference
的用法示例。
在下文中一共展示了EReference.getUpperBound方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getMultiplicity
import org.eclipse.emf.ecore.EReference; //導入方法依賴的package包/類
private String getMultiplicity(EReference eReference) {
int l = eReference.getLowerBound();
int u = eReference.getUpperBound();
if (l == 0 && u == 1)
return "lone ";
if (l == 0 && u == -1)
return "set ";
if (l == 1 && u == 1)
return "one ";
if (l == 1 && u == -1)
return "some ";
return "";
}
示例2: appendSig
import org.eclipse.emf.ecore.EReference; //導入方法依賴的package包/類
private void appendSig(String alias, EClass eClass) {
if (eClass.getName().equals(containerClassName) && ignoreContainer)
return;
// append sig trace
builder.append("-- [email protected]" + alias + "." + eClass.getName() + "\n");
EReference containerRef = getRefToContainer(eClass);
if (containerRef != null) {
String mul = getMultiplicity(containerRef);
if ("set ".equals(mul))
mul = "";
builder.append(mul);
}
// append sig
if (eClass.isAbstract()) {
builder.append("abstract sig " + eClass.getName());
} else {
builder.append("sig " + eClass.getName());
}
// extends parts
if (!eClass.getESuperTypes().isEmpty()) {
builder.append(" extends ");
}
for (Iterator<EClass> it = eClass.getESuperTypes().iterator(); it.hasNext();) {
EClass superClass = it.next();
builder.append(superClass.getName());
if (it.hasNext())
builder.append(", ");
}
builder.append(" {\n");
// relations
for (Iterator<EReference> iterator = eClass.getEReferences().iterator(); iterator.hasNext();) {
EReference eReference = iterator.next();
String sig = eReference.getEType().getName();
if (eReference.isContainment()) {
if (containmentFacts.get(sig) == null)
containmentFacts.put(sig, new ContainmentFact(sig));
containmentFacts.get(sig).addConRel(eClass.getName(), eReference.getName());
}
String multiplicity = getMultiplicity(eReference);
if (multiplicity.isEmpty()) {
multiplicity = "set ";
char c = eClass.getName().toLowerCase().charAt(0);
String fact = "all " + c + ":" + eClass.getName() + " | ";
if (eReference.getLowerBound() != -1)
fact += "#" + c + "." + eReference.getName() + " >= " + eReference.getLowerBound();
if (eReference.getUpperBound() != -1) {
fact += " and #" + c + "." + eReference.getName() + " <= " + eReference.getUpperBound();
}
facts.add(fact);
updateInt(Math.max(eReference.getLowerBound(), eReference.getUpperBound()));
}
// append trace
builder.append(
"\t-- [email protected]" + alias + "." + eClass.getName() + "." + eReference.getName() + "\n");
// append relation
builder.append(
"\t" + eReference.getName() + ": " + multiplicity + eReference.getEType().getName());
if (iterator.hasNext())
builder.append(",");
builder.append("\n");
}
builder.append("}\n\n");
}