KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > medor > expression > lib > BasicExpression


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

18 package org.objectweb.medor.expression.lib;
19
20 import org.objectweb.medor.expression.api.Expression;
21 import org.objectweb.medor.clone.lib.BasicCloneable;
22 import org.objectweb.jorm.type.api.PType;
23 import org.objectweb.util.monolog.Monolog;
24 import org.objectweb.util.monolog.api.Logger;
25
26 /**
27  * Is an abstract common class for expression. It contains the type and
28  * implements the cloning
29  * @author S.Chassande-Barrioz
30  */

31 public abstract class BasicExpression extends BasicCloneable implements Expression {
32
33     protected PType type = null;
34     transient protected Logger logger;
35
36     public BasicExpression() {
37         logger = Monolog.getMonologFactory().getLogger(getClass().getName());
38     }
39
40     public BasicExpression(PType type) {
41         this();
42         this.type = type;
43     }
44
45     public BasicExpression(BasicExpression be) {
46         this(be.type);
47     }
48
49     public PType getType() {
50         return type;
51     }
52
53     public Object JavaDoc clone(Object JavaDoc clone, java.util.Map JavaDoc obj2clone) throws CloneNotSupportedException JavaDoc {
54         clone = super.clone(clone, obj2clone);
55         ((BasicExpression) clone).type = type;
56         ((BasicExpression) clone).logger = logger;
57         return clone;
58     }
59 }
60
Popular Tags