| 1 | package VANAMBURG::OrderedSuit; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | extends 'VANAMBURG::Suit'; | |||||||||||||||||||||||||||||||||||||||||
| 4 | =head1 VANAMBURG::OrderedSuit | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | An extension of VANAMBURG::Suit that adds a value attribute | ||||||||||||||||||||||||||||||||||||||||||
| 7 | indicating the order of the suit. | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | =head2 value | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | The value indicating the order of the suit, useful for such | ||||||||||||||||||||||||||||||||||||||||||
| 14 | stacks as CHaSeD or SHoCkeD. | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | has 'value' => ( is => 'ro', isa => 'Int', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | =head2 equals | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | Returns true (1) if the name, abbreviation and value of this object | ||||||||||||||||||||||||||||||||||||||||||
| 23 | is the same as that passed as a parameter. | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | ▶ | override 'equals' => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.5
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | my ( $self, $other ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | ▶ | return 0 if ( !defined $other ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | ▶ | if ( $self->name eq $other->name | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$self->name eq $other->name and $self->abbreviation eq $other->abbreviation and $self->value == $other->value
$self->name eq $other->name and $self->abbreviation eq $other->abbreviation
MC/DC33%1/3
$self->name eq $other->name and $self->abbreviation eq $other->abbreviation and $self->value == $other->value
$self->name eq $other->name
$self->abbreviation eq $other->abbreviation
$self->value == $other->value
Truth table50%2/4
A and B and C
A= $self->name eq $other->nameB= $self->abbreviation eq $other->abbreviationC= $self->value == $other->value
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | && $self->abbreviation eq $other->abbreviation | ||||||||||||||||||||||||||||||||||||||||||
| 32 | && $self->value == $other->value ) | ||||||||||||||||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 5 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | }; | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||