public Collection<? extends CanvasObject> getAffected() {
   Collection<? extends CanvasObject> ret = affected;
   if (ret == null) {
     Map<AttributeMapKey, Object> newVals = newValues;
     if (newVals != null) {
       Set<CanvasObject> keys = new HashSet<CanvasObject>();
       for (AttributeMapKey key : newVals.keySet()) {
         keys.add(key.getObject());
       }
       ret = Collections.unmodifiableCollection(keys);
       affected = ret;
     }
   }
   return affected;
 }
  private CanvasModelEvent(
      CanvasModel source,
      int action,
      Map<AttributeMapKey, Object> oldValues,
      Map<AttributeMapKey, Object> newValues) {
    this(source, action, Collections.<CanvasObject>emptySet());

    Set<CanvasObject> affected;
    affected = new HashSet<CanvasObject>(newValues.size());
    for (AttributeMapKey key : newValues.keySet()) {
      affected.add(key.getObject());
    }
    this.affected = affected;

    Map<AttributeMapKey, Object> oldValuesCopy;
    oldValuesCopy = new HashMap<AttributeMapKey, Object>(oldValues);
    Map<AttributeMapKey, Object> newValuesCopy;
    newValuesCopy = new HashMap<AttributeMapKey, Object>(newValues);

    this.oldValues = Collections.unmodifiableMap(oldValuesCopy);
    this.newValues = Collections.unmodifiableMap(newValuesCopy);
  }