// Module    : $RCSfile: AbstractDefaultGUIElement.java,v $
// Version   : $Revision: 0.0 $  $Author: Patrick $  $Date: 27.11.2011 17:21:28 $
// Project   : TaskTreePerformanceTest
// Creation  : 2011 by Patrick
// Copyright : Patrick Harms, 2011

package de.ugoe.cs.quest.eventcore.guimodel;

/**
 * TODO comment
 * 
 * @version $Revision: $ $Date: $
 * @author 2011, last modified by $Author: $
 */
public abstract class AbstractDefaultGUIElement implements IGUIElement {
    
    /**  */
    public static final long serialVersionUID = 1L;

    /** the specification of the GUI element */
    private IGUIElementSpec specification;

    /**
     * <p>
     * TODO: comment
     * </p>
     *
     * @param specification
     */
    public AbstractDefaultGUIElement(IGUIElementSpec specification) {
        this.specification = specification;
    }

    /*
     * (non-Javadoc)
     * 
     * @see de.ugoe.cs.tasktree.guimodel.GUIElement#getSpecification()
     */
    @Override
    public IGUIElementSpec getSpecification() {
        return specification;
    }

    /*
     * (non-Javadoc)
     * 
     * @see GUIElement#equals(GUIElement)
     */
    public boolean equals(IGUIElement other) {
        if (this == other)
        {
            return true;
        }
        
        if (!this.getClass().isInstance(other)) {
            return false;
        }
        
        AbstractDefaultGUIElement otherElem = (AbstractDefaultGUIElement) other;
        
        return
            ((otherElem.specification == specification) ||
             ((specification != null) && specification.equals(otherElem.specification)));
    }

}
