org.salespointframework.core.data
Class DataBasketImpl.SubDataBasket

java.lang.Object
  extended by org.salespointframework.core.data.DataBasketImpl.SubDataBasket
Enclosing class:
DataBasketImpl

protected static class DataBasketImpl.SubDataBasket
extends java.lang.Object

Internal helper class used by DataBasketImpl, representing a subbasket of a DataBasket.

This class has been made protected so that framework users be able to subclass it should the need arise.

Since:
v2.0
Version:
2.0 14/06/1999
Author:
Steffen Zschaler

Field Summary
private  DataBasketImpl m_dbiOwner
          The owner of this subbasket.
private  java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<DataBasketEntry>>> m_mpmpldbeCategories
          The entries contained in this subbasket.
 
Constructor Summary
DataBasketImpl.SubDataBasket(DataBasketImpl dbiOwner)
          Create a new subbasket.
 
Method Summary
 void commit(DataBasketCondition dbc)
          Commit all items in this subbasket that match the condition.
 boolean equals(java.lang.Object o)
          Check whether the given Object is equal to this subbasket.
 DataBasketEntry get(DataBasketCondition dbc)
          Get the first entry in this subbasket that matches the condition, if any.
<T> java.util.Iterator<DataBasketEntry>
iterator(DataBasketCondition<T> dbc, boolean fAllowRemove, boolean fShowHandled)
          Iterate all entries in the subbasket that match the given condition.
 void put(DataBasketEntryImpl dbe)
          Put a DataBasketEntry into the subbasket.
 void rollback(DataBasketCondition dbc)
          Rollback all entries in this subbasket that match the condition.
 Value sumSubBasket(DataBasketCondition dbc, BasketEntryValue bev, Value vInit)
          Sum up the values of all entries in this subbasket that match the condition.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_mpmpldbeCategories

private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<DataBasketEntry>>> m_mpmpldbeCategories
The entries contained in this subbasket.

This is a map of maps of lists of DataBasketEntries.


m_dbiOwner

private DataBasketImpl m_dbiOwner
The owner of this subbasket.

Constructor Detail

DataBasketImpl.SubDataBasket

public DataBasketImpl.SubDataBasket(DataBasketImpl dbiOwner)
Create a new subbasket.

Parameters:
dbiOwner - the DataBasketImpl instance owning this subbasket.
Method Detail

equals

public boolean equals(java.lang.Object o)
Check whether the given Object is equal to this subbasket.

This is overridden to mean identity, because for subbaskets equality and identity are really the same.

Overrides:
equals in class java.lang.Object

commit

public void commit(DataBasketCondition dbc)
Commit all items in this subbasket that match the condition.

Parameters:
dbc - the condition that must be matched.
See Also:
DataBasketEntry.commit()

rollback

public void rollback(DataBasketCondition dbc)
Rollback all entries in this subbasket that match the condition.

Parameters:
dbc - the condition to be matched.
See Also:
DataBasketEntry.rollback()

iterator

public <T> java.util.Iterator<DataBasketEntry> iterator(DataBasketCondition<T> dbc,
                                                        boolean fAllowRemove,
                                                        boolean fShowHandled)
Iterate all entries in the subbasket that match the given condition.

The condition applies to the returned iterator only, it will not be influenced by any future calls to iterator().

Parameters:
dbc - the condition returned items will have to match. null means match all.
fAllowRemove - if true,the returned iterator's remove() method * will be enabled. An iterator with its remove() method enabled must never be made publicly accessible outside of the DataBasket.
fShowHandled - if true, the iterator will include items that return true from their DataBasketEntry.isHandled() method. Such an iterator must never be made publicly accessible outside of the DataBasket.
Returns:
an iterator that will iterate over all entries in this subbasket that match the given condition. The iterator will support the remove() method, if fAllowRemove is true.

sumSubBasket

public Value sumSubBasket(DataBasketCondition dbc,
                          BasketEntryValue bev,
                          Value vInit)
Sum up the values of all entries in this subbasket that match the condition.

Parameters:
dbc - the condition to be matched.
bev - an helper object used to determine the value of each matching DataBasketEntry.
vInit - the value that is to be used for adding up. All adding is performed by calling Value.addAccumulating(org.salespointframework.core.data.interfaces.Value) on this object.
Returns:
the sum in vInit.

put

public void put(DataBasketEntryImpl dbe)
Put a DataBasketEntry into the subbasket.

Parameters:
dbe - the entry to be put
See Also:
DataBasketImpl.put(org.salespointframework.core.data.interfaces.DataBasketEntry)

get

public DataBasketEntry get(DataBasketCondition dbc)
Get the first entry in this subbasket that matches the condition, if any.

Parameters:
dbc - the condition to be matched
Returns:
the matching entry, if any.
See Also:
DataBasketImpl.get(org.salespointframework.core.data.interfaces.DataBasketCondition)