OOP FormGenerator Version 3.1

com.oopreserch.web
Class IsDouble

java.lang.Object
  |
  +--com.oopreserch.web.IsDouble
All Implemented Interfaces:
FormValueVerifier

public class IsDouble
extends java.lang.Object
implements FormValueVerifier

Implementation of FormValueVerifier interface. Returns true if valid as positive double.

This class sees if the given String can be parsed to double or not. But, even if it can be parsed to double, the String which starts with 0 (zero) will be treated as invalid, unless it starts with 0. (zero followed by period). And the String which ends with . (period) will be treated as invalid, even if it can be parsed to double. In addition, while the String which starts with . (period) can be parsed to double, it will also be treated as invalid. For example:

StringResult
10true
010false
0true
0.1true
.1false
0.false
1.0true
1.false

Please note that all the Strings listed in the above table can be parsed to double. But, the valid String should look well also for human beings.

Author:
Jun Inamori

Constructor Summary
IsDouble()
           
 
Method Summary
 boolean isValidString(java.lang.String str)
          Returns true if the given String is valid as positive double.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IsDouble

public IsDouble()
Method Detail

isValidString

public boolean isValidString(java.lang.String str)
Returns true if the given String is valid as positive double.

Specified by:
isValidString in interface FormValueVerifier
Parameters:
str - String to be tested.
Returns:
true if the given String is valid as positive double.

OOP FormGenerator Version 3.1

ALL CONTENTS COPYRIGHT 2002, Jun Inamori. All rights reserved.
Any questions and comments are welcome to Jun Inamori.