Sha256: 051642b4db198a525e242fa89717d91eb79f8458a1c99f9c5d58ecc6703866e8
Contents?: true
Size: 1.64 KB
Versions: 3
Compression:
Stored size: 1.64 KB
Contents
require_relative 'term' require_relative 'freshness' module MiniKraken module Core # An atomic term is an elementary Minikraken term that cannot be # decomposed into simpler MiniKraken data value(s). class AtomicTerm < Term # @return [Object] Internal representation of a MiniKraken data value attr_reader :value # @param aValue [Object] Ruby representation of MiniKraken data value def initialize(aValue) @value = aValue @value.freeze end # An atomic term is by definition a ground term: since it doesn't contain # any bound variable (in Prolog sense). # @param _env [Vocabulary] # @return [Freshness] def freshness(_env) Freshness.new(:ground, self) end # An atomic term is a ground term: by definition it doesn't contain # any fresh variable. # @param _env [Vocabulary] # @return [FalseClass] def fresh?(_env) false end # An atomic term is a ground term: by definition it doesn't contain # any fresh variable. # @param _env [Vocabulary] # @return [TrueClass] def ground?(_env) true end # @return [AtomicTerm] def quote(_env) self 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/atomic_term.rb |
mini_kraken-0.1.03 | lib/mini_kraken/core/atomic_term.rb |
mini_kraken-0.1.02 | lib/mini_kraken/core/atomic_term.rb |