Package coneforest.psylla.core
Class PsyDict
- java.lang.Object
-
- coneforest.psylla.core.PsyDict
-
- All Implemented Interfaces:
PsyClearable
,PsyContainer<PsyObject>
,PsyConvertableToName
,PsyConvertableToString
,PsyDictlike<PsyObject>
,PsyIndexed<PsyStringy,PsyObject>
,PsyIterable<PsyObject>
,PsyLengthy
,PsyObject
,PsyStreamlike<PsyObject>
,Iterable<PsyObject>
- Direct Known Subclasses:
PsyModule
,PsyNamespace
public class PsyDict extends Object implements PsyDictlike<PsyObject>
A representation of Ψ-dict
, a dictionary.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PsyObject
get(String key)
boolean
isEmpty()
Returns a boolean indicating if this container is empty (has zero length).Iterator<PsyObject>
iterator()
boolean
known(String key)
int
length()
Returns a length of this object.void
psyClear()
Clear this object.PsyDict
psyClone()
Returns a clone of this object.PsyIterable<PsyStringy>
psyKeys()
Returns a Ψ-iterable
enumeration of all the keys of this object.PsyDict
psySlice(PsyIterable<PsyStringy> oKeys)
Returns a container of the same type as this object consisting of keys or indices from given Ψ-iterable
and of associated values.PsyStream
psyStream()
void
put(String key, PsyObject o)
void
undef(String key)
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface coneforest.psylla.core.PsyContainer
psyNewEmpty
-
Methods inherited from interface coneforest.psylla.core.PsyDictlike
psyDelete, psyEntries, psyExtract, psyGet, psyGetAll, psyKnown, psyPut, psyUndef, psyValues, toSyntaxString, toSyntaxStringHelper
-
Methods inherited from interface coneforest.psylla.core.PsyIterable
psyCount, psyFilter, psyForAll, psyMap, psyToArray, psyUnite
-
Methods inherited from interface coneforest.psylla.core.PsyLengthy
psyIsEmpty, psyLength
-
Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToName, psyToString, psyType, typeName
-
Methods inherited from interface coneforest.psylla.core.PsyStreamlike
psyConcat
-
-
-
-
Method Detail
-
psyClone
public PsyDict psyClone()
Description copied from interface:PsyObject
Returns a clone of this object.
-
get
public PsyObject get(String key) throws PsyException
- Specified by:
get
in interfacePsyDictlike<PsyObject>
- Throws:
PsyException
-
put
public void put(String key, PsyObject o)
- Specified by:
put
in interfacePsyDictlike<PsyObject>
-
undef
public void undef(String key)
- Specified by:
undef
in interfacePsyDictlike<PsyObject>
-
known
public boolean known(String key)
- Specified by:
known
in interfacePsyDictlike<PsyObject>
-
length
public int length()
Description copied from interface:PsyLengthy
Returns a length of this object.- Specified by:
length
in interfacePsyLengthy
- Returns:
- a length.
-
isEmpty
public boolean isEmpty()
Description copied from interface:PsyLengthy
Returns a boolean indicating if this container is empty (has zero length).- Specified by:
isEmpty
in interfacePsyLengthy
- Returns:
true
, if this container is empty, andfalse
otherwise.
-
psyClear
public void psyClear()
Description copied from interface:PsyClearable
Clear this object.- Specified by:
psyClear
in interfacePsyClearable
- Specified by:
psyClear
in interfacePsyDictlike<PsyObject>
-
psySlice
public PsyDict psySlice(PsyIterable<PsyStringy> oKeys) throws PsyException
Description copied from interface:PsyIndexed
Returns a container of the same type as this object consisting of keys or indices from given Ψ-iterable
and of associated values.- Specified by:
psySlice
in interfacePsyDictlike<PsyObject>
- Specified by:
psySlice
in interfacePsyIndexed<PsyStringy,PsyObject>
- Parameters:
oKeys
- an enumeration of keys.- Returns:
- a container.
- Throws:
PsyException
- when key is absent or index is out of range.
-
psyKeys
public PsyIterable<PsyStringy> psyKeys()
Description copied from interface:PsyIndexed
Returns a Ψ-iterable
enumeration of all the keys of this object.- Specified by:
psyKeys
in interfacePsyDictlike<PsyObject>
- Specified by:
psyKeys
in interfacePsyIndexed<PsyStringy,PsyObject>
- Returns:
- an enumeration of keys.
-
psyStream
public PsyStream psyStream()
- Specified by:
psyStream
in interfacePsyIterable<PsyObject>
-
-