signature:
public class InjectingAppWidgetProvider { /** * Returns the list of dagger modules to be included in this AppWidgetProvider ' s object graph . Subclasses that
 * override this method should add to the list returned by super . getModules ( ) .
 * @ return the list of modules */
protected List < Object > getModules ( ) { } }

implementation: List < Object > result = new ArrayList < Object > ( ) ; result . add ( new InjectingAppWidgetProviderModule ( mContext , this , this ) ) ; return result ;


signature:
public class AlertDialog { /** * Create new Builder .
 * @ param context context .
 * @ param themeResId theme res id .
 * @ return { @ link Builder } . */
public static Builder newBuilder ( Context context , int themeResId ) { } }

implementation: if ( Build . VERSION . SDK_INT >= 21 ) { return new APi21Builder ( context , themeResId ) ; } return new Api20Builder ( context , themeResId ) ;


signature:
public class MainActivity { /** * 显示正常用法的按钮 。 */
private void onCommonClick ( ) { } }

implementation: AlertDialog . build ( this ) . setTitle ( "标题" ) . setMessage ( "提示信息" ) . setNeutralButton ( "忽略" , ( dialog , which ) -> { Toast . makeText ( MainActivity . this , "点击了忽略" , Toast . LENGTH_SHORT ) . show ( ) ; } ) . setNegativeButton ( "取消" , ( dialog , which ) -> { Toast . makeText ( MainActivity . this , "点击了取消" , Toast . LENGTH_SHORT ) . show ( ) ; } ) . setPositiveButton ( "好的" , ( dialog , which ) -> { Toast . makeText ( MainActivity . this , "点击了确定" , Toast . LENGTH_SHORT ) . show ( ) ; } ) . show ( ) ; // Button被点击后 , 不调用dialog . dismiss ( ) , 因为AlertDialog会自动调用 。


signature:
public class MainActivity { /** * 特殊用法被点击 。 */
private void onSpecialClick ( ) { } }

implementation:
AlertDialog alertDialog = AlertDialog . build ( this ) . setTitle ( "标题" ) . setMessage ( "提示信息" ) // Listener 写null , Button被点击时 , Alertdialog就不会自动dismiss了 。
. setNeutralButton ( "忽略" , null ) . setNegativeButton ( "取消" , null ) . setPositiveButton ( "好的" , null ) . show ( ) ; // 这里是直接show ( ) , 不是create ( ) , 否则不能getButton ( ) 。
// 获取中性按钮 。
Button btnNeutral = alertDialog . getButton ( DialogInterface . BUTTON_NEUTRAL ) ; btnNeutral . setOnClickListener ( v -> { Toast . makeText ( MainActivity . this , "我们拦截了忽略点击关闭dialog操作" , Toast . LENGTH_SHORT ) . show ( ) ; } ) ; // 获取取消按钮 。
Button btnNegative = alertDialog . getButton ( DialogInterface . BUTTON_NEGATIVE ) ; btnNegative . setOnClickListener ( v -> { alertDialog . dismiss ( ) ; // 拦截了btn的默认操作 , 需要调用dialog . dismiss ( ) 。
Toast . makeText ( MainActivity . this , "点击了取消" , Toast . LENGTH_SHORT ) . show ( ) ; } ) ; // 获取确定按钮 。
Button btnPositive = alertDialog . getButton ( DialogInterface . BUTTON_POSITIVE ) ; btnPositive . setOnClickListener ( v -> { alertDialog . dismiss ( ) ; // 拦截了btn的默认操作 , 需要调用dialog . dismiss ( ) 。
Toast . makeText ( MainActivity . this , "点击了确定" , Toast . LENGTH_SHORT ) . show ( ) ; } ) ;


signature:
public class CachingGenerator { /** * if ( < cache > ! = null ) return < cache > ; */
private void generateCacheHitReturn ( final CodeBlock block ) { } }

implementation: generateGetFromCache ( block ) ; final LabelNode cacheMiss = new LabelNode ( ) ; block . dup ( ) . ifnull ( cacheMiss ) . areturn ( ) . label ( cacheMiss ) . pop ( ) ;


signature:
public class CachingGenerator { /** * < cache > = new ProxyMatcher ( ) ; */
private void generateStoreNewProxyMatcher ( final CodeBlock block ) { } }

implementation: block . newobj ( CodegenUtils . p ( ProxyMatcher . class ) ) . dup ( ) . invokespecial ( CodegenUtils . p ( ProxyMatcher . class ) , "<init>" , CodegenUtils . sig ( void . class ) ) ; generateStoreInCache ( block ) ;


signature:
public class CachingGenerator { /** * < proxyMatcher > . arm ( < rule > ) */
private static void generateArmProxyMatcher ( final CodeBlock block ) { } }

implementation: block . dup_x1 ( ) . checkcast ( CodegenUtils . p ( Matcher . class ) ) . invokevirtual ( CodegenUtils . p ( ProxyMatcher . class ) , "arm" , CodegenUtils . sig ( void . class , Matcher . class ) ) ;


signature:
public class ReflectiveClassLoader { /** * Returns the class with the given name if it has already been loaded by
 * the given class loader
 * < p > If the class has not been loaded yet , this method returns { @ code
 * null } . < / p >
 * @ param className the full name of the class to be loaded
 * @ return the class instance , if found */
@ Nullable public Class < ? > findClass ( final String className ) { } }

implementation: Objects . requireNonNull ( className ) ; try { return ( Class < ? > ) findClass . invoke ( loader , className ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { throw new ParserTransformException ( "unable to find class by name (" + className + ')' , e ) ; }


signature:
public class ReflectiveClassLoader { /** * Loads the class defined with the given name and bytecode using the given
 * class loader
 * < p > Since package and class idendity includes the ClassLoader instance
 * used to load a class , we use reflection on the given class loader to
 * define generated classes . < / p >
 * < p > If we used our own class loader ( in order to be able to access the
 * protected " defineClass " method ) , we would likely still be able to load
 * generated classes ; however , they would not have access to package - private
 * classes and members of their super classes . < / p >
 * @ param className the full name of the class to be loaded
 * @ param bytecode the bytecode of the class to load
 * @ return the class instance */
public Class < ? > loadClass ( final String className , final byte [ ] bytecode ) { } }

implementation: Objects . requireNonNull ( className ) ; Objects . requireNonNull ( bytecode ) ; try { return ( Class < ? > ) loadClass . invoke ( loader , className , bytecode , 0 , bytecode . length ) ; } catch ( InvocationTargetException | IllegalAccessException e ) { throw new ParserTransformException ( "unable to load class by name" , e ) ; }


signature:
public class TrieNode { /** * Core search method
 * < p > This method uses a { @ link CharBuffer } to perform searches , and changes
 * this buffer ' s position as the match progresses . The two other arguments
 * are the depth of the current search ( ie the number of nodes visited
 * since root ) and the index of the last node where a match was found ( ie
 * the last node where { @ link # fullWord } was true . < / p >
 * @ param buffer the charbuffer
 * @ param matchedLength the last matched length ( - 1 if no match yet )
 * @ param currentLength the current length walked by the trie
 * @ return the length of the match found , - 1 otherwise */
private int doSearch ( final CharBuffer buffer , final int matchedLength , final int currentLength , final boolean ignoreCase ) { } }

implementation:
/* * Try and see if there is a possible match here ; there is if " fullword "
 * is true , in this case the next " matchedLength " argument to a possible
 * child call will be the current length . */
final int nextLength = fullWord ? currentLength : matchedLength ; /* * If there is nothing left in the buffer , we have a match . */
if ( ! buffer . hasRemaining ( ) ) return nextLength ; /* * OK , there is at least one character remaining , so pick it up and see
 * whether it is in the list of our children . . . */
char c = buffer . get ( ) ; int index = Arrays . binarySearch ( nextChars , c ) ; if ( index < 0 && ignoreCase ) { final boolean isUpper = Character . isUpperCase ( c ) ; final boolean isLower = Character . isLowerCase ( c ) ; if ( isUpper != isLower ) { c = isUpper ? Character . toLowerCase ( c ) : Character . toUpperCase ( c ) ; index = Arrays . binarySearch ( nextChars , c ) ; } } /* * If not , we return the last good match ; if yes , we call this same
 * method on the matching child node with the ( possibly new ) matched
 * length as an argument and a depth increased by 1. */
if ( index < 0 ) return nextLength ; return nextNodes [ index ] . doSearch ( buffer , nextLength , currentLength + 1 , ignoreCase ) ;


signature:
public class TrieBuilder { /** * Add one word to the trie
 * @ param word the word to add
 * @ return this
 * @ throws IllegalArgumentException word is empty */
public TrieBuilder addWord ( @ Nonnull final String word ) { } }

implementation: Objects . requireNonNull ( word ) ; final int length = word . length ( ) ; if ( length == 0 ) throw new IllegalArgumentException ( "a trie cannot have empty " + "strings (use EMPTY instead)" ) ; nrWords ++ ; maxLength = Math . max ( maxLength , length ) ; nodeBuilder . addWord ( word ) ; return this ;


signature:
public class ParserGenerator { /** * TODO : poor exception handling again */
private static void runMethodTransformers ( final ParserClassNode classNode ) throws Exception { } }

implementation:
// TODO : comment above may be right , but it ' s still dangerous
// iterate through all rule methods
// since the ruleMethods map on the classnode is a treemap we get the
// methods sorted by name which puts all super methods first ( since they
// are prefixed with one or more ' $ ' )
for ( final RuleMethod ruleMethod : classNode . getRuleMethods ( ) . values ( ) ) { if ( ruleMethod . hasDontExtend ( ) ) continue ; for ( final RuleMethodProcessor methodProcessor : PROCESSORS ) if ( methodProcessor . appliesTo ( classNode , ruleMethod ) ) methodProcessor . process ( classNode , ruleMethod ) ; } for ( final RuleMethod ruleMethod : classNode . getRuleMethods ( ) . values ( ) ) if ( ! ruleMethod . isGenerationSkipped ( ) ) classNode . methods . add ( ruleMethod ) ;


signature:
public class StringBuilderVar { /** * Appends the given char .
 * If this instance is currently uninitialized the given char is used for initialization .
 * @ param c the char to append
 * @ return true */
public boolean append ( final char c ) { } }

implementation: if ( get ( ) == null ) return set ( new StringBuilder ( ) . append ( c ) ) ; get ( ) . append ( c ) ; return true ;


signature:
public class Reference { /** * Replaces this references value with the given one .
 * @ param value the new value
 * @ return the previous value */
public final T getAndSet ( final T value ) { } }

implementation: final T ret = this . value ; this . value = value ; return ret ;


signature:
public class AsmUtils { /** * Get the class equivalent to an ASM { @ link Type }
 * @ param type the type
 * @ return the matching class */
public static Class < ? > getClassForType ( final Type type ) { } }

implementation:
Objects . requireNonNull ( type , "type" ) ; switch ( type . getSort ( ) ) { case Type . BOOLEAN : return boolean . class ; case Type . BYTE : return byte . class ; case Type . CHAR : return char . class ; case Type . DOUBLE : return double . class ; case Type . FLOAT : return float . class ; case Type . INT : return int . class ; case Type . LONG : return long . class ; case Type . SHORT : return short . class ; case Type . VOID : return void . class ; case Type . OBJECT : case Type . ARRAY : return CACHE . loadClass ( type . getInternalName ( ) ) ; // return getClassForInternalName ( type . getInternalName ( ) ) ;
} throw new IllegalStateException ( ) ; // should be unreachable


signature:
public class AsmUtils { /** * Determines whether the class with the given descriptor is assignable to
 * the given type .
 * @ param classInternalName the class descriptor
 * @ param type the type
 * @ return true if the class with the given descriptor is assignable to the
 * given type */
public static boolean isAssignableTo ( final String classInternalName , final Class < ? > type ) { } }

implementation:
Objects . requireNonNull ( classInternalName , "classInternalName" ) ; Objects . requireNonNull ( type , "type" ) ; final Class < ? > c = CACHE . loadClass ( classInternalName ) ; // final Class < ? > c = getClassForInternalName ( classInternalName ) ;
return type . isAssignableFrom ( c ) ;


signature:
public class ParserTransformer { /** * TODO : poor exception specification */
public static byte [ ] getByteCode ( final Class < ? > parserClass ) throws Exception { } }

implementation: final ParserClassNode node = extendParserClass ( parserClass ) ; return node . getClassCode ( ) ;


signature:
public class TracingListener { /** * MUST be called after copyInputText ! */
private void copyParseInfo ( final FileSystem zipfs ) throws IOException { } }

implementation: final Path path = zipfs . getPath ( INFO_PATH ) ; try ( final BufferedWriter writer = Files . newBufferedWriter ( path , UTF_8 ) ; ) { sb . setLength ( 0 ) ; sb . append ( startTime ) . append ( ';' ) . append ( prematchIndices . size ( ) ) . append ( ';' ) . append ( nextMatcherId ) . append ( ';' ) . append ( nrLines ) . append ( ';' ) . append ( nrChars ) . append ( ';' ) . append ( nrCodePoints ) . append ( ';' ) . append ( nextNodeId ) . append ( '\n' ) ; writer . append ( sb ) ; writer . flush ( ) ; }


signature:
public class InstructionGroupHasher { /** * Generate a hash of the group , use it to name it
 * @ param group the instruction group
 * @ param className this group ' s parent class name */
public static void hash ( @ Nonnull final InstructionGroup group , @ Nonnull final String className ) { } }

implementation: final InstructionGroupHasher groupHasher = new InstructionGroupHasher ( group , className ) ; final String name = groupHasher . hashAndGetName ( ) ; group . setName ( name ) ;


signature:
public class InstructionGroupHasher { /** * TODO : not very nice : / */
private String hashAndGetName ( ) { } }

implementation: group . getInstructions ( ) . accept ( this ) ; for ( final FieldNode node : group . getFields ( ) ) hasher . putObject ( node , FieldNodeFunnel . INSTANCE ) ; final byte [ ] hash = new byte [ 10 ] ; hasher . hash ( ) . writeBytesTo ( hash , 0 , 10 ) ; final String prefix = group . getRoot ( ) . isActionRoot ( ) ? "Action$" : "VarInit$" ; return prefix + BASE_ENCODING . encode ( hash ) ;


signature:
public class VarFramingMatcher { /** * Rule */
@ Override public Rule label ( final String label ) { } }

implementation: return new VarFramingMatcher ( inner . label ( label ) , variables ) ;


signature:
public class BaseParser { /** * Match a given character in a case - insensitive manner
 * @ param c the character to match
 * @ return a rule */
@ Cached @ DontLabel public Rule ignoreCase ( final char c ) { } }

implementation: return Character . isLowerCase ( c ) == Character . isUpperCase ( c ) ? ch ( c ) : new CharIgnoreCaseMatcher ( c ) ;


signature:
public class BaseParser { /** * Match one Unicode character
 * @ param codePoint the code point
 * @ return a rule */
@ Cached @ DontLabel public Rule unicodeChar ( final int codePoint ) { } }

implementation: if ( ! Character . isValidCodePoint ( codePoint ) ) throw new InvalidGrammarException ( "invalid code point " + codePoint ) ; return new CodePointMatcher ( codePoint ) ;


signature:
public class BaseParser { /** * Match a Unicode character range
 * < p > Note that this method will delegate to " regular " character matchers if
 * part of , or all of , the specified range is into the basic multilingual
 * plane . < / p >
 * @ param low the lower code point ( inclusive )
 * @ param high the upper code point ( inclusive )
 * @ return a rule */
@ Cached @ DontLabel public Rule unicodeRange ( final int low , final int high ) { } }

implementation: if ( ! Character . isValidCodePoint ( low ) ) throw new InvalidGrammarException ( "invalid code point " + low ) ; if ( ! Character . isValidCodePoint ( high ) ) throw new InvalidGrammarException ( "invalid code point " + high ) ; if ( low > high ) throw new InvalidGrammarException ( "invalid code point range: " + low + " > " + high ) ; return low == high ? new CodePointMatcher ( low ) : new CodePointRangeMatcher ( low , high ) ;


signature:
public class BaseParser { /** * Match an inclusive range of { @ code char } s
 * @ param cLow the start char of the range ( inclusively )
 * @ param cHigh the end char of the range ( inclusively )
 * @ return a rule */
@ Cached @ DontLabel public Rule charRange ( final char cLow , final char cHigh ) { } }

implementation: return cLow == cHigh ? ch ( cLow ) : new CharRangeMatcher ( cLow , cHigh ) ;


signature:
public class BaseParser { /** * Match any of the characters in the given string
 * < p > This method delegates to { @ link # anyOf ( Characters ) } . < / p >
 * @ param characters the characters
 * @ return a rule
 * @ see # anyOf ( Characters ) */
@ DontLabel public Rule anyOf ( final String characters ) { } }

implementation:
Objects . requireNonNull ( characters ) ; // TODO : see in this Characters class whether it is possible to wrap
return anyOf ( characters . toCharArray ( ) ) ;


signature:
public class BaseParser { /** * Match any character in the given { @ code char } array
 * < p > This method delegates to { @ link # anyOf ( Characters ) } . < / p >
 * @ param characters the characters
 * @ return a rule
 * @ see # anyOf ( Characters ) */
@ DontLabel public Rule anyOf ( final char [ ] characters ) { } }

implementation: Objects . requireNonNull ( characters ) ; switch ( characters . length ) { case 0 : throw new IllegalArgumentException ( "empty character array" ) ; case 1 : return ch ( characters [ 0 ] ) ; default : return anyOf ( Characters . of ( characters ) ) ; }


signature:
public class BaseParser { /** * Match any given character among a set of characters
 * < p > Both { @ link # anyOf ( char [ ] ) } and { @ link # anyOf ( String ) } ultimately
 * delegate to this method , which caches its resuls . < / p >
 * @ param characters the characters
 * @ return a new rule */
@ Cached @ DontLabel public Rule anyOf ( final Characters characters ) { } }

implementation: Objects . requireNonNull ( characters ) ; if ( ! characters . isSubtractive ( ) && characters . getChars ( ) . length == 1 ) return ch ( characters . getChars ( ) [ 0 ] ) ; if ( characters . equals ( Characters . NONE ) ) return NOTHING ; return new AnyOfMatcher ( characters ) ;


signature:
public class BaseParser { /** * Match any characters < em > except < / em > the ones contained in the strings
 * @ param characters the characters
 * @ return a rule */
@ DontLabel public Rule noneOf ( final String characters ) { } }

implementation: Objects . requireNonNull ( characters ) ; return noneOf ( characters . toCharArray ( ) ) ;


signature:
public class BaseParser { /** * Match all characters < em > except < / em > the ones in the { @ code char } array
 * given as an argument
 * @ param characters the characters
 * @ return a new rule */
@ DontLabel public Rule noneOf ( final char [ ] characters ) { } }

implementation: Objects . requireNonNull ( characters ) ; Preconditions . checkArgument ( characters . length > 0 ) ; return anyOf ( Characters . allBut ( characters ) ) ;


signature:
public class BaseParser { /** * Match a string literal
 * @ param string the string to match
 * @ return a rule */
@ DontLabel public Rule string ( final String string ) { } }

implementation: Objects . requireNonNull ( string ) ; return string ( string . toCharArray ( ) ) ;


signature:
public class BaseParser { /** * Match a given set of characters as a string literal
 * @ param characters the characters of the string to match
 * @ return a rule */
@ Cached @ DontLabel public Rule string ( final char ... characters ) { } }

implementation:
if ( characters . length == 1 ) return ch ( characters [ 0 ] ) ; // optimize one - char strings
return new StringMatcher ( new String ( characters ) ) ;


signature:
public class BaseParser { /** * Match a string literal in a case insensitive manner
 * @ param string the string to match
 * @ return a rule */
@ DontLabel public Rule ignoreCase ( final String string ) { } }

implementation: Objects . requireNonNull ( string ) ; return ignoreCase ( string . toCharArray ( ) ) ;


signature:
public class BaseParser { /** * Match a sequence of characters as a string literal ( case insensitive )
 * @ param characters the characters of the string to match
 * @ return a rule */
@ Cached @ DontLabel public Rule ignoreCase ( final char ... characters ) { } }

implementation:
if ( characters . length == 1 ) return ignoreCase ( characters [ 0 ] ) ; // optimize one - char strings
return new StringIgnoreCaseMatcher ( new String ( characters ) ) ;


signature:
public class BaseParser { /** * Match the longest possible string among a series of strings ( case
 * sensitive )
 * < p > As its name says , this rule will always try and match the longest
 * possible string among its arguments . It means that , for instance , if you
 * write : < / p >
 * < pre >
 * longestString ( " do " , " double " )
 * < / pre >
 * < p > then with an input of { @ code doubles } , then { @ code double } will be
 * matched ; but if the input is { @ code doubling } then { @ code do } is matched .
 * < p > This method builds a { @ link Collection } and delegates to { @ link
 * # longestString ( Collection ) } . < / p >
 * @ param first the first string to match
 * @ param second the second string to match
 * @ param others the other strings to match , if any
 * @ return a rule */
public Rule longestString ( final String first , final String second , final String ... others ) { } }

implementation: return trie ( first , second , others ) ;


signature:
public class BaseParser { /** * Match the longest possible string among a series of strings ( case
 * insensitive )
 * < p > As its name says , this rule will always try and match the longest
 * possible string among its arguments . It means that , for instance , if you
 * write : < / p >
 * < pre >
 * longestStringIgnoreCase ( " do " , " double " )
 * < / pre >
 * < p > then with an input of { @ code doubles } , then { @ code double } will be
 * matched ; but if the input is { @ code doubling } then { @ code do } is matched .
 * < p > This method builds a { @ link Collection } , and delegates to
 * { @ link # longestString ( Collection ) } . < / p >
 * @ param first the first string to match
 * @ param second the second string to match
 * @ param others the other strings to match , if any
 * @ return a rule */
public Rule longestStringIgnoreCase ( final String first , final String second , final String ... others ) { } }

implementation: return trieIgnoreCase ( first , second , others ) ;


signature:
public class BaseParser { /** * Match one string among many using a < a
 * href = " http : / / en . wikipedia . org / wiki / Trie " target = " _ blank " > trie < / a >
 * < p > This method delegates to { @ link # trie ( Collection ) } . < / p >
 * @ param first the first string
 * @ param second the second string
 * @ param others other strings
 * @ return a rule
 * @ see TrieMatcher
 * @ see TrieNode */
public Rule trie ( final String first , final String second , final String ... others ) { } }

implementation: final List < String > words = ImmutableList . < String > builder ( ) . add ( first ) . add ( second ) . add ( others ) . build ( ) ; return trie ( words ) ;


signature:
public class BaseParser { /** * Match one string among many using a < a
 * href = " http : / / en . wikipedia . org / wiki / Trie " target = " _ blank " > trie < / a > , case
 * insensitive version
 * < p > Duplicate elements will be silently eliminated . < / p >
 * < p > Note that order of elements does not matter , and that this rule will
 * always trie ( err , try ) and match the < em > longest possible sequence < / em > .
 * That is , if you build a rule with inputs " do " and " double " in this order
 * and the input text is " doubles " , then " double " will be matched . However ,
 * if the input text is " doubling " then " do " is matched instead . < / p >
 * < p > Note also that the minimum length of strings in a trie is 1 . < / p >
 * @ param strings the list of strings for this trie
 * @ return a rule
 * @ see CaseInsensitiveTrieMatcher */
@ Cached public Rule trieIgnoreCase ( final Collection < String > strings ) { } }

implementation: final List < String > list = ImmutableList . copyOf ( strings ) ; final TrieBuilder builder = Trie . newBuilder ( ) ; list . forEach ( builder :: addWord ) ; return new CaseInsensitiveTrieMatcher ( builder . build ( ) ) ;


signature:
public class BaseParser { /** * Match the first rule of a series of rules
 * < p > When one rule matches , all others are ignored . < / p >
 * < p > Note : if you are considering matching one string among many , consider
 * using { @ link # trie ( Collection ) } / { @ link # trie ( String , String , String . . . ) }
 * instead . < / p >
 * @ param rule the first subrule
 * @ param rule2 the second subrule
 * @ param moreRules the other subrules
 * @ return a rule */
@ DontLabel public Rule firstOf ( final Object rule , final Object rule2 , final Object ... moreRules ) { } }

implementation: Objects . requireNonNull ( moreRules ) ; final Object [ ] rules = ImmutableList . builder ( ) . add ( rule ) . add ( rule2 ) . add ( moreRules ) . build ( ) . toArray ( ) ; return firstOf ( rules ) ;


signature:
public class BaseParser { /** * Match the first rule of a series of rules
 * < p > When one rule matches , all others are ignored . < / p >
 * @ param rules the subrules
 * @ return a rule */
@ Cached @ DontLabel public Rule firstOf ( final Object [ ] rules ) { } }

implementation: Objects . requireNonNull ( rules , "rules" ) ; if ( rules . length == 1 ) return toRule ( rules [ 0 ] ) ; final Collection < String > strings = new ArrayList < > ( ) ; for ( final Object object : rules ) { if ( ! ( object instanceof String ) ) return new FirstOfMatcher ( toRules ( rules ) ) ; strings . add ( ( String ) object ) ; } return trie ( strings ) ;


signature:
public class BaseParser { /** * Try and match a rule zero or one time
 * < p > This rule therefore always succeeds . < / p >
 * @ param rule the subrule
 * @ return a rule */
@ Cached @ DontLabel public Rule optional ( final Object rule ) { } }

implementation: Objects . requireNonNull ( rule ) ; return new OptionalMatcher ( toRule ( rule ) ) ;


signature:
public class BaseParser { /** * Try and match a given set of rules once
 * < p > This rule will therefore never fail . < / p >
 * @ param rule the first subrule
 * @ param rule2 the second subrule
 * @ param moreRules the other subrules
 * @ return a rule */
@ DontLabel public Rule optional ( final Object rule , final Object rule2 , final Object ... moreRules ) { } }

implementation: Objects . requireNonNull ( moreRules ) ; return optional ( sequence ( rule , rule2 , moreRules ) ) ;


signature:
public class BaseParser { /** * Match a given set of rules , exactly once
 * @ param rule the first subrule
 * @ param rule2 the second subrule
 * @ param moreRules the other subrules
 * @ return a rule */
@ DontLabel public Rule sequence ( final Object rule , final Object rule2 , final Object ... moreRules ) { } }

implementation: final Object [ ] rules = ImmutableList . builder ( ) . add ( rule ) . add ( rule2 ) . add ( moreRules ) . build ( ) . toArray ( ) ; return sequence ( rules ) ;


signature:
public class BaseParser { /** * Match a given set of rules , exactly once
 * @ param rules the rules
 * @ return a rule */
@ Cached @ DontLabel public Rule sequence ( final Object [ ] rules ) { } }

implementation: Objects . requireNonNull ( rules ) ; return rules . length == 1 ? toRule ( rules [ 0 ] ) : new SequenceMatcher ( toRules ( rules ) ) ;


signature:
public class BaseParser { /** * Kickstart a { @ code join } rule
 * < p > Usages : < / p >
 * < pre >
 * return join ( rule ( ) ) . using ( otherRule ( ) ) . times ( n ) ;
 * return join ( rule ( ) ) . using ( otherRule ( ) ) . min ( n ) ;
 * < / pre >
 * < p > etc . See { @ link JoinMatcherBuilder } for more possible constructs . < / p >
 * @ param rule the joined rule ( must not match an empty sequence ! )
 * @ return a { @ link JoinMatcherBootstrap }
 * @ see JoinMatcherBootstrap # using ( Object ) */
@ DontLabel public final JoinMatcherBootstrap < V , BaseParser < V > > join ( final Object rule ) { } }

implementation: final Rule matcher = toRule ( rule ) ; return new JoinMatcherBootstrap < > ( this , matcher ) ;


signature:
public class BaseParser { /** * Kickstart a { @ code join } rule
 * < p > Like { @ link # join ( Object ) } , except that several rules are accepted as
 * arguments . < / p >
 * @ param rule first rule
 * @ param rule2 second rule
 * @ param moreRules other rules
 * @ return a { @ link JoinMatcherBootstrap }
 * @ see # sequence ( Object , Object , Object . . . ) */
@ DontLabel public final JoinMatcherBootstrap < V , BaseParser < V > > join ( final Object rule , final Object rule2 , final Object ... moreRules ) { } }

implementation: Objects . requireNonNull ( moreRules ) ; return join ( sequence ( rule , rule2 , moreRules ) ) ;


signature:
public class BaseParser { /** * Kickstart a repeat rule
 * < p > Like { @ link # repeat ( Object ) } , except several rules are accepted as
 * arguments . < / p >
 * @ param rule first rule
 * @ param rule2 second rule
 * @ param moreRules other rules
 * @ return a rule
 * @ see # sequence ( Object , Object , Object . . . ) */
@ DontLabel public final RepeatMatcherBuilder < V > repeat ( final Object rule , final Object rule2 , final Object ... moreRules ) { } }

implementation: Objects . requireNonNull ( moreRules ) ; return repeat ( sequence ( rule , rule2 , moreRules ) ) ;


signature:
public class BaseParser { /** * Try and match a set of rules zero or more times
 * < p > This is an alias for { @ code repeat ( rule , rule2 , . . . ) . min ( 0 ) } . < / p >
 * @ param rule the first subrule
 * @ param rule2 the second subrule
 * @ param moreRules the other subrules
 * @ return a rule */
@ DontLabel public Rule zeroOrMore ( final Object rule , final Object rule2 , final Object ... moreRules ) { } }

implementation: return repeat ( rule , rule2 , moreRules ) . min ( 0 ) ;


signature:
public class BaseParser { /** * Convert a string literal to a parser rule
 * @ param string the string
 * @ return the rule */
@ DontExtend protected Rule fromStringLiteral ( final String string ) { } }

implementation: Objects . requireNonNull ( string ) ; return fromCharArray ( string . toCharArray ( ) ) ;


signature:
public class BaseParser { /** * Convert the given object array to an array of rules
 * @ param objects the objects to convert
 * @ return the rules corresponding to the given objects */
@ DontExtend public Rule [ ] toRules ( final Object ... objects ) { } }

implementation: return Arrays . stream ( objects ) . map ( this :: toRule ) . toArray ( Rule [ ] :: new ) ;


signature:
public class BaseParser { /** * Converts the given object to a rule
 * @ param obj the object to convert
 * @ return the rule corresponding to the given object */
@ DontExtend public Rule toRule ( final Object obj ) { } }

implementation: Objects . requireNonNull ( obj ) ; if ( obj instanceof Rule ) return ( Rule ) obj ; if ( obj instanceof Character ) return fromCharLiteral ( ( Character ) obj ) ; if ( obj instanceof String ) return fromStringLiteral ( ( String ) obj ) ; if ( obj instanceof char [ ] ) return fromCharArray ( ( char [ ] ) obj ) ; if ( obj instanceof Action ) { final Action < ? > action = ( Action < ? > ) obj ; return new ActionMatcher ( action ) ; } final String errmsg = obj instanceof Boolean ? "unwrapped Boolean value in rule (wrap it with ACTION())" : "'" + obj + "' cannot be automatically converted to a rule" ; throw new InvalidGrammarException ( errmsg ) ;


signature:
public class BaseActions { /** * Inserts the given value a given number of elements below the current top
 * of the value stack
 * @ param down the number of elements to skip before inserting the value ( 0
 * being equivalent to { @ code push ( value ) } )
 * @ param value the value
 * @ return true
 * @ throws IllegalArgumentException the stack does not contain enough
 * elements to perform this operation */
public boolean push ( final int down , final V value ) { } }

implementation: check ( ) ; context . getValueStack ( ) . push ( down , value ) ; return true ;


signature:
public class BaseActions { /** * Removes the value at the top of the value stack and casts it before
 * returning it
 * @ param c the class to cast to
 * @ param < E > type of the class
 * @ return the current top value
 * @ throws IllegalArgumentException the stack is empty
 * @ see # pop ( ) */
public < E extends V > E popAs ( @ Nonnull final Class < E > c ) { } }

implementation: return c . cast ( pop ( ) ) ;


signature:
public class BaseActions { /** * Removes the value the given number of elements below the top of the value
 * stack and casts it before returning it
 * @ param c the class to cast to
 * @ param down the number of elements to skip before removing the value ( 0
 * being equivalent to { @ code pop ( ) } )
 * @ param < E > type of the class
 * @ return the value
 * @ throws IllegalArgumentException the stack does not contain enough
 * elements to perform this operation
 * @ see # pop ( int ) */
public < E extends V > E popAs ( final Class < E > c , final int down ) { } }

implementation: return c . cast ( pop ( down ) ) ;


signature:
public class BaseActions { /** * Returns and casts the value at the top of the value stack without
 * removing it
 * @ param c the class to cast to
 * @ param < E > type of the class
 * @ return the value
 * @ see # peek ( ) */
public < E extends V > E peekAs ( final Class < E > c ) { } }

implementation: return c . cast ( peek ( ) ) ;


signature:
public class BaseActions { /** * Replaces the element the given number of elements below the current top
 * of the value stack
 * @ param down the number of elements to skip before replacing the value ( 0
 * being equivalent to { @ code poke ( value ) } )
 * @ param value the value to replace with
 * @ return true
 * @ throws IllegalArgumentException the stack does not contain enough
 * elements to perform this operation */
public boolean poke ( final int down , final V value ) { } }

implementation: check ( ) ; context . getValueStack ( ) . poke ( down , value ) ; return true ;


signature:
public class ParseRunner { /** * Internal method . DO NOT USE !
 * @ param context the MatcherContext
 * @ param < T > type parameter of the values on the parser stack
 * @ return true on a match ; false otherwise */
@ Override public < T > boolean match ( final MatcherContext < T > context ) { } }

implementation:
final Matcher matcher = context . getMatcher ( ) ; final PreMatchEvent < T > preMatchEvent = new PreMatchEvent < > ( context ) ; bus . post ( preMatchEvent ) ; if ( throwable != null ) throw new GrappaException ( "parsing listener error (before match)" , throwable ) ; // FIXME : is there any case at all where context . getMatcher ( ) is null ?
@ SuppressWarnings ( "ConstantConditions" ) final boolean match = matcher . match ( context ) ; final MatchContextEvent < T > postMatchEvent = match ? new MatchSuccessEvent < > ( context ) : new MatchFailureEvent < > ( context ) ; bus . post ( postMatchEvent ) ; if ( throwable != null ) throw new GrappaException ( "parsing listener error (after match)" , throwable ) ; return match ;


signature:
public class IndexRange { /** * Determines whether this range overlaps with the given other one .
 * @ param other the other range
 * @ return true if there is at least one index that is contained in both ranges */
public boolean overlapsWith ( final IndexRange other ) { } }

implementation: Objects . requireNonNull ( other , "other" ) ; return end > other . start && other . end > start ;


signature:
public class IndexRange { /** * Determines whether this range immediated follows or precedes the given other one .
 * @ param other the other range
 * @ return true if this range immediated follows or precedes the given other one . */
public boolean touches ( final IndexRange other ) { } }

implementation: Objects . requireNonNull ( other , "other" ) ; return other . end == start || end == other . start ;


signature:
public class IndexRange { /** * Created a new IndexRange that spans all characters between the smallest and the highest index of the two ranges .
 * @ param other the other range
 * @ return a new IndexRange instance */
public IndexRange mergedWith ( final IndexRange other ) { } }

implementation: Objects . requireNonNull ( other , "other" ) ; return new IndexRange ( Math . min ( start , other . start ) , Math . max ( end , other . end ) ) ;


signature:
public class JoinMatcher { /** * Tries a match on the given MatcherContext .
 * @ param context the MatcherContext
 * @ return true if the match was successful */
@ Override public final < V > boolean match ( final MatcherContext < V > context ) { } }

implementation:
/* * TODO ! Check logic
 * At this point , if we have enough cycles , we can ' t determined whether
 * our joining rule would match empty . . . Which is illegal . */
int cycles = 0 ; if ( ! joined . getSubContext ( context ) . runMatcher ( ) ) return enoughCycles ( cycles ) ; cycles ++ ; Object snapshot = context . getValueStack ( ) . takeSnapshot ( ) ; int beforeCycle = context . getCurrentIndex ( ) ; while ( runAgain ( cycles ) && matchCycle ( context , beforeCycle ) ) { beforeCycle = context . getCurrentIndex ( ) ; snapshot = context . getValueStack ( ) . takeSnapshot ( ) ; cycles ++ ; } context . getValueStack ( ) . restoreSnapshot ( snapshot ) ; context . setCurrentIndex ( beforeCycle ) ; return enoughCycles ( cycles ) ;


signature:
public class Grappa { /** * < p > Creates a parser object whose rule creation methods can then be used
 * with one of the { @ link ParseRunner } implementations . < / p >
 * < p > Since parboiled needs to extend your parser with certain extra logic
 * ( e . g . to prevent infinite recursions in recursive rule definitions ) you
 * cannot create your parser object yourself , but have to go through this
 * method . Also your parser class has to be derived from { @ link BaseParser } .
 * If you want to use a non - default constructor you can provide its
 * arguments to this method . Make sure your non - default constructor does not
 * use primitive type parameters ( like " int " ) but rather their boxed
 * counterparts ( like " Integer " ) , otherwise the constructor will not be
 * found . < / p >
 * < p > Performing the rule analysis and extending the parser class is an
 * expensive process ( time - wise ) and can take up to several hundred
 * milliseconds for large grammars . However , this cost is only incurred once
 * per parser class and class loader . Subsequent calls to this method are
 * therefore fast once the initial extension has been performed . < / p >
 * @ param parserClass the type of the parser to create
 * @ param constructorArgs optional arguments to the parser class constructor
 * @ return the ready to use parser instance */
public static < P extends BaseParser < V > , V > P createParser ( @ Nonnull final Class < P > parserClass , final Object ... constructorArgs ) { } }

implementation:
Objects . requireNonNull ( parserClass , "parserClass" ) ; try { final Class < ? > extendedClass = ParserTransformer . transformParser ( parserClass ) ; final Constructor < ? > constructor = findConstructor ( extendedClass , constructorArgs ) ; @ SuppressWarnings ( "unchecked" ) final P ret = ( P ) constructor . newInstance ( constructorArgs ) ; return ret ; } catch ( Exception e ) { // TODO : catch better than Exception
throw new RuntimeException ( "Error creating extended parser class: " + e . getMessage ( ) , e ) ; }


signature:
public class Grappa { /** * Generate the byte code of a transformed parser class
 * < p > When you create a parser using { @ link
 * # createParser ( Class , Object . . . ) } , Parboiled generates a new class which
 * is the one you actually use for parsing . This method allows to get the
 * byte code of such a generated class in a byte array . < / p >
 * @ param parserClass the parser class
 * @ param < P > class of the parser
 * @ param < V > see { @ link BaseParser }
 * @ return the byte code
 * @ throws RuntimeException byte code generation failure
 * @ see ParserTransformer # getByteCode ( Class ) */
public static < P extends BaseParser < V > , V > byte [ ] getByteCode ( final Class < P > parserClass ) { } }

implementation: try { return ParserTransformer . getByteCode ( parserClass ) ; } catch ( Exception e ) { throw new RuntimeException ( "failed to generate byte code" , e ) ; }


signature:
public class TrieNodeBuilder { /** * Add a word
 * < p > Here also , a { @ link CharBuffer } is used , which changes position as we
 * progress into building the tree , character by character , node by node .
 * < p > If the buffer is " empty " when entering this method , it means a match
 * must be recorded ( see { @ link # fullWord } ) . < / p >
 * @ param buffer the buffer ( never null ) */
private void doAddWord ( final CharBuffer buffer ) { } }

implementation: if ( ! buffer . hasRemaining ( ) ) { fullWord = true ; return ; } final char c = buffer . get ( ) ; TrieNodeBuilder builder = subnodes . get ( c ) ; if ( builder == null ) { builder = new TrieNodeBuilder ( ) ; subnodes . put ( c , builder ) ; } builder . doAddWord ( buffer ) ;


signature:
public class ProxyMatcher { /** * Retrieves the innermost Matcher that is not a ProxyMatcher .
 * @ param matcher the matcher to unwrap
 * @ return the given instance if it is not a ProxyMatcher , otherwise the innermost non - proxy Matcher */
public static Matcher unwrap ( final Matcher matcher ) { } }

implementation: if ( matcher instanceof ProxyMatcher ) { final ProxyMatcher proxyMatcher = ( ProxyMatcher ) matcher ; if ( proxyMatcher . dirty ) proxyMatcher . apply ( ) ; return proxyMatcher . target == null ? proxyMatcher : proxyMatcher . target ; } return matcher ;


signature:
public class TrieMatcher { /** * Tries a match on the given MatcherContext .
 * @ param context the MatcherContext
 * @ return true if the match was successful */
@ Override public < V > boolean match ( final MatcherContext < V > context ) { } }

implementation:
/* * Since the trie knows about the length of its possible longest match ,
 * extract that many characters from the buffer . Remind that . extract ( )
 * will adjust illegal indices automatically . */
final int maxLength = trie . getMaxLength ( ) ; final int index = context . getCurrentIndex ( ) ; final String input = context . getInputBuffer ( ) . extract ( index , index + maxLength ) ; /* * We now just have to trie and search . . . ( pun intended ) */
final int ret = trie . search ( input , false ) ; if ( ret == - 1 ) return false ; /* * and since the result , when positive , is the length of the match ,
 * advance the index in the buffer by that many positions . */
context . advanceIndex ( ret ) ; return true ;


signature:
public class EventBusParser { /** * Register a listener to the event bus
 * @ param listener the listener
 * @ return always true
 * @ see EventBus # register ( Object ) */
public final boolean register ( @ Nonnull final Object listener ) { } }

implementation: bus . register ( Objects . requireNonNull ( listener ) ) ; return true ;


signature:
public class EventBusParser { /** * Post an arbitrary , non null , object on the bus
 * @ param object the object ( must not be null )
 * @ return always true */
public final boolean post ( @ Nonnull final Object object ) { } }

implementation: Objects . requireNonNull ( object ) ; bus . post ( object ) ; return true ;


signature:
public class JoinMatcherBootstrap { /** * Define the joining rule
 * @ param joining the rule
 * @ return a new { @ link JoinMatcherBuilder }
 * @ see BaseParser # toRule ( Object ) */
public JoinMatcherBuilder < V > using ( @ Nonnull final Object joining ) { } }

implementation: return new JoinMatcherBuilder < > ( joined , parser , parser . toRule ( joining ) ) ;


signature:
public class JoinMatcherBootstrap { /** * Define the joining rule
 * < p > Like { @ link # using ( Object ) } , except several rules are accepted as
 * arguments . < / p >
 * @ param rule first rule
 * @ param rule2 second rule
 * @ param moreRules other rules
 * @ return a new { @ link JoinMatcherBuilder }
 * @ see BaseParser # sequence ( Object , Object , Object . . . ) */
public JoinMatcherBuilder < V > using ( final Object rule , final Object rule2 , final Object ... moreRules ) { } }

implementation: return using ( parser . sequence ( rule , rule2 , moreRules ) ) ;


signature:
public class AbstractMatcher { /** * default implementation is to simply delegate to the context */
@ Override public < V > MatcherContext < V > getSubContext ( final MatcherContext < V > context ) { } }

implementation: return context . getSubContext ( this ) ;


signature:
public class RangeMatcherBuilder { /** * Return a rule with a minimum number of cycles to run
 * @ param nrCycles the number of cycles
 * @ return a rule
 * @ throws IllegalArgumentException { @ code nrCycles } is less than 0
 * @ see Range # atLeast ( Comparable ) */
public Rule min ( final int nrCycles ) { } }

implementation: Preconditions . checkArgument ( nrCycles >= 0 , "illegal repetition number specified (" + nrCycles + "), must be 0 or greater" ) ; return range ( Range . atLeast ( nrCycles ) ) ;


signature:
public class RangeMatcherBuilder { /** * Return a rule with a maximum number of cycles to run
 * @ param nrCycles the number of cycles
 * @ return a rule
 * @ throws IllegalArgumentException { @ code nrCycles } is less than 0
 * @ see Range # atMost ( Comparable ) */
public Rule max ( final int nrCycles ) { } }

implementation: Preconditions . checkArgument ( nrCycles >= 0 , "illegal repetition number specified (" + nrCycles + "), must be 0 or greater" ) ; return range ( Range . atMost ( nrCycles ) ) ;


signature:
public class RangeMatcherBuilder { /** * Return a rule with an exact number of cycles to run
 * @ param nrCycles the number of cycles
 * @ return a rule
 * @ throws IllegalArgumentException { @ code nrCycles } is less than 0
 * @ see Range # singleton ( Comparable ) */
public Rule times ( final int nrCycles ) { } }

implementation: Preconditions . checkArgument ( nrCycles >= 0 , "illegal repetition number specified (" + nrCycles + "), must be 0 or greater" ) ; return range ( Range . singleton ( nrCycles ) ) ;


signature:
public class RangeMatcherBuilder { /** * Return a rule with both lower and upper bounds on the number of cycles
 * < p > Note that the range of cycles to run is closed on both ends ( that is ,
 * the minimum and maximum number of cycles ) are < strong > inclusive < / strong > .
 * @ param minCycles the minimum number of cycles
 * @ param maxCycles the maximum number of cycles
 * @ return a rule
 * @ throws IllegalArgumentException minimum number of cycles is negative ; or
 * maximum number of cycles is less than the minimum
 * @ see Range # closed ( Comparable , Comparable ) */
public Rule times ( final int minCycles , final int maxCycles ) { } }

implementation: Preconditions . checkArgument ( minCycles >= 0 , "illegal repetition number specified (" + minCycles + "), must be 0 or greater" ) ; Preconditions . checkArgument ( maxCycles >= minCycles , "illegal range specified (" + minCycles + ", " + maxCycles + "): maximum must be greater than minimum" ) ; return range ( Range . closed ( minCycles , maxCycles ) ) ;


signature:
public class RangeMatcherBuilder { /** * Core method for building a repeating matcher
 * < p > This is the method which all other methods ( min , max , times ) delegate
 * to ; among other things it is responsible for the logic of simplifying
 * matchers where possible . < / p >
 * < p > The simplifications are as follows : < / p >
 * < ul >
 * < li > [ 0 . . 0 ] : returns an { @ link EmptyMatcher } ; < / li >
 * < li > [ 0 . . 1 ] : returns an { @ link OptionalMatcher } with the rule as a
 * submatcher ; < / li >
 * < li > [ 1 . . 1 ] : returns the rule itself . < / li >
 * < / ul >
 * < p > If none of these apply , this method delegates as follows : < / p >
 * < ul >
 * < li > [ n . . + ∞ ) for whatever n : delegates to { @ link # boundedDown ( int ) } ;
 * < / li >
 * < li > [ 0 . . n ] for n & gt ; = 2 : delegates to { @ link # boundedUp ( int ) } ; < / li >
 * < li > [ n . . n ] for n & gt ; = 2 : delegates to { @ link # exactly ( int ) } ; < / li >
 * < li > [ n . . m ] with 0 & lt ; n & lt ; m : delegates to { @ link
 * # boundedBoth ( int , int ) } . < / li >
 * < / ul >
 * @ param range the range
 * @ return the final resulting rule */
@ Cached @ DontLabel public Rule range ( final Range < Integer > range ) { } }

implementation:
Objects . requireNonNull ( range , "range must not be null" ) ; final Range < Integer > realRange = normalizeRange ( range ) ; /* * We always have a lower bound */
final int lowerBound = realRange . lowerEndpoint ( ) ; /* * Handle the case where there is no upper bound */
if ( ! realRange . hasUpperBound ( ) ) return boundedDown ( lowerBound ) ; /* * There is an upper bound . Handle the case where it is 0 or 1 . Since
 * the range is legal , we know that if it is 0 , so is the lowerbound ;
 * and if it is one , the lower bound is either 0 or 1. */
final int upperBound = realRange . upperEndpoint ( ) ; if ( upperBound == 0 ) return parser . empty ( ) ; if ( upperBound == 1 ) return lowerBound == 0 ? parser . optional ( rule ) : rule ; /* * So , upper bound is 2 or greater ; return the appropriate matcher
 * according to what the lower bound is .
 * Also , if the lower and upper bounds are equal , return a matcher doing
 * a fixed number of matches . */
if ( lowerBound == 0 ) return boundedUp ( upperBound ) ; return lowerBound == upperBound ? exactly ( lowerBound ) : boundedBoth ( lowerBound , upperBound ) ;


signature:
public class Characters { /** * Creates a new Characters instance containing only the given chars .
 * @ param chars the chars
 * @ return a new Characters object */
public static Characters of ( final char ... chars ) { } }

implementation: final int length = chars . length ; if ( length == 0 ) return NONE ; final char [ ] array = Arrays . copyOf ( chars , length ) ; Arrays . sort ( array ) ; return new Characters ( false , array ) ;


signature:
public class Characters { /** * Creates a new Characters instance containing only the given chars .
 * @ param chars the chars
 * @ return a new Characters object */
public static Characters of ( final String chars ) { } }

implementation: return chars . isEmpty ( ) ? NONE : of ( chars . toCharArray ( ) ) ;


signature:
public class Characters { /** * Creates a new Characters instance containing all characters minus the given ones .
 * @ param chars the chars to NOT include
 * @ return a new Characters object */
public static Characters allBut ( final char ... chars ) { } }

implementation: final int length = chars . length ; if ( length == 0 ) return ALL ; final char [ ] array = Arrays . copyOf ( chars , length ) ; Arrays . sort ( array ) ; return new Characters ( true , array ) ;


signature:
public class Plugins { /** * Gets the value of the deploymentDescriptor property .
 * This accessor method returns a reference to the live list ,
 * not a snapshot . Therefore any modification you make to the
 * returned list will be present inside the JAXB object .
 * This is why there is not a < CODE > set < / CODE > method for the deploymentDescriptor property .
 * For example , to add a new item , do as follows :
 * < pre >
 * getDeploymentDescriptor ( ) . add ( newItem ) ;
 * < / pre >
 * Objects of the following type ( s ) are allowed in the list
 * { @ link JAXBElement } { @ code < } { @ link DeploymentDescriptorFactory } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link Modules } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link DeploymentDescriptorType } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link StartAsOneOf } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link CustomTSMPlugInConfiguration } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link DiffExcludeFilter } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link ClassLoaderExtension } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link RequiresAuthentication } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link NameValuePairs } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link SupportsFaultTolerance } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link RequiredComponents } { @ code > } */
public List < JAXBElement < ? extends DeploymentDescriptorType > > getDeploymentDescriptor ( ) { } }

implementation: if ( deploymentDescriptor == null ) { deploymentDescriptor = new ArrayList < JAXBElement < ? extends DeploymentDescriptorType > > ( ) ; } return this . deploymentDescriptor ;


signature:
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link CookieAuthenticationConfiguration } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.tibco.com/xmlns/authentication" , name = "CookieAuthenticationConfiguration" , substitutionHeadNamespace = "http://www.tibco.com/xmlns/authentication" , substitutionHeadName = "AuthenticationConfiguration" ) public JAXBElement < CookieAuthenticationConfiguration > createCookieAuthenticationConfiguration ( CookieAuthenticationConfiguration value ) { } }

implementation: return new JAXBElement < CookieAuthenticationConfiguration > ( _CookieAuthenticationConfiguration_QNAME , CookieAuthenticationConfiguration . class , null , value ) ;


signature:
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link URLAuthenticationConfiguration } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.tibco.com/xmlns/authentication" , name = "URLAuthenticationConfiguration" , substitutionHeadNamespace = "http://www.tibco.com/xmlns/authentication" , substitutionHeadName = "AuthenticationConfiguration" ) public JAXBElement < URLAuthenticationConfiguration > createURLAuthenticationConfiguration ( URLAuthenticationConfiguration value ) { } }

implementation: return new JAXBElement < URLAuthenticationConfiguration > ( _URLAuthenticationConfiguration_QNAME , URLAuthenticationConfiguration . class , null , value ) ;


signature:
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link RequiresAuthentication } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.tibco.com/xmlns/authentication" , name = "RequiresAuthentication" , substitutionHeadNamespace = "http://www.tibco.com/xmlns/dd" , substitutionHeadName = "DeploymentDescriptor" ) public JAXBElement < RequiresAuthentication > createRequiresAuthentication ( RequiresAuthentication value ) { } }

implementation: return new JAXBElement < RequiresAuthentication > ( _RequiresAuthentication_QNAME , RequiresAuthentication . class , null , value ) ;


signature:
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link WebServerAuthenticationConfiguration } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.tibco.com/xmlns/authentication" , name = "WebServerAuthenticationConfiguration" , substitutionHeadNamespace = "http://www.tibco.com/xmlns/authentication" , substitutionHeadName = "AuthenticationConfiguration" ) public JAXBElement < WebServerAuthenticationConfiguration > createWebServerAuthenticationConfiguration ( WebServerAuthenticationConfiguration value ) { } }

implementation: return new JAXBElement < WebServerAuthenticationConfiguration > ( _WebServerAuthenticationConfiguration_QNAME , WebServerAuthenticationConfiguration . class , null , value ) ;


signature:
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link HttpSessionAuthenticationConfiguration } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.tibco.com/xmlns/authentication" , name = "HttpSessionAuthenticationConfiguration" , substitutionHeadNamespace = "http://www.tibco.com/xmlns/authentication" , substitutionHeadName = "AuthenticationConfiguration" ) public JAXBElement < HttpSessionAuthenticationConfiguration > createHttpSessionAuthenticationConfiguration ( HttpSessionAuthenticationConfiguration value ) { } }

implementation: return new JAXBElement < HttpSessionAuthenticationConfiguration > ( _HttpSessionAuthenticationConfiguration_QNAME , HttpSessionAuthenticationConfiguration . class , null , value ) ;


signature:
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link CustomAuthenticationConfiguration } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.tibco.com/xmlns/authentication" , name = "CustomAuthenticationConfiguration" , substitutionHeadNamespace = "http://www.tibco.com/xmlns/authentication" , substitutionHeadName = "AuthenticationConfiguration" ) public JAXBElement < CustomAuthenticationConfiguration > createCustomAuthenticationConfiguration ( CustomAuthenticationConfiguration value ) { } }

implementation: return new JAXBElement < CustomAuthenticationConfiguration > ( _CustomAuthenticationConfiguration_QNAME , CustomAuthenticationConfiguration . class , null , value ) ;


signature:
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link AuthenticationConfigurationType } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.tibco.com/xmlns/authentication" , name = "AuthenticationConfiguration" ) public JAXBElement < AuthenticationConfigurationType > createAuthenticationConfiguration ( AuthenticationConfigurationType value ) { } }

implementation: return new JAXBElement < AuthenticationConfigurationType > ( _AuthenticationConfiguration_QNAME , AuthenticationConfigurationType . class , null , value ) ;


signature:
public class Authentications { /** * Gets the value of the authenticationConfiguration property .
 * This accessor method returns a reference to the live list ,
 * not a snapshot . Therefore any modification you make to the
 * returned list will be present inside the JAXB object .
 * This is why there is not a < CODE > set < / CODE > method for the authenticationConfiguration property .
 * For example , to add a new item , do as follows :
 * < pre >
 * getAuthenticationConfiguration ( ) . add ( newItem ) ;
 * < / pre >
 * Objects of the following type ( s ) are allowed in the list
 * { @ link JAXBElement } { @ code < } { @ link CookieAuthenticationConfiguration } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link URLAuthenticationConfiguration } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link CustomAuthenticationConfiguration } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link WebServerAuthenticationConfiguration } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link AuthenticationConfigurationType } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link HttpSessionAuthenticationConfiguration } { @ code > } */
public List < JAXBElement < ? extends AuthenticationConfigurationType > > getAuthenticationConfiguration ( ) { } }

implementation: if ( authenticationConfiguration == null ) { authenticationConfiguration = new ArrayList < JAXBElement < ? extends AuthenticationConfigurationType > > ( ) ; } return this . authenticationConfiguration ;


signature:
public class AbstractDocMojo { /** * @ throws JAXBException */
protected String getDescription ( File f ) throws JAXBException { } }

implementation: ProcessModel pm = new ProcessModel ( f ) ; String description = pm . getProcess ( ) . getDescription ( ) ; return description ;


signature:
public class ApplicationManagement { /** * This will initialize the { @ link ApplicationType } object which is a JAXB
 * representation of the " application " root - element of TIBCO XML Deployment
 * Descriptor files using the schema with
 * " http : / / www . tibco . com / xmlns / ApplicationManagement " namespace .
 * @ throws JAXBException */
private void initApplication ( ) throws JAXBException { } }

implementation:
jaxbContext = JAXBContext . newInstance ( com . tibco . xmlns . applicationmanagement . ObjectFactory . class , com . tibco . xmlns . applicationmanagement . bw . ObjectFactory . class , com . tibco . xmlns . dd . ObjectFactory . class ) ; Unmarshaller jaxbUnmarshaller = jaxbContext . createUnmarshaller ( ) ; Object o = jaxbUnmarshaller . unmarshal ( xmlFile ) ; try { this . application = ( ApplicationType ) o ; } catch ( ClassCastException e ) { // strange workaround : sometimes we get an ApplicationType object ,
// sometimes a JAXBElement < ApplicationType > object
@ SuppressWarnings ( "unchecked" ) JAXBElement < ApplicationType > j = ( JAXBElement < ApplicationType > ) o ; this . application = j . getValue ( ) ; }


signature:
public class ApplicationManagement { /** * This method retrieves the list of objects of type " BWServiceType " . */
private List < Bw > getBWServices ( ) { } }

implementation: List < Bw > result = new ArrayList < Bw > ( ) ; for ( JAXBElement < ? extends ServiceType > jaxbElement : application . getServices ( ) . getBaseService ( ) ) { if ( jaxbElement . getName ( ) . getLocalPart ( ) . equals ( "bw" ) ) { result . add ( ( Bw ) jaxbElement . getValue ( ) ) ; } } return result ;


signature:
public class ApplicationManagement { /** * This method retrieves { @ link Bwprocesses } object from Bw . getRest ( ) objects */
private Bwprocesses getBWProcesses ( Bw bwService ) { } }

implementation: for ( Object o : bwService . getRest ( ) ) { if ( o . getClass ( ) . equals ( Bwprocesses . class ) ) { return ( Bwprocesses ) o ; } } return null ;


signature:
public class ApplicationManagement { /** * This method retrieves { @ link Checkpoints } object from Bw . getRest ( ) objects */
private Checkpoints getBWCheckpoints ( Bw bwService ) { } }

implementation: for ( Object o : bwService . getRest ( ) ) { if ( o . getClass ( ) . equals ( Checkpoints . class ) ) { return ( Checkpoints ) o ; } } return null ;


signature:
public class ApplicationManagement { /** * This method retrieves { @ link FaultTolerant } object from Bw . getRest ( )
 * objects */
private FaultTolerant getBWFaultTolerant ( Bw bwService ) { } }

implementation: for ( Object o : bwService . getRest ( ) ) { if ( o . getClass ( ) . equals ( FaultTolerant . class ) ) { return ( FaultTolerant ) o ; } } return null ;


signature:
public class ApplicationManagement { /** * This method retrieves " isFt " property from Bw . getRest ( ) objects */
private Boolean isIsFt ( Bw bw ) { } }

implementation:
Boolean value = false ; // default to false ( ? )
for ( Object o : bw . getRest ( ) ) { if ( o . getClass ( ) . equals ( JAXBElement . class ) ) { // should never be other than Boolean according to
// com . tibco . xmlns . applicationmanagement . BWServiceType
@ SuppressWarnings ( "unchecked" ) JAXBElement < Boolean > e = ( JAXBElement < Boolean > ) o ; value = e . getValue ( ) ; } } return value ;


signature:
public class ApplicationManagement { /** * This method sets " isFt " property in Bw . getRest ( ) objects */
private void setIsFt ( Bw bw , Boolean value ) { } }

implementation:
for ( Object o : bw . getRest ( ) ) { if ( o . getClass ( ) . equals ( JAXBElement . class ) ) { // should never be other than Boolean according to
// com . tibco . xmlns . applicationmanagement . BWServiceType
@ SuppressWarnings ( "unchecked" ) JAXBElement < Boolean > e = ( JAXBElement < Boolean > ) o ; e . setValue ( value ) ; } }


signature:
public class ApplicationManagement { /** * The Global Variables are inside the NVPairs element with @ name attribute
 * equals to " Global Variables " at the root level .
 * @ return The Global Variables of the xmlFile in a { @ link SortedProperties }
 * object . */
public Properties getGlobalVariables ( ) { } }

implementation: SortedProperties result = new SortedProperties ( ) ; NVPairs globalVariablesPairs = getGlobalVariablesPairs ( ) ; if ( globalVariablesPairs != null ) { for ( JAXBElement < ? extends NVPairType > nvPair : globalVariablesPairs . getNVPair ( ) ) { String key = nvPair . getValue ( ) . getName ( ) ; String value = nvPair . getValue ( ) . getValue ( ) ; result . setProperty ( key , value ) ; } } return result ;


signature:
public class ApplicationManagement { /** * This method focuses on all child elements of < bw name = " par " > . These
 * elements are defined in the " ServiceType " & " BWServiceType " complexTypes
 * of the XSD schema . */
protected Properties getProcessArchives ( ) { } }

implementation:
SortedProperties result = new SortedProperties ( ) ; List < Bw > bwServices = getBWServices ( ) ; String key ; for ( Bw bwService : bwServices ) { String serviceKey = "bw[" + bwService . getName ( ) + "]" ; // / " ServiceType " complexType
// enabled
key = serviceKey + "/enabled" ; result . setProperty ( key , bwService . isEnabled ( ) ) ; // bindings
result . putAll ( getBindings ( bwService ) ) ; // NVPairs
result . putAll ( getNVPairs ( bwService ) ) ; // failureCount
key = serviceKey + "/failureCount" ; result . setProperty ( key , bwService . getFailureCount ( ) ) ; // failureInterval
key = serviceKey + "/failureInterval" ; result . setProperty ( key , bwService . getFailureInterval ( ) ) ; // monitor
// / " BWServiceType " complexType
// bwprocesses
result . putAll ( getProcesses ( bwService ) ) ; // checkpoints
result . putAll ( getCheckpoints ( bwService ) ) ; // isFt
key = serviceKey + "/isFt" ; result . setProperty ( key , isIsFt ( bwService ) ) ; // faultTolerant
result . putAll ( getFaultTolerant ( bwService ) ) ; // plugins
// not supported ( too complex )
} return result ;


signature:
public class ApplicationManagement { /** * This method focuses on all child elements of < adapter name = " aar " > . These
 * elements are defined in the " ServiceType " complexType of the XSD schema . */
protected Properties getAdapterArchives ( ) { } }

implementation:
SortedProperties result = new SortedProperties ( ) ; List < Adapter > adapters = getAdapterServices ( ) ; String key ; for ( Adapter adapter : adapters ) { String serviceKey = "adapter[" + adapter . getName ( ) + "]" ; // / " ServiceType " complexType
// enabled
key = serviceKey + "/enabled" ; result . setProperty ( key , adapter . isEnabled ( ) ) ; // bindings
result . putAll ( getBindings ( adapter ) ) ; // NVPairs
result . putAll ( getNVPairs ( adapter ) ) ; // failureCount
key = serviceKey + "/failureCount" ; result . setProperty ( key , adapter . getFailureCount ( ) ) ; // failureInterval
key = serviceKey + "/failureInterval" ; result . setProperty ( key , adapter . getFailureInterval ( ) ) ; // monitor
// plugins
// not supported ( too complex )
} return result ;


signature:
public class ApplicationManagement { /** * This method focuses on bindings found in these paths :
 * " / application / services / bw / bindings / binding "
 * " / application / services / adapter / bindings / binding " */
protected < T extends ServiceType > Properties getBindings ( T service ) { } }

implementation:
SortedProperties result = new SortedProperties ( ) ; String serviceKey = getElementKey ( service ) + "[" + service . getName ( ) + "]" ; Bindings bindings = service . getBindings ( ) ; if ( bindings != null ) { for ( Binding binding : bindings . getBinding ( ) ) { String processKey = serviceKey + "/bindings/binding[" + binding . getName ( ) + "]" ; String key ; // machine
key = processKey + "/machine" ; result . setProperty ( key , binding . getMachine ( ) ) ; // product
if ( binding . getProduct ( ) != null ) { key = processKey + "/product/type" ; result . setProperty ( key , binding . getProduct ( ) . getType ( ) ) ; key = processKey + "/product/version" ; result . setProperty ( key , binding . getProduct ( ) . getVersion ( ) ) ; key = processKey + "/product/location" ; result . setProperty ( key , binding . getProduct ( ) . getLocation ( ) ) ; } // container
key = processKey + "/container" ; result . setProperty ( key , binding . getContainer ( ) ) ; // description
key = processKey + "/description" ; result . setProperty ( key , binding . getDescription ( ) ) ; // contact
key = processKey + "/contact" ; result . setProperty ( key , binding . getContact ( ) ) ; // setting
Setting setting = binding . getSetting ( ) ; if ( setting != null ) { key = processKey + "/setting/startOnBoot" ; result . setProperty ( key , setting . isStartOnBoot ( ) ) ; key = processKey + "/setting/enableVerbose" ; result . setProperty ( key , setting . isEnableVerbose ( ) ) ; key = processKey + "/setting/maxLogFileSize" ; result . setProperty ( key , setting . getMaxLogFileSize ( ) ) ; key = processKey + "/setting/maxLogFileCount" ; result . setProperty ( key , setting . getMaxLogFileCount ( ) ) ; key = processKey + "/setting/threadCount" ; result . setProperty ( key , setting . getThreadCount ( ) ) ; NTService ntService = setting . getNTService ( ) ; if ( ntService != null ) { key = processKey + "/setting/NTService/runAsNT" ; result . setProperty ( key , ntService . isRunAsNT ( ) ) ; key = processKey + "/setting/NTService/startupType" ; result . setProperty ( key , ntService . getStartupType ( ) ) ; key = processKey + "/setting/NTService/loginAs" ; result . setProperty ( key , ntService . getLoginAs ( ) ) ; key = processKey + "/setting/NTService/password" ; result . setProperty ( key , ntService . getPassword ( ) ) ; } Java java = setting . getJava ( ) ; if ( java != null ) { key = processKey + "/setting/java/prepandClassPath" ; result . setProperty ( key , java . getPrepandClassPath ( ) ) ; key = processKey + "/setting/java/appendClassPath" ; result . setProperty ( key , java . getAppendClassPath ( ) ) ; key = processKey + "/setting/java/initHeapSize" ; result . setProperty ( key , java . getInitHeapSize ( ) ) ; key = processKey + "/setting/java/maxHeapSize" ; result . setProperty ( key , java . getMaxHeapSize ( ) ) ; key = processKey + "/setting/java/threadStackSize" ; result . setProperty ( key , java . getThreadStackSize ( ) ) ; } } // ftWeight
key = processKey + "/ftWeight" ; result . setProperty ( key , binding . getFtWeight ( ) ) ; // shutdown
Shutdown shutdown = binding . getShutdown ( ) ; if ( shutdown != null ) { key = processKey + "/shutdown/checkpoint" ; result . setProperty ( key , shutdown . isCheckpoint ( ) ) ; key = processKey + "/shutdown/timeout" ; result . setProperty ( key , shutdown . getTimeout ( ) ) ; } // plugins
// not supported ( too complex )
// NVPairs
if ( binding . getNVPairs ( ) != null ) { for ( JAXBElement < ? extends NVPairType > nvPair : binding . getNVPairs ( ) . getNVPair ( ) ) { key = processKey + "/variables/variable[" + nvPair . getValue ( ) . getName ( ) + "]" ; result . setProperty ( key , nvPair . getValue ( ) . getValue ( ) ) ; } } } } return result ;


signature:
public class ApplicationManagement { /** * This method focuses on Global Variables found in this path :
 * " / application / services / bw / NVPairs "
 * " / application / services / adapter / NVPairs " */
private < T extends ServiceType > Properties getNVPairs ( T service ) { } }

implementation: SortedProperties result = new SortedProperties ( ) ; String serviceKey = getElementKey ( service ) + "[" + service . getName ( ) + "]" ; List < NVPairs > nvPairsList = new ArrayList < NVPairs > ( ) ; nvPairsList = service . getNVPairs ( ) ; String variablesKey ; for ( NVPairs nvPairs : nvPairsList ) { variablesKey = serviceKey + "/variables[" + nvPairs . getName ( ) + "]" ; String key ; for ( JAXBElement < ? extends NVPairType > nvPair : nvPairs . getNVPair ( ) ) { key = variablesKey + "/variable[" + nvPair . getValue ( ) . getName ( ) + "]" ; result . setProperty ( key , nvPair . getValue ( ) . getValue ( ) ) ; } } return result ;


signature:
public class ApplicationManagement { /** * This method focuses on processes found in this path :
 * " / application / services / bw / bwprocesses / bwprocess " */
protected Properties getProcesses ( Bw bwService ) { } }

implementation:
SortedProperties result = new SortedProperties ( ) ; String serviceKey = "bw[" + bwService . getName ( ) + "]" ; Bwprocesses bwProcesses = getBWProcesses ( bwService ) ; if ( bwProcesses != null ) { for ( Bwprocess process : bwProcesses . getBwprocess ( ) ) { String processKey = serviceKey + "/bwprocesses/bwprocess[" + process . getName ( ) + "]" ; String key ; // starter
key = processKey + "/starter" ; result . setProperty ( key , process . getStarter ( ) ) ; // enabled
key = processKey + "/enabled" ; result . setProperty ( key , process . isEnabled ( ) ) ; // maxJob
key = processKey + "/maxJob" ; result . setProperty ( key , process . getMaxJob ( ) ) ; // activation
key = processKey + "/activation" ; result . setProperty ( key , process . isActivation ( ) ) ; // flowLimit
key = processKey + "/flowLimit" ; result . setProperty ( key , process . getFlowLimit ( ) ) ; } } return result ;


signature:
public class ApplicationManagement { /** * This method focuses on checkpoints found in this path :
 * " / application / services / bw / checkpoints / checkpoint " */
protected Properties getCheckpoints ( Bw bwService ) { } }

implementation:
SortedProperties result = new SortedProperties ( ) ; String serviceKey = "bw[" + bwService . getName ( ) + "]" ; Checkpoints checkpoints = getBWCheckpoints ( bwService ) ; if ( checkpoints != null ) { String key ; // tablePrefix
key = serviceKey + "/checkpoints/tablePrefix" ; result . setProperty ( key , checkpoints . getTablePrefix ( ) ) ; for ( String checkpoint : checkpoints . getCheckpoint ( ) ) { if ( checkpoint == null ) continue ; // checkpoint
key = serviceKey + "/checkpoints/checkpoint[" + checkpoint + "]" ; result . setProperty ( key , checkpoint . equals ( checkpoints . getSelected ( ) ) ) ; } } return result ;


signature:
public class ApplicationManagement { /** * This method focuses on faultTolerant object found in this path :
 * " / application / services / bw / faultTolerant " */
protected Properties getFaultTolerant ( Bw bwService ) { } }

implementation:
SortedProperties result = new SortedProperties ( ) ; String serviceKey = "bw[" + bwService . getName ( ) + "]" ; FaultTolerant faultTolerant = getBWFaultTolerant ( bwService ) ; if ( faultTolerant != null ) { String key ; // hbInterval
key = serviceKey + "/faultTolerant/hbInterval" ; result . setProperty ( key , faultTolerant . getHbInterval ( ) ) ; // activationInterval
key = serviceKey + "/faultTolerant/activationInterval" ; result . setProperty ( key , faultTolerant . getActivationInterval ( ) ) ; // preparationDelay
key = serviceKey + "/faultTolerant/preparationDelay" ; result . setProperty ( key , faultTolerant . getPreparationDelay ( ) ) ; } return result ;


signature:
public class ApplicationManagement { /** * / application / services / bw */
private Bw getBw ( String name ) { } }

implementation: List < Bw > services = getBWServices ( ) ; if ( services != null ) { for ( Bw service : services ) { if ( service . getName ( ) . equals ( name ) ) { return service ; } } } Bw result = new Bw ( ) ; result . setName ( name ) ; services . add ( result ) ; QName qName = new QName ( APPLICATION_MANAGEMENT_NAMESPACE , "bw" ) ; JAXBElement < Bw > j = new JAXBElement < Bw > ( qName , Bw . class , result ) ; application . getServices ( ) . getBaseService ( ) . add ( j ) ; return result ;


signature:
public class ApplicationManagement { /** * / application / services / adapter */
private Adapter getAdapter ( String name ) { } }

implementation: List < Adapter > services = getAdapterServices ( ) ; if ( services != null ) { for ( Adapter service : services ) { if ( service . getName ( ) . equals ( name ) ) { return service ; } } } Adapter result = new Adapter ( ) ; result . setName ( name ) ; services . add ( result ) ; QName qName = new QName ( APPLICATION_MANAGEMENT_NAMESPACE , "adapter" ) ; JAXBElement < Adapter > j = new JAXBElement < Adapter > ( qName , Adapter . class , result ) ; application . getServices ( ) . getBaseService ( ) . add ( j ) ; return result ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bindings / binding
 * / application / services / adapter / bindings / binding */
private < T extends ServiceType > Binding getBinding ( String nameAttribute , T parent ) { } }

implementation:
Bindings bindings = parent . getBindings ( ) ; if ( bindings != null ) { for ( Binding binding : bindings . getBinding ( ) ) { if ( binding . getName ( ) . equals ( nameAttribute ) ) { return binding ; } } } else { bindings = new Bindings ( ) ; parent . setBindings ( bindings ) ; } // create new Binding
Binding binding = new Binding ( ) ; binding . setName ( nameAttribute ) ; Product p = new Product ( ) ; p . setType ( "bwengine" ) ; p . setLocation ( "" ) ; p . setVersion ( "" ) ; binding . setProduct ( p ) ; binding . setDescription ( "" ) ; binding . setContact ( "" ) ; Shutdown s = new Shutdown ( ) ; s . setCheckpoint ( false ) ; s . setTimeout ( new BigInteger ( "0" ) ) ; binding . setShutdown ( s ) ; bindings . getBinding ( ) . add ( binding ) ; return binding ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bindings / binding / * */
private Object addBindingParameter ( Binding binding , String key , String value ) { } }

implementation: if ( "machine" . equals ( key ) ) { binding . setMachine ( value ) ; } else if ( "product" . equals ( key ) ) { if ( binding . getProduct ( ) == null ) { binding . setProduct ( new Product ( ) ) ; } return binding . getProduct ( ) ; } else if ( "container" . equals ( key ) ) { binding . setContainer ( value ) ; } else if ( "description" . equals ( key ) ) { binding . setDescription ( value ) ; } else if ( "contact" . equals ( key ) ) { binding . setContact ( value ) ; } else if ( "setting" . equals ( key ) ) { if ( binding . getSetting ( ) == null ) { binding . setSetting ( new Setting ( ) ) ; } return binding . getSetting ( ) ; } else if ( "ftWeight" . equals ( key ) ) { binding . setFtWeight ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "shutdown" . equals ( key ) ) { if ( binding . getShutdown ( ) == null ) { binding . setShutdown ( new Shutdown ( ) ) ; } return binding . getShutdown ( ) ; } return binding ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bindings / binding / product / * */
private Object addProductParameter ( Product product , String key , String value ) { } }

implementation: if ( "type" . equals ( key ) ) { product . setType ( value ) ; } else if ( "version" . equals ( key ) ) { product . setVersion ( value ) ; } else if ( "location" . equals ( key ) ) { product . setLocation ( value ) ; } return product ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bindings / binding / setting / * */
private Object addSettingParameter ( Setting setting , String key , String value ) { } }

implementation: if ( "startOnBoot" . equals ( key ) ) { setting . setStartOnBoot ( Boolean . parseBoolean ( value ) ) ; } else if ( "enableVerbose" . equals ( key ) ) { setting . setEnableVerbose ( Boolean . parseBoolean ( value ) ) ; } else if ( "maxLogFileSize" . equals ( key ) ) { setting . setMaxLogFileSize ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "maxLogFileCount" . equals ( key ) ) { setting . setMaxLogFileCount ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "threadCount" . equals ( key ) ) { setting . setThreadCount ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "NTService" . equals ( key ) ) { if ( setting . getNTService ( ) == null ) { setting . setNTService ( new NTService ( ) ) ; } return setting . getNTService ( ) ; } else if ( "java" . equals ( key ) ) { if ( setting . getJava ( ) == null ) { setting . setJava ( new Java ( ) ) ; } return setting . getJava ( ) ; } return setting ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bindings / binding / setting / NTService / * */
private Object addNTServiceParameter ( NTService ntService , String key , String value ) { } }

implementation: if ( "runAsNT" . equals ( key ) ) { ntService . setRunAsNT ( Boolean . parseBoolean ( value ) ) ; } else if ( "startupType" . equals ( key ) ) { ntService . setStartupType ( value ) ; } else if ( "loginAs" . equals ( key ) ) { ntService . setLoginAs ( value ) ; } else if ( "password" . equals ( key ) ) { ntService . setPassword ( value ) ; } return ntService ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bindings / binding / setting / java / * */
private Object addJavaParameter ( Java java , String key , String value ) { } }

implementation: if ( "prepandClassPath" . equals ( key ) ) { java . setPrepandClassPath ( value ) ; } else if ( "appendClassPath" . equals ( key ) ) { java . setAppendClassPath ( value ) ; } else if ( "initHeapSize" . equals ( key ) ) { java . setInitHeapSize ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "maxHeapSize" . equals ( key ) ) { java . setMaxHeapSize ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "threadStackSize" . equals ( key ) ) { java . setThreadStackSize ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } return java ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bindings / binding / shutdown / * */
private Object addShutdownParameter ( Shutdown shutdown , String key , String value ) { } }

implementation: if ( "checkpoint" . equals ( key ) ) { shutdown . setCheckpoint ( Boolean . parseBoolean ( value ) ) ; } else if ( "timeout" . equals ( key ) ) { shutdown . setTimeout ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } return shutdown ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bwprocesses / bwprocess */
private Bwprocess getBWProcess ( String nameAttribute , Bw parent ) { } }

implementation: Bwprocesses bwProcesses = getBWProcesses ( parent ) ; if ( bwProcesses != null ) { for ( Bwprocess bwProcess : bwProcesses . getBwprocess ( ) ) { if ( bwProcess . getName ( ) . equals ( nameAttribute ) ) { return bwProcess ; } } } else { bwProcesses = new Bwprocesses ( ) ; parent . getRest ( ) . add ( bwProcesses ) ; } Bwprocess bwProcess = new Bwprocess ( ) ; bwProcess . setName ( nameAttribute ) ; bwProcesses . getBwprocess ( ) . add ( bwProcess ) ; return bwProcess ;


signature:
public class ApplicationManagement { /** * / application / services / bw / bwprocesses / bwprocess / * */
private void addBWProcessParameter ( Bwprocess bwProcess , String key , String value ) { } }

implementation: if ( "starter" . equals ( key ) ) { bwProcess . setStarter ( value ) ; } else if ( "enabled" . equals ( key ) ) { bwProcess . setEnabled ( Boolean . parseBoolean ( value ) ) ; } else if ( "maxJob" . equals ( key ) ) { bwProcess . setMaxJob ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "activation" . equals ( key ) ) { bwProcess . setActivation ( Boolean . parseBoolean ( value ) ) ; } else if ( "flowLimit" . equals ( key ) ) { bwProcess . setFlowLimit ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; }


signature:
public class ApplicationManagement { /** * / application / services / bw / faultTolerant / * */
private void addFaultTolerantParameter ( FaultTolerant faultTolerant , String key , String value ) { } }

implementation: if ( "activationInterval" . equals ( key ) ) { faultTolerant . setActivationInterval ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "hbInterval" . equals ( key ) ) { faultTolerant . setHbInterval ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "preparationDelay" . equals ( key ) ) { faultTolerant . setPreparationDelay ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; }


signature:
public class ApplicationManagement { /** * / application / services / bw / * */
private Object addBwParameter ( Bw bw , String key , String value ) { } }

implementation: if ( "enabled" . equals ( key ) ) { bw . setEnabled ( Boolean . parseBoolean ( value ) ) ; } else if ( "failureCount" . equals ( key ) ) { bw . setFailureCount ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "failureInterval" . equals ( key ) ) { bw . setFailureInterval ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "isFt" . equals ( key ) ) { setIsFt ( bw , Boolean . parseBoolean ( value ) ) ; } else if ( "faultTolerant" . equals ( key ) ) { return getBWFaultTolerant ( bw ) ; } return bw ;


signature:
public class ApplicationManagement { /** * / application / services / adapter / * */
private Object addAdapterParameter ( Adapter adapter , String key , String value ) { } }

implementation: if ( "enabled" . equals ( key ) ) { adapter . setEnabled ( Boolean . parseBoolean ( value ) ) ; } else if ( "failureCount" . equals ( key ) ) { adapter . setFailureCount ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } else if ( "failureInterval" . equals ( key ) ) { adapter . setFailureInterval ( BigInteger . valueOf ( Long . parseLong ( value ) ) ) ; } return adapter ;


signature:
public class ApplicationManagement { /** * This method will create JAXB objects from Properties through recursive
 * calls .
 * Each property has a path . The last part of a path ( after last / ) is the
 * element . */
public Object getElement ( String path , String element , String value , Object parent ) { } }

implementation:
if ( map . containsKey ( path ) ) { return map . get ( path ) ; } else { Matcher matcherElement = patternElement . matcher ( element ) ; if ( matcherElement . matches ( ) ) { String elementName = matcherElement . group ( 1 ) ; String nameAttribute = matcherElement . group ( 3 ) ; if ( nameAttribute != null ) { if ( elementName . equals ( "variables" ) ) { NVPairs gvs = null ; if ( parent . getClass ( ) . equals ( Bw . class ) || parent . getClass ( ) . equals ( Adapter . class ) ) { ServiceType service = ( ServiceType ) parent ; for ( NVPairs nvPairs : service . getNVPairs ( ) ) { if ( nvPairs . getName ( ) . equals ( nameAttribute ) ) { gvs = nvPairs ; break ; } } if ( gvs == null ) { gvs = new NVPairs ( ) ; service . getNVPairs ( ) . add ( gvs ) ; } } else if ( parent . getClass ( ) . equals ( Binding . class ) ) { gvs = new NVPairs ( ) ; gvs . setName ( nameAttribute ) ; ( ( Binding ) parent ) . setNVPairs ( gvs ) ; } map . put ( path , gvs ) ; return gvs ; } else if ( elementName . equals ( "variable" ) ) { NameValuePair simpleGV = new NameValuePair ( ) ; simpleGV . setName ( nameAttribute ) ; simpleGV . setValue ( value ) ; QName name = new QName ( APPLICATION_MANAGEMENT_NAMESPACE , "NameValuePair" ) ; JAXBElement < NameValuePair > _simpleGV = new JAXBElement < NameValuePair > ( name , NameValuePair . class , simpleGV ) ; boolean found = false ; for ( JAXBElement < ? extends NVPairType > nvPair : ( ( NVPairs ) parent ) . getNVPair ( ) ) { if ( nameAttribute . equals ( nvPair . getValue ( ) . getName ( ) ) ) { nvPair . getValue ( ) . setValue ( value ) ; found = true ; } } if ( ! found ) { ( ( NVPairs ) parent ) . getNVPair ( ) . add ( _simpleGV ) ; } return simpleGV ; } else if ( elementName . equals ( "bw" ) ) { Bw service = this . getBw ( nameAttribute ) ; map . put ( path , service ) ; return service ; } else if ( elementName . equals ( "adapter" ) ) { Adapter service = this . getAdapter ( nameAttribute ) ; map . put ( path , service ) ; return service ; } else if ( elementName . equals ( "binding" ) ) { Binding binding = null ; if ( parent . getClass ( ) . equals ( Bw . class ) ) { binding = this . getBinding ( nameAttribute , ( Bw ) parent ) ; } else if ( parent . getClass ( ) . equals ( Adapter . class ) ) { binding = this . getBinding ( nameAttribute , ( Adapter ) parent ) ; } else { // throw ?
} map . put ( path , binding ) ; return binding ; } else if ( elementName . equals ( "bwprocess" ) ) { Bwprocess bwProcess = this . getBWProcess ( nameAttribute , ( Bw ) parent ) ; map . put ( path , bwProcess ) ; return bwProcess ; } else if ( elementName . equals ( "checkpoint" ) ) { Checkpoints checkpoints = ( Checkpoints ) parent ; if ( ! checkpoints . getCheckpoint ( ) . contains ( nameAttribute ) ) { checkpoints . getCheckpoint ( ) . add ( nameAttribute ) ; } if ( "true" . equals ( value ) ) { checkpoints . setSelected ( nameAttribute ) ; } } } else { if ( elementName . equals ( "variables" ) ) { NVPairs gvs = null ; if ( parent . getClass ( ) . equals ( Bw . class ) || parent . getClass ( ) . equals ( Adapter . class ) ) { ServiceType service = ( ServiceType ) parent ; for ( NVPairs nvPairs : service . getNVPairs ( ) ) { if ( nvPairs . getName ( ) . equals ( "Runtime Variables" ) ) { gvs = nvPairs ; break ; } } if ( gvs == null ) { gvs = new NVPairs ( ) ; service . getNVPairs ( ) . add ( gvs ) ; } } else if ( parent . getClass ( ) . equals ( Binding . class ) ) { gvs = new NVPairs ( ) ; gvs . setName ( "Runtime Variables" ) ; ( ( Binding ) parent ) . setNVPairs ( gvs ) ; } map . put ( path , gvs ) ; return gvs ; } else if ( elementName . equals ( "checkpoints" ) ) { Checkpoints checkpoints = this . getBWCheckpoints ( ( Bw ) parent ) ; map . put ( path , checkpoints ) ; return checkpoints ; } else if ( elementName . equals ( "tablePrefix" ) ) { Checkpoints checkpoints = ( Checkpoints ) parent ; checkpoints . setTablePrefix ( value ) ; // Binding children
} else if ( parent . getClass ( ) . equals ( Binding . class ) ) { return addBindingParameter ( ( Binding ) parent , elementName , value ) ; } else if ( parent . getClass ( ) . equals ( Product . class ) ) { return addProductParameter ( ( Product ) parent , elementName , value ) ; } else if ( parent . getClass ( ) . equals ( Setting . class ) ) { return addSettingParameter ( ( Setting ) parent , elementName , value ) ; } else if ( parent . getClass ( ) . equals ( NTService . class ) ) { return addNTServiceParameter ( ( NTService ) parent , elementName , value ) ; } else if ( parent . getClass ( ) . equals ( Java . class ) ) { return addJavaParameter ( ( Java ) parent , elementName , value ) ; } else if ( parent . getClass ( ) . equals ( Shutdown . class ) ) { return addShutdownParameter ( ( Shutdown ) parent , elementName , value ) ; // Bwprocess children
} else if ( parent . getClass ( ) . equals ( Bwprocess . class ) ) { addBWProcessParameter ( ( Bwprocess ) parent , elementName , value ) ; } else if ( parent . getClass ( ) . equals ( FaultTolerant . class ) ) { addFaultTolerantParameter ( ( FaultTolerant ) parent , elementName , value ) ; } else if ( parent . getClass ( ) . equals ( Checkpoints . class ) ) { addCheckpointsParameter ( ( Checkpoints ) parent , elementName , value ) ; // Bw chidren ( direct children )
} else if ( parent . getClass ( ) . equals ( Bw . class ) ) { return addBwParameter ( ( Bw ) parent , elementName , value ) ; } else if ( parent . getClass ( ) . equals ( Adapter . class ) ) { return addAdapterParameter ( ( Adapter ) parent , elementName , value ) ; } } } return parent ; }


signature:
public class ApplicationManagement { /** * This will remove from the XML the second duplicate default binding ( with
 * empty name attribute ) to keep only the first one .
 * This is is because " AppManage - export - max " exports two empty bindings
 * to prepare fault tolerance configuration . */
public void removeDuplicateBinding ( ) { } }

implementation: List < Bw > bwServices = this . getBWServices ( ) ; for ( Bw bw : bwServices ) { boolean first = true ; List < Binding > bindings = bw . getBindings ( ) . getBinding ( ) ; for ( Iterator < Binding > iterator = bindings . iterator ( ) ; iterator . hasNext ( ) ; ) { Binding binding = ( Binding ) iterator . next ( ) ; if ( ! first && binding . getName ( ) . equals ( "" ) ) { iterator . remove ( ) ; } first = false ; } } List < Adapter > adapterServices = this . getAdapterServices ( ) ; for ( Adapter adapter : adapterServices ) { boolean first = true ; List < Binding > bindings = adapter . getBindings ( ) . getBinding ( ) ; for ( Iterator < Binding > iterator = bindings . iterator ( ) ; iterator . hasNext ( ) ; ) { Binding binding = ( Binding ) iterator . next ( ) ; if ( ! first && binding . getName ( ) . equals ( "" ) ) { iterator . remove ( ) ; } first = false ; } }


signature:
public class ApplicationManagement { /** * This will remove from the XML the default binding ( with empty name
 * attribute ) if it is not found in the properties . */
public void removeDefaultBindingIfNotExists ( Properties properties ) { } }

implementation:
List < Bw > bwServices = this . getBWServices ( ) ; for ( Bw bw : bwServices ) { String path = "bw[" + bw . getName ( ) + "]/bindings/binding[]/machine" ; List < Binding > bindings = bw . getBindings ( ) . getBinding ( ) ; for ( Iterator < Binding > iterator = bindings . iterator ( ) ; iterator . hasNext ( ) ; ) { Binding binding = ( Binding ) iterator . next ( ) ; // if ( binding . getName ( ) . equals ( " " ) & & properties . getString ( path ) = = null ) {
if ( binding . getName ( ) . equals ( "" ) && ! properties . containsKey ( path ) ) { iterator . remove ( ) ; } } } List < Adapter > adapterServices = this . getAdapterServices ( ) ; for ( Adapter adapter : adapterServices ) { String path = "adapter[" + adapter . getName ( ) + "]/bindings/binding[]/machine" ; List < Binding > bindings = adapter . getBindings ( ) . getBinding ( ) ; for ( Iterator < Binding > iterator = bindings . iterator ( ) ; iterator . hasNext ( ) ; ) { Binding binding = ( Binding ) iterator . next ( ) ; // if ( binding . getName ( ) . equals ( " " ) & & properties . getString ( path ) = = null ) {
if ( binding . getName ( ) . equals ( "" ) && ! properties . containsKey ( path ) ) { iterator . remove ( ) ; } } }


signature:
public class ApplicationManagement { /** * Add & lt ; events > in & lt ; monitor > element of all & lt ; bw > elements .
 * @ param events */
public void addMonitoringEventsToAllServices ( Events events ) { } }

implementation: List < JAXBElement < ? extends EventType > > events_ = events . getEvent ( ) ; if ( events_ != null && ! events_ . isEmpty ( ) ) { for ( Bw service : this . getBWServices ( ) ) { Monitor monitor = service . getMonitor ( ) ; if ( monitor != null ) { monitor . setEvents ( events ) ; } } }


signature:
public class GlobalVariables { /** * Gets the value of the globalVariable property .
 * This accessor method returns a reference to the live list ,
 * not a snapshot . Therefore any modification you make to the
 * returned list will be present inside the JAXB object .
 * This is why there is not a < CODE > set < / CODE > method for the globalVariable property .
 * For example , to add a new item , do as follows :
 * < pre >
 * getGlobalVariable ( ) . add ( newItem ) ;
 * < / pre >
 * Objects of the following type ( s ) are allowed in the list
 * { @ link GlobalVariables . GlobalVariable } */
public List < GlobalVariables . GlobalVariable > getGlobalVariable ( ) { } }

implementation: if ( globalVariable == null ) { globalVariable = new ArrayList < GlobalVariables . GlobalVariable > ( ) ; } return this . globalVariable ;


signature:
public class Services { /** * Gets the value of the baseService property .
 * This accessor method returns a reference to the live list ,
 * not a snapshot . Therefore any modification you make to the
 * returned list will be present inside the JAXB object .
 * This is why there is not a < CODE > set < / CODE > method for the baseService property .
 * For example , to add a new item , do as follows :
 * < pre >
 * getBaseService ( ) . add ( newItem ) ;
 * < / pre >
 * Objects of the following type ( s ) are allowed in the list
 * { @ link JAXBElement } { @ code < } { @ link Bw } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link Service } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link ServiceType } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link Im } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link FormFlow } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link Adapter } { @ code > } */
public List < JAXBElement < ? extends ServiceType > > getBaseService ( ) { } }

implementation: if ( baseService == null ) { baseService = new ArrayList < JAXBElement < ? extends ServiceType > > ( ) ; } return this . baseService ;


signature:
public class Events { /** * Gets the value of the event property .
 * This accessor method returns a reference to the live list ,
 * not a snapshot . Therefore any modification you make to the
 * returned list will be present inside the JAXB object .
 * This is why there is not a < CODE > set < / CODE > method for the event property .
 * For example , to add a new item , do as follows :
 * < pre >
 * getEvent ( ) . add ( newItem ) ;
 * < / pre >
 * Objects of the following type ( s ) are allowed in the list
 * { @ link JAXBElement } { @ code < } { @ link EventType } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link LogEvent } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link SuspendProcessEvent } { @ code > }
 * { @ link JAXBElement } { @ code < } { @ link FailureEvent } { @ code > } */
public List < JAXBElement < ? extends EventType > > getEvent ( ) { } }

implementation: if ( event == null ) { event = new ArrayList < JAXBElement < ? extends EventType > > ( ) ; } return this . event ;


signature:
public class AbstractBWMojo { /** * Instantiate a minimalistic { @ link AbstractCommonMojo } to use properties
 * management as a standalone object .
 * @ param session
 * @ param mavenProject
 * @ return */
public static AbstractBWMojo propertiesManager ( MavenSession session , MavenProject mavenProject ) { } }

implementation: AbstractBWMojo mojo = new AbstractBWMojo ( ) ; mojo . setProject ( mavenProject ) ; mojo . setSession ( session ) ; mojo . setSettings ( session . getSettings ( ) ) ; return mojo ;


signature:
public class AbstractBWMojo { /** * This will check that the BW project specified in the POM project exists .
 * TODO : add additional checks about BW project integrity
 * @ throws MojoExecutionException */
private void checkBWProject ( ) throws MojoExecutionException { } }

implementation: if ( projectDirectory == null ) { projectNotFound ( ) ; } else if ( ! projectDirectory . exists ( ) || ! projectDirectory . isDirectory ( ) ) { projectNotFound ( ) ; }