Class LibraryCollection

java.lang.Object
org.opensourcephysics.tools.LibraryResource
org.opensourcephysics.tools.LibraryCollection
All Implemented Interfaces:
Comparable<LibraryResource>

public class LibraryCollection extends LibraryResource
This represents a collection of library resources.
Version:
1.0
Author:
Douglas Brown
  • Constructor Details

    • LibraryCollection

      public LibraryCollection(String name)
      Constructor.
      Parameters:
      name - the name of the collection
  • Method Details

    • getType

      public String getType()
      Gets the type of resource.
      Overrides:
      getType in class LibraryResource
      Returns:
      collection type
    • setType

      public boolean setType(String type)
      Overrides LibraryResource method.
      Overrides:
      setType in class LibraryResource
      Parameters:
      type - ignored
      Returns:
      false, since never changes
    • setTarget

      public boolean setTarget(String path)
      Sets the target of this collection.
      Overrides:
      setTarget in class LibraryResource
      Parameters:
      path - the target path
      Returns:
      true if changed
    • addResource

      public void addResource(LibraryResource resource)
      Adds a resource to the end of this collection.
      Parameters:
      resource - the resource
    • insertResource

      public boolean insertResource(LibraryResource resource, int index)
      Inserts a resource into this collection at a specified index.
      Parameters:
      resource - the resource
      index - the index
      Returns:
      true if inserted
    • removeResource

      public void removeResource(LibraryResource resource)
      Removes a resource from this collection.
      Parameters:
      resource - the resource to remove
    • getResources

      public LibraryResource[] getResources()
      Gets the array of resources in this collection.
      Returns:
      an array of resources
    • clearResources

      public void clearResources()
      Clears resources.
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns an ObjectLoader to save and load data for this class.
      Returns:
      the object loader