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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
get
(int i) Get the best statements of this group.Get the property used in the main snak of theClaim
of each statement in this group.Get the list of Statements of this group.Get the subject used in theClaim
of each statement in this group.int
hashCode()
boolean
isEmpty()
iterator()
int
size()
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, 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
-
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:
size
in interfaceCollection<Statement>
- Specified by:
size
in interfaceList<Statement>
- Specified by:
size
in classAbstractCollection<Statement>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Statement>
- Specified by:
isEmpty
in interfaceList<Statement>
- Overrides:
isEmpty
in classAbstractCollection<Statement>
-
getStatements
Description copied from interface:StatementGroup
Get the list of Statements of this group.- Specified by:
getStatements
in interfaceStatementGroup
- Returns:
- a list of Statements
-
getBestStatements
Description copied from interface:StatementGroup
Get the best statements of this group. These are the statements with rankStatementRank.PREFERRED
if they exists or the one with rankStatementRank.NORMAL
- Specified by:
getBestStatements
in interfaceStatementGroup
- Returns:
- a subset of the current StatementGroup, or null if there are no best statements
-
getProperty
Description copied from interface:StatementGroup
Get the property used in the main snak of theClaim
of each statement in this group.- Specified by:
getProperty
in interfaceStatementGroup
- Returns:
- a PropertyIdValue
-
getSubject
Description copied from interface:StatementGroup
Get the subject used in theClaim
of each statement in this group.- Specified by:
getSubject
in interfaceStatementGroup
- Returns:
- an EntityIdValue
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<Statement>
- Specified by:
hashCode
in interfaceList<Statement>
- Overrides:
hashCode
in classAbstractList<Statement>
-
equals
- Specified by:
equals
in interfaceCollection<Statement>
- Specified by:
equals
in interfaceList<Statement>
- Overrides:
equals
in classAbstractList<Statement>
-
toString
- Overrides:
toString
in classAbstractCollection<Statement>
-
withStatement
Description copied from interface:StatementGroup
Returns 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:
withStatement
in interfaceStatementGroup
-