public class LogicBlock extends Object implements JSONFunctor
JFunctor
if-then-else block. You supply a JSONObject, this parses it
into its correct elements at runtime. You may also use this as a utility to create such blocks by creating the
if then else blcks, setting them and invoking the toJSON()
method.
Created by Jeff Gaynor
on 2/27/18 at 4:33 PM
Constructor and Description |
---|
LogicBlock(JFunctorFactory factory) |
LogicBlock(JFunctorFactory factory,
jIf ifBlock,
jThen thenBlock)
Constructor for case of no else clause.
|
LogicBlock(JFunctorFactory factory,
jIf ifBlock,
jThen thenBlock,
jElse elseBlock) |
LogicBlock(JFunctorFactory factory,
net.sf.json.JSONObject json) |
Modifier and Type | Method and Description |
---|---|
protected void |
addResults(Object obj) |
void |
clearState()
This clears every executed functor in the antecedent and any consequents.
|
protected jIf |
createIfBlock()
A jIf functor is a functor with the agreement that the argument in text may consists of a functor (rather than
an array with a single functor).
|
protected JFunctor |
createThenOrElseBlock(FunctorTypeImpl type) |
Object |
execute() |
jThen |
getConsequent()
The consequent is either the then or else block, depending on the antecedent (the if block).
|
jElse |
getElseBlock() |
jIf |
getIfBlock() |
Object |
getResult() |
ArrayList<Object> |
getResults() |
jThen |
getThenBlock() |
boolean |
hasConsequent() |
protected void |
initialize() |
boolean |
isExecuted() |
boolean |
isIfTrue() |
void |
setElseBlock(jElse elseBlock) |
void |
setIfBlock(jIf ifBlock) |
void |
setThenBlock(jThen thenBlock) |
net.sf.json.JSONObject |
toJSON() |
String |
toString() |
public LogicBlock(JFunctorFactory factory)
public LogicBlock(JFunctorFactory factory, jIf ifBlock, jThen thenBlock, jElse elseBlock)
public LogicBlock(JFunctorFactory factory, jIf ifBlock, jThen thenBlock)
ifBlock
- thenBlock
- public LogicBlock(JFunctorFactory factory, net.sf.json.JSONObject json)
public Object getResult()
getResult
in interface JMetaMetaFunctor
public jThen getConsequent()
public boolean hasConsequent()
public jElse getElseBlock()
public jThen getThenBlock()
public jIf getIfBlock()
protected jIf createIfBlock()
public boolean isIfTrue()
protected JFunctor createThenOrElseBlock(FunctorTypeImpl type)
public boolean isExecuted()
public void clearState()
protected void initialize()
protected void addResults(Object obj)
public Object execute()
execute
in interface JMetaMetaFunctor
public void setIfBlock(jIf ifBlock)
public void setThenBlock(jThen thenBlock)
public void setElseBlock(jElse elseBlock)
public net.sf.json.JSONObject toJSON()
toJSON
in interface JSONFunctor
Copyright © 2019. All Rights Reserved.