2.5.3 - An Integer Object - JdlInt

John W. Campbell

2.5.3.1 Introduction

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

2.5.3.2 Class Details

Package:
Jdl.JdlLib;
Class name:
JdlInt
Class definition:
public class JdlInt
Extends:
Object
Implements:
none
Actions:
none

2.5.3.3 Accessible Fields

The following accessible fields have been defined:

public int value
The integer value.

2.5.3.4 Constructor

2.5.3.4.1 Introduction

A single constructor is available.

Constructors:

Constructor 1

2.5.3.4.2 Constructor 1

Create a JdlInt object from an integer value.

Constructor Definition:
public JdlInt(int i)
Parameters List:
i
The integer value.

2.5.3.5 Bit Methods

2.5.3.5.1 Introduction

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

2.5.3.5.2 Set a bit - setBit

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.

2.5.3.5.3 Clear a bit - clearBit

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

2.5.3.5.4 Test a bit - testBit

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