当前位置: 首页>>代码示例>>Java>>正文


Java BooleanValue.TRUE属性代码示例

本文整理汇总了Java中net.ssehub.easy.varModel.model.values.BooleanValue.TRUE属性的典型用法代码示例。如果您正苦于以下问题:Java BooleanValue.TRUE属性的具体用法?Java BooleanValue.TRUE怎么用?Java BooleanValue.TRUE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.ssehub.easy.varModel.model.values.BooleanValue的用法示例。


在下文中一共展示了BooleanValue.TRUE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertSpecialBooleanOperations

/**
 * Tests all nine possible situations of an binary boolean operation.
 * It will test:
 * <ol>
 * <li><tt>undef OPERATION false</tt></li>
 * <li><tt>undef OPERATION true</tt></li>
 * <li><tt>undef OPERATION undef</tt></li>
 * <li><tt>false OPERATION false</tt></li>
 * <li><tt>false OPERATION true</tt></li>
 * <li><tt>false OPERATION undef</tt></li>
 * <li><tt>true OPERATION false</tt></li>
 * <li><tt>true OPERATION true</tt></li>
 * <li><tt>true OPERATION undef</tt></li>
 * </ol>
 * @param operation One of {@link OclKeyWords#AND} or {@link OclKeyWords#OR}.
 * @param expectedValues The expected values for the given list above, should bean arrays with length = 9.
 *     If expected that the {@link EvaluationVisitor} is not able to resolve the operation, add <tt>null</tt> to
 *     the specific position of the array.
 * @see #testSpecialBooleanOperartions()
 */
private void assertSpecialBooleanOperations(String operation, Boolean[] expectedValues) {
    DecisionVariableDeclaration unDefVar = new DecisionVariableDeclaration("unDefVar", BooleanType.TYPE, project);
    project.add(unDefVar);
    Configuration config = new Configuration(project);
    EvaluationVisitor evaluator = new EvaluationVisitor(config, null, false, null);
    
    Variable nullVar = new Variable(unDefVar);
    ConstantValue constFalseVal = new ConstantValue(BooleanValue.FALSE);
    ConstantValue constTrueVal = new ConstantValue(BooleanValue.TRUE);
    
    // All nine possible constraints
    assertSpecialOperation(nullVar, operation, constFalseVal, expectedValues[0], evaluator);
    assertSpecialOperation(nullVar, operation, constTrueVal, expectedValues[1], evaluator);
    assertSpecialOperation(nullVar, operation, nullVar, expectedValues[2], evaluator);
    assertSpecialOperation(constFalseVal, operation, constFalseVal, expectedValues[3], evaluator);
    assertSpecialOperation(constFalseVal, operation, constTrueVal, expectedValues[4], evaluator);
    assertSpecialOperation(constFalseVal, operation, nullVar, expectedValues[5], evaluator);
    assertSpecialOperation(constTrueVal, operation, constFalseVal, expectedValues[6], evaluator);
    assertSpecialOperation(constTrueVal, operation, constTrueVal, expectedValues[7], evaluator);
    assertSpecialOperation(constTrueVal, operation, nullVar, expectedValues[8], evaluator);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:41,代码来源:EvaluationVisitorTest.java

示例2: testCopyDerivedType

/**
 * Tests whether a simple {@link DerivedDatatype} without any dependencies can be copied.
 * @throws CSTSemanticException If <tt>true</tt>  cannot be created as constraint for a boolean type
 */
@Test
public void testCopyDerivedType() throws CSTSemanticException {
    Project original = new Project("testCopyDerivedType");
    IDatatype basisType = BooleanType.TYPE;
    DerivedDatatype dType = new DerivedDatatype("posType", basisType, original);
    Constraint constraint = new Constraint(dType);
    OCLFeatureCall equality = new OCLFeatureCall(new Variable(dType.getTypeDeclaration()), OclKeyWords.EQUALS,
            new ConstantValue(BooleanValue.TRUE));
    constraint.setConsSyntax(equality);
    dType.setConstraints(new Constraint[] {constraint});
    original.add(dType);
    
    java.util.Set<Project> copiedProjects = new HashSet<Project>();
    Project copy = copyProject(original, copiedProjects);
    DerivedDatatype copiedType = (DerivedDatatype) copy.getElement(0);
    assertDerivedType(dType, copiedType, copy, copiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:ProjectCopyVisitorTest.java

示例3: testSimpleOperationCopy

/**
 * Tests whether a simple {@link OperationDefinition}, without any dependencies, can be copied.
 * Tests also that {@link ExplicitTypeVariableDeclaration}s can be copied (as they may be used inside of
 * {@link OperationDefinition}s but not elsewhere.
 */
@Test
public void testSimpleOperationCopy() {
    Project original = new Project("testSimpleOperationCopy");
    OperationDefinition operation = new OperationDefinition(original);
    ExplicitTypeVariableDeclaration parameterDecl = new ExplicitTypeVariableDeclaration("param1", RealType.TYPE,
        operation);
    ConstantValue constTrueFunc = new ConstantValue(BooleanValue.TRUE);
    CustomOperation func = new CustomOperation(BooleanType.TYPE, "returnsTrue", original.getType(), constTrueFunc,
        new DecisionVariableDeclaration[] {parameterDecl});
    operation.setOperation(func);
    original.add(operation);
    
    Project copy = copyProject(original);
    OperationDefinition copiedOp = (OperationDefinition) copy.getElement(0);
    assertUserOperation(operation, copiedOp, copy);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:ProjectCopyVisitorTest.java

示例4: testOperationDependingCompletely

/**
 * Tests whether a {@link OperationDefinition} can be copied, which depends on an unresolved type.
 */
@Test
public void testOperationDependingCompletely() {
    Project original = new Project("testOperationDependingCompletely");
    DerivedDatatype aliasType = new DerivedDatatype("boolAlias", BooleanType.TYPE, original);
    OperationDefinition operation = new OperationDefinition(original);
    ExplicitTypeVariableDeclaration parameterDecl = new ExplicitTypeVariableDeclaration("param1", aliasType,
        operation);
    ConstantValue constTrueFunc = new ConstantValue(BooleanValue.TRUE);
    CustomOperation func = new CustomOperation(aliasType, "returnsTrue", original.getType(), constTrueFunc,
        new DecisionVariableDeclaration[] {parameterDecl});
    operation.setOperation(func);
    original.add(operation);
    original.add(aliasType);
    
    Project copy = copyProject(original);
    // Attention: Ordering has changed!
    OperationDefinition copiedOp = (OperationDefinition) copy.getElement(1);
    assertUserOperation(operation, copiedOp, copy);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:ProjectCopyVisitorTest.java

示例5: testFreezeBlockKnownDeclarationSimpleBut

/**
 * Tests copying a {@link FreezeBlock}. It tests:
 * <ul>
 *   <li>A known declaration</li>
 *   <li>Simple but block (constant expression)</li>
 * </ul>
 */
@Test
public void testFreezeBlockKnownDeclarationSimpleBut() {
    Project orgProject = new Project("testFreezeBlockKnownDeclarationSimpleBut");
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("decl", RealType.TYPE, orgProject);
    orgProject.add(decl);
    DecisionVariableDeclaration itrDecl = new DecisionVariableDeclaration("i", BooleanType.TYPE, orgProject);
    ConstantValue trueExpr = new ConstantValue(BooleanValue.TRUE);
    FreezeBlock freeze = new FreezeBlock(new IFreezable[] {decl}, itrDecl, trueExpr, orgProject);
    orgProject.add(freeze);
    
    java.util.Set<Project> allCopiedProjects = new HashSet<Project>();
    Project copiedProject = copyProject(orgProject, allCopiedProjects);
    // Attention: Ordering has changed
    FreezeBlock copiedBlock = (FreezeBlock) copiedProject.getElement(1);
    assertFreezeBlock(freeze, copiedBlock, copiedProject, allCopiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:ProjectCopyVisitorTest.java

示例6: testFreezeBlockKnownDeclarationAnnotationBut

/**
 * Tests copying a {@link FreezeBlock}. It tests:
 * <ul>
 *   <li>A known declaration</li>
 *   <li>But expression on annotation</li>
 * </ul>
 */
@Test
public void testFreezeBlockKnownDeclarationAnnotationBut() {
    Project orgProject = new Project("testFreezeBlockKnownDeclarationAnnotationBut");
    Attribute annoDecl = new Attribute("anno", BooleanType.TYPE, orgProject, orgProject);
    orgProject.add(annoDecl);
    orgProject.attribute(annoDecl);
    Compound cType = new Compound("CP", orgProject);
    DecisionVariableDeclaration slotDecl = new DecisionVariableDeclaration("slot", StringType.TYPE, cType);
    cType.add(slotDecl);
    orgProject.add(cType);
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("decl", cType, orgProject);
    orgProject.add(decl);
    
    DecisionVariableDeclaration itrDecl = new DecisionVariableDeclaration("i", BooleanType.TYPE, orgProject);
    AttributeVariable annotationAccess = new AttributeVariable(new Variable(itrDecl), annoDecl);
    ConstantValue trueExpr = new ConstantValue(BooleanValue.TRUE);
    OCLFeatureCall equality = new OCLFeatureCall(annotationAccess, OclKeyWords.EQUALS, trueExpr); 
    FreezeBlock freeze = new FreezeBlock(new IFreezable[] {decl}, itrDecl, equality, orgProject);
    orgProject.add(freeze);
    
    java.util.Set<Project> allCopiedProjects = new HashSet<Project>();
    Project copiedProject = copyProject(orgProject, allCopiedProjects);
    FreezeBlock copiedBlock = (FreezeBlock) copiedProject.getElement(3);
    assertFreezeBlock(freeze, copiedBlock, copiedProject, allCopiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:32,代码来源:ProjectCopyVisitorTest.java

示例7: testSimplePartialEvaluationCopy

/**
 * Tests a copying of an evaluation block without problematic dependencies or nested declarations.
 * @throws CSTSemanticException If {@link Constraint#setConsSyntax(ConstraintSyntaxTree)} is not working.
 */
@Test
public void testSimplePartialEvaluationCopy() throws CSTSemanticException {
    Project orgProject = new Project("testSimplePartialEvaluationCopy");
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("decl", BooleanType.TYPE, orgProject);
    orgProject.add(decl);
    PartialEvaluationBlock evalBlock = new PartialEvaluationBlock("evalBlock", orgProject);
    Constraint constraint = new Constraint(evalBlock);
    OCLFeatureCall equality = new OCLFeatureCall(new Variable(decl), OclKeyWords.EQUALS,
        new ConstantValue(BooleanValue.TRUE));
    constraint.setConsSyntax(equality);
    evalBlock.setEvaluables(new IPartialEvaluable[] {constraint});
    orgProject.add(evalBlock);
    
    java.util.Set<Project> copiedProjects = new HashSet<Project>();
    Project copiedProject = copyProject(orgProject, copiedProjects);
    PartialEvaluationBlock copiedBlock = (PartialEvaluationBlock) copiedProject.getElement(1);
    assertEvalBlock(evalBlock, copiedBlock, copiedProject, copiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:ProjectCopyVisitorTest.java

示例8: testDependingPartialEvaluationCopy

/**
 * Tests a copying of an evaluation block depending on a declaration defined at a later point.
 * @throws CSTSemanticException If {@link Constraint#setConsSyntax(ConstraintSyntaxTree)} is not working.
 */
@Test
public void testDependingPartialEvaluationCopy() throws CSTSemanticException {
    Project orgProject = new Project("testDependingPartialEvaluationCopy");
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("decl", BooleanType.TYPE, orgProject);
    PartialEvaluationBlock evalBlock = new PartialEvaluationBlock("evalBlock", orgProject);
    Constraint constraint = new Constraint(evalBlock);
    OCLFeatureCall equality = new OCLFeatureCall(new Variable(decl), OclKeyWords.EQUALS,
            new ConstantValue(BooleanValue.TRUE));
    constraint.setConsSyntax(equality);
    evalBlock.setEvaluables(new IPartialEvaluable[] {constraint});
    orgProject.add(evalBlock);
    orgProject.add(decl);
    
    java.util.Set<Project> copiedProjects = new HashSet<Project>();
    Project copiedProject = copyProject(orgProject, copiedProjects);
    PartialEvaluationBlock copiedBlock = (PartialEvaluationBlock) copiedProject.getElement(0);
    assertEvalBlock(evalBlock, copiedBlock, copiedProject, copiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:ProjectCopyVisitorTest.java

示例9: testPartialEvaluationCopyWithInternallyDeclaredVariable

/**
 * Tests a copying of an evaluation block containing a constraining, which uses a
 * {@link DecisionVariableDeclaration} declared inside of the block.
 * @throws CSTSemanticException If {@link Constraint#setConsSyntax(ConstraintSyntaxTree)} is not working.
 */
@Test
public void testPartialEvaluationCopyWithInternallyDeclaredVariable() throws CSTSemanticException {
    Project orgProject = new Project("testPartialEvaluationCopyWithInternallyDeclaredVariable");
    PartialEvaluationBlock evalBlock = new PartialEvaluationBlock("evalBlock", orgProject);
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("decl", BooleanType.TYPE, evalBlock);
    Constraint constraint = new Constraint(evalBlock);
    OCLFeatureCall equality = new OCLFeatureCall(new Variable(decl), OclKeyWords.EQUALS,
        new ConstantValue(BooleanValue.TRUE));
    constraint.setConsSyntax(equality);
    evalBlock.setEvaluables(new IPartialEvaluable[] {constraint});
    orgProject.add(evalBlock);
    evalBlock.addModelElement(decl);
    
    java.util.Set<Project> copiedProjects = new HashSet<Project>();
    Project copiedProject = copyProject(orgProject, copiedProjects);
    PartialEvaluationBlock copiedBlock = (PartialEvaluationBlock) copiedProject.getElement(0);
    assertEvalBlock(evalBlock, copiedBlock, copiedProject, copiedProjects);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:23,代码来源:ProjectCopyVisitorTest.java

示例10: testAssignBlockCopySimple

/**
 * Tests that simple {@link AttributeAssignment}s can be copied without outstanding dependencies.
 */
@Test
public void testAssignBlockCopySimple() {
    Project orgProject = new Project("testAssignBlockCopySimple");
    Attribute annoDecl = new Attribute("anno", BooleanType.TYPE, orgProject, orgProject);
    orgProject.add(annoDecl);
    orgProject.attribute(annoDecl);
    AttributeAssignment assignBlock = new AttributeAssignment(orgProject);
    ConstantValue constTrue = new ConstantValue(BooleanValue.TRUE);
    Assignment assignment = new Assignment(annoDecl.getName(), OclKeyWords.EQUALS, constTrue);
    assignBlock.add(assignment);
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("decl", StringType.TYPE, assignBlock);
    assignBlock.add(decl);
    orgProject.add(assignBlock);
    
    java.util.Set<Project> allCopiedProject = new HashSet<Project>();
    Project copy = copyProject(orgProject, allCopiedProject);
    AttributeAssignment copiedBlock = (AttributeAssignment) copy.getElement(1);
    assertAssignBlock(assignBlock, copiedBlock, copy, allCopiedProject);
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:22,代码来源:ProjectCopyVisitorTest.java

示例11: toIVMLValue

@Override
protected Value toIVMLValue(IDecisionVariable trgVariable, Object oValue) throws ValueDoesNotMatchTypeException {
    IDatatype type = trgVariable.getDeclaration().getType();
    Value result = null;
    if (IntegerType.TYPE.isAssignableFrom(type) && oValue instanceof Double) {
        oValue = ((Double) oValue).intValue();
    } else if (BooleanType.TYPE.isAssignableFrom(type) && oValue instanceof Double) {
        result = ((Double) oValue) >= 0.5 ? BooleanValue.TRUE : BooleanValue.FALSE;
    }
    if (null == result) {
        result = ValueFactory.createValue(type, oValue);
    }
    
    return result;
}
 
开发者ID:QualiMaster,项目名称:QM-EASyProducer,代码行数:15,代码来源:IvmlElementIdentifier.java

示例12: testIfThenElse

/**
 * Tests the if-then-else expression.
 * 
 * @throws ValueDoesNotMatchTypeException in case that value assignments fail (shall not occur)
 * @throws ConfigurationException in case that initial assignment of values fail (shall not occur)
 * @throws CSTSemanticException in case that the expressions created during this test are not 
 *   valid (shall not occur)
 */
@Test
public void testIfThenElse() throws ValueDoesNotMatchTypeException, ConfigurationException, CSTSemanticException {
    Project project = new Project("Test");
    DecisionVariableDeclaration decl = new DecisionVariableDeclaration("test", IntegerType.TYPE, project);
    project.add(decl);

    Configuration config = new Configuration(project);
    config.getDecision(decl).setValue(ValueFactory.createValue(IntegerType.TYPE, 1), AssignmentState.ASSIGNED);
    
    // if test>0 then true else false
    ConstraintSyntaxTree const0 = new ConstantValue(ValueFactory.createValue(IntegerType.TYPE, 0));
    ConstraintSyntaxTree condition = Utils.createCall(decl, IntegerType.GREATER_EQUALS_INTEGER_INTEGER, const0);
    condition.inferDatatype();
    ConstraintSyntaxTree expr = new IfThen(condition, 
        new ConstantValue(BooleanValue.TRUE), 
        new ConstantValue(BooleanValue.FALSE));

    EvaluationVisitor visitor = new EvaluationVisitor();
    visitor.init(config, AssignmentState.DEFAULT, false, null);

    expr.accept(visitor);
    Assert.assertEquals(BooleanValue.TRUE, visitor.getResult());
    visitor.clearResult();

    config.getDecision(decl).setValue(ValueFactory.createValue(IntegerType.TYPE, -1), AssignmentState.ASSIGNED);
    expr.accept(visitor);
    Assert.assertEquals(BooleanValue.FALSE, visitor.getResult());
    visitor.clearResult();
    
    expr = new IfThen(condition, new ConstantValue(BooleanValue.TRUE), null);
    expr.accept(visitor);
    Assert.assertNull(visitor.getResult());
    visitor.clearResult();

    visitor.clear();
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:44,代码来源:EvaluationVisitorTest.java

示例13: aggregate

@Override
public BooleanValue aggregate(EvaluationAccessor result, Value iter, EvaluationAccessor value, 
    Map<Object, Object> data) throws ValueDoesNotMatchTypeException {
    BooleanValue stop;
    if (BooleanValue.TRUE.equals(value.getValue())) {
        // exists is fine with the first evaluation result that is true
        result.setValue(BooleanValue.TRUE, false);
        stop = BooleanValue.TRUE;
    } else {
        stop = BooleanValue.FALSE;
    }
    return stop;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:13,代码来源:ContainerIterators.java

示例14: evaluate

public EvaluationAccessor evaluate(EvaluationAccessor operand, EvaluationAccessor[] arguments) {
    EvaluationAccessor result = null;
    Value value = operand.getValue();
    if (value instanceof StringValue) {
        String str = ((StringValue) value).getValue();
        BooleanValue bValue; // close to OCL
        if (equalsIgnoreCase(str, "true", operand)) {
            bValue = BooleanValue.TRUE;
        } else {
            bValue = BooleanValue.FALSE;
        }
        result = ConstantAccessor.POOL.getInstance().bind(bValue, operand.getContext());
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:15,代码来源:StringOperations.java

示例15: getStartResult

public Value getStartResult(IDatatype type, IDatatype iterType) throws ValueDoesNotMatchTypeException {
    return BooleanValue.TRUE;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:3,代码来源:ContainerIterators.java


注:本文中的net.ssehub.easy.varModel.model.values.BooleanValue.TRUE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。