|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--quoggles.boxes.Box
Superclass providing all methods of IBox interface. If a box
subclasses this class, overriding methods should call the super versions
as first action. This specially applies to methods
execute(), reset(), reset(int), setinputs(Object[]).
Some basic type checking is done. It acts as an identity operator.
| Field Summary | |
protected boolean |
boxExecuted
|
private int |
boxNr
|
protected IBoxRepresentation |
iBoxGRep
|
private boolean |
ignoreBox
|
private boolean[] |
inputNumbersSet
|
protected java.lang.Object[] |
inputs
|
private boolean |
inputSet
|
private org.graffiti.graph.Node |
node
|
protected java.lang.Object[] |
outputs
|
protected org.graffiti.plugin.parameter.Parameter[] |
parameters
|
| Constructor Summary | |
Box()
|
|
Box(org.graffiti.graph.Node n)
|
|
| Method Summary | |
protected boolean |
areAllInputsNull()
Returns true iff all inputs are null. |
void |
execute()
Should be overridden and called first by subclasses. |
protected java.lang.String |
getClassName()
Used by getId() to retrieve the class name of the box. |
IBoxRepresentation |
getGraphicalRepresentation()
This implementation returns a new instance of DefaultBoxRepresentation.
|
java.lang.String |
getId()
Generates a unique id. |
int[] |
getInputTypes()
This implementation returns ONE element, the most general type. |
org.graffiti.graph.Node |
getNode()
Returns the node that holds this box. |
int |
getNumberOfInputs()
Returns the number of inputs this box expects. |
int |
getNumberOfOutputs()
Returns the number of outputs this box provides. |
java.lang.Object |
getOutputAt(int index)
Returns the ith output. |
java.lang.Object[] |
getOutputs()
Returns outputs. |
int[] |
getOutputTypes()
Override this method to specify more restricted types for the output(s) of the box. |
org.graffiti.plugin.parameter.Parameter[] |
getParameters()
Returns empty parameter array meaning the box does not need any parameters if the field parameters is still
null, otherwise returns this field. |
boolean |
hasBeenExecuted()
Returns true iff the box's execute() method
has been called since the creation of the box or the last call to
reset. |
boolean |
ignoreBox()
Gets the value previously set by setIgnoreBox(boolean) or
returns false if not yet set. |
boolean |
isGraphicalRepNull()
|
boolean |
isInputSet()
Returns true iff all inputs have been set. |
boolean |
isInputSetAt(int index)
Returns true iff the input at the given index has been set. |
boolean |
needsQueryRunner()
Returns false. |
java.util.Collection |
removeNullValues(java.util.Collection col)
Remove all null values from the given collection. |
void |
reset()
Should be called by all classes that override this method. |
void |
reset(int index)
Should be called by all classes that override this method. |
void |
setBoxNumber(int boxNumber)
Set the number of the box. |
void |
setCurrentNodesTodo(java.util.Stack nodesTodo)
Empty implementation. |
void |
setCurrentResult(java.util.List res)
Empty implementation. |
void |
setDefaultParameters()
If the subclass has any parameters, it may override this method. |
void |
setIgnoreBox(boolean ignore)
Specifies whether or not a box should be ignored by any query processing (possibly because it has already been executed as part of a sub query). |
void |
setInputAt(java.lang.Object input,
int index)
This method calls setInputs with the inputs set so far. |
void |
setInputs(java.lang.Object[] inputs)
Checks if the number of inputs is correct and sets the inputs. |
void |
setNode(org.graffiti.graph.Node n)
Sets the node that holds this box. |
void |
setParameters(org.graffiti.plugin.parameter.Parameter[] pars,
boolean fromRep)
Sets the parameters and - if needed - sets them in the graphical representation. |
void |
setQueryRunner(RunQuery qr)
Empty implementation. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected org.graffiti.plugin.parameter.Parameter[] parameters
private boolean inputSet
protected boolean boxExecuted
protected java.lang.Object[] outputs
protected java.lang.Object[] inputs
protected IBoxRepresentation iBoxGRep
private org.graffiti.graph.Node node
private boolean[] inputNumbersSet
private int boxNr
private boolean ignoreBox
| Constructor Detail |
public Box()
public Box(org.graffiti.graph.Node n)
| Method Detail |
public final void setBoxNumber(int boxNumber)
setBoxNumber in interface IBoxboxNumber -
public void setParameters(org.graffiti.plugin.parameter.Parameter[] pars,
boolean fromRep)
parameters.
setParameters in interface IBoxpars - the parameters to be setfromRep - true if called from the box's representationquoggles.IBox#setParameters(org.graffiti.plugin.algorithm.Parameter)public final org.graffiti.plugin.parameter.Parameter[] getParameters()
parameters is still
null, otherwise returns this field.
getParameters in interface IBoxIBox.getParameters()
public void execute()
throws QueryExecutionException
InputNotSetException if the inputSet
flag indicates the no input has been set for this box.
May throw other QueryExecutionExceptions.
The implementation of this abstract sets the output to be equal to the
input.
execute in interface IBoxQueryExecutionExceptionIBox.execute()protected java.lang.String getClassName()
getId() to retrieve the class name of the box.
public final java.lang.String getId()
getId in interface IBoxString identifying the boxquoggles.boxes.IBox#getID()public final boolean hasBeenExecuted()
IBoxtrue iff the box's execute() method
has been called since the creation of the box or the last call to
reset.
hasBeenExecuted in interface IBoxIBox.hasBeenExecuted()public void setDefaultParameters()
getParameters.
setDefaultParameters in interface IBoxIBox.setDefaultParameters()public IBoxRepresentation getGraphicalRepresentation()
DefaultBoxRepresentation.
If your subclass has any parameters, you will probably have to design
your own representation and override this method for example as follows:
if (iBoxGRep == null || !(iBoxGRep instanceof MYOWNBOX_Rep)) {
iBoxGRep = new MYOWNBOX_Rep(this);
}
return iBoxGRep;
getGraphicalRepresentation in interface IBoxIBox.getGraphicalRepresentation()public boolean isGraphicalRepNull()
quoggles.boxes.IBox#isGraphicalRepNull()public int[] getInputTypes()
getNumberOfInputs.
getInputTypes in interface IBoxint array whose size gives the number of inputs.
The entries specify the type of the inputs. This uses constants defined
in quoggles.constants.ITypeConstants.quoggles.boxes.IBox#getOtherInputTypes()public int getNumberOfInputs()
getNumberOfInputs in interface IBoxquoggles.boxes.IBox#hasSeveralInputs()
public final void setInputAt(java.lang.Object input,
int index)
throws InvalidInputException
setInputs with the inputs set so far.
setInputAt in interface IBoxinput - the input to be set at the given indexindex - the index of the input to set
InvalidInputExceptionIBox.setInputAt(java.lang.Object, int)protected final boolean areAllInputsNull()
public final boolean isInputSet()
true iff all inputs have been set.
isInputSet in interface IBoxpublic final boolean isInputSetAt(int index)
IBox
isInputSetAt in interface IBoxindex - between zero and getNumberOfInputs()-1
IBox.isInputSetAt(int)
public void setInputs(java.lang.Object[] inputs)
throws InvalidInputException
super.setInputs(inputs)) so that consistency checks are
done and some flags are correctly set.
setInputs in interface IBoxinputs - the inputs of the box
InvalidInputExceptionquoggles.boxes.IBox#setOtherInputs(java.lang.Object[])public int getNumberOfOutputs()
getNumberOfOutputs in interface IBoxquoggles.boxes.IBox#hasSeveralOutputs()public int[] getOutputTypes()
getNumberOfOutputs.
This implementation returns the same as a call to
getInputTypes yields.
getOutputTypes in interface IBoxint array whose size gives the number of
outputs.
The entries specify the type of the outputs. This uses constants defined
in quoggles.constants.ITypeConstants.quoggles.boxes.IBox#getOtherOutputTypes()
public java.lang.Object getOutputAt(int index)
throws BoxNotExecutedException
ith output.
getOutputAt in interface IBoxith output of the box
BoxNotExecutedExceptionIBox.getOutputAt(int)
public java.lang.Object[] getOutputs()
throws BoxNotExecutedException
outputs. Throws exception if the box's
execute method has not been called.
No need to override this method. Just work on the outputs
field.
getOutputs in interface IBoxBoxNotExecutedExceptionquoggles.boxes.IBox#getOtherOutputs()public void reset()
reset in interface IBoxIBox.reset()public final java.util.Collection removeNullValues(java.util.Collection col)
null values from the given collection.
If the given collection supports the remove operation, it
is changed directly. Otherwise, all non-null elements are
inserted into a new list. In both cases, the new list is returned.
col - the collection to remove null values from
null values. Needs not be the same object as
the given collection.public void reset(int index)
reset in interface IBoxindex - the index of the input that should be marked as invalidIBox.reset(int)public boolean needsQueryRunner()
false.
needsQueryRunner in interface IBoxRunQuery
interface should be passed to this boxquoggles.boxes.IBox#neeedsQueryRunner()public void setQueryRunner(RunQuery qr)
setQueryRunner in interface IBoxqr - an object that has a runQuery(...) methodIBox.setQueryRunner(quoggles.auxiliary.RunQuery)public void setCurrentResult(java.util.List res)
setCurrentResult in interface IBoxres - the last result of a call to runQuery(...)IBox.setCurrentResult(java.util.List)public void setCurrentNodesTodo(java.util.Stack nodesTodo)
setCurrentNodesTodo in interface IBoxnodesTodo - the stack of nodes that still need to be processedquoggles.boxes.IBox#setCurrentNodesTodo(java.util.ArrayList)public void setIgnoreBox(boolean ignore)
IBox
setIgnoreBox in interface IBoxignore - true iff the box should not be executedIBox.setIgnoreBox(boolean)public boolean ignoreBox()
IBoxsetIgnoreBox(boolean) or
returns false if not yet set.
ignoreBox in interface IBoxtrue if the box should be ignoredIBox.ignoreBox()public void setNode(org.graffiti.graph.Node n)
IBox
setNode in interface IBoxn - the node that holds this box.IBox.setNode(org.graffiti.graph.Node)public org.graffiti.graph.Node getNode()
IBox
getNode in interface IBoxIBox.getNode()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||