Log Message:
-----------
Added a ->with() method that lets you set fields of a Parser object as
you create it. For example:
$f = Formula("sqrt(x)")->with(limits=>[0,3]);
or
ANS(Formula("(x+1)/x")->with(checkUndefinedPoints=>1,test_at=>[[0]])->cmp);
or
ANS($f->with(test_points=>[[0],[1],[2]])->cmp);
Modified Files:
--------------
pg/lib:
Value.pm
Revision Data
-------------
Index: Value.pm
===================================================================
RCS file: /webwork/cvs/system/pg/lib/Value.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -Llib/Value.pm -Llib/Value.pm -u -r1.33 -r1.34
--- lib/Value.pm
+++ lib/Value.pm
@@ -42,6 +42,8 @@
granularity => 1000,
resolution => undef,
max_adapt => 1E8,
+ checkUndefinedPoints => 0,
+ max_undefined => undef,
},
);
@@ -289,6 +291,15 @@
}
#
+# Easy method for setting parameters of an object
+#
+sub with {
+ my $self = shift; my %hash = @_;
+ foreach my $id (keys(%hash)) {$self->{$id} = $hash{$id}}
+ return $self;
+}
+
+#
# Return a type structure for the item
# (includes name, length of vectors, and so on)
#
|