80 likes | 249 Views
Some here are primitive data types. Characterize data into different kinds for convenience. bit byte integer ascii character array string real record. objects. + operations. Abstraction primitive date types are already abstracted from bits 0/1.
E N D
Some here are primitive data types • Characterize data into different kinds for convenience • bit • byte • integer • ascii • character • array • string • real • record objects + operations IT 179
Abstraction primitive date types are already abstracted from bits 0/1 • A tool (concept) to manage complexity • Hide irrelevant details; focus on the features needed • Examples • Integer addition • File deletion using icons • The brakes on a car • Television remotes IT 179
Data Type (how to view it) • Specification View of a data type • Data values • Operations defined on those values • Abstract Data Type (ADT) –use of abstraction! • Implementation View of a data type • Language-specific representation for the values • Implementation of the operations Implementation of an ADT IT 179
Abstract Data Type (ADT) Abstract model of Priority Queues (Specification View) insert one item Priority Queue Get the one with the highest priority the minimum one (or maximum) a black box IT 179
Abstract Data Type (ADT) Abstract model of Priority Queues (Implementation View) insert one item Binary Search Tree or Binary Heap? Get the one with the highest priority the minimum one (or maximum) IT 179
What do we want/need to do on arrays? int[] A; double[] B; IT 179
Add an element Remove an element Replace an element Retrieve an element Determine if a collection contains an element Get the collection’s size Determine if a collection is empty Traverse a collection Determine if two collections are equal Clone a collection Serialize a collection Typical Collection Operations Most collections support the same operations, but may give them different names. IT 179
Collection Queue List {interface} {interface} {interface} RandomAccess AbstractList {interface} {abstract} The Java Collections Framework (JCF) UML Class Diagram ArrayList Vector AbstractSequentialList {abstract} Java Provides a List interface for several implementations Stack LinkedList IT 179