class Diff::LCS::ContextChange

taken.
elements in the old and the new sequenced enumerables as well as the action
Represents a contextual change. Contains the position and values of the

def self.from_a(arr)

def self.from_a(arr)
  Diff::LCS::Change.from_a(arr)
end

def self.simplify(event)

are converted to '-' and '>' actions are converted to '+'.
Simplifies a context change for use in some diff callbacks. '<' actions
def self.simplify(event)
  ea = event.to_a
  case ea[0]
  when '-'
    ea[2][1] = nil
  when '<'
    ea[0] = '-'
    ea[2][1] = nil
  when '+'
    ea[1][1] = nil
  when '>'
    ea[0] = '+'
    ea[1][1] = nil
  end
  Diff::LCS::ContextChange.from_a(ea)
end

def <=>(other)

def <=>(other)
  r = @action <=> other.action
  r = @old_position <=> other.old_position if r.zero?
  r = @new_position <=> other.new_position if r.zero?
  r = @old_element <=> other.old_element if r.zero?
  r = @new_element <=> other.new_element if r.zero?
  r
end

def ==(other)

def ==(other)
  (@action == other.action) and
  (@old_position == other.old_position) and
  (@new_position == other.new_position) and
  (@old_element == other.old_element) and
  (@new_element == other.new_element)
end

def initialize(*args)

def initialize(*args)
  @action, @old_position, @old_element, @new_position, @new_element = *args
  unless Diff::LCS::Change.valid_action?(@action)
    raise "Invalid Change Action '#{@action}'"
  end
  unless @old_position.nil? or @old_position.kind_of? Fixnum
    raise "Invalid (Old) Position Type"
  end
  unless @new_position.nil? or @new_position.kind_of? Fixnum
    raise "Invalid (New) Position Type"
  end
end

def inspect(*args)

def inspect(*args)
  to_a.inspect
end

def to_a

def to_a
  [ @action,
    [ @old_position, @old_element ],
    [ @new_position, @new_element ]
  ]
end