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