|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.engine.bool.BooleanFactory
public abstract class BooleanFactory
A factory for creating boolean values
,
matrices
, and ints
.
no f1, f2: BooleanFactory | f1 != f2 => f1.components & f2.components = BooleanConstant |
comparisonDepth: int // the depth to which circuits should be checked for equality |
intEncoding: Options.IntEncoding // the encoding used for generating integers ({@link #integer(int)} |
bitwidth: int // the bitwidth used for integer computations |
components: set BooleanValue |
Method Summary | |
---|---|
BooleanValue |
accumulate(BooleanAccumulator g)
Converts the given accumulator into an immutable boolean value and adds it to this.components. |
BooleanValue |
and(BooleanValue v0,
BooleanValue v1)
Returns a boolean value whose meaning is the conjunction of the input components. |
int |
bitwidth()
Returns the bitwidth used for integer representation. |
BooleanValue |
carry(BooleanValue v0,
BooleanValue v1,
BooleanValue cin)
Returns a boolean value whose meaning is the carry out bit of a full binary adder. |
void |
clear()
Removes all formulas with one or more inputs from this.components. |
int |
comparisonDepth()
Returns the depth (from the root) to which components are checked for semantic equality during gate construction. |
static BooleanFactory |
constantFactory(Options options)
Returns a BooleanFactory with no variables; the returned factory can manipulate only constants. |
boolean |
contains(BooleanValue v)
Returns true if v is in this.components. |
static BooleanFactory |
factory(int numVars,
Options options)
Returns a boolean factory, initialized to contain the given number of boolean variables. |
BooleanValue |
iff(BooleanValue v0,
BooleanValue v1)
Returns a boolean value whose meaning is [[v0]] <=> [[v1]]. |
BooleanValue |
implies(BooleanValue v0,
BooleanValue v1)
Returns a boolean value whose meaning is [[v0]] => [[v1]]. |
abstract Int |
integer(int number)
Returns an Int that represents the given number using this.intEncoding. |
abstract Int |
integer(int number,
BooleanValue bit)
Returns an Int that represents 0 or the given number, depending on the value of the given bit. |
abstract Options.IntEncoding |
intEncoding()
Returns the encoding used by this factory to represent integers. |
BooleanValue |
ite(BooleanValue i,
BooleanValue t,
BooleanValue e)
Returns a boolean value whose meaning is [[i]] ? [[t]] : [[e]]. |
BooleanMatrix |
matrix(Dimensions d)
Returns a BooleanMatrix with the given dimensions and this as the factory for its non-FALSE components. |
BooleanMatrix |
matrix(Dimensions d,
IntSet allIndices,
IntSet trueIndices)
Returns a BooleanMatrix m with the given dimensions, this as its factory, and the indices from the set trueIndices initialized to TRUE. |
BooleanValue |
not(BooleanValue v)
Returns the negation of the given boolean value. |
int |
numberOfVariables()
Returns the number of variables in this.components |
BooleanValue |
or(BooleanValue v0,
BooleanValue v1)
Returns a boolean value whose meaning is the disjunction of the input components. |
void |
setComparisonDepth(int newDepth)
Sets the comparison depth to the given value. |
BooleanValue |
sum(BooleanValue v0,
BooleanValue v1,
BooleanValue cin)
Returns a boolean value whose meaning is the sum bit of a full binary adder. |
Int |
sum(java.util.Collection<BooleanValue> bits)
Returns an Int that represents the sum of all values in the given collection. |
BooleanVariable |
variable(int label)
Returns the variable with the given label. |
BooleanValue |
xor(BooleanValue v0,
BooleanValue v1)
Returns a boolean value whose meaning is [[v0]] ^ [[v1]]. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static BooleanFactory factory(int numVars, Options options)
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.
Integers are created/manipulated according to the specifications in the given Options object.
java.lang.IllegalArgumentException
- - numVars < 0 || numVars = Integer.MAX_VALUE
java.lang.NullPointerException
- - options = nullpublic static BooleanFactory constantFactory(Options options)
java.lang.NullPointerException
- - options = nullpublic final int comparisonDepth()
public final void setComparisonDepth(int newDepth)
java.lang.IllegalArgumentException
- - newDepth < 1this.comparisonDepth' = newDepth |
public final int bitwidth()
public abstract Options.IntEncoding intEncoding()
public final boolean contains(BooleanValue v)
java.lang.NullPointerException
- - v = nullpublic final int numberOfVariables()
public final BooleanVariable variable(int label)
0 < label <= numberOfVariables() |
public final BooleanValue not(BooleanValue v)
java.lang.NullPointerException
- - v = null(components.v).components' = (components.v).components + n |
public final BooleanValue and(BooleanValue v0, BooleanValue v1)
java.lang.NullPointerException
- - any of the arguments are nullthis.components' = this.components + v |
v0 + v1 in this.components |
public final BooleanValue or(BooleanValue v0, BooleanValue v1)
java.lang.NullPointerException
- - any of the arguments are null
java.lang.IllegalArgumentException
- - v0 + v1 !in this.componentsthis.components' = this.components + v |
v0 + v1 in this.components |
public final BooleanValue xor(BooleanValue v0, BooleanValue v1)
java.lang.NullPointerException
- - any of the arguments are nullthis.components' = this.components + v |
v0 + v1 in this.components |
public final BooleanValue implies(BooleanValue v0, BooleanValue v1)
java.lang.NullPointerException
- - any of the arguments are nullthis.components' = this.components + v |
v0 + v1 in this.components |
public final BooleanValue iff(BooleanValue v0, BooleanValue v1)
java.lang.NullPointerException
- - any of the arguments are nullthis.components' = this.components + v |
v0 + v1 in this.components |
public final BooleanValue ite(BooleanValue i, BooleanValue t, BooleanValue e)
java.lang.NullPointerException
- - any of the arguments are nullthis.components' = this.components + v |
i + t + e in this.components |
public final BooleanValue sum(BooleanValue v0, BooleanValue v1, BooleanValue cin)
java.lang.NullPointerException
- - any of the arguments are nullthis.components' = this.components + v |
v0 + v1 + cin in this.components |
public final BooleanValue carry(BooleanValue v0, BooleanValue v1, BooleanValue cin)
java.lang.NullPointerException
- - any of the arguments are nullthis.components' = this.components + v |
v0 + v1 + cin in this.components |
public final BooleanValue accumulate(BooleanAccumulator g)
this.components' = this.components + g' |
g.components in this.components |
public abstract Int integer(int number)
java.lang.IllegalArgumentException
- - the number cannot be represented using
the specified encodingpublic abstract Int integer(int number, BooleanValue bit)
public final Int sum(java.util.Collection<BooleanValue> bits)
public final void clear()
this.componets' =
BooleanConstant + this.components & BooleanVariable |
public final BooleanMatrix matrix(Dimensions d)
java.lang.NullPointerException
- - d = nullpublic final BooleanMatrix matrix(Dimensions d, IntSet allIndices, IntSet trueIndices)
BooleanMatrix.set(int, BooleanValue)
is called on m with an index
not contained in allIndices. If allIndices.equals(trueIndices),
m may be a constant matrix; that is, an IllegalArgumentException may be
thrown if BooleanMatrix.set(int, BooleanValue)
is called on m with
a non-constant value. Finally, if cloning trueIndices results in an immutable
set, then m.set(int, BooleanValue)
may throw
an UnsupportedOperationException when called with a member of trueIndices.
java.lang.IllegalArgumentException
- - allIndices !in [0..d.capacity())
java.lang.IllegalArgumentException
- - one of the input sets is not cloneable
java.lang.NullPointerException
- - d = null || allIndices = null || trueIndices = nullallIndices.containsAll(trueIndices) |
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |