Class INTTransitions

java.lang.Object
application.model.rules.isotropic.transitions.INTTransitions
Direct Known Subclasses:
DoubleLetterTransitions, SingleLetterTransitions

public abstract class INTTransitions
extends java.lang.Object
All INT transitions should inherit from this class
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected Coordinate[] neighbourhood
    The neighbourhood of the INT transitions
    protected java.util.TreeSet<java.lang.String> sortedTransitionTable
    A transition table that is sorted in lexicographical order (useful for deficient rules).
    protected java.lang.String transitionString
    The transition string of the INT transition
    protected java.util.HashSet<java.util.ArrayList<java.lang.Integer>> transitionTable
    The transition table with the symmetries applied
  • Constructor Summary

    Constructors 
    Constructor Description
    INTTransitions​(java.lang.String string)
    Constructs INT transitions from the provided string
  • Method Summary

    Modifier and Type Method Description
    abstract void addTransition​(java.lang.String transition)
    Adds an INT transition
    void addTransition​(java.util.ArrayList<java.lang.Integer> transition)
    Adds the provided transition to the transitions table
    abstract java.lang.String canoniseTransitions()
    Canonises the transitions based on the currently loaded parameters
    boolean checkSubset​(INTTransitions transition)
    Checks if this INT transition is a subset of another
    boolean checkTransition​(int[] neighbours)
    Checks if the provided neighbours of the cell satisfy the INT transitions
    boolean checkTransition​(java.util.ArrayList<java.lang.Integer> neighbours)
    Checks if the provided neighbours of the cell satisfy the INT transitions
    abstract java.lang.Object clone()
    Makes a deep copy of the INT transitions
    INTTransitions getMaxTransition()
    Generates an INT transition with the maximum number of transitions possible
    INTTransitions getMinTransition()
    Generates an INT transition with the minimum number of transitions possible
    Coordinate[] getNeighbourhood()
    Gets the neighbourhood of the INT transitions
    abstract java.lang.String getRegex()
    Gets the regex for the INT transitions
    java.util.TreeSet<java.lang.String> getSortedTransitionTable()
    Gets the sorted transitions
    protected abstract java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> getSymmetries​(java.util.ArrayList<java.lang.Integer> transition)
    Applies the symmetries to the required transitions
    abstract java.lang.String getTransitionsFromNeighbours​(java.util.ArrayList<java.lang.Integer> neighbours)
    Gets the INT transition from the neighbours
    java.lang.String getTransitionString()
    Gets the transition string of the INT transitions
    java.util.HashSet<java.util.ArrayList<java.lang.Integer>> getTransitionTable()
    Gets the transition table of the INT transition
    protected abstract void parseTransitions​(java.lang.String string)
    Parses transitions from the provided string
    static INTTransitions randomise​(INTTransitions minTransitions, INTTransitions maxTransitions)
    Generates a random INT transition between a min and max INT transition
    abstract void removeTransition​(java.lang.String transition)
    Removes an INT transition
    void removeTransition​(java.util.ArrayList<java.lang.Integer> transition)
    Remove the provided transition to the transitions table
    void setTransitionString​(java.lang.String string)
    Sets the transition string of the INT transitions

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • transitionString

      protected java.lang.String transitionString
      The transition string of the INT transition
    • neighbourhood

      protected Coordinate[] neighbourhood
      The neighbourhood of the INT transitions
    • transitionTable

      protected java.util.HashSet<java.util.ArrayList<java.lang.Integer>> transitionTable
      The transition table with the symmetries applied
    • sortedTransitionTable

      protected java.util.TreeSet<java.lang.String> sortedTransitionTable
      A transition table that is sorted in lexicographical order (useful for deficient rules). Contains all the transitions in string format (e.g. 1c, 1e, 2a, 4c, 4z, 6k...)
  • Constructor Details

    • INTTransitions

      public INTTransitions​(java.lang.String string)
      Constructs INT transitions from the provided string
      Parameters:
      string - The string representation of the INT transitions
  • Method Details

    • setTransitionString

      public void setTransitionString​(java.lang.String string)
      Sets the transition string of the INT transitions
      Parameters:
      string - The transition string
    • parseTransitions

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

      public abstract java.lang.String canoniseTransitions()
      Canonises the transitions based on the currently loaded parameters
      Returns:
      Returns the canonised transitions in the form of a string
    • addTransition

      public void addTransition​(java.util.ArrayList<java.lang.Integer> transition)
      Adds the provided transition to the transitions table
      Parameters:
      transition - The INT transition to be added
    • removeTransition

      public void removeTransition​(java.util.ArrayList<java.lang.Integer> transition)
      Remove the provided transition to the transitions table
      Parameters:
      transition - The INT transition to be removed
    • getSymmetries

      protected abstract java.util.ArrayList<java.util.ArrayList<java.lang.Integer>> getSymmetries​(java.util.ArrayList<java.lang.Integer> transition)
      Applies the symmetries to the required transitions
      Parameters:
      transition - The transition on which the symmetries will be applied
      Returns:
      Returns the applied symmetries
    • checkTransition

      public boolean checkTransition​(int[] neighbours)
      Checks if the provided neighbours of the cell satisfy the INT transitions
      Parameters:
      neighbours - Neighbours of the cell
      Returns:
      Returns true if the condition is satisfied, false otherwise
    • checkTransition

      public boolean checkTransition​(java.util.ArrayList<java.lang.Integer> neighbours)
      Checks if the provided neighbours of the cell satisfy the INT transitions
      Parameters:
      neighbours - Neighbours of the cell
      Returns:
      Returns true if the condition is satisfied, false otherwise
    • getRegex

      public abstract java.lang.String getRegex()
      Gets the regex for the INT transitions
      Returns:
      Returns the regex for the INT transitions
    • getTransitionsFromNeighbours

      public abstract java.lang.String getTransitionsFromNeighbours​(java.util.ArrayList<java.lang.Integer> neighbours)
      Gets the INT transition from the neighbours
      Parameters:
      neighbours - The neighbours of the cell
      Returns:
      Returns the INT transition
    • addTransition

      public abstract void addTransition​(java.lang.String transition)
      Adds an INT transition
      Parameters:
      transition - The INT transition to add
    • removeTransition

      public abstract void removeTransition​(java.lang.String transition)
      Removes an INT transition
      Parameters:
      transition - The INT transition to remove
    • checkSubset

      public boolean checkSubset​(INTTransitions transition)
      Checks if this INT transition is a subset of another
      Parameters:
      transition - The INT transition to check
      Returns:
      Returns true if the this INT transition is a subset of another, false otherwise
    • getNeighbourhood

      public Coordinate[] getNeighbourhood()
      Gets the neighbourhood of the INT transitions
      Returns:
      Returns the neighbourhood of the INT transitions
    • getSortedTransitionTable

      public java.util.TreeSet<java.lang.String> getSortedTransitionTable()
      Gets the sorted transitions
      Returns:
      Returns the sorted transitions
    • getTransitionTable

      public java.util.HashSet<java.util.ArrayList<java.lang.Integer>> getTransitionTable()
      Gets the transition table of the INT transition
      Returns:
      Returns the transition table
    • getTransitionString

      public java.lang.String getTransitionString()
      Gets the transition string of the INT transitions
      Returns:
      Returns the transition string of the INT transitions
    • clone

      public abstract java.lang.Object clone()
      Makes a deep copy of the INT transitions
      Overrides:
      clone in class java.lang.Object
      Returns:
      Returns the deep copy
    • randomise

      public static INTTransitions randomise​(INTTransitions minTransitions, INTTransitions maxTransitions)
      Generates a random INT transition between a min and max INT transition
      Parameters:
      minTransitions - The minimum INT transition
      maxTransitions - The maximum INT transition
      Returns:
      Returns the randomised INT transition
    • getMaxTransition

      public INTTransitions getMaxTransition()
      Generates an INT transition with the maximum number of transitions possible
      Returns:
      Returns the INT transition with the maximum number of transitions possible
    • getMinTransition

      public INTTransitions getMinTransition()
      Generates an INT transition with the minimum number of transitions possible
      Returns:
      Returns the INT transition with the minimum number of transitions possible