|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--quoggles.boxes.Box
|
+--quoggles.deprecated.stdboxes.flatten.Flatten_Box
Input: an object
Output: null if the input has been null.
If the input is a collection, a flat structure of that collection
is returned (this flattenig is applied recursively)
From its hierarchical input (a Collection holding
Collections), a flat structure is retrieved.
Example: If the input is a list of the form
[ [A1, A2], B, [C1, A1, C2] ]
then the result list will look like this:
[ A1, A2, B, C1, A1, C2 ]
null values are removed.
The order will be preserved (if the given
Collectionss guarantee an order).
Duplicates are not removed.
null as input is passed on.
A non-collection input is put into a one element list.
| Field Summary | |
private java.util.Collection |
inputCol
|
private java.lang.Object |
singleInput
Only set if input is not a collection |
| Fields inherited from class quoggles.boxes.Box |
boxExecuted, iBoxGRep, inputs, outputs, parameters |
| Constructor Summary | |
Flatten_Box()
|
|
| Method Summary | |
void |
execute()
Should be overridden and called first by subclasses. |
private java.lang.Object |
flatten(java.lang.Object in)
Flattens a hierarchical structure. |
IBoxRepresentation |
getGraphicalRepresentation()
This implementation returns a new instance of DefaultBoxRepresentation.
|
int[] |
getInputTypes()
This implementation returns ONE element, the most general type. |
void |
setInputs(java.lang.Object[] inputs)
Checks if the number of inputs is correct and sets the inputs. |
| Methods inherited from class quoggles.boxes.Box |
areAllInputsNull, getClassName, getId, getNode, getNumberOfInputs, getNumberOfOutputs, getOutputAt, getOutputs, getOutputTypes, getParameters, hasBeenExecuted, ignoreBox, isGraphicalRepNull, isInputSet, isInputSetAt, needsQueryRunner, removeNullValues, reset, reset, setBoxNumber, setCurrentNodesTodo, setCurrentResult, setDefaultParameters, setIgnoreBox, setInputAt, setNode, setParameters, setQueryRunner |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.util.Collection inputCol
private java.lang.Object singleInput
| Constructor Detail |
public Flatten_Box()
| Method Detail |
private java.lang.Object flatten(java.lang.Object in)
in - the object to flatten
Collection that does not hold any
Collection as element; the input object itself if it had
not been a collection
public void execute()
throws QueryExecutionException
BoxInputNotSetException 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 IBoxexecute in class BoxQueryExecutionExceptionIBox.execute()public int[] getInputTypes()
BoxgetNumberOfInputs.
getInputTypes in interface IBoxgetInputTypes in class BoxIBox.getInputTypes()
public void setInputs(java.lang.Object[] inputs)
throws InvalidInputException
Boxsuper.setInputs(inputs)) so that consistency checks are
done and some flags are correctly set.
setInputs in interface IBoxsetInputs in class BoxInvalidInputExceptionIBox.setInputs(java.lang.Object[])public IBoxRepresentation getGraphicalRepresentation()
BoxDefaultBoxRepresentation.
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 IBoxgetGraphicalRepresentation in class BoxIBox.getGraphicalRepresentation()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||