Class TuckBox.SimpleDepthwiseSizer
- java.lang.Object
-
- ca.cgjennings.apps.arkham.deck.item.TuckBox.SimpleDepthwiseSizer
-
- All Implemented Interfaces:
TuckBox.BoxSizer
- Enclosing class:
- TuckBox
public static class TuckBox.SimpleDepthwiseSizer extends java.lang.Object implements TuckBox.BoxSizer
An implementation ofTuckBox.BoxSizerthat has a fixed width and height but varies in depth 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 SimpleDepthwiseSizer(java.lang.String name, double width, double height, double depthPadding, double depthPerCard, int minCards)This convenience constructor creates a sizer that allows plastic sleeves.SimpleDepthwiseSizer(java.lang.String name, double width, double height, double depthPadding, double depthPerCard, int minCards, boolean allowSleeves)Create aTuckBox.BoxSizerthat creates boxes of the given width and height.
-
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
-
SimpleDepthwiseSizer
public SimpleDepthwiseSizer(java.lang.String name, double width, double height, double depthPadding, double depthPerCard, int minCards)This convenience constructor creates a sizer that allows plastic sleeves.- Parameters:
name- the name to be returned by the sizer'sname()methodwidth- the width of boxes created by this sizer, in mmheight- the height of boxes created by this sizer, in mmdepthPadding- a padding value added to the depth of every box, in mm (5 is a typical value)depthPerCard- the added depth 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 ifdepthPaddingis negative
-
SimpleDepthwiseSizer
public SimpleDepthwiseSizer(java.lang.String name, double width, double height, double depthPadding, double depthPerCard, int minCards, boolean allowSleeves)Create aTuckBox.BoxSizerthat creates boxes of the given width and height. The depth of the box will be determined using the formuladepthPadding + depthPerCard * numberOfCards, but will not be less thandepthPadding + depthPerCard * 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 mmheight- the height of boxes created by this sizer, in mmdepthPadding- a padding value added to the depth of every box, in mm (5 is a typical value)depthPerCard- the added depth 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 ifdepthPaddingis 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
-
-