|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.WorkArea
public class WorkArea
This class helps to eliminate JVM Heap allocations.
$Id: WorkArea.java,v 1.7 2007-08-27 18:37:51 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
This class provides Stack
and HashSet
instances for re-use. Stacks &
HashSets are often used for spanning algorithms. By re-using
exisiting instances many allocations of large structures can be
avoided.
Constructor Summary | |
---|---|
WorkArea()
|
Method Summary | ||
---|---|---|
static void |
cleanup()
Clean up for profiling statistics. |
|
static
|
getSet(java.lang.String name)
Obtain a HashSet instance for
temporary use. |
|
static
|
getStack(java.lang.String name)
Obtain a Stack for temporary use. |
|
static int |
inUseSets()
Return the number of in use sets. |
|
static int |
inUseStacks()
Return the number of in use stacks. |
|
static int |
maxSets()
Return the maximum number of sets allocated. |
|
static int |
maxStacks()
Return the maximum number of stacks allocated. |
|
static
|
returnSet(HashSet<T> set)
Release the HashSet instance so that
it can be used again. |
|
static
|
returnStack(Stack<T> stk)
Release the Stack so that it can be used again. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WorkArea()
Method Detail |
---|
public static int maxStacks()
public static int inUseStacks()
public static int maxSets()
public static int inUseSets()
public static <T> Stack<T> getStack(java.lang.String name)
Stack
for temporary use. The
Stack
obtained must not be attached to
anything whose lifetime is longer than the invocation time of the
method calling the getStack method. It must be returned for
further use by using returnStack
.
name
- is used to detect who didn't return a Stack
for re-usepublic static <T> void returnStack(Stack<T> stk)
Stack
so that it can be used again.
public static <T> HashSet<T> getSet(java.lang.String name)
HashSet
instance for
temporary use. The HashSet
instance
obtained must not be attached to anything whose lifetime is
longer than the invocation time of the method calling the getSet
method. It must be returned for further use by using returnSet
.
name
- is used to detect who didn't return a HashSet
instance for re-usepublic static <T> void returnSet(HashSet<T> set)
HashSet
instance so that
it can be used again.
public static void cleanup()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |