Info

14 //query methods

15 public boolean isMature() {

16 return getPhenologicalPhase().eqals(!,maturityn);

18 public boolean isPostPlanting() {

19 return weather.getDayOfYear()> getPlantingDate();

Figure 3-18. Java comments represent UML stereotypes.

Line 6 is a comment in Java that shows the stereotype defined in Figure 317. Lines 7 through 12 define Java methods that belong to the category initializations. Lines 15 through 20 define methods belonging to the category query. In Figure 3-17, each operation definition includes its stereotype, whereas Figure 3-18 defines a stereotype for the entire group of methods that belong to this stereotype. In Java, methods that belong to a stereotype follow the stereotype definition.

Chapter 4 RELATIONSHIPS

As previously mentioned in this book, the main feature that distinguishes object-oriented from other programming paradigms is the fact that functionality is carried out by dialog between objects. Objects are provided with behavior that defines the role of each object. Communication between objects is realized through messages they send to each other. In UML, the ways in which things can connect to each other, either logically or physically, are modeled as relationships [BRJ99].

There are three types of relationships in UML: Associations, generalizations, and dependencies. Relationships are graphically represented with lines; each type of line represents a particular type of relationship.

0 0

Post a comment