public class LogicBlocks<V extends LogicBlock> extends LinkedList<V> implements JSONFunctor
LogicBlock
objects. A logic block is an if-then-else construct. Executing these
will result in a collection of results. There are various sublcasses of this that do various things:
XORLogicBlocks
, ANDLogicBlocks
and ORLogicBlocks
.
Created by Jeff Gaynor
on 4/20/18 at 10:26 AM
Modifier and Type | Field and Description |
---|---|
static int |
AND |
protected int |
connector |
static int |
OR |
protected boolean |
result |
static int |
UNKNOWN |
static int |
XOR |
modCount
Constructor and Description |
---|
LogicBlocks()
A default constructor.
|
LogicBlocks(int connector) |
Modifier and Type | Method and Description |
---|---|
void |
clearState()
Clears each of the execution states of the logic blocks
|
protected boolean |
doANDCase(LogicBlock lb)
This will execute every logic block and take logicla AND of all the results.
|
protected boolean |
doORCase(LogicBlock lb)
This will execute every logic block and take the logical OR of all the results.
|
protected boolean |
doXORCase(LogicBlock lb)
The logical connector is excluive or.
|
Object |
execute() |
List<jThen> |
getConsequents() |
FunctorMap |
getFunctorMap() |
Object |
getResult() |
boolean |
isExecuted() |
void |
setConnector(int connector) |
net.sf.json.JSONObject |
toJSON() |
protected void |
updateFunctormap(LogicBlock lb) |
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
iterator
equals, hashCode, listIterator, removeRange, subList
containsAll, isEmpty, removeAll, retainAll, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
parallelStream, removeIf, stream
public static final int XOR
public static final int OR
public static final int AND
public static final int UNKNOWN
protected int connector
protected boolean result
public LogicBlocks(int connector)
public LogicBlocks()
execute()
or this will fail.public void setConnector(int connector)
public Object getResult()
getResult
in interface JMetaMetaFunctor
public FunctorMap getFunctorMap()
public Object execute()
execute
in interface JMetaMetaFunctor
protected boolean doXORCase(LogicBlock lb)
lb
- protected void updateFunctormap(LogicBlock lb)
protected boolean doORCase(LogicBlock lb)
lb
- protected boolean doANDCase(LogicBlock lb)
lb
- public void clearState()
public boolean isExecuted()
public net.sf.json.JSONObject toJSON()
toJSON
in interface JSONFunctor
Copyright © 2019. All Rights Reserved.