| 1 | package VANAMBURG::Suit; | ||||||||||||||||||||||||||||
| 2 | 7 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | =head1 VANAMBURG::Suit | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | Represents the suit aspect of a card. | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | =cut | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | =head2 name | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | The name of the card, such as "Jack", "Queen", "Two", etc. | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | =cut | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 7 | has 'name' => ( isa => 'Str', is => 'ro', required => 1 ); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head2 abbreviation | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | A single character representation of the suit such as "H" for heard, etc. | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =cut | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 7 | has 'abbreviation' => ( isa => 'Str', is => 'ro', required => 1 ); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =head2 unicode_char | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | A unicode represendation of the suit symbol. | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =cut | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 7 | has 'unicode_char' => ( isa => 'Str', is => 'ro', required => 1 ); | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head2 equals | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | Returns true (1) if the name and abbreviation of this object are the | ||||||||||||||||||||||||||||
| 37 | same as the suit passed as the parameter. | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =cut | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 6 | ▶ | sub equals { | ||||||||||||||||||||||||||
|
Subroutine
equals: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 42 | 6 | my ( $self, $other ) = @_; | |||||||||||||||||||||||||||
| 43 | 6 | ▶ | return 0 if ( !defined $other ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 6 | ▶ | if ( $self->name eq $other->name && $self->abbreviation eq $other->abbreviation ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->name eq $other->name and $self->abbreviation eq $other->abbreviation
MC/DC50%1/2
$self->name eq $other->name and $self->abbreviation eq $other->abbreviation
$self->name eq $other->name
$self->abbreviation eq $other->abbreviation
Truth table66%2/3
A and B
A= $self->name eq $other->nameB= $self->abbreviation eq $other->abbreviation
| |||||||||||||||||||||||||||||
| 45 | 5 | return 1; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | else { | ||||||||||||||||||||||||||||
| 48 | 1 | return 0; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 7 | 1; | |||||||||||||||||||||||||||