PTP
Release 5.0

org.eclipse.ptp.debug.core
Class TaskSet

java.lang.Object
  extended by java.util.BitSet
      extended by org.eclipse.ptp.debug.core.TaskSet
All Implemented Interfaces:
Serializable, Cloneable

public class TaskSet
extends BitSet

Since:
4.0
See Also:
Serialized Form

Constructor Summary
TaskSet()
          Creates a new task set.
TaskSet(int ntasks)
          Creates a task set whose initial size is large enough to explicitly represent tasks with indices in the range 0 through ntasks-1.
TaskSet(int ntasks, String str)
          Construct a TaskSet and initialize from a hex string representation.
 
Method Summary
 void clear(int[] indices)
          Clear the bits at each position given by the array of indices
 Object clone()
           
 TaskSet copy()
          Create a copy of the TaskSet
 void set(int[] indices)
          Set the tasks at each position given by the array of indices
 int taskSize()
          Get the fixed number of tasks represented by the TaskSet.
 int[] toArray()
          Convert the TaskSet to an array containing the indices of all tasks.
 String toHexString()
          Convert the TaskSet into a hex string representation.
 String toString()
           
 
Methods inherited from class java.util.BitSet
and, andNot, cardinality, clear, clear, clear, equals, flip, flip, get, get, hashCode, intersects, isEmpty, length, nextClearBit, nextSetBit, or, set, set, set, set, size, xor
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TaskSet

public TaskSet()
Creates a new task set. The set is initially empty.


TaskSet

public TaskSet(int ntasks)
Creates a task set whose initial size is large enough to explicitly represent tasks with indices in the range 0 through ntasks-1. All tasks are initially false.

Parameters:
ntasks - the initial size of the task set.
Throws:
NegativeArraySizeException - if the specified initial size is negative.

TaskSet

public TaskSet(int ntasks,
               String str)
Construct a TaskSet and initialize from a hex string representation.

Parameters:
nbits - number of tasks in the TaskSet
str - hex string representation of tasks in the TaskSet
Throws:
NegativeArraySizeException - if the specified initial size is negative.
Method Detail

clear

public void clear(int[] indices)
           throws IndexOutOfBoundsException
Clear the bits at each position given by the array of indices

Parameters:
indexes - array of indices to clear
Throws:
IndexOutOfBoundsException

clone

public Object clone()
Overrides:
clone in class BitSet

copy

public TaskSet copy()
Create a copy of the TaskSet

Returns:
a copy of the TaskSet

set

public void set(int[] indices)
         throws IndexOutOfBoundsException
Set the tasks at each position given by the array of indices

Parameters:
indices - array of indices to clear
Throws:
IndexOutOfBoundsException

toArray

public int[] toArray()
Convert the TaskSet to an array containing the indices of all tasks. If there are no tasks, an empty array is returned.

Returns:
array containing the indices of all set bits.

toHexString

public String toHexString()
Convert the TaskSet into a hex string representation. The number of characters in the string is always even.

Returns:
hex string representation of TaskSet

toString

public String toString()
Overrides:
toString in class BitSet

taskSize

public int taskSize()
Get the fixed number of tasks represented by the TaskSet. This differs from BitSet.size() which is the number of bits of space used by the TaskSet and BitSet.length() which is the index of the highest bit plus one.

Returns:
initial number of bits

PTP
Release 5.0

Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.