Save This Page
Home » openjdk-7 » net » sf » rvpf » metadata » [javadoc | source]
    1   /**
    2    * Related Values Processing Framework.
    3    * 
    4    * Copyright (C) 2003 Serge Brisson.
    5    * 
    6    * This software is distributable under LGPL license.
    7    * See details at the bottom of this file.
    8    * 
    9    * $Header: /cvsroot/rvpf/RVPF/java/src/net/sf/rvpf/metadata/TransformEntity.java,v 1.7 2003/10/20 18:00:10 sfb Exp $
   10    */
   11   package net.sf.rvpf.metadata;
   12   
   13   import net.sf.rvpf.processor.engine.Transform;
   14   
   15   /** Transform Entity.
   16    * 
   17    * @author Serge Brisson
   18    * @version $Revision: 1.7 $
   19    */
   20   public class TransformEntity extends ParamsEntity {
   21   
   22       // Public Class Constants.
   23       
   24       public static final String PREFIX = "O";
   25   
   26       // Instance Properties.
   27   
   28       /** Sets the Engine for this Transform.
   29        * 
   30        * @param engine The Engine.
   31        */
   32       public void setEngine(EngineEntity engine) {
   33           this.engine = engine;
   34           reset();
   35       }
   36   
   37       /**
   38        */
   39       public String getPrefix() {
   40           return PREFIX;
   41       }
   42   
   43       /** Gets the actual Transform, as generated by the Engine.
   44        * 
   45        * @return The Transform.
   46        */
   47       public Transform getTransform() {
   48           if (this.transform == null)
   49               synchronized (this) {
   50                   if (this.transform == null)
   51                       this.transform = this.engine.createTransform(getParams());
   52               }
   53           
   54           return this.transform;
   55       }
   56   
   57       // Instance Methods.
   58   
   59       /** Resets this Transform.
   60        * <p>
   61        * The next call to {@link #getTransform} will be forced to ask
   62        * the Engine for the actual Transform.
   63        * <p>
   64        * This is needed when the same Transform is reused for different
   65        * formulas and or engines.
   66        */
   67       public void reset() {
   68           this.transform = null;
   69       }
   70   
   71       /** Sets up this Transform.
   72        * <p>
   73        * This means making sure that its Engine is ready for action.
   74        * 
   75        * @param metadata The Metadata.
   76        */
   77       public boolean setUp(Metadata metadata) {
   78           return this.engine.setUp(metadata);
   79       }
   80   
   81       /** Tears down what has been set up.
   82        */
   83       public void tearDown() {
   84           this.transform = null;
   85           this.engine.tearDown();
   86       }
   87   
   88       // Instance Attributes.
   89   
   90       private Transform transform = null;
   91       private EngineEntity engine = null;
   92   }
   93   
   94   // $Log: TransformEntity.java,v $
   95   // Revision 1.7  2003/10/20 18:00:10  sfb
   96   // Added 'reset'.
   97   //
   98   // Revision 1.6  2003/09/19 16:39:43  sfb
   99   // Refactored DefEntity.
  100   //
  101   
  102   /*
  103    * This is free software; you can redistribute it and/or modify
  104    * it under the terms of the GNU Lesser General Public License
  105    * as published by the Free Software Foundation; either version 2.1
  106    * of the License, or (at your option) any later version.
  107    *
  108    * This software is distributed in the hope that it will be useful,
  109    * but WITHOUT ANY WARRANTY; without even the implied warranty of
  110    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  111    * Lesser General Public License for more details.
  112    *
  113    * You should have received a copy of the GNU Lesser General Public
  114    * License along with this software; if not, write to the Free Software
  115    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  116    */

Save This Page
Home » openjdk-7 » net » sf » rvpf » metadata » [javadoc | source]