Package org.qdl_lang.functions
Class FTable<K extends FKey,V extends FunctionRecord>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- org.qdl_lang.state.XTable<K,V>
-
- org.qdl_lang.functions.FTable<K,V>
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,V>,Documentable
public class FTable<K extends FKey,V extends FunctionRecord> extends XTable<K,V> implements Documentable
Created by Jeff Gaynor
on 11/19/21 at 7:48 AM- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static StringFUNCTION_ENTRY_KEY-
Fields inherited from class org.qdl_lang.state.XTable
FDOC_CONVERT
-
-
Constructor Summary
Constructors Constructor Description FTable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(Object key)VdeserializeElement(XMLEventReader xer, SerializationState SerializationState, QDLInterpreter qi)voiddeserializeFromJSON(org.kordamp.json.JSONObject json, QDLInterpreter qi, SerializationState serializationState)StringfromJSONEntry(String x, SerializationState serializationState)voidfromXML(XMLEventReader xer, QDLInterpreter qi)List<V>getByAllName(String name)List<String>getDocumentation(String fName, int argCount)Returns the specific documentation for a function.List<String>getDocumentation(FKey key)StringgetXMLElementTag()StringgetXMLTableTag()List<String>listAllDocs()Just lists the first line of every function with documentationList<String>listAllDocs(String fname)Return the first line of all documentation for the given function name.Set<DyadicFunctionReferenceNode>listFunctionReferences(String regex)Return every function in this tables as a set ofDyadicFunctionReferenceNodes.TreeSet<String>listFunctions(String regex)List first lines of function documentation given a regular expression.voidprocessSingleFunction(XMLEventReader xer, QDLInterpreter qi)Deserialize a single function using the interpreter (and its current state); This assumes that the function will get stuffed into the current state and that will get processed.Vremove(Object key)If argCount === -1, remove all named functions, otherwise only remove the one with the exact argCount.org.kordamp.json.JSONObjectserializeToJSON(V xThing, SerializationState serializationState)StringtoJSONEntry(V xThing, SerializationState serializationState)voidtoXML(XMLStreamWriter xsw, SerializationState SerializationState)Writes every function in no particular order by its source code.Collection<V>values()-
Methods inherited from class org.qdl_lang.state.XTable
convertFDOC, fromXML, getID, getModuleUtils, put, serializeToJSON, toString
-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, replace, replace, replaceAll, size
-
Methods inherited from class java.util.AbstractMap
equals, hashCode
-
-
-
-
Field Detail
-
FUNCTION_ENTRY_KEY
public static final String FUNCTION_ENTRY_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
remove
public V remove(Object key)
If argCount === -1, remove all named functions, otherwise only remove the one with the exact argCount.
-
values
public Collection<V> values()
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K extends FKey,V extends FunctionRecord>- Overrides:
containsKeyin classHashMap<K extends FKey,V extends FunctionRecord>
-
listFunctionReferences
public Set<DyadicFunctionReferenceNode> listFunctionReferences(String regex)
Return every function in this tables as a set ofDyadicFunctionReferenceNodes.- Parameters:
regex-- Returns:
-
listFunctions
public TreeSet<String> listFunctions(String regex)
Description copied from interface:DocumentableList first lines of function documentation given a regular expression. If the regular expression is null, then no filtering is done.- Specified by:
listFunctionsin interfaceDocumentable- Returns:
-
listAllDocs
public List<String> listAllDocs()
Just lists the first line of every function with documentation- Specified by:
listAllDocsin interfaceDocumentable- Returns:
-
listAllDocs
public List<String> listAllDocs(String fname)
Description copied from interface:DocumentableReturn the first line of all documentation for the given function name.- Specified by:
listAllDocsin interfaceDocumentable- Returns:
-
getDocumentation
public List<String> getDocumentation(String fName, int argCount)
Returns the specific documentation for a function. The request is of the form name(args);- Specified by:
getDocumentationin interfaceDocumentable- Parameters:
fName-- Returns:
-
getDocumentation
public List<String> getDocumentation(FKey key)
- Specified by:
getDocumentationin interfaceDocumentable
-
toXML
public void toXML(XMLStreamWriter xsw, SerializationState SerializationState) throws XMLStreamException
Writes every function in no particular order by its source code. Look atXStack.toXML(XMLStreamWriter, SerializationState)for top level of functions- Specified by:
toXMLin classXTable<K extends FKey,V extends FunctionRecord>- Throws:
XMLStreamException
-
processSingleFunction
public void processSingleFunction(XMLEventReader xer, QDLInterpreter qi) throws XMLStreamException
Deserialize a single function using the interpreter (and its current state); This assumes that the function will get stuffed into the current state and that will get processed.- Parameters:
xer-qi-- Throws:
XMLStreamException
-
deserializeElement
public V deserializeElement(XMLEventReader xer, SerializationState SerializationState, QDLInterpreter qi) throws XMLStreamException
- Specified by:
deserializeElementin classXTable<K extends FKey,V extends FunctionRecord>- Returns:
- Throws:
XMLStreamException
-
fromXML
public void fromXML(XMLEventReader xer, QDLInterpreter qi) throws XMLStreamException
- Specified by:
fromXMLin classXTable<K extends FKey,V extends FunctionRecord>- Throws:
XMLStreamException
-
getXMLTableTag
public String getXMLTableTag()
- Specified by:
getXMLTableTagin classXTable<K extends FKey,V extends FunctionRecord>- Returns:
-
getXMLElementTag
public String getXMLElementTag()
- Specified by:
getXMLElementTagin classXTable<K extends FKey,V extends FunctionRecord>- Returns:
-
toJSONEntry
public String toJSONEntry(V xThing, SerializationState serializationState)
- Specified by:
toJSONEntryin classXTable<K extends FKey,V extends FunctionRecord>
-
serializeToJSON
public org.kordamp.json.JSONObject serializeToJSON(V xThing, SerializationState serializationState)
- Specified by:
serializeToJSONin classXTable<K extends FKey,V extends FunctionRecord>
-
deserializeFromJSON
public void deserializeFromJSON(org.kordamp.json.JSONObject json, QDLInterpreter qi, SerializationState serializationState)- Specified by:
deserializeFromJSONin classXTable<K extends FKey,V extends FunctionRecord>
-
fromJSONEntry
public String fromJSONEntry(String x, SerializationState serializationState)
- Specified by:
fromJSONEntryin classXTable<K extends FKey,V extends FunctionRecord>
-
-