SubroutineHandler

Package: MachII.framework
Handles processing of Commands for a Subroutine.
Method Summary
public SubroutineHandler init()

Used by the framework for initialization. Do not override.

public void addCommand(Command command)

Adds a Command.

public boolean handleSubroutine(Event event, EventContext eventContext)

Handles a Subroutine.

Method Detail
addCommand

public void addCommand( Command command )

Adds a Command.

Parameters:
Command command

Code:

	<cffunction name="addCommand" access="public" returntype="void" output="false"
		hint="Adds a Command.">
		<cfargument name="command" type="MachII.framework.Command" required="true" />
		<cfset ArrayAppend(variables.commands, arguments.command) />
	</cffunction> 

handleSubroutine

public boolean handleSubroutine( Event event, EventContext eventContext )

Handles a Subroutine.

Parameters:
Event event
EventContext eventContext

Code:

	<cffunction name="handleSubroutine" access="public" returntype="boolean" output="true"
		hint="Handles a Subroutine.">
		<cfargument name="event" type="MachII.framework.Event" required="true" />
		<cfargument name="eventContext" type="MachII.framework.EventContext" required="true" />
		
		<cfset var continue = true />
		<cfset var command = "" />
		<cfset var i = 0 />
		
		<cfloop from="1" to="#ArrayLen(variables.commands)#" index="i">
			<cfset command = variables.commands[i] />
			<cfset continue = command.execute(arguments.event, arguments.eventContext) />
			<cfif continue IS false>
				<cfbreak />
			</cfif>
		</cfloop>
		
		<cfreturn continue />
	</cffunction> 

init

public SubroutineHandler init( )

Used by the framework for initialization. Do not override.

Parameters:

Code:

	<cffunction name="init" access="public" returntype="SubroutineHandler" output="false"
		hint="Used by the framework for initialization. Do not override.">
		<cfreturn this />
	</cffunction>