Index: trunk/src/org/openstreetmap/josm/data/osm/BackreferencedDataSet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/BackreferencedDataSet.java	(revision 2410)
+++ trunk/src/org/openstreetmap/josm/data/osm/BackreferencedDataSet.java	(revision 2411)
@@ -4,9 +4,6 @@
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
-import static org.openstreetmap.josm.tools.I18n.tr;
 
 public class BackreferencedDataSet {
@@ -87,59 +84,19 @@
     }
 
-    private DataSet source;
-    private Map<OsmPrimitive, Set<OsmPrimitive>> referers;
-    private boolean built = false;
-
-
     /**
      * Creates a new backreference data set based on the dataset <code>source</code>.
      * 
-     * Doesn't create the cache of backreferences yet. Invoke {@see #build()} on the
-     * created {@see BackreferencedDataSet}.
-     * 
-     * @param source the source. Must not be null.
-     * @throws IllegalArgumentException thrown if source is null
+     * @param source the source. Ignored
      */
     public BackreferencedDataSet(DataSet source) {
-        if (source == null)
-            throw new IllegalArgumentException(tr("Parameter ''{0}'' must not be null."));
-        this.source = source;
-        int size = source.getWays().size() + source.getRelations().size();
-        referers = new HashMap<OsmPrimitive, Set<OsmPrimitive>>(size, 0.75f);
+
     }
 
     /**
-     * Remembers a reference from a parent primitive to a child primitive
-     * 
-     * @param parent the parent primitive
-     * @param child the child primitive
+     * @deprecated It's not necessary to call this method, OsmPrimitive.getReferres() is used to get list of referrers
      */
-    protected void remember(OsmPrimitive parent, OsmPrimitive child) {
-        Set<OsmPrimitive> parents = referers.get(child);
-        if (parents != null) {
-            parents.add(parent);
-            return;
-        }
-        parents = new HashSet<OsmPrimitive>();
-        parents.add(parent);
-        referers.put(child, parents);
-    }
+    @Deprecated
+    public void build() {
 
-    /**
-     * Builds the dataset of back references
-     * 
-     */
-    public void build() {
-        for (Way w : source.getWays()) {
-            for (Node n : w.getNodes()) {
-                remember(w, n);
-            }
-        }
-        for (Relation r : source.getRelations()) {
-            for (RelationMember m : r.getMembers()) {
-                remember(r, m.getMember());
-            }
-        }
-        built = true;
     }
 
@@ -152,6 +109,5 @@
      */
     public Set<OsmPrimitive> getParents(OsmPrimitive child) {
-        Set<OsmPrimitive> parents = referers.get(child);
-        return parents == null ? new HashSet<OsmPrimitive>() : parents;
+        return new HashSet<OsmPrimitive>(child.getReferrers());
     }
 
@@ -159,9 +115,8 @@
         if (children == null) return Collections.emptySet();
         children.remove(null);
+
         Set<OsmPrimitive> parents = new HashSet<OsmPrimitive>();
         for(OsmPrimitive child: children) {
-            if (referers.get(child) != null) {
-                parents.addAll(referers.get(child));
-            }
+            parents.addAll(child.getReferrers());
         }
         return parents;
@@ -177,13 +132,4 @@
     public boolean hasParents(OsmPrimitive child) {
         return ! getParents(child).isEmpty();
-    }
-
-    /**
-     * Replies the source dataset for this Backreference DataSet
-     * 
-     * @return the source dataset
-     */
-    public DataSet getSource() {
-        return source;
     }
 
@@ -221,7 +167,3 @@
         return references;
     }
-
-    public boolean isBuilt() {
-        return built;
-    }
 }
