J-Sim v1.2.1-p7 API

drcl.util.scalar
Class IntSpace

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.util.scalar.IntSpace
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, java.io.Serializable

public class IntSpace
extends DrclObj

An integer space.

See Also:
Serialized Form

Constructor Summary
IntSpace()
           
IntSpace(int start_, int end_)
           
 
Method Summary
 void checkin(int which_)
           
 void checkin(int start_, int end_)
          Check in a range of integers.
 int checkout()
          Check out the first available integer from the space.
 int checkout(int code_)
          Check out an integer, given a preference.
 void checkout(int start_, int end_)
          Check out a range of integers.
 int checkoutGreater(int code_)
          Check out the smallest integer that is greater than or equal to code_.
 int checkoutSmaller(int code_)
          Check out the greatest integer that is smaller than or equal to code_.
 void checkoutUntil(int end_)
          Check out all integers before the specified one.
 void clear()
           
 boolean contains(int code_)
          Returns true if the integer is in the space.
 boolean contains(int start_, int end_)
          Returns true if the range is covered in the space.
 void duplicate(java.lang.Object source_)
          opies the content of the source_ object to this object.
 void excludes(IntSpace that_)
           
 java.util.Iterator getGapIterator()
          Returns the iterator that iterates the gaps in this space.
 java.util.Iterator getGapIterator(int start_)
          Returns the iterator that iterates the gaps in this space.
 java.util.Iterator getIntervalIterator()
          Returns the iterator that iterates the intervals in this space.
 java.util.Iterator getIntervalIterator(int start_)
          Returns the iterator that iterates the intervals in this space.
 IntInterval getIntInterval(int index_)
           
 IntInterval[] getIntIntervals()
           
 int getSize()
          Returns the number of integers in this space.
 int getSize(int start_, int end_)
          Returns the number of integers in this space that are in the specified range.
 int getSizeUpTo(int end_)
          Returns the number of integers in this space that are smaller than the specified one.
 int getSmallest()
          Returns the first available integer in the space.
 java.lang.String info()
           
 void intersectedWith(IntSpace that_)
           
 boolean isIntersectedWith(int start_, int end_)
          Returns true if the intersection of the range and this space is not empty.
 IntInterval nextGap(int start_)
          Returns next gap starting greater than or equal to start_.
 IntInterval nextInterval(int start_)
          Returns next interval starting greater than or equal to start_.
 int numOfIntIntervals()
           
 void reset()
           
 void reset(int start, int end)
           
 void shiftedBy(int shift_)
          Shifts all the intervals in the space by shift_.
 boolean strictlyContains(int start_, int end_)
          Returns true if the range is covered in the space but is not one of the constituent blocks.
 void takesUnionWith(IntSpace that_)
           
 java.lang.String toString()
           
 
Methods inherited from class drcl.DrclObj
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntSpace

public IntSpace()

IntSpace

public IntSpace(int start_,
                int end_)
Method Detail

reset

public void reset()

reset

public void reset(int start,
                  int end)

clear

public void clear()

duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: DrclObj
opies the content of the source_ object to this object. he subclass must implement this method to realize DrclObj.clone().

Specified by:
duplicate in interface ObjectDuplicable
Overrides:
duplicate in class DrclObj

toString

public java.lang.String toString()
Overrides:
toString in class DrclObj

info

public java.lang.String info()

numOfIntIntervals

public int numOfIntIntervals()

getSmallest

public int getSmallest()
Returns the first available integer in the space.

Returns:
java.lang.Integer.MIN_VALUE if the set is empty.

getIntIntervals

public IntInterval[] getIntIntervals()

getIntInterval

public IntInterval getIntInterval(int index_)

checkout

public int checkout()
Check out the first available integer from the space.

Returns:
java.lang.Integer.MIN_VALUE if the set is empty.

checkout

public int checkout(int code_)
Check out an integer, given a preference.

Returns:
java.lang.Integer.MIN_VALUE if code_ is not in the space.

checkout

public void checkout(int start_,
                     int end_)
Check out a range of integers.

Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

checkoutUntil

public void checkoutUntil(int end_)
Check out all integers before the specified one.

Parameters:
end_ - end of the range, exclusive.

checkoutGreater

public int checkoutGreater(int code_)
Check out the smallest integer that is greater than or equal to code_.

Returns:
java.lang.Integer.MIN_VALUE if none is available.

checkoutSmaller

public int checkoutSmaller(int code_)
Check out the greatest integer that is smaller than or equal to code_.

Returns:
java.lang.Integer.MAX_VALUE if none is available.

checkin

public void checkin(int which_)

checkin

public void checkin(int start_,
                    int end_)
Check in a range of integers.

Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

takesUnionWith

public void takesUnionWith(IntSpace that_)

excludes

public void excludes(IntSpace that_)

intersectedWith

public void intersectedWith(IntSpace that_)

shiftedBy

public void shiftedBy(int shift_)
Shifts all the intervals in the space by shift_.


nextInterval

public IntInterval nextInterval(int start_)
Returns next interval starting greater than or equal to start_. The returned interval may be shared by this space, modifying it alters this space.

Returns:
null if no such an interval exisits.

nextGap

public IntInterval nextGap(int start_)
Returns next gap starting greater than or equal to start_.


contains

public boolean contains(int code_)
Returns true if the integer is in the space.


contains

public boolean contains(int start_,
                        int end_)
Returns true if the range is covered in the space.

Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

strictlyContains

public boolean strictlyContains(int start_,
                                int end_)
Returns true if the range is covered in the space but is not one of the constituent blocks.

Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

isIntersectedWith

public boolean isIntersectedWith(int start_,
                                 int end_)
Returns true if the intersection of the range and this space is not empty.

Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

getSize

public int getSize()
Returns the number of integers in this space.


getSize

public int getSize(int start_,
                   int end_)
Returns the number of integers in this space that are in the specified range.

Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

getSizeUpTo

public int getSizeUpTo(int end_)
Returns the number of integers in this space that are smaller than the specified one.

Parameters:
end_ - end of the range, exclusive.

getIntervalIterator

public java.util.Iterator getIntervalIterator()
Returns the iterator that iterates the intervals in this space.


getIntervalIterator

public java.util.Iterator getIntervalIterator(int start_)
Returns the iterator that iterates the intervals in this space. The interval strictly containing start_ does not count.


getGapIterator

public java.util.Iterator getGapIterator()
Returns the iterator that iterates the gaps in this space.


getGapIterator

public java.util.Iterator getGapIterator(int start_)
Returns the iterator that iterates the gaps in this space. The gap strictly containing start_ does not count.


J-Sim v1.2.1-p7 API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~