class PostWalkRules

Copyright
Author

Attributes

MATCHER_PROP_IDS_IN_USE[R]

Public constants

OPERATOR[R]

Public constants

PROPERTY[R]

Public constants

PROPERTY_MATCHER[R]

Public constants

PROPERTY_VALUE[R]

Public constants

RULE_ARR[R]

Public constants

RULE_GROUPS[R]

Public constants

RULE_PROP_IDS_IN_USE[R]

Public constants

RULE_SET[R]

Public constants

RULE_SET_COUNT[R]

Public constants

branch[RW]

Public instance variables

propertyIdToType[RW]

Public instance variables

propertyNameToId[RW]

Public instance variables

tree[RW]

Public instance variables

Public Class Methods

new(tree, type) click to toggle source
# File ../Src/postwalkrules.rb, line 41
def initialize(tree, type)

        # Set the public constants
        @RULE_GROUPS = 'rg'
        @PROPERTY_MATCHER = 'p'
        @PROPERTY = 'p'
        @PROPERTY_VALUE = 'v'
        @OPERATOR = 'o'
        @RULE_ARR = 'r'
        @RULE_PROP_IDS_IN_USE = 'rpids'       # calculated in init
        @MATCHER_PROP_IDS_IN_USE = 'mpids'    # calculated in init
        @RULE_SET = 't'
        @RULE_SET_COUNT = 'tc' # calculated in init

        # Initialize two of the public instance variables
        @tree = tree
        @branch = tree[type] # main branch
        
        # Initialize the private instance variables
        @propMatcherIdsInUse = []
        @rulePropIdsInUse = []

        init
end

Public Instance Methods

getRequiredProperties() click to toggle source

Get a list of all the required properties that are needed for this class to properly run its rules.

# File ../Src/postwalkrules.rb, line 155
def getRequiredProperties
        @propMatcherIdsInUse
end
propIsOutput(propertyId) click to toggle source

Check if the property is used in the rules and so can be found from them. This is used in Api.getProperty() to avoid calling the methods in the class if the property that is being looked for cannot be found here.

propertyId

The ID of the property that is sought.

return

TRUE if the propertyId is used, FALSE otherwise.

# File ../Src/postwalkrules.rb, line 148
def propIsOutput(propertyId)
        !@rulePropIdsInUse.nil? && @rulePropIdsInUse.include?(propertyId)
end

Protected Instance Methods

initGetMatcherPropertyIds(group, propIds) click to toggle source

Find all the properties that are used for matching. This is needed in case the DeviceAtlas#getProperty function is called as we need these properties for the rules to work correctly.

group

The rule group that can contain a property matcher.

propIds

The list of found property IDs.

return

An updated set of property IDs.

# File ../Src/postwalkrules.rb, line 99
def initGetMatcherPropertyIds(group, propIds)
        raise(PostWalkRulesException, "This is an abstract method that has not been implemented.")
end
initRuleSets(group) click to toggle source

Prepare the rule set

group

The current parent group.

return

A list of all rule sets.

# File ../Src/postwalkrules.rb, line 107
def initRuleSets(group)
        raise(PostWalkRulesException, "This is an abstract method that has not been implemented.")
end