001package jmri.jmrit.symbolicprog;
002
003import java.util.HashMap;
004import javax.swing.JLabel;
005
006/**
007 * Like {@link DecVariableValue}, except that the string representation is in
008 * hexadecimal.
009 *
010 * @author Bob Jacobsen Copyright (C) 2001, 2014
011 * @author Dave Heap Copyright (C) 2015
012 */
013public class HexVariableValue extends DecVariableValue {
014
015    public HexVariableValue(String name, String comment, String cvName,
016            boolean readOnly, boolean infoOnly, boolean writeOnly, boolean opsOnly,
017            String cvNum, String mask, int minVal, int maxVal,
018            HashMap<String, CvValue> v, JLabel status, String stdname) {
019        super(name, comment, cvName, readOnly, infoOnly, writeOnly, opsOnly, cvNum, mask, minVal, maxVal, v, status, stdname);
020    }
021
022    @Override
023    int textToValue(String s) {
024        return (Integer.valueOf(s, 16));
025    }
026
027    @Override
028    String valueToText(int v) {
029        return (Integer.toHexString(v));
030    }
031
032}