DRCL JavaSim API

drcl.util.scalar
Class LongSpace

java.lang.Object
  |
  +--drcl.DrclObj
        |
        +--drcl.util.scalar.LongSpace
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, java.io.Serializable

public class LongSpace
extends DrclObj

A long integer space.

See Also:
Serialized Form

Constructor Summary
LongSpace()
           
LongSpace(long start_, long end_)
           
 
Method Summary
 void checkin(long which_)
           
 void checkin(long start_, long end_)
          Check in a range of long integers.
 long checkout()
          Check out the first available long integer from the space.
 long checkout(long code_)
          Check out a long integer, given a preference.
 void checkout(long start_, long end_)
          Check out a range of long integers.
 long checkoutGreater(long code_)
          Check out the smallest long integer that is greater than or equal to code_.
 long checkoutSmaller(long code_)
          Check out the greatest long integer that is smaller than or equal to code_.
 void checkoutUntil(long end_)
          Check out all long integers before the specified one.
 void clear()
           
 boolean contains(long code_)
          Returns true if the long integer is in the space.
 boolean contains(long start_, long 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(LongSpace that_)
           
 java.util.Iterator getGapIterator()
          Returns the iterator that iterates the gaps in this space.
 java.util.Iterator getGapIterator(long 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(long start_)
          Returns the iterator that iterates the intervals in this space.
 LongInterval[] getLongIntervals()
           
 long getSize()
          Returns the number of long integers in this space.
 long getSize(long start_, long end_)
          Returns the number of long integers in this space that are in the specified range.
 long getSizeUpTo(long end_)
          Returns the number of long integers in this space that are smaller than the specified one.
 long getSmallest()
          Returns the first available long integer in the space.
 java.lang.String info()
           
 void intersectedWith(LongSpace that_)
           
 boolean isIntersectedWith(long start_, long end_)
          Returns true if the intersection of the range and this space is not empty.
 LongInterval nextGap(long start_)
          Returns next gap starting greater than or equal to start_.
 LongInterval nextInterval(long start_)
          Returns next interval starting greater than or equal to start_.
 int numOfLongIntervals()
           
 void reset()
           
 void reset(long start, long end)
           
 void shiftedBy(long shift_)
          Shifts all the intervals in the space by shift_.
 boolean strictlyContains(long start_, long end_)
          Returns true if the range is covered in this space but not one of the constituent blocks.
 void takesUnionWith(LongSpace 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

LongSpace

public LongSpace()

LongSpace

public LongSpace(long start_,
                 long end_)
Method Detail

reset

public void reset()

reset

public void reset(long start,
                  long 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().
Overrides:
duplicate in class DrclObj

toString

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

info

public java.lang.String info()

numOfLongIntervals

public int numOfLongIntervals()

getSmallest

public long getSmallest()
Returns the first available long integer in the space.
Returns:
java.lang.Long.MIN_VALUE if the set is empty.

getLongIntervals

public LongInterval[] getLongIntervals()

checkout

public long checkout()
Check out the first available long integer from the space.
Returns:
java.lang.Long.MIN_VALUE if the set is empty.

checkout

public long checkout(long code_)
Check out a long integer, given a preference.
Returns:
java.lang.Long.MIN_VALUE if code_ is not in the space.

checkout

public void checkout(long start_,
                     long end_)
Check out a range of long integers.
Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

checkoutUntil

public void checkoutUntil(long end_)
Check out all long integers before the specified one.
Parameters:
end_ - end of the range, exclusive.

checkoutGreater

public long checkoutGreater(long code_)
Check out the smallest long integer that is greater than or equal to code_.
Returns:
java.lang.Long.MIN_VALUE if none is available.

checkoutSmaller

public long checkoutSmaller(long code_)
Check out the greatest long integer that is smaller than or equal to code_.
Returns:
java.lang.Long.MAX_VALUE if none is available.

checkin

public void checkin(long which_)

checkin

public void checkin(long start_,
                    long end_)
Check in a range of long integers.
Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

takesUnionWith

public void takesUnionWith(LongSpace that_)

excludes

public void excludes(LongSpace that_)

intersectedWith

public void intersectedWith(LongSpace that_)

shiftedBy

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

nextInterval

public LongInterval nextInterval(long 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 LongInterval nextGap(long start_)
Returns next gap starting greater than or equal to start_.

contains

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

contains

public boolean contains(long start_,
                        long 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(long start_,
                                long end_)
Returns true if the range is covered in this space but not one of the constituent blocks.
Parameters:
start_ - start of the range, inclusive.
end_ - end of the range, exclusive.

isIntersectedWith

public boolean isIntersectedWith(long start_,
                                 long 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 long getSize()
Returns the number of long integers in this space.

getSize

public long getSize(long start_,
                    long end_)
Returns the number of long 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 long getSizeUpTo(long end_)
Returns the number of long 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(long 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(long start_)
Returns the iterator that iterates the gaps in this space. The gap strictly containing start_ does not count.

DRCL JavaSim API

Copyright © 2001 - DRCL, OSU     ~ Back to JavaSim Home ~