Start to switch to Moose
[scpubgit/stemmatology.git] / lib / Text / Tradition / Collation.pm
1 #!/usr/bin/env perl
2
3 package Text::Tradition::Collation;
4 use Moose;
5
6 has 'graph' => (
7                 is => 'ro',
8                 isa => 'Text::Tradition::Graph',
9                 );
10
11 # The graph is full of nodes, which have positions and equivalences.
12 # These have to be stored externally to the graph itself.
13 has 'positions' => (
14                     is => 'ro';
15                     isa => 'Text::Tradition::Graph::Position',
16                     );
17
18 has 'equivalences' => (
19                        is => 'rw';
20                        isa => 'Text::Tradition::Graph::Equivalence',
21                        );
22
23 # We need a way to access the parent object.
24 has 'tradition' => (
25                     is => 'ro',
26                     isa => 'Text::Tradition',
27                     );
28
29 # The collation can be created two ways:
30 # 1. Collate a set of witnesses (with CollateX I guess) and process
31 #    the results as in 2.
32 # 2. Read a pre-prepared collation in one of a variety of formats,
33 #    and make the graph from that.
34
35 # The graph itself will (for now) be immutable, and the positions
36 # within the graph will also be immutable.  We need to calculate those
37 # positions upon graph construction.  The equivalences between graph
38 # nodes will be mutable, entirely determined by the user (or possibly
39 # by some semantic pre-processing provided by the user.)  So the
40 # constructor should just make an empty equivalences object.  The
41 # constructor will also need to make the witness objects, if we didn't
42 # come through option 1.
43
44 no Moose;
45 __PACKAGE__->meta->make_immutable;