Can the composite
pattern be used to support the following budget structure (a tree):
My GUI will allow the input of amounts. Each amount can be broken down into sub-amounts. Basically, the value stored in a node will be the sum of the amounts of its immediate children.
I see a difficulty arising because the tree has two types of leafs: horizontal amounts and vertical amounts. The sum of the horizontal amounts and the sum of the vertical amounts will both be equal to the amount of their common parent.
Reports will have to be produced grouping the horizontal and the vertical amounts. What is the proper approach to be able to distinguish these two types of leafs? Create two subclasses of Node?
Rich