001 /* 002 Copyright (C) 2002-2003 Renaud Pawlak <renaud@aopsys.com> 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU Lesser General Public License as 006 published by the Free Software Foundation; either version 2 of the 007 License, or (at your option) any later version. 008 009 This program is distributed in the hope that it will be useful, 010 but WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 GNU Lesser General Public License for more details. 013 014 You should have received a copy of the GNU Lesser General Public 015 License along with this program; if not, write to the Free Software 016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 017 USA */ 018 019 package org.objectweb.jac.ide; 020 021 public abstract class TypedElement extends ModelElement implements Typed { 022 023 Type type = Projects.types.resolveType("void"); 024 025 /** 026 * Get the value of type. 027 * @return value of type. 028 */ 029 public Type getType() { 030 return type; 031 } 032 033 /** 034 * Set the value of type. 035 * @param v Value to assign to type. 036 */ 037 public void setType(Type v) { 038 this.type = v; 039 } 040 041 public String getPrototype() { 042 return type.getGenerationFullName()+(array?"[]":"")+" "+getGenerationName(); 043 } 044 045 public String getToString() { 046 return name+":"+type.getName()+(array?"[]":""); 047 } 048 049 public String getTypeName() { 050 return type.getGenerationFullName()+(array?"[]":""); 051 } 052 053 boolean array=false; 054 055 /** 056 * Get the value of array. 057 * @return value of array. 058 */ 059 public boolean isArray() { 060 return array; 061 } 062 063 /** 064 * Set the value of array. 065 * @param v Value to assign to array. 066 */ 067 public void setArray(boolean v) { 068 this.array = v; 069 } 070 071 }