Class MapRepresentation
- java.lang.Object
-
- it.unive.lisa.util.representation.StructuredRepresentation
-
- it.unive.lisa.util.representation.MapRepresentation
-
- All Implemented Interfaces:
java.lang.Comparable<StructuredRepresentation>
public class MapRepresentation extends StructuredRepresentation
AStructuredRepresentation
in the form of a key-value mapping.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.SortedMap<StructuredRepresentation,StructuredRepresentation>
map
The mappings of contained in this map.
-
Constructor Summary
Constructors Constructor Description MapRepresentation(java.util.Map<StructuredRepresentation,StructuredRepresentation> map)
Builds a new representation containing the given map.MapRepresentation(java.util.Map<K,V> map, java.util.function.Function<K,StructuredRepresentation> keyMapper, java.util.function.Function<V,StructuredRepresentation> valueMapper)
Builds a new representation starting from the given map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
int
hashCode()
SerializableValue
toSerializableValue()
Produces a serializable version of this representation.java.lang.String
toString()
-
Methods inherited from class it.unive.lisa.util.representation.StructuredRepresentation
compareTo, getProperties, setProperty
-
-
-
-
Field Detail
-
map
protected final java.util.SortedMap<StructuredRepresentation,StructuredRepresentation> map
The mappings of contained in this map.
-
-
Constructor Detail
-
MapRepresentation
public MapRepresentation(java.util.Map<K,V> map, java.util.function.Function<K,StructuredRepresentation> keyMapper, java.util.function.Function<V,StructuredRepresentation> valueMapper)
Builds a new representation starting from the given map.keyMapper
andvalueMapper
are used for transforming each key and value in the map to their individual representation.- Type Parameters:
K
- the type of keys in the mapV
- the type of values in the map- Parameters:
map
- the map to representkeyMapper
- the function that knows how to convert keys to their representationvalueMapper
- the function that knows how to convert values to their representation
-
MapRepresentation
public MapRepresentation(java.util.Map<StructuredRepresentation,StructuredRepresentation> map)
Builds a new representation containing the given map.- Parameters:
map
- the map
-
-
Method Detail
-
toSerializableValue
public SerializableValue toSerializableValue()
Description copied from class:StructuredRepresentation
Produces a serializable version of this representation.- Specified by:
toSerializableValue
in classStructuredRepresentation
- Returns:
- an instance of
SerializableValue
containing representing the same information as this representation
-
toString
public java.lang.String toString()
- Specified by:
toString
in classStructuredRepresentation
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classStructuredRepresentation
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classStructuredRepresentation
-
-