Class AssignmentColorPool

Object
AssignmentColorPool

public class AssignmentColorPool extends Object
Different ColorSchemes that can be used to select colors for paired and unpaired objects.

This is useful when showing an assignment visually with the two objects side-by-side e.g. left and right.

Author:
Owen Feehan
  • Constructor Details

    • AssignmentColorPool

      public AssignmentColorPool(int numberPaired, ColorScheme colorSchemePaired)
      Creates with a number and colors for the paired objects, and defaults colors for unpaired.
      Parameters:
      numberPaired - the number of paired objects that exist in the assignment.
      colorSchemePaired - the color-scheme used to generate colors for paired objects.
    • AssignmentColorPool

      public AssignmentColorPool(int numberPaired, ColorScheme colorSchemePaired, ColorScheme colorSchemeUnpaired, boolean differentColorsForPairs)
      Creates a new AssignmentColorPool instance.
      Parameters:
      numberPaired - The number of paired objects that exist in the assignment.
      colorSchemePaired - The color-scheme used to generate colors for paired objects.
      colorSchemeUnpaired - The color-scheme used to generate colors for unpaired objects.
      differentColorsForPairs - If true, different colors are used for paired objects, otherwise always the same color is used.
  • Method Details

    • createColors

      public ColorList createColors(int numberUnpaired) throws OperationFailedException
      Creates a list of colors to describe the assignment.

      The first numberPaired elements in this list, are colors to describe the paired elements.

      The remaining elements, are colors to describe the unpaired elements.

      Parameters:
      numberUnpaired - the number of unapred objects that exist in this particular set of objects.
      Returns:
      a list of elements of size numberPaired + numberUnpaired as described above.
      Throws:
      OperationFailedException - if colors cannot be generated from the respective ColorScheme.
    • isDifferentColorsForPairs

      public boolean isDifferentColorsForPairs()
      If true, different colors are used for paired objects, otherwise always the same color is used.