Package gnu.expr
Class Keyword
java.lang.Object
gnu.mapping.Symbol
gnu.expr.Keyword
- All Implemented Interfaces:
EnvironmentKey
,Externalizable
,Serializable
,Comparable
Implementation of Lisp keywords.
Keywords are symbolic identifiers that evaluate to themselves, as opposed to
symbols which generally name other values.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasSymbol()
Get the corresponding non-keyword symbol.static boolean
Test whether an object is a keyword.static Keyword
Create or find a Keyword with a given name (without ':').void
static Object
searchForKeyword
(Object[] vals, int offset, Object keyword) Search vals[0:offset-1] for a keyword.static Object
searchForKeyword
(Object[] vals, int offset, Object keyword, Object dfault) Search vals[0:offset-1] for a keyword.final String
toString()
void
Methods inherited from class gnu.mapping.Symbol
compareTo, equals, equals, getKeyProperty, getKeySymbol, getLocalName, getLocalPart, getName, getNamespace, getNamespaceURI, getPrefix, hasEmptyNamespace, hashCode, hasUnknownNamespace, make, make, makeUninterned, makeUninterned, makeWithUnknownNamespace, matches, matches, parse, setNamespace, toString, valueOf, valueOf, valueOf
-
Field Details
-
keywordNamespace
-
-
Constructor Details
-
Keyword
public Keyword() -
Keyword
Used for constructing literals (int gnu.expr.LitTable).
-
-
Method Details
-
asSymbol
Get the corresponding non-keyword symbol. Informally, the symbol corresponding to dropping the ':'. -
make
Create or find a Keyword with a given name (without ':').- Parameters:
name
- the print-name of the desired Keyword- Returns:
- a Keyword with the given name, newly created iff none such exist
-
isKeyword
Test whether an object is a keyword.- Parameters:
obj
- the object to test.- Returns:
true
if the object is a keyword,false
otherwise.
-
toString
-
searchForKeyword
Search vals[0:offset-1] for a keyword. Each key at vals[i] is followed by a value at keys[i+1]. (This is used to search for a keyword parameter in an argument list.)- Parameters:
vals
- the list to search inoffset
- the index in vals to start the search atkeyword
- the keyword to search for- Returns:
- vals[i+1] such that vals[i]==keyword (and (i-offset) is even and non-negative); if there is no such i, return Special.dfault.
-
searchForKeyword
Search vals[0:offset-1] for a keyword. Each key at vals[i] is followed by a value at keys[i+1]. (This is used to search for a keyword parameter in an argument list.)- Parameters:
vals
- the list to search inoffset
- the index in vals to start the search atkeyword
- the keyword to search fordfault
- the value to return if there is no match- Returns:
- vals[i+1] such that vals[i]==keyword (and (i-offset) is even and non-negative); if there is no such i, return dfault.
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classSymbol
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classSymbol
- Throws:
IOException
ClassNotFoundException
-
readResolve
- Overrides:
readResolve
in classSymbol
- Throws:
ObjectStreamException
-