class Mappings implements Iterable<Mapping<T, R>> {

	public boolean remove(Mapping<T, R> mapping) {
		boolean exist = mappings.remove(mapping);
		if (exist) {
			T source = mapping.getSource();
			R target = mapping.getTarget();

			Set<Mapping<T, R>> s0 = taskMappings.get(source);
			Set<Mapping<T, R>> s1 = resourceMappings.get(target);

			s0.remove(mapping);
			s1.remove(mapping);

			Bag<R> ts = targets.get(source);
			Bag<T> ss = sources.get(target);

			ts.remove(target);
			ss.remove(source);
		}
		return exist;
	}

}