class RDF::Query::HashPatternNormalizer::Counter
A counter that can be incremented and decremented.
Attributes
The increment for this counter.
@return [Numeric]
The offset (or initial value) for this counter.
@return [Numeric]
Public Class Methods
Source
# File lib/rdf/query/hash_pattern_normalizer.rb, line 25 def initialize(offset = 0, increment = 1) @offset = offset @increment = increment @value = @offset end
@param [Numeric] offset
the offset (or initial value) for this counter.
@param [Numeric] increment
the increment for this counter.
Public Instance Methods
Source
# File lib/rdf/query/hash_pattern_normalizer.rb, line 36 def decrement! @value -= @increment self end
Decrements this counter, and returns the new value.
@return [RDF::Query::HashPatternNormalizer::Counter]
Source
# File lib/rdf/query/hash_pattern_normalizer.rb, line 46 def increment! @value += @increment self end
Increments this counter, and returns the new value.
@return [RDF::Query::HashPatternNormalizer::Counter]
Source
# File lib/rdf/query/hash_pattern_normalizer.rb, line 56 def to_f @value.to_f end
Returns a floating point representation of this counter.
@return [Float]
Source
# File lib/rdf/query/hash_pattern_normalizer.rb, line 64 def to_i @value.to_i end
Returns an integer representation of this counter.
@return [Integer]
Source
# File lib/rdf/query/hash_pattern_normalizer.rb, line 71 def to_s @value.to_s end
Returns a string representation of this counter.
@return [String]