Class Suffixer


  • public abstract class Suffixer
    extends java.lang.Object
    Object that defines how groups of (parameter) suffixes are constructed.
    Since:
    14 Sep 2017
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      Suffixer()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static Suffixer createAlphaSuffixer​(java.lang.String name, java.lang.String separator, boolean isBlank1, boolean isUpper)
      Returns an instance that generates alphabetic suffixes a, b, c, ...
      static Suffixer createNumericSuffixer​(java.lang.String name, java.lang.String separator, boolean isBlank1)
      Returns an instance that generates numeric suffixes 1, 2, 3, ...
      abstract java.util.List<java.lang.String> createSuffixes​(int n)
      Returns a list of suffixes according to this object's policy.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Suffixer

        public Suffixer()
    • Method Detail

      • createSuffixes

        public abstract java.util.List<java.lang.String> createSuffixes​(int n)
        Returns a list of suffixes according to this object's policy. Note that, because of the way that these suffixes are used in STILTS plotting commands, no suffix in the returned list should contain any other suffix as a leading substring. Making all the elements the same length and unique is a straightforward way to ensure this, for instance by using something like leading zeroes.
        Parameters:
        n - number of suffixes required
        Returns:
        n-element list
      • createNumericSuffixer

        public static Suffixer createNumericSuffixer​(java.lang.String name,
                                                     java.lang.String separator,
                                                     boolean isBlank1)
        Returns an instance that generates numeric suffixes 1, 2, 3, ... prepended with an optional supplied separator string. Leading zeroes are used when the number of suffixes requied is greater than 9.
        Parameters:
        name - suffixer name
        separator - string to prepend to all non-blank suffixes, may be null
        isBlank1 - if true, then a request for a single-element suffix list will be treated specially, giving an empty string
        Returns:
        new suffixer
      • createAlphaSuffixer

        public static Suffixer createAlphaSuffixer​(java.lang.String name,
                                                   java.lang.String separator,
                                                   boolean isBlank1,
                                                   boolean isUpper)
        Returns an instance that generates alphabetic suffixes a, b, c, ... If there are more than 26, letters are repeated (the output is actually in base 26 with digits 'a'-'z').
        Parameters:
        name - suffixer name
        separator - string to prepend to all non-blank suffixes, may be null
        isBlank1 - if true, then a request for a single-element suffix list will be treated specially, giving an empty string
        isUpper - true for upper case letters, false for lower case
        Returns:
        new suffixer