Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2248)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2249)
@@ -41,4 +41,6 @@
     private static final int FLAG_FILTERED = 1 << 4;
     private static final int FLAG_SELECTED = 1 << 5;
+    private static final int FLAG_HAS_DIRECTIONS = 1 << 6;
+    private static final int FLAG_TAGGED = 1 << 7;
 
     /**
@@ -527,4 +529,5 @@
             this.keys = new HashMap<String, String>(keys);
         }
+        keysChangedImpl();
     }
 
@@ -550,4 +553,5 @@
         }
         mappaintStyle = null;
+        keysChangedImpl();
     }
     /**
@@ -564,4 +568,5 @@
         }
         mappaintStyle = null;
+        keysChangedImpl();
     }
 
@@ -574,4 +579,5 @@
         keys = null;
         mappaintStyle = null;
+        keysChangedImpl();
     }
 
@@ -610,4 +616,9 @@
     public final boolean hasKeys() {
         return keys != null && !keys.isEmpty();
+    }
+
+    private void keysChangedImpl() {
+        updateHasDirectionKeys();
+        updateTagged();
     }
 
@@ -675,4 +686,17 @@
     }
 
+    private void updateTagged() {
+        getUninterestingKeys();
+        if (keys != null) {
+            for (Entry<String,String> e : keys.entrySet()) {
+                if (!uninteresting.contains(e.getKey())) {
+                    flags |= FLAG_TAGGED;
+                    return;
+                }
+            }
+        }
+        flags &= ~FLAG_TAGGED;
+    }
+
     /**
      * true if this object is considered "tagged". To be "tagged", an object
@@ -682,27 +706,24 @@
      */
     public boolean isTagged() {
-        // TODO Cache value after keys are made private
-        getUninterestingKeys();
-        if (keys != null) {
-            for (Entry<String,String> e : keys.entrySet()) {
-                if (!uninteresting.contains(e.getKey()))
-                    return true;
-            }
-        }
-        return false;
-    }
-    /**
-     * true if this object has direction dependent tags (e.g. oneway)
-     */
-    public boolean hasDirectionKeys() {
-        // TODO Cache value after keys are made private
+        return (flags & FLAG_TAGGED) != 0;
+    }
+
+    private void updateHasDirectionKeys() {
         getDirectionKeys();
         if (keys != null) {
             for (Entry<String,String> e : keys.entrySet()) {
-                if (directionKeys.contains(e.getKey()))
-                    return true;
+                if (directionKeys.contains(e.getKey())) {
+                    flags |= FLAG_HAS_DIRECTIONS;
+                    return;
+                }
             }
         }
-        return false;
+        flags &= ~FLAG_HAS_DIRECTIONS;
+    }
+    /**
+     * true if this object has direction dependent tags (e.g. oneway)
+     */
+    public boolean hasDirectionKeys() {
+        return (flags & FLAG_HAS_DIRECTIONS) != 0;
     }
 
