ENG 06: Engineering Problem Solving with MATLAB – Lecture 16 notes

3 Pages
57 Views
Unlock Document

Department
Engineering
Course
ENG 6
Professor
Professor Rajeevan Amirtharajah
Semester
Spring

Description
ENG 06 – Lecture 16; 2/28/2013 Notes: Object Oriented Programming, Pattern Matching Object Oriented Programming  Structures and Objects o Structures relate data of different types o Objects also have functions related to the variable  How is an object oriented system structured? o Categorizations  Inheritance o Objects belonging to a narrow class can ‘inherit’ properties from a more general parent class o You can create a child class that inherits some of the properties of the parent class and modifies others’ o Example: cars  General properties:  Engine horsepower  Fuel efficiency  Dimensions  Also subcategories, have some diff. properties  Make(Toyota, Chevrolet, bmw, etc.) o Financing options o Warranty info o These properties are not shared with other makes  Model (camry, rav4, prius) o Properties that aren’t shared with other models of the same make o E.g. Replacement part numbers  Use your engineering judgment to decide how to divide these  Ball example: inheritance o More specific class that simulates bouncing ball with inelastic collisions o Add parameters that specify energy lost in each collision Pattern Matching/Regular Expressions  Analyze written text  Regular Expressions o String of characters that defines a certain pattern o Use to match a group of words/large text block o Provide a unique way to search a volume of text for a particular subset of characters within that text o Give you ability to look for certain pattern of characters, rather than looking for an exact character match like with strfind o Ex. string ‘Joh?n\w*’  Example of regular expression  Defines pattern that starts with Jo, followed by letter h, then followed by letter n, and ends with any number of word characters (indicated by \w*)  Matches any of the following: Jon, John, Jonathan, Johnny o 3 main functions  regexp  matches pattern  case sensitive  takes 2 arguments o 1. String in which you’re searching for matches o 2. The pattern (also a
More Less

Related notes for ENG 6

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit