pl.edu.pjwstk.yaod.yaql.engine.queryresulttypes
Class ComplexValue

java.lang.Object
  |
  +--pl.edu.pjwstk.yaod.yaql.engine.queryresulttypes.QueryResult
        |
        +--pl.edu.pjwstk.yaod.yaql.engine.queryresulttypes.ComplexValue
Direct Known Subclasses:
BagValue, SequenceValue, StructValue

public abstract class ComplexValue
extends QueryResult

The ComplexValue class represents the main class of available complex results - collections (structures, bags and sequences).

Author:
Jakub Trzetrzelewski, jakub_trzetrzelewski@yahoo.com

Field Summary
 java.util.Vector results
           
 
Constructor Summary
ComplexValue()
          Creates a new empty collection.
ComplexValue(java.util.Vector v)
          Creates a new collection initialized with the v.
 
Method Summary
 ComplexValue addBag(QueryResult bag)
          Adds a new element to the collection.
 QueryResult addResult(QueryResult result)
          Adds a new element to the collection, additionally returns the collection.
 ComplexValue addSequence(QueryResult seq)
          Adds a new element to the collection.
 ComplexValue addStruct(QueryResult str)
          Adds a new element to the collection.
 QueryResult getFirstResult()
          Returns the first element in the collection.
 QueryResult getNextResultAt(int i)
          Method used during evaluation of non algebraic operators.
 int getNumberOfResults()
          Method used during evaluation of non algebraic operators.
 QueryResult getResultAt(int i)
          Returns the i-th element from the collection.
 java.util.Vector getResults()
          Returns the elements of the collection.
 int getSize()
          Returns the number of elements in the collection.
 boolean isEmpty()
          Tests whether or not the collection is empty.
 QueryResult operatorASCENDING()
          Method responsible for unary ascending operation.
 QueryResult operatorAVERAGE()
          Method responsible for unary average operation.
 IntegerValue operatorCOUNT()
          Method responsible for unary count operation.
 void operatorCREATE(EnvironmentalStack ENVS)
          Method responsible for unary create operation on environmental stack.
 QueryResult operatorCREATE(IdentifierValue iv)
          Method responsible for unary create operation.
 void operatorCREATELOCAL(EnvironmentalStack ENVS)
          Method responsible for unary create local operation on environmental stack.
 QueryResult operatorCREATELOCAL(IdentifierValue iv)
          Method responsible for unary create local operation.
 void operatorCREATEPERMANENT(EnvironmentalStack ENVS)
          Method responsible for unary create permanent operation on environmental stack.
 QueryResult operatorCREATEPERMANENT(IdentifierValue iv)
          Method responsible for unary create permanent operation.
 void operatorDELETE(EnvironmentalStack ENVS)
          Method responsible for unary delete operation.
 QueryResult operatorDEREFERENCE()
          Returns the result of dereference operation on complex result, which is this complex result itself.
 BooleanValue operatorEXISTS()
          Method responsible for unary exists operation.
 QueryResult operatorFULLDEREFERENCE()
          Returns the result of full dereference operation on complex result, which is this complex result with recursively fully dereferenced elements.
 BinderValue operatorGROUPAS(QueryResult r)
          Method responsible for unary group as operation.
 void operatorINSERTINTO(QueryResult r, EnvironmentalStack ENVS)
          Method responsible for binary insert into operation.
 QueryResult operatorMAXIMUM()
          Method responsible for unary maximum operation.
 QueryResult operatorMINIMUM()
          Method responsible for unary minimum operation.
 QueryResult operatorMIXEDDEREFERENCE()
          Returns the result of mixed dereference operation on complex result, which is this complex result with recursively mixed dereferenced elements.
 void operatorPRINT(java.lang.String st, java.io.PrintWriter out)
          Prints the actual atomic result in the normal fashion.
 void operatorRENAMETO(QueryResult r, EnvironmentalStack ENVS)
          Method responsible for binary rename to operation.
 QueryResult operatorSPECIALDEREFERENCE()
          Returns the result of special dereference operation on complex result, which is this complex result with recursively specially dereferenced elements.
 QueryResult operatorSUM()
          Method responsible for unary sum operation.
 BagValue operatorTOBAG()
          Method responsible for unary tobag operation.
 SequenceValue operatorTOSEQUENCE()
          Method responsible for unary tosequence operation.
 QueryResult operatorTOSINGLE()
          Method responsible for unary tosingle operation.
 StructValue operatorTOSTRUCT()
          Method responsible for unary tostruct operation.
 void operatorUPDATETO(QueryResult r)
          Method responsible for binary update to operation.
 void operatorXMLPRINT(java.lang.String st, java.io.PrintWriter out)
          Prints the actual atomic result in the xml fashion.
 void setResultAt(int i, QueryResult r)
          Sets the i-th element value to r in the collection.
 void show(java.lang.String st, java.io.PrintWriter out)
          Prints the actual atomic result in the raw fashion.
 
Methods inherited from class pl.edu.pjwstk.yaod.yaql.engine.queryresulttypes.QueryResult
getLongestTypeAsSpacesString, getPreparedTypeAsString, getTypeAsString, nested, operatorABSOLUTEVALUE, operatorAS, operatorASSIGN, operatorBAG, operatorCOMMA, operatorCOMPARE, operatorCONDITION, operatorCONJUNCTION, operatorCOSINE, operatorDESCENDING, operatorDIFFERENCE, operatorDISJUNCTION, operatorDIVIDE, operatorDIVIDEASSIGN, operatorEQUAL, operatorEXPONENT, operatorGREATER, operatorGREATEREQUAL, operatorINCLUSION, operatorINSERT, operatorINTERSECTION, operatorLOGARITHM, operatorLOWER, operatorLOWEREQUAL, operatorMINUS, operatorMINUS, operatorMINUSASSIGN, operatorMODULO, operatorMODULOASSIGN, operatorNEGATION, operatorNOTEQUAL, operatorPLUS, operatorPLUS, operatorPLUSASSIGN, operatorPOWER, operatorPREDECREMENT, operatorPREINCREMENT, operatorPRINT, operatorRANGE, operatorRANGE, operatorSEQUENCE, operatorSIGNUM, operatorSINE, operatorSQUAREROOT, operatorSTRUCT, operatorSYMMETRICDIFFERENCE, operatorTIMES, operatorTIMESASSIGN, operatorTODOUBLE, operatorTOINTEGER, operatorTOSTRING, operatorUNION, operatorUNIQUE, operatorXMLPRINT, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

results

public java.util.Vector results
Constructor Detail

ComplexValue

public ComplexValue()
Creates a new empty collection.

ComplexValue

public ComplexValue(java.util.Vector v)
Creates a new collection initialized with the v.
Parameters:
v - vector of elements.
Method Detail

getResultAt

public QueryResult getResultAt(int i)
Returns the i-th element from the collection.
Parameters:
i - the index of element to be returned.
Returns:
the i-th element of collection.
See Also:
QueryResult

setResultAt

public void setResultAt(int i,
                        QueryResult r)
Sets the i-th element value to r in the collection.
Parameters:
i - the index of element to be updated.
See Also:
QueryResult

getSize

public int getSize()
Returns the number of elements in the collection.
Returns:
the number of elements in the collection.

addResult

public QueryResult addResult(QueryResult result)
Adds a new element to the collection, additionally returns the collection.
Parameters:
result - an element to be added.
Returns:
the actual collection.
See Also:
QueryResult

isEmpty

public boolean isEmpty()
Tests whether or not the collection is empty.

getFirstResult

public QueryResult getFirstResult()
Returns the first element in the collection.
See Also:
QueryResult

getResults

public java.util.Vector getResults()
Returns the elements of the collection.
Returns:
the elements of the collection.

getNumberOfResults

public int getNumberOfResults()
Method used during evaluation of non algebraic operators. It returns the size of all collections, except structure (StructValue).
Overrides:
getNumberOfResults in class QueryResult
Returns:
the number of elements in the collection.

getNextResultAt

public QueryResult getNextResultAt(int i)
Method used during evaluation of non algebraic operators. It returns the element i of the collection, except structure (StructValue).
Overrides:
getNextResultAt in class QueryResult
Parameters:
i - the i-th element to be returned.
Returns:
the i-th element in the collection.
See Also:
QueryResult

addBag

public ComplexValue addBag(QueryResult bag)
Adds a new element to the collection. If this element is a bag, all its elements are added to the actual collection, otherwise the entire result is added as an element. Additionally returns the actual collection.
Parameters:
bag - an element to be added.
Returns:
the actual collection.
See Also:
QueryResult, ComplexValue, BagValue

addSequence

public ComplexValue addSequence(QueryResult seq)
Adds a new element to the collection. If this element is a sequence, all its elements are added to the actual collection, otherwise the entire result is added as an element. Additionally returns the actual collection.
Parameters:
seq - an element to be added.
Returns:
the actual collection.
See Also:
QueryResult, ComplexValue, SequenceValue

addStruct

public ComplexValue addStruct(QueryResult str)
Adds a new element to the collection. If this element is a structure, all its elements are added to the actual collection, otherwise the entire result is added as an element. Additionally returns the actual collection.
Parameters:
str - an element to be added.
Returns:
the actual collection.
See Also:
QueryResult, ComplexValue, StructValue

operatorDEREFERENCE

public QueryResult operatorDEREFERENCE()
                                throws TypeMismatchException
Returns the result of dereference operation on complex result, which is this complex result itself.
Overrides:
operatorDEREFERENCE in class QueryResult
Returns:
this complex value.
Throws:
TypeMismatchException - never in this case.
See Also:
QueryResult

operatorFULLDEREFERENCE

public QueryResult operatorFULLDEREFERENCE()
                                    throws TypeMismatchException
Returns the result of full dereference operation on complex result, which is this complex result with recursively fully dereferenced elements.
Overrides:
operatorFULLDEREFERENCE in class QueryResult
Returns:
this complex value.
Throws:
TypeMismatchException - never in this case.
See Also:
QueryResult

operatorSPECIALDEREFERENCE

public QueryResult operatorSPECIALDEREFERENCE()
                                       throws TypeMismatchException
Returns the result of special dereference operation on complex result, which is this complex result with recursively specially dereferenced elements.
Overrides:
operatorSPECIALDEREFERENCE in class QueryResult
Returns:
this complex value.
Throws:
TypeMismatchException - never in this case.
See Also:
QueryResult

operatorMIXEDDEREFERENCE

public QueryResult operatorMIXEDDEREFERENCE()
                                     throws TypeMismatchException
Returns the result of mixed dereference operation on complex result, which is this complex result with recursively mixed dereferenced elements.
Overrides:
operatorMIXEDDEREFERENCE in class QueryResult
Returns:
this complex value.
Throws:
TypeMismatchException - never in this case.
See Also:
QueryResult

show

public void show(java.lang.String st,
                 java.io.PrintWriter out)
Prints the actual atomic result in the raw fashion. The result is printed on out object.
Overrides:
show in class QueryResult
Parameters:
st - the string which is a auxiliary tabulator.
out - the object responsible for displaying information.
Throws:
TypeMismatchException - never in this case.

operatorPRINT

public void operatorPRINT(java.lang.String st,
                          java.io.PrintWriter out)
                   throws TypeMismatchException
Prints the actual atomic result in the normal fashion. The result is printed on out object.
Overrides:
operatorPRINT in class QueryResult
Parameters:
st - the string which is a auxiliary tabulator.
out - the object responsible for displaying information.
Throws:
TypeMismatchException - never in this case.

operatorXMLPRINT

public void operatorXMLPRINT(java.lang.String st,
                             java.io.PrintWriter out)
                      throws TypeMismatchException
Prints the actual atomic result in the xml fashion. The result is printed on out object.
Overrides:
operatorXMLPRINT in class QueryResult
Parameters:
st - the string which is a auxiliary tabulator.
out - the object responsible for displaying information.
Throws:
TypeMismatchException - never in this case.

operatorCOUNT

public IntegerValue operatorCOUNT()
                           throws TypeMismatchException
Method responsible for unary count operation.
Overrides:
operatorCOUNT in class QueryResult
Returns:
the result of the unary count operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
IntegerValue

operatorEXISTS

public BooleanValue operatorEXISTS()
                            throws TypeMismatchException
Method responsible for unary exists operation.
Overrides:
operatorEXISTS in class QueryResult
Returns:
the result of the unary exists operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
BooleanValue

operatorSUM

public QueryResult operatorSUM()
                        throws TypeMismatchException
Method responsible for unary sum operation.
Overrides:
operatorSUM in class QueryResult
Returns:
the result of the unary sum operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult

operatorAVERAGE

public QueryResult operatorAVERAGE()
                            throws TypeMismatchException
Method responsible for unary average operation.
Overrides:
operatorAVERAGE in class QueryResult
Returns:
the result of the unary average operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult

operatorMINIMUM

public QueryResult operatorMINIMUM()
                            throws TypeMismatchException
Method responsible for unary minimum operation.
Overrides:
operatorMINIMUM in class QueryResult
Returns:
the result of the unary minimum operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult

operatorMAXIMUM

public QueryResult operatorMAXIMUM()
                            throws TypeMismatchException
Method responsible for unary maximum operation.
Overrides:
operatorMAXIMUM in class QueryResult
Returns:
the result of the unary maximum operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult

operatorTOSINGLE

public QueryResult operatorTOSINGLE()
                             throws TypeMismatchException
Method responsible for unary tosingle operation.
Overrides:
operatorTOSINGLE in class QueryResult
Returns:
the result of the unary tosingle operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult

operatorTOSTRUCT

public StructValue operatorTOSTRUCT()
                             throws TypeMismatchException
Method responsible for unary tostruct operation.
Overrides:
operatorTOSTRUCT in class QueryResult
Returns:
the result of the unary tostruct operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
StructValue

operatorTOBAG

public BagValue operatorTOBAG()
                       throws TypeMismatchException
Method responsible for unary tobag operation.
Overrides:
operatorTOBAG in class QueryResult
Returns:
the result of the unary tobag operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
BagValue

operatorTOSEQUENCE

public SequenceValue operatorTOSEQUENCE()
                                 throws TypeMismatchException
Method responsible for unary tosequence operation.
Overrides:
operatorTOSEQUENCE in class QueryResult
Returns:
the result of the unary tosequence operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
SequenceValue

operatorASCENDING

public QueryResult operatorASCENDING()
                              throws TypeMismatchException
Method responsible for unary ascending operation.
Overrides:
operatorASCENDING in class QueryResult
Returns:
the result of the unary ascending operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult

operatorDELETE

public void operatorDELETE(EnvironmentalStack ENVS)
                    throws TypeMismatchException
Method responsible for unary delete operation.
Overrides:
operatorDELETE in class QueryResult
Parameters:
ENVS - environmental stack which has to be updated.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
EnvironmentalStack

operatorCREATE

public QueryResult operatorCREATE(IdentifierValue iv)
                           throws TypeMismatchException
Method responsible for unary create operation.
Overrides:
operatorCREATE in class QueryResult
Parameters:
id - Identifier of the parent object in object store.
Returns:
by default, it always throws TypeMismatchException.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
IdentifierValue, BagValue, QueryResult

operatorCREATE

public void operatorCREATE(EnvironmentalStack ENVS)
                    throws TypeMismatchException
Method responsible for unary create operation on environmental stack.
Overrides:
operatorCREATE in class QueryResult
Parameters:
ENVS - environmental stack which has to be updated.
Returns:
by default, it always throws TypeMismatchException.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
EnvironmentalStack

operatorCREATELOCAL

public QueryResult operatorCREATELOCAL(IdentifierValue iv)
                                throws TypeMismatchException
Method responsible for unary create local operation.
Overrides:
operatorCREATELOCAL in class QueryResult
Parameters:
id - Identifier of the parent object in object store.
Returns:
by default, it always throws TypeMismatchException.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
IdentifierValue, BagValue, QueryResult

operatorCREATELOCAL

public void operatorCREATELOCAL(EnvironmentalStack ENVS)
                         throws TypeMismatchException
Method responsible for unary create local operation on environmental stack.
Overrides:
operatorCREATELOCAL in class QueryResult
Parameters:
ENVS - environmental stack which has to be updated.
Returns:
by default, it always throws TypeMismatchException.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
EnvironmentalStack

operatorCREATEPERMANENT

public QueryResult operatorCREATEPERMANENT(IdentifierValue iv)
                                    throws TypeMismatchException
Method responsible for unary create permanent operation.
Overrides:
operatorCREATEPERMANENT in class QueryResult
Parameters:
id - Identifier of the parent object in object store.
Returns:
by default, it always throws TypeMismatchException.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
IdentifierValue, BagValue, QueryResult

operatorCREATEPERMANENT

public void operatorCREATEPERMANENT(EnvironmentalStack ENVS)
                             throws TypeMismatchException
Method responsible for unary create permanent operation on environmental stack.
Overrides:
operatorCREATEPERMANENT in class QueryResult
Parameters:
ENVS - environmental stack which has to be updated.
Returns:
by default, it always throws TypeMismatchException.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
EnvironmentalStack

operatorGROUPAS

public BinderValue operatorGROUPAS(QueryResult r)
                            throws TypeMismatchException
Method responsible for unary group as operation.
Overrides:
operatorGROUPAS in class QueryResult
Parameters:
r - the right operand of the unary as operator.
Returns:
the result of the unary as operation.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult, BinderValue, StringValue

operatorRENAMETO

public void operatorRENAMETO(QueryResult r,
                             EnvironmentalStack ENVS)
                      throws TypeMismatchException
Method responsible for binary rename to operation.
Overrides:
operatorRENAMETO in class QueryResult
Parameters:
r - the right operand of the binary rename to operator.
ENVS - environmental stack which has to be updated.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult, EnvironmentalStack

operatorINSERTINTO

public void operatorINSERTINTO(QueryResult r,
                               EnvironmentalStack ENVS)
                        throws TypeMismatchException
Method responsible for binary insert into operation.
Overrides:
operatorINSERTINTO in class QueryResult
Parameters:
r - the right operand of the binary insert into operator.
ENVS - environmental stack which has to be updated.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult, EnvironmentalStack

operatorUPDATETO

public void operatorUPDATETO(QueryResult r)
                      throws TypeMismatchException
Method responsible for binary update to operation.
Overrides:
operatorUPDATETO in class QueryResult
Parameters:
r - the right operand of the binary update to operator.
Throws:
TypeMismatchException - if type mismatch occurs.
See Also:
QueryResult