1 A_Object I_Comparable App_B Klassehierarki I_Container A_Container I_Stack I_Queue I_Graph I_Tree I_SearchableContainer I_OrderedList I_SortedList I_HashTable.

Slides:



Advertisements
Similar presentations
12 Copyright © 2005, Oracle. All rights reserved. Structuring Code Using Abstract Classes and Interfaces.
Advertisements

Transparency No. 1 Java Collection API : Built-in Data Structures for Java.
Polymorphism. 3 Fundamental Properties of OO 1. Encapsulation 2. Polymorphism 3. Inheritance These are the 3 building blocks of object-oriented design.
Interfaces CSC 171 FALL 2004 LECTURE 14. Project 1 review public class Rational { private int numerator, denominator; public Rational(int numerator, int.
Chapter 6 The Collections API. Simple Container/ Iterator Simple Container Shape [] v = new Shape[10]; Simple Iterator For( int i=0 ; i< v.length ; i++)
Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
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.
Computer Science 209 Software Development Equality and Comparisons.
FEN KbP: Seminar 2/JML-Intro1 JML Introduktion Specifikation af en Personklasse.
AbstractClassesInterfacesPolymorphism1 Abstract Classes, Interfaces, Polymorphism Barb Ericson Georgia Tech April 2010.
Lecture 28: Abstract Classes & Inheritance Announcements & Review Lab 8 Due Thursday Image and color effects with 2D arrays Read: –Chapter 9 Cahoon & Davidson.
C8: Understanding Inheritance. Intuitive description Intuitive: FLORISTS are SHOPKEEPERS, inheriting various shopkeeper behaviors Tension in OOP languages:
Introduction to Design Patterns What is Design Pattern? The Container Pattern. The Visitor Pattern. The SearchableContainer Pattern. The Enumeration Pattern.
1 Hashing Techniques: Implementation Implementing Hash Functions Implementing Hash Tables Implementing Chained Hash Tables Implementing Open Hash Tables.
1 More on Inheritance Overview l Object: The father of all classes l Casting and Classes l Object Cloning l Importance of Cloning.
CS2200 Software Development Lecture: Object class A. O’Riordan, 2008.
JAVA Objects & The Comparable Interface The MyComparable Interface. The MyComparable Interface. The AbstractObject class. The AbstractObject class. Wrapper.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L15 (Chapter 22) Java Collections.
Inheritance and interfaces A class C1 is derived from class C2, then C1 is called subclass, and C2 is called superclass Superclass-parent, base class Subclass.
0 Abstract Syntax Tree (AST) Imperative Programming, B. Hirsbrunner, diuf.unifr.ch/pai/ip Each leaf represents an operand and each non leaf an operator.
Chapter 19 Java Data Structures
Data Structures Data structures permit the storage of related data for use in your program. –Arrays.
Chapter 11 Abstract Classes and Interfaces 1. Abstract method New modifier for class and method: abstract An abstract method has no body Compare: abstract.
Object Oriented Design and UML
CS2110: SW Development Methods Textbook readings: MSD, Chapter 8 (Sect. 8.1 and 8.2) But we won’t implement our own, so study the section on Java’s Map.
08 1 Abstract Data Types Problem Sets: PS2 due due Monday, Feburary 26 PS3 due Wednesday, March 7 Wellesley College CS230 Lecture 08 Monday, February 26.
Data Structures and Abstract Data Types "Get your data structures correct first, and the rest of the program will write itself." - David Jones.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 22 Java Collections.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 22 Java Collections.
1 Object-Oriented Software Engineering CS Interfaces Interfaces are contracts Contracts between software groups Defines how software interacts with.
Java Collections An Introduction to Abstract Data Types, Data Structures, and Algorithms David A Watt and Deryck F Brown © 2001, D.A. Watt and D.F. Brown.
Generalized Containers CSIS 3701: Advanced Object Oriented Programming.
Recitation 4 Abstract classes, Interfaces. A Little More Geometry! Abstract Classes Shape x ____ y ____ Triangle area() base____ height ____ Circle area()
Generic abstraction  Genericity  Generic classes  Generic procedures Programming Languages 3 © 2012 David A Watt, University of Glasgow.
The java.lang Package chapter 8 Java Certification Study Group February 2, 1998 Seth Ladd.
Chapter 18 Java Collections Framework
AP Computer Science A – Healdsburg High School 1 Interfaces, Abstract Classes and the DanceStudio - Similarities and Differences between Abstact Classes.
Computer Science 209 Software Development Java Collections.
1/20/03A2-1 CS494 Interfaces and Collection in Java.
15440 Distributed Systems Recitation 1 Objected-Oriented Java Programming.
Some Standard Classes Goals The Object class The String class Wrapper classes The Math class Random Numbers.
Abstract Classes and Interfaces Chapter 9 CSCI 1302.
Chapter 5 Objects and Classes Inheritance. Solution Assignments 3 & 4 Review in class…..
U n i v e r s i t y o f H a i l 1 ICS 202  2011 spring  Data Structures and Algorithms 
Inheritance Type/Subtype Relationship. Inheritance Idea: An object B of one type, termed child class, inherits from another object A of another type,
Introduction to Collections. Collections Collections provide a way of organizing related data in a model Different types of collections have different.
(c) University of Washington06-1 CSC 143 Java Inheritance Tidbits.
Java Programming Persistent Data Types. Persistent Data Structure A persistent data structure is a data structure having an internal state that never.
Interfaces, Abstract Classes, and Polymorphism. What Is an Interface? An interface is the set of public methods in a class Java provides the syntax for.
1 Chapter 8 Class Inheritance and Interfaces F Superclasses and Subclasses  Keywords: super F Overriding methods  The Object Class  Modifiers: protected,
Reference Types CSE301 University of Sunderland Harry R Erwin, PhD.
The Object class Object package java.lang Object clone equals hashCode toString aCopy toThis hash string ! yesOrNo.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
ISOM MIS 215 Module 1 – Ordered Lists. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
Lecture 5:Interfaces and Abstract Classes Michael Hsu CSULA.
Lecture 6:Interfaces and Abstract Classes Michael Hsu CSULA.
יסודות מדעי המחשב – תרגול 6
Adapter, Fascade, and More
Variables as Remote Control
Abstract Data Types and Java Classes
JAVA Collections Framework Set Interfaces & Implementations
null, true, and false are also reserved.
The Language Package.
Summary.
Sampath Kumar S Assistant Professor, SECE
Chapter 8 Class Inheritance and Interfaces
CS Fall 2012, Lab 11 Haohan Zhu.
Inheritance Lakshmish Ramaswamy.
Presentation transcript:

1 A_Object I_Comparable App_B Klassehierarki I_Container A_Container I_Stack I_Queue I_Graph I_Tree I_SearchableContainer I_OrderedList I_SortedList I_HashTable I_Set A_Graph A_Tree A_SearchableContainer I_SearchTree A_HashTable A_Set StackAsArrayStackAsLinkedList QueueAsArrayQueueAsLinkedList GraphAsMatrixGraphAsLists SetAsArray ChainedHashTable GeneralTree BinaryTreeBinarySearchTree OrderedListAsArrayOrderedListAsLinkedList SortedListAsArraySortedListAsLinkedList Wrappers

2 Arv-Klassehierarki Object X X Enhver Java-klasse X (inkludert array’er) vil alltid være arvet (direkte eller indirekte) fra en klasse kalt Object. Object A A X X

3 Klassen Object Litt av innholdet i klassen Object: public class Object { public final Class getClass ( );// return classname public String toString ( ); public boolean equals (Object obj);// equal if ref to the same object public int hashCode ( ); … }

4 Arv - Klassehierarki-diagram Concrete classAbstract class Interface extends Interface extends Interface implements Interface implements Concrete class Abstract class Concrete class extends Concrete class

5 A_Object I_Comparable Klassehierarki I_Container A_Container I_Stack I_Queue I_Graph I_Tree I_SearchableContainer I_OrderedList I_SortedList I_HashTable I_Set A_Graph A_Tree A_SearchableContainer I_SearchTree A_HashTable A_Set StackAsArrayStackAsLinkedList QueueAsArrayQueueAsLinkedList GraphAsMatrixGraphAsLists SetAsArray ChainedHashTable GeneralTree BinaryTreeBinarySearchTree OrderedListAsArrayOrderedListAsLinkedList SortedListAsArraySortedListAsLinkedList Wrappers

6 Interface I_Comparable Interface I_Comparable som inneholder sammenligningsmetoder:

7 Abstract A_Object som implementerer I_Comparable

8 Abstract A_Object Implementering av compare og innføring av abstract compareTo

9 Implementering av clone Abstract A_Object

10 IntA_Object I_Comparable Wrappers Dbl Chr Str

11 Int

12 Dbl

13 Chr

14 Str

15 Interface I_Comparable Interface I_Comparable som inneholder sammenligningsmetoder:

16 ENDEND