class ClientForPoslynx::SignatureImage::Move

Constants

X_BITS_LONG
Y_BITS_LONG

Attributes

x[R]
y[R]

Public Class Methods

first_in_bit_sequence(bit_seq, format=:legacy) click to toggle source
# File lib/client_for_poslynx/signature_image/move.rb, line 10
def self.first_in_bit_sequence(bit_seq, format=:legacy)
  bit_sequence_length = 1 + X_BITS_LONG[format] + Y_BITS_LONG[format]
  bit_seq.first_bit_digit == '1' &&
    bit_seq.length >= bit_sequence_length
end
new(x,y) click to toggle source
# File lib/client_for_poslynx/signature_image/move.rb, line 25
def initialize(x,y)
  @x = x
  @y = y
end
parse_from_bit_sequence!(bit_seq, format=:legacy) click to toggle source
# File lib/client_for_poslynx/signature_image/move.rb, line 16
def self.parse_from_bit_sequence!(bit_seq, format=:legacy)
  bit_seq.shift 1
  x_bit_seq = bit_seq.shift( X_BITS_LONG[format] )
  y_bit_seq = bit_seq.shift( Y_BITS_LONG[format] )
  new( x_bit_seq.as_unsigned, y_bit_seq.as_unsigned )
end

Public Instance Methods

==(other) click to toggle source
# File lib/client_for_poslynx/signature_image/move.rb, line 30
def ==(other)
  return false unless self.class === other
  return x == other.x && y == other.y
end
to_bit_sequence(format=:legacy) click to toggle source
# File lib/client_for_poslynx/signature_image/move.rb, line 35
def to_bit_sequence(format=:legacy)
  bit_seq = ClientForPoslynx::BitSequence / '1'
  bit_seq << ClientForPoslynx::BitSequence.from_unsigned( x, X_BITS_LONG[format] )
  bit_seq << ClientForPoslynx::BitSequence.from_unsigned( y, Y_BITS_LONG[format] )
end