Class TuckBox.SimpleHeightwiseSizer

  • All Implemented Interfaces:
    TuckBox.BoxSizer
    Enclosing class:
    TuckBox

    public static class TuckBox.SimpleHeightwiseSizer
    extends java.lang.Object
    implements TuckBox.BoxSizer
    An implementation of TuckBox.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 a TuckBox.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()
      Returns true 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 to cards.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 of TuckBox.SimpleDepthwiseSizer, because this sizer tends to be used for thick items like tokens.
        Parameters:
        name - the name to be returned by the sizer's name() method
        width - the width of boxes created by this sizer, in mm
        depth - the depth of boxes created by this sizer, in mm
        heightPadding - 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 mm
        minCards - a minimum depth for the box, expressed as a card count
        Throws:
        java.lang.NullPointerException - if name is null
        java.lang.IllegalArgumentException - if any dimension or minCards is less than or equal to 0, or if heightPadding is negative
      • SimpleHeightwiseSizer

        public SimpleHeightwiseSizer​(java.lang.String name,
                                     double width,
                                     double depth,
                                     double heightPadding,
                                     double heightPerCard,
                                     int minCards,
                                     boolean allowSleeves)
        Create a TuckBox.BoxSizer that creates boxes of the given width and depth. The height of the box will be determined using the formula heightPadding + heightPerCard * numberOfCards, but will not be less than heightPadding + heightPerCard * minCards. All measurements are in millimetres.
        Parameters:
        name - the name to be returned by the sizer's name() method
        width - the width of boxes created by this sizer, in mm
        depth - the height of boxes created by this sizer, in mm
        heightPadding - 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 mm
        minCards - a minimum depth for the box, expressed as a card count
        allowSleeves - true if the user can select a sleeve thickness when using this sizer
        Throws:
        java.lang.NullPointerException - if name is null
        java.lang.IllegalArgumentException - if any dimension or minCards is less than or equal to 0, or if heightPadding is negative
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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 to cards. The dimensions are returned as an array of three double values which measure the width, height, and depth in mm (respectively).
        Specified by:
        size in interface TuckBox.BoxSizer
        Parameters:
        cards - the number of objects the box should hold
        sleeveThicknessInMicrons - 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
        Returns true 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 return false.
        Specified by:
        allowSleeves in interface TuckBox.BoxSizer
        Returns:
        true if and only if the user can store this component type on plastic sleeves