org.problets.lib.io.input
Class InputItem

java.lang.Object
  extended by org.problets.lib.io.input.InputItem

public class InputItem
extends java.lang.Object

Holds the following information for one form question: type, question prompt, answering options and whether answering it is mandatory

Author:
Amruth Kumar

Constructor Summary
InputItem(java.lang.String inType)
          Constructs an InputItem object of the specified type
InputItem(java.util.Vector contents)
          Constructs an InputItem object given a vector that specifies its type, whether answering it is mandatory (optional), the question's prompt, and answering options (optional).
 
Method Summary
 java.lang.String[] getOptions()
          Accessor of the answering options of this question
 java.lang.String getPrompt()
          Accessor of the prompt of this question
 boolean getRequired()
          Accessor of whether answering the question is mandatory
 java.lang.String getType()
          Accessor of the type of the form question
static void main(java.lang.String[] args)
          Used for local testing
 void print()
          Prints the type, prompt and answering options of this question on the console
 void resetRequired()
          Makes it not mandatory for the user to answer this question - user can skip answering this input item
 void setOptions(java.lang.String[] inOptions)
          Mutator for the answering options for this question
 void setPrompt(java.lang.String inPrompt)
          Mutator for the prompt of this question
 void setRequired()
          Makes it mandatory for the user to answer this question
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputItem

public InputItem(java.lang.String inType)
Constructs an InputItem object of the specified type

Parameters:
inType - String representing one of the allowed types of form questions - See the constants declared in DataInputModel for the allowed types

InputItem

public InputItem(java.util.Vector contents)
Constructs an InputItem object given a vector that specifies its type, whether answering it is mandatory (optional), the question's prompt, and answering options (optional).

Parameters:
contents - Vector containing the following elements in order - a valid input type (see the constants declared in DataInputModel for the allowed types), whether answering the question is mandatory (optional), the prompt of the question, and answering options (optional).
Method Detail

getType

public java.lang.String getType()
Accessor of the type of the form question

Returns:
String representing the type of this form question

getRequired

public boolean getRequired()
Accessor of whether answering the question is mandatory

Returns:
True of the user is required to answer this question and false otherwise

getPrompt

public java.lang.String getPrompt()
Accessor of the prompt of this question

Returns:
String representing the prompt for this question

getOptions

public java.lang.String[] getOptions()
Accessor of the answering options of this question

Returns:
Array of strings, each string representing an answering option for this question

setRequired

public void setRequired()
Makes it mandatory for the user to answer this question


resetRequired

public void resetRequired()
Makes it not mandatory for the user to answer this question - user can skip answering this input item


setPrompt

public void setPrompt(java.lang.String inPrompt)
Mutator for the prompt of this question

Parameters:
inPrompt - String representing the new prompt for this question

setOptions

public void setOptions(java.lang.String[] inOptions)
Mutator for the answering options for this question

Parameters:
inOptions - Array of strings, each representing a new answering option for this question

print

public void print()
Prints the type, prompt and answering options of this question on the console


main

public static void main(java.lang.String[] args)
Used for local testing