}else{
// search starting from the bottom since @return should be near the
// end.
int index = tags.size();
for (int ii = tags.size() - 1; ii >= 0; ii--){
TagElement tag = (TagElement)tags.get(ii);
// return tag already exists?
if(TagElement.TAG_RETURN.equals(tag.getTagName())){
index = -1;
break;
}
// if we hit the param tags, or the main text, insert below them.
if (TagElement.TAG_PARAM.equals(tag.getTagName()) ||
tag.getTagName() == null)
{
index = ii + 1;
break;
}
index = ii;
}
if(index > -1){
addTag(javadoc, index, TagElement.TAG_RETURN, null);
}
}
}else{
// remove any return tag that may exist.
for (int ii = tags.size() - 1; ii >= 0; ii--){
TagElement tag = (TagElement)tags.get(ii);
// return tag already exists?
if(TagElement.TAG_RETURN.equals(tag.getTagName())){
tags.remove(tag);
}
// if we hit the param tags, or the main text we can stop.
if (TagElement.TAG_PARAM.equals(tag.getTagName()) ||
tag.getTagName() == null)
{
break;
}
}
}