Package org.qdl_lang.expressions
Class StemExtractionNode
- java.lang.Object
-
- org.qdl_lang.expressions.ExpressionImpl
-
- org.qdl_lang.expressions.StemExtractionNode
-
- All Implemented Interfaces:
Serializable,ExpressionNode,ExpressionInterface,HasResultInterface,Statement
public class StemExtractionNode extends ExpressionImpl
This will allow for creating a subset (copy of portion) of a stem. The result is a stem completely indep. of the original.Created by Jeff Gaynor
on 6/27/22 at 4:02 PM- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXTRACTstatic StringEXTRACT_LISTstatic StringEXTRACT_LIST_STARstatic StringEXTRACT_LIST_UNIQUEstatic StringEXTRACT_LIST_UNIQUE_STARstatic StringEXTRACT_STARstatic StringEXTRACT_UNIQUEstatic StringEXTRACT_UNIQUE_STAR-
Fields inherited from class org.qdl_lang.expressions.ExpressionImpl
arguments, result, valence
-
Fields inherited from interface org.qdl_lang.statements.ExpressionInterface
ALL_INDICES_NODE, ALT_IF_NODE, ASSIGNMENT_NODE, AXIS_RESTRICTION_NODE, CLOSED_SLICE_NODE, COMPARISON_DYAD_NODE, CONSTANT_NODE, DYAD_NODE, DYADIC_FUNCTION_REFERENCE_NODE, EXPRESSION_STEM_NODE, EXPRESSION_STEM2_NODE, FUNCTION_REFERENCE_NODE, LAMBDA_DEFINITION_NODE, LIST_NODE, MODULE_NODE, MONAD_NODE, NILAD_NODE, OPEN_SLICE_NODE, PARENTHESIZED_NODE, PARSE_EXPRESSION_BLOCK_NODE, PARSE_STATEMENT_BLOCK_NODE, POLYAD_NODE, QDL_NULL_NODE, SELECT_NODE, SET_NODE, STEM_ENTRY_NODE, STEM_EXTRACTION_NODE, STEM_NODE, UNKNOWN_NODE, VARIABLE_NODE
-
-
Constructor Summary
Constructors Constructor Description StemExtractionNode()StemExtractionNode(int operatorType)StemExtractionNode(int operatorType, TokenPosition tokenPosition)StemExtractionNode(TokenPosition tokenPosition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddArgument(IndexArg indexArg)protected IndexArgscheckIfAlreadyLinearized(State state)QDLValueevaluate(State state)ExpressionInterfacegetLeftArg()intgetNodeType()QDL is not strongly typed but Java is, so each node type should have a unique integer and conditionals should use that, not the instanceof operator.ExpressionInterfacegetRightArg()protected List<IndexArg>linearize(State state)Start linearizing the tree.protected IndexArgslinearizeLeftArgs(List<IndexArg> indices, State state)Some parts of parse trees are left balanced, not right.ExpressionInterfacemakeCopy()protected IndexArgsnormalize(IndexArgs args)Remove any trailing *'s.protected QDLValuerecurse(QDLStem in, IndexArgs sourceIndices, State state)Starts descent through all of the nodesprotected Objectrecurse(QDLStem in, QDLStem out, IndexList targetIndex, List<IndexArg> sourceIndices, int indexLocation, long strictIndex, State state)voidsetLeftArg(ExpressionInterface swri)voidsetRightArg(ExpressionInterface swri)StringtoString()-
Methods inherited from class org.qdl_lang.expressions.ExpressionImpl
addArgument, evalArg, evalLastArg, evaluatedArgs, getAlias, getArgAt, getArgCount, getArguments, getEvaluatedArgs, getLastArg, getOperatorType, getResult, getResultType, getSourceCode, getTokenPosition, hasAlias, hasEvaluatedArgs, hasTokenPosition, isEvaluated, isSizeQuery, setAlias, setArguments, setEvaluated, setEvaluatedArgs, setOperatorType, setResult, setResult, setSizeQuery, setSourceCode, setTokenPosition
-
-
-
-
Field Detail
-
EXTRACT
public static final String EXTRACT
- See Also:
- Constant Field Values
-
EXTRACT_STAR
public static final String EXTRACT_STAR
- See Also:
- Constant Field Values
-
EXTRACT_UNIQUE
public static final String EXTRACT_UNIQUE
- See Also:
- Constant Field Values
-
EXTRACT_UNIQUE_STAR
public static final String EXTRACT_UNIQUE_STAR
- See Also:
- Constant Field Values
-
EXTRACT_LIST
public static final String EXTRACT_LIST
- See Also:
- Constant Field Values
-
EXTRACT_LIST_STAR
public static final String EXTRACT_LIST_STAR
- See Also:
- Constant Field Values
-
EXTRACT_LIST_UNIQUE
public static final String EXTRACT_LIST_UNIQUE
- See Also:
- Constant Field Values
-
EXTRACT_LIST_UNIQUE_STAR
public static final String EXTRACT_LIST_UNIQUE_STAR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StemExtractionNode
public StemExtractionNode()
-
StemExtractionNode
public StemExtractionNode(TokenPosition tokenPosition)
-
StemExtractionNode
public StemExtractionNode(int operatorType, TokenPosition tokenPosition)
-
StemExtractionNode
public StemExtractionNode(int operatorType)
-
-
Method Detail
-
normalize
protected IndexArgs normalize(IndexArgs args)
Remove any trailing *'s. These do nothing but make the system loop through everything.a\2\*\*\* == a\2 == a.2- Parameters:
args-- Returns:
-
recurse
protected QDLValue recurse(QDLStem in, IndexArgs sourceIndices, State state)
Starts descent through all of the nodes- Parameters:
in-sourceIndices-- Returns:
-
recurse
protected Object recurse(QDLStem in, QDLStem out, IndexList targetIndex, List<IndexArg> sourceIndices, int indexLocation, long strictIndex, State state)
-
linearizeLeftArgs
protected IndexArgs linearizeLeftArgs(List<IndexArg> indices, State state)
Some parts of parse trees are left balanced, not right. linearizes a left tree- Returns:
-
linearize
protected List<IndexArg> linearize(State state)
Start linearizing the tree. This treats trees balanced on the right directly,and calls another method if there is a left hand tree.- Returns:
-
makeCopy
public ExpressionInterface makeCopy()
-
getLeftArg
public ExpressionInterface getLeftArg()
-
setLeftArg
public void setLeftArg(ExpressionInterface swri)
-
setRightArg
public void setRightArg(ExpressionInterface swri)
-
getRightArg
public ExpressionInterface getRightArg()
-
addArgument
public void addArgument(IndexArg indexArg)
-
toString
public String toString()
- Overrides:
toStringin classExpressionImpl
-
getNodeType
public int getNodeType()
Description copied from interface:ExpressionInterfaceQDL is not strongly typed but Java is, so each node type should have a unique integer and conditionals should use that, not the instanceof operator. This allows for efficient programming with switch statements rather than a bevy of conditionals (potentially each of which gets done even if the correct case has been handled).- Returns:
-
-