Class DfsRefDatabase.RefCache

  • Enclosing class:
    DfsRefDatabase

    public static class DfsRefDatabase.RefCache
    extends java.lang.Object
    Collection of references managed by this database.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Ref get​(java.lang.String name)
      Find a reference by name.
      DfsRefDatabase.RefCache put​(Ref ref)
      Obtain a modified copy of the cache with a ref stored.
      DfsRefDatabase.RefCache remove​(java.lang.String refName)
      Obtain a modified copy of the cache with the ref removed.
      int size()  
      • Methods inherited from class java.lang.Object

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

      • RefCache

        public RefCache​(RefList<Ref> ids,
                        RefList<Ref> sym)
        Initialize a new reference cache.

        The two reference lists supplied must be sorted in correct order (string compare order) by name.

        Parameters:
        ids - references that carry an ObjectId, and all of sym.
        sym - references that are symbolic references to others.
    • Method Detail

      • size

        public int size()
        Returns:
        number of references in this cache.
      • get

        public Ref get​(java.lang.String name)
        Find a reference by name.
        Parameters:
        name - full name of the reference.
        Returns:
        the reference, if it exists, otherwise null.
      • put

        public DfsRefDatabase.RefCache put​(Ref ref)
        Obtain a modified copy of the cache with a ref stored.

        This cache instance is not modified by this method.

        Parameters:
        ref - reference to add or replace.
        Returns:
        a copy of this cache, with the reference added or replaced.
      • remove

        public DfsRefDatabase.RefCache remove​(java.lang.String refName)
        Obtain a modified copy of the cache with the ref removed.

        This cache instance is not modified by this method.

        Parameters:
        refName - reference to remove, if it exists.
        Returns:
        a copy of this cache, with the reference removed.