Tabnine Logo
RecycleManager
Code IndexAdd Tabnine to your IDE (free)

How to use
RecycleManager
in
org.ddogleg.struct

Best Java code snippets using org.ddogleg.struct.RecycleManager (Showing top 7 results out of 315)

origin: org.ddogleg/ddogleg

  @Override
  public T requestInstance() {
    T n = super.requestInstance();
    used.add(n);
    return n;
  }
}
origin: org.ddogleg/ddogleg

/**
 * Either returns a recycled instance or a new one.
 */
public T requestInstance() {
  T a;
  if( unused.size() > 0 ) {
    a = unused.pop();
  } else {
    a = createInstance();
  }
  return a;
}
origin: org.boofcv/recognition

/**
 * Removes the edge from the two nodes and recycles the data structure
 */
void detachEdge(SquareEdge edge) {
  edge.a.edges[edge.sideA] = null;
  edge.b.edges[edge.sideB] = null;
  edge.distance = 0;
  edges.recycleInstance(edge);
}
origin: lessthanoptimal/ddogleg

@Test
public void requestInstance_recycleInstance() {
  RecycleManager<Dummy> manager = new RecycleManager<Dummy>(Dummy.class);
  Dummy first = manager.requestInstance();
  Dummy second = manager.requestInstance();
  manager.recycleInstance(first);
  Dummy third = manager.requestInstance();
  assertTrue(first==third);
  assertTrue(first!=second);
  assertEquals(0, manager.unused.size());
}
origin: lessthanoptimal/ddogleg

  @Override
  public T requestInstance() {
    T n = super.requestInstance();
    used.add(n);
    return n;
  }
}
origin: lessthanoptimal/ddogleg

/**
 * Either returns a recycled instance or a new one.
 */
public T requestInstance() {
  T a;
  if( unused.size() > 0 ) {
    a = unused.pop();
  } else {
    a = createInstance();
  }
  return a;
}
origin: org.boofcv/recognition

  /**
   * Creates a new edge which will connect the two nodes.  The side on each node which is connected
   * is specified by the indexes.
   * @param a First node
   * @param indexA side on node 'a'
   * @param b Second node
   * @param indexB side on node 'b'
   * @param distance distance apart the center of the two nodes
   */
  void connect( SquareNode a , int indexA , SquareNode b , int indexB , double distance ) {
    SquareEdge edge = edges.requestInstance();
    edge.reset();

    edge.a = a;
    edge.sideA = indexA;
    edge.b = b;
    edge.sideB = indexB;
    edge.distance = distance;

    a.edges[indexA] = edge;
    b.edges[indexB] = edge;
  }
}
org.ddogleg.structRecycleManager

Javadoc

Simple class which helps minimize declaring new objects by helping you recycle them.

Most used methods

  • requestInstance
    Either returns a recycled instance or a new one.
  • createInstance
    Creates a new instance using the class. overload this to handle more complex constructors
  • recycleInstance
    Call when an instance is no longer needed and can be recycled
  • <init>

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
  • getApplicationContext (Context)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now