| 1 | |||||||||||||
| 2 | ### | ||||||||||||
| 3 | # CSS::SAC::Condition::Combinator - SAC CombinatorConditions | ||||||||||||
| 4 | # Robin Berjon <robin@knowscape.com> | ||||||||||||
| 5 | # 24/02/2001 | ||||||||||||
| 6 | ### | ||||||||||||
| 7 | |||||||||||||
| 8 | package CSS::SAC::Condition::Combinator; | ||||||||||||
| 9 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 2 | ▶ | use vars qw($VERSION); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 2 | ▶ | $VERSION = $CSS::SAC::VERSION || '0.03'; | ||||||||||
|
Condition50%1/2
$CSS::SAC::VERSION || '0.03'
MC/DC0%0/1
$CSS::SAC::VERSION || '0.03'
$CSS::SAC::VERSION
Truth table50%1/2
A
A= $CSS::SAC::VERSION
| |||||||||||||
| 12 | |||||||||||||
| 13 | 2 | ▶ | use base qw(CSS::SAC::Condition); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | |||||||||||||
| 15 | |||||||||||||
| 16 | #---------------------------------------------------------------------# | ||||||||||||
| 17 | # build the fields for an array based object | ||||||||||||
| 18 | #---------------------------------------------------------------------# | ||||||||||||
| 19 | 2 | ▶ | use Class::ArrayObjects extend => { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | class => 'CSS::SAC::Condition', | ||||||||||||
| 21 | with => [qw( | ||||||||||||
| 22 | _condition_1_ | ||||||||||||
| 23 | _condition_2_ | ||||||||||||
| 24 | )], | ||||||||||||
| 25 | 2 | }; | |||||||||||
| 26 | #---------------------------------------------------------------------# | ||||||||||||
| 27 | |||||||||||||
| 28 | |||||||||||||
| 29 | |||||||||||||
| 30 | |||||||||||||
| 31 | ### Constructor ####################################################### | ||||||||||||
| 32 | # # | ||||||||||||
| 33 | # # | ||||||||||||
| 34 | |||||||||||||
| 35 | |||||||||||||
| 36 | #---------------------------------------------------------------------# | ||||||||||||
| 37 | # CSS::SAC::Condition::Combinator->new($type,$first_cond,$second_cond) | ||||||||||||
| 38 | # creates a new sac CombinatorCondition object | ||||||||||||
| 39 | #---------------------------------------------------------------------# | ||||||||||||
| 40 | 2 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||
| 41 | 2 | ▶ | my $class = ref($_[0])?ref(shift):shift; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 42 | 2 | my $type = shift; # should be one of the combinator conditions | |||||||||||
| 43 | 2 | my $condition_1 = shift; # any default ? | |||||||||||
| 44 | 2 | my $condition_2 = shift; | |||||||||||
| 45 | |||||||||||||
| 46 | # create a condition | ||||||||||||
| 47 | 2 | my $ccond = $class->SUPER::new($type); | |||||||||||
| 48 | |||||||||||||
| 49 | # add our fields | ||||||||||||
| 50 | 2 | ▶ | $ccond->[_condition_1_] = $condition_1 if $condition_1; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 51 | 2 | ▶ | $ccond->[_condition_2_] = $condition_2 if $condition_2; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 52 | |||||||||||||
| 53 | 2 | return $ccond; | |||||||||||
| 54 | } | ||||||||||||
| 55 | #---------------------------------------------------------------------# | ||||||||||||
| 56 | |||||||||||||
| 57 | |||||||||||||
| 58 | # # | ||||||||||||
| 59 | # # | ||||||||||||
| 60 | ### Constructor ####################################################### | ||||||||||||
| 61 | |||||||||||||
| 62 | |||||||||||||
| 63 | |||||||||||||
| 64 | ### Accessors ######################################################### | ||||||||||||
| 65 | # # | ||||||||||||
| 66 | # # | ||||||||||||
| 67 | |||||||||||||
| 68 | # aliases | ||||||||||||
| 69 | 2 | *CSS::SAC::Condition::Combinator::getFirstCondition = \&FirstCondition; | |||||||||||
| 70 | 2 | *CSS::SAC::Condition::Combinator::getSecondCondition = \&SecondCondition; | |||||||||||
| 71 | |||||||||||||
| 72 | |||||||||||||
| 73 | #---------------------------------------------------------------------# | ||||||||||||
| 74 | # my $cond1 = $ccond->FirstCondition() | ||||||||||||
| 75 | # $ccond->FirstCondition($cond1) | ||||||||||||
| 76 | # get/set the first condition | ||||||||||||
| 77 | #---------------------------------------------------------------------# | ||||||||||||
| 78 | 6 | ▶ | sub FirstCondition { | ||||||||||
|
Subroutine
FirstCondition: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||
| 79 | 6 | ▶ | (@_==2) ? $_[0]->[_condition_1_] = $_[1] : | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 80 | $_[0]->[_condition_1_]; | ||||||||||||
| 81 | } | ||||||||||||
| 82 | #---------------------------------------------------------------------# | ||||||||||||
| 83 | |||||||||||||
| 84 | |||||||||||||
| 85 | #---------------------------------------------------------------------# | ||||||||||||
| 86 | # my $cond2 = $ccond->SecondCondition() | ||||||||||||
| 87 | # $ccond->SecondCondition($cond2) | ||||||||||||
| 88 | # get/set the second condition | ||||||||||||
| 89 | #---------------------------------------------------------------------# | ||||||||||||
| 90 | 6 | ▶ | sub SecondCondition { | ||||||||||
|
Subroutine
SecondCondition: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||
| 91 | 6 | ▶ | (@_==2) ? $_[0]->[_condition_2_] = $_[1] : | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 92 | $_[0]->[_condition_2_]; | ||||||||||||
| 93 | } | ||||||||||||
| 94 | #---------------------------------------------------------------------# | ||||||||||||
| 95 | |||||||||||||
| 96 | |||||||||||||
| 97 | |||||||||||||
| 98 | # # | ||||||||||||
| 99 | # # | ||||||||||||
| 100 | ### Accessors ######################################################### | ||||||||||||
| 101 | |||||||||||||
| 102 | |||||||||||||
| 103 | |||||||||||||
| 104 | 2 | 1; | |||||||||||
| 105 | |||||||||||||
| 106 | =pod | ||||||||||||
| 107 | |||||||||||||
| 108 | =head1 NAME | ||||||||||||
| 109 | |||||||||||||
| 110 | CSS::SAC::Condition::Combinator - SAC CombinatorConditions | ||||||||||||
| 111 | |||||||||||||
| 112 | =head1 SYNOPSIS | ||||||||||||
| 113 | |||||||||||||
| 114 | see CSS::SAC::Condition | ||||||||||||
| 115 | |||||||||||||
| 116 | =head1 DESCRIPTION | ||||||||||||
| 117 | |||||||||||||
| 118 | This is a subclass of CSS::SAC::Condition, look there for more | ||||||||||||
| 119 | documentation. This class adds the following methods (the spec | ||||||||||||
| 120 | equivalents are available as well, just prepend 'get'): | ||||||||||||
| 121 | |||||||||||||
| 122 | =head1 METHODS | ||||||||||||
| 123 | |||||||||||||
| 124 | =over 4 | ||||||||||||
| 125 | |||||||||||||
| 126 | =item * CSS::SAC::Condition::Combinator->new($type,$cond1,$cond2) | ||||||||||||
| 127 | |||||||||||||
| 128 | =item * $cond->new($type,$cond1,$cond2) | ||||||||||||
| 129 | |||||||||||||
| 130 | Creates a new combinator condition. | ||||||||||||
| 131 | |||||||||||||
| 132 | =item * $ccond->FirstCondition([$cond]) | ||||||||||||
| 133 | =item * $ccond->SecondCondition([$cond]) | ||||||||||||
| 134 | |||||||||||||
| 135 | get/set the conditions that compose the combinator | ||||||||||||
| 136 | |||||||||||||
| 137 | =back | ||||||||||||
| 138 | |||||||||||||
| 139 | =head1 AUTHOR | ||||||||||||
| 140 | |||||||||||||
| 141 | Robin Berjon <robin@knowscape.com> | ||||||||||||
| 142 | |||||||||||||
| 143 | This module is licensed under the same terms as Perl itself. | ||||||||||||
| 144 | |||||||||||||
| 145 | =cut | ||||||||||||
| 146 | |||||||||||||
| 147 | |||||||||||||