FileDocCategorySizeDatePackage
Q.javaAPI DocExample2049Thu May 18 22:08:10 BST 2000None

Q

public class Q extends Observable
A Q is one Question used in TestEdit.

Fields Summary
public static final String[]
labels
String
question
The text of the question
String[]
ans
The text of the alternative answers.
int
correct
The number of the answer that is correct. Zero-based.
int
objective
The number of the chapter that this question relates to
boolean
tried
A Boolean for use by Interactive Programs
Constructors Summary
Q(int n)
construct a Q given the # of answers allowed.

		if (n<0 || n>10)
			throw new IllegalArgumentException("Q.init: Count " + n + " invalid");
		question = "";
		ans = new String[n];
		correct = objective = -1;
	
Methods Summary
public intgetAns()

		return correct;
	
java.lang.StringgetAnsText(int i)

		return ans[i];
	
public intgetCount()
Get the number of questions.

deprecated
See getNumAnswers.

		return getNumAnswers();
	
public intgetNumAnswers()
Get the number of questions.

		return ans.length;
	
intgetObjective()

		return objective;
	
java.lang.StringgetQText()

		return question;
	
public voidsetAns(int i, boolean notify)

		if (i<0 || i>=getCount())
			throw new IllegalArgumentException("Q.setAns: Count " + i + " invalid");
		correct = i;
		setChanged();
		// if (notify)
		// 	notifyObservers(new QChangeEvent(this,
		// 		QChangeEvent.CHANGE_ANSWER_NUMBER, i, null));
	
voidsetAnsText(int i, java.lang.String s, boolean notify)

		if (i<0 || i>=getCount())
			throw new IllegalArgumentException("Q.setAnsText: Count " + i + " invalid");
		ans[i] = s;
		setChanged();
		// if (notify)
		// 	notifyObservers(new QChangeEvent(this,
		// 		QChangeEvent.CHANGE_ANSWER_TEXT, i, s));
	
voidsetObjective(int i)

		objective = i;
	
voidsetQText(java.lang.String s, boolean notify)

		question = s;
		setChanged();
		// if (notify)
		// 	notifyObservers(new QChangeEvent(this,
		// 		QChangeEvent.CHANGE_QUESTION_TEXT, -1, s));
	
public java.lang.StringtoString()


	   
		return "Q[" + question + "]";