Java Code Examples for kodkod.engine.config.Options#intEncoding()

The following examples show how to use kodkod.engine.config.Options#intEncoding() . 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: BooleanFactory.java    From org.alloytools.alloy with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a boolean factory, initialized to contain the given number of boolean
 * variables.
 * <p>
 * Gates are checked for semantic equality down to the depth given by
 * options.sharing when checking for cached values. In general, setting the
 * comparison depth to a higher value will result in more subcomponents being
 * shared. However, it will also slow down gate construction.
 * </p>
 * <p>
 * Integers are created/manipulated according to the specifications in the given
 * Options object.
 * </p>
 *
 * @return {f: BooleanFactory | #(f.components & BooleanVariable) = numVars &&
 *         BooleanConstant in f.components && f.components in BooleanVariable +
 *         BooleanConstant && f.comparisonDepth = options.sharing && f.bitwidth
 *         = options.bitwidth && f.intEncoding = options.intEncoding && (all i:
 *         [1..numVars] | one f.components.label & i }}
 * @throws IllegalArgumentException numVars < 0 || numVars = Integer.MAX_VALUE
 * @throws NullPointerException options = null
 */
public static BooleanFactory factory(int numVars, Options options) {
    switch (options.intEncoding()) {
        case TWOSCOMPLEMENT :
            return new TwosComplementFactory(numVars, options.sharing(), options.bitwidth(), options.overflowPolicy());
        default :
            throw new IllegalArgumentException("unknown encoding: " + options.intEncoding());
    }
}
 
Example 2
Source File: BooleanFactory.java    From kodkod with MIT License 3 votes vote down vote up
/**
 * Returns a boolean factory, initialized to contain the given number
 * of boolean variables.  
 * <p>Gates are checked for semantic equality 
 * down to the depth given by options.sharing when checking for cached values.  In general,  setting the
 * comparison depth to a higher value will result in more 
 * subcomponents being shared.  However, it will also slow down
 * gate construction.  </p>
 * <p>Integers are created/manipulated according to the specifications in the given Options object.</p>
 * @return {f: BooleanFactory | #(f.components & BooleanVariable) = numVars &&
 *                              BooleanConstant in f.components && f.components in BooleanVariable + BooleanConstant &&
 *                              f.comparisonDepth = options.sharing && 
 *                              f.bitwidth = options.bitwidth && f.intEncoding = options.intEncoding && 
 *                              (all i: [1..numVars] | one f.components.label & i }}
 * @throws IllegalArgumentException  numVars < 0 || numVars = Integer.MAX_VALUE
 * @throws NullPointerException  options = null
 */
public static BooleanFactory factory(int numVars, Options options) {
	switch(options.intEncoding()) {
	case TWOSCOMPLEMENT : 
		return new TwosComplementFactory(numVars, options.sharing(), options.bitwidth()); 
	default :
		throw new IllegalArgumentException("unknown encoding: " + options.intEncoding());
	}
}