Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Working with custom types"
Line 21: | Line 21: | ||
= <br> Service = | = <br> Service = | ||
+ | |||
+ | <source lang="java"> | ||
+ | Service MyService{} | ||
+ | |||
+ | // variables and constants can be here | ||
+ | |||
+ | function calculate(myScore INT[]) returns (Decimal (4,2)) | ||
+ | |||
+ | numberOfScores, i, mySum INT; | ||
+ | numberOfScores = myScore.getSize(); | ||
+ | |||
+ | for (i from 1 to numberOfScores by 1) | ||
+ | mySum = myScore[i] + mySum; | ||
+ | end | ||
+ | |||
+ | return(mySum/numberOfScores); | ||
+ | end | ||
+ | |||
+ | // other functions are here | ||
+ | |||
+ | end | ||
+ | |||
+ | |||
+ | </source> |
Revision as of 12:13, 9 February 2012
Your custom types are based on these EGL classifiers:
Contents
Delegate
Enumeration
ExternalType
Handler
Interface
Library
Program
Record
Service
Service MyService{} // variables and constants can be here function calculate(myScore INT[]) returns (Decimal (4,2)) numberOfScores, i, mySum INT; numberOfScores = myScore.getSize(); for (i from 1 to numberOfScores by 1) mySum = myScore[i] + mySum; end return(mySum/numberOfScores); end // other functions are here end