com.ihr.xbrl.om.formula
Class XBRLVariableResourceUse

java.lang.Object
  extended by com.ihr.xbrl.om.formula.XBRLVariableResourceUse

public class XBRLVariableResourceUse
extends java.lang.Object

This is a class representing an XBRLVariableResource use. An USE of a variable resource has a name (the variable name as indicated in the relationship) and may have an evaluated value so this is a different object than the resource itself.

A variable use can be shared between multiple variable sets. But it MUST not be shared between different threads evaluating the same variable name. Each thread must have its own local copy of the evaluation values.

Author:
Ignacio

Constructor Summary
XBRLVariableResourceUse(javax.xml.namespace.QName name, XBRLVariableFormulaEvaluable res, XBRLVariablesHolder set)
           
 
Method Summary
 boolean checkVariable(java.util.Collection<net.sf.saxon.s9api.QName> resolved)
          Execute validations as defined in the Formula specification.
 int evaluatedValueSize()
          Access to the number of elements in the evaluation sequence
 net.sf.saxon.s9api.XdmValue evaluateValue(XMLFragment evaluationContext, java.util.Collection<XBRLVariableResourceUse> evaluatedVars)
          Evaluates this variable value.
 EvaluationType getEvaluationType()
          Computes the evaluation type for the value that
 net.sf.saxon.s9api.XdmValue getLastEvaluatedValue()
          Returns the last evaluated value for this variable from the cached value
 javax.xml.namespace.QName getVariableName()
          Access to the variable name (a QName)
 XBRLVariableFormulaEvaluable getVariableResource()
          This is the XBRLVariableResource this variable use is assigned to.
 net.sf.saxon.s9api.QName getVariableS9APIQName()
          Helper method to obtain the variable name using a saxon s9api QName rather than a java.xml.namespace.QName
 java.util.Collection<javax.xml.namespace.QName> getVariablesRequired()
          Access to a collection of variable names required to evaluate this variable.
 boolean hasNext()
          Returns true if this variable has been evaluated and there are more values not already obtained using calls to evaluateValue
 boolean isEvaluated()
          Returns true if this variable has been successfully evaluated the last time it was evaluated
 boolean isFallbackDefined()
          If the variable has a fall back value defined this method will return true. regardless the last evaluation is the fall back value or not.
 boolean isFallBackEvaluation()
          Returns true if the last evaluated value is the fallback value
 java.util.Vector<java.util.ArrayList<net.sf.saxon.s9api.XdmItem>> preparePartitions(java.util.Vector<java.util.ArrayList<net.sf.saxon.s9api.XdmItem>> hsOutSeq, int uncoveredAspects)
          For API use only.
 void replaceLastEvaluatedValue(net.sf.saxon.s9api.XdmValue newValue)
          Sets the cache of the evaluated value to a specific value.
 void reset()
          Sets this variable use to the status of not evaluated.
 void setIsEvaluated(boolean value)
          Sets the cache of the evaluated flag value to a specific value.
 void setLastEvaluatedLen(int i)
          Sets the cache of the evaluated sequence length to a specific value.
 void setVariableName(javax.xml.namespace.QName name)
          Sets a specific variable name if needed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XBRLVariableResourceUse

public XBRLVariableResourceUse(javax.xml.namespace.QName name,
                               XBRLVariableFormulaEvaluable res,
                               XBRLVariablesHolder set)
Method Detail

getVariableName

public javax.xml.namespace.QName getVariableName()
Access to the variable name (a QName)

Returns:
QName of the variable name.

setVariableName

public void setVariableName(javax.xml.namespace.QName name)
Sets a specific variable name if needed.

Parameters:
name - QName

getVariableResource

public XBRLVariableFormulaEvaluable getVariableResource()
This is the XBRLVariableResource this variable use is assigned to. The target object can be either a parameter, a general or a fact variable.

Returns:
instance of the XBRLVariableResource linked with this XBRLVariableResourceUse

getVariableS9APIQName

public net.sf.saxon.s9api.QName getVariableS9APIQName()
Helper method to obtain the variable name using a saxon s9api QName rather than a java.xml.namespace.QName

Returns:
net.sf.saxon.s9api.QName

evaluateValue

public net.sf.saxon.s9api.XdmValue evaluateValue(XMLFragment evaluationContext,
                                                 java.util.Collection<XBRLVariableResourceUse> evaluatedVars)
                                          throws XFValidationException
Evaluates this variable value.

If the variable does not binds as sequence but the variable evaluation returns a sequence this method returns the first (or next) element in the sequence

Parameters:
variablesLoopCtl -
evaluationContext -
evaluatedVars -
staticEvaluationLevel -
Returns:
XdmValue
Throws:
XFValidationException

preparePartitions

public java.util.Vector<java.util.ArrayList<net.sf.saxon.s9api.XdmItem>> preparePartitions(java.util.Vector<java.util.ArrayList<net.sf.saxon.s9api.XdmItem>> hsOutSeq,
                                                                                           int uncoveredAspects)
                                                                                    throws XFValidationException
For API use only. It is public because Consistency assertions also use this method for preparation of the Assertion Data Set

Parameters:
hsOutSeq -
Throws:
XFValidationException

getLastEvaluatedValue

public net.sf.saxon.s9api.XdmValue getLastEvaluatedValue()
Returns the last evaluated value for this variable from the cached value

Returns:
XdmValue

evaluatedValueSize

public int evaluatedValueSize()
Access to the number of elements in the evaluation sequence

Returns:
integer

getVariablesRequired

public java.util.Collection<javax.xml.namespace.QName> getVariablesRequired()
Access to a collection of variable names required to evaluate this variable.

This is static information once the variable and all its filters are compiled.

Returns:
Collection of QName

checkVariable

public boolean checkVariable(java.util.Collection<net.sf.saxon.s9api.QName> resolved)
                      throws XFValidationException
Execute validations as defined in the Formula specification. This method is used internally by the API.

Parameters:
xbrlVariableSetResource -
Throws:
XFValidationException

replaceLastEvaluatedValue

public void replaceLastEvaluatedValue(net.sf.saxon.s9api.XdmValue newValue)
Sets the cache of the evaluated value to a specific value. This method is used internally by the API.

Parameters:
newValue -

isEvaluated

public boolean isEvaluated()
Returns true if this variable has been successfully evaluated the last time it was evaluated

Returns:
boolean value

getEvaluationType

public EvaluationType getEvaluationType()
Computes the evaluation type for the value that

Returns:
EvaluationType

setLastEvaluatedLen

public void setLastEvaluatedLen(int i)
Sets the cache of the evaluated sequence length to a specific value. This method is used internally by the API.

Parameters:
i -

setIsEvaluated

public void setIsEvaluated(boolean value)
Sets the cache of the evaluated flag value to a specific value. This method is used internally by the API.

Parameters:
value -

reset

public void reset()
Sets this variable use to the status of not evaluated. This will cause the next time evaluateValue will be called the expression will be evaluated again


hasNext

public boolean hasNext()
Returns true if this variable has been evaluated and there are more values not already obtained using calls to evaluateValue

Returns:

isFallbackDefined

public boolean isFallbackDefined()
If the variable has a fall back value defined this method will return true. regardless the last evaluation is the fall back value or not. If the variable has no fall back value defined this method returns false

Returns:

isFallBackEvaluation

public boolean isFallBackEvaluation()
Returns true if the last evaluated value is the fallback value

Returns:
boolean


Copyright 2006-2009 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa