1. Scala 2. Traffic DSL in Scala 3. Comparison AToM3 4. Conclusion & Future work.

Slides:



Advertisements
Similar presentations
1 Applets Programming Enabling Application Delivery Via the Web.
Advertisements

Java Language Quick-Reference Guide B. Oracle10g: Java Programming B - 2 Console Output Java applications and applets can output simple messages to the.
JAVA Revision Lecture Electronic Voting System Marina De Vos.
Verification of DSMLs Using Graph Transformation: A Case Study with Alloy Zekai Demirezen 1, Marjan Mernik 1,2, Jeff Gray 1, Barrett Bryant 1 1 Department.
C Language.
Based on Java Software Development, 5th Ed. By Lewis &Loftus
Lecture 04 – Classes.  Python has a number of classes built-in  lists, dictionaries, sets, int, float, boolean, strings  We can define our own classes.
Java Applets:. How Applets differ from application?: They do not use main method but init(), start() and paint() methods of the applet class They can.
ITEC 352 Lecture 13 ISA(4).
The Line Class Suppose you are involved in the development of a large mathematical application, and this application needs an object to represent a Line.
CSCI 160 Midterm Review Rasanjalee DM.
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
Winter Compiler Construction T7 – semantic analysis part II type-checking Mooly Sagiv and Roman Manevich School of Computer Science Tel-Aviv.
Written by: Dr. JJ Shepherd
Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
What is UML? A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a.
1 Chapter 2 Introductory Programs. 2 Getting started To create and run a Java program –Create a text file with a.java extension for the source code. For.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
1 Gentle Introduction to Programming Session 5: Memory Model, Object Oriented Programming.
Programming in Scala Chapter 1. Scala: both object-oriented and functional Scala blends –object-oriented and –functional programming in a –statically.
Chapter 10 Classes Continued
1 CMSC 132: Object-Oriented Programming II Java Constructs Department of Computer Science University of Maryland, College Park.
Exploring a Model-Oriented and Executable Syntax for UML Attributes SERA 2013SERA 2013 (August 7, 2013 in Prague, Czech Republic) Omar Badreddin, Andrew.
Unit 5 School of Information Systems & Technology1 School of Information Systems and Technology (IST)
Programming Languages and Paradigms Object-Oriented Programming.
10-Sep-15 Classes. Classes and objects Scala is an Object-Oriented (O-O), functional language Object-Oriented (O-O) means it’s built around “objects”
Introduction to Python
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
Java Classes Using Java Classes Introduction to UML.
Institute for Software Integrated Systems Vanderbilt University Copyright © Vanderbilt University/ISIS 2008 Model Interpreters Janos Mathe based on Peter.
Validated Model Transformation Tihamér Levendovszky Budapest University of Technology and Economics Department of Automation and Applied Informatics Applied.
Programming Languages and Paradigms Object-Oriented Programming.
Miscellaneous Terms. Math Notations Infix notation: Prefix notation: Postfix notation: Infix notation: 3*(6-4) Prefix notation: * -
Generic API Test tool By Moshe Sapir Almog Masika.
- Neeraj Chandra.  It’s language written by by Martin Odersky at EPFL  It’s language written by by Martin Odersky at EPFL (École Polytechnique Fédérale.
Applications Development
Automata Based Method for Domain Specific Languages Definition Ulyana Tikhonova PhD student at St. Petersburg State Politechnical University, supervised.
CSE 341, S. Tanimoto Java brief review - 1 Java Brief Review Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance.
Overview The Basics – Python classes and objects Procedural vs OO Programming Entity modelling Operations / methods Program flow OOP Concepts and user-defined.
1 Programming for Engineers in Python Autumn Lecture 6: More Object Oriented Programming.
Python Primer 1: Types and Operators © 2013 Goodrich, Tamassia, Goldwasser1Python Primer.
Algorithms Java Methods A & AB Object-Oriented Programming and Data Structures Maria Litvin ● Gary Litvin Copyright © 2006 by Maria Litvin, Gary Litvin,
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Topic 8Classes, Objects and Methods 1 Topic 8 l Class and Method Definitions l Information Hiding and Encapsulation l Objects and Reference Classes, Objects,
21. PHP Classes To define a class, use the keyword class followed by the name and a block with the properties and method definitions Properties are declared.
Monday, Jan 27, 2003Kate Gregory with material from Deitel and Deitel Week 4 Questions from Last Week Hand in Lab 2 Classes.
Strings Robin Burke IT 130. Outline Objects Strings methods properties Basic methods Form validation.
DEVS modeling of Traffic in AToM3 Presented by Ximeng Sun April 11, 2005.
Georgia Institute of Technology More on Creating Classes Barb Ericson Georgia Institute of Technology June 2006.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Programming With Java ICS201 University Of Ha’il1 ICS 201 Introduction to Computer Science Inheritance.
UNIT-IV Designing Classes – Access Layer ‐ Object Storage ‐ Object Interoperability.
Key Words / Reserved Words
>> Introduction to JavaScript
Dynamic structure modelling for Causal Block Diagrams
Data Structures and Algorithms revision
Introduction to Python
Interface, Subclass, and Abstract Class Review
Graph-Based Operational Semantics
Programming Language Concepts (CIS 635)
Compiler Design 18. Object Oriented Semantic Analysis (Symbol Tables, Type Checking) Kanat Bolazar March 30, 2010.
An Introduction to Java – Part I, language basics
Python Primer 1: Types and Operators
Presentation transcript:

1. Scala 2. Traffic DSL in Scala 3. Comparison AToM3 4. Conclusion & Future work

 “scalable language”  grow with the demands of its users  Runs on the standard Java platform  Interoperates with all Java libraries  Scala = OO + functional programming Eg. List(1, 2, 3, 4, 5) map { _ * 2 } => List[Int] = List(2, 4, 6, 8, 10)

 Concrete syntax  Abstract syntax val r1 = new Road(5 m) val r2 = new Road("e17") val r3 = new Road(10 km, "a12" ) val r4 = new Road() r1 > r2 > r3 > r4 class Road extends InOutSegment { var in: Segment = null var out: Segment = null [..] }

 Multiple constructors class Road() extends InOutSegment { TrafficSim.+(this) var length: Int = Default.roadlength var name: String = NextName.road [..] def this (l : Int, n : String = NextName.road) = { this() length = l name = n } def this(n: String) = { this() name = n } [..] }

 Infix Operator Notation r1 > r2 > r3 r1.>(r2).>(r3) r1.>(r2) r2.>(r3)

 Implicit Conversion ◦ Integer doesn’t have km() method! ◦ Implicit conversion: Int => Measure val r1 = new Road(5 km) 5.km() protected case class Measure(val amount: Int){ def km: Int = amount*1000 def m: Int = amount } Measure(5).km() => 5000 meters implicit def int2Measure(i: Int) = new Measure(i)

 Concrete syntax // create roads val r1 = new Road() val r2 = new Road() val bigRoad = new Road() //merge (r1,r2) > bigRoad //split bigRoad > (r1,r2)

 Implicit Conversion (r1,r2).>(bigRoad) Tuple2[Road, Road] doesn’t have >(r : Road) method! implicit def tuple2DualRoad(t: Tuple2[Road, Road]) = new DualRoad(t._1, t._2)

 Concrete syntax  Create own cars! val e313 = new Road() // add Tractor to the road e313 new Car("Tractor") at e313 // add Ferrari to the road e313 with speed = 180kmh new Car(180 kmh,"Ferrari") at e313 // add car with default parameters to e313 new Car() at e313 class LeftCar(s: Int, name : String) extends Car(s,name){ override def getDirection(left : Road, right : Road): Direction = Left }

 Multiple constructors class Car(val speed: Int = Default.speed, val name: String = NextName.car) { def this(n: String) = this(Default.speed, n) [..] def at(r: Road) {.. } def getDirection(left: Road, right: Road): Direction = { if (Random.nextBoolean) { return Left } else { return Right }

 Generator & Sink //generate 6 cars and each car has a tracker new Generator(6,true) > e313 > new Sink() //generate 11 cars, speed of car = 6kmh and name = jos new Generator(11,false,6 kmh, "jos") > new Road() > new Sink(“hey“)  Capacity val c = new Capacity(4) val r1 = new Road() + c val r2 = new Road() + c

// define a trafficlightcontrol that starts on Green val tlc = new TrafficLightControl(Green) new Road() + TrafficLight(tlc) // trafficlight with opposite = true // this means the trafficlight will start red new Road() + TrafficLight(tlc,true)

 A road/car can have tracker  Save all events of that car/road during a simulation in a xml file ◦ Event: eg. when a car enters a new road.  The generated XML could be loaded in the DEVS Trace Plotter

new Car + Tracker() new Road + Tracker()

 Abstract Syntax ◦ AToM3: Class Diagram Formalism  Create classes (actions (python), constraints (python), attributes)  Create associations (multiplicities)  Inherit from other classes ◦ Scala Language  Create classes (methods, exceptions, attributes)  Associations as class attributes  Inherit from other classes + traits

 Concrete Syntax ◦ AToM3: Class Diagram Formalism  Instances of classes => graphical  Load multiple formalisms ◦ Scala Language  Instances of classes => textual  More freedom:  Write scala code in internal DSL or interop with Java

 Operational Semantics ◦ AToM3: Class Diagram Formalism  Coded model transformation  Rule-based model transformation  View the simulation step by step (moving cars,..) ◦ Scala Language  Just execute the code  Output = textual  Make a Scala or Java package -> to visualize traffic ->.. do sth else with data

◦ AToM3: Class Diagram Formalism  Good overview  Better for modelling traffic ◦ Scala  More freedom  Useful if you want to do something with the data  Interop with Java or Scala code ◦ Future work: Scala also supports external DSLs