Java Code Examples for org.eclipse.collections.impl.set.mutable.UnifiedSet#iterator()

The following examples show how to use org.eclipse.collections.impl.set.mutable.UnifiedSet#iterator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MithraAbstractObjectPortal.java    From reladomo with Apache License 2.0 6 votes vote down vote up
protected boolean isOperationPartiallyCached(Operation op)
{
    boolean partiallyCached = this.isPartiallyCached();
    if (!partiallyCached && !(op instanceof CompactUpdateCountOperation))
    {
        UnifiedSet dependentPortals = new UnifiedSet(3);
        op.addDependentPortalsToSet(dependentPortals);
        if (dependentPortals.size() > 1)
        {
            Iterator it = dependentPortals.iterator();
            while (it.hasNext() && !partiallyCached)
            {
                MithraObjectPortal depPortal = (MithraObjectPortal) it.next();
                partiallyCached = depPortal.isPartiallyCached();
            }
        }
    }
    return partiallyCached;
}
 
Example 2
Source File: MithraTransactionalPortal.java    From reladomo with Apache License 2.0 6 votes vote down vote up
private boolean txParticipationRequired(MithraTransaction tx, Operation op)
{
    boolean participate = this.getTxParticipationMode(tx).mustParticipateInTxOnRead();
    if (!participate)
    {
        UnifiedSet dependentPortals = new UnifiedSet(3);
        op.addDependentPortalsToSet(dependentPortals);
        if (dependentPortals.size() > 1)
        {
            Iterator it = dependentPortals.iterator();
            while (it.hasNext() && !participate)
            {
                MithraObjectPortal depPortal = (MithraObjectPortal) it.next();
                participate = depPortal.getTxParticipationMode(tx).mustParticipateInTxOnRead();
            }
        }
    }
    return participate;
}
 
Example 3
Source File: DeepFetchNode.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private boolean differentPersisterIdThanParent(Mapper mapper)
{
    UnifiedSet<MithraObjectPortal> set = new UnifiedSet<MithraObjectPortal>();
    mapper.addDepenedentPortalsToSet(set);
    Iterator<MithraObjectPortal> portals = set.iterator();
    PersisterId id = portals.next().getPersisterId();
    while(portals.hasNext())
    {
        if (!id.equals(portals.next().getPersisterId())) return true;
    }
    return false;
}
 
Example 4
Source File: MithraTransactionalPortal.java    From reladomo with Apache License 2.0 4 votes vote down vote up
public List findForMassDeleteInMemory(Operation op, MithraTransaction tx)
{
    if (this.getCache().size() == 0)
    {
        return ListFactory.EMPTY_LIST;
    }
    AnalyzedOperation analyzedOperation = new AnalyzedOperation(op);
    QueryCache queryCache = this.getQueryCache(tx);
    List result = null;
    CachedQuery cachedQuery = queryCache.findByEquality(analyzedOperation.getOriginalOperation());
    if (cachedQuery == null && analyzedOperation.isAnalyzedOperationDifferent())
    {
        cachedQuery = queryCache.findByEquality(analyzedOperation.getAnalyzedOperation());
    }
    if (cachedQuery != null)
    {
        result = cachedQuery.getResult();
    }
    if (result == null)
    {
        boolean partiallyCached = this.isPartiallyCached();
        UnifiedSet dependentPortals = new UnifiedSet(3);
        op.addDependentPortalsToSet(dependentPortals);
        if (!partiallyCached)
        {
            Iterator it = dependentPortals.iterator();
            while (it.hasNext() && !partiallyCached)
            {
                MithraObjectPortal depPortal = (MithraObjectPortal) it.next();
                partiallyCached = depPortal.isPartiallyCached();
            }
        }
        try
        {
            if (tx != null)
            {
                tx.zSetOperationEvaluationMode(true);
            }
            if (!partiallyCached)
            {
                result = op.applyOperationToFullCache();
            }
            else if (dependentPortals.size() == 1 && !op.isJoinedWith(this))
            {
                // even though we're partally cached, the operation can search the cache, because there are no mapped ops
                result = op.applyOperationToFullCache();
            }
        }
        finally
        {
            if (tx != null)
            {
                tx.zSetOperationEvaluationMode(false);
            }
        }
    }
    return result;
}