X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.databoard%2Fsrc%2Forg%2Fsimantics%2Fdataboard%2Faccessor%2Freference%2FKeyReference.java;h=cc59142353547f916e12afe5988244567008c850;hb=39508c529ed6dce08d4ca505c9518e3e82fd6efa;hp=b550df5d0f72701cd27e7b7aa33befd7243e16c7;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/reference/KeyReference.java b/bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/reference/KeyReference.java index b550df5d0..cc5914235 100644 --- a/bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/reference/KeyReference.java +++ b/bundles/org.simantics.databoard/src/org/simantics/databoard/accessor/reference/KeyReference.java @@ -1,34 +1,34 @@ -/******************************************************************************* - * 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 - *******************************************************************************/ +/******************************************************************************* + * 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; -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; +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 * "/" */ public class KeyReference extends ChildReference { - - static Adapter VARIANT_TO_STRING_ADAPTER = Bindings.getAdapterUnchecked(Bindings.VARIANT, Bindings.STR_VARIANT); + + static Adapter VARIANT_TO_STRING_ADAPTER = Bindings.getAdapterUnchecked(Bindings.VARIANT, Bindings.STR_VARIANT); public Variant key; - - public KeyReference() { - } + + public KeyReference() { + } public KeyReference(Binding keyBinding, Object key) { this.key = new Variant(keyBinding, key); @@ -43,38 +43,38 @@ public class KeyReference extends ChildReference { this.key = key.clone(); } - @Override - public String toString(boolean labelReference) { - String strKey = (String) VARIANT_TO_STRING_ADAPTER.adaptUnchecked(key); - return labelReference ? URIUtil.encodeURI( strKey ) : "k-"+strKey; - } + @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()); } - - @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+"]"; - } + + @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+"]"; + } }