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 String
FUNCTION_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 boolean
containsKey(Object key)
V
deserializeElement(XMLEventReader xer, SerializationState SerializationState, QDLInterpreter qi)
void
deserializeFromJSON(net.sf.json.JSONObject json, QDLInterpreter qi, SerializationState serializationState)
String
fromJSONEntry(String x, SerializationState serializationState)
void
fromXML(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)
String
getXMLElementTag()
String
getXMLTableTag()
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 ofDyadicFunctionReferenceNode
s.TreeSet<String>
listFunctions(String regex)
List first lines of function documentation given a regular expression.void
processSingleFunction(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.V
remove(Object key)
If argCount === -1, remove all named functions, otherwise only remove the one with the exact argCount.net.sf.json.JSONObject
serializeToJSON(V xThing, SerializationState serializationState)
String
toJSONEntry(V xThing, SerializationState serializationState)
void
toXML(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:
containsKey
in interfaceMap<K extends FKey,V extends FunctionRecord>
- Overrides:
containsKey
in classHashMap<K extends FKey,V extends FunctionRecord>
-
listFunctionReferences
public Set<DyadicFunctionReferenceNode> listFunctionReferences(String regex)
Return every function in this tables as a set ofDyadicFunctionReferenceNode
s.- Parameters:
regex
-- Returns:
-
listFunctions
public TreeSet<String> listFunctions(String regex)
Description copied from interface:Documentable
List first lines of function documentation given a regular expression.- Specified by:
listFunctions
in interfaceDocumentable
- Returns:
-
listAllDocs
public List<String> listAllDocs()
Just lists the first line of every function with documentation- Specified by:
listAllDocs
in interfaceDocumentable
- Returns:
-
listAllDocs
public List<String> listAllDocs(String fname)
Description copied from interface:Documentable
Return the first line of all documentation for the given function name.- Specified by:
listAllDocs
in 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:
getDocumentation
in interfaceDocumentable
- Parameters:
fName
-- Returns:
-
getDocumentation
public List<String> getDocumentation(FKey key)
- Specified by:
getDocumentation
in 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:
toXML
in 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:
deserializeElement
in classXTable<K extends FKey,V extends FunctionRecord>
- Returns:
- Throws:
XMLStreamException
-
fromXML
public void fromXML(XMLEventReader xer, QDLInterpreter qi) throws XMLStreamException
- Specified by:
fromXML
in classXTable<K extends FKey,V extends FunctionRecord>
- Throws:
XMLStreamException
-
getXMLTableTag
public String getXMLTableTag()
- Specified by:
getXMLTableTag
in classXTable<K extends FKey,V extends FunctionRecord>
- Returns:
-
getXMLElementTag
public String getXMLElementTag()
- Specified by:
getXMLElementTag
in classXTable<K extends FKey,V extends FunctionRecord>
- Returns:
-
toJSONEntry
public String toJSONEntry(V xThing, SerializationState serializationState)
- Specified by:
toJSONEntry
in classXTable<K extends FKey,V extends FunctionRecord>
-
serializeToJSON
public net.sf.json.JSONObject serializeToJSON(V xThing, SerializationState serializationState)
- Specified by:
serializeToJSON
in classXTable<K extends FKey,V extends FunctionRecord>
-
deserializeFromJSON
public void deserializeFromJSON(net.sf.json.JSONObject json, QDLInterpreter qi, SerializationState serializationState)
- Specified by:
deserializeFromJSON
in classXTable<K extends FKey,V extends FunctionRecord>
-
fromJSONEntry
public String fromJSONEntry(String x, SerializationState serializationState)
- Specified by:
fromJSONEntry
in classXTable<K extends FKey,V extends FunctionRecord>
-
-