public CompilerDirective create(String data,int startPosition,int endPosition) throws CompilerDirectiveFactoryUnsupportedDirectiveException, CompilerDirectiveFactorySyntaxException {
  int directiveFirstChar=getDirectiveFirstChar(data,startPosition);
  int directiveLastChar=getDirectiveLastChar(data,startPosition);
  String directiveName=getName(data,directiveFirstChar);
  String directiveItem=getItem(data,directiveFirstChar);
  CompilerDirectiveType type=CompilerDirectiveType.getTypeByName(directiveName.toLowerCase());
switch (type) {
case DEFINE:
    return new DefineDirective(directiveItem,directiveFirstChar,directiveLastChar);
case UNDEFINE:
  return new UndefineDirective(directiveItem,directiveFirstChar,directiveLastChar);
case IF:
return new IfDirective(directiveItem,directiveFirstChar,directiveLastChar);
case IFDEF:
return new IfDefDirective(directiveName,directiveItem,directiveFirstChar,directiveLastChar);
case IFEND:
return new IfEndDirective(directiveItem,directiveFirstChar,directiveLastChar);
case ENDIF:
return new EndIfDirective(directiveItem,directiveFirstChar,directiveLastChar);
case ELSE:
return new ElseDirective(directiveItem,directiveFirstChar,directiveLastChar);
case INCLUDE:
return new IncludeDirective(directiveItem,directiveFirstChar,directiveLastChar);
case UNUSED:
return new UnusedDirective(directiveFirstChar,directiveLastChar);
default :
throw new CompilerDirectiveFactoryUnsupportedDirectiveException("Not implemented directive name: " + directiveName);
}
}

public CompilerDirective create ( String data , int startPosition , int endPosition ) throws CompilerDirectiveFactoryUnsupportedDirectiveException , CompilerDirectiveFactorySyntaxException { int directiveFirstChar = getDirectiveFirstChar ( data , startPosition ) ; int directiveLastChar = getDirectiveLastChar ( data , startPosition ) ; String directiveName = getName ( data , directiveFirstChar ) ; String directiveItem = getItem ( data , directiveFirstChar ) ; CompilerDirectiveType type = CompilerDirectiveType . getTypeByName ( directiveName . toLowerCase ( ) ) ; switch ( type ) { case DEFINE : return new DefineDirective ( directiveItem , directiveFirstChar , directiveLastChar ) ; case UNDEFINE : return new UndefineDirective ( directiveItem , directiveFirstChar , directiveLastChar ) ; case IF : return new IfDirective ( directiveItem , directiveFirstChar , directiveLastChar ) ; case IFDEF : return new IfDefDirective ( directiveName , directiveItem , directiveFirstChar , directiveLastChar ) ; case IFEND : return new IfEndDirective ( directiveItem , directiveFirstChar , directiveLastChar ) ; case ENDIF : return new EndIfDirective ( directiveItem , directiveFirstChar , directiveLastChar ) ; case ELSE : return new ElseDirective ( directiveItem , directiveFirstChar , directiveLastChar ) ; case INCLUDE : return new IncludeDirective ( directiveItem , directiveFirstChar , directiveLastChar ) ; case UNUSED : return new UnusedDirective ( directiveFirstChar , directiveLastChar ) ; default : throw new CompilerDirectiveFactoryUnsupportedDirectiveException ( "Not implemented directive name: " + directiveName ) ; } }
creates a concrete compiler directive class base on a given string
