class LogicTools::NodeUnary

Represents an unary node.

Attributes

child[R]
op[R]

Public Class Methods

new(op,child) click to toggle source

Creates a node with operator op and a child.

# File lib/logic_tools/logictree.rb, line 874
def initialize(op,child)
    if !child.is_a?(Node) then
        raise ArgumentError.new("Not a valid object for child.")
    end
    @op = op.to_sym
    @child = child
    # @sym = self.to_s.to_sym
    @sym = nil
end

Public Instance Methods

include?(tree) click to toggle source

Tells if the self includes tree.

# File lib/logic_tools/logictree.rb, line 929
def include?(tree)
    return true if self == tree # Same tree, so inclusion.
    # Check the child
    return true if @child.include?(tree)
    # Do not include
    return false
end
is_parent?() click to toggle source

Tells if the node is a parent.

# File lib/logic_tools/logictree.rb, line 885
def is_parent?
    return true
end