<commit_before># Contains Action classes used by the application.

require_relative 'clipboard_helper'


# Java Imports:
%w(
    javax.swing.AbstractAction
).each { |java_class| java_import(java_class)}


# Generation Move Actions.  Class hierarchy is:
#
# MoveAction
# -- ShowPastGenerationAction
# -- -- ShowFirstGenerationAction
# -- -- ShowPreviousGenerationAction
# -- ShowFutureGenerationAction
# -- -- ShowNextGenerationAction
# -- -- ShowLastGenerationAction


class MoveAction < AbstractAction

  def initialize(table_model)
    super(caption)  # caption implemented by subclasses
    @table_model = table_model

    # should_be_enabled? below needs to be implemented by subclasses
    enabled_updater = lambda do |current_generation_num|
      self.enabled = should_be_enabled?
    end

    @table_model.add_current_num_change_handler(enabled_updater)

    self.enabled = enabled_updater.call(nil)
  end

  def actionPerformed(event)
    move  # implemented by subclasses
    @table_model.fire_table_data_changed
  end
end




class ShowFutureGenerationAction < MoveAction

  def initialize(table_model)
    super(table_model)  # caption implemented by subclasses
  end

  def should_be_enabled?
    ! @table_model.at_last_generation?
  end
end




class ShowPastGenerationAction < MoveAction

  def initialize(table_model)
    super(table_model)  # caption implemented by subclasses
  end

  def should_be_enabled?
    ! @table_model.at_first_generation?
  end
end




class ShowNextGenerationAction < ShowFutureGenerationAction

  def initialize(table_model)
    super(table_model)
  end

  def move
    @table_model.go_to_next_generation
  end

  def caption
    "Next (7)"
  end
end




class ShowLastGenerationAction < ShowFutureGenerationAction

  def initialize(table_model)
    super(table_model)
  end

  def move
    @table_model.go_to_last_generation
  end

  def caption
    "Last (0)"
  end
end




class ShowPreviousGenerationAction < ShowPastGenerationAction

  def initialize(table_model)
    super(table_model)
  end

  def move
    @table_model.go_to_previous_generation
  end

  def caption
    "Previous (4)"
  end
end




class ShowFirstGenerationAction < ShowPastGenerationAction

  def initialize(table_model)
    super(table_model)
  end

  def move
    @table_model.go_to_first_generation
  end

  def caption
    "First (1)"
  end
end



<commit_msg>Neatened the order of the action classes in the file.<commit_after># Contains Action classes used by the application.

require_relative 'clipboard_helper'


# Java Imports:
%w(
    javax.swing.AbstractAction
).each { |java_class| java_import(java_class)}


# Generation Move Actions.  Class hierarchy is:
#
# MoveAction
# -- ShowPastGenerationAction
# -- -- ShowFirstGenerationAction
# -- -- ShowPreviousGenerationAction
# -- ShowFutureGenerationAction
# -- -- ShowNextGenerationAction
# -- -- ShowLastGenerationAction


class MoveAction < AbstractAction

  def initialize(table_model)
    super(caption)  # caption implemented by subclasses
    @table_model = table_model

    # should_be_enabled? below needs to be implemented by subclasses
    enabled_updater = lambda do |current_generation_num|
      self.enabled = should_be_enabled?
    end

    @table_model.add_current_num_change_handler(enabled_updater)

    self.enabled = enabled_updater.call(nil)
  end

  def actionPerformed(event)
    move  # implemented by subclasses
    @table_model.fire_table_data_changed
  end
end




class ShowPastGenerationAction < MoveAction

  def initialize(table_model)
    super(table_model)  # caption implemented by subclasses
  end

  def should_be_enabled?
    ! @table_model.at_first_generation?
  end
end




class ShowFirstGenerationAction < ShowPastGenerationAction

  def initialize(table_model)
    super(table_model)
  end

  def move
    @table_model.go_to_first_generation
  end

  def caption
    "First (1)"
  end
end




class ShowPreviousGenerationAction < ShowPastGenerationAction

  def initialize(table_model)
    super(table_model)
  end

  def move
    @table_model.go_to_previous_generation
  end

  def caption
    "Previous (4)"
  end
end




class ShowFutureGenerationAction < MoveAction

  def initialize(table_model)
    super(table_model)  # caption implemented by subclasses
  end

  def should_be_enabled?
    ! @table_model.at_last_generation?
  end
end




class ShowNextGenerationAction < ShowFutureGenerationAction

  def initialize(table_model)
    super(table_model)
  end

  def move
    @table_model.go_to_next_generation
  end

  def caption
    "Next (7)"
  end
end




class ShowLastGenerationAction < ShowFutureGenerationAction

  def initialize(table_model)
    super(table_model)
  end

  def move
    @table_model.go_to_last_generation
  end

  def caption
    "Last (0)"
  end
end




{'fraction_non_alphanumeric': 0.06172069825436409, 'fraction_numerical': 0.0016625103906899418, 'mean_word_length': 3.886294416243655, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '190843', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1422, 'n_words': 349}