/*
 * MarcacaoMutableTreeNode.java
 *
 * Created on 18 de Maio de 2007, 7:02
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package siprp.medicina.processo.estrutura;

import java.util.Date;

/**
 *
 * @author Frederico
 */
public abstract class MarcacaoMutableTreeNode extends EstruturaProcessoMutableTreeNode
	implements Comparable
{
	protected Date data;
	
	/** Creates a new instance of MarcacaoMutableTreeNode */
	public MarcacaoMutableTreeNode( Integer id, String descricao )
	{
		super( id, descricao );
	}
	
	public void setData( Date data )
	{
		this.data = data;
	}
	
	public Date getData()
	{
		return data;
	}
	
	public int compareTo( Object other )
	{
		if( !( other instanceof MarcacaoMutableTreeNode ) )
		{
			return 0;
		}
		MarcacaoMutableTreeNode om = ( MarcacaoMutableTreeNode ) other;
		if( data == null )
		{
			return 1;
		}
		else if( om == null || om.getData() == null )
		{
			return -1;
		}
		else
		{
			return -1 * getData().compareTo( om.getData() );
		}
	}
}
