From 22e8ab6479334206f97b0093f6c5ffd14610cce3 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 18 Aug 2019 20:30:44 -0400
Subject: [PATCH] More credits
---
timeflow/format/field/FieldFormat.java | 112 +++++++++++++++++++++++++++++---------------------------
1 files changed, 58 insertions(+), 54 deletions(-)
diff --git a/timeflow/format/field/FieldFormat.java b/timeflow/format/field/FieldFormat.java
index a8c7223..a899ab0 100755
--- a/timeflow/format/field/FieldFormat.java
+++ b/timeflow/format/field/FieldFormat.java
@@ -4,61 +4,65 @@
import timeflow.data.time.*;
-public abstract class FieldFormat {
- protected String lastInput;
- protected Object lastValue;
- protected boolean understood=true;
-
- double value;
-
- void add(double x)
- {
- value+=x;
- }
-
- void note(String s)
- {
- add(scoreFormatMatch(s));
- }
+public abstract class FieldFormat
+{
+ protected String lastInput;
+ protected Object lastValue;
+ protected boolean understood = true;
+ double value;
-
- protected abstract Object _parse(String s) throws Exception;
- public abstract String format(Object o);
- public abstract Class getType();
- public abstract double scoreFormatMatch(String s);
- public abstract String getHumanName();
+ void add(double x)
+ {
+ value += x;
+ }
+ void note(String s)
+ {
+ add(scoreFormatMatch(s));
+ }
- public void setValue(Object o)
- {
- lastValue=o;
- lastInput=o==null ? "" : format(o);
- }
-
- public Object parse(String s) throws Exception
- {
- lastInput=s;
- lastValue=null;
- understood=false;
- lastValue=_parse(s);
- understood=true;
- return lastValue;
- }
-
- public Object getLastValue()
- {
- return lastValue;
- }
-
- public String feedback()
- {
- if (!understood)
- return "Couldn't understand";
- return lastValue==null ? "(missing)" : "Read: "+format(lastValue);
- }
-
- public boolean isUnderstood()
- {
- return understood;
- }
+ protected abstract Object _parse(String s) throws Exception;
+
+ public abstract String format(Object o);
+
+ public abstract Class getType();
+
+ public abstract double scoreFormatMatch(String s);
+
+ public abstract String getHumanName();
+
+ public void setValue(Object o)
+ {
+ lastValue = o;
+ lastInput = o == null ? "" : format(o);
+ }
+
+ public Object parse(String s) throws Exception
+ {
+ lastInput = s;
+ lastValue = null;
+ understood = false;
+ lastValue = _parse(s);
+ understood = true;
+ return lastValue;
+ }
+
+ public Object getLastValue()
+ {
+ return lastValue;
+ }
+
+ public String feedback()
+ {
+ if (!understood)
+ {
+ return "Couldn't understand";
+ }
+ return lastValue == null ? "(missing)" : "Read: " + format(lastValue);
+ }
+
+ public boolean isUnderstood()
+ {
+ return understood;
+ }
}
--
Gitblit v1.6.2