Top Inners Fields Constructors Methods
com.jogamp.opengl.util.packrect

public Class Level

extends Object
Class Inheritance
Imports
java.util.*

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private List<Rect>
private int
private final LevelSet
private int
private final List<Rect>
private static final Comparator<Rect>
private final int
private final int

Constructor Summary

AccessConstructor and Description
public
Level(final int width, final int height, final int yPos, final LevelSet holder)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(final Rect rect)

Tries to add the given rectangle to this level only allowing non-disruptive changes like trivial expansion of the last level in the RectanglePacker and allocation from the free list.

private void
public void
compact(final Object backingStore, final BackingStoreManager manager)

public boolean
couldAllocateIfCompacted(final Rect rect)

Indicates whether this Level could satisfy an allocation request if it were compacted.

public void
public int
h()

public boolean
isEmpty()

Indicates whether this Level contains no rectangles.

public Iterator<Rect>
public boolean
remove(final Rect rect)

Removes the given Rect from this Level.

public void
updateRectangleReferences()

Updates the references to the Rect objects in this Level with the "next locations" of those Rects.

public void
visit(final RectVisitor visitor)

Visits all Rects contained in this Level.

public int
w()

public int
yPos()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

freeListback to summary
private List<Rect> freeList
heightback to summary
private int height
holderback to summary
private final LevelSet holder
nextAddXback to summary
private int nextAddX
rectsback to summary
private final List<Rect> rects
rectXComparatorback to summary
private static final Comparator<Rect> rectXComparator
widthback to summary
private final int width
yPosback to summary
private final int yPos

Constructor Detail

Levelback to summary
public Level(final int width, final int height, final int yPos, final LevelSet holder)

Method Detail

addback to summary
public boolean add(final Rect rect)

Tries to add the given rectangle to this level only allowing non-disruptive changes like trivial expansion of the last level in the RectanglePacker and allocation from the free list. More disruptive changes like compaction of the level must be requested explicitly.

coalesceFreeListback to summary
private void coalesceFreeList()
compactback to summary
public void compact(final Object backingStore, final BackingStoreManager manager)
couldAllocateIfCompactedback to summary
public boolean couldAllocateIfCompacted(final Rect rect)

Indicates whether this Level could satisfy an allocation request if it were compacted.

dumpFreeSpaceback to summary
public void dumpFreeSpace()
hback to summary
public int h()
isEmptyback to summary
public boolean isEmpty()

Indicates whether this Level contains no rectangles.

iteratorback to summary
public Iterator<Rect> iterator()
removeback to summary
public boolean remove(final Rect rect)

Removes the given Rect from this Level.

updateRectangleReferencesback to summary
public void updateRectangleReferences()

Updates the references to the Rect objects in this Level with the "next locations" of those Rects. This is actually used to update the new Rects in a newly laid-out LevelSet with the original Rects.

visitback to summary
public void visit(final RectVisitor visitor)

Visits all Rects contained in this Level.

wback to summary
public int w()
yPosback to summary
public int yPos()
com.jogamp.opengl.util.packrect back to summary

pack-priv Class Level.RectXComparator

extends Object
implements Comparator<Rect>
Class Inheritance
All Implemented Interfaces
java.util.Comparator

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
compare(final Rect
the first object to be compared.
r1
,
final Rect
the second object to be compared.
r2
)

Implements java.util.Comparator.compare.

Compares its two arguments for order.
public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Implements java.util.Comparator.equals.

Indicates whether some other object is "equal to" this comparator.
Inherited from java.lang.Object:
clonefinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RectXComparatorback to summary
pack-priv RectXComparator()

Method Detail

compareback to summary
public int compare(final Rect r1, final Rect r2)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Parameters
r1:Rect

the first object to be compared.

r2:Rect

the second object to be compared.

Returns:int

a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Annotations
@Override
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Implements java.util.Comparator.equals.

Doc from java.util.Comparator.equals.

Indicates whether some other object is "equal to" this comparator. This method must obey the general contract of Object#equals(Object). Additionally, this method can return true only if the specified object is also a comparator and it imposes the same ordering as this comparator. Thus, comp1.equals(comp2) implies that signum(comp1.compare(o1, o2))==signum(comp2.compare(o1, o2)) for every object reference o1 and o2.

Note that it is always safe not to override Object.equals(Object). However, overriding this method may, in some cases, improve performance by allowing programs to determine that two distinct comparators impose the same order.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true only if the specified object is also a comparator and it imposes the same ordering as this comparator.

Annotations
@Override