public class FactSetImpl extends java.lang.Object implements FactSet
The implementation requires high performance for
the FactSet.getAspectValues(Fact)
method
and the FactSet.getFacts(AspectValue)
method.
It should be noted that a fact will map to multiple aspect values
and that an aspect value will, in general, map to multiple facts.
To support this performance requirement, a FactSet is implemented using three one-to-many maps . These are based on synchronised versions of the Google Collections Multimap.
Constructor and Description |
---|
FactSetImpl(AspectModel model) |
Modifier and Type | Method and Description |
---|---|
void |
addFact(Fact fact)
Adds the fact to the fact set, computing the aspect values
for the fact for each aspect in the fact set's aspect model.
|
<F extends Fact> |
addFacts(java.util.Collection<F> facts)
Adds the facts to the fact set, computing the aspect values
for the facts for each aspect in the fact set's aspect model.
|
void |
emptyLocalLabelCache()
This method simply empties the label cache that is a local property of the fact set.
|
AspectModel |
getAspectModel() |
AspectValue |
getAspectValue(java.lang.String aspectId,
Fact fact) |
int |
getAspectValueCount(java.lang.String aspectId) |
java.lang.String |
getAspectValueLabel(AspectValue value,
java.lang.String locale,
java.lang.String resourceRole,
java.lang.String linkRole)
This is a convenience method to give access to the labels generated by
the labellers for the values of each aspect in the fact set's aspect model.
|
java.lang.String |
getAspectValueLabelGivenLists(AspectValue value,
java.util.List<java.lang.String> locales,
java.util.List<java.lang.String> resourceRoles,
java.util.List<java.lang.String> linkRoles)
This is a convenience method to give access to the labels generated by
the labellers for the values of each aspect in the fact set's aspect model.
|
java.util.Set<AspectValue> |
getAspectValues() |
java.util.Collection<AspectValue> |
getAspectValues(Fact fact) |
java.util.Collection<AspectValue> |
getAspectValues(java.lang.String aspectId) |
java.util.Set<Fact> |
getFacts() |
java.util.Set<Fact> |
getFacts(AspectValue value) |
java.util.Set<Fact> |
getFacts(java.util.Collection<AspectValue> values) |
AspectModel |
getModel() |
java.util.Collection<Aspect> |
getPopulatedAspects() |
java.util.List<Fact> |
getRootFacts(java.lang.String aspectId) |
long |
getSize() |
boolean |
hasAspectValue(AspectValue value) |
boolean |
hasFact(Fact fact) |
boolean |
isPopulated(java.lang.String aspectId) |
boolean |
isSingular(java.lang.String aspectId) |
public FactSetImpl(AspectModel model) throws XBRLException
model
- The aspect model determining the aspects to work with.XBRLException
public AspectModel getModel()
getModel
in interface FactSet
FactSet.getModel()
public AspectModel getAspectModel()
getAspectModel
in interface FactSet
FactSet.getAspectModel()
public <F extends Fact> void addFacts(java.util.Collection<F> facts) throws XBRLException
FactSet
addFacts
in interface FactSet
facts
- The facts to add.XBRLException
FactSet.addFacts(Collection)
public void addFact(Fact fact) throws XBRLException
FactSet
addFact
in interface FactSet
fact
- The fact to add.XBRLException
FactSet.addFact(Fact)
public java.util.Set<AspectValue> getAspectValues()
getAspectValues
in interface FactSet
FactSet.getAspectValues()
public java.util.Collection<AspectValue> getAspectValues(Fact fact) throws XBRLException
getAspectValues
in interface FactSet
fact
- The fact.XBRLException
FactSet.getAspectValues(Fact)
public AspectValue getAspectValue(java.lang.String aspectId, Fact fact) throws XBRLException
getAspectValue
in interface FactSet
aspectId
- the ID of the aspect to get the aspect value for.fact
- The fact.XBRLException
FactSet.getAspectValue(String, Fact)
public java.util.Collection<AspectValue> getAspectValues(java.lang.String aspectId)
getAspectValues
in interface FactSet
aspectId
- The ID of the aspect.FactSet.getAspectValues(String)
public int getAspectValueCount(java.lang.String aspectId)
getAspectValueCount
in interface FactSet
aspectId
- The ID of the aspect.FactSet.getAspectValueCount(String)
public java.util.Set<Fact> getFacts()
getFacts
in interface FactSet
FactSet.getFacts()
public java.util.Set<Fact> getFacts(AspectValue value)
getFacts
in interface FactSet
value
- The aspect value.FactSet.getFacts(AspectValue)
public java.util.Set<Fact> getFacts(java.util.Collection<AspectValue> values)
getFacts
in interface FactSet
values
- The collection of aspect values that the
returned facts must have.FactSet.getFacts(Collection)
public boolean hasAspectValue(AspectValue value)
hasAspectValue
in interface FactSet
value
- The aspect value to test for.FactSet.hasAspectValue(AspectValue)
public boolean hasFact(Fact fact)
hasFact
in interface FactSet
fact
- The fact to test for.FactSet.hasFact(Fact)
public long getSize()
getSize
in interface FactSet
FactSet.getSize()
public boolean isPopulated(java.lang.String aspectId)
isPopulated
in interface FactSet
aspectId
- The ID of the aspect.FactSet.isPopulated(String)
public boolean isSingular(java.lang.String aspectId)
isSingular
in interface FactSet
aspectId
- The ID of the aspect.FactSet.isSingular(String)
public java.util.List<Fact> getRootFacts(java.lang.String aspectId) throws XBRLException
getRootFacts
in interface FactSet
aspectId
- The ID of the aspect of interest.XBRLException
FactSet.getRootFacts(String)
public java.util.Collection<Aspect> getPopulatedAspects() throws XBRLException
getPopulatedAspects
in interface FactSet
XBRLException
FactSet.getPopulatedAspects()
public void emptyLocalLabelCache()
FactSet
emptyLocalLabelCache
in interface FactSet
FactSet.emptyLocalLabelCache()
public java.lang.String getAspectValueLabelGivenLists(AspectValue value, java.util.List<java.lang.String> locales, java.util.List<java.lang.String> resourceRoles, java.util.List<java.lang.String> linkRoles) throws XBRLException
FactSet
getAspectValueLabelGivenLists
in interface FactSet
value
- The aspect valuelocales
- The list of label locales from first, most preferred to last,
least preferred. The list can include nulls or it can be null.resourceRoles
- The list of label XLink resource roles from first, most
preferred to last, least preferred. The list can include nulls
or it can be null.linkRoles
- The label link role from first, most preferred to last, least
preferred. The list can include nulls or it can be null.XBRLException
- if the aspect is not in the aspect model.FactSet.getAspectValueLabelGivenLists(AspectValue, java.util.List, List, List)
public java.lang.String getAspectValueLabel(AspectValue value, java.lang.String locale, java.lang.String resourceRole, java.lang.String linkRole) throws XBRLException
FactSet
getAspectValueLabel
in interface FactSet
value
- The aspect valuelocale
- The label localeresourceRole
- The label XLink resource rolelinkRole
- The label link roleXBRLException
- if the aspect is not in the aspect model.FactSet.getAspectValueLabel(AspectValue, java.lang.String, String, String)