The Mozilla
Organization
At A Glance
Feedback
Get Involved
Newsgroups
License Terms
Newsbot
Developer Docs
Roadmap
Projects
Ports
Module Owners
Hacking
Get the Source
Build It
Testing
Download
Bugzilla
Bug Writing
Tools
View Source
Tree Status
New Checkins
Submit A Bug
FAQ
Search
Class calypso.util.SignedInteger
All Packages  This Package  Class Hierarchy  Class Search  Index

Class calypso.util.SignedInteger

java.lang.Object
   |
   +----calypso.util.SignedInteger

Utility class that represents the parse state from parsing a signed integer. The sign of the integer is maintained so that "10" can be distinguished from "+10". In addition, we can optionally handle numbers expressed as percentages.

See Also: Integer.parseInt


public class  SignedInteger
     extends java.lang.Object
{
          // Fields 6
     public static final int MINUS;
     public static final int NONE;
     public static final int PLUS;
     protected boolean fPct;
     protected int fSign;
     protected int fValue;

          // Constructors 2
     public SignedInteger(int, int);
     public SignedInteger(String, boolean) throws NumberFormatException;

          // Methods 5
     public int computeValue(int);
     public int getSign();
     public int intValue();
     public boolean isPct();
     public String toString();
}



Fields


PLUS

   public static final int PLUS


MINUS

   public static final int MINUS


NONE

   public static final int NONE


fValue

   protected int fValue


fSign

   protected int fSign


fPct

   protected boolean fPct



Constructors


SignedInteger

   public SignedInteger(String aString, 
                        boolean aAllowPct)  throws NumberFormatException

The integer part works (almost) the same as atoi():

  • Skip leading white spaces.
  • Non-digit char terminates convertion.
  • If got a valid integer, don't throw NumberFormatException.
  • Throw exception if first nonspace char is not digit(atoi returns 0). Example: " +4z" works as 4.



SignedInteger

   public SignedInteger(int aValue, 
                        int aSign) 



Methods


intValue

   public int intValue() 


isPct

   public boolean isPct() 


computeValue

   public int computeValue(int aBaseValue) 

Compute a value based on "aBaseValue". Apply the sign of this SignedInteger to determine the value to return.



getSign

   public int getSign() 

Return the sign of the value.



toString

   public String toString() 
Overrides:
toString in class Object


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4
Copyright © 1998-1999 The Mozilla Organization.
Last modified December 25, 1998.