Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

ADVANCED CLASS MODELING, STATE MODELING

UNIT 2 ADVANCED CLASS MODELING, STATE MODELING

Topics:
Advanced object and class concepts, Asoociation ends, N-ary association
Aggregation, Abstract classes, Multiple inheritance, Metadata
Reification, Constraints, Derived data, Packages
State Modeling: Events, States, Transitions and Conditions;
State diagrams; State diagram behavior; Practical tips.

Define the following terms, with an example:-------8M


a. Enumeration
b. Association ends
c. Aggregation
d. Abstract classes

Advanced object and class concepts


Enumerations
A data type is a description of values, includes numbers, strings, enumerations.
Enumerations: A Data type that has a finite set of values.
In the UML an enumeration is a data type.
We can declare an enumeration by listing the keyword enumeration in guillemets (<< >>) above the
enumeration name in the top section of a box.
The second section lists the enumeration values.

Multiplicity (multiplicity for attributes)

Multiplicity is a constraint on the cardinality of a set, multiplicity also applied to attributes.

Multiplicity for an attribute specifies the number of possible values for each instantiation of an attribute.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 1


ADVANCED CLASS MODELING, STATE MODELING
attribute is mandatory single value ( [1] )
optional single value [0..1]
many [*]

Multiplicity also indicates whether an attribute is single valued or can be a collection.

Fig: multiplicity for attributes

A person has one name, one or more addresses, zero or more phone numbers, and one birthdate.

Scope
Scope indicates if a feature (attribute & operation) applies to an object or a class.
An underline distinguishes feature with class scope (static) from those with object scope.
Our convention is to list attributes and operations with class scope at the top of the attribute and operation
boxes, respectively. But it is not encouraged model.

Fig: attribute scope


Preferred model is to create new instances of a class and define attributes & operations of class scope as
shown in the figure.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 2


ADVANCED CLASS MODELING, STATE MODELING
Visibility
Visibility refers to the ability of a method to reference a feature from another class and has the
possible values of public, protected & private.
Public : Any element that can access the class can access any of its features with public visibility
Private : Only operations within the class can access features with private visibility
Protected : Only operations within the class, or within children of the class, can access features
with protected visibility
Package : Methods of classes defined in the same package as the target class can access.
The UML denotes visibility with a prefix
+ public
- private
# protected
~ package
Several issues to consider when choosing visibility are
1. Comprehension: understand all public features to understand the capabilities of a class.
2. Extensibility: many classes can depend on public methods, so it can be highly disruptive to change
their signature. Since fewer classes depend on private, protected, and package methods, there is
more latitude to change them.
3. Context: private, protected, and package methods may rely on preconditions or state information
created by other methods in the class. Applied out of context, a private method may calculate
incorrect results or cause the object to fail.

Association ends
What is an association end? What are the properties of an association end?-----------6/8M

Association End is an end of association.


A binary association has 2 ends; a ternary association has 3 ends.
Properties of Association Ends:
1. Association end name: an Association end may have name. They can also distinguish multiple
associations between a pair of classes.
2. Multiplicity: You can specify multiplicity for each Association end. UML specifies multiplicity
with an interval, such as 1 (exactly one). 1..(one or more). 3..5(three to five, inclusive). * (
many, i.e zero or more).

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 3


ADVANCED CLASS MODELING, STATE MODELING
3. Ordering: Sometimes, the objects on a many association end can be given explicit order.
Ordering is an inherent part of association. You can indicate an ordered set of objects by writing
{ordered} next to the appropriate association end.
4. Bags and sequences: the objects for a many association end can also be a bad or sequence. A bag is
a collection of elements with duplicates allowed. A sequence is an ordered collection of elements
with duplicates allowed.
5. Qualification: Qualified Association is an association in which an attribute called the qualifier
disambiguates the objects for a many association ends.

Additional Properties of Association Ends:


6. Aggregation
7. Changeability: specifies update status of an Association end. The possibilities are changeable
(can be updated) or readonly (only initialized).
8. Navigability: Association may be traversed in either direction. The UML shows navigability with
the arrowhead on the association end attached to the target class.
9. Visibility: association end may have visibility public, protected, private or package.

N-ary Association
An N-ary association is association among 3 or more classes.
But we should try to avoid n-ary associations- most of them can be decomposed into binary
associations, with possible qualifiers and attributes.
The UML symbol for n-ary associations is a diamond with lines connecting to related
classes.
If the association has a name, it is written in italics next to the diamond.

Fig1: Ternary association and links

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 4


ADVANCED CLASS MODELING, STATE MODELING
Figure 1 above shows n-ary association: Programmers use computer languages on projects. This n-ary
association is an atomic unit and cannot be subdivided into binary associations without losing information.

Fig2: Ternary association

Figure 2 above shows ternary association: A professor teaches a listed course during a semester. The
resulting delivered course has a room number and any number of textbooks. In n-ary association there is
atmost one link for each combination of Professor,Semester, and ListedCourse & there is one
DeliveredCourse.

Fig3: promoting an n-ary association


Figure 3 above shows how an n-ary association is promoted to classes. When promoting classes we should
not change the meaning of the model.
Promoted class can have any number of links for each combination of Professor, Semester, and
ListedCourse & there can be many DeliveredCourse.

Aggregation
What is aggregation and composition? Give their respective UML notations, with an example.----------------
--10M

Explain association & aggregation, with examples.------------------------------10M

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 5


ADVANCED CLASS MODELING, STATE MODELING
Aggregation is a strong form of association in which an aggregate object is made of constituent parts.
Constituents are the parts of aggregate.
Aggregation is drawn like association, except a small (hollow) diamond indicates the assembly end.

In figure above, A LawnMover consists of a Blade, an Engine, many Wheels and a Deck. Here
LawnMover is assembly and other parts are called constituents.

The most significant property of aggregation is :


transitivity (if A is part of B and B is part of C, then A is part of C)
antisymmetric (if A is part of B then B is not part of A)

Aggregation versus Association


Aggregation is a special form of association
In aggregation: two objects are tightly bound by a part-whole relationship.
In association: two objects are usually considered as independent, even though they may often be linked.

Aggregation versus Composition


The UML has 2 forms of part-whole relationships:
1. a general form called Aggregation
2. a more restrictive form called composition.
Composition is a form of aggregation with two additional constraints.
1. A constitute part can belong to at most one assembly.
2. Once a constitute part has been assigned an assembly, it has a coincident lifetime with the
assembly.
Deletion of an assembly object triggers deletion of all constituent objects.
Notation for composition is a small solid diamond next to the assembly class.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 6


ADVANCED CLASS MODELING, STATE MODELING

Propagation of Operations
Propagation (triggering) is the automatic application of an operation to a network of objects when the
operation is applied to some starting object.
A person owns multiple documents
each document consists of paragraphs
paragraphs consists of characters.
The copy operation propagates from documents to paragraphs to characters.
The copy operation does not propagate in the reverse direction.
A small arrow indicating the direction and operation name is written next to the affected association.

Abstract Classes
Abstract class is a class that has no direct instances but whose descendant classes have direct instances.

Fig: Abstract class & Abstract operation

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 7


ADVANCED CLASS MODELING, STATE MODELING
In UML notation an abstract class name or abstract operation is listed in italic (or place the keyword
{abstract} below or after the name).
ComputePay is an abstract operation of a abstract class Employee; its implementation is not defined.
Each subclass must supply a method for this operation.

A concert class has direct instances.


Only concrete classes may be leaf classes in an inheritance tree.

Fig: concrete class

Fig: Concrete superclasses must be avoided. One way to eliminate concrete superclasses is to introduce
other subclass as shown below.

Multiple Inheritance
Multiple inheritance allows a class to have more than one superclass and to inherit features from all parent
classes.
The advantage of multiple inheritance is
greater power in specifying classes by extending the base class
an increased opportunity for reuse
Disadvantage:
loss of conceptual and implementation simplicity.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 8


ADVANCED CLASS MODELING, STATE MODELING

Kinds of Multiple Inheritance


Multiple inheritance can be of two types:
1. From disjoint classes
2. From overlapping classes

1) Multiple inheritance from disjoint classes


The most common form of multiple inheritance is from sets of disjoint classes. Each subclass inherits from
one class in each set.
FullTImeIndividualContributor is both FullTimeEmployee and IndividualContributor and combine
their features.
FullTimeEmployee and PartTimeEmployee are disjoint ie. Each employee must exactly belong to
one of these.
Manager and IndividualContributor are disjoint, i.e. . Each employee must exactly belong to one of
these.
FullTImeIndividualContributor inherits Employee features along two paths, via employmentStatus
and managerialStatus. But FullTImeIndividualContributor has only one single copy of Employee
features.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 9


ADVANCED CLASS MODELING, STATE MODELING
2) Multiple inheritance from overlapping classes

AmphibiousVehicle is both LandVehicle and WaterVehicle.


LandVehicle and WaterVehicle overlap because some vehicles can travel both on water and land.
The UML uses a constraint to indicate an overlapping generalization set; the notation is a dotted line
cutting across the affected generalization with keywords in braces.
Here overlapping means that an individual vehicle may belong to more than one of the subclasses.
Incomplete means that all possible subclasses of vehicle may not have been explicitly named.

With respect to multiple inheritance, briefly discuss about ------------------6M


e. Multiple classification
f. Metadata

Multiple Classification
An instance of a class is inherently an instance of all ancestors of the class.
For example, an instructor could be both faculty and student. One instance happens to participate in two
overlapping classes.

With respect to multiple inheritance, briefly discuss about -------------6M

a. Multiple classification

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 10


ADVANCED CLASS MODELING, STATE MODELING
b. workarounds

List and explain the various restructuring techniques used with respect to workarounds-------10M

***Workarounds
Dealing with lack of multiple inheritance is really an implementation issue.
There are various restructuring techniques used with respective to workarounds:
1. Delegation using composition of parts (it uses delegation)
2. Inherit the most important class and delegate the rest (it uses delegation)
3. Nested generalization
Here first 2 approaches use delegation.
Delegation is an implementation mechanism by which an object forwards an operation to another object for
execution.
1. Delegation using composition of parts:
A superclass with multiple independent generalization as a composition in which each constituent
part replaces a generalization.
Inheritance of operations across the composition is not automatic.
The composite (employee) must catch operations and delegate them to the appropriate part.

Fig: Workaround for multiple inheritance --- Delegation


EmployeeEmployment is the superclass of FullTImeEmployee and PartTimeEmployee.
EmployeeManagement is the superclass of Manager and IndividualContributor. Employee is modeled as a
composition of EmployeeEmployment and EmployeeManagement. An operation such as ComputePay sent
to an Employee object would have to be redirected to the EmployeeEmployment component of the
Employee Class.

2. Inherit the most important class and delegate the rest:

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 11


ADVANCED CLASS MODELING, STATE MODELING
One of the subclass is made to inherit the most important superclass and the other subclass is
treated as a composition of the superclass and their operations are delegated to the subclasses.
This approach preserves identity and inheritance across the most important generalization.

3. Nested generalization:
This approach multiplies out all possible combinations.
This preserves inheritance but duplicates declarations and code and violets the spirit of OO
programming.

Issues to consider when choosing workaround approaches:


Superclasses of equal importance: if a subclass has several superclasses, all of equal importance,
it may be best to use delegation (Delegation using composition of parts) and preserve symmetry in
the model.
4. Dominant superclass: if one superclass clearly dominates and the others are less important,
preserve inheritance through this path. (Inherit the most important class and delegate the rest or
nested generalization).
Few subclasses: if the number of combinations is small, consider nested generalization. If the
number of combinations is large, avoid it.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 12


ADVANCED CLASS MODELING, STATE MODELING
Sequencing generalization sets: if we use generalization, factor on the most important criterion
first, the next most important second, and so forth.
Large quantities of code: try to avoid nested generalization if we must duplicate large quantities of
code.
Identity: consider the importance of maintaining strict identity. Only nested generalization
preserves this.

Metadata
Metadata is data that describes other data.
For example, a class definition is a metadata.
Models are inherently metadata
Many real-world applications have metadata, such as parts catalogs, blueprints, and dictionaries.

Figure above shows metadata and data. A Car model has a model name, year, base price and a
manufacturer.
Examples of Car Model: 1969, Ford Mustang & 1974, Volkswagen Rabbit.
A physical car has serial number, colour, options & owner.
Examples of physical Car: John owns blue Ford with serial number IFAJP and a red Volkswagen
with serial number 7E8IF.
A car model describes many physical cars and holds common data. Therefore, car model is metadata
relative to a physical car.

Reification
Define reification. Explain it with a diagram.------------------------6M
Reification is the promotion of something that is not an object into an object.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 13


ADVANCED CLASS MODELING, STATE MODELING
SubstanceName attribute of the class Substance is promoted as a class to capture the many-to-many
relationship between Substance and SubstanceName.
A chemical substance may have multiple aliases.
Ex: propylene may be referred to as propylene and C3H6 .
An alias may pertain to multiple chemical substances.
Ex: Antifreeze refers to ethylene glycol and automotive additives.

Constraints
What is a constraint with respect to a class modeling? Explain

a. Constraints on generalization sets


b. Constraints on links

Constraint is a condition involving model elements, such as objects, classes, attributes, links, associations,
and generalization sets.
A Constraint restricts the values that elements can assume.
1. Constraints on objects:

a. No employees salary can exceed the salary of the employees boss (a constraint
between two things at the same time.)
b. No Window can have the aspect ratio (length/width) of less than 0.8 or greater than
1.5(a constraint between attributes of a single object.)
c. The priority of the job may not increase(constraint on the same object over time)
2. Constraints on generalization sets

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 14


ADVANCED CLASS MODELING, STATE MODELING
The UML defines the following keywords for generalization sets:
a. Disjoint: The subclasses are mutually exclusive. Each object belongs to exactly one of the
subclasses.
b. Overlapping: The subclasses can share some objects. An object may belong to more than one
subclass.
c. Complete: The generalization lists all the possible subclasses.
d. Incomplete: The generalization may be missing some subclasses.

3. Constraints on Links
Multiplicity is a constraint on the cardinality of a set.
o Multiplicity for an association restricts the number of objects related to a given object.
o Multiplicity for an attribute specifies the number of values that are possible for each
instantiation of an attribute.
Qualification also constraints an association. A qualifier attribute disambiguates the objects for a
many association ends.
An association class implies a constraint. An association class is a class, it can have attribute
and operations, participate in associations, and participate in generalization.
The constraint {ordered} indicates that the elements of a many association end have an explicit
order that must be preserved.
Explicit constraint : The chair of a committee must be a member of the committee; the ChairOf
association is the subset of the MemberOf association.

Fig: subset constraint between associations.


4. Use of constraints

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 15


ADVANCED CLASS MODELING, STATE MODELING
A good class model captures many constraints through its structure.
The UML has two alternative notations for constraints;
o delimit a constraint with braces
o place it in a dog-earned comment box. We can use dashed lines to connect
constrained elements. A dashed arrow can connect a constrained element to the
element on which it depends.

Derived Data
A derived element is a function of one or more elements, which in turn may be derived.
Classes, associations, and attributes may be derived.
The notation for a derived element is a slash in front of the element name along with constraint that
determines the derivation.

In figure above Age attribute is derived from birthdate & Currentdate.

Derived object and association

The Person class is associated to the Department class


Department class is the part of Company class.
Therefore Person class is also associated with the Company class.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 16


ADVANCED CLASS MODELING, STATE MODELING
So we can derive WorksForCompany association from the association between Person and
Department class and the Company and Department class.

Packages
A package is a group of elements (classes, association, generalization, and lesser packages) with a
common theme.
A package partitions a model, making it easier to understand and manage.
Large applications may require several tiers of packages.
Packages form a tree with increasing abstraction toward the root, which is the application, the top-
level package.
Notation for pakage is a box with a tab.

Tips for devising packages


Carefully delineate (explain) each packages scope:
class and association names are unique within each package
Use consistent names across the packages.
Define each class in a single package: the defining package should show the class name, attributes
and operations.
Make packages cohesive (interrelated):
Associations and generalizations normally appear in a single package.
Classes can appear in multiple packages. Try to limit appearances of classes in multiple
packages.

Prepare a class diagram for a graphical document editor that supports grouping.
Assume that a document consists of several sheets. Each sheet contains drawing objects, including
text, geometrical objects and groups. A group is simply a set of drawing objects, possibly including
other groups. A group must also contain at least two drawing objects. A drawing object can be a
direct member of at most one group. Geometrical objects include circles, ellipses, rectangles, lines,
and squares.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 17


ADVANCED CLASS MODELING, STATE MODELING
Answer:

Chapter2: State Modelling

**What is an event? Explain different types of events with an example.----------10/7M

Events
An event is an occurrence at a point in time
Example: user depresses left button or Air Deccan flight departs from Bombay.
An event happens instantaneously with regard to time scale of an application. One event may logically
precede or follow another, or the two events may be unrelated.
Events include error conditions as well as normal conditions.
Three types of events:
1. signal event
2. change event
3. time event.

Signal Event
A signal is an explicit one-way transmission of information from one object to another.
An object sending a signal to another object may expect a reply, but the reply is a separate signal under the
control of the second object, which may or may not choose to send it.
A signal event is the event of sending or receiving a signal.
Divya, Asst. Professor, ISE dept., VCET, Puttur Page 18
ADVANCED CLASS MODELING, STATE MODELING

Signal can be grouped into signal classes and give each signal class a name to indicate common
structure and behavior.
The UML notation is the keyword signal in guillemets (<< >>) above the signal class name in the
top section.
The second section lists the signal attributes.

Change Event
A change event is an event that is caused by the satisfaction of a Boolean expression.
UML notation for a change event is keyword when followed by a parenthesized Boolean expression.

Time Event
Time event is an event caused by the occurrence of an absolute time or the elapse of a time interval.
1. UML notation for an absolute time is the keyword when followed by a parenthesized expression
involving time.
2. The notation for a time interval is the keyword after followed by a parenthesized expression that
evaluates to time duration.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 19


ADVANCED CLASS MODELING, STATE MODELING

States
A state is an abstraction of the values and links of an object.
UML notation for state- a rounded box containing an optional state name, list the state name in
boldface, center the name near the top of the box, capitalize the fist letter.

The objects in a class have a finite number of possible states.


Each object can be in one state at a time.
A state specifies the response of an object to input events.
It will remain in a state until an event occurs that causes it to change state.
Event vs. States

Event
represents points in time.
Eg: power turned on power turned off power turned on
State represents intervals of time.
Eg: Powered Not powered

Fig: characterizations of a state


Divya, Asst. Professor, ISE dept., VCET, Puttur Page 20
ADVANCED CLASS MODELING, STATE MODELING

Consider the state AlarmRinging.


The event sequence that leads to the state consists of setting the alarm, doing things that do not reset or
clear the alarm or waiting for the target time to occur.
The condition that characterizes the state(ringing state) are given as alarm=on , or
currenttime=targettime+20 seconds or no button has been pushed since the target time.
Finally the response to the stimuli shows the effect of event current time and button pushed, including the
response that occurs and the next state(normal state in this example)

Transitions & Conditions


A transition is an instantaneous change from one state to another.
The transition is said to fire upon the change from the source state to target state.
The origin and target of a transition usually are different states, but sometimes may be the same.
A transition fires when its events occurs.
A guard condition is a Boolean expression that must be true in order for a transition to occur.
UML notation for a transition is a line may include event label in italics followed by guard condition in
square brackets from the origin state to the target state an arrowhead points to the target state.
Guard condition Vs. change event
1. A guard condition is checked only once, at the time the event occurs, and the transition fires if the
condition is true.
2. Change event is checked continuously.

Fig: Guard condition in transition: Traffic example

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 21


ADVANCED CLASS MODELING, STATE MODELING

State Diagrams
Give general UML system for state diagram & explain. ---------------------------5M
Explain with a diagram, the basic UML syntax for state diagrams.---------------8M
Define state diagrams and state model. Draw the state diagram for telephone line with activities.--------------
--------8M

A state diagram is a graph whose nodes are states and whose directed arcs are transitions between states.
State names must be unique within the scope of a state diagram.
All objects in a class execute the state diagram for that class, which models their common behavior.
A state model consists of multiple state diagrams one state diagram for each class with important temporal
behavior.
State diagrams interact by passing events and through the side effects of guard conditions.
UML notation for a state diagram is a rectangle with its name in small pentagonal tag in the upper
left corner.
The constituent states and transitions lie within the rectangle.
If more than one transition leaves a state, then the first event to occur causes the corresponding
transition to fire.
If an event occurs and no transition matches it, then the event is ignored.
If more than one transition matches an event, only one transition will fire, but the choice is
nondeterministic.

What do you mean by states and events? Draw the state diagram for telephone line system.--------6M

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 22


ADVANCED CLASS MODELING, STATE MODELING

One shot state diagrams


State diagrams can represent continuous loops or one-shot life cycles
One shot state diagrams represent objects with finite lives and have initial and final states.
Initial state is entered on creation of an object
Entry of the final state implies destruction of the object.
Initial state is represented with a solid circle and final state is represented by the bulls eye.

An alternate notation is to indicate initial and final states through entry (hollow circle) and exit
points(circles enclosing an x) .

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 23


ADVANCED CLASS MODELING, STATE MODELING

State diagram Behaviour


1) Activity effects
An effect is a behavior executed in response to an event.
An activity is behavior that can be executed in response to an event.
Notation for activity: a slash / and the name of the activity, following the event that causes it.

Fig: Activities for pop-up menu


When the right-button is depressed, the menu is displayed; when the right button is released the menu is
erased.

2) Do-Activities:
A do-activity is an activity that continues for an extended time.
Do-activity can occur only within a state and cannot be attached to a transition.
Example : the warning light may flash during the paper jam state for a copier machine.

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 24


ADVANCED CLASS MODELING, STATE MODELING
The notation do/ denotes a do-activity that may be performed for all or part of the duration that
an object is in a state.
A do-activity may be interrupted by an event that is received during its execution.

3) Activities on transitions: are the activities that are bound to an event that causes a transition.

Figure shows the control of garage opener. The user generates the depress events with a push button to
open and close the door. The control generates motor up and motor down activities for the motor. The
motor generates door open and door close events when the motion(opening/closing) has completed.

4) Entry and Exit Activities:


These activities are bound to an entry to a state and exit from a state.
An entry activity is shown inside the state box following the keyword entry and a / character.
Whenever the state is entered, by any incoming transition, the entry activity is performed first.
An exit activity is shown inside the state box following the keyword exit and a / character.
Whenever the state is exited, by any outgoing transition, the exit activity is performed first.

5) Self-transition: is a transition in which the source and target states are the same.
self-transition causes both the entry and exit activities will be executed
event within a state will not cause the entry and exit activities to be executed.
Divya, Asst. Professor, ISE dept., VCET, Puttur Page 25
ADVANCED CLASS MODELING, STATE MODELING

6) Completion Transition:
Completion transitions are triggered upon completion of an activity in the source state.
They are indicated by an arrow without any event name or label on them.
It fires automatically upon the completion of the activity associated with the source state.

7) Sending signals:
An object can perform the activity of sending a signal to another object.
A system of objects interacts by exchanging signals.
The activity send target.S(attributes) sends signal S with the given attributes to the
target object or objects.
A signal can be directed towards an object or a set of objects.
Target refers to the class of the objects that are targets of the event

Phone line sends a Connect(phone number) signal to the switcher when a complete phone number
has been dialed.

If signal is directed towards a set of objects


then each of them receives a separate copy of the signal concurrently
each of them processes the signal and determines whether to fire a transition.
If an object can receive signals from more than one object, then the order in which concurrent
signals are received may affect the final state: race condition.

Explain state diagrams. Draw the state model for telephone line with activities.--------10M

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 26


ADVANCED CLASS MODELING, STATE MODELING

A simple digital watch has a display and two buttons to set it, the A button and the B button. The
watch has two modes of operation, display time and set time. In the display time mode, the watch
displays hours and minutes, separated by a flashing colon. The set time mode has two sub modes, set
hours and set minutes. The A button selects modes. Each time it is pressed, the mode advances in the
sequence: display, set hour, set minutes, display, etc. Within the sub modes, the B button advances
the hours or minutes once each time it is pressed. Buttons must be released before they can generate
another event. Prepare a State diagram of the watch.-------------------------10M
Answer:

Divya, Asst. Professor, ISE dept., VCET, Puttur Page 27

You might also like