John W. Campbell
This is a simple class to store an integer. It may be used, for example,
to return an integer value from a method when such a data item is required
in addition to the main return data from the method. This object has methods
to set, clear and test individual bits within the 32 bit integer. The integer
value is accessible as the public field 'value'.
Constructor, Field and Methods:
Class Details
Accessible Fields
Constructor
Bit Methods
- Package:
- Jdl.JdlLib;
- Class name:
- JdlInt
- Class definition:
- public class JdlInt
- Extends:
- Object
- Implements:
- none
- Actions:
- none
The following accessible fields have been defined:
- public int value
- The integer value.
A single constructor is available.
Constructors:
Constructor 1
Create a JdlInt object from an integer value.
- Constructor Definition:
- public JdlInt(int i)
- Parameters List:
- i
- The integer value.
This section contains methods to set, clear and test single bits within
the 32 bit integer.
Methods:
Set a bit - setBit
Clear a bit - clearBit
Test a bit - testBit
Set a bit at the required position.
- Method Definition:
- public void setBit (int ibit)
- Parameters List:
- ibit
- Bit number (from 0-31) of the bit to be set.
Clear a bit at the required position.
- Method Definition:
- public void clearBit (int ibit)
- Parameters List:
- ibit
- Bit number (from 0-31) of the bit to be cleared
Test the value of a bit at the required position.
- Method Definition:
- public boolean testBit (int ibit)
- Parameters List:
- ibit
- Bit number (from 0-31) of bit to be tested.
- Method Return:
-
Returns true if the bit was set, otherwise false.
⇑ Up 2
⇑ Up 1
⇑ Top of this