You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(36) |
Apr
(36) |
May
(127) |
Jun
(193) |
Jul
(12) |
Aug
(46) |
Sep
(66) |
Oct
(28) |
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(39) |
Feb
(68) |
Mar
(58) |
Apr
(88) |
May
(40) |
Jun
(82) |
Jul
(213) |
Aug
(19) |
Sep
(2) |
Oct
(26) |
Nov
(2) |
Dec
|
| 2008 |
Jan
(5) |
Feb
(30) |
Mar
(26) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
(4) |
Apr
(44) |
May
(1) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
(7) |
May
(35) |
Jun
|
Jul
|
Aug
(48) |
Sep
(10) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(40) |
| 2017 |
Jan
(82) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(37) |
Mar
(28) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(27) |
| 2021 |
Jan
(52) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(8) |
Nov
(72) |
Dec
(100) |
| 2022 |
Jan
(119) |
Feb
(94) |
Mar
(4) |
Apr
|
May
|
Jun
(5) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
|
Nov
(10) |
Dec
(97) |
| 2023 |
Jan
(52) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(17) |
Sep
(21) |
Oct
(8) |
Nov
|
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(11) |
Feb
(1) |
Mar
|
Apr
(27) |
May
(62) |
Jun
(27) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2026 |
Jan
(14) |
Feb
(55) |
Mar
(49) |
Apr
(31) |
May
(19) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <vic...@us...> - 2026-05-03 16:05:53
|
Revision: 3051
http://sourceforge.net/p/axsl/code/3051
Author: victormote
Date: 2026-05-03 16:05:51 +0000 (Sun, 03 May 2026)
Log Message:
-----------
Convert some uses of millipoint (int) to point (FixedDecimal).
Modified Paths:
--------------
trunk/axsl/axsl-mif/src/main/java/org/axsl/mif/MifBook.java
Modified: trunk/axsl/axsl-mif/src/main/java/org/axsl/mif/MifBook.java
===================================================================
--- trunk/axsl/axsl-mif/src/main/java/org/axsl/mif/MifBook.java 2026-05-03 13:34:44 UTC (rev 3050)
+++ trunk/axsl/axsl-mif/src/main/java/org/axsl/mif/MifBook.java 2026-05-03 16:05:51 UTC (rev 3051)
@@ -24,6 +24,7 @@
package org.axsl.mif;
import org.axsl.output.OutputException;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.io.OutputStream;
@@ -57,10 +58,10 @@
/**
* Creates a new paragraph and sets its properties.
- * @param startIndent The start-indent value of the new paragraph.
- * @param endIndent The end-indent value of the new paragraph.
+ * @param startIndent The start-indent value of the new paragraph, in points.
+ * @param endIndent The end-indent value of the new paragraph, in points.
*/
- void setBlockProp(int startIndent, int endIndent);
+ void setBlockProp(FixedDecimal startIndent, FixedDecimal endIndent);
/**
* Add a page to this book.
@@ -69,10 +70,10 @@
/**
* Sets the dimensions of this document.
- * @param height The height, in millipoints (??), of this document.
- * @param width The width, in millipoints (??), of this document.
+ * @param height The height, in points, of this document.
+ * @param width The width, in points, of this document.
*/
- void setDocumentHeightWidth(int height, int width);
+ void setDocumentHeightWidth(FixedDecimal height, FixedDecimal width);
/**
* Writes the content of this book to a given output stream.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-03 13:34:47
|
Revision: 3050
http://sourceforge.net/p/axsl/code/3050
Author: victormote
Date: 2026-05-03 13:34:44 +0000 (Sun, 03 May 2026)
Log Message:
-----------
Convert some uses of millipoint (int) to point (FixedDecimal).
Modified Paths:
--------------
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ContentHeightPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ContentWidthPa.java
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ContentHeightPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ContentHeightPa.java 2026-05-03 11:51:30 UTC (rev 3049)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ContentHeightPa.java 2026-05-03 13:34:44 UTC (rev 3050)
@@ -25,6 +25,7 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoScalable;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* The XSL-FO content-height property.
@@ -40,9 +41,9 @@
* It is exposed in this method only for completeness.
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
- * @return The "content-height" trait, in millipoints.
+ * @return The "content-height" trait, in points.
* @see "XSL-FO Recommendation 1.1, Section 7.15.4"
*/
- int traitContentHeight(FoContext context);
+ FixedDecimal traitContentHeight(FoContext context);
}
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ContentWidthPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ContentWidthPa.java 2026-05-03 11:51:30 UTC (rev 3049)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ContentWidthPa.java 2026-05-03 13:34:44 UTC (rev 3050)
@@ -25,6 +25,7 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoScalable;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* The XSL-FO content-width property.
@@ -40,9 +41,9 @@
* It is exposed in this method only for completeness.
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
- * @return The "content-width" trait, in millipoints.
+ * @return The "content-width" trait, in points.
* @see "XSL-FO Recommendation 1.1, Section 7.15.5"
*/
- int traitContentWidth(FoContext context);
+ FixedDecimal traitContentWidth(FoContext context);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-03 11:51:32
|
Revision: 3049
http://sourceforge.net/p/axsl/code/3049
Author: victormote
Date: 2026-05-03 11:51:30 +0000 (Sun, 03 May 2026)
Log Message:
-----------
Convert some uses of millipoint (int) to point (FixedDecimal).
Modified Paths:
--------------
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/HeightPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/WidthPa.java
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/HeightPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/HeightPa.java 2026-05-02 18:15:48 UTC (rev 3048)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/HeightPa.java 2026-05-03 11:51:30 UTC (rev 3049)
@@ -25,6 +25,7 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoScalable;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* The XSL-FO "height" property.
@@ -40,9 +41,9 @@
* It is exposed in this method only for completeness.
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
- * @return The "height" trait, in millipoints.
+ * @return The "height" trait, in points.
* @see "XSL-FO Recommendation 1.1, Section 7.15.6"
*/
- int traitHeight(FoContext context);
+ FixedDecimal traitHeight(FoContext context);
}
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/WidthPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/WidthPa.java 2026-05-02 18:15:48 UTC (rev 3048)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/WidthPa.java 2026-05-03 11:51:30 UTC (rev 3049)
@@ -25,6 +25,7 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoScalable;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* The XSL-FO "width" property.
@@ -40,9 +41,9 @@
* It is exposed in this method only for completeness.
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
- * @return The "width" trait, in millipoints.
+ * @return The "width" trait, in points.
* @see "XSL-FO Recommendation 1.1, Section 7.15.14"
*/
- int traitWidth(FoContext context);
+ FixedDecimal traitWidth(FoContext context);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 18:15:50
|
Revision: 3048
http://sourceforge.net/p/axsl/code/3048
Author: victormote
Date: 2026-05-02 18:15:48 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Remove last reference to Float type.
Modified Paths:
--------------
trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml
trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java
Modified: trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml 2026-05-02 17:52:54 UTC (rev 3047)
+++ trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml 2026-05-02 18:15:48 UTC (rev 3048)
@@ -337,11 +337,12 @@
<property name="message" value="Use @throws instead of @exception in Javadoc comments."/>
</module>
- <!-- Haven't figured out how to push the following into the IllegalType check.-->
+ <!-- Haven't figured out how to push the following into the IllegalType check. Floats and doubles are fine for
+ intermediate computations, but we don't want them in parameters or return types. -->
<module name="RegexpSinglelineJava">
<property name="id" value="disallow-float-and-double"/>
<property name="ignoreComments" value="true"/>
- <property name="format" value="\s([Dd]ouble|float)\s"/>
+ <property name="format" value="\s([Dd]ouble|[Ff]loat)\s"/>
<property name="message" value="Use FixedDecimal for real (non-integer) numbers."/>
</module>
<!-- Allow float and double where explicitly needed. -->
Modified: trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java
===================================================================
--- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java 2026-05-02 17:52:54 UTC (rev 3047)
+++ trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java 2026-05-02 18:15:48 UTC (rev 3048)
@@ -144,8 +144,7 @@
* millipoints = proportionOfEmUsed * actualFontSize * 1000.
* which simplifies to
* millipoints = glyphSpaceUnits * fontSize / unitsPerEm. */
- final Float raw = glyphSpaceUnits * fontSize / (float) unitsPerEm;
- return Math.round(raw);
+ return Math.round(glyphSpaceUnits * fontSize / (float) unitsPerEm);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 17:52:57
|
Revision: 3047
http://sourceforge.net/p/axsl/code/3047
Author: victormote
Date: 2026-05-02 17:52:54 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Convert some uses of Float to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/Float.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfPage.java
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2026-05-02 17:13:00 UTC (rev 3046)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoContext.java 2026-05-02 17:52:54 UTC (rev 3047)
@@ -28,6 +28,7 @@
import org.axsl.fotree.fo.Marker;
import org.axsl.fotree.fo.RetrieveMarker;
import org.axsl.fotree.fo.RetrieveTableMarker;
+import org.axsl.primitive.fixed.FixedDecimal;
import org.axsl.value.BaselineIdentifier;
import org.axsl.value.group.TextModifiers;
@@ -163,7 +164,7 @@
* @see "XSL-FO Recommendation 1.1, Section 7.16.4."
* @see <a href="http://www.w3.org/TR/REC-CSS2/visudet.html#propdef-line-height">The CSS Recommendation</a>
*/
- Float normalLineHeightFactor();
+ FixedDecimal normalLineHeightFactor();
/**
* Returns some information about the selected font, to be used in font-related calculations, such as x-height,
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/Float.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/Float.java 2026-05-02 17:13:00 UTC (rev 3046)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/Float.java 2026-05-02 17:52:54 UTC (rev 3047)
@@ -21,6 +21,8 @@
* $LastChangedBy$
*/
+/* Checkstyle: Allow float and double here. */
+
package org.axsl.fotree.fo;
import org.axsl.fotree.Fo;
@@ -47,3 +49,5 @@
NormalBlockAreaGenerator { // NormalBlockAreaGenerator only applies to fo:float/@float="none"
}
+
+/* Checkstyle: Restart float and double checking. */
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfPage.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfPage.java 2026-05-02 17:13:00 UTC (rev 3046)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfPage.java 2026-05-02 17:52:54 UTC (rev 3047)
@@ -68,7 +68,7 @@
* @throws PdfException If there is already a destination registered with {@code name}.
*/
PdfDestination createDestination(PdfExplicitDestination.PositionAndZoom positionAndZoom,
- PdfExplicitDestination.Coordinates coordinates, Float explicitZoom, String name) throws PdfException;
+ PdfExplicitDestination.Coordinates coordinates, FixedDecimal explicitZoom, String name) throws PdfException;
/**
* Sets the default user space units for this page, in multiples of 1/72 inch.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 17:13:04
|
Revision: 3046
http://sourceforge.net/p/axsl/code/3046
Author: victormote
Date: 2026-05-02 17:13:00 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Convert some uses of Float to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java
Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java
===================================================================
--- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2026-05-02 17:12:35 UTC (rev 3045)
+++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2026-05-02 17:13:00 UTC (rev 3046)
@@ -445,7 +445,7 @@
* Returns the ItalicAngle value for this font.
* @return The ItalicAngle value, expressed in degrees counterclockwise from vertical.
*/
- Float getItalicAngle();
+ FixedDecimal getItalicAngle();
/**
* Returns the StemV value for this font, used in a PDF Font Descriptor.
@@ -485,7 +485,7 @@
* For example, if the font-size is 12 points, and this method returns 1.2, the computed "normal" line-height is
* 14.4 points.
*/
- Float normalLineHeightFactor(Font.LineHeightAlgorithm algorithm);
+ FixedDecimal normalLineHeightFactor(Font.LineHeightAlgorithm algorithm);
/**
* Returns the location of the specified baseline.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 17:12:37
|
Revision: 3045
http://sourceforge.net/p/axsl/code/3045
Author: victormote
Date: 2026-05-02 17:12:35 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Make the FixedDecimal classes serializable.
Modified Paths:
--------------
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_00.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_01.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_02.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_03.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_04.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_05.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -41,6 +41,9 @@
*/
public class FixedBigDecimal implements FixedDecimal {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 6377553045252784348L;
+
/** The instance wrapped by this adapter. */
private final BigDecimal wrapped;
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -23,6 +23,7 @@
package org.axsl.primitive.fixed;
+import java.io.Serializable;
import java.math.BigDecimal;
import java.math.MathContext;
@@ -45,7 +46,7 @@
* All numbers are stored as base-2 bits internally, but the mapping and manipulation of those bits to and from the
* base-10 digits represented by them is an implementation detail.</p>
*/
-public interface FixedDecimal extends Comparable<FixedDecimal> {
+public interface FixedDecimal extends Comparable<FixedDecimal>, Serializable {
/** Constant for the value of zero, with an unscaled value of zero, and a scale of zero. */
FixedDecimal ZERO = FixedDecimal.valueOf(0);
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -38,6 +38,9 @@
*/
public abstract class FixedDecimal32 implements FixedDecimal {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -154025631932457509L;
+
/**
* Enumeration of configurations for fixed-point classes.
*/
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_00.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_00.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_00.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -31,6 +31,9 @@
*/
public final class FixedDecimal32_00 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -6872568472655579940L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_01.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_01.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_01.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_01 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -4743121457283508226L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_02.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_02.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_02.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_02 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 6126053297913009710L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_03.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_03.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_03.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_03 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -9195988506793408782L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_04.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_04.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_04.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_04 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 1057942448122534621L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_05.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_05.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_05.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_05 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 4214861508524626415L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_06 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -1533527527771934460L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_07 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 1926869052293781391L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_08 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -7169927148058230359L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java 2026-05-02 15:19:51 UTC (rev 3044)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java 2026-05-02 17:12:35 UTC (rev 3045)
@@ -30,6 +30,9 @@
*/
public final class FixedDecimal32_09 extends FixedDecimal32 {
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 4282248183413032751L;
+
/**
* Constructor.
* @param unscaledValue The unscaledValue of this fixed-point value.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 15:19:53
|
Revision: 3044
http://sourceforge.net/p/axsl/code/3044
Author: victormote
Date: 2026-05-02 15:19:51 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Convert some uses of Float to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-kp-model/build.gradle
trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpFitnessClass.java
trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpUserAgent.java
Modified: trunk/axsl/axsl-kp-model/build.gradle
===================================================================
--- trunk/axsl/axsl-kp-model/build.gradle 2026-05-02 14:31:52 UTC (rev 3043)
+++ trunk/axsl/axsl-kp-model/build.gradle 2026-05-02 15:19:51 UTC (rev 3044)
@@ -6,4 +6,8 @@
description = "axsl-kp-model"
+dependencies {
+ api project(":axsl-primitive")
+}
+
/* Last line of script. */
Modified: trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpFitnessClass.java
===================================================================
--- trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpFitnessClass.java 2026-05-02 14:31:52 UTC (rev 3043)
+++ trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpFitnessClass.java 2026-05-02 15:19:51 UTC (rev 3044)
@@ -23,6 +23,8 @@
package org.axsl.kp;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -52,13 +54,13 @@
/** Constant indicating the top threshold for a tight classification. */
- private static final Float TIGHT_TOP_THRESHOLD = (float) -.5;
+ private static final FixedDecimal TIGHT_TOP_THRESHOLD = FixedDecimal.valueOf("-.5");
/** Constant indicating the top threshold for a normal classification. */
- private static final Float NORMAL_TOP_THRESHOLD = (float) .5;
+ private static final FixedDecimal NORMAL_TOP_THRESHOLD = FixedDecimal.valueOf(".5");
/** Constant indicating the top threshold for a loose classification. */
- private static final Float LOOSE_TOP_THRESHOLD = (float) 1;
+ private static final FixedDecimal LOOSE_TOP_THRESHOLD = FixedDecimal.ONE;
/** The numeric value assigned to this fitness class. */
private int numericValue;
@@ -76,13 +78,12 @@
* @param adjustmentRatio The adjustment ratio to be converted.
* @return The instance of this enumeration that represents {@code adjustmentRatio}.
*/
- public static KpFitnessClass fromAdjustmentRatio(final Number adjustmentRatio) {
- final Float adjustmentRatioAsDouble = adjustmentRatio.floatValue();
- if (adjustmentRatioAsDouble < TIGHT_TOP_THRESHOLD) {
+ public static KpFitnessClass fromAdjustmentRatio(final FixedDecimal adjustmentRatio) {
+ if (adjustmentRatio.isLessThan(TIGHT_TOP_THRESHOLD)) {
return TIGHT;
- } else if (adjustmentRatioAsDouble <= NORMAL_TOP_THRESHOLD) {
+ } else if (adjustmentRatio.isNotGreaterThan(NORMAL_TOP_THRESHOLD)) {
return NORMAL;
- } else if (adjustmentRatioAsDouble <= LOOSE_TOP_THRESHOLD) {
+ } else if (adjustmentRatio.isNotGreaterThan(LOOSE_TOP_THRESHOLD)) {
return LOOSE;
} else {
return VERY_LOOSE;
Modified: trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpUserAgent.java
===================================================================
--- trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpUserAgent.java 2026-05-02 14:31:52 UTC (rev 3043)
+++ trunk/axsl/axsl-kp-model/src/main/java/org/axsl/kp/KpUserAgent.java 2026-05-02 15:19:51 UTC (rev 3044)
@@ -23,6 +23,8 @@
package org.axsl.kp;
+import org.axsl.primitive.fixed.FixedDecimal;
+
/**
* Provides context information for systems laying out paragraph elements.
*/
@@ -83,7 +85,7 @@
* @see "[KP-01], pages 1161–1163, where iterative adjustments to this value are discussed."
* @see "[KP-03], page 114."
*/
- Float getAdjustmentRatioTolerance();
+ FixedDecimal getAdjustmentRatioTolerance();
/**
* Returns the cost that should be assessed, in the Knuth-Plass line-breaking scheme, for a penalty of a given
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 14:31:56
|
Revision: 3043
http://sourceforge.net/p/axsl/code/3043
Author: victormote
Date: 2026-05-02 14:31:52 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Convert some uses of Float to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java
Modified: trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java
===================================================================
--- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java 2026-05-02 13:05:22 UTC (rev 3042)
+++ trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java 2026-05-02 14:31:52 UTC (rev 3043)
@@ -32,9 +32,7 @@
*/
public final class TypographicConstants {
- /**
- * Well-known constant used to convert millipoints to/from points, which is {@value}.
- */
+ /** Well-known constant used to convert millipoints to/from points, which is {@value}. */
public static final int MILLIPOINTS_PER_POINT = 1_000;
/**
@@ -58,7 +56,7 @@
public static final int DECIPOINTS_PER_POINT = 10;
/**
- * The factor for conversion of Monotype units to millipoints for a font set at 1 point.
+ * The factor for conversion of Monotype units to millipoints for a font set at 1 point: 55.555556.
* According to para. 54, 18 Monotype units at 12 points is one pica (1/6 of an inch).
* In millipoints, this is 72,000 / 6 = 12,000.
* To get to 18 Monotype units at 1 point, divide by 12 = 12,000 / 12 = 1,000.
@@ -73,47 +71,46 @@
*/
public static final FixedDecimal MILLIPOINTS_PER_MONOTYPE_UNIT = FixedDecimal.valueOf("55.555556");
- /** Constant indicating the ratio between 3-per-em and em. */
+ /** Constant indicating the ratio between 3-per-em and em: {@value}. */
public static final int FACTOR_3_PER_EM = 3;
- /** Constant indicating the ratio between 4-per-em and em. */
+ /** Constant indicating the ratio between 4-per-em and em: {@value}. */
public static final int FACTOR_4_PER_EM = 4;
- /** Constant indicating the ratio between 6-per-em and em. */
+ /** Constant indicating the ratio between 6-per-em and em: {@value}. */
public static final int FACTOR_6_PER_EM = 6;
- /** Constant indicating the ratio between a thin space and em. */
+ /** Constant indicating the ratio between a thin space and em: {@value}. */
public static final int FACTOR_THIN_SPACE_PER_EM = 5;
- /** Constant indicating the ratio between a hair space and em. */
+ /** Constant indicating the ratio between a hair space and em: {@value}. */
public static final int FACTOR_HAIR_SPACE_PER_EM = 10;
- /** Constant indicating the default line-height factor. */
- public static final Float DEFAULT_LINE_HEIGHT_FACTOR = 1.2F;
+ /** Constant indicating the default line-height factor, expressed as a ratio to font size: 1.2. */
+ public static final FixedDecimal DEFAULT_LINE_HEIGHT_FACTOR = FixedDecimal.valueOf("1.2");
- /** Constant indicating the default strikeout position. */
- public static final Float DEFAULT_STRIKEOUT_POSITION = .375F;
+ /** Constant indicating the default strikeout position, expressed as a ratio to font size: .375. */
+ public static final FixedDecimal DEFAULT_STRIKEOUT_POSITION = FixedDecimal.valueOf(".375");
- /** Constant for the default strikout size. The computation is equal to
- * 102 / 2048, which factors come from the OpenType manual, Section "OS/2
- * table", for the definition of "yStrikeoutSize", where this ratio is
- * suggested. */
- public static final Float DEFAULT_STRIKEOUT_SIZE = 0.0498046875F;
+ /** Constant for the default strikout size, expressed as a ratio to font size: 0.049804688.
+ * The computation is equal to 102 / 2048, which factors come from the OpenType manual, Section "OS/2 table", for
+ * the definition of "yStrikeoutSize", where this ratio is suggested. */
+ public static final FixedDecimal DEFAULT_STRIKEOUT_SIZE = FixedDecimal.valueOf("0.049804688");
- /** Constant for the default underline position. */
- public static final Float DEFAULT_UNDERLINE_POSITION = .10F;
+ /** Constant for the default underline position, expressed as a ratio to font size: .1. */
+ public static final FixedDecimal DEFAULT_UNDERLINE_POSITION = FixedDecimal.valueOf(1, 1);
- /** Constant for the default overline position. */
- public static final Float DEFAULT_OVERLINE_POSITION = .10F;
+ /** Constant for the default overline position, expressed as a ratio to font size: .1. */
+ public static final FixedDecimal DEFAULT_OVERLINE_POSITION = FixedDecimal.valueOf(1, 1);
- /** Constant for the default hanging baseline position. */
- public static final Float DEFAULT_HANGING_BASELINE_POSITION = .3F;
+ /** Constant for the default hanging baseline position, expressed as a ratio to font size: .3. */
+ public static final FixedDecimal DEFAULT_HANGING_BASELINE_POSITION = FixedDecimal.valueOf(3, 1);
- /** Constant used to compute subscript baseline shift amounts. */
- public static final Float SUBSCRIPT_SHIFT_FACTOR = .6666666666666666667f;
+ /** Constant used to compute subscript baseline shift amounts, expressed as a ratio to font size: .666666667. */
+ public static final FixedDecimal SUBSCRIPT_SHIFT_FACTOR = FixedDecimal.valueOf(".666666667");
- /** Constant used to compute superscript baseline shift amounts. */
- public static final Float SUPERSCRIPT_SHIFT_FACTOR = .6666666666666666667f;
+ /** Constant used to compute superscript baseline shift amounts, expressed as a ratio to font size: .666666667. */
+ public static final FixedDecimal SUPERSCRIPT_SHIFT_FACTOR = SUBSCRIPT_SHIFT_FACTOR;
/**
* Private constructor. This is a utility class that should never be instantiated.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 13:05:25
|
Revision: 3042
http://sourceforge.net/p/axsl/code/3042
Author: victormote
Date: 2026-05-02 13:05:22 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Convert some uses of Float to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MeasurementConstants.java
Modified: trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MeasurementConstants.java
===================================================================
--- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MeasurementConstants.java 2026-05-02 12:32:27 UTC (rev 3041)
+++ trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/MeasurementConstants.java 2026-05-02 13:05:22 UTC (rev 3042)
@@ -23,6 +23,8 @@
package org.axsl.constants;
+import org.axsl.primitive.fixed.FixedDecimal;
+
/**
* Constants used in measurements of physical objects, e.g. lengths, volumes, weights, counts, etc.
*/
@@ -41,7 +43,7 @@
public static final short MILLISECONDS_PER_SECOND = 1_000;
/** The number of centimeters per inch, which is 2.54. */
- public static final Float CM_PER_INCH = Float.parseFloat("2.54");
+ public static final FixedDecimal CM_PER_INCH = FixedDecimal.valueOf("2.54");
/** The number of millimeters per centimeter, which is {@value}. */
public static final byte MM_PER_CM = 10;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 12:32:30
|
Revision: 3041
http://sourceforge.net/p/axsl/code/3041
Author: victormote
Date: 2026-05-02 12:32:27 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Add arithmetic methods to operate on ints.
Modified Paths:
--------------
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java 2026-05-02 11:55:05 UTC (rev 3040)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java 2026-05-02 12:32:27 UTC (rev 3041)
@@ -102,21 +102,41 @@
}
@Override
+ public FixedDecimal add(final int addend) {
+ return add(new FixedDecimal32_00(addend));
+ }
+
+ @Override
public FixedBigDecimal subtract(final FixedDecimal subtrahend) {
return new FixedBigDecimal(this.wrapped.subtract(subtrahend.bigDecimalValue()));
}
@Override
+ public FixedDecimal subtract(final int subtrahend) {
+ return subtract(new FixedDecimal32_00(subtrahend));
+ }
+
+ @Override
public FixedBigDecimal multiply(final FixedDecimal multiplier) {
return new FixedBigDecimal(this.wrapped.multiply(multiplier.bigDecimalValue()));
}
@Override
+ public FixedDecimal multiply(final int multiplier) {
+ return multiply(new FixedDecimal32_00(multiplier));
+ }
+
+ @Override
public FixedBigDecimal divide(final FixedDecimal divisor) {
return new FixedBigDecimal(this.wrapped.divide(divisor.bigDecimalValue()));
}
@Override
+ public FixedDecimal divide(final int divisor) {
+ return divide(new FixedDecimal32_00(divisor));
+ }
+
+ @Override
public FixedBigDecimal negate() {
return new FixedBigDecimal(this.wrapped.negate());
}
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-02 11:55:05 UTC (rev 3040)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-02 12:32:27 UTC (rev 3041)
@@ -291,6 +291,13 @@
FixedDecimal add(FixedDecimal addend);
/**
+ * Computes and returns the sum of this (the augend) and an addend.
+ * @param addend The amount to be added to this.
+ * @return The sum of this and {@code addend}.
+ */
+ FixedDecimal add(int addend);
+
+ /**
* Computes and returns the difference between this (the minuend) less a subtrahend.
* @param subtrahend The amount to be subtracted from this.
* @return The difference between this and {@code subtrahend}.
@@ -298,6 +305,13 @@
FixedDecimal subtract(FixedDecimal subtrahend);
/**
+ * Computes and returns the difference between this (the minuend) less a subtrahend.
+ * @param subtrahend The amount to be subtracted from this.
+ * @return The difference between this and {@code subtrahend}.
+ */
+ FixedDecimal subtract(int subtrahend);
+
+ /**
* Computes and returns the product of this (the multiplicand) and a multiplier.
* @param multiplier The amount to be multiplied by this.
* @return The product of this and {@code multiplier}.
@@ -305,6 +319,13 @@
FixedDecimal multiply(FixedDecimal multiplier);
/**
+ * Computes and returns the product of this (the multiplicand) and a multiplier.
+ * @param multiplier The amount to be multiplied by this.
+ * @return The product of this and {@code multiplier}.
+ */
+ FixedDecimal multiply(int multiplier);
+
+ /**
* Computes and returns the quotient of this (the dividend or numerator) and a divisor (or denominator).
* @param divisor The amount to be divided into this.
* @return The quotient of this and {@code divisor}.
@@ -312,6 +333,13 @@
FixedDecimal divide(FixedDecimal divisor);
/**
+ * Computes and returns the quotient of this (the dividend or numerator) and a divisor (or denominator).
+ * @param divisor The amount to be divided into this.
+ * @return The quotient of this and {@code divisor}.
+ */
+ FixedDecimal divide(int divisor);
+
+ /**
* Returns a {@code FixedDecimal} whose value is (- {@link #unscaledValue()}), and whose scale is
* {@link #scale()}.
* @return {@code -this}.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-05-02 11:55:05 UTC (rev 3040)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-05-02 12:32:27 UTC (rev 3041)
@@ -237,6 +237,11 @@
}
@Override
+ public FixedDecimal add(final int addend) {
+ return add(new FixedDecimal32_00(addend));
+ }
+
+ @Override
public FixedDecimal subtract(final FixedDecimal subtrahend) {
final BigDecimal result = bigDecimalValue().subtract(subtrahend.bigDecimalValue());
return FixedDecimal.valueOf(result);
@@ -243,6 +248,11 @@
}
@Override
+ public FixedDecimal subtract(final int subtrahend) {
+ return subtract(new FixedDecimal32_00(subtrahend));
+ }
+
+ @Override
public FixedDecimal multiply(final FixedDecimal multiplier) {
final BigDecimal result = bigDecimalValue().multiply(multiplier.bigDecimalValue());
return FixedDecimal.valueOf(result);
@@ -249,6 +259,11 @@
}
@Override
+ public FixedDecimal multiply(final int multiplier) {
+ return multiply(new FixedDecimal32_00(multiplier));
+ }
+
+ @Override
public FixedDecimal divide(final FixedDecimal divisor) {
final BigDecimal result = bigDecimalValue().divide(divisor.bigDecimalValue(), MathContext.DECIMAL32);
return FixedDecimal.valueOf(result);
@@ -255,6 +270,11 @@
}
@Override
+ public FixedDecimal divide(final int divisor) {
+ return divide(new FixedDecimal32_00(divisor));
+ }
+
+ @Override
public FixedDecimal negate() {
return FixedDecimal.valueOf(this.unscaledValue * -1, this.scale());
}
Modified: trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java
===================================================================
--- trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java 2026-05-02 11:55:05 UTC (rev 3040)
+++ trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java 2026-05-02 12:32:27 UTC (rev 3041)
@@ -289,6 +289,23 @@
}
/**
+ * Tests of {@link FixedDecimal32#add(int)}.
+ */
+ @Test
+ public void testAddInt() {
+ final FixedDecimal value1 = FixedDecimal.valueOf("113.57");
+ int value2 = 15;
+ FixedDecimal sum = value1.add(value2);
+ assertThat(sum.unscaledValue()).isEqualTo(12857);
+ assertThat(sum.scale()).isEqualTo(2);
+
+ value2 = -15;
+ sum = value1.add(value2);
+ assertThat(sum.unscaledValue()).isEqualTo(9857);
+ assertThat(sum.scale()).isEqualTo(2);
+ }
+
+ /**
* Tests of {@link FixedDecimal32#subtract(FixedDecimal)}.
*/
@Test
@@ -311,6 +328,23 @@
}
/**
+ * Tests of {@link FixedDecimal32#subtract(int)}.
+ */
+ @Test
+ public void testSubtractInt() {
+ final FixedDecimal value1 = FixedDecimal.valueOf("113.57");
+ int value2 = 15;
+ FixedDecimal sum = value1.subtract(value2);
+ assertThat(sum.unscaledValue()).isEqualTo(9857);
+ assertThat(sum.scale()).isEqualTo(2);
+
+ value2 = -15;
+ sum = value1.subtract(value2);
+ assertThat(sum.unscaledValue()).isEqualTo(12857);
+ assertThat(sum.scale()).isEqualTo(2);
+ }
+
+ /**
* Tests of {@link FixedDecimal32#multiply(FixedDecimal)}.
*/
@Test
@@ -333,6 +367,23 @@
}
/**
+ * Tests of {@link FixedDecimal32#multiply(int)}.
+ */
+ @Test
+ public void testMultiplyInt() {
+ final FixedDecimal value1 = FixedDecimal.valueOf("113.57");
+ int value2 = 15;
+ FixedDecimal sum = value1.multiply(value2);
+ assertThat(sum.unscaledValue()).isEqualTo(170355);
+ assertThat(sum.scale()).isEqualTo(2);
+
+ value2 = -15;
+ sum = value1.multiply(value2);
+ assertThat(sum.unscaledValue()).isEqualTo(-170355);
+ assertThat(sum.scale()).isEqualTo(2);
+ }
+
+ /**
* Tests of {@link FixedDecimal32#divide(FixedDecimal)}.
*/
@Test
@@ -351,6 +402,23 @@
}
/**
+ * Tests of {@link FixedDecimal32#divide(int)}.
+ */
+ @Test
+ public void testDivideInt() {
+ final FixedDecimal value1 = FixedDecimal.valueOf("113.57");
+ int value2 = 15;
+ FixedDecimal sum = value1.divide(value2);
+ assertThat(sum.unscaledValue()).isEqualTo(7571333);
+ assertThat(sum.scale()).isEqualTo(6);
+
+ value2 = -15;
+ sum = value1.divide(value2);
+ assertThat(sum.unscaledValue()).isEqualTo(-7571333);
+ assertThat(sum.scale()).isEqualTo(6);
+ }
+
+ /**
* Tests of {@link FixedDecimal32#negate(FixedDecimal)}.
*/
@Test
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-02 11:55:07
|
Revision: 3040
http://sourceforge.net/p/axsl/code/3040
Author: victormote
Date: 2026-05-02 11:55:05 +0000 (Sat, 02 May 2026)
Log Message:
-----------
Setup for general removal of millipoints as units of length.
Modified Paths:
--------------
trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml
Modified: trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml 2026-05-01 23:26:31 UTC (rev 3039)
+++ trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml 2026-05-02 11:55:05 UTC (rev 3040)
@@ -351,6 +351,14 @@
<property name="checkFormat" value="RegexpSinglelineJava"/>
</module>
+<!--
+ <module name="RegexpSinglelineJava">
+ <property name="ignoreComments" value="false"/>
+ <property name="format" value="[Mm]illipoint"/>
+ <property name="message" value="Use FixedDecimal with a scale of 3."/>
+ </module>
+-->
+
<module name="MissingOverride"/>
</module>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-01 23:26:33
|
Revision: 3039
http://sourceforge.net/p/axsl/code/3039
Author: victormote
Date: 2026-05-01 23:26:31 +0000 (Fri, 01 May 2026)
Log Message:
-----------
Convert remaining uses of BigDecimal to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml
trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/factory/LineContentFactory.java
trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/CharacterTraitsTa.java
Modified: trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml 2026-05-01 22:56:32 UTC (rev 3038)
+++ trunk/axsl/axsl-00-dev/config/checkstyle/checkstyle-config.xml 2026-05-01 23:26:31 UTC (rev 3039)
@@ -251,12 +251,10 @@
<!-- Classes that we wish to disallow in favor of using FixedDecimal. We would like to include java.lang.Double and
java.lang.Float here, but the check seems to ignore them. See the RegexpSinglelineJava check which is used as a
workaround. -->
-<!--
<module name="IllegalType">
<property name="id" value="disallow-BigDecimal"/>
<property name="illegalClassNames" value="java.math.BigDecimal"/>
</module>
--->
<!-- Allow BigDecimal where explicitly needed. -->
<module name="SuppressionCommentFilter">
Modified: trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/factory/LineContentFactory.java
===================================================================
--- trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/factory/LineContentFactory.java 2026-05-01 22:56:32 UTC (rev 3038)
+++ trunk/axsl/axsl-areatree/src/main/java/org/axsl/area/factory/LineContentFactory.java 2026-05-01 23:26:31 UTC (rev 3039)
@@ -43,9 +43,8 @@
import org.axsl.fotree.fo.ScalingValueCitation;
import org.axsl.fotree.text.TextTokenFlowLocation;
import org.axsl.galley.GlyphAreaSequenceG5;
+import org.axsl.primitive.fixed.FixedDecimal;
-import java.math.BigDecimal;
-
/**
* Super-interface for all interfaces that need to be able to create child inline content.
*/
@@ -86,7 +85,7 @@
*/
GlyphAreaSequenceG5 createGlyphAreaSequence(FoTextCharacters characters, int startOffset, int sizeInChars,
boolean hasDiscretionaryHyphen, boolean isLastItemOnLine, int resolvedWordSpacing,
- int resolvedLetterSpacing, BigDecimal resolvedIpdStretch);
+ int resolvedLetterSpacing, FixedDecimal resolvedIpdStretch);
/**
* Create a new sequence of glyph-areas for {@link FoTextWords}.
@@ -105,7 +104,7 @@
*/
GlyphAreaSequenceG5 createGlyphAreaSequence(FoTextWords paragraph, TextTokenFlowLocation startLocation,
TextTokenFlowLocation endLocation, int resolvedWordSpacing, int resolvedLetterSpacing,
- BigDecimal resolvedIpdStretch);
+ FixedDecimal resolvedIpdStretch);
/**
* Creates a new Area for external-graphic content.
Modified: trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/CharacterTraitsTa.java
===================================================================
--- trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/CharacterTraitsTa.java 2026-05-01 22:56:32 UTC (rev 3038)
+++ trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/CharacterTraitsTa.java 2026-05-01 23:26:31 UTC (rev 3039)
@@ -23,7 +23,7 @@
package org.axsl.galley.trait;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* Accessor for the character traits.
@@ -31,7 +31,7 @@
public interface CharacterTraitsTa {
/** The default inline-progression-dimension scaling factor. */
- BigDecimal DEFAULT_IPD_SCALING = new BigDecimal("100");
+ FixedDecimal DEFAULT_IPD_SCALING = FixedDecimal.valueOf(100);
/**
* The "letter-spacing" trait for this area, i.e. the extra space between glyphs in a word.
@@ -61,7 +61,7 @@
* the ipd of the font characters themselves has been adjusted as part of the line-breaking logic.
* @return The scaling percentage to be applied to the inline-progression-dimension for this area.
*/
- default BigDecimal getIpdScaling() {
+ default FixedDecimal getIpdScaling() {
return DEFAULT_IPD_SCALING;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-01 22:56:34
|
Revision: 3038
http://sourceforge.net/p/axsl/code/3038
Author: victormote
Date: 2026-05-01 22:56:32 +0000 (Fri, 01 May 2026)
Log Message:
-----------
Convert some uses of BigDecimal to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java
trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java
===================================================================
--- trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2026-05-01 21:58:54 UTC (rev 3037)
+++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/Font.java 2026-05-01 22:56:32 UTC (rev 3038)
@@ -27,12 +27,11 @@
import org.axsl.context.FontData;
import org.axsl.i18n.BaselineType;
import org.axsl.orthography.Orthography;
+import org.axsl.primitive.fixed.FixedDecimal;
import org.axsl.ps.BoundingBox;
import org.axsl.ps.Encoding;
import org.axsl.value.FontStretch;
-import java.math.BigDecimal;
-
/**
* The Font interface exposes a font resource to the client application.
*/
@@ -626,7 +625,7 @@
* small-caps should not be simulated, or {@link FontFeatureSimulation#SMALL_CAP_SIMULATION_NATIVE} if the native
* font metrics should be used to compute the font size.
*/
- BigDecimal simulateSmallCaps();
+ FixedDecimal simulateSmallCaps();
/**
* <p>Returns the size, in millipoints, which should be used for the intrinsically lowercase characters in this
@@ -664,7 +663,7 @@
* @return The percentage of 90 degrees that glyphs from this font should be rotated clockwise to simulate oblique,
* or null if oblique should not be simulated.
*/
- BigDecimal simulateOblique();
+ FixedDecimal simulateOblique();
/**
* Returns the percentage of 90 degrees that this font should be rotated counter-clockwise to simulate backslant.
@@ -673,7 +672,7 @@
* @return The percentage of 90 degrees that glyphs from this font should be rotated counter-clockwise to simulate
* backslant, or null if backslant should not be simulated.
*/
- BigDecimal simulateBackslant();
+ FixedDecimal simulateBackslant();
/**
* Returns the percentage by which the horizontal width of glyphs should be stretched to simulate font-stretch.
@@ -682,7 +681,7 @@
* @return The percentage that should be applied to the width of characters from this font for {@code stretch}, or
* null if the font has not been configured to simulate that stretch value.
*/
- BigDecimal simulateStretch(FontStretch stretch);
+ FixedDecimal simulateStretch(FontStretch stretch);
/**
* Reports on the availability of a glyph in this font, without regard to encoding issues.
Modified: trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java
===================================================================
--- trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java 2026-05-01 21:58:54 UTC (rev 3037)
+++ trunk/axsl/axsl-font/src/main/java/org/axsl/font/FontFeatureSimulation.java 2026-05-01 22:56:32 UTC (rev 3038)
@@ -23,10 +23,9 @@
package org.axsl.font;
+import org.axsl.primitive.fixed.FixedDecimal;
import org.axsl.value.FontStretch;
-import java.math.BigDecimal;
-
/**
* Stores information about whether and how to simulate font features that are not present in the font.
*/
@@ -40,7 +39,7 @@
* the basis for the small-caps percentage.
* @see #getSimulatedSmallCaps()
*/
- BigDecimal SMALL_CAP_SIMULATION_NATIVE = BigDecimal.valueOf(Long.MIN_VALUE);
+ FixedDecimal SMALL_CAP_SIMULATION_NATIVE = FixedDecimal.valueOf(Integer.MIN_VALUE);
/**
* Returns the percentage which should be applied to the font-size to simulate small caps.
@@ -50,7 +49,7 @@
* should not be simulated, or {@link #SMALL_CAP_SIMULATION_NATIVE} if the font's x-height should be used as the
* basis for simulating small-caps.
*/
- default BigDecimal getSimulatedSmallCaps() {
+ default FixedDecimal getSimulatedSmallCaps() {
return null;
}
@@ -59,7 +58,7 @@
* @return The number of degrees clockwise that the font should be skewed to simulate oblique, or null if it should
* not simulate oblique.
*/
- default BigDecimal getSimulatedOblique() {
+ default FixedDecimal getSimulatedOblique() {
return null;
}
@@ -68,7 +67,7 @@
* @return The number of degrees counterclockwise that the font should be skewed to simulate backslant, or null if
* it should not simulate backslant.
*/
- default BigDecimal getSimulatedBackslant() {
+ default FixedDecimal getSimulatedBackslant() {
return null;
}
@@ -82,7 +81,7 @@
* @return Returns the percentage by which the font should be stretched horizontally to simulat {@code fontStretch},
* or null if it should not simulate font-stretch.
*/
- default BigDecimal getSimulatedStretch(final FontStretch fontStretch) {
+ default FixedDecimal getSimulatedStretch(final FontStretch fontStretch) {
return null;
}
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-01 21:58:54 UTC (rev 3037)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-01 22:56:32 UTC (rev 3038)
@@ -80,6 +80,15 @@
/* Checkstyle: Restart Magic Number checking. */
}
+ /**
+ * Factory method.
+ * @param value The int to be converted to an instance of {@link FixedDecimal32}.
+ * @return An instance whose values match {@code value}.
+ */
+ static FixedDecimal valueOf(final int value) {
+ return new FixedDecimal32_00(value);
+ }
+
/* Checkstyle: Allow BigDecimal here. */
/**
@@ -99,17 +108,7 @@
return fd32 == null ? new FixedBigDecimal(bd) : fd32;
}
- /* Checkstyle: Restart BigDecimal checking.*/
- /**
- * Factory method.
- * @param value The int to be converted to an instance of {@link FixedDecimal32}.
- * @return An instance whose values match {@code value}.
- */
- static FixedDecimal valueOf(final int value) {
- return new FixedDecimal32_00(value);
- }
-
/* Checkstyle: Allow float and double here." */
/**
@@ -124,6 +123,8 @@
/* Checkstyle: Restart float and double checking." */
+ /* Checkstyle: Restart BigDecimal checking.*/
+
/**
* Factory method.
* @param numeric The numeric string to be converted to a fixed-point.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-01 21:58:57
|
Revision: 3037
http://sourceforge.net/p/axsl/code/3037
Author: victormote
Date: 2026-05-01 21:58:54 +0000 (Fri, 01 May 2026)
Log Message:
-----------
Convert some uses of BigDecimal to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfContentStream.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfDocument.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfPage.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCalGrayColorSpace.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCalRgbColorSpace.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCieBasedColorSpace.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfLabColorSpace.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction0.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction2.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction3.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction4.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfPattern.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfShadingPattern.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfTilingPattern.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading1.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading2.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading3.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading4.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading5.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading6.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading7.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/state/PdfLineDashPattern.java
trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/interact/PdfExplicitDestination.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfContentStream.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfContentStream.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfContentStream.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -32,12 +32,12 @@
import org.axsl.pdf.graphics.state.PdfLineCapStyle;
import org.axsl.pdf.graphics.state.PdfLineDashPattern;
import org.axsl.pdf.text.PdfTextRenderingMode;
+import org.axsl.primitive.fixed.FixedDecimal;
import org.axsl.ps.Encoding;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
-import java.math.BigDecimal;
/**
* A PDF Content Stream.
@@ -86,9 +86,9 @@
* Sets the width of paths to be stroked in the current graphics state.
* @param width The new width, in user space units, at which paths should be stroked.
* @throws IOException For errors while setting the value.
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setLineWidth(BigDecimal width) throws IOException;
+ void setLineWidth(FixedDecimal width) throws IOException;
/**
* Sets the dash pattern in the graphics state.
@@ -105,41 +105,41 @@
* @param originX The new X (horizontal) coordinate of the cursor, in points.
* @param originY The new Y (vertical) coordinate of the cursor, in points.
* @throws IOException For errors while setting the value.
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setCursor(BigDecimal originX, BigDecimal originY) throws IOException;
+ void setCursor(FixedDecimal originX, FixedDecimal originY) throws IOException;
/**
* Sets the character spacing (a text state parameter).
* @param newCharacterSpacing The new character spacing, in points.
* @throws IOException For errors while setting the value.
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setCharacterSpacing(BigDecimal newCharacterSpacing) throws IOException;
+ void setCharacterSpacing(FixedDecimal newCharacterSpacing) throws IOException;
/**
* Sets the word spacing (a text state parameter).
* @param newWordSpacing The new word spacing, in points.
* @throws IOException For errors while setting the value.
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setWordSpacing(BigDecimal newWordSpacing) throws IOException;
+ void setWordSpacing(FixedDecimal newWordSpacing) throws IOException;
/**
* Sets the horizontal scaling percentage (a text state parameter).
* @param newHorizontalScaling The percentage of the normal width at which text should be rendered.
* @throws IOException For errors while setting the value.
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setHorizontalScaling(BigDecimal newHorizontalScaling) throws IOException;
+ void setHorizontalScaling(FixedDecimal newHorizontalScaling) throws IOException;
/**
* Sets the text leading (a text state parameter).
* @param newLeading The new text leading value, expressed in unscaled text space units.
* @throws IOException For errors while setting the value.
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setLeading(BigDecimal newLeading) throws IOException;
+ void setLeading(FixedDecimal newLeading) throws IOException;
/**
* Sets the font and font size (text state parameters), using the standard font encoding.
@@ -146,10 +146,10 @@
* @param newFont The new font.
* @param newFontSize The new font size.
* @throws IOException For errors while setting the value.
- * @see #setFont(Font, Encoding, BigDecimal)
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @see #setFont(Font, Encoding, FixedDecimal)
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setFont(Font newFont, BigDecimal newFontSize) throws IOException;
+ void setFont(Font newFont, FixedDecimal newFontSize) throws IOException;
/**
* Sets the font and font size (text state parameters), using an encoding that is not the native font encoding.
@@ -158,10 +158,10 @@
* @param encoding The non-native encoding to use.
* @param newFontSize The new font size.
* @throws IOException For errors while setting the value.
- * @see #setFont(Font, BigDecimal)
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @see #setFont(Font, FixedDecimal)
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setFont(Font newFont, Encoding encoding, BigDecimal newFontSize) throws IOException;
+ void setFont(Font newFont, Encoding encoding, FixedDecimal newFontSize) throws IOException;
/**
* Sets the text rendering mode (a text state parameter).
@@ -174,9 +174,9 @@
* Sets the text rise (a text state parameter).
* @param newTextRise The new text rise value, expressed in unscaled text space units.
* @throws IOException For errors while setting the value.
- * @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
+ * @apiNote {@link FixedDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- void setTextRise(BigDecimal newTextRise) throws IOException;
+ void setTextRise(FixedDecimal newTextRise) throws IOException;
/**
* Sets the text knockout flag (a text state parameter).
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfDocument.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfDocument.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfDocument.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -26,10 +26,10 @@
import org.axsl.pdf.graphics.pattern.PdfShadingPattern;
import org.axsl.pdf.interact.PdfNamedDestination;
import org.axsl.pdf.interact.PdfOutlineParent;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.Color;
import java.awt.MultipleGradientPaint;
-import java.math.BigDecimal;
import java.util.Comparator;
/**
@@ -91,14 +91,14 @@
/**
* Create a {@link PdfPage} instance.
* @param width The width of the page that should be created, in default user space units.
- * Unless set to a different value at {@link PdfPage#setDefaultUserSpaceUnits(BigDecimal)}, a user space unit is
+ * Unless set to a different value at {@link PdfPage#setDefaultUserSpaceUnits(FixedDecimal)}, a user space unit is
* 1/72 inch.
* @param height The height of the page that should be created, in default user space units.
- * Unless set to a different value at {@link PdfPage#setDefaultUserSpaceUnits(BigDecimal)}, a user space unit is
+ * Unless set to a different value at {@link PdfPage#setDefaultUserSpaceUnits(FixedDecimal)}, a user space unit is
* 1/72 inch.
* @return A new PDFPage instance.
*/
- PdfPage createPage(BigDecimal width, BigDecimal height);
+ PdfPage createPage(FixedDecimal width, FixedDecimal height);
/**
* <p>Adds a range page number label range to this document.
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfPage.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfPage.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/PdfPage.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -25,9 +25,9 @@
import org.axsl.pdf.interact.PdfDestination;
import org.axsl.pdf.interact.PdfExplicitDestination;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.geom.Rectangle2D;
-import java.math.BigDecimal;
/**
* A PDF Page.
@@ -75,6 +75,6 @@
* The default is 1.0.
* @param userSpaceUnits The number of 1/72 inch units that equals one user space unit.
*/
- void setDefaultUserSpaceUnits(BigDecimal userSpaceUnits);
+ void setDefaultUserSpaceUnits(FixedDecimal userSpaceUnits);
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCalGrayColorSpace.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCalGrayColorSpace.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCalGrayColorSpace.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,7 @@
package org.axsl.pdf.cs;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* A PDF CIE-based CalGray color space.
@@ -50,6 +50,6 @@
* Returns the gamma.
* @return The gamma.
*/
- BigDecimal getGamma();
+ FixedDecimal getGamma();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCalRgbColorSpace.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCalRgbColorSpace.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCalRgbColorSpace.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,8 @@
package org.axsl.pdf.cs;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.util.List;
/**
@@ -50,12 +51,12 @@
* Returns the gamma.
* @return The gamma.
*/
- BigDecimal getGamma();
+ FixedDecimal getGamma();
/**
* Returns the array of nine numbers specifying the linear interpretation of the decoded A, B, and C components.
* @return The matrix array.
*/
- List<BigDecimal> getMatrix();
+ List<FixedDecimal> getMatrix();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCieBasedColorSpace.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCieBasedColorSpace.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfCieBasedColorSpace.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,8 @@
package org.axsl.pdf.cs;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -41,7 +42,7 @@
class TristimulusValue {
/** The values, in X, Y, Z order.*/
- private List<BigDecimal> values;
+ private List<FixedDecimal> values;
/**
* Constructor.
@@ -49,11 +50,11 @@
* @param y The Y value.
* @param z The Z value;
*/
- public TristimulusValue(final BigDecimal x, final BigDecimal y, final BigDecimal z) {
+ public TristimulusValue(final FixedDecimal x, final FixedDecimal y, final FixedDecimal z) {
if (x == null || y == null || z == null) {
throw new IllegalArgumentException("XYZ values cannot be null.");
}
- final List<BigDecimal> valuesInner = new ArrayList<BigDecimal>(3);
+ final List<FixedDecimal> valuesInner = new ArrayList<FixedDecimal>(3);
valuesInner.add(x);
valuesInner.add(y);
valuesInner.add(z);
@@ -64,7 +65,7 @@
* Returns the XYZ values.
* @return The XYZ values.
*/
- public List<BigDecimal> getValues() {
+ public List<FixedDecimal> getValues() {
return this.values;
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfLabColorSpace.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfLabColorSpace.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/cs/PdfLabColorSpace.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,8 @@
package org.axsl.pdf.cs;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.util.List;
/**
@@ -49,6 +50,6 @@
* Returns the array of four numbers specifying the range of valid values for the B and C components.
* @return The range array.
*/
- List<BigDecimal> getRange();
+ List<FixedDecimal> getRange();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,8 @@
package org.axsl.pdf.function;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.util.List;
/**
@@ -43,10 +44,10 @@
abstract class Impl implements PdfFunction {
/** Required: 2 * m Array of Double numbers which are possible inputs to the function. */
- private List<BigDecimal> domain = null;
+ private List<FixedDecimal> domain = null;
/** Required: 2 * n Array of Double numbers which are possible outputs to the function. */
- private List<BigDecimal> range = null;
+ private List<FixedDecimal> range = null;
/**
* Constructor.
@@ -54,7 +55,7 @@
* @param range The range (output) of the function (required).
* @see "PDF Reference, Sixth Edition, Section 3.9, Table 3.35."
*/
- public Impl(final List<BigDecimal> domain, final List<BigDecimal> range) {
+ public Impl(final List<FixedDecimal> domain, final List<FixedDecimal> range) {
if (domain == null) {
throw new IllegalArgumentException("The domain cannot be null");
}
@@ -66,12 +67,12 @@
}
@Override
- public List<BigDecimal> getDomain() {
+ public List<FixedDecimal> getDomain() {
return this.domain;
}
@Override
- public List<BigDecimal> getRange() {
+ public List<FixedDecimal> getRange() {
return this.range;
}
@@ -127,12 +128,12 @@
* Returns The domain (input) of the function.
* @return The domain (input) of the function.
*/
- List<BigDecimal> getDomain();
+ List<FixedDecimal> getDomain();
/**
* Returns The range (output) of the function.
* @return The range (output) of the function.
*/
- List<BigDecimal> getRange();
+ List<FixedDecimal> getRange();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction0.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction0.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction0.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,8 @@
package org.axsl.pdf.function;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.util.List;
/**
@@ -91,13 +92,13 @@
* Optional for Type 0: A 2 * m array of Doubles which provides a linear
* mapping of input values to the domain.
*/
- private List<BigDecimal> encode = null;
+ private List<FixedDecimal> encode = null;
/**
* Optional for Type 0: A 2 * n array of Doubles which provides a linear
* mapping of sample values to the range. Defaults to Range.
*/
- private List<BigDecimal> decode = null;
+ private List<FixedDecimal> decode = null;
/**
* Create a complete Function object of Type 0, a Sampled function.
@@ -140,9 +141,9 @@
*
* @see "PDF Reference, Sixth Edition, Table 3.35."
*/
- public Impl(final List<BigDecimal> domain, final List<BigDecimal> range, final int[] theSize,
- final int theBitsPerSample, final Order theOrder, final List<BigDecimal> theEncode,
- final List<BigDecimal> theDecode) {
+ public Impl(final List<FixedDecimal> domain, final List<FixedDecimal> range, final int[] theSize,
+ final int theBitsPerSample, final Order theOrder, final List<FixedDecimal> theEncode,
+ final List<FixedDecimal> theDecode) {
super(domain, range);
this.size = theSize;
this.bitsPerSample = theBitsPerSample;
@@ -167,12 +168,12 @@
}
@Override
- public List<BigDecimal> getEncode() {
+ public List<FixedDecimal> getEncode() {
return this.encode;
}
@Override
- public List<BigDecimal> getDecode() {
+ public List<FixedDecimal> getDecode() {
return this.decode;
}
@@ -205,12 +206,12 @@
* Returns the encode.
* @return the encode.
*/
- List<BigDecimal> getEncode();
+ List<FixedDecimal> getEncode();
/**
* Returns the decode.
* @return the decode.
*/
- List<BigDecimal> getDecode();
+ List<FixedDecimal> getDecode();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction2.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction2.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction2.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,8 @@
package org.axsl.pdf.function;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.util.List;
/**
@@ -40,12 +41,12 @@
/**
* Required For Type 2: An Array of n Doubles defining the function result when x=0. Default is [0].
*/
- private List<BigDecimal> cZero;
+ private List<FixedDecimal> cZero;
/**
* Required For Type 2: An Array of n Doubles defining the function result when x=1. Default is [1].
*/
- private List<BigDecimal> cOne;
+ private List<FixedDecimal> cOne;
/**
* Required for Type 2: The interpolation exponent.
@@ -52,7 +53,7 @@
* Each value x will return n results.
* Must be greater than 0.
*/
- private BigDecimal interpolationExponentN;
+ private FixedDecimal interpolationExponentN;
/**
* Create a complete Function object of Type 2, an Exponential
@@ -77,8 +78,8 @@
*
* @see "PDF Reference, Sixth Edition, Table 3.35."
*/
- public Impl(final List<BigDecimal> domain, final List<BigDecimal> range, final List<BigDecimal> theCZero,
- final List<BigDecimal> theCOne, final BigDecimal theInterpolationExponentN) {
+ public Impl(final List<FixedDecimal> domain, final List<FixedDecimal> range, final List<FixedDecimal> theCZero,
+ final List<FixedDecimal> theCOne, final FixedDecimal theInterpolationExponentN) {
super(domain, range);
this.cZero = theCZero;
this.cOne = theCOne;
@@ -86,17 +87,17 @@
}
@Override
- public List<BigDecimal> getcZero() {
+ public List<FixedDecimal> getcZero() {
return this.cZero;
}
@Override
- public List<BigDecimal> getcOne() {
+ public List<FixedDecimal> getcOne() {
return this.cOne;
}
@Override
- public BigDecimal getInterpolationExponentN() {
+ public FixedDecimal getInterpolationExponentN() {
return this.interpolationExponentN;
}
@@ -110,18 +111,18 @@
* Returns the cZero.
* @return the cZero.
*/
- List<BigDecimal> getcZero();
+ List<FixedDecimal> getcZero();
/**
* Returns the cOne.
* @return the cOne.
*/
- List<BigDecimal> getcOne();
+ List<FixedDecimal> getcOne();
/**
* Returns the interpolation exponent N.
* @return the interpolationExponentN.
*/
- BigDecimal getInterpolationExponentN();
+ FixedDecimal getInterpolationExponentN();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction3.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction3.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction3.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,8 @@
package org.axsl.pdf.function;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.util.List;
/**
@@ -54,7 +55,7 @@
* stitching function.
* It makes the gradient even.
*/
- private List<BigDecimal> bounds = null;
+ private List<FixedDecimal> bounds = null;
/**
* Required for Type 3: A 2 * k array of Doubles that, taken in pairs, map
@@ -63,7 +64,7 @@
* Should be two values per function, usually (0,1), as in [0 1 0 1] for 2
* functions.
*/
- private List<BigDecimal> encode = null;
+ private List<FixedDecimal> encode = null;
/**
* create an complete Function object of Type 3, a Stitching function.
@@ -95,8 +96,9 @@
*
* @see "PDF Reference, Sixth Edition, Table 3.35."
*/
- public Impl(final List<BigDecimal> domain, final List<BigDecimal> range, final List<PdfFunction> theFunctions,
- final List<BigDecimal> theBounds, final List<BigDecimal> theEncode) {
+ public Impl(final List<FixedDecimal> domain, final List<FixedDecimal> range,
+ final List<PdfFunction> theFunctions, final List<FixedDecimal> theBounds,
+ final List<FixedDecimal> theEncode) {
super(domain, range);
this.functions = theFunctions;
this.bounds = theBounds;
@@ -109,12 +111,12 @@
}
@Override
- public List<BigDecimal> getBounds() {
+ public List<FixedDecimal> getBounds() {
return this.bounds;
}
@Override
- public List<BigDecimal> getEncode() {
+ public List<FixedDecimal> getEncode() {
return this.encode;
}
@@ -136,12 +138,12 @@
* Returns the bounds.
* @return the bounds.
*/
- List<BigDecimal> getBounds();
+ List<FixedDecimal> getBounds();
/**
* Returns the encode.
* @return the encode.
*/
- List<BigDecimal> getEncode();
+ List<FixedDecimal> getEncode();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction4.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction4.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/function/PdfFunction4.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,10 +23,10 @@
package org.axsl.pdf.function;
+import org.axsl.primitive.fixed.FixedDecimal;
import org.axsl.primitive.sequence.ByteSequence;
import java.io.InputStream;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -51,7 +51,8 @@
* Do <em>not</em> include the enclosing curly braces "{}", as they will be added during serialization.
* @see "PDF Reference, Sixth Edition, Table 3.35."
*/
- public Impl(final List<BigDecimal> domain, final List<BigDecimal> range, final ByteSequence theFunctionData) {
+ public Impl(final List<FixedDecimal> domain, final List<FixedDecimal> range,
+ final ByteSequence theFunctionData) {
super(domain, range);
this.functionData = theFunctionData;
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfPattern.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfPattern.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfPattern.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -25,8 +25,8 @@
package org.axsl.pdf.graphics.pattern;
import org.axsl.pdf.graphics.PdfPaint;
+import org.axsl.primitive.fixed.FixedDecimal;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -73,18 +73,18 @@
abstract class Impl implements PdfPattern {
/** The Transformation matrix. */
- private List<BigDecimal> matrix = null;
+ private List<FixedDecimal> matrix = null;
/**
* Constructor.
* @param matrix The pattern matrix. Optional.
*/
- protected Impl(final List<BigDecimal> matrix) {
+ protected Impl(final List<FixedDecimal> matrix) {
this.matrix = matrix;
}
@Override
- public List<BigDecimal> getMatrix() {
+ public List<FixedDecimal> getMatrix() {
return this.matrix;
}
@@ -101,6 +101,6 @@
* Returns the matrix.
* @return the matrix.
*/
- List<BigDecimal> getMatrix();
+ List<FixedDecimal> getMatrix();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfShadingPattern.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfShadingPattern.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfShadingPattern.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,8 +24,8 @@
package org.axsl.pdf.graphics.pattern;
import org.axsl.pdf.graphics.shading.PdfShading;
+import org.axsl.primitive.fixed.FixedDecimal;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -49,7 +49,7 @@
* @param theShading the PDF Shading object that comprises this pattern
* @param matrix Optional:List of Doubles that specify the matrix.
*/
- public Impl(final PdfShading theShading, final List<BigDecimal> matrix) {
+ public Impl(final PdfShading theShading, final List<FixedDecimal> matrix) {
super(matrix);
this.shading = theShading;
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfTilingPattern.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfTilingPattern.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/pattern/PdfTilingPattern.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,10 +24,10 @@
package org.axsl.pdf.graphics.pattern;
+import org.axsl.primitive.fixed.FixedDecimal;
import org.axsl.primitive.sequence.ByteSequence;
import org.axsl.primitive.sequence.ByteSequencePlus;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -118,13 +118,13 @@
private TilingType tilingType;
/** The Bounding box rectangle. */
- private List<BigDecimal> bBox;
+ private List<FixedDecimal> bBox;
/** Horizontal spacing. */
- private BigDecimal xStep;
+ private FixedDecimal xStep;
/** Vertical spacing. */
- private BigDecimal yStep;
+ private FixedDecimal yStep;
/** The content stream for this pattern. */
private ByteSequencePlus patternContentStream;
@@ -141,8 +141,8 @@
* @param matrix Optional transformation matrix.
* @param patternContentStream The content stream for this pattern.
*/
- public Impl(final PaintType thePaintType, final TilingType theTilingType, final List<BigDecimal> theBBox,
- final BigDecimal theXStep, final BigDecimal theYStep, final List<BigDecimal> matrix,
+ public Impl(final PaintType thePaintType, final TilingType theTilingType, final List<FixedDecimal> theBBox,
+ final FixedDecimal theXStep, final FixedDecimal theYStep, final List<FixedDecimal> matrix,
final ByteSequence patternContentStream) {
super(matrix);
@@ -164,17 +164,17 @@
}
@Override
- public List<BigDecimal> getbBox() {
+ public List<FixedDecimal> getbBox() {
return this.bBox;
}
@Override
- public BigDecimal getxStep() {
+ public FixedDecimal getxStep() {
return this.xStep;
}
@Override
- public BigDecimal getyStep() {
+ public FixedDecimal getyStep() {
return this.yStep;
}
@@ -209,19 +209,19 @@
* Returns the bounding box.
* @return the bBox.
*/
- List<BigDecimal> getbBox();
+ List<FixedDecimal> getbBox();
/**
* Returns the X step.
* @return the xStep.
*/
- BigDecimal getxStep();
+ FixedDecimal getxStep();
/**
* Returns the Y stop.
* @return the yStep.
*/
- BigDecimal getyStep();
+ FixedDecimal getyStep();
/**
* Returns the content stream for this pattern.
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,9 +24,9 @@
package org.axsl.pdf.graphics.shading;
import org.axsl.pdf.function.PdfFunction;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.color.ColorSpace;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -98,10 +98,10 @@
* The background color. Since shading is opaque,
* this is very rarely used.
*/
- private List<BigDecimal> background = null;
+ private List<FixedDecimal> background = null;
/** Optional list specifying the clipping rectangle. */
- private List<BigDecimal> bBox = null;
+ private List<FixedDecimal> bBox = null;
/**
* Optional: A flag whether or not to filter the shading function
@@ -130,8 +130,8 @@
* @param function The function for this shading.
* Optional for some subtypes.
*/
- public Impl(final ColorSpace colorSpace, final List<BigDecimal> background,
- final List<BigDecimal> bBox, final boolean antiAlias, final PdfFunction function) {
+ public Impl(final ColorSpace colorSpace, final List<FixedDecimal> background,
+ final List<FixedDecimal> bBox, final boolean antiAlias, final PdfFunction function) {
this.colorSpace = colorSpace;
this.background = background;
this.bBox = bBox;
@@ -145,12 +145,12 @@
}
@Override
- public List<BigDecimal> getBackground() {
+ public List<FixedDecimal> getBackground() {
return this.background;
}
@Override
- public List<BigDecimal> getbBox() {
+ public List<FixedDecimal> getbBox() {
return this.bBox;
}
@@ -184,13 +184,13 @@
* Returns the background.
* @return the background.
*/
- List<BigDecimal> getBackground();
+ List<FixedDecimal> getBackground();
/**
* Returns the bounding box.
* @return the bBox.
*/
- List<BigDecimal> getbBox();
+ List<FixedDecimal> getbBox();
/**
* Returns the anti-alias flag.
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading1.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading1.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading1.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,9 +24,9 @@
package org.axsl.pdf.graphics.shading;
import org.axsl.pdf.function.PdfFunction;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.color.ColorSpace;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -44,10 +44,10 @@
* Optional: Array of four numbers, xmin, xmax, ymin, ymax.
* Default is [0 1 0 1].
*/
- private List<BigDecimal> domain = null;
+ private List<FixedDecimal> domain = null;
/** A transformation matrix, optional. */
- private List<BigDecimal> matrix = null;
+ private List<FixedDecimal> matrix = null;
/**
* Constructor.
@@ -68,8 +68,8 @@
* @param function The PDF Function that maps an (x,y) location to a color.
* Required
*/
- public Impl(final ColorSpace colorSpace, final List<BigDecimal> background, final List<BigDecimal> bBox,
- final boolean antiAlias, final List<BigDecimal> theDomain, final List<BigDecimal> theMatrix,
+ public Impl(final ColorSpace colorSpace, final List<FixedDecimal> background, final List<FixedDecimal> bBox,
+ final boolean antiAlias, final List<FixedDecimal> theDomain, final List<FixedDecimal> theMatrix,
final PdfFunction function) {
super(colorSpace, background, bBox, antiAlias, function);
this.domain = theDomain;
@@ -77,12 +77,12 @@
}
@Override
- public List<BigDecimal> getDomain() {
+ public List<FixedDecimal> getDomain() {
return this.domain;
}
@Override
- public List<BigDecimal> getMatrix() {
+ public List<FixedDecimal> getMatrix() {
return this.matrix;
}
@@ -97,12 +97,12 @@
* Returns the domain.
* @return the domain.
*/
- List<BigDecimal> getDomain();
+ List<FixedDecimal> getDomain();
/**
* Returns the matix.
* @return the matrix.
*/
- List<BigDecimal> getMatrix();
+ List<FixedDecimal> getMatrix();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading2.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading2.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading2.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,9 +24,9 @@
package org.axsl.pdf.graphics.shading;
import org.axsl.pdf.function.PdfFunction;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.color.ColorSpace;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -44,13 +44,13 @@
* An Array of four numbers specifying the starting and ending coordinate pairs.
* Required.
*/
- private List<BigDecimal> coords = null;
+ private List<FixedDecimal> coords = null;
/**
* An array of two numbers between which the blend varies between start and end points. Default is 0, 1.
* Optional.
*/
- private List<BigDecimal> domain = null;
+ private List<FixedDecimal> domain = null;
/**
* An Array of two boolean values specifying whether to extend the start and end colors past the start and end
@@ -78,8 +78,8 @@
* points.
* The default is [false, false]
*/
- public Impl(final ColorSpace colorSpace, final List<BigDecimal> background, final List<BigDecimal> bBox,
- final boolean antiAlias, final List<BigDecimal> theCoords, final List<BigDecimal> theDomain,
+ public Impl(final ColorSpace colorSpace, final List<FixedDecimal> background, final List<FixedDecimal> bBox,
+ final boolean antiAlias, final List<FixedDecimal> theCoords, final List<FixedDecimal> theDomain,
final PdfFunction function, final List<Boolean> theExtend) {
super(colorSpace, background, bBox, antiAlias, function);
this.coords = theCoords;
@@ -88,12 +88,12 @@
}
@Override
- public List<BigDecimal> getCoords() {
+ public List<FixedDecimal> getCoords() {
return this.coords;
}
@Override
- public List<BigDecimal> getDomain() {
+ public List<FixedDecimal> getDomain() {
return this.domain;
}
@@ -114,13 +114,13 @@
* Returns the coords.
* @return the coords.
*/
- List<BigDecimal> getCoords();
+ List<FixedDecimal> getCoords();
/**
* Returns the domain.
* @return the domain.
*/
- List<BigDecimal> getDomain();
+ List<FixedDecimal> getDomain();
/**
* Returns the extend.
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading3.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading3.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading3.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,9 +24,9 @@
package org.axsl.pdf.graphics.shading;
import org.axsl.pdf.function.PdfFunction;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.color.ColorSpace;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -45,13 +45,13 @@
* circles.
* Required.
*/
- private List<BigDecimal> coords = null;
+ private List<FixedDecimal> coords = null;
/**
* An array of two numbers between which the blend varies between start and end points. Default is 0, 1.
* Optional.
*/
- private List<BigDecimal> domain = null;
+ private List<FixedDecimal> domain = null;
/**
* An Array of two boolean values specifying whether to extend the start and end colors past the start and end
@@ -79,8 +79,8 @@
* points.
* The default is [false, false]
*/
- public Impl(final ColorSpace colorSpace, final List<BigDecimal> background, final List<BigDecimal> bBox,
- final boolean antiAlias, final List<BigDecimal> theCoords, final List<BigDecimal> theDomain,
+ public Impl(final ColorSpace colorSpace, final List<FixedDecimal> background, final List<FixedDecimal> bBox,
+ final boolean antiAlias, final List<FixedDecimal> theCoords, final List<FixedDecimal> theDomain,
final PdfFunction function, final List<Boolean> theExtend) {
super(colorSpace, background, bBox, antiAlias, function);
this.coords = theCoords;
@@ -89,12 +89,12 @@
}
@Override
- public List<BigDecimal> getCoords() {
+ public List<FixedDecimal> getCoords() {
return this.coords;
}
@Override
- public List<BigDecimal> getDomain() {
+ public List<FixedDecimal> getDomain() {
return this.domain;
}
@@ -115,13 +115,13 @@
* Returns the coords.
* @return the coords.
*/
- List<BigDecimal> getCoords();
+ List<FixedDecimal> getCoords();
/**
* Returns the domain.
* @return the domain.
*/
- List<BigDecimal> getDomain();
+ List<FixedDecimal> getDomain();
/**
* Returns the extend.
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading4.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading4.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading4.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,9 +24,9 @@
package org.axsl.pdf.graphics.shading;
import org.axsl.pdf.function.PdfFunction;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.color.ColorSpace;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -69,7 +69,7 @@
* spec.
* Page 303 in PDF Spec 1.3
*/
- private List<BigDecimal> decode = null;
+ private List<FixedDecimal> decode = null;
/**
* Constructor.
@@ -89,9 +89,9 @@
* @param function The function for this shading.
* Optional for some subtypes.
*/
- public Impl(final ColorSpace colorSpace, final List<BigDecimal> background, final List<BigDecimal> bBox,
+ public Impl(final ColorSpace colorSpace, final List<FixedDecimal> background, final List<FixedDecimal> bBox,
final boolean antiAlias, final int theBitsPerCoordinate, final int theBitsPerComponent,
- final int theBitsPerFlag, final List<BigDecimal> theDecode, final PdfFunction function) {
+ final int theBitsPerFlag, final List<FixedDecimal> theDecode, final PdfFunction function) {
super(colorSpace, background, bBox, antiAlias, function);
this.bitsPerCoordinate = theBitsPerCoordinate;
this.bitsPerComponent = theBitsPerComponent;
@@ -115,7 +115,7 @@
}
@Override
- public List<BigDecimal> getDecode() {
+ public List<FixedDecimal> getDecode() {
return this.decode;
}
@@ -149,6 +149,6 @@
* Returns the decode.
* @return the decode.
*/
- List<BigDecimal> getDecode();
+ List<FixedDecimal> getDecode();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading5.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading5.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading5.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,9 +24,9 @@
package org.axsl.pdf.graphics.shading;
import org.axsl.pdf.function.PdfFunction;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.color.ColorSpace;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -67,7 +67,7 @@
* spec.
* Page 303 in PDF Spec 1.3
*/
- private List<BigDecimal> decode = null;
+ private List<FixedDecimal> decode = null;
/**
* Constructor.
@@ -87,9 +87,9 @@
* @param function The function for this shading.
* Optional for some subtypes.
*/
- public Impl(final ColorSpace colorSpace, final List<BigDecimal> background, final List<BigDecimal> bBox,
+ public Impl(final ColorSpace colorSpace, final List<FixedDecimal> background, final List<FixedDecimal> bBox,
final boolean antiAlias, final int theBitsPerCoordinate, final int theBitsPerComponent,
- final List<BigDecimal> theDecode, final int theVerticesPerRow, final PdfFunction function) {
+ final List<FixedDecimal> theDecode, final int theVerticesPerRow, final PdfFunction function) {
super(colorSpace, background, bBox, antiAlias, function);
this.bitsPerCoordinate = theBitsPerCoordinate;
this.bitsPerComponent = theBitsPerComponent;
@@ -113,7 +113,7 @@
}
@Override
- public List<BigDecimal> getDecode() {
+ public List<FixedDecimal> getDecode() {
return this.decode;
}
@@ -147,6 +147,6 @@
* Returns the decode.
* @return the decode.
*/
- List<BigDecimal> getDecode();
+ List<FixedDecimal> getDecode();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading6.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading6.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading6.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,9 +24,9 @@
package org.axsl.pdf.graphics.shading;
import org.axsl.pdf.function.PdfFunction;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.color.ColorSpace;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -69,7 +69,7 @@
* spec.
* Page 303 in PDF Spec 1.3
*/
- private List<BigDecimal> decode = null;
+ private List<FixedDecimal> decode = null;
/**
* Constructor.
@@ -89,9 +89,9 @@
* @param function The function for this shading.
* Optional for some subtypes.
*/
- public Impl(final ColorSpace colorSpace, final List<BigDecimal> background, final List<BigDecimal> bBox,
+ public Impl(final ColorSpace colorSpace, final List<FixedDecimal> background, final List<FixedDecimal> bBox,
final boolean antiAlias, final int theBitsPerCoordinate, final int theBitsPerComponent,
- final int theBitsPerFlag, final List<BigDecimal> theDecode, final PdfFunction function) {
+ final int theBitsPerFlag, final List<FixedDecimal> theDecode, final PdfFunction function) {
super(colorSpace, background, bBox, antiAlias, function);
this.bitsPerCoordinate = theBitsPerCoordinate;
this.bitsPerComponent = theBitsPerComponent;
@@ -115,7 +115,7 @@
}
@Override
- public List<BigDecimal> getDecode() {
+ public List<FixedDecimal> getDecode() {
return this.decode;
}
@@ -149,6 +149,6 @@
* Returns the decode.
* @return the decode.
*/
- List<BigDecimal> getDecode();
+ List<FixedDecimal> getDecode();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading7.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading7.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/shading/PdfShading7.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -24,9 +24,9 @@
package org.axsl.pdf.graphics.shading;
import org.axsl.pdf.function.PdfFunction;
+import org.axsl.primitive.fixed.FixedDecimal;
import java.awt.color.ColorSpace;
-import java.math.BigDecimal;
import java.util.List;
/**
@@ -69,7 +69,7 @@
* spec.
* Page 303 in PDF Spec 1.3
*/
- private List<BigDecimal> decode = null;
+ private List<FixedDecimal> decode = null;
/**
* Constructor.
@@ -89,9 +89,9 @@
* @param function The function for this shading.
* Optional for some subtypes.
*/
- public Impl(final ColorSpace colorSpace, final List<BigDecimal> background, final List<BigDecimal> bBox,
+ public Impl(final ColorSpace colorSpace, final List<FixedDecimal> background, final List<FixedDecimal> bBox,
final boolean antiAlias, final int theBitsPerCoordinate, final int theBitsPerComponent,
- final int theBitsPerFlag, final List<BigDecimal> theDecode, final PdfFunction function) {
+ final int theBitsPerFlag, final List<FixedDecimal> theDecode, final PdfFunction function) {
super(colorSpace, background, bBox, antiAlias, function);
this.bitsPerCoordinate = theBitsPerCoordinate;
this.bitsPerComponent = theBitsPerComponent;
@@ -115,7 +115,7 @@
}
@Override
- public List<BigDecimal> getDecode() {
+ public List<FixedDecimal> getDecode() {
return this.decode;
}
@@ -149,6 +149,6 @@
* Returns the decode.
* @return the decode.
*/
- List<BigDecimal> getDecode();
+ List<FixedDecimal> getDecode();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/state/PdfLineDashPattern.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/state/PdfLineDashPattern.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/graphics/state/PdfLineDashPattern.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -22,6 +22,8 @@
*/
package org.axsl.pdf.graphics.state;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
@@ -38,11 +40,12 @@
* Basic implementation of {@link PdfLineDashPattern}.
*/
class Impl implements PdfLineDashPattern {
+
/** The dash array. */
- private List<BigDecimal> dashArray;
+ private List<FixedDecimal> dashArray;
/** The dash phase. */
- private BigDecimal dashPhase;
+ private FixedDecimal dashPhase;
/**
* Constructor.
@@ -49,7 +52,7 @@
* @param dashArray The dash array.
* @param dashPhase The dash phase.
*/
- public Impl(final List<BigDecimal> dashArray, final BigDecimal dashPhase) {
+ public Impl(final List<FixedDecimal> dashArray, final FixedDecimal dashPhase) {
if (dashArray == null) {
throw new IllegalArgumentException("dashArray cannot be null.");
}
@@ -61,12 +64,12 @@
}
@Override
- public List<BigDecimal> getDashArray() {
+ public List<FixedDecimal> getDashArray() {
return this.dashArray;
}
@Override
- public BigDecimal getDashPhase() {
+ public FixedDecimal getDashPhase() {
return this.dashPhase;
}
@@ -84,8 +87,8 @@
return false;
}
for (int index = 0; index < this.dashArray.size(); index ++) {
- final BigDecimal thisElement = this.dashArray.get(index);
- final BigDecimal otherElement = otherPattern.getDashArray().get(index);
+ final FixedDecimal thisElement = this.dashArray.get(index);
+ final FixedDecimal otherElement = otherPattern.getDashArray().get(index);
if (thisElement.compareTo(otherElement) != 0) {
return false;
}
@@ -95,15 +98,15 @@
}
/** Constant used to designate a solid dash pattern. */
- PdfLineDashPattern DASHPATTERN_SOLID = new Impl(Collections.emptyList(), BigDecimal.ZERO);
+ PdfLineDashPattern DASHPATTERN_SOLID = new Impl(Collections.emptyList(), FixedDecimal.ZERO);
/** Constant used to designate a "dotted" dash pattern: 1 on, 3 off. */
PdfLineDashPattern DASHPATTERN_DOTTED = new Impl(
- Collections.unmodifiableList(Arrays.asList(BigDecimal.ONE, BigDecimal.valueOf(3))), BigDecimal.ZERO);
+ Collections.unmodifiableList(Arrays.asList(FixedDecimal.ONE, FixedDecimal.valueOf(3))), FixedDecimal.ZERO);
/** Constant used to designate a "dashed" dash pattern: 3 on, 3 off. */
- PdfLineDashPattern DASHPATTERN_DASHED = new Impl(
- Collections.unmodifiableList(Arrays.asList(BigDecimal.valueOf(3), BigDecimal.valueOf(3))), BigDecimal.ZERO);
+ PdfLineDashPattern DASHPATTERN_DASHED = new Impl(Collections.unmodifiableList(
+ Arrays.asList(FixedDecimal.valueOf(3), FixedDecimal.valueOf(3))), FixedDecimal.ZERO);
@@ -115,7 +118,7 @@
* @return The dash array for this pattern, in user space units.
* @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- List<BigDecimal> getDashArray();
+ List<FixedDecimal> getDashArray();
/**
* Returns the phase for this pattern.
@@ -123,6 +126,6 @@
* @return The dash phase for this pattern, in user space units.
* @apiNote {@link BigDecimal} is used instead of {@link Float#TYPE}, to ensure precision.
*/
- BigDecimal getDashPhase();
+ FixedDecimal getDashPhase();
}
Modified: trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/interact/PdfExplicitDestination.java
===================================================================
--- trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/interact/PdfExplicitDestination.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-pdf/src/main/java/org/axsl/pdf/interact/PdfExplicitDestination.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -23,7 +23,7 @@
package org.axsl.pdf.interact;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* A PDF explicit destination.
@@ -107,7 +107,7 @@
* A null value implies that the coordinate should remain unchanged from its current state.
* @return The left coordinate of the display window.
*/
- BigDecimal getLeft();
+ FixedDecimal getLeft();
/**
* The bottom coordinate of the display window, expressed in points.
@@ -114,7 +114,7 @@
* A null value implies that the coordinate should remain unchanged from its current state.
* @return The bottom coordinate of the display window.
*/
- BigDecimal getBottom();
+ FixedDecimal getBottom();
/**
* The right coordinate of the display window, expressed in points.
@@ -121,7 +121,7 @@
* A null value implies that the coordinate should remain unchanged from its current state.
* @return The right coordinate of the display window.
*/
- BigDecimal getRight();
+ FixedDecimal getRight();
/**
* The top coordinate of the display window, expressed in points.
@@ -128,7 +128,7 @@
* A null value implies that the coordinate should remain unchanged from its current state.
* @return The top coordinate of the display window.
*/
- BigDecimal getTop();
+ FixedDecimal getTop();
}
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-01 19:08:03 UTC (rev 3036)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-01 21:58:54 UTC (rev 3037)
@@ -106,12 +106,26 @@
* @param value The int to be converted to an instance of {@link FixedDecimal32}.
* @return An instance whose values match {@code value}.
*/
- static FixedDecimal32 valueOf(final int value) {
+ static FixedDecimal valueOf(final int value) {
return new FixedDecimal32_00(value);
}
+ /* Checkstyle: Allow float and double here." */
+
/**
* Factory method.
+ * @param value The int to be converted to an instance of {@link FixedDecimal32}.
+ * @return An instance whose values match {@code value}.
+ */
+ static FixedDecimal valueOf(final float value) {
+ final BigDecimal bd = new BigDecimal(value);
+ return FixedDecimal.valueOf(bd);
+ }
+
+ /* Checkstyle: Restart float and double checking." */
+
+ /**
+ * Factory method.
* @param numeric The numeric string to be converted to a fixed-point.
* @return An instance matching {@code numeric}.
* @throws NumberFormatException For invalid values of {@code numeric}.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-01 19:08:05
|
Revision: 3036
http://sourceforge.net/p/axsl/code/3036
Author: victormote
Date: 2026-05-01 19:08:03 +0000 (Fri, 01 May 2026)
Log Message:
-----------
Convert some uses of BigDecimal to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsFontInfoDictionary.java
Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsFontInfoDictionary.java
===================================================================
--- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsFontInfoDictionary.java 2026-05-01 17:38:58 UTC (rev 3035)
+++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsFontInfoDictionary.java 2026-05-01 19:08:03 UTC (rev 3036)
@@ -23,7 +23,7 @@
package org.axsl.ps;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* A PostScript FontInfo dictionary.
@@ -64,7 +64,7 @@
* Returns the /ItalicAngle for this font dictionary.
* @return The /ItalicAngle.
*/
- BigDecimal getItalicAngle();
+ FixedDecimal getItalicAngle();
/**
* Returns the /isFixedPitch for this font dictionary.
@@ -76,12 +76,12 @@
* Returns the /UnderlinePosition for this font dictionary.
* @return The /UnderlinePosition.
*/
- BigDecimal getUnderlinePosition();
+ FixedDecimal getUnderlinePosition();
/**
* Returns the /UnderlineThickness for this font dictionary.
* @return The /UnderlineThickness.
*/
- BigDecimal getUnderlineThickness();
+ FixedDecimal getUnderlineThickness();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-01 17:39:14
|
Revision: 3035
http://sourceforge.net/p/axsl/code/3035
Author: victormote
Date: 2026-05-01 17:38:58 +0000 (Fri, 01 May 2026)
Log Message:
-----------
Convert some uses of BigDecimal to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-constants/build.gradle
trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java
trunk/axsl/axsl-constants/src/test/java/org/axsl/constants/TypographicConstantsTests.java
Modified: trunk/axsl/axsl-constants/build.gradle
===================================================================
--- trunk/axsl/axsl-constants/build.gradle 2026-05-01 17:06:49 UTC (rev 3034)
+++ trunk/axsl/axsl-constants/build.gradle 2026-05-01 17:38:58 UTC (rev 3035)
@@ -3,7 +3,10 @@
id 'axsl.test-conventions'
}
-
description = "axsl-constants"
+dependencies {
+ api project(":axsl-primitive")
+}
+
/* Last line of script. */
Modified: trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java
===================================================================
--- trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java 2026-05-01 17:06:49 UTC (rev 3034)
+++ trunk/axsl/axsl-constants/src/main/java/org/axsl/constants/TypographicConstants.java 2026-05-01 17:38:58 UTC (rev 3035)
@@ -23,6 +23,8 @@
package org.axsl.constants;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import java.math.BigDecimal;
/**
@@ -69,7 +71,7 @@
* @see <a href="https://books.google.com/books/download/The_monotype_system.pdf?id=6kU5AAAAMAAJ&output=pdf">1912,
* The Monotype System, Philadelphia, Lanston Monotype Machine Co.</a>
*/
- public static final BigDecimal MILLIPOINTS_PER_MONOTYPE_UNIT = new BigDecimal("55.555556");
+ public static final FixedDecimal MILLIPOINTS_PER_MONOTYPE_UNIT = FixedDecimal.valueOf("55.555556");
/** Constant indicating the ratio between 3-per-em and em. */
public static final int FACTOR_3_PER_EM = 3;
@@ -154,8 +156,8 @@
* @param millipoints The millipoints to be converted.
* @return The {@link BigDecimal} equivalent in points of {@code millipoints}.
*/
- public static BigDecimal millipointsToPoints(final int millipoints) {
- return BigDecimal.valueOf(millipoints, MILLIPOINTS_TO_POINTS_SCALE);
+ public static FixedDecimal millipointsToPoints(final int millipoints) {
+ return FixedDecimal.valueOf(millipoints, MILLIPOINTS_TO_POINTS_SCALE);
}
}
Modified: trunk/axsl/axsl-constants/src/test/java/org/axsl/constants/TypographicConstantsTests.java
===================================================================
--- trunk/axsl/axsl-constants/src/test/java/org/axsl/constants/TypographicConstantsTests.java 2026-05-01 17:06:49 UTC (rev 3034)
+++ trunk/axsl/axsl-constants/src/test/java/org/axsl/constants/TypographicConstantsTests.java 2026-05-01 17:38:58 UTC (rev 3035)
@@ -23,11 +23,11 @@
package org.axsl.constants;
+import org.axsl.primitive.fixed.FixedDecimal;
+
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
-import java.math.BigDecimal;
-
/**
* Tests of {@link TypographicConstants}.
*/
@@ -38,16 +38,16 @@
*/
@Test
public void testMillipointsToPoints() {
- BigDecimal expected = new BigDecimal("15.999");
- BigDecimal actual = TypographicConstants.millipointsToPoints(15_999);
+ FixedDecimal expected = FixedDecimal.valueOf("15.999");
+ FixedDecimal actual = TypographicConstants.millipointsToPoints(15_999);
assertThat(expected).isEqualTo(actual);
- expected = BigDecimal.ZERO;
+ expected = FixedDecimal.ZERO;
actual = TypographicConstants.millipointsToPoints(0);
/* Want to do identity equality check here, but BigDecimal actually caches 15 different zero values. */
assertThat(0).isEqualTo(expected.compareTo(actual));
- expected = BigDecimal.ONE;
+ expected = FixedDecimal.ONE;
actual = TypographicConstants.millipointsToPoints(1000);
assertThat(0).isEqualTo(expected.compareTo(actual));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-01 17:06:51
|
Revision: 3034
http://sourceforge.net/p/axsl/code/3034
Author: victormote
Date: 2026-05-01 17:06:49 +0000 (Fri, 01 May 2026)
Log Message:
-----------
Allow BigDecimal reference in method to convert to it.
Modified Paths:
--------------
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-01 17:03:10 UTC (rev 3033)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-01 17:06:49 UTC (rev 3034)
@@ -80,6 +80,8 @@
/* Checkstyle: Restart Magic Number checking. */
}
+ /* Checkstyle: Allow BigDecimal here. */
+
/**
* Factory method.
* @param bd The BigDecimal to be converted to an instance of {@link FixedDecimal32}.
@@ -97,6 +99,8 @@
return fd32 == null ? new FixedBigDecimal(bd) : fd32;
}
+ /* Checkstyle: Restart BigDecimal checking.*/
+
/**
* Factory method.
* @param value The int to be converted to an instance of {@link FixedDecimal32}.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-05-01 17:03:13
|
Revision: 3033
http://sourceforge.net/p/axsl/code/3033
Author: victormote
Date: 2026-05-01 17:03:10 +0000 (Fri, 01 May 2026)
Log Message:
-----------
Move constants to the interface.
Modified Paths:
--------------
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-04-30 20:18:34 UTC (rev 3032)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-05-01 17:03:10 UTC (rev 3033)
@@ -47,6 +47,12 @@
*/
public interface FixedDecimal extends Comparable<FixedDecimal> {
+ /** Constant for the value of zero, with an unscaled value of zero, and a scale of zero. */
+ FixedDecimal ZERO = FixedDecimal.valueOf(0);
+
+ /** Constant for the value of one, with an unscaled value of one, and a scale of zero. */
+ FixedDecimal ONE = FixedDecimal.valueOf(1);
+
/**
* Factory method.
* @param scale The scale of the fixed-point to be acquired.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-04-30 20:18:34 UTC (rev 3032)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-05-01 17:03:10 UTC (rev 3033)
@@ -38,12 +38,6 @@
*/
public abstract class FixedDecimal32 implements FixedDecimal {
- /** Constant for the value of zero, with an unscaled value of zero, and a scale of zero. */
- public static final FixedDecimal32 ZERO = FixedDecimal.valueOf(0);
-
- /** Constant for the value of one, with an unscaled value of one, and a scale of zero. */
- public static final FixedDecimal32 ONE = FixedDecimal.valueOf(1);
-
/**
* Enumeration of configurations for fixed-point classes.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-04-30 20:18:36
|
Revision: 3032
http://sourceforge.net/p/axsl/code/3032
Author: victormote
Date: 2026-04-30 20:18:34 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
Move static factory methods from FixedDecimal32 to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-04-30 17:20:15 UTC (rev 3031)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-04-30 20:18:34 UTC (rev 3032)
@@ -48,6 +48,78 @@
public interface FixedDecimal extends Comparable<FixedDecimal> {
/**
+ * Factory method.
+ * @param scale The scale of the fixed-point to be acquired.
+ * @param unscaledValue The unscaledValue of the fixed-point to be acquired.
+ * @return An instance matching {@code scale} and {@code unscaledValue}, or null if outside of range or no
+ * implementation can be found.
+ * @throws IllegalArgumentException For an unknown scale.
+ * @see BigDecimal#valueOf(long, int)
+ */
+ static FixedDecimal valueOf(final int unscaledValue, final int scale) {
+ /* Checkstyle: Allow Magic Numbers that are hard-coded data. */
+ switch (scale) {
+ case 0: return new FixedDecimal32_00(unscaledValue);
+ case 1: return new FixedDecimal32_01(unscaledValue);
+ case 2: return new FixedDecimal32_02(unscaledValue);
+ case 3: return new FixedDecimal32_03(unscaledValue);
+ case 4: return new FixedDecimal32_04(unscaledValue);
+ case 5: return new FixedDecimal32_05(unscaledValue);
+ case 6: return new FixedDecimal32_06(unscaledValue);
+ case 7: return new FixedDecimal32_07(unscaledValue);
+ case 8: return new FixedDecimal32_08(unscaledValue);
+ case 9: return new FixedDecimal32_09(unscaledValue);
+ }
+ return null;
+ /* Checkstyle: Restart Magic Number checking. */
+ }
+
+ /**
+ * Factory method.
+ * @param bd The BigDecimal to be converted to an instance of {@link FixedDecimal32}.
+ * @return An instance whose values match {@code bd}.
+ * @throws ArithmeticException If {@code bd} is out of range for the int type.
+ */
+ static FixedDecimal valueOf(final BigDecimal bd) {
+ final int unscaledValue;
+ try {
+ unscaledValue = bd.unscaledValue().intValueExact();
+ } catch (final ArithmeticException e) {
+ return new FixedBigDecimal(bd);
+ }
+ final FixedDecimal fd32 = valueOf(unscaledValue, bd.scale());
+ return fd32 == null ? new FixedBigDecimal(bd) : fd32;
+ }
+
+ /**
+ * Factory method.
+ * @param value The int to be converted to an instance of {@link FixedDecimal32}.
+ * @return An instance whose values match {@code value}.
+ */
+ static FixedDecimal32 valueOf(final int value) {
+ return new FixedDecimal32_00(value);
+ }
+
+ /**
+ * Factory method.
+ * @param numeric The numeric string to be converted to a fixed-point.
+ * @return An instance matching {@code numeric}.
+ * @throws NumberFormatException For invalid values of {@code numeric}.
+ */
+ static FixedDecimal valueOf(final CharSequence numeric) {
+ final String numericString = numeric.toString();
+ final int decimalIndex = numericString.indexOf('.');
+ if (decimalIndex < 0) {
+ return valueOf(Integer.parseInt(numericString), 0);
+ }
+ final int scale = numeric.length() - decimalIndex - 1;
+ final StringBuilder builder = new StringBuilder(numericString);
+ builder.deleteCharAt(decimalIndex);
+ final int unscaledValue = Integer.parseInt(builder.toString());
+ return valueOf(unscaledValue, scale);
+ }
+
+ /**
* Returns the <i>scale</i> of this {@code FixedPoint}.
* If zero or positive, the scale is the number of digits to the right of the decimal point.
* If negative, the unscaled value of the number is multiplied by ten to the power of the negation of the scale.
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-04-30 17:20:15 UTC (rev 3031)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-04-30 20:18:34 UTC (rev 3032)
@@ -39,41 +39,11 @@
public abstract class FixedDecimal32 implements FixedDecimal {
/** Constant for the value of zero, with an unscaled value of zero, and a scale of zero. */
- public static final FixedDecimal32 ZERO = FixedDecimal32.valueOf(0);
+ public static final FixedDecimal32 ZERO = FixedDecimal.valueOf(0);
/** Constant for the value of one, with an unscaled value of one, and a scale of zero. */
- public static final FixedDecimal32 ONE = FixedDecimal32.valueOf(1);
+ public static final FixedDecimal32 ONE = FixedDecimal.valueOf(1);
- /** Constant for the scale of 0. */
- protected static final int SCALE_00 = 0;
-
- /** Constant for the scale of 1. */
- protected static final int SCALE_01 = 1;
-
- /** Constant for the scale of 2. */
- protected static final int SCALE_02 = 2;
-
- /** Constant for the scale of 3. */
- protected static final int SCALE_03 = 3;
-
- /** Constant for the scale of 4. */
- protected static final int SCALE_04 = 4;
-
- /** Constant for the scale of 5. */
- protected static final int SCALE_05 = 5;
-
- /** Constant for the scale of 6. */
- protected static final int SCALE_06 = 6;
-
- /** Constant for the scale of 7. */
- protected static final int SCALE_07 = 7;
-
- /** Constant for the scale of 8. */
- protected static final int SCALE_08 = 8;
-
- /** Constant for the scale of 9. */
- protected static final int SCALE_09 = 9;
-
/**
* Enumeration of configurations for fixed-point classes.
*/
@@ -155,76 +125,6 @@
}
/**
- * Factory method.
- * @param scale The scale of the fixed-point to be acquired.
- * @param unscaledValue The unscaledValue of the fixed-point to be acquired.
- * @return An instance matching {@code scale} and {@code unscaledValue}, or null if outside of range or no
- * implementation can be found.
- * @throws IllegalArgumentException For an unknown scale.
- * @see BigDecimal#valueOf(long, int)
- */
- public static FixedDecimal valueOf(final int unscaledValue, final int scale) {
- switch (scale) {
- case SCALE_00: return new FixedDecimal32_00(unscaledValue);
- case SCALE_01: return new FixedDecimal32_01(unscaledValue);
- case SCALE_02: return new FixedDecimal32_02(unscaledValue);
- case SCALE_03: return new FixedDecimal32_03(unscaledValue);
- case SCALE_04: return new FixedDecimal32_04(unscaledValue);
- case SCALE_05: return new FixedDecimal32_05(unscaledValue);
- case SCALE_06: return new FixedDecimal32_06(unscaledValue);
- case SCALE_07: return new FixedDecimal32_07(unscaledValue);
- case SCALE_08: return new FixedDecimal32_08(unscaledValue);
- case SCALE_09: return new FixedDecimal32_09(unscaledValue);
- }
- return null;
- }
-
- /**
- * Factory method.
- * @param bd The BigDecimal to be converted to an instance of {@link FixedDecimal32}.
- * @return An instance whose values match {@code bd}.
- * @throws ArithmeticException If {@code bd} is out of range for the int type.
- */
- public static FixedDecimal valueOf(final BigDecimal bd) {
- final int unscaledValue;
- try {
- unscaledValue = bd.unscaledValue().intValueExact();
- } catch (final ArithmeticException e) {
- return new FixedBigDecimal(bd);
- }
- final FixedDecimal fd32 = valueOf(unscaledValue, bd.scale());
- return fd32 == null ? new FixedBigDecimal(bd) : fd32;
- }
-
- /**
- * Factory method.
- * @param value The int to be converted to an instance of {@link FixedDecimal32}.
- * @return An instance whose values match {@code value}.
- */
- public static FixedDecimal32 valueOf(final int value) {
- return new FixedDecimal32_00(value);
- }
-
- /**
- * Factory method.
- * @param numeric The numeric string to be converted to a fixed-point.
- * @return An instance matching {@code numeric}.
- * @throws NumberFormatException For invalid values of {@code numeric}.
- */
- public static FixedDecimal valueOf(final CharSequence numeric) {
- final String numericString = numeric.toString();
- final int decimalIndex = numericString.indexOf('.');
- if (decimalIndex < 0) {
- return valueOf(Integer.parseInt(numericString), 0);
- }
- final int scale = numeric.length() - decimalIndex - 1;
- final StringBuilder builder = new StringBuilder(numericString);
- builder.deleteCharAt(decimalIndex);
- final int unscaledValue = Integer.parseInt(builder.toString());
- return valueOf(unscaledValue, scale);
- }
-
- /**
* Returns the configuration.
* @return The configuration.
*/
@@ -325,7 +225,7 @@
return this.unscaledValue - other.unscaledValue();
}
final FixedDecimal other4a = other instanceof FixedDecimal32 ? (FixedDecimal32) other :
- FixedDecimal32.valueOf(other.unscaledValue(), other.scale());
+ FixedDecimal.valueOf(other.unscaledValue(), other.scale());
final long whole1 = this.whole();
final long whole2 = other4a.whole();
if (whole1 == whole2) {
@@ -339,30 +239,30 @@
@Override
public FixedDecimal add(final FixedDecimal addend) {
final BigDecimal result = bigDecimalValue().add(addend.bigDecimalValue());
- return valueOf(result);
+ return FixedDecimal.valueOf(result);
}
@Override
public FixedDecimal subtract(final FixedDecimal subtrahend) {
final BigDecimal result = bigDecimalValue().subtract(subtrahend.bigDecimalValue());
- return valueOf(result);
+ return FixedDecimal.valueOf(result);
}
@Override
public FixedDecimal multiply(final FixedDecimal multiplier) {
final BigDecimal result = bigDecimalValue().multiply(multiplier.bigDecimalValue());
- return valueOf(result);
+ return FixedDecimal.valueOf(result);
}
@Override
public FixedDecimal divide(final FixedDecimal divisor) {
final BigDecimal result = bigDecimalValue().divide(divisor.bigDecimalValue(), MathContext.DECIMAL32);
- return valueOf(result);
+ return FixedDecimal.valueOf(result);
}
@Override
public FixedDecimal negate() {
- return valueOf(this.unscaledValue * -1, this.scale());
+ return FixedDecimal.valueOf(this.unscaledValue * -1, this.scale());
}
@Override
@@ -372,7 +272,7 @@
@Override
public FixedDecimal round(final MathContext mc) {
- return valueOf(bigDecimalValue().round(mc));
+ return FixedDecimal.valueOf(bigDecimalValue().round(mc));
}
@Override
Modified: trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java
===================================================================
--- trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java 2026-04-30 17:20:15 UTC (rev 3031)
+++ trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java 2026-04-30 20:18:34 UTC (rev 3032)
@@ -41,11 +41,11 @@
*/
@Test
public void testNumericFactory() {
- FixedDecimal out = FixedDecimal32.valueOf(112, 0);
+ FixedDecimal out = FixedDecimal.valueOf(112, 0);
assertThat(out.scale()).isEqualTo(0);
assertThat(out.unscaledValue()).isEqualTo(112);
- out = FixedDecimal32.valueOf(147_339, 3);
+ out = FixedDecimal.valueOf(147_339, 3);
assertThat(out.scale()).isEqualTo(3);
assertThat(out.unscaledValue()).isEqualTo(147_339);
}
@@ -55,11 +55,11 @@
*/
@Test
public void testStringFactory() {
- FixedDecimal out = FixedDecimal32.valueOf("112");
+ FixedDecimal out = FixedDecimal.valueOf("112");
assertThat(out.scale()).isEqualTo(0);
assertThat(out.unscaledValue()).isEqualTo(112);
- out = FixedDecimal32.valueOf("147.339");
+ out = FixedDecimal.valueOf("147.339");
assertThat(out.scale()).isEqualTo(3);
assertThat(out.unscaledValue()).isEqualTo(147_339);
}
@@ -69,10 +69,10 @@
*/
@Test
public void testWhole() {
- FixedDecimal out = FixedDecimal32.valueOf(112, 0);
+ FixedDecimal out = FixedDecimal.valueOf(112, 0);
assertThat(out.whole()).isEqualTo(112);
- out = FixedDecimal32.valueOf("147.339");
+ out = FixedDecimal.valueOf("147.339");
assertThat(out.whole()).isEqualTo(147);
}
@@ -81,10 +81,10 @@
*/
@Test
public void testFractional() {
- FixedDecimal out = FixedDecimal32.valueOf(112, 0);
+ FixedDecimal out = FixedDecimal.valueOf(112, 0);
assertThat(out.fractional()).isEqualTo(0);
- out = FixedDecimal32.valueOf("147.339");
+ out = FixedDecimal.valueOf("147.339");
assertThat(out.fractional()).isEqualTo(339);
}
@@ -93,24 +93,24 @@
*/
@Test
public void testCompareTo() {
- FixedDecimal low = FixedDecimal32.valueOf("112");
- FixedDecimal high = FixedDecimal32.valueOf("113");
+ FixedDecimal low = FixedDecimal.valueOf("112");
+ FixedDecimal high = FixedDecimal.valueOf("113");
assertThat(high.compareTo(low)).isGreaterThan(0);
- low = FixedDecimal32.valueOf("2147483.646");
- high = FixedDecimal32.valueOf("2147483.647");
+ low = FixedDecimal.valueOf("2147483.646");
+ high = FixedDecimal.valueOf("2147483.647");
assertThat(high.compareTo(low)).isGreaterThan(0);
- low = FixedDecimal32.valueOf(".646");
- high = FixedDecimal32.valueOf(".647");
+ low = FixedDecimal.valueOf(".646");
+ high = FixedDecimal.valueOf(".647");
assertThat(high.compareTo(low)).isGreaterThan(0);
- low = FixedDecimal32.valueOf("110.646");
- high = FixedDecimal32.valueOf("110.646");
+ low = FixedDecimal.valueOf("110.646");
+ high = FixedDecimal.valueOf("110.646");
assertThat(high.compareTo(low)).isEqualTo(0);
- low = FixedDecimal32.valueOf("110.64");
- high = FixedDecimal32.valueOf("110.641");
+ low = FixedDecimal.valueOf("110.64");
+ high = FixedDecimal.valueOf("110.641");
assertThat(high.compareTo(low)).isGreaterThan(0);
}
@@ -119,24 +119,24 @@
*/
@Test
public void testIsEqualTo() {
- FixedDecimal value1 = FixedDecimal32.valueOf("112");
- FixedDecimal value2 = FixedDecimal32.valueOf("113");
+ FixedDecimal value1 = FixedDecimal.valueOf("112");
+ FixedDecimal value2 = FixedDecimal.valueOf("113");
assertThat(value1.isEqualTo(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("2147483.646");
- value2 = FixedDecimal32.valueOf("2147483.647");
+ value1 = FixedDecimal.valueOf("2147483.646");
+ value2 = FixedDecimal.valueOf("2147483.647");
assertThat(value1.isEqualTo(value2)).isFalse();
- value1 = FixedDecimal32.valueOf(".646");
- value2 = FixedDecimal32.valueOf(".647");
+ value1 = FixedDecimal.valueOf(".646");
+ value2 = FixedDecimal.valueOf(".647");
assertThat(value1.isEqualTo(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("110.646");
- value2 = FixedDecimal32.valueOf("110.646");
+ value1 = FixedDecimal.valueOf("110.646");
+ value2 = FixedDecimal.valueOf("110.646");
assertThat(value1.isEqualTo(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("110.64");
- value2 = FixedDecimal32.valueOf("110.641");
+ value1 = FixedDecimal.valueOf("110.64");
+ value2 = FixedDecimal.valueOf("110.641");
assertThat(value1.isEqualTo(value2)).isFalse();
}
@@ -145,24 +145,24 @@
*/
@Test
public void testIsNotEqualTo() {
- FixedDecimal value1 = FixedDecimal32.valueOf("112");
- FixedDecimal value2 = FixedDecimal32.valueOf("113");
+ FixedDecimal value1 = FixedDecimal.valueOf("112");
+ FixedDecimal value2 = FixedDecimal.valueOf("113");
assertThat(value1.isNotEqualTo(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("2147483.646");
- value2 = FixedDecimal32.valueOf("2147483.647");
+ value1 = FixedDecimal.valueOf("2147483.646");
+ value2 = FixedDecimal.valueOf("2147483.647");
assertThat(value1.isNotEqualTo(value2)).isTrue();
- value1 = FixedDecimal32.valueOf(".646");
- value2 = FixedDecimal32.valueOf(".647");
+ value1 = FixedDecimal.valueOf(".646");
+ value2 = FixedDecimal.valueOf(".647");
assertThat(value1.isNotEqualTo(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("110.646");
- value2 = FixedDecimal32.valueOf("110.646");
+ value1 = FixedDecimal.valueOf("110.646");
+ value2 = FixedDecimal.valueOf("110.646");
assertThat(value1.isNotEqualTo(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("110.64");
- value2 = FixedDecimal32.valueOf("110.641");
+ value1 = FixedDecimal.valueOf("110.64");
+ value2 = FixedDecimal.valueOf("110.641");
assertThat(value1.isNotEqualTo(value2)).isTrue();
}
@@ -171,24 +171,24 @@
*/
@Test
public void testIsGreaterThan() {
- FixedDecimal value1 = FixedDecimal32.valueOf("113");
- FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal.valueOf("113");
+ FixedDecimal value2 = FixedDecimal.valueOf("112");
assertThat(value1.isGreaterThan(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("2147483.646");
- value2 = FixedDecimal32.valueOf("2147483.647");
+ value1 = FixedDecimal.valueOf("2147483.646");
+ value2 = FixedDecimal.valueOf("2147483.647");
assertThat(value1.isGreaterThan(value2)).isFalse();
- value1 = FixedDecimal32.valueOf(".647");
- value2 = FixedDecimal32.valueOf(".646");
+ value1 = FixedDecimal.valueOf(".647");
+ value2 = FixedDecimal.valueOf(".646");
assertThat(value1.isGreaterThan(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("110.646");
- value2 = FixedDecimal32.valueOf("110.646");
+ value1 = FixedDecimal.valueOf("110.646");
+ value2 = FixedDecimal.valueOf("110.646");
assertThat(value1.isGreaterThan(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("110.64");
- value2 = FixedDecimal32.valueOf("110.641");
+ value1 = FixedDecimal.valueOf("110.64");
+ value2 = FixedDecimal.valueOf("110.641");
assertThat(value1.isGreaterThan(value2)).isFalse();
}
@@ -197,24 +197,24 @@
*/
@Test
public void testIsNotGreaterThan() {
- FixedDecimal value1 = FixedDecimal32.valueOf("113");
- FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal.valueOf("113");
+ FixedDecimal value2 = FixedDecimal.valueOf("112");
assertThat(value1.isNotGreaterThan(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("2147483.646");
- value2 = FixedDecimal32.valueOf("2147483.647");
+ value1 = FixedDecimal.valueOf("2147483.646");
+ value2 = FixedDecimal.valueOf("2147483.647");
assertThat(value1.isNotGreaterThan(value2)).isTrue();
- value1 = FixedDecimal32.valueOf(".647");
- value2 = FixedDecimal32.valueOf(".646");
+ value1 = FixedDecimal.valueOf(".647");
+ value2 = FixedDecimal.valueOf(".646");
assertThat(value1.isNotGreaterThan(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("110.646");
- value2 = FixedDecimal32.valueOf("110.646");
+ value1 = FixedDecimal.valueOf("110.646");
+ value2 = FixedDecimal.valueOf("110.646");
assertThat(value1.isNotGreaterThan(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("110.64");
- value2 = FixedDecimal32.valueOf("110.641");
+ value1 = FixedDecimal.valueOf("110.64");
+ value2 = FixedDecimal.valueOf("110.641");
assertThat(value1.isNotGreaterThan(value2)).isTrue();
}
@@ -223,24 +223,24 @@
*/
@Test
public void testIsLessThan() {
- FixedDecimal value1 = FixedDecimal32.valueOf("113");
- FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal.valueOf("113");
+ FixedDecimal value2 = FixedDecimal.valueOf("112");
assertThat(value1.isLessThan(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("2147483.646");
- value2 = FixedDecimal32.valueOf("2147483.647");
+ value1 = FixedDecimal.valueOf("2147483.646");
+ value2 = FixedDecimal.valueOf("2147483.647");
assertThat(value1.isLessThan(value2)).isTrue();
- value1 = FixedDecimal32.valueOf(".647");
- value2 = FixedDecimal32.valueOf(".646");
+ value1 = FixedDecimal.valueOf(".647");
+ value2 = FixedDecimal.valueOf(".646");
assertThat(value1.isLessThan(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("110.646");
- value2 = FixedDecimal32.valueOf("110.646");
+ value1 = FixedDecimal.valueOf("110.646");
+ value2 = FixedDecimal.valueOf("110.646");
assertThat(value1.isLessThan(value2)).isFalse();
- value1 = FixedDecimal32.valueOf("110.64");
- value2 = FixedDecimal32.valueOf("110.641");
+ value1 = FixedDecimal.valueOf("110.64");
+ value2 = FixedDecimal.valueOf("110.641");
assertThat(value1.isLessThan(value2)).isTrue();
}
@@ -249,24 +249,24 @@
*/
@Test
public void testIsNotLessThan() {
- FixedDecimal value1 = FixedDecimal32.valueOf("113");
- FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal.valueOf("113");
+ FixedDecimal value2 = FixedDecimal.valueOf("112");
assertThat(value1.isNotLessThan(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("2147483.646");
- value2 = FixedDecimal32.valueOf("2147483.647");
+ value1 = FixedDecimal.valueOf("2147483.646");
+ value2 = FixedDecimal.valueOf("2147483.647");
assertThat(value1.isNotLessThan(value2)).isFalse();
- value1 = FixedDecimal32.valueOf(".647");
- value2 = FixedDecimal32.valueOf(".646");
+ value1 = FixedDecimal.valueOf(".647");
+ value2 = FixedDecimal.valueOf(".646");
assertThat(value1.isNotLessThan(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("110.646");
- value2 = FixedDecimal32.valueOf("110.646");
+ value1 = FixedDecimal.valueOf("110.646");
+ value2 = FixedDecimal.valueOf("110.646");
assertThat(value1.isNotLessThan(value2)).isTrue();
- value1 = FixedDecimal32.valueOf("110.64");
- value2 = FixedDecimal32.valueOf("110.641");
+ value1 = FixedDecimal.valueOf("110.64");
+ value2 = FixedDecimal.valueOf("110.641");
assertThat(value1.isNotLessThan(value2)).isFalse();
}
@@ -275,14 +275,14 @@
*/
@Test
public void testAdd() {
- FixedDecimal value1 = FixedDecimal32.valueOf("113");
- FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal.valueOf("113");
+ FixedDecimal value2 = FixedDecimal.valueOf("112");
FixedDecimal sum = value1.add(value2);
assertThat(sum.unscaledValue()).isEqualTo(225);
assertThat(sum.scale()).isEqualTo(0);
- value1 = FixedDecimal32.valueOf("113.57");
- value2 = FixedDecimal32.valueOf("112.329");
+ value1 = FixedDecimal.valueOf("113.57");
+ value2 = FixedDecimal.valueOf("112.329");
sum = value1.add(value2);
assertThat(sum.unscaledValue()).isEqualTo(225899);
assertThat(sum.scale()).isEqualTo(3);
@@ -293,8 +293,8 @@
*/
@Test
public void testSubtract() {
- FixedDecimal value1 = FixedDecimal32.valueOf("225");
- FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal.valueOf("225");
+ FixedDecimal value2 = FixedDecimal.valueOf("112");
FixedDecimal difference = value1.subtract(value2);
assertThat(difference.unscaledValue()).isEqualTo(113);
assertThat(difference.scale()).isEqualTo(0);
@@ -303,8 +303,8 @@
assertThat(difference.unscaledValue()).isEqualTo(-113);
assertThat(difference.scale()).isEqualTo(0);
- value1 = FixedDecimal32.valueOf("225.899");
- value2 = FixedDecimal32.valueOf("112.329");
+ value1 = FixedDecimal.valueOf("225.899");
+ value2 = FixedDecimal.valueOf("112.329");
difference = value1.subtract(value2);
assertThat(difference.unscaledValue()).isEqualTo(113570);
assertThat(difference.scale()).isEqualTo(3);
@@ -315,8 +315,8 @@
*/
@Test
public void testMultiply() {
- FixedDecimal value1 = FixedDecimal32.valueOf("225");
- FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal.valueOf("225");
+ FixedDecimal value2 = FixedDecimal.valueOf("112");
FixedDecimal product = value1.multiply(value2);
assertThat(product.unscaledValue()).isEqualTo(25_200);
assertThat(product.scale()).isEqualTo(0);
@@ -325,8 +325,8 @@
assertThat(product.unscaledValue()).isEqualTo(25_200);
assertThat(product.scale()).isEqualTo(0);
- value1 = FixedDecimal32.valueOf("225.89");
- value2 = FixedDecimal32.valueOf("112.32");
+ value1 = FixedDecimal.valueOf("225.89");
+ value2 = FixedDecimal.valueOf("112.32");
product = value1.multiply(value2);
assertThat(product.unscaledValue()).isEqualTo(253_719_648);
assertThat(product.scale()).isEqualTo(4);
@@ -337,14 +337,14 @@
*/
@Test
public void testDivide() {
- FixedDecimal value1 = FixedDecimal32.valueOf("25200");
- FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal.valueOf("25200");
+ FixedDecimal value2 = FixedDecimal.valueOf("112");
FixedDecimal quotient = value1.divide(value2);
assertThat(quotient.unscaledValue()).isEqualTo(225);
assertThat(quotient.scale()).isEqualTo(0);
- value1 = FixedDecimal32.valueOf("25371.9648");
- value2 = FixedDecimal32.valueOf("112.32");
+ value1 = FixedDecimal.valueOf("25371.9648");
+ value2 = FixedDecimal.valueOf("112.32");
quotient = value1.divide(value2);
assertThat(quotient.unscaledValue()).isEqualTo(22_589);
assertThat(quotient.scale()).isEqualTo(2);
@@ -355,12 +355,12 @@
*/
@Test
public void testNegate() {
- FixedDecimal value1 = FixedDecimal32.valueOf("25200");
+ FixedDecimal value1 = FixedDecimal.valueOf("25200");
FixedDecimal negative = value1.negate();
assertThat(negative.unscaledValue()).isEqualTo(-25_200);
assertThat(negative.scale()).isEqualTo(0);
- value1 = FixedDecimal32.valueOf("-112.32");
+ value1 = FixedDecimal.valueOf("-112.32");
negative = value1.negate();
assertThat(negative.unscaledValue()).isEqualTo(11232);
assertThat(negative.scale()).isEqualTo(2);
@@ -371,13 +371,13 @@
*/
@Test
public void testAbs() {
- FixedDecimal value1 = FixedDecimal32.valueOf("25200");
+ FixedDecimal value1 = FixedDecimal.valueOf("25200");
FixedDecimal abs = value1.abs();
assertThat(abs.unscaledValue()).isEqualTo(25_200);
assertThat(abs.scale()).isEqualTo(0);
assertThat(value1).isSameAs(abs);
- value1 = FixedDecimal32.valueOf("-112.32");
+ value1 = FixedDecimal.valueOf("-112.32");
abs = value1.abs();
assertThat(abs.unscaledValue()).isEqualTo(11232);
assertThat(abs.scale()).isEqualTo(2);
@@ -388,11 +388,11 @@
*/
@Test
public void testFloatValue() {
- FixedDecimal value1 = FixedDecimal32.valueOf("25200");
+ FixedDecimal value1 = FixedDecimal.valueOf("25200");
float result = value1.floatValue();
assertThat(result).isEqualTo(25_200f);
- value1 = FixedDecimal32.valueOf("-112.32");
+ value1 = FixedDecimal.valueOf("-112.32");
result = value1.floatValue();
assertThat(result).isEqualTo(-112.32f);
}
@@ -402,10 +402,10 @@
*/
@Test
public void testIntValueExact() {
- final FixedDecimal value1 = FixedDecimal32.valueOf("25200");
+ final FixedDecimal value1 = FixedDecimal.valueOf("25200");
assertThat(value1.intValueExact()).isEqualTo(25_200);
- final FixedDecimal value2 = FixedDecimal32.valueOf("-112.32");
+ final FixedDecimal value2 = FixedDecimal.valueOf("-112.32");
assertThatExceptionOfType(ArithmeticException.class).isThrownBy(() -> {
value2.intValueExact();
});
@@ -417,21 +417,21 @@
@Test
public void testRound() {
MathContext mc = new MathContext(5, RoundingMode.HALF_UP);
- FixedDecimal actual = FixedDecimal32.valueOf("25200").round(mc);
- FixedDecimal expected = FixedDecimal32.valueOf("25200");
+ FixedDecimal actual = FixedDecimal.valueOf("25200").round(mc);
+ FixedDecimal expected = FixedDecimal.valueOf("25200");
assertThat(actual).isEqualTo(expected);
mc = new MathContext(3, RoundingMode.HALF_UP);
- actual = FixedDecimal32.valueOf("25.925").round(mc);
- expected = FixedDecimal32.valueOf("25.9");
+ actual = FixedDecimal.valueOf("25.925").round(mc);
+ expected = FixedDecimal.valueOf("25.9");
assertThat(actual).isEqualTo(expected);
- actual = FixedDecimal32.valueOf("25.55").round(mc);
- expected = FixedDecimal32.valueOf("25.6");
+ actual = FixedDecimal.valueOf("25.55").round(mc);
+ expected = FixedDecimal.valueOf("25.6");
assertThat(actual).isEqualTo(expected);
- actual = FixedDecimal32.valueOf("25.54").round(mc);
- expected = FixedDecimal32.valueOf("25.5");
+ actual = FixedDecimal.valueOf("25.54").round(mc);
+ expected = FixedDecimal.valueOf("25.5");
assertThat(actual).isEqualTo(expected);
}
@@ -440,7 +440,7 @@
*/
@Test
public void testClone() {
- final FixedDecimal value1 = FixedDecimal32.valueOf("25200");
+ final FixedDecimal value1 = FixedDecimal.valueOf("25200");
assertThat(value1.clone()).isSameAs(value1);
}
@@ -449,11 +449,11 @@
*/
@Test
public void testEquals() {
- final FixedDecimal value1 = FixedDecimal32.valueOf("25.201");
- final FixedDecimal value2 = FixedDecimal32.valueOf(25201, 3);
+ final FixedDecimal value1 = FixedDecimal.valueOf("25.201");
+ final FixedDecimal value2 = FixedDecimal.valueOf(25201, 3);
assertThat(value1.clone()).isEqualTo(value2);
- final FixedDecimal value3 = FixedDecimal32.valueOf("25.2010");
+ final FixedDecimal value3 = FixedDecimal.valueOf("25.2010");
assertThat(value1.clone()).isNotEqualTo(value3);
}
@@ -462,13 +462,13 @@
*/
@Test
public void testToString() {
- FixedDecimal value1 = FixedDecimal32.valueOf("25.201");
+ FixedDecimal value1 = FixedDecimal.valueOf("25.201");
assertThat(value1.toString()).isEqualTo("25.201");
- value1 = FixedDecimal32.valueOf("-213.99");
+ value1 = FixedDecimal.valueOf("-213.99");
assertThat(value1.toString()).isEqualTo("-213.99");
- value1 = FixedDecimal32.valueOf("-2.002");
+ value1 = FixedDecimal.valueOf("-2.002");
assertThat(value1.toString()).isEqualTo("-2.002");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-04-30 17:20:17
|
Revision: 3031
http://sourceforge.net/p/axsl/code/3031
Author: victormote
Date: 2026-04-30 17:20:15 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
Convert URL return types in FO tree to URI, as specified.
Modified Paths:
--------------
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoTree.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonAccessibilityPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonAuralNotInheritedPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonBorderPaddingBgPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ExternalDestinationPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/SrcPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetPresentationContextPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetProcessingContextPa.java
trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetStylesheetPa.java
trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/AreaG5.java
trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/ExternalDestinationTa.java
trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicServer.java
trunk/axsl/axsl-value/src/main/java/org/axsl/value/UriConstants.java
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoTree.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoTree.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/FoTree.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -40,17 +40,6 @@
* <li>If needed, use {@link FoTreeParser#getFoTree()} to obtain the {@link FoTree} instance that was just parsed.
* This is the same instance retrieved above.
* </ol>
- *
- * <p>The XSL-FO Recommendation specifies several XSL-FO property values as a "uri-specification."
- * A "uri-specification" as defined in that Recommendation is an IRI/URI reference enclosed between the parentheses of
- * the string "url()".
- * For example, the URI "http.something" would be expressed in the "uri-specification" as "url(http.something)".
- * This appears to be a function that converts the IRI/URI to a URL.
- * Also, an IRI/URI that cannot be converted to a URL is worthless as a return type for any property that actually needs
- * to locate a resource.
- * For these reasons, for those properties, we have chosen to return a {@link java.net.URL} instead of a
- * {@link java.net.URI}.</p>
-
*/
public interface FoTree {
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonAccessibilityPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonAccessibilityPa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonAccessibilityPa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -25,7 +25,7 @@
import org.axsl.fotree.FoContext;
-import java.net.URL;
+import java.net.URI;
import java.util.List;
/**
@@ -39,16 +39,14 @@
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
* @return The source-document trait, or null if it is "none".
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL}s instead of
- * {@link java.net.URI}s.
* @see "XSL-FO Recommendation 1.0, Section 7.4.1"
* @see "XSL-FO Recommendation 1.1, Section 7.5.1"
*/
- List<URL> traitSourceDocument(FoContext context);
+ List<URI> traitSourceDocument(FoContext context);
/**
* Returns the "role" trait for this FO if that trait was created as a semantic identifier.
- * If it was instead created as a {@link URL} to an RDF resource, see {@link #traitRoleRdfResource(FoContext)}.
+ * If it was instead created as a {@link URI} to an RDF resource, see {@link #traitRoleRdfResource(FoContext)}.
* If "none" was specified, then both methods will return null.
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
@@ -60,18 +58,16 @@
String traitRoleIdentifier(FoContext context);
/**
- * Returns the "role" trait for this FO if that trait was created as a {@link URL} to an RDF resource.
+ * Returns the "role" trait for this FO if that trait was created as a {@link URI} to an RDF resource.
* If it was instead created as a semantic identifier, see {@link #traitRoleIdentifier(FoContext)}.
* If "none" was specified, then both methods will return null.
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
- * @return The "role" trait, if an only if it was created as a {@link URL} to an RDF resource.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
+ * @return The "role" trait, if an only if it was created as a {@link URI} to an RDF resource.
* @see #traitRoleIdentifier(FoContext)
* @see "XSL-FO Recommendation 1.0, Section 7.4.2"
* @see "XSL-FO Recommendation 1.1, Section 7.5.2"
*/
- URL traitRoleRdfResource(FoContext context);
+ URI traitRoleRdfResource(FoContext context);
}
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonAuralNotInheritedPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonAuralNotInheritedPa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonAuralNotInheritedPa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -25,7 +25,7 @@
import org.axsl.fotree.FoContext;
-import java.net.URL;
+import java.net.URI;
/**
* The XSL-FO Common Aural properties.
@@ -38,12 +38,10 @@
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
* @return The "cue-after" trait.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.0, Section 7.6.2"
* @see "XSL-FO Recommendation 1.1, Section 7.7.2"
*/
- URL traitCueAfter(FoContext context);
+ URI traitCueAfter(FoContext context);
/**
* Returns the "cue-before" trait for this FO.
@@ -50,12 +48,10 @@
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
* @return The "cue-before" trait.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.0, Section 7.6.3"
* @see "XSL-FO Recommendation 1.1, Section 7.7.3"
*/
- URL traitCueBefore(FoContext context);
+ URI traitCueBefore(FoContext context);
/**
* Returns the "pause-after" trait for this FO, in milliseconds.
@@ -85,14 +81,12 @@
* The special return value of {@link org.axsl.value.UriConstants#AUTO} indicates a value of "auto", that is, that
* the sound (if any) of the parent element should continue to play.
* The special return value of null indicates a value of "none", that is, that no sound should be played at all.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.0, Section 7.6.9"
* @see "XSL-FO Recommendation 1.1, Section 7.7.9"
* @see #traitPlayDuringMix(FoContext)
* @see #traitPlayDuringRepeat(FoContext)
*/
- URL traitPlayDuring(FoContext context);
+ URI traitPlayDuring(FoContext context);
/**
* Returns the "mix" component of the "play-during" trait for this FO.
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonBorderPaddingBgPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonBorderPaddingBgPa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/CommonBorderPaddingBgPa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -29,7 +29,7 @@
import org.axsl.value.BorderStyle;
import java.awt.Color;
-import java.net.URL;
+import java.net.URI;
/**
* The XSL-FO Common Border, Padding, and Background properties.
@@ -63,12 +63,10 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The location of the background image for this FO, or null if none was specified or if the one specified
* cannot be resolved.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.0, Section 7.7.3"
* @see "XSL-FO Recommendation 1.1, Section 7.8.3"
*/
- URL traitBackgroundImage(FoContext context);
+ URI traitBackgroundImage(FoContext context);
/**
* Returns the "background-repeat" trait for this FO.
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ExternalDestinationPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ExternalDestinationPa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/ExternalDestinationPa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -23,7 +23,7 @@
package org.axsl.fotree.fo.prop;
-import java.net.URL;
+import java.net.URI;
/**
* The XSL-FO external-destination property.
@@ -35,10 +35,8 @@
* This trait is not inherited.
* @return The URI containing the location of the external-destination, or null which implies the "empty string"
* value.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.1, Section 7.23.6."
*/
- URL traitExternalDestination();
+ URI traitExternalDestination();
}
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/SrcPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/SrcPa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/SrcPa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -25,9 +25,8 @@
import org.axsl.fotree.FoContext;
-import java.net.URL;
+import java.net.URI;
-
/**
* The XSL-FO src property.
*/
@@ -38,11 +37,9 @@
* This trait is not inherited.
* @param context An object that knows how to resolve FO Tree context issues.
* @return The "src" trait for this FO, or null if it has none.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.0, Section 7.28.7"
* @see "XSL-FO Recommendation 1.1, Section 7.30.16"
*/
- URL traitSrc(FoContext context);
+ URI traitSrc(FoContext context);
}
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetPresentationContextPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetPresentationContextPa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetPresentationContextPa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -23,7 +23,7 @@
package org.axsl.fotree.fo.prop;
-import java.net.URL;
+import java.net.URI;
/**
* The XSL-FO target-presentation-context property.
@@ -34,11 +34,9 @@
* Returns the "target-presentation-context" trait for this FO.
* This trait is not inherited.
* @return Either a uri-specification or null if the "target-processing-context" should be used.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.0, Section 7.22.12"
* @see "XSL-FO Recommendation 1.1, Section 7.23.12"
*/
- URL traitTargetPresentationContext();
+ URI traitTargetPresentationContext();
}
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetProcessingContextPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetProcessingContextPa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetProcessingContextPa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -23,7 +23,7 @@
package org.axsl.fotree.fo.prop;
-import java.net.URL;
+import java.net.URI;
/**
* The XSL-FO target-processing-context property.
@@ -34,11 +34,9 @@
* Returns the "target-processing-context" trait for this FO.
* This trait is not inherited.
* @return Either a uri-specification or null if the document root should be used.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.0, Section 7.22.13"
* @see "XSL-FO Recommendation 1.1, Section 7.23.13"
*/
- URL traitTargetProcessingContext();
+ URI traitTargetProcessingContext();
}
Modified: trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetStylesheetPa.java
===================================================================
--- trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetStylesheetPa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-fotree/src/main/java/org/axsl/fotree/fo/prop/TargetStylesheetPa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -23,7 +23,7 @@
package org.axsl.fotree.fo.prop;
-import java.net.URL;
+import java.net.URI;
/**
* The XSL-FO target-stylesheet property.
@@ -34,11 +34,9 @@
* Returns the "target-stylesheet" trait for this FO.
* This trait is not inherited.
* @return Either a uri-specification or null if "use-normal-stylesheet" should be used.
- * See {@link org.axsl.fotree.FoTree} for an explanation of why this method returns {@link java.net.URL} instead of
- * {@link java.net.URI}.
* @see "XSL-FO Recommendation 1.0, Section 7.22.14"
* @see "XSL-FO Recommendation 1.1, Section 7.23.14"
*/
- URL traitTargetStylesheet();
+ URI traitTargetStylesheet();
}
Modified: trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/AreaG5.java
===================================================================
--- trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/AreaG5.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/AreaG5.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -27,7 +27,7 @@
import org.axsl.galley.trait.GeneratedByProxyTa;
import org.axsl.value.LinkType;
-import java.net.URL;
+import java.net.URI;
/**
* Super-interface for all AreaNodes that actually occupy Area on a page.
@@ -147,7 +147,7 @@
* @return The external-destination for the ancestor fo:basic-link, or null if there is no such ancestor, or if that
* ancestor is linked to an internal-destination.
*/
- URL linkExternalDestination();
+ URI linkExternalDestination();
/**
* If this Area is descended from a fo:basic-link and if that link has an internal-destination, return that link
Modified: trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/ExternalDestinationTa.java
===================================================================
--- trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/ExternalDestinationTa.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-galley/src/main/java/org/axsl/galley/trait/ExternalDestinationTa.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -23,7 +23,7 @@
package org.axsl.galley.trait;
-import java.net.URL;
+import java.net.URI;
/**
* Accessor for the "external-destination" trait.
@@ -34,6 +34,6 @@
* Returns the external destination for this area.
* @return The external-destination trait, or null if there is no external destination.
*/
- URL traitExternalDestination();
+ URI traitExternalDestination();
}
Modified: trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicServer.java
===================================================================
--- trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicServer.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-graphic/src/main/java/org/axsl/graphic/GraphicServer.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -28,7 +28,7 @@
import java.io.IOException;
import java.io.OutputStream;
-import java.net.URL;
+import java.net.URI;
/**
* Interface for creating Graphic objects.
@@ -44,7 +44,7 @@
* @return The Graphic instance.
* @throws GraphicException For errors during construction.
*/
- Graphic procureGraphic(URL graphicLocation, boolean cacheThisGraphic) throws GraphicException;
+ Graphic procureGraphic(URI graphicLocation, boolean cacheThisGraphic) throws GraphicException;
/**
* Factory method to find or create an {@link SvgGraphic} instance from an already-parsed {@link SVGDocument}.
Modified: trunk/axsl/axsl-value/src/main/java/org/axsl/value/UriConstants.java
===================================================================
--- trunk/axsl/axsl-value/src/main/java/org/axsl/value/UriConstants.java 2026-04-30 15:11:58 UTC (rev 3030)
+++ trunk/axsl/axsl-value/src/main/java/org/axsl/value/UriConstants.java 2026-04-30 17:20:15 UTC (rev 3031)
@@ -23,8 +23,8 @@
package org.axsl.value;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
/**
* URL constants used to signify special cases where a URL is expected.
@@ -31,12 +31,12 @@
*/
public final class UriConstants {
- /** Bogus URL signalling a value of "auto". */
- public static final URL AUTO;
+ /** Bogus URI signalling a value of "auto". */
+ public static final URI AUTO;
static {
try {
- AUTO = new URL("auto", null, null);
- } catch (final MalformedURLException e) {
+ AUTO = new URI("auto", null, null);
+ } catch (final URISyntaxException e) {
throw new IllegalStateException(e);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-04-30 15:11:59
|
Revision: 3030
http://sourceforge.net/p/axsl/code/3030
Author: victormote
Date: 2026-04-30 15:11:58 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
Reordering of config for clarity. No change to content.
Modified Paths:
--------------
trunk/axsl/buildSrc/src/main/groovy/axsl.java-library-conventions.gradle
Modified: trunk/axsl/buildSrc/src/main/groovy/axsl.java-library-conventions.gradle
===================================================================
--- trunk/axsl/buildSrc/src/main/groovy/axsl.java-library-conventions.gradle 2026-04-30 15:00:35 UTC (rev 3029)
+++ trunk/axsl/buildSrc/src/main/groovy/axsl.java-library-conventions.gradle 2026-04-30 15:11:58 UTC (rev 3030)
@@ -9,9 +9,12 @@
}
-tasks.withType(Javadoc) {
- /* We use checkstyle for this purpose. Suppress javadoc direct complaints. */
- options.addStringOption('Xdoclint:none', '-quiet')
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ toolchain {
+ languageVersion.set(JavaLanguageVersion.of(21))
+ }
}
@@ -24,12 +27,32 @@
}
-task packageSources(type: Jar, dependsOn:classes) {
- archiveClassifier = 'sources'
- from sourceSets.main.allSource
+javadoc {
+ configure(options) {
+ tags(
+ 'apiNote:a:API Note:',
+ 'implSpec:a:Implementation Requirements:',
+ 'implNote:a:Implementation Note:'
+ )
+ }
+
+ failOnError = true
+ options.encoding = 'UTF-8'
+ options.author = false
+ options.version = true
+ options.use = true
+ options.memberLevel = JavadocMemberLevel.PROTECTED
+ options.bottom = "<p>This documentation was created ${buildDate} by <a href=\"http://www.axsl.org\"" +
+ "target=\"_new\">The aXSL Group</a> and may be freely copied. See license for details.</p>"
}
+tasks.withType(Javadoc) {
+ /* We use checkstyle for this purpose. Suppress javadoc direct complaints. */
+ options.addStringOption('Xdoclint:none', '-quiet')
+}
+
+
task packageJavadocs(type: Jar, dependsOn:javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
@@ -36,12 +59,9 @@
}
-java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
- toolchain {
- languageVersion.set(JavaLanguageVersion.of(21))
- }
+task packageSources(type: Jar, dependsOn:classes) {
+ archiveClassifier = 'sources'
+ from sourceSets.main.allSource
}
@@ -82,28 +102,6 @@
suppressPomMetadataWarningsFor('testFixturesRuntimeElements')
}
}
-
-
-javadoc {
- configure(options) {
- tags(
- 'apiNote:a:API Note:',
- 'implSpec:a:Implementation Requirements:',
- 'implNote:a:Implementation Note:'
- )
- }
-
- failOnError = true
- options.encoding = 'UTF-8'
- options.author = false
- options.version = true
- options.use = true
- options.memberLevel = JavadocMemberLevel.PROTECTED
- options.bottom = "<p>This documentation was created ${buildDate} by <a href=\"http://www.axsl.org\"" +
- "target=\"_new\">The aXSL Group</a> and may be freely copied. See license for details.</p>"
}
-
-}
-
/* Last line of script. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-04-30 15:00:37
|
Revision: 3029
http://sourceforge.net/p/axsl/code/3029
Author: victormote
Date: 2026-04-30 15:00:35 +0000 (Thu, 30 Apr 2026)
Log Message:
-----------
Upgrade checkstyle to 13.4.1. To support this, upgrade the Java toolchain version from 17 to 21.
Modified Paths:
--------------
trunk/axsl/buildSrc/src/main/groovy/axsl.java-library-conventions.gradle
Modified: trunk/axsl/buildSrc/src/main/groovy/axsl.java-library-conventions.gradle
===================================================================
--- trunk/axsl/buildSrc/src/main/groovy/axsl.java-library-conventions.gradle 2026-04-29 20:37:33 UTC (rev 3028)
+++ trunk/axsl/buildSrc/src/main/groovy/axsl.java-library-conventions.gradle 2026-04-30 15:00:35 UTC (rev 3029)
@@ -17,6 +17,10 @@
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
+ /* Suppress the following compiler complaint:
+ warning: [options] source value 8 is obsolete and will be removed in a future release
+ */
+ options.compilerArgs += ['-Xlint:-options']
}
@@ -36,7 +40,7 @@
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain {
- languageVersion.set(JavaLanguageVersion.of(17))
+ languageVersion.set(JavaLanguageVersion.of(21))
}
}
@@ -45,10 +49,13 @@
configFile = new File(rootProject.projectDir.absolutePath + '/axsl-00-dev/config/checkstyle/checkstyle-config.xml')
configProperties.put('axsl.root', rootProject.projectDir)
- /* The latest version of checkstyle as of 2025-06-11 is 10.25. As of that same date, the current Eclipse plugin for
- checkstyle uses Checkstyle 10.23.0. We will use that for now to avoid configuration conflicts between the two
- versions. */
- toolVersion = "10.23.0"
+ /* To avoid configuration conflicts, we wish to use the latest version of Checkstyle that is supported by the
+ Eclipse plugin.
+ As of 2026-04-30, the latest version of Checkstyle is 13.4.1.
+ As of that same date, the current Eclipse plugin supports 13.4.0.
+ We think that using a maintenance release should not cause config differences.
+ */
+ toolVersion = "13.4.1"
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-04-29 20:37:36
|
Revision: 3028
http://sourceforge.net/p/axsl/code/3028
Author: victormote
Date: 2026-04-29 20:37:33 +0000 (Wed, 29 Apr 2026)
Log Message:
-----------
1. Add more FixedDecimal implementation classes. 2. General fixes to existing implementations. 3. Convert axsl-ps implementations to FixedDecimal.
Modified Paths:
--------------
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java
trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsFontPrivateDictionary.java
Added Paths:
-----------
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java 2026-04-28 16:58:47 UTC (rev 3027)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -26,6 +26,7 @@
package org.axsl.primitive.fixed;
import java.math.BigDecimal;
+import java.math.BigInteger;
import java.math.MathContext;
/**
@@ -85,34 +86,34 @@
}
@Override
- public BigDecimal toBigDecimal() {
+ public BigDecimal bigDecimalValue() {
return this.wrapped;
}
@Override
public int compareTo(final FixedDecimal o) {
- final BigDecimal otherBd = o instanceof FixedBigDecimal ? ((FixedBigDecimal) o).wrapped : o.toBigDecimal();
+ final BigDecimal otherBd = o instanceof FixedBigDecimal ? ((FixedBigDecimal) o).wrapped : o.bigDecimalValue();
return this.wrapped.compareTo(otherBd);
}
@Override
public FixedBigDecimal add(final FixedDecimal addend) {
- return new FixedBigDecimal(this.wrapped.add(addend.toBigDecimal()));
+ return new FixedBigDecimal(this.wrapped.add(addend.bigDecimalValue()));
}
@Override
public FixedBigDecimal subtract(final FixedDecimal subtrahend) {
- return new FixedBigDecimal(this.wrapped.subtract(subtrahend.toBigDecimal()));
+ return new FixedBigDecimal(this.wrapped.subtract(subtrahend.bigDecimalValue()));
}
@Override
public FixedBigDecimal multiply(final FixedDecimal multiplier) {
- return new FixedBigDecimal(this.wrapped.multiply(multiplier.toBigDecimal()));
+ return new FixedBigDecimal(this.wrapped.multiply(multiplier.bigDecimalValue()));
}
@Override
public FixedBigDecimal divide(final FixedDecimal divisor) {
- return new FixedBigDecimal(this.wrapped.divide(divisor.toBigDecimal()));
+ return new FixedBigDecimal(this.wrapped.divide(divisor.bigDecimalValue()));
}
@Override
@@ -135,6 +136,34 @@
return new FixedBigDecimal(this.wrapped.round(mc));
}
-/* Checkstyle: Restart BigDecimal checking.*/
+ @Override
+ public String toString() {
+ return this.wrapped.toString();
+ }
+ @Override
+ public int whole() {
+ if (this.scale() == 0) {
+ return this.wrapped.unscaledValue().intValueExact();
+ }
+ final BigInteger conversionFactor = BigInteger.TEN.pow(this.scale());
+ return this.wrapped.unscaledValue().divide(conversionFactor).intValueExact();
+ }
+
+ @Override
+ public int fractional() {
+ if (this.scale() == 0) {
+ return 0;
+ }
+ final BigInteger conversionFactor = BigInteger.TEN.pow(this.scale());
+ return this.wrapped.unscaledValue().remainder(conversionFactor).intValueExact();
+ }
+
+ @Override
+ public int signum() {
+ return this.wrapped.signum();
+ }
+
+ /* Checkstyle: Restart BigDecimal checking.*/
+
}
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-04-28 16:58:47 UTC (rev 3027)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -93,7 +93,7 @@
* Returns the value of this as a {@link BigDecimal}.
* @return The value of this as a {@link BigDecimal}.
*/
- default BigDecimal toBigDecimal() {
+ default BigDecimal bigDecimalValue() {
return BigDecimal.valueOf(unscaledValue(), scale());
}
@@ -107,11 +107,28 @@
* @see Number#floatValue()
*/
default float floatValue() {
- return BigDecimal.valueOf(this.unscaledValue(), this.scale()).floatValue();
+// return BigDecimal.valueOf(this.unscaledValue(), this.scale()).floatValue();
+ return Float.valueOf(toString());
}
/* Checkstyle: Restart float and double checking." */
+ /**
+ * Returns the whole number portion of this fixed-point.
+ * @return The whole number portion of this.
+ * For example, for 123.456, returns 123.
+ */
+ int whole();
+
+ /**
+ * Returns the fractional portion of this fixed-point.
+ * @return The fractional portion of this.
+ * For example, for 123.456, returns 456.
+ * Caveat: This number is only meaningful when scale is considered.
+ * A value of 1 is .001 when the scale is 3 but .1 when the scale is 1.
+ */
+ int fractional();
+
@Override
int compareTo(FixedDecimal o);
@@ -227,6 +244,12 @@
* Mutable implementations should provide an implementation that does a deep copy.
* @return A clone of this object.
*/
- FixedDecimal clone() throws CloneNotSupportedException;
+ FixedDecimal clone();
+ /**
+ * Returns the signum function of this {@code FixedDecimal}.
+ * @return -1, 0, or 1 as the value of this {@code FixedDecimal} is negative, zero, or positive.
+ */
+ int signum();
+
}
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-04-28 16:58:47 UTC (rev 3027)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -56,12 +56,24 @@
/** Constant for the scale of 3. */
protected static final int SCALE_03 = 3;
- /** Constant for the scale of 3. */
+ /** Constant for the scale of 4. */
protected static final int SCALE_04 = 4;
- /** Constant for the scale of 3. */
+ /** Constant for the scale of 5. */
protected static final int SCALE_05 = 5;
+ /** Constant for the scale of 6. */
+ protected static final int SCALE_06 = 6;
+
+ /** Constant for the scale of 7. */
+ protected static final int SCALE_07 = 7;
+
+ /** Constant for the scale of 8. */
+ protected static final int SCALE_08 = 8;
+
+ /** Constant for the scale of 9. */
+ protected static final int SCALE_09 = 9;
+
/**
* Enumeration of configurations for fixed-point classes.
*/
@@ -79,12 +91,24 @@
/** Scale of 3. */
CONFIG_03(3, 1000),
- /** Scale of 3. */
+ /** Scale of 4. */
CONFIG_04(4, 10_000),
- /** Scale of 3. */
- CONFIG_05(5, 100_000);
+ /** Scale of 5. */
+ CONFIG_05(5, 100_000),
+ /** Scale of 6. */
+ CONFIG_06(6, 1_000_000),
+
+ /** Scale of 7. */
+ CONFIG_07(7, 10_000_000),
+
+ /** Scale of 8. */
+ CONFIG_08(8, 100_000_000),
+
+ /** Scale of 9. */
+ CONFIG_09(9, 1_000_000_000);
+
/** The scale for this configuration. */
private int scale;
@@ -134,11 +158,12 @@
* Factory method.
* @param scale The scale of the fixed-point to be acquired.
* @param unscaledValue The unscaledValue of the fixed-point to be acquired.
- * @return An instance matching {@code scale} and {@code unscaledValue}.
+ * @return An instance matching {@code scale} and {@code unscaledValue}, or null if outside of range or no
+ * implementation can be found.
* @throws IllegalArgumentException For an unknown scale.
* @see BigDecimal#valueOf(long, int)
*/
- public static FixedDecimal32 valueOf(final int unscaledValue, final int scale) {
+ public static FixedDecimal valueOf(final int unscaledValue, final int scale) {
switch (scale) {
case SCALE_00: return new FixedDecimal32_00(unscaledValue);
case SCALE_01: return new FixedDecimal32_01(unscaledValue);
@@ -146,8 +171,12 @@
case SCALE_03: return new FixedDecimal32_03(unscaledValue);
case SCALE_04: return new FixedDecimal32_04(unscaledValue);
case SCALE_05: return new FixedDecimal32_05(unscaledValue);
+ case SCALE_06: return new FixedDecimal32_06(unscaledValue);
+ case SCALE_07: return new FixedDecimal32_07(unscaledValue);
+ case SCALE_08: return new FixedDecimal32_08(unscaledValue);
+ case SCALE_09: return new FixedDecimal32_09(unscaledValue);
}
- throw new IllegalArgumentException("Implementation not found for scale: " + scale);
+ return null;
}
/**
@@ -154,10 +183,17 @@
* Factory method.
* @param bd The BigDecimal to be converted to an instance of {@link FixedDecimal32}.
* @return An instance whose values match {@code bd}.
- * @see org.axsl.primitive.fixed.FixedBigDecimal#FixedBigDecimal(BigDecimal)
+ * @throws ArithmeticException If {@code bd} is out of range for the int type.
*/
- public static FixedDecimal32 valueOf(final BigDecimal bd) {
- return valueOf(bd.unscaledValue().intValueExact(), bd.scale());
+ public static FixedDecimal valueOf(final BigDecimal bd) {
+ final int unscaledValue;
+ try {
+ unscaledValue = bd.unscaledValue().intValueExact();
+ } catch (final ArithmeticException e) {
+ return new FixedBigDecimal(bd);
+ }
+ final FixedDecimal fd32 = valueOf(unscaledValue, bd.scale());
+ return fd32 == null ? new FixedBigDecimal(bd) : fd32;
}
/**
@@ -175,7 +211,7 @@
* @return An instance matching {@code numeric}.
* @throws NumberFormatException For invalid values of {@code numeric}.
*/
- public static FixedDecimal32 valueOf(final CharSequence numeric) {
+ public static FixedDecimal valueOf(final CharSequence numeric) {
final String numericString = numeric.toString();
final int decimalIndex = numericString.indexOf('.');
if (decimalIndex < 0) {
@@ -217,6 +253,21 @@
if (this == other) {
return true;
}
+ if (other instanceof BigDecimal) {
+ final BigDecimal bd = (BigDecimal) other;
+ if (this.scale() != bd.scale()) {
+ return false;
+ }
+ try {
+ if (this.unscaledValue != bd.unscaledValue().intValueExact()) {
+ return false;
+ }
+ } catch (final ArithmeticException e) {
+ /* The BigDecimal unscaled exceeds int capacity. */
+ return false;
+ }
+ return true;
+ }
if (! (other instanceof FixedDecimal)) {
return false;
}
@@ -230,11 +281,7 @@
return true;
}
- /**
- * Returns the whole number portion of this fixed-point.
- * @return The whole number portion of this.
- * For example, for 123.456, returns 123.
- */
+ @Override
public int whole() {
if (scale() == 0) {
return this.unscaledValue;
@@ -242,24 +289,33 @@
return this.unscaledValue / getConfig().conversionFactor;
}
- /**
- * Returns the fractional portion of this fixed-point.
- * @return The fractional portion of this.
- * For example, for 123.456, returns 456.
- */
+ @Override
public int fractional() {
if (scale() == 0) {
return 0;
}
- return this.unscaledValue % getConfig().conversionFactor;
+ return Math.abs(unscaledValue % getConfig().conversionFactor);
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
- builder.append(whole());
- builder.append(".");
- builder.append(fractional());
+ final int whole = whole();
+ if (whole == 0
+ && signum() < 0) {
+ builder.append("-");
+ }
+ builder.append(Integer.toString(whole));
+ if (scale() > 0) {
+ builder.append(".");
+ final String fractional = Long.toString(fractional());
+ int digitsToPad = scale() - fractional.length();
+ while (digitsToPad > 0) {
+ builder.append("0");
+ digitsToPad --;
+ }
+ builder.append(fractional());
+ }
return builder.toString();
}
@@ -268,59 +324,62 @@
if (this.scale() == other.scale()) {
return this.unscaledValue - other.unscaledValue();
}
- final FixedDecimal32 other4a = other instanceof FixedDecimal32 ? (FixedDecimal32) other :
+ final FixedDecimal other4a = other instanceof FixedDecimal32 ? (FixedDecimal32) other :
FixedDecimal32.valueOf(other.unscaledValue(), other.scale());
- final int whole1 = this.whole();
- final int whole2 = other4a.whole();
+ final long whole1 = this.whole();
+ final long whole2 = other4a.whole();
if (whole1 == whole2) {
- final int fractional1 = this.fractional();
- final int fractional2 = other4a.fractional();
- return fractional1 - fractional2;
+ final long fractional1 = this.fractional();
+ final long fractional2 = other4a.fractional();
+ return (int) (fractional1 - fractional2);
}
- return whole1 - whole2;
+ return (int) (whole1 - whole2);
}
@Override
- public FixedDecimal32 add(final FixedDecimal addend) {
- final BigDecimal result = toBigDecimal().add(addend.toBigDecimal());
+ public FixedDecimal add(final FixedDecimal addend) {
+ final BigDecimal result = bigDecimalValue().add(addend.bigDecimalValue());
return valueOf(result);
}
@Override
- public FixedDecimal32 subtract(final FixedDecimal subtrahend) {
- final BigDecimal result = toBigDecimal().subtract(subtrahend.toBigDecimal());
+ public FixedDecimal subtract(final FixedDecimal subtrahend) {
+ final BigDecimal result = bigDecimalValue().subtract(subtrahend.bigDecimalValue());
return valueOf(result);
}
@Override
- public FixedDecimal32 multiply(final FixedDecimal multiplier) {
- final BigDecimal result = toBigDecimal().multiply(multiplier.toBigDecimal());
+ public FixedDecimal multiply(final FixedDecimal multiplier) {
+ final BigDecimal result = bigDecimalValue().multiply(multiplier.bigDecimalValue());
return valueOf(result);
}
@Override
- public FixedDecimal32 divide(final FixedDecimal divisor) {
- final BigDecimal result = toBigDecimal().divide(divisor.toBigDecimal(), MathContext.DECIMAL32);
+ public FixedDecimal divide(final FixedDecimal divisor) {
+ final BigDecimal result = bigDecimalValue().divide(divisor.bigDecimalValue(), MathContext.DECIMAL32);
return valueOf(result);
}
@Override
- public FixedDecimal32 negate() {
+ public FixedDecimal negate() {
return valueOf(this.unscaledValue * -1, this.scale());
}
@Override
- public FixedDecimal32 abs() {
+ public FixedDecimal abs() {
return this.unscaledValue < 0 ? negate() : this;
}
@Override
- public FixedDecimal32 round(final MathContext mc) {
- return valueOf(toBigDecimal().round(mc));
+ public FixedDecimal round(final MathContext mc) {
+ return valueOf(bigDecimalValue().round(mc));
}
@Override
public int intValueExact() {
+ if (scale() == 0) {
+ return unscaledValue();
+ }
if (fractional() == 0) {
return whole();
}
@@ -332,6 +391,11 @@
return this;
}
+ @Override
+ public int signum() {
+ return Integer.signum(this.unscaledValue);
+ }
+
/* Checkstyle: Restart BigDecimal checking.*/
}
Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java (rev 0)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2026 The aXSL Project.
+ * http://www.axsl.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate $
+ * $LastChangedBy$
+ */
+
+package org.axsl.primitive.fixed;
+
+/**
+ * <p>A fixed-point value with a scale of 6.</p>
+ *
+ * <p>Instances of this class are immutable.</p>
+ */
+public final class FixedDecimal32_06 extends FixedDecimal32 {
+
+ /**
+ * Constructor.
+ * @param unscaledValue The unscaledValue of this fixed-point value.
+ */
+ protected FixedDecimal32_06(final int unscaledValue) {
+ super(unscaledValue);
+ }
+
+ @Override
+ public Config getConfig() {
+ return Config.CONFIG_06;
+ }
+
+}
Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_06.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java (rev 0)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2026 The aXSL Project.
+ * http://www.axsl.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate $
+ * $LastChangedBy$
+ */
+
+package org.axsl.primitive.fixed;
+
+/**
+ * <p>A fixed-point value with a scale of 7.</p>
+ *
+ * <p>Instances of this class are immutable.</p>
+ */
+public final class FixedDecimal32_07 extends FixedDecimal32 {
+
+ /**
+ * Constructor.
+ * @param unscaledValue The unscaledValue of this fixed-point value.
+ */
+ protected FixedDecimal32_07(final int unscaledValue) {
+ super(unscaledValue);
+ }
+
+ @Override
+ public Config getConfig() {
+ return Config.CONFIG_07;
+ }
+
+}
Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_07.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java (rev 0)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2026 The aXSL Project.
+ * http://www.axsl.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate $
+ * $LastChangedBy$
+ */
+
+package org.axsl.primitive.fixed;
+
+/**
+ * <p>A fixed-point value with a scale of 8.</p>
+ *
+ * <p>Instances of this class are immutable.</p>
+ */
+public final class FixedDecimal32_08 extends FixedDecimal32 {
+
+ /**
+ * Constructor.
+ * @param unscaledValue The unscaledValue of this fixed-point value.
+ */
+ protected FixedDecimal32_08(final int unscaledValue) {
+ super(unscaledValue);
+ }
+
+ @Override
+ public Config getConfig() {
+ return Config.CONFIG_08;
+ }
+
+}
Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_08.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java (rev 0)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2026 The aXSL Project.
+ * http://www.axsl.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate $
+ * $LastChangedBy$
+ */
+
+package org.axsl.primitive.fixed;
+
+/**
+ * <p>A fixed-point value with a scale of 9.</p>
+ *
+ * <p>Instances of this class are immutable.</p>
+ */
+public final class FixedDecimal32_09 extends FixedDecimal32 {
+
+ /**
+ * Constructor.
+ * @param unscaledValue The unscaledValue of this fixed-point value.
+ */
+ protected FixedDecimal32_09(final int unscaledValue) {
+ super(unscaledValue);
+ }
+
+ @Override
+ public Config getConfig() {
+ return Config.CONFIG_09;
+ }
+
+}
Property changes on: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32_09.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java
===================================================================
--- trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java 2026-04-28 16:58:47 UTC (rev 3027)
+++ trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -69,7 +69,7 @@
*/
@Test
public void testWhole() {
- FixedDecimal32 out = FixedDecimal32.valueOf(112, 0);
+ FixedDecimal out = FixedDecimal32.valueOf(112, 0);
assertThat(out.whole()).isEqualTo(112);
out = FixedDecimal32.valueOf("147.339");
@@ -81,7 +81,7 @@
*/
@Test
public void testFractional() {
- FixedDecimal32 out = FixedDecimal32.valueOf(112, 0);
+ FixedDecimal out = FixedDecimal32.valueOf(112, 0);
assertThat(out.fractional()).isEqualTo(0);
out = FixedDecimal32.valueOf("147.339");
@@ -93,8 +93,8 @@
*/
@Test
public void testCompareTo() {
- FixedDecimal32 low = FixedDecimal32.valueOf("112");
- FixedDecimal32 high = FixedDecimal32.valueOf("113");
+ FixedDecimal low = FixedDecimal32.valueOf("112");
+ FixedDecimal high = FixedDecimal32.valueOf("113");
assertThat(high.compareTo(low)).isGreaterThan(0);
low = FixedDecimal32.valueOf("2147483.646");
@@ -119,8 +119,8 @@
*/
@Test
public void testIsEqualTo() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("112");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("113");
+ FixedDecimal value1 = FixedDecimal32.valueOf("112");
+ FixedDecimal value2 = FixedDecimal32.valueOf("113");
assertThat(value1.isEqualTo(value2)).isFalse();
value1 = FixedDecimal32.valueOf("2147483.646");
@@ -145,8 +145,8 @@
*/
@Test
public void testIsNotEqualTo() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("112");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("113");
+ FixedDecimal value1 = FixedDecimal32.valueOf("112");
+ FixedDecimal value2 = FixedDecimal32.valueOf("113");
assertThat(value1.isNotEqualTo(value2)).isTrue();
value1 = FixedDecimal32.valueOf("2147483.646");
@@ -171,8 +171,8 @@
*/
@Test
public void testIsGreaterThan() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("113");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal32.valueOf("113");
+ FixedDecimal value2 = FixedDecimal32.valueOf("112");
assertThat(value1.isGreaterThan(value2)).isTrue();
value1 = FixedDecimal32.valueOf("2147483.646");
@@ -197,8 +197,8 @@
*/
@Test
public void testIsNotGreaterThan() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("113");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal32.valueOf("113");
+ FixedDecimal value2 = FixedDecimal32.valueOf("112");
assertThat(value1.isNotGreaterThan(value2)).isFalse();
value1 = FixedDecimal32.valueOf("2147483.646");
@@ -223,8 +223,8 @@
*/
@Test
public void testIsLessThan() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("113");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal32.valueOf("113");
+ FixedDecimal value2 = FixedDecimal32.valueOf("112");
assertThat(value1.isLessThan(value2)).isFalse();
value1 = FixedDecimal32.valueOf("2147483.646");
@@ -249,8 +249,8 @@
*/
@Test
public void testIsNotLessThan() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("113");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal value1 = FixedDecimal32.valueOf("113");
+ FixedDecimal value2 = FixedDecimal32.valueOf("112");
assertThat(value1.isNotLessThan(value2)).isTrue();
value1 = FixedDecimal32.valueOf("2147483.646");
@@ -275,9 +275,9 @@
*/
@Test
public void testAdd() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("113");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("112");
- FixedDecimal32 sum = value1.add(value2);
+ FixedDecimal value1 = FixedDecimal32.valueOf("113");
+ FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal sum = value1.add(value2);
assertThat(sum.unscaledValue()).isEqualTo(225);
assertThat(sum.scale()).isEqualTo(0);
@@ -293,9 +293,9 @@
*/
@Test
public void testSubtract() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("225");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("112");
- FixedDecimal32 difference = value1.subtract(value2);
+ FixedDecimal value1 = FixedDecimal32.valueOf("225");
+ FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal difference = value1.subtract(value2);
assertThat(difference.unscaledValue()).isEqualTo(113);
assertThat(difference.scale()).isEqualTo(0);
@@ -315,9 +315,9 @@
*/
@Test
public void testMultiply() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("225");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("112");
- FixedDecimal32 product = value1.multiply(value2);
+ FixedDecimal value1 = FixedDecimal32.valueOf("225");
+ FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal product = value1.multiply(value2);
assertThat(product.unscaledValue()).isEqualTo(25_200);
assertThat(product.scale()).isEqualTo(0);
@@ -337,9 +337,9 @@
*/
@Test
public void testDivide() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("25200");
- FixedDecimal32 value2 = FixedDecimal32.valueOf("112");
- FixedDecimal32 quotient = value1.divide(value2);
+ FixedDecimal value1 = FixedDecimal32.valueOf("25200");
+ FixedDecimal value2 = FixedDecimal32.valueOf("112");
+ FixedDecimal quotient = value1.divide(value2);
assertThat(quotient.unscaledValue()).isEqualTo(225);
assertThat(quotient.scale()).isEqualTo(0);
@@ -355,8 +355,8 @@
*/
@Test
public void testNegate() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("25200");
- FixedDecimal32 negative = value1.negate();
+ FixedDecimal value1 = FixedDecimal32.valueOf("25200");
+ FixedDecimal negative = value1.negate();
assertThat(negative.unscaledValue()).isEqualTo(-25_200);
assertThat(negative.scale()).isEqualTo(0);
@@ -371,8 +371,8 @@
*/
@Test
public void testAbs() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("25200");
- FixedDecimal32 abs = value1.abs();
+ FixedDecimal value1 = FixedDecimal32.valueOf("25200");
+ FixedDecimal abs = value1.abs();
assertThat(abs.unscaledValue()).isEqualTo(25_200);
assertThat(abs.scale()).isEqualTo(0);
assertThat(value1).isSameAs(abs);
@@ -388,7 +388,7 @@
*/
@Test
public void testFloatValue() {
- FixedDecimal32 value1 = FixedDecimal32.valueOf("25200");
+ FixedDecimal value1 = FixedDecimal32.valueOf("25200");
float result = value1.floatValue();
assertThat(result).isEqualTo(25_200f);
@@ -402,10 +402,10 @@
*/
@Test
public void testIntValueExact() {
- final FixedDecimal32 value1 = FixedDecimal32.valueOf("25200");
+ final FixedDecimal value1 = FixedDecimal32.valueOf("25200");
assertThat(value1.intValueExact()).isEqualTo(25_200);
- final FixedDecimal32 value2 = FixedDecimal32.valueOf("-112.32");
+ final FixedDecimal value2 = FixedDecimal32.valueOf("-112.32");
assertThatExceptionOfType(ArithmeticException.class).isThrownBy(() -> {
value2.intValueExact();
});
@@ -417,8 +417,8 @@
@Test
public void testRound() {
MathContext mc = new MathContext(5, RoundingMode.HALF_UP);
- FixedDecimal32 actual = FixedDecimal32.valueOf("25200").round(mc);
- FixedDecimal32 expected = FixedDecimal32.valueOf("25200");
+ FixedDecimal actual = FixedDecimal32.valueOf("25200").round(mc);
+ FixedDecimal expected = FixedDecimal32.valueOf("25200");
assertThat(actual).isEqualTo(expected);
mc = new MathContext(3, RoundingMode.HALF_UP);
@@ -440,7 +440,7 @@
*/
@Test
public void testClone() {
- final FixedDecimal32 value1 = FixedDecimal32.valueOf("25200");
+ final FixedDecimal value1 = FixedDecimal32.valueOf("25200");
assertThat(value1.clone()).isSameAs(value1);
}
@@ -449,12 +449,27 @@
*/
@Test
public void testEquals() {
- final FixedDecimal32 value1 = FixedDecimal32.valueOf("25.201");
- final FixedDecimal32 value2 = FixedDecimal32.valueOf(25201, 3);
+ final FixedDecimal value1 = FixedDecimal32.valueOf("25.201");
+ final FixedDecimal value2 = FixedDecimal32.valueOf(25201, 3);
assertThat(value1.clone()).isEqualTo(value2);
- final FixedDecimal32 value3 = FixedDecimal32.valueOf("25.2010");
+ final FixedDecimal value3 = FixedDecimal32.valueOf("25.2010");
assertThat(value1.clone()).isNotEqualTo(value3);
}
+ /**
+ * Tests of {@link FixedDecimal32#toString()}.
+ */
+ @Test
+ public void testToString() {
+ FixedDecimal value1 = FixedDecimal32.valueOf("25.201");
+ assertThat(value1.toString()).isEqualTo("25.201");
+
+ value1 = FixedDecimal32.valueOf("-213.99");
+ assertThat(value1.toString()).isEqualTo("-213.99");
+
+ value1 = FixedDecimal32.valueOf("-2.002");
+ assertThat(value1.toString()).isEqualTo("-2.002");
+ }
+
}
Modified: trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsFontPrivateDictionary.java
===================================================================
--- trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsFontPrivateDictionary.java 2026-04-28 16:58:47 UTC (rev 3027)
+++ trunk/axsl/axsl-ps/src/main/java/org/axsl/ps/PsFontPrivateDictionary.java 2026-04-29 20:37:33 UTC (rev 3028)
@@ -23,7 +23,7 @@
package org.axsl.ps;
-import java.math.BigDecimal;
+import org.axsl.primitive.fixed.FixedDecimal;
/**
* A PostScript font "Private" dictionary.
@@ -34,6 +34,6 @@
* Returns the StdVW value from the font file.
* @return The StdVW value, or null if it does not exist.
*/
- BigDecimal getStdVw();
+ FixedDecimal getStdVw();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2026-04-28 16:58:50
|
Revision: 3027
http://sourceforge.net/p/axsl/code/3027
Author: victormote
Date: 2026-04-28 16:58:47 +0000 (Tue, 28 Apr 2026)
Log Message:
-----------
Add round(), intValueExact(), equals(), and clone() methods.
Modified Paths:
--------------
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java 2026-04-27 18:57:08 UTC (rev 3026)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedBigDecimal.java 2026-04-28 16:58:47 UTC (rev 3027)
@@ -26,6 +26,7 @@
package org.axsl.primitive.fixed;
import java.math.BigDecimal;
+import java.math.MathContext;
/**
* <p>Wraps a {@link BigDecimal} instance, adapting it to the {@link FixedDecimal} interface.
@@ -57,10 +58,33 @@
@Override
public int unscaledValue() {
- return wrapped.unscaledValue().intValueExact();
+ return this.wrapped.unscaledValue().intValueExact();
}
@Override
+ public int intValueExact() {
+ return this.wrapped.intValueExact();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (! (other instanceof FixedDecimal)) {
+ return false;
+ }
+ final FixedDecimal otherFd = (FixedDecimal) other;
+ if (this.scale() != otherFd.scale()) {
+ return false;
+ }
+ if (this.unscaledValue() != otherFd.unscaledValue()) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
public BigDecimal toBigDecimal() {
return this.wrapped;
}
@@ -72,35 +96,45 @@
}
@Override
- public FixedDecimal add(final FixedDecimal addend) {
+ public FixedBigDecimal add(final FixedDecimal addend) {
return new FixedBigDecimal(this.wrapped.add(addend.toBigDecimal()));
}
@Override
- public FixedDecimal subtract(final FixedDecimal subtrahend) {
+ public FixedBigDecimal subtract(final FixedDecimal subtrahend) {
return new FixedBigDecimal(this.wrapped.subtract(subtrahend.toBigDecimal()));
}
@Override
- public FixedDecimal multiply(final FixedDecimal multiplier) {
+ public FixedBigDecimal multiply(final FixedDecimal multiplier) {
return new FixedBigDecimal(this.wrapped.multiply(multiplier.toBigDecimal()));
}
@Override
- public FixedDecimal divide(final FixedDecimal divisor) {
+ public FixedBigDecimal divide(final FixedDecimal divisor) {
return new FixedBigDecimal(this.wrapped.divide(divisor.toBigDecimal()));
}
@Override
- public FixedDecimal negate() {
+ public FixedBigDecimal negate() {
return new FixedBigDecimal(this.wrapped.negate());
}
@Override
- public FixedDecimal abs() {
+ public FixedBigDecimal abs() {
return this.wrapped.signum() < 0 ? negate() : this;
}
+ @Override
+ public FixedBigDecimal clone() {
+ return this;
+ }
+
+ @Override
+ public FixedBigDecimal round(final MathContext mc) {
+ return new FixedBigDecimal(this.wrapped.round(mc));
+ }
+
/* Checkstyle: Restart BigDecimal checking.*/
}
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-04-27 18:57:08 UTC (rev 3026)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal.java 2026-04-28 16:58:47 UTC (rev 3027)
@@ -24,6 +24,7 @@
package org.axsl.primitive.fixed;
import java.math.BigDecimal;
+import java.math.MathContext;
/**
* <p>Implementations store numeric values with a fixed number of <em>decimal</em> places.
@@ -64,6 +65,28 @@
*/
int unscaledValue();
+ /**
+ * {@inheritDoc}
+ * <p>This method considers this instance equal to another {@code FixedDecimal} object only if they are equal in
+ * both unscaledValue and scale.
+ * In other words, 2.0 is not equal to 2.00 when compared by this method.
+ * For comparisons that would equate those two values, use {@link #compareTo(FixedDecimal)} or
+ * {@link #isEqualTo(FixedDecimal)}.</p>
+ */
+ @Override
+ boolean equals(Object other);
+
+ /**
+ * Converts this {@code FixedDecimal} to an {@code int}, checking for lost information.
+ * If this {@code FixedDecimal} has a nonzero fractional part or is out of the possible range for an {@code int}
+ * result then an {@code ArithmeticException} is thrown.
+ *
+ * @return This {@code FixedDecimal} converted to an {@code int}.
+ * @throws ArithmeticException if {@code this} has a nonzero fractional part, or will not fit in an {@code int}.
+ * @see BigDecimal#intValueExact()
+ */
+ int intValueExact();
+
/* Checkstyle: Allow BigDecimal here. */
/**
@@ -89,6 +112,9 @@
/* Checkstyle: Restart float and double checking." */
+ @Override
+ int compareTo(FixedDecimal o);
+
/**
* Tests for value equality between this and another {@link FixedDecimal} value.
* @param other The fixed-point value being compared.
@@ -143,7 +169,6 @@
return this.compareTo(other) >= 0;
}
-
/**
* Computes and returns the sum of this (the augend) and an addend.
* @param addend The amount to be added to this.
@@ -180,11 +205,28 @@
FixedDecimal negate();
/**
- * Returns a {@code FixedDecimal} whose value is the absolute value of this {@code BigDecimal}, and whose scale is
+ * Returns a {@code FixedDecimal} whose value is the absolute value of this {@code FixedDecimal}, and whose scale is
* {@code this.scale()}.
- *
* @return {@code abs(this)}
*/
FixedDecimal abs();
+ /**
+ * Returns a {@code FixedDecimal} rounded according to the {@code MathContext} settings.
+ * If the {@link MathContext#getPrecision()} setting is 0 then no rounding takes place.
+ * @param mc The context to use.
+ * @return A {@code FixedDecimal} rounded according to the {@code MathContext} settings.
+ * @throws ArithmeticException if the rounding mode is {@code UNNECESSARY} and the operation would require rounding.
+ * @see BigDecimal#round(MathContext)
+ */
+ FixedDecimal round(MathContext mc);
+
+ /**
+ * Returns a "clone" of this object.
+ * It should be safe for immutable implementations to simply return "this."
+ * Mutable implementations should provide an implementation that does a deep copy.
+ * @return A clone of this object.
+ */
+ FixedDecimal clone() throws CloneNotSupportedException;
+
}
Modified: trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java
===================================================================
--- trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-04-27 18:57:08 UTC (rev 3026)
+++ trunk/axsl/axsl-primitive/src/main/java/org/axsl/primitive/fixed/FixedDecimal32.java 2026-04-28 16:58:47 UTC (rev 3027)
@@ -205,11 +205,40 @@
}
/**
+ * {@inheritDoc}
+ * <p>This method considers this instance equal to another {@code FixedDecimal} object only if they are equal in
+ * both unscaledValue and scale.
+ * In other words, 2.0 is not equal to 2.00 when compared by this method.
+ * For comparisons that would equate those two values, use {@link #compareTo(FixedDecimal)} or
+ * {@link #isEqualTo(FixedDecimal)}.</p>
+ */
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (! (other instanceof FixedDecimal)) {
+ return false;
+ }
+ final FixedDecimal otherFd = (FixedDecimal) other;
+ if (this.scale() != otherFd.scale()) {
+ return false;
+ }
+ if (this.unscaledValue != otherFd.unscaledValue()) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
* Returns the whole number portion of this fixed-point.
* @return The whole number portion of this.
* For example, for 123.456, returns 123.
*/
public int whole() {
+ if (scale() == 0) {
+ return this.unscaledValue;
+ }
return this.unscaledValue / getConfig().conversionFactor;
}
@@ -219,6 +248,9 @@
* For example, for 123.456, returns 456.
*/
public int fractional() {
+ if (scale() == 0) {
+ return 0;
+ }
return this.unscaledValue % getConfig().conversionFactor;
}
@@ -282,6 +314,24 @@
return this.unscaledValue < 0 ? negate() : this;
}
+ @Override
+ public FixedDecimal32 round(final MathContext mc) {
+ return valueOf(toBigDecimal().round(mc));
+ }
+
+ @Override
+ public int intValueExact() {
+ if (fractional() == 0) {
+ return whole();
+ }
+ throw new ArithmeticException("Rounding necessary");
+ }
+
+ @Override
+ public FixedDecimal32 clone() {
+ return this;
+ }
+
/* Checkstyle: Restart BigDecimal checking.*/
}
Modified: trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java
===================================================================
--- trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java 2026-04-27 18:57:08 UTC (rev 3026)
+++ trunk/axsl/axsl-primitive/src/test/java/org/axsl/primitive/fixed/FixedDecimal32Tests.java 2026-04-28 16:58:47 UTC (rev 3027)
@@ -25,8 +25,12 @@
package org.axsl.primitive.fixed;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import org.junit.jupiter.api.Test;
+import java.math.MathContext;
+import java.math.RoundingMode;
+
/**
* Tests of {@link FixedDecimal32}.
*/
@@ -393,4 +397,64 @@
assertThat(result).isEqualTo(-112.32f);
}
+ /**
+ * Tests of {@link FixedDecimal32#intValueExact()}.
+ */
+ @Test
+ public void testIntValueExact() {
+ final FixedDecimal32 value1 = FixedDecimal32.valueOf("25200");
+ assertThat(value1.intValueExact()).isEqualTo(25_200);
+
+ final FixedDecimal32 value2 = FixedDecimal32.valueOf("-112.32");
+ assertThatExceptionOfType(ArithmeticException.class).isThrownBy(() -> {
+ value2.intValueExact();
+ });
+ }
+
+ /**
+ * Tests of {@link FixedDecimal32#round(MathContext)}.
+ */
+ @Test
+ public void testRound() {
+ MathContext mc = new MathContext(5, RoundingMode.HALF_UP);
+ FixedDecimal32 actual = FixedDecimal32.valueOf("25200").round(mc);
+ FixedDecimal32 expected = FixedDecimal32.valueOf("25200");
+ assertThat(actual).isEqualTo(expected);
+
+ mc = new MathContext(3, RoundingMode.HALF_UP);
+ actual = FixedDecimal32.valueOf("25.925").round(mc);
+ expected = FixedDecimal32.valueOf("25.9");
+ assertThat(actual).isEqualTo(expected);
+
+ actual = FixedDecimal32.valueOf("25.55").round(mc);
+ expected = FixedDecimal32.valueOf("25.6");
+ assertThat(actual).isEqualTo(expected);
+
+ actual = FixedDecimal32.valueOf("25.54").round(mc);
+ expected = FixedDecimal32.valueOf("25.5");
+ assertThat(actual).isEqualTo(expected);
+ }
+
+ /**
+ * Tests of {@link FixedDecimal32#clone()}.
+ */
+ @Test
+ public void testClone() {
+ final FixedDecimal32 value1 = FixedDecimal32.valueOf("25200");
+ assertThat(value1.clone()).isSameAs(value1);
+ }
+
+ /**
+ * Tests of {@link FixedDecimal32#equals()}.
+ */
+ @Test
+ public void testEquals() {
+ final FixedDecimal32 value1 = FixedDecimal32.valueOf("25.201");
+ final FixedDecimal32 value2 = FixedDecimal32.valueOf(25201, 3);
+ assertThat(value1.clone()).isEqualTo(value2);
+
+ final FixedDecimal32 value3 = FixedDecimal32.valueOf("25.2010");
+ assertThat(value1.clone()).isNotEqualTo(value3);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|