From 8471241a88adc5533e0b8aec56c6110474187ec8 Mon Sep 17 00:00:00 2001 From: hns Date: Sun, 5 Aug 2001 19:23:22 +0000 Subject: [PATCH] rewrote comment to reflect that this key is not only used for virtual and groupby nodes, but also for nodes accessed via a property name --- src/helma/objectmodel/SyntheticKey.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/helma/objectmodel/SyntheticKey.java b/src/helma/objectmodel/SyntheticKey.java index cd37c4c8..29584fbc 100644 --- a/src/helma/objectmodel/SyntheticKey.java +++ b/src/helma/objectmodel/SyntheticKey.java @@ -6,16 +6,15 @@ package helma.objectmodel; import java.io.Serializable; /** - * This is the internal key for an object that is not stored in a db, but generated - * on the fly. Currently there are two kinds of such objects: virtual nodes, which are used - * as utility containers for objects in the database, and groupby nodes, which are used - * to group a certain kind of relational objects according to some property. + * This is the internal key for an object that is not - or not directly - fetched from a db, + * but derived from another object. This is useful for all kinds of object accessed via a + * symbolic name from another object, like objects mounted via a property name column, + * virtual nodes and groupby nodes. */ public final class SyntheticKey implements Key, Serializable { private final Key parentKey; private final String name; - // private final int hash; /** @@ -24,23 +23,22 @@ public final class SyntheticKey implements Key, Serializable { public SyntheticKey (Key key, String name) { this.parentKey = key; this.name = name; - // hash = name.hashCode () + key.hashCode (); } public boolean equals (Object what) { + if (what == this) + return true; try { SyntheticKey k = (SyntheticKey) what; return parentKey.equals (k.parentKey) && (name == k.name || name.equals (k.name)); } catch (Exception x) { - System.err.println ("SYNTHETIC NOT EQUAL: "+what+" - "+this); return false; } } public int hashCode () { - // return hash; return name.hashCode () + parentKey.hashCode (); }