summaryrefslogtreecommitdiffstats
path: root/src/Double.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/Double.vala')
-rw-r--r--src/Double.vala30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Double.vala b/src/Double.vala
new file mode 100644
index 0000000..0ca6866
--- /dev/null
+++ b/src/Double.vala
@@ -0,0 +1,30 @@
+namespace Eva {
+ public class Double : Object, Term {
+ public double value {get; construct;}
+
+ public Double(double v) {
+ Object(value: v);
+ }
+
+ public string to_string() {
+ return value.to_string();
+ }
+
+ protected bool do_match(Term o, Gee.Map<string, Term> vars, Gee.Map<string, string> aliases) {
+ if(o is Var) {
+ return o.do_match(this, vars, aliases);
+ }
+
+ if(o is Double) {
+ return value == (o as Double).value;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public void encode(Erl.Buffer buffer) {
+ buffer.encode_double(value);
+ }
+ }
+}