Class UnitDatabase.PrefixedUnitMap.PrefixedUnitNameSet.PrefixedUnitNameIterator

  • All Implemented Interfaces:
    java.util.Iterator<java.lang.String>
    Enclosing class:
    UnitDatabase.PrefixedUnitMap.PrefixedUnitNameSet

    private static final class UnitDatabase.PrefixedUnitMap.PrefixedUnitNameSet.PrefixedUnitNameIterator
    extends java.lang.Object
    implements java.util.Iterator<java.lang.String>
    An iterator that iterates over the units of a PrefixedUnitNameSet.
    Since:
    2019-04-14, v0.2.0
    Author:
    Adrien Hopkins
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​Unit> map  
      private java.util.List<java.lang.Integer> prefixCoordinates  
      private java.util.List<java.lang.String> prefixNames  
      private int unitNamePosition  
      private java.util.List<java.lang.String> unitNames  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String getCurrentUnitName()  
      boolean hasNext()  
      private void incrementPosition()
      Changes this iterator's position to the next available one.
      java.lang.String next()  
      private java.lang.String peek()  
      java.lang.String toString()
      Returns a string representation of the object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Field Detail

      • unitNamePosition

        private int unitNamePosition
      • prefixCoordinates

        private final java.util.List<java.lang.Integer> prefixCoordinates
      • map

        private final java.util.Map<java.lang.String,​Unit> map
      • unitNames

        private final transient java.util.List<java.lang.String> unitNames
      • prefixNames

        private final transient java.util.List<java.lang.String> prefixNames
    • Constructor Detail

      • PrefixedUnitNameIterator

        public PrefixedUnitNameIterator​(UnitDatabase.PrefixedUnitMap map)
        Creates the UnitsDatabase.PrefixedUnitMap.PrefixedUnitNameSet.PrefixedUnitNameIterator.
        Since:
        2019-04-14, v0.2.0
    • Method Detail

      • getCurrentUnitName

        private java.lang.String getCurrentUnitName()
        Returns:
        current unit name
        Since:
        2019-04-14, v0.2.0
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<java.lang.String>
      • incrementPosition

        private void incrementPosition()
        Changes this iterator's position to the next available one.
        Since:
        2019-04-14, v0.2.0
      • next

        public java.lang.String next()
        Specified by:
        next in interface java.util.Iterator<java.lang.String>
      • peek

        private java.lang.String peek()
        Returns:
        the next element in the iterator, without iterating over it
        Since:
        2019-05-03
      • toString

        public java.lang.String toString()
        Returns a string representation of the object. The exact details of the representation are unspecified and subject to change.
        Overrides:
        toString in class java.lang.Object
        Since:
        2019-05-03