]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/nodes/TransformationAssignment.java
Support for dynamic transforms for both elements and terminals
[simantics/platform.git] / bundles / org.simantics.scenegraph / src / org / simantics / scenegraph / g2d / nodes / TransformationAssignment.java
1 /*******************************************************************************
2  * Copyright (c) 2017 Association for Decentralized Information Management
3  * in 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  *     Semantum Oy - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.scenegraph.g2d.nodes;
13
14 import java.awt.geom.AffineTransform;
15
16 /**
17  * @author Antti Villberg
18  * @since 1.29.0
19  */
20 public class TransformationAssignment {
21         public Object key;
22         public AffineTransform transform;
23         public TransformationAssignment(Object key, AffineTransform transform) {
24                 this.key = key;
25                 this.transform = transform;
26         }
27         @Override
28         public int hashCode() {
29                 final int prime = 31;
30                 int result = 1;
31                 result = prime * result + ((key == null) ? 0 : key.hashCode());
32                 result = prime * result + ((transform == null) ? 0 : transform.hashCode());
33                 return result;
34         }
35         @Override
36         public boolean equals(Object obj) {
37                 if (this == obj)
38                         return true;
39                 if (obj == null)
40                         return false;
41                 if (getClass() != obj.getClass())
42                         return false;
43                 TransformationAssignment other = (TransformationAssignment) obj;
44                 if (key == null) {
45                         if (other.key != null)
46                                 return false;
47                 } else if (!key.equals(other.key))
48                         return false;
49                 if (transform == null) {
50                         if (other.transform != null)
51                                 return false;
52                 } else if (!transform.equals(other.transform))
53                         return false;
54                 return true;
55         }
56 }