for (int i = 0; i<alternation.getPatternCount(); i++)
groupcount += getGroupCount(alternation.getPattern(i));
}
else if (element instanceof Concatenation)
{
Concatenation concatenation = (Concatenation)element;
for (int i = 0; i<concatenation.getPatternCount(); i++)
groupcount += getGroupCount(concatenation.getPattern(i));
}
else if (element instanceof PatternGroup)
{
groupcount++;