ArrayList<String> content = new ArrayList<String>();
OORexxDirective previousClass = null;
int directiveStartIndex = 0;
for(int i = 0; i < contentLines.length ; i++){
String contentLine = contentLines[i].trim();
for(String directive: keywordBean.getDirectiveKeywords())
if(contentLine.toLowerCase().startsWith(directive + " ")){
currentDirective = directive;
content = new ArrayList<String>();
directiveStartIndex = i;
}
if(!currentDirective.equals(""))
content.add(contentLine);
if(!currentDirective.equals("") && isDirectiveFinished(contentLines, i) && content.size() > 0){
OORexxDirective commentAble = StringToDirectiveParser.parse(currentDirective, content, getNearestClassComment(directiveStartIndex), packageFile);
content = new ArrayList<String>();
if(commentAble instanceof OORexxClass){
previousClass = commentAble;
}
if(commentAble instanceof OORexxRoutine || commentAble instanceof OORexxOptions
|| commentAble instanceof OORexxRequires)
previousClass = null;
if(previousClass != null && (commentAble instanceof OORexxMethod || commentAble instanceof OORexxAttribute || commentAble instanceof OORexxConstant)){
OORexxClass clazz = (OORexxClass) this.directiveMap.get(previousClass.getName());
if(commentAble instanceof OORexxMethod && commentAble.getName().toLowerCase().equals("init"))
clazz.setInit((OORexxMethod)commentAble);
if(commentAble instanceof OORexxMethod && !commentAble.getName().toLowerCase().equals("init"))
clazz.appendMethod((OORexxMethod)commentAble);
if(commentAble instanceof OORexxAttribute)
clazz.appendAttribute((OORexxAttribute) commentAble);
if(commentAble instanceof OORexxConstant)
clazz.appendConstant((OORexxConstant) commentAble);
Collections.sort(clazz.getMethods());
Collections.sort(clazz.getAttributes());
Collections.sort(clazz.getConstants());
this.directiveMap.put(previousClass.getName(), clazz);
}
if(previousClass == null || commentAble instanceof OORexxClass){
directiveMap.put(commentAble.getName(), commentAble);
}
currentDirective = "";
}