/** Returns a recursively created XML representation of this <code>Meta</code>. */ public String toString() { StringBuilder buffer = new StringBuilder(); buffer.append("<" + xmltag + ">" + newline); if (null != corpus_id) { buffer.append("\t\t\t" + corpus_id.toString()); } if (null != history) { buffer.append("\t\t\t" + history.toString()); } if (null != format) { buffer.append("\t\t\t" + format.toString()); } if (null != name) { buffer.append("\t\t\t" + name.toString()); } if (null != author) { buffer.append("\t\t\t" + author.toString()); } if (null != date) { buffer.append("\t\t\t" + date.toString()); } if (null != description) { buffer.append("\t\t\t" + description.toString()); } buffer.append("\t\t</" + xmltag + ">" + newline); return buffer.toString(); }
@Override public ValidationResult validate(String value, Doc doc, Model model) { for (Format f : EnumSet.allOf(Format.class)) { if (f.toString().equalsIgnoreCase(value)) { return new PositiveValidationResult(f); } } return new NegativeValidationResult("Unknown/unsupported format: '" + value + "'"); }
public void addOperand(String newOperand) throws FormatException { Rational test = format.parse(newOperand, base); String test2 = format.toString(test, base); if (!newOperand.contains(".")) { newOperand = newOperand + ".0"; } if (!test2.equals(newOperand)) { try { throw new NumberBaseException("Wrong number for this base."); } catch (NumberBaseException e) { System.out.println(e.getMessage()); } } else { operand_1 = operand_0; operand_0 = format.parse(newOperand, base); } }
public String secondOperand() { return format.toString(operand_0, base); }
public String firstOperand() { return format.toString(operand_1, base); }