Package org.orekit.utils
Class DoubleArrayDictionary
java.lang.Object
org.orekit.utils.DoubleArrayDictionary
- All Implemented Interfaces:
Serializable
String → double[] mapping, for small number of keys.
This class is a low overhead for a very small number of keys.
It is based on simple array and string comparison. It plays
the same role a Map<String, double[]> but with reduced
features and not intended for large number of keys. For such
needs the regular Map<String, double[]> should be preferred.
- Since:
- 11.1
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionConstructor withdefault initial capacity.DoubleArrayDictionary(int initialCapacity) Constructor with specified capacity.DoubleArrayDictionary(Map<String, double[]> map) Constructor from a map.DoubleArrayDictionary(DoubleArrayDictionary dictionary) Constructor from another dictionary. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all entries.double[]Get the value corresponding to a key.getData()Get an unmodifiable view of the dictionary entries.Get a complete entry.voidAdd an entry.voidPut all the entries from the map in the dictionary.voidputAll(DoubleArrayDictionary dictionary) Put all the entries from another dictionary.booleanRemove an entry.intsize()Get the number of dictionary entries.toMap()Create a map from the instance.toString()Get a string representation of the dictionary.
-
Constructor Details
-
DoubleArrayDictionary
public DoubleArrayDictionary()Constructor withdefault initial capacity. -
DoubleArrayDictionary
public DoubleArrayDictionary(int initialCapacity) Constructor with specified capacity.- Parameters:
initialCapacity- initial capacity
-
DoubleArrayDictionary
Constructor from another dictionary.- Parameters:
dictionary- dictionary to use for initializing entries
-
DoubleArrayDictionary
Constructor from a map.- Parameters:
map- map to use for initializing entries
-
-
Method Details
-
getData
Get an unmodifiable view of the dictionary entries.- Returns:
- unmodifiable view of the dictionary entries
-
size
public int size()Get the number of dictionary entries.- Returns:
- number of dictionary entries
-
toMap
Create a map from the instance.The map contains a copy of the instance data
- Returns:
- copy of the dictionary, as an independent map
-
clear
public void clear()Remove all entries. -
put
Add an entry.If an entry with the same key already exists, it will be removed first.
The new entry is always put at the end.
- Parameters:
key- entry keyvalue- entry value
-
putAll
Put all the entries from the map in the dictionary.- Parameters:
map- map to copy into the instance
-
putAll
Put all the entries from another dictionary.- Parameters:
dictionary- dictionary to copy into the instance
-
get
Get the value corresponding to a key.- Parameters:
key- entry key- Returns:
- copy of the value corresponding to the key or null if key not present
-
getEntry
Get a complete entry.- Parameters:
key- entry key- Returns:
- entry with key if it exists, null otherwise
-
remove
Remove an entry.- Parameters:
key- key of the entry to remove- Returns:
- true if an entry has been removed, false if the key was not present
-
toString
Get a string representation of the dictionary.This string representation is intended for improving displays in debuggers only.
-