Ejemplo n.º 1
0
  public OGraphElementIterator(
      final ODatabaseGraphTx iDatabase, final String iClassName, final boolean iPolymorphic) {
    database = iDatabase;
    className = iClassName;
    underlying =
        new ORecordIteratorClass<ODocument>(
            (ODatabaseRecord) iDatabase.getUnderlying(),
            (ODatabaseRecordAbstract)
                ((ODatabaseDocumentTx) iDatabase.getUnderlying()).getUnderlying(),
            iClassName,
            iPolymorphic,
            false);

    setReuseSameObject(false);
    underlying.setReuseSameRecord(false);
  }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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;
 }