View Javadoc
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 aploese
33   */
34  public class VifeManufacturerSpecific implements Vife {
35  
36      private byte vifeValue;
37  
38      public VifeManufacturerSpecific(byte vifeValue) {
39          this.vifeValue = vifeValue;
40      }
41  
42      @Override
43      public String getLabel() {
44          return String.format("%02X", vifeValue);
45      }
46  
47      @Override
48      public VifeTypes getVifeType() {
49          return VifeTypes.MAN_SPEC;
50      }
51  
52      /**
53       * @return the vifeValue
54       */
55      public byte getVifeValue() {
56          return vifeValue;
57      }
58  
59      /**
60       * @param vifeValue the vifeValue to set
61       */
62      public void setVifeValue(byte vifeValue) {
63          this.vifeValue = vifeValue;
64      }
65  
66      @Override
67      public boolean equals(Object other) {
68          if (other instanceof VifeManufacturerSpecific) {
69              return ((VifeManufacturerSpecific) other).vifeValue == vifeValue;
70          } else {
71              return false;
72          }
73      }
74  
75      @Override
76      public int hashCode() {
77          int hash = 7;
78          hash = 97 * hash + this.vifeValue;
79          return hash;
80      }
81  
82  }