/*
 * Created on 2004-2-9
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package workflow.wfmc.xpdl.parameter;

import workflow.WorkflowInterface;
/**
 * @author zosatapo
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public  class ParameterMode implements WorkflowInterface
{
  public final static  ParameterMode MODE_IN=new ParameterMode("IN");
  
  public final static  ParameterMode MODE_OUT=new ParameterMode("OUT");
  
  public final static  ParameterMode MODE_INOUT=new ParameterMode("INOUT");
  
  private String mode;
  
  public ParameterMode(String mode)
  {
    this.mode=mode;
  }
  
  public String getMode()
  {
    return mode;
  }
  
  public static ParameterMode parse(String mode)
  {
    if("IN".equals(mode))
    {
      return MODE_IN;
    }
    else if("OUT".equals(mode))
    {
      return MODE_OUT;
    }
    else if("INOUT".equals(mode))
    {
      return MODE_INOUT;
    }
    
    //default value is MODE_IN
    
    return MODE_IN;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) 
    {
      return true;
    }

    if (obj instanceof ParameterMode) 
    {
      ParameterMode anotherPM = (ParameterMode)obj;
  
      if(anotherPM.getMode().equals(mode))
      {
        return true;
      }      
    }

    return false;
  }
}
