Class StatementGroupImpl
- All Implemented Interfaces:
Iterable<Statement>,Collection<Statement>,List<Statement>,StatementGroup
Helper class to represent a
StatementGroup.- Author:
- Markus Kroetzsch, Antonin Delpeuch
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanget(int i) Get the best statements of this group.Get the property used in the main snak of theClaimof each statement in this group.Get the list of Statements of this group.Get the subject used in theClaimof each statement in this group.inthashCode()booleanisEmpty()iterator()intsize()toString()withStatement(Statement statement) Returns a new version of this group, where the given statement has been added.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
-
StatementGroupImpl
Constructor.- Parameters:
statements- a non-empty list of statements that use the same subject and main-snak property in their claim
-
-
Method Details
-
get
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<Statement>- Specified by:
sizein interfaceList<Statement>- Specified by:
sizein classAbstractCollection<Statement>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<Statement>- Specified by:
isEmptyin interfaceList<Statement>- Overrides:
isEmptyin classAbstractCollection<Statement>
-
getStatements
Description copied from interface:StatementGroupGet the list of Statements of this group.- Specified by:
getStatementsin interfaceStatementGroup- Returns:
- a list of Statements
-
getBestStatements
Description copied from interface:StatementGroupGet the best statements of this group. These are the statements with rankStatementRank.PREFERREDif they exists or the one with rankStatementRank.NORMAL- Specified by:
getBestStatementsin interfaceStatementGroup- Returns:
- a subset of the current StatementGroup, or null if there are no best statements
-
getProperty
Description copied from interface:StatementGroupGet the property used in the main snak of theClaimof each statement in this group.- Specified by:
getPropertyin interfaceStatementGroup- Returns:
- a PropertyIdValue
-
getSubject
Description copied from interface:StatementGroupGet the subject used in theClaimof each statement in this group.- Specified by:
getSubjectin interfaceStatementGroup- Returns:
- an EntityIdValue
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<Statement>- Specified by:
hashCodein interfaceList<Statement>- Overrides:
hashCodein classAbstractList<Statement>
-
equals
- Specified by:
equalsin interfaceCollection<Statement>- Specified by:
equalsin interfaceList<Statement>- Overrides:
equalsin classAbstractList<Statement>
-
toString
- Overrides:
toStringin classAbstractCollection<Statement>
-
withStatement
Description copied from interface:StatementGroupReturns a new version of this group, where the given statement has been added. If some statement in the group has the same non-empty statement id, then the new statement will replace it. Otherwise the new statement is appended at the end of the list.- Specified by:
withStatementin interfaceStatementGroup
-