コード例 #1
0
 /**
  * Returns the object to use for the operation.
  *
  * @return
  */
 protected T getObject() {
   final T object;
   if (reusedObject != null) {
     // REUSE THE SAME RECORD AFTER HAVING RESETTED IT
     object = reusedObject;
     object.reset();
   } else
     // CREATE A NEW ONE
     object = (T) database.newInstance(className);
   return object;
 }
コード例 #2
0
 /**
  * Tells to the iterator to use the same object for browsing. The object will be reset before
  * every use. This improve the performance and reduce memory utilization since it does not create
  * a new one for each operation, but pay attention to copy the data of the object once read
  * otherwise they will be reset to the next operation.
  *
  * @param iReuse
  * @return @see #isReuseSameObject()
  */
 public OGraphElementIterator<T> setReuseSameObject(boolean iReuse) {
   reusedObject = (T) database.newInstance(className);
   return this;
 }