Parent

Methods

Class Index [+]

Quicksearch

TaskJuggler::LogicalExpression

A LogicalExpression is an object that describes tree of LogicalOperation objects and the context that it should be evaluated in.

Attributes

query[R]
sourceFileInfo[R]

Public Class Methods

new(op, sourceFileInfo = nil) click to toggle source

Create a new LogicalExpression object. op must be a LogicalOperation. sourceFileInfo is the file position where expression started. It may be nil if not available.

    # File lib/LogicalExpression.rb, line 29
29:     def initialize(op, sourceFileInfo = nil)
30:       @operation = op
31:       @sourceFileInfo = sourceFileInfo
32: 
33:       @query = nil
34:     end

Public Instance Methods

eval(query) click to toggle source

This function triggers the evaluation of the expression. property is the PropertyTreeNode that should be used for the evaluation. scopeProperty is the PropertyTreeNode that describes the scope. It may be nil.

    # File lib/LogicalExpression.rb, line 39
39:     def eval(query)
40:       @query = query
41:       res = @operation.eval(self)
42:       return res if res.class == TrueClass || res.class == FalseClass ||
43:                     res.class == String
44:       # In TJP syntax 'non 0' means false.
45:       return res != 0
46:     end
to_s(query = nil) click to toggle source

Dump the LogicalExpression as a String. If query is provided, it will show the actual values, otherwise just the variable names.

    # File lib/LogicalExpression.rb, line 50
50:     def to_s(query = nil)
51:       if @sourceFileInfo.nil?
52:         "#{@operation.to_s(query)}"
53:       else
54:         str = "#{@sourceFileInfo} #{@operation.to_s(query)}"
55:       end
56:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.