java.lang.Object
org.refcodes.struct.CanonicalMapImpl
- All Implemented Interfaces:
org.refcodes.mixin.AnnotatorAccessor
,org.refcodes.mixin.DelimiterAccessor
,org.refcodes.mixin.Dumpable
,org.refcodes.mixin.EmptyAccessor
,org.refcodes.mixin.TypeAccessor<String>
,CanonicalMap
,Containable
,Dictionary<String,
,String> InterOperableMap<String>
,Keys<String,
,String> PathMap<String>
The Class CanonicalMapImpl.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.AnnotatorAccessor
org.refcodes.mixin.AnnotatorAccessor.AnnotatorBuilder<B extends org.refcodes.mixin.AnnotatorAccessor.AnnotatorBuilder<B>>, org.refcodes.mixin.AnnotatorAccessor.AnnotatorMutator, org.refcodes.mixin.AnnotatorAccessor.AnnotatorProperty
Nested classes/interfaces inherited from interface org.refcodes.struct.CanonicalMap
CanonicalMap.CanonicalMapBuilder, CanonicalMap.MutableCanonicalMap
Nested classes/interfaces inherited from interface org.refcodes.mixin.DelimiterAccessor
org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B extends org.refcodes.mixin.DelimiterAccessor.DelimiterBuilder<B>>, org.refcodes.mixin.DelimiterAccessor.DelimiterMutator, org.refcodes.mixin.DelimiterAccessor.DelimiterProperty
Nested classes/interfaces inherited from interface org.refcodes.struct.Dictionary
Dictionary.MutableDictionary<K,
V> Nested classes/interfaces inherited from interface org.refcodes.mixin.EmptyAccessor
org.refcodes.mixin.EmptyAccessor.EmptyMutator, org.refcodes.mixin.EmptyAccessor.EmptyProperty
Nested classes/interfaces inherited from interface org.refcodes.struct.InterOperableMap
InterOperableMap.InterOperableMapBuilder<T>, InterOperableMap.MutableInterOperableMap<T>
Nested classes/interfaces inherited from interface org.refcodes.struct.Keys
Keys.MutableKeys<K,
V>, Keys.MutableValues<K, V> Nested classes/interfaces inherited from interface org.refcodes.struct.PathMap
PathMap.MutablePathMap<T>, PathMap.PathMapBuilder<T>
Nested classes/interfaces inherited from interface org.refcodes.mixin.TypeAccessor
org.refcodes.mixin.TypeAccessor.TypeBuilder<T extends Object,
B extends org.refcodes.mixin.TypeAccessor.TypeBuilder<T, B>>, org.refcodes.mixin.TypeAccessor.TypeMutator<T extends Object>, org.refcodes.mixin.TypeAccessor.TypeProperty<T extends Object> -
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate an emptyCanonicalMap
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.CanonicalMapImpl
(char aDelimiter) Create aCanonicalMap
instance using the provided path delimiter for the path declarations.CanonicalMapImpl
(Object aObj) Create aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.CanonicalMapImpl
(Object aObj, char aDelimiter) Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
.CanonicalMapImpl
(Object aObj, String aFromPath) Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.CanonicalMapImpl
(Object aObj, String aFromPath, char aDelimiter) Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
.CanonicalMapImpl
(String aToPath, Object aObj) Create aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.CanonicalMapImpl
(String aToPath, Object aObj, char aDelimiter) Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
.CanonicalMapImpl
(String aToPath, Object aObj, String aFromPath) Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
for the path declarations.CanonicalMapImpl
(String aToPath, Object aObj, String aFromPath, char aDelimiter) Create aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Object aKey) Tests whether there is an element with the given key.Retrieves the element assigned to the given key.char
char
getType()
boolean
isEmpty()
keySet()
Retrieves a collection containing all the keys found in the elements of this collection.retrieveFrom
(String aFromPath) retrieveTo
(String aToPath) int
size()
Returns the number of data elements contained in the collection.toDataStructure
(String aFromPath) Similar to thePathMap.toMap(String)
method, though in case all the keys of a nestedMap
instance (applicable to the rootMap
as well) represent an array (as ofPathMap.getArray(String)
), then an array is generated where the index of each value in theMap
is represented by the number representation of theMap
's key for that value.values()
Returns aCollection
view of the values related to the contained keys.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.refcodes.struct.CanonicalMap
asArray, asArray, asArray, asArray, asBooleanArray, asBooleanArray, asBooleanArray, asBooleanArray, asByteArray, asByteArray, asByteArray, asByteArray, asCharArray, asCharArray, asCharArray, asCharArray, asDoubleArray, asDoubleArray, asDoubleArray, asDoubleArray, asFloatArray, asFloatArray, asFloatArray, asFloatArray, asIntArray, asIntArray, asIntArray, asIntArray, asLongArray, asLongArray, asLongArray, asLongArray, asShortArray, asShortArray, asShortArray, asShortArray, containsValue, getDir, getDir, getDir, getDir, getDir, getDirAt, getDirAt, getDirAt, getDirAt, getDirAt, getDirAt, getDirs, getDirs, getDirs, getDirs, getDirs, query, query, query, query, query, queryBetween, queryBetween, queryBetween, queryBetween, queryBetween, queryBetween, queryFrom, queryFrom, queryFrom, queryFrom, queryFrom, queryFrom, queryTo, queryTo, queryTo, queryTo, queryTo, queryTo, retrieveBetween, retrieveBetween, retrieveBetween, retrieveBetween, retrieveBetween, retrieveFrom, retrieveFrom, retrieveFrom, retrieveFrom, retrieveTo, retrieveTo, retrieveTo, retrieveTo, toMap, toProperties
Methods inherited from interface org.refcodes.mixin.Dumpable
toDump, toDump
Methods inherited from interface org.refcodes.struct.InterOperableMap
getBoolean, getBoolean, getBoolean, getBoolean, getBoolean, getBooleanOr, getBooleanOr, getBooleanOr, getBooleanOr, getBooleanOr, getByte, getByte, getByte, getByte, getByte, getByteOr, getByteOr, getByteOr, getByteOr, getByteOr, getChar, getChar, getChar, getChar, getChar, getCharOr, getCharOr, getCharOr, getCharOr, getCharOr, getClass, getClass, getClass, getClass, getClass, getClassOr, getClassOr, getClassOr, getClassOr, getClassOr, getDouble, getDouble, getDouble, getDouble, getDouble, getDoubleOr, getDoubleOr, getDoubleOr, getDoubleOr, getDoubleOr, getEnum, getEnum, getEnum, getEnum, getEnum, getEnumOr, getEnumOr, getEnumOr, getEnumOr, getEnumOr, getEnumOr, getEnumOr, getEnumOr, getEnumOr, getEnumOr, getFloat, getFloat, getFloat, getFloat, getFloat, getFloatOr, getFloatOr, getFloatOr, getFloatOr, getFloatOr, getInt, getInt, getInt, getInt, getInt, getIntOr, getIntOr, getIntOr, getIntOr, getIntOr, getLong, getLong, getLong, getLong, getLong, getLongOr, getLongOr, getLongOr, getLongOr, getLongOr, getShort, getShort, getShort, getShort, getShort, getShortOr, getShortOr, getShortOr, getShortOr, getShortOr, getString, getString, getString, getString, getString, getStringOr, getStringOr, getStringOr, getStringOr, getStringOr
Methods inherited from interface org.refcodes.struct.PathMap
children, children, children, children, children, children, containsKey, containsKey, containsKey, dirs, dirs, dirs, dirs, dirs, dirs, findPaths, fromExternalPath, get, get, get, getArray, getArray, getArray, getArray, getArray, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayIndexes, getArrayOr, getArrayOr, getArrayOr, getArrayOr, getArrayOr, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getDirIndexes, getRootPath, getValueAt, getValueAt, getValueAt, getValueAt, getValueAt, getValueAt, hasChildren, hasChildren, hasChildren, hasChildren, hasChildren, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasDirAt, hasParentPath, hasPath, hasPath, hasPath, hasPath, hasSubDirs, hasSubDirs, hasSubDirs, hasSubDirs, hasValue, hasValue, hasValue, hasValue, hasValue, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, hasValueAt, isArray, isArray, isArray, isArray, isArray, isArray, isChild, isChild, isChild, isChild, isDir, isDir, isDir, isDir, isDir, isEqualTo, isIndexDir, isIndexDir, isIndexDir, isIndexDir, isIndexDir, isLeaf, isLeaf, isLeaf, isLeaf, isLeaf, isRootPath, keySet, keySet, keySet, keySet, keySet, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastArrayIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, lastDirIndex, leaves, leaves, leaves, leaves, leaves, leaves, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextArrayIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, nextDirIndex, paths, paths, paths, paths, paths, paths, queryPaths, queryPaths, queryPaths, queryPaths, queryPaths, queryPaths, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, sortedKeys, toDataStructure, toExternalPath, toInstance, toInstance, toLeaf, toMap, toNormalizedPath, toParentPath, toPath, toPath, toPath, toPath, toPathElements, toPathList, toPathStack, toPrintable, toPropertyPath, toType, toType, toType, toType, toType, toType, toType, toType
-
Field Details
-
_canonicalMap
-
-
Constructor Details
-
CanonicalMapImpl
public CanonicalMapImpl()Create an emptyCanonicalMap
instance using the default path delimiter "/" (Delimiter.PATH
) for the path declarations. -
CanonicalMapImpl
public CanonicalMapImpl(char aDelimiter) Create aCanonicalMap
instance using the provided path delimiter for the path declarations.- Parameters:
aDelimiter
- The path delimiter to be used for the path declarations.
-
CanonicalMapImpl
Create aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.- Parameters:
aObj
- The object from which the elements are to be added.
-
CanonicalMapImpl
Create aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.- Parameters:
aToPath
- The sub-path where to insert the object's introspected values to.aObj
- The object from which the elements are to be added.
-
CanonicalMapImpl
Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
) for the path declarations.- Parameters:
aObj
- The object from which the elements are to be added.aFromPath
- The path from where to start adding elements of the provided object.
-
CanonicalMapImpl
Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
using the default path delimiter "/" (Delimiter.PATH
for the path declarations.- Parameters:
aToPath
- The sub-path where to insert the object's introspected values to.aObj
- The object from which the elements are to be added.aFromPath
- The path from where to start adding elements of the provided object.
-
CanonicalMapImpl
Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
.- Parameters:
aObj
- The object from which the elements are to be added.aDelimiter
- The path delimiter to be used for the path declarations.
-
CanonicalMapImpl
Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
.- Parameters:
aToPath
- The sub-path where to insert the object's introspected values to.aObj
- The object from which the elements are to be added.aDelimiter
- The path delimiter to be used for the path declarations.
-
CanonicalMapImpl
Creates aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
.- Parameters:
aObj
- The object from which the elements are to be added.aFromPath
- The path from where to start adding elements of the provided object.aDelimiter
- The path delimiter to be used for the path declarations.
-
CanonicalMapImpl
Create aCanonicalMap
instance containing the elements as ofPathMap.MutablePathMap.insert(Object)
.- Parameters:
aToPath
- The sub-path where to insert the object's introspected values to.aObj
- The object from which the elements are to be added.aFromPath
- The path from where to start adding elements of the provided object.aDelimiter
- The path delimiter to be used for the path declarations.
-
-
Method Details
-
containsKey
Tests whether there is an element with the given key.- Specified by:
containsKey
in interfaceKeys<String,
String> - Parameters:
aKey
- The key for which to test whether there is an element.- Returns:
- True in case there is an element for the given key.
-
get
Retrieves the element assigned to the given key. -
keySet
Retrieves a collection containing all the keys found in the elements of this collection. -
values
Returns aCollection
view of the values related to the contained keys.- Specified by:
values
in interfaceKeys<String,
String> - Returns:
- A
Collection
view of the values related to the contained keys.
-
size
public int size()Returns the number of data elements contained in the collection.- Specified by:
size
in interfaceContainable
- Returns:
- An integer representing the number of items stored in the accumulation.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceorg.refcodes.mixin.EmptyAccessor
-
retrieveFrom
Extracts a newPathMap
from the elements of thisPathMap
found below the "from-path". The sub-paths will be the root paths for the newPathMap
. Given we have a value for path "/dog/cat" in thePathMap
and we callPathMap.retrieveFrom(String)
with "/dog", then the resultingPathMap
will contain the path "/cat" for that value.- Specified by:
retrieveFrom
in interfaceCanonicalMap
- Specified by:
retrieveFrom
in interfacePathMap<String>
- Parameters:
aFromPath
- The path from where to start extracting the paths.- Returns:
- The
PathMap
with the elements below the provided path which are root elements in the newPathMap
.
-
retrieveTo
Extracts a newPathMap
from thisPathMap
's elements with the paths relocated to the provided "to-path". Given we have a value for path "/dog/cat" in thePathMap
and we callPathMap.retrieveTo(String)
with "/animals", then the resultingPathMap
will contain the path "/animals/dog/cat" for that value.- Specified by:
retrieveTo
in interfaceCanonicalMap
- Specified by:
retrieveTo
in interfacePathMap<String>
- Parameters:
aToPath
- The path where to relocate the paths of thisPathMap
to.- Returns:
- The
PathMap
with the elements from the providedPathMap
with accordingly relocated paths.
-
getAnnotator
public char getAnnotator()- Specified by:
getAnnotator
in interfaceorg.refcodes.mixin.AnnotatorAccessor
-
getDelimiter
public char getDelimiter()- Specified by:
getDelimiter
in interfaceorg.refcodes.mixin.DelimiterAccessor
-
getType
- Specified by:
getType
in interfaceorg.refcodes.mixin.TypeAccessor<String>
-
toDataStructure
Similar to thePathMap.toMap(String)
method, though in case all the keys of a nestedMap
instance (applicable to the rootMap
as well) represent an array (as ofPathMap.getArray(String)
), then an array is generated where the index of each value in theMap
is represented by the number representation of theMap
's key for that value. The result is a data structure consisting ofMap
instances and arrays.- Specified by:
toDataStructure
in interfacePathMap<String>
- Parameters:
aFromPath
- The path below which thePathMap
to be converted into a data structure.- Returns:
- A data structure being a mixture of
Map
instances and arrays representing the data below the given path.
-