NumberOptionValue.java revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright 1998-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* This class provides a way to retain the radix specified by the user
* when entering the data. Currently only support 10 and 16 for radix.
*/
class NumberValue implements Serializable {
private int radix;
// Serialization id for this class
static final long serialVersionUID = -3480903816949402385L;
}
if (value instanceof BigInteger) {
}
// Handle hex specially
if (radix == 16) {
} else {
}
}
}
public class NumberOptionValue extends OptionValue {
private boolean valid;
private int radix;
// Serialization id for this class
static final long serialVersionUID = -5824132577553748971L;
valid = false;
}
// Find option in option definition table in order to validate the data
}
// The granularity attribute must be interpreted in context
// of what kind of number option we're dealing with. If this
// is a NUMBER option, then granularity defines the number of
// octets the number will contain (in other words the size).
// For all other number types it defines how many numbers of
// that type make make a valid option of that type. Note that
// in the case of NUMBER options that granularity always defaults
// to one. XXX Swill code here. Should probably define a new class and
// create an array of them and simply loop.
boolean isUnsigned = false;
realGranularity = 1;
bits = 7;
bits = 8;
isUnsigned = true;
bits = 15;
bits = 16;
isUnsigned = true;
bits = 31;
bits = 32;
isUnsigned = true;
bits = 63;
bits = 64;
isUnsigned = true;
}
// Empty strings are not acceptable
}
// Parse each token into an object of the correct numeric type
while (st.hasMoreTokens()) {
int radix = 10;
radix = 16;
s = s.substring(2);
radix = 8;
s = s.substring(1);
}
BigInteger b;
try {
b = new BigInteger(s, radix);
}
}
} catch (NumberFormatException e) {
}
}
} else {
// Caller supplied a vector; make sure each value is a number
while (en.hasMoreElements()) {
if (!(o instanceof Number)) {
} else {
}
}
}
// We now have a vector of numbers; check count against expected
}
}
valid = true;
}
return name;
}
return "";
}
}
}
}
}
public boolean isValid() {
return valid;
}
}
return v;
}
}