Class SnakGroupImpl
Helper class to represent a
SnakGroup
deserialized from JSON. The
actual data is part of a map of lists of SnakImpl
objects in JSON,
so there is no corresponding JSON object.- Author:
- Markus Kroetzsch
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
get
(int i) Get the property used by each snak in this group.getSnaks()
Get the list of Snaks of this group.int
hashCode()
boolean
isEmpty()
iterator()
Construct a list ofSnakGroup
objects from a map from property ids to snak lists as found in JSON.int
size()
toString()
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, contains, containsAll, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Constructor Details
-
SnakGroupImpl
Constructor.- Parameters:
snaks
- a non-empty list of snaks that use the same property
-
-
Method Details
-
get
-
iterator
-
size
public int size()- Specified by:
size
in interfaceCollection<Snak>
- Specified by:
size
in interfaceList<Snak>
- Specified by:
size
in classAbstractCollection<Snak>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Snak>
- Specified by:
isEmpty
in interfaceList<Snak>
- Overrides:
isEmpty
in classAbstractCollection<Snak>
-
getSnaks
Description copied from interface:SnakGroup
Get the list of Snaks of this group. -
getProperty
Description copied from interface:SnakGroup
Get the property used by each snak in this group.- Specified by:
getProperty
in interfaceSnakGroup
- Returns:
- a PropertyIdValue
-
makeSnakGroups
public static List<SnakGroup> makeSnakGroups(Map<String, List<Snak>> snaks, List<String> propertyOrder) Construct a list ofSnakGroup
objects from a map from property ids to snak lists as found in JSON.- Parameters:
snaks
- the map with the data- Returns:
- the result list
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<Snak>
- Specified by:
hashCode
in interfaceList<Snak>
- Overrides:
hashCode
in classAbstractList<Snak>
-
equals
- Specified by:
equals
in interfaceCollection<Snak>
- Specified by:
equals
in interfaceList<Snak>
- Overrides:
equals
in classAbstractList<Snak>
-
toString
- Overrides:
toString
in classAbstractCollection<Snak>
-