diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2013-10-20 23:14:51 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2013-10-20 23:14:51 -0700 |
commit | e77c9b418fdfb935ff8e99f10f607a4bbd7e1c8c (patch) | |
tree | 9005f8c0e3b18f853fb8093b01f6aad64949bc13 /src/com/p4square/grow/model/CircleQuestion.java | |
parent | 5037f4797461649994068d97a8433b6cd793c523 (diff) |
First stage of a major refactoring.
Question and Answer can now be serialized and deserialized to/from JSON.
As such, I no longer have to pass awkward maps around. As part of this
change I have introduced a Provider interface to abstract out loading
and persisting these beans.
The scoring logic has been completed factored out of
SurveyResultsResource and into the various ScoringEngines. Tests have
been added for Question, Answer, and the ScoringEngines. A bug has been
fixed in computing the value for slider questions.
The label identifiers in the circle questions have changed from all
lower case to camel case. That is, topleft is now topLeft. Several
issues have been corrected in the circle answers where the point values
did not match the labels.
Testing and code coverage support and reports have been added.
Diffstat (limited to 'src/com/p4square/grow/model/CircleQuestion.java')
-rw-r--r-- | src/com/p4square/grow/model/CircleQuestion.java | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/com/p4square/grow/model/CircleQuestion.java b/src/com/p4square/grow/model/CircleQuestion.java new file mode 100644 index 0000000..71acc14 --- /dev/null +++ b/src/com/p4square/grow/model/CircleQuestion.java @@ -0,0 +1,89 @@ +/* + * Copyright 2013 Jesse Morgan + */ + +package com.p4square.grow.model; + +/** + * Circle Question. + * + * @author Jesse Morgan <jesse@jesterpm.net> + */ +public class CircleQuestion extends Question { + private static final ScoringEngine ENGINE = new QuadScoringEngine(); + + private String mTopLeft; + private String mTopRight; + private String mBottomLeft; + private String mBottomRight; + + /** + * @return the Top Left label. + */ + public String getTopLeft() { + return mTopLeft; + } + + /** + * Set the Top Left label. + * @param s The new top left label. + */ + public void setTopLeft(String s) { + mTopLeft = s; + } + + /** + * @return the Top Right label. + */ + public String getTopRight() { + return mTopRight; + } + + /** + * Set the Top Right label. + * @param s The new top left label. + */ + public void setTopRight(String s) { + mTopRight = s; + } + + /** + * @return the Bottom Left label. + */ + public String getBottomLeft() { + return mBottomLeft; + } + + /** + * Set the Bottom Left label. + * @param s The new top left label. + */ + public void setBottomLeft(String s) { + mBottomLeft = s; + } + + /** + * @return the Bottom Right label. + */ + public String getBottomRight() { + return mBottomRight; + } + + /** + * Set the Bottom Right label. + * @param s The new top left label. + */ + public void setBottomRight(String s) { + mBottomRight = s; + } + + @Override + public boolean scoreAnswer(Score score, RecordedAnswer answer) { + return ENGINE.scoreAnswer(score, this, answer); + } + + @Override + public QuestionType getType() { + return QuestionType.CIRCLE; + } +} |