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