The Composite of Nested Arrays
Treat individual spells and combinations of spells uniformly.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Transmutation // Aggregation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MATLAB PATTERN //
classdef (Abstract) ArcaneComponent < handle
methods (Abstract)
power = calculatePower(obj)
end
end
classdef SingleRune < ArcaneComponent
properties
BasePower
end
methods
function obj = SingleRune(p)
obj.BasePower = p;
end
function power = calculatePower(obj)
power = obj.BasePower;
end
end
end
classdef RuneCluster < ArcaneComponent
properties
Children = []
end
methods
function add(obj, child)
obj.Children = [obj.Children, child];
end
function power = calculatePower(obj)
power = 0;
for i = 1:length(obj.Children)
power = power + obj.Children(i).calculatePower();
end
end
end
end
Composite
A single rune and a galaxy of runes are both just nodes in the grand fractal.
Runic Tags:
#composite
#runes
#arrays