package org.mitre.midiki.workshop;
import java.io.Serializable;
/**
* Represents a diagnostic test which can be used to confirm the presence
* or absence of a named symptom, a short text description of a positive
* test result, and whether the symptom diagnosed by the test must
* be present or absent. Typically, disease descriptions show those symptoms
* which must be present, while diagnosis queries may contain symptoms which
* have been identified as absent (as distinct from symptoms whose status
* is unknown).
*
* @author Carl Burke
* @version 1.0
* @since 1.0
* @see Serializable
*/
public class DiagnosticTest implements Serializable
{
/**
* The name of the symptom.
*/
public String name;
/**
* The name of the appropriate test.
*/
public String test;
/**
* The description of a positive test result.
*/
public String result;
/**
* true
if the symptom is required vs suggestive.
*/
public boolean required;
/**
* true
if the symptom is present.
*/
public boolean present;
/**
* Generates a string representation of the symptom.
*
* @return a String
value
*/
public String toString()
{
StringBuffer sb = new StringBuffer(128);
sb.append("DiagnosticTest(");
sb.append(name);
sb.append(",test='");
sb.append(test);
sb.append("',result='");
sb.append(result);
sb.append("',");
if (required) {
sb.append("required=yes,");
} else {
sb.append("required=no,");
}
if (present) {
sb.append("present=yes");
} else {
sb.append("present=no");
}
sb.append(")");
return sb.toString();
}
/**
* Returns true
if the symptom matches the query.
* Since synonyms are not considered, this is a less powerful
* match than the one performed by WorkshopDatabase
* in calculating a diagnosis.
*
* @param s a DiagnosticTest
value
* @return a boolean
value
*/
public boolean matches(DiagnosticTest s)
{
if (!name.equalsIgnoreCase(s.name)) return false;
return (present==s.present);
}
/**
* Empty constructor.
*
*/
public DiagnosticTest()
{
}
/**
* Creates a new DiagnosticTest
instance.
*
* @param n a String
value
* @param t a String
value
* @param r a String
value
* @param q a boolean
value
* @param p a boolean
value
*/
public DiagnosticTest(String n, String t, String r, boolean q, boolean p)
{
this();
name=n; test=t; result=r; required=q; present=p;
}
}