diff options
author | Harvey Harrison <[email protected]> | 2012-06-26 22:28:16 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2012-06-26 22:28:16 -0700 |
commit | 73903b54c3e6f72f2d88e82b89d7aa80a4733a90 (patch) | |
tree | 0c16d177d371791ea983b91fb687e9ae7673475e /src | |
parent | d48d2ddeaf465424b2b53c406dd3f10c746744b2 (diff) |
j3dcore: annoate freelist with type and clean code in RenderingEnvironmentStructure
Signed-off-by: Harvey Harrison <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java b/src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java index 7b116ce..1de685b 100644 --- a/src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java +++ b/src/classes/share/javax/media/j3d/RenderingEnvironmentStructure.java @@ -116,8 +116,8 @@ int numberOfClips = 0; ArrayList xformChangeList = new ArrayList(); - // freelist management of objects - ArrayList objFreeList = new ArrayList(); +// freelist management of objects +private final ArrayList<Object[]> objFreeList = new ArrayList<Object[]>(); LightRetained[] retlights = new LightRetained[5]; @@ -142,33 +142,21 @@ int numberOfClips = 0; } - /** - * Returns a object array of length 5 to save the 5 objects in the message list. - */ - Object[] getObjectArray() { - Object[] objs; - int size; - - size = objFreeList.size(); - if (size == 0) { - objs = new Object[5]; - } - else { - objs = (Object[]) objFreeList.get(size - 1); - objFreeList.remove(size -1); - } - return objs; - } - - void addObjArrayToFreeList(Object[] objs) { - int i; - - for (i = 0; i < objs.length; i++) - objs[i] = null; +/** + * Returns a object array of length 5 to save the 5 objects in the message list. + */ +Object[] getObjectArray() { + int size = objFreeList.size(); + if (size == 0) + return new Object[5]; + + return objFreeList.remove(size - 1); +} +void addObjArrayToFreeList(Object[] objs) { + Arrays.fill(objs, null); objFreeList.add(objs); - } - +} public void updateObject() { |