Appendix D. Example Implementation

This appendix provides an example of the implementation of OCL expressions as explained in Chapter 4. The class CustomerCard, together with all OCL expressions given as examples in this book, is implemented by the following Java code:

 package royalAndLoyal; import java.util.HashSet; import java.util.Iterator; import java.util.Set; public class CustomerCard /**************************************************************** * Attributes, and their get and set operations * ****************************************************************/ boolean valid = true; // implements initial value // definition from page 24 Date validFrom; Date goodThru; Color color; public void setValid(boolean v) { valid = v; } public boolean ...

Get Object Constraint Language, The: Getting Your Models Ready for MDA, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.