You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by bc...@apache.org on 2004/10/19 15:40:14 UTC

cvs commit: xml-fop/src/java/org/apache/fop/fo StaticPropertyList.java

bckfnn      2004/10/19 06:40:14

  Added:       src/java/org/apache/fop/fo StaticPropertyList.java
  Log:
  Initial version.
  
  PR: 31699
  
  Revision  Changes    Path
  1.1                  xml-fop/src/java/org/apache/fop/fo/StaticPropertyList.java
  
  Index: StaticPropertyList.java
  ===================================================================
  /*
   * Copyright 2004 The Apache Software Foundation.
   * 
   * 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.
   */
  package org.apache.fop.fo;
  
  import org.apache.fop.fo.properties.Property;
  
  /**
   * A very fast implementation of PropertyList that uses arrays to store
   * the explit set properties and another array to store cached values.
   */
  public class StaticPropertyList extends PropertyList {
  	private Property[] explicit;
  	private Property[] values;
      
      /**
       * Construct a StaticPropertyList. 
       * @param fObjToAttach The FObj object.
       * @param parentPropertyList The parent property list.
       */
  	public StaticPropertyList(FObj fObjToAttach, PropertyList parentPropertyList) {
  		super(fObjToAttach, parentPropertyList);
  		explicit = new Property[Constants.PROPERTY_COUNT + 1];
          values = new Property[Constants.PROPERTY_COUNT + 1];
  	}
  	
      /**
       * Return the value explicitly specified on this FO.
       * @param propId The ID of the property whose value is desired.
       * @return The value if the property is explicitly set, otherwise null.
       */
      public Property getExplicit(int propId) {
      	return explicit[propId];
      }
  
      /**
       * Set an value defined explicitly on this FO.
       * @param propId The ID of the property whose value is desired.
       * @param value The value of the property to set.
       */
      public void putExplicit(int propId, Property value) {
      	explicit[propId] = value;
      }
  
      /**
       * Override PropertyList.get() and provides fast caching of previously
       * retrieved property values.
       * @param propId The property ID
       */
      public Property get(int propId, boolean bTryInherit, boolean bTryDefault) {
          Property p = values[propId];
          if (p == null) {
              p = values[propId] = super.get(propId, bTryInherit, bTryDefault);
          }
          return p;
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org