]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/examples/org/simantics/databoard/example/DeepHashcode.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / examples / org / simantics / databoard / example / DeepHashcode.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.databoard.example;
13
14 import org.simantics.databoard.Bindings;
15 import org.simantics.databoard.binding.Binding;
16 import org.simantics.databoard.binding.error.BindingException;
17
18 public class DeepHashcode {
19
20         public static void main(String[] args) throws BindingException {
21
22                 // Binding can calculate deep hashcode for any instance
23                 Binding binding = Bindings.getBindingUnchecked( int[].class );
24                 
25                 int[] array1 = new int[] { 1, 2, 3 };
26                 int[] array2 = new int[] { 1, 2, 3 };
27                 int[] array3 = new int[] { 2, 3, 4 };
28                 
29                 System.out.println( "Hashcode for array1 is " + binding.hashValue( array1 ) );
30                 System.out.println( "Hashcode for array2 is " + binding.hashValue( array2 ) );
31                 System.out.println( "Hashcode for array3 is " + binding.hashValue( array3 ) );
32                 
33         }
34         
35 }