Class EcNumber.Impl

  • All Implemented Interfaces:
    EcNumber
    Enclosing interface:
    EcNumber

    public static class EcNumber.Impl
    extends java.lang.Object
    implements EcNumber
    A simple implementation of EcNumber.
    Since:
    1.4
    Author:
    Matthew Pocock
    • Constructor Summary

      Constructors 
      Constructor Description
      Impl​(int mainClass, int subClass, int subSubClass, int group)
      Make a new EcNumber.Impl with the data provided.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int getClassNumber​(int level)
      Get the class number associated with the particular level of the ec number.
      int hashCode()  
      java.lang.String toString()  
      static EcNumber.Impl valueOf​(java.lang.String ecString)
      Process a string into an EcNumber.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Impl

        public Impl​(int mainClass,
                    int subClass,
                    int subSubClass,
                    int group)
        Make a new EcNumber.Impl with the data provided.
        Parameters:
        mainClass - the main class number
        subClass - the sub class number
        subSubClass - the sub-sub class number
        group - the group number
    • Method Detail

      • getClassNumber

        public int getClassNumber​(int level)
        Description copied from interface: EcNumber
        Get the class number associated with the particular level of the ec number.

        The index can be between 0 and 3 inclusive. 0 correxpons to the top level class, 1 to the sub-class and so on. A return value of UNDEFINED indicates that this field is not populated.

        Specified by:
        getClassNumber in interface EcNumber
        Parameters:
        level - the level in the ec classification to return the number for
        Returns:
        the value at that level
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • valueOf

        public static EcNumber.Impl valueOf​(java.lang.String ecString)
        Process a string into an EcNumber.

        This method uses the EcNumber.EC_PATTERN regular expression.

        Parameters:
        ecString - String to parse
        Returns:
        a new EcNumber
        Throws:
        java.lang.IllegalArgumentException - if ecString could not be parsed