Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

The package contains classes representing Splicer specific functionality for resolving splicing and desplicing directives within each parsed rule context. The Objects sub-package contains implementation of splicing and desplicing directives and regions.

TM1DirectiveContainer (class in TM1DirectiveContainer.py)

This class stores all directives that apply to a single TM1 rule or a feeder command. It also contains convert helper method to provide support when splicing dimensional elements of the TM1 rule.

The class defines following attributes:

Attribute

Type

Usage

splice_executor

TM1SpliceExecutor

Link to an instance of TM1SpliceExecutor.

directives

List[TM1Directive]

Global position of the text start (inclusive) within the TM1 rule, calculated as zero based number of characters from start of the rule.

priority_directives

Dict[(str, str), TM1Directive]

Dictionary of directives that apply to all elements of a dimension/hierarchy.

The class exposes following methods:

Method

Usage

append_directive

Adds a directive to list of directives.

get_dimensions

Returns a list of all dimensions extracted from all directives.

get_directives_by_dimension

Returns a list of directives related to a specified dimension.

get_elements

Returns a list of directives related to a specified dimension or empty list if dimension is not within scope of any directive.

get_mdx_splicing_rule_applies

Returns flag indicating the specified directive targets entire dimension regardless regular expression filter.

convert

Returns a list of elements spliced by all directives that apply either by regular expression or to entire dimension.

TM1DirectiveResolver (class in TM1DirectiveResolver.py)

The class is implementing mechanism to select a list of directives applying to certain TM1 rule command or a feeder command out of all available directives in the TM1 rule file. The mechanism is using region membership (scope) of each rule or feeder to select proper list of directives. The directives are selected according to priority given by distance of the rule or feeder command from each region start.

The class defines following attributes:

Attribute

Type

Usage

splice_executor

TM1SpliceExecutor

Link to an instance of TM1SpliceExecutor.

directives_by_scope

Dict[str, List[TM1Directive]]

Dictionary of directives applying to region, indexed by region name.

The class exposes following methods:

Method

Usage

append_directive

Adds a directive to dictionary of directives directives_by_scope.

consume_directive

Called by parser whenever a directive is found during parsing of the TM1 rule file. Creates a new directive and appends it to the internal dictionary.

resolve_directives

Returns a new instance of TM1DirectiveContainer that has been added all applying directives according to region membership.

apply_directives

Resolves and applies directives to an area statement of a TM1 rule or feeder command.

deregister

Functionality was removed, originally served to store last splicing results in a file to be able to rollback to previous rule state.

TM1RegionContainer (class in TM1RegionContainer.py)

The class is used to store global list of regions defined throughout the TM1 rule file. Regions play important role when calculating scope of splicing directives to certain TM1 rule or feeder command.

The class defines following attributes:

Attribute

Type

Usage

regions

Dict[str, TM1RegionStore]

Dictionary of all available regions defined in the TM1 rule file indexed by region name. The value is TM1RegionStore object containing pointers to all instances of the region in the file.

The class exposes following methods:

Method

Usage

add_region

Adds a region to internal regions store.

update_region_start

Creates a new region and sets its start index (by characters counted from beginning of the file) according to parser.

update_region_end

Creates a new region and sets its end index or if the region already exists, updates its end index. Index is counted by number of characters from beginning of the file.

get_regions

Returns a list of regions that enclose specified string area by start and end indices if supplied. If not supplied, returns a list of all regions defined in the rule file. The list of regions is ordered by distance of the region start index to the string area.

get_region

Returns a list of all TM1Region instances based on supplied region_name.

get_region_start

Returns lowest available start index of all TM1Region instances based on supplied region_name.

get_region_end

Returns highest available end index of all TM1Region instances based on supplied region_name.

  • No labels