Class TuckBox.SimpleHeightwiseSizer
- java.lang.Object
-
- ca.cgjennings.apps.arkham.deck.item.TuckBox.SimpleHeightwiseSizer
-
- All Implemented Interfaces:
TuckBox.BoxSizer
- Enclosing class:
- TuckBox
public static class TuckBox.SimpleHeightwiseSizer extends java.lang.Object implements TuckBox.BoxSizer
An implementation ofTuckBox.BoxSizer
that has a fixed width and depth but varies in height according to the number of components the box will contain. The additional thickness due to sleeves is calculated automatically using a default method.
-
-
Constructor Summary
Constructors Constructor Description SimpleHeightwiseSizer(java.lang.String name, double width, double depth, double heightPadding, double heightPerCard, int minCards)
This is a convenience that creates a sizer that does not allow sleeves.SimpleHeightwiseSizer(java.lang.String name, double width, double depth, double heightPadding, double heightPerCard, int minCards, boolean allowSleeves)
Create aTuckBox.BoxSizer
that creates boxes of the given width and depth.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowSleeves()
Returnstrue
if this helper uses sleeve thickness as part of its sizing algorithm.double[]
size(int cards, double sleeveThicknessInMicrons)
Returns the dimensions for a box of the type represented by this sizer that allows sufficient space to hold a number of cards equal tocards
.java.lang.String
toString()
-
-
-
Constructor Detail
-
SimpleHeightwiseSizer
public SimpleHeightwiseSizer(java.lang.String name, double width, double depth, double heightPadding, double heightPerCard, int minCards)
This is a convenience that creates a sizer that does not allow sleeves. Note that this is the opposite default ofTuckBox.SimpleDepthwiseSizer
, because this sizer tends to be used for thick items like tokens.- Parameters:
name
- the name to be returned by the sizer'sname()
methodwidth
- the width of boxes created by this sizer, in mmdepth
- the depth of boxes created by this sizer, in mmheightPadding
- a padding value added to the height of every box, in mm (5 is a typical value)heightPerCard
- the added height required to hold 1 card, in mmminCards
- a minimum depth for the box, expressed as a card count- Throws:
java.lang.NullPointerException
- ifname
isnull
java.lang.IllegalArgumentException
- if any dimension orminCards
is less than or equal to 0, or ifheightPadding
is negative
-
SimpleHeightwiseSizer
public SimpleHeightwiseSizer(java.lang.String name, double width, double depth, double heightPadding, double heightPerCard, int minCards, boolean allowSleeves)
Create aTuckBox.BoxSizer
that creates boxes of the given width and depth. The height of the box will be determined using the formulaheightPadding + heightPerCard * numberOfCards
, but will not be less thanheightPadding + heightPerCard * minCards
. All measurements are in millimetres.- Parameters:
name
- the name to be returned by the sizer'sname()
methodwidth
- the width of boxes created by this sizer, in mmdepth
- the height of boxes created by this sizer, in mmheightPadding
- a padding value added to the height of every box, in mm (5 is a typical value)heightPerCard
- the added height required to hold 1 card, in mmminCards
- a minimum depth for the box, expressed as a card countallowSleeves
-true
if the user can select a sleeve thickness when using this sizer- Throws:
java.lang.NullPointerException
- ifname
isnull
java.lang.IllegalArgumentException
- if any dimension orminCards
is less than or equal to 0, or ifheightPadding
is negative
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
size
public double[] size(int cards, double sleeveThicknessInMicrons)
Description copied from interface:TuckBox.BoxSizer
Returns the dimensions for a box of the type represented by this sizer that allows sufficient space to hold a number of cards equal tocards
. The dimensions are returned as an array of threedouble
values which measure the width, height, and depth in mm (respectively).- Specified by:
size
in interfaceTuckBox.BoxSizer
- Parameters:
cards
- the number of objects the box should holdsleeveThicknessInMicrons
- the tickness rating of the plastic sleeve in microns, 0 for no sleeves- Returns:
- an array of millimetre measurements for the box's width, height and depth
-
allowSleeves
public boolean allowSleeves()
Description copied from interface:TuckBox.BoxSizer
Returnstrue
if this helper uses sleeve thickness as part of its sizing algorithm. Non-card components typically don't have a suitable sleeve available, so sizers for such components would returnfalse
.- Specified by:
allowSleeves
in interfaceTuckBox.BoxSizer
- Returns:
true
if and only if the user can store this component type on plastic sleeves
-
-