idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
131,300
public EmbeddedMongoDB start ( ) { if ( ! this . active ) { try { this . mongodProcess = MongodStarter . getDefaultInstance ( ) . prepare ( new MongodConfigBuilder ( ) . version ( this . version ) . net ( new Net ( this . host , this . port , false ) ) . build ( ) ) . start ( ) ; this . active = true ; LOG . info ( "Su...
Starts the EmbeddedMongoDB instance
131,301
public void stop ( ) { if ( this . active ) { this . mongodProcess . stop ( ) ; this . active = false ; LOG . info ( "Successfully stopped EmbeddedMongoDB @ {}:{}" , this . host , this . port ) ; } }
Stops the EmbeddedMongoDB instance
131,302
public String encrypt ( String toEncrypt ) { byte [ ] encryptedBytes = encryptInternal ( dataEncryptionSecretKeySpec , toEncrypt ) ; return new String ( base64Encoder . encode ( encryptedBytes ) ) ; }
Encrypt and base64 - encode a String .
131,303
private byte [ ] encryptInternal ( SecretKeySpec key , String toEncrypt ) { try { Cipher cipher = Cipher . getInstance ( ENCRYPTION_ALGORITHM + ENCRYPTION_ALGORITHM_MODIFIER ) ; cipher . init ( Cipher . ENCRYPT_MODE , key ) ; return cipher . doFinal ( toEncrypt . getBytes ( ENCODING ) ) ; } catch ( GeneralSecurityExcep...
Internal Encryption method .
131,304
public String decrypt ( String toDecrypt ) { byte [ ] encryptedBytes = base64Decoder . decode ( toDecrypt ) ; return decryptInternal ( dataEncryptionSecretKeySpec , encryptedBytes ) ; }
Decrypt an encrypted and base64 - encoded String
131,305
private String decryptInternal ( SecretKeySpec key , byte [ ] encryptedBytes ) { try { Cipher cipher = Cipher . getInstance ( ENCRYPTION_ALGORITHM + ENCRYPTION_ALGORITHM_MODIFIER ) ; cipher . init ( Cipher . DECRYPT_MODE , key ) ; byte [ ] decryptedBytes = cipher . doFinal ( encryptedBytes ) ; return new String ( decry...
Internal decryption method .
131,306
public void process ( final Exchange exchange ) throws Exception { final Message in = exchange . getIn ( ) ; final String contentType = in . getHeader ( CONTENT_TYPE , "" , String . class ) ; final String body = in . getBody ( String . class ) ; final Set < String > endpoints = new HashSet < > ( ) ; for ( final String ...
Convert the incoming REST request into the correct Fcrepo header fields .
131,307
public void process ( final Exchange exchange ) throws Exception { final Message in = exchange . getIn ( ) ; final String eventURIBase = in . getHeader ( AuditHeaders . EVENT_BASE_URI , String . class ) ; final String eventID = in . getHeader ( FCREPO_EVENT_ID , String . class ) ; final Resource eventURI = createResour...
Define how a message should be processed .
131,308
private static String serializedGraphForMessage ( final Message message , final Resource subject ) throws IOException { final ByteArrayOutputStream serializedGraph = new ByteArrayOutputStream ( ) ; final Model model = createDefaultModel ( ) ; @ SuppressWarnings ( "unchecked" ) final List < String > eventType = message ...
Convert a Camel message to audit event description .
131,309
private static Optional < String > getAuditEventType ( final List < String > eventType , final List < String > resourceType ) { if ( eventType . contains ( EVENT_NAMESPACE + "ResourceCreation" ) || eventType . contains ( AS_NAMESPACE + "Create" ) ) { if ( resourceType . contains ( REPOSITORY + "Binary" ) ) { return of ...
Returns the Audit event type based on fedora event type and properties .
131,310
public List < Map < String , Collection < ? > > > programQuery ( final String uri , final InputStream program ) throws LDPathParseException { return singletonList ( ldpath . programQuery ( new URIImpl ( uri ) , new InputStreamReader ( program ) ) ) ; }
Execute an LDPath query
131,311
public static ClientConfiguration createClient ( final AuthScope authScope , final Credentials credentials , final List < Endpoint > endpoints , final List < DataProvider > providers ) { final ClientConfiguration client = new ClientConfiguration ( ) ; if ( credentials != null && authScope != null ) { final CredentialsP...
Create a linked data client suitable for use with a Fedora Repository .
131,312
public void configure ( ) throws Exception { final Namespaces ns = new Namespaces ( "rdf" , "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ) . add ( "fedora" , REPOSITORY ) ; onException ( Exception . class ) . maximumRedeliveries ( "{{error.maxRedeliveries}}" ) . log ( "Index Routing Error: ${routeId}" ) ; from ( "{{in...
Configure the message route workflow
131,313
public JsonPropertyBuilder < T , P > name ( String name ) { return new JsonPropertyBuilder < T , P > ( coderClass , name , null , null ) ; }
Gets a new instance of property builder for the given key name .
131,314
public JsonPropertyBuilder < T , P > coder ( JsonModelCoder < P > coder ) { return new JsonPropertyBuilder < T , P > ( coderClass , name , coder , null ) ; }
Gets a new instance of property builder for the given value coder .
131,315
public JsonPropertyBuilder < T , P > router ( JsonCoderRouter < P > router ) { return new JsonPropertyBuilder < T , P > ( coderClass , name , null , router ) ; }
Gets a new instance of property builder for the given coder router .
131,316
public Object put ( String key , Object value , State state ) { return put ( key , value , Type . from ( state ) ) ; }
put with State .
131,317
public void write ( ) throws IOException { { Filer filer = processingEnv . getFiler ( ) ; String generateClassName = jsonModel . getPackageName ( ) + "." + jsonModel . getTarget ( ) + postfix ; JavaFileObject fileObject = filer . createSourceFile ( generateClassName , classElement ) ; Template . writeGen ( fileObject ,...
Generates the source code .
131,318
String getElementKeyString ( Element element ) { JsonKey key = element . getAnnotation ( JsonKey . class ) ; JsonModel model = element . getEnclosingElement ( ) . getAnnotation ( JsonModel . class ) ; if ( ! "" . equals ( key . value ( ) ) ) { return key . value ( ) ; } else if ( "" . equals ( key . value ( ) ) && key ...
Get JSON key string .
131,319
public T pop ( ) { final int max = stack . size ( ) - 1 ; if ( max < 0 ) { throw new NoSuchElementException ( ) ; } return stack . remove ( max ) ; }
Pops the value from the top of stack and returns it .
131,320
public T peek ( ) { final int top = stack . size ( ) - 1 ; if ( top < 0 ) { throw new NoSuchElementException ( ) ; } return stack . get ( top ) ; }
Returns the value currently on the top of the stack .
131,321
public static Integer parserInteger ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_LONG ) { return ( int ) parser . getValueLong ( ) ; } else { throw new Ille...
Parses the current token as an integer .
131,322
public static Long parserLong ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_LONG ) { return parser . getValueLong ( ) ; } else { throw new IllegalStateExcept...
Parses the current token as a long .
131,323
public static Byte parserByte ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_LONG ) { return ( byte ) parser . getValueLong ( ) ; } else { throw new IllegalSt...
Parses the current token as a byte .
131,324
public static Short parserShort ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_LONG ) { return ( short ) parser . getValueLong ( ) ; } else { throw new Illega...
Parses the current token as a short .
131,325
public static Boolean parserBoolean ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_BOOLEAN ) { return parser . getValueBoolean ( ) ; } else { throw new Illega...
Parses the current token as a boolean .
131,326
public static Character parserCharacter ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_STRING ) { String str = parser . getValueString ( ) ; if ( str . length...
Parses the current token as a character .
131,327
public static Double parserDouble ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_DOUBLE ) { return parser . getValueDouble ( ) ; } else { throw new IllegalSta...
Parses the current token as a double - precision floating point value .
131,328
public static Float parserFloat ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } else if ( eventType == State . VALUE_DOUBLE ) { return ( float ) parser . getValueDouble ( ) ; } else { throw new Il...
Parses the current token as a single - precision floating point value .
131,329
public static List < Integer > parserIntegerList ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } if ( eventType != State . START_ARRAY ) { throw new IllegalStateException ( "not started brace!" ) ...
Parses the current token as a list of integers .
131,330
public static List < Boolean > parserBooleanList ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } if ( eventType != State . START_ARRAY ) { throw new IllegalStateException ( "not started brace!" ) ...
Parses the current token as a list of booleans .
131,331
public static List < Character > parserCharacterList ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } if ( eventType != State . START_ARRAY ) { throw new IllegalStateException ( "not started brace!...
Parses the current token as a list of characters .
131,332
public static List < Double > parserDoubleList ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } if ( eventType != State . START_ARRAY ) { throw new IllegalStateException ( "not started brace!" ) ; ...
Parses the current token as a list of double - precision floating point numbers .
131,333
public static List < String > parserStringList ( JsonPullParser parser ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } if ( eventType != State . START_ARRAY ) { throw new IllegalStateException ( "not started brace!" ) ; ...
Parses the current token as a list of strings .
131,334
public static < T extends Enum < T > > List < T > parserEnumList ( JsonPullParser parser , Class < T > clazz ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } if ( eventType != State . START_ARRAY ) { throw new IllegalStat...
Parses the current token as a list of Enums .
131,335
public JsonModelBuilder < T > rm ( String ... names ) { for ( String name : names ) { rmSub ( name ) ; } return this ; }
Detaches property builder for the given names .
131,336
public static JsonArray fromParser ( JsonPullParser parser ) throws IOException , JsonFormatException { State state = parser . getEventType ( ) ; if ( state == State . VALUE_NULL ) { return null ; } else if ( state != State . START_ARRAY ) { throw new JsonFormatException ( "unexpected token. token=" + state , parser ) ...
Parses the given JSON data as an array .
131,337
public static void e ( String msg , Element element ) { messager . printMessage ( Diagnostic . Kind . ERROR , msg , element ) ; }
Logs error message about the given element .
131,338
public static void e ( Throwable e ) { messager . printMessage ( Diagnostic . Kind . ERROR , "exception thrown! " + e . getMessage ( ) ) ; }
Logs error message about the given exception .
131,339
public static boolean isPrimitiveWrapper ( Element element ) { if ( element == null ) { return false ; } else if ( element . toString ( ) . equals ( Boolean . class . getCanonicalName ( ) ) ) { return true ; } else if ( element . toString ( ) . equals ( Integer . class . getCanonicalName ( ) ) ) { return true ; } else ...
Tests if the given element is a primitive wrapper .
131,340
public static boolean isInternalType ( Types typeUtils , TypeMirror type ) { Element element = ( ( TypeElement ) typeUtils . asElement ( type ) ) . getEnclosingElement ( ) ; return element . getKind ( ) != ElementKind . PACKAGE ; }
Test if the given type is an internal type .
131,341
public static boolean isPackagePrivate ( Element element ) { if ( isPublic ( element ) ) { return false ; } else if ( isProtected ( element ) ) { return false ; } else if ( isPrivate ( element ) ) { return false ; } return true ; }
Tests if the given element has the package - private visibility .
131,342
public static String getElementSetter ( Element element ) { String setterName = null ; if ( isPrimitiveBoolean ( element ) ) { Pattern pattern = Pattern . compile ( "^is[^a-z].*$" ) ; Matcher matcher = pattern . matcher ( element . getSimpleName ( ) . toString ( ) ) ; if ( matcher . matches ( ) ) { setterName = "set" +...
Returns the name of corresponding setter .
131,343
public static String getElementGetter ( Element element ) { String getterName1 = "get" + element . getSimpleName ( ) . toString ( ) ; String getterName2 = "is" + element . getSimpleName ( ) . toString ( ) ; String getterName3 = element . getSimpleName ( ) . toString ( ) ; Element getter = null ; for ( Element method : ...
Returns the name of corresponding getter .
131,344
public void setInputFile ( final File value ) { if ( value != null && ! value . isAbsolute ( ) ) { throw new IllegalArgumentException ( "path is not absolute: " + value ) ; } this . inputFile = value ; }
Sets the absolute path to the grammar file to pass into JTB for preprocessing .
131,345
public void setOutputDirectory ( final File value ) { if ( value != null && ! value . isAbsolute ( ) ) { throw new IllegalArgumentException ( "path is not absolute: " + value ) ; } this . outputDirectory = value ; }
Sets the absolute path to the output directory for the generated grammar file .
131,346
public File getOutputFile ( ) { File outputFile = null ; if ( this . outputDirectory != null && this . inputFile != null ) { final String fileName = FileUtils . removeExtension ( this . inputFile . getName ( ) ) + ".jj" ; outputFile = new File ( this . outputDirectory , fileName ) ; } return outputFile ; }
Gets the absolute path to the enhanced grammar file generated by JTB .
131,347
public void setNodeDirectory ( final File value ) { if ( value != null && ! value . isAbsolute ( ) ) { throw new IllegalArgumentException ( "path is not absolute: " + value ) ; } this . nodeDirectory = value ; }
Sets the absolute path to the output directory for the syntax tree files .
131,348
private File getEffectiveNodeDirectory ( ) { if ( this . nodeDirectory != null ) return this . nodeDirectory ; if ( this . outputDirectory != null ) return new File ( this . outputDirectory , getLastPackageName ( getEffectiveNodePackageName ( ) ) ) ; return null ; }
Gets the absolute path to the output directory for the syntax tree files .
131,349
public void setVisitorDirectory ( final File value ) { if ( value != null && ! value . isAbsolute ( ) ) { throw new IllegalArgumentException ( "path is not absolute: " + value ) ; } this . visitorDirectory = value ; }
Sets the absolute path to the output directory for the visitor files .
131,350
private File getEffectiveVisitorDirectory ( ) { if ( this . visitorDirectory != null ) return this . visitorDirectory ; if ( this . outputDirectory != null ) return new File ( this . outputDirectory , getLastPackageName ( getEffectiveVisitorPackageName ( ) ) ) ; return null ; }
Gets the absolute path to the output directory for the visitor files .
131,351
private String getEffectiveNodePackageName ( ) { if ( this . packageName != null ) return this . packageName . length ( ) <= 0 ? SYNTAX_TREE : this . packageName + '.' + SYNTAX_TREE ; if ( this . nodePackageName != null ) return this . nodePackageName ; return SYNTAX_TREE ; }
Gets the effective package name for the syntax tree files .
131,352
private String getEffectiveVisitorPackageName ( ) { if ( this . packageName != null ) return this . packageName . length ( ) <= 0 ? VISITOR : this . packageName + '.' + VISITOR ; if ( this . visitorPackageName != null ) return this . visitorPackageName ; return VISITOR ; }
Gets the effective package name for the visitor files .
131,353
private String [ ] generateArguments ( ) { final List < String > argsList = new ArrayList < > ( ) ; argsList . add ( "-np" ) ; argsList . add ( getEffectiveNodePackageName ( ) ) ; argsList . add ( "-vp" ) ; argsList . add ( getEffectiveVisitorPackageName ( ) ) ; if ( this . supressErrorChecking != null && this . supres...
Assembles the command line arguments for the invocation of JTB according to the configuration .
131,354
private String getLastPackageName ( final String name ) { if ( name != null ) { return name . substring ( name . lastIndexOf ( '.' ) + 1 ) ; } return null ; }
Gets the last identifier from the specified package name . For example returns apache upon input of org . apache . JTB uses this approach to derive the output directories for the visitor and syntax tree files .
131,355
protected JJTree newJJTree ( ) { final JJTree jjtree = new JJTree ( ) ; jjtree . setLog ( getLog ( ) ) ; jjtree . setGrammarEncoding ( getGrammarEncoding ( ) ) ; jjtree . setOutputEncoding ( getOutputEncoding ( ) ) ; jjtree . setJdkVersion ( getJdkVersion ( ) ) ; jjtree . setBuildNodeFiles ( this . buildNodeFiles ) ; j...
Creates a new facade to invoke JJTree . Most options for the invocation are derived from the current values of the corresponding mojo parameters . The caller is responsible to set the input file output directory and package on the returned facade .
131,356
public final void addClassPathEntry ( final File path ) { if ( path != null ) m_aClassPathEntries . add ( path . getAbsolutePath ( ) ) ; }
Adds the specified path to the class path of the forked JVM .
131,357
private static File _getResourceSource ( final String resource , final ClassLoader loader ) { if ( resource != null ) { URL url ; if ( loader != null ) { url = loader . getResource ( resource ) ; } else { url = ClassLoader . getSystemResource ( resource ) ; } return UrlUtils . getResourceRoot ( url , resource ) ; } ret...
Gets the JAR file or directory that contains the specified resource .
131,358
private Commandline _createCommandLine ( ) { final Commandline cli = new Commandline ( ) ; cli . setExecutable ( this . executable ) ; if ( this . workingDirectory != null ) { cli . setWorkingDirectory ( this . workingDirectory . getAbsolutePath ( ) ) ; } final String classPath = _getClassPath ( ) ; if ( classPath != n...
Creates the command line for the new JVM based on the current configuration .
131,359
private File [ ] getSourceDirectories ( ) { final Set < File > directories = new LinkedHashSet < > ( ) ; if ( this . sourceDirectories != null && this . sourceDirectories . length > 0 ) { directories . addAll ( Arrays . asList ( this . sourceDirectories ) ) ; } else { if ( this . defaultGrammarDirectoryJavaCC != null )...
Get the source directories that should be scanned for grammar files .
131,360
public void executeReport ( final Locale locale ) throws MavenReportException { final Sink sink = getSink ( ) ; createReportHeader ( getBundle ( locale ) , sink ) ; final File [ ] sourceDirs = getSourceDirectories ( ) ; for ( final File sourceDir : sourceDirs ) { final GrammarInfo [ ] grammarInfos = scanForGrammars ( s...
Run the actual report .
131,361
private void createReportHeader ( final ResourceBundle bundle , final Sink sink ) { sink . head ( ) ; sink . title ( ) ; sink . text ( bundle . getString ( "report.jjdoc.title" ) ) ; sink . title_ ( ) ; sink . head_ ( ) ; sink . body ( ) ; sink . section1 ( ) ; sink . sectionTitle1 ( ) ; sink . text ( bundle . getStrin...
Create the header and title for the HTML report page .
131,362
private void createReportLink ( final Sink sink , final File sourceDirectory , final File grammarFile , String linkPath ) { sink . tableRow ( ) ; sink . tableCell ( ) ; if ( linkPath . startsWith ( "/" ) ) { linkPath = linkPath . substring ( 1 ) ; } sink . link ( linkPath ) ; String grammarFileRelativePath = sourceDire...
Create a table row containing a link to the JJDoc report for a grammar file .
131,363
private JJDoc newJJDoc ( ) { final JJDoc jjdoc = new JJDoc ( ) ; jjdoc . setLog ( getLog ( ) ) ; jjdoc . setGrammarEncoding ( this . grammarEncoding ) ; jjdoc . setOutputEncoding ( this . outputEncoding ) ; jjdoc . setCssHref ( this . cssHref ) ; jjdoc . setText ( this . text ) ; jjdoc . setBnf ( this . bnf ) ; jjdoc ....
Creates a new facade to invoke JJDoc . Most options for the invocation are derived from the current values of the corresponding mojo parameters . The caller is responsible to set the input file and output file on the returned facade .
131,364
private GrammarInfo [ ] scanForGrammars ( final File sourceDirectory ) throws MavenReportException { if ( ! sourceDirectory . isDirectory ( ) ) { return null ; } GrammarInfo [ ] grammarInfos ; getLog ( ) . debug ( "Scanning for grammars: " + sourceDirectory ) ; try { final String [ ] includes = { "**/*.jj" , "**/*.JJ" ...
Searches the specified source directory to find grammar files that can be documented .
131,365
public void execute ( ) throws MojoExecutionException , MojoFailureException { final GrammarInfo [ ] grammarInfos = scanForGrammars ( ) ; if ( grammarInfos == null ) { getLog ( ) . info ( "Skipping non-existing source directory: " + getSourceDirectory ( ) ) ; return ; } else if ( grammarInfos . length <= 0 ) { getLog (...
Execute the tool .
131,366
private GrammarInfo [ ] scanForGrammars ( ) throws MojoExecutionException { if ( ! getSourceDirectory ( ) . isDirectory ( ) ) { return null ; } GrammarInfo [ ] grammarInfos ; getLog ( ) . debug ( "Scanning for grammars: " + getSourceDirectory ( ) ) ; try { final GrammarDirectoryScanner scanner = new GrammarDirectorySca...
Scans the configured source directory for grammar files which need processing .
131,367
protected void deleteTempDirectory ( final File tempDirectory ) { try { FileUtils . deleteDirectory ( tempDirectory ) ; } catch ( final IOException e ) { getLog ( ) . warn ( "Failed to delete temporary directory: " + tempDirectory , e ) ; } }
Deletes the specified temporary directory .
131,368
private File findSourceFile ( final String filename ) { final Collection < File > sourceRoots = this . nonGeneratedSourceRoots ; for ( final File sourceRoot : sourceRoots ) { final File sourceFile = new File ( sourceRoot , filename ) ; if ( sourceFile . exists ( ) ) { return sourceFile ; } } return null ; }
Determines whether the specified source file is already present in any of the compile source roots registered with the current Maven project .
131,369
private void addSourceRoot ( final File directory ) { if ( this . project != null ) { getLog ( ) . debug ( "Adding compile source root: " + directory ) ; this . project . addCompileSourceRoot ( directory . getAbsolutePath ( ) ) ; } }
Registers the specified directory as a compile source root for the current project .
131,370
protected JavaCC newJavaCC ( ) { final JavaCC javacc = new JavaCC ( ) ; javacc . setLog ( getLog ( ) ) ; javacc . setGrammarEncoding ( this . grammarEncoding ) ; javacc . setOutputEncoding ( this . outputEncoding ) ; javacc . setJdkVersion ( this . jdkVersion ) ; javacc . setBuildParser ( this . buildParser ) ; javacc ...
Creates a new facade to invoke JavaCC . Most options for the invocation are derived from the current values of the corresponding mojo parameters . The caller is responsible to set the input file and output directory on the returned facade .
131,371
public static File getResourceRoot ( final URL url , final String resource ) { String path = null ; if ( url != null ) { final String spec = url . toExternalForm ( ) ; if ( ( JAR_FILE ) . regionMatches ( true , 0 , spec , 0 , JAR_FILE . length ( ) ) ) { URL jar ; try { jar = new URL ( spec . substring ( JAR . length ( ...
Gets the absolute filesystem path to the class path root for the specified resource . The root is either a JAR file or a directory with loose class files . If the URL does not use a supported protocol an exception will be thrown .
131,372
private JTB newJTB ( ) { final JTB jtb = new JTB ( ) ; jtb . setLog ( getLog ( ) ) ; jtb . setDescriptiveFieldNames ( this . descriptiveFieldNames ) ; jtb . setJavadocFriendlyComments ( this . javadocFriendlyComments ) ; jtb . setNodeParentClass ( this . nodeParentClass ) ; jtb . setParentPointers ( this . parentPointe...
Creates a new facade to invoke JTB . Most options for the invocation are derived from the current values of the corresponding mojo parameters . The caller is responsible to set the input file output directories and packages on the returned facade .
131,373
public void setSourceDirectory ( final File directory ) { if ( ! directory . isAbsolute ( ) ) { throw new IllegalArgumentException ( "source directory is not absolute: " + directory ) ; } this . scanner . setBasedir ( directory ) ; }
Sets the absolute path to the source directory to scan for grammar files . This directory must exist or the scanner will report an error .
131,374
public void setOutputDirectory ( final File directory ) { if ( directory != null && ! directory . isAbsolute ( ) ) { throw new IllegalArgumentException ( "output directory is not absolute: " + directory ) ; } this . outputDirectory = directory ; }
Sets the absolute path to the output directory used to detect stale target files .
131,375
public void scan ( ) throws IOException { this . includedGrammars . clear ( ) ; this . scanner . scan ( ) ; final String [ ] includedFiles = this . scanner . getIncludedFiles ( ) ; for ( final String includedFile : includedFiles ) { final GrammarInfo grammarInfo = new GrammarInfo ( this . scanner . getBasedir ( ) , inc...
Scans the source directory for grammar files that match at least one inclusion pattern but no exclusion pattern optionally performing timestamp checking to exclude grammars whose corresponding parser files are up to date .
131,376
protected File [ ] getTargetFiles ( final File targetDirectory , final String grammarFile , final GrammarInfo grammarInfo ) { final File parserFile = new File ( targetDirectory , grammarInfo . getParserFile ( ) ) ; return new File [ ] { parserFile } ; }
Determines the output files corresponding to the specified grammar file .
131,377
private String findPackageName ( final String grammar ) { final String packageDeclaration = "package\\s+([^\\s.;]+(\\.[^\\s.;]+)*)\\s*;" ; final Matcher matcher = Pattern . compile ( packageDeclaration ) . matcher ( grammar ) ; if ( matcher . find ( ) ) { return matcher . group ( 1 ) ; } return "" ; }
Extracts the declared package name from the specified grammar file .
131,378
private String findParserName ( final String grammar ) { final String parserBegin = "PARSER_BEGIN\\s*\\(\\s*([^\\s\\)]+)\\s*\\)" ; final Matcher matcher = Pattern . compile ( parserBegin ) . matcher ( grammar ) ; if ( matcher . find ( ) ) { return matcher . group ( 1 ) ; } return "" ; }
Extracts the simple parser name from the specified grammar file .
131,379
protected String getToolName ( ) { final String name = getClass ( ) . getName ( ) ; return name . substring ( name . lastIndexOf ( '.' ) + 1 ) ; }
Gets the name of the tool .
131,380
public void run ( ) throws MojoExecutionException , MojoFailureException { ESuccess exitCode ; try { if ( getLog ( ) . isDebugEnabled ( ) ) { getLog ( ) . debug ( "Running " + getToolName ( ) + ": " + this ) ; } exitCode = execute ( ) ; } catch ( final Exception e ) { throw new MojoExecutionException ( "Failed to execu...
Runs the tool using the previously set parameters .
131,381
public void setOutputFile ( final File value ) { if ( value != null && ! value . isAbsolute ( ) ) { throw new IllegalArgumentException ( "path is not absolute: " + value ) ; } this . outputFile = value ; }
Sets the absolute path to the output file .
131,382
private String [ ] _generateArguments ( ) { final List < String > argsList = new ArrayList < > ( ) ; if ( StringUtils . isNotEmpty ( this . grammarEncoding ) ) { argsList . add ( "-GRAMMAR_ENCODING=" + this . grammarEncoding ) ; } if ( StringUtils . isNotEmpty ( this . outputEncoding ) ) { argsList . add ( "-OUTPUT_ENC...
Assembles the command line arguments for the invocation of JJDoc according to the configuration .
131,383
public final PowerAdapter offset ( int offset ) { if ( offset <= 0 ) { return this ; } if ( offset == Integer . MAX_VALUE ) { return EMPTY ; } return new OffsetAdapter ( this , offset ) ; }
Returns a new adapter that presents all items of this adapter starting at the specified offset .
131,384
public final PowerAdapter limit ( int limit ) { if ( limit == Integer . MAX_VALUE ) { return this ; } if ( limit <= 0 ) { return EMPTY ; } return new LimitAdapter ( this , limit ) ; }
Returns a new adapter that presents all items of this adapter up until the specified limit .
131,385
private boolean shouldAnimate ( ) { if ( ! mAnimationEnabled ) { return false ; } Display display = currentDisplay ( ) ; if ( display == null ) { return false ; } if ( mVisibleStartTime <= 0 ) { return false ; } long threshold = ( long ) ( 1000 / display . getRefreshRate ( ) ) ; long millisVisible = elapsedRealtime ( )...
Returns whether now is an appropriate time to perform animations .
131,386
protected final void notifyChanged ( ) { for ( int i = mObservers . size ( ) - 1 ; i >= 0 ; i -- ) { mObservers . get ( i ) . onChanged ( ) ; } }
Notify observers that the condition has changed .
131,387
protected final void notifyError ( final Throwable e ) { checkNotNull ( e , "e" ) ; runOnUiThread ( new Runnable ( ) { public void run ( ) { mErrorObservable . notifyError ( e ) ; } } ) ; }
Dispatch an error notification on the UI thread .
131,388
public final < O > Data < O > filter ( final Class < O > type ) { return ( Data < O > ) new FilterData < > ( this , new Predicate < Object > ( ) { public boolean apply ( Object o ) { return type . isInstance ( o ) ; } } ) ; }
Filter this data by class . The resulting elements are guaranteed to be of the given type .
131,389
private void loadLoop ( ) throws InterruptedException { boolean firstItem = true ; boolean moreAvailable = true ; while ( moreAvailable ) { if ( currentThread ( ) . isInterrupted ( ) ) { throw new InterruptedException ( ) ; } try { setLoading ( true ) ; final Result < ? extends T > result = load ( ) ; moreAvailable = r...
Loads each increment until full range has been loading halting in between increment until instructed to proceed .
131,390
private void updateCursorObserver ( ) { Cursor newObservedCursor = getDataObserverCount ( ) > 0 ? mCursor : null ; if ( newObservedCursor != mObservedCursor ) { if ( mObservedCursor != null ) { mObservedCursor . unregisterContentObserver ( mCursorContentObserver ) ; } mObservedCursor = newObservedCursor ; if ( mObserve...
Registers or unregisters with the cursor . Idempotent .
131,391
private void closeCursor ( ) { if ( mCursor != null ) { int count = mCursor . getCount ( ) ; mCursor . close ( ) ; mCursor = null ; notifyItemRangeRemoved ( 0 , count ) ; } updateCursorObserver ( ) ; }
Closes the cursor notifying observers of data changes as necessary .
131,392
public void printElement ( String elementName , Object value ) { println ( "<" + elementName + ">" + ( value == null ? "" : escape ( value . toString ( ) ) ) + "</" + elementName + ">" ) ; }
Output a complete element with the given content .
131,393
public void printElement ( String elementName , String value , Map < String , String > attributes ) { print ( "<" + elementName ) ; for ( Entry < String , String > entry : attributes . entrySet ( ) ) { print ( " " + entry . getKey ( ) + "=\"" + escape ( entry . getValue ( ) ) + "\"" ) ; } if ( value != null ) { println...
Output a complete element with the given content and attributes .
131,394
public String escape ( String in ) { StringBuffer out = new StringBuffer ( ) ; for ( char c : in . toCharArray ( ) ) { switch ( c ) { case '<' : out . append ( "&lt;" ) ; break ; case '>' : out . append ( "&gt;" ) ; break ; case '&' : out . append ( "&amp;" ) ; break ; case '"' : out . append ( "&quot;" ) ; break ; def...
Translate reserved XML characters to XML entities .
131,395
public static String removeNewLines ( String textContent ) { if ( textContent == null ) { return "" ; } StringBuilder s = new StringBuilder ( ) ; boolean inNl = false ; for ( char c : textContent . toCharArray ( ) ) { if ( c == '\n' ) { if ( ! inNl ) { s . append ( ' ' ) ; inNl = true ; } } else { inNl = false ; s . ap...
Replace multiple newline characters with a single space .
131,396
public void buildAll ( MessageMLParser context , org . w3c . dom . Element element ) throws InvalidInputException , ProcessingException { NamedNodeMap attr = element . getAttributes ( ) ; for ( int i = 0 ; i < attr . getLength ( ) ; i ++ ) { buildAttribute ( attr . item ( i ) ) ; } NodeList children = element . getChil...
Process a DOM element descending into its children and construct the output MessageML tree .
131,397
void buildAttribute ( org . w3c . dom . Node item ) throws InvalidInputException { switch ( item . getNodeName ( ) ) { case CLASS_ATTR : attributes . put ( CLASS_ATTR , getStringAttribute ( item ) ) ; break ; case STYLE_ATTR : final String styleAttribute = getStringAttribute ( item ) ; Styles . validate ( styleAttribut...
Parse a DOM attribute into MessageML element properties .
131,398
private void buildNode ( MessageMLParser context , org . w3c . dom . Node node ) throws InvalidInputException , ProcessingException { switch ( node . getNodeType ( ) ) { case org . w3c . dom . Node . TEXT_NODE : buildText ( ( Text ) node ) ; break ; case org . w3c . dom . Node . ELEMENT_NODE : buildElement ( context , ...
Build a text node or a MessageML element based on the provided DOM node .
131,399
private void buildElement ( MessageMLParser context , org . w3c . dom . Element element ) throws InvalidInputException , ProcessingException { Element child = context . createElement ( element , this ) ; child . buildAll ( context , element ) ; child . validate ( ) ; addChild ( child ) ; }
Build a MessageML element based on the provided DOM element and descend into its children .