Class SwitchHandler
- java.lang.Object
-
- edu.uiuc.ncsa.security.util.functor.parser.AbstractHandler
-
- edu.uiuc.ncsa.security.util.functor.parser.event.SwitchHandler
-
- All Implemented Interfaces:
CommaListener,DelimiterListener,Serializable,EventListener
public class SwitchHandler extends AbstractHandler implements DelimiterListener, CommaListener
Event-Driven Logic BlockS handler. This is the outermost part of any parsing operation. LogicBlocks are basicallt just a type of switch statement that allows for some awareness of how to evaluate the components (standard switch is to evaluate exactly one, out xor case). This has a few specialized calls to let you get results from running logic blocks.Created by Jeff Gaynor
on 7/16/18 at 2:34 PM- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class edu.uiuc.ncsa.security.util.functor.parser.AbstractHandler
closeDelimiterCount, CONDITIONAL_TYPE, FUNCTOR_TYPE, openDelimiterCount, SWITCH_TYPE, used
-
-
Constructor Summary
Constructors Constructor Description SwitchHandler(ConditionalHandler conditionalHandler, JFunctorFactory functorFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseDelimiter(DelimiterEvent delimeterEvent)voidexecute()jThengetConsequentAt(int index)Get the logic block at theindexand return the consequent (i.e.List<JFunctor>getFunctorMapEntry(String key)intgetHandlerType()Allows for determining the type of handler without resorting to a lot of java class operations.LogicBlocks<? extends LogicBlock>getLogicBlocks()ObjectgetResultAt(int consequentIndex, int resultIndex)Fetches the consequent atconsequentIndexthen grabs the list atresultIndex(since consequents have lists of results) and returns the object.voidgotComma(CommaEvent commaEvent)booleanhasConsequentAt(int index)voidopenDelimiter(DelimiterEvent delimeterEvent)voidreset()voidrunLogicBlocks()-
Methods inherited from class edu.uiuc.ncsa.security.util.functor.parser.AbstractHandler
areDelimitersBalanced, convertType, equals, getFunctorFactory, isUsed, toString
-
-
-
-
Constructor Detail
-
SwitchHandler
public SwitchHandler(ConditionalHandler conditionalHandler, JFunctorFactory functorFactory)
-
-
Method Detail
-
runLogicBlocks
public void runLogicBlocks()
-
getHandlerType
public int getHandlerType()
Description copied from class:AbstractHandlerAllows for determining the type of handler without resorting to a lot of java class operations.- Specified by:
getHandlerTypein classAbstractHandler- Returns:
-
getConsequentAt
public jThen getConsequentAt(int index)
Get the logic block at theindexand return the consequent (i.e. result of having executed the logic block.)- Parameters:
index-- Returns:
-
getResultAt
public Object getResultAt(int consequentIndex, int resultIndex)
Fetches the consequent atconsequentIndexthen grabs the list atresultIndex(since consequents have lists of results) and returns the object.- Parameters:
consequentIndex-resultIndex-- Returns:
-
hasConsequentAt
public boolean hasConsequentAt(int index)
-
getLogicBlocks
public LogicBlocks<? extends LogicBlock> getLogicBlocks()
-
execute
public void execute()
-
gotComma
public void gotComma(CommaEvent commaEvent)
- Specified by:
gotCommain interfaceCommaListener
-
openDelimiter
public void openDelimiter(DelimiterEvent delimeterEvent)
- Specified by:
openDelimiterin interfaceDelimiterListener- Overrides:
openDelimiterin classAbstractHandler
-
closeDelimiter
public void closeDelimiter(DelimiterEvent delimeterEvent)
- Specified by:
closeDelimiterin interfaceDelimiterListener- Overrides:
closeDelimiterin classAbstractHandler
-
reset
public void reset()
- Specified by:
resetin interfaceDelimiterListener- Overrides:
resetin classAbstractHandler
-
-