[FOray-commit] SF.net SVN: foray:[12956] trunk/foray/foray-fotree/src
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2022-12-26 16:02:10
|
Revision: 12956
http://sourceforge.net/p/foray/code/12956
Author: victormote
Date: 2022-12-26 16:02:07 +0000 (Mon, 26 Dec 2022)
Log Message:
-----------
Rename class for completeness and consistency.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Function.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromNearestSpecifiedValue.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnNearestSpecProp.java
trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnNearestSpecPropTests.java
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromNearestSpecifiedValue.java (from rev 12923, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnNearestSpecProp.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromNearestSpecifiedValue.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnFromNearestSpecifiedValue.java 2022-12-26 16:02:07 UTC (rev 12956)
@@ -0,0 +1,152 @@
+/*
+ * 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;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.Property;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyId;
+import org.foray.fotree.fo.FoPropertyId;
+
+import java.awt.Color;
+
+/**
+ * The "from-nearest-specified-value" function in XSL-FO.
+ */
+public class FnFromNearestSpecifiedValue extends FnAbstractNamedProperty {
+
+ /**
+ * Constructor.
+ * @param arguments The arguments to this function.
+ * @param propertyType The property which is calling this function.
+ * @throws PropertyException For errors creating this function.
+ */
+ public FnFromNearestSpecifiedValue(final Expr[] arguments,
+ final PropertyId propertyType) throws PropertyException {
+ super(arguments, propertyType);
+ }
+
+ @Override
+ public String getFunctionName() {
+ return "from-nearest-specified-value";
+ }
+
+ /**
+ * 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();
+ }
+
+ @Override
+ public boolean canEvalNumeric() {
+ return false;
+ }
+
+ @Override
+ public double evalNumeric() {
+ throw this.evalNumericException();
+ }
+
+ @Override
+ public boolean canEvalLength() {
+ return false;
+ }
+
+ @Override
+ public byte getUnitPower() {
+ throw this.evalNumericException();
+ }
+
+ @Override
+ public int evalLength(final int pointSize) {
+ throw this.evalLengthException();
+ }
+
+ @Override
+ public boolean canEvalColor() {
+ return false;
+ }
+
+ @Override
+ public Color evalColor() {
+ throw evalColorException();
+ }
+
+ @Override
+ public boolean lengthRequiresFontSize() {
+ return false;
+ }
+
+ @Override
+ public boolean canEvalInteger() {
+ return false;
+ }
+
+ @Override
+ public int evalInteger() {
+ throw evalIntegerException();
+ }
+
+ @Override
+ public boolean canEvalKeyword() {
+ return false;
+ }
+
+ @Override
+ public PvKeyword evalKeyword() {
+ throw this.evalKeywordException();
+ }
+
+ @Override
+ public boolean canEvalPercentage() {
+ return false;
+ }
+
+ @Override
+ public float evalPercentage() {
+ throw evalPercentageException();
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnNearestSpecProp.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnNearestSpecProp.java 2022-12-26 15:35:22 UTC (rev 12955)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/FnNearestSpecProp.java 2022-12-26 16:02:07 UTC (rev 12956)
@@ -1,152 +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;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.Property;
-import org.foray.fotree.PropertyException;
-import org.foray.fotree.PropertyId;
-import org.foray.fotree.fo.FoPropertyId;
-
-import java.awt.Color;
-
-/**
- * The "nearest-specified-value" function in XSL-FO.
- */
-public class FnNearestSpecProp extends FnAbstractNamedProperty {
-
- /**
- * Constructor.
- * @param arguments The arguments to this function.
- * @param propertyType The property which is calling this function.
- * @throws PropertyException For errors creating this function.
- */
- public FnNearestSpecProp(final Expr[] arguments,
- final PropertyId propertyType) throws PropertyException {
- super(arguments, propertyType);
- }
-
- @Override
- public String getFunctionName() {
- return "from-nearest-specified-value";
- }
-
- /**
- * 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();
- }
-
- @Override
- public boolean canEvalNumeric() {
- return false;
- }
-
- @Override
- public double evalNumeric() {
- throw this.evalNumericException();
- }
-
- @Override
- public boolean canEvalLength() {
- return false;
- }
-
- @Override
- public byte getUnitPower() {
- throw this.evalNumericException();
- }
-
- @Override
- public int evalLength(final int pointSize) {
- throw this.evalLengthException();
- }
-
- @Override
- public boolean canEvalColor() {
- return false;
- }
-
- @Override
- public Color evalColor() {
- throw evalColorException();
- }
-
- @Override
- public boolean lengthRequiresFontSize() {
- return false;
- }
-
- @Override
- public boolean canEvalInteger() {
- return false;
- }
-
- @Override
- public int evalInteger() {
- throw evalIntegerException();
- }
-
- @Override
- public boolean canEvalKeyword() {
- return false;
- }
-
- @Override
- public PvKeyword evalKeyword() {
- throw this.evalKeywordException();
- }
-
- @Override
- public boolean canEvalPercentage() {
- return false;
- }
-
- @Override
- public float evalPercentage() {
- throw evalPercentageException();
- }
-
-}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Function.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Function.java 2022-12-26 15:35:22 UTC (rev 12955)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/value/Function.java 2022-12-26 16:02:07 UTC (rev 12956)
@@ -75,7 +75,7 @@
return new FnFloor(arguments);
}
case "from-nearest-specified-value": {
- return new FnNearestSpecProp(arguments, propertyType);
+ return new FnFromNearestSpecifiedValue(arguments, propertyType);
}
case "from-page-master-region": {
return new FnFromPageMasterRegion(arguments, propertyType);
Copied: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java (from rev 12923, trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnNearestSpecPropTests.java)
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java (rev 0)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnFromNearestSpecifiedValueTests.java 2022-12-26 16:02:07 UTC (rev 12956)
@@ -0,0 +1,60 @@
+/*
+ * 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);
+ }
+
+}
Deleted: trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnNearestSpecPropTests.java
===================================================================
--- trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnNearestSpecPropTests.java 2022-12-26 15:35:22 UTC (rev 12955)
+++ trunk/foray/foray-fotree/src/test/java/org/foray/fotree/value/FnNearestSpecPropTests.java 2022-12-26 16:02:07 UTC (rev 12956)
@@ -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 FnNearestSpecProp}.
- */
-public class FnNearestSpecPropTests {
-
- /** 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[] {
- FnNearestSpecPropTests.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",
- FnNearestSpecPropTests.OPERAND_ARRAY_1, null);
- assertTrue(fn instanceof FnNearestSpecProp);
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|