stop saving duplicate path arrays in witnesses; get rid of relationship
[scpubgit/stemmatology.git] / lib / Text / Tradition / Collation / Relationship.pm
CommitLineData
d047cd52 1package Text::Tradition::Collation::Relationship;
2
3use Moose;
4use Moose::Util::TypeConstraints;
3265b0ce 5## CAREFUL in our use of Moose::Util::TypeConstraints. That 'from'
6## clashes with Graph::Easy::Edge 'from', so we'll need to unimport
7## TypeConstraints after defining the types. Or else we would have to
8## finally split out our types into another module.
9use MooseX::NonMoose;
d047cd52 10
3265b0ce 11extends 'Graph::Easy::Edge';
d047cd52 12
ef9d481f 13enum 'RelationshipType' => qw( spelling orthographic grammatical repetition lexical );
3265b0ce 14
3265b0ce 15no Moose::Util::TypeConstraints; ## see comment above
16
4cdd82f1 17has 'type' => (
d047cd52 18 is => 'rw',
19 isa => 'RelationshipType',
20 required => 1,
21);
22
d047cd52 23has 'global' => (
24 is => 'rw',
25 isa => 'Bool',
3265b0ce 26 default => 0,
d047cd52 27);
28
b15511bf 29has 'non_correctable' => (
30 is => 'rw',
31 isa => 'Bool',
32 );
33
34has 'non_independent' => (
35 is => 'rw',
36 isa => 'Bool',
37 );
910a0a6d 38
39has 'equal_rank' => (
40 is => 'rw',
41 isa => 'Bool',
42 );
b15511bf 43
3265b0ce 44sub FOREIGNBUILDARGS {
45 my $class = shift;
46 my %args = @_;
47
4cdd82f1 48 # Make the label match our 'type' attribute.
3265b0ce 49 my @superclass_args;
4cdd82f1 50 if( exists $args{'type'} ) {
51 push( @superclass_args, 'label', $args{'type'} );
3265b0ce 52 }
53 return @superclass_args;
54}
55
56sub BUILD {
57 my( $self, $args ) = @_;
58
59 $self->set_attribute( 'class', 'relationship' );
60
3265b0ce 61}
62
63no Moose;
64__PACKAGE__->meta->make_immutable;