View Javadoc
1   package nom.tam.image.compression.bintable;
2   
3   /*
4    * #%L
5    * nom.tam FITS library
6    * %%
7    * Copyright (C) 1996 - 2024 nom-tam-fits
8    * %%
9    * This is free and unencumbered software released into the public domain.
10   *
11   * Anyone is free to copy, modify, publish, use, compile, sell, or
12   * distribute this software, either in source code form or as a compiled
13   * binary, for any purpose, commercial or non-commercial, and by any
14   * means.
15   *
16   * In jurisdictions that recognize copyright laws, the author or authors
17   * of this software dedicate any and all copyright interest in the
18   * software to the public domain. We make this dedication for the benefit
19   * of the public at large and to the detriment of our heirs and
20   * successors. We intend this dedication to be an overt act of
21   * relinquishment in perpetuity of all present and future rights to this
22   * software under copyright law.
23   *
24   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27   * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
28   * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29   * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30   * OTHER DEALINGS IN THE SOFTWARE.
31   * #L%
32   */
33  
34  import nom.tam.fits.header.Compression;
35  
36  /**
37   * (<i>for internal use</i>) The specifications of a binary table 'tile'.
38   */
39  @SuppressWarnings("javadoc")
40  public final class BinaryTableTileDescription {
41  
42      private int rowStart;
43  
44      private int rowEnd;
45  
46      private int column;
47  
48      /** 1-based tile index */
49      private int tileIndex;
50  
51      private String compressionAlgorithm;
52  
53      public static BinaryTableTileDescription tile() {
54          return new BinaryTableTileDescription();
55      }
56  
57      private BinaryTableTileDescription() {
58          // use the static method to instantiate this class.
59      }
60  
61      public BinaryTableTileDescription column(int value) {
62          column = value;
63          return this;
64      }
65  
66      public BinaryTableTileDescription compressionAlgorithm(String value) {
67          compressionAlgorithm = value;
68          return this;
69      }
70  
71      public BinaryTableTileDescription rowEnd(int value) {
72          rowEnd = value;
73          return this;
74      }
75  
76      public BinaryTableTileDescription rowStart(int value) {
77          rowStart = value;
78          return this;
79      }
80  
81      /**
82       * Set the FITS table tile index
83       * 
84       * @param  value The 1-based table tile index
85       * 
86       * @return       itself
87       */
88      public BinaryTableTileDescription tileIndex(int value) {
89          tileIndex = value;
90          return this;
91      }
92  
93      protected int getColumn() {
94          return column;
95      }
96  
97      protected String getCompressionAlgorithm() {
98          if (compressionAlgorithm == null) {
99              return Compression.ZCMPTYPE_GZIP_2;
100         }
101         return compressionAlgorithm;
102     }
103 
104     protected int getRowEnd() {
105         return rowEnd;
106     }
107 
108     protected int getRowStart() {
109         return rowStart;
110     }
111 
112     protected int getTileIndex() {
113         return tileIndex;
114     }
115 }