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.BoxSizerthat 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.BoxSizerthat creates boxes of the given width and depth.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowSleeves()Returnstrueif 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.StringtoString()
-
-
-
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- ifnameisnulljava.lang.IllegalArgumentException- if any dimension orminCardsis less than or equal to 0, or ifheightPaddingis negative
-
SimpleHeightwiseSizer
public SimpleHeightwiseSizer(java.lang.String name, double width, double depth, double heightPadding, double heightPerCard, int minCards, boolean allowSleeves)Create aTuckBox.BoxSizerthat 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-trueif the user can select a sleeve thickness when using this sizer- Throws:
java.lang.NullPointerException- ifnameisnulljava.lang.IllegalArgumentException- if any dimension orminCardsis less than or equal to 0, or ifheightPaddingis negative
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
size
public double[] size(int cards, double sleeveThicknessInMicrons)Description copied from interface:TuckBox.BoxSizerReturns 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 threedoublevalues which measure the width, height, and depth in mm (respectively).- Specified by:
sizein 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.BoxSizerReturnstrueif 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:
allowSleevesin interfaceTuckBox.BoxSizer- Returns:
trueif and only if the user can store this component type on plastic sleeves
-
-