[system] / trunk / pg / lib / Value / AnswerChecker.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Value/AnswerChecker.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2611 Revision 2612
231 231
232package Value::String; 232package Value::String;
233 233
234sub cmp_defaults {( 234sub cmp_defaults {(
235 Value::Real->cmp_defaults, 235 Value::Real->cmp_defaults,
236 typeMatch => Value::Real->new(1), 236 typeMatch => undef,
237)}; 237)};
238 238
239sub cmp_class { 239sub cmp_class {
240 my $self = shift; my $ans = shift; 240 my $self = shift; my $ans = shift;
241 my $typeMatch = $ans->{typeMatch}; 241 my $typeMatch = $ans->{typeMatch};
242 my $typeMatch = $ans->{typeMatch} = Value::Real->new(1) unless defined($typeMatch);
242 return 'a Word' if $typeMatch->class eq 'String'; 243 return 'a Word' if !Value::isValue($typeMatch) || $typeMatch->class eq 'String';
243 return $typeMatch->cmp_class; 244 return $typeMatch->cmp_class;
244}; 245};
245 246
246sub typeMatch { 247sub typeMatch {
247 my $self = shift; my $other = shift; my $ans = shift; 248 my $self = shift; my $other = shift; my $ans = shift;
249 my $typeMatch = $ans->{typeMatch};
250 my $typeMatch = $ans->{typeMatch} = Value::Real->new(1) unless defined($typeMatch);
248 return 1 if $self->type eq $other->type || $ans->{typeMatch}->class eq 'String'; 251 return 1 if $self->type eq $other->type || !Value::isValue($typeMatch) || $typeMatch->class eq 'String';
249 return $ans->{typeMatch}->typeMatch($other,$ans); 252 return $typeMatch->typeMatch($other,$ans);
250} 253}
251 254
252############################################################# 255#############################################################
253 256
254package Value::Point; 257package Value::Point;

Legend:
Removed from v.2611  
changed lines
  Added in v.2612

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9