Class TuckBox.SimpleDepthwiseSizer

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

    public static class TuckBox.SimpleDepthwiseSizer
    extends java.lang.Object
    implements TuckBox.BoxSizer
    An implementation of TuckBox.BoxSizer that 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 a TuckBox.BoxSizer that creates boxes of the given width and height.
    • 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

      • 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's name() method
        width - the width of boxes created by this sizer, in mm
        height - the height of boxes created by this sizer, in mm
        depthPadding - 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 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 depthPadding is negative
      • SimpleDepthwiseSizer

        public SimpleDepthwiseSizer​(java.lang.String name,
                                    double width,
                                    double height,
                                    double depthPadding,
                                    double depthPerCard,
                                    int minCards,
                                    boolean allowSleeves)
        Create a TuckBox.BoxSizer that creates boxes of the given width and height. The depth of the box will be determined using the formula depthPadding + depthPerCard * numberOfCards, but will not be less than depthPadding + depthPerCard * 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
        height - the height of boxes created by this sizer, in mm
        depthPadding - 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 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 depthPadding 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