foray-commit Mailing List for FOray (Page 20)
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
|
Dec
|
|
From: <vic...@us...> - 2025-04-14 12:20:04
|
Revision: 13401
http://sourceforge.net/p/foray/code/13401
Author: victormote
Date: 2025-04-14 12:19:46 +0000 (Mon, 14 Apr 2025)
Log Message:
-----------
Remove extraneous package-info.
Removed Paths:
-------------
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java 2025-04-14 11:32:10 UTC (rev 13400)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java 2025-04-14 12:19:46 UTC (rev 13401)
@@ -1,32 +0,0 @@
-/*
- * Copyright 2025 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$
- */
-
-/**
- * Test of classes in org.foray.fotree.fo.datatype.
- */
-package org.foray.fotree.fo.datatype;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-14 11:32:28
|
Revision: 13400
http://sourceforge.net/p/foray/code/13400
Author: victormote
Date: 2025-04-14 11:32:10 +0000 (Mon, 14 Apr 2025)
Log Message:
-----------
Add missing writing-mode keywords.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/FoKeyword.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/FoKeyword.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/FoKeyword.java 2025-04-14 10:18:20 UTC (rev 13399)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/FoKeyword.java 2025-04-14 11:32:10 UTC (rev 13400)
@@ -30,6 +30,8 @@
/**
* An enumeration of the XSL-FO property value keywords.
+ * Because this list of enumerated items is searched using a binary search, it must be maintained in strict ASCII
+ * sorting order <em>by the text</em>, not by the name of the enumerated item.
*/
public enum FoKeyword {
@@ -141,249 +143,255 @@
/** The "bounded-in-one-dimension" FO property value. */
BOUNDED_IN_ONE_DIMENSION("bounded-in-one-dimension"), // 35
+ /** The "bt-lr" FO property value. */
+ BT_LR("bt-lr"), // 36
+
+ /** The "bt-rl" FO property value. */
+ BT_RL("bt-rl"), // 37
+
/** The "capitalize" FO property value. */
- CAPITALIZE("capitalize"), // 36
+ CAPITALIZE("capitalize"), // 38
/** The "center" FO property value. */
- CENTER("center"), // 37
+ CENTER("center"), // 39
/** The "center-left" FO property value. */
- CENTER_LEFT("center-left"), // 38
+ CENTER_LEFT("center-left"), // 40
/** The "center-right" FO property value. */
- CENTER_RIGHT("center-right"), // 39
+ CENTER_RIGHT("center-right"), // 41
/** The "central" FO property value. */
- CENTRAL("central"), // 40
+ CENTRAL("central"), // 42
/** The "character-by-character" FO property value. */
- CHARACTER_BY_CHARACTER("character-by-character"), // 41
+ CHARACTER_BY_CHARACTER("character-by-character"), // 43
/** The "child" FO property value. */
- CHILD("child"), // 42
+ CHILD("child"), // 44
/** The "code" FO property value. */
- CODE("code"), // 43
+ CODE("code"), // 45
/** The "collapse" FO property value. */
- COLLAPSE("collapse"), // 44
+ COLLAPSE("collapse"), // 46
/** The "collapse-with-precedence" FO property value. */
- COLLAPSE_WITH_PRECEDENCE("collapse-with-precedence"), // 45
+ COLLAPSE_WITH_PRECEDENCE("collapse-with-precedence"), // 47
/** The "column" FO property value. */
- COLUMN("column"), // 46
+ COLUMN("column"), // 48
/** The "condensed" FO property value. */
- CONDENSED("condensed"), // 47
+ CONDENSED("condensed"), // 49
/** The "consider-shifts" FO property value. */
- CONSIDER_SHIFTS("consider-shifts"), // 48
+ CONSIDER_SHIFTS("consider-shifts"), // 50
/** The "continuous" FO property value. */
- CONTINUOUS("continuous"), // 49
+ CONTINUOUS("continuous"), // 51
/** The "cursive" FO property value. */
- CURSIVE("cursive"), // 50
+ CURSIVE("cursive"), // 52
/** The "dashed" FO property value. */
- DASHED("dashed"), // 51
+ DASHED("dashed"), // 53
/** The "digits" FO property value. */
- DIGITS("digits"), // 52
+ DIGITS("digits"), // 54
/** The "discard" FO property value. */
- DISCARD("discard"), // 53
+ DISCARD("discard"), // 55
/** The "disregard-shifts" FO property value. */
- DISREGARD_SHIFTS("disregard-shifts"), // 54
+ DISREGARD_SHIFTS("disregard-shifts"), // 56
/** The "document" FO property value. */
- DOCUMENT("document"), // 55
+ DOCUMENT("document"), // 57
/** The "document-root" FO property value. */
- DOCUMENT_ROOT("document-root"), // 56
+ DOCUMENT_ROOT("document-root"), // 58
/** The "dots" FO property value. */
- DOTS("dots"), // 57
+ DOTS("dots"), // 59
/** The "dotted" FO property value. */
- DOTTED("dotted"), // 58
+ DOTTED("dotted"), // 60
/** The "double" FO property value. */
- DOUBLE("double"), // 59
+ DOUBLE("double"), // 61
/** The "embed" FO property value. */
- EMBED("embed"), // 60
+ EMBED("embed"), // 62
/** The "end" FO property value. */
- END("end"), // 61
+ END("end"), // 63
/** The "end-on-even" FO property value. */
- END_ON_EVEN("end-on-even"), // 62
+ END_ON_EVEN("end-on-even"), // 64
/** The "end-on-odd" FO property value. */
- END_ON_ODD("end-on-odd"), // 63
+ END_ON_ODD("end-on-odd"), // 65
/** The "error-if-overflow" FO property value. */
- ERROR_IF_OVERFLOW("error-if-overflow"), // 64
+ ERROR_IF_OVERFLOW("error-if-overflow"), // 66
/** The "even" FO property value. */
- EVEN("even"), // 65
+ EVEN("even"), // 67
/** The "even-page" FO property value. */
- EVEN_PAGE("even-page"), // 66
+ EVEN_PAGE("even-page"), // 68
/** The "expanded" FO property value. */
- EXPANDED("expanded"), // 67
+ EXPANDED("expanded"), // 69
/** The "extra-condensed" FO property value. */
- EXTRA_CONDENSED("extra-condensed"), // 68
+ EXTRA_CONDENSED("extra-condensed"), // 70
/** The "extra-expanded" FO property value. */
- EXTRA_EXPANDED("extra-expanded"), // 69
+ EXTRA_EXPANDED("extra-expanded"), // 71
/** The "false" FO property value. */
- FALSE("false"), // 70
+ FALSE("false"), // 72
/** The "fantasy" FO property value. */
- FANTASY("fantasy"), // 71
+ FANTASY("fantasy"), // 73
/** The "far-left" FO property value. */
- FAR_LEFT("far-left"), // 72
+ FAR_LEFT("far-left"), // 74
/** The "far-right" FO property value. */
- FAR_RIGHT("far-right"), // 73
+ FAR_RIGHT("far-right"), // 75
/** The "fast" FO property value. */
- FAST("fast"), // 74
+ FAST("fast"), // 76
/** The "faster" FO property value. */
- FASTER("faster"), // 75
+ FASTER("faster"), // 77
/** The "female" FO property value. */
- FEMALE("female"), // 76
+ FEMALE("female"), // 78
/** The "first" FO property value. */
- FIRST("first"), // 77
+ FIRST("first"), // 79
/** The "first-including-carryover" FO property value. */
- FIRST_INCLUDING_CARRYOVER("first-including-carryover"), // 78
+ FIRST_INCLUDING_CARRYOVER("first-including-carryover"), // 80
/** The "first-starting" FO property value. */
- FIRST_STARTING("first-starting"), // 79
+ FIRST_STARTING("first-starting"), // 81
/** The "first-starting-within-page" FO property value. */
- FIRST_STARTING_WITHIN_PAGE("first-starting-within-page"), // 80
+ FIRST_STARTING_WITHIN_PAGE("first-starting-within-page"), // 82
/** The "fixed" FO property value. */
- FIXED("fixed"), // 81
+ FIXED("fixed"), // 83
/** The "focus" FO property value. */
- FOCUS("focus"), // 82
+ FOCUS("focus"), // 84
/** The "font-height" FO property value. */
- FONT_HEIGHT("font-height"), // 83
+ FONT_HEIGHT("font-height"), // 85
/** The "force" FO property value. */
- FORCE("force"), // 84
+ FORCE("force"), // 86
/** The "groove" FO property value. */
- GROOVE("groove"), // 85
+ GROOVE("groove"), // 87
/** The "hanging" FO property value. */
- HANGING("hanging"), // 86
+ HANGING("hanging"), // 88
/** The "height" FO property value. */
- HEIGHT("height"), // 87
+ HEIGHT("height"), // 89
/** The "hidden" FO property value. */
- HIDDEN("hidden"), // 88
+ HIDDEN("hidden"), // 90
/** The "hide" FO property value. */
- HIDE("hide"), // 89
+ HIDE("hide"), // 91
/** The "high" FO property value. */
- HIGH("high"), // 90
+ HIGH("high"), // 92
/** The "higher" FO property value. */
- HIGHER("higher"), // 91
+ HIGHER("higher"), // 93
/** The "hover" FO property value. */
- HOVER("hover"), // 92
+ HOVER("hover"), // 94
/** The "ideographic" FO property value. */
- IDEOGRAPHIC("ideographic"), // 93
+ IDEOGRAPHIC("ideographic"), // 95
/** The "ignore" FO property value. */
- IGNORE("ignore"), // 94
+ IGNORE("ignore"), // 96
/** The "ignore-if-after-linefeed" FO property value. */
- IGNORE_IF_AFTER_LINEFEED("ignore-if-after-linefeed"), // 95
+ IGNORE_IF_AFTER_LINEFEED("ignore-if-after-linefeed"), // 97
/** The "ignore-if-before-linefeed" FO property value. */
- IGNORE_IF_BEFORE_LINEFEED("ignore-if-before-linefeed"), // 96
+ IGNORE_IF_BEFORE_LINEFEED("ignore-if-before-linefeed"), // 98
/** The "ignore-if-surrounding-linefeed" FO property
* value. */
- IGNORE_IF_SURROUNDING_LINEFEED("ignore-if-surrounding-linefeed"), // 97
+ IGNORE_IF_SURROUNDING_LINEFEED("ignore-if-surrounding-linefeed"), // 99
/** The "indefinite" FO property value. */
- INDEFINITE("indefinite"), // 98
+ INDEFINITE("indefinite"), // 100
/** The "indent" FO property value. */
- INDENT("indent"), // 99
+ INDENT("indent"), // 101
/** The "inherit" FO property value. */
- INHERIT("inherit"), // 100
+ INHERIT("inherit"), // 102
/** The "inset" FO property value. */
- INSET("inset"), // 101
+ INSET("inset"), // 103
/** The "inside" FO property value. */
- INSIDE("inside"), // 102
+ INSIDE("inside"), // 104
/** The "integer-pixels" FO property value. */
- INTEGER_PIXELS("integer-pixels"), // 103
+ INTEGER_PIXELS("integer-pixels"), // 105
/** The "italic" FO property value. */
- ITALIC("italic"), // 104
+ ITALIC("italic"), // 106
/** The "justify" FO property value. */
- JUSTIFY("justify"), // 105
+ JUSTIFY("justify"), // 107
/** The "landscape" FO property value. */
- LANDSCAPE("landscape"), // 106
+ LANDSCAPE("landscape"), // 108
/** The "large" FO property value. */
- LARGE("large"), // 107
+ LARGE("large"), // 109
/** The "larger" FO property value. */
- LARGER("larger"), // 108
+ LARGER("larger"), // 110
/** The "last" FO property value. */
- LAST("last"), // 109
+ LAST("last"), // 111
/** The "last-ending" FO property value. */
- LAST_ENDING("last-ending"), // 110
+ LAST_ENDING("last-ending"), // 112
/** The "last-ending-within-page" FO property value. */
- LAST_ENDING_WITHIN_PAGE("last-ending-within-page"), // 111
+ LAST_ENDING_WITHIN_PAGE("last-ending-within-page"), // 113
/** The "last-starting" FO property value. */
- LAST_STARTING("last-starting"), // 112
+ LAST_STARTING("last-starting"), // 114
/** The "last-starting-within-page" FO property value. */
- LAST_STARTING_WITHIN_PAGE("last-starting-within-page"), // 113
+ LAST_STARTING_WITHIN_PAGE("last-starting-within-page"), // 115
/** The "leave-separate" FO property value. */
- LEAVE_SEPARATE("leave-separate"), // 114
+ LEAVE_SEPARATE("leave-separate"), // 116
/** The "left" FO property value. */
- LEFT("left"), // 115
+ LEFT("left"), // 117
/** The "left-side" FO property value. */
- LEFT_SIDE("left-side"), // 116
+ LEFT_SIDE("left-side"), // 118
/* In ASCII, "LEFTWARDS" comes before "LEFT_SIDE". However, "left-side"
* comes before "leftwards". Since any binary search will be done on
@@ -391,441 +399,465 @@
* follow it here. */
/** The "leftwards" FO property value. */
- LEFTWARDS("leftwards"), // 117
+ LEFTWARDS("leftwards"), // 119
/** The "level" FO property value. */
- LEVEL("level"), // 118
+ LEVEL("level"), // 120
/** The "lighter" FO property value. */
- LIGHTER("lighter"), // 119
+ LIGHTER("lighter"), // 121
/** The "line" FO property value. */
- LINE("line"), // 120
+ LINE("line"), // 122
/** The "line-height" FO property value. */
- LINE_HEIGHT("line-height"), // 121
+ LINE_HEIGHT("line-height"), // 123
/** The "line-through" FO property value. */
- LINE_THROUGH("line-through"), // 122
+ LINE_THROUGH("line-through"), // 124
/** The "link" FO property value. */
- LINK("link"), // 123
+ LINK("link"), // 125
/** The "loud" FO property value. */
- LOUD("loud"), // 124
+ LOUD("loud"), // 126
/** The "low" FO property value. */
- LOW("low"), // 125
+ LOW("low"), // 127
/** The "lower" FO property value. */
- LOWER("lower"), // 126
+ LOWER("lower"), // 128
/** The "lowercase" FO property value. */
- LOWERCASE("lowercase"), // 127
+ LOWERCASE("lowercase"), // 129
/** The "lr" FO property value. */
- LR("lr"), // 128
+ LR("lr"), // 130
+ /** The "lr-alternating-rl-bt" FO property value. */
+ LR_ALTERNATING_RL_BT("lr-alternating-rl-bt"), // 131
+
+ /** The "lr-alternating-rl-tb" FO property value. */
+ LR_ALTERNATING_RL_TB("lr-alternating-rl-tb"), // 132
+
+ /** The "lr-bt" FO property value. */
+ LR_BT("lr-bt"), // 133
+
+ /** The "llr-inverting-rl-bt" FO property value. */
+ LR_INVERTING_RL_BT("lr-inverting-rl-bt"), // 134
+
+ /** The "lr-inverting-rl-tb" FO property value. */
+ LR_INVERTING_RL_TB("lr-inverting-rl-tb"), // 135
+
/** The "lr-tb" FO property value. */
- LR_TB("lr-tb"), // 129
+ LR_TB("lr-tb"), // 136
/** The "ltr" FO property value. */
- LTR("ltr"), // 130
+ LTR("ltr"), // 137
/** The "male" FO property value. */
- MALE("male"), // 131
+ MALE("male"), // 138
/** The "mathematical" FO property value. */
- MATHEMATICAL("mathematical"), // 132
+ MATHEMATICAL("mathematical"), // 139
/** The "max-height" FO property value. */
- MAX_HEIGHT("max-height"), // 133
+ MAX_HEIGHT("max-height"), // 140
/** The "medium" FO property value. */
- MEDIUM("medium"), // 134
+ MEDIUM("medium"), // 141
/** The "merge" FO property value. */
- MERGE("merge"), // 135
+ MERGE("merge"), // 142
/** The "middle" FO property value. */
- MIDDLE("middle"), // 136
+ MIDDLE("middle"), // 143
/** The "monospace" FO property value. */
- MONOSPACE("monospace"), // 137
+ MONOSPACE("monospace"), // 144
/** The "narrower" FO property value. */
- NARROWER("narrower"), // 138
+ NARROWER("narrower"), // 145
/** The "new" FO property value. */
- NEW("new"), // 139
+ NEW("new"), // 146
/** The "no-blink" FO property value. */
- NO_BLINK("no-blink"), // 140
+ NO_BLINK("no-blink"), // 147
/** The "no-change" FO property value. */
- NO_CHANGE("no-change"), // 141
+ NO_CHANGE("no-change"), // 148
/** The "no-force" FO property value. */
- NO_FORCE("no-force"), // 142
+ NO_FORCE("no-force"), // 149
/** The "no-limit" FO property value. */
- NO_LIMIT("no-limit"), // 143
+ NO_LIMIT("no-limit"), // 150
/** The "no-line-through" FO property value. */
- NO_LINE_THROUGH("no-line-through"), // 144
+ NO_LINE_THROUGH("no-line-through"), // 151
/** The "no-link" FO property value. */
- NO_LINK("no-link"), // 145
+ NO_LINK("no-link"), // 152
/** The "no-overline" FO property value. */
- NO_OVERLINE("no-overline"), // 146
+ NO_OVERLINE("no-overline"), // 153
/** The "no-repeate" FO property value. */
- NO_REPEAT("no-repeat"), // 147
+ NO_REPEAT("no-repeat"), // 154
/** The "no-underline" FO property value. */
- NO_UNDERLINE("no-underline"), // 148
+ NO_UNDERLINE("no-underline"), // 155
/** The "no-wrap" FO property value. */
- NO_WRAP("no-wrap"), // 149
+ NO_WRAP("no-wrap"), // 156
/** The "non-blank" FO property value. */
- NON_BLANK("non-blank"), // 150
+ NON_BLANK("non-blank"), // 157
/** The "non-uniform" FO property value. */
- NON_UNIFORM("non-uniform"), // 151
+ NON_UNIFORM("non-uniform"), // 158
/** The "none" FO property value. */
- NONE("none"), // 152
+ NONE("none"), // 159
/** The "normal" FO property value. */
- NORMAL("normal"), // 153
+ NORMAL("normal"), // 160
/** The "not-a-keyword" FO property value. */
- NOT_A_KEYWORD("not-a-keyword"), // 154
+ NOT_A_KEYWORD("not-a-keyword"), // 161
/** The "not-blank" FO property value. */
- NOT_BLANK("not-blank"), // 155
+ NOT_BLANK("not-blank"), // 162
/** The "nowrap" FO property value. */
- NOWRAP("nowrap"), // 156
+ NOWRAP("nowrap"), // 163
/** The "oblique" FO property value. */
- OBLIQUE("oblique"), // 157
+ OBLIQUE("oblique"), // 164
/** The "odd" FO property value. */
- ODD("odd"), // 158
+ ODD("odd"), // 165
/** The "odd-page" FO property value. */
- ODD_PAGE("odd-page"), // 159
+ ODD_PAGE("odd-page"), // 166
/** The "once" FO property value. */
- ONCE("once"), // 160
+ ONCE("once"), // 167
/** The "only" FO property value. */
- ONLY("only"), // 161
+ ONLY("only"), // 168
/** The "outset" FO property value. */
- OUTSET("outset"), // 162
+ OUTSET("outset"), // 169
/** The "outside" FO property value. */
- OUTSIDE("outside"), // 163
+ OUTSIDE("outside"), // 170
/** The "overline" FO property value. */
- OVERLINE("overline"), // 164
+ OVERLINE("overline"), // 171
/** The "page" FO property value. */
- PAGE("page"), // 165
+ PAGE("page"), // 172
/** The "page-sequence" FO property value. */
- PAGE_SEQUENCE("page-sequence"), // 166
+ PAGE_SEQUENCE("page-sequence"), // 173
/** The "paginate" FO property value. */
- PAGINATE("paginate"), // 167
+ PAGINATE("paginate"), // 174
/** The "perceptual" FO property value. */
- PERCEPTUAL("perceptual"), // 168
+ PERCEPTUAL("perceptual"), // 175
/** The "portrait" FO property value. */
- PORTRAIT("portrait"), // 169
+ PORTRAIT("portrait"), // 176
/** The "pre" FO property value. */
- PRE("pre"), // 170
+ PRE("pre"), // 177
/** The "preserve" FO property value. */
- PRESERVE("preserve"), // 171
+ PRESERVE("preserve"), // 178
/** The "reference-area" FO property value. */
- REFERENCE_AREA("reference-area"), // 172
+ REFERENCE_AREA("reference-area"), // 179
/** The "relative" FO property value. */
- RELATIVE("relative"), // 173
+ RELATIVE("relative"), // 180
/** The "relative-colorimetric" FO property value. */
- RELATIVE_COLORIMETRIC("relative-colorimetric"), // 174
+ RELATIVE_COLORIMETRIC("relative-colorimetric"), // 181
/** The "repeat" FO property value. */
- REPEAT("repeat"), // 175
+ REPEAT("repeat"), // 182
/** The "repeat-x" FO property value. */
- REPEAT_X("repeat-x"), // 176
+ REPEAT_X("repeat-x"), // 183
/** The "repeat-y" FO property value. */
- REPEAT_Y("repeat-y"), // 177
+ REPEAT_Y("repeat-y"), // 184
/** The "replace" FO property value. */
- REPLACE("replace"), // 178
+ REPLACE("replace"), // 185
/** The "resample-any-method" FO property value. */
- RESAMPLE_ANY_METHOD("resample-any-method"), // 179
+ RESAMPLE_ANY_METHOD("resample-any-method"), // 186
/** The "reset-size" FO property value. */
- RESET_SIZE("reset-size"), // 180
+ RESET_SIZE("reset-size"), // 187
/** The "rest" FO property value. */
- REST("rest"), // 181
+ REST("rest"), // 188
/** The "retain" FO property value. */
- RETAIN("retain"), // 182
+ RETAIN("retain"), // 189
/** The "ridge" FO property value. */
- RIDGE("ridge"), // 183
+ RIDGE("ridge"), // 190
/** The "right" FO property value. */
- RIGHT("right"), // 184
+ RIGHT("right"), // 191
/** The "right-side" FO property value. */
- RIGHT_SIDE("right-side"), // 185
+ RIGHT_SIDE("right-side"), // 192
/* See note at "LEFTWARDS" explaining the order. */
/** The "rightwards" FO property value. */
- RIGHTWARDS("rightwards"), // 186
+ RIGHTWARDS("rightwards"), // 193
/** The "rl" FO property value. */
- RL("rl"), // 187
+ RL("rl"), // 194
+ /** The "rl-bt" FO property value. */
+ RL_BT("rl-bt"), // 195
+
/** The "rl-tb" FO property value. */
- RL_TB("rl-tb"), // 188
+ RL_TB("rl-tb"), // 196
/** The "rtl" FO property value. */
- RTL("rtl"), // 189
+ RTL("rtl"), // 197
/** The "rule" FO property value. */
- RULE("rule"), // 190
+ RULE("rule"), // 198
/** The "sans-serif" FO property value. */
- SANS_SERIF("sans-serif"), // 191
+ SANS_SERIF("sans-serif"), // 199
/** The "saturation" FO property value. */
- SATURATION("saturation"), // 192
+ SATURATION("saturation"), // 200
/** The "scale-down-to-fit" FO property value. */
- SCALE_DOWN_TO_FIT("scale-down-to-fit"), // 193
+ SCALE_DOWN_TO_FIT("scale-down-to-fit"), // 201
/** The "scale-to-fit" FO property value. */
- SCALE_TO_FIT("scale-to-fit"), // 194
+ SCALE_TO_FIT("scale-to-fit"), // 202
/** The "scale-up-to-fit" FO property value. */
- SCALE_UP_TO_FIT("scale-up-to-fit"), // 195
+ SCALE_UP_TO_FIT("scale-up-to-fit"), // 203
/** The "scroll" FO property value. */
- SCROLL("scroll"), // 196
+ SCROLL("scroll"), // 204
/** The "semi-condensed" FO property value. */
- SEMI_CONDENSED("semi-condensed"), // 197
+ SEMI_CONDENSED("semi-condensed"), // 205
/** The "semi-expanded" FO property value. */
- SEMI_EXPANDED("semi-expanded"), // 198
+ SEMI_EXPANDED("semi-expanded"), // 206
/** The "separate" FO property value. */
- SEPARATE("separate"), // 199
+ SEPARATE("separate"), // 207
/** The "serif" FO property value. */
- SERIF("serif"), // 200
+ SERIF("serif"), // 208
/** The "show" FO property value. */
- SHOW("show"), // 201
+ SHOW("show"), // 209
/** The "silent" FO property value. */
- SILENT("silent"), // 202
+ SILENT("silent"), // 210
/** The "slow" FO property value. */
- SLOW("slow"), // 203
+ SLOW("slow"), // 211
/** The "slower" FO property value. */
- SLOWER("slower"), // 204
+ SLOWER("slower"), // 212
/** The "small" FO property value. */
- SMALL("small"), // 205
+ SMALL("small"), // 213
/** The "small-caps" FO property value. */
- SMALL_CAPS("small-caps"), // 206
+ SMALL_CAPS("small-caps"), // 214
/** The "smaller" FO property value. */
- SMALLER("smaller"), // 207
+ SMALLER("smaller"), // 215
/** The "soft" FO property value. */
- SOFT("soft"), // 208
+ SOFT("soft"), // 216
/** The "solid" FO property value. */
- SOLID("solid"), // 209
+ SOLID("solid"), // 217
/** The "space" FO property value. */
- SPACE("space"), // 210
+ SPACE("space"), // 218
/** The "spell-out" FO property value. */
- SPELL_OUT("spell-out"), // 211
+ SPELL_OUT("spell-out"), // 219
/** The "start" FO property value. */
- START("start"), // 212
+ START("start"), // 220
/** The "static" FO property value. */
- STATIC("static"), // 213
+ STATIC("static"), // 221
/** The "sub" FO property value. */
- SUB("sub"), // 214
+ SUB("sub"), // 222
/** The "super" FO property value. */
- SUPER("super"), // 215
+ SUPER("super"), // 223
/** The "supress" FO property value. */
- SUPPRESS("suppress"), // 216
+ SUPPRESS("suppress"), // 224
/** The "table" FO property value. */
- TABLE("table"), // 217
+ TABLE("table"), // 225
/** The "table-fragment" FO property value. */
- TABLE_FRAGMENT("table-fragment"), // 218
+ TABLE_FRAGMENT("table-fragment"), // 226
/** The "tb" FO property value. */
- TB("tb"), // 219
+ TB("tb"), // 227
+ /** The "tb-lr" FO property value. */
+ TB_LR("tb-lr"), // 228
+
+ /** The "tb-lr-in-lr-pairs" FO property value. */
+ TB_LR_IN_LR_PAIRS("tb-lr-in-lr-pairs"), // 229
+
/** The "tb-rl" FO property value. */
- TB_RL("tb-rl"), // 220
+ TB_RL("tb-rl"), // 230
/** The "text-after-edge" FO property value. */
- TEXT_AFTER_EDGE("text-after-edge"), // 221
+ TEXT_AFTER_EDGE("text-after-edge"), // 231
/** The "text-before-edge" FO property value. */
- TEXT_BEFORE_EDGE("text-before-edge"), // 222
+ TEXT_BEFORE_EDGE("text-before-edge"), // 232
/** The "text-bottom" FO property value. */
- TEXT_BOTTOM("text-bottom"), // 223
+ TEXT_BOTTOM("text-bottom"), // 233
/** The "text-top" FO property value. */
- TEXT_TOP("text-top"), // 224
+ TEXT_TOP("text-top"), // 234
/** The "thick" FO property value. */
- THICK("thick"), // 225
+ THICK("thick"), // 235
/** The "thin" FO property value. */
- THIN("thin"), // 226
+ THIN("thin"), // 236
/** The "top" FO property value. */
- TOP("top"), // 227
+ TOP("top"), // 237
/** The "traditional" FO property value. */
- TRADITIONAL("traditional"), // 228
+ TRADITIONAL("traditional"), // 238
/** The "transparent" FO property value. */
- TRANSPARENT("transparent"), // 229
+ TRANSPARENT("transparent"), // 239
/** The "treat-as-space" FO property value. */
- TREAT_AS_SPACE("treat-as-space"), // 230
+ TREAT_AS_SPACE("treat-as-space"), // 240
/** The "treat-as-zero-width-space" FO property value. */
- TREAT_AS_ZERO_WIDTH_SPACE("treat-as-zero-width-space"), // 231
+ TREAT_AS_ZERO_WIDTH_SPACE("treat-as-zero-width-space"), // 241
/** The "true" FO property value. */
- TRUE("true"), // 232
+ TRUE("true"), // 242
/** The "ultra-condensed" FO property value. */
- ULTRA_CONDENSED("ultra-condensed"), // 233
+ ULTRA_CONDENSED("ultra-condensed"), // 243
/** The "ultra-expanded" FO property value. */
- ULTRA_EXPANDED("ultra-expanded"), // 234
+ ULTRA_EXPANDED("ultra-expanded"), // 244
/** The "unbounded" FO property value. */
- UNBOUNDED("unbounded"), // 235
+ UNBOUNDED("unbounded"), // 245
/** The "underline" FO property value. */
- UNDERLINE("underline"), // 236
+ UNDERLINE("underline"), // 246
/** The "uniform" FO property value. */
- UNIFORM("uniform"), // 237
+ UNIFORM("uniform"), // 247
/** The "uppercase" FO property value. */
- UPPERCASE("uppercase"), // 238
+ UPPERCASE("uppercase"), // 248
/** The "use-content" FO property value. */
- USE_CONTENT("use-content"), // 239
+ USE_CONTENT("use-content"), // 249
/** The "use-font-metrics" FO property value. */
- USE_FONT_METRICS("use-font-metrics"), // 240
+ USE_FONT_METRICS("use-font-metrics"), // 250
/** The "use-normal-stylesheet" FO property value. */
- USE_NORMAL_STYLESHEET("use-normal-stylesheet"), // 241
+ USE_NORMAL_STYLESHEET("use-normal-stylesheet"), // 251
/** The "use-script" FO property value. */
- USE_SCRIPT("use-script"), // 242
+ USE_SCRIPT("use-script"), // 252
/** The "use-target-processing-context" FO property value. */
- USE_TARGET_PROCESSING_CONTEXT("use-target-processing-context"), // 243
+ USE_TARGET_PROCESSING_CONTEXT("use-target-processing-context"), // 253
/** The "visible" FO property value. */
- VISIBLE("visible"), // 244
+ VISIBLE("visible"), // 254
/** The "visited" FO property value. */
- VISITED("visited"), // 245
+ VISITED("visited"), // 255
/** The "wider" FO property value. */
- WIDER("wider"), // 246
+ WIDER("wider"), // 256
/** The "width" FO property value. */
- WIDTH("width"), // 247
+ WIDTH("width"), // 257
/** The "wrap" FO property value. */
- WRAP("wrap"), // 248
+ WRAP("wrap"), // 258
/** The "x-fast" FO property value. */
- X_FAST("x-fast"), // 249
+ X_FAST("x-fast"), // 259
/** The "x-high" FO property value. */
- X_HIGH("x-high"), // 250
+ X_HIGH("x-high"), // 260
/** The "x-large" FO property value. */
- X_LARGE("x-large"), // 251
+ X_LARGE("x-large"), // 261
/** The "x-loud" FO property value. */
- X_LOUD("x-loud"), // 252
+ X_LOUD("x-loud"), // 262
/** The "x-low" FO property value. */
- X_LOW("x-low"), // 253
+ X_LOW("x-low"), // 263
/** The "x-slow" FO property value. */
- X_SLOW("x-slow"), // 254
+ X_SLOW("x-slow"), // 264
/** The "x-small" FO property value. */
- X_SMALL("x-small"), // 255
+ X_SMALL("x-small"), // 265
/** The "x-soft" FO property value. */
- X_SOFT("x-soft"), // 256
+ X_SOFT("x-soft"), // 266
/** The "xsl-any" FO property value. */
- XSL_ANY("xsl-any"), // 257
+ XSL_ANY("xsl-any"), // 267
/** The "xsl-following" FO property value. */
- XSL_FOLLOWING("xsl-following"), // 258
+ XSL_FOLLOWING("xsl-following"), // 268
/** The "xsl-preceding" FO property value. */
- XSL_PRECEDING("xsl-preceding"), // 259
+ XSL_PRECEDING("xsl-preceding"), // 269
/** The "xx-large" FO property value. */
- XX_LARGE("xx-large"), // 260
+ XX_LARGE("xx-large"), // 270
/** The "xx-small" FO property value. */
- XX_SMALL("xx-small"); // 261
+ XX_SMALL("xx-small"); // 271
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-14 10:18:39
|
Revision: 13399
http://sourceforge.net/p/foray/code/13399
Author: victormote
Date: 2025-04-14 10:18:20 +0000 (Mon, 14 Apr 2025)
Log Message:
-----------
Move test classes to match source packaging.
Added Paths:
-----------
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/DtFrequencyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/DtLengthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnAbsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnBodyStartTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnCeilingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFloorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromPageMasterRegionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromParentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromTableColumnTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnInheritedPropertyValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnLabelEndTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnMaxTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnMergePropertyValuesTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnMinTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnProportionalColumnWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnRgbIccTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnRgbTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnRoundTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnSystemColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnSystemFontTests.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/DtFrequencyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/DtLengthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnAbsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnBodyStartTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnCeilingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFloorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromPageMasterRegionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromParentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromTableColumnTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnInheritedPropertyValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnLabelEndTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnMaxTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnMergePropertyValuesTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnMinTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnProportionalColumnWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnRgbIccTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnRgbTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnRoundTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnSystemColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnSystemFontTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/DtFrequencyTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtFrequencyTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/DtFrequencyTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/DtFrequencyTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -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.fo.datatype;
+
+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);
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/DtLengthTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/DtLengthTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/DtLengthTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2006 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.fo.datatype;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link DtLength}.
+ */
+public class DtLengthTests {
+
+ /** A point size to use for these tests. */
+ private static final int POINT_SIZE = 12_000;
+
+ /**
+ * Unit test for a points length.
+ */
+ @Test
+ public void pointsTest() {
+ final DtLength length = DtLength.procureInstance("18.5pt");
+ final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
+ /* Return value is in millipoints. */
+ 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);
+ }
+
+}
Added: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2025 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$
+ */
+
+/**
+ * Test of classes in org.foray.fotree.fo.datatype.
+ */
+package org.foray.fotree.fo.datatype;
Property changes on: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/datatype/package-info.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/DtFrequencyTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtFrequencyTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/DtFrequencyTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,59 +0,0 @@
-/*
- * 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);
- }
-
-}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/DtLengthTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/DtLengthTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,119 +0,0 @@
-/*
- * Copyright 2006 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 DtLength}.
- */
-public class DtLengthTests {
-
- /** A point size to use for these tests. */
- private static final int POINT_SIZE = 12_000;
-
- /**
- * Unit test for a points length.
- */
- @Test
- public void pointsTest() {
- final DtLength length = DtLength.procureInstance("18.5pt");
- final int resolvedLength = length.getValue(DtLengthTests.POINT_SIZE);
- /* Return value is in millipoints. */
- 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);
- }
-
-}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnAbsTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnAbsTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,82 +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;
-
-import org.foray.fotree.PropertyException;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test class for the class {@link FnAbs}.
- */
-public class FnAbsTests {
-
- /** Constant used for testing. */
- private static final DtNumber NUMERIC_1 = new DtNumber(-2.3);
-
- /** Constant used for testing. */
- private static final Expr[] NUMERIC_ARRAY_1 = new Expr[] {
- FnAbsTests.NUMERIC_1,
- };
-
- /** Constant used for testing. */
- private static final DtNumber NUMERIC_2 = new DtNumber(512.9);
-
- /** Constant used for testing. */
- private static final Expr[] NUMERIC_ARRAY_2 = new Expr[] {
- FnAbsTests.NUMERIC_2,
- };
-
- /**
- * Unit test of a negative operand.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testNegative() throws PropertyException {
- final Function fn = Function.makeFunction("abs", FnAbsTests.NUMERIC_ARRAY_1, null);
- assertTrue(fn instanceof FnAbs);
- final FnAbs fnAbs = (FnAbs) fn;
- assertEquals(2.3, fnAbs.evalNumber().doubleValue(), .001);
- }
-
- /**
- * Unit test of a negative operand.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testPositive() throws PropertyException {
- final Function fn = Function.makeFunction("abs", FnAbsTests.NUMERIC_ARRAY_2, null);
- assertTrue(fn instanceof FnAbs);
- final FnAbs fnAbs = (FnAbs) fn;
- assertEquals(512.9, fnAbs.evalNumber().doubleValue(), .001);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnAbsTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnAbsTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnAbsTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,84 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.datatype.DtNumber;
+import org.foray.fotree.fo.expression.Expr;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link FnAbs}.
+ */
+public class FnAbsTests {
+
+ /** Constant used for testing. */
+ private static final DtNumber NUMERIC_1 = new DtNumber(-2.3);
+
+ /** Constant used for testing. */
+ private static final Expr[] NUMERIC_ARRAY_1 = new Expr[] {
+ FnAbsTests.NUMERIC_1,
+ };
+
+ /** Constant used for testing. */
+ private static final DtNumber NUMERIC_2 = new DtNumber(512.9);
+
+ /** Constant used for testing. */
+ private static final Expr[] NUMERIC_ARRAY_2 = new Expr[] {
+ FnAbsTests.NUMERIC_2,
+ };
+
+ /**
+ * Unit test of a negative operand.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testNegative() throws PropertyException {
+ final Function fn = Function.makeFunction("abs", FnAbsTests.NUMERIC_ARRAY_1, null);
+ assertTrue(fn instanceof FnAbs);
+ final FnAbs fnAbs = (FnAbs) fn;
+ assertEquals(2.3, fnAbs.evalNumber().doubleValue(), .001);
+ }
+
+ /**
+ * Unit test of a negative operand.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testPositive() throws PropertyException {
+ final Function fn = Function.makeFunction("abs", FnAbsTests.NUMERIC_ARRAY_2, null);
+ assertTrue(fn instanceof FnAbs);
+ final FnAbs fnAbs = (FnAbs) fn;
+ assertEquals(512.9, fnAbs.evalNumber().doubleValue(), .001);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnBodyStartTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnBodyStartTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnBodyStartTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,51 +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;
-
-import org.foray.fotree.PropertyException;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test class for the class {@link FnBodyStart}.
- */
-public class FnBodyStartTests {
-
- /**
- * Unit test of a function creation.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testBasic() throws PropertyException {
- final Function fn = Function.makeFunction("body-start", null, null);
- assertTrue(fn instanceof FnBodyStart);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnBodyStartTests.java (from rev 13395, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnBodyStartTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnBodyStartTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnBodyStartTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,51 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link FnBodyStart}.
+ */
+public class FnBodyStartTests {
+
+ /**
+ * Unit test of a function creation.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testBasic() throws PropertyException {
+ final Function fn = Function.makeFunction("body-start", null, null);
+ assertTrue(fn instanceof FnBodyStart);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnCeilingTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnCeilingTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnCeilingTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,59 +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;
-
-import org.foray.fotree.PropertyException;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test class for the class {@link FnCeiling}.
- */
-public class FnCeilingTests {
-
- /** Constant used for testing. */
- private static final DtNumber NUMERIC_1 = new DtNumber(-2.3);
-
- /** Constant used for testing. */
- private static final Expr[] NUMERIC_ARRAY_1 = new Expr[] {
- FnCeilingTests.NUMERIC_1,
- };
-
- /**
- * Unit test of a function creation.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testBasic() throws PropertyException {
- final Function fn = Function.makeFunction("ceiling", FnCeilingTests.NUMERIC_ARRAY_1, null);
- assertTrue(fn instanceof FnCeiling);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnCeilingTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnCeilingTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnCeilingTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnCeilingTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,61 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.datatype.DtNumber;
+import org.foray.fotree.fo.expression.Expr;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link FnCeiling}.
+ */
+public class FnCeilingTests {
+
+ /** Constant used for testing. */
+ private static final DtNumber NUMERIC_1 = new DtNumber(-2.3);
+
+ /** Constant used for testing. */
+ private static final Expr[] NUMERIC_ARRAY_1 = new Expr[] {
+ FnCeilingTests.NUMERIC_1,
+ };
+
+ /**
+ * Unit test of a function creation.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testBasic() throws PropertyException {
+ final Function fn = Function.makeFunction("ceiling", FnCeilingTests.NUMERIC_ARRAY_1, null);
+ assertTrue(fn instanceof FnCeiling);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFloorTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFloorTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFloorTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,59 +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;
-
-import org.foray.fotree.PropertyException;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test class for the class {@link FnFloor}.
- */
-public class FnFloorTests {
-
- /** Constant used for testing. */
- private static final DtNumber NUMERIC_1 = new DtNumber(-2.3);
-
- /** Constant used for testing. */
- private static final Expr[] NUMERIC_ARRAY_1 = new Expr[] {
- FnFloorTests.NUMERIC_1,
- };
-
- /**
- * Unit test of a function creation.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testBasic() throws PropertyException {
- final Function fn = Function.makeFunction("floor", FnFloorTests.NUMERIC_ARRAY_1, null);
- assertTrue(fn instanceof FnFloor);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFloorTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFloorTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFloorTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFloorTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,61 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.datatype.DtNumber;
+import org.foray.fotree.fo.expression.Expr;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link FnFloor}.
+ */
+public class FnFloorTests {
+
+ /** Constant used for testing. */
+ private static final DtNumber NUMERIC_1 = new DtNumber(-2.3);
+
+ /** Constant used for testing. */
+ private static final Expr[] NUMERIC_ARRAY_1 = new Expr[] {
+ FnFloorTests.NUMERIC_1,
+ };
+
+ /**
+ * Unit test of a function creation.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testBasic() throws PropertyException {
+ final Function fn = Function.makeFunction("floor", FnFloorTests.NUMERIC_ARRAY_1, null);
+ assertTrue(fn instanceof FnFloor);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValueTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValueTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,60 +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;
-
-import org.foray.fotree.PropertyException;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test class for the class {@link FnFromNearestSpecifiedValue}.
- */
-public class FnFromNearestSpecifiedValueTests {
-
- /** Constant used for testing. */
- private static final DtName NAME_1 = new DtName("orphans");
-
- /** Constant used for testing. */
- private static final Expr[] OPERAND_ARRAY_1 = new Expr[] {
- FnFromNearestSpecifiedValueTests.NAME_1,
- };
-
- /**
- * Unit test of a function creation.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testBasic() throws PropertyException {
- final Function fn = Function.makeFunction("from-nearest-specified-value",
- FnFromNearestSpecifiedValueTests.OPERAND_ARRAY_1, null);
- assertTrue(fn instanceof FnFromNearestSpecifiedValue);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValueTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValueTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValueTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,62 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.datatype.DtName;
+import org.foray.fotree.fo.expression.Expr;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link FnFromNearestSpecifiedValue}.
+ */
+public class FnFromNearestSpecifiedValueTests {
+
+ /** Constant used for testing. */
+ private static final DtName NAME_1 = new DtName("orphans");
+
+ /** Constant used for testing. */
+ private static final Expr[] OPERAND_ARRAY_1 = new Expr[] {
+ FnFromNearestSpecifiedValueTests.NAME_1,
+ };
+
+ /**
+ * Unit test of a function creation.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testBasic() throws PropertyException {
+ final Function fn = Function.makeFunction("from-nearest-specified-value",
+ FnFromNearestSpecifiedValueTests.OPERAND_ARRAY_1, null);
+ assertTrue(fn instanceof FnFromNearestSpecifiedValue);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromPageMasterRegionTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromPageMasterRegionTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromPageMasterRegionTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,75 +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;
-
-import org.foray.fotree.PropertyException;
-import org.foray.fotree.fo.FoPropertyId;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.junit.jupiter.api.Assertions.fail;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test class for the class {@link FnFromPageMasterRegion}.
- */
-public class FnFromPageMasterRegionTests {
-
- /** Constant used for testing. */
- private static final Expr[] OPERAND_ARRAY_ORPHANS = {new DtName("orphans")};
-
- /** Constant used for testing. */
- private static final Expr[] OPERAND_ARRAY_WRITING_MODE = {new DtName("writing-mode")};
-
- /**
- * Unit test of a function creation.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testBasic() throws PropertyException {
- final Function fn = Function.makeFunction("from-page-master-region",
- FnFromPageMasterRegionTests.OPERAND_ARRAY_WRITING_MODE, FoPropertyId.WRITING_MODE);
- assertTrue(fn instanceof FnFromPageMasterRegion);
- }
-
- /**
- * Unit test of a function creation.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void invalidPropertyShouldFail() throws PropertyException {
- try {
- Function.makeFunction("from-page-master-region",
- FnFromPageMasterRegionTests.OPERAND_ARRAY_ORPHANS, FoPropertyId.ORPHANS);
- fail("Expected PropertyException for invalid operand");
- } catch (final PropertyException e) {
- /* This is the expected path. */
- }
- }
-
-}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromPageMasterRegionTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromPageMasterRegionTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromPageMasterRegionTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromPageMasterRegionTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,77 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.fo.datatype.DtName;
+import org.foray.fotree.fo.expression.Expr;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link FnFromPageMasterRegion}.
+ */
+public class FnFromPageMasterRegionTests {
+
+ /** Constant used for testing. */
+ private static final Expr[] OPERAND_ARRAY_ORPHANS = {new DtName("orphans")};
+
+ /** Constant used for testing. */
+ private static final Expr[] OPERAND_ARRAY_WRITING_MODE = {new DtName("writing-mode")};
+
+ /**
+ * Unit test of a function creation.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testBasic() throws PropertyException {
+ final Function fn = Function.makeFunction("from-page-master-region",
+ FnFromPageMasterRegionTests.OPERAND_ARRAY_WRITING_MODE, FoPropertyId.WRITING_MODE);
+ assertTrue(fn instanceof FnFromPageMasterRegion);
+ }
+
+ /**
+ * Unit test of a function creation.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void invalidPropertyShouldFail() throws PropertyException {
+ try {
+ Function.makeFunction("from-page-master-region",
+ FnFromPageMasterRegionTests.OPERAND_ARRAY_ORPHANS, FoPropertyId.ORPHANS);
+ fail("Expected PropertyException for invalid operand");
+ } catch (final PropertyException e) {
+ /* This is the expected path. */
+ }
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromParentTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromParentTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromParentTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,59 +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;
-
-import org.foray.fotree.PropertyException;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test class for the class {@link FnFromParent}.
- */
-public class FnFromParentTests {
-
- /** Constant used for testing. */
- private static final DtName NAME_1 = new DtName("orphans");
-
- /** Constant used for testing. */
- private static final Expr[] OPERAND_ARRAY_1 = new Expr[] {
- FnFromParentTests.NAME_1,
- };
-
- /**
- * Unit test of a function creation.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testBasic() throws PropertyException {
- final Function fn = Function.makeFunction("from-parent", FnFromParentTests.OPERAND_ARRAY_1, null);
- assertTrue(fn instanceof FnFromParent);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromParentTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromParentTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromParentTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromParentTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,61 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.datatype.DtName;
+import org.foray.fotree.fo.expression.Expr;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link FnFromParent}.
+ */
+public class FnFromParentTests {
+
+ /** Constant used for testing. */
+ private static final DtName NAME_1 = new DtName("orphans");
+
+ /** Constant used for testing. */
+ private static final Expr[] OPERAND_ARRAY_1 = new Expr[] {
+ FnFromParentTests.NAME_1,
+ };
+
+ /**
+ * Unit test of a function creation.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testBasic() throws PropertyException {
+ final Function fn = Function.makeFunction("from-parent", FnFromParentTests.OPERAND_ARRAY_1, null);
+ assertTrue(fn instanceof FnFromParent);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromTableColumnTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromTableColumnTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromTableColumnTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,59 +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;
-
-import org.foray.fotree.PropertyException;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.jupiter.api.Test;
-
-/**
- * JUnit test class for the class {@link FnFromTableColumn}.
- */
-public class FnFromTableColumnTests {
-
- /** Constant used for testing. */
- private static final DtName NAME_1 = new DtName("orphans");
-
- /** Constant used for testing. */
- private static final Expr[] OPERAND_ARRAY_1 = new Expr[] {
- FnFromTableColumnTests.NAME_1,
- };
-
- /**
- * Unit test of a function creation.
- * @throws PropertyException For errors during function creation.
- */
- @Test
- public void testBasic() throws PropertyException {
- final Function fn = Function.makeFunction("from-table-column", OPERAND_ARRAY_1, null);
- assertTrue(fn instanceof FnFromTableColumn);
- }
-
-}
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromTableColumnTests.java (from rev 13397, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromTableColumnTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromTableColumnTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnFromTableColumnTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -0,0 +1,61 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.datatype.DtName;
+import org.foray.fotree.fo.expression.Expr;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+/**
+ * JUnit test class for the class {@link FnFromTableColumn}.
+ */
+public class FnFromTableColumnTests {
+
+ /** Constant used for testing. */
+ private static final DtName NAME_1 = new DtName("orphans");
+
+ /** Constant used for testing. */
+ private static final Expr[] OPERAND_ARRAY_1 = new Expr[] {
+ FnFromTableColumnTests.NAME_1,
+ };
+
+ /**
+ * Unit test of a function creation.
+ * @throws PropertyException For errors during function creation.
+ */
+ @Test
+ public void testBasic() throws PropertyException {
+ final Function fn = Function.makeFunction("from-table-column", OPERAND_ARRAY_1, null);
+ assertTrue(fn instanceof FnFromTableColumn);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnInheritedPropertyValueTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnInheritedPropertyValueTests.java 2023-10-22 12:16:29 UTC (rev 13316)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/function/FnInheritedPropertyValueTests.java 2025-04-14 10:18:20 UTC (rev 13399)
@@ -1,60 +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 distribut...
[truncated message content] |
|
From: <vic...@us...> - 2025-04-14 00:07:36
|
Revision: 13398
http://sourceforge.net/p/foray/code/13398
Author: victormote
Date: 2025-04-14 00:07:18 +0000 (Mon, 14 Apr 2025)
Log Message:
-----------
Add some missing datatypes. Add table to package doc cross-referencing the datatypes with the classes that support them.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/package-info.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtFamilyName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtId.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtIdref.java
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtFamilyName.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtFamilyName.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtFamilyName.java 2025-04-14 00:07:18 UTC (rev 13398)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2025 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.fo.datatype;
+
+/**
+ * A "family-name" property datatype in XSL-FO.
+ */
+public final class DtFamilyName extends Datatype {
+
+ /** The string value of the family-name. */
+ private String value = null;
+
+ /**
+ * Constructor. Use {@link #make(String)} to obtain an instance.
+ * @param value The string value of the family-name.
+ */
+ private DtFamilyName(final String value) {
+ this.value = value;
+ }
+
+ /**
+ * Return the value.
+ * @return The string value of the family-name.
+ */
+ public String getValue() {
+ return this.value;
+ }
+
+ /**
+ * This factory method creates an instance from String input.
+ * @param input String containing the value of the family-name.
+ * @return A new instance, or null if input is not valid.
+ */
+ public static DtFamilyName make(final String input) {
+ return new DtFamilyName(input);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtFamilyName.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/fo/datatype/DtId.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtId.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtId.java 2025-04-14 00:07:18 UTC (rev 13398)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2025 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.fo.datatype;
+
+import org.foray.common.primitive.XmlCharacterUtils;
+
+/**
+ * An "id" property datatype in XSL-FO.
+ */
+public final class DtId extends Datatype {
+
+ /** The string value of the id. */
+ private String value = null;
+
+ /**
+ * Constructor. Use {@link #make(String)} to obtain an instance.
+ * @param value The string value of the id.
+ */
+ private DtId(final String value) {
+ this.value = value;
+ }
+
+ /**
+ * Return the value.
+ * @return The string value of the id.
+ */
+ public String getValue() {
+ return this.value;
+ }
+
+ /**
+ * This factory method creates an instance from String input.
+ * It validates the input for conformance with the definition of NCName at
+ * http://www.w3.org/TR/REC-xml-names/#NT-NCName.
+ * @param input String containing the value to be converted.
+ * @return A new instance, or null if input is not valid.
+ */
+ public static DtId make(final String input) {
+ if (! XmlCharacterUtils.isNCName(input)) {
+ return null;
+ }
+ return new DtId(input);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtId.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/fo/datatype/DtIdref.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtIdref.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtIdref.java 2025-04-14 00:07:18 UTC (rev 13398)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2025 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.fo.datatype;
+
+import org.foray.common.primitive.XmlCharacterUtils;
+
+/**
+ * An "idref" property datatype in XSL-FO.
+ */
+public final class DtIdref extends Datatype {
+
+ /** The string value of the idref. */
+ private String value = null;
+
+ /**
+ * Constructor. Use {@link #make(String)} to obtain an instance.
+ * @param value The string value of the idref.
+ */
+ private DtIdref(final String value) {
+ this.value = value;
+ }
+
+ /**
+ * Return the value.
+ * @return The string value of the idref.
+ */
+ public String getValue() {
+ return this.value;
+ }
+
+ /**
+ * This factory method creates an instance from String input.
+ * It validates the input for conformance with the definition of NCName at
+ * http://www.w3.org/TR/REC-xml-names/#NT-NCName.
+ * @param input String containing the value to be converted.
+ * @return A new instance, or null if input is not valid.
+ */
+ public static DtIdref make(final String input) {
+ if (! XmlCharacterUtils.isNCName(input)) {
+ return null;
+ }
+ return new DtIdref(input);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtIdref.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/fo/datatype/package-info.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/package-info.java 2025-04-13 23:22:48 UTC (rev 13397)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/package-info.java 2025-04-14 00:07:18 UTC (rev 13398)
@@ -27,7 +27,40 @@
*/
/**
- * Classes supporting XSL-FO datatypes.
+ * <p>Classes supporting XSL-FO datatypes.
+ * The datatypes listed in the Recommendation, listed in order:</p>
+ *
+ * <table>
+ * <tr><th>Per Recommendation</th> <th>Classes</th></tr>
+
+ * <tr><td>integer<td> <td>DtInteger</td></tr>
+ * <tr><td>number</td> <td>DtNumber</td></tr>
+ * <tr><td>length</td> <td>DtLength and 7 subclasses</td></tr>
+ * <tr><td>length-range<td> <td>DtLengthRange</td></tr>
+ * <tr><td>length-conditional<td> <td>DtLengthConditional</td></tr>
+ * <tr><td>length-bp-ip-direction<td> <td>DtLengthBpIpDirection</td></tr>
+ * <tr><td>space</td> <td>DtSpace</td></tr>
+ * <tr><td>keep</td> <td>DtKeep</td></tr>
+ * <tr><td>angle</td> <td>DtAngle and 3 subclasses</td></tr>
+ * <tr><td>percentage</td> <td>DtPercentage</td></tr>
+ * <tr><td>character</td> <td>DtCharacter</td></tr>
+ * <tr><td>string</td> <td>DtString</td></tr>
+ * <tr><td>name</td> <td>DtName</td></tr>
+ * <tr><td>family-name</td> <td>DtFamilyName</td></tr>
+ * <tr><td>color</td> <td>DtColor</td></tr>
+ * <tr><td>country</td> <td>DtCountry</td></tr>
+ * <tr><td>language</td> <td>DtLanguage</td></tr>
+ * <tr><td>script</td> <td>DtScript</td></tr>
+ * <tr><td>id</td> <td>DtId</td></tr>
+ * <tr><td>idref</td> <td>DtIdref</td></tr>
+ * <tr><td>uri-specification</td> <td>DtUri</td></tr>
+ * <tr><td>shape</td> <td>DtShape and subclass DtRectangle</td></tr>
+ * <tr><td>time</td> <td>DtTime and 2 subclasses</td></tr>
+ * <tr><td>frequency</td> <td>DtFrequency and 2 subclasses.</td></tr>
+ * </table>
+ *
+ * <p>Classes representing pseudo-datatypes: DtBorderStyle, DtBorderWidth, DtShadowEffect, DtShadowEffectWrapper,
+ * DtTextDeco, DtWritingMode.</p>
* @see "XSL-FO Recommendation 1.1, Section 5.11."
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-13 23:23:11
|
Revision: 13397
http://sourceforge.net/p/foray/code/13397
Author: victormote
Date: 2025-04-13 23:22:48 +0000 (Sun, 13 Apr 2025)
Log Message:
-----------
Move XSL-FO datatype classes to their own package.
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/AbstractFoProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgbIcc.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/Function.java
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/AbstractBorder.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractBorderStyle.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/fo/prop/AbstractCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractCue.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/AbstractIndent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/AbstractName.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/AbstractString.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/PdBackground.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBackgroundImage.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/PdBaselineShift.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderBottomColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderBottomWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderLeftColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderLeftWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderRightColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderRightWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSeparation.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderSpacing.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderStyle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderTopColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderTopWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdChangeBarWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdClip.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdContentType.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdCountry.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/PdExtent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdExternalDestination.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/PdFontFamily.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdGlyphOrientationHorizontal.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdGlyphOrientationVertical.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdGroupingSeparator.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdHyphenationCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdId.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdInternalDestination.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdLastLineEndIndent.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/PdLineHeight.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPaddingBottom.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPaddingLeft.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPaddingRight.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdPaddingTop.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/PdPlayDuring.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdRefId.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdRegionName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdRole.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdScript.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/PdSourceDocument.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSrc.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSwitchTo.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTargetPresentationContext.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTargetProcessingContext.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTargetStylesheet.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextAlign.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdTextDecoration.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-fotree/src/main/java/org/foray/fotree/fo/prop/PdWordSpacing.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdWritingMode.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/ValueCollection.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtFrequencyTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/DtLengthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnCeilingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFloorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromPageMasterRegionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromParentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromTableColumnTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnInheritedPropertyValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMaxTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMergePropertyValuesTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMinTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnProportionalColumnWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRgbIccTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRgbTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRoundTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnSystemColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnSystemFontTests.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/Datatype.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Degrees.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Grads.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Radians.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtBorderStyle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtBorderWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtCharacter.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtCountry.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtFrequency.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtFrequency_Hertz.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtFrequency_Kilohertz.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtInteger.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLanguage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLength.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLengthBpIpDirection.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLengthConditional.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLengthRange.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLength_Centimeters.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLength_Ems.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLength_Inches.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLength_Millimeters.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLength_Picas.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLength_Pixels.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtLength_Points.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtName.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtPercentage.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtRectangle.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtScript.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtShadowEffect.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtShadowEffectWrapper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtShape.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtSpace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtString.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtTextDeco.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtTime.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtTime_Milliseconds.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtTime_Seconds.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtUri.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtWritingMode.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/package-info.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Datatype.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
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderStyle.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/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/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/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
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/DtShadowEffectWrapper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtShape.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/DtTime_Milliseconds.java
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/DtUri.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtWritingMode.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 2025-04-13 23:16:37 UTC (rev 13396)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -36,6 +36,8 @@
import org.foray.common.primitive.XmlCharacterUtils;
import org.foray.fotree.fo.FoKeyword;
import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.fo.datatype.DtBorderWidth;
+import org.foray.fotree.fo.datatype.DtWritingMode;
import org.foray.fotree.fo.obj.BasicLink4a;
import org.foray.fotree.fo.obj.Block4a;
import org.foray.fotree.fo.obj.Flow4a;
@@ -52,8 +54,6 @@
import org.foray.fotree.fo.prop.AbstractAllowedAxisScale;
import org.foray.fotree.fo.prop.PdChangeBarOffset;
import org.foray.fotree.fo.prop.PdWritingMode;
-import org.foray.fotree.value.DtBorderWidth;
-import org.foray.fotree.value.DtWritingMode;
import org.foray.primitive.StringUtils;
import org.axsl.fotree.Fo;
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 2025-04-13 23:16:37 UTC (rev 13396)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyList.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -31,6 +31,8 @@
import org.foray.common.i18n.Country4a;
import org.foray.fotree.fo.FoKeyword;
import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.fo.datatype.DtTextDeco;
+import org.foray.fotree.fo.datatype.DtWritingMode;
import org.foray.fotree.fo.obj.FoScalable4a;
import org.foray.fotree.fo.obj.Region4a;
import org.foray.fotree.fo.prop.AbstractAbsoluteDimension;
@@ -225,8 +227,6 @@
import org.foray.fotree.fo.prop.PdWrapOption;
import org.foray.fotree.fo.prop.PdWritingMode;
import org.foray.fotree.fo.prop.PdZindex;
-import org.foray.fotree.value.DtTextDeco;
-import org.foray.fotree.value.DtWritingMode;
import org.foray.fotree.xml.XmlPropertyId;
import org.foray.fotree.xml.prop.Lang;
import org.foray.primitive.StringUtils;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/AbstractFoProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/AbstractFoProperty.java 2025-04-13 23:16:37 UTC (rev 13396)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/AbstractFoProperty.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -30,9 +30,9 @@
import org.foray.fotree.Property;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.datatype.DtBorderStyle;
+import org.foray.fotree.fo.datatype.DtUri;
import org.foray.fotree.parse.PropertyParser;
-import org.foray.fotree.value.DtBorderStyle;
-import org.foray.fotree.value.DtUri;
import org.foray.fotree.value.PropertyValue;
import org.foray.fotree.value.PvKeyword;
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/Datatype.java (from rev 13396, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Datatype.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/Datatype.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/Datatype.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004 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.fo.datatype;
+
+import org.foray.fotree.fo.FoKeyword;
+import org.foray.fotree.fo.PvKeywordFo;
+import org.foray.fotree.fo.expression.ExprPrimary;
+import org.foray.fotree.value.PropertyValue;
+import org.foray.fotree.value.PvKeyword;
+
+
+/**
+ * Abstract class representing an XSL-FO Property Datatype, as defined in
+ * Section 5.11 of the XSL-FO Standard 1.0.
+ */
+public abstract class Datatype extends ExprPrimary {
+
+ /**
+ * Converts a keyword property value to its equivalent FoValue.
+ * @param value The property value to be converted.
+ * @return The value of the property, as an FoValue.
+ */
+ public static FoKeyword convertValueToFoValue(final PropertyValue value) {
+ if (! value.canEvalKeyword()) {
+ return null;
+ }
+ final PvKeyword genericKeyword = value.evalKeyword();
+ if (! (genericKeyword instanceof PvKeywordFo)) {
+ return null;
+ }
+ final PvKeywordFo keyword = (PvKeywordFo) genericKeyword;
+ final FoKeyword keywordValue = keyword.getValue();
+ return keywordValue;
+ }
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004 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.fo.datatype;
+
+import org.axsl.constants.NumericConstants;
+
+import java.math.BigDecimal;
+import java.util.regex.Matcher;
+
+/**
+ * An "angle" property datatype in XSL-FO.
+ * @see "XSL-FO Recommendation 1.1, Section 5.11."
+ */
+public abstract class DtAngle extends Datatype {
+
+ /**
+ * 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 int getValue() {
+ double degrees = asDegrees();
+ while (degrees < 0) {
+ degrees += NumericConstants.DEGREES_PER_CIRCLE;
+ }
+ degrees %= NumericConstants.DEGREES_PER_CIRCLE;
+ return (int) Math.round(degrees * NumericConstants.MILLIDEGREES_PER_DEGREE);
+ }
+
+ /**
+ * Returns this value as degrees.
+ * @return This value as degrees.
+ */
+ public abstract double asDegrees();
+
+ /**
+ * 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 procureInstance(final String input) {
+ final Matcher matcher = NUMBER_AND_UNITS_PATTERN.matcher(input);
+ if (! matcher.matches()) {
+ return null;
+ }
+ final String numericPart = matcher.group(1);
+ final String unitsPart = matcher.group(2);
+
+ final BigDecimal numeric;
+ try {
+ numeric = new BigDecimal(numericPart);
+ } catch (final NumberFormatException e) {
+ return null;
+ }
+
+ switch (unitsPart) {
+ case "deg": return new DtAngle_Degrees(numeric);
+ case "grad": return new DtAngle_Grads(numeric);
+ case "rad": return new DtAngle_Radians(numeric);
+ }
+ return null;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Degrees.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Degrees.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Degrees.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Degrees.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -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.fo.datatype;
+
+import java.math.BigDecimal;
+
+/**
+ * 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 BigDecimal value;
+
+ /**
+ * Constructor.
+ * @param value The signed angle value.
+ */
+ public DtAngle_Degrees(final BigDecimal value) {
+ this.value = value;
+ }
+
+ @Override
+ public double asDegrees() {
+ return this.value.doubleValue();
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Grads.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Grads.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Grads.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Grads.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -0,0 +1,57 @@
+/*
+ * 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.fo.datatype;
+
+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.
+ */
+public final class DtAngle_Grads extends DtAngle {
+
+ /** The signed number value. Stored locally to ensure immutability. */
+ private BigDecimal value;
+
+ /**
+ * Constructor.
+ * @param value The signed angle value.
+ */
+ public DtAngle_Grads(final BigDecimal value) {
+ this.value = value;
+ }
+
+ @Override
+ public double asDegrees() {
+ return value.doubleValue() * NumericConstants.DEGREES_PER_CIRCLE / NumericConstants.GRADS_PER_CIRCLE;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Radians.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtAngle_Radians.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Radians.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtAngle_Radians.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -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.fo.datatype;
+
+import java.math.BigDecimal;
+
+/**
+ * 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 BigDecimal value;
+
+ /**
+ * Constructor.
+ * @param value The signed angle value.
+ */
+ public DtAngle_Radians(final BigDecimal value) {
+ this.value = value;
+ }
+
+ @Override
+ public double asDegrees() {
+ return Math.toDegrees(this.value.doubleValue());
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtBorderStyle.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderStyle.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtBorderStyle.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtBorderStyle.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -0,0 +1,151 @@
+/*
+ * 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.fo.datatype;
+
+import org.foray.fotree.fo.FoKeyword;
+import org.foray.fotree.value.PvKeyword;
+
+import org.axsl.value.BorderStyle;
+
+/**
+ * Pseudo-datatype wrapper for the axsl {@link BorderStyle} enumeration that
+ * conforms to the PropertyValue interface.
+ * Instances of this class are immutable and are therefore treated as a group
+ * of singletons, one for each possible keyword value.
+ * @see "XSL-FO Recommendation 1.1, Section 7.8.20."
+ */
+public final class DtBorderStyle extends PvKeyword {
+
+ /** Array of valid keywords that can be used to designate a border-style. */
+ public static final FoKeyword[] VALID_KEYWORDS = {
+ FoKeyword.NONE,
+ FoKeyword.HIDDEN,
+ FoKeyword.DOTTED,
+ FoKeyword.DASHED,
+ FoKeyword.SOLID,
+ FoKeyword.DOUBLE,
+ FoKeyword.GROOVE,
+ FoKeyword.RIDGE,
+ FoKeyword.INSET,
+ FoKeyword.OUTSET,
+ };
+
+ /** Array of the instances of this class. */
+ private static DtBorderStyle[] keywords = new DtBorderStyle[
+ DtBorderStyle.VALID_KEYWORDS.length];
+
+ /** The encapsulated keyword enumeration. */
+ private BorderStyle value;
+
+ /**
+ * Private constructor. Use {@link #getInstance(FoKeyword)} to obtain an instance of this class.
+ * @param value The keyword enumeration value to encapsulate in this object.
+ */
+ private DtBorderStyle(final BorderStyle value) {
+ this.value = value;
+ }
+
+ /**
+ * Return the BorderStyle instance.
+ * @return The BorderStyle instance.
+ */
+ public BorderStyle getValue() {
+ return this.value;
+ }
+
+ /**
+ * Indicates whether a given property value qualifies as a border-style
+ * property.
+ * @param foValue The property value to be tested.
+ * @return True if and only if the property qualifies as a border-style property.
+ */
+ public static boolean isBorderStyle(final FoKeyword foValue) {
+ return getIndex(foValue) > -1;
+ }
+
+ /**
+ * Converts an {@link FoKeyword} border-style value to the more generic
+ * {@link BorderStyle} value.
+ * @param foBorderStyle The raw FO border style to be converted.
+ * @return The matching BorderStyle instance.
+ */
+ private static BorderStyle convertBorderStyle(final FoKeyword foBorderStyle) {
+ switch (foBorderStyle) {
+ case NONE: return BorderStyle.NONE;
+ case HIDDEN: return BorderStyle.HIDDEN;
+ case DOTTED: return BorderStyle.DOTTED;
+ case DASHED: return BorderStyle.DASHED;
+ case SOLID: return BorderStyle.SOLID;
+ case DOUBLE: return BorderStyle.DOUBLE;
+ case GROOVE: return BorderStyle.GROOVE;
+ case RIDGE: return BorderStyle.RIDGE;
+ case INSET: return BorderStyle.INSET;
+ case OUTSET: return BorderStyle.OUTSET;
+ default: throw new IllegalArgumentException("Illegal border style: "
+ + foBorderStyle.getText());
+ }
+ }
+
+ /**
+ * Gets or creates the singleton instance for the specific keyword value.
+ * There is no need for multiple instances of this class for the same
+ * keyword.
+ * @param value The value for which the singleton instance is needed.
+ * @return The singleton keyword instance, or null if the value is an
+ * invalid keyword index.
+ */
+ public static DtBorderStyle getInstance(final FoKeyword value) {
+ if (value == null) {
+ return null;
+ }
+ final int ordinal = getIndex(value);
+ if (DtBorderStyle.keywords[ordinal] == null) {
+ final BorderStyle borderStyle = convertBorderStyle(value);
+ DtBorderStyle.keywords[ordinal] = new DtBorderStyle(borderStyle);
+ }
+ return DtBorderStyle.keywords[ordinal];
+ }
+
+ /**
+ * Finds the index in the valid keywords to a given keyword.
+ * @param value The valid keyword value whose index is needed.
+ * @return The index to {@code value} in the valid keywords, or -1 if
+ * it is not found.
+ */
+ private static int getIndex(final FoKeyword value) {
+ for (int i = 0; i < DtBorderStyle.VALID_KEYWORDS.length; i++) {
+ final FoKeyword foValue = DtBorderStyle.VALID_KEYWORDS[i];
+ if (value == foValue) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtBorderWidth.java (from rev 13396, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtBorderWidth.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtBorderWidth.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -0,0 +1,185 @@
+/*
+ * 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.fo.datatype;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.FoKeyword;
+import org.foray.fotree.fo.expression.Expr;
+import org.foray.fotree.value.PropertyValue;
+
+/**
+ * Pseudo-datatype for border-width, which is defined at XSL-FO Recommendation
+ * 1.1, Section 7.8.21.
+ * @see "XSL-FO Recommendation 1.1, Section 7.8.21."
+ */
+public final class DtBorderWidth extends Datatype {
+
+ /** The size, in millipoints, of a "thin" border (500 millipoints).
+ * This value is not specified in the standard, but depends on the user
+ * agent. */
+ public static final short BORDER_WIDTH_THIN = 500;
+
+ /** The size, in millipoints, of a "medium" border (1000 millipoints).
+ * This value is not specified in the standard, but depends on the user
+ * agent. */
+ public static final short BORDER_WIDTH_MEDIUM = 1000;
+
+ /** The size, in millipoints, of a "thick" border (2000 millipoints).
+ * This value is not specified in the standard, but depends on the user
+ * agent. */
+ public static final short BORDER_WIDTH_THICK = 2000;
+
+ /** Array of valid keywords, including the word "inherit". */
+ public static final FoKeyword[] VALID_KEYWORDS = {
+ FoKeyword.THIN,
+ FoKeyword.MEDIUM,
+ FoKeyword.THICK,
+ };
+
+ /** The encapsulated value. */
+ private PropertyValue value;
+
+ /**
+ * Constructor.
+ * @param value The value of this border width.
+ * @throws PropertyException If {@code value} is not a valid border
+ * width.
+ * Check {@link #isBorderWidth(PropertyValue)} first to avoid this
+ * exception.
+ * @see #isBorderWidth(PropertyValue)
+ */
+ public DtBorderWidth(final PropertyValue value) throws PropertyException {
+ if (DtBorderWidth.isBorderWidth(value)) {
+ this.value = value;
+ } else {
+ throw new PropertyException("Invalid border-width value.");
+ }
+ }
+
+ /**
+ * Returns this border-width's length, in millipoints.
+ * @param pointSize The font-size, needed for some length computations.
+ * @return This border-width's length.
+ */
+ public int getValue(final int pointSize) {
+ if (this.value.canEvalLength()) {
+ return this.value.evalLength(pointSize);
+ }
+ if (this.value.canEvalKeyword()) {
+ return this.getKeywordValue();
+ }
+ throw new IllegalStateException("Error retrieving value from "
+ + this.getClass().getName());
+ }
+
+ /**
+ * Returns the value of this border-width if its value is a keyword.
+ * @return The value of this border-width if its value is a keyword, or
+ * {@link Integer#MIN_VALUE} otherwise.
+ */
+ private int getKeywordValue() {
+ final FoKeyword foValue = Datatype.convertValueToFoValue(this.value);
+ if (foValue == null) {
+ return Integer.MIN_VALUE;
+ }
+ switch (foValue) {
+ case THIN: return DtBorderWidth.BORDER_WIDTH_THIN;
+ case MEDIUM: return DtBorderWidth.BORDER_WIDTH_MEDIUM;
+ case THICK: return DtBorderWidth.BORDER_WIDTH_THICK;
+ default: return Integer.MIN_VALUE;
+ }
+ }
+
+ /**
+ * Indicates whether a given property value qualifies as a border-width
+ * property.
+ * @param value The property value to be tested.
+ * @return True if and only if the property qualifies as a border-width property.
+ */
+ public static boolean isBorderWidth(final PropertyValue value) {
+ if (value == null) {
+ throw new NullPointerException("DtBorderWidth value cannot be null");
+ }
+ if (value.canEvalLength()) {
+ return true;
+ }
+ final FoKeyword foValue = Datatype.convertValueToFoValue(value);
+ if (foValue == null) {
+ return false;
+ }
+ switch (foValue) {
+ case THIN:
+ case THICK:
+ case MEDIUM: {
+ return true;
+ }
+ default: {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public boolean canEvalNumber() {
+ return true;
+ }
+
+ @Override
+ public Number evalNumber() {
+ if (this.value.canEvalNumber()) {
+ return this.value.evalNumber();
+ }
+ return this.getKeywordValue();
+ }
+
+ @Override
+ public byte getUnitPower() {
+ return Expr.UNIT_POWER_LENGTH;
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ return true;
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ return getValue(pointSize);
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ if (this.value.canEvalLength()) {
+ return this.value.lengthRequiresFontSize();
+ }
+ /* It is a keyword, which has a fixed value.*/
+ return false;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtCharacter.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtCharacter.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtCharacter.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtCharacter.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004 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.fo.datatype;
+
+/**
+ * A "character" datatype in XSL-FO.
+ */
+public class DtCharacter extends Datatype {
+
+ /** The character value, stored as a Unicode code point. */
+ private int value = 0;
+
+ /**
+ * Constructor.
+ * @param value The char value.
+ */
+ public DtCharacter(final int value) {
+ this.value = value;
+ }
+
+ /**
+ * Returns the value.
+ * @return The value, a Unicode code point.
+ */
+ public int getValue() {
+ return this.value;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtColor.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtColor.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtColor.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/datatype/DtColor.java 2025-04-13 23:22:48 UTC (rev 13397)
@@ -0,0 +1,768 @@
+/*
+ * Copyright 2004 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.fo.datatype;
+
+import org.foray.fotree.PropertyException;
+
+import org.axsl.constants.NumericConstants;
+import org.axsl.constants.PrimitiveConstants;
+
+import java.awt.Color;
+import java.awt.color.ColorSpace;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * <p>A "color" property datatype in XSL-FO. See XSL-FO Std. 1.0, Sec. 5.11.</p>
+ *
+ * <p>To prevent creation of multiple instances for the same underlying color,
+ * the constructor is private.
+ * To obtain an instance, use one of the following static methods instead:
+ * {@link #makeDtColor(String)}, {@link #makeDtColor(Color)}, or
+ * {@link #makeDtColor(float, float, float, float)}.</p>
+ */
+public final class DtColor extends Datatype {
+
+ /** A standard transparent color. */
+ public static final Color COLOR_RGB_TRANSPARENT = new Color(255, 255, 255,
+ 0);
+
+ /** Constant indicating the number of components in the sRGB color space. */
+ public static final byte SRGB_COMPONENTS = (byte) ColorSpace.getInstance(
+ ColorSpace.CS_sRGB).getNumComponents();
+
+ /** Constant indicating the index to the Red component in the sRGB color
+ * space. */
+ public static final byte SRGB_RED_COMPONENT = 0;
+
+ /** Constant indicating the index to the Green component in the sRGB color
+ * space. */
+ public static final byte SRGB_GREEN_COMPONENT = 1;
+
+ /** Constant indicating the index to the Blue component in the sRGB color
+ * space. */
+ public static final byte SRGB_BLUE_COMPONENT = 2;
+
+ /** Constant indicating the index to the Alpha component in the sRGB color
+ * space. */
+ public static final byte SRGB_ALPHA_COMPONENT = 3;
+
+ /** The expected number of color instances, that is, the amount by which
+ * the list of color instances should be sized. */
+ private static final int EXPECTED_QTY_COLORS_USED = 20;
+
+ /** The length, in characters, of a String indicating an RGB color in
+ * #RGB format. */
+ private static final int RGB_SHORT_LENGTH = 4;
+
+ /** The length, in characters, of a String indicating an RGB color in
+ * #RRGGBB format. */
+ private static final int RGB_LONG_LENGTH = 7;
+
+ /**
+ * Alphabetical list of named colors supported by XSL-FO.
+ * The list is kept in alphabetical order to facilitate binary searches.
+ * (There are only 16 items now, but that may grow in the future).
+ * The list of these colors is found in XSL-FO 1.0, Section 5.11, in the
+ * description of the "color" datatype.
+ */
+ private static final String[] NAMES = {
+ "aqua",
+ "black",
+ "blue",
+ "fuchsia",
+ "gray",
+ "green",
+ "lime",
+ "maroon",
+ "navy",
+ "olive",
+ "purple",
+ "red",
+ "silver",
+ "teal",
+ "white",
+ "yellow",
+ };
+
+ /**
+ * Keep this list in the same order as the name list above (i.e.
+ * alphabetical, to facilitate binary searches.
+ * See the <a href="http://www.w3.org/TR/CSS21/syndata.html#color-units">CSS
+ * color definitions</a> for what we think is the authoritative source of
+ * the color values.
+ */
+ private static final DtColor[] VALS = {
+ makeDtColor(new Color(0, 255, 255)), // aqua
+ makeDtColor(Color.BLACK), // black
+ makeDtColor(Color.BLUE), // blue
+ makeDtColor(new Color(255, 0, 255)), // fuchsia
+ makeDtColor(Color.GRAY), // gray
+ /* Don't use the Java Color.GREEN. It is 0, 255, 0. */
+ makeDtColor(new Color(0, 128, 0)), // green
+ /* Use Java Color.GREEN, which is the specified 0, 255, 0. */
+ makeDtColor(Color.GREEN), // lime
+ makeDtColor(new Color(128, 0, 0)), // maroon
+ makeDtColor(new Color(0, 0, 128)), // navy
+ makeDtColor(new Color(128, 128, 0)), // olive
+ makeDtColor(new Color(128, 0, 128)), // purple
+ makeDtColor(Color.RED), // red
+ makeDtColor(new Color(192, 192, 192)), // silver
+ makeDtColor(new Color(0, 128, 128)), // teal
+ makeDtColor(Color.WHITE), // white
+ makeDtColor(Color.YELLOW), // yellow
+ };
+
+ /**
+ * Alphabetical list of additional named colors, not supported directly
+ * by XSL-FO, but available to FOray users through the system-color()
+ * function.
+ * The list is kept in alphabetical order to facilitate binary searches.
+ * NOTE: We do not know the source of these color definitions.
+ */
+ private static final String[] SECONDARY_NAMES = {
+ "aliceblue",
+ "antiquewhite",
+ "aquamarine",
+ "azure",
+ "beige",
+ "bisque",
+ "blanchedalmond",
+ "blueviolet",
+ "brown",
+ "burlywood",
+ "cadetblue",
+ "chartreuse",
+ "chocolate",
+ "coral",
+ "cornflowerblue",
+ "cornsilk",
+ "crimson",
+ "cyan",
+ "darkblue",
+ "darkcyan",
+ "darkgoldenrod",
+ "darkgray",
+ "darkgreen",
+ "darkgrey",
+ "darkkhaki",
+ "darkmagenta",
+ "darkolivegreen",
+ "darkorange",
+ "darkorchid",
+ "darkred",
+ "darksalmon",
+ "darkseagreen",
+ "darkslateblue",
+ "darkslategray",
+ "darkslategrey",
+ "darkturquoise",
+ "darkviolet",
+ "deeppink",
+ "deepskyblue",
+ "dimgray",
+ "dimgrey",
+ "dodgerblue",
+ "firebrick",
+ "floralwhite",
+ "forestgreen",
+ "gainsboro",
+ "ghostwhite",
+ "gold",
+ "goldenrod",
+ "greenyellow",
+ "grey",
+ "honeydew",
+ "hotpink",
+ "indianred",
+ "indigo",
+ "ivory",
+ "khaki",
+ "lavender",
+ "lavenderblush",
+ "lawngreen",
+ "lemonchiffon",
+ "lightblue",
+ "lightcoral",
+ "lightcyan",
+ "lightgoldenrodyellow",
+ "lightgray",
+ "lightgreen",
+ "lightgrey",
+ "lightpink",
+ "lightsalmon",
+ "lightseagreen",
+ "lightskyblue",
+ "lightslategray",
+ "lightslategrey",
+ "lightsteelblue",
+ "lightyellow",
+ "limegreen",
+ "linen",
+ "magenta",
+ "mediumaquamarine",
+ "mediumblue",
+ "mediumorchid",
+ "mediumpurple",
+ "mediumseagreen",
+ "mediumslateblue",
+ "mediumspringgreen",
+ "mediumturquoise",
+ "mediumvioletred",
+ "midnightblue",
+ "mintcream",
+ "mistyrose",
+ "moccasin",
+ "navajowhite",
+ "oldlace",
+ "olivedrab",
+ "orange",
+ "orangered",
+ "orchid",
+ "palegoldenrod",
+ "palegreen",
+ "paleturquoise",
+ "palevioletred",
+ "papayawhip",
+ "peachpuff",
+ "peru",
+ "pink",
+ "plum",
+ "powderblue",
+ "rosybrown",
+ "royalblue",
+ "saddlebrown",
+ "salmon",
+ "sandybrown",
+ "seagreen",
+ "seashell",
+ "sienna",
+ "skyblue",
+ "slateblue",
+ "slategray",
+ "slategrey",
+ "snow",
+ "springgreen",
+ "steelblue",
+ "tan",
+ "thistle",
+ "tomato",
+ "turquoise",
+ "violet",
+ "wheat",
+ "whitesmoke",
+ "yellowgreen",
+ };
+
+ /**
+ * Here are the RGB values for a bunch of other colors, listed in
+ * alphabetical order, that are not supported by XSL-FO. They are retained
+ * here for reference purposes only, and in case these named colors are
+ * added to the standard in the future. We do not know the source of these
+ * color definitions.
+ */
+ private static final DtColor[] SECONDARY_VALS = {
+ makeDtColor(new Color(240, 248, 255)), // aliceblue
+ makeDtColor(new Color(250, 235, 215)), // antiquewhite
+ makeDtColor(new Color(127, 255, 212)), // aquamarine
+ makeDtColor(new Color(240, 255, 255)), // azure
+ makeDtColor(new Color(245, 245, 220)), // beige
+ makeDtColor(new Color(255, 228, 196)), // bisque
+ makeDtColor(new Color(255, 235, 205)), // blanchedalmond
+ makeDtColor(new Color(138, 43, 226)), // blueviolet
+ makeDtColor(new Color(165, 42, 42)), // brown
+ makeDtColor(new Color(222, 184, 135)), // burlywood
+ makeDtColor(new Color(95, 158, 160)), // cadetblue
+ makeDtColor(new Color(127, 255, 0)), // chartreuse
+ makeDtColor(new Color(210, 105, 30)), // chocolate
+ makeDtColor(new Color(255, 127, 80)), // coral
+ makeDtColor(new Color(100, 149, 237)), // cornflowerblue
+ makeDtColor(new Color(255, 248, 220)), // cornsilk
+ makeDtColor(new Color(220, 20, 60)), // crimson
+ makeDtColor(new Color(0, 255, 255)), // cyan
+ makeDtColor(new Color(0, 0, 139)), // darkblue
+ makeDtColor(new Color(0, 139, 139)), // darkcyan
+ makeDtColor(new Color(184, 134, 11)), // darkgoldenrod
+ makeDtColor(new Color(169, 169, 169)), // darkgray
+ makeDtColor(new Color(0, 100, 0)), // darkgreen
+ makeDtColor(new Color(169, 169, 169)), // darkgrey
+ makeDtColor(new Color(189, 183, 107)), // darkkhaki
+ makeDtColor(new Color(139, 0, 139)), // darkmagenta
+ makeDtColor(new Color(85, 107, 47)), // darkolivegreen
+ makeDtColor(new Color(255, 140, 0)), // darkorange
+ makeDtColor(new Color(153, 50, 204)), // darkorchid
+ makeDtColor(new Color(139, 0, 0)), // darkred
+ makeDtColor(new Color(233, 150, 122)), // darksalmon
+ makeDtColor(new Color(143, 188, 143)), // darkseagreen
+ makeDtColor(new Color(72, 61, 139)), // darkslateblue
+ makeDtColor(new Color(47, 79, 79)), // darkslategray
+ makeDtColor(new Color(47, 79, 79)), // darkslategrey
+ makeDtColor(new Color(0, 206, 209)), // darkturquoise
+ makeDtColor(new Color(148, 0, 211)), // darkviolet
+ makeDtColor(new Color(255, 20, 147)), // deeppink
+ makeDtColor(new Color(0, 191, 255)), // deepskyblue
+ makeDtColor(new Color(105, 105, 105)), // dimgray
+ makeDtColor(new Color(105, 105, 105)), // dimgrey
+ makeDtColor(new Color(30, 144, 255)), // dodgerblue
+ makeDtColor(new Color(178, 34, 34)), // firebrick
+ makeDtColor(new Color(255, 250, 240)), // floralwhite
+ makeDtColor(new Color(34, 139, 34)), // forestgreen
+ makeDtColor(new Color(220, 220, 220)), // gainsboro
+ makeDtColor(new Color(248, 248, 255)), // ghostwhite
+ makeDtColor(new Color(255, 215, 0)), // gold
+ makeDtColor(new Color(218, 165, 32)), // goldenrod
+ makeDtColor(new Color(173, 255, 47)), // greenyellow
+ makeDtColor(new Color(128, 128, 128)), // grey
+ makeDtColor(new Color(240, 255, 240)), // honeydew
+ makeDtColor(new Color(255, 105, 180)), // hotpink
+ makeDtColor(new Color(205, 92, 92)), // indianred
+ makeDtColor(new Color(75, 0, 130)), // indigo
+ makeDtColor(new Color(255, 255, 240)), // ivory
+ makeDtColor...
[truncated message content] |
|
From: <vic...@us...> - 2025-04-13 23:16:57
|
Revision: 13396
http://sourceforge.net/p/foray/code/13396
Author: victormote
Date: 2025-04-13 23:16:37 +0000 (Sun, 13 Apr 2025)
Log Message:
-----------
Move XSL-FO expression classes to their own package.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbs.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnCeiling.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFloor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMax.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnProportionalColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgb.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgbIcc.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRound.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/Function.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/Datatype.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/PropertyValue.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnCeilingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFloorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromPageMasterRegionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromParentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromTableColumnTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnInheritedPropertyValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMaxTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMergePropertyValuesTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMinTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnProportionalColumnWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRgbIccTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRgbTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRoundTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnSystemColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnSystemFontTests.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/Expr.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprAdditive.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprAdditiveOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprInner.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprMultiplicative.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprMultiplicativeOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprPrimary.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprUnary.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprUnaryOper.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/package-info.java
Removed 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/ExprAdditive.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/ExprMultiplicative.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/ExprPrimary.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnary.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/Expr.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/Expr.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/Expr.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+import org.foray.fotree.value.PropertyValue;
+
+/**
+ * Abstract Base Class for all Expressions.
+ */
+public abstract class Expr implements PropertyValue {
+
+ /** Constant indicating an add operation. */
+ public static final byte OPERATION_ADD = '+';
+
+ /** Constant indicating a subtract operation. */
+ public static final byte OPERATION_SUBTRACT = '-';
+
+ /** Constant indicating a multiplication operation. */
+ public static final byte OPERATION_MULTIPLY = '*';
+
+ /** Constant indicating a division operation. */
+ public static final byte OPERATION_DIVIDE = '/';
+
+ /** Constant indicating a modulo or remainder operation. */
+ public static final byte OPERATION_MOD = '%';
+
+ /** Constant indicating a negation operation. */
+ public static final byte OPERATION_NEGATION = '-';
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprAdditive.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditive.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprAdditive.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprAdditive.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+/**
+ * Class for handling AdditiveExpr.
+ */
+public abstract class ExprAdditive extends Expr {
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprAdditiveOper.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprAdditiveOper.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprAdditiveOper.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+import org.foray.fotree.PropertyException;
+
+/**
+ * Class for handling AdditiveExpr.
+ */
+public class ExprAdditiveOper extends ExprAdditive {
+
+ /** The first operand in this expression. */
+ private ExprAdditive operand1;
+
+ /** The second operand in this expression. */
+ private ExprMultiplicative operand2;
+
+ /** The operation in this expression. */
+ private byte operation;
+
+ /**
+ * Constructor.
+ * @param operand1 The first operand in this expression.
+ * @param operand2 The second operand in this expression.
+ * @param operation The operation in this expression.
+ * @throws PropertyException For invalid operands or operation.
+ */
+ public ExprAdditiveOper(final ExprAdditive operand1,
+ final ExprMultiplicative operand2,
+ final byte operation) throws PropertyException {
+ if (! (operand1.canEvalNumber())) {
+ throw new PropertyException("AdditiveExpr: Non-numeric operand: "
+ + operand1.toString());
+ }
+ this.operand1 = operand1;
+ if (! (operand2.canEvalNumber())) {
+ throw new PropertyException("AdditiveExpr: Non-numeric operand: "
+ + operand2.toString());
+ }
+ this.operand2 = operand2;
+ /*
+ * 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()) {
+ throw new PropertyException("AdditiveExpr: Unit powers differ: "
+ + operand1.toString() + ", " + operand2.toString());
+ }
+ if (operation != Expr.OPERATION_ADD
+ && operation != Expr.OPERATION_SUBTRACT) {
+ throw new PropertyException("AdditiveExpr: Illegal Operator: "
+ + operation);
+ }
+ this.operation = operation;
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ /* In the constructor, we have already tested the equality of the
+ * operands unit power. Therefore, we can just evaluate one here. */
+ return this.operand1.canEvalLength();
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ switch (this.operation) {
+ case Expr.OPERATION_ADD: {
+ return getOperand1Length(pointSize)
+ + getOperand2Length(pointSize);
+ }
+ case Expr.OPERATION_SUBTRACT: {
+ return getOperand1Length(pointSize)
+ - getOperand2Length(pointSize);
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ return this.operand1.lengthRequiresFontSize()
+ || this.operand2.lengthRequiresFontSize();
+ }
+
+ @Override
+ public byte getUnitPower() {
+ /* We already tested that the unit powers were equal at construction,
+ * so all we need to do here is return one of them. */
+ return this.operand1.getUnitPower();
+ }
+
+ /**
+ * Returns the numeric value of the first operand.
+ * @return The numeric value of the first operand.
+ */
+ private Number getOperand1Value() {
+ return this.operand1.evalNumber();
+ }
+
+ /**
+ * Returns the numeric value of the second operand.
+ * @return The numeric value of the second operand.
+ */
+ private Number getOperand2Value() {
+ return this.operand2.evalNumber();
+ }
+
+ /**
+ * Returns the length value of the first operand.
+ * @param pointSize The point size, in millipoints, of the font.
+ * This is used in calculations that are relative to the point size.
+ * @return The length value of the first operand.
+ */
+ private int getOperand1Length(final int pointSize) {
+ return this.operand1.evalLength(pointSize);
+ }
+
+ /**
+ * Returns the length value of the second operand.
+ * @param pointSize The point size, in millipoints, of the font.
+ * This is used in calculations that are relative to the point size.
+ * @return The length value of the second operand.
+ */
+ private int getOperand2Length(final int pointSize) {
+ return this.operand2.evalLength(pointSize);
+ }
+
+ @Override
+ public boolean canEvalNumber() {
+ return true;
+ }
+
+ @Override
+ public Number evalNumber() {
+ switch (this.operation) {
+ case Expr.OPERATION_ADD: {
+ return getOperand1Value().doubleValue() + getOperand2Value().doubleValue();
+ }
+ case Expr.OPERATION_SUBTRACT: {
+ return getOperand1Value().doubleValue() - getOperand2Value().doubleValue();
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return this.operand1.canEvalPercentage()
+ && this.operand2.canEvalPercentage();
+ }
+
+ @Override
+ public Number evalPercentage() {
+ switch (this.operation) {
+ case Expr.OPERATION_ADD: {
+ return this.operand1.evalPercentage().doubleValue() + this.operand2.evalPercentage().doubleValue();
+ }
+ case Expr.OPERATION_SUBTRACT: {
+ return this.operand1.evalPercentage().doubleValue() - this.operand2.evalPercentage().doubleValue();
+ }
+ }
+ return 0;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprInner.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprInner.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprInner.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprInner.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+import org.foray.fotree.value.PvKeyword;
+
+import java.awt.Color;
+
+/**
+ * Class representing nested expressions. Specifically, in XSL-FO Standard,
+ * Section 5.9.3, it is the first item listed under grammar item [2]
+ * "PrimaryExpr".
+ */
+public class ExprInner extends ExprPrimary {
+
+ /** The wrapped expression. */
+ private ExprAdditive enclosedExpression;
+
+ /**
+ * Constructor.
+ * @param expression The expression to be wrapped inside this one.
+ */
+ public ExprInner(final ExprAdditive expression) {
+ this.enclosedExpression = expression;
+ }
+
+ /**
+ * Returns the wrapped expression.
+ * @return The wrapped expression.
+ */
+ public ExprAdditive getEnclosedExpression() {
+ return this.enclosedExpression;
+ }
+
+ @Override
+ public boolean canEvalNumber() {
+ return this.getEnclosedExpression().canEvalNumber();
+ }
+
+ @Override
+ public Number evalNumber() {
+ return this.getEnclosedExpression().evalNumber();
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ return this.getEnclosedExpression().canEvalLength();
+ }
+
+ @Override
+ public byte getUnitPower() {
+ return this.getEnclosedExpression().getUnitPower();
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ return this.getEnclosedExpression().evalLength(pointSize);
+ }
+
+ @Override
+ public boolean canEvalColor() {
+ return this.getEnclosedExpression().canEvalColor();
+ }
+
+ @Override
+ public Color evalColor() {
+ return this.getEnclosedExpression().evalColor();
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ return this.getEnclosedExpression().lengthRequiresFontSize();
+ }
+
+ @Override
+ public boolean canEvalInteger() {
+ return this.getEnclosedExpression().canEvalInteger();
+ }
+
+ @Override
+ public int evalInteger() {
+ return this.getEnclosedExpression().evalInteger();
+ }
+
+ @Override
+ public boolean canEvalKeyword() {
+ return this.getEnclosedExpression().canEvalKeyword();
+ }
+
+ @Override
+ public PvKeyword evalKeyword() {
+ return this.getEnclosedExpression().evalKeyword();
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return this.getEnclosedExpression().canEvalPercentage();
+ }
+
+ @Override
+ public Number evalPercentage() {
+ return this.getEnclosedExpression().evalPercentage();
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprMultiplicative.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicative.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprMultiplicative.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprMultiplicative.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+/**
+ * Abstract superclass for multiplicative expressions.
+ */
+public abstract class ExprMultiplicative extends ExprAdditive {
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprMultiplicativeOper.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprMultiplicativeOper.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprMultiplicativeOper.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprMultiplicativeOper.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,246 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+import org.foray.fotree.PropertyException;
+
+/**
+ * Multiplicative operation.
+ */
+public class ExprMultiplicativeOper extends ExprMultiplicative {
+
+ /** The first operand in this expression. */
+ private ExprMultiplicative operand1;
+
+ /** The second operand in this expression. */
+ private ExprUnary operand2;
+
+ /** The operation in this expression. */
+ private byte operation;
+
+ /**
+ * Constructor.
+ * @param operand1 The first operand in this expression.
+ * @param operand2 The second operand in this expression.
+ * @param operation The operation in this expression.
+ * @throws PropertyException If either operand is non-numeric, or if their
+ * unit powers are different, or if the operation is invalid.
+ */
+ public ExprMultiplicativeOper(final ExprMultiplicative operand1,
+ final ExprUnary operand2, final byte operation)
+ throws PropertyException {
+ if (! (operand1.canEvalNumber())) {
+ throw new PropertyException(this.getClass().getName()
+ + ": Non-numeric operand: " + operand1.toString());
+ }
+ this.operand1 = operand1;
+ if (! (operand2.canEvalNumber())) {
+ throw new PropertyException(this.getClass().getName()
+ + "Non-numeric operand: " + operand2.toString());
+ }
+ this.operand2 = operand2;
+ /*
+ * For Modulo Expressions, the unitPower of the two operands must
+ * be equal. See XSL-FO Specification 1.0, Section 5.9.6.
+ */
+ if (operation == Expr.OPERATION_MOD
+ && operand1.getUnitPower()
+ != operand2.getUnitPower()) {
+ throw new PropertyException("Modulo Operator: Unit powers differ: "
+ + operand1.toString() + ", " + operand2.toString());
+ }
+ if (operation != Expr.OPERATION_MULTIPLY
+ && operation != Expr.OPERATION_DIVIDE
+ && operation != Expr.OPERATION_MOD) {
+ throw new PropertyException("MultiplicativeExpr: Illegal Operator: "
+ + operation);
+ }
+ this.operation = operation;
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ if (this.operand1.canEvalLength()
+ || this.operand2.canEvalLength()) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ // Compute raw value for operand1
+ Number rawOperand1 = 0;
+ if (getOperand1UnitPower() == 1) {
+ rawOperand1 = getOperand1Length(pointSize);
+ } else {
+ /* Capability verified during construction. */
+ rawOperand1 = this.operand1.evalNumber();
+ }
+
+ // Compute raw value for operand2
+ Number rawOperand2 = 0;
+ if (getOperand2UnitPower() == 1) {
+ rawOperand2 = getOperand2Length(pointSize);
+ } else {
+ rawOperand2 = this.operand2.evalNumber();
+ }
+
+ Number rawValue = 0;
+ switch (this.operation) {
+ case (byte) '*': {
+ rawValue = rawOperand1.doubleValue() * rawOperand2.doubleValue();
+ break;
+ }
+ case (byte) '/': {
+ rawValue = rawOperand1.doubleValue() / rawOperand2.doubleValue();
+ break;
+ }
+ case (byte) '%': {
+ rawValue = rawOperand1.doubleValue() % rawOperand2.doubleValue();
+ break;
+ }
+ }
+ return (int) Math.round(rawValue.doubleValue());
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ return this.operand1.lengthRequiresFontSize()
+ || this.operand2.lengthRequiresFontSize();
+ }
+
+ /**
+ * Returns the numeric value of the first operand.
+ * @return The numeric value of the first operand.
+ */
+ private Number getOperand1Value() {
+ return this.operand1.evalNumber();
+ }
+
+ /**
+ * Returns the numeric value of the second operand.
+ * @return The numeric value of the second operand.
+ */
+ private Number getOperand2Value() {
+ return this.operand2.evalNumber();
+ }
+
+ /**
+ * Returns the unit power of the first operand.
+ * @return The unit power of the first operand.
+ */
+ private byte getOperand1UnitPower() {
+ return this.operand1.getUnitPower();
+ }
+
+ /**
+ * Returns the unit power of the second operand.
+ * @return The unit power of the second operand.
+ */
+ private byte getOperand2UnitPower() {
+ return this.operand2.getUnitPower();
+ }
+
+ /**
+ * Returns the length value of the first operand.
+ * @param pointSize The point size, in millipoints, of the font.
+ * This is used in calculations that are relative to the point size.
+ * @return The length value of the first operand.
+ */
+ private int getOperand1Length(final int pointSize) {
+ return this.operand1.evalLength(pointSize);
+ }
+
+ /**
+ * Returns the length value of the second operand.
+ * @param pointSize The point size, in millipoints, of the font.
+ * This is used in calculations that are relative to the point size.
+ * @return The length value of the second operand.
+ */
+ private int getOperand2Length(final int pointSize) {
+ return this.operand2.evalLength(pointSize);
+ }
+
+ @Override
+ public byte getUnitPower() {
+ /* For multiplication, the unit power of the product is the sum
+ * of the unit powers of the operands.
+ * For example, 3 meters * 5 = 15 meters.
+ * The first operand has a unit power of 1, the second has a unit power
+ * 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());
+ }
+
+ @Override
+ public boolean canEvalNumber() {
+ return true;
+ }
+
+ @Override
+ public Number evalNumber() {
+ switch (this.operation) {
+ case Expr.OPERATION_MULTIPLY: {
+ return getOperand1Value().doubleValue() * getOperand2Value().doubleValue();
+ }
+ case Expr.OPERATION_DIVIDE: {
+ return getOperand1Value().doubleValue() / getOperand2Value().doubleValue();
+ }
+ case Expr.OPERATION_MOD: {
+ return getOperand1Value().doubleValue() % getOperand2Value().doubleValue();
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return this.operand1.canEvalPercentage()
+ && this.operand2.canEvalPercentage();
+ }
+
+ @Override
+ public Number evalPercentage() {
+ switch (this.operation) {
+ case Expr.OPERATION_MULTIPLY: {
+ return this.operand1.evalPercentage().doubleValue() * this.operand2.evalPercentage().doubleValue();
+ }
+ case Expr.OPERATION_DIVIDE: {
+ return this.operand1.evalPercentage().doubleValue() / this.operand2.evalPercentage().doubleValue();
+ }
+ case Expr.OPERATION_MOD: {
+ return this.operand1.evalPercentage().doubleValue() % this.operand2.evalPercentage().doubleValue();
+ }
+ }
+ return 0;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprPrimary.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprPrimary.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprPrimary.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprPrimary.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+/**
+ * Common superclass for all Expression types.
+ */
+public abstract class ExprPrimary extends ExprUnary {
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprUnary.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnary.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprUnary.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprUnary.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+/**
+ * Abstract superclass for unary expressions.
+ */
+public abstract class ExprUnary extends ExprMultiplicative {
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprUnaryOper.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprUnaryOper.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprUnaryOper.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/ExprUnaryOper.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2004 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.fo.expression;
+
+import org.foray.fotree.PropertyException;
+
+/**
+ * Unary operation expression.
+ */
+public class ExprUnaryOper extends ExprUnary {
+
+ /** The operand in this expression. */
+ private ExprUnary operand1;
+
+ /** The operation in this expression. */
+ private byte operation;
+
+ /**
+ * Constructor.
+ * @param operand1 The operand in this expression.
+ * @param operation The operation in this expression.
+ * @throws PropertyException If the operand is not numeric, or if the
+ * operation is illegal.
+ */
+ public ExprUnaryOper(final ExprUnary operand1, final byte operation)
+ throws PropertyException {
+ if (! (operand1.canEvalNumber())) {
+ throw new PropertyException("UnaryExpr: Non-numeric operand: "
+ + operand1.toString());
+ }
+ this.operand1 = operand1;
+ if (operation != Expr.OPERATION_NEGATION) {
+ throw new PropertyException("UnaryExpr: Illegal Operator: "
+ + operation);
+ }
+ this.operation = operation;
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ return this.operand1.canEvalLength();
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ switch (this.operation) {
+ case Expr.OPERATION_NEGATION: {
+ return this.operand1.evalLength(pointSize) * -1;
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ return this.operand1.lengthRequiresFontSize();
+ }
+
+ @Override
+ public byte getUnitPower() {
+ return this.operand1.getUnitPower();
+ }
+
+ @Override
+ public boolean canEvalNumber() {
+ return true;
+ }
+
+ @Override
+ public Number evalNumber() {
+ if (this.operation == Expr.OPERATION_NEGATION) {
+ return this.operand1.evalNumber().doubleValue() * -1;
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return this.operand1.canEvalPercentage();
+ }
+
+ @Override
+ public Number evalPercentage() {
+ if (this.operation == Expr.OPERATION_NEGATION) {
+ return this.operand1.evalPercentage().doubleValue() * -1;
+ }
+ return 0;
+ }
+
+}
Added: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/package-info.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/package-info.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/package-info.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2025 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$
+ */
+
+/**
+ * Classes supporting XSL-FO expressions.
+ * @see "XSL-FO Recommendation 1.1, Section 5.9."
+ */
+package org.foray.fotree.fo.expression;
Property changes on: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/expression/package-info.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/fo/function/FnAbs.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbs.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbs.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,7 +29,7 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
/**
* The "abs" function in XSL-FO.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -30,9 +30,9 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.expression.Expr;
import org.foray.fotree.value.DtLength;
import org.foray.fotree.value.DtLength_Points;
-import org.foray.fotree.value.Expr;
import org.axsl.constants.TypographicConstants;
import org.axsl.fotree.FoContext;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnCeiling.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnCeiling.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnCeiling.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,7 +29,7 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
/**
* The "ceiling" function in XSL-FO.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFloor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFloor.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFloor.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,7 +29,7 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
/**
* The "floor" function in XSL-FO.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -30,9 +30,9 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.expression.Expr;
import org.foray.fotree.value.DtLength;
import org.foray.fotree.value.DtLength_Points;
-import org.foray.fotree.value.Expr;
import org.axsl.constants.TypographicConstants;
import org.axsl.fotree.FoContext;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMax.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMax.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMax.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,7 +29,7 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
/**
* The "max" function in XSL-FO.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMin.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMin.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMin.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,7 +29,7 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
/**
* The "min" function in XSL-FO.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnProportionalColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnProportionalColumnWidth.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnProportionalColumnWidth.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -30,8 +30,8 @@
import org.foray.fotree.FoObj;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.expression.Expr;
import org.foray.fotree.fo.obj.TableColumn4a;
-import org.foray.fotree.value.Expr;
import org.axsl.fotree.fo.Table;
import org.axsl.value.TableLayout;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgb.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgb.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgb.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,7 +29,7 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
import org.axsl.constants.PrimitiveConstants;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgbIcc.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgbIcc.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgbIcc.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,8 +29,8 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.expression.Expr;
import org.foray.fotree.value.DtName;
-import org.foray.fotree.value.Expr;
import org.axsl.constants.PrimitiveConstants;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRound.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRound.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRound.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,7 +29,7 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
/**
* The "round" function in XSL-FO.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemColor.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemColor.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemColor.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -29,9 +29,9 @@
package org.foray.fotree.fo.function;
import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.expression.Expr;
import org.foray.fotree.value.DtColor;
import org.foray.fotree.value.DtName;
-import org.foray.fotree.value.Expr;
import java.awt.Color;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemFont.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemFont.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemFont.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -32,8 +32,8 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyId;
import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.fo.expression.Expr;
import org.foray.fotree.value.DtName;
-import org.foray.fotree.value.Expr;
import org.foray.fotree.value.PropertyValue;
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/Function.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/Function.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/Function.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -32,9 +32,9 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyId;
import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.fo.expression.Expr;
+import org.foray.fotree.fo.expression.ExprPrimary;
import org.foray.fotree.value.DtName;
-import org.foray.fotree.value.Expr;
-import org.foray.fotree.value.ExprPrimary;
/**
* Abstract superclass for all XSL-FO functions.
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdSpeechRate.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -33,7 +33,7 @@
import org.foray.fotree.fo.AbstractFoProperty;
import org.foray.fotree.fo.FoKeyword;
import org.foray.fotree.fo.FoPropertyId;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
import org.foray.fotree.value.PropertyValue;
import org.axsl.fotree.FoContext;
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdVolume.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -33,7 +33,7 @@
import org.foray.fotree.fo.AbstractFoProperty;
import org.foray.fotree.fo.FoKeyword;
import org.foray.fotree.fo.FoPropertyId;
-import org.foray.fotree.value.Expr;
+import org.foray.fotree.fo.expression.Expr;
import org.foray.fotree.value.PropertyValue;
import org.axsl.constants.NumericConstants;
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -31,6 +31,15 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.expression.Expr;
+import org.foray.fotree.fo.expression.ExprAdditive;
+import org.foray.fotree.fo.expression.ExprAdditiveOper;
+import org.foray.fotree.fo.expression.ExprInner;
+import org.foray.fotree.fo.expression.ExprMultiplicative;
+import org.foray.fotree.fo.expression.ExprMultiplicativeOper;
+import org.foray.fotree.fo.expression.ExprPrimary;
+import org.foray.fotree.fo.expression.ExprUnary;
+import org.foray.fotree.fo.expression.ExprUnaryOper;
import org.foray.fotree.fo.function.Function;
import org.foray.fotree.value.DtColor;
import org.foray.fotree.value.DtInteger;
@@ -39,15 +48,6 @@
import org.foray.fotree.value.DtNumber;
import org.foray.fotree.value.DtPercentage;
import org.foray.fotree.value.DtString;
-import org.foray.fotree.value.Expr;
-import org.foray.fotree.value.ExprAdditive;
-import org.foray.fotree.value.ExprAdditiveOper;
-import org.foray.fotree.value.ExprInner;
-import org.foray.fotree.value.ExprMultiplicative;
-import org.foray.fotree.value.ExprMultiplicativeOper;
-import org.foray.fotree.value.ExprPrimary;
-import org.foray.fotree.value.ExprUnary;
-import org.foray.fotree.value.ExprUnaryOper;
import org.foray.fotree.value.PropertyValue;
import java.util.ArrayList;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Datatype.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Datatype.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Datatype.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -30,6 +30,7 @@
import org.foray.fotree.fo.FoKeyword;
import org.foray.fotree.fo.PvKeywordFo;
+import org.foray.fotree.fo.expression.ExprPrimary;
/**
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtBorderWidth.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -30,6 +30,7 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.fo.FoKeyword;
+import org.foray.fotree.fo.expression.Expr;
/**
* Pseudo-datatype for border-width, which is defined at XSL-FO Recommendation
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtInteger.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -28,6 +28,8 @@
package org.foray.fotree.value;
+import org.foray.fotree.fo.expression.Expr;
+
/**
* An "integer" property datatype in XSL-FO.
* Members of this class are immutable.
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtLength.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -28,6 +28,8 @@
package org.foray.fotree.value;
+import org.foray.fotree.fo.expression.Expr;
+
import java.util.regex.Matcher;
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtNumber.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -28,6 +28,8 @@
package org.foray.fotree.value;
+import org.foray.fotree.fo.expression.Expr;
+
/**
* A "number" property datatype in XSL-FO.
*/
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtPercentage.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -28,6 +28,8 @@
package org.foray.fotree.value;
+import org.foray.fotree.fo.expression.Expr;
+
/**
* A "percentage" property datatype in XSL-FO.
* Instances of this class are immutable.
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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -32,6 +32,7 @@
import org.foray.fotree.PropertyException;
import org.foray.fotree.fo.FoKeyword;
import org.foray.fotree.fo.PvKeywordFo;
+import org.foray.fotree.fo.expression.Expr;
import org.axsl.value.Conditionality;
Deleted: 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 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Expr.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -1,54 +0,0 @@
-/*
- * Copyright 2004 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 Base Class for all Expressions.
- */
-public abstract class Expr implements PropertyValue {
-
- /** Constant indicating an add operation. */
- public static final byte OPERATION_ADD = '+';
-
- /** Constant indicating a subtract operation. */
- public static final byte OPERATION_SUBTRACT = '-';
-
- /** Constant indicating a multiplication operation. */
- public static final byte OPERATION_MULTIPLY = '*';
-
- /** Constant indicating a division operation. */
- public static final byte OPERATION_DIVIDE = '/';
-
- /** Constant indicating a modulo or remainder operation. */
- public static final byte OPERATION_MOD = '%';
-
- /** Constant indicating a negation operation. */
- public static final byte OPERATION_NEGATION = '-';
-
-}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditive.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditive.java 2025-04-13 23:10:19 UTC (rev 13395)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditive.java 2025-04-13 23:16:37 UTC (rev 13396)
@@ -1,36 +0,0 @@
-/*
- * Copyright 2004 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;
-
-/**
- * Class for handling AdditiveExpr.
- */
-public abstract class ExprAdditive extends Expr {
-
-}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/ExprAdditiveOper.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/v...
[truncated message content] |
|
From: <vic...@us...> - 2025-04-13 23:10:38
|
Revision: 13395
http://sourceforge.net/p/foray/code/13395
Author: victormote
Date: 2025-04-13 23:10:19 +0000 (Sun, 13 Apr 2025)
Log Message:
-----------
Move XSL-FO function classes to their own package.
Modified Paths:
--------------
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/PdColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdDominantBaseline.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/prop/PdFontStretch.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnAbsTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnBodyStartTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnCeilingTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFloorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromPageMasterRegionTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromParentTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromTableColumnTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnInheritedPropertyValueTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnLabelEndTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMaxTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMergePropertyValuesTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnMinTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnProportionalColumnWidthTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRgbIccTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRgbTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnRoundTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnSystemColorTests.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnSystemFontTests.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbs.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractNamedProperty.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractNumber.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnCeiling.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFloor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromPageMasterRegion.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromParent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromTableColumn.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnInheritedPropertyValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMax.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMergePropertyValues.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMin.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnProportionalColumnWidth.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgb.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRgbIcc.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnRound.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemColor.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnSystemFont.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/Function.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/package-info.java
Removed Paths:
-------------
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/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/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/FnFromNearestSpecifiedValue.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromPageMasterRegion.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromParent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromTableColumn.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnInheritedPropertyValue.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/FnMergePropertyValues.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/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/Function.java
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbs.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbs.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbs.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbs.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.value.Expr;
+
+/**
+ * The "abs" function in XSL-FO.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.1."
+ */
+public class FnAbs extends FnAbstractNumber {
+
+ /** The operand to this function. */
+ private Expr operand1;
+
+ /**
+ * Constructor.
+ * @param arguments The arguments to this function.
+ * @throws PropertyException For errors creating this function.
+ */
+ public FnAbs(final Expr[] arguments)
+ throws PropertyException {
+ super();
+ /* There must be exactly one argument. */
+ if (arguments.length != 1) {
+ this.invalidParameters();
+ }
+ /* The argument must be numeric. */
+ if (! (arguments[0].canEvalNumber())) {
+ this.invalidParameters();
+ }
+ this.operand1 = arguments[0];
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "abs";
+ }
+
+ @Override
+ public Number evalNumber() {
+ return Math.abs(this.operand1.evalNumber().doubleValue());
+ }
+
+ @Override
+ public byte getUnitPower() {
+ return this.operand1.getUnitPower();
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ return this.operand1.canEvalLength();
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ return Math.abs(this.operand1.evalLength(pointSize));
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ return this.operand1.lengthRequiresFontSize();
+ }
+
+ @Override
+ public boolean canEvalInteger() {
+ return this.operand1.canEvalInteger();
+ }
+
+ @Override
+ public int evalInteger() {
+ return Math.abs(this.operand1.evalInteger());
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return this.operand1.canEvalPercentage();
+ }
+
+ @Override
+ public Number evalPercentage() {
+ return Math.abs(this.operand1.evalPercentage().doubleValue());
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractColor.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractColor.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractColor.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractColor.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,42 @@
+/*
+ * 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.fo.function;
+
+/**
+ * Abstract superclass for color functions.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.2."
+ */
+public abstract class FnAbstractColor extends Function {
+
+ @Override
+ public boolean canEvalColor() {
+ return true;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractNamedProperty.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNamedProperty.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractNamedProperty.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractNamedProperty.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,107 @@
+/*
+ * 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.fo.function;
+
+import org.foray.fotree.fo.FoPropertyId;
+
+import java.awt.Color;
+
+/**
+ * Abstract superclass for the "inherited-property-value", "from-parent", "from-nearest-specified-value",
+ * "from-page-master-region", and "merge-property-values" functions.
+ */
+public abstract class FnAbstractNamedProperty extends Function {
+
+ /**
+ * Returns the property type to be operated on by the subclass.
+ * @return The property type operand.
+ */
+ public abstract FoPropertyId getPropertyType();
+
+ @Override
+ public boolean canEvalNumber() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.canEvalNumber();
+ }
+
+ @Override
+ public Number evalNumber() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.evalNumber();
+ }
+
+ @Override
+ public byte getUnitPower() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.getUnitPower();
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.canEvalLength();
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ /* 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() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.canEvalColor();
+ }
+
+ @Override
+ public Color evalColor() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.evalColor();
+ }
+
+ @Override
+ public boolean canEvalInteger() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.canEvalInteger();
+ }
+
+ @Override
+ public int evalInteger() {
+ /* TODO: Fix this. It needs to pass-thru the contained type. */
+ return super.evalInteger();
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractNumber.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnAbstractNumber.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractNumber.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnAbstractNumber.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,42 @@
+/*
+ * 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.fo.function;
+
+/**
+ * Abstract superclass for number functions.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.1."
+ */
+public abstract class FnAbstractNumber extends Function {
+
+ @Override
+ public boolean canEvalNumber() {
+ return true;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnBodyStart.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnBodyStart.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.value.DtLength;
+import org.foray.fotree.value.DtLength_Points;
+import org.foray.fotree.value.Expr;
+
+import org.axsl.constants.TypographicConstants;
+import org.axsl.fotree.FoContext;
+import org.axsl.fotree.fo.ListItem;
+
+/**
+ * The "body-start" function in XSL-FO.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.4."
+ */
+public class FnBodyStart extends Function {
+
+ /**
+ * Constructor.
+ * @param arguments The arguments to this function.
+ * @throws PropertyException For errors creating this function.
+ */
+ public FnBodyStart(final Expr[] arguments) throws PropertyException {
+ super();
+ validateNoArguments(arguments);
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "body-start";
+ }
+
+ /**
+ * The computation for the value of body-start() is found in XSL-FO
+ * Standard, 1.0, Section 7.28.4.
+ * @param fobj The FoObj instance against whom this function should be
+ * evaluated.
+ * @param context An object that knows how to resolve FO context issues.
+ * @return The Numeric representation of the function value.
+ */
+ public DtLength eval(final FoObj fobj, final FoContext context) {
+ final FoObj item = fobj.getNearestListItem(null);
+ final int startIndent = item.traitStartIndent(context);
+ /* TODO: We don't know how to compute this yet. */
+ final int startIntrusionAdjustment = 0;
+ final int provisionalDistanceBetweenStarts
+ /* TODO: Not sure the parameter passed here is correct. */
+ = item.traitProvisionalDistanceBetweenStarts(context);
+
+ final int length
+ = startIndent
+ + startIntrusionAdjustment
+ + provisionalDistanceBetweenStarts;
+
+ DtLength lengthDT = null;
+ lengthDT = new DtLength_Points(length / TypographicConstants.MILLIPOINTS_PER_POINT);
+ return lengthDT;
+ }
+
+ @Override
+ public boolean isValidForObject(final FoObj fobj) {
+ final ListItem listItem = fobj.getNearestListItem(null);
+ if (listItem == null) {
+ return false;
+ }
+ return true;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnCeiling.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnCeiling.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnCeiling.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnCeiling.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.value.Expr;
+
+/**
+ * The "ceiling" function in XSL-FO.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.1."
+ */
+public class FnCeiling extends FnAbstractNumber {
+
+ /** The operand to this function. */
+ private Expr operand1;
+
+ /**
+ * Constructor.
+ * @param arguments The arguments to this function.
+ * @throws PropertyException For errors creating this function.
+ */
+ public FnCeiling(final Expr[] arguments) throws PropertyException {
+ super();
+ /* There must be exactly one argument. */
+ if (arguments.length != 1) {
+ this.invalidParameters();
+ }
+ /* The argument must be numeric. */
+ if (! (arguments[0].canEvalNumber())) {
+ this.invalidParameters();
+ }
+ this.operand1 = arguments[0];
+ /* The numeric must have a unit power of zero. */
+ if (this.operand1.getUnitPower() != Expr.UNIT_POWER_NUMERIC) {
+ this.invalidParameters();
+ }
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "ceiling";
+ }
+
+ @Override
+ public Number evalNumber() {
+ return Math.ceil(this.operand1.evalNumber().doubleValue());
+ }
+
+ @Override
+ public byte getUnitPower() {
+ /* Unit power of zero is a requirement, and is tested in the argument validation. */
+ return Expr.UNIT_POWER_NUMERIC;
+ }
+
+ @Override
+ public boolean canEvalInteger() {
+ return this.operand1.canEvalInteger();
+ }
+
+ @Override
+ public int evalInteger() {
+ return (int) Math.ceil(this.operand1.evalInteger());
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return this.operand1.canEvalPercentage();
+ }
+
+ @Override
+ public Number evalPercentage() {
+ return (float) Math.ceil(this.operand1.evalPercentage().doubleValue());
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFloor.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFloor.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFloor.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFloor.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.value.Expr;
+
+/**
+ * The "floor" function in XSL-FO.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.1."
+ */
+public class FnFloor extends FnAbstractNumber {
+
+ /** The operand to this function. */
+ private Expr operand1;
+
+ /**
+ * Constructor.
+ * @param arguments The arguments to this function.
+ * @throws PropertyException For errors creating this function.
+ */
+ public FnFloor(final Expr[] arguments) throws PropertyException {
+ super();
+ /* There must be exactly one argument. */
+ if (arguments.length != 1) {
+ this.invalidParameters();
+ }
+ /* The argument must be numeric. */
+ if (! (arguments[0].canEvalNumber())) {
+ this.invalidParameters();
+ }
+ this.operand1 = arguments[0];
+ /* The numeric must have a unit power of zero. */
+ if (this.operand1.getUnitPower() != Expr.UNIT_POWER_NUMERIC) {
+ this.invalidParameters();
+ }
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "floor";
+ }
+
+ @Override
+ public Number evalNumber() {
+ return Math.floor(this.operand1.evalNumber().doubleValue());
+ }
+
+ @Override
+ public byte getUnitPower() {
+ /* Unit power of zero is a requirement, and is tested in the argument validation. */
+ return Expr.UNIT_POWER_NUMERIC;
+ }
+
+ @Override
+ public boolean canEvalInteger() {
+ return this.operand1.canEvalInteger();
+ }
+
+ @Override
+ public int evalInteger() {
+ return (int) Math.floor(this.operand1.evalInteger());
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return this.operand1.canEvalPercentage();
+ }
+
+ @Override
+ public Number evalPercentage() {
+ return (float) Math.floor(this.operand1.evalPercentage().doubleValue());
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValue.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromNearestSpecifiedValue.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValue.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromNearestSpecifiedValue.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.Property;
+import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.value.PropertyValue;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * The "from-nearest-specified-value" function in XSL-FO.
+ * Instances of this class are immutable.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.4."
+ */
+public final class FnFromNearestSpecifiedValue extends FnAbstractNamedProperty {
+
+ /** Instance whose operand is null, indicating that the current property should be evaluated by this function. */
+ private static final FnFromNearestSpecifiedValue UNSPECIFIED_PROPERTY_INSTANCE =
+ new FnFromNearestSpecifiedValue(null);
+
+ /** Internal map of the instances. The key is the property id of the instance and the value is the instance.
+ * This is used to ensure that at most one instance per property ID is created. */
+ private static final Map<FoPropertyId, FnFromNearestSpecifiedValue> INSTANCE_MAP =
+ new EnumMap<FoPropertyId, FnFromNearestSpecifiedValue>(FoPropertyId.class);
+
+ /** The parameter to this function. */
+ private FoPropertyId operand;
+
+ /**
+ * Private constructor.
+ * Use {@link #procureInstance(FoPropertyId)} to obtain an instance of this class.
+ * @param operand The ID of the property to be retrieved by this function.
+ */
+ private FnFromNearestSpecifiedValue(final FoPropertyId operand) {
+ this.operand = operand;
+ }
+
+ /**
+ * Procure the instance of this function for a specific property type.
+ * @param operand The ID of the property to be retrieved by this function.
+ * @return The instance of this function for {@code propertyType}.
+ */
+ public static FnFromNearestSpecifiedValue procureInstance(final FoPropertyId operand) {
+ if (operand == null) {
+ return UNSPECIFIED_PROPERTY_INSTANCE;
+ }
+ FnFromNearestSpecifiedValue instance = INSTANCE_MAP.get(operand);
+ if (instance == null) {
+ instance = new FnFromNearestSpecifiedValue(operand);
+ INSTANCE_MAP.put(operand, instance);
+ }
+ return instance;
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "from-nearest-specified-value";
+ }
+
+ @Override
+ public FoPropertyId getPropertyType() {
+ return this.operand;
+ }
+
+ /**
+ * Returns the value of this function.
+ * @param callingProperty The property which is calling this function.
+ * @param fobj The FO object for whom this property is being evaluated.
+ * @return The value of this function.
+ */
+ public PropertyValue eval(final Property callingProperty, final FoObj fobj) {
+ /* TODO: Provide the right context. */
+ FoObj parent = fobj.effectiveParent(null);
+ final FoPropertyId propertyType = this.getPropertyType();
+ Property ps = null;
+ while (parent != null && ps == null) {
+ ps = parent.getPropertyList().getProperty(propertyType);
+ /* TODO: Provide the right context. */
+ parent = fobj.effectiveParent(null);
+ }
+ if (ps == null) {
+ return null;
+ }
+ return ps.value();
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromPageMasterRegion.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromPageMasterRegion.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromPageMasterRegion.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromPageMasterRegion.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.value.PropertyValue;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * The "from-page-master-region" function in XSL-FO.
+ * Instances of this class are immutable.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.4."
+ */
+public final class FnFromPageMasterRegion extends FnAbstractNamedProperty {
+
+ /** Instance whose operand is null, indicating that the current property should be evaluated by this function. */
+ private static final FnFromPageMasterRegion UNSPECIFIED_PROPERTY_INSTANCE = new FnFromPageMasterRegion(null);
+
+ /** Internal map of the instances. The key is the property id of the instance and the value is the instance.
+ * This is used to ensure that at most one instance per property ID is created. */
+ private static final Map<FoPropertyId, FnFromPageMasterRegion> INSTANCE_MAP =
+ new EnumMap<FoPropertyId, FnFromPageMasterRegion>(FoPropertyId.class);
+
+ /** The parameter to this function. */
+ private FoPropertyId operand;
+
+ /**
+ * Private constructor.
+ * Use {@link #procureInstance(FoPropertyId)} to obtain an instance of this class.
+ * @param operand The ID of the property to be retrieved by this function.
+ */
+ private FnFromPageMasterRegion(final FoPropertyId operand) {
+ this.operand = operand;
+ }
+
+ /**
+ * Procure the instance of this function for a specific property type.
+ * @param operand The ID of the property to be retrieved by this function.
+ * @return The instance of this function for {@code propertyType}.
+ */
+ public static FnFromPageMasterRegion procureInstance(final FoPropertyId operand) {
+ if (operand == null) {
+ return UNSPECIFIED_PROPERTY_INSTANCE;
+ }
+ FnFromPageMasterRegion instance = INSTANCE_MAP.get(operand);
+ if (instance == null) {
+ instance = new FnFromPageMasterRegion(operand);
+ INSTANCE_MAP.put(operand, instance);
+ }
+ return instance;
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "from-page-master-region";
+ }
+
+ @Override
+ public FoPropertyId getPropertyType() {
+ return this.operand;
+ }
+
+ /**
+ * Returns the value of this function.
+ * @param fobj The FO object for whom this property is being evaluated.
+ * @return The value of this function.
+ * @throws PropertyException If the operand cannot be evaluated to a value.
+ */
+ public PropertyValue eval(final FoObj fobj) throws PropertyException {
+ /* TODO: Implement this. */
+ return null;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromParent.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromParent.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromParent.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromParent.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.Property;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.value.PropertyValue;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * The "from-parent" function in XSL-FO.
+ * Instances of this class are immutable.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.4."
+ */
+public final class FnFromParent extends FnAbstractNamedProperty {
+
+ /** Instance whose operand is null, indicating that the current property should be evaluated by this function. */
+ private static final FnFromParent UNSPECIFIED_PROPERTY_INSTANCE = new FnFromParent(null);
+
+ /** Internal map of the instances. The key is the property id of the instance and the value is the instance.
+ * This is used to ensure that at most one instance per property ID is created. */
+ private static final Map<FoPropertyId, FnFromParent> INSTANCE_MAP =
+ new EnumMap<FoPropertyId, FnFromParent>(FoPropertyId.class);
+
+ /** The parameter to this function. */
+ private FoPropertyId operand;
+
+ /**
+ * Private constructor.
+ * Use {@link #procureInstance(FoPropertyId)} to obtain an instance of this class.
+ * @param operand The ID of the property to be retrieved by this function.
+ */
+ private FnFromParent(final FoPropertyId operand) {
+ this.operand = operand;
+ }
+
+ /**
+ * Procure the instance of this function for a specific property type.
+ * @param operand The ID of the property to be retrieved by this function.
+ * @return The instance of this function for {@code propertyType}.
+ */
+ public static FnFromParent procureInstance(final FoPropertyId operand) {
+ if (operand == null) {
+ return UNSPECIFIED_PROPERTY_INSTANCE;
+ }
+ FnFromParent instance = INSTANCE_MAP.get(operand);
+ if (instance == null) {
+ instance = new FnFromParent(operand);
+ INSTANCE_MAP.put(operand, instance);
+ }
+ return instance;
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "from-parent";
+ }
+
+ @Override
+ public FoPropertyId getPropertyType() {
+ return this.operand;
+ }
+
+ /**
+ * Returns the value of this function.
+ * @param fobj The FO object for whom this property is being evaluated.
+ * @return The value of this function.
+ * @throws PropertyException If the operand cannot be evaluated to a value.
+ */
+ public PropertyValue eval(final FoObj fobj)
+ throws PropertyException {
+ // NOTE: special cases for shorthand property
+ // Should return COMPUTED VALUE
+ /*
+ * For now, this is the same as inherited-property-value(propName)
+ * (The only difference I can see is that this could work for
+ * non-inherited properties too. Perhaps the result is different for
+ * a property like line-height which "inherits specified"???
+ */
+ /* TODO: Provide the right context. */
+ final FoObj parent = fobj.effectiveParent(null);
+ final FoPropertyId propertyType = this.getPropertyType();
+ /*
+ * TODO: This is not right. It needs to return the PropertyValue
+ * regardless of whether the Property was explicitly set or not.
+ */
+ final Property ps = parent.getPropertyList().getProperty(propertyType);
+ if (ps == null) {
+ throw new PropertyException("Invalid operand: 'from-parent' "
+ + "function");
+ }
+ return ps.value();
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromTableColumn.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromTableColumn.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromTableColumn.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnFromTableColumn.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.value.PropertyValue;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * The "from-table-column" function in XSL-FO.
+ * Instances of this class are immutable.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.4."
+ */
+public final class FnFromTableColumn extends FnAbstractNamedProperty {
+
+ /** Instance whose operand is null, indicating that the current property should be evaluated by this function. */
+ private static final FnFromTableColumn UNSPECIFIED_PROPERTY_INSTANCE = new FnFromTableColumn(null);
+
+ /** Internal map of the instances. The key is the property id of the instance and the value is the instance.
+ * This is used to ensure that at most one instance per property ID is created. */
+ private static final Map<FoPropertyId, FnFromTableColumn> INSTANCE_MAP =
+ new EnumMap<FoPropertyId, FnFromTableColumn>(FoPropertyId.class);
+
+ /** The parameter to this function. */
+ private FoPropertyId operand;
+
+ /**
+ * Private constructor.
+ * Use {@link #procureInstance(FoPropertyId)} to obtain an instance of this class.
+ * @param operand The ID of the property to be retrieved by this function.
+ */
+ private FnFromTableColumn(final FoPropertyId operand) {
+ this.operand = operand;
+ }
+
+ /**
+ * Procure the instance of this function for a specific property type.
+ * @param operand The ID of the property to be retrieved by this function.
+ * @return The instance of this function for {@code propertyType}.
+ */
+ public static FnFromTableColumn procureInstance(final FoPropertyId operand) {
+ if (operand == null) {
+ return UNSPECIFIED_PROPERTY_INSTANCE;
+ }
+ FnFromTableColumn instance = INSTANCE_MAP.get(operand);
+ if (instance == null) {
+ instance = new FnFromTableColumn(operand);
+ INSTANCE_MAP.put(operand, instance);
+ }
+ return instance;
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "from-table-column";
+ }
+
+ @Override
+ public FoPropertyId getPropertyType() {
+ return this.operand;
+ }
+
+ /**
+ * Returns the value of this function.
+ * @return The value of this function.
+ */
+ public PropertyValue eval() {
+ /* TODO: Implement this. */
+ return null;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnInheritedPropertyValue.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnInheritedPropertyValue.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnInheritedPropertyValue.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnInheritedPropertyValue.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.Property;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.fo.FoPropertyId;
+import org.foray.fotree.value.PropertyValue;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * The "inherited-property-value" function in XSL-FO.
+ * Instances of this class are immutable.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.4."
+ */
+public final class FnInheritedPropertyValue extends FnAbstractNamedProperty {
+
+ /** Instance whose operand is null, indicating that the current property should be evaluated by this function. */
+ private static final FnInheritedPropertyValue UNSPECIFIED_PROPERTY_INSTANCE = new FnInheritedPropertyValue(null);
+
+ /** Internal map of the instances. The key is the property id of the instance and the value is the instance.
+ * This is used to ensure that at most one instance per property ID is created. */
+ private static final Map<FoPropertyId, FnInheritedPropertyValue> INSTANCE_MAP =
+ new EnumMap<FoPropertyId, FnInheritedPropertyValue>(FoPropertyId.class);
+
+ /** The parameter to this function. */
+ private FoPropertyId operand;
+
+ /**
+ * Private constructor.
+ * Use {@link #procureInstance(FoPropertyId)} to obtain an instance of this class.
+ * @param operand The ID of the property to be retrieved by this function.
+ */
+ private FnInheritedPropertyValue(final FoPropertyId operand) {
+ this.operand = operand;
+ }
+
+ /**
+ * Procure the instance of this function for a specific property type.
+ * @param operand The ID of the property to be retrieved by this function.
+ * @return The instance of this function for {@code propertyType}.
+ */
+ public static FnInheritedPropertyValue procureInstance(final FoPropertyId operand) {
+ if (operand == null) {
+ return UNSPECIFIED_PROPERTY_INSTANCE;
+ }
+ FnInheritedPropertyValue instance = INSTANCE_MAP.get(operand);
+ if (instance == null) {
+ instance = new FnInheritedPropertyValue(operand);
+ INSTANCE_MAP.put(operand, instance);
+ }
+ return instance;
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "inherited-property-value";
+ }
+
+ @Override
+ public FoPropertyId getPropertyType() {
+ return this.operand;
+ }
+
+ /**
+ * Returns the value of this function.
+ * @param callingProperty The property which is calling this function.
+ * @param fobj The FO object for whom this property is being evaluated.
+ * @return The value of this function.
+ * @throws PropertyException If the operand cannot be found in the ancestor
+ * values.
+ */
+ public PropertyValue eval(final Property callingProperty, final FoObj fobj) throws PropertyException {
+ /* TODO: Provide the right context. */
+ final FoObj parent = fobj.effectiveParent(null);
+ final FoPropertyId propertyType = this.getPropertyType();
+ /*
+ * TODO: This is not right. It needs to return the inherited value
+ * regardless of whether the Property was explicitly set or not.
+ */
+ final Property ps = parent.getPropertyList().getProperty(propertyType);
+ if (ps == null) {
+ throw new PropertyException("Invalid operand: "
+ + "'inherited-property-value' function");
+ }
+ return ps.value();
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnLabelEnd.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnLabelEnd.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.value.DtLength;
+import org.foray.fotree.value.DtLength_Points;
+import org.foray.fotree.value.Expr;
+
+import org.axsl.constants.TypographicConstants;
+import org.axsl.fotree.FoContext;
+import org.axsl.fotree.fo.ListBlock;
+import org.axsl.fotree.fo.ListItem;
+
+/**
+ * The "label-end" function in XSL-FO.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.4."
+ */
+public class FnLabelEnd extends Function {
+
+ /**
+ * Constructor.
+ * @param arguments The arguments to this function.
+ * @throws PropertyException For errors creating this function.
+ */
+ public FnLabelEnd(final Expr[] arguments) throws PropertyException {
+ super();
+ validateNoArguments(arguments);
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "label-end";
+ }
+
+ /**
+ * The computation for the value of label-end() is found in XSL-FO
+ * Standard, 1.0, Section 7.28.3.
+ * @param fobj The FoObj instance against whom this function should be
+ * evaluated.
+ * @param context An object that knows how to resolve FO context issues.
+ * @return The Numeric representation of the function value.
+ */
+ public DtLength eval(final FoObj fobj, final FoContext context) {
+ final ListBlock listBlock = fobj.getNearestAncestorListBlock(null);
+ final int provisionalDistanceBetweenStarts
+ = listBlock.traitProvisionalDistanceBetweenStarts(context);
+ final int startIndent = listBlock.traitStartIndent(context);
+ /* TODO: We don't know how to get this number yet. */
+ final int startIntrusionAdjustment = 0;
+ final int provisionalLabelSeparation
+ = listBlock.traitProvisionalLabelSeparation(context);
+
+ final int length
+ = context.ipdAncestorBlockArea()
+ - (provisionalDistanceBetweenStarts
+ + startIndent
+ + startIntrusionAdjustment
+ - provisionalLabelSeparation);
+
+ DtLength lengthDT = null;
+ lengthDT = new DtLength_Points(length / TypographicConstants.MILLIPOINTS_PER_POINT);
+ return lengthDT;
+ }
+
+ @Override
+ public boolean isValidForObject(final FoObj fobj) {
+ final ListItem listItem = fobj.getNearestListItem(null);
+ if (listItem == null) {
+ return false;
+ }
+ return true;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMax.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMax.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMax.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMax.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2004 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.fo.function;
+
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.value.Expr;
+
+/**
+ * The "max" function in XSL-FO.
+ * @see "XSL-FO Recommendation 1.1, Section 5.10.1."
+ */
+public class FnMax extends FnAbstractNumber {
+
+ /** The first operand to this function. */
+ private Expr operand1;
+
+ /** The second operand to this function. */
+ private Expr operand2;
+
+ /**
+ * Constructor.
+ * @param arguments The arguments to this function.
+ * @throws PropertyException For errors creating this function.
+ */
+ public FnMax(final Expr[] arguments) throws PropertyException {
+ super();
+ if (arguments.length != 2) {
+ this.invalidParameters();
+ }
+ /* The arguments must be numeric. */
+ if (! (arguments[0].canEvalNumber())) {
+ this.invalidParameters();
+ }
+ this.operand1 = arguments[0];
+ if (! (arguments[1].canEvalNumber())) {
+ this.invalidParameters();
+ }
+ this.operand2 = arguments[1];
+ /* The arguments must have the same unit power. */
+ if (this.operand1.getUnitPower()
+ != this.operand2.getUnitPower()) {
+ this.invalidParameters();
+ }
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "max";
+ }
+
+ @Override
+ public Number evalNumber() {
+ return Math.max(this.operand1.evalNumber().doubleValue(), this.operand2.evalNumber().doubleValue());
+ }
+
+ @Override
+ public byte getUnitPower() {
+ /* The equality of the unit powers of the two arguments is a
+ * requirement, and is tested in the argument validation. */
+ return this.operand1.getUnitPower();
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ /* The equality of the unit powers of the two arguments is a
+ * requirement, and is tested in the argument validation. */
+ return this.operand1.canEvalLength();
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ return Math.max(this.operand1.evalLength(pointSize), this.operand2.evalLength(pointSize));
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ return this.operand1.lengthRequiresFontSize();
+ }
+
+ @Override
+ public boolean canEvalInteger() {
+ return this.operand1.canEvalInteger()
+ && this.operand2.canEvalInteger();
+ }
+
+ @Override
+ public int evalInteger() {
+ return Math.max(this.operand1.evalInteger(),
+ this.operand2.evalInteger());
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return this.operand1.canEvalPercentage()
+ && this.operand2.canEvalPercentage();
+ }
+
+ @Override
+ public Number evalPercentage() {
+ return Math.max(this.operand1.evalPercentage().doubleValue(),
+ this.operand2.evalPercentage().doubleValue());
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMergePropertyValues.java (from rev 13316, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnMergePropertyValues.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMergePropertyValues.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/function/FnMergePropertyValues.java 2025-04-13 23:10:19 UTC (rev 13395)
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004 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 o...
[truncated message content] |
|
From: <vic...@us...> - 2025-04-13 20:58:02
|
Revision: 13394
http://sourceforge.net/p/foray/code/13394
Author: victormote
Date: 2025-04-13 20:57:44 +0000 (Sun, 13 Apr 2025)
Log Message:
-----------
Add a minor test.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RelativeSpaceTests.java
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 2025-04-13 13:26:40 UTC (rev 13393)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtKeep.java 2025-04-13 20:57:44 UTC (rev 13394)
@@ -32,8 +32,8 @@
/**
* A keep datatype in XSL. Used for the XSL-FO properties keep-together,
- * keep-with-next, and keep-with-previous. This datatype is
- * described in the XSL-FO Standard 1.0, at Section 4.8 and Section 5.11.
+ * keep-with-next, and keep-with-previous.
+ * @see "XSL-FO Recommendation 1.0, Section 4.8 and Section 5.11."
*/
public class DtKeep extends Datatype {
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 2025-04-13 13:26:40 UTC (rev 13393)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/DtSpace.java 2025-04-13 20:57:44 UTC (rev 13394)
@@ -36,8 +36,10 @@
import org.axsl.value.Conditionality;
/**
- * 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.
+ * A space quantity in XSL (space-before, space-after).
+ *
+ * @see "XSL-FO Recommendation 1.0, Section 4.3 and Section 5.11."
+ * @see "XSL-FO Recommendation 1.1, Section 4.3 and Section 5.11."
*/
public class DtSpace extends Datatype {
Modified: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RelativeSpaceTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RelativeSpaceTests.java 2025-04-13 13:26:40 UTC (rev 13393)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/fo/prop/RelativeSpaceTests.java 2025-04-13 20:57:44 UTC (rev 13394)
@@ -34,6 +34,7 @@
import org.foray.fotree.PropertyException;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import org.junit.jupiter.api.Test;
/**
@@ -68,4 +69,17 @@
assertEquals(11500, testLength);
}
+ /**
+ * Test of a value with an invalid keyword.
+ */
+ @Test
+ public void testInvalidKeyword() {
+ try {
+ createProperty("bogus");
+ fail("Expected PropertyException.");
+ } catch (final PropertyException e) {
+ /* This is the expected path. */
+ }
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-13 13:26:58
|
Revision: 13393
http://sourceforge.net/p/foray/code/13393
Author: victormote
Date: 2025-04-13 13:26:40 +0000 (Sun, 13 Apr 2025)
Log Message:
-----------
Add test for adding another component to a compound property.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/PropertyListTests.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 2025-04-13 11:11:57 UTC (rev 13392)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/Property.java 2025-04-13 13:26:40 UTC (rev 13393)
@@ -52,6 +52,15 @@
*/
public abstract PropertyId getPropertyType();
+ @Override
+ public boolean equals(final Object other) {
+ if (! (other instanceof Property)) {
+ return false;
+ }
+ final Property otherProperty = (Property) other;
+ return otherProperty.getPropertyType() == this.getPropertyType();
+ }
+
/**
* Convenience method which returns an exception indicating that the value of this property does not meet the
* property's requirements.
@@ -96,10 +105,8 @@
* @param propertyName The name of the property that is not valid.
* @return The newly-created exception.
*/
- public static PropertyException invalidPropertyName(
- final String propertyName) {
- return new PropertyException("Invalid property: " + propertyName
- + "'.");
+ public static PropertyException invalidPropertyName(final String propertyName) {
+ return new PropertyException("Invalid property: " + propertyName + "'.");
}
/**
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 2025-04-13 11:11:57 UTC (rev 13392)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/AbstractPropertyTests.java 2025-04-13 13:26:40 UTC (rev 13393)
@@ -55,7 +55,7 @@
public abstract class AbstractPropertyTests {
/** Constant providing a standard FO Tree creation context. */
- protected static final FoTreeCreator STD_FO_TREE_CREATOR = new FoTreeCreator() {
+ public static final FoTreeCreator STD_FO_TREE_CREATOR = new FoTreeCreator() {
@Override
public List<URL> getResourceSearchPath() {
Added: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/PropertyListTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/PropertyListTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/PropertyListTests.java 2025-04-13 13:26:40 UTC (rev 13393)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2025 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;
+
+import org.foray.fotree.fo.NamespaceFo;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests of {@Link PropertyList}.
+ */
+public class PropertyListTests {
+
+ /**
+ * Test of a compound property being properly updated when another piece of it is found.
+ * @throws PropertyException Not expected here.
+ */
+ @Test
+ @Disabled
+ public void checkCompoundPropertyUpdate() throws PropertyException {
+ final PropertyList list = new PropertyList(2);
+ final NamespaceFo ns = NamespaceFo.getInstance();
+ final Property prop1 = ns.parseAttributeForNS("space-before.conditionality", "retain",
+ AbstractPropertyTests.STD_FO_TREE_CREATOR);
+ list.addProperty(prop1);
+ final Property prop2 = ns.parseAttributeForNS("space-before", "1in", AbstractPropertyTests.STD_FO_TREE_CREATOR);
+ list.addProperty(prop2);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/PropertyListTests.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...> - 2025-04-13 11:12:15
|
Revision: 13392
http://sourceforge.net/p/foray/code/13392
Author: victormote
Date: 2025-04-13 11:11:57 +0000 (Sun, 13 Apr 2025)
Log Message:
-----------
Add location information to PropertyExceptions that are thrown.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2025-04-13 10:55:56 UTC (rev 13391)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2025-04-13 11:11:57 UTC (rev 13392)
@@ -352,6 +352,9 @@
// Let Root register an unmatched "ref-id", if any.
this.foTree.getRootFo().checkUnmatchedReference(fobj);
} catch (final FoTreeException e) {
+ if (! e.isContextSet()) {
+ e.setContextMessage(getLocationString(getLocator()));
+ }
throw new SAXException(e);
}
this.currentFObj = fobj;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-13 10:56:13
|
Revision: 13391
http://sourceforge.net/p/foray/code/13391
Author: victormote
Date: 2025-04-13 10:55:56 +0000 (Sun, 13 Apr 2025)
Log Message:
-----------
Simplify exception handling a bit by making PropertyException a subclass of FoTreeException.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyException.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2025-04-12 22:33:08 UTC (rev 13390)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/NamespaceNative.java 2025-04-13 10:55:56 UTC (rev 13391)
@@ -163,11 +163,7 @@
}
final int[] attributeSort = sortAttributes(attlist);
final PropertyList propertyList = new PropertyList(attlist.getLength());
- try {
- makeList(propertyList, attlist, attributeSort, creator);
- } catch (final PropertyException e) {
- throw new FoTreeException(e);
- }
+ makeList(propertyList, attlist, attributeSort, creator);
return propertyList;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyException.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyException.java 2025-04-12 22:33:08 UTC (rev 13390)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/PropertyException.java 2025-04-13 10:55:56 UTC (rev 13391)
@@ -28,10 +28,12 @@
package org.foray.fotree;
+import org.axsl.fotree.FoTreeException;
+
/**
* Exception class for handling errors during property parsing.
*/
-public class PropertyException extends Exception {
+public class PropertyException extends FoTreeException {
/** Constant needed for serialization. */
static final long serialVersionUID = 613178531358859549L;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java 2025-04-12 22:33:08 UTC (rev 13390)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/LayoutMasterSet4a.java 2025-04-13 10:55:56 UTC (rev 13391)
@@ -360,9 +360,6 @@
} catch (final FoTreeException e) {
/* This should not happen, as all parameters are controlled. */
throw new IllegalStateException(e);
- } catch (final PropertyException e) {
- /* This should not happen, as all parameters are controlled. */
- throw new IllegalStateException(e);
}
return flowMap;
}
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 2025-04-12 22:33:08 UTC (rev 13390)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/parse/PropertyParser.java 2025-04-13 10:55:56 UTC (rev 13391)
@@ -266,11 +266,7 @@
break;
case COLORSPEC:
- try {
- prop = DtColor.parseColorDescription(tokenizer.getCurrentTokenValue());
- } catch (final PropertyException e) {
- throw new PropertyException(e.getMessage());
- }
+ prop = DtColor.parseColorDescription(tokenizer.getCurrentTokenValue());
break;
case FUNCTION_LPAR: {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-12 22:33:28
|
Revision: 13390
http://sourceforge.net/p/foray/code/13390
Author: victormote
Date: 2025-04-12 22:33:08 +0000 (Sat, 12 Apr 2025)
Log Message:
-----------
Test for the invalid orthography after we have recorded the location of the text.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2025-04-12 22:31:50 UTC (rev 13389)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2025-04-12 22:33:08 UTC (rev 13390)
@@ -69,9 +69,8 @@
this.parent = parent;
final FoOrthographyServer orthographyServer = getOrthographyServer();
final FoOrthography orthography = orthographyServer.getOrthography(getWritingSystem());
- if (orthography == null) {
- logWarning("Orthography not found for: {}", getWritingSystem());
- } else {
+ if (orthography != null) {
+ /* If null, we will report it in validateAncestry, as we will have the location information by then. */
this.tokenFlow = orthography.tokenize(content, 0, content.length());
}
}
@@ -82,6 +81,17 @@
}
@Override
+ public void validateAncestry() {
+ if (this.tokenFlow == null) {
+ logWarning("Orthography not found for: {}", getWritingSystem());
+ }
+ }
+
+ @Override
+ public void setup() {
+ }
+
+ @Override
public boolean isAllWhiteSpace() {
for (int index = 0; index < this.tokenFlow.qtyTokens(); index ++) {
final FoTextToken token = this.tokenFlow.tokenAt(index);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-12 22:32:08
|
Revision: 13389
http://sourceforge.net/p/foray/code/13389
Author: victormote
Date: 2025-04-12 22:31:50 +0000 (Sat, 12 Apr 2025)
Log Message:
-----------
Extract method and use to complete creation of text nodes in the same manner as for element nodes.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2025-04-12 21:26:48 UTC (rev 13388)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeParser4a.java 2025-04-12 22:31:50 UTC (rev 13389)
@@ -236,6 +236,7 @@
throw new SAXException(e);
}
this.currentFObj.addChild(wordSequence);
+ completeFoObjCreation(wordSequence);
break;
}
case CHARACTER: {
@@ -242,6 +243,7 @@
final char[] charArray = this.textBuffer.toString().toCharArray();
final FoTextCharacters4a ft = new FoTextCharacters4a(this.currentFObj, charArray);
this.currentFObj.addChild(ft);
+ completeFoObjCreation(ft);
break;
}
default: throw new IllegalArgumentException("Unrecognized text storage strategy. ");
@@ -342,19 +344,9 @@
}
- if (getLocator() != null) {
- final Locator locator = getLocator();
- fobj.setLocation(locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber());
- }
- fobj.validateAncestry();
- fobj.validatePropertyTypes();
- fobj.validatePropertyValues();
- fobj.validateProperties();
+ completeFoObjCreation(fobj);
- /* Give the fobj a chance to do some validation and/or setup before the children are processed. */
- fobj.setup();
-
// Let Root register an "id", if any.
this.foTree.getRootFo().addId(fobj);
// Let Root register an unmatched "ref-id", if any.
@@ -365,6 +357,26 @@
this.currentFObj = fobj;
}
+ /**
+ * Wrap up creation of the FoObj instance by setting its location information, validating it, and allowing it to
+ * initiate itself.
+ * @param fobj The object to be completed.
+ * @throws FoTreeException For validation errors.
+ */
+ private void completeFoObjCreation(final FoObj fobj) throws FoTreeException {
+ if (getLocator() != null) {
+ final Locator locator = getLocator();
+ fobj.setLocation(locator.getSystemId(), locator.getLineNumber(), locator.getColumnNumber());
+ }
+ fobj.validateAncestry();
+ fobj.validatePropertyTypes();
+ fobj.validatePropertyValues();
+ fobj.validateProperties();
+
+ /* Give the fobj a chance to do some validation and/or setup before the children are processed. */
+ fobj.setup();
+ }
+
@Override
public void endElement(final String uri, final String localName, final String rawName) throws SAXException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-12 21:27:08
|
Revision: 13388
http://sourceforge.net/p/foray/code/13388
Author: victormote
Date: 2025-04-12 21:26:48 +0000 (Sat, 12 Apr 2025)
Log Message:
-----------
Use standard logging for warning.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.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 2025-04-12 20:49:32 UTC (rev 13387)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2025-04-12 21:26:48 UTC (rev 13388)
@@ -694,9 +694,10 @@
/**
* Convenience method for logging a warning.
* @param message The warning to be logged.
+ * @param arguments Parameters for the string template, if needed.
*/
- public void logWarning(final String message) {
- getFoTree().logWarning(message + "\n" + getContextMessage());
+ public void logWarning(final String message, final Object... arguments) {
+ getFoTree().logWarning(message + "\n " + getContextMessage(), arguments);
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2025-04-12 20:49:32 UTC (rev 13387)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoTextWords4a.java 2025-04-12 21:26:48 UTC (rev 13388)
@@ -45,9 +45,6 @@
import org.axsl.kp.KpNode;
import org.axsl.orthography.OrthographyException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* Text in an FO document that has been tokenized into words.
* This is a thin wrapper around an instance of {@link FoTextTokenFlow} that allows that token flow to live in an FO
@@ -55,9 +52,6 @@
*/
public class FoTextWords4a extends FoText4a implements FoTextWords, KpBranch {
- /** Logger for this class. */
- private static final Logger LOGGER = LoggerFactory.getLogger(FoTextWords4a.class);
-
/** The parent of this node. */
private FoObj parent;
@@ -76,7 +70,7 @@
final FoOrthographyServer orthographyServer = getOrthographyServer();
final FoOrthography orthography = orthographyServer.getOrthography(getWritingSystem());
if (orthography == null) {
- LOGGER.warn("Orthography not found for: {}", getWritingSystem());
+ logWarning("Orthography not found for: {}", getWritingSystem());
} else {
this.tokenFlow = orthography.tokenize(content, 0, content.length());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-12 20:49:49
|
Revision: 13387
http://sourceforge.net/p/foray/code/13387
Author: victormote
Date: 2025-04-12 20:49:32 +0000 (Sat, 12 Apr 2025)
Log Message:
-----------
Log a warning instead of aborting when a flow cannot be placed on any pages in a page-sequence.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFlow.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFlow.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFlow.java 2025-04-12 19:09:46 UTC (rev 13386)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractFlow.java 2025-04-12 20:49:32 UTC (rev 13387)
@@ -87,10 +87,8 @@
canBeLaidOut = true;
}
if (! canBeLaidOut) {
- this.isValid = false;
- throwException(this.getFullName() + " '" + traitFlowName()
- + "' cannot be laid out in any pages in '"
- + this.getParent().traitMasterName() + "'");
+ logWarning(this.getFullName() + " '" + traitFlowName() + "' cannot be laid out in any pages in '" +
+ this.getParent().traitMasterReference() + "'");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-04-12 19:10:03
|
Revision: 13386
http://sourceforge.net/p/foray/code/13386
Author: victormote
Date: 2025-04-12 19:09:46 +0000 (Sat, 12 Apr 2025)
Log Message:
-----------
Fix build to include foray-config.dtd.
Modified Paths:
--------------
trunk/foray/foray-common/build.gradle
trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java
Modified: trunk/foray/foray-common/build.gradle
===================================================================
--- trunk/foray/foray-common/build.gradle 2025-02-16 11:45:35 UTC (rev 13385)
+++ trunk/foray/foray-common/build.gradle 2025-04-12 19:09:46 UTC (rev 13386)
@@ -27,4 +27,13 @@
options.header = "FOray Common API ${version}"
}
+/* We want the DTDs to live as part of the website files, so we need to copy them into the jar file here. */
+jar {
+ from rootProject.projectDir.absolutePath + '/foray-00-dev/doc/web/dtds/0.1/en/',
+ {
+ include 'foray-config.dtd'
+ into '/resources/org/foray/dtds/'
+ }
+}
+
/* Last line of script. */
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java 2025-02-16 11:45:35 UTC (rev 13385)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/ForayEntityResolver.java 2025-04-12 19:09:46 UTC (rev 13386)
@@ -92,6 +92,13 @@
* @return The appropriate aXSL DTD, or null if not found.
*/
private InputStream getAxslDtdAsInputStream(final String dtdName) {
+ /* The aXSL DTDs should all be found in jar files created by the aXSL build system.
+ * Find axsl-font-config.dtd in axsl-font-{release}.jar
+ * Find axsl-area-tree.dtd in axsl-galley-{release}.jar
+ * Find axsl-hyphenation.dtd in axsl-orthography-{release}.jar
+ * Find axsl-dictionary.dtd in axsl-orthography-{release}.jar
+ * Find axsl-orthography-config.dtd in axsl-orthography-{release}.jar
+ * Find axsl-parts-of-speech.dtd in axsl-orthography-{release}.jar*/
return ForayEntityResolver.class.getResourceAsStream("/resources/org/axsl/dtds/" + dtdName);
}
@@ -101,13 +108,14 @@
* @return The appropriate FOray DTD, or null if not found.
*/
private InputStream getForayDtdAsInputStream(final String dtdName) {
+ /* The FOray DTDs should all be found in jar files created by the FOray build system.
+ * Find foray-config.dtd in foray-common-{release}.jar
+ */
final InputStream inputStream = this.getClass().getResourceAsStream("/resources/org/foray/dtds/" + dtdName);
if (inputStream == null) {
- /* The aXSL DTDs should all be found in jar files resolved by the build system.
- * For FOray DTDs, the user could be a developer running in an IDE, and, because the DTD files live in the
- * website directory in the "master" project, the IDE does not know about them.
- * See build.gradle where the file is copied into the jar file.
+ /* If not found in the jars in the classpath, the user could be a developer running in an IDE, and, because
+ * the DTD files live in the website directory in the "master" project, the IDE does not know about them.
* Therefore, we look for the file on the local file system. */
final File file = new File("../foray-00-dev/doc/web/dtds/0.1/en/" + dtdName);
if (! file.exists()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-16 11:45:39
|
Revision: 13385
http://sourceforge.net/p/foray/code/13385
Author: victormote
Date: 2025-02-16 11:45:35 +0000 (Sun, 16 Feb 2025)
Log Message:
-----------
Add new usage INLINE_EMPTY to prevent "Page" from being treated as if it needed to be on a new line.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/dtd/DtdElement.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XmlModelElement.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XsdElement.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-14 13:29:33 UTC (rev 13384)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-16 11:45:35 UTC (rev 13385)
@@ -88,7 +88,10 @@
/** An element whose ancestors are all STRUCTURAL, but which has mixed content. */
BLOCK,
- /** An element whose parent is BLOCK, and who has mixed content. */
+ /** An element whose parent is BLOCK, and whose content model does not allow any content. */
+ INLINE_EMPTY,
+
+ /** An element whose parent is BLOCK, and whose content model allows mixed content. */
INLINE_MIXED,
/** An element whose parent is BLOCK, and which does not have mixed content. */
@@ -472,6 +475,7 @@
switch (usage) {
case STRUCTURAL: return true;
case BLOCK: return true;
+ case INLINE_EMPTY: return false;
case INLINE_MIXED: return false;
case INLINE_UNMIXED: return false;
case INLINE_UNMIXED_CONTENT: return true;
@@ -489,6 +493,7 @@
switch (modelElement.getUsage()) {
case STRUCTURAL:
case BLOCK: return this.elementStack.size() - 1;
+ case INLINE_EMPTY:
case INLINE_MIXED:
case INLINE_UNMIXED: return 0;
case INLINE_UNMIXED_CONTENT: return modelElement.getDistanceFromNearestBlock() - 1;
@@ -508,6 +513,7 @@
switch (modelElement.getUsage()) {
case STRUCTURAL: return this.elementStack.size() - 1;
case BLOCK:
+ case INLINE_EMPTY:
case INLINE_MIXED:
case INLINE_UNMIXED:
case INLINE_UNMIXED_CONTENT: return -1;
@@ -527,6 +533,7 @@
switch (modelElement.getUsage()) {
case STRUCTURAL: return this.elementStack.size() - 1;
case BLOCK:
+ case INLINE_EMPTY:
case INLINE_MIXED:
case INLINE_UNMIXED:
case INLINE_UNMIXED_CONTENT: return -1;
@@ -546,6 +553,7 @@
switch (usage) {
case STRUCTURAL: return true;
case BLOCK: return false;
+ case INLINE_EMPTY: return false;
case INLINE_MIXED: return false;
case INLINE_UNMIXED: return true;
case INLINE_UNMIXED_CONTENT: {
@@ -570,6 +578,7 @@
switch (modelElementUsage.getUsage()) {
case STRUCTURAL: return this.elementStack.size() - 1;
case BLOCK:
+ case INLINE_EMPTY:
case INLINE_MIXED:
case INLINE_UNMIXED: return 0;
case INLINE_UNMIXED_CONTENT: return modelElementUsage.getDistanceFromNearestBlock();
@@ -750,7 +759,9 @@
}
}
if (topElement.usage == ElementUsage.BLOCK) {
- if (newElement.canContainPCDATA()) {
+ if (newElement.isEmpty()) {
+ return ElementUsage.INLINE_EMPTY;
+ } else if (newElement.canContainPCDATA()) {
return ElementUsage.INLINE_MIXED;
} else {
return ElementUsage.INLINE_UNMIXED;
@@ -760,7 +771,9 @@
return ElementUsage.INLINE_UNMIXED_CONTENT;
}
if (topElement.usage == ElementUsage.INLINE_MIXED) {
- if (newElement.canContainPCDATA()) {
+ if (newElement.isEmpty()) {
+ return ElementUsage.INLINE_EMPTY;
+ } else if (newElement.canContainPCDATA()) {
return ElementUsage.INLINE_MIXED;
} else {
return ElementUsage.INLINE_UNMIXED;
@@ -767,7 +780,9 @@
}
}
if (topElement.usage == ElementUsage.INLINE_UNMIXED_CONTENT) {
- if (newElement.canContainPCDATA()) {
+ if (newElement.isEmpty()) {
+ return ElementUsage.INLINE_EMPTY;
+ } else if (newElement.canContainPCDATA()) {
return ElementUsage.INLINE_MIXED;
} else {
return ElementUsage.INLINE_UNMIXED;
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/dtd/DtdElement.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/dtd/DtdElement.java 2025-02-14 13:29:33 UTC (rev 13384)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/dtd/DtdElement.java 2025-02-16 11:45:35 UTC (rev 13385)
@@ -94,10 +94,7 @@
return this.canContainPCDATA;
}
- /**
- * Indicates whether this element's content model is empty.
- * @return True if and only if this element's content model is empty.
- */
+ @Override
public boolean isEmpty() {
return this.isEmpty;
}
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XmlModelElement.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XmlModelElement.java 2025-02-14 13:29:33 UTC (rev 13384)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XmlModelElement.java 2025-02-16 11:45:35 UTC (rev 13385)
@@ -36,7 +36,13 @@
public interface XmlModelElement {
/**
- * Indicated whether this element's content model actually is PCDATA. An example would be an element that is a
+ * Indicates whether this element's content model has an content at all.
+ * @return True if and only if this element's content model is empty.
+ */
+ boolean isEmpty();
+
+ /**
+ * Indicates whether this element's content model actually is PCDATA. An example would be an element that is a
* primitive XML Schema type, for example xs:date. The content of the element is actually text.
* @return True if and only if this element's content model indicates that it is a primitive XML Schema type.
*/
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XsdElement.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XsdElement.java 2025-02-14 13:29:33 UTC (rev 13384)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XsdElement.java 2025-02-16 11:45:35 UTC (rev 13385)
@@ -38,6 +38,7 @@
import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension;
import org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
import org.apache.ws.commons.schema.XmlSchemaType;
import javax.xml.XMLConstants;
@@ -74,6 +75,45 @@
}
@Override
+ public boolean isEmpty() {
+ final XmlSchemaType schemaType = this.element.getSchemaType();
+
+ /* If the element has no schema type, it can have no content. */
+ if (schemaType == null) {
+ return true;
+ }
+
+ if ((schemaType instanceof XmlSchemaSimpleType)) {
+ final XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) schemaType;
+ return simpleType.getContent() == null;
+ }
+
+ /* Schema type is complex. */
+ final XmlSchema schema = schemaType.getParent();
+ final XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaType;
+ final XmlSchemaContentModel contentModel = complexType.getContentModel();
+ if (contentModel == null) {
+ return complexType.getParticle() == null;
+ } else {
+ /* Check the complex content itself. */
+ final XmlSchemaComplexContent complexContent = (XmlSchemaComplexContent) contentModel;
+ /* If the complex content is mixed, then this type has content. */
+ if (complexContent.isMixed()) {
+ return false;
+ }
+
+ /* Now check the type that the complex content is derived from. */
+ final XmlSchemaContent content = complexContent.getContent();
+ final XmlSchemaType baseType = getBaseType(schema, content);
+ if (! (baseType instanceof XmlSchemaComplexType)) {
+ return true;
+ }
+ final XmlSchemaComplexType baseComplexType = (XmlSchemaComplexType) baseType;
+ return baseComplexType.getParticle() == null;
+ }
+ }
+
+ @Override
public boolean isPCDATA() {
final XmlSchemaType type = this.element.getSchemaType();
if (type == null) {
@@ -128,6 +168,17 @@
/* Now check the type that the complex content is derived from. */
final XmlSchemaContent content = complexContent.getContent();
+ final XmlSchemaType baseType = getBaseType(schema, content);
+ return baseType.isMixed();
+ }
+
+ /**
+ * Find the base type for a schema content item.
+ * @param schema The parent schema.
+ * @param content The schema content for which we want to find the base type.
+ * @return The base type for {@code content}.
+ */
+ private XmlSchemaType getBaseType(final XmlSchema schema, final XmlSchemaContent content) {
/* This is pretty annoying. The getBaseTypeName() method should be in the XmlSchemaContent superclass.
* Instead we need to check each subclass. */
QName baseTypeQname = null;
@@ -149,7 +200,7 @@
}
final XmlSchemaType derivedFromType = schema.getTypeByName(baseTypeQname);
- return derivedFromType.isMixed();
+ return derivedFromType;
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-14 13:29:34
|
Revision: 13384
http://sourceforge.net/p/foray/code/13384
Author: victormote
Date: 2025-02-14 13:29:33 +0000 (Fri, 14 Feb 2025)
Log Message:
-----------
1. Convert input to ForayXDiff to be a URL, to match its current API. 2. Put the temp file in the user's temp directory.
Modified Paths:
--------------
trunk/foray/src/dist/bin/foray-pretty.bat
Modified: trunk/foray/src/dist/bin/foray-pretty.bat
===================================================================
--- trunk/foray/src/dist/bin/foray-pretty.bat 2025-02-14 12:10:03 UTC (rev 13383)
+++ trunk/foray/src/dist/bin/foray-pretty.bat 2025-02-14 13:29:33 UTC (rev 13384)
@@ -28,10 +28,14 @@
set CLASS=org.foray.xml.ForayPrettyPush
-set TEMP_NAME=pretty.xml
+rem TEMP_DIR and TEMP_FILE can easily have spaces in them, so enclose in quotation marks when used
+set TEMP_DIR=%TEMP%\portage
+if not exist "%TEMP_DIR%" mkdir "%TEMP_DIR%"
+set TEMP_FILE=%TEMP_DIR%\pretty.xml
+
rem Run the pretty-printer.
-set COMMAND=java -cp %FORAY_CP% %CLASS% --input %INPUT_FILE% --output %TEMP_NAME% --catalog %CATALOG%
+set COMMAND=java -cp %FORAY_CP% %CLASS% --input %INPUT_FILE% --output "%TEMP_FILE%" --catalog %CATALOG%
%COMMAND%
echo End pretty-printing.
rem echo Error Level is %errorlevel%
@@ -43,7 +47,7 @@
rem Make sure the pretty-printed version has the same content as original.
echo Comparing content for unintended changes during pretty-print.
set CLASS=org.foray.xml.ForayXdiff
-set COMMAND=java -cp %FORAY_CP% %CLASS% --files %INPUT_FILE% %TEMP_NAME% --catalog %CATALOG%
+set COMMAND=java -cp %FORAY_CP% %CLASS% --files file:///%INPUT_FILE% "file:///%TEMP_FILE%" --catalog %CATALOG%
%COMMAND%
echo End comparison.
if %errorlevel% == 0 goto :copy
@@ -53,7 +57,7 @@
:copy
rem Copy the pretty version over the original.
echo Replacing %INPUT_FILE% with pretty-printed version.
-copy %TEMP_NAME% %INPUT_FILE%
+copy "%TEMP_FILE%" %INPUT_FILE%
if %errorlevel% == 0 goto :delete
echo Copy failed. The temporary file will not be deleted. Exit code %errorlevel%.
exit errorlevel
@@ -60,7 +64,7 @@
:delete
rem Delete the temp file.
-del %TEMP_NAME%
+del "%TEMP_FILE%"
set FORAY_CP=
rem Last line of script.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-14 12:10:06
|
Revision: 13383
http://sourceforge.net/p/foray/code/13383
Author: victormote
Date: 2025-02-14 12:10:03 +0000 (Fri, 14 Feb 2025)
Log Message:
-----------
When checking for mixed content, check not only the element type, but also any types that the element type is derived from.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XsdElement.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XsdElement.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XsdElement.java 2025-02-13 23:38:52 UTC (rev 13382)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/model/XsdElement.java 2025-02-14 12:10:03 UTC (rev 13383)
@@ -28,7 +28,16 @@
package org.foray.xml.model;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaComplexContent;
+import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension;
+import org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaContent;
+import org.apache.ws.commons.schema.XmlSchemaContentModel;
import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension;
+import org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction;
import org.apache.ws.commons.schema.XmlSchemaType;
import javax.xml.XMLConstants;
@@ -90,12 +99,57 @@
if (isPCDATA()) {
return true;
}
- final XmlSchemaType schemaType = element.getSchemaType();
+ final XmlSchemaType schemaType = this.element.getSchemaType();
if (schemaType == null) {
/* If it has no type, it cannot have any content at all. */
return false;
}
- return schemaType.isMixed();
+ if (schemaType.isMixed()) {
+ return true;
+ }
+ if (! (schemaType instanceof XmlSchemaComplexType)) {
+ return false;
+ }
+
+ /* Schema type is complex. */
+ final XmlSchema schema = schemaType.getParent();
+ final XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaType;
+ final XmlSchemaContentModel model = complexType.getContentModel();
+ if (! (model instanceof XmlSchemaComplexContent)) {
+ return false;
+ }
+
+ /* Check the complex content itself. */
+ final XmlSchemaComplexContent complexContent = (XmlSchemaComplexContent) model;
+ if (complexContent.isMixed()) {
+ return true;
+ }
+
+ /* Now check the type that the complex content is derived from. */
+ final XmlSchemaContent content = complexContent.getContent();
+
+ /* This is pretty annoying. The getBaseTypeName() method should be in the XmlSchemaContent superclass.
+ * Instead we need to check each subclass. */
+ QName baseTypeQname = null;
+ if (content instanceof XmlSchemaComplexContentExtension) {
+ final XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension) content;
+ baseTypeQname = extension.getBaseTypeName();
+ }
+ if (content instanceof XmlSchemaComplexContentRestriction) {
+ final XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
+ baseTypeQname = restriction.getBaseTypeName();
+ }
+ if (content instanceof XmlSchemaSimpleContentExtension) {
+ final XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content;
+ baseTypeQname = extension.getBaseTypeName();
+ }
+ if (content instanceof XmlSchemaSimpleContentRestriction) {
+ final XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) content;
+ baseTypeQname = restriction.getBaseTypeName();
+ }
+
+ final XmlSchemaType derivedFromType = schema.getTypeByName(baseTypeQname);
+ return derivedFromType.isMixed();
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-13 23:38:55
|
Revision: 13382
http://sourceforge.net/p/foray/code/13382
Author: victormote
Date: 2025-02-13 23:38:52 +0000 (Thu, 13 Feb 2025)
Log Message:
-----------
Handle attribute indentation separately from element indentation.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 15:16:00 UTC (rev 13381)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 23:38:52 UTC (rev 13382)
@@ -398,10 +398,11 @@
}
/* Whitespace at beginning of attribute. */
- if (this.elementStack.peek().getUsage() == ElementUsage.BLOCK
- || this.elementStack.peek().getUsage() == ElementUsage.STRUCTURAL) {
- final int indentLevels = computeStartTagIndentation() + this.config.getExtraAttributeIndentationLevels();
- attributesContent.add(this.prettyOutput.contingentlyIndent(indentLevels));
+ final int basicAttributeIndentLevels = computeAttributeIndentation();
+ if (basicAttributeIndentLevels > -1) {
+ final int attributeIndentLevels = basicAttributeIndentLevels +
+ this.config.getExtraAttributeIndentationLevels();
+ attributesContent.add(this.prettyOutput.contingentlyIndent(attributeIndentLevels));
} else {
attributesContent.add(StringUtils.SINGLE_SPACE);
}
@@ -417,7 +418,14 @@
for (int pieceIndex = 0; pieceIndex < pieces.length; pieceIndex ++) {
attributesContent.add(pieces[pieceIndex]);
if (pieceIndex < pieces.length - 1) {
- attributesContent.add(StringUtils.SINGLE_SPACE);
+ final int basicIntraIndentLevels = this.computeIntraAttributeIndentation();
+ if (basicIntraIndentLevels > -1) {
+ final int intraIndentLevels = basicIntraIndentLevels +
+ this.config.getExtraIntraAttributeIndentationLevels();
+ attributesContent.add(this.prettyOutput.contingentlyIndent(intraIndentLevels));
+ } else {
+ attributesContent.add(StringUtils.SINGLE_SPACE);
+ }
}
}
} else {
@@ -490,6 +498,44 @@
/**
+ * Computes the normal indentation for the name of an attribute that flows on to a new line.
+ * This is the base indentation, which can be increased further by
+ * {@link ForayPrettyConfig#getExtraAttributeIndentationLevels()}.
+ * @return The number of base levels of indentation for the start of a new attribute.
+ */
+ private int computeAttributeIndentation() {
+ final DocumentElement modelElement = this.elementStack.peek();
+ switch (modelElement.getUsage()) {
+ case STRUCTURAL: return this.elementStack.size() - 1;
+ case BLOCK:
+ case INLINE_MIXED:
+ case INLINE_UNMIXED:
+ case INLINE_UNMIXED_CONTENT: return -1;
+ default: throw new IllegalStateException("Unexpected Element Usage: " + modelElement.getUsage());
+ }
+ }
+
+
+ /**
+ * Computes the normal indentation for the value of an attribute when it is split between two lines.
+ * This is the base indentation, which can be increased further by
+ * {@link ForayPrettyConfig#getExtraIntraAttributeIndentationLevels()}.
+ * @return The number of levels of indentation for the start tag of the current element.
+ */
+ private int computeIntraAttributeIndentation() {
+ final DocumentElement modelElement = this.elementStack.peek();
+ switch (modelElement.getUsage()) {
+ case STRUCTURAL: return this.elementStack.size() - 1;
+ case BLOCK:
+ case INLINE_MIXED:
+ case INLINE_UNMIXED:
+ case INLINE_UNMIXED_CONTENT: return -1;
+ default: throw new IllegalStateException("Unexpected Element Usage: " + modelElement.getUsage());
+ }
+ }
+
+
+ /**
* Determines whether the end tag for the current element should be written on a new line or whether it should be
* written immediately after the contents.
* @return True if the end tag for the current element should be written on a new line.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-13 15:16:02
|
Revision: 13381
http://sourceforge.net/p/foray/code/13381
Author: victormote
Date: 2025-02-13 15:16:00 +0000 (Thu, 13 Feb 2025)
Log Message:
-----------
Lock sizes of indentation and congingent indentation together.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java 2025-02-13 14:55:26 UTC (rev 13380)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java 2025-02-13 15:16:00 UTC (rev 13381)
@@ -155,17 +155,13 @@
/** Array containing already already-created indentation strings. */
private static final String[] INDENTATION = new String[MAX_QTY_INDENTATION_LEVELS];
- /** The maximum number of notional indentation levels. */
- private static final int MAX_CONTINGENT_INDENTATIONS = 20;
-
/** Singleton instance of the array of {@link ContingentIndentation} instances. */
- private final ContingentIndentation[] contingentIndentationInstances =
- new ContingentIndentation[MAX_CONTINGENT_INDENTATIONS];
+ private static final ContingentIndentation[] CONTINGENT_INDENTATION =
+ new ContingentIndentation[MAX_QTY_INDENTATION_LEVELS];
/** Singleton instance of the {@link ForcedLinebreak} instance. */
private final ForcedLinebreak forcedLinebreakInstance = new ForcedLinebreak();
-
/** The output stream to which the pretty-printed output should be sent. */
private OutputStream output;
@@ -653,10 +649,10 @@
* @return An appropriate instance.
*/
public ContingentIndentation contingentlyIndent(final int indentationLevels) {
- if (contingentIndentationInstances[indentationLevels] == null) {
- contingentIndentationInstances[indentationLevels] = new ContingentIndentation(indent(indentationLevels));
+ if (CONTINGENT_INDENTATION[indentationLevels] == null) {
+ CONTINGENT_INDENTATION[indentationLevels] = new ContingentIndentation(indent(indentationLevels));
}
- return contingentIndentationInstances[indentationLevels];
+ return CONTINGENT_INDENTATION[indentationLevels];
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-13 14:55:28
|
Revision: 13380
http://sourceforge.net/p/foray/code/13380
Author: victormote
Date: 2025-02-13 14:55:26 +0000 (Thu, 13 Feb 2025)
Log Message:
-----------
Store parsed attributes in the stack with the resolved elements.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 14:36:48 UTC (rev 13379)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 14:55:26 UTC (rev 13380)
@@ -109,6 +109,9 @@
/** The wrapped model element. */
private XmlModelElement modelElement;
+ /** The parsed attributes for this document element. */
+ private Attributes2 attributes;
+
/** The usage for {@link #modelElement} in this stack. */
private ElementUsage usage;
@@ -116,16 +119,19 @@
* {@link ElementUsage#BLOCK}. */
private int distanceFromNearestBlock;
+
/**
* Constuctor.
* @param modelElement The wrapped model element.
+ * @param attributes The parsed attributes for this document element.
* @param usage The usage for {@code modelElement} in this stack.
* @param distanceFromNearestBlock The number of levels in the stack between this element and its nearest
* ancestor {@link ElementUsage#BLOCK}.
*/
- private DocumentElement(final XmlModelElement modelElement, final ElementUsage usage,
- final int distanceFromNearestBlock) {
+ private DocumentElement(final XmlModelElement modelElement, final Attributes2 attributes,
+ final ElementUsage usage, final int distanceFromNearestBlock) {
this.modelElement = modelElement;
+ this.attributes = attributes;
this.usage = usage;
this.distanceFromNearestBlock = distanceFromNearestBlock;
}
@@ -138,7 +144,16 @@
return this.modelElement;
}
+
/**
+ * Returns the parsed attributes for this document element.
+ * @return The parsed attributes for this document element.
+ */
+ public Attributes2 getAttributes() {
+ return this.attributes;
+ }
+
+ /**
* Returns the usage for {@link #getModelElement()} in this stack.
* @return the usage for {@link #getModelElement()} in this stack.
*/
@@ -196,9 +211,6 @@
/** Indicates whether the item on the top of the element stack has been written. */
private boolean topElementWritten = true;
- /** The attributes belonging to the last-started element. */
- private Attributes2 lastStartedAttributes;
-
/* End state variables. */
@@ -259,7 +271,8 @@
* element, and empty elements can be written two different ways.*/
/* Must copy the attributes as they are reset on each callback. */
- this.lastStartedAttributes = new Attributes2Impl(attributes);
+ final Attributes2 attributesCopy = new Attributes2Impl(attributes);
+
if (getDtd() == null) {
QName qname = this.qnameMap.get(qNameString);
if (qname == null) {
@@ -274,11 +287,11 @@
xsdElement = new XsdElement(schemaElement);
schemaElementMap.put(schemaElement, xsdElement);
}
- final DocumentElement documentElement = createDocumentElement(xsdElement);
+ final DocumentElement documentElement = createDocumentElement(xsdElement, attributesCopy);
this.elementStack.push(documentElement);
} else {
final DtdElement dtdElement = getDtd().getElement(qNameString);
- final DocumentElement documentElement = createDocumentElement(dtdElement);
+ final DocumentElement documentElement = createDocumentElement(dtdElement, attributesCopy);
this.elementStack.push(documentElement);
}
this.topElementWritten = false;
@@ -288,12 +301,13 @@
/**
* Wraps a model element and adds some metadata to it that is useful for pretty-print processing.
* @param element The model element to be wrapped.
+ * @param attributes The parsed attributes for the document element.
* @return The wrapper.
*/
- private DocumentElement createDocumentElement(final XmlModelElement element) {
+ private DocumentElement createDocumentElement(final XmlModelElement element, final Attributes2 attributes) {
final ElementUsage usage = computeUsage(element);
final int distanceFromNearestBlock = computeDistanceFromNearestBlock(element);
- final DocumentElement modelElement = new DocumentElement(element, usage, distanceFromNearestBlock);
+ final DocumentElement modelElement = new DocumentElement(element, attributes, usage, distanceFromNearestBlock);
return modelElement;
}
@@ -300,12 +314,14 @@
/**
* Writes the element at the top of the stack if it has not already been written.
* @param isEmpty Indicates whether the element has any content or not.
+ * We must wait until the next element start tag is reached to determine whether the current top element has any
+ * descendants.
*/
private void ensureTopElementWritten(final boolean isEmpty) {
if (this.topElementWritten) {
return;
}
- writeElementStart(this.lastStartedAttributes, isEmpty);
+ writeElementStart(isEmpty);
this.topElementWritten = true;
}
@@ -312,10 +328,9 @@
/**
* Writes an element.
- * @param attributes The attributes for the element to be written.
* @param isEmpty Indicates whether the element has any content or not.
*/
- private void writeElementStart(final Attributes2 attributes, final boolean isEmpty) {
+ private void writeElementStart(final boolean isEmpty) {
final DocumentElement documentElement = this.elementStack.peek();
final XmlModelElement modelElement = documentElement.modelElement;
if (modelElement == null) {
@@ -336,6 +351,7 @@
/* Accumulate the attributes. */
final List<CharSequence> attributesContent = new ArrayList<CharSequence>();
+ final Attributes2 attributes = documentElement.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
writeAttribute(attributes, i, attributesContent);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-13 14:36:51
|
Revision: 13379
http://sourceforge.net/p/foray/code/13379
Author: victormote
Date: 2025-02-13 14:36:48 +0000 (Thu, 13 Feb 2025)
Log Message:
-----------
Remove state instance variable in favor of using the stack to track which element is being processed.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java 2025-02-13 14:27:02 UTC (rev 13378)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java 2025-02-13 14:36:48 UTC (rev 13379)
@@ -652,7 +652,7 @@
* @param indentationLevels The number of levels of indentation to be used.
* @return An appropriate instance.
*/
- public ContingentIndentation getContingentIndentation(final int indentationLevels) {
+ public ContingentIndentation contingentlyIndent(final int indentationLevels) {
if (contingentIndentationInstances[indentationLevels] == null) {
contingentIndentationInstances[indentationLevels] = new ContingentIndentation(indent(indentationLevels));
}
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 14:27:02 UTC (rev 13378)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 14:36:48 UTC (rev 13379)
@@ -196,9 +196,6 @@
/** Indicates whether the item on the top of the element stack has been written. */
private boolean topElementWritten = true;
- /** The the last started-element. */
- private XmlModelElement lastStartedElement;
-
/** The attributes belonging to the last-started element. */
private Attributes2 lastStartedAttributes;
@@ -279,7 +276,6 @@
}
final DocumentElement documentElement = createDocumentElement(xsdElement);
this.elementStack.push(documentElement);
- this.lastStartedElement = xsdElement;
} else {
final DtdElement dtdElement = getDtd().getElement(qNameString);
final DocumentElement documentElement = createDocumentElement(dtdElement);
@@ -309,7 +305,7 @@
if (this.topElementWritten) {
return;
}
- writeElementStart(this.lastStartedElement, this.lastStartedAttributes, isEmpty);
+ writeElementStart(this.lastStartedAttributes, isEmpty);
this.topElementWritten = true;
}
@@ -316,12 +312,12 @@
/**
* Writes an element.
- * @param modelElement The namespace-qualified name of the element to be written.
* @param attributes The attributes for the element to be written.
* @param isEmpty Indicates whether the element has any content or not.
*/
- private void writeElementStart(final XmlModelElement modelElement, final Attributes2 attributes,
- final boolean isEmpty) {
+ private void writeElementStart(final Attributes2 attributes, final boolean isEmpty) {
+ final DocumentElement documentElement = this.elementStack.peek();
+ final XmlModelElement modelElement = documentElement.modelElement;
if (modelElement == null) {
return;
}
@@ -389,7 +385,7 @@
if (this.elementStack.peek().getUsage() == ElementUsage.BLOCK
|| this.elementStack.peek().getUsage() == ElementUsage.STRUCTURAL) {
final int indentLevels = computeStartTagIndentation() + this.config.getExtraAttributeIndentationLevels();
- attributesContent.add(this.prettyOutput.getContingentIndentation(indentLevels));
+ attributesContent.add(this.prettyOutput.contingentlyIndent(indentLevels));
} else {
attributesContent.add(StringUtils.SINGLE_SPACE);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-13 14:27:04
|
Revision: 13378
http://sourceforge.net/p/foray/code/13378
Author: victormote
Date: 2025-02-13 14:27:02 +0000 (Thu, 13 Feb 2025)
Log Message:
-----------
Move indentation data to ForayPrettyOutput.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java 2025-02-13 14:17:07 UTC (rev 13377)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyOutput.java 2025-02-13 14:27:02 UTC (rev 13378)
@@ -57,16 +57,10 @@
/**
* Constructor.
- * @param levels The number of space characters to be used if indentation takes place.
+ * @param indentString The String to use for indentation if indentation takes place.
*/
- private ContingentIndentation(final int levels) {
- int numIndents = levels;
- final StringBuilder buffer = new StringBuilder();
- while (numIndents > 0) {
- buffer.append(ForayPrettyOutput.this.config.getIndentString());
- numIndents --;
- }
- this.indentString = buffer.toString();
+ private ContingentIndentation(final String indentString) {
+ this.indentString = indentString;
}
@Override
@@ -155,6 +149,12 @@
/** Initial size of {@link #breaksChosen}. */
private static final int INITIAL_BREAKS_CHOSEN_SIZE = 2048;
+ /** Constant used to create the {@link #INDENTATION} array. */
+ private static final int MAX_QTY_INDENTATION_LEVELS = 20;
+
+ /** Array containing already already-created indentation strings. */
+ private static final String[] INDENTATION = new String[MAX_QTY_INDENTATION_LEVELS];
+
/** The maximum number of notional indentation levels. */
private static final int MAX_CONTINGENT_INDENTATIONS = 20;
@@ -626,20 +626,40 @@
}
/**
+ * Returns what should be written to indent a line.
+ * @param indentationLevels The number of levels of indentation to be returned.
+ * @return The String content that should be written to indent a line.
+ */
+ public String indent(final int indentationLevels) {
+ if (indentationLevels > MAX_QTY_INDENTATION_LEVELS) {
+ throw new IllegalArgumentException("Maximum indentation levels is " + MAX_QTY_INDENTATION_LEVELS);
+ }
+ if (INDENTATION[indentationLevels] == null) {
+ final StringBuilder buffer = new StringBuilder(this.config.getIndentString().length() * indentationLevels);
+ int numIndents = indentationLevels;
+ while (numIndents > 0) {
+ buffer.append(this.config.getIndentString());
+ numIndents --;
+ }
+ INDENTATION[indentationLevels] = buffer.toString();
+ }
+ return INDENTATION[indentationLevels];
+ }
+
+
+ /**
* Returns a contingent indentation instance.
* @param indentationLevels The number of levels of indentation to be used.
* @return An appropriate instance.
*/
public ContingentIndentation getContingentIndentation(final int indentationLevels) {
- if (indentationLevels >= MAX_CONTINGENT_INDENTATIONS) {
- throw new IndexOutOfBoundsException("Maximum indentation levels is " + MAX_CONTINGENT_INDENTATIONS);
- }
if (contingentIndentationInstances[indentationLevels] == null) {
- contingentIndentationInstances[indentationLevels] = new ContingentIndentation(indentationLevels);
+ contingentIndentationInstances[indentationLevels] = new ContingentIndentation(indent(indentationLevels));
}
return contingentIndentationInstances[indentationLevels];
}
+
/**
* Returns a forced linebreak instance.
* @return An appropriate instance.
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 14:17:07 UTC (rev 13377)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 14:27:02 UTC (rev 13378)
@@ -166,12 +166,6 @@
/** Command-line return status constant indicating that there was an error parsing the input file. */
public static final byte STATUS_PARSING_ERROR = 3;
- /** Constant used to create the {@link #INDENTATION} array. */
- private static final int MAX_QTY_INDENTATION_LEVELS = 20;
-
- /** Array containing already already-created indentation strings. */
- private static final String[] INDENTATION = new String[MAX_QTY_INDENTATION_LEVELS];
-
/** The configuration for this pretty-printer. */
private ForayPrettyConfig config;
@@ -364,7 +358,7 @@
this.prettyOutput.write(this.config.getLineTerminator());
final int indentLevels = this.computeStartTagIndentation();
if (indentLevels > 0) {
- this.prettyOutput.write(indent(indentLevels));
+ this.prettyOutput.write(this.prettyOutput.indent(indentLevels));
}
this.prettyOutput.write(startTagOpen.toString());
} else {
@@ -430,7 +424,7 @@
this.prettyOutput.flush();
this.prettyOutput.write(this.config.getLineTerminator());
final int indentationLevels = computeEndTagIndentation();
- this.prettyOutput.write(indent(indentationLevels));
+ this.prettyOutput.write(this.prettyOutput.indent(indentationLevels));
}
this.prettyOutput.add("</" + qName + ">");
if (endTagOnNewLine()) {
@@ -526,28 +520,6 @@
}
- /**
- * Returns what should be written to indent a line.
- * @param qtyLevels The number of levels of indentation to be returned.
- * @return The String content that should be written to indent a line.
- */
- private String indent(final int qtyLevels) {
- if (qtyLevels > MAX_QTY_INDENTATION_LEVELS) {
- throw new IllegalArgumentException("Maximum indentation levels is " + MAX_QTY_INDENTATION_LEVELS);
- }
- if (INDENTATION[qtyLevels] == null) {
- final StringBuilder buffer = new StringBuilder(this.config.getIndentString().length() * qtyLevels);
- int numIndents = qtyLevels;
- while (numIndents > 0) {
- buffer.append(this.config.getIndentString());
- numIndents --;
- }
- INDENTATION[qtyLevels] = buffer.toString();
- }
- return INDENTATION[qtyLevels];
- }
-
-
@Override
public void characters(final char[] buffer, final int offset, final int length) {
/* For whatever insanely sadly stupid reason, ignorable whitespace is treated as ignorable whitespace only if
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2025-02-13 14:17:09
|
Revision: 13377
http://sourceforge.net/p/foray/code/13377
Author: victormote
Date: 2025-02-13 14:17:07 +0000 (Thu, 13 Feb 2025)
Log Message:
-----------
Roll ElementStack class into the pretty-print class. The separate class is now handled through a normal Stack of a composite type.
Modified Paths:
--------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
Removed Paths:
-------------
trunk/foray/foray-xml/src/main/java/org/foray/xml/model/ElementStack.java
Modified: trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 13:47:43 UTC (rev 13376)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/ForayPrettyPush.java 2025-02-13 14:17:07 UTC (rev 13377)
@@ -30,9 +30,6 @@
import org.foray.primitive.StringUtils;
import org.foray.xml.dtd.DtdElement;
-import org.foray.xml.model.ElementStack;
-import org.foray.xml.model.ElementStack.ElementUsage;
-import org.foray.xml.model.ElementStack.ModelElementUsage;
import org.foray.xml.model.XmlModelElement;
import org.foray.xml.model.XsdElement;
@@ -66,6 +63,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Stack;
import javax.xml.namespace.QName;
@@ -74,6 +72,91 @@
*/
public class ForayPrettyPush extends SaxParser4a<Object> {
+ /**
+ * Enumeration of element usages.
+ * These usages are not fixed by the element type, but are dependent on the element's position in the stack.
+ * For example, suppose a "Comment" element can appear anywhere in the document, and that it can have mixed content
+ * (i.e. can contain text).
+ * If all of its ancestors are of usage "STRUCTURAL", it is usage "BLOCK".
+ * If instead its immediate ancestor is usage "BLOCK", it is usage "INLINE_MIXED".
+ */
+ private enum ElementUsage {
+ /** An element whose content is not mixed (contains no text), and whose ancestors are all also STRUCTURAL
+ * elements. */
+ STRUCTURAL,
+
+ /** An element whose ancestors are all STRUCTURAL, but which has mixed content. */
+ BLOCK,
+
+ /** An element whose parent is BLOCK, and who has mixed content. */
+ INLINE_MIXED,
+
+ /** An element whose parent is BLOCK, and which does not have mixed content. */
+ INLINE_UNMIXED,
+
+ /** An element whose parent is INLINE_UNMIXED. */
+ INLINE_UNMIXED_CONTENT,
+
+ /** An element not satisfying any of the other usages. */
+ OTHER
+ }
+
+ /**
+ * Wrapper around an {@link XmlModelElement}, storing its usage in this stack.
+ */
+ private final class DocumentElement {
+
+ /** The wrapped model element. */
+ private XmlModelElement modelElement;
+
+ /** The usage for {@link #modelElement} in this stack. */
+ private ElementUsage usage;
+
+ /** The number of levels in the stack between this element and its nearest ancestor
+ * {@link ElementUsage#BLOCK}. */
+ private int distanceFromNearestBlock;
+
+ /**
+ * Constuctor.
+ * @param modelElement The wrapped model element.
+ * @param usage The usage for {@code modelElement} in this stack.
+ * @param distanceFromNearestBlock The number of levels in the stack between this element and its nearest
+ * ancestor {@link ElementUsage#BLOCK}.
+ */
+ private DocumentElement(final XmlModelElement modelElement, final ElementUsage usage,
+ final int distanceFromNearestBlock) {
+ this.modelElement = modelElement;
+ this.usage = usage;
+ this.distanceFromNearestBlock = distanceFromNearestBlock;
+ }
+
+ /**
+ * Returns the wrapped model element.
+ * @return The wrapped model element.
+ */
+ public XmlModelElement getModelElement() {
+ return this.modelElement;
+ }
+
+ /**
+ * Returns the usage for {@link #getModelElement()} in this stack.
+ * @return the usage for {@link #getModelElement()} in this stack.
+ */
+ public ElementUsage getUsage() {
+ return this.usage;
+ }
+
+ /**
+ * Returns the number of levels in the stack between this element and its nearest ancestor
+ * {@link ElementUsage#BLOCK}.
+ * @return The number of levels in the stack between this element and its nearest ancestor
+ * {@link ElementUsage#BLOCK}.
+ */
+ public int getDistanceFromNearestBlock() {
+ return this.distanceFromNearestBlock;
+ }
+ }
+
/** Command-line status constant indicating that the command line itself was not properly formed. */
public static final byte STATUS_COMMAND_LINE_ERROR = 1;
@@ -99,7 +182,7 @@
private DtdElement rootElement;
/** The element stack. */
- private ElementStack elementStack = new ElementStack();
+ private Stack<DocumentElement> elementStack = new Stack<DocumentElement>();
/** Map whose key is a String qname, and whose value is a QName instance. Used to avoid unnecessary object
* creation. */
@@ -200,15 +283,31 @@
xsdElement = new XsdElement(schemaElement);
schemaElementMap.put(schemaElement, xsdElement);
}
- this.elementStack.push(xsdElement);
+ final DocumentElement documentElement = createDocumentElement(xsdElement);
+ this.elementStack.push(documentElement);
this.lastStartedElement = xsdElement;
} else {
- this.elementStack.push(getDtd().getElement(qNameString));
+ final DtdElement dtdElement = getDtd().getElement(qNameString);
+ final DocumentElement documentElement = createDocumentElement(dtdElement);
+ this.elementStack.push(documentElement);
}
this.topElementWritten = false;
}
+
/**
+ * Wraps a model element and adds some metadata to it that is useful for pretty-print processing.
+ * @param element The model element to be wrapped.
+ * @return The wrapper.
+ */
+ private DocumentElement createDocumentElement(final XmlModelElement element) {
+ final ElementUsage usage = computeUsage(element);
+ final int distanceFromNearestBlock = computeDistanceFromNearestBlock(element);
+ final DocumentElement modelElement = new DocumentElement(element, usage, distanceFromNearestBlock);
+ return modelElement;
+ }
+
+ /**
* Writes the element at the top of the stack if it has not already been written.
* @param isEmpty Indicates whether the element has any content or not.
*/
@@ -372,7 +471,7 @@
* @return The number of levels of indentation for the start tag of the current element.
*/
private int computeStartTagIndentation() {
- final ModelElementUsage modelElement = this.elementStack.peek();
+ final DocumentElement modelElement = this.elementStack.peek();
switch (modelElement.getUsage()) {
case STRUCTURAL:
case BLOCK: return this.elementStack.size() - 1;
@@ -390,7 +489,7 @@
* @return True if the end tag for the current element should be written on a new line.
*/
private boolean endTagOnNewLine() {
- final ModelElementUsage modelElementUsage = this.elementStack.peek();
+ final DocumentElement modelElementUsage = this.elementStack.peek();
final ElementUsage usage = modelElementUsage.getUsage();
switch (usage) {
case STRUCTURAL: return true;
@@ -415,7 +514,7 @@
* @return The number of levels of indentation for the end tag of the current element.
*/
private int computeEndTagIndentation() {
- final ModelElementUsage modelElementUsage = this.elementStack.peek();
+ final DocumentElement modelElementUsage = this.elementStack.peek();
switch (modelElementUsage.getUsage()) {
case STRUCTURAL: return this.elementStack.size() - 1;
case BLOCK:
@@ -604,7 +703,72 @@
throw new UnsupportedOperationException();
}
+
/**
+ * Computes the usage of the element that is about to be added to the stack.
+ * @param newElement The element to be added to the stack.
+ * @return The computed usage for {@code newElement}.
+ */
+ private ElementUsage computeUsage(final XmlModelElement newElement) {
+ final DocumentElement topElement = this.elementStack.isEmpty() ? null : this.elementStack.peek();
+ if (topElement == null
+ || topElement.usage == ElementUsage.STRUCTURAL) {
+ if (newElement.canContainPCDATA()) {
+ return ElementUsage.BLOCK;
+ } else {
+ return ElementUsage.STRUCTURAL;
+ }
+ }
+ if (topElement.usage == ElementUsage.BLOCK) {
+ if (newElement.canContainPCDATA()) {
+ return ElementUsage.INLINE_MIXED;
+ } else {
+ return ElementUsage.INLINE_UNMIXED;
+ }
+ }
+ if (topElement.usage == ElementUsage.INLINE_UNMIXED) {
+ return ElementUsage.INLINE_UNMIXED_CONTENT;
+ }
+ if (topElement.usage == ElementUsage.INLINE_MIXED) {
+ if (newElement.canContainPCDATA()) {
+ return ElementUsage.INLINE_MIXED;
+ } else {
+ return ElementUsage.INLINE_UNMIXED;
+ }
+ }
+ if (topElement.usage == ElementUsage.INLINE_UNMIXED_CONTENT) {
+ if (newElement.canContainPCDATA()) {
+ return ElementUsage.INLINE_MIXED;
+ } else {
+ return ElementUsage.INLINE_UNMIXED;
+ }
+ }
+ return ElementUsage.OTHER;
+ }
+
+
+ /**
+ * Computes the number of levels in the stack between the new element and its nearest ancestor
+ * {@link ElementUsage#BLOCK}.
+ * @param newElement The element to be added to the stack.
+ * @return The computed levels for {@code newElement}.
+ */
+ private int computeDistanceFromNearestBlock(final XmlModelElement newElement) {
+ final DocumentElement topElement = this.elementStack.isEmpty() ? null : this.elementStack.peek();
+ if (topElement == null) {
+ return 0;
+ }
+ if (topElement.getUsage() == ElementUsage.BLOCK) {
+ return 1;
+ }
+ if (topElement.getDistanceFromNearestBlock() == 0) {
+ return 0;
+ }
+ return topElement.getDistanceFromNearestBlock() + 1;
+ }
+
+
+ /**
* Returns the command-line options for the {@link #main(String[])} method.
* @return Command-line options.
*/
Deleted: trunk/foray/foray-xml/src/main/java/org/foray/xml/model/ElementStack.java
===================================================================
--- trunk/foray/foray-xml/src/main/java/org/foray/xml/model/ElementStack.java 2025-02-13 13:47:43 UTC (rev 13376)
+++ trunk/foray/foray-xml/src/main/java/org/foray/xml/model/ElementStack.java 2025-02-13 14:17:07 UTC (rev 13377)
@@ -1,271 +0,0 @@
-/*
- * Copyright 2006 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.xml.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A stack of {@link XmlModelElement} instances.
- */
-public class ElementStack {
-
- /**
- * Enumeration of element usages.
- * These usages are not fixed by the element type, but are dependent on the element's position in the stack.
- * For example, suppose a "Comment" element can appear anywhere in the document, and that it can have mixed content
- * (i.e. can contain text).
- * If all of its ancestors are of usage "STRUCTURAL", it is usage "BLOCK".
- * If instead its immediate ancestor is usage "BLOCK", it is usage "INLINE_MIXED".
- */
- public enum ElementUsage {
- /** An element whose content is not mixed (contains no text), and whose ancestors are all also STRUCTURAL
- * elements. */
- STRUCTURAL,
-
- /** An element whose ancestors are all STRUCTURAL, but which has mixed content. */
- BLOCK,
-
- /** An element whose parent is BLOCK, and who has mixed content. */
- INLINE_MIXED,
-
- /** An element whose parent is BLOCK, and which does not have mixed content. */
- INLINE_UNMIXED,
-
- /** An element whose parent is INLINE_UNMIXED. */
- INLINE_UNMIXED_CONTENT,
-
- /** An element not satisfying any of the other usages. */
- OTHER
- }
-
- /**
- * Wrapper around an {@link XmlModelElement}, storing its usage in this stack.
- */
- public final class ModelElementUsage {
-
- /** The wrapped model element. */
- private XmlModelElement modelElement;
-
- /** The usage for {@link #modelElement} in this stack. */
- private ElementUsage usage;
-
- /** The number of levels in the stack between this element and its nearest ancestor
- * {@link ElementUsage#BLOCK}. */
- private int distanceFromNearestBlock;
-
- /**
- * Constuctor.
- * @param modelElement The wrapped model element.
- * @param usage The usage for {@code modelElement} in this stack.
- * @param distanceFromNearestBlock The number of levels in the stack between this element and its nearest
- * ancestor {@link ElementUsage#BLOCK}.
- */
- private ModelElementUsage(final XmlModelElement modelElement, final ElementUsage usage,
- final int distanceFromNearestBlock) {
- this.modelElement = modelElement;
- this.usage = usage;
- this.distanceFromNearestBlock = distanceFromNearestBlock;
- }
-
- /**
- * Returns the wrapped model element.
- * @return The wrapped model element.
- */
- public XmlModelElement getModelElement() {
- return this.modelElement;
- }
-
- /**
- * Returns the usage for {@link #getModelElement()} in this stack.
- * @return the usage for {@link #getModelElement()} in this stack.
- */
- public ElementUsage getUsage() {
- return this.usage;
- }
-
- /**
- * Returns the number of levels in the stack between this element and its nearest ancestor
- * {@link ElementUsage#BLOCK}.
- * @return The number of levels in the stack between this element and its nearest ancestor
- * {@link ElementUsage#BLOCK}.
- */
- public int getDistanceFromNearestBlock() {
- return this.distanceFromNearestBlock;
- }
- }
-
- /** The actual element stack. */
- private List<ModelElementUsage> stack = new ArrayList<ModelElementUsage>();
-
- /**
- * Constructor.
- */
- public ElementStack() {
- }
-
- /**
- * Push an item onto the stack.
- * @param element The element to push onto the stack.
- */
- public void push(final XmlModelElement element) {
- if (element == null) {
- throw new IllegalArgumentException("Cannot add a null item to the element stack.");
- }
- final ElementUsage usage = computeUsage(element);
- final int distanceFromNearestBlock = computeDistanceFromNearestBlock(element);
- final ModelElementUsage modelElement = new ModelElementUsage(element, usage, distanceFromNearestBlock);
- this.stack.add(modelElement);
- }
-
- /**
- * Computes the usage of the element that is about to be added to the stack.
- * @param newElement The element to be added to the stack.
- * @return The computed usage for {@code newElement}.
- */
- private ElementUsage computeUsage(final XmlModelElement newElement) {
- final ModelElementUsage topElement = peek();
- if (topElement == null
- || topElement.usage == ElementUsage.STRUCTURAL) {
- if (newElement.canContainPCDATA()) {
- return ElementUsage.BLOCK;
- } else {
- return ElementUsage.STRUCTURAL;
- }
- }
- if (topElement.usage == ElementUsage.BLOCK) {
- if (newElement.canContainPCDATA()) {
- return ElementUsage.INLINE_MIXED;
- } else {
- return ElementUsage.INLINE_UNMIXED;
- }
- }
- if (topElement.usage == ElementUsage.INLINE_UNMIXED) {
- return ElementUsage.INLINE_UNMIXED_CONTENT;
- }
- if (topElement.usage == ElementUsage.INLINE_MIXED) {
- if (newElement.canContainPCDATA()) {
- return ElementUsage.INLINE_MIXED;
- } else {
- return ElementUsage.INLINE_UNMIXED;
- }
- }
- if (topElement.usage == ElementUsage.INLINE_UNMIXED_CONTENT) {
- if (newElement.canContainPCDATA()) {
- return ElementUsage.INLINE_MIXED;
- } else {
- return ElementUsage.INLINE_UNMIXED;
- }
- }
- return ElementUsage.OTHER;
- }
-
-
- /**
- * Computes the number of levels in the stack between the new element and its nearest ancestor
- * {@link ElementUsage#BLOCK}.
- * @param newElement The element to be added to the stack.
- * @return The computed levels for {@code newElement}.
- */
- private int computeDistanceFromNearestBlock(final XmlModelElement newElement) {
- final ModelElementUsage modelElement = peek();
- if (modelElement == null) {
- return 0;
- }
- if (modelElement.getUsage() == ElementUsage.BLOCK) {
- return 1;
- }
- if (modelElement.getDistanceFromNearestBlock() == 0) {
- return 0;
- }
- return modelElement.getDistanceFromNearestBlock() + 1;
- }
-
- /**
- * Pop an item off of the stack.
- * @return The popped element, or null if the stack is empty.
- */
- public ModelElementUsage pop() {
- final ModelElementUsage topElement = peek();
- if (topElement != null) {
- this.stack.remove(this.stack.size() - 1);
- }
- return topElement;
- }
-
- /**
- * Peek at the top element on the stack without removing it from the stack.
- * @return The top element on the stack.
- */
- public ModelElementUsage peek() {
- return peek(0);
- }
-
- /**
- * Return an element from the stack without removing either it or anything else from the stack.
- * @param indexFromTop The number of items deep in the stack the desired element is.
- * To get the top element, set to 0. To get the next element down, set to 1, etc.
- * @return The nth item down the stack, where n is indexFromTop.
- */
- public ModelElementUsage peek(final int indexFromTop) {
- if (this.stack.size() <= indexFromTop) {
- return null;
- }
- final int index = this.stack.size() - indexFromTop - 1;
- return this.stack.get(index);
- }
-
- /**
- * Returns the element at the bottom of the stack.
- * @return The element at the bottom of the stack, or null if the stack is empty.
- */
- public ModelElementUsage getBottom() {
- if (this.stack.size() < 1) {
- return null;
- }
- return this.stack.get(0);
- }
-
- /**
- * Return the number of elements on the stack.
- * @return The number of elements on the stack.
- */
- public int size() {
- return this.stack.size();
- }
-
- /**
- * Indicates whether the stack is empty.
- * @return True if and only if the stack has no elements on it.
- */
- public boolean isEmpty() {
- return this.stack.isEmpty();
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|