Class LogicBlocks<V extends LogicBlock>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.AbstractSequentialList<E>
-
- java.util.LinkedList<V>
-
- edu.uiuc.ncsa.security.util.functor.LogicBlocks<V>
-
- All Implemented Interfaces:
JMetaMetaFunctor
,JSONFunctor
,Serializable
,Cloneable
,Iterable<V>
,Collection<V>
,Deque<V>
,List<V>
,Queue<V>
- Direct Known Subclasses:
ANDLogicBlocks
,ORLogicBlocks
,XORLogicBlocks
public class LogicBlocks<V extends LogicBlock> extends LinkedList<V> implements JSONFunctor
A collection ofLogicBlock
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
andORLogicBlocks
.Created by Jeff Gaynor
on 4/20/18 at 10:26 AM- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LogicBlocks()
A default constructor.LogicBlocks(int connector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearState()
Clears each of the execution states of the logic blocksprotected 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)
-
Methods inherited from class java.util.LinkedList
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
-
Methods inherited from class java.util.AbstractSequentialList
iterator
-
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
-
-
-
Field Detail
-
XOR
public static final int XOR
- See Also:
- Constant Field Values
-
OR
public static final int OR
- See Also:
- Constant Field Values
-
AND
public static final int AND
- See Also:
- Constant Field Values
-
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
-
connector
protected int connector
-
result
protected boolean result
-
-
Constructor Detail
-
LogicBlocks
public LogicBlocks(int connector)
-
LogicBlocks
public LogicBlocks()
A default constructor. You need to set the connector type before invokingexecute()
or this will fail.
-
-
Method Detail
-
setConnector
public void setConnector(int connector)
-
getResult
public Object getResult()
- Specified by:
getResult
in interfaceJMetaMetaFunctor
-
getFunctorMap
public FunctorMap getFunctorMap()
-
execute
public Object execute()
- Specified by:
execute
in interfaceJMetaMetaFunctor
-
doXORCase
protected boolean doXORCase(LogicBlock lb)
The logical connector is excluive or. This means that the processing ends as soon as the first block is true. else -- the else result will be added to the functor map, BUT execution will stop. Invoking the XOR connector means to stop processing in this case!!!- Parameters:
lb
-- Returns:
-
updateFunctormap
protected void updateFunctormap(LogicBlock lb)
-
doORCase
protected boolean doORCase(LogicBlock lb)
This will execute every logic block and take the logical OR of all the results. Each consequent will be added- Parameters:
lb
-- Returns:
-
doANDCase
protected boolean doANDCase(LogicBlock lb)
This will execute every logic block and take logicla AND of all the results. Processing continues for all of these. Note that only in the case of XOR is processing interrupted.- Parameters:
lb
-- Returns:
-
clearState
public void clearState()
Clears each of the execution states of the logic blocks
-
isExecuted
public boolean isExecuted()
-
toJSON
public net.sf.json.JSONObject toJSON()
- Specified by:
toJSON
in interfaceJSONFunctor
-
-