idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
134,300
public final Span [ ] multiWordsToSpans ( final String [ ] tokens ) { final List < Span > multiWordsFound = new LinkedList < Span > ( ) ; for ( int offsetFrom = 0 ; offsetFrom < tokens . length ; offsetFrom ++ ) { Span multiwordFound = null ; String tokensSearching [ ] = new String [ ] { } ; for ( int offsetTo = offset...
Detects multiword expressions ignoring case .
134,301
private int compareDate ( Date a , Date b ) { final Date ta = new Date ( a . getTime ( ) ) ; final Date tb = new Date ( b . getTime ( ) ) ; final long d1 = setHourToZero ( ta ) . getTime ( ) ; final long d2 = setHourToZero ( tb ) . getTime ( ) ; return ( int ) Math . round ( ( d2 - d1 ) / 1000.0 / 60.0 / 60.0 / 24.0 ) ...
Calculate the number of days between two dates
134,302
@ SuppressWarnings ( "deprecation" ) private Date setHourToZero ( Date in ) { final Date d = new Date ( in . getTime ( ) ) ; d . setHours ( 0 ) ; d . setMinutes ( 0 ) ; d . setSeconds ( 0 ) ; long t = d . getTime ( ) / 1000 ; t = t * 1000 ; return new Date ( t ) ; }
Set hour minutes second and milliseconds to zero .
134,303
@ SuppressWarnings ( "deprecation" ) private Date getWeekOne ( int year ) { GregorianCalendar weekOne = new GregorianCalendar ( ) ; weekOne . setFirstDayOfWeek ( getFirstDayOfWeek ( ) ) ; weekOne . setMinimalDaysInFirstWeek ( getMinimalDaysInFirstWeek ( ) ) ; weekOne . setTime ( new Date ( year , 0 , 1 ) ) ; int dow = ...
Gets the date of the first week for the specified year .
134,304
protected final void createTagDictionary ( final String dictPath ) { if ( ! dictPath . equalsIgnoreCase ( Flags . DEFAULT_DICT_PATH ) ) { try { getPosTaggerFactory ( ) . setTagDictionary ( getPosTaggerFactory ( ) . createTagDictionary ( new File ( dictPath ) ) ) ; } catch ( final IOException e ) { throw new TerminateTo...
Create a tag dictionary with the dictionary contained in the dictPath .
134,305
protected final void createAutomaticDictionary ( final ObjectStream < POSSample > aDictSamples , final int aDictCutOff ) { if ( aDictCutOff != Flags . DEFAULT_DICT_CUTOFF ) { try { TagDictionary dict = getPosTaggerFactory ( ) . getTagDictionary ( ) ; if ( dict == null ) { dict = getPosTaggerFactory ( ) . createEmptyTag...
Automatically create a tag dictionary from training data .
134,306
protected final Dictionary createNgramDictionary ( final ObjectStream < POSSample > aDictSamples , final int aNgramCutoff ) { Dictionary ngramDict = null ; if ( aNgramCutoff != Flags . DEFAULT_DICT_CUTOFF ) { System . err . print ( "Building ngram dictionary ... " ) ; try { ngramDict = POSTaggerME . buildNGramDictionar...
Create ngram dictionary from training data .
134,307
public String getQualifiedSurroundingClassName ( ) { TypeElement typeElement = ( TypeElement ) field . getEnclosingElement ( ) ; return typeElement . getQualifiedName ( ) . toString ( ) ; }
Get the full qualified class name this field is part of .
134,308
private static void setInternal ( int [ ] array , int fromIndex , int toIndex ) { int first = wordIndex ( fromIndex ) ; int last = wordIndex ( toIndex ) ; maybeGrowArrayToIndex ( array , last ) ; int startBit = bitOffset ( fromIndex ) ; int endBit = bitOffset ( toIndex ) ; if ( first == last ) { maskInWord ( array , fi...
Sets all bits to true within the given range .
134,309
private static int lastSetWordIndex ( int [ ] array ) { int i = array . length - 1 ; for ( ; i >= 0 && wordAt ( array , i ) == 0 ; -- i ) { } return i ; }
Returns the index of the last word containing a true bit in an array or - 1 if none .
134,310
private static void flipMaskedWord ( int [ ] array , int index , int from , int to ) { if ( from == to ) { return ; } to = 32 - to ; int word = wordAt ( array , index ) ; word ^= ( ( 0xffffffff >>> from ) << ( from + to ) ) >>> to ; array [ index ] = word & WORD_MASK ; }
Flips all bits in a word within the given range .
134,311
private static void maskInWord ( int [ ] array , int index , int from , int to ) { if ( from == to ) { return ; } to = 32 - to ; int word = wordAt ( array , index ) ; word |= ( ( 0xffffffff >>> from ) << ( from + to ) ) >>> to ; array [ index ] = word & WORD_MASK ; }
Sets all bits to true in a word within the given bit range .
134,312
private static void maskOutWord ( int [ ] array , int index , int from , int to ) { if ( from == to ) { return ; } int word = wordAt ( array , index ) ; if ( word == 0 ) { return ; } int mask ; if ( from != 0 ) { mask = 0xffffffff >>> ( 32 - from ) ; } else { mask = 0 ; } if ( to != 32 ) { mask |= 0xffffffff << to ; } ...
Sets all bits to false in a word within the given bit range .
134,313
public final List < Morpheme > getMorphemes ( final String [ ] tokens ) { final List < String > origPosTags = posAnnotate ( tokens ) ; final List < Morpheme > morphemes = getMorphemesFromStrings ( origPosTags , tokens ) ; return morphemes ; }
Get morphological analysis from a tokenized sentence .
134,314
public final List < String > posAnnotate ( final String [ ] tokens ) { final String [ ] annotatedText = this . posTagger . tag ( tokens ) ; final List < String > posTags = new ArrayList < String > ( Arrays . asList ( annotatedText ) ) ; return posTags ; }
Produce postags from a tokenized sentence .
134,315
public final String [ ] [ ] getAllPosTags ( final String [ ] tokens ) { final String [ ] [ ] allPosTags = this . posTagger . tag ( 13 , tokens ) ; return allPosTags ; }
Produces a multidimensional array containing all the tagging possible for a given sentence .
134,316
@ GwtIncompatible ( "incompatible method" ) public static < T extends Comparable < ? super T > > T median ( final T ... items ) { Validate . notEmpty ( items ) ; Validate . noNullElements ( items ) ; final TreeSet < T > sort = new TreeSet < > ( ) ; Collections . addAll ( sort , items ) ; @ SuppressWarnings ( "unchecked...
Find the best guess middle value among comparables . If there is an even number of total values the lower of the two middle values will be returned .
134,317
public static < T > T mode ( final T ... items ) { if ( ArrayUtils . isNotEmpty ( items ) ) { final HashMap < T , MutableInt > occurrences = new HashMap < > ( items . length ) ; for ( final T t : items ) { final MutableInt count = occurrences . get ( t ) ; if ( count == null ) { occurrences . put ( t , new MutableInt (...
Find the most frequently occurring item .
134,318
public final void crossValidate ( final TrainingParameters params ) { POSTaggerCrossValidator validator = null ; try { validator = getPOSTaggerCrossValidator ( params ) ; validator . evaluate ( this . trainSamples , this . folds ) ; } catch ( final IOException e ) { System . err . println ( "IO error while loading trai...
Cross validate when no separate testset is available .
134,319
private POSTaggerCrossValidator getPOSTaggerCrossValidator ( final TrainingParameters params ) { final File dictPath = new File ( Flags . getDictionaryFeatures ( params ) ) ; if ( this . posTaggerFactory == null ) { throw new IllegalStateException ( "You must create the POSTaggerFactory features!" ) ; } POSTaggerCrossV...
Get the postagger cross validator .
134,320
private static Type [ ] extractTypeArgumentsFrom ( final Map < TypeVariable < ? > , Type > mappings , final TypeVariable < ? > [ ] variables ) { final Type [ ] result = new Type [ variables . length ] ; int index = 0 ; for ( final TypeVariable < ? > var : variables ) { Validate . isTrue ( mappings . containsKey ( var )...
Helper method to establish the formal parameters for a parameterized type .
134,321
public static < V > String replace ( final Object source , final Map < String , V > valueMap ) { return new StrSubstitutor ( valueMap ) . replace ( source ) ; }
Replaces all the occurrences of variables in the given source object with their matching values from the map .
134,322
public static < V > String replace ( final Object source , final Map < String , V > valueMap , final String prefix , final String suffix ) { return new StrSubstitutor ( valueMap , prefix , suffix ) . replace ( source ) ; }
Replaces all the occurrences of variables in the given source object with their matching values from the map . This method allows to specify a custom variable prefix and suffix
134,323
public static String replace ( final Object source , final Properties valueProperties ) { if ( valueProperties == null ) { return source . toString ( ) ; } final Map < String , String > valueMap = new HashMap < > ( ) ; final Enumeration < ? > propNames = valueProperties . propertyNames ( ) ; while ( propNames . hasMore...
Replaces all the occurrences of variables in the given source object with their matching values from the properties .
134,324
public String replace ( final CharSequence source ) { if ( source == null ) { return null ; } return replace ( source , 0 , source . length ( ) ) ; }
Replaces all the occurrences of variables with their matching values from the resolver using the given source as a template . The source is not altered by this method .
134,325
public String replace ( final StrBuilder source ) { if ( source == null ) { return null ; } final StrBuilder buf = new StrBuilder ( source . length ( ) ) . append ( source ) ; substitute ( buf , 0 , buf . length ( ) ) ; return buf . toString ( ) ; }
Replaces all the occurrences of variables with their matching values from the resolver using the given source builder as a template . The builder is not altered by this method .
134,326
public boolean replaceIn ( final StrBuilder source ) { if ( source == null ) { return false ; } return substitute ( source , 0 , source . length ( ) ) ; }
Replaces all the occurrences of variables within the given source builder with their matching values from the resolver .
134,327
@ SuppressWarnings ( "unchecked" ) public static < L , M , R > ImmutableTriple < L , M , R > nullTriple ( ) { return NULL ; }
Returns an immutable triple of nulls .
134,328
static Token [ ] lexx ( final String format ) { final ArrayList < Token > list = new ArrayList < > ( format . length ( ) ) ; boolean inLiteral = false ; StringBuilder buffer = null ; Token previous = null ; for ( int i = 0 ; i < format . length ( ) ; i ++ ) { final char ch = format . charAt ( i ) ; if ( inLiteral && ch...
Parses a classic date format string into Tokens
134,329
public StrBuilder setNullText ( String nullText ) { if ( nullText != null && nullText . isEmpty ( ) ) { nullText = null ; } this . nullText = nullText ; return this ; }
Sets the text to be appended when null is added .
134,330
public StrBuilder setLength ( final int length ) { if ( length < 0 ) { throw new StringIndexOutOfBoundsException ( length ) ; } if ( length < size ) { size = length ; } else if ( length > size ) { ensureCapacity ( length ) ; final int oldEnd = size ; final int newEnd = length ; size = length ; for ( int i = oldEnd ; i ...
Updates the length of the builder by either dropping the last characters or adding filler of Unicode zero .
134,331
public StrBuilder ensureCapacity ( final int capacity ) { if ( capacity > buffer . length ) { final char [ ] old = buffer ; buffer = new char [ capacity * 2 ] ; System . arraycopy ( old , 0 , buffer , 0 , size ) ; } return this ; }
Checks the capacity and ensures that it is at least the size specified .
134,332
public StrBuilder minimizeCapacity ( ) { if ( buffer . length > length ( ) ) { final char [ ] old = buffer ; buffer = new char [ length ( ) ] ; System . arraycopy ( old , 0 , buffer , 0 , size ) ; } return this ; }
Minimizes the capacity to the actual length of the string .
134,333
public StrBuilder setCharAt ( final int index , final char ch ) { if ( index < 0 || index >= length ( ) ) { throw new StringIndexOutOfBoundsException ( index ) ; } buffer [ index ] = ch ; return this ; }
Sets the character at the specified index .
134,334
public StrBuilder deleteCharAt ( final int index ) { if ( index < 0 || index >= size ) { throw new StringIndexOutOfBoundsException ( index ) ; } deleteImpl ( index , index + 1 , 1 ) ; return this ; }
Deletes the character at the specified index .
134,335
public char [ ] toCharArray ( ) { if ( size == 0 ) { return ArrayUtils . EMPTY_CHAR_ARRAY ; } final char chars [ ] = new char [ size ] ; System . arraycopy ( buffer , 0 , chars , 0 , size ) ; return chars ; }
Copies the builder s character array into a new character array .
134,336
public char [ ] toCharArray ( final int startIndex , int endIndex ) { endIndex = validateRange ( startIndex , endIndex ) ; final int len = endIndex - startIndex ; if ( len == 0 ) { return ArrayUtils . EMPTY_CHAR_ARRAY ; } final char chars [ ] = new char [ len ] ; System . arraycopy ( buffer , startIndex , chars , 0 , l...
Copies part of the builder s character array into a new character array .
134,337
public StrBuilder append ( final boolean value ) { if ( value ) { ensureCapacity ( size + 4 ) ; buffer [ size ++ ] = 't' ; buffer [ size ++ ] = 'r' ; buffer [ size ++ ] = 'u' ; buffer [ size ++ ] = 'e' ; } else { ensureCapacity ( size + 5 ) ; buffer [ size ++ ] = 'f' ; buffer [ size ++ ] = 'a' ; buffer [ size ++ ] = 'l...
Appends a boolean value to the string builder .
134,338
public StrBuilder append ( final char ch ) { final int len = length ( ) ; ensureCapacity ( len + 1 ) ; buffer [ size ++ ] = ch ; return this ; }
Appends a char value to the string builder .
134,339
public StrBuilder appendSeparator ( final String standard , final String defaultIfEmpty ) { final String str = isEmpty ( ) ? defaultIfEmpty : standard ; if ( str != null ) { append ( str ) ; } return this ; }
Appends one of both separators to the StrBuilder . If the builder is currently empty it will append the defaultIfEmpty - separator Otherwise it will append the standard - separator
134,340
public StrBuilder appendPadding ( final int length , final char padChar ) { if ( length >= 0 ) { ensureCapacity ( size + length ) ; for ( int i = 0 ; i < length ; i ++ ) { buffer [ size ++ ] = padChar ; } } return this ; }
Appends the pad character to the builder the specified number of times .
134,341
public StrBuilder insert ( final int index , final Object obj ) { if ( obj == null ) { return insert ( index , nullText ) ; } return insert ( index , obj . toString ( ) ) ; }
Inserts the string representation of an object into this builder . Inserting null will use the stored null text value .
134,342
public StrBuilder insert ( final int index , String str ) { validateIndex ( index ) ; if ( str == null ) { str = nullText ; } if ( str != null ) { final int strLen = str . length ( ) ; if ( strLen > 0 ) { final int newSize = size + strLen ; ensureCapacity ( newSize ) ; System . arraycopy ( buffer , index , buffer , ind...
Inserts the string into this builder . Inserting null will use the stored null text value .
134,343
public StrBuilder insert ( final int index , final char chars [ ] ) { validateIndex ( index ) ; if ( chars == null ) { return insert ( index , nullText ) ; } final int len = chars . length ; if ( len > 0 ) { ensureCapacity ( size + len ) ; System . arraycopy ( buffer , index , buffer , index + len , size - index ) ; Sy...
Inserts the character array into this builder . Inserting null will use the stored null text value .
134,344
public StrBuilder insert ( final int index , final char chars [ ] , final int offset , final int length ) { validateIndex ( index ) ; if ( chars == null ) { return insert ( index , nullText ) ; } if ( offset < 0 || offset > chars . length ) { throw new StringIndexOutOfBoundsException ( "Invalid offset: " + offset ) ; }...
Inserts part of the character array into this builder . Inserting null will use the stored null text value .
134,345
public StrBuilder delete ( final int startIndex , int endIndex ) { endIndex = validateRange ( startIndex , endIndex ) ; final int len = endIndex - startIndex ; if ( len > 0 ) { deleteImpl ( startIndex , endIndex , len ) ; } return this ; }
Deletes the characters between the two specified indices .
134,346
public StrBuilder deleteAll ( final String str ) { final int len = ( str == null ? 0 : str . length ( ) ) ; if ( len > 0 ) { int index = indexOf ( str , 0 ) ; while ( index >= 0 ) { deleteImpl ( index , index + len , len ) ; index = indexOf ( str , index ) ; } } return this ; }
Deletes the string wherever it occurs in the builder .
134,347
public StrBuilder replace ( final int startIndex , int endIndex , final String replaceStr ) { endIndex = validateRange ( startIndex , endIndex ) ; final int insertLen = ( replaceStr == null ? 0 : replaceStr . length ( ) ) ; replaceImpl ( startIndex , endIndex , endIndex - startIndex , replaceStr , insertLen ) ; return ...
Replaces a portion of the string builder with another string . The length of the inserted string does not have to match the removed length .
134,348
public StrBuilder replaceAll ( final char search , final char replace ) { if ( search != replace ) { for ( int i = 0 ; i < size ; i ++ ) { if ( buffer [ i ] == search ) { buffer [ i ] = replace ; } } } return this ; }
Replaces the search character with the replace character throughout the builder .
134,349
public StrBuilder replaceFirst ( final char search , final char replace ) { if ( search != replace ) { for ( int i = 0 ; i < size ; i ++ ) { if ( buffer [ i ] == search ) { buffer [ i ] = replace ; break ; } } } return this ; }
Replaces the first instance of the search character with the replace character in the builder .
134,350
public StrBuilder replaceAll ( final String searchStr , final String replaceStr ) { final int searchLen = ( searchStr == null ? 0 : searchStr . length ( ) ) ; if ( searchLen > 0 ) { final int replaceLen = ( replaceStr == null ? 0 : replaceStr . length ( ) ) ; int index = indexOf ( searchStr , 0 ) ; while ( index >= 0 )...
Replaces the search string with the replace string throughout the builder .
134,351
public StrBuilder reverse ( ) { if ( size == 0 ) { return this ; } final int half = size / 2 ; final char [ ] buf = buffer ; for ( int leftIdx = 0 , rightIdx = size - 1 ; leftIdx < half ; leftIdx ++ , rightIdx -- ) { final char swap = buf [ leftIdx ] ; buf [ leftIdx ] = buf [ rightIdx ] ; buf [ rightIdx ] = swap ; } re...
Reverses the string builder placing each character in the opposite index .
134,352
public StrBuilder trim ( ) { if ( size == 0 ) { return this ; } int len = size ; final char [ ] buf = buffer ; int pos = 0 ; while ( pos < len && buf [ pos ] <= ' ' ) { pos ++ ; } while ( pos < len && buf [ len - 1 ] <= ' ' ) { len -- ; } if ( len < size ) { delete ( len , size ) ; } if ( pos > 0 ) { delete ( 0 , pos )...
Trims the builder by removing characters less than or equal to a space from the beginning and end .
134,353
public boolean contains ( final char ch ) { final char [ ] thisBuf = buffer ; for ( int i = 0 ; i < this . size ; i ++ ) { if ( thisBuf [ i ] == ch ) { return true ; } } return false ; }
Checks if the string builder contains the specified char .
134,354
public int indexOf ( final char ch , int startIndex ) { startIndex = ( startIndex < 0 ? 0 : startIndex ) ; if ( startIndex >= size ) { return - 1 ; } final char [ ] thisBuf = buffer ; for ( int i = startIndex ; i < size ; i ++ ) { if ( thisBuf [ i ] == ch ) { return i ; } } return - 1 ; }
Searches the string builder to find the first reference to the specified char .
134,355
public int lastIndexOf ( final char ch , int startIndex ) { startIndex = ( startIndex >= size ? size - 1 : startIndex ) ; if ( startIndex < 0 ) { return - 1 ; } for ( int i = startIndex ; i >= 0 ; i -- ) { if ( buffer [ i ] == ch ) { return i ; } } return - 1 ; }
Searches the string builder to find the last reference to the specified char .
134,356
public boolean equalsIgnoreCase ( final StrBuilder other ) { if ( this == other ) { return true ; } if ( this . size != other . size ) { return false ; } final char thisBuf [ ] = this . buffer ; final char otherBuf [ ] = other . buffer ; for ( int i = size - 1 ; i >= 0 ; i -- ) { final char c1 = thisBuf [ i ] ; final c...
Checks the contents of this builder against another to see if they contain the same character content ignoring case .
134,357
protected int validateRange ( final int startIndex , int endIndex ) { if ( startIndex < 0 ) { throw new StringIndexOutOfBoundsException ( startIndex ) ; } if ( endIndex > size ) { endIndex = size ; } if ( startIndex > endIndex ) { throw new StringIndexOutOfBoundsException ( "end < start" ) ; } return endIndex ; }
Validates parameters defining a range of the builder .
134,358
public T get ( ) throws ConcurrentException { T result = object ; if ( result == NO_INIT ) { synchronized ( this ) { result = object ; if ( result == NO_INIT ) { object = result = initialize ( ) ; } } } return result ; }
Returns the object wrapped by this instance . On first access the object is created . After that it is cached and can be accessed pretty fast .
134,359
public static Thread findThreadById ( final long threadId , final ThreadGroup threadGroup ) { Validate . isTrue ( threadGroup != null , "The thread group must not be null" ) ; final Thread thread = findThreadById ( threadId ) ; if ( thread != null && threadGroup . equals ( thread . getThreadGroup ( ) ) ) { return threa...
Return the active thread with the specified id if it belongs to the specified thread group .
134,360
public static Thread findThreadById ( final long threadId , final String threadGroupName ) { Validate . isTrue ( threadGroupName != null , "The thread group name must not be null" ) ; final Thread thread = findThreadById ( threadId ) ; if ( thread != null && thread . getThreadGroup ( ) != null && thread . getThreadGrou...
Return the active thread with the specified id if it belongs to a thread group with the specified group name .
134,361
public static Collection < Thread > findThreadsByName ( final String threadName , final ThreadGroup threadGroup ) { return findThreads ( threadGroup , false , new NamePredicate ( threadName ) ) ; }
Return active threads with the specified name if they belong to a specified thread group .
134,362
public static Collection < Thread > findThreadsByName ( final String threadName , final String threadGroupName ) { Validate . isTrue ( threadName != null , "The thread name must not be null" ) ; Validate . isTrue ( threadGroupName != null , "The thread group name must not be null" ) ; final Collection < ThreadGroup > t...
Return active threads with the specified name if they belong to a thread group with the specified group name .
134,363
public static Thread findThreadById ( final long threadId ) { final Collection < Thread > result = findThreads ( new ThreadIdPredicate ( threadId ) ) ; return result . isEmpty ( ) ? null : result . iterator ( ) . next ( ) ; }
Return the active thread with the specified id .
134,364
public < T > Optional < T > as ( Class < T > type ) { return inner . filter ( d -> d . is ( type ) ) . map ( d -> d . as ( type ) ) ; }
Returns inner value as optional of input type if the inner value is absent or not an instance of the input type an empty optional is returned
134,365
@ SuppressWarnings ( "unchecked" ) private static < R , T extends Throwable > R typeErasure ( final Throwable throwable ) throws T { throw ( T ) throwable ; }
Claim a Throwable is another Exception type using type erasure . This hides a checked exception from the java compiler allowing a checked exception to be thrown without having the exception in the method s throw clause .
134,366
@ GwtIncompatible ( "incompatible method" ) public static boolean hasCause ( Throwable chain , final Class < ? extends Throwable > type ) { if ( chain instanceof UndeclaredThrowableException ) { chain = chain . getCause ( ) ; } return type . isInstance ( chain ) ; }
Does the throwable s causal chain have an immediate or wrapped exception of the given type?
134,367
private boolean hasStage ( InputProcessor processor ) { if ( ! ( processor instanceof InputMultiplexer ) ) { return processor == stage ; } InputMultiplexer im = ( InputMultiplexer ) processor ; SnapshotArray < InputProcessor > ips = im . getProcessors ( ) ; for ( InputProcessor ip : ips ) { if ( hasStage ( ip ) ) { ret...
Compares the given processor to the console s stage . If given a multiplexer it is iterated through recursively to check all of the multiplexer s processors for comparison .
134,368
public String tag ( final String word , final String posTag ) { final List < WordData > wdList = this . dictLookup . lookup ( word . toLowerCase ( ) ) ; String newPosTag = null ; for ( final WordData wd : wdList ) { newPosTag = wd . getTag ( ) . toString ( ) ; } if ( newPosTag == null ) { newPosTag = posTag ; } return ...
Get the postag for a surface form from a FSA morfologik generated dictionary .
134,369
private static String appendIfMissing ( final String str , final CharSequence suffix , final boolean ignoreCase , final CharSequence ... suffixes ) { if ( str == null || isEmpty ( suffix ) || endsWith ( str , suffix , ignoreCase ) ) { return str ; } if ( suffixes != null && suffixes . length > 0 ) { for ( final CharSeq...
Appends the suffix to the end of the string if the string does not already end with the suffix .
134,370
public static String appendIfMissing ( final String str , final CharSequence suffix , final CharSequence ... suffixes ) { return appendIfMissing ( str , suffix , false , suffixes ) ; }
Appends the suffix to the end of the string if the string does not already end with any of the suffixes .
134,371
public static String appendIfMissingIgnoreCase ( final String str , final CharSequence suffix , final CharSequence ... suffixes ) { return appendIfMissing ( str , suffix , true , suffixes ) ; }
Appends the suffix to the end of the string if the string does not already end case insensitive with any of the suffixes .
134,372
public static String prependIfMissingIgnoreCase ( final String str , final CharSequence prefix , final CharSequence ... prefixes ) { return prependIfMissing ( str , prefix , true , prefixes ) ; }
Prepends the prefix to the start of the string if the string does not already start case insensitive with any of the prefixes .
134,373
public final void getAllTagsLemmasToNAF ( final KAFDocument kaf ) { final List < List < WF > > sentences = kaf . getSentences ( ) ; for ( final List < WF > wfs : sentences ) { final List < ixa . kaflib . Span < WF > > tokenSpans = new ArrayList < ixa . kaflib . Span < WF > > ( ) ; final String [ ] tokens = new String [...
Add all postags and lemmas to morphofeat attribute .
134,374
public final String getAllTagsLemmasToCoNLL ( final KAFDocument kaf ) { final StringBuilder sb = new StringBuilder ( ) ; final List < List < WF > > sentences = kaf . getSentences ( ) ; for ( final List < WF > wfs : sentences ) { final List < ixa . kaflib . Span < WF > > tokenSpans = new ArrayList < ixa . kaflib . Span ...
Give all lemmas and tags possible for a sentence in conll tabulated format .
134,375
private boolean isSetterForField ( ExecutableElement setter , VariableElement field ) { return setter . getParameters ( ) != null && setter . getParameters ( ) . size ( ) == 1 && setter . getParameters ( ) . get ( 0 ) . asType ( ) . equals ( field . asType ( ) ) ; }
Checks if the setter method is valid for the given field
134,376
private TypeElement getSurroundingClass ( Element e ) throws ProcessingException { if ( e . getEnclosingElement ( ) . getKind ( ) == ElementKind . CLASS ) { return ( TypeElement ) e . getEnclosingElement ( ) ; } throw new ProcessingException ( e , "Field %s is not part of a class. Only fields in a class can be annotat...
Checks if a Element is in class and returns the TypeElement of the surrounding class
134,377
private TypeElement checkAndGetClass ( Element e ) throws ProcessingException { if ( e . getKind ( ) != ElementKind . CLASS ) { throw new ProcessingException ( e , "%s is annotated with @%s but only classes can be annotated with this annotation" , e . toString ( ) , ObjectMappable . class . getSimpleName ( ) ) ; } retu...
Check the Element if it s a class and returns the corresponding TypeElement
134,378
private FieldSpec generateRxMappingMethod ( ObjectMappableAnnotatedClass clazz ) { String objectVarName = "item" ; String cursorVarName = "cursor" ; TypeName elementType = ClassName . get ( clazz . getElement ( ) . asType ( ) ) ; CodeBlock . Builder initBlockBuilder = CodeBlock . builder ( ) . add ( "new $L<$L, $L>() {...
Generates the field that can be used as RxJava method
134,379
private TypeSpec generateContentValuesBuilderClass ( ObjectMappableAnnotatedClass clazz , String mapperClassName , String className ) { String cvVarName = "contentValues" ; MethodSpec constructor = MethodSpec . constructorBuilder ( ) . addModifiers ( Modifier . PRIVATE ) . addStatement ( "$L = new $T()" , cvVarName , C...
Generates the ContentValues Builder Class
134,380
private MethodSpec generateContentValuesMethod ( ObjectMappableAnnotatedClass clazz , String mapperClassName , String className ) { ClassName typeName = ClassName . get ( getPackageName ( clazz ) , mapperClassName , className ) ; return MethodSpec . methodBuilder ( "contentValues" ) . addJavadoc ( "Get a typesafe Conte...
Generates a static file to get
134,381
private String getPackageName ( ObjectMappableAnnotatedClass clazz ) { PackageElement pkg = elements . getPackageOf ( clazz . getElement ( ) ) ; return pkg . isUnnamed ( ) ? "" : pkg . getQualifiedName ( ) . toString ( ) ; }
Get the package name of a certain clazz
134,382
protected QueryBuilder rawQueryOnManyTables ( final Iterable < String > tables , final String sql ) { return new QueryBuilder ( tables , sql ) ; }
Creates a raw query and enables auto updates for the given tables
134,383
private QueryObservable executeQuery ( QueryBuilder queryBuilder ) { String sql = queryBuilder . rawStatement ; Iterable < String > affectedTables = queryBuilder . rawStatementAffectedTables ; if ( queryBuilder . statement != null ) { SqlCompileable . CompileableStatement compileableStatement = queryBuilder . statement...
Executes the a query
134,384
protected Observable < Long > insert ( final String table , final ContentValues contentValues ) { return Observable . defer ( new Func0 < Observable < Long > > ( ) { public Observable < Long > call ( ) { return Observable . just ( db . insert ( table , contentValues ) ) ; } } ) ; }
Insert a row into the given table
134,385
protected Observable < Integer > delete ( final String table ) { return delete ( table , null ) ; }
Deletes all rows from a table
134,386
protected Observable < Integer > delete ( final String table , final String whereClause , final String ... whereArgs ) { return Observable . defer ( new Func0 < Observable < Integer > > ( ) { public Observable < Integer > call ( ) { return Observable . just ( db . delete ( table , whereClause , whereArgs ) ) ; } } ) ; ...
Delete data from a table
134,387
private static Locale parseLocale ( final String str ) { if ( isISO639LanguageCode ( str ) ) { return new Locale ( str ) ; } final String [ ] segments = str . split ( "_" , - 1 ) ; final String language = segments [ 0 ] ; if ( segments . length == 2 ) { final String country = segments [ 1 ] ; if ( isISO639LanguageCode ...
Tries to parse a locale from the given String .
134,388
private static boolean isISO639LanguageCode ( final String str ) { return StringUtils . isAllLowerCase ( str ) && ( str . length ( ) == 2 || str . length ( ) == 3 ) ; }
Checks whether the given String is a ISO 639 compliant language code .
134,389
public static int compareModifierVisibility ( Element a , Element b ) { if ( a . getModifiers ( ) . contains ( Modifier . PUBLIC ) && ! b . getModifiers ( ) . contains ( Modifier . PUBLIC ) ) { return - 1 ; } if ( isDefaultModifier ( a . getModifiers ( ) ) && ! isDefaultModifier ( b . getModifiers ( ) ) ) { return - 1 ...
Compare the modifier of two elements
134,390
public final void evaluate ( ) { final POSEvaluator evaluator = new POSEvaluator ( this . posTagger ) ; try { evaluator . evaluate ( this . testSamples ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } System . out . println ( evaluator . getWordAccuracy ( ) ) ; }
Evaluate word accuracy .
134,391
public final void detailEvaluate ( ) { final List < EvaluationMonitor < POSSample > > listeners = new LinkedList < EvaluationMonitor < POSSample > > ( ) ; final POSTaggerFineGrainedReportListener detailedFListener = new POSTaggerFineGrainedReportListener ( System . out ) ; listeners . add ( detailedFListener ) ; final ...
Detail evaluation of a model outputting the report a file .
134,392
private static Stream < Node > streamChildNodes ( Node node ) { int children = node . getChildNodes ( ) . getLength ( ) ; Node firstChild = node . getFirstChild ( ) ; if ( firstChild == null ) return Stream . empty ( ) ; return Stream . iterate ( firstChild , prev -> prev != null ? prev . getNextSibling ( ) : null ) . ...
Needs to be thread - safe childNodes NodeList is not!
134,393
private static Stream < Node > streamAttributes ( Node node ) { final NamedNodeMap attributes = node . getAttributes ( ) ; if ( attributes == null ) return Stream . empty ( ) ; return IntStream . range ( 0 , attributes . getLength ( ) ) . mapToObj ( attributes :: item ) ; }
Needs to be thread - safe
134,394
protected void changeState ( final State newState ) { if ( state . compareAndSet ( newState . oppositeState ( ) , newState ) ) { changeSupport . firePropertyChange ( PROPERTY_NAME , ! isOpen ( newState ) , isOpen ( newState ) ) ; } }
Changes the internal state of this circuit breaker . If there is actually a change of the state value all registered change listeners are notified .
134,395
private static boolean isDelimiter ( final char ch , final char [ ] delimiters ) { if ( delimiters == null ) { return CharUtils . isWhitespace ( ch ) ; } for ( final char delimiter : delimiters ) { if ( ch == delimiter ) { return true ; } } return false ; }
Is the character a delimiter .
134,396
public T get ( ) throws ConcurrentException { T result = reference . get ( ) ; if ( result == null ) { result = initialize ( ) ; if ( ! reference . compareAndSet ( null , result ) ) { result = reference . get ( ) ; } } return result ; }
Returns the object managed by this initializer . The object is created if it is not available yet and stored internally . This method always returns the same object .
134,397
public final List < Morpheme > getMorphemes ( final String [ ] tokens , final String [ ] posTags ) { final List < String > lemmas = lemmatize ( tokens , posTags ) ; final List < Morpheme > morphemes = getMorphemesFromStrings ( tokens , posTags , lemmas ) ; return morphemes ; }
Get lemmas from a tokenized and pos tagged sentence .
134,398
public List < String > lemmatize ( String [ ] tokens , String [ ] posTags ) { String [ ] annotatedLemmas = lemmatizer . lemmatize ( tokens , posTags ) ; String [ ] decodedLemmas = lemmatizer . decodeLemmas ( tokens , annotatedLemmas ) ; final List < String > lemmas = new ArrayList < String > ( Arrays . asList ( decoded...
Produce lemmas from a tokenized sentence and its postags .
134,399
private void initializeTransientFields ( final Class < L > listenerInterface , final ClassLoader classLoader ) { @ SuppressWarnings ( "unchecked" ) final L [ ] array = ( L [ ] ) Array . newInstance ( listenerInterface , 0 ) ; this . prototypeArray = array ; createProxy ( listenerInterface , classLoader ) ; }
Initialize transient fields .