/******************************************************************************* * 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.Iterator; import java.util.Set; import org.simantics.databoard.binding.ArrayBinding; import org.simantics.databoard.binding.Binding; import org.simantics.databoard.binding.BooleanBinding; 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.BooleanType; import org.simantics.databoard.util.IdentityPair; /** * Binds the type Boolean[]-type to boolean[] Class. */ public final class BooleanArrayBinding extends ArrayBinding { public static BooleanArrayBinding createFrom(ArrayType type) { return new BooleanArrayBinding(type, new BooleanBindingDefault((BooleanType) type.componentType)); } public BooleanArrayBinding(ArrayType type, Binding componentBinding) { super(type, componentBinding); } @Override public Object create() { return new boolean[0]; } @Override public Object create(int length, Iterator values) { boolean[] array = new boolean[length]; for(int i=0;i> compareHistory) throws BindingException { boolean[] a1 = (boolean[]) o1; boolean[] a2 = (boolean[]) o2; // Compare Lengths int l1 = a1.length; int l2 = a2.length; int dif = l1 - l2; if (dif!=0) return dif; // Compare elements for (int i=0; i