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

import workflow.WorkflowInterface;

/**
 * @author reic
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class SplitType  implements WorkflowInterface
{
	public final static SplitType SPLIT_AND = new SplitType("AND");
	public final static SplitType SPLIT_OR  = new SplitType("OR");  
	public final static SplitType SPLIT_XOR = new SplitType("XOR");
  
	public final static SplitType SPLIT_NA  = new SplitType("NA");

  
	private String type;
  
	private SplitType(String type)
	{
		this.type=type;
	}
  
	public String getType()
	{
		return type;
	}
  
	public boolean equals(Object obj)
	{
		if (this == obj) 
		{
			return true;
		}
  
		if (obj instanceof JoinType) 
		{
			SplitType anotherJT = (SplitType)obj;
      
			if(anotherJT.getType().equals(type))
			{
				return true;
			}      
		}
    
		return false;
	}
  
	public String toString()
	{
		return "SplitType@" + type;
	}
	
	public static SplitType parse(String type)
	{
		if("AND".equals(type))
		{
			return SPLIT_AND;
		}
		else if("OR".equals(type))
		{
			return SPLIT_OR;
		}
		else if("XOR".equals(type))
		{
			return SPLIT_XOR;
		}
    
		return SPLIT_NA;
	}
}