introducing asml n.
Skip this Video
Loading SlideShow in 5 Seconds..
Introducing ASML PowerPoint Presentation
Download Presentation
Introducing ASML

Loading in 2 Seconds...

play fullscreen
1 / 20

Introducing ASML - PowerPoint PPT Presentation

  • Uploaded on

Introducing ASML. Methods, Values, Constraints, Constants, Variables Lecture 10 Software Engineering COMP201. I. Methods. Methods are named operations that may be invoked in various contexts

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Introducing ASML' - saxton

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
introducing asml

Introducing ASML

Methods, Values, Constraints, Constants, Variables

Lecture 10

Software Engineering COMP201

i methods
I. Methods
  • Methods are named operations that may be invoked in various contexts
  • The definition of a method may include parameters that will be associated with particular values each time the method is invoked
  • Methods may also specify a return value that is available after the operation has been performed
the general form for a method definition
The general form for a method definition

The type of the return value, if there is one

name (parameter 1 as Type, … parameter n as Type)as Type

the name of method

the values sent to the method,

if there any

method isword
Method IsWord()
  • An expression in the form IsWord() is an application of the name IsWord to argument i, which is a long integer.
  • IsWord evaluates an argument i and returns the value true if i 0 and i0xFFFF (hexadecimal number).
  • If i doesn’t fit these criteria, IsWord returns the value false.

IsWord ( i as Integer ) as Boolean

return (0<= i and i <= 0xFFFF)



if IsWord ( 123 ) then

Writelone (“123 is a word of memory.”)

functions and update procedures
Functions and update procedures
  • Functions have no effect on state variables
  • Functions must return a value

IsWord ( i as Integer ) as Boolean

return (0<= i and i <= 0xFFFF)

  • Update procedures configure the values of state variables for the next sequential step of the machine
  • Update procedures may optionally return a value
update procedure power
Update procedure power()

var x as Integer = 3

var y as Integer = 0

var index as Integer = 3

power (x as Integer, n as Integer) as Integer

var result as Integer = 1

var i as Integer = 1

step while i<=n



step return result


step y := power(5,3)


WriteLine (“5 cubed =” +y)

WriteLine(“3 cubed =” + power(3,index))

x:= power(x, power(2,2))

step WriteLine (“x = ” +x)


5 cubed = 125

3 cubed = 27

x = 81

local names for values


mySet = {1, 2, 3}


WriteLine(“mySet has” + asString(size(mySet))+ “ elements. ”)

Local names for values

Statement in the form

identifier = expression

introduce identifier as a local name for the value given on the right hand side of the equals sign (“ = ”) by expression.

Local names may be introduced within any block of statement.

Local names could appear after the “then” keyword of an if … then … else statement

local names in sequences of steps
Local names in sequences of steps
  • A local name can be referenced anywhere in its statement block.
  • In a sequence of steps, local namesintroduced within a step block are available within any following step block.



mySet1 = {1, 2, 3}

WriteLine (“mySet has” + asString(size(mySet1))+ “ elements. ”)


mySet2 = mySet1 union {4 , 5, 6}

WriteLine(“mySet has” + asString(size(mySet2))+ “ elements. ”)

method overloading
Method overloading

Method overloading allows you:

  • to use the same name in different methods
  • in each instance to have the compiler choose the correct instance

Must be a clear way for the compiler to decide which method should be called for any particular instance

The KEY for this is

the parameter list

method overloading example
Method overloading example

S = { 1, 8, 2, 12, 13, 6}

Max(i as Integer, j as Integer)as Integer

returnif i > j then i else j

Max(s as Set of Integer)as Integer

returnany m | m in S where not (exists n in S where n>m )


stepwriteln(“The largest number in the set is ” + ( Max(S) ) )

stepwriteln(“The largest of the two integers is ” + ( Max(2,3) ) )

A series of methods with the same name but differentiated by their parameter lists are overloaded methods

ii values what are values
II.ValuesWhat are values?

The term value has the same meaning as in mathematical sets


A value is an immutable element that supports two operations:

equality testing and set membership.

If x and y are values, then we can ask whether x is equal to y

If the S is a set, then we can ask whether x is an element of S

x in S

x = y

structured values

ordered pair


( x , y )

Structured values
  • Some values are composed of other values
  • Some structured values are built into AsmL; others may be defined by you

structure Location

base as Integer

offset as Integer

Location (1,4) is a value of the user-defined structure type Location

built in value types

Data Type



A type that can be assigned true and false


8-bit unsigned integer type


16-bit signed integer type


32-bit signed integer type


64-bit signed integer type


Single-precision 32-bit floating-point format type as specified in IEEE 754


Double-precision 64-bit floating-point format type as specified in IEEE 754

Built in value types
built in value types1
Built in value types

Data Type



Unicode character type


Unicode string type

Seq of A

A sequence of elements of type A

Set of A

A set containing elements of type A

Map of A to B

A table whose entries map of elements of type A to type B

built in value types2
Built in value types

Data Type



A tuple consisting of elements of type A1, A2, … Tuple values are written in the same form

For example, (1,2) is of a value of the built-in type (Integer,Integer)


Types in the form t? includes all of the values of type t plus the special value undef.

For example, a variable declared as Boolean? could contain either of the Boolean value true or false or the value undef.

iii constraints assertions
III. Constraints Assertions
  • Assertionsrequire and ensure statements document constraints placed upon the model
  • Violating a constraint at runtime is called an assertion failure

AllTickets = {1..1024}

IsTicketID (i as Integer) as Boolean

require i > 0

return ( i in AllTickets)

ChooseAnyTicket() as Integer

ensure IsTicketID(result)

return any t | t in AllTickets

  • The keyword result denotes the value of the return statement
type constraints
Type constraints
  • Types of constants, variables and method parameters may be specified using the syntax :


  • Types may be explicitly checked using the “ is” operator :


an expression will be either true or false, depending on whether the value given is an element of the type

  • Types are not themselves values. For example, you can’t pass a type as an argument
iv constants
IV. Constants
  • Constants are fixed, named values
  • Constants can either be global or local
  • Global constants are declared in the beginning of the program
  • Local constants are declared within a statement block
  • The general form of declaring and initialising a constant is:

Name [as Type] = value

MaxInteger = 100


MinInteger = 0

v variables
V. Variables
  • Variables are names given to memory locations.
  • Updating variables is the only way to change a state of a machine.
  • Variables can be complex types such as structures or maps as well as simple types.
  • Here is the general form for declaring and initialising variables:

varname[asType] = value

types of variables
Types of variables
  • There are three types of variables in AsmL
    • Global variables
    • Local variables
    • Instance-based variables

Instance-based variables are variables that exist for each instance of a class

var x as Integer = 10 // shows explicit typing

var x = 10 // shows implicit typing

var greeting as String = “Hello” // shows a // string variable

var y = [1..6] // shows a sequence of // integers from 1 to 6

var menu = {“ham”, “cheese”, “bit”} // shows a // set