foray-commit Mailing List for FOray (Page 36)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
|
From: <vic...@us...> - 2023-01-02 02:24:27
|
Revision: 13000
http://sourceforge.net/p/foray/code/13000
Author: victormote
Date: 2023-01-02 02:24:24 +0000 (Mon, 02 Jan 2023)
Log Message:
-----------
Rename standard property test methods for consistency and clarity.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontFamilyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/NameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RoleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/StringTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SwitchToTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextAlignTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VoiceFamilyTests.java
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2023-01-02 02:10:45 UTC (rev 12999)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2023-01-02 02:24:24 UTC (rev 13000)
@@ -228,7 +228,7 @@
* @throws PropertyException For errors during parsing.
*/
@Test
- public void testNullInput() throws PropertyException {
+ public void nullInputTest() throws PropertyException {
try {
testNullInputSetup();
fail("Expected PropertyException for invalid keyword.");
@@ -251,7 +251,7 @@
* @throws PropertyException For errors during parsing.
*/
@Test
- public void testName001() throws PropertyException {
+ public void nameTest001() throws PropertyException {
try {
testName001Setup();
fail("Expected PropertyException for invalid keyword.");
@@ -268,7 +268,7 @@
* @throws PropertyException For errors during parsing.
*/
@Test
- public void testString001() throws PropertyException {
+ public void stringTest001() throws PropertyException {
try {
createProperty("abc xyz");
fail("Expected PropertyException for invalid keyword.");
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontFamilyTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontFamilyTests.java 2023-01-02 02:10:45 UTC (rev 12999)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontFamilyTests.java 2023-01-02 02:24:24 UTC (rev 13000)
@@ -57,7 +57,7 @@
*/
@Override
@Test
- public void testName001() throws PropertyException {
+ public void nameTest001() throws PropertyException {
createProperty("bhxbt");
}
@@ -67,7 +67,7 @@
*/
@Override
@Test
- public void testString001() throws PropertyException {
+ public void stringTest001() throws PropertyException {
createProperty("abc xyz");
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/NameTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/NameTests.java 2023-01-02 02:10:45 UTC (rev 12999)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/NameTests.java 2023-01-02 02:24:24 UTC (rev 13000)
@@ -40,7 +40,7 @@
@Override
@Test
- public void testName001() throws PropertyException {
+ public void nameTest001() throws PropertyException {
testName001Setup();
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RoleTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RoleTests.java 2023-01-02 02:10:45 UTC (rev 12999)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RoleTests.java 2023-01-02 02:24:24 UTC (rev 13000)
@@ -57,7 +57,7 @@
*/
@Override
@Test
- public void testName001() throws PropertyException {
+ public void nameTest001() throws PropertyException {
createProperty("bhxbt");
}
@@ -67,7 +67,7 @@
*/
@Override
@Test
- public void testString001() throws PropertyException {
+ public void stringTest001() throws PropertyException {
createProperty("abc xyz");
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/StringTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/StringTests.java 2023-01-02 02:10:45 UTC (rev 12999)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/StringTests.java 2023-01-02 02:24:24 UTC (rev 13000)
@@ -45,7 +45,7 @@
*/
@Override
@Test
- public void testNullInput() throws PropertyException {
+ public void nullInputTest() throws PropertyException {
createProperty("");
}
@@ -55,7 +55,7 @@
*/
@Override
@Test
- public void testName001() throws PropertyException {
+ public void nameTest001() throws PropertyException {
createProperty("bhxbt");
}
@@ -65,7 +65,7 @@
*/
@Override
@Test
- public void testString001() throws PropertyException {
+ public void stringTest001() throws PropertyException {
createProperty("abc xyz");
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SwitchToTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SwitchToTests.java 2023-01-02 02:10:45 UTC (rev 12999)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SwitchToTests.java 2023-01-02 02:24:24 UTC (rev 13000)
@@ -57,7 +57,7 @@
*/
@Override
@Test
- public void testName001() throws PropertyException {
+ public void nameTest001() throws PropertyException {
createProperty("bhxbt");
}
@@ -67,7 +67,7 @@
*/
@Override
@Test
- public void testString001() throws PropertyException {
+ public void stringTest001() throws PropertyException {
createProperty("abc xyz");
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextAlignTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextAlignTests.java 2023-01-02 02:10:45 UTC (rev 12999)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextAlignTests.java 2023-01-02 02:24:24 UTC (rev 13000)
@@ -57,7 +57,7 @@
*/
@Override
@Test
- public void testName001() throws PropertyException {
+ public void nameTest001() throws PropertyException {
createProperty("bhxbt");
}
@@ -67,7 +67,7 @@
*/
@Override
@Test
- public void testString001() throws PropertyException {
+ public void stringTest001() throws PropertyException {
createProperty("abc xyz");
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VoiceFamilyTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VoiceFamilyTests.java 2023-01-02 02:10:45 UTC (rev 12999)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VoiceFamilyTests.java 2023-01-02 02:24:24 UTC (rev 13000)
@@ -57,7 +57,7 @@
*/
@Override
@Test
- public void testName001() throws PropertyException {
+ public void nameTest001() throws PropertyException {
createProperty("bhxbt");
}
@@ -67,7 +67,7 @@
*/
@Override
@Test
- public void testString001() throws PropertyException {
+ public void stringTest001() throws PropertyException {
createProperty("abc xyz");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2023-01-02 02:10:47
|
Revision: 12999
http://sourceforge.net/p/foray/code/12999
Author: victormote
Date: 2023-01-02 02:10:45 +0000 (Mon, 02 Jan 2023)
Log Message:
-----------
1. Conform to aXSL change: Remove relative FontWeight enums .BOLDER and .LIGHTER. 2. Add tests of PdFontWeight.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontWeightTests.java
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontWeightTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontWeightTests.java 2023-01-02 00:01:46 UTC (rev 12998)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontWeightTests.java 2023-01-02 02:10:45 UTC (rev 12999)
@@ -29,10 +29,18 @@
package org.foray.fotree.fo.prop;
import org.foray.fotree.AbstractPropertyTests;
+import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyId;
import org.foray.fotree.fo.FoPropertyId;
+import org.axsl.value.FontWeight;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
/**
* JUnit test class for the class {@link PdFontWeight}.
*/
@@ -49,4 +57,138 @@
return property;
}
+ /**
+ * Test of font-weight="normal".
+ */
+ @Test
+ public void normalTest() throws PropertyException {
+ final PdFontWeight out = createProperty("normal");
+ assertEquals(FontWeight.NORMAL, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="bold".
+ */
+ @Test
+ public void boldTest() throws PropertyException {
+ final PdFontWeight out = createProperty("bold");
+ assertEquals(FontWeight.BOLD, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="bolder".
+ */
+ @Test
+ public void bolderTest() throws PropertyException {
+ final FoObj fo = Mockito.mock(FoObj.class);
+ Mockito.when(fo.traitFontWeight(STD_FO_CONTEXT)).thenReturn(FontWeight.NORMAL);
+ final PdFontWeight out = createProperty("bolder");
+ assertEquals(FontWeight.N500, out.getValue(STD_FO_CONTEXT, fo));
+ }
+
+ /**
+ * Test of font-weight="lighter".
+ */
+ @Test
+ public void lighterTest() throws PropertyException {
+ final FoObj fo = Mockito.mock(FoObj.class);
+ Mockito.when(fo.traitFontWeight(STD_FO_CONTEXT)).thenReturn(FontWeight.NORMAL);
+ final PdFontWeight out = createProperty("lighter");
+ assertEquals(FontWeight.N300, out.getValue(STD_FO_CONTEXT, fo));
+ }
+
+ /**
+ * Test of font-weight="100".
+ */
+ @Test
+ public void n100Test() throws PropertyException {
+ final PdFontWeight out = createProperty("100");
+ assertEquals(FontWeight.N100, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="200".
+ */
+ @Test
+ public void n200Test() throws PropertyException {
+ final PdFontWeight out = createProperty("200");
+ assertEquals(FontWeight.N200, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="300".
+ */
+ @Test
+ public void n300Test() throws PropertyException {
+ final PdFontWeight out = createProperty("300");
+ assertEquals(FontWeight.N300, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="400".
+ */
+ @Test
+ public void n400Test() throws PropertyException {
+ final PdFontWeight out = createProperty("400");
+ assertEquals(FontWeight.N400, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="500".
+ */
+ @Test
+ public void n500Test() throws PropertyException {
+ final PdFontWeight out = createProperty("500");
+ assertEquals(FontWeight.N500, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="600".
+ */
+ @Test
+ public void n600Test() throws PropertyException {
+ final PdFontWeight out = createProperty("600");
+ assertEquals(FontWeight.N600, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="700".
+ */
+ @Test
+ public void n700Test() throws PropertyException {
+ final PdFontWeight out = createProperty("700");
+ assertEquals(FontWeight.N700, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="800".
+ */
+ @Test
+ public void n800Test() throws PropertyException {
+ final PdFontWeight out = createProperty("800");
+ assertEquals(FontWeight.N800, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="900".
+ */
+ @Test
+ public void n900Test() throws PropertyException {
+ final PdFontWeight out = createProperty("900");
+ assertEquals(FontWeight.N900, out.getValue(STD_FO_CONTEXT, null));
+ }
+
+ /**
+ * Test of font-weight="inherit".
+ */
+ @Test
+ public void inheritTest() throws PropertyException {
+ final FoObj parent = Mockito.mock(FoObj.class);
+ Mockito.when(parent.traitFontWeight(STD_FO_CONTEXT)).thenReturn(FontWeight.N900);
+ final FoObj fo = Mockito.mock(FoObj.class);
+ Mockito.when(fo.effectiveParent(any())).thenReturn(parent);
+ final PdFontWeight out = createProperty("inherit");
+ assertEquals(FontWeight.N900, out.getValue(STD_FO_CONTEXT, fo));
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2023-01-02 00:01:48
|
Revision: 12998
http://sourceforge.net/p/foray/code/12998
Author: victormote
Date: 2023-01-02 00:01:46 +0000 (Mon, 02 Jan 2023)
Log Message:
-----------
Conform to aXSL changes: Convert array return types to List or primitive sequences.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Declarations4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSourceDocument.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextShadow.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVoiceFamily.java
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2023-01-01 23:19:43 UTC (rev 12997)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2023-01-02 00:01:46 UTC (rev 12998)
@@ -69,6 +69,7 @@
import org.axsl.i18n.WritingSystem;
import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyServer;
+import org.axsl.primitive.sequence.FloatSequence;
import org.axsl.value.AbsoluteDirection;
import org.axsl.value.AbsolutePosition;
import org.axsl.value.ActiveState;
@@ -1797,7 +1798,7 @@
}
@Override
- public URL[] traitSourceDocument(final FoContext context) {
+ public List<URL> traitSourceDocument(final FoContext context) {
return getPropertyList().getSourceDocument(this, context);
}
@@ -2751,7 +2752,7 @@
}
@Override
- public String[] traitVoiceFamily(final FoContext context) {
+ public List<String> traitVoiceFamily(final FoContext context) {
return getPropertyList().getVoiceFamily(this, context);
}
@@ -2823,13 +2824,13 @@
}
@Override
- public String[] traitSwitchToNames() {
+ public List<String> traitSwitchToNames() {
/* TODO: This needs to return the names in the FO input. */
return null;
}
@Override
- public ShadowEffect[] traitTextShadow(final FoContext context) {
+ public List<? extends ShadowEffect> traitTextShadow(final FoContext context) {
return getPropertyList().traitTextShadow(this, context);
}
@@ -3223,7 +3224,7 @@
* Returns the allowed-height-scale trait.
* @return The allowed-height-scale trait.
*/
- public float[] traitAllowedHeightScale() {
+ public FloatSequence traitAllowedHeightScale() {
return getPropertyList().traitAllowedHeightScale(this);
}
@@ -3231,7 +3232,7 @@
* Returns the allowed-height-scale trait.
* @return The allowed-height-scale trait.
*/
- public float[] traitAllowedWidthScale() {
+ public FloatSequence traitAllowedWidthScale() {
return getPropertyList().traitAllowedWidthScale(this);
}
@@ -3377,13 +3378,13 @@
}
@Override
- public float[] traitAllowedHeightScale(final FoContext context) {
+ public FloatSequence traitAllowedHeightScale(final FoContext context) {
/* TODO: Implement this. */
return AbstractAllowedAxisScale.traitValueNoInstance(this);
}
@Override
- public float[] traitAllowedWidthScale(final FoContext context) {
+ public FloatSequence traitAllowedWidthScale(final FoContext context) {
/* TODO: Implement this. */
return AbstractAllowedAxisScale.traitValueNoInstance(this);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2023-01-01 23:19:43 UTC (rev 12997)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2023-01-02 00:01:46 UTC (rev 12998)
@@ -233,6 +233,7 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.FoInlineContext;
+import org.axsl.primitive.sequence.FloatSequence;
import org.axsl.value.AbsoluteAxis;
import org.axsl.value.AbsoluteCompass;
import org.axsl.value.AbsoluteDirection;
@@ -2772,7 +2773,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The source-document property.
*/
- public URL[] getSourceDocument(final FoObj fobj, final FoContext context) {
+ public List<URL> getSourceDocument(final FoObj fobj, final FoContext context) {
final PdSourceDocument property = (PdSourceDocument) getProperty(FoPropertyId.SOURCE_DOCUMENT);
if (property == null) {
return PdSourceDocument.getValueNoInstance();
@@ -4194,7 +4195,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The voice-family property.
*/
- public String[] getVoiceFamily(final FoObj fobj, final FoContext context) {
+ public List<String> getVoiceFamily(final FoObj fobj, final FoContext context) {
final PdVoiceFamily property = (PdVoiceFamily) getProperty(FoPropertyId.VOICE_FAMILY);
if (property != null) {
return property.getValue(context, fobj);
@@ -4271,7 +4272,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The text-shadow property.
*/
- public ShadowEffect[] traitTextShadow(final FoObj fobj, final FoContext context) {
+ public List<? extends ShadowEffect> traitTextShadow(final FoObj fobj, final FoContext context) {
final PdTextShadow property = (PdTextShadow) getProperty(FoPropertyId.TEXT_SHADOW);
if (property != null) {
return property.getValue(context, fobj);
@@ -4519,7 +4520,7 @@
* @param fobj The FoObj to which the property belongs.
* @return The allowed-height-scale property.
*/
- public float[] traitAllowedHeightScale(final FoObj fobj) {
+ public FloatSequence traitAllowedHeightScale(final FoObj fobj) {
final PdAllowedHeightScale property = (PdAllowedHeightScale) getProperty(FoPropertyId.ALLOWED_HEIGHT_SCALE);
if (property != null) {
return property.traitValue(fobj);
@@ -4532,7 +4533,7 @@
* @param fobj The FoObj to which the property belongs.
* @return The allowed-width-scale property.
*/
- public float[] traitAllowedWidthScale(final FoObj fobj) {
+ public FloatSequence traitAllowedWidthScale(final FoObj fobj) {
final PdAllowedWidthScale property = (PdAllowedWidthScale) getProperty(FoPropertyId.ALLOWED_WIDTH_SCALE);
if (property != null) {
return property.traitValue(fobj);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Declarations4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Declarations4a.java 2023-01-01 23:19:43 UTC (rev 12997)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Declarations4a.java 2023-01-02 00:01:46 UTC (rev 12998)
@@ -62,7 +62,7 @@
private PropertyList propertyList;
/** The child color profiles.*/
- private ColorProfile4a[] colorProfiles;
+ private List<ColorProfile4a> colorProfiles;
/** The child metadata items. */
private Map<String, Metadata4a> metadata = new HashMap<String, Metadata4a>();
@@ -104,11 +104,11 @@
}
/* Create the arrays storing the children. */
- this.colorProfiles = new ColorProfile4a[colorProfileCount];
+ this.colorProfiles = new ArrayList<ColorProfile4a>(colorProfileCount);
colorProfileCount = 0;
for (FoObj node : this.getChildren()) {
if (node instanceof ColorProfile4a) {
- this.colorProfiles[colorProfileCount] = (ColorProfile4a) node;
+ this.colorProfiles.set(colorProfileCount, (ColorProfile4a) node);
colorProfileCount ++;
} else if (node instanceof Metadata4a) {
final Metadata4a metadata = (Metadata4a) node;
@@ -164,7 +164,7 @@
}
@Override
- public ColorProfile4a[] getColorProfiles() {
+ public List<ColorProfile4a> getColorProfiles() {
return this.colorProfiles;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java 2023-01-01 23:19:43 UTC (rev 12997)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java 2023-01-02 00:01:46 UTC (rev 12998)
@@ -35,7 +35,10 @@
import org.foray.fotree.fo.FoValue;
import org.foray.fotree.value.PropertyValue;
import org.foray.fotree.value.ValueCollection;
+import org.foray.primitive.sequence.FloatArray;
+import org.axsl.primitive.sequence.FloatSequence;
+
import java.util.StringTokenizer;
/**
@@ -55,8 +58,7 @@
};
/** The default value for this property. */
- private static final float[] VALUE_ANY =
- new float[] {java.lang.Float.POSITIVE_INFINITY};
+ private static final FloatSequence VALUE_ANY = new FloatArray(java.lang.Float.POSITIVE_INFINITY);
/** The PropertyValue instance that contains this property's value. */
private PropertyValue value;
@@ -130,7 +132,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public float[] traitValue(final FoObj fobj) {
+ public FloatSequence traitValue(final FoObj fobj) {
if (this.value == FoPropertyKeyword.getPropertyKeyword(
FoValue.INHERIT)) {
return PdAllowedWidthScale.traitValueNoInstance(fobj);
@@ -145,7 +147,8 @@
returnValue[i] = pv.evalPercentage().floatValue();
}
}
- return returnValue;
+ /* TODO: Store the value correctly at parse time instead of doing this conversion. */
+ return new FloatArray(returnValue);
}
/**
@@ -153,7 +156,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static float[] traitValueNoInstance(final FoObj fobj) {
+ public static FloatSequence traitValueNoInstance(final FoObj fobj) {
final FoObj parent = fobj.getParent();
if (parent == null) {
return AbstractAllowedAxisScale.VALUE_ANY;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSourceDocument.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSourceDocument.java 2023-01-01 23:19:43 UTC (rev 12997)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSourceDocument.java 2023-01-02 00:01:46 UTC (rev 12998)
@@ -41,6 +41,8 @@
import org.axsl.fotree.FoTreeCreator;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
/**
@@ -104,7 +106,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public URL[] getValue(final FoContext context, final FoObj fobj) {
+ public List<URL> getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
switch (keyword) {
@@ -125,10 +127,10 @@
}
if (value() instanceof ValueCollection) {
final ValueCollection theCollection = (ValueCollection) value();
- final URL[] returnArray = new URL[theCollection.getCount()];
+ final List<URL> returnArray = new ArrayList<URL>(theCollection.getCount());
for (int i = 0; i < theCollection.getCount(); i++) {
final DtUri value = (DtUri) theCollection.getItem(i);
- returnArray[i] = value.getValue();
+ returnArray.set(i, value.getValue());
}
return returnArray;
}
@@ -139,8 +141,8 @@
* Returns the default (initial) value for this property.
* @return The initial value for this property.
*/
- public static URL[] getValueNoInstance() {
- return null;
+ public static List<URL> getValueNoInstance() {
+ return Collections.emptyList();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextShadow.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextShadow.java 2023-01-01 23:19:43 UTC (rev 12997)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextShadow.java 2023-01-02 00:01:46 UTC (rev 12998)
@@ -40,6 +40,10 @@
import org.axsl.fotree.FoContext;
import org.axsl.value.ShadowEffect;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
/**
* The "text-shadow" property in XSL-FO.
* @see "XSL-FO Recommendation 1.1, Section 7.17.5."
@@ -53,7 +57,7 @@
};
/** The default (empty) array that can be used as the initial value. */
- private static final ShadowEffect[] INITIAL_VALUE = new ShadowEffect[0];
+ private static final List<ShadowEffect> INITIAL_VALUE = Collections.emptyList();
/** The PropertyValue instance that contains this property's value. */
private PropertyValue value;
@@ -93,15 +97,13 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public ShadowEffect[] getValue(final FoContext context, final FoObj fobj) {
+ public List<? extends ShadowEffect> getValue(final FoContext context, final FoObj fobj) {
if (value() instanceof DtShadowEffect) {
/* TODO: This only returns the first item. After the parsing is
* fixed to store the items as a collection, this needs to be
* rewritten to return all of them. */
- final DtShadowEffectWrapper[] returnArray =
- new DtShadowEffectWrapper[1];
- returnArray[0] = new DtShadowEffectWrapper((DtShadowEffect) value(),
- fobj, context);
+ final List<ShadowEffect> returnArray = new ArrayList<ShadowEffect>(1);
+ returnArray.add((ShadowEffect) new DtShadowEffectWrapper((DtShadowEffect) value(), fobj, context));
return returnArray;
}
if (value().canEvalKeyword()) {
@@ -129,7 +131,7 @@
* Returns the default (initial) value for this property.
* @return The initial value for this property.
*/
- public static ShadowEffect[] getValueNoInstance() {
+ public static List<ShadowEffect> getValueNoInstance() {
return PdTextShadow.INITIAL_VALUE;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVoiceFamily.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVoiceFamily.java 2023-01-01 23:19:43 UTC (rev 12997)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVoiceFamily.java 2023-01-02 00:01:46 UTC (rev 12998)
@@ -39,6 +39,9 @@
import org.axsl.fotree.FoContext;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
import java.util.StringTokenizer;
/**
@@ -48,8 +51,7 @@
public class PdVoiceFamily extends AbstractFoProperty {
/** The default (initial) value for this property. */
- public static final String[] DEFAULT_VOICE_FAMILY
- = {"male"};
+ public static final List<String> DEFAULT_VOICE_FAMILY = Collections.unmodifiableList(Arrays.asList("male"));
/** Array of valid keywords for the tokens. */
private static final FoValue[] VALID_TOKEN_KEYWORDS = {
@@ -110,7 +112,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public String[] getValue(final FoContext context, final FoObj fobj) {
+ public List<String> getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
switch (keyword) {
@@ -120,8 +122,7 @@
case MALE:
case FEMALE:
case CHILD: {
- final String[] returnArray
- = {keyword.toXslFo()};
+ final List<String> returnArray = Arrays.asList(keyword.toXslFo());
return returnArray;
}
default: {
@@ -155,8 +156,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static String[] getValueNoInstance(final FoContext context,
- final FoObj fobj) {
+ public static List<String> getValueNoInstance(final FoContext context, final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
return parent.traitVoiceFamily(context);
Modified: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java 2023-01-01 23:19:43 UTC (rev 12997)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java 2023-01-02 00:01:46 UTC (rev 12998)
@@ -73,8 +73,8 @@
}
/**
- * Provides an implementation of {@link DoubleSequenceMutable} from a specified {@link DoubleSequence}, recasting the
- * specified sequence if possible, otherwise copying its content into a new mutable instance.
+ * Provides an implementation of {@link DoubleSequenceMutable} from a specified {@link DoubleSequence}, recasting
+ * the specified sequence if possible, otherwise copying its content into a new mutable instance.
* @param doubleSequence The sequence for which a mutable instance is needed.
* @return A mutable sequence.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2023-01-01 23:19:45
|
Revision: 12997
http://sourceforge.net/p/foray/code/12997
Author: victormote
Date: 2023-01-01 23:19:43 +0000 (Sun, 01 Jan 2023)
Log Message:
-----------
Add implementations of new primitive sequence interfaces for float and double.
Added Paths:
-----------
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractFloatSequence.java
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArray.java
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArrayBuilder.java
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleSequenceIterator.java
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArray.java
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArrayBuilder.java
trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatSequenceIterator.java
Added: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java (rev 0)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java 2023-01-01 23:19:43 UTC (rev 12997)
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2023 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.primitive.sequence;
+
+import org.axsl.primitive.sequence.DoublePrimitiveIterator;
+import org.axsl.primitive.sequence.DoubleSequence;
+import org.axsl.primitive.sequence.DoubleSequenceMutable;
+import org.axsl.primitive.sequence.DoubleSequencePlus;
+
+/**
+ * Abstract superclass for implementations of {@link DoubleSequencePlus}.
+ */
+public abstract class AbstractDoubleSequence extends AbstractSequence implements DoubleSequencePlus {
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 2366533487441850922L;
+
+ @Override
+ public int indexOf(final double aDouble) {
+ for (int index = 0; index < length(); index ++) {
+ final double foundDouble = doubleAt(index);
+ if (foundDouble == aDouble) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public boolean contains(final double aDouble) {
+ return indexOf(aDouble) > -1;
+ }
+
+ @Override
+ public DoublePrimitiveIterator iterator() {
+ return new DoubleSequenceIterator(this);
+ }
+
+ @Override
+ public DoublePrimitiveIterator iteratorReverse() {
+ return new DoubleSequenceIterator(this, true);
+ }
+
+ @Override
+ public DoubleSequencePlus asPlus() {
+ return this;
+ }
+
+ /**
+ * Provides an implementation of {@link DoubleSequenceMutable} from a specified {@link DoubleSequence}, recasting the
+ * specified sequence if possible, otherwise copying its content into a new mutable instance.
+ * @param doubleSequence The sequence for which a mutable instance is needed.
+ * @return A mutable sequence.
+ */
+ public static DoubleSequenceMutable fromDoubleSequence(final DoubleSequence doubleSequence) {
+ if (doubleSequence == null) {
+ return new DoubleArrayBuilder();
+ }
+ final DoubleSequenceMutable mutable = doubleSequence.asMutable();
+ if (mutable != null) {
+ return mutable;
+ }
+ final DoubleArrayBuilder builder = new DoubleArrayBuilder(doubleSequence.length());
+ builder.append(doubleSequence);
+ return builder;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (! (other instanceof DoubleSequence)) {
+ return false;
+ }
+ final DoubleSequence otherDoubleSequence = (DoubleSequence) other;
+ if (length() != otherDoubleSequence.length()) {
+ return false;
+ }
+ for (int index = 0; index < length(); index ++) {
+ if (doubleAt(index) != otherDoubleSequence.doubleAt(index)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public double firstElement() {
+ return doubleAt(0);
+ }
+
+ @Override
+ public double lastElement() {
+ return doubleAt(length() - 1);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return this.length() < 1;
+ }
+
+}
Property changes on: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractDoubleSequence.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractFloatSequence.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractFloatSequence.java (rev 0)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractFloatSequence.java 2023-01-01 23:19:43 UTC (rev 12997)
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2023 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.primitive.sequence;
+
+import org.axsl.primitive.sequence.FloatPrimitiveIterator;
+import org.axsl.primitive.sequence.FloatSequence;
+import org.axsl.primitive.sequence.FloatSequenceMutable;
+import org.axsl.primitive.sequence.FloatSequencePlus;
+
+/**
+ * Abstract superclass for implementations of {@link FloatSequencePlus}.
+ */
+public abstract class AbstractFloatSequence extends AbstractSequence implements FloatSequencePlus {
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 2366533487441850922L;
+
+ @Override
+ public int indexOf(final float aFloat) {
+ for (int index = 0; index < length(); index ++) {
+ final float foundFloat = floatAt(index);
+ if (foundFloat == aFloat) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public boolean contains(final float aFloat) {
+ return indexOf(aFloat) > -1;
+ }
+
+ @Override
+ public FloatPrimitiveIterator iterator() {
+ return new FloatSequenceIterator(this);
+ }
+
+ @Override
+ public FloatPrimitiveIterator iteratorReverse() {
+ return new FloatSequenceIterator(this, true);
+ }
+
+ @Override
+ public FloatSequencePlus asPlus() {
+ return this;
+ }
+
+ /**
+ * Provides an implementation of {@link FloatSequenceMutable} from a specified {@link FloatSequence}, recasting the
+ * specified sequence if possible, otherwise copying its content into a new mutable instance.
+ * @param floatSequence The sequence for which a mutable instance is needed.
+ * @return A mutable sequence.
+ */
+ public static FloatSequenceMutable fromFloatSequence(final FloatSequence floatSequence) {
+ if (floatSequence == null) {
+ return new FloatArrayBuilder();
+ }
+ final FloatSequenceMutable mutable = floatSequence.asMutable();
+ if (mutable != null) {
+ return mutable;
+ }
+ final FloatArrayBuilder builder = new FloatArrayBuilder(floatSequence.length());
+ builder.append(floatSequence);
+ return builder;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (! (other instanceof FloatSequence)) {
+ return false;
+ }
+ final FloatSequence otherFloatSequence = (FloatSequence) other;
+ if (length() != otherFloatSequence.length()) {
+ return false;
+ }
+ for (int index = 0; index < length(); index ++) {
+ if (floatAt(index) != otherFloatSequence.floatAt(index)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public float firstElement() {
+ return floatAt(0);
+ }
+
+ @Override
+ public float lastElement() {
+ return floatAt(length() - 1);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return this.length() < 1;
+ }
+
+}
Property changes on: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/AbstractFloatSequence.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArray.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArray.java (rev 0)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArray.java 2023-01-01 23:19:43 UTC (rev 12997)
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2023 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.primitive.sequence;
+
+import org.axsl.primitive.sequence.DoublePrimitiveIterator;
+import org.axsl.primitive.sequence.DoubleSequence;
+import org.axsl.primitive.sequence.DoubleSequenceMutable;
+import org.axsl.primitive.sequence.DoubleSequencePlus;
+
+import java.util.Arrays;
+
+/**
+ * Wrapper around an array of {@link Double#TYPE}s, intended to be similar in scope and purpose to what {@link String}
+ * does for an array of chars.
+ * Instances of this class are immutable.
+ */
+public class DoubleArray extends AbstractDoubleSequence implements DoubleSequencePlus {
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -2196475282575408782L;
+
+ /** The internal array. */
+ private double[] array;
+
+ /**
+ * Constructor for an existing array.
+ * @param array The array to be wrapped. This array is copied into an internal data structure to prevent it from
+ * being changed.
+ */
+ public DoubleArray(final double... array) {
+ this.array = new double[array.length];
+ System.arraycopy(array, 0, this.array, 0, array.length);
+ }
+
+ /**
+ * Constructor for part of an existing array.
+ * @param array The array to be wrapped. This array is copied into an internal data structure to prevent it from
+ * being changed.
+ * @param start The index of the first element {@code array} to be included in this instance.
+ * @param length The number of elements in {@code array} to be included in this instance.
+ */
+ public DoubleArray(final double[] array, final int start, final int length) {
+ this.array = new double[length];
+ System.arraycopy(array, start, this.array, 0, array.length);
+ }
+
+ /**
+ * Constructor for an existing sequence.
+ * @param sequence The sequence whose content will be the content of this.
+ * This content is copied into an internal data structure to prevent it from being changed.
+ */
+ public DoubleArray(final DoubleSequence sequence) {
+ this.array = new double[sequence.length()];
+ for (int index = 0; index < sequence.length(); index ++) {
+ this.array[index] = sequence.doubleAt(index);
+ }
+ }
+
+ @Override
+ public int length() {
+ return this.array.length;
+ }
+
+ @Override
+ public double doubleAt(final int index) {
+ return this.array[index];
+ }
+
+ @Override
+ public DoubleSequence subSequence(final int start, final int end) {
+ return new DoubleArray(this.array, start, end - start);
+ }
+
+ @Override
+ public double[] toArray() {
+ /* Return a copy of the array to prevent the internal copy from changing. */
+ final double[] returnValue = new double[this.array.length];
+ System.arraycopy(this.array, 0, returnValue, 0, this.array.length);
+ return returnValue;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (! (other instanceof DoubleSequence)) {
+ return false;
+ }
+ final DoubleSequence otherDoubleSequence = (DoubleSequence) other;
+ if (this.array.length != otherDoubleSequence.length()) {
+ return false;
+ }
+ for (int index = 0; index < this.array.length; index ++) {
+ if (doubleAt(index) != otherDoubleSequence.doubleAt(index)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return Arrays.toString(this.array);
+ }
+
+ /**
+ * Convenience method that returns the value of the last element in this array.
+ * @return The last element in this array.
+ */
+ public double lastDouble() {
+ final int index = this.length() - 1;
+ return this.doubleAt(index);
+ }
+
+ @Override
+ public DoubleSequencePlus asPlus() {
+ return this;
+ }
+
+ @Override
+ public DoubleSequenceMutable asMutable() {
+ return null;
+ }
+
+ @Override
+ public DoublePrimitiveIterator iterator() {
+ return new DoubleSequenceIterator(this);
+ }
+
+ @Override
+ public DoublePrimitiveIterator iteratorReverse() {
+ return new DoubleSequenceIterator(this, true);
+ }
+
+ @Override
+ public int binarySearch(final double value) {
+ return Arrays.binarySearch(this.array, value);
+ }
+
+}
Property changes on: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArray.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArrayBuilder.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArrayBuilder.java (rev 0)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArrayBuilder.java 2023-01-01 23:19:43 UTC (rev 12997)
@@ -0,0 +1,323 @@
+/*
+ * Copyright 2023 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.primitive.sequence;
+
+import org.axsl.primitive.sequence.DoubleSequence;
+import org.axsl.primitive.sequence.DoubleSequenceMutable;
+
+import java.util.Arrays;
+import java.util.EmptyStackException;
+
+/**
+ * <p>A mutable and automatically resizable collection of primitive {@link Double#TYPE}, whose methods are analogous
+ * to, but a subset of, what is available in {@link StringBuilder}, using doubles instead of chars.</p>
+ *
+ * <p>This class can also operate as a stack of primitive doubles, the methods {@link #push(double)}, {@link #pop()},
+ * {@link #peek()}, and {@link #empty()} being provided for that purpose.</p>
+ */
+public class DoubleArrayBuilder extends AbstractDoubleSequence implements DoubleSequenceMutable {
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -1176730727260937528L;
+
+ /** The initial size of the array of no initial size is specified. */
+ private static final int DEFAULT_INITIAL_SIZE = 10;
+
+ /** The internal array. */
+ private double[] backingArray;
+
+ /** The number of doubles in {@link #backingArray} actually used. */
+ private int length;
+
+ /**
+ * Constructor.
+ * @param initialCapacity The initial size of the internal array.
+ */
+ public DoubleArrayBuilder(final int initialCapacity) {
+ this.backingArray = new double[initialCapacity];
+ }
+
+ /**
+ * No-args constructor.
+ * Creates an instance with an initial size of 10.
+ */
+ public DoubleArrayBuilder() {
+ this(DEFAULT_INITIAL_SIZE);
+ }
+
+ @Override
+ public int length() {
+ return this.length;
+ }
+
+ @Override
+ public double doubleAt(final int index) {
+ if ((index < 0) || (index >= this.length)) {
+ throwIndexOutOfBoundsException(index, this.length);
+ }
+ return this.backingArray[index];
+ }
+
+ @Override
+ public DoubleSequence subSequence(final int start, final int end) {
+ if (start < 0) {
+ throwIndexOutOfBoundsException(start, this.length);
+ }
+ if (end > this.length) {
+ throwIndexOutOfBoundsException(end, this.length);
+ }
+ if (start > end) {
+ throw new StringIndexOutOfBoundsException("Index out of range: " + (end - start));
+ }
+ final DoubleArrayBuilder returnBuilder = new DoubleArrayBuilder(this.length);
+ for (int index = start; index < end; index ++) {
+ returnBuilder.append(this.backingArray[index]);
+ }
+ return returnBuilder;
+ }
+
+ @Override
+ public double[] toArray() {
+ final double[] returnArray = new double[this.length];
+ System.arraycopy(this.backingArray, 0, returnArray, 0, this.length);
+ return returnArray;
+ }
+
+ @Override
+ public DoubleArray toImmutable() {
+ return new DoubleArray(this);
+ }
+
+ @Override
+ public String toString() {
+ return Arrays.toString(toArray());
+ }
+
+ /**
+ * Ensures that the capacity is at least equal to the specified minimum.
+ * If the current capacity is less than the argument, then a new internal array is allocated with greater capacity.
+ * The new capacity is the larger of:
+ * <ul>
+ * <li>The {@code minimumCapacity} argument.
+ * <li>Twice the old capacity, plus {@code 2}.
+ * </ul>
+ * If the {@code minimumCapacity} argument is nonpositive, this method takes no action and simply returns.
+ * @param minimumCapacity The minimum desired capacity.
+ * @see "java.lang.AbstractStringBuilder#ensureCapacity(int)"
+ */
+ public void ensureCapacity(final int minimumCapacity) {
+ if (minimumCapacity > this.backingArray.length) {
+ expandCapacity(minimumCapacity);
+ }
+ }
+
+ /**
+ * Implements the expansion semantics of ensureCapacity with no size check or synchronization.
+ * @param minimumCapacity The minimum desired capacity.
+ * @see This code is based on AbstractStringBuilder.expandCapacity(int).
+ */
+ private void expandCapacity(final int minimumCapacity) {
+ int newCapacity = (this.backingArray.length + 1) * 2;
+ if (newCapacity < 0) {
+ newCapacity = Integer.MAX_VALUE;
+ } else if (minimumCapacity > newCapacity) {
+ newCapacity = minimumCapacity;
+ }
+ this.backingArray = Arrays.copyOf(this.backingArray, newCapacity);
+ }
+
+ /**
+ * Append a {@link Double#TYPE} to this structure.
+ * @param doubleToAppend The {@link Double#TYPE} to append.
+ * @return This object.
+ */
+ public DoubleArrayBuilder append(final double doubleToAppend) {
+ ensureCapacity(this.length + 1);
+ this.backingArray[this.length] = doubleToAppend;
+ this.length ++;
+ return this;
+ }
+
+ @Override
+ public DoubleArrayBuilder append(final double... doublesToAppend) {
+ ensureCapacity(this.length + doublesToAppend.length);
+ for (int index = 0; index < doublesToAppend.length; index ++) {
+ this.backingArray[this.length] = doublesToAppend[index];
+ this.length ++;
+ }
+ return this;
+ }
+
+ @Override
+ public DoubleArrayBuilder append(final DoubleSequence sequence) {
+ ensureCapacity(length() + sequence.length());
+ return append(sequence, 0, sequence.length());
+ }
+
+ @Override
+ public DoubleArrayBuilder append(final DoubleSequence sequence, final int start, final int end) {
+ ensureCapacity(length() + end - start);
+ for (int index = start; index < end; index ++) {
+ this.backingArray[this.length] = sequence.doubleAt(index);
+ this.length ++;
+ }
+ return this;
+ }
+
+ /**
+ * Removes the value at a given index.
+ * @param index The index whose value should be deleted.
+ * @return This object.
+ * @throws IndexOutOfBoundsException If the {@code index} is negative or greater than or equal to {@link #length()}.
+ */
+ public DoubleArrayBuilder deleteDoubleAt(final int index) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index >= this.length)) {
+ throwIndexOutOfBoundsException(index, this.length);
+ }
+ System.arraycopy(this.backingArray, index + 1, this.backingArray, index, this.length - index - 1);
+ this.length--;
+ return this;
+ }
+
+ /**
+ * Removes the longs in a range of this sequence.
+ * The range begins at the specified {@code start} and extends to the long at index {@code end - 1} or to the end of
+ * the sequence if no such long exists.
+ * If {@code start} is equal to {@code end}, no changes are made.
+ * @param start The beginning index, inclusive.
+ * @param end The ending index, exclusive.
+ * @return This object.
+ * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than
+ * {@code end}.
+ */
+ public DoubleArrayBuilder delete(final int start, final int end) throws IndexOutOfBoundsException {
+ if (start < 0) {
+ throwIndexOutOfBoundsException(start, this.length);
+ }
+ int adjustedEnd = end;
+ if (end > this.length) {
+ adjustedEnd = this.length;
+ }
+ if (start > adjustedEnd) {
+ throw new IndexOutOfBoundsException("Index out of range: " + start);
+ }
+ final int len = adjustedEnd - start;
+ if (len > 0) {
+ System.arraycopy(this.backingArray, start + len, this.backingArray, start, this.length - adjustedEnd);
+ this.length -= len;
+ }
+ return this;
+ }
+
+ @Override
+ public double push(final double doubleToPush) {
+ append(doubleToPush);
+ return doubleToPush;
+ }
+
+ @Override
+ public double pop() {
+ final int index = this.length - 1;
+ final double returnValue = doubleAt(index);
+ deleteDoubleAt(index);
+ return returnValue;
+ }
+
+ @Override
+ public double peek() {
+ if (this.length < 1) {
+ throw new EmptyStackException();
+ }
+ final int index = this.length - 1;
+ return doubleAt(index);
+ }
+
+ @Override
+ public boolean empty() {
+ return this.length < 1;
+ }
+
+ @Override
+ public DoubleSequenceMutable asMutable() {
+ return this;
+ }
+
+ @Override
+ public void setLength(final int newLength) {
+ if (newLength < 0) {
+ throwIndexOutOfBoundsException(newLength, this.length);
+ }
+ ensureCapacity(newLength);
+ if (newLength > this.length) {
+ for (int index = this.length; index < newLength; index ++) {
+ this.backingArray[index] = 0;
+ }
+ }
+ this.length = newLength;
+ }
+
+ @Override
+ public void setDoubleAt(final int index, final double newDouble) {
+ if ((index < 0)
+ || (index >= this.length)) {
+ throw new ArrayIndexOutOfBoundsException(index);
+ }
+ this.backingArray[index] = newDouble;
+ }
+
+ @Override
+ public void sort() {
+ Arrays.sort(this.backingArray);
+ }
+
+ @Override
+ public void swap(final int index1, final int index2) {
+ final double temp = this.backingArray[index1];
+ this.backingArray[index1] = this.backingArray[index2];
+ this.backingArray[index2] = temp;
+ }
+
+ @Override
+ public int binarySearch(final double value) {
+ return Arrays.binarySearch(this.backingArray, 0, length(), value);
+ }
+
+ @Override
+ public int capacity() {
+ return this.backingArray.length;
+ }
+
+ @Override
+ public void trimToSize() {
+ if (this.length < this.backingArray.length) {
+ this.backingArray = Arrays.copyOf(this.backingArray, this.length);
+ }
+ }
+
+}
Property changes on: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleArrayBuilder.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleSequenceIterator.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleSequenceIterator.java (rev 0)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleSequenceIterator.java 2023-01-01 23:19:43 UTC (rev 12997)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2023 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.primitive.sequence;
+
+import org.axsl.primitive.sequence.DoublePrimitiveIterator;
+import org.axsl.primitive.sequence.DoubleSequence;
+
+import java.util.NoSuchElementException;
+
+/**
+ * Iterates an instance of {@link DoubleSequence}.
+ */
+public class DoubleSequenceIterator implements DoublePrimitiveIterator {
+
+ /** The sequence being iterated. */
+ private DoubleSequence sequence;
+
+ /** The index to the "next" item to return. Conceptually, the iterator pointer sits between {@code index - 1} and
+ * {@code index}. */
+ private int index;
+
+ /** Indicates whether this iterator iterates in reverse order. */
+ private boolean reverseOrder;
+
+ /**
+ * Constructor for the simple case of iterating starting at the first element, and progressing toward the last.
+ * @param sequence The sequence to be iterated.
+ */
+ public DoubleSequenceIterator(final DoubleSequence sequence) {
+ this(sequence, false);
+ }
+
+ /**
+ * Constructor for the case where we wish to iterate over the content in reverse order.
+ * @param sequence The sequence to be iterated.
+ * @param reverseOrder Indicates whether this iterator should progress forward, from lower index to
+ * higher index (false), or reverse, from higher index to lower (true);
+ */
+ public DoubleSequenceIterator(final DoubleSequence sequence, final boolean reverseOrder) {
+ this.sequence = sequence;
+ this.reverseOrder = reverseOrder;
+ if (reverseOrder) {
+ this.index = sequence.length();
+ } else {
+ this.index = 0;
+ }
+
+ }
+
+ /**
+ * Indicates whether this iterator has at least one more element.
+ * Follows the semantics of {@link java.util.Iterator#hasNext()}.
+ * @return True if and only if this iterator can return at least one more element.
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ if (this.reverseOrder) {
+ return this.index > 0;
+ } else {
+ return this.index < this.sequence.length();
+ }
+ }
+
+ /**
+ * Returns the next element in the iteration.
+ * Follows the semantics of {@link java.util.Iterator#next()}.
+ * @return The next element in the iteration.
+ * @throws NoSuchElementException If the iteration has no more elements.
+ * Check {@link #hasNext()} first to avoid this exception.
+ * @see java.util.Iterator#next()
+ */
+ public double nextDouble() {
+ if (! hasNext()) {
+ throw new NoSuchElementException();
+ }
+ if (this.reverseOrder) {
+ final double returnValue = sequence.doubleAt(this.index - 1);
+ this.index --;
+ return returnValue;
+ } else {
+ final double returnValue = sequence.doubleAt(this.index);
+ this.index ++;
+ return returnValue;
+ }
+ }
+
+}
Property changes on: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/DoubleSequenceIterator.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArray.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArray.java (rev 0)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArray.java 2023-01-01 23:19:43 UTC (rev 12997)
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2023 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.primitive.sequence;
+
+import org.axsl.primitive.sequence.FloatPrimitiveIterator;
+import org.axsl.primitive.sequence.FloatSequence;
+import org.axsl.primitive.sequence.FloatSequenceMutable;
+import org.axsl.primitive.sequence.FloatSequencePlus;
+
+import java.util.Arrays;
+
+/**
+ * Wrapper around an array of {@link Float#TYPE}s, intended to be similar in scope and purpose to what {@link String}
+ * does for an array of chars.
+ * Instances of this class are immutable.
+ */
+public class FloatArray extends AbstractFloatSequence implements FloatSequencePlus {
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -2196475282575408782L;
+
+ /** The internal array. */
+ private float[] array;
+
+ /**
+ * Constructor for an existing array.
+ * @param array The array to be wrapped. This array is copied into an internal data structure to prevent it from
+ * being changed.
+ */
+ public FloatArray(final float... array) {
+ this.array = new float[array.length];
+ System.arraycopy(array, 0, this.array, 0, array.length);
+ }
+
+ /**
+ * Constructor for part of an existing array.
+ * @param array The array to be wrapped. This array is copied into an internal data structure to prevent it from
+ * being changed.
+ * @param start The index of the first element {@code array} to be included in this instance.
+ * @param length The number of elements in {@code array} to be included in this instance.
+ */
+ public FloatArray(final float[] array, final int start, final int length) {
+ this.array = new float[length];
+ System.arraycopy(array, start, this.array, 0, array.length);
+ }
+
+ /**
+ * Constructor for an existing sequence.
+ * @param sequence The sequence whose content will be the content of this.
+ * This content is copied into an internal data structure to prevent it from being changed.
+ */
+ public FloatArray(final FloatSequence sequence) {
+ this.array = new float[sequence.length()];
+ for (int index = 0; index < sequence.length(); index ++) {
+ this.array[index] = sequence.floatAt(index);
+ }
+ }
+
+ @Override
+ public int length() {
+ return this.array.length;
+ }
+
+ @Override
+ public float floatAt(final int index) {
+ return this.array[index];
+ }
+
+ @Override
+ public FloatSequence subSequence(final int start, final int end) {
+ return new FloatArray(this.array, start, end - start);
+ }
+
+ @Override
+ public float[] toArray() {
+ /* Return a copy of the array to prevent the internal copy from changing. */
+ final float[] returnValue = new float[this.array.length];
+ System.arraycopy(this.array, 0, returnValue, 0, this.array.length);
+ return returnValue;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == null) {
+ return false;
+ }
+ if (! (other instanceof FloatSequence)) {
+ return false;
+ }
+ final FloatSequence otherFloatSequence = (FloatSequence) other;
+ if (this.array.length != otherFloatSequence.length()) {
+ return false;
+ }
+ for (int index = 0; index < this.array.length; index ++) {
+ if (floatAt(index) != otherFloatSequence.floatAt(index)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return Arrays.toString(this.array);
+ }
+
+ /**
+ * Convenience method that returns the value of the last element in this array.
+ * @return The last element in this array.
+ */
+ public float lastFloat() {
+ final int index = this.length() - 1;
+ return this.floatAt(index);
+ }
+
+ @Override
+ public FloatSequencePlus asPlus() {
+ return this;
+ }
+
+ @Override
+ public FloatSequenceMutable asMutable() {
+ return null;
+ }
+
+ @Override
+ public FloatPrimitiveIterator iterator() {
+ return new FloatSequenceIterator(this);
+ }
+
+ @Override
+ public FloatPrimitiveIterator iteratorReverse() {
+ return new FloatSequenceIterator(this, true);
+ }
+
+ @Override
+ public int binarySearch(final float value) {
+ return Arrays.binarySearch(this.array, value);
+ }
+
+}
Property changes on: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArray.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArrayBuilder.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArrayBuilder.java (rev 0)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArrayBuilder.java 2023-01-01 23:19:43 UTC (rev 12997)
@@ -0,0 +1,323 @@
+/*
+ * Copyright 2023 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.primitive.sequence;
+
+import org.axsl.primitive.sequence.FloatSequence;
+import org.axsl.primitive.sequence.FloatSequenceMutable;
+
+import java.util.Arrays;
+import java.util.EmptyStackException;
+
+/**
+ * <p>A mutable and automatically resizable collection of primitive {@link Float#TYPE}, whose methods are analogous
+ * to, but a subset of, what is available in {@link StringBuilder}, using floats instead of chars.</p>
+ *
+ * <p>This class can also operate as a stack of primitive floats, the methods {@link #push(float)}, {@link #pop()},
+ * {@link #peek()}, and {@link #empty()} being provided for that purpose.</p>
+ */
+public class FloatArrayBuilder extends AbstractFloatSequence implements FloatSequenceMutable {
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = -1176730727260937528L;
+
+ /** The initial size of the array of no initial size is specified. */
+ private static final int DEFAULT_INITIAL_SIZE = 10;
+
+ /** The internal array. */
+ private float[] backingArray;
+
+ /** The number of floats in {@link #backingArray} actually used. */
+ private int length;
+
+ /**
+ * Constructor.
+ * @param initialCapacity The initial size of the internal array.
+ */
+ public FloatArrayBuilder(final int initialCapacity) {
+ this.backingArray = new float[initialCapacity];
+ }
+
+ /**
+ * No-args constructor.
+ * Creates an instance with an initial size of 10.
+ */
+ public FloatArrayBuilder() {
+ this(DEFAULT_INITIAL_SIZE);
+ }
+
+ @Override
+ public int length() {
+ return this.length;
+ }
+
+ @Override
+ public float floatAt(final int index) {
+ if ((index < 0) || (index >= this.length)) {
+ throwIndexOutOfBoundsException(index, this.length);
+ }
+ return this.backingArray[index];
+ }
+
+ @Override
+ public FloatSequence subSequence(final int start, final int end) {
+ if (start < 0) {
+ throwIndexOutOfBoundsException(start, this.length);
+ }
+ if (end > this.length) {
+ throwIndexOutOfBoundsException(end, this.length);
+ }
+ if (start > end) {
+ throw new StringIndexOutOfBoundsException("Index out of range: " + (end - start));
+ }
+ final FloatArrayBuilder returnBuilder = new FloatArrayBuilder(this.length);
+ for (int index = start; index < end; index ++) {
+ returnBuilder.append(this.backingArray[index]);
+ }
+ return returnBuilder;
+ }
+
+ @Override
+ public float[] toArray() {
+ final float[] returnArray = new float[this.length];
+ System.arraycopy(this.backingArray, 0, returnArray, 0, this.length);
+ return returnArray;
+ }
+
+ @Override
+ public FloatArray toImmutable() {
+ return new FloatArray(this);
+ }
+
+ @Override
+ public String toString() {
+ return Arrays.toString(toArray());
+ }
+
+ /**
+ * Ensures that the capacity is at least equal to the specified minimum.
+ * If the current capacity is less than the argument, then a new internal array is allocated with greater capacity.
+ * The new capacity is the larger of:
+ * <ul>
+ * <li>The {@code minimumCapacity} argument.
+ * <li>Twice the old capacity, plus {@code 2}.
+ * </ul>
+ * If the {@code minimumCapacity} argument is nonpositive, this method takes no action and simply returns.
+ * @param minimumCapacity The minimum desired capacity.
+ * @see "java.lang.AbstractStringBuilder#ensureCapacity(int)"
+ */
+ public void ensureCapacity(final int minimumCapacity) {
+ if (minimumCapacity > this.backingArray.length) {
+ expandCapacity(minimumCapacity);
+ }
+ }
+
+ /**
+ * Implements the expansion semantics of ensureCapacity with no size check or synchronization.
+ * @param minimumCapacity The minimum desired capacity.
+ * @see This code is based on AbstractStringBuilder.expandCapacity(int).
+ */
+ private void expandCapacity(final int minimumCapacity) {
+ int newCapacity = (this.backingArray.length + 1) * 2;
+ if (newCapacity < 0) {
+ newCapacity = Integer.MAX_VALUE;
+ } else if (minimumCapacity > newCapacity) {
+ newCapacity = minimumCapacity;
+ }
+ this.backingArray = Arrays.copyOf(this.backingArray, newCapacity);
+ }
+
+ /**
+ * Append a {@link Float#TYPE} to this structure.
+ * @param floatToAppend The {@link Float#TYPE} to append.
+ * @return This object.
+ */
+ public FloatArrayBuilder append(final float floatToAppend) {
+ ensureCapacity(this.length + 1);
+ this.backingArray[this.length] = floatToAppend;
+ this.length ++;
+ return this;
+ }
+
+ @Override
+ public FloatArrayBuilder append(final float... floatsToAppend) {
+ ensureCapacity(this.length + floatsToAppend.length);
+ for (int index = 0; index < floatsToAppend.length; index ++) {
+ this.backingArray[this.length] = floatsToAppend[index];
+ this.length ++;
+ }
+ return this;
+ }
+
+ @Override
+ public FloatArrayBuilder append(final FloatSequence sequence) {
+ ensureCapacity(length() + sequence.length());
+ return append(sequence, 0, sequence.length());
+ }
+
+ @Override
+ public FloatArrayBuilder append(final FloatSequence sequence, final int start, final int end) {
+ ensureCapacity(length() + end - start);
+ for (int index = start; index < end; index ++) {
+ this.backingArray[this.length] = sequence.floatAt(index);
+ this.length ++;
+ }
+ return this;
+ }
+
+ /**
+ * Removes the value at a given index.
+ * @param index The index whose value should be deleted.
+ * @return This object.
+ * @throws IndexOutOfBoundsException If the {@code index} is negative or greater than or equal to {@link #length()}.
+ */
+ public FloatArrayBuilder deleteFloatAt(final int index) throws IndexOutOfBoundsException {
+ if ((index < 0) || (index >= this.length)) {
+ throwIndexOutOfBoundsException(index, this.length);
+ }
+ System.arraycopy(this.backingArray, index + 1, this.backingArray, index, this.length - index - 1);
+ this.length--;
+ return this;
+ }
+
+ /**
+ * Removes the longs in a range of this sequence.
+ * The range begins at the specified {@code start} and extends to the long at index {@code end - 1} or to the end of
+ * the sequence if no such long exists.
+ * If {@code start} is equal to {@code end}, no changes are made.
+ * @param start The beginning index, inclusive.
+ * @param end The ending index, exclusive.
+ * @return This object.
+ * @throws IndexOutOfBoundsException If {@code start} is negative, greater than {@link #length()}, or greater than
+ * {@code end}.
+ */
+ public FloatArrayBuilder delete(final int start, final int end) throws IndexOutOfBoundsException {
+ if (start < 0) {
+ throwIndexOutOfBoundsException(start, this.length);
+ }
+ int adjustedEnd = end;
+ if (end > this.length) {
+ adjustedEnd = this.length;
+ }
+ if (start > adjustedEnd) {
+ throw new IndexOutOfBoundsException("Index out of range: " + start);
+ }
+ final int len = adjustedEnd - start;
+ if (len > 0) {
+ System.arraycopy(this.backingArray, start + len, this.backingArray, start, this.length - adjustedEnd);
+ this.length -= len;
+ }
+ return this;
+ }
+
+ @Override
+ public float push(final float floatToPush) {
+ append(floatToPush);
+ return floatToPush;
+ }
+
+ @Override
+ public float pop() {
+ final int index = this.length - 1;
+ final float returnValue = floatAt(index);
+ deleteFloatAt(index);
+ return returnValue;
+ }
+
+ @Override
+ public float peek() {
+ if (this.length < 1) {
+ throw new EmptyStackException();
+ }
+ final int index = this.length - 1;
+ return floatAt(index);
+ }
+
+ @Override
+ public boolean empty() {
+ return this.length < 1;
+ }
+
+ @Override
+ public FloatSequenceMutable asMutable() {
+ return this;
+ }
+
+ @Override
+ public void setLength(final int newLength) {
+ if (newLength < 0) {
+ throwIndexOutOfBoundsException(newLength, this.length);
+ }
+ ensureCapacity(newLength);
+ if (newLength > this.length) {
+ for (int index = this.length; index < newLength; index ++) {
+ this.backingArray[index] = 0;
+ }
+ }
+ this.length = newLength;
+ }
+
+ @Override
+ public void setFloatAt(final int index, final float newFloat) {
+ if ((index < 0)
+ || (index >= this.length)) {
+ throw new ArrayIndexOutOfBoundsException(index);
+ }
+ this.backingArray[index] = newFloat;
+ }
+
+ @Override
+ public void sort() {
+ Arrays.sort(this.backingArray);
+ }
+
+ @Override
+ public void swap(final int index1, final int index2) {
+ final float temp = this.backingArray[index1];
+ this.backingArray[index1] = this.backingArray[index2];
+ this.backingArray[index2] = temp;
+ }
+
+ @Override
+ public int binarySearch(final float value) {
+ return Arrays.binarySearch(this.backingArray, 0, length(), value);
+ }
+
+ @Override
+ public int capacity() {
+ return this.backingArray.length;
+ }
+
+ @Override
+ public void trimToSize() {
+ if (this.length < this.backingArray.length) {
+ this.backingArray = Arrays.copyOf(this.backingArray, this.length);
+ }
+ }
+
+}
Property changes on: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatArrayBuilder.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatSequenceIterator.java
===================================================================
--- trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatSequenceIterator.java (rev 0)
+++ trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatSequenceIterator.java 2023-01-01 23:19:43 UTC (rev 12997)
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2023 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.primitive.sequence;
+
+import org.axsl.primitive.sequence.FloatPrimitiveIterator;
+import org.axsl.primitive.sequence.FloatSequence;
+
+import java.util.NoSuchElementException;
+
+/**
+ * Iterates an instance of {@link FloatSequence}.
+ */
+public class FloatSequenceIterator implements FloatPrimitiveIterator {
+
+ /** The sequence being iterated. */
+ private FloatSequence sequence;
+
+ /** The index to the "next" item to return. Conceptually, the iterator pointer sits between {@code index - 1} and
+ * {@code index}. */
+ private int index;
+
+ /** Indicates whether this iterator iterates in reverse order. */
+ private boolean reverseOrder;
+
+ /**
+ * Constructor for the simple case of iterating starting at the first element, and progressing toward the last.
+ * @param sequence The sequence to be iterated.
+ */
+ public FloatSequenceIterator(final FloatSequence sequence) {
+ this(sequence, false);
+ }
+
+ /**
+ * Constructor for the case where we wish to iterate over the content in reverse order.
+ * @param sequence The sequence to be iterated.
+ * @param reverseOrder Indicates whether this iterator should progress forward, from lower index to
+ * higher index (false), or reverse, from higher index to lower (true);
+ */
+ public FloatSequenceIterator(final FloatSequence sequence, final boolean reverseOrder) {
+ this.sequence = sequence;
+ this.reverseOrder = reverseOrder;
+ if (reverseOrder) {
+ this.index = sequence.length();
+ } else {
+ this.index = 0;
+ }
+
+ }
+
+ /**
+ * Indicates whether this iterator has at least one more element.
+ * Follows the semantics of {@link java.util.Iterator#hasNext()}.
+ * @return True if and only if this iterator can return at least one more element.
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ if (this.reverseOrder) {
+ return this.index > 0;
+ } else {
+ return this.index < this.sequence.length();
+ }
+ }
+
+ /**
+ * Returns the next element in the iteration.
+ * Follows the semantics of {@link java.util.Iterator#next()}.
+ * @return The next element in the iteration.
+ * @throws NoSuchElementException If the iteration has no more elements.
+ * Check {@link #hasNext()} first to avoid this exception.
+ * @see java.util.Iterator#next()
+ */
+ public float nextFloat() {
+ if (! hasNext()) {
+ throw new NoSuchElementException();
+ }
+ if (this.reverseOrder) {
+ final float returnValue = sequence.floatAt(this.index - 1);
+ this.index --;
+ return returnValue;
+ } else {
+ final float returnValue = sequence.floatAt(this.index);
+ this.index ++;
+ return returnValue;
+ }
+ }
+
+}
Property changes on: trunk/foray/foray-primitive/src/main/java/org/foray/primitive/sequence/FloatSequenceIterator.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2023-01-01 15:15:19
|
Revision: 12996
http://sourceforge.net/p/foray/code/12996
Author: victormote
Date: 2023-01-01 15:15:15 +0000 (Sun, 01 Jan 2023)
Log Message:
-----------
Conform to aXSL change: Change return type from array to List.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Table4a.java
trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/AbstractTablePartPnr.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java 2023-01-01 12:42:15 UTC (rev 12995)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java 2023-01-01 15:15:15 UTC (rev 12996)
@@ -280,8 +280,8 @@
double tuMin = Double.MAX_VALUE;
/* Loop through the columns and total the fixed widths and proportional
* units for each one. */
- for (int i = 0; i < table.getTableColumns().length; i++) {
- final TableColumn column = table.getTableColumns()[i];
+ for (int i = 0; i < table.getTableColumns().size(); i++) {
+ final TableColumn column = table.getTableColumns().get(i);
if (column == null) {
getAreaTree().logWarning("No table-column specification for column " + (i + 1) + ".");
} else {
@@ -379,8 +379,8 @@
}
// Now distribute the extra units onto each column and set offsets
int columnOffset = 0;
- for (int i = 0; i < table.getTableColumns().length; i++) {
- final TableColumn column = table.getTableColumns()[i];
+ for (int i = 0; i < table.getTableColumns().size(); i++) {
+ final TableColumn column = table.getTableColumns().get(i);
if (column != null) {
//Compute the width of the column
int colWidth = -1;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Table4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Table4a.java 2023-01-01 12:42:15 UTC (rev 12995)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Table4a.java 2023-01-01 15:15:15 UTC (rev 12996)
@@ -223,13 +223,8 @@
}
@Override
- public TableColumn4a[] getTableColumns() {
- final TableColumn4a[] returnColumns =
- new TableColumn4a[this.columns.size()];
- for (int i = 0; i < this.columns.size(); i++) {
- returnColumns[i] = this.columns.get(i);
- }
- return returnColumns;
+ public List<TableColumn4a> getTableColumns() {
+ return this.columns;
}
@Override
Modified: trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/AbstractTablePartPnr.java
===================================================================
--- trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/AbstractTablePartPnr.java 2023-01-01 12:42:15 UTC (rev 12995)
+++ trunk/foray/foray-pioneer/src/main/java/org/foray/pioneer/AbstractTablePartPnr.java 2023-01-01 15:15:15 UTC (rev 12996)
@@ -92,8 +92,7 @@
if (getProgress() == FoNodePnr.START) {
if (this.rowSpanMgr == null) {
- this.rowSpanMgr = new RowSpanMgr(table.getTableColumns().length,
- this.getLayout());
+ this.rowSpanMgr = new RowSpanMgr(table.getTableColumns().size(), this.getLayout());
}
// if (this.isInListBody) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2023-01-01 12:42:20
|
Revision: 12995
http://sourceforge.net/p/foray/code/12995
Author: victormote
Date: 2023-01-01 12:42:15 +0000 (Sun, 01 Jan 2023)
Log Message:
-----------
Conform to aXSL changes: Convert more return types from Number to 1000x int.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2023-01-01 01:30:16 UTC (rev 12994)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2023-01-01 12:42:15 UTC (rev 12995)
@@ -2701,7 +2701,7 @@
}
@Override
- public Number traitSpeechRate(final FoContext context) {
+ public int traitSpeechRate(final FoContext context) {
return getPropertyList().traitSpeechRate(this, context);
}
@@ -2726,12 +2726,12 @@
}
@Override
- public Number traitPitchRange(final FoContext context) {
+ public int traitPitchRange(final FoContext context) {
return getPropertyList().traitPitchRange(this, context);
}
@Override
- public Number traitVolume(final FoContext context) {
+ public int traitVolume(final FoContext context) {
return getPropertyList().traitVolume(this, context);
}
@@ -2756,12 +2756,12 @@
}
@Override
- public Number traitRichness(final FoContext context) {
+ public int traitRichness(final FoContext context) {
return getPropertyList().traitRichness(this, context);
}
@Override
- public Number traitStress(final FoContext context) {
+ public int traitStress(final FoContext context) {
return getPropertyList().traitStress(this, context);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2023-01-01 01:30:16 UTC (rev 12994)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2023-01-01 12:42:15 UTC (rev 12995)
@@ -4048,7 +4048,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The speech-rate property.
*/
- public Number traitSpeechRate(final FoObj fobj, final FoContext context) {
+ public int traitSpeechRate(final FoObj fobj, final FoContext context) {
final PdSpeechRate property = (PdSpeechRate) getProperty(FoPropertyId.SPEECH_RATE);
if (property != null) {
return property.getValue(context, fobj);
@@ -4128,7 +4128,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The pitch-range property.
*/
- public Number traitPitchRange(final FoObj fobj, final FoContext context) {
+ public int traitPitchRange(final FoObj fobj, final FoContext context) {
final AbstractAudioDial property = (AbstractAudioDial) getProperty(FoPropertyId.PITCH_RANGE);
if (property != null) {
return property.getValue(context, fobj);
@@ -4142,7 +4142,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The volume property.
*/
- public Number traitVolume(final FoObj fobj, final FoContext context) {
+ public int traitVolume(final FoObj fobj, final FoContext context) {
final PdVolume property = (PdVolume) getProperty(FoPropertyId.VOLUME);
if (property != null) {
return property.getValue(context, fobj);
@@ -4208,7 +4208,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The richness property.
*/
- public Number traitRichness(final FoObj fobj, final FoContext context) {
+ public int traitRichness(final FoObj fobj, final FoContext context) {
final AbstractAudioDial property = (AbstractAudioDial) getProperty(FoPropertyId.RICHNESS);
if (property != null) {
return property.getValue(context, fobj);
@@ -4222,7 +4222,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The stress property.
*/
- public Number traitStress(final FoObj fobj, final FoContext context) {
+ public int traitStress(final FoObj fobj, final FoContext context) {
final AbstractAudioDial property = (AbstractAudioDial) getProperty(FoPropertyId.STRESS);
if (property != null) {
return property.getValue(context, fobj);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2023-01-01 01:30:16 UTC (rev 12994)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2023-01-01 12:42:15 UTC (rev 12995)
@@ -95,9 +95,9 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public Number getValue(final FoContext context, final FoObj fobj) {
+ public int getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalNumber()) {
- return value().evalNumber();
+ return value().evalNumber().intValue();
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
@@ -121,8 +121,7 @@
* is needed.
* @return The initial value for this property.
*/
- public static Number getValueNoInstance(final FoContext context,
- final FoObj fobj, final FoPropertyId propertyType) {
+ public static int getValueNoInstance(final FoContext context, final FoObj fobj, final FoPropertyId propertyType) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
switch (propertyType) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2023-01-01 01:30:16 UTC (rev 12994)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2023-01-01 12:42:15 UTC (rev 12995)
@@ -152,7 +152,7 @@
* is computed in units of words-per-minute, so we multiply by
* 60,000 to convert from minutes to milliseconds.
*/
- final double base = 1 / fobj.traitSpeechRate(context).doubleValue() * 60000;
+ final double base = 1 / fobj.traitSpeechRate(context) * 60000;
return (int) Math.round(base * percentage.doubleValue());
}
if (value().canEvalKeyword()) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java 2023-01-01 01:30:16 UTC (rev 12994)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java 2023-01-01 12:42:15 UTC (rev 12995)
@@ -117,9 +117,9 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public Number getValue(final FoContext context, final FoObj fobj) {
+ public int getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalNumber()) {
- return value().evalNumber();
+ return value().evalNumber().intValue();
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
@@ -143,12 +143,10 @@
return PdSpeechRate.SPEECH_RATE_X_FAST;
}
case FASTER: {
- return getValueNoInstance(context, fobj).doubleValue()
- + PdSpeechRate.SPEECH_RATE_RELATIVE_INCREMENT;
+ return getValueNoInstance(context, fobj) + PdSpeechRate.SPEECH_RATE_RELATIVE_INCREMENT;
}
case SLOWER: {
- return getValueNoInstance(context, fobj).doubleValue()
- - PdSpeechRate.SPEECH_RATE_RELATIVE_INCREMENT;
+ return getValueNoInstance(context, fobj) - PdSpeechRate.SPEECH_RATE_RELATIVE_INCREMENT;
}
default: {
throw this.unexpectedRetrieval();
@@ -164,8 +162,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static Number getValueNoInstance(final FoContext context,
- final FoObj fobj) {
+ public static int getValueNoInstance(final FoContext context, final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
return parent.traitSpeechRate(context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2023-01-01 01:30:16 UTC (rev 12994)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2023-01-01 12:42:15 UTC (rev 12995)
@@ -49,22 +49,22 @@
* VOLUME_SILENT, which was invented here. */
/** The numeric equivalent of "silent". */
- public static final double VOLUME_SILENT = -1;
+ public static final int VOLUME_SILENT = -1;
/** The numeric equivalent of "extra-soft". */
- public static final double VOLUME_X_SOFT = 0;
+ public static final int VOLUME_X_SOFT = 0;
/** The numeric equivalent of "soft". */
- public static final double VOLUME_SOFT = 25;
+ public static final int VOLUME_SOFT = 25_000;
/** The numeric equivalent of "medium". */
- public static final double VOLUME_MEDIUM = 50;
+ public static final int VOLUME_MEDIUM = 50_000;
/** The numeric equivalent of "loud". */
- public static final double VOLUME_LOUD = 75;
+ public static final int VOLUME_LOUD = 75_000;
/** The numeric equivalent of "extra-loud". */
- public static final double VOLUME_X_LOUD = 100;
+ public static final int VOLUME_X_LOUD = 100_000;
/** Array of valid keywords. */
private static final FoValue[] VALID_KEYWORDS = {
@@ -121,21 +121,21 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public Number getValue(final FoContext context, final FoObj fobj) {
+ public int getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalPercentage()) {
- final Number base = getInheritedValue(context, fobj);
- if (base.doubleValue() < 0) {
+ final int base = getInheritedValue(context, fobj);
+ if (base < 0) {
// Handle the special case of "silent"
return base;
}
final Number percent = value().evalPercentage();
- double product = percent.doubleValue() * base.doubleValue();
+ int product = (int) Math.round(percent.doubleValue() * base);
product = Math.max(product, 0);
product = Math.min(product, NumericConstants.PERCENT_CONVERSION);
return product;
}
if (value().canEvalNumber()) {
- return value().evalNumber();
+ return value().evalNumber().intValue();
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
@@ -175,8 +175,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static Number getValueNoInstance(final FoContext context,
- final FoObj fobj) {
+ public static int getValueNoInstance(final FoContext context, final FoObj fobj) {
return getInheritedValue(context, fobj);
}
@@ -186,8 +185,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- private static Number getInheritedValue(final FoContext context,
- final FoObj fobj) {
+ private static int getInheritedValue(final FoContext context, final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
return parent.traitVolume(context);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2023-01-01 01:30:19
|
Revision: 12994
http://sourceforge.net/p/foray/code/12994
Author: victormote
Date: 2023-01-01 01:30:16 +0000 (Sun, 01 Jan 2023)
Log Message:
-----------
Conform to aXSL change: Normalize angle property return values to millidegrees instead of fractional degrees.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -2612,12 +2612,12 @@
}
@Override
- public Number traitAzimuth(final FoContext context) {
+ public int traitAzimuth(final FoContext context) {
return getPropertyList().traitAzimuth(this, context);
}
@Override
- public Number traitElevation(final FoContext context) {
+ public int traitElevation(final FoContext context) {
return getPropertyList().traitElevation(this, context);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -3811,7 +3811,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The azimuth property.
*/
- public Number traitAzimuth(final FoObj fobj, final FoContext context) {
+ public int traitAzimuth(final FoObj fobj, final FoContext context) {
final PdAzimuth property = (PdAzimuth) getProperty(FoPropertyId.AZIMUTH);
if (property != null) {
return property.getValue(context, fobj);
@@ -3825,7 +3825,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The elevation property.
*/
- public Number traitElevation(final FoObj fobj, final FoContext context) {
+ public int traitElevation(final FoObj fobj, final FoContext context) {
final PdElevation property = (PdElevation) getProperty(FoPropertyId.ELEVATION);
if (property != null) {
return property.getValue(context, fobj);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -102,7 +102,7 @@
throw new IllegalStateException("Value must be an angle to round.");
}
final DtAngle angle = (DtAngle) value();
- final double angleValue = angle.getValue();
+ final int angleValue = angle.getValue();
if (angleValue < AbstractGlyphOrientation.ANGLE_ROUNDING_0_CUTOFF) {
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -189,7 +189,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public Number getValue(final FoContext context, final FoObj fobj) {
+ public int getValue(final FoContext context, final FoObj fobj) {
if (value() instanceof DtAngle) {
return ((DtAngle) value()).getValue();
}
@@ -248,12 +248,12 @@
return PdAzimuth.ANGLE_RIGHT_SIDE;
}
case LEFTWARDS: {
- return (getValueNoInstance(context, fobj).doubleValue()
+ return (getValueNoInstance(context, fobj)
- PdAzimuth.ANGLE_RELATIVE_INCREMENTOR)
% NumericConstants.DEGREES_PER_CIRCLE;
}
case RIGHTWARDS: {
- return (getValueNoInstance(context, fobj).doubleValue()
+ return (getValueNoInstance(context, fobj)
+ PdAzimuth.ANGLE_RELATIVE_INCREMENTOR)
% NumericConstants.DEGREES_PER_CIRCLE;
}
@@ -271,8 +271,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static Number getValueNoInstance(final FoContext context,
- final FoObj fobj) {
+ public static int getValueNoInstance(final FoContext context, final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
return parent.traitAzimuth(context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -107,7 +107,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public Number getValue(final FoContext context, final FoObj fobj) {
+ public int getValue(final FoContext context, final FoObj fobj) {
if (value() instanceof DtAngle) {
return ((DtAngle) value()).getValue();
}
@@ -127,12 +127,12 @@
return PdElevation.ANGLE_ABOVE;
}
case HIGHER: {
- return Math.min(getValueNoInstance(context, fobj).doubleValue()
+ return Math.min(getValueNoInstance(context, fobj)
+ PdElevation.ANGLE_RELATIVE_INCREMENT,
PdElevation.ANGLE_ABOVE);
}
case LOWER: {
- return Math.max(getValueNoInstance(context, fobj).doubleValue()
+ return Math.max(getValueNoInstance(context, fobj)
- PdElevation.ANGLE_RELATIVE_INCREMENT,
PdElevation.ANGLE_BELOW);
}
@@ -150,8 +150,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static Number getValueNoInstance(final FoContext context,
- final FoObj fobj) {
+ public static int getValueNoInstance(final FoContext context, final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
return parent.traitAzimuth(context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -30,6 +30,7 @@
import org.axsl.constants.NumericConstants;
+import java.math.BigDecimal;
import java.util.regex.Matcher;
/**
@@ -39,16 +40,16 @@
public abstract class DtAngle extends Datatype {
/**
- * Returns the value of this angle.
+ * Returns the value of this angle, in millidegrees.
* @return The normalized value of this angle, i.e. a value between 0 and 360 degrees, in degrees.
*/
- public float getValue() {
- float returnValue = asDegrees();
- while (returnValue < 0) {
- returnValue += NumericConstants.DEGREES_PER_CIRCLE;
+ public int getValue() {
+ double degrees = asDegrees();
+ while (degrees < 0) {
+ degrees += NumericConstants.DEGREES_PER_CIRCLE;
}
- returnValue %= NumericConstants.DEGREES_PER_CIRCLE;
- return returnValue;
+ degrees %= NumericConstants.DEGREES_PER_CIRCLE;
+ return (int) Math.round(degrees * NumericConstants.MILLIDEGREES_PER_DEGREE);
}
/**
@@ -55,7 +56,7 @@
* Returns this value as degrees.
* @return This value as degrees.
*/
- public abstract float asDegrees();
+ public abstract double asDegrees();
/**
* Factory method that creates or obtains a {@link DtAngle} instance if the input is valid.
@@ -70,9 +71,9 @@
final String numericPart = matcher.group(1);
final String unitsPart = matcher.group(2);
- final float numeric;
+ final BigDecimal numeric;
try {
- numeric = Float.parseFloat(numericPart);
+ numeric = new BigDecimal(numericPart);
} catch (final NumberFormatException e) {
return null;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -28,6 +28,8 @@
package org.foray.fotree.value;
+import java.math.BigDecimal;
+
/**
* An "angle" property datatype in XSL-FO, stored as "degrees".
* Members of this class are immutable.
@@ -35,19 +37,19 @@
public final class DtAngle_Degrees extends DtAngle {
/** The signed number value. Stored locally to ensure immutability. */
- private float value = 0;
+ private BigDecimal value;
/**
* Constructor.
* @param value The signed angle value.
*/
- public DtAngle_Degrees(final float value) {
+ public DtAngle_Degrees(final BigDecimal value) {
this.value = value;
}
@Override
- public float asDegrees() {
- return this.value;
+ public double asDegrees() {
+ return this.value.doubleValue();
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -30,6 +30,8 @@
import org.axsl.constants.NumericConstants;
+import java.math.BigDecimal;
+
/**
* An "angle" property datatype in XSL-FO, stored as "degrees".
* Members of this class are immutable.
@@ -37,19 +39,19 @@
public final class DtAngle_Grads extends DtAngle {
/** The signed number value. Stored locally to ensure immutability. */
- private float value = 0;
+ private BigDecimal value;
/**
* Constructor.
* @param value The signed angle value.
*/
- public DtAngle_Grads(final float value) {
+ public DtAngle_Grads(final BigDecimal value) {
this.value = value;
}
@Override
- public float asDegrees() {
- return value * NumericConstants.DEGREES_PER_CIRCLE / NumericConstants.GRADS_PER_CIRCLE;
+ public double asDegrees() {
+ return value.doubleValue() * NumericConstants.DEGREES_PER_CIRCLE / NumericConstants.GRADS_PER_CIRCLE;
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java 2023-01-01 00:58:40 UTC (rev 12993)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java 2023-01-01 01:30:16 UTC (rev 12994)
@@ -28,6 +28,8 @@
package org.foray.fotree.value;
+import java.math.BigDecimal;
+
/**
* An "angle" property datatype in XSL-FO, stored as "degrees".
* Members of this class are immutable.
@@ -35,19 +37,19 @@
public final class DtAngle_Radians extends DtAngle {
/** The signed number value. Stored locally to ensure immutability. */
- private float value = 0;
+ private BigDecimal value;
/**
* Constructor.
* @param value The signed angle value.
*/
- public DtAngle_Radians(final float value) {
+ public DtAngle_Radians(final BigDecimal value) {
this.value = value;
}
@Override
- public float asDegrees() {
- return (float) Math.toDegrees(this.value);
+ public double asDegrees() {
+ return Math.toDegrees(this.value.doubleValue());
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2023-01-01 00:58:42
|
Revision: 12993
http://sourceforge.net/p/foray/code/12993
Author: victormote
Date: 2023-01-01 00:58:40 +0000 (Sun, 01 Jan 2023)
Log Message:
-----------
Conform to aXSL change: Change return type for traitPitch to int, to express millihertz.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtFrequencyTests.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-31 20:16:16 UTC (rev 12992)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2023-01-01 00:58:40 UTC (rev 12993)
@@ -2716,7 +2716,7 @@
}
@Override
- public Number traitPitch(final FoContext context) {
+ public int traitPitch(final FoContext context) {
return getPropertyList().traitPitch(this, context);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-31 20:16:16 UTC (rev 12992)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2023-01-01 00:58:40 UTC (rev 12993)
@@ -4100,7 +4100,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The pitch property.
*/
- public Number traitPitch(final FoObj fobj, final FoContext context) {
+ public int traitPitch(final FoObj fobj, final FoContext context) {
final PdPitch property = (PdPitch) getProperty(FoPropertyId.PITCH);
if (property != null) {
return property.getValueAbsolute(context, fobj);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java 2022-12-31 20:16:16 UTC (rev 12992)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java 2023-01-01 00:58:40 UTC (rev 12993)
@@ -93,7 +93,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public Number getValueAbsolute(final FoContext context, final FoObj fobj) {
+ public int getValueAbsolute(final FoContext context, final FoObj fobj) {
if (value() instanceof DtFrequency) {
return ((DtFrequency) value()).getValue();
}
@@ -137,12 +137,12 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static Number getValueNoInstanceAbsolute(final FoContext context, final FoObj fobj) {
+ public static int getValueNoInstanceAbsolute(final FoContext context, final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
return parent.traitPitch(context);
}
- return Double.NEGATIVE_INFINITY;
+ return -1;
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 20:16:16 UTC (rev 12992)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2023-01-01 00:58:40 UTC (rev 12993)
@@ -28,6 +28,7 @@
package org.foray.fotree.value;
+import java.math.BigDecimal;
import java.util.regex.Matcher;
/**
@@ -38,10 +39,10 @@
public abstract class DtFrequency extends Datatype {
/**
- * Returns the value, normalized to a unit of Hertz.
- * @return The value, normalized to a unit of Hertz.
+ * Returns the value, normalized to a unit of millihertz.
+ * @return The value, normalized to a unit of millihertz.
*/
- public abstract double getValue();
+ public abstract int getValue();
/**
* Factory method for creating a {@link DtFrequency} from String input.
@@ -56,9 +57,9 @@
final String numericPart = matcher.group(1);
final String unitsPart = matcher.group(2);
- final float numeric;
+ final BigDecimal numeric;
try {
- numeric = Float.parseFloat(numericPart);
+ numeric = new BigDecimal(numericPart);
} catch (final NumberFormatException e) {
return null;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java 2022-12-31 20:16:16 UTC (rev 12992)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java 2023-01-01 00:58:40 UTC (rev 12993)
@@ -28,6 +28,10 @@
package org.foray.fotree.value;
+import org.axsl.constants.MeasurementConstants;
+
+import java.math.BigDecimal;
+
/**
* A "frequency" datatype in XSL using units of "hertz".
* Members of this class are immutable.
@@ -35,19 +39,19 @@
public class DtFrequency_Hertz extends DtFrequency {
/** The quantity of units. */
- private double quantity;
+ private BigDecimal quantity;
/**
* Constructor.
* @param quantity The quantity of units.
*/
- public DtFrequency_Hertz(final double quantity) {
+ public DtFrequency_Hertz(final BigDecimal quantity) {
this.quantity = quantity;
}
@Override
- public double getValue() {
- return this.quantity;
+ public int getValue() {
+ return (int) Math.round(quantity.doubleValue() * MeasurementConstants.MILLIHERTZ_PER_HERTZ);
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java 2022-12-31 20:16:16 UTC (rev 12992)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java 2023-01-01 00:58:40 UTC (rev 12993)
@@ -30,6 +30,8 @@
import org.axsl.constants.MeasurementConstants;
+import java.math.BigDecimal;
+
/**
* A "frequency" datatype in XSL using units of "kilohertz".
* Members of this class are immutable.
@@ -37,19 +39,19 @@
public class DtFrequency_Kilohertz extends DtFrequency {
/** The quantity of units. */
- private double quantity;
+ private BigDecimal quantity;
/**
* Constructor.
* @param quantity The quantity of units.
*/
- public DtFrequency_Kilohertz(final double quantity) {
+ public DtFrequency_Kilohertz(final BigDecimal quantity) {
this.quantity = quantity;
}
@Override
- public double getValue() {
- return this.quantity * MeasurementConstants.HERTZ_PER_KILOHERTZ;
+ public int getValue() {
+ return (int) Math.round(this.quantity.doubleValue() * MeasurementConstants.MILLIHERTZ_PER_KILOHERTZ);
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 20:16:16 UTC (rev 12992)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2023-01-01 00:58:40 UTC (rev 12993)
@@ -42,7 +42,7 @@
* This expression handles leading and trailing whitespace and separates the numeric part from the units part, but
* does not attempt to validate either part as that is done downstream.
* Useful in parsing lengths, angles, times, and frequencies. */
- Pattern NUMBER_AND_UNITS_PATTERN = Pattern.compile("^\\s?([+-]?[0-9]*\\.?[0-9]*)([a-z]+)\\s?$");
+ Pattern NUMBER_AND_UNITS_PATTERN = Pattern.compile("^\\s?([+-]?[0-9]*\\.?[0-9]*)([A-Za-z]+)\\s?$");
/** Constant indicating an invalid unit power, that is, a non-numeric item.*/
byte UNIT_POWER_NON_NUMERIC = -1;
Added: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtFrequencyTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtFrequencyTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtFrequencyTests.java 2023-01-01 00:58:40 UTC (rev 12993)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link DtFrequency}.
+ */
+public class DtFrequencyTests {
+
+ /**
+ * Unit test for a hertz frequency.
+ */
+ @Test
+ public void hertzTest() {
+ final DtFrequency frequency = DtFrequency.procureInstance("56500Hz");
+ final int actual = frequency.getValue();
+ assertEquals(56_500_000, actual);
+ }
+
+ /**
+ * Unit test for megahertz frequency.
+ */
+ @Test
+ public void kilohertzTest() {
+ final DtFrequency frequency = DtFrequency.procureInstance("31.8kHz");
+ final int actual = frequency.getValue();
+ assertEquals(31_800_000, actual);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtFrequencyTests.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 20:16:19
|
Revision: 12992
http://sourceforge.net/p/foray/code/12992
Author: victormote
Date: 2022-12-31 20:16:16 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Make DtFrequency abstract and move unit differences to subclasses.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java 2022-12-31 19:57:19 UTC (rev 12991)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java 2022-12-31 20:16:16 UTC (rev 12992)
@@ -80,7 +80,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- pv = DtFrequency.makeFrequencyDT(value);
+ pv = DtFrequency.procureInstance(value);
if (pv != null) {
return pv;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 19:57:19 UTC (rev 12991)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 20:16:16 UTC (rev 12992)
@@ -28,97 +28,46 @@
package org.foray.fotree.value;
-import org.foray.fotree.PropertyException;
+import java.util.regex.Matcher;
-import org.axsl.constants.MeasurementConstants;
-
/**
- * A "frequency" datatype in XSL. See XSL-FO Specification 1.0, Section 5.11.
+ * A "frequency" datatype in XSL.
+ * @see "XSL-FO Recommendation 1.0, Section 5.11."
+ * @see "XSL-FO Recommendation 1.1, Section 5.11."
*/
-public class DtFrequency extends Datatype {
+public abstract class DtFrequency extends Datatype {
- /** Constant indicating a unit type of hertz. */
- public static final byte UNITS_HERTZ = 1;
-
- /** Constant indicating a unit type of kilohertz. */
- public static final byte UNITS_KILOHERTZ = 2;
-
- /** The quantity of units. */
- private double quantity;
-
- /** The unit type, either hertz or kilohertz. */
- private byte units;
-
/**
- * Constructor.
- * @param quantity The quantity of units.
- * @param units The unit type, either {@link DtFrequency#UNITS_HERTZ} or
- * {@link DtFrequency#UNITS_KILOHERTZ}.
- * @throws PropertyException For an invalid units value.
- */
- public DtFrequency(final double quantity, final byte units)
- throws PropertyException {
- if (units < 1 || units > 2) {
- throw new PropertyException("Invalid FrequencyDT unit ID.");
- }
- this.quantity = quantity;
- this.units = units;
- }
-
- /**
* Returns the value, normalized to a unit of Hertz.
* @return The value, normalized to a unit of Hertz.
*/
- public double getValue() {
- switch (this.units) {
- case DtFrequency.UNITS_HERTZ: {
- return this.quantity;
- }
- case DtFrequency.UNITS_KILOHERTZ: {
- return this.quantity * MeasurementConstants.HERTZ_PER_KILOHERTZ;
- }
- }
- return -1;
- }
+ public abstract double getValue();
/**
- * Factory method for creating a FrequencyDT from a String input.
- * @param input The String from which a FrequencyDT should be constructed.
- * @return The FrequencyDT instance constructed, or null if input is not
- * valid.
+ * Factory method for creating a {@link DtFrequency} from String input.
+ * @param input The String from which a {@link DtFrequency} should be constructed.
+ * @return The {@link DtFrequency} procured, or null if input is not valid.
*/
- public static DtFrequency makeFrequencyDT(final String input) {
- // Make a copy of input
- final String useInput = new String(input);
- useInput.trim();
- byte units = -1;
- int unitsLength = -1;
- if (useInput.endsWith("Hz")) {
- units = DtFrequency.UNITS_HERTZ;
- unitsLength = "Hz".length();
- } else if (useInput.endsWith("kHz")) {
- units = DtFrequency.UNITS_KILOHERTZ;
- unitsLength = "kHz".length();
- } else {
+ public static DtFrequency procureInstance(final String input) {
+ final Matcher matcher = NUMBER_AND_UNITS_PATTERN.matcher(input);
+ if (! matcher.matches()) {
return null;
}
- final String quantityPart = useInput.substring(0, useInput.length()
- - unitsLength);
- final double quantity;
+ final String numericPart = matcher.group(1);
+ final String unitsPart = matcher.group(2);
+
+ final float numeric;
try {
- quantity = Double.parseDouble(quantityPart);
+ numeric = Float.parseFloat(numericPart);
} catch (final NumberFormatException e) {
return null;
}
- try {
- return new DtFrequency(quantity, units);
- } catch (final PropertyException e1) {
- /*
- * This should never happen, because we have already validated the
- * input.
- */
- return null;
+
+ switch(unitsPart) {
+ case "Hz": return new DtFrequency_Hertz(numeric);
+ case "kHz": return new DtFrequency_Kilohertz(numeric);
}
+ return null;
}
}
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java 2022-12-31 20:16:16 UTC (rev 12992)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+/**
+ * A "frequency" datatype in XSL using units of "hertz".
+ * Members of this class are immutable.
+ */
+public class DtFrequency_Hertz extends DtFrequency {
+
+ /** The quantity of units. */
+ private double quantity;
+
+ /**
+ * Constructor.
+ * @param quantity The quantity of units.
+ */
+ public DtFrequency_Hertz(final double quantity) {
+ this.quantity = quantity;
+ }
+
+ @Override
+ public double getValue() {
+ return this.quantity;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Hertz.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java 2022-12-31 20:16:16 UTC (rev 12992)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.MeasurementConstants;
+
+/**
+ * A "frequency" datatype in XSL using units of "kilohertz".
+ * Members of this class are immutable.
+ */
+public class DtFrequency_Kilohertz extends DtFrequency {
+
+ /** The quantity of units. */
+ private double quantity;
+
+ /**
+ * Constructor.
+ * @param quantity The quantity of units.
+ */
+ public DtFrequency_Kilohertz(final double quantity) {
+ this.quantity = quantity;
+ }
+
+ @Override
+ public double getValue() {
+ return this.quantity * MeasurementConstants.HERTZ_PER_KILOHERTZ;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency_Kilohertz.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 19:57:21
|
Revision: 12991
http://sourceforge.net/p/foray/code/12991
Author: victormote
Date: 2022-12-31 19:57:19 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Make DtTime abstract and move unit differences to subclasses.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Milliseconds.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Seconds.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-31 19:01:48 UTC (rev 12990)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-31 19:57:19 UTC (rev 12991)
@@ -119,7 +119,7 @@
while (st.hasMoreTokens()) {
PropertyValue insideValue = null;
Property insideProperty = null;
- insideValue = DtTime.makeTimeDT(value);
+ insideValue = DtTime.procureInstance(value);
if (insideValue == null) {
insideValue = DtPercentage.makePercentageDT(value);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 19:01:48 UTC (rev 12990)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 19:57:19 UTC (rev 12991)
@@ -28,89 +28,46 @@
package org.foray.fotree.value;
-import org.axsl.constants.MeasurementConstants;
+import java.util.regex.Matcher;
/**
- * A "time" datatype in XSL. See XSL-FO Specification 1.0, Section 5.11.
+ * A "time" datatype in XSL.
+ * @see "XSL-FO Recommendation 1.0, Section 5.11."
+ * @see "XSL-FO Recommendation 1.1, Section 5.11."
*/
-public class DtTime extends Datatype {
+public abstract class DtTime extends Datatype {
/**
- * Enumeration of valid units of time.
- */
- public enum Units {
-
- /** The unit of time is seconds. */
- SECONDS,
-
- /** The unit of time is milliseconds. */
- MILLISECONDS;
-
- }
-
- /** The number of seconds or milliseconds in this time. */
- private Number quantity;
-
- /** The units (seconds or milliseconds) stored by this time. */
- private Units units;
-
- /**
- * Constructor.
- * @param quantity The number of seconds or milliseconds in this time.
- * @param units The units for this time measurement.
- */
- public DtTime(final Number quantity, final Units units) {
- if (units == null) {
- throw new NullPointerException("Time units cannot be null.");
- }
- this.quantity = quantity;
- this.units = units;
- }
-
- /**
* Returns the value, normalized to a unit of milliseconds.
* @return The value, normalized to a unit of milliseconds.
*/
- public int getValue() {
- switch (this.units) {
- case SECONDS: {
- return (int) Math.round(this.quantity.doubleValue() * MeasurementConstants.MILLISECONDS_PER_SECOND);
- }
- case MILLISECONDS: {
- return this.quantity.intValue();
- }
- }
- return -1;
- }
+ public abstract int getValue();
/**
- * Factory method for creating a TimeDT from a String input.
- * @param input The String from which a TimeDT should be constructed.
- * @return The TimeDT instance constructed, or null if input is not valid.
+ * Factory method for creating or obtaining an instance of {@link DtTime} from string input.
+ * @param input The String from which a {@link DtTime} instance should be constructed.
+ * @return The {@link DtTime}, or null if input is not valid.
*/
- public static DtTime makeTimeDT(final String input) {
- // Make a copy of input
- final String useInput = new String(input);
- useInput.trim();
- Units units = null;
- int unitsLength = -1;
- if (useInput.endsWith("ms")) {
- units = Units.MILLISECONDS;
- unitsLength = 2;
- } else if (useInput.endsWith("s")) {
- units = Units.SECONDS;
- unitsLength = 1;
- } else {
+ public static DtTime procureInstance(final String input) {
+ final Matcher matcher = NUMBER_AND_UNITS_PATTERN.matcher(input);
+ if (! matcher.matches()) {
return null;
}
- final String quantityPart = useInput.substring(0, useInput.length() - unitsLength);
- final double quantity;
+ final String numericPart = matcher.group(1);
+ final String unitsPart = matcher.group(2);
+
+ final float numeric;
try {
- quantity = Double.parseDouble(quantityPart);
+ numeric = Float.parseFloat(numericPart);
} catch (final NumberFormatException e) {
return null;
}
- return new DtTime(quantity, units);
+
+ switch(unitsPart) {
+ case "s": return new DtTime_Seconds(numeric);
+ case "ms": return new DtTime_Milliseconds(numeric);
+ }
+ return null;
}
}
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Milliseconds.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Milliseconds.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Milliseconds.java 2022-12-31 19:57:19 UTC (rev 12991)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+/**
+ * A "time" datatype in XSL expressed in units of "milliseconds".
+ * Members of this class are immutable.
+ */
+public final class DtTime_Milliseconds extends DtTime {
+
+ /** The number of seconds. Stored locally to ensure immutability. */
+ private Number quantity;
+
+ /**
+ * Constructor.
+ * @param quantity The number of seconds in this time.
+ */
+ public DtTime_Milliseconds(final Number quantity) {
+ this.quantity = quantity;
+ }
+
+ @Override
+ public int getValue() {
+ return this.quantity.intValue();
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Milliseconds.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Seconds.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Seconds.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Seconds.java 2022-12-31 19:57:19 UTC (rev 12991)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.MeasurementConstants;
+
+/**
+ * A "time" datatype in XSL expressed in units of "seconds".
+ * Members of this class are immutable.
+ */
+public final class DtTime_Seconds extends DtTime {
+
+ /** The number of seconds. Stored locally to ensure immutability. */
+ private Number quantity;
+
+ /**
+ * Constructor.
+ * @param quantity The number of seconds in this time.
+ */
+ public DtTime_Seconds(final Number quantity) {
+ this.quantity = quantity;
+ }
+
+ @Override
+ public int getValue() {
+ return (int) Math.round(this.quantity.doubleValue() * MeasurementConstants.MILLISECONDS_PER_SECOND);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime_Seconds.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 19:01:50
|
Revision: 12990
http://sourceforge.net/p/foray/code/12990
Author: victormote
Date: 2022-12-31 19:01:48 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Make DtAngle abstract and move unit differences to subclasses.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java 2022-12-31 18:06:36 UTC (rev 12989)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractGlyphOrientation.java 2022-12-31 19:01:48 UTC (rev 12990)
@@ -86,7 +86,7 @@
if (pv != null) {
return pv;
}
- pv = DtAngle.makeAngleDT(value);
+ pv = DtAngle.procureInstance(value);
if (pv != null) {
return pv;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java 2022-12-31 18:06:36 UTC (rev 12989)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java 2022-12-31 19:01:48 UTC (rev 12990)
@@ -176,7 +176,7 @@
if (this.isBehind) {
throw unexpectedValue(value);
}
- pv = DtAngle.makeAngleDT(value);
+ pv = DtAngle.procureInstance(value);
if (pv != null) {
return pv;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 18:06:36 UTC (rev 12989)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 19:01:48 UTC (rev 12990)
@@ -28,146 +28,61 @@
package org.foray.fotree.value;
-import org.foray.fotree.PropertyException;
-
import org.axsl.constants.NumericConstants;
+import java.util.regex.Matcher;
+
/**
* An "angle" property datatype in XSL-FO.
+ * @see "XSL-FO Recommendation 1.1, Section 5.11."
*/
-public class DtAngle extends Datatype {
+public abstract class DtAngle extends Datatype {
- /** Constant indicating that the units in this angle are degrees. */
- public static final byte DEGREES = 1;
-
- /** Constant indicating that the units in this angle are grads. */
- public static final byte GRADS = 2;
-
- /** Constant indicating that the units in this angle are radians. */
- public static final byte RADIANS = 3;
-
- /** The signed number value. */
- private float value = 0;
-
- /** The unit identifier. **/
- private byte unitID;
-
/**
- * Constructor.
- * @param value The signed angle value.
- * @param units One of {@link DtAngle#DEGREES}, {@link DtAngle#GRADS}, or
- * {@link DtAngle#RADIANS}.
- * @throws PropertyException For illegal {@code units} value.
- */
- public DtAngle(final float value, final byte units)
- throws PropertyException {
- if (! validUnits(units)) {
- throw new PropertyException("Illegal angle unit ID: " + units);
- }
- this.value = value;
- this.unitID = units;
- }
-
- /**
* Returns the value of this angle.
- * @return The normalized value of this angle, i.e. a value between 0
- * and 360 degrees, in degrees.
+ * @return The normalized value of this angle, i.e. a value between 0 and 360 degrees, in degrees.
*/
public float getValue() {
- float returnValue = DtAngle.convertToDegrees(this.value, this.unitID);
- returnValue %= NumericConstants.DEGREES_PER_CIRCLE;
- if (returnValue < 0) {
+ float returnValue = asDegrees();
+ while (returnValue < 0) {
returnValue += NumericConstants.DEGREES_PER_CIRCLE;
}
+ returnValue %= NumericConstants.DEGREES_PER_CIRCLE;
return returnValue;
}
/**
- * Converts input degrees, grads, or radians to degrees.
- * @param value The quantity to be converted, e.g. to convert 180 degrees,
- * set value to 180.
- * @param units One of AngleDT.DEGREES, AngleDT.GRADS, or AngleDT.RADIANS.
- * @return The value, in degrees, of the angle.
+ * Returns this value as degrees.
+ * @return This value as degrees.
*/
- public static float convertToDegrees(final float value, final byte units) {
- switch (units) {
- case DtAngle.DEGREES: {
- return value;
- }
- case DtAngle.GRADS: {
- /*
- * Conversion factor is per
- * http://www.metrication.com/conversions/tables.htm
- */
- return value * NumericConstants.DEGREES_PER_CIRCLE
- / NumericConstants.GRADS_PER_CIRCLE;
- }
- case DtAngle.RADIANS: {
- return (float) Math.toDegrees(value);
- }
- }
- return 0;
- }
+ public abstract float asDegrees();
/**
- * Factory method that creates an AngleDT instance if the input is valid.
- * @param input A String that conforms to the definition of the "angle"
- * datatype in the XSL-FO spec, 1.0, Section 5.11.
- * @return An AngleDT instance if input is valid, otherwise null;
+ * Factory method that creates or obtains a {@link DtAngle} instance if the input is valid.
+ * @param input A String that conforms to the definition of the "angle" datatype.
+ * @return A {@link DtAngle} instance, or null if the input is not valid.
*/
- public static DtAngle makeAngleDT(final String input) {
- byte unitID = 0;
- int index = input.indexOf("deg");
- if (index > -1) {
- unitID = DtAngle.DEGREES;
- }
- if (unitID == 0) {
- index = input.indexOf("grad");
- if (index > -1) {
- unitID = DtAngle.GRADS;
- }
- }
- if (unitID == 0) {
- index = input.indexOf("rad");
- if (index > -1) {
- unitID = DtAngle.RADIANS;
- }
- }
- if (! validUnits(unitID)) {
+ public static DtAngle procureInstance(final String input) {
+ final Matcher matcher = NUMBER_AND_UNITS_PATTERN.matcher(input);
+ if (! matcher.matches()) {
return null;
}
- final String valuePortion = input.substring(0, index - 1);
- float value = 0;
+ final String numericPart = matcher.group(1);
+ final String unitsPart = matcher.group(2);
+
+ final float numeric;
try {
- value = Float.parseFloat(valuePortion);
+ numeric = Float.parseFloat(numericPart);
} catch (final NumberFormatException e) {
return null;
}
- try {
- return new DtAngle(value, unitID);
- } catch (final PropertyException e1) {
- /*
- * The exception thrown by the constructor is to ensure that the
- * units are valid, which we have already done above. Therefore,
- * simply ignore this exception, as it should never occur.
- */
- return null;
- }
- }
- /**
- * Validates the units.
- * @param units The units value to be tested.
- * @return True if and only if the units value is valid.
- */
- public static boolean validUnits(final byte units) {
- if (units < DtAngle.DEGREES) {
- return false;
+ switch(unitsPart) {
+ case "deg": return new DtAngle_Degrees(numeric);
+ case "grad": return new DtAngle_Grads(numeric);
+ case "rad": return new DtAngle_Radians(numeric);
}
- if (units > DtAngle.RADIANS) {
- return false;
- }
- return true;
+ return null;
}
}
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java 2022-12-31 19:01:48 UTC (rev 12990)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+/**
+ * An "angle" property datatype in XSL-FO, stored as "degrees".
+ * Members of this class are immutable.
+ */
+public final class DtAngle_Degrees extends DtAngle {
+
+ /** The signed number value. Stored locally to ensure immutability. */
+ private float value = 0;
+
+ /**
+ * Constructor.
+ * @param value The signed angle value.
+ */
+ public DtAngle_Degrees(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public float asDegrees() {
+ return this.value;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java 2022-12-31 19:01:48 UTC (rev 12990)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.NumericConstants;
+
+/**
+ * An "angle" property datatype in XSL-FO, stored as "degrees".
+ * Members of this class are immutable.
+ */
+public final class DtAngle_Grads extends DtAngle {
+
+ /** The signed number value. Stored locally to ensure immutability. */
+ private float value = 0;
+
+ /**
+ * Constructor.
+ * @param value The signed angle value.
+ */
+ public DtAngle_Grads(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public float asDegrees() {
+ return value * NumericConstants.DEGREES_PER_CIRCLE / NumericConstants.GRADS_PER_CIRCLE;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java 2022-12-31 19:01:48 UTC (rev 12990)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+/**
+ * An "angle" property datatype in XSL-FO, stored as "degrees".
+ * Members of this class are immutable.
+ */
+public final class DtAngle_Radians extends DtAngle {
+
+ /** The signed number value. Stored locally to ensure immutability. */
+ private float value = 0;
+
+ /**
+ * Constructor.
+ * @param value The signed angle value.
+ */
+ public DtAngle_Radians(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public float asDegrees() {
+ return (float) Math.toDegrees(this.value);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 18:06:36 UTC (rev 12989)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 19:01:48 UTC (rev 12990)
@@ -29,7 +29,6 @@
package org.foray.fotree.value;
import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
@@ -41,11 +40,6 @@
/** A property value that evaluates to a length of zero, suitable for use as a default. */
public static final DtLength ZERO_LENGTH = new DtLength_Points(0);
- /** Regex pattern for matching/parsing XSL-FO length expressions. This handles leading and trailing whitespace
- * and separates the numeric part from the units part, but does not attempt to validate either part as that is
- * done downstream. */
- private static final Pattern LENGTH_PATTERN = Pattern.compile("^\\s?([+-]?[0-9]*\\.?[0-9]*)([a-z]+)\\s?$");
-
/**
* Returns the value of this length, normalized to millipoints.
* @param fontSize The font-size, in millipoints. This is used only for "em" computations.
@@ -68,7 +62,7 @@
* @return A {@link DtLength} instance, or null if input is not valid.
*/
public static DtLength procureInstance(final String input) {
- final Matcher matcher = LENGTH_PATTERN.matcher(input);
+ final Matcher matcher = NUMBER_AND_UNITS_PATTERN.matcher(input);
if (! matcher.matches()) {
return null;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 18:06:36 UTC (rev 12989)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 19:01:48 UTC (rev 12990)
@@ -31,6 +31,7 @@
import org.foray.fotree.FoObj;
import java.awt.Color;
+import java.util.regex.Pattern;
/**
* Interface for all XSL-FO property values.
@@ -37,6 +38,12 @@
*/
public interface PropertyValue {
+ /** Regex pattern for matching/parsing XSL-FO numbers that have trailing units.
+ * This expression handles leading and trailing whitespace and separates the numeric part from the units part, but
+ * does not attempt to validate either part as that is done downstream.
+ * Useful in parsing lengths, angles, times, and frequencies. */
+ Pattern NUMBER_AND_UNITS_PATTERN = Pattern.compile("^\\s?([+-]?[0-9]*\\.?[0-9]*)([a-z]+)\\s?$");
+
/** Constant indicating an invalid unit power, that is, a non-numeric item.*/
byte UNIT_POWER_NON_NUMERIC = -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 18:06:38
|
Revision: 12989
http://sourceforge.net/p/foray/code/12989
Author: victormote
Date: 2022-12-31 18:06:36 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Add length tests. Fix bug in picas computation revealed by test.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java 2022-12-31 17:35:07 UTC (rev 12988)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java 2022-12-31 18:06:36 UTC (rev 12989)
@@ -50,8 +50,8 @@
@Override
public int getValue(final int fontSize) {
- return Math.round(this.value * TypographicConstants.PICAS_PER_INCH
- * TypographicConstants.MILLIPOINTS_PER_POINT);
+ return Math.round(this.value / TypographicConstants.PICAS_PER_INCH
+ * TypographicConstants.POINTS_PER_INCH * TypographicConstants.MILLIPOINTS_PER_POINT);
}
@Override
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java 2022-12-31 17:35:07 UTC (rev 12988)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java 2022-12-31 18:06:36 UTC (rev 12989)
@@ -36,18 +36,84 @@
*/
public class DtLengthTests {
- /** A bogus point size to use when we don't care what it is. */
- private static final byte POINT_SIZE_DONT_CARE = 12;
+ /** A point size to use for these tests. */
+ private static final int POINT_SIZE = 12_000;
/**
- * Unit test for a centimeter length.
+ * Unit test for a points length.
*/
@Test
- public void testCentimeters() {
- final DtLength length = DtLength.procureInstance("3.7cm");
- final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE_DONT_CARE);
+ public void pointsTest() {
+ final DtLength length = DtLength.procureInstance("18.5pt");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
/* Return value is in millipoints. */
- assertEquals(104882, resolvedLength);
+ assertEquals(18_500, resolvedLength);
}
+ /**
+ * Unit test for an ems length.
+ */
+ @Test
+ public void emsTest() {
+ final DtLength length = DtLength.procureInstance("1.2em");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
+ /* Return value is in millipoints. */
+ assertEquals(14_400, resolvedLength);
+ }
+
+ /**
+ * Unit test for an inches length.
+ */
+ @Test
+ public void inchesTest() {
+ final DtLength length = DtLength.procureInstance("2.5in");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
+ /* Return value is in millipoints. */
+ assertEquals(180_000, resolvedLength);
+ }
+
+ /**
+ * Unit test for a centimeters length.
+ */
+ @Test
+ public void centimetersTest() {
+ final DtLength length = DtLength.procureInstance("3.7cm");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
+ /* Return value is in millipoints. 3.7 / 2.54 * 72,000. */
+ assertEquals(104_882, resolvedLength);
+ }
+
+ /**
+ * Unit test for a millimeters length.
+ */
+ @Test
+ public void millimetersTest() {
+ final DtLength length = DtLength.procureInstance("89.3mm");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
+ /* Return value is in millipoints. 89.3 / 10 / 2.54 * 72,000. */
+ assertEquals(253_134, resolvedLength);
+ }
+
+ /**
+ * Unit test for a picas length.
+ */
+ @Test
+ public void picasTest() {
+ final DtLength length = DtLength.procureInstance("6.5pc");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
+ /* Return value is in millipoints. 6.5 / 6 * 72,000. */
+ assertEquals(78_000, resolvedLength);
+ }
+
+ /**
+ * Unit test for a pixels length.
+ */
+ @Test
+ public void pixelsTest() {
+ final DtLength length = DtLength.procureInstance("300px");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
+ /* Return value is in millipoints. The pixels-per-inch value is 72. 300 / 72 * 72,000. */
+ assertEquals(300_000, resolvedLength);
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 17:35:10
|
Revision: 12988
http://sourceforge.net/p/foray/code/12988
Author: victormote
Date: 2022-12-31 17:35:07 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Make DtLength abstract and move unit differences to subclasses.
Modified Paths:
--------------
trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackground.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLetterSpacing.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSize.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWordSpacing.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/package-info.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Centimeters.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Ems.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Inches.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Millimeters.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Pixels.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Points.java
Modified: trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml
===================================================================
--- trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-00-master/config/checkstyle/checkstyle-config.xml 2022-12-31 17:35:07 UTC (rev 12988)
@@ -90,7 +90,7 @@
first letter in acronyms. Because it is imperfect, we list exceptions as alternatives in the expression
itself." -->
<module name="TypeName">
- <property name="format" value="(^[A-Z]([a-z0-9][A-Z]?)+$)|(^FOray$)"/>
+ <property name="format" value="(^[A-Z]([a-z0-9]_?[A-Z]?)+$)|(^FOray$)"/>
</module>
<module name="ModifierOrder">
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -352,9 +352,8 @@
final String propertyFullName) throws PropertyException {
DtSpace spaceDT = inputSpaceDT;
if (spaceDT == null) {
- final DtLength length = DtLength.makeLengthDT("0pt");
- spaceDT = new DtSpace(length, length, length,
- FoValue.DISCARD, new DtInteger(0));
+ final DtLength length = DtLength.ZERO_LENGTH;
+ spaceDT = new DtSpace(length, length, length, FoValue.DISCARD, new DtInteger(0));
}
final PropertyValue pv = this.standardParse(value, null);
if (pv.canEvalLength()) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackground.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackground.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackground.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -212,7 +212,7 @@
if (normalizedUri != null) {
return FoPropertyId.BACKGROUND_IMAGE;
}
- final DtLength length = DtLength.makeLengthDT(input);
+ final DtLength length = DtLength.procureInstance(input);
if (length != null) {
return FoPropertyId.BACKGROUND_POSITION;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -105,7 +105,7 @@
final String token = st.nextToken();
pv = DtPercentage.makePercentageDT(token);
if (pv == null) {
- pv = DtLength.makeLengthDT(token);
+ pv = DtLength.procureInstance(token);
}
if (pv == null) {
final FoValue keyword = FoValue.xslValueOf(token);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFont.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFont.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFont.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -234,7 +234,7 @@
if (Property.keywordInSet(keyword, PdFontFamily.VALID_KEYWORDS)) {
return FoPropertyId.FONT_FAMILY;
}
- final DtLength length = DtLength.makeLengthDT(input);
+ final DtLength length = DtLength.procureInstance(input);
if (length != null) {
return FoPropertyId.FONT_SIZE;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -38,6 +38,7 @@
import org.foray.fotree.fo.FoValue;
import org.foray.fotree.value.DtLength;
import org.foray.fotree.value.DtLengthRange;
+import org.foray.fotree.value.DtLength_Points;
import org.foray.fotree.value.DtPercentage;
import org.foray.fotree.value.PropertyValue;
@@ -56,8 +57,8 @@
private static final int DEFAULT_OPTIMUM_VALUE = 12 * TypographicConstants.MILLIPOINTS_PER_POINT;
/** The default optimum value when creating a length-range component. */
- private static final DtLength DEFAULT_OPTIMUM_COMPONENT = new DtLength(
- PdLeaderLength.DEFAULT_OPTIMUM_VALUE, "pt");
+ private static final DtLength DEFAULT_OPTIMUM_COMPONENT =
+ new DtLength_Points(PdLeaderLength.DEFAULT_OPTIMUM_VALUE);
/** The default maximum value when creating a length-range component. */
private static final DtPercentage DEFAULT_MAXIMUM_COMPONENT =
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLetterSpacing.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLetterSpacing.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLetterSpacing.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -268,9 +268,8 @@
final String propertyFullName) throws PropertyException {
DtSpace spaceDT = inputSpaceDT;
if (spaceDT == null) {
- final DtLength length = DtLength.makeLengthDT("0pt");
- spaceDT = new DtSpace(length, length, length,
- FoValue.DISCARD, new DtInteger(0));
+ final DtLength length = DtLength.ZERO_LENGTH;
+ spaceDT = new DtSpace(length, length, length, FoValue.DISCARD, new DtInteger(0));
}
final boolean componentAdded = spaceDT.addComponent(subPropertyName,
value);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSize.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSize.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSize.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -96,7 +96,7 @@
final PropertyCollection collection = new PropertyCollection();
while (st.hasMoreTokens()) {
final String token = st.nextToken();
- final DtLength length = DtLength.makeLengthDT(token);
+ final DtLength length = DtLength.procureInstance(token);
if (length == null) {
throw unexpectedValue(value);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWordSpacing.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWordSpacing.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWordSpacing.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -270,9 +270,8 @@
final String subPropertyName, final String propertyFullName) throws PropertyException {
DtSpace spaceDT = inputSpaceDT;
if (spaceDT == null) {
- final DtLength length = DtLength.makeLengthDT("0pt");
- spaceDT = new DtSpace(length, length, length,
- FoValue.DISCARD, new DtInteger(0));
+ final DtLength length = DtLength.ZERO_LENGTH;
+ spaceDT = new DtSpace(length, length, length, FoValue.DISCARD, new DtInteger(0));
}
final boolean componentAdded = spaceDT.addComponent(subPropertyName, value);
if (! componentAdded) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/package-info.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/package-info.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/package-info.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -30,6 +30,21 @@
* <p>Classes for parsing and representing the XSL-FO document input objects and properties in the various
* namespaces.</p>
*
+ * <p>Design considerations:</p>
+ * <ul>
+ * <li>The FO Tree faces two directions. First, it faces the incoming document. The guiding document for this process
+ * is the XSL-FO Recommendation. Second, it faces the layout and Area Tree systems, and the axsl-fotree interfaces
+ * address these requirements.</li>
+ * <li>With regard to the incoming document, the FO Tree must be able to parse and store it accurately, compactly
+ * (efficiently with regard to memory), and quickly (efficiently with regard to time). Of these, accuracy is not
+ * negotiable.</li>
+ * <li>FOray has added a design consideration with regard to the incoming document that is purely internal:
+ * We wish to be able to round-trip the parsed XSL-FO document.
+ * In other words, we should be able to take a FOray FO Tree, and write it back out with no loss of information. By
+ * doing so, we hope someday to integrate better with CSS or something similar that would allow in-place formatting
+ * concepts to be applied, and thus provide a complete WYSIWYG publishing system.</li>
+ * </ul>
+ *
* <p>Future development for foray-fotree:</p>
* <ul>
* <li>TODO: Make property value objects immutable and therefore reusable, where possible.</li>
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -262,11 +262,7 @@
case NUMERIC_WITH_UNITS:
// A number plus a valid unit name.
- final int numLen = tokenizer.getCurrentTokenValue().length() - tokenizer.getCurrentUnitLength();
- final String valuePart = tokenizer.getCurrentTokenValue().substring(0, numLen);
- final String unitPart = tokenizer.getCurrentTokenValue().substring(numLen);
- final float value = Float.parseFloat(valuePart);
- prop = new DtLength(value, unitPart);
+ prop = DtLength.procureInstance(tokenizer.getCurrentTokenValue());
break;
case COLORSPEC:
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -28,8 +28,8 @@
package org.foray.fotree.value;
-import org.axsl.constants.MeasurementConstants;
-import org.axsl.constants.TypographicConstants;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
@@ -36,126 +36,62 @@
* A "length" property datatype in XSL-FO.
* Members of this class are immutable.
*/
-public class DtLength extends Datatype {
+public abstract class DtLength extends Datatype {
- /** Array of valid string descriptions for length units. */
- public static final String[] UNIT_ARRAY = {
- "in",
- "cm",
- "mm",
- "pt",
- "pc",
- "px",
- "em",
- };
+ /** A property value that evaluates to a length of zero, suitable for use as a default. */
+ public static final DtLength ZERO_LENGTH = new DtLength_Points(0);
- /** Constant indicating units of "inches". */
- public static final byte UNIT_INCHES = 0;
+ /** Regex pattern for matching/parsing XSL-FO length expressions. This handles leading and trailing whitespace
+ * and separates the numeric part from the units part, but does not attempt to validate either part as that is
+ * done downstream. */
+ private static final Pattern LENGTH_PATTERN = Pattern.compile("^\\s?([+-]?[0-9]*\\.?[0-9]*)([a-z]+)\\s?$");
- /** Constant indicating units of "centimeters". */
- public static final byte UNIT_CENTIMETERS = 1;
-
- /** Constant indicating units of "millimeters". */
- public static final byte UNIT_MILLIMETERS = 2;
-
- /** Constant indicating units of "points". */
- public static final byte UNIT_POINTS = 3;
-
- /** Constant indicating units of "picas". */
- public static final byte UNIT_PICAS = 4;
-
- /** Constant indicating units of "pixels". */
- public static final byte UNIT_PIXELS = 5;
-
- /** Constant indicating units of "ems". */
- public static final byte UNIT_EMS = 6;
-
- /** A property value that evaluates to a length of zero, suitable for
- * use as a default. */
- public static final DtLength ZERO_LENGTH = new DtLength(0, "pt");
-
- /** The signed length value. */
- private final float value;
-
/**
- * An enumerated symbol for the units. Must be one of the UNIT_ constants.
+ * Returns the value of this length, normalized to millipoints.
+ * @param fontSize The font-size, in millipoints. This is used only for "em" computations.
+ * In cases where computing the font-size is expensive, check {@link #lengthRequiresFontSize()} first before
+ * computing it.
+ * If it returns false, zero or some other constant can safely be passed, as the value will not be used anyway.
+ * @return The value of this length in millipoints.
*/
- private final byte units;
+ public abstract int getValue(int fontSize);
/**
- * Constructor.
- * @param value The signed length value.
- * @param units A byte representation of the unit of measure (points,
- * inches, etc.)
+ * Returns the raw value of this length, that is, without regard to units of measure or normalization.
+ * @return The raw value of this length.
*/
- public DtLength(final float value, final String units) {
- this.value = value;
- this.units = convertUnits(units);
- if (this.units < 0
- || this.units >= DtLength.UNIT_ARRAY.length) {
- throw new IllegalArgumentException("Invalid length unit: " + units);
- }
- }
+ public abstract float getRawValue();
/**
- * Return the value.
- * @param fontSize The font-size, in millipoints. This is used for "em"
- * computations.
- * In environments where computing the font-size is expensive, check
- * {@link #needsFontSize()} first before computing it.
- * If it returns false, zero or some other constant can safely be passed,
- * as the value will not be used anyway.
- * @return The value of this length in millipoints.
+ * Factory method for creating a {@link DtLength} instance from a String.
+ * @param input The string from which a {@link DtLength} instance should be created.
+ * @return A {@link DtLength} instance, or null if input is not valid.
*/
- public int getValue(final int fontSize) {
- switch (this.units) {
- case DtLength.UNIT_INCHES: {
- return Math.round(this.value * TypographicConstants.POINTS_PER_INCH
- * TypographicConstants.MILLIPOINTS_PER_POINT);
+ public static DtLength procureInstance(final String input) {
+ final Matcher matcher = LENGTH_PATTERN.matcher(input);
+ if (! matcher.matches()) {
+ return null;
}
- case DtLength.UNIT_CENTIMETERS: {
- return Math.round(this.value * TypographicConstants.POINTS_PER_INCH
- / MeasurementConstants.CM_PER_INCH
- * TypographicConstants.MILLIPOINTS_PER_POINT);
+ final String numericPart = matcher.group(1);
+ final String unitsPart = matcher.group(2);
+
+ final float numeric;
+ try {
+ numeric = Float.parseFloat(numericPart);
+ } catch (final NumberFormatException e) {
+ return null;
}
- case DtLength.UNIT_MILLIMETERS: {
- return Math.round(this.value * TypographicConstants.POINTS_PER_INCH
- / MeasurementConstants.CM_PER_INCH
- / MeasurementConstants.MM_PER_CM
- * TypographicConstants.MILLIPOINTS_PER_POINT);
- }
- case DtLength.UNIT_POINTS: {
- return Math.round(this.value * TypographicConstants.MILLIPOINTS_PER_POINT);
- }
- case DtLength.UNIT_PICAS: {
- return Math.round(this.value * TypographicConstants.PICAS_PER_INCH
- * TypographicConstants.MILLIPOINTS_PER_POINT);
- }
- case DtLength.UNIT_PIXELS: {
- // for now, assume that 1 pixel = 1 point = 1/72"
- return Math.round(this.value * TypographicConstants.MILLIPOINTS_PER_POINT);
- }
- case DtLength.UNIT_EMS: {
- return Math.round(this.value * fontSize);
- }
- default: {
- return 0;
- }
- }
- }
- /**
- * Converts a String unit descriptor to its internal byte equivalent.
- * @param units The String descriptor of the units.
- * @return The byte equivalent.
- */
- public static byte convertUnits(final String units) {
- for (byte i = 0; i < DtLength.UNIT_ARRAY.length; i++) {
- if (units.equals(DtLength.UNIT_ARRAY[i])) {
- return i;
- }
+ switch(unitsPart) {
+ case "pt": return new DtLength_Points(numeric);
+ case "em": return new DtLength_Ems(numeric);
+ case "in": return new DtLength_Inches(numeric);
+ case "cm": return new DtLength_Centimeters(numeric);
+ case "mm": return new DtLength_Millimeters(numeric);
+ case "pc": return new DtLength_Picas(numeric);
+ case "px": return new DtLength_Pixels(numeric);
}
- return -1;
+ return null;
}
@Override
@@ -165,7 +101,7 @@
@Override
public Number evalNumber() {
- return this.value;
+ return getRawValue();
}
@Override
@@ -173,38 +109,6 @@
return Expr.UNIT_POWER_LENGTH;
}
- /**
- * Factory method for creating a LengthDT instance from a String.
- * @param input The string from which a LengthDT instance should be
- * created.
- * @return A LengthDT instance, or null if input is not valid.
- */
- public static DtLength makeLengthDT(final String input) {
- // Make a copy of input
- final String useInput = new String(input);
- useInput.trim();
- byte unitArrayIndex = -1;
- for (byte i = 1; i < DtLength.UNIT_ARRAY.length; i++) {
- if (useInput.endsWith(DtLength.UNIT_ARRAY[i])) {
- unitArrayIndex = i;
- }
- }
- if (unitArrayIndex < 1) {
- return null;
- }
- final int charsToTruncate =
- DtLength.UNIT_ARRAY[unitArrayIndex].length();
- final String valuePart = useInput.substring(0, useInput.length()
- - charsToTruncate);
- float value = 0;
- try {
- value = Float.parseFloat(valuePart);
- } catch (final NumberFormatException e) {
- return null;
- }
- return new DtLength(value, DtLength.UNIT_ARRAY[unitArrayIndex]);
- }
-
@Override
public boolean canEvalLength() {
return true;
@@ -215,19 +119,4 @@
return getValue(pointSize);
}
- @Override
- public boolean lengthRequiresFontSize() {
- return this.needsFontSize();
- }
-
- /**
- * Indicates whether this length requires a font-size to compute its value.
- * In environments where computing the font-size is expensive, checking this
- * method first can avoid that cost.
- * @return True if and only if this length requires a font-size to compute its value.
- */
- public boolean needsFontSize() {
- return this.units == DtLength.UNIT_EMS;
- }
-
}
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Centimeters.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Centimeters.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Centimeters.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.MeasurementConstants;
+import org.axsl.constants.TypographicConstants;
+
+
+/**
+ * A "length" property datatype in XSL-FO whose units are "centimeters".
+ * Members of this class are immutable.
+ */
+public final class DtLength_Centimeters extends DtLength {
+
+ /** The signed length value. Stored internally to ensure immutability. */
+ private final float value;
+
+ /**
+ * Constructor.
+ * @param value The signed length value.
+ */
+ public DtLength_Centimeters(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue(final int fontSize) {
+ return Math.round(this.value * TypographicConstants.POINTS_PER_INCH
+ / MeasurementConstants.CM_PER_INCH
+ * TypographicConstants.MILLIPOINTS_PER_POINT);
+ }
+
+ @Override
+ public float getRawValue() {
+ return this.value;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Centimeters.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Ems.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Ems.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Ems.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+/**
+ * A "length" property datatype in XSL-FO whose units are "ems".
+ * Members of this class are immutable.
+ */
+public final class DtLength_Ems extends DtLength {
+
+ /** The signed length value. Stored internally to ensure immutability. */
+ private final float value;
+
+ /**
+ * Constructor.
+ * @param value The signed length value.
+ */
+ public DtLength_Ems(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue(final int fontSize) {
+ return Math.round(this.value * fontSize);
+ }
+
+ @Override
+ public float getRawValue() {
+ return this.value;
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ return true;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Ems.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Inches.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Inches.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Inches.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.TypographicConstants;
+
+
+/**
+ * A "length" property datatype in XSL-FO whose units are "inches".
+ * Members of this class are immutable.
+ */
+public final class DtLength_Inches extends DtLength {
+
+ /** The signed length value. Stored internally to ensure immutability. */
+ private final float value;
+
+ /**
+ * Constructor.
+ * @param value The signed length value.
+ */
+ public DtLength_Inches(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue(final int fontSize) {
+ return Math.round(this.value * TypographicConstants.POINTS_PER_INCH
+ * TypographicConstants.MILLIPOINTS_PER_POINT);
+ }
+
+ @Override
+ public float getRawValue() {
+ return this.value;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Inches.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Millimeters.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Millimeters.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Millimeters.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.MeasurementConstants;
+import org.axsl.constants.TypographicConstants;
+
+
+/**
+ * A "length" property datatype in XSL-FO whose units are "millimeters".
+ * Members of this class are immutable.
+ */
+public final class DtLength_Millimeters extends DtLength {
+
+ /** The signed length value. Stored internally to ensure immutability. */
+ private final float value;
+
+ /**
+ * Constructor.
+ * @param value The signed length value.
+ */
+ public DtLength_Millimeters(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue(final int fontSize) {
+ return Math.round(this.value * TypographicConstants.POINTS_PER_INCH
+ / MeasurementConstants.CM_PER_INCH
+ / MeasurementConstants.MM_PER_CM
+ * TypographicConstants.MILLIPOINTS_PER_POINT);
+ }
+
+ @Override
+ public float getRawValue() {
+ return this.value;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Millimeters.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.TypographicConstants;
+
+
+/**
+ * A "length" property datatype in XSL-FO whose units are "picas".
+ * Members of this class are immutable.
+ */
+public final class DtLength_Picas extends DtLength {
+
+ /** The signed length value. Stored internally to ensure immutability. */
+ private final float value;
+
+ /**
+ * Constructor.
+ * @param value The signed length value.
+ */
+ public DtLength_Picas(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue(final int fontSize) {
+ return Math.round(this.value * TypographicConstants.PICAS_PER_INCH
+ * TypographicConstants.MILLIPOINTS_PER_POINT);
+ }
+
+ @Override
+ public float getRawValue() {
+ return this.value;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Picas.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Pixels.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Pixels.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Pixels.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.TypographicConstants;
+
+
+/**
+ * A "length" property datatype in XSL-FO whose units are "pixels".
+ * Members of this class are immutable.
+ */
+public final class DtLength_Pixels extends DtLength {
+
+ /** The signed length value. Stored internally to ensure immutability. */
+ private final float value;
+
+ /**
+ * Constructor.
+ * @param value The signed length value.
+ */
+ public DtLength_Pixels(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue(final int fontSize) {
+ // for now, assume that 1 pixel = 1 point = 1/72"
+ return Math.round(this.value * TypographicConstants.MILLIPOINTS_PER_POINT);
+ }
+
+ @Override
+ public float getRawValue() {
+ return this.value;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Pixels.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Points.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Points.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Points.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2022 The FOray Project.
+ * http://www.foray.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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.fotree.value;
+
+import org.axsl.constants.TypographicConstants;
+
+
+/**
+ * A "length" property datatype in XSL-FO whose units are "points".
+ * Members of this class are immutable.
+ */
+public final class DtLength_Points extends DtLength {
+
+ /** The signed length value. Stored internally to ensure immutability. */
+ private final float value;
+
+ /**
+ * Constructor.
+ * @param value The signed length value.
+ */
+ public DtLength_Points(final float value) {
+ this.value = value;
+ }
+
+ @Override
+ public int getValue(final int fontSize) {
+ return Math.round(this.value * TypographicConstants.MILLIPOINTS_PER_POINT);
+ }
+
+ @Override
+ public float getRawValue() {
+ return this.value;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength_Points.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -40,9 +40,8 @@
/**
* A rectangle datatype in XSL.
- * This datatype is not specifically listed among the datatypes in the XSL-FO
- * Standard 1.0, at Section 5.11. However, it is described at Section 7.20.1,
- * and in the CSS 2.1 Specification at 11.1.2 and other places.
+ * This datatype is not specifically listed among the datatypes in the XSL-FO Standard 1.0, at Section 5.11.
+ * However, it is described at Section 7.20.1, and in the CSS 2.1 Specification at 11.1.2 and other places.
*/
public class DtRectangle extends DtShape {
@@ -197,7 +196,7 @@
pvArray[pvIndex] = FoPropertyKeyword.getPropertyKeyword(
FoValue.INHERIT);
}
- final DtLength length = DtLength.makeLengthDT(token);
+ final DtLength length = DtLength.procureInstance(token);
if (length != null) {
pvArray[pvIndex] = length;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -158,7 +158,7 @@
}
return null;
}
- final DtLength aLength = DtLength.makeLengthDT(token);
+ final DtLength aLength = DtLength.procureInstance(token);
if (aLength == null) {
// This can only happen if the input is bad.
return null;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -253,7 +253,7 @@
this.setPrecedence(new DtInteger(precedence));
return true;
}
- final DtLength length = DtLength.makeLengthDT(value);
+ final DtLength length = DtLength.procureInstance(value);
if (length != null) {
if (subPropertyName.equals("minimum")) {
this.setLengthMaximum(length);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -79,7 +79,7 @@
+ provisionalDistanceBetweenStarts;
DtLength lengthDT = null;
- lengthDT = new DtLength(length / TypographicConstants.MILLIPOINTS_PER_POINT, "pt");
+ lengthDT = new DtLength_Points(length / TypographicConstants.MILLIPOINTS_PER_POINT);
return lengthDT;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -83,7 +83,7 @@
- provisionalLabelSeparation);
DtLength lengthDT = null;
- lengthDT = new DtLength(length / TypographicConstants.MILLIPOINTS_PER_POINT, "pt");
+ lengthDT = new DtLength_Points(length / TypographicConstants.MILLIPOINTS_PER_POINT);
return lengthDT;
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -109,8 +109,7 @@
propertyList.addProperty(lh);
final int halfLeadingMax = fobj.traitHalfLeadingMax(STD_FO_CONTEXT);
/* D = Distance between baselines = 3.7cm = 104,882 millipoints.
- * L = Leading = D - the default font size of 12,000 = 92,882
- * millipoints.
+ * L = Leading = D - the default font size of 12,000 = 92,882 millipoints.
* HL = L / 2 = 46,441 millipoints. */
assertEquals(46441, halfLeadingMax);
final int halfLeadingOpt = fobj.traitHalfLeadingOpt(STD_FO_CONTEXT);
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java 2022-12-31 14:06:19 UTC (rev 12987)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java 2022-12-31 17:35:07 UTC (rev 12988)
@@ -39,16 +39,15 @@
/** A bogus point size to use when we don't care what it is. */
private static final byte POINT_SIZE_DONT_CARE = 12;
-/**
- * Unit test for a centimeter length.
- */
-@Test
-public void testCentimeters() {
- final DtLength length = DtLength.makeLengthDT("3.7cm");
- final int resolvedLength = length.getValue(
- DtLengthTests.POINT_SIZE_DONT_CARE);
- /* Return value is in millipoints. */
- assertEquals(104882, resolvedLength);
-}
+ /**
+ * Unit test for a centimeter length.
+ */
+ @Test
+ public void testCentimeters() {
+ final DtLength length = DtLength.procureInstance("3.7cm");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE_DONT_CARE);
+ /* Return value is in millipoints. */
+ assertEquals(104882, resolvedLength);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 14:06:22
|
Revision: 12987
http://sourceforge.net/p/foray/code/12987
Author: victormote
Date: 2022-12-31 14:06:19 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Remove no-longer-needed class.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyCollection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PvKeyword.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ValueCollection.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 13:44:11 UTC (rev 12986)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 14:06:19 UTC (rev 12987)
@@ -28,24 +28,11 @@
package org.foray.fotree.value;
-
/**
* Abstract Base Class for all Expressions.
*/
public abstract class Expr implements PropertyValue {
- /** Constant indicating an invalid unit power, that is, a non-numeric item.*/
- public static final byte UNIT_POWER_NON_NUMERIC = -1;
-
- /** Constant indicating a numeric item, but one that has zero dimensions. */
- public static final byte UNIT_POWER_NUMERIC = 0;
-
- /** Constant indicating a one-dimensional item in space, that is, a length. */
- public static final byte UNIT_POWER_LENGTH = 1;
-
- /** Constant indicating a two-dimensional item in space, that is, an area. */
- public static final byte UNIT_POWER_AREA = 2;
-
/** Constant indicating an add operation. */
public static final byte OPERATION_ADD = '+';
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyCollection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyCollection.java 2022-12-31 13:44:11 UTC (rev 12986)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyCollection.java 2022-12-31 14:06:19 UTC (rev 12987)
@@ -43,7 +43,7 @@
* properties like "border-style" which can contain 1, 2, 3 or 4 values,
* and which must be wrapped up and unwrapped in some orderly way.
*/
-public class PropertyCollection extends PropertyValueStatic {
+public class PropertyCollection implements PropertyValue {
/** Constant indicating that this collection contains one property. */
private static final byte SIZE_1 = 1;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 13:44:11 UTC (rev 12986)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 14:06:19 UTC (rev 12987)
@@ -37,6 +37,21 @@
*/
public interface PropertyValue {
+ /** Constant indicating an invalid unit power, that is, a non-numeric item.*/
+ byte UNIT_POWER_NON_NUMERIC = -1;
+
+ /** Constant indicating a numeric item, but one that has zero dimensions. */
+ byte UNIT_POWER_NUMERIC = 0;
+
+ /** Constant indicating a one-dimensional item in space, that is, a length. */
+ byte UNIT_POWER_LENGTH = 1;
+
+ /** Constant indicating a two-dimensional item in space, that is, an area. */
+ byte UNIT_POWER_AREA = 2;
+
+ /** Constant indicating a three-dimensional item in space, that is, a volume. */
+ byte UNIT_POWER_VOLUME = 3;
+
/**
* Indicates whether this property value can be expressed as an XSL-FO "number".
* @return True if and only if this property value can be expressed as an XSL-FO "number".
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-31 13:44:11 UTC (rev 12986)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-31 14:06:19 UTC (rev 12987)
@@ -1,37 +0,0 @@
-/*
- * Copyright 2007 The FOray Project.
- * http://www.foray.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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.fotree.value;
-
-/**
- * Abstract superclass for static property values, that is, property values
- * that are not expressions.
- */
-public abstract class PropertyValueStatic implements PropertyValue {
-
-}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PvKeyword.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PvKeyword.java 2022-12-31 13:44:11 UTC (rev 12986)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PvKeyword.java 2022-12-31 14:06:19 UTC (rev 12987)
@@ -32,7 +32,7 @@
* Abstract superclass for all property value classes that encapsulate keywords,
* regardless of namespace.
*/
-public abstract class PvKeyword extends PropertyValueStatic {
+public abstract class PvKeyword implements PropertyValue {
@Override
public boolean canEvalKeyword() {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ValueCollection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ValueCollection.java 2022-12-31 13:44:11 UTC (rev 12986)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ValueCollection.java 2022-12-31 14:06:19 UTC (rev 12987)
@@ -36,7 +36,7 @@
* A collection of one or more other <em>PropertyValue</em> instances that is
* itself a <em>PropertyValue</em>.
*/
-public class ValueCollection extends PropertyValueStatic {
+public class ValueCollection implements PropertyValue {
/**
* Contains the collection of Properties that are stored in this
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 13:44:14
|
Revision: 12986
http://sourceforge.net/p/foray/code/12986
Author: victormote
Date: 2022-12-31 13:44:11 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Move common code related to canEvalKeyword and evalKeyword to default implementation in the interface.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyCollection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ValueCollection.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -170,14 +170,4 @@
return true;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -180,14 +180,4 @@
return false;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -52,14 +52,4 @@
return this.value;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -765,14 +765,4 @@
return (float) integralColor / divisor;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -96,14 +96,4 @@
return dtCountry;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -121,14 +121,4 @@
}
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -97,14 +97,4 @@
return this.getValue();
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -159,14 +159,4 @@
return DtKeep.DEFAULT_KEEP_VALUE;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -72,16 +72,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public String toString() {
return this.getValue();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -230,14 +230,4 @@
return this.units == DtLength.UNIT_EMS;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -104,14 +104,4 @@
return this.ipdLength;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -69,14 +69,4 @@
return this.conditionality;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -171,14 +171,4 @@
return false;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -85,14 +85,4 @@
return dtColor.evalColor();
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -83,14 +83,4 @@
return new DtNumber(aNumber);
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -94,16 +94,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public boolean canEvalPercentage() {
return true;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -217,16 +217,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public Shape computeShape(final Shape inputShape, final int pointSize) {
/* TODO: Not sure what the percent base should be here. It is probably
* relative to the inputShape. */
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -182,14 +182,4 @@
return false;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -191,14 +191,4 @@
return this.color.getValue();
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -314,14 +314,4 @@
}
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -52,14 +52,4 @@
return this.value;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -126,14 +126,4 @@
this.isUnderlined = isUnderlined;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -113,14 +113,4 @@
return new DtTime(quantity, units);
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -109,14 +109,4 @@
return tokenizedList;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -555,16 +555,6 @@
return null;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
/**
* Indicates whether this writing-mode is horizontal or vertical.
* @return True if this writing-mode is horizontal, false if it is vertical.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -34,19 +34,16 @@
*/
public abstract class Expr implements PropertyValue {
- /** Constant indicating an invalid unit power, that is, a non-numeric
- * item.*/
+ /** Constant indicating an invalid unit power, that is, a non-numeric item.*/
public static final byte UNIT_POWER_NON_NUMERIC = -1;
/** Constant indicating a numeric item, but one that has zero dimensions. */
public static final byte UNIT_POWER_NUMERIC = 0;
- /** Constant indicating a one-dimensional item in space, that is, a
- * length. */
+ /** Constant indicating a one-dimensional item in space, that is, a length. */
public static final byte UNIT_POWER_LENGTH = 1;
- /** Constant indicating a two-dimensional item in space, that is, an
- * area. */
+ /** Constant indicating a two-dimensional item in space, that is, an area. */
public static final byte UNIT_POWER_AREA = 2;
/** Constant indicating an add operation. */
@@ -67,14 +64,4 @@
/** Constant indicating a negation operation. */
public static final byte OPERATION_NEGATION = '-';
- /**
- * Standard exception when trying to evaluate to a Keyword for a value that
- * cannot do so.
- * @return An appropriate Exception.
- */
- public IllegalStateException evalKeywordException() {
- return new IllegalStateException("Property cannot evaluate to a "
- + "Keyword.");
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -170,16 +170,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public boolean canEvalPercentage() {
return this.operand1.canEvalPercentage()
&& this.operand2.canEvalPercentage();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -222,16 +222,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public boolean canEvalPercentage() {
return this.operand1.canEvalPercentage()
&& this.operand2.canEvalPercentage();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -101,16 +101,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public boolean canEvalPercentage() {
return this.operand1.canEvalPercentage();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -39,14 +39,4 @@
return true;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -104,14 +104,4 @@
return super.evalInteger();
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -39,14 +39,4 @@
return true;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -84,16 +84,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public boolean isValidForObject(final FoObj fobj) {
final ListItem listItem = fobj.getNearestListItem(null);
if (listItem == null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -88,16 +88,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public boolean isValidForObject(final FoObj fobj) {
final ListItem listItem = fobj.getNearestListItem(null);
if (listItem == null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -99,16 +99,6 @@
}
@Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
public boolean isValidForObject(final FoObj fobj) {
/* Per the XSL-FO standard 1.0, Section 5.10.4, it is an error for
* this function to be used by anything but a table-column. */
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -125,14 +125,4 @@
return this.propertyType;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyCollection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyCollection.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyCollection.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -210,14 +210,4 @@
return null;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -170,17 +170,19 @@
* Indicates whether this property value can evaluate to a keyword.
* @return True if and only if this property value can evaluate to a keyword.
*/
- boolean canEvalKeyword();
+ default boolean canEvalKeyword() {
+ return false;
+ }
/**
* Returns the keyword value of this property value.
- * This method should only be executed on instances where
- * {@link #canEvalKeyword()} returns true.
- * Doing so on other instances may result in an
- * {@link IllegalStateException}.
* @return The keyword value of this property value.
+ * @throws IllegalStateException If this value cannot be expressed as a keyword.
+ * Test with {@link #canEvalKeyword()} to avoid this exception.
*/
- PvKeyword evalKeyword();
+ default PvKeyword evalKeyword() {
+ throw new IllegalStateException("Property cannot evaluate to a keyword.");
+ }
/**
* Indicates whether this function can be evaluated in the context of a given object.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -34,14 +34,4 @@
*/
public abstract class PropertyValueStatic implements PropertyValue {
- /**
- * Standard exception when trying to evaluate to a Keyword for a value that
- * cannot do so.
- * @return An appropriate Exception.
- */
- public IllegalStateException evalKeywordException() {
- return new IllegalStateException("Property cannot evaluate to a "
- + "Keyword.");
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ValueCollection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ValueCollection.java 2022-12-31 12:42:50 UTC (rev 12985)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ValueCollection.java 2022-12-31 13:44:11 UTC (rev 12986)
@@ -107,14 +107,4 @@
return returnArray;
}
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 12:42:53
|
Revision: 12985
http://sourceforge.net/p/foray/code/12985
Author: victormote
Date: 2022-12-31 12:42:50 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Move common code related to canEvalColor and evalColor to default implementation in the interface.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -32,8 +32,6 @@
import org.axsl.constants.NumericConstants;
-import java.awt.Color;
-
/**
* An "angle" property datatype in XSL-FO.
*/
@@ -173,16 +171,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -31,8 +31,6 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.fo.FoValue;
-import java.awt.Color;
-
/**
* Pseudo-datatype for border-width, which is defined at XSL-FO Recommendation
* 1.1, Section 7.8.21.
@@ -183,16 +181,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,8 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
-
/**
* A "character" datatype in XSL-FO.
*/
@@ -55,16 +53,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -452,19 +452,12 @@
return this.value;
}
- /**
- * {@inheritDoc}
- * Overrides the base class, because this function can evaluate to a color.
- */
@Override
public boolean canEvalColor() {
return true;
}
- /**
- * Returns the encapsulated Color.
- * @return The encapsulated Color.
- */
+ @Override
public Color evalColor() {
return getValue();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -32,7 +32,6 @@
import org.axsl.i18n.Country;
-import java.awt.Color;
import java.util.HashMap;
import java.util.Map;
@@ -98,16 +97,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -32,8 +32,6 @@
import org.axsl.constants.MeasurementConstants;
-import java.awt.Color;
-
/**
* A "frequency" datatype in XSL. See XSL-FO Specification 1.0, Section 5.11.
*/
@@ -124,16 +122,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,9 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
-
-
/**
* An "integer" property datatype in XSL-FO.
* Members of this class are immutable.
@@ -101,16 +98,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -30,8 +30,6 @@
import org.foray.fotree.PropertyException;
-import java.awt.Color;
-
/**
* A keep datatype in XSL. Used for the XSL-FO properties keep-together,
* keep-with-next, and keep-with-previous. This datatype is
@@ -162,16 +160,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -32,8 +32,6 @@
import org.axsl.i18n.Language;
-import java.awt.Color;
-
/**
* A "language" datatype in XSL-FO.
* Languages must conform to the 2-letter or 3-letter ISO 639 codes.
@@ -74,16 +72,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -31,9 +31,7 @@
import org.axsl.constants.MeasurementConstants;
import org.axsl.constants.TypographicConstants;
-import java.awt.Color;
-
/**
* A "length" property datatype in XSL-FO.
* Members of this class are immutable.
@@ -233,16 +231,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -30,8 +30,6 @@
import org.foray.fotree.PropertyException;
-import java.awt.Color;
-
/**
* A length-conditional datatype in XSL. This datatype is described in the
* XSL-FO Standard 1.0, at Section 5.11.
@@ -107,16 +105,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -30,8 +30,6 @@
import org.foray.fotree.fo.FoValue;
-import java.awt.Color;
-
/**
* A length-conditional datatype in XSL. This datatype is described in the
* XSL-FO Standard 1.0, at Section 5.11.
@@ -72,16 +70,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -30,8 +30,6 @@
import org.foray.fotree.PropertyException;
-import java.awt.Color;
-
/**
* A length-range datatype in XSL.
* This datatype is described in the XSL-FO Standard 1.0, at Section 5.11.
@@ -174,16 +172,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -80,7 +80,7 @@
public Color evalColor() {
final DtColor dtColor = DtColor.mapNameToColorRGB(this.value);
if (dtColor == null) {
- throw evalColorException();
+ super.evalColor();
}
return dtColor.evalColor();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,9 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
-
-
/**
* A "number" property datatype in XSL-FO.
*/
@@ -87,16 +84,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,9 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
-
-
/**
* A "percentage" property datatype in XSL-FO.
* Instances of this class are immutable.
@@ -97,16 +94,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -33,7 +33,6 @@
import org.foray.fotree.fo.FoPropertyKeyword;
import org.foray.fotree.fo.FoValue;
-import java.awt.Color;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
@@ -218,16 +217,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,7 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
import java.util.Arrays;
/**
@@ -184,16 +183,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -116,14 +116,6 @@
return this.blurRadius.getValue(fontSize);
}
- @Override
- public Color evalColor() {
- if (this.color == null) {
- return null;
- }
- return this.color.getValue();
- }
-
/**
* Returns the color for this shadow effect.
* @return The color for this shadow effect.
@@ -188,10 +180,18 @@
@Override
public boolean canEvalColor() {
- return false;
+ return this.color != null;
}
@Override
+ public Color evalColor() {
+ if (this.color == null) {
+ return null;
+ }
+ return this.color.getValue();
+ }
+
+ @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -35,8 +35,6 @@
import org.axsl.value.Conditionality;
-import java.awt.Color;
-
/**
* A space quantity in XSL (space-before, space-after). This datatype is
* described in the XSL-FO Standard 1.0, at Section 4.3 and Section 5.11.
@@ -317,16 +315,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,8 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
-
/**
* A "string" property datatype in XSL-FO.
*/
@@ -55,16 +53,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,8 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
-
/**
* Text Decoration is not a datatype recognized in XSL-FO. However, its
* definition in the standard makes it a <em>de facto</em> compound data
@@ -129,16 +127,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -30,8 +30,6 @@
import org.axsl.constants.MeasurementConstants;
-import java.awt.Color;
-
/**
* A "time" datatype in XSL. See XSL-FO Specification 1.0, Section 5.11.
*/
@@ -116,16 +114,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -31,7 +31,6 @@
import org.foray.common.url.UrlUtil;
import org.foray.fotree.PropertyException;
-import java.awt.Color;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -111,16 +110,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -35,7 +35,6 @@
import org.axsl.value.RelativeAxis;
import org.axsl.value.RelativeCompass;
-import java.awt.Color;
import java.util.HashMap;
import java.util.Map;
@@ -557,16 +556,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -68,16 +68,6 @@
public static final byte OPERATION_NEGATION = '-';
/**
- * Standard exception when trying to evaluate to a Color for a value that
- * cannot do so.
- * @return An appropriate Exception.
- */
- public IllegalStateException evalColorException() {
- return new IllegalStateException("Property cannot evaluate to a "
- + "Color.");
- }
-
- /**
* Standard exception when trying to evaluate to a Keyword for a value that
* cannot do so.
* @return An appropriate Exception.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -30,8 +30,6 @@
import org.foray.fotree.PropertyException;
-import java.awt.Color;
-
/**
* Class for handling AdditiveExpr.
*/
@@ -172,16 +170,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -30,8 +30,6 @@
import org.foray.fotree.PropertyException;
-import java.awt.Color;
-
/**
* Multiplicative operation.
*/
@@ -224,16 +222,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -30,8 +30,6 @@
import org.foray.fotree.PropertyException;
-import java.awt.Color;
-
/**
* Unary operation expression.
*/
@@ -103,16 +101,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -82,12 +82,14 @@
@Override
public boolean canEvalColor() {
- return false;
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.canEvalColor();
}
@Override
public Color evalColor() {
- throw evalColorException();
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.evalColor();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,8 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
-
/**
* Abstract superclass for number functions.
* @see "XSL-FO Recommendation 1.1, Section 5.10.1."
@@ -42,16 +40,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -35,8 +35,6 @@
import org.axsl.fotree.FoContext;
import org.axsl.fotree.fo.ListItem;
-import java.awt.Color;
-
/**
* The "body-start" function in XSL-FO.
* @see "XSL-FO Recommendation 1.1, Section 5.10.4."
@@ -86,16 +84,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -36,8 +36,6 @@
import org.axsl.fotree.fo.ListBlock;
import org.axsl.fotree.fo.ListItem;
-import java.awt.Color;
-
/**
* The "label-end" function in XSL-FO.
* @see "XSL-FO Recommendation 1.1, Section 5.10.4."
@@ -90,16 +88,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -35,8 +35,6 @@
import org.axsl.fotree.fo.Table;
import org.axsl.value.TableLayout;
-import java.awt.Color;
-
/**
* The "proportional-column-width" function in XSL-FO.
* @see "XSL-FO Recommendation 1.1, Section 5.10.4."
@@ -101,16 +99,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -114,10 +114,6 @@
/ PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT);
}
- /**
- * {@inheritDoc}
- * Overrides the base class, because this function can evaluate to a color.
- */
@Override
public Color evalColor() {
return eval();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -117,10 +117,6 @@
return null;
}
- /**
- * {@inheritDoc}
- * Overrides the base class, because this function can evaluate to a color.
- */
@Override
public Color evalColor() {
return eval();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemColor.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemColor.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -69,10 +69,6 @@
return dtColor.evalColor();
}
- /**
- * {@inheritDoc}
- * Overrides the base class, because this function can evaluate to a color.
- */
@Override
public Color evalColor() {
return eval();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -33,8 +33,6 @@
import org.foray.fotree.PropertyId;
import org.foray.fotree.fo.FoPropertyId;
-import java.awt.Color;
-
/**
* The "system-font" function in XSL-FO.
* @see "XSL-FO Recommendation 1.1, Section 5.10.2."
@@ -128,16 +126,6 @@
}
@Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -146,21 +146,25 @@
*/
default Number evalPercentage() {
throw new IllegalStateException("Property cannot evaluate to a percentage.");
-
}
/**
- * Indicates whether this property value has the ability to express itself
- * as a Color.
- * @return True if and only if this property value is a color.
+ * Indicates whether this property value can evaluate to a Color.
+ * @return True if and only if this property value can evaluate to a color.
*/
- boolean canEvalColor();
+ default boolean canEvalColor() {
+ return false;
+ }
/**
- * Return the color value of "this".
- * @return The color representation of the value of "this".
+ * Returns this property value expressed as a color.
+ * @return The color value of the this property value.
+ * @throws IllegalStateException If this value cannot be expressed as a color.
+ * Test with {@link #canEvalColor()} to avoid this exception.
*/
- Color evalColor();
+ default Color evalColor() {
+ throw new IllegalStateException("Property cannot evaluate to a color.");
+ }
/**
* Indicates whether this property value can evaluate to a keyword.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-31 01:28:25 UTC (rev 12984)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-31 12:42:50 UTC (rev 12985)
@@ -28,8 +28,6 @@
package org.foray.fotree.value;
-import java.awt.Color;
-
/**
* Abstract superclass for static property values, that is, property values
* that are not expressions.
@@ -36,16 +34,6 @@
*/
public abstract class PropertyValueStatic implements PropertyValue {
- @Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw new IllegalStateException("Property cannot evaluate to a Color.");
- }
-
/**
* Standard exception when trying to evaluate to a Keyword for a value that
* cannot do so.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-31 01:28:28
|
Revision: 12984
http://sourceforge.net/p/foray/code/12984
Author: victormote
Date: 2022-12-31 01:28:25 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Move common code related to canEvalPercentage and evalPercentage to default implementation in the interface.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteOffset.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBackgroundPosition.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractContentDimension.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractIndent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPadding.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdExtent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderPatternWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMargin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPadding.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalDistanceBetweenStarts.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalLabelSeparation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextAltitude.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDepth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextIndent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -114,9 +114,8 @@
} else {
base = context.ipdAncestorBlockOrRa();
}
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base
- / NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteOffset.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteOffset.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAbsoluteOffset.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -112,8 +112,8 @@
if (value().canEvalPercentage()) {
final int dimensionContainingBlock = this.dimensionContainingBlock(
context);
- final float percent = value().evalPercentage();
- return Math.round(dimensionContainingBlock * percent
+ final Number percent = value().evalPercentage();
+ return (int) Math.round(dimensionContainingBlock * percent.doubleValue()
/ NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAllowedAxisScale.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -142,7 +142,7 @@
if (pv.canEvalKeyword()) {
returnValue[i] = java.lang.Float.POSITIVE_INFINITY;
} else if (pv.canEvalPercentage()) {
- returnValue[i] = pv.evalPercentage();
+ returnValue[i] = pv.evalPercentage().floatValue();
}
}
return returnValue;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBackgroundPosition.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBackgroundPosition.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBackgroundPosition.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -90,10 +90,9 @@
final int paddingRectangleDimension,
final int backgroundImageDimension) {
if (value().canEvalPercentage()) {
- final float percent = value().evalPercentage();
- return Math.round(percent / NumericConstants.PERCENT_CONVERSION
- * (paddingRectangleDimension
- - backgroundImageDimension));
+ final Number percent = value().evalPercentage();
+ return (int) Math.round(percent.doubleValue() / NumericConstants.PERCENT_CONVERSION
+ * (paddingRectangleDimension - backgroundImageDimension));
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractContentDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractContentDimension.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractContentDimension.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -132,8 +132,8 @@
}
}
if (value().canEvalPercentage()) {
- final float percentage = value().evalPercentage();
- return percentage / NumericConstants.PERCENT_CONVERSION;
+ final Number percentage = value().evalPercentage();
+ return (float) percentage.doubleValue() / NumericConstants.PERCENT_CONVERSION;
}
if (value().canEvalLength()) {
final int length = this.convertValueToLength(value(), fobj,
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractIndent.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractIndent.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractIndent.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -109,10 +109,9 @@
}
}
if (value().canEvalPercentage()) {
- final float percentage = value().evalPercentage();
+ final Number percentage = value().evalPercentage();
final int base = context.ipdContainingRefArea();
- return Math.round(percentage * base /
- NumericConstants.PERCENT_CONVERSION);
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractMargin.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -103,9 +103,8 @@
} else {
base = context.widthContainingBlock();
}
- final float percent = value().evalPercentage();
- return Math.round(base * percent
- / NumericConstants.PERCENT_CONVERSION);
+ final Number percent = value().evalPercentage();
+ return (int) Math.round(base * percent.doubleValue() / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPadding.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPadding.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPadding.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -104,7 +104,7 @@
if (value().canEvalPercentage()) {
/* TODO: This base is probably not quite right. */
final int base = context.ipdAncestorBlockOrRa();
- return Math.round(value().evalPercentage() * base);
+ return (int) Math.round(value().evalPercentage().doubleValue() * base);
}
if (value() instanceof DtLengthConditional) {
final DtLengthConditional lengthConditional
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -145,7 +145,7 @@
return ((DtTime) value()).getValue();
}
if (value().canEvalPercentage()) {
- final float percentage = value().evalPercentage();
+ final Number percentage = value().evalPercentage();
/*
* The base is computed as the reciprocal of the speech-rate,
* and we wish to express the value in milliseconds. speech-rate
@@ -153,7 +153,7 @@
* 60,000 to convert from minutes to milliseconds.
*/
final double base = 1 / fobj.traitSpeechRate(context).doubleValue() * 60000;
- return (int) Math.round(base * percentage);
+ return (int) Math.round(base * percentage.doubleValue());
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -137,9 +137,8 @@
if (base < 0) {
return FoPropertyConstants.DIMENSION_AUTO;
}
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base
- / NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractRelativeSpace.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -155,8 +155,8 @@
if (ipdAncestorBlockArea < 0) {
return 0;
}
- final float percentage = value().evalPercentage();
- return Math.round(percentage * ipdAncestorBlockArea);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * ipdAncestorBlockArea);
}
if (this.isKeywordInherit(this.value())) {
return getValueInherited(context, subProperty, fobj);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAlignmentAdjust.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -134,7 +134,7 @@
}
}
if (value().canEvalPercentage()) {
- return PdAlignmentAdjust.evalPercentage(value().evalPercentage(), inlineContext);
+ return PdAlignmentAdjust.evalPercentage(value().evalPercentage().floatValue(), inlineContext);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundPosition.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -188,10 +188,9 @@
final AbsoluteAxis axis, final int paddingRectangleDimension,
final int backgroundImageDimension) {
if (value().canEvalPercentage()) {
- final float percent = value().evalPercentage();
- return Math.round(percent / NumericConstants.PERCENT_CONVERSION
- * (paddingRectangleDimension
- - backgroundImageDimension));
+ final Number percent = value().evalPercentage();
+ return (int) Math.round(percent.doubleValue() / NumericConstants.PERCENT_CONVERSION
+ * (paddingRectangleDimension - backgroundImageDimension));
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnGap.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -114,9 +114,8 @@
final RegionBody4a rb = (RegionBody4a) fobj;
base = rb.crWidth(context);
}
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base
- / NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -86,8 +86,8 @@
public int getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalPercentage()) {
final int tableWidth = context.tableWidth();
- final float percentage = value().evalPercentage();
- return Math.round(percentage * tableWidth);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * tableWidth);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdExtent.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdExtent.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdExtent.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -114,9 +114,8 @@
}
if (value().canEvalPercentage()) {
final int base = computeBase(context, fobj);
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base
- / NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -195,9 +195,9 @@
return this.convertValueToLength(value(), fobj, context);
}
if (value().canEvalPercentage()) {
- final float percentage = value().evalPercentage();
- return Math.round(percentage * getBaseFontSize(context,
- fobj) / NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * getBaseFontSize(context, fobj)
+ / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalNumber()) {
return value().evalLength(getBaseFontSize(context, fobj));
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderLength.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -160,8 +160,8 @@
return length.evalLength(fobj.traitFontSize(context));
}
if (length.canEvalPercentage()) {
- final float percent = length.evalPercentage();
- return Math.round(context.ipdAncestorBlockOrRa() * percent
+ final Number percent = length.evalPercentage();
+ return (int) Math.round(context.ipdAncestorBlockOrRa() * percent.doubleValue()
/ NumericConstants.PERCENT_CONVERSION);
}
throw this.unexpectedRetrieval();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderPatternWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderPatternWidth.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLeaderPatternWidth.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -104,10 +104,9 @@
}
}
if (value().canEvalPercentage()) {
- final float percentage = value().evalPercentage();
+ final Number percentage = value().evalPercentage();
final int base = context.ipdParentArea();
- return Math.round(percentage * base /
- NumericConstants.PERCENT_CONVERSION);
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -99,7 +99,7 @@
return pv;
}
if (pv.canEvalPercentage()) {
- if (pv.evalPercentage() < 0) {
+ if (pv.evalPercentage().doubleValue() < 0) {
throw unexpectedValue(value);
}
return pv;
@@ -164,9 +164,8 @@
}
if (value().canEvalPercentage()) {
final int base = fobj.traitFontSize(context);
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base /
- NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalNumber()) {
final int fontSize = fobj.traitFontSize(context);
@@ -219,7 +218,7 @@
if (value().canEvalPercentage()) {
/* Not sure from the spec whether percentages are inherited or
* not. It is possible we should return a value of 1.0F here. */
- return value().evalPercentage() / NumericConstants.PERCENT_CONVERSION;
+ return (float) value().evalPercentage().doubleValue() / NumericConstants.PERCENT_CONVERSION;
}
if (value().canEvalNumber()) {
if (value().canEvalLength()) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMargin.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMargin.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMargin.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -137,8 +137,8 @@
} else {
base = context.widthContainingBlock();
}
- final float percent = value.evalPercentage();
- return Math.round(base * percent / NumericConstants.PERCENT_CONVERSION);
+ final Number percent = value.evalPercentage();
+ return (int) Math.round(base * percent.doubleValue() / NumericConstants.PERCENT_CONVERSION);
}
if (value.canEvalLength()) {
return this.convertValueToLength(value, fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPadding.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPadding.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPadding.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -137,8 +137,8 @@
} else {
base = context.widthContainingBlock();
}
- final float percent = value.evalPercentage();
- return Math.round(base * percent / NumericConstants.PERCENT_CONVERSION);
+ final Number percent = value.evalPercentage();
+ return (int) Math.round(base * percent.doubleValue() / NumericConstants.PERCENT_CONVERSION);
}
if (value.canEvalLength()) {
return this.convertValueToLength(value, fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalDistanceBetweenStarts.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalDistanceBetweenStarts.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalDistanceBetweenStarts.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -105,9 +105,8 @@
}
if (value().canEvalPercentage()) {
final int base = context.ipdAncestorBlockArea();
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base /
- NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalLabelSeparation.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalLabelSeparation.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdProvisionalLabelSeparation.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -105,9 +105,8 @@
}
if (value().canEvalPercentage()) {
final int base = context.ipdAncestorBlockArea();
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base
- / NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextAltitude.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextAltitude.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextAltitude.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -109,9 +109,8 @@
* same thing as the fonts em-size, which is essentially the same
* thing as the font's size. */
final int base = fobj.traitFontSize(context);
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base
- / NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDepth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDepth.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDepth.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -109,9 +109,8 @@
* same thing as the fonts em-size, which is essentially the same
* thing as the font's size. */
final int base = fobj.traitFontSize(context);
- final float percentage = value().evalPercentage();
- return Math.round(percentage * base
- / NumericConstants.PERCENT_CONVERSION);
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * base / NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextIndent.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextIndent.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextIndent.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -101,8 +101,8 @@
}
if (value().canEvalPercentage()) {
final int widthContainingBlock = context.widthContainingBlock();
- final float percentage = value().evalPercentage();
- return Math.round(percentage * widthContainingBlock
+ final Number percentage = value().evalPercentage();
+ return (int) Math.round(percentage.doubleValue() * widthContainingBlock
/ NumericConstants.PERCENT_CONVERSION);
}
if (value().canEvalLength()) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVerticalAlign.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -153,7 +153,7 @@
throw unexpectedRetrieval();
}
if (value().canEvalPercentage()) {
- return PdAlignmentAdjust.evalPercentage(value().evalPercentage(), inlineContext);
+ return PdAlignmentAdjust.evalPercentage(value().evalPercentage().floatValue(), inlineContext);
}
if (value().canEvalLength()) {
return this.convertValueToLength(value(), fobj, context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -128,8 +128,8 @@
// Handle the special case of "silent"
return base;
}
- final float percent = value().evalPercentage();
- double product = percent * base.doubleValue();
+ final Number percent = value().evalPercentage();
+ double product = percent.doubleValue() * base.doubleValue();
product = Math.max(product, 0);
product = Math.min(product, NumericConstants.PERCENT_CONVERSION);
return product;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -192,14 +192,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -202,14 +202,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -74,14 +74,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -782,14 +782,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -117,14 +117,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -143,14 +143,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -120,14 +120,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -181,14 +181,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -94,16 +94,6 @@
}
@Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
- @Override
public String toString() {
return this.getValue();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -252,14 +252,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -126,14 +126,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -91,14 +91,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -193,14 +193,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -95,14 +95,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -106,14 +106,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -122,7 +122,7 @@
}
@Override
- public float evalPercentage() {
+ public Number evalPercentage() {
return this.getValue();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -238,16 +238,6 @@
}
@Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
- @Override
public Shape computeShape(final Shape inputShape, final int pointSize) {
/* TODO: Not sure what the percent base should be here. It is probably
* relative to the inputShape. */
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -203,14 +203,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -201,14 +201,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -336,14 +336,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -74,14 +74,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -148,14 +148,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -135,14 +135,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -130,14 +130,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -576,16 +576,6 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
/**
* Indicates whether this writing-mode is horizontal or vertical.
* @return True if this writing-mode is horizontal, false if it is vertical.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -77,16 +77,6 @@
+ "Color.");
}
-// /**
-// * Standard exception when trying to evaluate to a Length for a value that
-// * cannot do so.
-// * @return An appropriate Exception.
-// */
-// public IllegalStateException evalLengthException() {
-// return new IllegalStateException("Property cannot evaluate to a "
-// + "Length.");
-// }
-
/**
* Standard exception when trying to evaluate to a Keyword for a value that
* cannot do so.
@@ -97,14 +87,4 @@
+ "Keyword.");
}
- /**
- * Standard exception when trying to evaluate to a Percentage for a value
- * that cannot do so.
- * @return An appropriate Exception.
- */
- public IllegalStateException evalPercentageException() {
- return new IllegalStateException("Property cannot evaluate to a "
- + "Percentage.");
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -198,15 +198,13 @@
}
@Override
- public float evalPercentage() {
+ public Number evalPercentage() {
switch (this.operation) {
case Expr.OPERATION_ADD: {
- return this.operand1.evalPercentage()
- + this.operand2.evalPercentage();
+ return this.operand1.evalPercentage().doubleValue() + this.operand2.evalPercentage().doubleValue();
}
case Expr.OPERATION_SUBTRACT: {
- return this.operand1.evalPercentage()
- - this.operand2.evalPercentage();
+ return this.operand1.evalPercentage().doubleValue() - this.operand2.evalPercentage().doubleValue();
}
}
return 0;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -122,7 +122,7 @@
}
@Override
- public float evalPercentage() {
+ public Number evalPercentage() {
return this.getEnclosedExpression().evalPercentage();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -250,19 +250,16 @@
}
@Override
- public float evalPercentage() {
+ public Number evalPercentage() {
switch (this.operation) {
case Expr.OPERATION_MULTIPLY: {
- return this.operand1.evalPercentage()
- * this.operand2.evalPercentage();
+ return this.operand1.evalPercentage().doubleValue() * this.operand2.evalPercentage().doubleValue();
}
case Expr.OPERATION_DIVIDE: {
- return this.operand1.evalPercentage()
- / this.operand2.evalPercentage();
+ return this.operand1.evalPercentage().doubleValue() / this.operand2.evalPercentage().doubleValue();
}
case Expr.OPERATION_MOD: {
- return this.operand1.evalPercentage()
- % this.operand2.evalPercentage();
+ return this.operand1.evalPercentage().doubleValue() % this.operand2.evalPercentage().doubleValue();
}
}
return 0;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -128,9 +128,9 @@
}
@Override
- public float evalPercentage() {
+ public Number evalPercentage() {
if (this.operation == Expr.OPERATION_NEGATION) {
- return this.operand1.evalPercentage() * -1;
+ return this.operand1.evalPercentage().doubleValue() * -1;
}
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -104,8 +104,8 @@
}
@Override
- public float evalPercentage() {
- return Math.abs(this.operand1.evalPercentage());
+ public Number evalPercentage() {
+ return Math.abs(this.operand1.evalPercentage().doubleValue());
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -49,14 +49,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-31 00:38:49 UTC (rev 12983)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-31 01:28:25 UTC (rev 12984)
@@ -112,14 +112,4 @@
throw this.evalKeywordException();
}
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
==============================...
[truncated message content] |
|
From: <vic...@us...> - 2022-12-31 00:38:52
|
Revision: 12983
http://sourceforge.net/p/foray/code/12983
Author: victormote
Date: 2022-12-31 00:38:49 +0000 (Sat, 31 Dec 2022)
Log Message:
-----------
Move common code related to canEvalLength and evalLength to default implementation in the interface.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -225,8 +225,7 @@
* @param context An object that knows how to resolve FO context issues.
* @return The length of the property, in millipoints.
*/
- protected int convertValueToLength(final PropertyValue value,
- final FoObj fobj, final FoContext context) {
+ protected int convertValueToLength(final PropertyValue value, final FoObj fobj, final FoContext context) {
int fontSize = 0;
if (value.lengthRequiresFontSize()) {
fontSize = fobj.traitFontSize(context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderWidth.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderWidth.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -113,8 +113,7 @@
return getKeywordValue(context, direction, fobj);
}
if (value().canEvalLength()) {
- final int length = this.convertValueToLength(value(), fobj,
- context);
+ final int length = this.convertValueToLength(value(), fobj, context);
return Math.max(length, 0);
}
if (value() instanceof DtLengthConditional
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -173,16 +173,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -193,11 +183,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -124,8 +124,7 @@
*/
public static boolean isBorderWidth(final PropertyValue value) {
if (value == null) {
- throw new NullPointerException("DtBorderWidth value cannot be " +
- "null");
+ throw new NullPointerException("DtBorderWidth value cannot be null");
}
if (value.canEvalLength()) {
return true;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -55,16 +55,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -75,11 +65,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -773,21 +773,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -98,16 +98,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -118,11 +108,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -124,16 +124,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -144,11 +134,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -91,11 +91,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
public boolean canEvalInteger() {
return true;
}
@@ -106,11 +101,6 @@
}
@Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -121,11 +111,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -162,16 +162,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -182,11 +172,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -74,16 +74,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -94,11 +84,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -107,16 +107,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -127,11 +117,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -72,16 +72,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -92,11 +82,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -174,16 +174,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -194,11 +184,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -71,16 +71,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
final DtColor dtColor = DtColor.mapNameToColorRGB(this.value);
return dtColor != null;
@@ -96,11 +86,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -87,16 +87,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -107,11 +97,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -97,16 +97,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -117,11 +107,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -218,16 +218,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -238,11 +228,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -184,16 +184,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -204,11 +194,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -187,26 +187,11 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -100,11 +100,9 @@
* @param lengthMinimum The new minimum length.
* @throws PropertyException If the input value is not a valid length.
*/
- public void setLengthMinimum(final PropertyValue lengthMinimum)
- throws PropertyException {
+ public void setLengthMinimum(final PropertyValue lengthMinimum) throws PropertyException {
if (! lengthMinimum.canEvalLength()) {
- throw new PropertyException("Invalid length for minimum in "
- + this.getClass().getName());
+ throw new PropertyException("Invalid length for minimum in " + this.getClass().getName());
}
this.lengthMinimum = lengthMinimum;
}
@@ -114,11 +112,9 @@
* @param lengthOptimum The new optimum length.
* @throws PropertyException If the input value is not a valid length.
*/
- public void setLengthOptimum(final PropertyValue lengthOptimum)
- throws PropertyException {
+ public void setLengthOptimum(final PropertyValue lengthOptimum) throws PropertyException {
if (! lengthOptimum.canEvalLength()) {
- throw new PropertyException("Invalid length for optimum in "
- + this.getClass().getName());
+ throw new PropertyException("Invalid length for optimum in " + this.getClass().getName());
}
this.lengthOptimum = lengthOptimum;
}
@@ -128,11 +124,9 @@
* @param lengthMaximum The new maximum length.
* @throws PropertyException If the input value is not a valid length.
*/
- public void setLengthMaximum(final PropertyValue lengthMaximum)
- throws PropertyException {
+ public void setLengthMaximum(final PropertyValue lengthMaximum) throws PropertyException {
if (! lengthMaximum.canEvalLength()) {
- throw new PropertyException("Invalid length for maximum in "
- + this.getClass().getName());
+ throw new PropertyException("Invalid length for maximum in " + this.getClass().getName());
}
this.lengthMaximum = lengthMaximum;
}
@@ -323,16 +317,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -343,11 +327,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -55,16 +55,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -75,11 +65,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -129,16 +129,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -149,11 +139,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -116,16 +116,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -136,11 +126,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -111,16 +111,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -131,11 +121,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -557,16 +557,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -577,11 +567,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -77,15 +77,15 @@
+ "Color.");
}
- /**
- * Standard exception when trying to evaluate to a Length for a value that
- * cannot do so.
- * @return An appropriate Exception.
- */
- public IllegalStateException evalLengthException() {
- return new IllegalStateException("Property cannot evaluate to a "
- + "Length.");
- }
+// /**
+// * Standard exception when trying to evaluate to a Length for a value that
+// * cannot do so.
+// * @return An appropriate Exception.
+// */
+// public IllegalStateException evalLengthException() {
+// return new IllegalStateException("Property cannot evaluate to a "
+// + "Length.");
+// }
/**
* Standard exception when trying to evaluate to a Keyword for a value that
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -91,9 +91,6 @@
@Override
public int evalLength(final int pointSize) {
- if (! canEvalLength()) {
- throw evalLengthException();
- }
switch (this.operation) {
case Expr.OPERATION_ADD: {
return getOperand1Length(pointSize)
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -97,10 +97,6 @@
@Override
public int evalLength(final int pointSize) {
- if (! canEvalLength()) {
- throw evalLengthException();
- }
-
// Compute raw value for operand1
Number rawOperand1 = 0;
if (getOperand1UnitPower() == 1) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -71,9 +71,6 @@
@Override
public int evalLength(final int pointSize) {
- if (! canEvalLength()) {
- throw evalLengthException();
- }
switch (this.operation) {
case Expr.OPERATION_NEGATION: {
return this.operand1.evalLength(pointSize) * -1;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -40,21 +40,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -57,22 +57,30 @@
}
@Override
- public boolean canEvalLength() {
- return false;
+ public byte getUnitPower() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.getUnitPower();
}
@Override
- public byte getUnitPower() {
+ public boolean canEvalLength() {
/* TODO: Fix this. It needs to pass-thru the contained type. */
- return super.getUnitPower();
+ return super.canEvalLength();
}
@Override
public int evalLength(final int pointSize) {
- throw this.evalLengthException();
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.evalLength(pointSize);
}
@Override
+ public boolean lengthRequiresFontSize() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.lengthRequiresFontSize();
+ }
+
+ @Override
public boolean canEvalColor() {
return false;
}
@@ -83,11 +91,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalInteger() {
/* TODO: Fix this. It needs to pass-thru the contained type. */
return super.canEvalInteger();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -86,16 +86,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -106,11 +96,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -78,25 +78,6 @@
}
@Override
- public boolean canEvalLength() {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return Integer.MIN_VALUE;
- }
-
- @Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalInteger() {
return this.operand1.canEvalInteger();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -78,25 +78,6 @@
}
@Override
- public boolean canEvalLength() {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return Integer.MIN_VALUE;
- }
-
- @Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalInteger() {
return this.operand1.canEvalInteger();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -90,16 +90,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -110,11 +100,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -94,8 +94,7 @@
@Override
public int evalLength(final int pointSize) {
- return Math.max(this.operand1.evalLength(pointSize),
- this.operand2.evalLength(pointSize));
+ return Math.max(this.operand1.evalLength(pointSize), this.operand2.evalLength(pointSize));
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -95,8 +95,7 @@
@Override
public int evalLength(final int pointSize) {
- return Math.min(this.operand1.evalLength(pointSize),
- this.operand1.evalLength(pointSize));
+ return Math.min(this.operand1.evalLength(pointSize), this.operand1.evalLength(pointSize));
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -78,25 +78,6 @@
}
@Override
- public boolean canEvalLength() {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return Integer.MIN_VALUE;
- }
-
- @Override
- public boolean lengthRequiresFontSize() {
- return this.operand1.lengthRequiresFontSize();
- }
-
- @Override
public boolean canEvalInteger() {
return true;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -128,16 +128,6 @@
}
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -148,11 +138,6 @@
}
@Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -89,34 +89,46 @@
}
/**
- * Indicates whether this expression can be evaluated to a unit power = 1
- * (length) or not.
- * @return True if the expression can be evaluated to a unit power of 1
- * (length).
+ * Indicates whether this expression can be evaluated to a unit power = 1 (length) or not.
+ * @return True if the expression can be evaluated to a unit power of 1 (length).
*/
- boolean canEvalLength();
+ default boolean canEvalLength() {
+ return false;
+ }
/**
* Evaluates the expression to a unit power of 1 (length).
* @param fontSize The point size, in millipoints, of the font.
* This is used in calculations that are relative to the point size.
- * In cases where the computation of the font-size is expensive, check
- * {@link #lengthRequiresFontSize} first.
- * If that method returns false, zero or some other constant can safely
- * be passed, as it will be ignored anyway.
- * @return The unit power 1 value (length) of this expression if the
- * expression can be so evaluated, or {@link Integer#MIN_VALUE} otherwise.
+ * In cases where the computation of the font-size is expensive, check {@link #lengthRequiresFontSize} first.
+ * If that method returns false, zero or some other constant can safely be passed, as it will be ignored anyway.
+ * @return The unit power 1 value (length) of this expression if the expression can be so evaluated, or
+ * {@link Integer#MIN_VALUE} otherwise.
* The value is expressed in millipoints.
+ * @throws IllegalStateException If this value cannot be expressed as an XSL-FO "length".
+ * Test with {@link #canEvalLength()} to avoid this exception.
*/
- int evalLength(int fontSize);
+ default int evalLength(int fontSize) {
+ throw new IllegalStateException("Property cannot evaluate to an XSL-FO <length>.");
+ }
/**
- * Indicates whether the computation of the length will require an
- * accurate font-size parameter.
- * @return True if and only if the computation of the length will require an accurate
- * font-size parameter.
+ * Indicates whether the computation of the length will require an accurate font-size parameter.
+ * @return True if and only if the computation of the length will require an accurate font-size parameter.
+ * @throws IllegalStateException If this value cannot be expressed as an XSL-FO "length".
+ * Test with {@link #canEvalLength()} to avoid this exception.
*/
- boolean lengthRequiresFontSize();
+ default boolean lengthRequiresFontSize() {
+ /* It is tempting here to throw an exception when hitting this method from a property value that does not
+ * evaluate to a length.
+ * However, <length> items can be a part of an expression that includes a <number>.
+ * For example, consider the expression "10pt * 1.15".
+ * When that expression is evaluated for lengthRequiresFontSize(), both operands need to be considered, so
+ * throwing an exception on the "1.15" operand is a bad idea.
+ * It is sufficient here to simply return "false" in that case. */
+// throw new IllegalStateException("Property cannot evaluate to an XSL-FO <length>.");
+ return false;
+ }
/**
* Indicates whether this property value can evaluate to a percentage.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-30 23:04:26 UTC (rev 12982)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-31 00:38:49 UTC (rev 12983)
@@ -37,11 +37,6 @@
public abstract class PropertyValueStatic implements PropertyValue {
@Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
public boolean canEvalColor() {
return false;
}
@@ -97,16 +92,6 @@
}
@Override
- public int evalLength(final int pointSize) {
- throw evalLengthException();
- }
-
- @Override
- public boolean lengthRequiresFontSize() {
- throw evalLengthException();
- }
-
- @Override
public boolean canEvalPercentage() {
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-30 23:04:32
|
Revision: 12982
http://sourceforge.net/p/foray/code/12982
Author: victormote
Date: 2022-12-30 23:04:26 +0000 (Fri, 30 Dec 2022)
Log Message:
-----------
Move common code related to canEvalInteger and evalInteger to default implementation in the interface.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -178,11 +178,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -203,16 +198,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -161,7 +161,7 @@
@Override
public byte getUnitPower() {
- return 1;
+ return Expr.UNIT_POWER_LENGTH;
}
@Override
@@ -194,16 +194,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -60,11 +60,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -85,16 +80,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -778,11 +778,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -793,16 +788,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -103,11 +103,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -128,16 +123,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -129,11 +129,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -154,16 +149,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -68,7 +68,7 @@
@Override
public byte getUnitPower() {
- return 0;
+ return Expr.UNIT_POWER_NUMERIC;
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -167,11 +167,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -192,16 +187,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -79,11 +79,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -104,16 +99,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -172,7 +172,7 @@
@Override
public byte getUnitPower() {
- return 1;
+ return Expr.UNIT_POWER_LENGTH;
}
/**
@@ -243,16 +243,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -112,11 +112,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -137,16 +132,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -77,11 +77,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -102,16 +97,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -179,11 +179,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -204,16 +199,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -76,11 +76,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -106,16 +101,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -68,7 +68,7 @@
@Override
public byte getUnitPower() {
- return 0;
+ return Expr.UNIT_POWER_NUMERIC;
}
/**
@@ -112,16 +112,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -69,7 +69,7 @@
@Override
public byte getUnitPower() {
- return 0;
+ return Expr.UNIT_POWER_NUMERIC;
}
/**
@@ -122,16 +122,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -223,11 +223,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -248,16 +243,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -189,11 +189,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -214,16 +209,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -192,11 +192,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -212,16 +207,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -328,11 +328,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -353,16 +348,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -60,11 +60,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -85,16 +80,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -134,11 +134,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -159,16 +154,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -121,11 +121,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -146,16 +141,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -116,11 +116,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -141,16 +136,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -562,11 +562,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -587,16 +582,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -68,16 +68,6 @@
public static final byte OPERATION_NEGATION = '-';
/**
- * Standard exception when trying to evaluate to a Numeric for a value that
- * cannot do so.
- * @return An appropriate Exception.
- */
- public IllegalStateException evalNumericException() {
- return new IllegalStateException("Property cannot evaluate to a "
- + "Numeric.");
- }
-
- /**
* Standard exception when trying to evaluate to a Color for a value that
* cannot do so.
* @return An appropriate Exception.
@@ -98,16 +88,6 @@
}
/**
- * Standard exception when trying to evaluate to an Integer for a value that
- * cannot do so.
- * @return An appropriate Exception.
- */
- public IllegalStateException evalIntegerException() {
- return new IllegalStateException("Property cannot evaluate to an "
- + "Integer.");
- }
-
- /**
* Standard exception when trying to evaluate to a Keyword for a value that
* cannot do so.
* @return An appropriate Exception.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -70,8 +70,7 @@
* For Additive Expressions, the unitPower of the two operands must
* be equal. See XSL-FO Specification 1.0, Section 5.9.6.
*/
- if (operand1.getUnitPower()
- != operand2.getUnitPower()) {
+ if (operand1.getUnitPower() != operand2.getUnitPower()) {
throw new PropertyException("AdditiveExpr: Unit powers differ: "
+ operand1.toString() + ", " + operand2.toString());
}
@@ -186,16 +185,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -203,8 +203,7 @@
* of 0.
* 1 + 0 = 1, which is intuitively correct, because our product is in
* meters, which has a unit power of 1.*/
- return (byte) (this.operand1.getUnitPower()
- + this.operand2.getUnitPower());
+ return (byte) (this.operand1.getUnitPower() + this.operand2.getUnitPower());
}
@Override
@@ -239,16 +238,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -116,16 +116,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -45,11 +45,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -60,16 +55,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -47,13 +47,13 @@
@Override
public boolean canEvalNumber() {
/* TODO: Fix this. It needs to pass-thru the contained type. */
- return false;
+ return super.canEvalNumber();
}
@Override
public Number evalNumber() {
/* TODO: Fix this. It needs to pass-thru the contained type. */
- throw this.evalNumericException();
+ return super.evalNumber();
}
@Override
@@ -63,7 +63,8 @@
@Override
public byte getUnitPower() {
- throw this.evalNumericException();
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.getUnitPower();
}
@Override
@@ -88,12 +89,14 @@
@Override
public boolean canEvalInteger() {
- return false;
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.canEvalInteger();
}
@Override
public int evalInteger() {
- throw evalIntegerException();
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.evalInteger();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -91,11 +91,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -116,16 +111,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -56,7 +56,7 @@
}
this.operand1 = arguments[0];
/* The numeric must have a unit power of zero. */
- if (this.operand1.getUnitPower() != 0) {
+ if (this.operand1.getUnitPower() != Expr.UNIT_POWER_NUMERIC) {
this.invalidParameters();
}
}
@@ -73,9 +73,8 @@
@Override
public byte getUnitPower() {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return 0;
+ /* Unit power of zero is a requirement, and is tested in the argument validation. */
+ return Expr.UNIT_POWER_NUMERIC;
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -56,7 +56,7 @@
}
this.operand1 = arguments[0];
/* The numeric must have a unit power of zero. */
- if (this.operand1.getUnitPower() != 0) {
+ if (this.operand1.getUnitPower() != Expr.UNIT_POWER_NUMERIC) {
this.invalidParameters();
}
}
@@ -73,9 +73,8 @@
@Override
public byte getUnitPower() {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return 0;
+ /* Unit power of zero is a requirement, and is tested in the argument validation. */
+ return Expr.UNIT_POWER_NUMERIC;
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -95,11 +95,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -120,16 +115,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -111,16 +111,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -73,9 +73,8 @@
@Override
public byte getUnitPower() {
- /* Unit power of zero is a requirement, and is tested in the argument
- * validation. */
- return 0;
+ /* Unit power of zero is a requirement, and is tested in the argument validation. */
+ return Expr.UNIT_POWER_NUMERIC;
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -133,11 +133,6 @@
}
@Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
public int evalLength(final int pointSize) {
throw this.evalLengthException();
}
@@ -158,16 +153,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalKeyword() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -49,6 +49,7 @@
* Return the XSL-FO number value of "this", without regard to unit power.
* @return This value, as an XSL-FO "number".
* @throws IllegalStateException If this value cannot be expressed as an XSL-FO "number".
+ * Test with {@link #canEvalNumber()} to avoid this exception.
*/
default Number evalNumber() {
throw new IllegalStateException("Property cannot evaluate to an XSL-FO <number>.");
@@ -55,38 +56,37 @@
}
/**
- * Indicates whether this property value has the ability to express itself
- * as an integer Numeric item.
- * @return True if and only if this property value is an integer.
+ * Indicates whether this property value can be expressed as an XSL-FO "integer".
+ * @return True if and only if this property value can be expressed as an XSL-FO "integer".
*/
- boolean canEvalInteger();
+ default boolean canEvalInteger() {
+ return false;
+ }
/**
- * Return this value as an int.
- * This method should only be executed on instances where
- * {@link #canEvalInteger()} returns true.
- * Doing so on other instances may result in an
- * {@link IllegalStateException}.
- * @return This value as an int.
+ * Return the XSL-FO "integer" value of "this", without regard to unit power.
+ * @return This value, as an XSL-FO "integer".
+ * @throws IllegalStateException If this value cannot be expressed as an XSL-FO "integer".
+ * Test with {@link #canEvalInteger()} to avoid this exception.
*/
- int evalInteger();
+ default int evalInteger() {
+ throw new IllegalStateException("Property cannot evaluate to an XSL-FO <integer>.");
+ }
/**
- * Each numeric has a "unit power".
- * This number refers to the number of spatial dimensions in which the
- * number operates.
- * So, a number that has no relationship to space or refers to a point, has
- * a length power of 0.
+ * Each numeric has a "unit power," whic refers to the number of spatial dimensions in which the number operates.
+ * A number that has no relationship to space or refers to a point, has a length power of 0.
* A number that refers to length has a length power of 1 (1 dimension).
- * Although there are none yet in XSL-FO, a number that referred to area
- * (e.g. square inches) would, we suppose, have a length power of 2, and one
- * referring to volume (e.g. cubic feet) would, we suppose have a length
- * power of 3.
- * @return The number of spatial dimensions in which this numeric item
- * operates. For XSL-FO items, this should be either
- * {@link Expr#UNIT_POWER_NUMERIC} or {@link Expr#UNIT_POWER_LENGTH}.
+ * Although there are none yet in XSL-FO, a number that referred to area (e.g. square inches) would, we suppose,
+ * have a length power of 2, and one referring to volume (e.g. cubic feet) would, we suppose, have a length power of
+ * 3.
+ * @return The number of spatial dimensions in which this numeric item operates.
+ * For XSL-FO items, this should be either {@link Expr#UNIT_POWER_NUMERIC} or {@link Expr#UNIT_POWER_LENGTH}.
*/
- byte getUnitPower();
+ default byte getUnitPower() {
+ throw new IllegalStateException("Property cannot evaluate to an XSL-FO <integer>, <number>, <length>, or other "
+ + "numeric value.");
+ }
/**
* Indicates whether this expression can be evaluated to a unit power = 1
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-30 22:00:47 UTC (rev 12981)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-30 23:04:26 UTC (rev 12982)
@@ -107,16 +107,6 @@
}
@Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
public boolean canEvalPercentage() {
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-30 22:00:50
|
Revision: 12981
http://sourceforge.net/p/foray/code/12981
Author: victormote
Date: 2022-12-30 22:00:47 +0000 (Fri, 30 Dec 2022)
Log Message:
-----------
Rename methods to more closely match the XSL-FO Recommendation.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnCount.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdGroupingSize.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationPushCharacterCount.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationRemainCharacterCount.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMaximumRepeats.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsRepeated.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsSpanned.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberRowsSpanned.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -243,7 +243,7 @@
if (value.canEvalInteger()) {
return value.evalInteger();
}
- return value.evalNumeric().intValue();
+ return value.evalNumber().intValue();
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -79,8 +79,8 @@
if (pv.canEvalKeyword()) {
return pv;
}
- if (pv.canEvalNumeric()) {
- final Number number = pv.evalNumeric();
+ if (pv.canEvalNumber()) {
+ final Number number = pv.evalNumber();
if (number.doubleValue() >= 0
&& number.doubleValue() <= NumericConstants.PERCENT_CONVERSION) {
return pv;
@@ -96,8 +96,8 @@
* @return The value of this property.
*/
public Number getValue(final FoContext context, final FoObj fobj) {
- if (value().canEvalNumeric()) {
- return value().evalNumeric();
+ if (value().canEvalNumber()) {
+ return value().evalNumber();
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnCount.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnCount.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnCount.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -71,7 +71,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
@@ -94,7 +94,7 @@
}
return getValueNoInstance();
}
- if (value().canEvalNumeric()) {
+ if (value().canEvalNumber()) {
final int integerValue = this.convertNumericToInteger(value());
return Math.max(1, integerValue);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnNumber.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -65,7 +65,7 @@
*/
private PropertyValue createPropertyValue(final String value) throws PropertyException {
final PropertyValue pv = standardParse(value);
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
@@ -87,7 +87,7 @@
* @return The value of this property.
*/
public int getValue() {
- if (this.value().canEvalNumeric()) {
+ if (this.value().canEvalNumber()) {
final int integerValue = this.convertNumericToInteger(value());
return Math.max(1, integerValue);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -108,7 +108,7 @@
if (value() instanceof FnProportionalColumnWidth) {
final FnProportionalColumnWidth function =
(FnProportionalColumnWidth) value();
- return function.evalNumeric();
+ return function.evalNumber();
}
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSize.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -199,7 +199,7 @@
return Math.round(percentage * getBaseFontSize(context,
fobj) / NumericConstants.PERCENT_CONVERSION);
}
- if (value().canEvalNumeric()) {
+ if (value().canEvalNumber()) {
return value().evalLength(getBaseFontSize(context, fobj));
}
throw this.unexpectedRetrieval();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -72,7 +72,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
@@ -85,8 +85,8 @@
* @return The value of this property.
*/
public Number getValue(final FoContext context, final FoObj fobj) {
- if (value().canEvalNumeric()) {
- return value().evalNumeric();
+ if (value().canEvalNumber()) {
+ return value().evalNumber();
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdGroupingSize.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdGroupingSize.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdGroupingSize.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -62,7 +62,7 @@
*/
private PropertyValue createPropertyValue(final String value) throws PropertyException {
final PropertyValue pv = standardParse(value);
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationPushCharacterCount.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationPushCharacterCount.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationPushCharacterCount.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -71,7 +71,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
@@ -96,7 +96,7 @@
}
}
}
- if (value().canEvalNumeric()) {
+ if (value().canEvalNumber()) {
final int integerValue = this.convertNumericToInteger(value());
return Math.max(1, integerValue);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationRemainCharacterCount.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationRemainCharacterCount.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationRemainCharacterCount.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -71,7 +71,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
@@ -96,7 +96,7 @@
}
}
}
- if (value().canEvalNumeric()) {
+ if (value().canEvalNumber()) {
final int integerValue = this.convertNumericToInteger(value());
return Math.max(1, integerValue);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -104,10 +104,10 @@
}
return pv;
}
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
/* This test includes both expressions that can and cannot evaluate
* to a length, because <number> is one of the input values. */
- if (pv.evalNumeric().doubleValue() >= 0) {
+ if (pv.evalNumber().doubleValue() >= 0) {
return pv;
}
}
@@ -168,12 +168,12 @@
return Math.round(percentage * base /
NumericConstants.PERCENT_CONVERSION);
}
- if (value().canEvalNumeric()) {
+ if (value().canEvalNumber()) {
final int fontSize = fobj.traitFontSize(context);
if (value().canEvalLength()) {
return value().evalLength(fontSize);
} else {
- return (int) Math.round(value().evalNumeric().doubleValue() * fontSize);
+ return (int) Math.round(value().evalNumber().doubleValue() * fontSize);
}
}
if (value() instanceof DtSpace) {
@@ -221,13 +221,13 @@
* not. It is possible we should return a value of 1.0F here. */
return value().evalPercentage() / NumericConstants.PERCENT_CONVERSION;
}
- if (value().canEvalNumeric()) {
+ if (value().canEvalNumber()) {
if (value().canEvalLength()) {
/* It is possible that this value should be inferred as the
* Length value divided by font-size. */
return 1.0f;
} else {
- return (float) value().evalNumeric();
+ return (float) value().evalNumber();
}
}
throw this.unexpectedRetrieval();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMaximumRepeats.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMaximumRepeats.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdMaximumRepeats.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -74,7 +74,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
@@ -104,7 +104,7 @@
}
}
}
- if (value().canEvalNumeric()) {
+ if (value().canEvalNumber()) {
final int integerValue = this.convertNumericToInteger(value());
return Math.max(0, integerValue);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsRepeated.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsRepeated.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsRepeated.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -60,7 +60,7 @@
*/
private PropertyValue createPropertyValue(final String value) throws PropertyException {
final PropertyValue pv = standardParse(value);
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsSpanned.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsSpanned.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberColumnsSpanned.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -60,7 +60,7 @@
*/
private PropertyValue createPropertyValue(final String value) throws PropertyException {
final PropertyValue pv = standardParse(value);
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberRowsSpanned.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberRowsSpanned.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdNumberRowsSpanned.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -60,7 +60,7 @@
*/
private PropertyValue createPropertyValue(final String value) throws PropertyException {
final PropertyValue pv = standardParse(value);
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
return pv;
}
throw unexpectedValue(value);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -103,7 +103,7 @@
if (pv.canEvalKeyword()) {
return pv;
}
- if (pv.canEvalNumeric()) {
+ if (pv.canEvalNumber()) {
if (pv.getUnitPower() == Expr.UNIT_POWER_NUMERIC) {
return pv;
}
@@ -118,8 +118,8 @@
* @return The value of this property.
*/
public Number getValue(final FoContext context, final FoObj fobj) {
- if (value().canEvalNumeric()) {
- return value().evalNumeric();
+ if (value().canEvalNumber()) {
+ return value().evalNumber();
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -103,8 +103,8 @@
if (pv.canEvalPercentage()) {
return pv;
}
- if (pv.canEvalNumeric()) {
- final Number number = pv.evalNumeric();
+ if (pv.canEvalNumber()) {
+ final Number number = pv.evalNumber();
if (pv.getUnitPower() == Expr.UNIT_POWER_NUMERIC
&& number.doubleValue() >= 0
&& number.doubleValue() <= NumericConstants.PERCENT_CONVERSION) {
@@ -134,8 +134,8 @@
product = Math.min(product, NumericConstants.PERCENT_CONVERSION);
return product;
}
- if (value().canEvalNumeric()) {
- return value().evalNumeric();
+ if (value().canEvalNumber()) {
+ return value().evalNumber();
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -118,7 +118,7 @@
/* If what is parsed so far is not numeric, it cannot be a part of
* an additive expression. Therefore, as far as this parser is
* concerned, the expression is an error. */
- if (! prop.canEvalNumeric()) {
+ if (! prop.canEvalNumber()) {
return null;
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -147,14 +147,14 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
- if (this.value.canEvalNumeric()) {
- return this.value.evalNumeric();
+ public Number evalNumber() {
+ if (this.value.canEvalNumber()) {
+ return this.value.evalNumber();
}
return this.getKeywordValue();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -57,12 +57,12 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
+ public Number evalNumber() {
return this.value;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -161,12 +161,12 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
+ public Number evalNumber() {
return this.value;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -48,12 +48,12 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
+ public Number evalNumber() {
return this.value;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -58,12 +58,12 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
+ public Number evalNumber() {
return this.value;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -171,7 +171,7 @@
*/
public void setPrecedence(final PropertyValue precedence)
throws PropertyException {
- if (! precedence.canEvalNumeric()) {
+ if (! precedence.canEvalNumber()) {
throw new PropertyException("Invalid Numeric for precedence in "
+ this.getClass().getName());
}
@@ -219,7 +219,7 @@
*/
public int getPrecedence() {
/* TODO: This needs some work. */
- return (int) Math.round(this.precedence.evalNumeric().doubleValue());
+ return (int) Math.round(this.precedence.evalNumber().doubleValue());
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -56,12 +56,12 @@
public ExprAdditiveOper(final ExprAdditive operand1,
final ExprMultiplicative operand2,
final byte operation) throws PropertyException {
- if (! (operand1.canEvalNumeric())) {
+ if (! (operand1.canEvalNumber())) {
throw new PropertyException("AdditiveExpr: Non-numeric operand: "
+ operand1.toString());
}
this.operand1 = operand1;
- if (! (operand2.canEvalNumeric())) {
+ if (! (operand2.canEvalNumber())) {
throw new PropertyException("AdditiveExpr: Non-numeric operand: "
+ operand2.toString());
}
@@ -126,7 +126,7 @@
* @return The numeric value of the first operand.
*/
private Number getOperand1Value() {
- return this.operand1.evalNumeric();
+ return this.operand1.evalNumber();
}
/**
@@ -134,7 +134,7 @@
* @return The numeric value of the second operand.
*/
private Number getOperand2Value() {
- return this.operand2.evalNumeric();
+ return this.operand2.evalNumber();
}
/**
@@ -158,12 +158,12 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
+ public Number evalNumber() {
switch (this.operation) {
case Expr.OPERATION_ADD: {
return getOperand1Value().doubleValue() + getOperand2Value().doubleValue();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -57,13 +57,13 @@
}
@Override
- public boolean canEvalNumeric() {
- return this.getEnclosedExpression().canEvalNumeric();
+ public boolean canEvalNumber() {
+ return this.getEnclosedExpression().canEvalNumber();
}
@Override
- public Number evalNumeric() {
- return this.getEnclosedExpression().evalNumeric();
+ public Number evalNumber() {
+ return this.getEnclosedExpression().evalNumber();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -57,12 +57,12 @@
public ExprMultiplicativeOper(final ExprMultiplicative operand1,
final ExprUnary operand2, final byte operation)
throws PropertyException {
- if (! (operand1.canEvalNumeric())) {
+ if (! (operand1.canEvalNumber())) {
throw new PropertyException(this.getClass().getName()
+ ": Non-numeric operand: " + operand1.toString());
}
this.operand1 = operand1;
- if (! (operand2.canEvalNumeric())) {
+ if (! (operand2.canEvalNumber())) {
throw new PropertyException(this.getClass().getName()
+ "Non-numeric operand: " + operand2.toString());
}
@@ -107,7 +107,7 @@
rawOperand1 = getOperand1Length(pointSize);
} else {
/* Capability verified during construction. */
- rawOperand1 = this.operand1.evalNumeric();
+ rawOperand1 = this.operand1.evalNumber();
}
// Compute raw value for operand2
@@ -115,7 +115,7 @@
if (getOperand2UnitPower() == 1) {
rawOperand2 = getOperand2Length(pointSize);
} else {
- rawOperand2 = this.operand2.evalNumeric();
+ rawOperand2 = this.operand2.evalNumber();
}
Number rawValue = 0;
@@ -147,7 +147,7 @@
* @return The numeric value of the first operand.
*/
private Number getOperand1Value() {
- return this.operand1.evalNumeric();
+ return this.operand1.evalNumber();
}
/**
@@ -155,7 +155,7 @@
* @return The numeric value of the second operand.
*/
private Number getOperand2Value() {
- return this.operand2.evalNumeric();
+ return this.operand2.evalNumber();
}
/**
@@ -208,12 +208,12 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
+ public Number evalNumber() {
switch (this.operation) {
case Expr.OPERATION_MULTIPLY: {
return getOperand1Value().doubleValue() * getOperand2Value().doubleValue();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -52,7 +52,7 @@
*/
public ExprUnaryOper(final ExprUnary operand1, final byte operation)
throws PropertyException {
- if (! (operand1.canEvalNumeric())) {
+ if (! (operand1.canEvalNumber())) {
throw new PropertyException("UnaryExpr: Non-numeric operand: "
+ operand1.toString());
}
@@ -93,14 +93,14 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
+ public Number evalNumber() {
if (this.operation == Expr.OPERATION_NEGATION) {
- return this.operand1.evalNumeric().doubleValue() * -1;
+ return this.operand1.evalNumber().doubleValue() * -1;
}
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -52,7 +52,7 @@
this.invalidParameters();
}
/* The argument must be numeric. */
- if (! (arguments[0].canEvalNumeric())) {
+ if (! (arguments[0].canEvalNumber())) {
this.invalidParameters();
}
this.operand1 = arguments[0];
@@ -64,8 +64,8 @@
}
@Override
- public Number evalNumeric() {
- return Math.abs(this.operand1.evalNumeric().doubleValue());
+ public Number evalNumber() {
+ return Math.abs(this.operand1.evalNumber().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -45,13 +45,13 @@
public abstract FoPropertyId getPropertyType();
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
/* TODO: Fix this. It needs to pass-thru the contained type. */
return false;
}
@Override
- public Number evalNumeric() {
+ public Number evalNumber() {
/* TODO: Fix this. It needs to pass-thru the contained type. */
throw this.evalNumericException();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -37,7 +37,7 @@
public abstract class FnAbstractNumber extends Function {
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -51,7 +51,7 @@
this.invalidParameters();
}
/* The argument must be numeric. */
- if (! (arguments[0].canEvalNumeric())) {
+ if (! (arguments[0].canEvalNumber())) {
this.invalidParameters();
}
this.operand1 = arguments[0];
@@ -67,8 +67,8 @@
}
@Override
- public Number evalNumeric() {
- return Math.ceil(this.operand1.evalNumeric().doubleValue());
+ public Number evalNumber() {
+ return Math.ceil(this.operand1.evalNumber().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -51,7 +51,7 @@
this.invalidParameters();
}
/* The argument must be numeric. */
- if (! (arguments[0].canEvalNumeric())) {
+ if (! (arguments[0].canEvalNumber())) {
this.invalidParameters();
}
this.operand1 = arguments[0];
@@ -67,8 +67,8 @@
}
@Override
- public Number evalNumeric() {
- return Math.floor(this.operand1.evalNumeric().doubleValue());
+ public Number evalNumber() {
+ return Math.floor(this.operand1.evalNumber().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -53,11 +53,11 @@
this.invalidParameters();
}
/* The arguments must be numeric. */
- if (! (arguments[0].canEvalNumeric())) {
+ if (! (arguments[0].canEvalNumber())) {
this.invalidParameters();
}
this.operand1 = arguments[0];
- if (! (arguments[1].canEvalNumeric())) {
+ if (! (arguments[1].canEvalNumber())) {
this.invalidParameters();
}
this.operand2 = arguments[1];
@@ -74,8 +74,8 @@
}
@Override
- public Number evalNumeric() {
- return Math.max(this.operand1.evalNumeric().doubleValue(), this.operand2.evalNumeric().doubleValue());
+ public Number evalNumber() {
+ return Math.max(this.operand1.evalNumber().doubleValue(), this.operand2.evalNumber().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -54,11 +54,11 @@
this.invalidParameters();
}
/* The arguments must be numeric. */
- if (! (arguments[0].canEvalNumeric())) {
+ if (! (arguments[0].canEvalNumber())) {
this.invalidParameters();
}
this.operand1 = arguments[0];
- if (! (arguments[1].canEvalNumeric())) {
+ if (! (arguments[1].canEvalNumber())) {
this.invalidParameters();
}
this.operand2 = arguments[1];
@@ -75,8 +75,8 @@
}
@Override
- public Number evalNumeric() {
- return Math.min(this.operand1.evalNumeric().doubleValue(), this.operand2.evalNumeric().doubleValue());
+ public Number evalNumber() {
+ return Math.min(this.operand1.evalNumber().doubleValue(), this.operand2.evalNumber().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -59,7 +59,7 @@
invalidParameters();
}
/* The one argument must be Numeric. */
- if (! (arguments[0].canEvalNumeric())) {
+ if (! (arguments[0].canEvalNumber())) {
invalidParameters();
}
this.operand1 = arguments[0];
@@ -71,13 +71,13 @@
}
@Override
- public boolean canEvalNumeric() {
+ public boolean canEvalNumber() {
return true;
}
@Override
- public Number evalNumeric() {
- return this.operand1.evalNumeric();
+ public Number evalNumber() {
+ return this.operand1.evalNumber();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -57,17 +57,17 @@
if (arguments.length != FnRgb.QTY_RGB_ELEMENTS) {
this.invalidParameters();
}
- if (! (arguments[0].canEvalNumeric())) {
+ if (! (arguments[0].canEvalNumber())) {
this.invalidParameters();
}
this.numerics[0] = arguments[0];
validateColor(this.numerics[0]);
- if (! (arguments[1].canEvalNumeric())) {
+ if (! (arguments[1].canEvalNumber())) {
this.invalidParameters();
}
this.numerics[1] = arguments[1];
validateColor(this.numerics[1]);
- if (! (arguments[2].canEvalNumeric())) {
+ if (! (arguments[2].canEvalNumber())) {
this.invalidParameters();
}
this.numerics[2] = arguments[2];
@@ -91,7 +91,7 @@
/* Using CSS rules, numbers are either supposed to be 0-255
* or percentage values. If percentages value, they've already
* been converted to reals. */
- final double colorVal = numeric.evalNumeric().doubleValue()
+ final double colorVal = numeric.evalNumber().doubleValue()
/ PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT;
if (colorVal < 0.0
|| colorVal > PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT) {
@@ -106,11 +106,11 @@
*/
public Color eval() {
return new Color(
- (float) this.numerics[0].evalNumeric()
+ (float) this.numerics[0].evalNumber()
/ PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT,
- (float) this.numerics[1].evalNumeric()
+ (float) this.numerics[1].evalNumber()
/ PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT,
- (float) this.numerics[2].evalNumeric()
+ (float) this.numerics[2].evalNumber()
/ PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -72,7 +72,7 @@
/* Validate and store the fallback color arguments. */
for (int i = 0; i < FnRgbIcc.QTY_RGB_ELEMENTS; i++) {
- if (! (arguments[i].canEvalNumeric())) {
+ if (! (arguments[i].canEvalNumber())) {
this.invalidParameters();
}
this.fallbackColor[i] = arguments[i];
@@ -93,7 +93,7 @@
* quantity of components? */
this.numerics = new Expr[qtyComponents];
for (int i = FnRgbIcc.QTY_RGB_ELEMENTS + 1; i < arguments.length; i++) {
- if (! (arguments[i].canEvalNumeric())) {
+ if (! (arguments[i].canEvalNumber())) {
this.invalidParameters();
}
/* TODO: We don't know how to validate this until we understand the
@@ -138,7 +138,7 @@
/* Using CSS rules, numbers are either supposed to be 0-255
* or percentage values. If percentages value, they've already
* been converted to reals. */
- final double colorVal = numeric.evalNumeric().doubleValue()
+ final double colorVal = numeric.evalNumber().doubleValue()
/ PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT;
if (colorVal < 0.0
|| colorVal > PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -51,7 +51,7 @@
invalidParameters();
}
/* The argument must be numeric. */
- if (! (arguments[0].canEvalNumeric())) {
+ if (! (arguments[0].canEvalNumber())) {
invalidParameters();
}
this.operand1 = arguments[0];
@@ -67,8 +67,8 @@
}
@Override
- public Number evalNumeric() {
- return Math.round(this.operand1.evalNumeric().doubleValue());
+ public Number evalNumber() {
+ return Math.round(this.operand1.evalNumber().doubleValue());
}
@Override
@@ -104,7 +104,7 @@
@Override
public int evalInteger() {
- return this.operand1.evalNumeric().intValue();
+ return this.operand1.evalNumber().intValue();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -38,19 +38,20 @@
public interface PropertyValue {
/**
- * Indicates whether this property value has the ability to express itself as a Numeric item.
- * @return True if and only if this property value is a numeric.
+ * Indicates whether this property value can be expressed as an XSL-FO "number".
+ * @return True if and only if this property value can be expressed as an XSL-FO "number".
*/
- default boolean canEvalNumeric() {
+ default boolean canEvalNumber() {
return false;
}
/**
- * Return the raw numeric value of "this", without regard to unit power.
- * @return A number representation of the this value.
+ * Return the XSL-FO number value of "this", without regard to unit power.
+ * @return This value, as an XSL-FO "number".
+ * @throws IllegalStateException If this value cannot be expressed as an XSL-FO "number".
*/
- default Number evalNumeric() {
- throw new IllegalStateException("Property cannot evaluate to a Numeric.");
+ default Number evalNumber() {
+ throw new IllegalStateException("Property cannot evaluate to an XSL-FO <number>.");
}
/**
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java 2022-12-30 21:35:36 UTC (rev 12980)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java 2022-12-30 22:00:47 UTC (rev 12981)
@@ -64,7 +64,7 @@
final Function fn = Function.makeFunction("abs", FnAbsTests.NUMERIC_ARRAY_1, null);
assertTrue(fn instanceof FnAbs);
final FnAbs fnAbs = (FnAbs) fn;
- assertEquals(2.3, fnAbs.evalNumeric().doubleValue(), .001);
+ assertEquals(2.3, fnAbs.evalNumber().doubleValue(), .001);
}
/**
@@ -76,7 +76,7 @@
final Function fn = Function.makeFunction("abs", FnAbsTests.NUMERIC_ARRAY_2, null);
assertTrue(fn instanceof FnAbs);
final FnAbs fnAbs = (FnAbs) fn;
- assertEquals(512.9, fnAbs.evalNumeric().doubleValue(), .001);
+ assertEquals(512.9, fnAbs.evalNumber().doubleValue(), .001);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-30 21:35:39
|
Revision: 12980
http://sourceforge.net/p/foray/code/12980
Author: victormote
Date: 2022-12-30 21:35:36 +0000 (Fri, 30 Dec 2022)
Log Message:
-----------
Move common code related to canEvalNumeric and evalNumeric to default implementation in the interface.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -243,8 +243,7 @@
if (value.canEvalInteger()) {
return value.evalInteger();
}
- final double numeric = value.evalNumeric();
- return (int) Math.round(numeric);
+ return value.evalNumeric().intValue();
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -883,7 +883,7 @@
* Returns the column-width property.
* @return The column-width property.
*/
- public double getColumnWidthTableUnits() {
+ public Number getColumnWidthTableUnits() {
final PdColumnWidth property = (PdColumnWidth) getProperty(FoPropertyId.COLUMN_WIDTH);
if (property == null) {
return PdColumnWidth.getValueNoInstance();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -80,9 +80,9 @@
return pv;
}
if (pv.canEvalNumeric()) {
- final double number = pv.evalNumeric();
- if (number >= 0
- && number <= NumericConstants.PERCENT_CONVERSION) {
+ final Number number = pv.evalNumeric();
+ if (number.doubleValue() >= 0
+ && number.doubleValue() <= NumericConstants.PERCENT_CONVERSION) {
return pv;
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColumnWidth.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -104,7 +104,7 @@
* @return The proportional width specified by this property, or 0 if no
* proportional width was specified.
*/
- public double getValueProportional() {
+ public Number getValueProportional() {
if (value() instanceof FnProportionalColumnWidth) {
final FnProportionalColumnWidth function =
(FnProportionalColumnWidth) value();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLineHeight.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -107,7 +107,7 @@
if (pv.canEvalNumeric()) {
/* This test includes both expressions that can and cannot evaluate
* to a length, because <number> is one of the input values. */
- if (pv.evalNumeric() >= 0) {
+ if (pv.evalNumeric().doubleValue() >= 0) {
return pv;
}
}
@@ -173,7 +173,7 @@
if (value().canEvalLength()) {
return value().evalLength(fontSize);
} else {
- return (int) Math.round(value().evalNumeric() * fontSize);
+ return (int) Math.round(value().evalNumeric().doubleValue() * fontSize);
}
}
if (value() instanceof DtSpace) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -104,10 +104,10 @@
return pv;
}
if (pv.canEvalNumeric()) {
- final double number = pv.evalNumeric();
+ final Number number = pv.evalNumeric();
if (pv.getUnitPower() == Expr.UNIT_POWER_NUMERIC
- && number >= 0
- && number <= NumericConstants.PERCENT_CONVERSION) {
+ && number.doubleValue() >= 0
+ && number.doubleValue() <= NumericConstants.PERCENT_CONVERSION) {
return pv;
}
throw unexpectedValue(value);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -173,16 +173,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -152,7 +152,7 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
if (this.value.canEvalNumeric()) {
return this.value.evalNumeric();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -55,16 +55,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -773,16 +773,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCountry.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -98,16 +98,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtFrequency.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -124,16 +124,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -62,7 +62,7 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
return this.value;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -162,16 +162,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLanguage.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -74,16 +74,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -166,7 +166,7 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
return this.value;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthBpIpDirection.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -107,16 +107,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthConditional.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -72,16 +72,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLengthRange.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -174,16 +174,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtName.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -71,16 +71,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -53,7 +53,7 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
return this.value;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -63,7 +63,7 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
return this.value;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtRectangle.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -218,16 +218,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtScript.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -184,16 +184,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShadowEffect.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -187,16 +187,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -219,7 +219,7 @@
*/
public int getPrecedence() {
/* TODO: This needs some work. */
- return (int) Math.round(this.precedence.evalNumeric());
+ return (int) Math.round(this.precedence.evalNumeric().doubleValue());
}
/**
@@ -323,16 +323,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtString.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -55,16 +55,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTextDeco.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -129,16 +129,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -116,16 +116,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtUri.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -111,16 +111,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -557,16 +557,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -125,7 +125,7 @@
* Returns the numeric value of the first operand.
* @return The numeric value of the first operand.
*/
- private double getOperand1Value() {
+ private Number getOperand1Value() {
return this.operand1.evalNumeric();
}
@@ -133,7 +133,7 @@
* Returns the numeric value of the second operand.
* @return The numeric value of the second operand.
*/
- private double getOperand2Value() {
+ private Number getOperand2Value() {
return this.operand2.evalNumeric();
}
@@ -163,13 +163,13 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
switch (this.operation) {
case Expr.OPERATION_ADD: {
- return getOperand1Value() + getOperand2Value();
+ return getOperand1Value().doubleValue() + getOperand2Value().doubleValue();
}
case Expr.OPERATION_SUBTRACT: {
- return getOperand1Value() - getOperand2Value();
+ return getOperand1Value().doubleValue() - getOperand2Value().doubleValue();
}
}
return 0;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -62,7 +62,7 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
return this.getEnclosedExpression().evalNumeric();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -102,7 +102,7 @@
}
// Compute raw value for operand1
- double rawOperand1 = 0;
+ Number rawOperand1 = 0;
if (getOperand1UnitPower() == 1) {
rawOperand1 = getOperand1Length(pointSize);
} else {
@@ -111,7 +111,7 @@
}
// Compute raw value for operand2
- double rawOperand2 = 0;
+ Number rawOperand2 = 0;
if (getOperand2UnitPower() == 1) {
rawOperand2 = getOperand2Length(pointSize);
} else {
@@ -118,22 +118,22 @@
rawOperand2 = this.operand2.evalNumeric();
}
- double rawValue = 0;
+ Number rawValue = 0;
switch (this.operation) {
case (byte) '*': {
- rawValue = rawOperand1 * rawOperand2;
+ rawValue = rawOperand1.doubleValue() * rawOperand2.doubleValue();
break;
}
case (byte) '/': {
- rawValue = rawOperand1 / rawOperand2;
+ rawValue = rawOperand1.doubleValue() / rawOperand2.doubleValue();
break;
}
case (byte) '%': {
- rawValue = rawOperand1 % rawOperand2;
+ rawValue = rawOperand1.doubleValue() % rawOperand2.doubleValue();
break;
}
}
- return (int) Math.round(rawValue);
+ return (int) Math.round(rawValue.doubleValue());
}
@Override
@@ -146,7 +146,7 @@
* Returns the numeric value of the first operand.
* @return The numeric value of the first operand.
*/
- private double getOperand1Value() {
+ private Number getOperand1Value() {
return this.operand1.evalNumeric();
}
@@ -154,7 +154,7 @@
* Returns the numeric value of the second operand.
* @return The numeric value of the second operand.
*/
- private double getOperand2Value() {
+ private Number getOperand2Value() {
return this.operand2.evalNumeric();
}
@@ -213,16 +213,16 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
switch (this.operation) {
case Expr.OPERATION_MULTIPLY: {
- return getOperand1Value() * getOperand2Value();
+ return getOperand1Value().doubleValue() * getOperand2Value().doubleValue();
}
case Expr.OPERATION_DIVIDE: {
- return getOperand1Value() / getOperand2Value();
+ return getOperand1Value().doubleValue() / getOperand2Value().doubleValue();
}
case Expr.OPERATION_MOD: {
- return getOperand1Value() % getOperand2Value();
+ return getOperand1Value().doubleValue() % getOperand2Value().doubleValue();
}
}
return 0;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -98,9 +98,9 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
if (this.operation == Expr.OPERATION_NEGATION) {
- return this.operand1.evalNumeric() * -1;
+ return this.operand1.evalNumeric().doubleValue() * -1;
}
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -64,8 +64,8 @@
}
@Override
- public double evalNumeric() {
- return Math.abs(this.operand1.evalNumeric());
+ public Number evalNumeric() {
+ return Math.abs(this.operand1.evalNumeric().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -40,16 +40,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -46,11 +46,13 @@
@Override
public boolean canEvalNumeric() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
return false;
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
throw this.evalNumericException();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -86,16 +86,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -67,8 +67,8 @@
}
@Override
- public double evalNumeric() {
- return Math.ceil(this.operand1.evalNumeric());
+ public Number evalNumeric() {
+ return Math.ceil(this.operand1.evalNumeric().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -67,8 +67,8 @@
}
@Override
- public double evalNumeric() {
- return Math.floor(this.operand1.evalNumeric());
+ public Number evalNumeric() {
+ return Math.floor(this.operand1.evalNumeric().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -90,16 +90,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -74,9 +74,8 @@
}
@Override
- public double evalNumeric() {
- return Math.max(this.operand1.evalNumeric(),
- this.operand2.evalNumeric());
+ public Number evalNumeric() {
+ return Math.max(this.operand1.evalNumeric().doubleValue(), this.operand2.evalNumeric().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMin.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -75,9 +75,8 @@
}
@Override
- public double evalNumeric() {
- return Math.min(this.operand1.evalNumeric(),
- this.operand2.evalNumeric());
+ public Number evalNumeric() {
+ return Math.min(this.operand1.evalNumeric().doubleValue(), this.operand2.evalNumeric().doubleValue());
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnProportionalColumnWidth.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -76,7 +76,7 @@
}
@Override
- public double evalNumeric() {
+ public Number evalNumeric() {
return this.operand1.evalNumeric();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgb.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -91,7 +91,7 @@
/* Using CSS rules, numbers are either supposed to be 0-255
* or percentage values. If percentages value, they've already
* been converted to reals. */
- final double colorVal = numeric.evalNumeric()
+ final double colorVal = numeric.evalNumeric().doubleValue()
/ PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT;
if (colorVal < 0.0
|| colorVal > PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRgbIcc.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -138,7 +138,7 @@
/* Using CSS rules, numbers are either supposed to be 0-255
* or percentage values. If percentages value, they've already
* been converted to reals. */
- final double colorVal = numeric.evalNumeric()
+ final double colorVal = numeric.evalNumeric().doubleValue()
/ PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT;
if (colorVal < 0.0
|| colorVal > PrimitiveConstants.MAX_8_BIT_UNSIGNED_INT) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnRound.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -67,8 +67,8 @@
}
@Override
- public double evalNumeric() {
- return Math.round(this.operand1.evalNumeric());
+ public Number evalNumeric() {
+ return Math.round(this.operand1.evalNumeric().doubleValue());
}
@Override
@@ -104,7 +104,7 @@
@Override
public int evalInteger() {
- return (int) Math.round(this.operand1.evalNumeric());
+ return this.operand1.evalNumeric().intValue();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnSystemFont.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -128,16 +128,6 @@
}
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValue.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -38,18 +38,20 @@
public interface PropertyValue {
/**
- * Indicates whether this property value has the ability to express itself
- * as a Numeric item.
+ * Indicates whether this property value has the ability to express itself as a Numeric item.
* @return True if and only if this property value is a numeric.
*/
- boolean canEvalNumeric();
+ default boolean canEvalNumeric() {
+ return false;
+ }
/**
* Return the raw numeric value of "this", without regard to unit power.
- * @return A double representation of the value of "this". Type "double" is
- * assumed to be the lowest-common-denominator of all numeric values.
+ * @return A number representation of the this value.
*/
- double evalNumeric();
+ default Number evalNumeric() {
+ throw new IllegalStateException("Property cannot evaluate to a Numeric.");
+ }
/**
* Indicates whether this property value has the ability to express itself
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/PropertyValueStatic.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -37,17 +37,6 @@
public abstract class PropertyValueStatic implements PropertyValue {
@Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw new IllegalStateException("Property cannot evaluate to a "
- + "Numeric.");
- }
-
- @Override
public boolean canEvalLength() {
return false;
}
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java 2022-12-30 20:27:05 UTC (rev 12979)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java 2022-12-30 21:35:36 UTC (rev 12980)
@@ -64,7 +64,7 @@
final Function fn = Function.makeFunction("abs", FnAbsTests.NUMERIC_ARRAY_1, null);
assertTrue(fn instanceof FnAbs);
final FnAbs fnAbs = (FnAbs) fn;
- assertEquals(2.3, fnAbs.evalNumeric(), .001);
+ assertEquals(2.3, fnAbs.evalNumeric().doubleValue(), .001);
}
/**
@@ -76,7 +76,7 @@
final Function fn = Function.makeFunction("abs", FnAbsTests.NUMERIC_ARRAY_2, null);
assertTrue(fn instanceof FnAbs);
final FnAbs fnAbs = (FnAbs) fn;
- assertEquals(512.9, fnAbs.evalNumeric(), .001);
+ assertEquals(512.9, fnAbs.evalNumeric().doubleValue(), .001);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-30 20:27:09
|
Revision: 12979
http://sourceforge.net/p/foray/code/12979
Author: victormote
Date: 2022-12-30 20:27:05 +0000 (Fri, 30 Dec 2022)
Log Message:
-----------
Conform to aXSL change: Convert remaining double return values and parameters to Number.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java 2022-12-30 19:21:17 UTC (rev 12978)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/TestFont.java 2022-12-30 20:27:05 UTC (rev 12979)
@@ -110,8 +110,8 @@
/* The nominal font-size is 10 pts. */
assertEquals(10000, nominalFontSize);
/* The font-size-adjust is .6. */
- final double fontSizeAdjust = block.traitFontSizeAdjust(null);
- assertEquals(.6, fontSizeAdjust, .001);
+ final Number fontSizeAdjust = block.traitFontSizeAdjust(null);
+ assertEquals(.6, fontSizeAdjust.doubleValue(), .001);
/* Actual font size computation, using a basis factor of 1000.
* 600 / 426 * 10000 = 14085. */
// fontSize = block.traitFontSizeActual(null, font);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-30 19:21:17 UTC (rev 12978)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-30 20:27:05 UTC (rev 12979)
@@ -2683,20 +2683,21 @@
}
@Override
- public double traitFontSizeAdjust(final FoContext context) {
+ public Number traitFontSizeAdjust(final FoContext context) {
return getPropertyList().traitFontSizeAdjust(this, context);
}
@Override
public int traitFontSizeActual(final FoContext context) {
- final double fontSizeAdjust = this.traitFontSizeAdjust(context);
+ final Number fontSizeAdjust = this.traitFontSizeAdjust(context);
final int nominalFontSize = this.traitFontSize(context);
- if (fontSizeAdjust == Double.NEGATIVE_INFINITY) {
+ if (fontSizeAdjust instanceof Double
+ && (Double) fontSizeAdjust == Double.NEGATIVE_INFINITY) {
return nominalFontSize;
}
final int xHeight = context.fontXheight(nominalFontSize);
final double fontAspectRatio = (float) xHeight / (float) nominalFontSize;
- return (int) Math.round(fontSizeAdjust / fontAspectRatio * nominalFontSize);
+ return (int) Math.round(fontSizeAdjust.doubleValue() / fontAspectRatio * nominalFontSize);
}
@Override
@@ -3658,7 +3659,7 @@
}
@Override
- public double traitIntrinsicScaleValue(final FoContext context) {
+ public Number traitIntrinsicScaleValue(final FoContext context) {
// TODO Auto-generated method stub
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-30 19:21:17 UTC (rev 12978)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-30 20:27:05 UTC (rev 12979)
@@ -4026,7 +4026,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The font-size-adjust property.
*/
- public double traitFontSizeAdjust(final FoObj fobj, final FoContext context) {
+ public Number traitFontSizeAdjust(final FoObj fobj, final FoContext context) {
final PdFontSizeAdjust property = (PdFontSizeAdjust)
getProperty(FoPropertyId.FONT_SIZE_ADJUST);
if (property != null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java 2022-12-30 19:21:17 UTC (rev 12978)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontSizeAdjust.java 2022-12-30 20:27:05 UTC (rev 12979)
@@ -84,7 +84,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public double getValue(final FoContext context, final FoObj fobj) {
+ public Number getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalNumeric()) {
return value().evalNumeric();
}
@@ -111,7 +111,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static double getValueNoInstance(final FoContext context,
+ public static Number getValueNoInstance(final FoContext context,
final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-30 19:21:20
|
Revision: 12978
http://sourceforge.net/p/foray/code/12978
Author: victormote
Date: 2022-12-30 19:21:17 +0000 (Fri, 30 Dec 2022)
Log Message:
-----------
Conform to aXSL change: Convert some double return values to Number.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableColumn4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TableRa.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -285,7 +285,7 @@
if (column == null) {
getAreaTree().logWarning("No table-column specification for column " + (i + 1) + ".");
} else {
- final double tu = column.traitColumnWidthTableUnits();
+ final double tu = column.traitColumnWidthTableUnits().doubleValue();
/* Keep track of minimum number of proportional units in any
* column which has only proportional units. */
if (tu > 0 && tu < tuMin
@@ -384,10 +384,9 @@
if (column != null) {
//Compute the width of the column
int colWidth = -1;
- if (column.traitColumnWidthTableUnits() > 0) {
+ if (column.traitColumnWidthTableUnits().doubleValue() > 0) {
//Proportional width
- colWidth = (int) (column.traitColumnWidthTableUnits()
- * dUnitLength);
+ colWidth = (int) (column.traitColumnWidthTableUnits().doubleValue() * dUnitLength);
} else {
//Fixed width
colWidth = column.traitColumnWidth(this);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -2612,12 +2612,12 @@
}
@Override
- public double traitAzimuth(final FoContext context) {
+ public Number traitAzimuth(final FoContext context) {
return getPropertyList().traitAzimuth(this, context);
}
@Override
- public double traitElevation(final FoContext context) {
+ public Number traitElevation(final FoContext context) {
return getPropertyList().traitElevation(this, context);
}
@@ -2700,7 +2700,7 @@
}
@Override
- public double traitSpeechRate(final FoContext context) {
+ public Number traitSpeechRate(final FoContext context) {
return getPropertyList().traitSpeechRate(this, context);
}
@@ -2715,7 +2715,7 @@
}
@Override
- public double traitPitch(final FoContext context) {
+ public Number traitPitch(final FoContext context) {
return getPropertyList().traitPitch(this, context);
}
@@ -2725,12 +2725,12 @@
}
@Override
- public double traitPitchRange(final FoContext context) {
+ public Number traitPitchRange(final FoContext context) {
return getPropertyList().traitPitchRange(this, context);
}
@Override
- public double traitVolume(final FoContext context) {
+ public Number traitVolume(final FoContext context) {
return getPropertyList().traitVolume(this, context);
}
@@ -2755,12 +2755,12 @@
}
@Override
- public double traitRichness(final FoContext context) {
+ public Number traitRichness(final FoContext context) {
return getPropertyList().traitRichness(this, context);
}
@Override
- public double traitStress(final FoContext context) {
+ public Number traitStress(final FoContext context) {
return getPropertyList().traitStress(this, context);
}
@@ -3640,7 +3640,7 @@
}
@Override
- public double traitColumnWidthTableUnits() {
+ public Number traitColumnWidthTableUnits() {
// TODO Auto-generated method stub
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -3811,7 +3811,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The azimuth property.
*/
- public double traitAzimuth(final FoObj fobj, final FoContext context) {
+ public Number traitAzimuth(final FoObj fobj, final FoContext context) {
final PdAzimuth property = (PdAzimuth) getProperty(FoPropertyId.AZIMUTH);
if (property != null) {
return property.getValue(context, fobj);
@@ -3825,7 +3825,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The elevation property.
*/
- public double traitElevation(final FoObj fobj, final FoContext context) {
+ public Number traitElevation(final FoObj fobj, final FoContext context) {
final PdElevation property = (PdElevation) getProperty(FoPropertyId.ELEVATION);
if (property != null) {
return property.getValue(context, fobj);
@@ -4048,7 +4048,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The speech-rate property.
*/
- public double traitSpeechRate(final FoObj fobj, final FoContext context) {
+ public Number traitSpeechRate(final FoObj fobj, final FoContext context) {
final PdSpeechRate property = (PdSpeechRate) getProperty(FoPropertyId.SPEECH_RATE);
if (property != null) {
return property.getValue(context, fobj);
@@ -4100,7 +4100,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The pitch property.
*/
- public double traitPitch(final FoObj fobj, final FoContext context) {
+ public Number traitPitch(final FoObj fobj, final FoContext context) {
final PdPitch property = (PdPitch) getProperty(FoPropertyId.PITCH);
if (property != null) {
return property.getValueAbsolute(context, fobj);
@@ -4128,7 +4128,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The pitch-range property.
*/
- public double traitPitchRange(final FoObj fobj, final FoContext context) {
+ public Number traitPitchRange(final FoObj fobj, final FoContext context) {
final AbstractAudioDial property = (AbstractAudioDial) getProperty(FoPropertyId.PITCH_RANGE);
if (property != null) {
return property.getValue(context, fobj);
@@ -4142,7 +4142,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The volume property.
*/
- public double traitVolume(final FoObj fobj, final FoContext context) {
+ public Number traitVolume(final FoObj fobj, final FoContext context) {
final PdVolume property = (PdVolume) getProperty(FoPropertyId.VOLUME);
if (property != null) {
return property.getValue(context, fobj);
@@ -4208,7 +4208,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The richness property.
*/
- public double traitRichness(final FoObj fobj, final FoContext context) {
+ public Number traitRichness(final FoObj fobj, final FoContext context) {
final AbstractAudioDial property = (AbstractAudioDial) getProperty(FoPropertyId.RICHNESS);
if (property != null) {
return property.getValue(context, fobj);
@@ -4222,7 +4222,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The stress property.
*/
- public double traitStress(final FoObj fobj, final FoContext context) {
+ public Number traitStress(final FoObj fobj, final FoContext context) {
final AbstractAudioDial property = (AbstractAudioDial) getProperty(FoPropertyId.STRESS);
if (property != null) {
return property.getValue(context, fobj);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableColumn4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableColumn4a.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/TableColumn4a.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -156,7 +156,7 @@
}
@Override
- public double traitColumnWidthTableUnits() {
+ public Number traitColumnWidthTableUnits() {
return getPropertyList().getColumnWidthTableUnits();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractAudioDial.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -95,7 +95,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public double getValue(final FoContext context, final FoObj fobj) {
+ public Number getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalNumeric()) {
return value().evalNumeric();
}
@@ -121,7 +121,7 @@
* is needed.
* @return The initial value for this property.
*/
- public static double getValueNoInstance(final FoContext context,
+ public static Number getValueNoInstance(final FoContext context,
final FoObj fobj, final FoPropertyId propertyType) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -152,7 +152,7 @@
* is computed in units of words-per-minute, so we multiply by
* 60,000 to convert from minutes to milliseconds.
*/
- final double base = 1 / fobj.traitSpeechRate(context) * 60000;
+ final double base = 1 / fobj.traitSpeechRate(context).doubleValue() * 60000;
return (int) Math.round(base * percentage);
}
if (value().canEvalKeyword()) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdAzimuth.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -189,7 +189,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public double getValue(final FoContext context, final FoObj fobj) {
+ public Number getValue(final FoContext context, final FoObj fobj) {
if (value() instanceof DtAngle) {
return ((DtAngle) value()).getValue();
}
@@ -248,12 +248,12 @@
return PdAzimuth.ANGLE_RIGHT_SIDE;
}
case LEFTWARDS: {
- return (getValueNoInstance(context, fobj)
+ return (getValueNoInstance(context, fobj).doubleValue()
- PdAzimuth.ANGLE_RELATIVE_INCREMENTOR)
% NumericConstants.DEGREES_PER_CIRCLE;
}
case RIGHTWARDS: {
- return (getValueNoInstance(context, fobj)
+ return (getValueNoInstance(context, fobj).doubleValue()
+ PdAzimuth.ANGLE_RELATIVE_INCREMENTOR)
% NumericConstants.DEGREES_PER_CIRCLE;
}
@@ -271,7 +271,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static double getValueNoInstance(final FoContext context,
+ public static Number getValueNoInstance(final FoContext context,
final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdElevation.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -107,7 +107,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public double getValue(final FoContext context, final FoObj fobj) {
+ public Number getValue(final FoContext context, final FoObj fobj) {
if (value() instanceof DtAngle) {
return ((DtAngle) value()).getValue();
}
@@ -127,12 +127,12 @@
return PdElevation.ANGLE_ABOVE;
}
case HIGHER: {
- return Math.min(getValueNoInstance(context, fobj)
+ return Math.min(getValueNoInstance(context, fobj).doubleValue()
+ PdElevation.ANGLE_RELATIVE_INCREMENT,
PdElevation.ANGLE_ABOVE);
}
case LOWER: {
- return Math.max(getValueNoInstance(context, fobj)
+ return Math.max(getValueNoInstance(context, fobj).doubleValue()
- PdElevation.ANGLE_RELATIVE_INCREMENT,
PdElevation.ANGLE_BELOW);
}
@@ -150,7 +150,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static double getValueNoInstance(final FoContext context,
+ public static Number getValueNoInstance(final FoContext context,
final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPitch.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -93,7 +93,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public double getValueAbsolute(final FoContext context, final FoObj fobj) {
+ public Number getValueAbsolute(final FoContext context, final FoObj fobj) {
if (value() instanceof DtFrequency) {
return ((DtFrequency) value()).getValue();
}
@@ -137,7 +137,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static double getValueNoInstanceAbsolute(final FoContext context, final FoObj fobj) {
+ public static Number getValueNoInstanceAbsolute(final FoContext context, final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
return parent.traitPitch(context);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -117,7 +117,7 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public double getValue(final FoContext context, final FoObj fobj) {
+ public Number getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalNumeric()) {
return value().evalNumeric();
}
@@ -143,11 +143,11 @@
return PdSpeechRate.SPEECH_RATE_X_FAST;
}
case FASTER: {
- return getValueNoInstance(context, fobj)
+ return getValueNoInstance(context, fobj).doubleValue()
+ PdSpeechRate.SPEECH_RATE_RELATIVE_INCREMENT;
}
case SLOWER: {
- return getValueNoInstance(context, fobj)
+ return getValueNoInstance(context, fobj).doubleValue()
- PdSpeechRate.SPEECH_RATE_RELATIVE_INCREMENT;
}
default: {
@@ -164,7 +164,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static double getValueNoInstance(final FoContext context,
+ public static Number getValueNoInstance(final FoContext context,
final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2022-12-30 18:45:34 UTC (rev 12977)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2022-12-30 19:21:17 UTC (rev 12978)
@@ -121,15 +121,15 @@
* @param fobj The FO for which this value is needed.
* @return The value of this property.
*/
- public double getValue(final FoContext context, final FoObj fobj) {
+ public Number getValue(final FoContext context, final FoObj fobj) {
if (value().canEvalPercentage()) {
- final double base = getInheritedValue(context, fobj);
- if (base < 0) {
+ final Number base = getInheritedValue(context, fobj);
+ if (base.doubleValue() < 0) {
// Handle the special case of "silent"
return base;
}
final float percent = value().evalPercentage();
- double product = percent * base;
+ double product = percent * base.doubleValue();
product = Math.max(product, 0);
product = Math.min(product, NumericConstants.PERCENT_CONVERSION);
return product;
@@ -175,7 +175,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- public static double getValueNoInstance(final FoContext context,
+ public static Number getValueNoInstance(final FoContext context,
final FoObj fobj) {
return getInheritedValue(context, fobj);
}
@@ -186,7 +186,7 @@
* @param fobj The FO for which this value is needed.
* @return The initial value for this property.
*/
- private static double getInheritedValue(final FoContext context,
+ private static Number getInheritedValue(final FoContext context,
final FoObj fobj) {
final FoObj parent = fobj.effectiveParent(context);
if (parent != null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-30 18:45:37
|
Revision: 12977
http://sourceforge.net/p/foray/code/12977
Author: victormote
Date: 2022-12-30 18:45:34 +0000 (Fri, 30 Dec 2022)
Log Message:
-----------
Conform to aXSL change: Change return types for <time> values from double to int.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-29 16:54:28 UTC (rev 12976)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2022-12-30 18:45:34 UTC (rev 12977)
@@ -2705,12 +2705,12 @@
}
@Override
- public double traitPauseBefore(final FoContext context) {
+ public int traitPauseBefore(final FoContext context) {
return getPropertyList().traitPauseBefore(this, context);
}
@Override
- public double traitPauseAfter(final FoContext context) {
+ public int traitPauseAfter(final FoContext context) {
return getPropertyList().traitPauseAfter(this, context);
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-29 16:54:28 UTC (rev 12976)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2022-12-30 18:45:34 UTC (rev 12977)
@@ -4062,7 +4062,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The pause-before property.
*/
- public double traitPauseBefore(final FoObj fobj, final FoContext context) {
+ public int traitPauseBefore(final FoObj fobj, final FoContext context) {
AbstractPause property = (AbstractPause) getProperty(FoPropertyId.PAUSE_BEFORE);
if (property != null) {
return property.getValue(context, fobj, FoPropertyId.PAUSE_BEFORE);
@@ -4081,7 +4081,7 @@
* @param context An object that knows how to resolve FO Tree context issues.
* @return The pause-after property.
*/
- public double traitPauseAfter(final FoObj fobj, final FoContext context) {
+ public int traitPauseAfter(final FoObj fobj, final FoContext context) {
AbstractPause property = (AbstractPause) getProperty(FoPropertyId.PAUSE_AFTER);
if (property != null) {
return property.getValue(context, fobj, FoPropertyId.PAUSE_AFTER);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-29 16:54:28 UTC (rev 12976)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractPause.java 2022-12-30 18:45:34 UTC (rev 12977)
@@ -140,8 +140,7 @@
* compound property.
* @return The value of this property.
*/
- public double getValue(final FoContext context, final FoObj fobj,
- final FoPropertyId propertyType) {
+ public int getValue(final FoContext context, final FoObj fobj, final FoPropertyId propertyType) {
if (value() instanceof DtTime) {
return ((DtTime) value()).getValue();
}
@@ -154,7 +153,7 @@
* 60,000 to convert from minutes to milliseconds.
*/
final double base = 1 / fobj.traitSpeechRate(context) * 60000;
- return base * percentage;
+ return (int) Math.round(base * percentage);
}
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
@@ -193,8 +192,7 @@
* compound property.
* @return The value of this property.
*/
- public double getShorthandValue(final FoContext context, final FoObj fobj,
- final FoPropertyId propertyType) {
+ public int getShorthandValue(final FoContext context, final FoObj fobj, final FoPropertyId propertyType) {
if (value().canEvalKeyword()) {
final FoValue keyword = this.convertValueToFoValue(value());
switch (keyword) {
@@ -252,7 +250,7 @@
* Returns the default (initial) value for this property.
* @return The initial value for this property.
*/
- public static double getValueNoInstance() {
+ public static int getValueNoInstance() {
return 0;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-29 16:54:28 UTC (rev 12976)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtTime.java 2022-12-30 18:45:34 UTC (rev 12977)
@@ -28,8 +28,6 @@
package org.foray.fotree.value;
-import org.foray.fotree.PropertyException;
-
import org.axsl.constants.MeasurementConstants;
import java.awt.Color;
@@ -39,31 +37,33 @@
*/
public class DtTime extends Datatype {
- /** Constant indicating that the unit of time stored in this instance is
- * seconds. */
- public static final byte UNITS_SECONDS = 1;
+ /**
+ * Enumeration of valid units of time.
+ */
+ public enum Units {
- /** Constant indicating that the unit of time stored in this instance is
- * milliseconds. */
- public static final byte UNITS_MILLISECONDS = 2;
+ /** The unit of time is seconds. */
+ SECONDS,
+ /** The unit of time is milliseconds. */
+ MILLISECONDS;
+
+ }
+
/** The number of seconds or milliseconds in this time. */
- private double quantity;
+ private Number quantity;
/** The units (seconds or milliseconds) stored by this time. */
- private byte units;
+ private Units units;
/**
* Constructor.
* @param quantity The number of seconds or milliseconds in this time.
- * @param units Either {@link DtTime#UNITS_SECONDS} or
- * {@link DtTime#UNITS_MILLISECONDS}.
- * @throws PropertyException For an invalid {@code units} specifier.
+ * @param units The units for this time measurement.
*/
- public DtTime(final double quantity, final byte units)
- throws PropertyException {
- if (units < 1 || units > 2) {
- throw new PropertyException("Invalid TimeDT unit ID.");
+ public DtTime(final Number quantity, final Units units) {
+ if (units == null) {
+ throw new NullPointerException("Time units cannot be null.");
}
this.quantity = quantity;
this.units = units;
@@ -73,13 +73,13 @@
* Returns the value, normalized to a unit of milliseconds.
* @return The value, normalized to a unit of milliseconds.
*/
- public double getValue() {
+ public int getValue() {
switch (this.units) {
- case DtTime.UNITS_SECONDS: {
- return this.quantity * MeasurementConstants.MILLISECONDS_PER_SECOND;
+ case SECONDS: {
+ return (int) Math.round(this.quantity.doubleValue() * MeasurementConstants.MILLISECONDS_PER_SECOND);
}
- case DtTime.UNITS_MILLISECONDS: {
- return this.quantity;
+ case MILLISECONDS: {
+ return this.quantity.intValue();
}
}
return -1;
@@ -88,27 +88,24 @@
/**
* Factory method for creating a TimeDT from a String input.
* @param input The String from which a TimeDT should be constructed.
- * @return The TimeDT instance constructed, or null if input is not
- * valid.
+ * @return The TimeDT instance constructed, or null if input is not valid.
*/
public static DtTime makeTimeDT(final String input) {
// Make a copy of input
final String useInput = new String(input);
useInput.trim();
- byte units = -1;
+ Units units = null;
int unitsLength = -1;
if (useInput.endsWith("ms")) {
- units = DtTime.UNITS_MILLISECONDS;
+ units = Units.MILLISECONDS;
unitsLength = 2;
} else if (useInput.endsWith("s")) {
- units = DtTime.UNITS_SECONDS;
+ units = Units.SECONDS;
unitsLength = 1;
- }
- if (units < 1) {
+ } else {
return null;
}
- final String quantityPart = useInput.substring(0, useInput.length()
- - unitsLength);
+ final String quantityPart = useInput.substring(0, useInput.length() - unitsLength);
final double quantity;
try {
quantity = Double.parseDouble(quantityPart);
@@ -115,15 +112,7 @@
} catch (final NumberFormatException e) {
return null;
}
- try {
- return new DtTime(quantity, units);
- } catch (final PropertyException e1) {
- /*
- * This should never happen, because we have already validated the
- * input.
- */
- return null;
- }
+ return new DtTime(quantity, units);
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2022-12-29 16:54:36
|
Revision: 12976
http://sourceforge.net/p/foray/code/12976
Author: victormote
Date: 2022-12-29 16:54:28 +0000 (Thu, 29 Dec 2022)
Log Message:
-----------
Add method returning PropertyId to each property test class.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AbsolutePositionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ActiveStateTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AlignmentAdjustTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AlignmentBaselineTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AllowedHeightScaleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AllowedWidthScaleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AutoRestoreTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AzimuthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundAttachmentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundImageTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionHorizontalTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionVerticalTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundRepeatTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BaselineShiftTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BlankOrNotBlankTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BlockProgressionDimensionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterPrecedenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforePrecedenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderCollapseTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderEndColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderEndPrecedenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderEndStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderEndWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderLeftColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderLeftStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderLeftTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderLeftWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderRightColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderRightStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderRightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderRightWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderSeparationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderSpacingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderStartColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderStartPrecedenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderStartStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderStartWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderTopColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderTopStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderTopTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderTopWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BottomTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BreakAfterTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BreakBeforeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/CaptionSideTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/CaseNameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/CaseTitleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ChangeBarClassTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ChangeBarColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ChangeBarOffsetTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ChangeBarPlacementTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ChangeBarStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ChangeBarWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/CharacterTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ClearTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ClipTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ColorProfileNameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ColumnCountTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ColumnGapTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ColumnNumberTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ColumnWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ContentHeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ContentTypeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ContentWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/CountryTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/CueAfterTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/CueBeforeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/CueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/DestinationPlacementOffsetTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/DirectionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/DisplayAlignTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/DominantBaselineTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ElevationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/EmptyCellsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/EndIndentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/EndsRowTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ExtentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ExternalDestinationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FloatTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FlowMapNameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FlowMapReferenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FlowNameReferenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FlowNameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontFamilyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontSelectionStrategyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontSizeAdjustTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontSizeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontStretchTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontVariantTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FontWeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ForcePageCountTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/FormatTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/GlyphOrientationHorizontalTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/GlyphOrientationVerticalTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/GroupingSeparatorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/GroupingSizeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/HeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/HyphenateTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/HyphenationCharacterTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/HyphenationKeepTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/HyphenationLadderCountTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/HyphenationPushCharacterCountTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/HyphenationRemainCharacterCountTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/IdTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/IndexClassTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/IndexKeyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/IndicateDestinationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/InitialPageNumberTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/InlineProgressionDimensionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/InternalDestinationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/IntrinsicScaleValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/IntrusionDisplaceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/KeepTogetherTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/KeepWithNextTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/KeepWithPreviousTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LanguageTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LastLineEndIndentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LeaderAlignmentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LeaderLengthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LeaderPatternTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LeaderPatternWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LeftTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LetterSpacingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LetterValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightShiftAdjustmentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineHeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LineStackingStrategyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/LinefeedTreatmentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MarginBottomTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MarginLeftTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MarginRightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MarginTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MarginTopTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MarkerClassNameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MasterNameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MasterReferenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MaxHeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MaxWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MaximumRepeatsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MediaUsageTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MergePagesAcrossIndexKeyReferencesTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MergeRangesAcrossIndexKeyReferencesTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MergeSequentialPageNumbersTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MinHeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/MinWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/NumberColumnsRepeatedTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/NumberColumnsSpannedTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/NumberRowsSpannedTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/OddOrEvenTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/OrphansTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/OverflowTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingAfterTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingBeforeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingBottomTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingEndTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingLeftTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingRightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingStartTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PaddingTopTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PageBreakAfterTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PageBreakBeforeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PageBreakInsideTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PageCitationStrategyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PageHeightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PageNumberTreatmentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PagePositionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PageWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PauseAfterTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PauseBeforeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PauseTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PitchRangeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PitchTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PlayDuringTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PositionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/PrecedenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ProvisionalDistanceBetweenStartsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ProvisionalLabelSeparationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RefIdTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RefIndexKeyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ReferenceOrientationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RegionNameReferenceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RegionNameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RelativeAlignTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RelativePositionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RenderingIntentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RetrieveBoundaryTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RetrieveBoundaryWithinTableTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RetrieveClassNameTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RetrievePositionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RetrievePositionWithinTableTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RichnessTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RightTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RoleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RuleStyleTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RuleThicknessTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ScaleOptionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ScalingMethodTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ScalingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ScoreSpacesTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ScriptTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ShowDestinationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SizeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SourceDocumentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpaceAfterTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpaceBeforeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpaceEndTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpaceStartTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpanTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpeakHeaderTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpeakNumeralTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpeakPunctuationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpeakTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SpeechRateTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SrcTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/StartIndentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/StartingStateTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/StartsRowTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/StressTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SuppressAtLineBreakTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/SwitchToTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TableLayoutTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TableOmitFooterAtBreakTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TableOmitHeaderAtBreakTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TargetPresentationContextTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TargetProcessingContextTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TargetStylesheetTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextAlignLastTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextAlignTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextAltitudeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextDecorationTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextDepthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextIndentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextShadowTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TextTransformTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TopTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/TreatAsWordSpaceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/UnicodeBidiTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VerticalAlignTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VisibilityTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VoiceFamilyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/VolumeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/WhiteSpaceCollapseTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/WhiteSpaceTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/WhiteSpaceTreatmentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/WidowsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/WidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/WordSpacingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/WrapOptionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/WritingModeTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ZindexTests.java
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -201,6 +201,12 @@
}
/**
+ * Returns the {@link PropertyId} of the property being tested in this class.
+ * @return The {@link PropertyId} of the property being tested in this class.
+ */
+ protected abstract PropertyId getPropertyId();
+
+ /**
* Parses an attribute value and returns the property value created.
* @param attributeValue The attribute value to be parsed.
* @return The newly-created Property.
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AbsolutePositionTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AbsolutePositionTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AbsolutePositionTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdAbsolutePosition}.
@@ -37,6 +39,11 @@
public class AbsolutePositionTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.ABSOLUTE_POSITION;
+ }
+
+ @Override
protected PdAbsolutePosition createProperty(final String attributeValue) throws PropertyException {
final PdAbsolutePosition property = new PdAbsolutePosition(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ActiveStateTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ActiveStateTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/ActiveStateTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdActiveState}.
@@ -37,6 +39,11 @@
public class ActiveStateTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.ACTIVE_STATE;
+ }
+
+ @Override
protected PdActiveState createProperty(final String attributeValue) throws PropertyException {
final PdActiveState property = new PdActiveState(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AlignmentAdjustTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AlignmentAdjustTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AlignmentAdjustTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -31,6 +31,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
@@ -41,6 +43,11 @@
public class AlignmentAdjustTests extends AbstractPropertyTests implements CmpLengthTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.ALIGNMENT_ADJUST;
+ }
+
+ @Override
protected PdAlignmentAdjust createProperty(final String attributeValue) throws PropertyException {
final PdAlignmentAdjust property = new PdAlignmentAdjust(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AlignmentBaselineTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AlignmentBaselineTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AlignmentBaselineTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdAlignmentBaseline}.
@@ -37,6 +39,11 @@
public class AlignmentBaselineTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.ALIGNMENT_BASELINE;
+ }
+
+ @Override
protected PdAlignmentBaseline createProperty(final String attributeValue) throws PropertyException {
final PdAlignmentBaseline property = new PdAlignmentBaseline(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AllowedHeightScaleTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AllowedHeightScaleTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AllowedHeightScaleTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdAllowedHeightScale}.
@@ -37,6 +39,11 @@
public class AllowedHeightScaleTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.ALLOWED_HEIGHT_SCALE;
+ }
+
+ @Override
protected PdAllowedHeightScale createProperty(final String attributeValue)
throws PropertyException {
final PdAllowedHeightScale property = new PdAllowedHeightScale(attributeValue);
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AllowedWidthScaleTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AllowedWidthScaleTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AllowedWidthScaleTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdAllowedWidthScale}.
@@ -37,6 +39,11 @@
public class AllowedWidthScaleTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.ALLOWED_WIDTH_SCALE;
+ }
+
+ @Override
protected PdAllowedWidthScale createProperty(final String attributeValue)
throws PropertyException {
final PdAllowedWidthScale property = new PdAllowedWidthScale(attributeValue);
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AutoRestoreTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AutoRestoreTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AutoRestoreTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdAutoRestore}.
@@ -37,6 +39,11 @@
public class AutoRestoreTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.AUTO_RESTORE;
+ }
+
+ @Override
protected PdAutoRestore createProperty(final String attributeValue) throws PropertyException {
final PdAutoRestore property = new PdAutoRestore(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AzimuthTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AzimuthTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/AzimuthTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdAzimuth}.
@@ -37,6 +39,11 @@
public class AzimuthTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.AZIMUTH;
+ }
+
+ @Override
protected PdAzimuth createProperty(final String attributeValue) throws PropertyException {
final PdAzimuth property = new PdAzimuth(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundAttachmentTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundAttachmentTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundAttachmentTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBackgroundAttachment}.
@@ -37,6 +39,11 @@
public class BackgroundAttachmentTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BACKGROUND_ATTACHMENT;
+ }
+
+ @Override
protected PdBackgroundAttachment createProperty(final String attributeValue) throws PropertyException {
final PdBackgroundAttachment property = new PdBackgroundAttachment(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundColorTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundColorTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundColorTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBackgroundColor}.
@@ -37,6 +39,11 @@
public class BackgroundColorTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BACKGROUND_COLOR;
+ }
+
+ @Override
protected PdBackgroundColor createProperty(final String attributeValue) throws PropertyException {
final PdBackgroundColor property = new PdBackgroundColor(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundImageTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundImageTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundImageTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBackgroundImage}.
@@ -37,6 +39,11 @@
public class BackgroundImageTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BACKGROUND_IMAGE;
+ }
+
+ @Override
protected PdBackgroundImage createProperty(final String attributeValue) throws PropertyException {
final PdBackgroundImage property = new PdBackgroundImage(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionHorizontalTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionHorizontalTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionHorizontalTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -29,6 +29,8 @@
package org.foray.fotree.fo.prop;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBackgroundPositionHorizontal}.
@@ -37,6 +39,11 @@
extends AbstractBackgroundPositionTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BACKGROUND_POSITION_HORIZONTAL;
+ }
+
+ @Override
protected PdBackgroundPositionHorizontal createProperty(final String attributeValue) throws PropertyException {
final PdBackgroundPositionHorizontal property =
new PdBackgroundPositionHorizontal(attributeValue);
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBackgroundPosition}.
@@ -37,6 +39,11 @@
public class BackgroundPositionTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BACKGROUND_POSITION;
+ }
+
+ @Override
protected PdBackgroundPosition createProperty(final String attributeValue) throws PropertyException {
final PdBackgroundPosition property = new PdBackgroundPosition(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionVerticalTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionVerticalTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundPositionVerticalTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -29,6 +29,8 @@
package org.foray.fotree.fo.prop;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBackgroundPositionVertical}.
@@ -37,6 +39,11 @@
extends AbstractBackgroundPositionTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BACKGROUND_POSITION_VERTICAL;
+ }
+
+ @Override
protected PdBackgroundPositionVertical createProperty(final String attributeValue) throws PropertyException {
final PdBackgroundPositionVertical property =
new PdBackgroundPositionVertical(attributeValue);
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundRepeatTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundRepeatTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundRepeatTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBackgroundRepeat}.
@@ -37,6 +39,11 @@
public class BackgroundRepeatTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BACKGROUND_REPEAT;
+ }
+
+ @Override
protected PdBackgroundRepeat createProperty(final String attributeValue) throws PropertyException {
final PdBackgroundRepeat property = new PdBackgroundRepeat(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BackgroundTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBackground}.
@@ -37,6 +39,11 @@
public class BackgroundTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BACKGROUND;
+ }
+
+ @Override
protected PdBackground createProperty(final String attributeValue) throws PropertyException {
final PdBackground property = new PdBackground("", attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BaselineShiftTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BaselineShiftTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BaselineShiftTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -31,6 +31,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
@@ -42,6 +44,11 @@
implements CmpLengthTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BASELINE_SHIFT;
+ }
+
+ @Override
protected PdBaselineShift createProperty(final String attributeValue) throws PropertyException {
final PdBaselineShift property = new PdBaselineShift(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BlankOrNotBlankTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BlankOrNotBlankTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BlankOrNotBlankTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBlankOrNotBlank}.
@@ -37,6 +39,11 @@
public class BlankOrNotBlankTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BLANK_OR_NOT_BLANK;
+ }
+
+ @Override
protected PdBlankOrNotBlank createProperty(final String attributeValue) throws PropertyException {
final PdBlankOrNotBlank property = new PdBlankOrNotBlank(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BlockProgressionDimensionTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BlockProgressionDimensionTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BlockProgressionDimensionTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -29,6 +29,8 @@
package org.foray.fotree.fo.prop;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBlockProgressionDimension}.
@@ -37,6 +39,11 @@
extends RelativeDimensionTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BLOCK_PROGRESSION_DIMENSION;
+ }
+
+ @Override
protected PdBlockProgressionDimension createProperty(final String attributeValue) throws PropertyException {
final PdBlockProgressionDimension property =
new PdBlockProgressionDimension(attributeValue);
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterColorTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterColorTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterColorTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderAfterColor}.
@@ -37,6 +39,11 @@
public class BorderAfterColorTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_AFTER_COLOR;
+ }
+
+ @Override
protected PdBorderAfterColor createProperty(final String attributeValue) throws PropertyException {
final PdBorderAfterColor property = new PdBorderAfterColor(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterPrecedenceTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterPrecedenceTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterPrecedenceTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderAfterPrecedence}.
@@ -37,6 +39,11 @@
public class BorderAfterPrecedenceTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_AFTER_PRECEDENCE;
+ }
+
+ @Override
protected PdBorderAfterPrecedence createProperty(final String attributeValue) throws PropertyException {
final PdBorderAfterPrecedence property = new PdBorderAfterPrecedence(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterStyleTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterStyleTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterStyleTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderAfterStyle}.
@@ -37,6 +39,11 @@
public class BorderAfterStyleTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_AFTER_STYLE;
+ }
+
+ @Override
protected PdBorderAfterStyle createProperty(final String attributeValue) throws PropertyException {
final PdBorderAfterStyle property = new PdBorderAfterStyle(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterWidthTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterWidthTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderAfterWidthTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -29,6 +29,8 @@
package org.foray.fotree.fo.prop;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderAfterWidth}.
@@ -36,6 +38,11 @@
public class BorderAfterWidthTests extends AbstractBorderWidthTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_AFTER_WIDTH;
+ }
+
+ @Override
protected PdBorderAfterWidth createProperty(final String attributeValue) throws PropertyException {
final PdBorderAfterWidth property = new PdBorderAfterWidth(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeColorTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeColorTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeColorTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderBeforeColor}.
@@ -37,6 +39,11 @@
public class BorderBeforeColorTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_BEFORE_COLOR;
+ }
+
+ @Override
protected PdBorderBeforeColor createProperty(final String attributeValue) throws PropertyException {
final PdBorderBeforeColor property = new PdBorderBeforeColor(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforePrecedenceTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforePrecedenceTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforePrecedenceTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderBeforePrecedence}.
@@ -37,6 +39,11 @@
public class BorderBeforePrecedenceTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_BEFORE_PRECEDENCE;
+ }
+
+ @Override
protected PdBorderBeforePrecedence createProperty(final String attributeValue) throws PropertyException {
final PdBorderBeforePrecedence property = new PdBorderBeforePrecedence(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeStyleTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeStyleTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeStyleTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderBeforeStyle}.
@@ -37,6 +39,11 @@
public class BorderBeforeStyleTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_BEFORE_STYLE;
+ }
+
+ @Override
protected PdBorderBeforeStyle createProperty(final String attributeValue) throws PropertyException {
final PdBorderBeforeStyle property = new PdBorderBeforeStyle(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeWidthTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeWidthTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBeforeWidthTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -29,6 +29,8 @@
package org.foray.fotree.fo.prop;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderBeforeWidth}.
@@ -36,6 +38,11 @@
public class BorderBeforeWidthTests extends AbstractBorderWidthTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_BEFORE_WIDTH;
+ }
+
+ @Override
protected PdBorderBeforeWidth createProperty(final String attributeValue) throws PropertyException {
final PdBorderBeforeWidth property = new PdBorderBeforeWidth(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomColorTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomColorTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomColorTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderBottomColor}.
@@ -37,6 +39,11 @@
public class BorderBottomColorTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_BOTTOM_COLOR;
+ }
+
+ @Override
protected PdBorderBottomColor createProperty(final String attributeValue) throws PropertyException {
final PdBorderBottomColor property = new PdBorderBottomColor(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomStyleTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomStyleTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomStyleTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderBottomStyle}.
@@ -37,6 +39,11 @@
public class BorderBottomStyleTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_BOTTOM_STYLE;
+ }
+
+ @Override
protected PdBorderBottomStyle createProperty(final String attributeValue) throws PropertyException {
final PdBorderBottomStyle property = new PdBorderBottomStyle(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -30,6 +30,8 @@
import org.foray.fotree.AbstractPropertyTests;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
/**
* JUnit test class for the class {@link PdBorderBottom}.
@@ -37,6 +39,11 @@
public class BorderBottomTests extends AbstractPropertyTests {
@Override
+ protected PropertyId getPropertyId() {
+ return FoPropertyId.BORDER_BOTTOM;
+ }
+
+ @Override
protected PdBorderBottom createProperty(final String attributeValue) throws PropertyException {
final PdBorderBottom property = new PdBorderBottom(attributeValue);
return property;
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomWidthTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomWidthTests.java 2022-12-29 13:01:44 UTC (rev 12975)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/BorderBottomWidthTests.java 2022-12-29 16:54:28 UTC (rev 12976)
@@ -29,6 +29,8 @@
package org.foray.fotree.fo.prop;
import org.foray....
[truncated message content] |