Class SingleLetterTransitions

java.lang.Object
application.model.rules.isotropic.transitions.INTTransitions
application.model.rules.isotropic.transitions.SingleLetterTransitions
Direct Known Subclasses:
R1HexINT, R1MooreINT, R2CrossINT, R2FarCornersINT, R2KnightINT, R3FarEdgesINT

public abstract class SingleLetterTransitions
extends INTTransitions
Handles INT transitions that consist of single letters (e.g. 2n3-q4c8, 2an4w)
  • Field Details

    • transitionLookup

      protected java.util.HashMap<java.lang.Integer,​java.util.HashMap<java.lang.Character,​java.util.ArrayList<java.lang.Integer>>> transitionLookup
    • reverseTransitionLookup

      protected java.util.HashMap<java.util.ArrayList<java.lang.Integer>,​java.lang.String> reverseTransitionLookup
  • Constructor Details

    • SingleLetterTransitions

      public SingleLetterTransitions​(java.lang.String string)
      Constructs INT transitions that consist of single letters
      Parameters:
      string - The string representation of the INT transitions
  • Method Details

    • readTransitionsFromFile

      public void readTransitionsFromFile​(java.io.InputStream stream)
      Reads the transitions from a file with the provided filename and loads them into a transition lookup
      Parameters:
      stream - The input stream of the file
    • parseTransitions

      protected void parseTransitions​(java.lang.String string)
      Parses transitions from the provided string
      Specified by:
      parseTransitions in class INTTransitions
      Parameters:
      string - The string representation of the INT transitions
    • canoniseTransitions

      public java.lang.String canoniseTransitions()
      Canonises the transitions based on the currently loaded parameters
      Specified by:
      canoniseTransitions in class INTTransitions
      Returns:
      Returns the canonised transitions in the form of a string
    • getRegex

      public java.lang.String getRegex()
      Gets the regex to identify a single transition block (number + characters)
      Specified by:
      getRegex in class INTTransitions
      Returns:
      Returns the regex that identifies that transition block
    • getTransitionsFromNeighbours

      public java.lang.String getTransitionsFromNeighbours​(java.util.ArrayList<java.lang.Integer> neighbours)
      Gets the INT transition from the neighbours
      Specified by:
      getTransitionsFromNeighbours in class INTTransitions
      Parameters:
      neighbours - The neighbours of the cell
      Returns:
      Returns the INT transition (e.g. 2n, 3a, 6q)
    • addTransition

      public void addTransition​(java.lang.String transition)
      Adds an INT transition
      Specified by:
      addTransition in class INTTransitions
      Parameters:
      transition - The INT transition to add
    • removeTransition

      public void removeTransition​(java.lang.String transition)
      Removes an INT transition
      Specified by:
      removeTransition in class INTTransitions
      Parameters:
      transition - The INT transition to remove