Package org.qdl_lang.variables
Class StemUtility
- java.lang.Object
- 
- org.qdl_lang.variables.StemUtility
 
- 
 public class StemUtility extends Object Created by Jeff Gaynor 
 on 3/24/21 at 12:38 PM
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceStemUtility.DyadAxisActionAction to be applied at a given axis.static interfaceStemUtility.StemAxisWalkerAction1For operations that return a stem.
 - 
Field SummaryFields Modifier and Type Field Description protected static intBOOLEAN_TYPEprotected static intDOUBLE_TYPEprotected static intFLOAT_TYPEprotected static intINT_TYPEstatic LongLAST_AXIS_ARGUMENT_VALUEprotected static intLIST_TYPEprotected static intLONG_TYPEprotected static intMAP_TYPEprotected static intSTRING_TYPEprotected static intUNKNON_TYPE
 - 
Constructor SummaryConstructors Constructor Description StemUtility()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanareAllStems(Object... objects)static booleanareNoneStems(Object... objects)static voidaxisDayadRecursion(QDLStem out0, QDLStem left0, QDLStem right0, int depth, boolean maxDepth, StemUtility.DyadAxisAction axisAction)Apply some action along an axis.static ObjectaxisWalker(QDLStem inStem, int depth, StemUtility.StemAxisWalkerAction1 walker)Recurses through stem that has arbitrary rank.protected static QDLValueconvert(Object value)Converts Java objects to one of the Java objects that QDL uses.static ObjectconvertToPOJO(QDLValue element, boolean escapeNames, int type)For use in filteringQDLValues to POJOs (plain old java object) that can be put into JSON.static voiddoNodeSurgery(ExpressionStemNode ESN, State state)static voidformatList(QDLStem stem)protected static intgetType(Object obj)static booleanisStem(Object o)static QDLValuelistToStem(List list)static voidmain(String[] args)static QDLValuemapToStem(Map map)Convert a generic map to a stemstatic QDLValuemapToStem(QDLStem out, Map map)static voidput(QDLStem stem, Object key, Object value)Since Java's use of generics precludes a generalQDLStemput on Objects, this utility does that.static voidsetStemValue(QDLStem stem, Map<String,Object> values)Floats a map of values toQDLValues in the stem.static StringstemListToString(QDLStem contents, boolean forceToString)Convert a stem list to a string, separated by line feeds.
 
- 
- 
- 
Field Detail- 
LAST_AXIS_ARGUMENT_VALUEpublic static final Long LAST_AXIS_ARGUMENT_VALUE 
 - 
UNKNON_TYPEprotected static final int UNKNON_TYPE - See Also:
- Constant Field Values
 
 - 
INT_TYPEprotected static final int INT_TYPE - See Also:
- Constant Field Values
 
 - 
FLOAT_TYPEprotected static final int FLOAT_TYPE - See Also:
- Constant Field Values
 
 - 
DOUBLE_TYPEprotected static final int DOUBLE_TYPE - See Also:
- Constant Field Values
 
 - 
LONG_TYPEprotected static final int LONG_TYPE - See Also:
- Constant Field Values
 
 - 
BOOLEAN_TYPEprotected static final int BOOLEAN_TYPE - See Also:
- Constant Field Values
 
 - 
STRING_TYPEprotected static final int STRING_TYPE - See Also:
- Constant Field Values
 
 - 
LIST_TYPEprotected static final int LIST_TYPE - See Also:
- Constant Field Values
 
 - 
MAP_TYPEprotected static final int MAP_TYPE - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
isStempublic static boolean isStem(Object o) 
 - 
areNoneStemspublic static boolean areNoneStems(Object... objects) 
 - 
areAllStemspublic static boolean areAllStems(Object... objects) 
 - 
axisDayadRecursionpublic static void axisDayadRecursion(QDLStem out0, QDLStem left0, QDLStem right0, int depth, boolean maxDepth, StemUtility.DyadAxisAction axisAction) Apply some action along an axis. This will recurse to a given axis and apply an action there- Parameters:
- out0-
- left0-
- right0-
- depth-
- maxDepth-
- axisAction-
 
 - 
axisWalkerpublic static Object axisWalker(QDLStem inStem, int depth, StemUtility.StemAxisWalkerAction1 walker) Recurses through stem that has arbitrary rank.- Parameters:
- inStem-
- depth-
- walker-
- Returns:
 
 - 
doNodeSurgerypublic static void doNodeSurgery(ExpressionStemNode ESN, State state) 
 - 
formatListpublic static void formatList(QDLStem stem) 
 - 
mainpublic static void main(String[] args) 
 - 
stemListToStringpublic static String stemListToString(QDLStem contents, boolean forceToString) Convert a stem list to a string, separated by line feeds. IfforceToStringis true, then every elements toString is called, otherwise, if the element is not a string, an exception is thrown.- Parameters:
- contents-
- forceToString-
- Returns:
 
 - 
mapToStempublic static QDLValue mapToStem(Map map) Convert a generic map to a stem- Parameters:
- map-
- Returns:
 
 - 
convertprotected static QDLValue convert(Object value) Converts Java objects to one of the Java objects that QDL uses.- Parameters:
- value-
- Returns:
 
 - 
getTypeprotected static int getType(Object obj) 
 - 
setStemValuepublic static void setStemValue(QDLStem stem, Map<String,Object> values) Floats a map of values toQDLValues in the stem. This way you don't have to mess with conversions- Parameters:
- stem-
- values-
 
 - 
putpublic static void put(QDLStem stem, Object key, Object value) Since Java's use of generics precludes a generalQDLStemput on Objects, this utility does that.- Parameters:
- stem-
- key-
- value-
 
 
- 
 
-