Lines Matching defs:units

38  * units in which the values are measured. Methods are provided to return a
39 * resolution attribute's values, indicating the units in which the values are
40 * to be returned. The two most common resolution units are dots per inch (dpi)
43 * indicating those units.
50 * resolution values are stored internally using units of dots per 100 inches
51 * (dphi). Storing the values in dphi rather than, say, metric units allows
54 * into and retrieved back from a resolution attribute in either units with no
57 * resolution attribute's values are created in one units and retrieved in
58 * different units; for example, 600 dpi will be rounded to 236 dpcm, whereas
61 * Storing the values internally in common units of dphi lets two resolution
62 * attributes be compared without regard to the units in which they were
66 * representations regardless of the units in which they were created. Again,
75 * dphi. A client can specify a resolution value in units other than dpi or dpcm
76 * by supplying its own conversion factor. However, since the internal units of
77 * dphi was chosen with supporting only the external units of dpi and dpcm in
78 * mind, there is no guarantee that the conversion factor for the client's units
80 * resolution values in the client's units won't be stored precisely.
91 * Cross feed direction resolution in units of dots per 100 inches (dphi).
97 * Feed direction resolution in units of dots per 100 inches (dphi).
103 * Value to indicate units of dots per inch (dpi). It is actually the
109 * Value to indicate units of dots per centimeter (dpcm). It is actually
122 * @param units
128 * 1 or <CODE>feedResolution</CODE> < 1 or <CODE>units</CODE> < 1.
131 int units) {
139 if (units < 1) {
140 throw new IllegalArgumentException("units is < 1");
143 this.crossFeedResolution = crossFeedResolution * units;
144 this.feedResolution = feedResolution * units;
148 * Convert a value from dphi to some other units. The result is rounded to
153 * @param units
157 * @return The value of <CODE>dphi</CODE> converted to the desired units.
160 * (unchecked exception) Thrown if <CODE>units</CODE> < 1.
162 private static int convertFromDphi(int dphi, int units) {
163 if (units < 1) {
164 throw new IllegalArgumentException(": units is < 1");
166 int round = units / 2;
167 return (dphi + round) / units;
171 * Get this resolution attribute's resolution values in the given units.
174 * @param units
182 * (unchecked exception) Thrown if <CODE>units</CODE> < 1.
184 public int[] getResolution(int units) {
185 return new int[] { getCrossFeedResolution(units),
186 getFeedResolution(units)
192 * the given units. The value is rounded to the nearest integer.
194 * @param units
201 * (unchecked exception) Thrown if <CODE>units</CODE> < 1.
203 public int getCrossFeedResolution(int units) {
204 return convertFromDphi (crossFeedResolution, units);
209 * given units. The value is rounded to the nearest integer.
211 * @param units
218 * (unchecked exception) Thrown if <CODE>units</CODE> < 1.
220 public int getFeedResolution(int units) {
221 return convertFromDphi (feedResolution, units);
225 * Returns a string version of this resolution attribute in the given units.
228 * feed direction resolution, and <I>U</I> is the units name. The values are
231 * @param units
236 * null, no units name is appended to the result.
241 * (unchecked exception) Thrown if <CODE>units</CODE> < 1.
243 public String toString(int units, String unitsName) {
245 result.append(getCrossFeedResolution (units));
247 result.append(getFeedResolution (units));
326 * resolution. The values are reported in the internal units of dphi.
340 * units of dphi. (For use in a subclass.)
349 * Returns this resolution attribute's feed direction resolution in units