Class ImportListImpl

  • All Implemented Interfaces:
    ImportList

    public class ImportListImpl
    extends java.lang.Object
    implements ImportList
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  ImportListImpl.Node  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImportListImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Type addImport​(java.lang.String name)
      Add a fully-qualified type name to the imports.
      void addImport​(Type type)  
      private void clearRoot()  
      boolean contains​(java.lang.String name)
      Return whether or not this Type is in the imports.
      boolean contains​(Type type)  
      ImportList copy()
      Return a copy of this ImportList.
      java.util.List<Pair<java.lang.String,​java.lang.String>> getInOrderList()
      Return a list of imports as (packageName,className) pairs.
      private void insertType​(Type type)  
      Type lookup​(java.lang.String className)
      Lookup just the className, without package name.
      private void updateRoot()  
      • Methods inherited from class java.lang.Object

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

      • imports

        private java.util.Map<java.lang.String,​Type> imports
      • sortedImports

        private java.util.List<Pair<java.lang.String,​java.lang.String>> sortedImports
    • Constructor Detail

      • ImportListImpl

        public ImportListImpl()
    • Method Detail

      • clearRoot

        private void clearRoot()
      • addImport

        public Type addImport​(java.lang.String name)
        Add a fully-qualified type name to the imports. Returns the Type for the name.
        Specified by:
        addImport in interface ImportList
      • contains

        public boolean contains​(java.lang.String name)
        Return whether or not this Type is in the imports.
        Specified by:
        contains in interface ImportList
      • lookup

        public Type lookup​(java.lang.String className)
        Lookup just the className, without package name.
        Specified by:
        lookup in interface ImportList
      • insertType

        private void insertType​(Type type)
      • updateRoot

        private void updateRoot()
      • getInOrderList

        public java.util.List<Pair<java.lang.String,​java.lang.String>> getInOrderList()
        Return a list of imports as (packageName,className) pairs. The list is sorted lexicographically.
        Specified by:
        getInOrderList in interface ImportList