Feature Diagrams

A feature diagram is a tree. Nodes are called features. Edges are containment relationships.  Nodes can be one of four types: AND, OR, XOR, and LEAF. Look at the Car feature diagram (a) below.  The notations for AND, OR, and XOR nodes are illustrated.  AND, OR, and XOR must have 2 or more children nodes.  LEAF nodes (obviously) have no children.

Remember: Given any parent node (feature), all of its children have OR connections to it, or XOR connections, or ANDmandatory/ANDoptional connections.  No other combinations of edges is allowed.


Here are three feature diagrams:

(a)

(b)

(b)

(c)


Your Assignment

  1. Draw a class diagram metamodel of your program where all three of the above models conform. In English, explain the constraints that you think are essential to validate.
  2. Write a Java program to implement your metamodel so that you can construct feature diagrams.  Your goal is that your code to create feature diagrams should be as elegant as possible.  For each diagram, define a method construct its tree.  Further, your program must have a method that validates a tree, and that after constructing each tree, you invoke this validation method.
  3. You must show the correspondence between your Java program and each of the above feature diagrams.  If your program is ugly, so too will be your class diagram.  May I suggest that you do NOT use methods or constructors that have set-valued arguments.
  4. Remember: clarity is important in this project (as defined subjectively by the Grader).
Hint: all of this should look familiar to you (as it should).  I give you the following hints:

What to Submit

A critical part of this assignment is for me to see that you see the connection between our prior work on models and your Java code. "Style" points will be given (or taken away) depending on how clean your code is.

A critical part of any design is clarity and understandability.   Hence, you will be graded on the clarity of your project and its ability to work correctly.  Sloppy code, documentation, or anything that makes grading or understanding your program difficult will cost you points!  Beware, some of these "beauty" points are subjective. 

No late assignments/submissions will be accepted.