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

The following examples show how to use org.eclipse.collections.impl.set.mutable.UnifiedSet#size() . 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: AbstractTransactionalOperationBasedList.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void deleteAll(DelegatingList<E> delegatingList)
{
    Operation op = delegatingList.getOperation();
    verifyNonDatedList(op);
    boolean oneByOne = (op instanceof MappedOperation);
    if (!oneByOne)
    {
        UnifiedSet portals = new UnifiedSet(3);
        op.addDependentPortalsToSet(portals);
        MithraObjectPortal portal = op.getResultObjectPortal();
        oneByOne = portals.size() > 1 || portal.getSuperClassPortals() != null || portal.getJoinedSubClassPortals() != null;
    }
    TransactionalCommand command = null;
    if (oneByOne)
    {
        command = new DeleteAllOneByOneCommand(delegatingList);
    }
    else
    {
        command = new DeleteAllTransactionalCommand(delegatingList, this);
    }
    MithraManagerProvider.getMithraManager().executeTransactionalCommand(command);
}
 
Example 4
Source File: AbstractTransactionalOperationBasedList.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void purgeAll(DelegatingList<E> delegatingList)
{
    Operation op = delegatingList.getOperation();
    UnifiedSet portals = new UnifiedSet(3);
    op.addDependentPortalsToSet(portals);
    TransactionalCommand command;
    if (portals.size() > 1)
    {
        throw new RuntimeException("Multiple portal purgeAll not implemented");
    }
    else
    {
        command = new PurgeAllTransactionalCommand(delegatingList, this);
    }
    MithraManagerProvider.getMithraManager().executeTransactionalCommand(command);
}
 
Example 5
Source File: AbstractTransactionalOperationBasedList.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private boolean isComplexOperation(DelegatingList<E> delegatingList)
{
    Operation op = delegatingList.getOperation();
    boolean oneByOne = (op instanceof MappedOperation);
    if (!oneByOne)
    {
        UnifiedSet portals = new UnifiedSet(3);
        op.addDependentPortalsToSet(portals);
        MithraObjectPortal portal = op.getResultObjectPortal();
        oneByOne = portals.size() > 1 || portal.getSuperClassPortals() != null || portal.getJoinedSubClassPortals() != null;
    }
    return oneByOne;
}
 
Example 6
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;
}