Class EngineResourceSet.ResourceSet<R extends EngineResource>

java.lang.Object
com.blackrook.engine.EngineResourceSet.ResourceSet<R>
Type Parameters:
R - an EngineResource type.
All Implemented Interfaces:
Iterable<R>
Enclosing class:
EngineResourceSet

public static class EngineResourceSet.ResourceSet<R extends EngineResource> extends Object implements Iterable<R>
Mapping of name-to-resource and id-to-resource.
Author:
Matthew Tropiano
  • Method Details

    • add

      public void add(R resource)
      Adds a resource to the list.
      Parameters:
      resource - the added resource.
    • get

      public R get(String id)
      Gets a resource by its identity.
      Parameters:
      id - the identity of thge resource.
      Returns:
      the resource desired, or null if not found.
    • getByTag

      public int getByTag(String tagName, R[] out)
      Gets resources by a tag name. The target array provided will be filled with the qualifying objects sequentially and will stop if the end is reached, even if there may be more to return.
      Parameters:
      tagName - the tag name.
      out - the output array to put the objects into.
      Returns:
      the amount of objects returned, up to the size of the provided array.
      Throws:
      NullPointerException - if the tagName or array provided is null.
    • getByTag

      public int getByTag(String tagName, R[] out, int offset)
      Gets resources by a tag name. The target array provided will be filled with the qualifying objects sequentially and will stop if the end is reached, even if there may be more to return.
      Parameters:
      tagName - the tag name.
      out - the output array to put the objects into.
      offset - the offset into the array to start putting objects.
      Returns:
      the amount of objects returned, up to the size of the provided array.
      Throws:
      NullPointerException - if the tagName or array provided is null.
    • getByIndex

      public int getByIndex(String indexName, Number value, R[] out)
      Gets all objects that match an index value. The target array provided will be filled with the qualifying objects sequentially and will stop if the end is reached, even if there may be more to return.
      Parameters:
      indexName - the name of the index.
      value - the value to search for.
      out - the output array to put the objects into.
      Returns:
      the amount of objects returned, up to the size of the provided array.
      Throws:
      NullPointerException - if the indexName, value, or array provided is null.
    • getByIndex

      public int getByIndex(String indexName, Number value, R[] out, int offset)
      Gets all objects that match an index value. The target array provided will be filled with the qualifying objects sequentially and will stop if the end is reached, even if there may be more to return.
      Parameters:
      indexName - the name of the index.
      value - the value to search for.
      out - the output array to put the objects into.
      offset - the offset into the array to start putting objects.
      Returns:
      the amount of objects returned, up to the size of the provided array.
      Throws:
      NullPointerException - if the indexName, value, or array provided is null.
    • getBeforeIndexValue

      public int getBeforeIndexValue(String indexName, Number value, R[] out)
      Gets all objects that are before an index value. The target array provided will be filled with the qualifying objects sequentially and will stop if the end is reached, even if there may be more to return.
      Parameters:
      indexName - the name of the index.
      value - the value to search for.
      out - the output array to put the objects into.
      Returns:
      the amount of objects returned, up to the size of the provided array.
      Throws:
      NullPointerException - if the indexName, value, or array provided is null.
    • getBeforeIndexValue

      public int getBeforeIndexValue(String indexName, Number value, R[] out, int offset)
      Gets all objects that are before an index value. The target array provided will be filled with the qualifying objects sequentially and will stop if the end is reached, even if there may be more to return.
      Parameters:
      indexName - the name of the index.
      value - the value to search for.
      out - the output array to put the objects into.
      offset - the offset into the array to start putting objects.
      Returns:
      the amount of objects returned, up to the size of the provided array.
      Throws:
      NullPointerException - if the indexName, value, or array provided is null.
    • getAfterIndexValue

      public int getAfterIndexValue(String indexName, Number value, R[] out)
      Gets all objects that are after an index value. The target array provided will be filled with the qualifying objects sequentially and will stop if the end is reached, even if there may be more to return.
      Parameters:
      indexName - the name of the index.
      value - the value to search for.
      out - the output array to put the objects into.
      Returns:
      the amount of objects returned, up to the size of the provided array.
      Throws:
      NullPointerException - if the indexName, value, or array provided is null.
    • getAfterIndexValue

      public int getAfterIndexValue(String indexName, Number value, R[] out, int offset)
      Gets all objects that are after an index value. The target array provided will be filled with the qualifying objects sequentially and will stop if the end is reached, even if there may be more to return.
      Parameters:
      indexName - the name of the index.
      value - the value to search for.
      out - the output array to put the objects into.
      offset - the offset into the array to start putting objects.
      Returns:
      the amount of objects returned, up to the size of the provided array.
      Throws:
      NullPointerException - if the indexName, value, or array provided is null.
    • iterator

      public Iterator<R> iterator()
      Specified by:
      iterator in interface Iterable<R extends EngineResource>
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()