CalculationSettings Class TIBCO Spotfire 7.6 API Reference
Base class for calculation settings. Holds the input to a calculation and uses it to determine when the calculation needs to be rerun, invalidated etc. This class must be extended to implement a specialized settings class that is suited for a concrete calculations implementation.
Inheritance Hierarchy

System. Object
  Spotfire.Dxp.Framework.DocumentModel.Node
    Spotfire.Dxp.Framework.DocumentModel.DocumentNode
      Spotfire.Dxp.Application.Calculations.CalculationSettings
        Spotfire.Dxp.Application.Calculations.DataRelationships.DataRelationshipsCalculationSettings

Namespace: Spotfire.Dxp.Application.Calculations
Assembly: Spotfire.Dxp.Application (in Spotfire.Dxp.Application.dll) Version: 25.11.10401.3615 (25.11.10401.3615)
Syntax

C#
[SerializableAttribute]
[PersistenceVersionAttribute(3, 0)]
public abstract class CalculationSettings : DocumentNode

The CalculationSettings type exposes the following members.

Constructors

  NameDescription
Protected methodCalculationSettings()
Creates a CalculationSettings object.
Protected methodCalculationSettings(SerializationInfo, StreamingContext)
Implements ISerializable.
Top
Methods

  NameDescription
Protected methodAddDependency(CalculationDependencyIdentifier, DataColumn)
Creates a dependency on a DataColumn identified by identifier. If a dependency with that identifier already exists it will replace the old dependency with the new one.
Protected methodAddDependency(CalculationDependencyIdentifier, DataSelection)
Creates a dependency on a dataselection identified by identifier. If a dependency with that identifier already exists it will replace the old dependency with the new one.
Protected methodAddDependency(CalculationDependencyIdentifier, IEnumerable<DataColumn>)
Creates a dependency on a number of DataColumn objects identified by identifier. If a dependency with that identifier already exists it will replace the old dependency with the new one.
Protected methodCreateEventRelay(PropertyName, StatelessDependencyDeclarer)
Creates an event relay. An event relay is a property in the document model which propagates event. An event is raised for the event relay whenever when the trigger returned by the specified dependencyDeclarer fires.
(Inherited from DocumentNode.)
Protected methodCreateEventRelay(PropertyName, StatelessDependencyDeclarer, EventRelayMode)
Creates an event relay. An event relay is a property in the document model which propagates event. An event is raised for the event relay whenever when the trigger returned by the specified dependencyDeclarer fires.
(Inherited from DocumentNode.)
Protected methodCreateProperty<T>(PropertyName, UndoableList<T>) (Inherited from DocumentNode.)
Protected methodCreateProperty<T>(PropertyName, UndoableSet<T>) (Inherited from DocumentNode.)
Protected methodCreateProperty<TNode>(PropertyName, UndoableCrossReferenceProperty<TNode>, TNode) (Inherited from DocumentNode.)
Protected methodCreateProperty<T>(PropertyName, UndoableProperty<T>, T) (Inherited from DocumentNode.)
Protected methodCreateProperty<TKey, TValue>(PropertyName, UndoableDictionary<TKey, TValue>) (Inherited from DocumentNode.)
Protected methodCreateProperty<TKey, TNode>(PropertyName, PropertyName, UndoableKeyedCollection<TKey, TNode>) (Inherited from DocumentNode.)
Protected methodCreateReadOnlyProperty<T>
Creates a read-only property of type T and assigns it to the specified field.
(Inherited from DocumentNode.)
Protected methodCreateRuntimeConstant<T>
Creates a runtime constant. A runtime constant is a property in the document model whose value is computed once when first accessed. The value is then disposed along with the DocumentNode.
(Inherited from DocumentNode.)
Protected methodCreateRuntimeProperty<T>(PropertyName, RuntimeProperty<T>, DependencyDeclarer, PropertyComputer<T>) Obsolete. (Inherited from DocumentNode.)
Protected methodCreateRuntimeProperty<T>(PropertyName, RuntimeProperty<T>, StatelessDependencyDeclarer, StatelessPropertyComputer<T>) (Inherited from DocumentNode.)
Protected methodDeclareInternalEventHandlers
Override this method to declare handlers of internal events.
(Overrides DocumentNode.DeclareInternalEventHandlers(InternalEventManager).)
Protected methodDeserializeProperty<T>(SerializationInfo, StreamingContext, PropertyName, UndoableCrossReferenceProperty<T>) (Inherited from DocumentNode.)
Protected methodDeserializeProperty<T>(SerializationInfo, StreamingContext, PropertyName, UndoableList<T>) (Inherited from DocumentNode.)
Protected methodDeserializeProperty<T>(SerializationInfo, StreamingContext, PropertyName, UndoableProperty<T>) (Inherited from DocumentNode.)
Protected methodDeserializeProperty<T>(SerializationInfo, StreamingContext, PropertyName, UndoableSet<T>) (Inherited from DocumentNode.)
Protected methodDeserializeProperty<TKey, TValue>(SerializationInfo, StreamingContext, PropertyName, UndoableDictionary<TKey, TValue>) (Inherited from DocumentNode.)
Protected methodDeserializeProperty<TKey, TNode>(SerializationInfo, StreamingContext, PropertyName, PropertyName, UndoableKeyedCollection<TKey, TNode>) (Inherited from DocumentNode.)
Protected methodDeserializeReadOnlyProperty<T>
Deserializes a read-only property of type T stored in info with key propertyName.
(Inherited from DocumentNode.)
Protected methodDuplicateSubtree<T>
Returns a copy of the sub tree spanned from this node that has the same outwards non-owning references. The returned copy will be in state New and is intended to be attached to the document immediately.
(Inherited from DocumentNode.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Protected methodGetAdditionalIsValidTriggers
If a subclass has additional dependencies besides those added to the baseclass this method can be overridden to indicate when the input to the calculation has changed/disappeared so the calculation can no longer produce a sensible result. This will trigger the Calculation.HasValidValue property and cause invalid columns to be output the next time the calculation is run.
Protected methodGetAdditionalNeedsRefreshTriggers
If a subclass has additional dependencies besides those added to the baseclass this method can be overridden to indicate when the input to the calculation has changed to warrant an invalidation or recalculation depending on UpdateBehavior. This will trigger the Calculation.NeedsRefresh property.
Protected methodGetColumnDependencies
Get the column dependencies identified by a given CalculationDependencyIdentifier
Protected methodGetDataSelectionDependency
Get the DataSelection dependency identified by a given CalculationDependencyIdentifier
Protected methodGetPersistedTypeName
Can be used in the deserialization constructor to get the type name that the class corresponding to this class had when it was originally serialized. Will return null if the specified caller type has no correspondence in the serialized information
(Inherited from DocumentNode.)
Protected methodGetPersistedVersion
Can be used in the deserialization constructor to get the persistence version that this class was marked with when it was originally serialized. Will return null if the specified caller type has no correspondence in the serialized information
(Inherited from DocumentNode.)
Protected methodGetSelectedRows Obsolete.
Gets the selected rows for a datatable and a CalculationDependencyIdentifier that has been registered together with a DataSelection.
Protected methodGetService
Override this method to provide services accessible from this node and its descendants. If you can not provide the requested service, you should call base.GetService which relays the request to the owner or to the AnalysisApplication if no owner is set.
(Inherited from Node.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodGetUpdateBehaviorTriggerCore
Override this method to provide a trigger which fire when the value of the UpdateBehavior changes.
Protected methodInternalTransaction
Starts an internal transaction on the document model by executing the specified executor delegate.
(Inherited from DocumentNode.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnConfigure
Allows a node to configure itself to the surrounding document.
(Overrides DocumentNode.OnConfigure().)
Protected methodOnConfigured
Allows a node to configure itself to the surrounding document.
(Inherited from DocumentNode.)
Protected methodOnReconfigure
Allows a node to reconfigure itself to a new part of the surrounding document.
(Inherited from DocumentNode.)
Protected methodOnReconfigured
Allows a node to reconfigure itself to a new part of the surrounding document.
(Inherited from DocumentNode.)
Protected methodSerializeProperty<T>(SerializationInfo, StreamingContext, UndoableCrossReferenceProperty<T>)
Serializes an Undoable*Property with value of type T storing it in info with key property.Name.
(Inherited from DocumentNode.)
Protected methodSerializeProperty<T>(SerializationInfo, StreamingContext, UndoableList<T>)
Serializes an UndoableList with values of type T storing it in info with key list.Name.
(Inherited from DocumentNode.)
Protected methodSerializeProperty<T>(SerializationInfo, StreamingContext, UndoableProperty<T>)
Serializes an UndoableProperty with value of type T storing it in info with key property.Name.
(Inherited from DocumentNode.)
Protected methodSerializeProperty<T>(SerializationInfo, StreamingContext, UndoableSet<T>)
Serializes an UndoableSet storing it in info with key given by the property name of the set.
(Inherited from DocumentNode.)
Protected methodSerializeProperty<TKey, TValue>(SerializationInfo, StreamingContext, UndoableDictionary<TKey, TValue>)
Serializes an UndoableDictionary storing it in info with key given by the property name of the dictionary.
(Inherited from DocumentNode.)
Protected methodSerializeProperty<TKey, TNode>(SerializationInfo, StreamingContext, UndoableKeyedCollection<TKey, TNode>) (Inherited from DocumentNode.)
Protected methodSerializeReadOnlyProperty<T>
Serializes a read-only property of type T stored in info with key propertyName.
(Inherited from DocumentNode.)
Protected methodValidateAttached
Validates that the node is attached.
(Inherited from DocumentNode.)
Public methodValidateSettings
Validates the suggested columns, filtering selections and marking selections with respect to the current Settings and Results. In particular this means checking for circular references. This method is meant to be called from a dialog before allowing the user to set up dependencies that would cause errors. If the implementer forgets to do this the framework will run the same check before trying to calculate but without any chance for the user to modify their choices.
Top
Properties

  NameDescription
Public propertyContext
Gets the context of this node.
(Inherited from DocumentNode.)
Public propertyIsAttached
Gets a value indicating whether this node is attached.
(Inherited from DocumentNode.)
Public propertyIsNew
Gets whether or not a settings object is new, that is, is associated with a calculation instance that has not been executed yet.
Public propertyTransactions
Gets a collection of methods for executing transactions on the document.
(Inherited from DocumentNode.)
Public propertyUpdateBehavior
Gets the update behavior of the calculation.
Top
Explicit Interface Implementations

  NameDescription
Explicit interface implementationPrivate methodIServiceProvider.GetService
Implements IServiceProvider.
(Inherited from Node.)
Explicit interface implementationPrivate methodINodeContext.GetAncestor<T> (Inherited from DocumentNode.)
Explicit interface implementationPrivate methodINodeContext.GetService<T> (Inherited from DocumentNode.)
Explicit interface implementationPrivate methodINodeContext.IsDescendantOf (Inherited from DocumentNode.)
Explicit interface implementationPrivate methodITransactions.BeginAggregatedTransaction (Inherited from DocumentNode.)
Explicit interface implementationPrivate methodITransactions.ExecuteInvisibleTransaction (Inherited from DocumentNode.)
Explicit interface implementationPrivate methodITransactions.ExecuteStickyTransaction (Inherited from DocumentNode.)
Explicit interface implementationPrivate methodITransactions.ExecuteTransaction (Inherited from DocumentNode.)
Top
Remarks

Adding the input as dependencies allows the framework to ask for a recalculation/invalidation when they change. In addition it will detect when they disappear due to the user deleting vital columns and avoid recalculation until new ones are set up. The deriving class can ask this base class for default result types such as columns or tables by using CalculationDependencyIdentifier objects created in the nested CalculationSettings. CalculationDependencyIdentifiers class. These should then be exposed as normal properties in the deriving class so user of the implementation calculation doesn't have to know anything about identifiers etc.
Examples

This example show a sample implementation of this class.
    internal class MyCalculationSettings : CalculationSettings
    {
    #region Classes for property names

    public new abstract class PropertyNames : CalculationSettings.PropertyNames
    {
            //empty
    }

    #endregion // Classes for property names

    #region Classes for calculation dependency identifiers

    public new abstract class CalculationDependencyIdentifiers 
        : CalculationSettings.CalculationDependencyIdentifiers
    {
        internal static readonly CalculationDependencyIdentifier XColumns = CreateIdentifier("XColumns");

        internal static readonly CalculationDependencyIdentifier YColumns = CreateIdentifier("YColumns");

        internal static readonly CalculationDependencyIdentifier DataFilteringSelection = CreateIdentifier("DataFilteringSelection"); 
    }

    #endregion

    #region Properties

    public override CalculationUpdateBehavior UpdateBehavior
    {
        get { return CalculationUpdateBehavior.Invalidate; }
    }

    public DataTable XColumnsSourceDataTable
    {
        get
        {
            DataColumnCalculationDependencyCollection dep = GetColumnDependencies(CalculationDependencyIdentifiers.XColumns);
            if (dep != null)
            {
                //unlike asking the columns for their ancestor table this will always work even if the user has deleted all columns
                //in the table and is thus preferable
                return dep.DataTable;
            }
            return null;            
        }
    }

    public IEnumerable<DataColumn> XColumns
    {
        get 
        {     
            DataColumnCalculationDependencyCollection dep =  GetColumnDependencies(CalculationDependencyIdentifiers.XColumns);
            if (dep != null)
            {
                return dep.Columns;
            }
            return new List<DataColumn>();
        }
        set 
        { 
            AddDependency(CalculationDependencyIdentifiers.XColumns, value);
        }
    }

    public IEnumerable<DataColumn> YColumns
    {
        get
        {
            DataColumnCalculationDependencyCollection dep = GetColumnDependencies(CalculationDependencyIdentifiers.YColumns);
            if (dep != null)
            {
                return dep.Columns;
            }
            return new List<DataColumn>();
        }
        set 
        { 
            AddDependency(CalculationDependencyIdentifiers.YColumns, value);
        }
    }

    //the steps for a dependency on marking are exactly the same
    public DataFilteringSelection DataFilteringSelection
    {
         get
         {
             DataSelectionCalculationDependency dep = GetDataSelectionDependency(CalculationDependencyIdentifiers.DataFilteringSelection);
             if(dep!=null)
             {
                 return dep.DataSelection;
             }
             return null;
         }
         set
         {
             AddDependency(CalculationDependencyIdentifiers.DataFilteringSelection, value);
         }
    }

    #endregion

    #region Construction

    public MyCalculationSettings()
    {
    }

    #endregion

    #region ISerializable Members

    protected MyCalculationSettings(SerializationInfo info, StreamingContext context)
       : base(info, context)
    {
    }

    protected override void GetObjectData(SerializationInfo info, StreamingContext context)
    {
        base.GetObjectData(info, context);
    }

    #endregion 
}
Version Information

Supported in: 7.6, 7.5, 7.0, 6.5, 6.0, 5.5, 5.0
See Also

Reference