Java Code Examples for kodkod.ast.operator.Multiplicity#NO

The following examples show how to use kodkod.ast.operator.Multiplicity#NO . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Decl.java    From org.alloytools.alloy with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new declaration from the specified variable and expression, with
 * the specified order.
 *
 * @ensures this.variable' = variable && this.expression' = expression &&
 *          this.multiplicity' = mult
 * @throws NullPointerException variable = null || expression = null || mult =
 *             null
 * @throws IllegalArgumentException variable.arity != expression.arity
 */
Decl(Variable variable, Multiplicity mult, Expression expression) {
    if (mult == Multiplicity.NO)
        throw new IllegalArgumentException("NO is not a valid multiplicity in a declaration.");
    if (variable.arity() != expression.arity())
        throw new IllegalArgumentException("Unmatched arities in a declaration: " + variable + " and " + expression);
    if (mult != Multiplicity.SET && expression.arity() > 1)
        throw new IllegalArgumentException("Cannot use multiplicity " + mult + " with an expression of arity > 1.");
    this.variable = variable;
    this.mult = mult;
    this.expression = expression;
}
 
Example 2
Source File: Decl.java    From kodkod with MIT License 5 votes vote down vote up
/**  
 * Constructs a new declaration from the specified variable and
 * expression, with the specified order.
 * 
 * @ensures this.variable' = variable && this.expression' = expression && this.multiplicity' = mult
 * @throws NullPointerException  variable = null || expression = null || mult = null
 * @throws IllegalArgumentException  variable.arity != expression.arity 
 */
Decl(Variable variable, Multiplicity mult, Expression expression) {
	if (mult==Multiplicity.NO)
			throw new IllegalArgumentException("NO is not a valid multiplicity in a declaration.");
    if (variable.arity() != expression.arity())
        throw new IllegalArgumentException("Unmatched arities in a declaration: " + variable + " and " + expression);
    if (mult != Multiplicity.SET && expression.arity()>1) 
    		throw new IllegalArgumentException("Cannot use multiplicity " + mult + " with an expression of arity > 1.");
    this.variable = variable;
    this.mult = mult;
    this.expression = expression;
}