1 package net.sf.mbus4j.dataframes.datablocks.vif;
2
3 /*
4 * #%L
5 * mbus4j-core
6 * %%
7 * Copyright (C) 2009 - 2014 MBus4J
8 * %%
9 * mbus4j - Drivers for the M-Bus protocol - http://mbus4j.sourceforge.net/
10 * Copyright (C) 2009-2014, mbus4j.sf.net, and individual contributors as indicated
11 * by the @authors tag. See the copyright.txt in the distribution for a
12 * full listing of individual contributors.
13 *
14 * This is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 3 of
17 * the License, or (at your option) any later version.
18 *
19 * This software is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this software; if not, write to the Free
26 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
28 * #L%
29 */
30 /**
31 *
32 * @author arnep@users.sourceforge.net
33 * @version $Id: VifAscii.java 163 2016-10-07 18:53:55Z arnep $
34 */
35 public class VifAscii implements Vif {
36
37 private String value;
38
39 public VifAscii() {
40 }
41
42 public VifAscii(String value) {
43 this.value = value;
44 }
45
46 @Override
47 public Integer getExponent() {
48 return null;
49 }
50
51 @Override
52 public String getLabel() {
53 return value;
54 }
55
56 @Override
57 public SiPrefix getSiPrefix() {
58 return null;
59 }
60
61 @Override
62 public UnitOfMeasurement getUnitOfMeasurement() {
63 return null;
64 }
65
66 public String getValue() {
67 return value;
68 }
69
70 public void setValue(String value) {
71 this.value = value;
72 }
73
74 @Override
75 public String toString() {
76 return value;
77 }
78
79 @Override
80 public boolean equals(Object o) {
81 if (o instanceof VifAscii) {
82 return value.equals(((VifAscii) o).value);
83 } else {
84 return false;
85 }
86 }
87
88 @Override
89 public int hashCode() {
90 int hash = 5;
91 hash = 97 * hash + (this.value != null ? this.value.hashCode() : 0);
92 return hash;
93 }
94
95 @Override
96 public VifTypes getVifType() {
97 return VifTypes.ASCII;
98 }
99 }