-/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
+/*******************************************************************************
+ * Copyright (c) 2010 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
package org.simantics.databoard.accessor.reference;
-import org.simantics.databoard.Bindings;\r
-import org.simantics.databoard.adapter.Adapter;\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.binding.mutable.Variant;\r
-import org.simantics.databoard.util.URIUtil;\r
+import org.simantics.databoard.Bindings;
+import org.simantics.databoard.adapter.Adapter;
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.binding.mutable.Variant;
+import org.simantics.databoard.util.URIUtil;
/**
* Map Value
* "<key>/"
*/
public class KeyReference extends ChildReference {
-\r
- static Adapter VARIANT_TO_STRING_ADAPTER = Bindings.getAdapterUnchecked(Bindings.VARIANT, Bindings.STR_VARIANT);\r
+
+ static Adapter VARIANT_TO_STRING_ADAPTER = Bindings.getAdapterUnchecked(Bindings.VARIANT, Bindings.STR_VARIANT);
public Variant key;
- \r
- public KeyReference() {\r
- }\r
+
+ public KeyReference() {
+ }
public KeyReference(Binding keyBinding, Object key) {
this.key = new Variant(keyBinding, key);
this.key = key.clone();
}
- @Override\r
- public String toString(boolean labelReference) {\r
- String strKey = (String) VARIANT_TO_STRING_ADAPTER.adaptUnchecked(key);\r
- return labelReference ? URIUtil.encodeURI( strKey ) : "k-"+strKey;\r
- }\r
+ @Override
+ public String toString(boolean labelReference) {
+ String strKey = (String) VARIANT_TO_STRING_ADAPTER.adaptUnchecked(key);
+ return labelReference ? URIUtil.encodeURI( strKey ) : "k-"+strKey;
+ }
@Override
public ChildReference clone() {
return new KeyReference(key.clone(), childReference==null ? null : childReference.clone());
}
- \r
- @Override\r
- public boolean equals(Object obj) {\r
- if (obj instanceof KeyReference == false) return false;\r
- KeyReference other = (KeyReference) obj;\r
- if (!other.key.equals(key)) return false;\r
- if (other.hasChildReference() != hasChildReference()) return false;\r
- if (hasChildReference() && !other.childReference.equals(childReference)) return false;\r
- return true;\r
- }\r
- \r
- @Override\r
- public int hashCode() {\r
- int hash = 61468996 + 37 * key.hashCode();\r
- if (hasChildReference()) hash = 31*hash + childReference.hashCode(); \r
- return hash;\r
- }\r
- \r
- @Override\r
- public String toString() {\r
- return "["+key+"]";\r
- }\r
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof KeyReference == false) return false;
+ KeyReference other = (KeyReference) obj;
+ if (!other.key.equals(key)) return false;
+ if (other.hasChildReference() != hasChildReference()) return false;
+ if (hasChildReference() && !other.childReference.equals(childReference)) return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 61468996 + 37 * key.hashCode();
+ if (hasChildReference()) hash = 31*hash + childReference.hashCode();
+ return hash;
+ }
+
+ @Override
+ public String toString() {
+ return "["+key+"]";
+ }
}