本文整理汇总了Java中net.ssehub.easy.varModel.model.values.EnumValue类的典型用法代码示例。如果您正苦于以下问题:Java EnumValue类的具体用法?Java EnumValue怎么用?Java EnumValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnumValue类属于net.ssehub.easy.varModel.model.values包,在下文中一共展示了EnumValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isRuntimeEnact
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
/**
* Returns whether the given variable has runtime enact as binding time.
*
* @param var the variable to test
* @return <code>true</code> for runtime-enact, <code>false</code> else
*/
private boolean isRuntimeEnact(IDecisionVariable var) {
boolean result = false;
for (int a = 0; a < var.getAttributesCount(); a++) {
IDecisionVariable attribute = var.getAttribute(a);
AbstractVariable decl = attribute.getDeclaration();
if (QmConstants.ANNOTATION_BINDING_TIME.equals(decl.getName())) {
Value val = attribute.getValue();
if (val instanceof EnumValue) {
EnumValue eVal = (EnumValue) val;
if (eVal.getValue().getName().equals(QmConstants.CONST_BINDING_TIME_RUNTIME_ENACT)) {
result = true;
}
}
}
}
return result;
}
示例2: isRelevantVariable
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
@Override
protected boolean isRelevantVariable(IDecisionVariable var) {
boolean found = false;
if (null != var) {
for (int a = 0; !found && a < var.getAttributesCount(); a++) {
IDecisionVariable attribute = var.getAttribute(a);
AbstractVariable decl = attribute.getDeclaration();
if (QmConstants.ANNOTATION_BINDING_TIME.equals(decl.getName())) {
Value val = attribute.getValue();
if (val instanceof EnumValue) {
EnumValue eVal = (EnumValue) val;
found = (eVal.getValue().getName().startsWith("runtime"));
}
}
}
found = found && isActive(var, state, pipStatus);
}
return found;
}
示例3: isRuntimeVariable
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
/**
* Checks whether the given declaration is a runtime variable.
* @param config The configuration where the declaration belongs to.
* @param declaration The declaration to test.
* @return <tt>true</tt> if the variable is a runtime variable and should not be frozen, <tt>false</tt> else.
*/
private boolean isRuntimeVariable(Configuration config, DecisionVariableDeclaration declaration) {
boolean isRuntimeVar = false;
if (null != config) {
IDecisionVariable var = config.getDecision(declaration);
IDecisionVariable annotationVar = null;
for (int i = 0, end = var.getAttributesCount(); i < end && null == annotationVar; i++) {
IDecisionVariable tmpVar = var.getAttribute(i);
if (QmConstants.ANNOTATION_BINDING_TIME.equals(tmpVar.getDeclaration().getName())) {
annotationVar = tmpVar;
}
}
if (null != annotationVar && null != annotationVar.getValue()
&& annotationVar.getValue() instanceof EnumValue) {
EnumLiteral selectedLiteral = ((EnumValue) annotationVar.getValue()).getValue();
isRuntimeVar = selectedLiteral.getOrdinal() >= RUNTIME_LEVEL;
}
}
return isRuntimeVar;
}
示例4: assertEquals
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
/**
* Asserts equality between an expected enum value and an actual IVML value.
*
* @param expected the expected value
* @param actual the actual evaluation result
*/
static final void assertEquals(EnumLiteral expected, EvaluationAccessor actual) {
Value val;
if (null != actual) {
val = actual.getValue();
actual.release();
} else {
val = null;
}
if (null != expected && val instanceof EnumValue) {
Assert.assertEquals(expected, ((EnumValue) val).getValue());
} else if (null == expected && null == actual) {
Assert.assertTrue(true); // useless, I know
} else {
Assert.fail("expected " + expected + " is not equal to " + actual);
}
}
示例5: visitEnumValue
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
@Override
public void visitEnumValue(EnumValue value) {
Enum copiedType = (Enum) copyier.getTranslatedType(value.getType());
if (null != copiedType) {
EnumLiteral lit = copiedType.get(value.getValue().getName());
try {
result = ValueFactory.createValue(copiedType, lit);
} catch (ValueDoesNotMatchTypeException e) {
// May happen if not all elements are translated so far
result = value;
complete = false;
}
} else {
result = value;
complete = false;
}
}
示例6: visitEnumValue
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
@Override
public void visitEnumValue(EnumValue value) {
if (this.visitingNonNested) {
if (visitingConatinerValue) {
this.value += "new Integer(" + value.getValue().getOrdinal() + ")";
} else {
this.declaration += " = " + value.getValue().getOrdinal();
}
} else if (visitingNested) {
this.compDeclaration += " = " + value.getValue().getOrdinal();
} else if (visitingConfiguration) {
this.value += value.getValue().getOrdinal();
}
}
示例7: isRuntimeVariable
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
/**
* Checks whether the given declaration is a runtime variable.
* @param config The configuration where the declaration belongs to.
* @param declaration The declaration to test.
* @return <tt>true</tt> if the variable is a runtime variable and should not be frozen, <tt>false</tt> else.
*/
private boolean isRuntimeVariable(Configuration config, DecisionVariableDeclaration declaration) {
boolean isRuntimeVar = false;
IDecisionVariable var = config.getDecision(declaration);
IDecisionVariable annotationVar = null;
for (int i = 0, end = var.getAttributesCount(); i < end && null == annotationVar; i++) {
IDecisionVariable tmpVar = var.getAttribute(i);
if (ANNOTATION_BINDING_TIME.equals(tmpVar.getDeclaration().getName())) {
annotationVar = tmpVar;
}
}
if (null != annotationVar && null != annotationVar.getValue()
&& annotationVar.getValue() instanceof EnumValue) {
EnumLiteral selectedLiteral = ((EnumValue) annotationVar.getValue()).getValue();
isRuntimeVar = selectedLiteral.getOrdinal() >= RUNTIME_LEVEL;
}
return isRuntimeVar;
}
示例8: visitEnumValue
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
@Override
public void visitEnumValue(EnumValue value) {
Assert.assertTrue(decl.getValue()
instanceof net.ssehub.easy.instantiation.core.model.vilTypes.configuration.EnumValue);
Assert.assertNotNull(decl.getEnumValue());
Assert.assertTrue(decl.getEnumValue().equals(decl.getValue())); // may be two different instances
Assert.assertEquals(value.getValue().getName(), decl.getEnumValue().getName());
}
示例9: visitEnumType
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
@Override
public void visitEnumType(Enum enumType) {
variableName.append(variable.getDeclaration().getName());
EnumValue enumValue = (EnumValue) variable.getValue();
if (null != enumValue) {
values.add(new VelocityContextItem(variableName.toString(), enumValue.getValue().getName()));
}
}
示例10: customDataTypes
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
/**
* tests the CustomDataTypes.
* @throws ValueDoesNotMatchTypeException .
*/
@Test
public void customDataTypes() throws ValueDoesNotMatchTypeException {
//EnumValue
Enum en = new Enum("enum", project, "Lit1", "Lit2");
EnumValue enV = (EnumValue) ValueFactory.createValue(en, "Lit1", "a", "Lit2", "b");
Assert.assertTrue(enV.isConfigured());
}
示例11: evaluate
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
public EvaluationAccessor evaluate(EvaluationAccessor operand, EvaluationAccessor[] arguments) {
EvaluationAccessor result = null;
Value val = operand.getValue();
if (val instanceof EnumValue) {
EnumValue eVal = (EnumValue) val;
EnumLiteral lit = eVal.getValue();
try {
Value res = ValueFactory.createValue(IntegerType.TYPE, lit.getOrdinal());
result = ConstantAccessor.POOL.getInstance().bind(res, operand.getContext());
} catch (ValueDoesNotMatchTypeException e) {
// result -> null
}
}
return result;
}
示例12: visitEnumValue
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
@Override
public void visitEnumValue(EnumValue value) {
appendOutput(IvmlDatatypeVisitor.getUniqueType(value.getType()));
if (considerOclCompliance()) {
appendOutput(NAMESPACE_SEPARATOR);
} else {
appendOutput(ENUM_ACCESS);
}
appendOutput(value.getValue().getName());
}
示例13: toString
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
/**
* Turns a <code>value</code> into a string. Do not directly print a
* Value.
*
* @param value the value to be converted
* @return the textual representation
*/
public static String toString(Value value) {
// may require an own visitor here in future...
String result = StringProvider.toIvmlString(value);
if (value instanceof EnumValue) {
// cut qualified IVML name as this is not recognized by the ValueFactory
int pos = result.lastIndexOf('.');
if (pos > 0) {
result = result.substring(pos + 1);
}
}
return result;
}
示例14: visitConstantValue
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
@Override
public void visitConstantValue(ConstantValue value) {
if (value.getConstantValue() instanceof MetaTypeValue) {
this.visitMetaTypeValue((MetaTypeValue) value.getConstantValue());
} else if (value.getConstantValue() instanceof StringValue) {
innerlogic += " \"" + value.getConstantValue().getValue() + "\" ";
} else if (value.getConstantValue() instanceof EnumValue) {
EnumValue ev = (EnumValue) value.getConstantValue();
innerlogic += " " + ev.getValue().getOrdinal() + " ";
} else {
innerlogic += " " + value.getConstantValue().getValue() + " ";
}
}
示例15: visitEnumValue
import net.ssehub.easy.varModel.model.values.EnumValue; //导入依赖的package包/类
@Override
public void visitEnumValue(EnumValue value) {
if (modificationConstraint) {
modification += value.getValue().getOrdinal();
} else {
constraint += value.getValue().getOrdinal();
}
}