本文整理汇总了Java中net.ssehub.easy.varModel.cst.OCLFeatureCall.getOperation方法的典型用法代码示例。如果您正苦于以下问题:Java OCLFeatureCall.getOperation方法的具体用法?Java OCLFeatureCall.getOperation怎么用?Java OCLFeatureCall.getOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.ssehub.easy.varModel.cst.OCLFeatureCall
的用法示例。
在下文中一共展示了OCLFeatureCall.getOperation方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
// TODO consider re-assignments of constraint variables
String op = call.getOperation();
ConstraintSyntaxTree operand = call.getOperand();
if (OclKeyWords.IS_DEFINED.equals(op)) {
nextVarIsMandatory = true;
operand.accept(this);
nextVarIsMandatory = false;
} else if (!OclKeyWords.ASSIGNMENT.equals(op) && null != operand) {
// Most assignments should not be considered
operand.accept(this);
for (int i = 0; i < call.getParameterCount(); i++) {
call.getParameter(i).accept(this);
}
}
}
示例2: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
if (null != call.getOperand()) { // user defined function!
call.getOperand().accept(this);
}
String op = call.getOperation();
if (OclKeyWords.INDEX_ACCESS.equals(op) || OclKeyWords.AT.equals(op)) {
// Index based access to elements of a container
parents.addFirst(lastVariable);
for (int i = 0; i < call.getParameterCount(); i++) {
call.getParameter(i).accept(this);
}
parents.removeFirst();
} else {
for (int i = 0; i < call.getParameterCount(); i++) {
call.getParameter(i).accept(this);
}
}
}
示例3: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
this.innerlogic += "( ";
String op = call.getOperation();
if (DroolsOperations.isImplicitOperation(op)) {
call.getOperand().accept(this);
this.innerlogic += " " + DroolsOperations.getDroolsOperation(op) + " ";
call.getParameter(0).accept(this);
} else {
innerlogic += op;
innerlogic += "(";
call.getOperand().accept(this);
innerlogic += " , ";
call.getParameter(0).accept(this);
innerlogic += ")";
}
innerlogic += ")";
}
示例4: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
String op = call.getOperation();
currentOperation = op;
int result = getCalltype(call);
switch (result) {
case 0:
variableStatusChecker = "dList.contains";
call.getOperand().accept(this);
this.modificationConstraint = true;
rhsIndicator++;
for (int i = 0; i < call.getParameterCount(); i++) {
call.getParameter(i).accept(this);
}
break;
case 1:
notModificationRule(call, op);
break;
default:
logger.info("");
break;
}
}
示例5: notModificationRule
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
/**
* Method to process where there is no modification, i.e. Pure hard constraints or validations.
* @param call OCL Call.
* @param operation Operation.
*/
private void notModificationRule(OCLFeatureCall call, String operation) {
// Check this in future.
// To mitigate the problem with equalities involving reals, ocl calls are rewritten
// as not(unequals - expression)
OCLFeatureCall callA = call;
if (!modificationConstraint) {
callA = processEqualityCall(call, operation, callA);
} else {
if (this.mvelModeIndicator != 0) {
callA = processEqualityCall(call, operation, callA);
}
}
operation = callA.getOperation();
if (DroolsOperations.isImplicitOperation(operation)) {
doJavaSyntax(callA, operation);
} else {
if (!DroolsOperations.isOperationSupported(operation)) {
ruleSupported = false;
}
doLispSyntax(callA, operation);
}
}
示例6: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
String op = call.getOperation();
currentOp = op;
int result = getCalltype(call);
switch (result) {
case 0:
variableStatusChecker = "dList.contains";
call.getOperand().accept(this);
this.modificationConstraint = true;
rhsIndicator++;
for (int i = 0; i < call.getParameterCount(); i++) {
call.getParameter(i).accept(this);
}
break;
case 1:
notModificationRule(call, op);
break;
default:
logger.info("");
break;
}
}
示例7: notModificationRule
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
/**
* Method to process which do not have any constraints plus modifications.
* @param call Ocl call.
* @param op Operation.
*/
private void notModificationRule(OCLFeatureCall call, String op) {
// Check this in future.
// To mitigate the problem with equalities involving reals, ocl calls are rewritten
// as not(unequals - expression)
OCLFeatureCall callA = call;
if (!modificationConstraint) {
callA = processEqualityCall(call, op, callA);
}
op = callA.getOperation();
if (DroolsOperations.isImplicitOperation(op)) {
doJavaSyntax(callA, op);
} else {
if (!DroolsOperations.isOperationSupported(op)) {
ruleSupported = false;
}
doLispSyntax(callA, op);
}
}
示例8: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
this.innerlogic += "( ";
String op = call.getOperation();
if (DroolsOperations.isImplicitOperation(op)) {
call.getOperand().accept(this);
this.innerlogic += " " + DroolsOperations.getDroolsOperation(op) + " ";
call.getParameter(0).accept(this);
} else {
innerlogic += op;
innerlogic += "(";
call.getOperand().accept(this);
innerlogic += " , ";
call.getParameter(0).accept(this);
innerlogic += ")";
}
innerlogic += ")";
}
示例9: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
this.innerlogic += "( ";
String op = call.getOperation();
if (DroolsOperations.isImplicitOperation(op)) {
call.getOperand().accept(this);
this.innerlogic += " " + DroolsOperations.getDroolsOperation(op) + " ";
call.getParameter(0).accept(this);
} else {
innerlogic += DroolsOperations.getDroolsOperation(op);
innerlogic += "(";
call.getOperand().accept(this);
innerlogic += " , ";
call.getParameter(0).accept(this);
innerlogic += ")";
}
innerlogic += ")";
}
示例10: getCalltype
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
/**
* Method to identify the type of constraint.
* @param call OCL call.
* @return 0 if it is a soft constraint, 1 if it is a hard constraint.
*/
private int getCalltype(OCLFeatureCall call) {
int result = 0;
String op = call.getOperation();
boolean operationIsImplies = op.equals(OclKeyWords.IMPLIES);
int params = call.getParameterCount();
if (operationIsImplies && rhsIndicator == 0 && (params == 1)
&& call.getParameter(0).getClass().equals(call.getClass())) {
OCLFeatureCall temp = (OCLFeatureCall) call.getParameter(0);
boolean operationisEquals = temp.getOperation().equals(OclKeyWords.EQUALS);
if (operationisEquals && (ruleCounter == 0)
&& (temp.getOperand() instanceof Variable)) {
result = 0;
} else if (temp.getOperation().equals(OclKeyWords.EQUALS) && (ruleCounter == 0)
&& (temp.getOperand() instanceof CompoundAccess)) {
result = 0;
} else {
rhsIndicator++;
result = 1;
}
} else if (operationIsImplies && (rhsIndicator == 0)
&& (call.getParameter(0) instanceof Parenthesis)) {
rhsIndicator++;
result = 1;
// call1.accept(this);
} else {
rhsIndicator++;
result = 1;
}
return result;
}
示例11: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
currentOperation = call.getOperation();
call.getOperand().accept(this);
for (int i = 0; i < call.getParameterCount(); i++) {
call.getParameter(i).accept(this);
}
}
示例12: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
super.visitOclFeatureCall(call);
EvaluationAccessor result = getResultAccessor(true);
EvaluationAccessor operand = null;
EvaluationAccessor[] parameter = new EvaluationAccessor[call.getParameterCount()];
int startRelSize = relevant.size(); // initial size before evaluating operand
allowUpdateRelevant = true;
if (null != call.getOperand()) {
call.getOperand().accept(this);
operand = getResultAccessor(true);
}
int opRelSize = relevant.size(); // may change while evaluating operand
for (int p = 0; p < call.getParameterCount(); p++) {
call.getParameter(p).accept(this);
parameter[p] = getResultAccessor(true);
}
allowUpdateRelevant = false;
ConstraintSyntaxTree[] cst = getFailedExpression();
// this is just a very limited form of analysis - just for the beginning
if (null != cst && contains(cst, call) && 1 == parameter.length) {
int startIndex;
int endIndex;
boolean operandRelevant;
if (startRelSize < opRelSize) {
operandRelevant = true; // there was a relevant variable while evaluating operand
startIndex = startRelSize;
endIndex = opRelSize - 1;
} else {
operandRelevant = false;
startIndex = opRelSize;
endIndex = relevant.size() - 1;
}
Double op = toDouble(operand);
Double param = toDouble(parameter[0]);
Double deviation = null;
Double deviationPercentage = null;
String opName = call.getOperation();
if (null != op && null != param) {
if (oclOp1ParamDeviation.contains(opName)) {
if (operandRelevant) {
deviation = param - op;
deviationPercentage = deviation / op;
} else {
deviation = op - param;
deviationPercentage = deviation / param;
}
}
}
for (int r = startIndex; r <= endIndex; r++) {
IDecisionVariable var = relevant.get(r);
addViolatingInstance(createViolationInstance(var, opName, deviation, deviationPercentage));
}
}
release(operand);
for (int p = 0; p < parameter.length; p++) {
release(parameter[p]);
}
setResultAcessor(result); // set back original result (accessor), shall be null due to nullifying op/param
}
示例13: visitOclFeatureCall
import net.ssehub.easy.varModel.cst.OCLFeatureCall; //导入方法依赖的package包/类
@Override
public void visitOclFeatureCall(OCLFeatureCall call) {
callStack.push(call);
FormattingHint hint;
Operation resolved = call.getResolvedOperation();
if (null != resolved) {
hint = resolved.getFormattingHint();
} else {
hint = FormattingHint.FUNCTION_CALL;
}
String name = call.getOperation();
switch (hint) {
case FUNCTION_CALL:
if (OclKeyWords.INDEX_ACCESS.equals(name) && 1 == call.getParameterCount()) {
call.getOperand().accept(this);
appendOutput("[");
call.getParameter(0).accept(this);
appendOutput("]");
} else {
appendOutput(name);
appendOutput("(");
ConstraintSyntaxTree operand = call.getOperand();
if (null != operand) {
operand.accept(this);
}
if (call.getParameterCount() > 0) {
for (int p = 0; p < call.getParameterCount(); p++) {
ConstraintSyntaxTree param = call.getParameter(p);
if (null != operand || (null == operand && p > 0)) {
appendOutput(",");
}
if (null != param.getName()) {
appendOutput(WHITESPACE);
appendOutput(param.getName());
appendOutput(WHITESPACE);
appendOutput("=");
}
appendOutput(WHITESPACE);
param.accept(this);
}
}
appendOutput(")");
}
break;
case OPERATOR_INFIX:
call.getOperand().accept(this);
for (int p = 0; p < call.getParameterCount(); p++) {
appendOutput(WHITESPACE);
appendOutput(name);
appendOutput(WHITESPACE);
call.getParameter(p).accept(this);
}
break;
case OPERATOR_PREFIX:
appendOutput(name);
appendOutput(WHITESPACE);
call.getOperand().accept(this);
// it is ensured that there are no more parameters
break;
case OPERATOR_POSTFIX:
call.getOperand().accept(this);
appendOutput(name);
// it is ensured that there are no more parameters
break;
default:
// should not occur
break;
}
callStack.pop();
}