Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
IS3C03
Abstract Data Type
Abstract Data Type
Abstract Data Type (ADT) is a useful tool for specifying
the logical properties of a data type.
A data type is a collection of values and a set of operations
on those values.
An abstract data type (ADT) is an object with a generic
description independent of implementation details.
This description includes a specification of the components
from which the object is made and also the behavioral
details of the object.
Cont . . .
ADT consists of two parts:
• A Value definition and
• An Operator definition.
Value definition defines the collection of values for the
ADT and consists of two parts:
• Definition clause
• Condition clause.
Example
/* Value definition */
abstract typedef <integer, integer> RATIONAL;
condition RATIONAL[1] <> 0;
/* Operator definition */
abstract RATIONAL makerational (a, b)
int a, b;
precondition b <> 0;
postcondition makerational [0] == a;
makerational [1] == b;