/*
Tiamat - a role-playing game framework
NamedObject.java - an abstract object with a name and description
 
 Copyright  (C) 2004 Hugues Johnson
 
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

package com.huguesjohnson.tiamat;

import com.huguesjohnson.serialization.Formatter;
import com.huguesjohnson.serialization.Storable;
import java.lang.String;
import java.lang.StringBuffer;

/** NamedObject - an abstract class with a name and description
 * @author Hugues Johnson
 */
public abstract class NamedObject implements Storable{
    
/* begin public properties */
    //the name of the object
    private String name;
    /** Returns the name of the object.
     * @return The name of the object.
     */
    public String getName(){ return(this.name); }
    /** Sets the name of the object.
     * @param name The new name for the object.
     */
    public void setName(String name){ this.name=name; }
    private String description;
    /** Returns the description of the object.
     * @return The description of the object.
     */
    public String getDescription(){ return(this.description); }
    /** Sets the description of the object.
     * @param description The new description of the object.
     */
    public void setDescription(String description){ this.description=description; }
/* begin public properties */
    
/* begin constructors */
    public NamedObject(String name,String description){
        this.name=name;
        this.description=description;
    }
/* end constructors */    

/* begin public methods */
    /** 
     * Returns a string representation of the object.
     * @return A string representation of the object. 
     */
     public String toString(){
        StringBuffer tostring=new StringBuffer(this.getClass().getName());
        tostring.append("\n  name="+this.name);
        tostring.append("\n  description="+this.description);
        return(tostring.toString());
    }
    /** The onDeserialize event should be fired after an object is de-serialized.
     * This allows objects to load transient members, set their working directory, and load Storable members if needed.
     * @param formatter the formatter to use to load any storable members
     * @param absoluteDir the working directory since all paths stored in the object should be relative
     */
    public void onDeserialize(Formatter formatter,String absoluteDir){ }
/* end public methods */
}
