[system] / trunk / pg / macros / parserImplicitEquation.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/parserImplicitEquation.pl

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

Revision 6036 Revision 6037
1################################################################################ 1################################################################################
2# WeBWorK Online Homework Delivery System 2# WeBWorK Online Homework Delivery System
3# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ 3# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork2/lib/WeBWorK.pm,v 1.100 2007/08/13 22:59:53 sh002i Exp $ 4# $CVSHeader: pg/macros/parserImplicitEquation.pl,v 1.12 2007/10/04 16:40:48 sh002i Exp $
5# 5#
6# This program is free software; you can redistribute it and/or modify it under 6# This program is free software; you can redistribute it and/or modify it under
7# the terms of either: (a) the GNU General Public License as published by the 7# the terms of either: (a) the GNU General Public License as published by the
8# Free Software Foundation; either version 2, or (at your option) any later 8# Free Software Foundation; either version 2, or (at your option) any later
9# version, or (b) the "Artistic License" which comes with this package. 9# version, or (b) the "Artistic License" which comes with this package.
212 212
213sub new { 213sub new {
214 my $self = shift; my $class = ref($self) || $self; 214 my $self = shift; my $class = ref($self) || $self;
215 my $context = (Value::isContext($_[0]) ? shift : $self->context); 215 my $context = (Value::isContext($_[0]) ? shift : $self->context);
216 my $f = shift; return $f if ref($f) eq $class; 216 my $f = shift; return $f if ref($f) eq $class;
217 $f = main::Formula($f); 217 $f = $context->Package("Formula")->new($context,$f);
218 Value::Error("Your formula doesn't look like an implicit equation") 218 Value::Error("Your formula doesn't look like an implicit equation")
219 unless $f->type eq 'Equality'; 219 unless $f->type eq 'Equality';
220 my $F = ($context->Package("Formula")->new($context,$f->{tree}{lop}) - 220 my $F = ($context->Package("Formula")->new($context,$f->{tree}{lop}) -
221 $context->Package("Formula")->new($context,$f->{tree}{rop}))->reduce; 221 $context->Package("Formula")->new($context,$f->{tree}{rop}))->reduce;
222 $F = $context->Package("Formula")->new($F) unless Value::isFormula($F); 222 $F = $context->Package("Formula")->new($context,$F) unless Value::isFormula($F);
223 Value::Error("Your equation must be real-valued") unless $F->isRealNumber; 223 Value::Error("Your equation must be real-valued") unless $F->isRealNumber;
224 Value::Error("Your equation should not be constant") if $F->isConstant; 224 Value::Error("Your equation should not be constant") if $F->isConstant;
225 Value::Error("Your equation can not contain adaptive parameters") 225 Value::Error("Your equation can not contain adaptive parameters")
226 if ($F->usesOneOf($context->variables->parameters)); 226 if ($F->usesOneOf($context->variables->parameters));
227 $F = bless $F, $class; 227 $F = bless $F, $class;

Legend:
Removed from v.6036  
changed lines
  Added in v.6037

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9