*
* @return Return a list of violations, if this object isn't valid.
*/
public Violations validate()
{
Violations violations = new Violations();
if (startSymbol==null)
violations.addViolation("Start symbol is not defined", location);
/*for (int i = 0; i<definitions.length; i++)
for (int j = 0; j<definitions.length; j++)
if ((i!=j) && (definitions[i].getSymbol().equals(definitions[j].getSymbol())))
violations.addViolation("Element '"+definitions[i].getSymbol()+"' is already defined",
definitions[i].getLocation());*/
if (getDefinition(startSymbol)==null)
violations.addViolation("Start symbol \""+startSymbol+"\""+
"is not defined through a definition", location);
if (getDefinitionCount()<=0)
violations.addViolation("No definitions are defined", location);
for (int i = 0; i<definitions.length; i++)
violations.addViolations(definitions[i].validate());
/*SymbolSet ntdefinitions = getSymbols().getNonterminals();
for (int i = 0; i<ntdefinitions.getSymbolCount(); i++)
if ( !contains(ntdefinitions.getSymbol(i)))