Jeah, I think its fine in a CFC, but if you really wanted to get all
anal about the speed I just increment your numbers by + 1 and create
and array in application scope. Then you can just reference them by
index. (I'm also assuming that you meant to type 7 and not & for NW)
-Adam
On Mon, 3 Jan 2005 17:13:38 -0500, Tony Weeg <[EMAIL PROTECTED]> wrote:
> hola peeps.
>
> i have a cfc, that simply takes an integer that represents a heading,
> and turn that into a value that i display based on the return.
>
> i put the cfc in the session scope:
>
> <cfset session['COG'] = createObject("component","cfc.cogToDirection") />
>
> and then just hit it like this...
>
> #session['COG'].COGToDirection(getThis.COG[i])#
>
> and display all in the same line.
>
> now, in my debugging output i see 0ms. but i know that there is no
> such thing. there are milliseconds attached, im sure, and enough of
> those, well, you know... equal a second. regardless... do you think,
> as a preference, that i would be better off with a simple
> cfswitch/cfcase section of code that does this, rather than hit the
> cfc?
>
> thanks.
> tw
>
> <cfcomponent displayName="cogToDirection" hint="Turn COG integer to a
> compass direction">
>
> <cffunction name="COGToDirection" access="public" output="1"
> returntype="string">
>
> <cfargument name="cog" type="numeric" required="true"/>
>
> <cfset request.cogValue = (arguments.cog + 22.5) \ 45>
>
> <cfswitch expression="#request.cogValue#">
>
> <cfcase value="0">
>
> <cfset strHeading = "N">
>
> </cfcase>
>
> <cfcase value="1">
>
> <cfset strHeading = "NE">
>
> </cfcase>
>
> <cfcase value="2">
>
> <cfset strHeading = "E">
>
> </cfcase>
>
> <cfcase value="3">
>
> <cfset strHeading = "SE">
>
> </cfcase>
>
> <cfcase value="4">
>
> <cfset strHeading = "S">
>
> </cfcase>
>
> <cfcase value="5">
>
> <cfset strHeading = "SW">
>
> </cfcase>
>
> <cfcase value="6">
>
> <cfset strHeading = "W">
>
> </cfcase>
>
> <cfcase value="&">
>
> <cfset strHeading = "NW">
>
> </cfcase>
>
> <cfcase value="8">
>
> <cfset strHeading = "N">
>
> </cfcase>
>
> <cfdefaultcase>
>
> <cfset strHeading = "N">
>
> </cfdefaultcase>
>
> </cfswitch>
>
> <cfreturn strHeading>
>
> </cffunction>
>
> </cfcomponent>
>
> --
> tony
>
> Tony Weeg
>
> macromedia certified coldfusion mx developer
> email: tonyweeg [at] gmail [dot] com
> blog: http://www.revolutionwebdesign.com/blog/
> cool tool: http://www.antiwrap.com
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
>
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]