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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanget(int i) Get the property used by each snak in this group.getSnaks()Get the list of Snaks of this group.inthashCode()booleanisEmpty()iterator()Construct a list ofSnakGroupobjects from a map from property ids to snak lists as found in JSON.intsize()toString()Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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:
sizein interfaceCollection<Snak>- Specified by:
sizein interfaceList<Snak>- Specified by:
sizein classAbstractCollection<Snak>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<Snak>- Specified by:
isEmptyin interfaceList<Snak>- Overrides:
isEmptyin classAbstractCollection<Snak>
-
getSnaks
Description copied from interface:SnakGroupGet the list of Snaks of this group. -
getProperty
Description copied from interface:SnakGroupGet the property used by each snak in this group.- Specified by:
getPropertyin interfaceSnakGroup- Returns:
- a PropertyIdValue
-
makeSnakGroups
public static List<SnakGroup> makeSnakGroups(Map<String, List<Snak>> snaks, List<String> propertyOrder) Construct a list ofSnakGroupobjects 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:
hashCodein interfaceCollection<Snak>- Specified by:
hashCodein interfaceList<Snak>- Overrides:
hashCodein classAbstractList<Snak>
-
equals
- Specified by:
equalsin interfaceCollection<Snak>- Specified by:
equalsin interfaceList<Snak>- Overrides:
equalsin classAbstractList<Snak>
-
toString
- Overrides:
toStringin classAbstractCollection<Snak>
-