public final class LogicCluster
extends java.lang.Object
Logic instances.
When a cluster is evaluated all its Logic elements are evaluated and
the cluster evaluation returns a 32-bit integer representing the result of
all the elements. A '1' bit represents a Logic instance that
evaluated to true, a '0' bit represents one that evaluated to
false. The returned bit pattern can then be easily processed using a
switch table.
The first element controls the 1s place, the second element the 2s place and
so on. In general the n-nth element controls the 2^n place.| Constructor and Description |
|---|
LogicCluster(Logic... elements)
Creates a new cluster instance from a list of
Logic elements. |
| Modifier and Type | Method and Description |
|---|---|
int |
evaluate()
Evaluates the cluster.
|
Logic |
pattern(int code)
provides a
Logic instance testing for a specific evaluation
pattern. |
public LogicCluster(Logic... elements)
Logic elements.elements - the elements to build a cluster from. may not be nulljava.lang.NullPointerException - the elements parameter is nulljava.lang.IllegalArgumentException - the elements array is empty or contains more than 32 elementspublic int evaluate()
0.public Logic pattern(int code)
Logic instance testing for a specific evaluation
pattern. Whenever the cluster evaluates to that given pattern the
Logic instance evaluates to true.code - the 32-bit pattern that must be present for the logic instance
to evaluate to trueCopyright © 2018. All Rights Reserved.