| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private Object | |
| private static final float | |
| private final int | |
| private final int | |
| private LevelSet | |
| private final BackingStoreManager | |
| private int | |
| private int | |
| private static final Comparator | |
| private static final float |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | compact()
Forces a compaction cycle, which typically results in allocating a new backing store and copying all entries to it. |
| private void | |
| public void | |
| public Object | |
| public void | |
| public void | setMaxSize(final int maxWidth, final int maxHeight)
Sets up a maximum width and height for the backing store. |
| public float | |
| public void |
| backingStore | back to summary |
|---|---|
| private Object backingStore | |
| EXPANSION_FACTOR | back to summary |
|---|---|
| private static final float EXPANSION_FACTOR | |
| initialHeight | back to summary |
|---|---|
| private final int initialHeight | |
| initialWidth | back to summary |
|---|---|
| private final int initialWidth | |
| levels | back to summary |
|---|---|
| private LevelSet levels | |
| manager | back to summary |
|---|---|
| private final BackingStoreManager manager | |
| maxHeight | back to summary |
|---|---|
| private int maxHeight | |
| maxWidth | back to summary |
|---|---|
| private int maxWidth | |
| rectHComparator | back to summary |
|---|---|
| private static final Comparator<Rect> rectHComparator | |
| SHRINK_FACTOR | back to summary |
|---|---|
| private static final float SHRINK_FACTOR | |
| RectanglePacker | back to summary |
|---|---|
| public RectanglePacker(final BackingStoreManager manager, final int initialWidth, final int initialHeight) | |
| add | back to summary |
|---|---|
| public void add(final Rect rect) throws RuntimeException Decides upon an (x, y) position for the given rectangle (leaving
its width and height unchanged) and places it on the backing
store. May provoke re-layout of other Rects already added. If
the BackingStoreManager does not support compaction, and | |
| clear | back to summary |
|---|---|
| public void clear() Clears all Rects contained in this RectanglePacker. | |
| compact | back to summary |
|---|---|
| public void compact() Forces a compaction cycle, which typically results in allocating a new backing store and copying all entries to it. | |
| compactImpl | back to summary |
|---|---|
| private void compactImpl(final Rect cause) | |
| dispose | back to summary |
|---|---|
| public void dispose() Disposes the backing store allocated by the BackingStoreManager. This RectanglePacker may no longer be used after calling this method. | |
| getBackingStore | back to summary |
|---|---|
| public Object getBackingStore() | |
| remove | back to summary |
|---|---|
| public void remove(final Rect rect) Removes the given rectangle from this RectanglePacker. | |
| setMaxSize | back to summary |
|---|---|
| public void setMaxSize(final int maxWidth, final int maxHeight) Sets up a maximum width and height for the backing store. These are optional and if not specified the backing store will grow as necessary. Setting up a maximum width and height introduces the possibility that additions will fail; these are handled with the BackingStoreManager's allocationFailed notification. | |
| verticalFragmentationRatio | back to summary |
|---|---|
| public float verticalFragmentationRatio() Returns the vertical fragmentation ratio of this RectanglePacker. This is defined as the ratio of the sum of the heights of all completely empty Levels divided by the overall used height of the LevelSet. A high vertical fragmentation ratio indicates that it may be profitable to perform a compaction. | |
| visit | back to summary |
|---|---|
| public void visit(final RectVisitor visitor) Visits all Rects contained in this RectanglePacker. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method 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. |
| public boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. Implements java. |
| RectHComparator | back to summary |
|---|---|
| pack-priv RectHComparator() | |
| compare | back to summary |
|---|---|
| public int compare(final Rect r1, final Rect r2) Implements java. Doc from java. 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
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Implements java. Doc from java. Indicates whether some other object is "equal to"
this comparator. This method must obey the general contract of
Note that it is always safe not to override
| |