java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.nd.db.NdStringSet

public class NdStringSet extends Object
A container for storing a set of strings in the Database. The container allows only one instance of each string to be stored.

This implementation should only be used when the set is expected to be small. It uses a singly linked list for storing strings in Database. Which means that a linear lookup is needed to find strings in the list. An in-memory, lazily-loaded, cache is provided so the list will only be fully retrieved once in the lifetime of this instance. A BTree will be more efficient for larger sets.

  • Constructor Details

    • NdStringSet

      public NdStringSet(Database db, long ptr) throws org.eclipse.core.runtime.CoreException
      Throws:
      org.eclipse.core.runtime.CoreException
  • Method Details

    • clearCaches

      public void clearCaches()
    • add

      public long add(String str) throws org.eclipse.core.runtime.CoreException
      Adds the given string to the receiving set. May cause the entire list to be loaded from the Database while testing for uniqueness. Returns the record of the string that was inserted into the list.
      Throws:
      org.eclipse.core.runtime.CoreException
    • find

      public long find(String str) throws org.eclipse.core.runtime.CoreException
      Search for the given string in the receiver. This could cause the entire list to be loaded from the Database. The results are cached, so the list will only be loaded one time during the lifetime of this instance. Returns the record of the String.
      Throws:
      org.eclipse.core.runtime.CoreException
    • remove

      public long remove(String str) throws org.eclipse.core.runtime.CoreException
      Return a pointer to the record of the String that was removed.
      Throws:
      org.eclipse.core.runtime.CoreException