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

/**
 * @author reic
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class ActivityType
{
	
		public final static ActivityType ACTIVITY_BEGIN       = new ActivityType("ACTIVITY_BEGIN");
		public final static ActivityType ACTIVITY_END         = new ActivityType("ACTIVITY_END");
		
		public final static ActivityType ACTIVITY_SUBFLOW     = new ActivityType("ACTIVITY_SUBFLOW");
		public final static ActivityType ACTIVITY_JOIN        = new ActivityType("ACTIVITY_JOIN");
		public final static ActivityType ACTIVITY_DUMMY       = new ActivityType("ACTIVITY_DUMMY");
	
		public final static ActivityType ACTIVITY_BOUNDARY    = new ActivityType("ACTIVITY_BOUNDARY");
		public final static ActivityType ACTIVITY_BUSINESS    = new ActivityType("ACTIVITY_BUSINESS");
	
		private String type;

		private ActivityType(String type)
		{
			this.type = type;
		}

		public String getType()
		{
			return type;
		}

		public static ActivityType parse(String type)
		{	
			if ("ACTIVITY_BEGIN".equals(type))
			{
				return ACTIVITY_BEGIN;
			}
			else if ("ACTIVITY_END".equals(type))
			{
				return ACTIVITY_END;
			}
			else if ("ACTIVITY_SUBFLOW".equals(type))
			{
				return ACTIVITY_SUBFLOW;
			}
			else if ("ACTIVITY_JOIN".equals(type))
			{
				return ACTIVITY_JOIN;
			}
			else if ("ACTIVITY_BOUNDARY".equals(type))
			{
				return ACTIVITY_BOUNDARY;
			}
			else if ("ACTIVITY_BUSINESS".equals(type))
			{
				return ACTIVITY_BUSINESS;
			}		
			
			//default value is ACTIVITY_DUMMY
			return ACTIVITY_DUMMY;
		}

		public boolean equals(Object obj)
		{
			if (this == obj)
			{
				return true;
			}

			if (obj instanceof ActivityType)
			{
				ActivityType anotherAT = (ActivityType) obj;

				if (anotherAT.getType().equals(type))
				{
					return true;
				}
			}

			return false;
		}

		public String toString()
		{
			return "ActivityType@" + type;
		}
}
