Revision: 12788
http://sourceforge.net/p/foray/code/12788
Author: victormote
Date: 2022-12-06 02:45:40 +0000 (Tue, 06 Dec 2022)
Log Message:
-----------
Rename MathML namespace and object maker classes for consistency.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/ObjectMakerMath.java
Removed Paths:
-------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathObjectMaker.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-12-06 02:33:22 UTC (rev 12787)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTree4a.java 2022-12-06 02:45:40 UTC (rev 12788)
@@ -32,7 +32,7 @@
import org.foray.fotree.fo.NamespaceFo;
import org.foray.fotree.fo.obj.Root4a;
import org.foray.fotree.foray.NamespaceForay;
-import org.foray.fotree.math.MathNamespace;
+import org.foray.fotree.math.NamespaceMath;
import org.foray.fotree.svg.NamespaceSvg;
import org.foray.fotree.xml.NamespaceXml;
@@ -232,7 +232,7 @@
* Return the MathML namespace instance.
* @return The MathML namespace instance.
*/
- public MathNamespace getMathNamespace() {
+ public NamespaceMath getMathNamespace() {
return getTreeServer().getMathNamespace();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-12-06 02:33:22 UTC (rev 12787)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2022-12-06 02:45:40 UTC (rev 12788)
@@ -32,7 +32,7 @@
import org.foray.fotree.axsl.NamespaceAxsl;
import org.foray.fotree.fo.NamespaceFo;
import org.foray.fotree.foray.NamespaceForay;
-import org.foray.fotree.math.MathNamespace;
+import org.foray.fotree.math.NamespaceMath;
import org.foray.fotree.svg.NamespaceSvg;
import org.foray.fotree.xml.NamespaceXml;
@@ -87,7 +87,7 @@
private NamespaceSvg namespaceSVG;
/** The "MathML" namespace. */
- private MathNamespace namespaceMath;
+ private NamespaceMath namespaceMath;
/** The "XML namespace. */
private NamespaceXml namespaceXML;
@@ -131,8 +131,8 @@
registerNamespace(NamespaceSvg.getInstance());
this.namespaceSVG = NamespaceSvg.getInstance();
- this.registerNamespace(MathNamespace.getInstance());
- this.namespaceMath = MathNamespace.getInstance();
+ this.registerNamespace(NamespaceMath.getInstance());
+ this.namespaceMath = NamespaceMath.getInstance();
registerNamespace(NamespaceForay.getInstance());
this.namespaceForay = NamespaceForay.getInstance();
@@ -197,7 +197,7 @@
* Returns the namespace used for "MathML" items.
* @return The namespace used for "MathML" items.
*/
- public MathNamespace getMathNamespace() {
+ public NamespaceMath getMathNamespace() {
return this.namespaceMath;
}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java 2022-12-06 02:33:22 UTC (rev 12787)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java 2022-12-06 02:45:40 UTC (rev 12788)
@@ -1,114 +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.math;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.FoTree4a;
-import org.foray.fotree.FoTreeParser4a;
-import org.foray.fotree.Namespace;
-import org.foray.fotree.Property;
-import org.foray.fotree.PropertyException;
-import org.foray.fotree.PropertyList;
-import org.foray.fotree.PropertyListUnparsed;
-
-import org.axsl.fotree.FoTreeException;
-import org.axsl.graphic.MathGraphic;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-
-/**
- * This class manages the namespace that is used for the Math Markup Language
- * (MathML).
- */
-public final class MathNamespace extends Namespace {
-
- /** The singleton instance. */
- private static MathNamespace theInstance;
-
- /**
- * Private constructor. To obtain the singleton instance, use {@link #getInstance()}.
- */
- private MathNamespace() { }
-
- @Override
- public String getNamespaceURI() {
- return MathGraphic.MATHML_NS_URI;
- }
-
- @Override
- public String getTypicalPrefix() {
- return "m";
- }
-
- @Override
- public FoObj parseElementForNS(final FoTree4a foTree, final String localName,
- final FoObj currentFObj, final PropertyList list,
- final Locator locator) throws FoTreeException {
- return MathObjectMaker.makeObject(localName, currentFObj, list);
- }
-
- @Override
- public void parseAttributes(final PropertyList propertyList,
- final Attributes attlist, final FoObj currentFObj,
- final Locator locator, final FoTreeParser4a builder) {
- /*
- * There is nothing to do here. We passed the raw attributes when
- * we created the propertyList instance.
- */
- return;
- }
-
- @Override
- public Property parseAttributeForNS(final Attributes attributes,
- final String attributeName, final String attributeValue,
- final FoObj fobj, final Locator locator)
- throws PropertyException {
- /* This method is required by the abstract superclass Namespace, but is
- * not used, because the parseAttributes method does all of the work. */
- return null;
- }
-
- @Override
- protected PropertyList createNewPropertyList(final Attributes attlist) {
- return new PropertyListUnparsed(attlist);
- }
-
- /**
- * Returns the singleton instance of this class.
- * @return The singleton instance of this class.
- */
- public static MathNamespace getInstance() {
- if (MathNamespace.theInstance == null) {
- MathNamespace.theInstance = new MathNamespace();
- }
- return MathNamespace.theInstance;
- }
-
-}
Deleted: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathObjectMaker.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathObjectMaker.java 2022-12-06 02:33:22 UTC (rev 12787)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathObjectMaker.java 2022-12-06 02:45:40 UTC (rev 12788)
@@ -1,82 +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.math;
-
-import org.foray.fotree.FoObj;
-import org.foray.fotree.PropertyList;
-import org.foray.fotree.PropertyListUnparsed;
-import org.foray.fotree.fo.obj.InstreamForeignObject4a;
-import org.foray.fotree.math.obj.InstreamMathElement;
-
-import org.axsl.fotree.FoTreeException;
-
-/**
- * Factory class for creating formatting objects in the "m" (MathML) namespace.
- */
-public final class MathObjectMaker {
-
- /**
- * Private constructor. This is a utility class and should never be
- * instantiated.
- */
- private MathObjectMaker() { }
-
- /**
- * Converts an unparsed MathML element into an FoObj instance that can be
- * added to the FO Tree.
- * @param objectName The unparsed MathML element name.
- * @param parent The parent FoObj.
- * @param propertyList The property list of the parent FoObj.
- * @return The new FoObj instance for this MathML element.
- * @throws FoTreeException If the parent object is not an instance of
- * {@link InstreamForeignObject4a}.
- */
- public static FoObj makeObject(final String objectName, final FoObj parent,
- final PropertyList propertyList) throws FoTreeException {
- /* We only need to handle one element here, the root element, which is
- * always "math". */
- if (! objectName.equals("math")) {
- throw new IllegalArgumentException("Cannot parse any MathML "
- + "elements except \"math\".");
- }
- /* The PropertyList must be of the unparsed variety. */
- final PropertyListUnparsed propertyListUnparsed
- = (PropertyListUnparsed) propertyList;
- if (parent instanceof InstreamForeignObject4a) {
- final InstreamForeignObject4a ifo =
- (InstreamForeignObject4a) parent;
- return new InstreamMathElement(ifo, propertyListUnparsed);
- } else {
- parent.throwException("Instream MathML content must be inside "
- + "an fo:instream-foreign-object.");
- return null;
- }
- }
-
-}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java (from rev 12787, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathNamespace.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/NamespaceMath.java 2022-12-06 02:45:40 UTC (rev 12788)
@@ -0,0 +1,114 @@
+/*
+ * 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.math;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.FoTree4a;
+import org.foray.fotree.FoTreeParser4a;
+import org.foray.fotree.Namespace;
+import org.foray.fotree.Property;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.PropertyList;
+import org.foray.fotree.PropertyListUnparsed;
+
+import org.axsl.fotree.FoTreeException;
+import org.axsl.graphic.MathGraphic;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
+/**
+ * This class manages the namespace that is used for the Math Markup Language
+ * (MathML).
+ */
+public final class NamespaceMath extends Namespace {
+
+ /** The singleton instance. */
+ private static NamespaceMath theInstance;
+
+ /**
+ * Private constructor. To obtain the singleton instance, use {@link #getInstance()}.
+ */
+ private NamespaceMath() { }
+
+ @Override
+ public String getNamespaceURI() {
+ return MathGraphic.MATHML_NS_URI;
+ }
+
+ @Override
+ public String getTypicalPrefix() {
+ return "m";
+ }
+
+ @Override
+ public FoObj parseElementForNS(final FoTree4a foTree, final String localName,
+ final FoObj currentFObj, final PropertyList list,
+ final Locator locator) throws FoTreeException {
+ return ObjectMakerMath.makeObject(localName, currentFObj, list);
+ }
+
+ @Override
+ public void parseAttributes(final PropertyList propertyList,
+ final Attributes attlist, final FoObj currentFObj,
+ final Locator locator, final FoTreeParser4a builder) {
+ /*
+ * There is nothing to do here. We passed the raw attributes when
+ * we created the propertyList instance.
+ */
+ return;
+ }
+
+ @Override
+ public Property parseAttributeForNS(final Attributes attributes,
+ final String attributeName, final String attributeValue,
+ final FoObj fobj, final Locator locator)
+ throws PropertyException {
+ /* This method is required by the abstract superclass Namespace, but is
+ * not used, because the parseAttributes method does all of the work. */
+ return null;
+ }
+
+ @Override
+ protected PropertyList createNewPropertyList(final Attributes attlist) {
+ return new PropertyListUnparsed(attlist);
+ }
+
+ /**
+ * Returns the singleton instance of this class.
+ * @return The singleton instance of this class.
+ */
+ public static NamespaceMath getInstance() {
+ if (NamespaceMath.theInstance == null) {
+ NamespaceMath.theInstance = new NamespaceMath();
+ }
+ return NamespaceMath.theInstance;
+ }
+
+}
Copied: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/ObjectMakerMath.java (from rev 12720, trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/MathObjectMaker.java)
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/ObjectMakerMath.java (rev 0)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/math/ObjectMakerMath.java 2022-12-06 02:45:40 UTC (rev 12788)
@@ -0,0 +1,82 @@
+/*
+ * 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.math;
+
+import org.foray.fotree.FoObj;
+import org.foray.fotree.PropertyList;
+import org.foray.fotree.PropertyListUnparsed;
+import org.foray.fotree.fo.obj.InstreamForeignObject4a;
+import org.foray.fotree.math.obj.InstreamMathElement;
+
+import org.axsl.fotree.FoTreeException;
+
+/**
+ * Factory class for creating formatting objects in the "m" (MathML) namespace.
+ */
+public final class ObjectMakerMath {
+
+ /**
+ * Private constructor. This is a utility class and should never be
+ * instantiated.
+ */
+ private ObjectMakerMath() { }
+
+ /**
+ * Converts an unparsed MathML element into an FoObj instance that can be
+ * added to the FO Tree.
+ * @param objectName The unparsed MathML element name.
+ * @param parent The parent FoObj.
+ * @param propertyList The property list of the parent FoObj.
+ * @return The new FoObj instance for this MathML element.
+ * @throws FoTreeException If the parent object is not an instance of
+ * {@link InstreamForeignObject4a}.
+ */
+ public static FoObj makeObject(final String objectName, final FoObj parent,
+ final PropertyList propertyList) throws FoTreeException {
+ /* We only need to handle one element here, the root element, which is
+ * always "math". */
+ if (! objectName.equals("math")) {
+ throw new IllegalArgumentException("Cannot parse any MathML "
+ + "elements except \"math\".");
+ }
+ /* The PropertyList must be of the unparsed variety. */
+ final PropertyListUnparsed propertyListUnparsed
+ = (PropertyListUnparsed) propertyList;
+ if (parent instanceof InstreamForeignObject4a) {
+ final InstreamForeignObject4a ifo =
+ (InstreamForeignObject4a) parent;
+ return new InstreamMathElement(ifo, propertyListUnparsed);
+ } else {
+ parent.throwException("Instream MathML content must be inside "
+ + "an fo:instream-foreign-object.");
+ return null;
+ }
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|