|| m_Tokenizer.sval.equalsIgnoreCase(
Attribute.ARFF_ATTRIBUTE_INTEGER)
|| m_Tokenizer.sval.equalsIgnoreCase(
Attribute.ARFF_ATTRIBUTE_NUMERIC)) {
attributes.addElement(
new Attribute(attributeName, attributes.size()));
readTillEOL();
} else if (m_Tokenizer.sval.equalsIgnoreCase(
Attribute.ARFF_ATTRIBUTE_STRING)) {
attributes.addElement(
new Attribute(attributeName, (FastVector) null,
attributes.size()));
readTillEOL();
} else if (m_Tokenizer.sval.equalsIgnoreCase(
Attribute.ARFF_ATTRIBUTE_DATE)) {
String format = null;
if (m_Tokenizer.nextToken() != StreamTokenizer.TT_EOL) {
if ((m_Tokenizer.ttype != StreamTokenizer.TT_WORD)
&& (m_Tokenizer.ttype != '\'')
&& (m_Tokenizer.ttype != '\"')) {
errorMessage("not a valid date format");
}
format = m_Tokenizer.sval;
readTillEOL();
} else {
m_Tokenizer.pushBack();
}
attributes.addElement(
new Attribute(attributeName, format,
attributes.size()));
} else if (m_Tokenizer.sval.equalsIgnoreCase(
Attribute.ARFF_ATTRIBUTE_RELATIONAL)) {
readTillEOL();
// Read attributes for subrelation
// First, save current set of attributes
FastVector atts = attributes;
attributes = new FastVector();
// Now, read attributes until we hit end of declaration of relational value
getFirstToken();
if (m_Tokenizer.ttype == StreamTokenizer.TT_EOF) {
errorMessage("premature end of file");
}
do {
if (Attribute.ARFF_ATTRIBUTE.equalsIgnoreCase(
m_Tokenizer.sval)) {
attributes = parseAttribute(attributes);
} else if (Attribute.ARFF_END_SUBRELATION.equalsIgnoreCase(
m_Tokenizer.sval)) {
getNextToken();
if (!attributeName.equalsIgnoreCase(m_Tokenizer.sval)) {
errorMessage(
"declaration of subrelation "
+ attributeName
+ " must be terminated by "
+ "@end " + attributeName);
}
break;
} else {
errorMessage(
"declaration of subrelation "
+ attributeName
+ " must be terminated by "
+ "@end " + attributeName);
}
} while (true);
// Make relation and restore original set of attributes
Instances relation = new Instances(attributeName, attributes,
0);
attributes = atts;
attributes.addElement(
new Attribute(attributeName, relation,
attributes.size()));
} else {
errorMessage(
"no valid attribute type or invalid "
+ "enumeration");
}
} else {
// Attribute is nominal.
attributeValues = new FastVector();
m_Tokenizer.pushBack();
// Get values for nominal attribute.
if (m_Tokenizer.nextToken() != '{') {
errorMessage("{ expected at beginning of enumeration");
}
while (m_Tokenizer.nextToken() != '}') {
if (m_Tokenizer.ttype == StreamTokenizer.TT_EOL) {
errorMessage("} expected at end of enumeration");
} else {
attributeValues.addElement(m_Tokenizer.sval);
}
}
attributes.addElement(
new Attribute(attributeName, attributeValues,
attributes.size()));
}
getLastToken(false);
getFirstToken();
if (m_Tokenizer.ttype == StreamTokenizer.TT_EOF) {