javax.media.j3d
Class WakeupOnElapsedTimeHeap

java.lang.Object
  extended by javax.media.j3d.WakeupOnElapsedTimeHeap
All Implemented Interfaces:
java.lang.Cloneable

 class WakeupOnElapsedTimeHeap
extends java.lang.Object
implements java.lang.Cloneable

A Binary heap to store WakeupOnElapsedTime. It is arranged so that the smallest triggeredTime of the wakeup object is put at the top of the heap. Add/deletion takes O(log n) time. For better performance we can consider to use Fibonacci Heaps.


Field Summary
(package private)  WakeupOnElapsedTime[] data
           
(package private)  int size
           
 
Constructor Summary
WakeupOnElapsedTimeHeap()
          Construct heap of default capacity 10
WakeupOnElapsedTimeHeap(int initCapacity)
          Construct heap with user-defined capacity
 
Method Summary
protected  java.lang.Object clone()
          Clone this heap
(package private)  void extract(BehaviorRetained behav)
          Extract wakeup condition belongs to behav from the heap.
(package private)  WakeupOnElapsedTime extract(int i)
          Extract the ith value from the heap.
(package private)  boolean extract(WakeupOnElapsedTime wakeup)
          Extract wakeup from the heap.
(package private)  WakeupOnElapsedTime extractMin()
          Extract the minimum value from the heap.
(package private)  WakeupOnElapsedTime getMin()
          Get the minimum element from the heap.
(package private)  void insert(WakeupOnElapsedTime key)
          Insert the key into the heap
(package private)  boolean isEmpty()
          Return true if heap is empty
(package private)  int size()
          Return size of heap
 java.lang.String toString()
           
(package private)  void trimToSize()
          Trims the capacity of this instance to be the list's current size.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

WakeupOnElapsedTime[] data

size

int size
Constructor Detail

WakeupOnElapsedTimeHeap

WakeupOnElapsedTimeHeap(int initCapacity)
Construct heap with user-defined capacity


WakeupOnElapsedTimeHeap

WakeupOnElapsedTimeHeap()
Construct heap of default capacity 10

Method Detail

size

final int size()
Return size of heap


isEmpty

final boolean isEmpty()
Return true if heap is empty


getMin

final WakeupOnElapsedTime getMin()
Get the minimum element from the heap. User has to make sure that size > 0 before it is called.


insert

final void insert(WakeupOnElapsedTime key)
Insert the key into the heap


extract

final void extract(BehaviorRetained behav)
Extract wakeup condition belongs to behav from the heap. Return true if wakeup is found.


extract

final boolean extract(WakeupOnElapsedTime wakeup)
Extract wakeup from the heap. Return true if wakeup is found.


extractMin

final WakeupOnElapsedTime extractMin()
Extract the minimum value from the heap. User has to make sure that size > 0 before it is called.


extract

final WakeupOnElapsedTime extract(int i)
Extract the ith value from the heap. User has to make sure that i <= size before it is called.


trimToSize

final void trimToSize()
Trims the capacity of this instance to be the list's current size.


clone

protected final java.lang.Object clone()
Clone this heap

Overrides:
clone in class java.lang.Object

toString

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


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.