View Javadoc

1   package net.sf.tomp.xml.type;
2   
3   import java.util.*;
4   
5   /***
6    * DOCUMENT ME!
7    * 
8    * @author $author$
9    * @version $Revision$
10   */
11  public class TransformationsFromType {
12      /*** DOCUMENT ME! */
13      protected Type typ;
14  
15      /*** DOCUMENT ME! */
16      protected Map transformations;
17  
18      /***
19       * Creates a new TransformationsFromType object.
20       * 
21       * @param t DOCUMENT ME!
22       */
23      public TransformationsFromType(Type t) {
24          typ = t;
25          transformations = new HashMap();
26      }
27  
28      /***
29       * DOCUMENT ME!
30       * 
31       * @return DOCUMENT ME!
32       */
33      public Iterator typesIterator() {
34          return transformations.keySet().iterator();
35      }
36  
37      /***
38       * DOCUMENT ME!
39       * 
40       * @param t DOCUMENT ME!
41       * @param v DOCUMENT ME!
42       * @return DOCUMENT ME!
43       */
44      public TypeTransformation getTransformationTo(Type t, Variant v) {
45          Map tts = (Map) transformations.get(t);
46  
47          if (tts == null) {
48              return null;
49          }
50  
51          TypeTransformation tt = (TypeTransformation) tts.get(v);
52  
53          return tt;
54      }
55  
56      /***
57       * DOCUMENT ME!
58       * 
59       * @param t DOCUMENT ME!
60       * @param v DOCUMENT ME!
61       * @param ts DOCUMENT ME!
62       */
63      public void putTransformationTo(Type t, Variant v, TypeTransformation ts) {
64          Map tts = (Map) transformations.get(t);
65  
66          if (tts == null) {
67              tts = new HashMap();
68              transformations.put(t, tts);
69          }
70  
71          tts.put(v, ts);
72      }
73  
74      /***
75       * DOCUMENT ME!
76       * 
77       * @return DOCUMENT ME!
78       */
79      public String toString() {
80          return "TransformationsFromType[typ=" + typ + " #"
81                  + transformations.entrySet().size() + "]";
82      }
83  }
84  
85  /*
86   * The contents of this file are subject to the Mozilla Public License Version
87   * 1.1 (the "License"); you may not use this file except in compliance with the
88   * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
89   * Software distributed under the License is distributed on an "AS IS" basis,
90   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
91   * the specific language governing rights and limitations under the License. The
92   * Original Code is: all this file. The Initial Developer of the Original Code
93   * is: Tomas Pitner, Masaryk University in Brno, Czech Republic. Contributor(s):
94   */