Sha256: 619dbf9377223317fcfb6fa73da4c86ea36abc41e1e7c9b3b99ba89d1605f683
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
require_relative 'term' require_relative 'freshness' module MiniKraken module Core # An composite term is an Minikraken term that can be # decomposed into simpler MiniKraken data value(s). class CompositeTerm < Term def children raise NotImplementedError, 'This method must re-defined in subclass(es).' end # A composite term is fresh when all its members are nil or all non-nil members # are all fresh # A composite term is bound when it is not fresh and not ground # A composite term is a ground term when all its non-nil members are ground. # @param _env [Vocabulary] # @return [Freshness] def freshness(_env) env.freshness_composite(self) end # @param env [Environment] # @return [Boolean] def fresh?(env) env.fresh_value?(self) end # A composite is ground if all its children are ground def ground?(anEnv) children.all? do |child| child.nil? || child.ground?(anEnv) end end # # Data equality testing # # @return [Boolean] # def ==(other) # if other.respond_to?(:value) # value == other.value # else # value == other # end # end # # Type and data equality testing # # @return [Boolean] # def eql?(other) # (self.class == other.class) && value.eql?(other.value) # end end # class end # module end # module
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mini_kraken-0.1.04 | lib/mini_kraken/core/composite_term.rb |
mini_kraken-0.1.03 | lib/mini_kraken/core/composite_term.rb |
mini_kraken-0.1.02 | lib/mini_kraken/core/composite_term.rb |