org.jutil.java.collections
Class  MapVisitor
java.lang.Object
  |
  +--org.jutil.java.collections.MapVisitor
- All Implemented Interfaces: 
- MapOperator
- public abstract class MapVisitor- extends java.lang.Object- implements MapOperator
A visitor of maps. The code in visit is performed for each element
 pair in the visited map.
  
 MapVisitor is very much like Visitor.
 The main difference is that the visit now has 2 arguments: a key and a value.
 
 
| Method Summary | 
|  java.util.Map | applyTo(java.util.Map map)Perform the visitation defined in
 public void visit(Object)on | 
| abstract  void | visit(java.lang.Object key,
      java.lang.Object value)The code to be applied to all element pairs of a map.
 | 
 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
 
 
CVS_REVISION
public static final java.lang.String CVS_REVISION
MapVisitor
public MapVisitor()
visit
public abstract void visit(java.lang.Object key,
                           java.lang.Object value)
- The code to be applied to all element pairs of a map.
 
- 
 
- 
- Parameters:
- key- The key of the element pair the code should be applied to.
- element- The value of the element pair the code should be applied to.
 
- 
- Specifications:
- 
 public behavior
 requires isValidPair(key,value);
 
 
applyTo
public final java.util.Map applyTo(java.util.Map map)
                            throws java.util.ConcurrentModificationException
- Perform the visitation defined in - public void visit(Object)on
 - The collection is returned, so
 that further operations can be applied to it inline. - 
 
- 
 
- 
- Parameters:
- map- The collection to perform this visitation on. This can be null.
 
- 
- Specifications:
- 
 public behavior
 requires ( \forall Map.Entry entry; map.entrySet().contains(entry); isValidPair(entry.getKey(),entry.getValue()));
 ensures (* for all k, for all v: (map.containsKey(k) and (map.get(k) = v) ==> visit(k, v) *);
 ensures \result  == map;
 signals (ConcurrentModificationException) (* The collection was modified while performing the visit. *);