Switches

There are two types of switch. PatternSwitches and OptionsSwitches.

Without switches, it would be necessary to specify new configuration parts for every project specific pattern and every combination of display options.

The switches are given values as a DiagramStyle or TypeSelector is chosen.

Example

For example, you may wish to create a diagram style which highlights every class written by programmer Wilma.

TypeSelector wilmaClasses description "All classes authored by Wilma" {
  classes javadoc tag "@author" & javadoc value "Wilma" ;
}

DiagramStyle highlightWilmaClasses description "Highlights all classes authored by Wilma" extends defaultDiagramStyle {
 
displays types in wilmaClasses using purpleTypeDisplayStyle ;
}

This will work; however you will need to make changes to the configuration each time you wish to highlight a different author's work. A more flexible approach is to use a pattern switch in the type selector.

PatternSwitch authorPattern prompt "@author pattern" ;

TypeSelector authorSwitchedClasses description "All classes with author matching switch authorPattern" {
  classes javadoc tag "@author" & javadoc value authorPattern ;
}