/******************************************************************************* * 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.binding.impl; import java.lang.reflect.Array; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.Set; import org.simantics.databoard.binding.ArrayBinding; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.ByteBinding; import org.simantics.databoard.binding.error.BindingException; import org.simantics.databoard.binding.error.UnsupportedOperationException; import org.simantics.databoard.type.ArrayType; import org.simantics.databoard.type.ByteType; import org.simantics.databoard.type.NumberType; import org.simantics.databoard.util.IdentityPair; /** * Binds Byte[] type to byte[] class. */ public final class ByteArrayBinding extends ArrayBinding { public static ByteArrayBinding createFrom(ArrayType type) { return new ByteArrayBinding(type, new ByteBindingDefault((ByteType) type.componentType)); } public ByteArrayBinding(ArrayType type, Binding componentBinding) { super(type, componentBinding); } @Override public Object create() { return new byte[0]; } @Override public Object create(int length, Iterator values) { byte[] array = new byte[length]; for(int i=0;i hashedObjects) throws BindingException { int result = 1; byte[] array = (byte[]) value; for (int i=0; i> compareHistory) throws BindingException { byte[] b1 = (byte[]) o1; byte[] b2 = (byte[]) o2; // Compare Lengths int l1 = b1.length; int l2 = b2.length; int dif = l1 - l2; if (dif!=0) return dif; // Compare elements for (int i=0; i