idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
6,700
private boolean tagEquals ( String tag1 , String tag2 ) { if ( caseSensitive ) { return tag1 . equals ( tag2 ) ; } return tag1 . equalsIgnoreCase ( tag2 ) ; }
Determine if the two specified tag names are equal .
6,701
private void onHandleIntent ( GroundyTask groundyTask ) { if ( groundyTask == null ) { return ; } boolean requiresWifi = groundyTask . keepWifiOn ( ) ; if ( requiresWifi ) { mWakeLockHelper . acquire ( ) ; } L . d ( TAG , "Executing value: " + groundyTask ) ; TaskResult taskResult ; try { taskResult = groundyTask . doI...
This method is invoked on the worker thread with a request to process . Only one Intent is processed at a time but the processing happens on a worker thread that runs independently from other application logic . So if this code takes a long time it will hold up other requests to the same IntentService but it will not h...
6,702
public void expire ( long time ) { long calculatedSize = 0 ; Iterator < Bar > it = bars . iterator ( ) ; while ( it . hasNext ( ) ) { long barSize = it . next ( ) . expire ( time ) ; if ( barSize == 0 ) { it . remove ( ) ; } calculatedSize += barSize ; } this . size = calculatedSize ; if ( bars . isEmpty ( ) ) { bars ....
Expire old events from all buckets .
6,703
@ SuppressWarnings ( "rawtypes" ) public boolean useReferences ( Class type ) { return ! Util . isWrapperClass ( type ) && ! type . equals ( String . class ) && ! type . equals ( Date . class ) && ! type . equals ( BigDecimal . class ) && ! type . equals ( BigInteger . class ) ; }
Returns false for all primitive wrappers .
6,704
public static EbInterfaceWriter < Ebi30InvoiceType > ebInterface30 ( ) { final EbInterfaceWriter < Ebi30InvoiceType > ret = EbInterfaceWriter . create ( Ebi30InvoiceType . class ) ; ret . setNamespaceContext ( EbInterface30NamespaceContext . getInstance ( ) ) ; return ret ; }
Create a writer builder for Ebi30InvoiceType .
6,705
public static EbInterfaceWriter < Ebi302InvoiceType > ebInterface302 ( ) { final EbInterfaceWriter < Ebi302InvoiceType > ret = EbInterfaceWriter . create ( Ebi302InvoiceType . class ) ; ret . setNamespaceContext ( EbInterface302NamespaceContext . getInstance ( ) ) ; return ret ; }
Create a writer builder for Ebi302InvoiceType .
6,706
public static EbInterfaceWriter < Ebi40InvoiceType > ebInterface40 ( ) { final EbInterfaceWriter < Ebi40InvoiceType > ret = EbInterfaceWriter . create ( Ebi40InvoiceType . class ) ; ret . setNamespaceContext ( EbInterface40NamespaceContext . getInstance ( ) ) ; return ret ; }
Create a writer builder for Ebi40InvoiceType .
6,707
public static EbInterfaceWriter < Ebi41InvoiceType > ebInterface41 ( ) { final EbInterfaceWriter < Ebi41InvoiceType > ret = EbInterfaceWriter . create ( Ebi41InvoiceType . class ) ; ret . setNamespaceContext ( EbInterface41NamespaceContext . getInstance ( ) ) ; return ret ; }
Create a writer builder for Ebi41InvoiceType .
6,708
public static EbInterfaceWriter < Ebi42InvoiceType > ebInterface42 ( ) { final EbInterfaceWriter < Ebi42InvoiceType > ret = EbInterfaceWriter . create ( Ebi42InvoiceType . class ) ; ret . setNamespaceContext ( EbInterface42NamespaceContext . getInstance ( ) ) ; return ret ; }
Create a writer builder for Ebi42InvoiceType .
6,709
public static EbInterfaceWriter < Ebi43InvoiceType > ebInterface43 ( ) { final EbInterfaceWriter < Ebi43InvoiceType > ret = EbInterfaceWriter . create ( Ebi43InvoiceType . class ) ; ret . setNamespaceContext ( EbInterface43NamespaceContext . getInstance ( ) ) ; return ret ; }
Create a writer builder for Ebi43InvoiceType .
6,710
public static EbInterfaceWriter < Ebi50InvoiceType > ebInterface50 ( ) { final EbInterfaceWriter < Ebi50InvoiceType > ret = EbInterfaceWriter . create ( Ebi50InvoiceType . class ) ; ret . setNamespaceContext ( EbInterface50NamespaceContext . getInstance ( ) ) ; return ret ; }
Create a writer builder for Ebi50InvoiceType .
6,711
public static CallbacksManager init ( Bundle bundle , Object ... callbackHandlers ) { if ( bundle == null ) { return new CallbacksManager ( ) ; } CallbacksManager callbacksManager = new CallbacksManager ( ) ; ArrayList < TaskHandler > taskProxies = bundle . getParcelableArrayList ( TASK_PROXY_LIST ) ; if ( taskProxies ...
Call from within your activity or fragment onCreate method .
6,712
public void linkCallbacks ( Object ... callbackHandlers ) { if ( callbackHandlers != null ) { for ( TaskHandler proxyTask : new ArrayList < TaskHandler > ( proxyTasks ) ) { proxyTask . clearCallbacks ( ) ; proxyTask . appendCallbacks ( callbackHandlers ) ; } } }
Links the specified callback handlers to their respective tasks .
6,713
public void onSaveInstanceState ( Bundle bundle ) { bundle . putParcelableArrayList ( TASK_PROXY_LIST , proxyTasks ) ; for ( TaskHandler proxyTask : proxyTasks ) { bundle . putParcelable ( GROUNDY_PROXY_KEY_PREFIX + proxyTask . getTaskId ( ) , proxyTask ) ; } }
Saves the current callback handlers information in order to restore them after the configuration change .
6,714
public void addFields ( List < ModelFieldBean > modelFields ) { Assert . notNull ( modelFields , "modelFields must not be null" ) ; for ( ModelFieldBean bean : modelFields ) { this . fields . put ( bean . getName ( ) , bean ) ; } }
Add all provided fields to the collection of fields
6,715
public static void d ( String tag , String msg ) { if ( logEnabled ) { Log . d ( tag , msg ) ; } }
Sends a debug message to the log .
6,716
public Groundy service ( Class < ? extends GroundyService > groundyClass ) { if ( groundyClass == GroundyService . class ) { throw new IllegalStateException ( "This method is meant to set a different GroundyService implementation. " + "You cannot use GroundyService.class, http://i.imgur.com/IR23PAe.png" ) ; } checkAlre...
This allows you to use a different GroundyService implementation .
6,717
static GroundyTask get ( Class < ? extends GroundyTask > taskClass , Context context ) { if ( CACHE . containsKey ( taskClass ) ) { return CACHE . get ( taskClass ) ; } GroundyTask groundyTask = null ; try { L . d ( TAG , "Instantiating " + taskClass ) ; Constructor ctc = taskClass . getConstructor ( ) ; groundyTask = ...
Builds a GroundyTask based on call .
6,718
public boolean hasOnlyName ( OutputConfig outputConfig ) { if ( StringUtils . hasText ( this . name ) && ! StringUtils . hasText ( this . type ) && this . defaultValue == null && ! StringUtils . hasText ( this . dateFormat ) && ! StringUtils . hasText ( this . mapping ) && this . persist == null && ! StringUtils . hasT...
Returns true if only the name property is set
6,719
public void merge ( ExponentialHistogram b ) { if ( b . mergeThreshold != mergeThreshold ) { throw new IllegalArgumentException ( ) ; } merge ( b . boxes , b . total ) ; }
Merge the supplied ExponentialHistogram in to this one .
6,720
public long expire ( long time ) { for ( int logSize = ( Long . SIZE - 1 ) - numberOfLeadingZeros ( last ) ; logSize >= 0 ; logSize -- ) { boolean live = false ; for ( int i = min_l ( logSize ) ; i < max_l ( logSize ) ; i ++ ) { long end = boxes [ i ] ; if ( end != MIN_VALUE ) { if ( ( time - end ) >= window ) { total ...
Expire old events .
6,721
@ Consumes ( "application/json" ) public void putJson ( IncomingMessage msg ) { chatBean . addMessage ( msg . nick , msg . content ) ; }
PUT method for updating or creating an instance of ChatService
6,722
protected void callback ( String name , Bundle resultData ) { if ( resultData == null ) resultData = new Bundle ( ) ; resultData . putString ( Groundy . KEY_CALLBACK_NAME , name ) ; resultData . putSerializable ( Groundy . TASK_IMPLEMENTATION , getClass ( ) ) ; send ( OnCallback . class , resultData ) ; }
Sends this data to the callback methods annotated with the specified name .
6,723
private void mergeProxiesWithClassHierarchy ( ) { for ( Map . Entry < HandlerAndTask , Set < ProxyImplContent > > elementSetEntry : implMap . entrySet ( ) ) { final HandlerAndTask handlerAndTask = elementSetEntry . getKey ( ) ; final Set < Element > superTasks = getSuperClasses ( handlerAndTask . task ) ; for ( Element...
Merges callbacks implementations taking into account the supper types of the handlers and the tasks . 1 . It will look for callbacks of the super classes of the tasks in the same handler . 2 . It will look for callbacks of the super classes of the handler that use the same task . 3 . It will look for callbacks of the s...
6,724
private void appendNonExistentCallbacks ( HandlerAndTask from , HandlerAndTask to ) { final Set < ProxyImplContent > proxyImplContentsTo = implMap . get ( to ) ; if ( proxyImplContentsTo == null ) { return ; } final Set < ProxyImplContent > proxyImplContentsFrom = implMap . get ( from ) ; if ( proxyImplContentsFrom == ...
Copy all callbacks implementations from - > to the specified set . It makes sure to copy the callbacks that don t exist already on the destination set .
6,725
private static List < NameAndType > getParamNames ( Element callbackMethod ) { Element parentClass = callbackMethod . getEnclosingElement ( ) ; String methodFullInfo = parentClass + "#" + callbackMethod ; ExecutableElement method = ( ExecutableElement ) callbackMethod ; if ( ! method . getModifiers ( ) . contains ( Mod...
Makes sure method is public returns void and all its parameters are annotated too .
6,726
public boolean hasAnyProperties ( ) { return StringUtils . hasText ( this . type ) || StringUtils . hasText ( this . association ) || StringUtils . hasText ( this . child ) || StringUtils . hasText ( this . parent ) || StringUtils . hasText ( this . role ) || StringUtils . hasText ( this . inverse ) ; }
Tests if something is set .
6,727
private boolean hasSlf4jBinding ( File file ) throws MojoExecutionException { try ( JarFile jarFile = new JarFile ( file ) ) { return jarFile . getEntry ( "org/slf4j/impl/StaticLoggerBinder.class" ) != null ; } catch ( IOException e ) { throw new MojoExecutionException ( e . getMessage ( ) , e ) ; } }
Returns true if the given jar file contains an SLF4J binding
6,728
public static Templates getXSLTTemplates ( final EEbInterfaceVersion eVersion ) { final String sNamespaceURI = eVersion . getNamespaceURI ( ) ; final Templates ret = s_aRWLock . readLocked ( ( ) -> s_aTemplates . get ( sNamespaceURI ) ) ; if ( ret != null ) return ret ; return s_aRWLock . writeLocked ( ( ) -> { Templat...
Get the precompiled XSLT template to be used . It is lazily initialized upon first call .
6,729
public static ESuccess visualize ( final EEbInterfaceVersion eVersion , final Source aSource , final Result aResult ) { ValueEnforcer . notNull ( eVersion , "version" ) ; final Templates aTemplates = getXSLTTemplates ( eVersion ) ; if ( aTemplates == null ) return ESuccess . FAILURE ; try { final Transformer aTransform...
Visualize a source to a result for a certain ebInterface version using XSLT . This is the most generic method .
6,730
public static DownloadProgressListener getDownloadListenerForTask ( final GroundyTask groundyTask ) { return new DownloadProgressListener ( ) { public void onProgress ( String url , int progress ) { groundyTask . updateProgress ( progress ) ; } } ; }
Returns a progress listener that will post progress to the specified groundyTask .
6,731
public static Matcher < Class < ? > > subclassOf ( final Class < ? > klazz ) { return new Matcher < Class < ? > > ( ) { protected boolean matchesSafely ( Class < ? > t ) { return klazz . isAssignableFrom ( t ) ; } public String toString ( ) { return "a subtype of " + klazz ; } } ; }
Returns a matcher that matches classes that are sub - types of the supplied class .
6,732
public static Matcher < Map < String , Object > > hasAttribute ( final String key , final Object value ) { return new Matcher < Map < String , Object > > ( ) { protected boolean matchesSafely ( Map < String , Object > object ) { return object . containsKey ( key ) && value . equals ( object . get ( key ) ) ; } } ; }
Returns a matcher that matches attribute maps that include the given attribute entry .
6,733
public Object getValue ( String expression , Class < ? > expectedType ) { ValueExpression exp = factory . createValueExpression ( elManager . getELContext ( ) , bracket ( expression ) , expectedType ) ; return exp . getValue ( elManager . getELContext ( ) ) ; }
Evaluates an EL expression and coerces the result to the specified type .
6,734
public void defineFunction ( String prefix , String function , Method method ) throws NoSuchMethodException { if ( prefix == null || function == null || method == null ) { throw new NullPointerException ( "Null argument for defineFunction" ) ; } if ( ! Modifier . isStatic ( method . getModifiers ( ) ) ) { throw new NoS...
Define an EL function in the local function mapper .
6,735
public String getText ( String indentation , char indentationChar ) { newCode = FormatterHelper . indent ( newNode . getPrettySource ( indentationChar , indentationLevel , indentationSize , acceptedComments ) , indentation , indentationChar , indentationLevel , indentationSize , requiresExtraIndentationOnFirstLine ( ) ...
Returns the new text to insert with the appropriate indentation and comments
6,736
public Object getContext ( Class key ) { if ( key == null ) { throw new NullPointerException ( ) ; } return map . get ( key ) ; }
Returns the context object associated with the given key .
6,737
public void addEvaluationListener ( EvaluationListener listener ) { if ( listeners == null ) { listeners = new ArrayList < EvaluationListener > ( ) ; } listeners . add ( listener ) ; }
Registers an evaluation listener to the ELContext .
6,738
public void notifyBeforeEvaluation ( String expr ) { if ( getEvaluationListeners ( ) == null ) return ; for ( EvaluationListener listener : getEvaluationListeners ( ) ) { listener . beforeEvaluation ( this , expr ) ; } }
Notifies the listeners before an EL expression is evaluated
6,739
public void notifyAfterEvaluation ( String expr ) { if ( getEvaluationListeners ( ) == null ) return ; for ( EvaluationListener listener : getEvaluationListeners ( ) ) { listener . afterEvaluation ( this , expr ) ; } }
Notifies the listeners after an EL expression is evaluated
6,740
public boolean isLambdaArgument ( String arg ) { if ( lambdaArgs == null ) { return false ; } for ( int i = lambdaArgs . size ( ) - 1 ; i >= 0 ; i -- ) { Map < String , Object > lmap = lambdaArgs . elementAt ( i ) ; if ( lmap . containsKey ( arg ) ) { return true ; } } return false ; }
Inquires if the name is a LambdaArgument
6,741
public Object getLambdaArgument ( String arg ) { if ( lambdaArgs == null ) { return null ; } for ( int i = lambdaArgs . size ( ) - 1 ; i >= 0 ; i -- ) { Map < String , Object > lmap = lambdaArgs . elementAt ( i ) ; Object v = lmap . get ( arg ) ; if ( v != null ) { return v ; } } return null ; }
Retrieves the Lambda argument associated with a formal parameter . If the Lambda expression is nested within other Lambda expressions the arguments for the current Lambda expression is first searched and if not found the arguments for the immediate nesting Lambda expression then searched and so on .
6,742
public void enterLambdaScope ( Map < String , Object > args ) { if ( lambdaArgs == null ) { lambdaArgs = new Stack < Map < String , Object > > ( ) ; } lambdaArgs . push ( args ) ; }
Installs a Lambda argument map in preparation for the evaluation of a Lambda expression . The arguments in the map will be in scope during the evaluation of the Lambda expression .
6,743
public void setPackage ( PackageDeclaration pakage ) { if ( this . pakage != null ) { updateReferences ( this . pakage ) ; } this . pakage = pakage ; setAsParentNodeOf ( pakage ) ; }
Sets or clear the package declarations of this compilation unit .
6,744
public List < SubsetMove > getAllMoves ( SubsetSolution solution ) { Set < Integer > removeCandidates = getRemoveCandidates ( solution ) ; Set < Integer > addCandidates = getAddCandidates ( solution ) ; if ( removeCandidates . isEmpty ( ) || addCandidates . isEmpty ( ) ) { return Collections . emptyList ( ) ; } return ...
Generates a list of all possible swap moves that transform the given subset solution by removing a single ID from the current selection and replacing it with a new ID which is currently not selected . Possible fixed IDs are not considered to be swapped . May return an empty list if no swap moves can be generated .
6,745
public void setName ( NameExpr name ) { if ( this . name != null ) { updateReferences ( this . name ) ; } this . name = name ; setAsParentNodeOf ( name ) ; }
Sets the name of this package declaration .
6,746
protected void searchStep ( ) { for ( int i = 0 ; i < replicas . size ( ) ; i ++ ) { futures . add ( pool . submit ( replicas . get ( i ) , i ) ) ; } while ( ! futures . isEmpty ( ) ) { try { int i = futures . poll ( ) . get ( ) ; incNumAcceptedMoves ( replicas . get ( i ) . getNumAcceptedMoves ( ) ) ; incNumRejectedMo...
In each search step every replica performs several steps after which solutions of adjacent replicas may be swapped .
6,747
protected void searchDisposed ( ) { replicas . forEach ( r -> r . dispose ( ) ) ; pool . shutdown ( ) ; super . searchDisposed ( ) ; }
When disposing a parallel tempering search it will dispose each contained Metropolis replica and will shut down the thread pool used for concurrent execution of replicas .
6,748
public int getIfdCount ( ) { int c = 0 ; if ( metadata != null && metadata . contains ( "IFD" ) ) c = getMetadataList ( "IFD" ) . size ( ) ; return c ; }
Gets the ifd count .
6,749
public int getMainImagesCount ( ) { int count = 0 ; List < TiffObject > list = new ArrayList < > ( ) ; list . addAll ( getMetadataList ( "IFD" ) ) ; list . addAll ( getMetadataList ( "SubIFDs" ) ) ; for ( TiffObject to : list ) { if ( to instanceof IFD ) { IFD ifd = ( IFD ) to ; if ( ifd . isImage ( ) && ! ifd . isThum...
Gets the main images count .
6,750
public int getSubIfdCount ( ) { int c = 0 ; if ( metadata != null && metadata . contains ( "SubIFDs" ) ) c = getMetadataList ( "SubIFDs" ) . size ( ) ; return c ; }
Gets the Subifd count .
6,751
public List < TiffObject > getIfds ( ) { List < TiffObject > l = new ArrayList < TiffObject > ( ) ; if ( metadata != null && metadata . contains ( "IFD" ) ) l = getMetadataList ( "IFD" ) ; return l ; }
Returns a list of ifds including exifds .
6,752
public List < TiffObject > getImageIfds ( ) { List < TiffObject > l = new ArrayList < TiffObject > ( ) ; IFD oifd = this . firstIFD ; while ( oifd != null ) { if ( oifd . isImage ( ) ) { if ( oifd . hasSubIFD ( ) ) { try { long length = oifd . getMetadata ( ) . get ( "ImageLength" ) . getFirstNumericValue ( ) ; long wi...
Returns a list of ifds representing Images .
6,753
public List < TiffObject > getIfdsAndSubIfds ( ) { List < TiffObject > all = new ArrayList < TiffObject > ( ) ; all . addAll ( getMetadataList ( "IFD" ) ) ; all . addAll ( getMetadataList ( "SubIFDs" ) ) ; return all ; }
Returns a list of subifds .
6,754
public List < TiffObject > getMetadataList ( String name ) { List < TiffObject > l = new ArrayList < TiffObject > ( ) ; if ( metadata == null ) createMetadataDictionary ( ) ; if ( metadata . contains ( name ) ) l = metadata . getList ( name ) ; return l ; }
Gets the metadata ok a given class name .
6,755
private void addMetadataFromIFD ( IFD ifd , String key , boolean exif ) { metadata . add ( key , ifd ) ; for ( TagValue tag : ifd . getMetadata ( ) . getTags ( ) ) { if ( tag . getCardinality ( ) == 1 ) { abstractTiffType t = tag . getValue ( ) . get ( 0 ) ; if ( t . isIFD ( ) ) { addMetadataFromIFD ( ( IFD ) t , key ,...
Adds the metadata from ifd .
6,756
public void printMetadata ( ) { if ( metadata == null ) createMetadataDictionary ( ) ; System . out . println ( "METADATA" ) ; for ( String name : metadata . keySet ( ) ) { String mult = "" ; if ( getMetadataList ( name ) . size ( ) > 1 ) mult = "(x" + getMetadataList ( name ) . size ( ) + ")" ; if ( metadata . getMeta...
Prints the metadata .
6,757
public boolean isTabu ( Move < ? super SolutionType > move , SolutionType currentSolution ) { move . apply ( currentSolution ) ; boolean tabu = memory . contains ( currentSolution ) ; move . undo ( currentSolution ) ; return tabu ; }
Verifies whether the given move is tabu by applying it to the current solution and checking if the obtained neighbour is currently contained in the tabu memory . If not the move is allowed . Before returning the move is undone to restore the original state of the current solution .
6,758
public void registerVisitedSolution ( SolutionType visitedSolution , Move < ? super SolutionType > appliedMove ) { memory . add ( Solution . checkedCopy ( visitedSolution ) ) ; }
A newly visited solution is registered by storing a deep copy of this solution in the full tabu memory .
6,759
public List < SubsetMove > getAllMoves ( SubsetSolution solution ) { if ( maxSizeReached ( solution ) ) { return Collections . emptyList ( ) ; } Set < Integer > addCandidates = getAddCandidates ( solution ) ; if ( addCandidates . isEmpty ( ) ) { return Collections . emptyList ( ) ; } return addCandidates . stream ( ) ....
Generates a list of all possible addition moves that add a single ID to the selection of a given subset solution . Possible fixed IDs are not considered to be added and the maximum subset size is taken into account . May return an empty list if no addition moves can be generated .
6,760
public boolean searchShouldStop ( Search < ? > search ) { return search . getMinDelta ( ) != JamesConstants . INVALID_DELTA && search . getMinDelta ( ) < minDelta ; }
Checks whether the minimum delta observed during the current run of the given search is still above the required minimum .
6,761
protected void generateTagRules ( ) throws ReadTagsIOException { try { PrintWriter writer = new PrintWriter ( "typecheck.xml" , "UTF-8" ) ; for ( int tagId : tagMap . keySet ( ) ) { Tag tag = tagMap . get ( tagId ) ; writer . println ( " <rule context=\"tag[id=" + tag . getId ( ) + "]\">" ) ; String typeRule = "" ; fo...
Generate tag rules .
6,762
public static int getTagId ( String name ) { int id = - 1 ; try { if ( instance == null ) getTiffTags ( ) ; } catch ( ReadTagsIOException e ) { } if ( tagNames . containsKey ( name ) ) id = tagNames . get ( name ) . getId ( ) ; return id ; }
Gets the tag id .
6,763
public TiffObject get ( String name ) { TiffObject result = null ; String container = null ; ArrayList < TiffObject > found = new ArrayList < > ( ) ; if ( contains ( name ) ) { if ( metadata . get ( name ) . getObjectList ( ) . size ( ) == 1 ) { found . add ( getFirst ( name ) ) ; } else { for ( TiffObject to : metadat...
Gets a metadata value returning the appropriate value when multiple are found .
6,764
public void addMetadata ( Metadata meta ) { for ( String k : meta . keySet ( ) ) { for ( TiffObject to : meta . getList ( k ) ) { add ( k , to , meta . getMetadataObject ( k ) . isDublinCore ( ) , meta . getMetadataObject ( k ) . getPath ( ) ) ; } } }
Adds a complete dictionary to the current one .
6,765
public int readFile ( String filename , boolean validate ) { int result = 0 ; try { if ( Files . exists ( Paths . get ( filename ) ) ) { data = new TiffInputStream ( new File ( filename ) ) ; tiffModel = new TiffDocument ( ) ; validation = new ValidationResult ( validate ) ; tiffModel . setSize ( data . size ( ) ) ; bo...
Parses a Tiff File and create an internal model representation .
6,766
private boolean readHeader ( ) { boolean correct = true ; ByteOrder byteOrder = ByteOrder . LITTLE_ENDIAN ; int c1 = 0 ; int c2 = 0 ; try { c1 = data . readByte ( ) . toInt ( ) ; c2 = data . readByte ( ) . toInt ( ) ; } catch ( Exception ex ) { validation . addErrorLoc ( "Header IO Exception" , "Header" ) ; } if ( c1 =...
Reads the Tiff header .
6,767
private void readIFDs ( ) { int offset0 = 0 ; try { offset0 = data . readLong ( 4 ) . toInt ( ) ; tiffModel . setFirstIFDOffset ( offset0 ) ; if ( offset0 == 0 ) validation . addErrorLoc ( "There is no first IFD" , "Header" ) ; else if ( offset0 > data . size ( ) ) validation . addErrorLoc ( "Incorrect offset" , "Heade...
Read the IFDs contained in the Tiff file .
6,768
private boolean checkType ( int tagid , int tagType , int n ) { if ( TiffTags . hasTag ( tagid ) && ! TiffTags . getTag ( tagid ) . getName ( ) . equals ( "IPTC" ) ) { boolean found = false ; String stagType = TiffTags . getTagTypeName ( tagType ) ; if ( stagType != null ) { if ( stagType . equals ( "SUBIFD" ) ) stagTy...
Check tag type .
6,769
public void addTag ( TagValue tag ) { tags . add ( tag ) ; if ( ! hashTagsId . containsKey ( tag . getId ( ) ) ) { hashTagsId . put ( tag . getId ( ) , tag ) ; } Tag t = TiffTags . getTag ( tag . getId ( ) ) ; if ( t != null ) { if ( hashTagsName . containsKey ( t . getName ( ) ) ) { hashTagsName . put ( t . getName ( ...
Adds a tag to the set .
6,770
public void startChecking ( ) { synchronized ( runningTaskLock ) { if ( runningTask == null ) { if ( ! stopCriteria . isEmpty ( ) ) { runningTask = new StopCriterionCheckTask ( ) ; runningTaskFuture = SCHEDULER . scheduleWithFixedDelay ( runningTask , period , period , periodTimeUnit ) ; LOGGER . debug ( "Stop criterio...
Start checking the stop criteria in a separate background thread . If the stop criterion checker is already active or if no stop criteria have been added calling this method does not have any effect .
6,771
public void stopChecking ( ) { synchronized ( runningTaskLock ) { if ( runningTask != null ) { runningTaskFuture . cancel ( false ) ; LOGGER . debug ( "Stop criterion checker for search {} deactivated" , search ) ; runningTask = null ; runningTaskFuture = null ; } } }
Instructs the stop criterion checker to stop checking . In case the checker is not active calling this method does not have any effect .
6,772
public boolean stopCriterionSatisfied ( ) { int i = 0 ; while ( i < stopCriteria . size ( ) && ! stopCriteria . get ( i ) . searchShouldStop ( search ) ) { i ++ ; } return i < stopCriteria . size ( ) ; }
Check whether at least one stop criterion is satisfied .
6,773
public static String encode ( String string , String enc ) throws UnsupportedEncodingException { return new String ( encode ( string . getBytes ( enc ) ) , enc ) ; }
Encode a String in Base64 . No line breaks or other white space are inserted into the encoded data .
6,774
public static void encode ( InputStream in , OutputStream out ) throws IOException { encode ( in , out , true ) ; }
Encode data from the InputStream to the OutputStream in Base64 . Line breaks are inserted every 76 characters in the output .
6,775
public static void encode ( InputStream in , OutputStream out , boolean lineBreaks ) throws IOException { int [ ] inBuffer = new int [ 3 ] ; int lineCount = 0 ; boolean done = false ; while ( ! done && ( inBuffer [ 0 ] = in . read ( ) ) != END_OF_INPUT ) { inBuffer [ 1 ] = in . read ( ) ; inBuffer [ 2 ] = in . read ( )...
Encode data from the InputStream to the OutputStream in Base64 .
6,776
public static void decode ( byte [ ] bytes , OutputStream out ) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream ( bytes ) ; decode ( in , out , false ) ; }
Decode Base64 encoded bytes to the an OutputStream . Characters that are not part of the Base64 alphabet are ignored in the input .
6,777
public static byte [ ] decodeToBytes ( InputStream in ) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; decode ( in , out , false ) ; return out . toByteArray ( ) ; }
Decode Base64 encoded data from the InputStream to a byte array . Characters that are not part of the Base64 alphabet are ignored in the input .
6,778
public static String decodeToString ( InputStream in , String enc ) throws IOException { return new String ( decodeToBytes ( in ) , enc ) ; }
Decode Base64 encoded data from the InputStream to a String . Characters that are not part of the Base64 alphabet are ignored in the input .
6,779
private static void reportResults ( TiffReader tiffReader , int result , String filename , String output_file ) { TiffDocument to = tiffReader . getModel ( ) ; if ( output_file != null ) { } else { switch ( result ) { case - 1 : System . out . println ( "File '" + filename + "' does not exist" ) ; break ; case - 2 : Sy...
Report the results of the reading process to the console .
6,780
public synchronized void unload ( LCMSDataSubset subset , Object user , Set < LCMSDataSubset > exclude ) { if ( ! isLoaded ( subset ) ) { throw new IllegalStateException ( "LCMSData load/unload methods only" + " work for subsets loaded/unloaded using LCMSData API. The" + " subset you requested to unload wasn't loaded. ...
Unloads spectra matched by this subset .
6,781
private void unsafeUnload ( LCMSDataSubset subset ) { ConcurrentMap < Object , Set < LCMSDataSubset > > otherUserMaps = cache . asMap ( ) ; HashSet < LCMSDataSubset > otherUsersSubsetsCombined = new HashSet < > ( ) ; for ( Map . Entry < Object , Set < LCMSDataSubset > > entry : otherUserMaps . entrySet ( ) ) { Set < LC...
Unloads the subset without checking the user . It s required by our user - tracking automatic cleanup if a user was GCed and it hasn t unloaded its subsets we detect the GC automatically and unload all the subsets used by this killed user . It will still check for other users using scans from this subset .
6,782
public SubsetSolution next ( ) { Set < Integer > subset = subsetIterator . next ( ) ; return new SubsetSolution ( IDs , subset ) ; }
Generate the next subset solution . The returned subset will either have the same size as the previously generated solution if any or it will be a larger subset .
6,783
public void printError ( ) { System . out . print ( description ) ; if ( value != null ) System . out . print ( " (" + value + ")" ) ; System . out . println ( ) ; }
Prints the error in the console .
6,784
public void printWarning ( ) { System . out . print ( "Warning: " ) ; System . out . print ( description ) ; if ( value != null ) System . out . print ( " (" + value + ")" ) ; System . out . println ( ) ; }
Prints the warning in the console .
6,785
private int numSwaps ( Set < Integer > addCandidates , Set < Integer > deleteCandidates ) { return Math . min ( addCandidates . size ( ) , Math . min ( deleteCandidates . size ( ) , numSwaps ) ) ; }
Infer the number of swaps that will be performed taking into account the fixed number of desired swaps as specified at construction and the maximum number of possible swaps for the given subset solution .
6,786
public List < abstractTiffType > getDescriptiveValueObject ( ) { Tag tag = TiffTags . getTag ( id ) ; if ( tag != null ) { if ( tag . hasReadableDescription ( ) ) { String desc = this . toString ( ) ; String tagDescription = tag . getTextDescription ( toString ( ) ) ; if ( tagDescription != null ) { desc = tagDescripti...
Gets the descriptive value .
6,787
public long getFirstNumericValue ( ) { String val = ( value != null ) ? value . get ( 0 ) . toString ( ) : readValue . get ( 0 ) . toString ( ) ; if ( isInteger ( val ) ) { return Long . parseLong ( val ) ; } else { return 0 ; } }
Gets the first value of the list parsed as a number .
6,788
public String getName ( ) { String name = "" + id ; if ( TiffTags . hasTag ( id ) ) name = TiffTags . getTag ( id ) . getName ( ) ; return name ; }
Gets the name of the tag .
6,789
public void startSetup ( ) { try { LOGGER . debug ( "Starting in-app billing setup." ) ; billingClient = BillingClient . newBuilder ( AbstractApplication . get ( ) ) . setListener ( this ) . build ( ) ; Runnable runnable = new Runnable ( ) { public void run ( ) { LOGGER . debug ( "In-app billing setup successful." ) ; ...
Starts the setup process . This will start up the setup process asynchronously . You will be notified through the listener when the setup process is complete .
6,790
private void launchPurchaseFlow ( Activity activity , Product product , ItemType itemType , String oldProductId ) { executeServiceRequest ( new Runnable ( ) { public void run ( ) { if ( itemType . equals ( ItemType . SUBSCRIPTION ) && ! isSubscriptionsSupported ( ) ) { LOGGER . debug ( "Failed in-app purchase flow for ...
Initiate the UI flow for an in - app purchase . Call this method to initiate an in - app purchase which will involve bringing up the Google Play screen . The calling activity will be paused while the user interacts with Google Play This method MUST be called from the UI thread of the Activity .
6,791
private int fillBuffer ( ) throws IOException { int n = super . read ( buffer , 0 , BUF_SIZE ) ; if ( n >= 0 ) { real_pos += n ; buf_end = n ; buf_pos = 0 ; } return n ; }
Reads the next BUF_SIZE bytes into the internal buffer .
6,792
public int read ( byte b [ ] , int off , int len ) throws IOException { int leftover = buf_end - buf_pos ; if ( len <= leftover ) { System . arraycopy ( buffer , buf_pos , b , off , len ) ; buf_pos += len ; return len ; } for ( int i = 0 ; i < len ; i ++ ) { int c = this . read ( ) ; if ( c != - 1 ) { b [ off + i ] = (...
Reads the set number of bytes into the passed buffer .
6,793
protected void searchStep ( ) { pipeline . stream ( ) . forEachOrdered ( l -> { l . addSearchListener ( pipelineListener ) ; l . setCurrentSolution ( Solution . checkedCopy ( getCurrentSolution ( ) ) ) ; l . start ( ) ; SolutionType bestSol = l . getBestSolution ( ) ; Evaluation bestSolEvaluation = l . getBestSolutionE...
Executes all local searches in the pipeline where the best solution of the previous search is used as initial solution for the next search . When the entire pipeline has been executed the search step is complete and the search terminates .
6,794
private void readVersion ( TagValue tv ) { int maj = tv . getBytesBigEndian ( 8 , 1 ) ; int min = ( tv . getBytesBigEndian ( 9 , 1 ) & 0xF0 ) >> 4 ; version = maj + "." + min ; }
Read version .
6,795
private void readClass ( TagValue tv ) { int profileClass = tv . getBytesBigEndian ( 12 , 4 ) ; String hex = Integer . toHexString ( profileClass ) ; if ( hex . equals ( "73636e72" ) ) { this . profileClass = ProfileClass . Input ; } else if ( hex . equals ( "6d6e7472" ) ) { this . profileClass = ProfileClass . Display...
Read class .
6,796
private void readCreator ( TagValue tv ) { int creatorSignature = tv . getBytesBigEndian ( 4 , 4 ) ; creator = IccProfileCreators . getIccProfile ( creatorSignature ) ; }
Read creator .
6,797
private void readDescription ( TagValue tv ) throws NumberFormatException , IOException { int index = 128 ; int tagCount = tv . getBytesBigEndian ( index , 4 ) ; index += 4 ; for ( int i = 0 ; i < tagCount ; i ++ ) { int signature = tv . getBytesBigEndian ( index , 4 ) ; int tagOffset = tv . getBytesBigEndian ( index +...
Read description .
6,798
public void read ( TagValue tv ) { readClass ( tv ) ; readVersion ( tv ) ; readCreator ( tv ) ; readEmbedded ( tv ) ; try { readDescription ( tv ) ; } catch ( NumberFormatException | IOException e ) { e . printStackTrace ( ) ; } tv . clear ( ) ; tv . add ( this ) ; }
Reads the desired values of the ICCProfile .
6,799
public List < MsRun . ParentFile > getParentFile ( ) { if ( parentFile == null ) { parentFile = new ArrayList < MsRun . ParentFile > ( ) ; } return this . parentFile ; }
Gets the value of the parentFile property .