vieiro commented on code in PR #5432:
URL: https://github.com/apache/netbeans/pull/5432#discussion_r1096735306


##########
ide/css.lib/src/org/netbeans/modules/css/lib/properties/GrammarParser.java:
##########
@@ -372,4 +386,59 @@ public CharSequence readText() {
             return text.subSequence(0, pos);
         }
     }
+
+    private static class PropertyGrammarElementRef {
+        private final GrammarElement parent;
+        private final int index;
+        private final String propertyName;
+
+        public PropertyGrammarElementRef(GrammarElement parent, int index, 
String propertyName) {
+            this.parent = parent;
+            this.index = index;
+            this.propertyName = propertyName;
+        }
+
+        @Override
+        public int hashCode() {
+            int hash = 7;
+            hash = 29 * hash + this.index;
+            hash = 29 * hash + Objects.hashCode(this.propertyName);
+            return hash;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            final PropertyGrammarElementRef other = 
(PropertyGrammarElementRef) obj;
+            if (this.index != other.index) {
+                return false;
+            }
+            if (!Objects.equals(this.propertyName, other.propertyName)) {
+                return false;
+            }
+            return 
truncatedPath(this.parent).equals(truncatedPath(other.parent));
+        }
+
+        @SuppressWarnings("AssignmentToMethodParameter")
+        private String truncatedPath(GrammarElement parent) {
+            StringBuilder path = new StringBuilder();
+            while(parent != null) {
+                path.append(parent.getName());
+                path.append("/");
+                if(parent.getName() != null) {

Review Comment:
   This `if (parent.getName() != null) {` shouldn't it be two lines above? Or 
do we want `path.append(parent.getName());` even if `parent.getName()` is null?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to