Introduction to Computer Science, Shimon Schocken, IDC Herzliya. Lecture Writing Classes

Size: px
Start display at page:

Download "Introduction to Computer Science, Shimon Schocken, IDC Herzliya. Lecture Writing Classes"

Transcription

1 Introduction to Computer Science, Shimon Schocken, IDC Herzliy Lecture Writing Clsses Writing Clsses, Shimon Schocken IDC Herzliy, slide 1 Clsses Two viewpos on es: Client view: how to use n existing Server view: how to design, implement, nd min es Two min uses of es: Auxiliry es: Mth, Definition es: String, Turtle,, Where Jv es come from: The Jv stndrd librry Clsses tht or people write nd mke vilble Clsses tht I write. Writing Clsses, Shimon Schocken IDC Herzliy, slide 2

2 Outline Modulrity Abstrction Clss ntomy Fields Constructors Methods Relted topics Method overloding Revisiting Prmeter pssing Vrible life cycle Encpsultion Method ntomy Clss vs. instnce methods Types nd vlues Methods prmeters Accessors nd muttors Writing Clsses, Shimon Schocken IDC Herzliy, slide 3 Modulrity When building complex rtifct, it lwys helps to divide chllenge o smll, mngeble modules Ech module must hve Clerly defined function Contrct s to how it ercts with or modules Self-contined design tht enbles unit-testing nd locl mennce In prticulr, when we write, we hve to think how to divide things tht is supposed to do o methods Exmple: let s look t two versions of squreroot from Exercise 3 Un-modulr version Modulr version. Writing Clsses, Shimon Schocken IDC Herzliy, slide 4

3 Un-modulr version import import jv.util.scnner; SqureRoot SqureRoot finl finl EPSILON EPSILON 0.1; 0.1; min(string rgs[]) rgs[]) Scnner Scnner scn scn Scnner(System.in); Get Get user's user's input input System.out.pr("Enter number: number: "); "); x scn.nextint(); Problems with unmodulr code The I/O processing nd sqrt computtion re glued toger It s hrd to tell which prt of progrm is responsible for run-time bugs If we ll wnt to chnge I/O only, we hve to chnge entire The sqrt services re inccessible to or clients The design is not elegnt Solution: divide nd conquer. Compute Compute squre squre root root flot flot root root x / 2; 2; while while (Mth.bs((root root) root) - x) x) > EPSILON) EPSILON) improve improve guess guess root root (root (root (x (x/ root)) root)) / 2; 2; Pr Pr result result System.out.prln( The squre squre root root is: is: " sqrt(x)); sqrt(x)); Writing Clsses, Shimon Schocken IDC Herzliy, slide 5 Modulr version import import jv.util.scnner; SqureRootDemo min(string rgs[]) rgs[]) I/O Scnner Scnner scn scn Scnner(System.in); Get Get number number from from user user nd nd squre squre it it System.out.pr("Enter number: number: "); "); x scn.nextint(); System.out.prln( The squre squre root root is: is: " sqrt(x)); sqrt(x)); Wht hve we gined? Redbility Elegnce Unit testing Code re-use Prllel development Computes Computes squre squre root root function function processing sqrt( x) x) precision precision 0.1; 0.1; root root x / 2; 2; while while (Mth.bs((root root) root) - x) x) > precision) precision) root root (root (root (x (x/ root)) root)) / 2; 2; root; root; Using methods is just one exmple of modulr design Modulrity is key design objective tht comes up in numerous res in CS Modulr design begins t bstrction level. Writing Clsses, Shimon Schocken IDC Herzliy, slide 6

4 Outline Modulrity Abstrction Clss ntomy Fields Constructors Methods Relted topics Method overloding Revisiting Prmeter pssing Vrible life cycle Encpsultion Method ntomy Clss vs. instnce methods Types nd vlues Methods prmeters Accessors nd muttors Writing Clsses, Shimon Schocken IDC Herzliy, slide 7 Abstrction OO progrm design begins with bstrctions Abstrctions re used to describe objects like cr, bnk ccount, turtle, friend, etc. To describe n object bstrction, we think bout it terms of: Wht re its ttributes? ( dt-oriented view) Wht re its behviors? ( functionl view) Writing Clsses, Shimon Schocken IDC Herzliy, slide 8

5 Exmple: bstrction A is n object tht keeps nd reports time using 24- hour system Attributes: Hours Minutes Seconds Behviors: Crete clock Advnce clock 1 second Query clock time Etc. implementtion (structure only) The The clock clock stte stte (dt) (dt) hours, hours, constructor ( ( h, h, m, m, s); s); Advnce Advnce clock clock one one second second forwrd forwrd secondelpsed(); Query Query methods methods gethours(); getminutes(); getseconds(); Writing Clsses, Shimon Schocken IDC Herzliy, slide 9 Using (exmple) server The The clock clock stte stte hours, hours, constructor constructor ( ( h, h, m, m, s); s); Advnce Advnce clock clock one one second second forwrd forwrd secondelpsed(); secondelpsed(); client Using (n exmple) Some Some Query Query methods methods gethours(); gethours(); Crete Crete nd nd initilize initilize clock clock object object getminutes(); getminutes(); nytime nytime (23,59,59); (23,59,59); getseconds(); getseconds(); Advnce Advnce clock clock seconds seconds for for ( ( j j j j < < 5 5 j) j) nytime.secondelpsed(); nytime.secondelpsed(); Pr Pr clock s clock s current current time time System.out.pr( The System.out.pr( The time time in in New New York York is: is: ); ); System.out.prln(nyTime.getHours() System.out.prln(nyTime.getHours() nytime.gethours() nytime.gethours() : : nytime.getminutes() nytime.getminutes() : : nytime.getseconds()); nytime.getseconds()); Writing Clsses, Shimon Schocken IDC Herzliy, slide 10

6 Outline Modulrity Abstrction Clss ntomy Fields Constructors Methods Relted topics Method overloding Revisiting Prmeter pssing Vrible life cycle Encpsultion Method ntomy Clss vs. instnce methods Types nd vlues Methods prmeters Accessors nd muttors Writing Clsses, Shimon Schocken IDC Herzliy, slide 11 Clss members structure Clss members Fields Constructors The The clock clock stte stte hours, hours, constructor ( ( h, h, m, m, s); s); Advnce Advnce clock clock one one second second forwrd forwrd secondelpsed(); Methods Query Query methods methods gethours(); getminutes(); getseconds(); Visibility modifiers: Privte members: visible only to code; typiclly used for fields Public members: visible to code of or es; typiclly used for methods. Writing Clsses, Shimon Schocken IDC Herzliy, slide 12

7 Fields The object's stte (dt) is represented by vribles, AKA instnce vribles or fields Fields re vribles: y cn be of eir primitive or types Ech object hs nd seprte set of fields The fields re typiclly initilized by constructors. structure The The clock clock stte stte hours, hours, constructor ( ( h, h, m, m, s); s); Advnce Advnce clock clock one one second second forwrd forwrd secondelpsed(); Query Query methods methods gethours(); getminutes(); getseconds(); Writing Clsses, Shimon Schocken IDC Herzliy, slide 13 Constructor server When creting object, we normlly wish to specify its initil stte The The clock clock stte stte This is done using hours, hours, constructor: specil method which is Cretes Cretes object object nd nd initilizes invoked by commnd its its fields fields using using supplied supplied vlues vlues c ( ); ( ( h, h, m, m, s) s) hours hours h; h; minutes minutes m; m; client seconds seconds s; s; Public Public SomeClss SomeClss Or Or methods methods follow follow c1; c1; c1 c1 (12,0,0); c2 c2 (10,60,45); This client code cuses server code to crete two objects. Writing Clsses, Shimon Schocken IDC Herzliy, slide 14

8 The this keyword The The clock clock stte stte hours, hours, Constructor: one one style style ( ( h, h, m, m, s) s) hours hours h; h; minutes minutes m; m; seconds seconds s; s; Inside n instnce method, this keyword refers to object on which method is currently operting this cn be thought of s generic object vrible, poing to current object. Constructor: Constructor: nor nor style style ( ( hours, hours,,, seconds) seconds) ) this.hours hours hours hours; hours; this.minutes minutes minutes; minutes; this.seconds seconds seconds Constructor Or Or methods methods follow follow Writing Clsses, Shimon Schocken IDC Herzliy, slide 15 Constructor definition, properly documented using Jvdoc hours, hours, / / Cretes Cretes clock clock nd nd set set it it to to specified specified time. time. If If one one of of prmeters prmeters is is not not in in llowed llowed rnge, rnge, constructor constructor hs hs no no effect effect on on clock s clock s hours hours The The hours hours to to be be set set minutes minutes The The minutes minutes to to be be set set seconds seconds The The seconds seconds to to be be set set (0-59) (0-59) / / Resulting API, following jvdoc.jv ( ( hours, hours, seconds) seconds) if if ((seconds ((seconds > > 0) 0) && && (seconds (seconds < < 60) 60) && && (minutes (minutes > > 0) 0) && && (minutes (minutes < < 60) 60) && && (hours (hours > > 0) 0) && && (hours (hours < < 24)) 24)) this.hours this.hours hours; hours; this.minutes this.minutes minutes; minutes; this.seconds this.seconds Writing Clsses, Shimon Schocken IDC Herzliy, slide 16

9 Constructor ntomy, behind scene Creting Cloc object (exmple) SomeClss SomeClss c1, c1, c2, c2, c3; c3; c1 c1 (13,0,0); c2 c2 (22,10,1); When n object vrible is declred, only reference vrible is llocted The object dt is creted if nd when constructor is invoked vi Memory c c1 c3 c1 object c2 object Writing Clsses, Shimon Schocken IDC Herzliy, slide 17 Outline Modulrity Abstrction Clss ntomy Fields Constructors Methods Relted topics Method overloding Revisiting Prmeter pssing Vrible life cycle Encpsultion Method ntomy Clss vs. instnce methods Types nd vlues Methods prmeters Accessors nd muttors Writing Clsses, Shimon Schocken IDC Herzliy, slide 18

10 Methods A method, k subroutine, is stnd-lone piece of code designed to crry out well defined computtion or opertion Clss () methods: ssocited with level. Exmple: sqrt Instnce methods: methods tht re ssocited with objects. Exmple: turnright method ssocited with prticulr Turtle objects Clss methods provide generl-purpose functionlity Instnce methods implement object behviors. Writing Clsses, Shimon Schocken IDC Herzliy, slide 19 Instnce method exmple server hours, hours, Constructor (omitted) (omitted) The desired behviors of object re implemented by methods. Ech method is designed to perform one bstrct opertion Advnce Advnce clock clock by by 1 second second client secondelpsed() Public if if (seconds (seconds < 59) Public someclss someclss 59) else else c (12,0,0); seconds seconds c.secondelpsed(); if if (minutes (minutes < 59) 59) minutes minutes ; else else minutes minutes hours hours hours hours < 24 24? Hours Hours 1 : 1; 1; Semntics: invoke secondelpsed method on c (or methods) ( object tht c refers to). methods) Writing Clsses, Shimon Schocken IDC Herzliy, slide 20

11 Method types nd vlues client SomeClss SomeClss server c (0,0,0); hours, hours, Invoking Invoking method method c.hourelpsed(2); hourelpsed() Invoking Invoking typed typed methods methods hours hours (hours (hours 1) 1) % 24; 24; h c.gethours(); System.out.prln(c.toString); gethours() gethours() hours; hours; String String tostring() tostring() (hours (hours "\t" "\t" minutes minutes "\t" "\t" seconds); seconds); Void method: hs no type nd no vlue Typed method: hs eir primitive type or n object type. Returns vlue tht must conform to method s type. Writing Clsses, Shimon Schocken IDC Herzliy, slide 21 Method prmeters Methods my or my not hve prmeters A prmeter is like locl vrible which is initilized by method s cller. Forml prmeters cllee settime( hours, hours, seconds) seconds) if if ((seconds ((seconds > > 0) 0) && &&(seconds < 60) 60) && && (minutes (minutes > > 0) 0) && &&(minutes < 60) 60) && && (hours (hours > > 0) 0) && &&(hours < 24)) 24)) this.hours this.hours hours; hours; cller this.minutes minutes; minutes; Public this.seconds Public someclss someclss c1 c1 (12, (12, 0, 0, 0); 0); no no effect effect if if input input is is invlid invlid c1.settime(2, 15, 15, 0); 0); Actul prmeters (rguments) Writing Clsses, Shimon Schocken IDC Herzliy, slide 22

12 By wy Current Current time time represented by by clock clock hours, hours, Now tht we hve settime method, it mkes sense to re-define constructor. Constructor ( ( hours, hours, seconds) seconds) settime(hours, seconds); seconds); Sets Sets time time to to given given vlues vlues settime( hours, hours, seconds) seconds) if if ((seconds ((seconds > > 0) 0) && &&(seconds < 60) 60) && && (minutes (minutes > > 0) 0) && &&(minutes < 60) 60) && && (hours (hours > > 0) 0) && &&(hours < 24)) 24)) this.hours this.hours hours; hours; this.minutes minutes; minutes; this.seconds no no effect effect if if input input is is invlid invlid Writing Clsses, Shimon Schocken IDC Herzliy, slide 23 Accessor methods server hours, hours, Accessor methods: used to query nd informtion bout vribles Enble controlled ccess to vribles from outside. gethours() gethours() hours; hours; getminutes() minutes; minutes; getseconds() client someclss someclss c (12,0,0); h c.gethours(); System.out.pr(c.getSeconds) Writing Clsses, Shimon Schocken IDC Herzliy, slide 24

13 Muttor methods server hours, hours, sethours( hours) hours) if if ((h ((h > 0) 0) && &&(h (h < < 24)) 24)) this.hours this.hours hours; hours; setminutes( minutes) minutes) if if ((m ((m > > 0) 0) && &&(m (m < 60)) 60)) this.minutes minutes; minutes; setseconds( seconds) seconds) if if ((s ((s > > 0) 0) && &&(s (s < 60)) 60)) this.seconds Muttor methods: used to set vlues of vribles Enble controlled updte of vribles from outside. client someclss someclss dedlinehour 2 2 c (12,0,0); c.sethours(17); c.sethours(dedlinehour-1); c.setminutes(scn.nextint()); Writing Clsses, Shimon Schocken IDC Herzliy, slide 25 Method invoction exmples Demo Demo min(string[] rgs) rgs) c1 c1 (12,59,59); c2 c2 (12,59,59); h gethours(); h c1.gethours()); c1.secondelpsed(); Error! Which clock re we tlking bout? Invoking method System.out.prln(c1.getHours()); 1 System.out.prln(c2.getHours()); x Mth.sqrt(c2.getMinutes()); Sttic method invoction Instnce method invoction Writing Clsses, Shimon Schocken IDC Herzliy, slide 26

14 Outline Modulrity Abstrction Clss ntomy Fields Constructors Methods Relted topics Method overloding Revisiting Prmeter pssing Vrible life cycle Encpsultion Method ntomy Clss vs. instnce methods Types nd vlues Methods prmeters Accessors nd muttors Writing Clsses, Shimon Schocken IDC Herzliy, slide 27 Method overloding cllee MyMth MyMth sum sum ( ( x, x, y)) y)) x x y; y; sum sum ( ( x, x, y, y, z)) z)) x x y y z; z; sum sum ( ( x, x, y)) y)) x x y; y; cller SomeClss SomeClss System.Out.prln(MyMth.sum(5,3)); System.Out.prln(MyMth.sum(5,3)); Will Will prs prs 8 8 System.Out.prln(MyMth.sum(7,2,8)); System.Out.prln(MyMth.sum(7,2,8)); Will Will prs prs System.Out.prln(MyMth.sum(5.3,4)); System.Out.prln(MyMth.sum(5.3,4)); Will Will pr pr Jv llows defining different methods with sme nme Method signture: method nme, prmeter types, prmeter nmes Jv knows which method to invoke ccording to method signture implied by cller Advntges: Promotes shorter, fewer, nd redble method nmes. Writing Clsses, Shimon Schocken IDC Herzliy, slide 28

15 Method overloding SqureRootDemo min(string rgs[]) rgs[]) System.out.prln(sqrt(17) sqrt(17)); System.out.prln(sqrt(17, sqrt(17, sqrt(17, )); )); sqrt( sqrt( x) x) sqrt(x,0.1); sqrt( sqrt( x, x, precision) precision) root root x / 2; 2; while while (Mth.bs((root root) root) - x) x) > precision) precision) root root (root (root (x (x/ root)) root)) / 2; 2; root; root; Writing Clsses, Shimon Schocken IDC Herzliy, slide 29 Constructor overloding hours, hours, server Constructors Constructors ( ( hours, hours, seconds) seconds) settime(hours, settime(hours, seconds); seconds); client ( ( hours) hours) someclss someclss this.hours this.hours hours; hours; this.minutes this.minutes c1 c1 (12,59,59); this.seconds this.seconds c2 c2 (12); c3 c3 (); (); Alterntive Alterntive definition: definition: ( ( hours) hours) this(hours, this(hours, 0 0,0);,0); () () hours hours minutes minutes seconds seconds An overloded constructor provides multiple wys to set up object. Writing Clsses, Shimon Schocken IDC Herzliy, slide 30

16 revisited Account Account numbers numbers re re llocted llocted from from 1 1 onwrd. onwrd. nextaccountnumber nextaccountnumber 1; 1; Fields Fields number; number; Account Account number number String String owner; owner; Account Account owner owner blnce; blnce; Current Current blnce blnce Sets Sets up up ccount ccount (String (String owner, owner, blnce) blnce) this.number this.number nextaccountnumber; nextaccountnumber; this.owner this.owner owner; owner; this.blnce this.blnce blnce; blnce; Returns Returns textul textul object object description description String String tostring tostring () () (number (number "\t" "\t" owner owner "\t" "\t" () () blnce); blnce); Demo Demo server (Only subset of members is shown) client min(string[] min(string[] rgs) rgs) liceaccount liceaccount ("Alice", ("Alice", 0); 0); bobaccount bobaccount ("Bob", ("Bob", 100); 100); System.out.prln(liceAccount.toString()); System.out.prln(liceAccount.toString()); System.out.prln(bobAccount.toString()); System.out.prln(bobAccount.toString()); Writing Clsses, Shimon Schocken IDC Herzliy, slide 31 revisited Only Only subset subset of of members members is is shown shown server bnkdeposits bnkdeposits client Demo Demo Fields Fields number; number; min(string[] min(string[] rgs) rgs) String String owner; owner; liceaccount liceaccount ("Alice", ("Alice", 0); 0); blnce; blnce; bobaccount ("Bob", 100); bobaccount ("Bob", 100); System.out.prln(liceAccount.toString()); Hndles Hndles deposit System.out.prln(liceAccount.toString()); deposit deposit deposit ( ( mount) mount) System.out.prln(bobAccount.toString()); System.out.prln(bobAccount.toString()); chrge chrge commission(mount); commission(mount); blnce blnce blnce blnce mount mount - - chrge; liceaccount.deposit(1000); chrge; liceaccount.deposit(1000); bnkdeposits bnkdeposits (mount (mount chrge); chrge); liceaccount.trnsferto(300,bobaccount); liceaccount.trnsferto(300,bobaccount); System.out.prln(liceAccount.toString()); System.out.prln(liceAccount.toString()); System.out.prln(bobAccount.toString()); Hndles Hndles withdrwl System.out.prln(bobAccount.toString()); withdrwl withdrw withdrw ( ( mount) mount) chrge chrge commission(mount); commission(mount); blnce blnce blnce blnce - - mount mount - - chrge; chrge; bnkdeposits bnkdeposits - - (mount (mount - - chrge) chrge) ; ; Hndles Hndles trnsfer trnsfer Constructor trnsferto( trnsferto( mount, mount, trgetaccount) trgetaccount) trgetaccount.deposit(mount); trgetaccount.deposit(mount); this.withdrw(mount); this.withdrw(mount); Writing Clsses, Shimon Schocken IDC Herzliy, slide 32

17 revisited Only Only subset subset of of members members is is shown shown bnkdeposits bnkdeposits finl finl COMMISSION_RATE COMMISSION_RATE 0.005; 0.005; finl finl COMMISSION_STEP COMMISSION_STEP number; number; String String owner; owner; blnce; blnce; Hndles Hndles deposit deposit deposit deposit ( ( mount) mount) chrge chrge commission(mount); commission(mount); blnce blnce blnce blnce mount mount - - chrge; chrge; bnkdeposits bnkdeposits (mount (mount chrge); chrge); Returns Returns blnce blnce getblnce getblnce () () blnce; blnce; Returns Returns commission commission tht tht bnk bnk chrges chrges for for mount mount commission commission ( Constructor ( mount) mount) ((mount ((mount > > COMMISSION_STEP) COMMISSION_STEP)?? (mount (mount COMMISSION_RATE COMMISSION_RATE / / 2) 2) : : (mount (mount COMMISSION_RATE)); COMMISSION_RATE)); Writing Clsses, Shimon Schocken IDC Herzliy, slide 33 Cll by vlue / cll by reference cllee Fields Fields number; number; String String owner; owner; blnce; blnce; Hndles Hndles trnsfer trnsfer Cll by vlue Cll by reference trnsferto( trnsferto( mount, mount, trgetaccount) trgetaccount) trgetaccount.deposit(mount); trgetaccount.deposit(mount); this.withdrw(mount); this.withdrw(mount); mount mount just just for for demo demo cller liceacc liceacc ( Alice, ( Alice, 800); 800); bobacc bobacc ( Bob, ( Bob, 100); 100); Cll by vlue: Used when prmeter is of primitive type A vlue is computed nd pssed to method The method cnnot chnge prmeter. mount mount liceacc.trnsfer(mount, liceacc.trnsfer(mount, bobacc); bobacc); System.out.prln(mount); System.out.prln(mount); Will Will pr pr Cll by reference Used when prmeter is of object type A poer to object is pssed to method The method cn chnge referred object. Writing Clsses, Shimon Schocken IDC Herzliy, slide 34

18 Vrible life cycle Sttic vribles Instnce vribles Locl vribles Sttic vribles: creted first time method from is invoked Instnce vribles: creted when object is creted nd recycled when object is destroyed Locl vribles: creted when method is invoked nd recycled when it s Prmeters: sme s locl vribles. Initilized by rguments supplied by cller. lstaccountnumber 1; 1; bnkdeposits number; number; String String owner; owner; blnce; blnce; Sets Sets up up ccount ccount (String (String owner, owner, blnce) blnce) this.number lstaccountnumber; this.owner this.owner owner; owner; this.blnce blnce; blnce; prmeter Hndles Hndles withdrwl withdrwl withdrw withdrw ( ( mount) mount) blncetemp blnce blnce mount mount if if (blncetemp > > 0) 0) blnce blnce blncetemp; bnkdeposits - - mount; mount; else else omitted omitted Writing Clsses, Shimon Schocken IDC Herzliy, slide 35 Outline Modulrity Abstrction Clss ntomy Fields Constructors Methods Relted topics Method overloding Revisiting Prmeter pssing Vrible life cycle Encpsultion Method ntomy Clss vs. instnce methods Types nd vlues Methods prmeters Accessors nd muttors Writing Clsses, Shimon Schocken IDC Herzliy, slide 36

19 Encpsultion bstrction: A is n object tht keeps nd reports time using 24- hour system Required services: Crete clock Advnce clock 1 second Query clock time Set clock time ( (hours, seconds) secondelpsed() getseconds() getminutes() gethours() Encpsultion: Seprting contrctul erfce of n bstrction from its implementtion. setseconds() setminutes() sethours() More More services Writing Clsses, Shimon Schocken IDC Herzliy, slide 37 Encpsultion Clients Methods deposit() withdrw() Dt tildown number x,y Owner direction blnce trnsfer() getblnce() Encpsultion: Etc Hiding, or encpsulting, ernl stte of object from outside Protects egrity of object by preventing users from setting its ernl dt o n invlid or inconsistent stte A criticlly importnt OO design objective. Writing Clsses, Shimon Schocken IDC Herzliy, slide 38

20 Encpsultion nd visibility modifiers Vribles Violte encpsultion Enforce encpsultion Methods Provide services to clients Support or methods in sme Writing Clsses, Shimon Schocken IDC Herzliy, slide 39

Lecture Overview. Knowledge-based systems in Bioinformatics, 1MB602. Procedural abstraction. The sum procedure. Integration as a procedure

Lecture Overview. Knowledge-based systems in Bioinformatics, 1MB602. Procedural abstraction. The sum procedure. Integration as a procedure Lecture Overview Knowledge-bsed systems in Bioinformtics, MB6 Scheme lecture Procedurl bstrction Higher order procedures Procedures s rguments Procedures s returned vlues Locl vribles Dt bstrction Compound

More information

box Boxes and Arrows 3 true 7.59 'X' An object is drawn as a box that contains its data members, for example:

box Boxes and Arrows 3 true 7.59 'X' An object is drawn as a box that contains its data members, for example: Boxes nd Arrows There re two kinds of vriles in Jv: those tht store primitive vlues nd those tht store references. Primitive vlues re vlues of type long, int, short, chr, yte, oolen, doule, nd flot. References

More information

Data sharing in OpenMP

Data sharing in OpenMP Dt shring in OpenMP Polo Burgio polo.burgio@unimore.it Outline Expressing prllelism Understnding prllel threds Memory Dt mngement Dt cluses Synchroniztion Brriers, locks, criticl sections Work prtitioning

More information

Reference types and their characteristics Class Definition Constructors and Object Creation Special objects: Strings and Arrays

Reference types and their characteristics Class Definition Constructors and Object Creation Special objects: Strings and Arrays Objects nd Clsses Reference types nd their chrcteristics Clss Definition Constructors nd Object Cretion Specil objects: Strings nd Arrys OOAD 1999/2000 Cludi Niederée, Jochim W. Schmidt Softwre Systems

More information

CS201 Discussion 10 DRAWTREE + TRIES

CS201 Discussion 10 DRAWTREE + TRIES CS201 Discussion 10 DRAWTREE + TRIES DrwTree First instinct: recursion As very generic structure, we could tckle this problem s follows: drw(): Find the root drw(root) drw(root): Write the line for the

More information

cisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example:

cisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example: cisc1110 fll 2010 lecture VI.2 cll y vlue function prmeters more on functions more on cll y vlue nd cll y reference pssing strings to functions returning strings from functions vrile scope glol vriles

More information

How to Design REST API? Written Date : March 23, 2015

How to Design REST API? Written Date : March 23, 2015 Visul Prdigm How Design REST API? Turil How Design REST API? Written Dte : Mrch 23, 2015 REpresenttionl Stte Trnsfer, n rchitecturl style tht cn be used in building networked pplictions, is becoming incresingly

More information

Agenda & Reading. Class Exercise. COMPSCI 105 SS 2012 Principles of Computer Science. Arrays

Agenda & Reading. Class Exercise. COMPSCI 105 SS 2012 Principles of Computer Science. Arrays COMPSCI 5 SS Principles of Computer Science Arrys & Multidimensionl Arrys Agend & Reding Agend Arrys Creting & Using Primitive & Reference Types Assignments & Equlity Pss y Vlue & Pss y Reference Copying

More information

Functor (1A) Young Won Lim 10/5/17

Functor (1A) Young Won Lim 10/5/17 Copyright (c) 2016-2017 Young W. Lim. Permission is grnted to copy, distribute nd/or modify this document under the terms of the GNU Free Documenttion License, Version 1.2 or ny lter version published

More information

Introduction to Computer Science, Shimon Schocken, IDC Herzliya. Lecture A very small selection of some topics in Object-Oriented Design

Introduction to Computer Science, Shimon Schocken, IDC Herzliya. Lecture A very small selection of some topics in Object-Oriented Design Introduction to Computer Science, Shimon Schocken, IDC Herzliy Lecture 11.1 A very smll selection of some topics in Object-Oriented Desin OO Desin, Shimon Schocken IDC Herzliy, www.ro2cs.com slide 1 Systems

More information

MIPS I/O and Interrupt

MIPS I/O and Interrupt MIPS I/O nd Interrupt Review Floting point instructions re crried out on seprte chip clled coprocessor 1 You hve to move dt to/from coprocessor 1 to do most common opertions such s printing, clling functions,

More information

ECE 468/573 Midterm 1 September 28, 2012

ECE 468/573 Midterm 1 September 28, 2012 ECE 468/573 Midterm 1 September 28, 2012 Nme:! Purdue emil:! Plese sign the following: I ffirm tht the nswers given on this test re mine nd mine lone. I did not receive help from ny person or mteril (other

More information

Pointers and Arrays. More Pointer Examples. Pointers CS 217

Pointers and Arrays. More Pointer Examples. Pointers CS 217 Pointers nd Arrs CS 21 1 2 Pointers More Pointer Emples Wht is pointer A vrile whose vlue is the ddress of nother vrile p is pointer to vrile v Opertions &: ddress of (reference) *: indirection (dereference)

More information

Virtual Machine (Part I)

Virtual Machine (Part I) Hrvrd University CS Fll 2, Shimon Schocken Virtul Mchine (Prt I) Elements of Computing Systems Virtul Mchine I (Ch. 7) Motivtion clss clss Min Min sttic sttic x; x; function function void void min() min()

More information

From Dependencies to Evaluation Strategies

From Dependencies to Evaluation Strategies From Dependencies to Evlution Strtegies Possile strtegies: 1 let the user define the evlution order 2 utomtic strtegy sed on the dependencies: use locl dependencies to determine which ttriutes to compute

More information

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

In the last lecture, we discussed how valid tokens may be specified by regular expressions. LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.

More information

Functor (1A) Young Won Lim 8/2/17

Functor (1A) Young Won Lim 8/2/17 Copyright (c) 2016-2017 Young W. Lim. Permission is grnted to copy, distribute nd/or modify this document under the terms of the GNU Free Documenttion License, Version 1.2 or ny lter version published

More information

Introduction To Files In Pascal

Introduction To Files In Pascal Why other With Files? Introduction To Files In Pscl Too much informtion to input ll t once The informtion must be persistent (RAM is voltile) Etc. In this section of notes you will lern how to red from

More information

Unit 5 Vocabulary. A function is a special relationship where each input has a single output.

Unit 5 Vocabulary. A function is a special relationship where each input has a single output. MODULE 3 Terms Definition Picture/Exmple/Nottion 1 Function Nottion Function nottion is n efficient nd effective wy to write functions of ll types. This nottion llows you to identify the input vlue with

More information

Very sad code. Abstraction, List, & Cons. CS61A Lecture 7. Happier Code. Goals. Constructors. Constructors 6/29/2011. Selectors.

Very sad code. Abstraction, List, & Cons. CS61A Lecture 7. Happier Code. Goals. Constructors. Constructors 6/29/2011. Selectors. 6/9/ Abstrction, List, & Cons CS6A Lecture 7-6-9 Colleen Lewis Very sd code (define (totl hnd) (if (empty? hnd) (+ (butlst (lst hnd)) (totl (butlst hnd))))) STk> (totl (h c d)) 7 STk> (totl (h ks d)) ;;;EEEK!

More information

vcloud Director Service Provider Admin Portal Guide vcloud Director 9.1

vcloud Director Service Provider Admin Portal Guide vcloud Director 9.1 vcloud Director Service Provider Admin Portl Guide vcloud Director 9. vcloud Director Service Provider Admin Portl Guide You cn find the most up-to-dte technicl documenttion on the VMwre website t: https://docs.vmwre.com/

More information

Distributed Systems Principles and Paradigms

Distributed Systems Principles and Paradigms Distriuted Systems Principles nd Prdigms Chpter 11 (version April 7, 2008) Mrten vn Steen Vrije Universiteit Amsterdm, Fculty of Science Dept. Mthemtics nd Computer Science Room R4.20. Tel: (020) 598 7784

More information

CIS 1068 Program Design and Abstraction Spring2015 Midterm Exam 1. Name SOLUTION

CIS 1068 Program Design and Abstraction Spring2015 Midterm Exam 1. Name SOLUTION CIS 1068 Progrm Design nd Astrction Spring2015 Midterm Exm 1 Nme SOLUTION Pge Points Score 2 15 3 8 4 18 5 10 6 7 7 7 8 14 9 11 10 10 Totl 100 1 P ge 1. Progrm Trces (41 points, 50 minutes) Answer the

More information

- 2 U NIX FILES 1. Explin different file types vilble in UNIX or P OSIX s ystem. ( 08 mrks) ( My-08/Dec-08/My-10/My- 12) 2. Wht is n API? How is it di

- 2 U NIX FILES 1. Explin different file types vilble in UNIX or P OSIX s ystem. ( 08 mrks) ( My-08/Dec-08/My-10/My- 12) 2. Wht is n API? How is it di -1 I NTRODUCTION 1. Wht is posix stndrd? Explin different subset of posix stndrd. Write structure of progrm to filter out non- p osix complint codes from user progrm. ( 06 mrks) ( Dec- 2010). 2. W rite

More information

CPSC 213. Polymorphism. Introduction to Computer Systems. Readings for Next Two Lectures. Back to Procedure Calls

CPSC 213. Polymorphism. Introduction to Computer Systems. Readings for Next Two Lectures. Back to Procedure Calls Redings for Next Two Lectures Text CPSC 213 Switch Sttements, Understnding Pointers - 2nd ed: 3.6.7, 3.10-1st ed: 3.6.6, 3.11 Introduction to Computer Systems Unit 1f Dynmic Control Flow Polymorphism nd

More information

pdfapilot Server 2 Manual

pdfapilot Server 2 Manual pdfpilot Server 2 Mnul 2011 by clls softwre gmbh Schönhuser Allee 6/7 D 10119 Berlin Germny info@cllssoftwre.com www.cllssoftwre.com Mnul clls pdfpilot Server 2 Pge 2 clls pdfpilot Server 2 Mnul Lst modified:

More information

Discussion 1 Recap. COP4600 Discussion 2 OS concepts, System call, and Assignment 1. Questions. Questions. Outline. Outline 10/24/2010

Discussion 1 Recap. COP4600 Discussion 2 OS concepts, System call, and Assignment 1. Questions. Questions. Outline. Outline 10/24/2010 COP4600 Discussion 2 OS concepts, System cll, nd Assignment 1 TA: Hufeng Jin hj0@cise.ufl.edu Discussion 1 Recp Introduction to C C Bsic Types (chr, int, long, flot, doule, ) C Preprocessors (#include,

More information

Outline. Tiling, formally. Expression tile as rule. Statement tiles as rules. Function calls. CS 412 Introduction to Compilers

Outline. Tiling, formally. Expression tile as rule. Statement tiles as rules. Function calls. CS 412 Introduction to Compilers CS 412 Introduction to Compilers Andrew Myers Cornell University Lectur8 Finishing genertion 9 Mr 01 Outline Tiling s syntx-directed trnsltion Implementing function clls Implementing functions Optimizing

More information

Math 464 Fall 2012 Notes on Marginal and Conditional Densities October 18, 2012

Math 464 Fall 2012 Notes on Marginal and Conditional Densities October 18, 2012 Mth 464 Fll 2012 Notes on Mrginl nd Conditionl Densities klin@mth.rizon.edu October 18, 2012 Mrginl densities. Suppose you hve 3 continuous rndom vribles X, Y, nd Z, with joint density f(x,y,z. The mrginl

More information

Memory Management Functions

Memory Management Functions Meory Mngeent Functions Chpter 9 Meory Mngeent Process of binding vlues to eory loctions Vlues y be sttic or dynic Vlues re ssigned t different plces Sttic eory Run-tie stck Hep 1 Meory Mngeent Sttic Meory

More information

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID:

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID: Fll term 2012 KAIST EE209 Progrmming Structures for EE Mid-term exm Thursdy Oct 25, 2012 Student's nme: Student ID: The exm is closed book nd notes. Red the questions crefully nd focus your nswers on wht

More information

CSCE 531, Spring 2017, Midterm Exam Answer Key

CSCE 531, Spring 2017, Midterm Exam Answer Key CCE 531, pring 2017, Midterm Exm Answer Key 1. (15 points) Using the method descried in the ook or in clss, convert the following regulr expression into n equivlent (nondeterministic) finite utomton: (

More information

10.5 Graphing Quadratic Functions

10.5 Graphing Quadratic Functions 0.5 Grphing Qudrtic Functions Now tht we cn solve qudrtic equtions, we wnt to lern how to grph the function ssocited with the qudrtic eqution. We cll this the qudrtic function. Grphs of Qudrtic Functions

More information

MA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork

MA1008. Calculus and Linear Algebra for Engineers. Course Notes for Section B. Stephen Wills. Department of Mathematics. University College Cork MA1008 Clculus nd Liner Algebr for Engineers Course Notes for Section B Stephen Wills Deprtment of Mthemtics University College Cork s.wills@ucc.ie http://euclid.ucc.ie/pges/stff/wills/teching/m1008/ma1008.html

More information

Dynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012

Dynamic Programming. Andreas Klappenecker. [partially based on slides by Prof. Welch] Monday, September 24, 2012 Dynmic Progrmming Andres Klppenecker [prtilly bsed on slides by Prof. Welch] 1 Dynmic Progrmming Optiml substructure An optiml solution to the problem contins within it optiml solutions to subproblems.

More information

Creating Flexible Interfaces. Friday, 24 April 2015

Creating Flexible Interfaces. Friday, 24 April 2015 Creting Flexible Interfces 1 Requests, not Objects Domin objects re esy to find but they re not t the design center of your ppliction. Insted, they re trp for the unwry. Sequence digrms re vehicle for

More information

Geometric transformations

Geometric transformations Geometric trnsformtions Computer Grphics Some slides re bsed on Shy Shlom slides from TAU mn n n m m T A,,,,,, 2 1 2 22 12 1 21 11 Rows become columns nd columns become rows nm n n m m A,,,,,, 1 1 2 22

More information

Systems I. Logic Design I. Topics Digital logic Logic gates Simple combinational logic circuits

Systems I. Logic Design I. Topics Digital logic Logic gates Simple combinational logic circuits Systems I Logic Design I Topics Digitl logic Logic gtes Simple comintionl logic circuits Simple C sttement.. C = + ; Wht pieces of hrdwre do you think you might need? Storge - for vlues,, C Computtion

More information

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5 CS321 Lnguges nd Compiler Design I Winter 2012 Lecture 5 1 FINITE AUTOMATA A non-deterministic finite utomton (NFA) consists of: An input lphet Σ, e.g. Σ =,. A set of sttes S, e.g. S = {1, 3, 5, 7, 11,

More information

Fall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications.

Fall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications. 15-112 Fll 2018 Midterm 1 October 11, 2018 Nme: Andrew ID: Recittion Section: ˆ You my not use ny books, notes, extr pper, or electronic devices during this exm. There should be nothing on your desk or

More information

Midterm 2 Sample solution

Midterm 2 Sample solution Nme: Instructions Midterm 2 Smple solution CMSC 430 Introduction to Compilers Fll 2012 November 28, 2012 This exm contins 9 pges, including this one. Mke sure you hve ll the pges. Write your nme on the

More information

COMPUTER SCIENCE 123. Foundations of Computer Science. 6. Tuples

COMPUTER SCIENCE 123. Foundations of Computer Science. 6. Tuples COMPUTER SCIENCE 123 Foundtions of Computer Science 6. Tuples Summry: This lecture introduces tuples in Hskell. Reference: Thompson Sections 5.1 2 R.L. While, 2000 3 Tuples Most dt comes with structure

More information

Deposit a Technical Report in PubRep

Deposit a Technical Report in PubRep Technicl in Lst Updte:19.12.016 Te c h n i c l Technicl s re mjor source of scientific informtion, prepred for institutionl nd wider distribution. They re considered grey literture since they re scientific

More information

Virtual Machine I: Stack Arithmetic

Virtual Machine I: Stack Arithmetic Virtul Mchine I: Stck Arithmetic Building Modern Computer From First Principles www.nnd2tetris.org Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 7: Virtul Mchine

More information

1 Quad-Edge Construction Operators

1 Quad-Edge Construction Operators CS48: Computer Grphics Hndout # Geometric Modeling Originl Hndout #5 Stnford University Tuesdy, 8 December 99 Originl Lecture #5: 9 November 99 Topics: Mnipultions with Qud-Edge Dt Structures Scribe: Mike

More information

vcloud Director Service Provider Admin Portal Guide 04 OCT 2018 vcloud Director 9.5

vcloud Director Service Provider Admin Portal Guide 04 OCT 2018 vcloud Director 9.5 vcloud Director Service Provider Admin Portl Guide 04 OCT 208 vcloud Director 9.5 You cn find the most up-to-dte technicl documenttion on the VMwre website t: https://docs.vmwre.com/ If you hve comments

More information

4452 Mathematical Modeling Lecture 4: Lagrange Multipliers

4452 Mathematical Modeling Lecture 4: Lagrange Multipliers Mth Modeling Lecture 4: Lgrnge Multipliers Pge 4452 Mthemticl Modeling Lecture 4: Lgrnge Multipliers Lgrnge multipliers re high powered mthemticl technique to find the mximum nd minimum of multidimensionl

More information

UNIT 11. Query Optimization

UNIT 11. Query Optimization UNIT Query Optimiztion Contents Introduction to Query Optimiztion 2 The Optimiztion Process: An Overview 3 Optimiztion in System R 4 Optimiztion in INGRES 5 Implementing the Join Opertors Wei-Png Yng,

More information

L2-Python-Data-Structures

L2-Python-Data-Structures L2-Python-Dt-Structures Mrch 19, 2018 1 Principl built-in types in Python (Python ) numerics: int, flot, long, complex sequences: str, unicode, list, tuple, byterry, buffer, xrnge mppings: dict files:

More information

TO REGULAR EXPRESSIONS

TO REGULAR EXPRESSIONS Suject :- Computer Science Course Nme :- Theory Of Computtion DA TO REGULAR EXPRESSIONS Report Sumitted y:- Ajy Singh Meen 07000505 jysmeen@cse.iit.c.in BASIC DEINITIONS DA:- A finite stte mchine where

More information

Sample Midterm Solutions COMS W4115 Programming Languages and Translators Monday, October 12, 2009

Sample Midterm Solutions COMS W4115 Programming Languages and Translators Monday, October 12, 2009 Deprtment of Computer cience Columbi University mple Midterm olutions COM W4115 Progrmming Lnguges nd Trnsltors Mondy, October 12, 2009 Closed book, no ids. ch question is worth 20 points. Question 5(c)

More information

10/9/2012. Operator is an operation performed over data at runtime. Arithmetic, Logical, Comparison, Assignment, Etc. Operators have precedence

10/9/2012. Operator is an operation performed over data at runtime. Arithmetic, Logical, Comparison, Assignment, Etc. Operators have precedence /9/22 P f Performing i Si Simple l Clcultions C l l ti with ith C#. Opertors in C# nd Opertor Precedence 2. Arithmetic Opertors 3. Logicl Opertors 4. Bitwise Opertors 5. Comprison Opertors 6. Assignment

More information

ASTs, Regex, Parsing, and Pretty Printing

ASTs, Regex, Parsing, and Pretty Printing ASTs, Regex, Prsing, nd Pretty Printing CS 2112 Fll 2016 1 Algeric Expressions To strt, consider integer rithmetic. Suppose we hve the following 1. The lphet we will use is the digits {0, 1, 2, 3, 4, 5,

More information

Preserving Constraints for Aggregation Relationship Type Update in XML Document

Preserving Constraints for Aggregation Relationship Type Update in XML Document Preserving Constrints for Aggregtion Reltionship Type Updte in XML Document Eric Prdede 1, J. Wenny Rhyu 1, nd Dvid Tnir 2 1 Deprtment of Computer Science nd Computer Engineering, L Trobe University, Bundoor

More information

Definition of Regular Expression

Definition of Regular Expression Definition of Regulr Expression After the definition of the string nd lnguges, we re redy to descrie regulr expressions, the nottion we shll use to define the clss of lnguges known s regulr sets. Recll

More information

Reducing Costs with Duck Typing. Structural

Reducing Costs with Duck Typing. Structural Reducing Costs with Duck Typing Structurl 1 Duck Typing In computer progrmming with object-oriented progrmming lnguges, duck typing is lyer of progrmming lnguge nd design rules on top of typing. Typing

More information

Reducing a DFA to a Minimal DFA

Reducing a DFA to a Minimal DFA Lexicl Anlysis - Prt 4 Reducing DFA to Miniml DFA Input: DFA IN Assume DFA IN never gets stuck (dd ded stte if necessry) Output: DFA MIN An equivlent DFA with the minimum numer of sttes. Hrry H. Porter,

More information

If f(x, y) is a surface that lies above r(t), we can think about the area between the surface and the curve.

If f(x, y) is a surface that lies above r(t), we can think about the area between the surface and the curve. Line Integrls The ide of line integrl is very similr to tht of single integrls. If the function f(x) is bove the x-xis on the intervl [, b], then the integrl of f(x) over [, b] is the re under f over the

More information

Fig.25: the Role of LEX

Fig.25: the Role of LEX The Lnguge for Specifying Lexicl Anlyzer We shll now study how to uild lexicl nlyzer from specifiction of tokens in the form of list of regulr expressions The discussion centers round the design of n existing

More information

Some Thoughts on Grad School. Undergraduate Compilers Review and Intro to MJC. Structure of a Typical Compiler. Lexing and Parsing

Some Thoughts on Grad School. Undergraduate Compilers Review and Intro to MJC. Structure of a Typical Compiler. Lexing and Parsing Undergrdute Compilers Review nd Intro to MJC Announcements Miling list is in full swing Tody Some thoughts on grd school Finish prsing Semntic nlysis Visitor pttern for bstrct syntx trees Some Thoughts

More information

COMMON HALF YEARLY EXAMINATION DECEMBER 2018

COMMON HALF YEARLY EXAMINATION DECEMBER 2018 li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net li.net i.net.pds.pds COMMON HALF YEARLY EXAMINATION DECEMBER 2018 STD : XI SUBJECT: COMPUTER SCIENCE

More information

A Formalism for Functionality Preserving System Level Transformations

A Formalism for Functionality Preserving System Level Transformations A Formlism for Functionlity Preserving System Level Trnsformtions Smr Abdi Dniel Gjski Center for Embedded Computer Systems UC Irvine Center for Embedded Computer Systems UC Irvine Irvine, CA 92697 Irvine,

More information

Spring 2018 Midterm Exam 1 March 1, You may not use any books, notes, or electronic devices during this exam.

Spring 2018 Midterm Exam 1 March 1, You may not use any books, notes, or electronic devices during this exam. 15-112 Spring 2018 Midterm Exm 1 Mrch 1, 2018 Nme: Andrew ID: Recittion Section: You my not use ny books, notes, or electronic devices during this exm. You my not sk questions bout the exm except for lnguge

More information

Topic: Software Model Checking via Counter-Example Guided Abstraction Refinement. Having a BLAST with SLAM. Combining Strengths. SLAM Overview SLAM

Topic: Software Model Checking via Counter-Example Guided Abstraction Refinement. Having a BLAST with SLAM. Combining Strengths. SLAM Overview SLAM Hving BLAST with SLAM Topic: Softwre Model Checking vi Counter-Exmple Guided Abstrction Refinement There re esily two dozen SLAM/BLAST/MAGIC ppers; I will skim. # # Theorem Proving Combining Strengths

More information

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 4: Lexical Analyzers 28 Jan 08

CS412/413. Introduction to Compilers Tim Teitelbaum. Lecture 4: Lexical Analyzers 28 Jan 08 CS412/413 Introduction to Compilers Tim Teitelum Lecture 4: Lexicl Anlyzers 28 Jn 08 Outline DFA stte minimiztion Lexicl nlyzers Automting lexicl nlysis Jlex lexicl nlyzer genertor CS 412/413 Spring 2008

More information

Tool Vendor Perspectives SysML Thus Far

Tool Vendor Perspectives SysML Thus Far Frontiers 2008 Pnel Georgi Tec, 05-13-08 Tool Vendor Perspectives SysML Thus Fr Hns-Peter Hoffmnn, Ph.D Chief Systems Methodologist Telelogic, Systems & Softwre Modeling Business Unit Peter.Hoffmnn@telelogic.com

More information

Readings : Computer Networking. Outline. The Next Internet: More of the Same? Required: Relevant earlier meeting:

Readings : Computer Networking. Outline. The Next Internet: More of the Same? Required: Relevant earlier meeting: Redings 15-744: Computer Networking L-14 Future Internet Architecture Required: Servl pper Extr reding on Mobility First Relevnt erlier meeting: CCN -> Nmed Dt Network 2 Outline The Next Internet: More

More information

Dr. D.M. Akbar Hussain

Dr. D.M. Akbar Hussain Dr. D.M. Akr Hussin Lexicl Anlysis. Bsic Ide: Red the source code nd generte tokens, it is similr wht humns will do to red in; just tking on the input nd reking it down in pieces. Ech token is sequence

More information

EECS 281: Homework #4 Due: Thursday, October 7, 2004

EECS 281: Homework #4 Due: Thursday, October 7, 2004 EECS 28: Homework #4 Due: Thursdy, October 7, 24 Nme: Emil:. Convert the 24-bit number x44243 to mime bse64: QUJD First, set is to brek 8-bit blocks into 6-bit blocks, nd then convert: x44243 b b 6 2 9

More information

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus Unit #9 : Definite Integrl Properties, Fundmentl Theorem of Clculus Gols: Identify properties of definite integrls Define odd nd even functions, nd reltionship to integrl vlues Introduce the Fundmentl

More information

CSEP 573 Artificial Intelligence Winter 2016

CSEP 573 Artificial Intelligence Winter 2016 CSEP 573 Artificil Intelligence Winter 2016 Luke Zettlemoyer Problem Spces nd Serch slides from Dn Klein, Sturt Russell, Andrew Moore, Dn Weld, Pieter Abbeel, Ali Frhdi Outline Agents tht Pln Ahed Serch

More information

Container Vs. Definition Classes. Container Class

Container Vs. Definition Classes. Container Class Overview Abstraction Defining new classes Instance variables Constructors Defining methods and passing parameters Method/constructor overloading Encapsulation Visibility modifiers Static members 14 November

More information

COMP 423 lecture 11 Jan. 28, 2008

COMP 423 lecture 11 Jan. 28, 2008 COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring

More information

Coprocessor memory definition. Loic Pallardy / Arnaud Pouliquen

Coprocessor memory definition. Loic Pallardy / Arnaud Pouliquen Coprocessor memory definition Loic Pllrdy / Arnud Pouliquen Objective 2 The gol of following slides is to sum up on-going discussion in OpenAP weekly bout Remoteproc/Rpmsg memory lloction. Following proposl

More information

VoIP for the Small Business

VoIP for the Small Business Reducing your telecommunictions costs Reserch firm IDC 1 hs estimted tht VoIP system cn reduce telephony-relted expenses by 30%. Voice over Internet Protocol (VoIP) hs become vible solution for even the

More information

CS 340, Fall 2014 Dec 11 th /13 th Final Exam Note: in all questions, the special symbol ɛ (epsilon) is used to indicate the empty string.

CS 340, Fall 2014 Dec 11 th /13 th Final Exam Note: in all questions, the special symbol ɛ (epsilon) is used to indicate the empty string. CS 340, Fll 2014 Dec 11 th /13 th Finl Exm Nme: Note: in ll questions, the specil symol ɛ (epsilon) is used to indicte the empty string. Question 1. [5 points] Consider the following regulr expression;

More information

Digital Design. Chapter 6: Optimizations and Tradeoffs

Digital Design. Chapter 6: Optimizations and Tradeoffs Digitl Design Chpter 6: Optimiztions nd Trdeoffs Slides to ccompny the tetbook Digitl Design, with RTL Design, VHDL, nd Verilog, 2nd Edition, by Frnk Vhid, John Wiley nd Sons Publishers, 2. http://www.ddvhid.com

More information

Engineer-to-Engineer Note

Engineer-to-Engineer Note Engineer-to-Engineer Note EE-069 Technicl notes on using Anlog Devices DSPs, processors nd development tools Visit our Web resources http://www.nlog.com/ee-notes nd http://www.nlog.com/processors or e-mil

More information

Assignment 4. Due 09/18/17

Assignment 4. Due 09/18/17 Assignment 4. ue 09/18/17 1. ). Write regulr expressions tht define the strings recognized by the following finite utomt: b d b b b c c b) Write FA tht recognizes the tokens defined by the following regulr

More information

Fall 2018 Midterm 2 November 15, 2018

Fall 2018 Midterm 2 November 15, 2018 Nme: 15-112 Fll 2018 Midterm 2 November 15, 2018 Andrew ID: Recittion Section: ˆ You my not use ny books, notes, extr pper, or electronic devices during this exm. There should be nothing on your desk or

More information

Scanner Termination. Multi Character Lookahead. to its physical end. Most parsers require an end of file token. Lex and Jlex automatically create an

Scanner Termination. Multi Character Lookahead. to its physical end. Most parsers require an end of file token. Lex and Jlex automatically create an Scnner Termintion A scnner reds input chrcters nd prtitions them into tokens. Wht hppens when the end of the input file is reched? It my be useful to crete n Eof pseudo-chrcter when this occurs. In Jv,

More information

! Smaller, simpler, subcomponent of program! Provides abstraction. n hide low-level details, give high-level structure

! Smaller, simpler, subcomponent of program! Provides abstraction. n hide low-level details, give high-level structure Function Chpte 1 Functions Oiginl slides fom Gegoy Byd, Noth Colin Stte Univesity Modified slides by Chis Wilcox, Colodo Stte Univesity! Smlle, simple, subcomponent of pogm! Povides bstction n hide lo-level

More information

Stained Glass Design. Teaching Goals:

Stained Glass Design. Teaching Goals: Stined Glss Design Time required 45-90 minutes Teching Gols: 1. Students pply grphic methods to design vrious shpes on the plne.. Students pply geometric trnsformtions of grphs of functions in order to

More information

vcloud Director Tenant Portal Guide vcloud Director 9.1

vcloud Director Tenant Portal Guide vcloud Director 9.1 vcloud Director Tennt Portl Guide vcloud Director 9.1 You cn find the most up-to-dte technicl documenttion on the VMwre website t: https://docs.vmwre.com/ If you hve comments bout this documenttion, submit

More information

VoIP for the Small Business

VoIP for the Small Business Reducing your telecommunictions costs Reserch firm IDC 1 hs estimted tht VoIP system cn reduce telephony-relted expenses by 30%. Voice over Internet Protocol (VoIP) hs become vible solution for even the

More information

Presentation Martin Randers

Presentation Martin Randers Presenttion Mrtin Rnders Outline Introduction Algorithms Implementtion nd experiments Memory consumption Summry Introduction Introduction Evolution of species cn e modelled in trees Trees consist of nodes

More information

OPERATION MANUAL. DIGIFORCE 9307 PROFINET Integration into TIA Portal

OPERATION MANUAL. DIGIFORCE 9307 PROFINET Integration into TIA Portal OPERATION MANUAL DIGIFORCE 9307 PROFINET Integrtion into TIA Portl Mnufcturer: 2018 burster präzisionsmesstechnik gmbh & co kg burster präzisionsmesstechnik gmbh & co kg Alle Rechte vorbehlten Tlstrße

More information

VoIP for the Small Business

VoIP for the Small Business Reducing your telecommunictions costs Reserch firm IDC 1 hs estimted tht VoIP system cn reduce telephony-relted expenses by 30%. Voice over Internet Protocol (VoIP) hs become vible solution for even the

More information

5 Regular 4-Sided Composition

5 Regular 4-Sided Composition Xilinx-Lv User Guide 5 Regulr 4-Sided Composition This tutoril shows how regulr circuits with 4-sided elements cn be described in Lv. The type of regulr circuits tht re discussed in this tutoril re those

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

Improper Integrals. October 4, 2017

Improper Integrals. October 4, 2017 Improper Integrls October 4, 7 Introduction We hve seen how to clculte definite integrl when the it is rel number. However, there re times when we re interested to compute the integrl sy for emple 3. Here

More information

Slides for Data Mining by I. H. Witten and E. Frank

Slides for Data Mining by I. H. Witten and E. Frank Slides for Dt Mining y I. H. Witten nd E. Frnk Simplicity first Simple lgorithms often work very well! There re mny kinds of simple structure, eg: One ttriute does ll the work All ttriutes contriute eqully

More information

Scope, Functions, and Storage Management

Scope, Functions, and Storage Management Scope, Functions, nd Storge Mngement Block-structured lnguges nd stck storge In-le Blocks (previous set of overheds) ctivtion records storge for locl, glol vriles First-order functions (previous set of

More information

VoIP for the Small Business

VoIP for the Small Business VoIP for the Smll Business Reducing your telecommunictions costs Reserch firm IDC 1 hs estimted tht VoIP system cn reduce telephony-relted expenses by 30%. Voice over Internet Protocol (VoIP) hs become

More information

Today. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search

Today. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search Uninformed Serch [These slides were creted by Dn Klein nd Pieter Abbeel for CS188 Intro to AI t UC Berkeley. All CS188 mterils re vilble t http://i.berkeley.edu.] Tody Serch Problems Uninformed Serch Methods

More information

Fig.1. Let a source of monochromatic light be incident on a slit of finite width a, as shown in Fig. 1.

Fig.1. Let a source of monochromatic light be incident on a slit of finite width a, as shown in Fig. 1. Answer on Question #5692, Physics, Optics Stte slient fetures of single slit Frunhofer diffrction pttern. The slit is verticl nd illuminted by point source. Also, obtin n expression for intensity distribution

More information

VoIP for the Small Business

VoIP for the Small Business Reducing your telecommunictions costs Reserch firm IDC 1 hs estimted tht VoIP system cn reduce telephony-relted expenses by 30%. Voice over Internet Protocol (VoIP) hs become vible solution for even the

More information

50 AMC LECTURES Lecture 2 Analytic Geometry Distance and Lines. can be calculated by the following formula:

50 AMC LECTURES Lecture 2 Analytic Geometry Distance and Lines. can be calculated by the following formula: 5 AMC LECTURES Lecture Anlytic Geometry Distnce nd Lines BASIC KNOWLEDGE. Distnce formul The distnce (d) between two points P ( x, y) nd P ( x, y) cn be clculted by the following formul: d ( x y () x )

More information

520 Principles of Programming Languages. Memory Management. Memory Management... 35: Garbage Collection

520 Principles of Programming Languages. Memory Management. Memory Management... 35: Garbage Collection Dynmic Memory Mngement 50 Principles of Progrmming Lnguges 35: Grbge Collection Christin Collberg collberg@cs.rizon.edu Deprtment of Computer Science University of Arizon The run-time system linked in

More information

CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona

CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona CSc 453 Compilers nd Systems Softwre 4 : Lexicl Anlysis II Deprtment of Computer Science University of Arizon collerg@gmil.com Copyright c 2009 Christin Collerg Implementing Automt NFAs nd DFAs cn e hrd-coded

More information