From 7b0726b50d8a60b1f011cceeed4f16b3af7e0847 Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Wed, 25 Jun 2003 17:11:05 +0000 Subject: [PATCH] Cleaned up code generation to reduce Eclipse warnings. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196531 13f79535-47bb-0310-9956-ffa450edef68 --- src/codegen/enumgen.xsl | 193 ++++--- src/codegen/genconst.xsl | 50 +- src/codegen/properties.xsl | 1109 +++++++++++++++++++++++------------- 3 files changed, 851 insertions(+), 501 deletions(-) diff --git a/src/codegen/enumgen.xsl b/src/codegen/enumgen.xsl index cc70e234a..e21366c3b 100644 --- a/src/codegen/enumgen.xsl +++ b/src/codegen/enumgen.xsl @@ -62,43 +62,54 @@ Software Foundation, please see . - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - -package org.apache.fop.fo.properties; - - - public interface - - extends .Enums - { - - public final static int = Constants.; - - - - - } - - + + + + + + + + + + package org.apache.fop.fo.properties; + + + + public interface + + + extends + + .Enums + + { + + + int + + = Constants. + + ; + + + + + } + + + @@ -106,66 +117,92 @@ package org.apache.fop.fo.properties; - public interface { + + public interface + + { + - public final static int = Constants.; + + int + + = Constants. + + ; - } + + } + - + - - - - - - - - - public interface extends .Enums { } - - + + + + + + + + + + public interface + + extends + + .Enums { } + + + - false + + + false + - - - - - - - - - - - - - - - + + + + + + - + - - public interface extends .Enums. { - } - - - - - + + + + + + + + - + + + public interface + + extends + + .Enums. + + { } + + + + + + + diff --git a/src/codegen/genconst.xsl b/src/codegen/genconst.xsl index f45de83bc..518b3a418 100644 --- a/src/codegen/genconst.xsl +++ b/src/codegen/genconst.xsl @@ -56,17 +56,20 @@ Software Foundation, please see . - + - : + : + package org.apache.fop.fo.properties; -public interface Constants { - - - +public interface Constants { + + + + } + @@ -75,21 +78,26 @@ public interface Constants { - - - - - - - - - - public final static int = ; - - - - - + + + + + + + + + + + int + + = + + ; + + + + + diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index 5193d0dd4..37a2a8710 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -65,61 +65,85 @@ Software Foundation, please see . + /** Return object used to calculate base Length * for percent specifications. */ - public PercentBase getPercentBase(final FObj fo, final PropertyList propertyList) { - - - return new LengthBase(fo, propertyList, LengthBase.); - - - return (new LengthBase(fo, propertyList, LengthBase.CUSTOM_BASE ) { + public PercentBase getPercentBase(final FObj fo, final PropertyList propertyList) { + + + + return new LengthBase(fo, propertyList, LengthBase. + ); + + + + + + return new LengthBase(fo, propertyList, LengthBase.CUSTOM_BASE) { public int getBaseLength() { - return (); + return ( + + ); } - }); - - - } + }); + + + + } + protected boolean isAutoLengthAllowed() { - return true; - } + return true; + } - public Property checkEnumValues(String value) { + + public Property checkEnumValues(String value) { - + - return super.checkEnumValues(value); - } + + return super.checkEnumValues(value); + } + // Initialize hashtable of keywords static HashMap s_htKeywords; static { - s_htKeywords = new HashMap(); + s_htKeywords = new HashMap( + + ); - s_htKeywords.put("", ""); - + + s_htKeywords.put(" + + ", " + + "); + + } + protected String checkValueKeywords(String keyword) { - String value = (String)s_htKeywords.get(keyword); - if (value == null) { - return super.checkValueKeywords(keyword); - } - else return value; - } + String value = (String)s_htKeywords.get(keyword); + if (value == null) { + return super.checkValueKeywords(keyword); + } + else return value; + } @@ -131,70 +155,98 @@ Software Foundation, please see . + select="../compound/subproperty[@set-by-shorthand]"/> - - - - - - + + + + + + + + // See if other value types are acceptable - protected Property convertPropertyDatatype(Property p, - PropertyList propertyList, FObj fo) { - - { - - - - - + protected Property convertPropertyDatatype( + Property p, PropertyList propertyList, FObj fo) { + + + + + + - = - p.get(); - if ( != null) { - return new ( - ); - } - } + + + + + + = p.get + + (); + if ( + + != null) { + return new + ( + + ); + } - return super.convertPropertyDatatype(p, propertyList, fo); - } + + return super.convertPropertyDatatype(p, propertyList, fo); + } - - - - - - protected String getDefaultFor() { - return ""; - } + + + + + + + protected String getDefaultFor + + () { + return " + + "; + } - private Property m_defaultProp=null; + + private Property m_defaultProp=null; - public Property make(PropertyList propertyList) throws FOPException { - - return make(propertyList, "", propertyList.getParentFObj()); - + + public Property make(PropertyList propertyList) throws FOPException { + + + + return make(propertyList, " + + ", propertyList.getParentFObj()); + + + if (m_defaultProp == null) { - m_defaultProp=make(propertyList, "", propertyList.getParentFObj()); - } - return m_defaultProp; - - } + m_defaultProp=make(propertyList, " + + ", propertyList.getParentFObj()); + } + return m_defaultProp; + + + + } @@ -205,410 +257,654 @@ Software Foundation, please see . - - - - - - - - - - - - - - - - - - Maker - - - - - - + + + + + + + + + + + + + + + - - - - - .Maker - - - - - - Property.Maker - - - + + + + Maker + + - - - - implements - + + + + - -package org.apache.fop.fo.properties; - -import java.util.HashMap; -import org.apache.fop.datatypes.*; -import org.apache.fop.fo.*; -import org.apache.fop.apps.FOPException; - -public class extends { - - - - public interface Enums { - - int = Constants.; - - - - - - - - public interface { - - int = Constants.; - - } - - } - + + + + + .Maker + + + + + + Property.Maker + + + + + + + + implements + + + + package org.apache.fop.fo.properties; + + + +import java.util.HashMap; + + + +import org.apache.fop.datatypes.*; + + +import org.apache.fop.fo.*; + + +import org.apache.fop.apps.FOPException; + + + +public class + + extends + + { + + + + + public interface Enums { + + + int + + = Constants. + + ; + + + + + + + + + public interface + + { + + + int + + = Constants. + + ; + + + } + + + } + - - - protected final static EnumProperty s_prop = new EnumProperty(Enums.); - + + + + protected final static EnumProperty s_prop + + = new EnumProperty( + + Enums. + + + ); + - - - - - Enums - - - - - - - - - - - - - - - - Property.Maker - - - + + + + + + Enums + + + + + + + + + + + + + + + + + + + + Property.Maker + + + + + + + + static private class SP_ + + Maker extends + + + implements + + . + + + { + SP_ + + Maker(String sPropName) { + super(sPropName); + } + + + protected final static EnumProperty s_prop + + = new EnumProperty( + + ); + + + + + } - - - static private class SP_Maker - extends - implements . { - SP_Maker(String sPropName) { - super(sPropName); - } - - protected final static EnumProperty s_prop = new EnumProperty(); - + final private static Property.Maker s_ + + Maker = + new SP_ + Maker(" + + . + + "); + + + + final private static Property.Maker s_ + + Maker = + new + (" + + . + + "); + + + + - - } - final private static Property.Maker s_Maker = - new SP_Maker( - "."); - - - final private static Property.Maker s_Maker = - new ( - "."); - - - - + static public Property.Maker maker(String propName) { - return new (propName); + return new + + (propName); } - protected (String name) { - super(name); - - m_shorthandMaker= getSubpropMaker(""); - + protected + + (String name) { + super(name); + + + m_shorthandMaker= getSubpropMaker(" + + "); + + } + - + + Property.Maker m_shorthandMaker; public Property checkEnumValues(String value) { - return m_shorthandMaker.checkEnumValues(value); + return m_shorthandMaker.checkEnumValues(value); } protected boolean isCompoundMaker() { - return true; + return true; } - protected Property.Maker getSubpropMaker(String subprop) { - - - - - - - if (subprop.equals("")) - return s_Maker; - - return super.getSubpropMaker(subprop); + protected Property.Maker getSubpropMaker(String subprop) { + + + + + + + + if (subprop.equals(" + + ")) + return s_ + + Maker; + + + return super.getSubpropMaker(subprop); } protected Property setSubprop(Property baseProp, String subpropName, - Property subProp) { - val = baseProp.get(); - // Do some type checking??? - // Check if one of our subproperties??? - val.setComponent(subpropName, subProp, false); - return baseProp; + Property subProp) { + + + val = baseProp.get + + (); + // Do some type checking??? + // Check if one of our subproperties??? + val.setComponent(subpropName, subProp, false); + return baseProp; } public Property getSubpropValue(Property baseProp, String subpropName) { - val = baseProp.get(); - return val.getComponent(subpropName); + + + val = baseProp.get + + (); + return val.getComponent(subpropName); } - - - + + + + + public Property make(PropertyList propertyList) throws FOPException { return makeCompound(propertyList, propertyList.getParentFObj()); - } - - + } + + + private Property m_defaultProp=null; public Property make(PropertyList propertyList) throws FOPException { if (m_defaultProp == null) { - m_defaultProp=makeCompound(propertyList, propertyList.getParentFObj()); - } + m_defaultProp=makeCompound( + propertyList, propertyList.getParentFObj()); + } return m_defaultProp; - } - - - - protected Property makeCompound(PropertyList pList, FObj fo) throws FOPException { - p = new (); - Property subProp; - - - - - - - // set default for subprop - subProp = getSubpropMaker("").make(pList, - getDefaultFor(), fo); - p.setComponent("", subProp, true); - - return new (p); - } - - - - - - - - - protected String getDefaultFor() { - - return ""; - - return ""; - - return ""; - + } + + + + protected Property makeCompound(PropertyList pList, FObj fo) throws FOPException { + + p = new + + (); + Property subProp; + + + + + + + + // set default for subprop + + + subProp = getSubpropMaker(" + + ").make(pList, getDefaultFor + + (), fo); + p.setComponent(" + + ", subProp, true); + + + return new + + (p); } - + + + + + + + + + + protected String getDefaultFor + + () { + + + + return " + + "; + + + + return " + + "; + + + + return ""; + + + + } + + /** Set the appropriate components when the "base" property is set. */ public Property convertProperty(Property p, PropertyList pList,FObj fo) - throws FOPException - { - if (p instanceof ) return p; - if (! (p instanceof EnumProperty)) { - // delegate to the subprop maker to do conversions - p = m_shorthandMaker.convertProperty(p,pList,fo); - } - if (p != null) { - Property prop = makeCompound(pList, fo); - - pval = prop.get(); - - pval.setComponent("", p, false); - - return prop; + throws FOPException { + if (p instanceof + + ) return p; + if (! (p instanceof EnumProperty)) { + // delegate to the subprop maker to do conversions + p = m_shorthandMaker.convertProperty(p,pList,fo); } - else return null; - + else return null; + + } - + + - - public boolean isInherited() { return ; } - + + + public boolean isInherited() { + return + + ; + } + + - - - public boolean inheritsSpecified() { - return true; - } - + + + + public boolean inheritsSpecified() { + return true; + } + + - - + + + public Property compute(PropertyList propertyList) { - Property computedProperty = null; - Property correspondingProperty = propertyList.get(""); - if (correspondingProperty != null) { - int correspondingValue = correspondingProperty.getEnum(); + Property computedProperty = null; + Property correspondingProperty = propertyList.get(" + + "); + if (correspondingProperty != null) { + int correspondingValue = correspondingProperty.getEnum(); - if (correspondingValue == ) - computedProperty = new EnumProperty(); - else - ; - } - return computedProperty; + + if (correspondingValue == + + ) + computedProperty = new EnumProperty( + + ); + else + + + ; + } + return computedProperty; } - + + - - - + + + + public boolean isCorrespondingForced(PropertyList propertyList) { - FObj parentFO = propertyList.getParentFObj(); - StringBuffer sbExpr=new StringBuffer(); - - sbExpr.setLength(0); - - if (propertyList.getExplicit(sbExpr.toString()) != null) return true; - - return false; + FObj parentFO = propertyList.getParentFObj(); + StringBuffer sbExpr=new StringBuffer(); + + + sbExpr.setLength(0); + + + if (propertyList.getExplicit(sbExpr.toString()) != null) + return true; + + + return false; } - + + + public Property compute(PropertyList propertyList) throws FOPException { - FObj parentFO = propertyList.getParentFObj(); - StringBuffer sbExpr=new StringBuffer(); - Property p=null; - - - // Make sure the property is set before calculating it! - if (propertyList.getExplicitOrShorthand(sbExpr.toString()) == null) return p; - sbExpr.setLength(0); - - p= make(propertyList, sbExpr.toString(), propertyList.getParentFObj()); - - - p= propertyList.getExplicitOrShorthand(sbExpr.toString()); - - if (p != null) { - p = convertProperty(p, propertyList, parentFO ); - } + FObj parentFO = propertyList.getParentFObj(); + StringBuffer sbExpr=new StringBuffer(); + Property p=null; + + + + + // Make sure the property is set before calculating it! + if (propertyList.getExplicitOrShorthand(sbExpr.toString()) == null) + return p; + sbExpr.setLength(0); + + + p = make(propertyList, sbExpr.toString(), propertyList.getParentFObj()); + + + + + p= propertyList.getExplicitOrShorthand(sbExpr.toString()); + + + + if (p != null) { + p = convertProperty(p, propertyList, parentFO ); + } - else p= makeCompound(propertyList, parentFO); - - Property subprop; - - sbExpr.setLength(0); - - - subprop= getSubpropMaker(""). - make(propertyList, sbExpr.toString(), parentFO); - - - subprop= propertyList.getExplicitOrShorthand(sbExpr.toString()); - - if (subprop != null) { - setSubprop(p, "", subprop); - } + + else p = makeCompound(propertyList, parentFO); + + Property subprop; + + + sbExpr.setLength(0); + + + + + subprop = getSubpropMaker(" + + "). + make(propertyList, sbExpr.toString(), parentFO); + + + + + subprop = propertyList.getExplicitOrShorthand(sbExpr.toString()); + + + + if (subprop != null) { + setSubprop(p, " + + ", subprop); + } - - return p; + + + return p; } + + public Property getShorthand(PropertyList propertyList) { - Property p = null; - ListProperty listprop; - - - if (p == null) { - listprop = (ListProperty)propertyList.getExplicit(""); - if (listprop != null) { - // Get a parser for the shorthand to set the individual properties - ShorthandParser shparser = new (listprop); - p = shparser.getValueForProperty(getPropName(), this, propertyList); - } - } - - return p; + Property p = null; + ListProperty listprop; + + + + if (p == null) { + listprop = + (ListProperty)propertyList.getExplicit(" + + "); + if (listprop != null) { + // Get a parser for the shorthand to set the individual properties + ShorthandParser shparser = + new + + (listprop); + p = shparser.getValueForProperty( + getPropName(), this, propertyList); + } + } + + + return p; } + - + + } + - sbExpr.append("_fop-property-value("); - - sbExpr.append(")"); + + sbExpr.append("_fop-property-value("); + + + sbExpr.append(")"); - - sbExpr.append(""); + + + + sbExpr.append(" + + "); + - sbExpr.append(propertyList.wmRelToAbs(PropertyList.)); + + sbExpr.append(propertyList.wmRelToAbs(PropertyList. + + )); - sbExpr.append(parentFO.properties.wmRelToAbs(PropertyList.)); + + sbExpr.append(parentFO.properties.wmRelToAbs(PropertyList. + + )); - sbExpr.append(propertyList.wmAbsToRel(PropertyList.)); + + sbExpr.append(propertyList.wmAbsToRel(PropertyList. + + )); @@ -619,31 +915,40 @@ public class extends - - - - + + + + + + - Conflict between subproperty datatypes: - != + Conflict between subproperty datatypes: + != - - - + + + - - - - if (value.equals("")) { return s_prop; } + + + + + if (value.equals(" + + ")) { + return s_prop + + ; + } - + - + -- 2.39.5