本文整理匯總了Java中net.ssehub.easy.varModel.cst.OCLFeatureCall.accept方法的典型用法代碼示例。如果您正苦於以下問題:Java OCLFeatureCall.accept方法的具體用法?Java OCLFeatureCall.accept怎麽用?Java OCLFeatureCall.accept使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.ssehub.easy.varModel.cst.OCLFeatureCall
的用法示例。
在下文中一共展示了OCLFeatureCall.accept方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
boolean operationIsEquals = (call.getOperation().equals(OclKeyWords.EQUALS));
boolean operationIsImplies = call.getOperation().equals(OclKeyWords.IMPLIES);
if (operationIsEquals) {
if ((call.getOperand() instanceof Variable) || (call.getOperand() instanceof CompoundAccess)) {
// logger.info("This constraint needs to be there.");
acceptConstraint = true;
}
} else if (operationIsImplies) {
if (call.getParameter(0).getClass().equals(call.getClass())) {
OCLFeatureCall temp = (OCLFeatureCall) call.getParameter(0);
if (temp.getOperation().equals(OclKeyWords.EQUALS)) {
// logger.info("this should also be included.");
acceptConstraint = true;
}
} else if (call.getParameter(0) instanceof Parenthesis) {
OCLFeatureCall temp2 = new OCLFeatureCall(call.getOperand(), OclKeyWords.IMPLIES,
((Parenthesis) call.getParameter(0)).getExpr());
temp2.accept(this);
}
}
}
示例2: preprocessProjectElements
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
/**
* Method to process declarations.
* This is where the required optimization takes place.
* The aim is to use the declarations that have constraints.
* The rest are ignored as they speed up the reasoning process.
* @param project Project.
*/
private void preprocessProjectElements(Project project) {
DroolsVariablesPreProcessor processor = new DroolsVariablesPreProcessor();
for (int i = 0; i < project.getImportsCount(); i++) {
ProjectImport tempProjectImport = project.getImport(i);
preprocessProjectElements(tempProjectImport.getResolved());
}
for (int i = 0; i < project.getElementCount(); i++) {
if (project.getElement(i) instanceof Constraint) {
Constraint cons = (Constraint) project.getElement(i);
cons.getConsSyntax().accept(processor);
}
if (project.getElement(i) instanceof DecisionVariableDeclaration) {
DecisionVariableDeclaration decl = (DecisionVariableDeclaration) project.getElement(i);
if (decl.getDefaultValue() != null) {
ConstraintSyntaxTree call = (ConstraintSyntaxTree) decl.getDefaultValue();
Variable var = new Variable(decl);
OCLFeatureCall valueCall = new OCLFeatureCall(var, OclKeyWords.EQUALS, call);
valueCall.accept(processor);
}
}
if (project.getElement(i) instanceof AttributeAssignment) {
processor.visitAttributeAssignment((AttributeAssignment) project.getElement(i));
}
}
if (optimizationType.equals(OptimizationType.INTERMEDIATE)) {
for (int i = 0; i < project.getInternalConstraintCount(); i++) {
project.getInternalConstraint(i).getConsSyntax().accept(processor);
}
}
}
示例3: visitDecisionVariableDeclaration
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //導入方法依賴的package包/類
@Override
public void visitDecisionVariableDeclaration(DecisionVariableDeclaration decl) {
this.visitingNonNested = true;
String name = decl.getName();
if (declarationToBeUpdated) {
this.variableMap.put(name, decl.getType());
}
this.declaration = name;
declaration += " : ";
performOptimization(decl);
/**
* if a Declaration. is a compound type and any of its nested elements have default values,
* then "Declaration.NestedElement" is added to the drools dList.
*/
if (decl.getType().getTypeClass().equals(Compound.class)) {
processCompoundTypeDeclaration(decl);
}
if (decl.getDefaultValue() instanceof ConstraintSyntaxTree
&& !(decl.getDefaultValue() instanceof ConstantValue)) {
ConstraintSyntaxTree call = (ConstraintSyntaxTree) decl.getDefaultValue();
Variable var = new Variable(decl);
OCLFeatureCall valueCall = new OCLFeatureCall(var, OclKeyWords.ASSIGNMENT, call);
valueCall.accept(this);
configuredByDefaultList.add(decl.getName());
} else if (null != decl.getDefaultValue() && !(decl.getType() instanceof Container)) {
dList.add(name);
if (!(decl.getType() instanceof Compound)) {
decl.getDefaultValue().accept(this);
} else {
visitingNonNested = false; visitingConfiguration = true;
decl.getDefaultValue().accept(this);
configMap.put(name, value);
this.value = "";
variablesAssigned.add(name);
}
configuredByDefaultList.add(decl.getName());
}
if (decl.getType().getTypeClass().equals(Reference.class) && !isBasicType(decl.getType().getName())) {
String typ = decl.getType().getName();
String val = " new " + typ + "()";
configMap.put(decl.getName(), val);
}
declaration += "\n";
this.dVariables.add(name);
if (droolsClassMap.containsKey(name)) {
this.decisionVariables.add(declaration);
}
declaration = "";
visitingNonNested = false;
value = "";
if (decl.getType().getTypeClass().equals(Compound.class)) {
Compound c = (Compound) decl.getType();
for (int i = 0; i < c.getElementCount(); i++) {
if (nestedDefaults.contains(c.getElement(i).getName())) {
dList.add(name + "." + c.getElement(i));
}
}
}
visitDecisionVariableDeclarationAttributes(decl);
}