1 /*
2 * Copyright (c) 2003-2008 by Cosylab d. d.
3 *
4 * This file is part of CosyBeans.
5 *
6 * CosyBeans is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CosyBeans is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CosyBeans. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 package com.cosylab.gui.adapters;
21
22 /**
23 * <code>IdentityConverter</code> is ismplest possible conversion, it delegates same data value to consumers.
24 *
25 * @author <a href="mailto:igor.kriznar@cosylab.com">Igor Kriznar</a>
26 * @version $Id: IdentityConverter.java,v 1.12 2008-04-22 12:31:02 jbobnar Exp $
27 *
28 * @since Feb 15, 2004.
29 */
30 public class IdentityConverter extends SimpleConverterSupport {
31
32 private static final long serialVersionUID = 583866778614153371L;
33 public static final String SHORT_NAME = "Identity";
34 /**
35 * Creates new identity converter.
36 *
37 */
38 public IdentityConverter() {
39 super();
40 }
41
42 /*
43 * (non-Javadoc)
44 * @see com.cosylab.gui.adapters.SimpleConverterSupport#transform(double)
45 */
46 protected double transform(double value) {
47 return value;
48 }
49
50 /*
51 * (non-Javadoc)
52 * @see com.cosylab.gui.adapters.SimpleConverterSupport#inverseTransform(double)
53 */
54 protected double inverseTransform(double value) {
55 return value;
56 }
57
58 /*
59 * (non-Javadoc)
60 * @see com.cosylab.gui.adapters.DataConsumerDispatcher#getName()
61 */
62 public String getName(){
63 return SHORT_NAME;
64 }
65
66 /*
67 * (non-Javadoc)
68 * @see java.lang.Object#toString()
69 */
70 public String toString(){
71 return SHORT_NAME;
72 }
73
74 /*
75 * (non-Javadoc)
76 * @see java.lang.Object#equals(java.lang.Object)
77 */
78 @Override
79 public boolean equals(Object obj) {
80 if (obj instanceof IdentityConverter) return true;
81 return false;
82 }
83 }