KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > fractal > adl > AbstractNode


1 /***
2  * Fractal ADL Parser
3  * Copyright (C) 2002-2004 France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: Eric.Bruneton@rd.francetelecom.com
20  *
21  * Author: Eric Bruneton
22  */

23
24 package org.objectweb.fractal.adl;
25
26 import java.util.HashMap JavaDoc;
27 import java.util.Map JavaDoc;
28
29 /**
30  * An abstract {@link Node}.
31  */

32
33 public abstract class AbstractNode implements Node {
34
35   private String JavaDoc type;
36
37   private String JavaDoc source;
38   
39   private Map JavaDoc decorations = new HashMap JavaDoc();
40
41   public AbstractNode (final String JavaDoc type) {
42     this.type = type;
43   }
44   
45   // --------------------------------------------------------------------------
46
// Implementation of the Node interface
47
// --------------------------------------------------------------------------
48

49   public String JavaDoc astGetType () {
50     return type;
51   }
52
53   public String JavaDoc astGetSource () {
54     return source;
55   }
56
57   public void astSetSource (final String JavaDoc source) {
58     this.source = source;
59   }
60   
61   public Object JavaDoc astGetDecoration(String JavaDoc name) {
62     return decorations.get(name);
63   }
64
65   public Map JavaDoc astGetDecorations() {
66     return new HashMap JavaDoc(decorations);
67   }
68
69   public void astSetDecoration(String JavaDoc name, Object JavaDoc decoration) {
70     decorations.put(name, decoration);
71   }
72
73   public void astSetDecorations(Map JavaDoc decorations) {
74     this.decorations.putAll(decorations);
75   }
76
77 }
78
Popular Tags