idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
6,800
public List < MsRun . MsInstrument > getMsInstrument ( ) { if ( msInstrument == null ) { msInstrument = new ArrayList < MsRun . MsInstrument > ( ) ; } return this . msInstrument ; }
Gets the value of the msInstrument property .
6,801
public List < MsRun . DataProcessing > getDataProcessing ( ) { if ( dataProcessing == null ) { dataProcessing = new ArrayList < MsRun . DataProcessing > ( ) ; } return this . dataProcessing ; }
Gets the value of the dataProcessing property .
6,802
public static void addCacheEntry ( final ClassLoader classLoader , final String factoryId , final String factoryClassName ) { if ( factoryClassName == null ) { CLASS_CACHE . put ( new CacheKey ( classLoader , factoryId ) , "" ) ; } else { CLASS_CACHE . put ( new CacheKey ( classLoader , factoryId ) , factoryClassName )...
Called by the container at deployment time to set the name of a given factory to remove the need for the implementation to look it up on every call .
6,803
public static void clearClassLoader ( final ClassLoader classLoader ) { BeanPropertiesCache . clear ( classLoader ) ; final Iterator < Map . Entry < CacheKey , String > > it = CLASS_CACHE . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { final CacheKey key = it . next ( ) . getKey ( ) ; if ( key . loader == ...
This should be called by the container on undeploy to remove all references to the given class loader from the cache .
6,804
public void createValuesDictionary ( ) { tagValueDescriptions = new HashMap < String , String > ( ) ; if ( valueCodes != null && valueDescriptions != null && valueCodes . size ( ) > 0 && valueCodes . size ( ) == valueDescriptions . size ( ) ) { for ( int i = 0 ; i < valueCodes . size ( ) ; i ++ ) { tagValueDescriptions...
Creates the values dictionary .
6,805
public String getTextDescription ( String encodedValue ) { if ( forceDescription != null ) { return forceDescription ; } String desc = null ; if ( tagValueDescriptions . containsKey ( encodedValue ) ) { desc = tagValueDescriptions . get ( encodedValue ) ; } return desc ; }
Gets the tag value description .
6,806
private void checkForbiddenTag ( IfdTags metadata , String tagName , String ext ) { int tagid = TiffTags . getTagId ( tagName ) ; if ( metadata . containsTagId ( tagid ) ) { validation . addErrorLoc ( "Forbidden tag for TiffEP found " + tagName , ext ) ; } }
Check a forbidden tag is not present .
6,807
protected void searchStep ( ) { Move < ? super SolutionType > move = getBestMove ( getNeighbourhood ( ) . getAllMoves ( getCurrentSolution ( ) ) , true ) ; if ( move != null ) { accept ( move ) ; } else { stop ( ) ; } }
Investigates all neighbours of the current solution and adopts the best one as the new current solution if it is an improvement . If no improvement is found the search is requested to stop and no further steps will be performed .
6,808
public ELContext setELContext ( ELContext context ) { ELContext prev = elContext ; elContext = new StandardELContext ( context ) ; return prev ; }
Set the ELContext used for parsing and evaluating EL expressions . The supplied ELContext will not be modified except for the context object map .
6,809
public void mapFunction ( String prefix , String function , Method meth ) { getELContext ( ) . getFunctionMapper ( ) . mapFunction ( prefix , function , meth ) ; }
Maps a static method to an EL function .
6,810
public Object defineBean ( String name , Object bean ) { Object ret = getELContext ( ) . getBeans ( ) . get ( name ) ; getELContext ( ) . getBeans ( ) . put ( name , bean ) ; return ret ; }
Define a bean in the local bean repository
6,811
public SubsetValidation validate ( SubsetSolution solution ) { boolean validSize = solution . getNumSelectedIDs ( ) >= getMinSubsetSize ( ) && solution . getNumSelectedIDs ( ) <= getMaxSubsetSize ( ) ; if ( getMandatoryConstraints ( ) . isEmpty ( ) ) { return validSize ? UNCONSTRAINED_VALID_SIZE : UNCONSTRAINED_INVALID...
Validate a subset solution . The returned validation object separately indicates whether the solution passed general mandatory constraint validation and whether it has a valid size .
6,812
public void setMaxSubsetSize ( int maxSubsetSize ) { if ( maxSubsetSize < minSubsetSize ) { throw new IllegalArgumentException ( "Error while setting maximum subset size: should be >= minimum subset size." ) ; } if ( maxSubsetSize > getData ( ) . getIDs ( ) . size ( ) ) { throw new IllegalArgumentException ( "Error whi...
Set the maximum subset size . Specified size should be &ge ; the current minimum subset size and &le ; the number of items in the underlying data .
6,813
@ SuppressLint ( "SetTextI18n" ) public void setNotifications ( Integer notifications ) { if ( ( notifications != null ) && ( notifications > 0 ) ) { setVisibility ( VISIBLE ) ; if ( notifications > maximum ) { this . setText ( maximum + "+" ) ; } else { this . setText ( notifications . toString ( ) ) ; } } else { setV...
Sets a notification number in the badge .
6,814
private void nextNeighbourhood ( ) { if ( cycleNeighbourhoods || k < getNeighbourhoods ( ) . size ( ) - 1 ) { k = ( k + 1 ) % getNeighbourhoods ( ) . size ( ) ; } else { stop ( ) ; } }
Switches to the next neighbourhood in the list if any going back to the start if cycling is enabled and all neighbourhoods have been used .
6,815
public static umich . ms . fileio . filetypes . mzidentml . jaxb . standard . MzIdentMLType parse ( Path path ) throws FileParsingException { try { XMLStreamReader xsr = JaxbUtils . createXmlStreamReader ( path , false ) ; umich . ms . fileio . filetypes . mzidentml . jaxb . standard . MzIdentMLType mzIdentMLType = Jax...
Will parse the whole file . Might be not very efficient memory - wise .
6,816
private void iaddWarning ( String desc , String value , String loc ) { if ( ! validate ) return ; ValidationEvent ve = new ValidationEvent ( desc , value , loc ) ; warnings . add ( ve ) ; }
Adds a warning .
6,817
public void addWarning ( String desc , String value , String loc ) { iaddWarning ( desc , value , loc ) ; }
Adds an warning .
6,818
public void add ( ValidationResult validation ) { correct &= validation . correct ; if ( ! validate ) return ; errors . addAll ( validation . errors ) ; warnings . addAll ( validation . warnings ) ; }
Adds a validation result to this .
6,819
public static double min ( double ... nums ) { double min = nums [ 0 ] ; for ( int i = 1 ; i < nums . length ; i ++ ) { if ( nums [ i ] > min ) { min = nums [ i ] ; } } return min ; }
Find the minimum in an array of numbers .
6,820
public void init ( ) throws IOException { if ( ! Files . exists ( path ) ) { throw new FileNotFoundException ( "Could not find a file under path: " + path . toAbsolutePath ( ) . toString ( ) ) ; } if ( Files . size ( path ) == 0 ) { throw new IllegalStateException ( "File size can't be zero for chunked files" ) ; } chu...
Check if the file is still valid .
6,821
protected void searchStep ( ) { if ( solutionIterator . hasNext ( ) ) { SolutionType sol = solutionIterator . next ( ) ; updateBestSolution ( sol ) ; } else { stop ( ) ; } }
In every search step it is verified whether there are more solution to be generated using the solution iterator . If so the next solution is generated evaluated and presented for comparison with the current best solution . Else the search stops .
6,822
public boolean intersects ( Interval1D < V > other ) { if ( other . hi . compareTo ( this . lo ) < 0 ) { return false ; } if ( this . hi . compareTo ( other . lo ) < 0 ) { return false ; } return true ; }
Does this interval intersect that one?
6,823
public boolean selectAll ( Collection < Integer > IDs ) { boolean modified = false ; for ( int ID : IDs ) { if ( select ( ID ) ) { modified = true ; } } return modified ; }
Select all IDs contained in the given collection . Returns true if the subset solution was modified by this operation i . e . if at least one previously unselected ID has been selected .
6,824
public boolean deselectAll ( Collection < Integer > IDs ) { boolean modified = false ; for ( int ID : IDs ) { if ( deselect ( ID ) ) { modified = true ; } } return modified ; }
Deselect all IDs contained in the given collection . Returns true if the subset solution was modified by this operation i . e . if at least one previously selected ID has been deselected .
6,825
public static final void setJavolutionLogLevel ( org . slf4j . Logger log ) { if ( log . isTraceEnabled ( ) ) { javolution . context . LogContext . enter ( ) . setLevel ( LogContext . Level . DEBUG ) ; } else if ( log . isDebugEnabled ( ) ) { javolution . context . LogContext . enter ( ) . setLevel ( LogContext . Level...
Set Javolution log level according to the provided logger .
6,826
public Map < String , String > getChildrenMap ( String parentId ) { Map < String , String > map = new HashMap < > ( ) ; List < StringEntity > children = getByField ( Column . PARENT_ID , parentId ) ; for ( StringEntity stringEntity : children ) { map . put ( stringEntity . getId ( ) , stringEntity . getValue ( ) ) ; } ...
This method returns the map of children associated with given parent id .
6,827
public void replaceMapChildren ( Map < String , String > map , String parentId ) { ArrayList < StringEntity > entities = new ArrayList < > ( ) ; for ( String key : map . keySet ( ) ) { StringEntity entity = new StringEntity ( ) ; entity . setParentId ( parentId ) ; entity . setId ( key ) ; entity . setValue ( map . get...
This method allows to replace all children of a given parent it will remove any children which are not in the list add the new ones and update which are in the list .
6,828
protected void searchStep ( ) { if ( k >= getNeighbourhoods ( ) . size ( ) ) { stop ( ) ; } else { Neighbourhood < ? super SolutionType > neigh = getNeighbourhoods ( ) . get ( k ) ; Move < ? super SolutionType > move = getBestMove ( neigh . getAllMoves ( getCurrentSolution ( ) ) , true ) ; if ( move != null ) { accept ...
Investigates all neighbours of the current solution using the k - th neighbourhood and adopts the best one as the new current solution if it is an improvement . If no improvement is found k is increased . Upon each improvement k is reset to 0 and when k has reached the number of available neighbourhoods the search stop...
6,829
protected boolean accept ( Move < ? super SolutionType > move ) { if ( super . accept ( move ) ) { tabuMemory . registerVisitedSolution ( getCurrentSolution ( ) , move ) ; return true ; } else { return false ; } }
Overrides acceptance of a move to update the tabu memory by registering the newly visited solution .
6,830
public void addPenalizingValidation ( Object key , PenalizingValidation penalizingValidation ) { initMapOnce ( ) ; penalties . put ( key , penalizingValidation ) ; if ( ! penalizingValidation . passed ( ) ) { assignedPenalties = true ; double p = penalizingValidation . getPenalty ( ) ; penalizedValue += minimizing ? p ...
Add a penalty expressed by a penalizing validation object . A key is required that can be used to retrieve the validation object later .
6,831
public static LCMSDataSource < ? > create ( Path path ) { path = path . toAbsolutePath ( ) ; String lowerCaseName = path . getFileName ( ) . toString ( ) . toLowerCase ( ) ; if ( lowerCaseName . endsWith ( ".mzxml" ) ) { return new MZXMLFile ( path . toString ( ) ) ; } else if ( lowerCaseName . endsWith ( ".mzml" ) ) {...
Try and create a data source from a given file path .
6,832
public final void cacheMoveEvaluation ( Move < ? > move , Evaluation evaluation ) { evaluatedMove = move ; this . evaluation = evaluation ; }
Cache the given evaluation discarding any previously cached evaluations .
6,833
public final Evaluation getCachedMoveEvaluation ( Move < ? > move ) { if ( evaluatedMove == null || ! evaluatedMove . equals ( move ) ) { return null ; } else { return evaluation ; } }
Retrieve a cached evaluation if still available . If the evaluation of any other move has been cached at a later point in time the value for this move will have been overwritten .
6,834
public final void cacheMoveValidation ( Move < ? > move , Validation validation ) { validatedMove = move ; this . validation = validation ; }
Cache validation of the given move discarding any previously cached value .
6,835
public final Validation getCachedMoveValidation ( Move < ? > move ) { if ( validatedMove == null || ! validatedMove . equals ( move ) ) { return null ; } else { return validation ; } }
Retrieve a cached validation if still available . If the validation of any other move has been cached at a later point in time the value for this move will have been overwritten .
6,836
public final void clear ( ) { evaluatedMove = null ; evaluation = null ; validatedMove = null ; validation = null ; }
Clear all cached values .
6,837
protected void updateCurrentSolution ( SolutionType solution , Evaluation evaluation , Validation validation ) { super . updateCurrentSolution ( solution , evaluation , validation ) ; if ( cache != null ) { cache . clear ( ) ; } }
When updating the current solution in a neighbourhood search the evaluated move cache is cleared because it is no longer valid for the new current solution .
6,838
protected Evaluation evaluate ( Move < ? super SolutionType > move ) { Evaluation eval = null ; if ( cache != null ) { eval = cache . getCachedMoveEvaluation ( move ) ; } if ( eval != null ) { return eval ; } else { eval = getProblem ( ) . evaluate ( move , getCurrentSolution ( ) , getCurrentSolutionEvaluation ( ) ) ; ...
Evaluates a move to be applied to the current solution . If this move has been evaluated before and the obtained evaluation is still available in the cache the cached evaluation will be returned . Else the evaluation will be computed and offered to the cache .
6,839
protected Validation validate ( Move < ? super SolutionType > move ) { Validation val = null ; if ( cache != null ) { val = cache . getCachedMoveValidation ( move ) ; } if ( val != null ) { return val ; } else { val = getProblem ( ) . validate ( move , getCurrentSolution ( ) , getCurrentSolutionValidation ( ) ) ; if ( ...
Validates a move to be applied to the current solution . If this move has been validated before and the obtained validation is still available in the cache the cached validation will be returned . Else the validation will be computed and offered to the cache .
6,840
public void validate ( ) { int n = 0 ; try { for ( TiffObject o : model . getImageIfds ( ) ) { IFD ifd = ( IFD ) o ; IfdTags metadata = ifd . getMetadata ( ) ; validateMetadata ( metadata ) ; checkImage ( ifd , n , metadata ) ; n ++ ; } } catch ( Exception ex ) { } }
Validates the IFD .
6,841
public void validateMetadata ( IfdTags metadata ) { int prevTagId = 0 ; try { TiffTags . getTiffTags ( ) ; } catch ( ReadTagsIOException e ) { } for ( TagValue ie : metadata . getTags ( ) ) { if ( ! TiffTags . tagMap . containsKey ( ie . getId ( ) ) ) { validation . addWarning ( "Ignoring undefined tag id " + ie . getI...
Validates that the ifd entries have correct types and cardinalities as they are defined in the JSONs tag configuration files .
6,842
public void checkImage ( IFD ifd , int n , IfdTags metadata ) { CheckCommonFields ( ifd , n , metadata ) ; if ( ! metadata . containsTagId ( TiffTags . getTagId ( "PhotometricInterpretation" ) ) ) { validation . addErrorLoc ( "Missing Photometric Interpretation" , "IFD" + n ) ; } else if ( metadata . get ( TiffTags . g...
Check if the tags that define the image are correct and consistent .
6,843
private void CheckBilevelImage ( IfdTags metadata , int n ) { long comp = metadata . get ( TiffTags . getTagId ( "Compression" ) ) . getFirstNumericValue ( ) ; if ( comp < 1 ) validation . addError ( "Invalid Compression" , "IFD" + n , comp ) ; }
Check Bilevel Image .
6,844
private void CheckGrayscaleImage ( IfdTags metadata , int n ) { long bps = metadata . get ( TiffTags . getTagId ( "BitsPerSample" ) ) . getFirstNumericValue ( ) ; if ( bps < 1 ) validation . addError ( "Invalid Bits per Sample" , "IFD" + n , bps ) ; long comp = metadata . get ( TiffTags . getTagId ( "Compression" ) ) ....
Check Grayscale Image .
6,845
private void CheckPalleteImage ( IfdTags metadata , int nifd ) { if ( ! metadata . containsTagId ( TiffTags . getTagId ( "ColorMap" ) ) ) { validation . addErrorLoc ( "Missing Color Map" , "IFD" + nifd ) ; } else { int n = metadata . get ( TiffTags . getTagId ( "ColorMap" ) ) . getCardinality ( ) ; if ( n != 3 * ( int ...
Check Pallete Color Image .
6,846
private void CheckTransparencyMask ( IfdTags metadata , int n ) { if ( ! metadata . containsTagId ( TiffTags . getTagId ( "SamplesPerPixel" ) ) ) { validation . addErrorLoc ( "Missing Samples Per Pixel" , "IFD" + n ) ; } else { long spp = metadata . get ( TiffTags . getTagId ( "SamplesPerPixel" ) ) . getFirstNumericVal...
Check transparency mask .
6,847
private void CheckCMYK ( IfdTags metadata , int n ) { if ( ! metadata . containsTagId ( TiffTags . getTagId ( "SamplesPerPixel" ) ) ) { validation . addErrorLoc ( "Missing Samples Per Pixel" , "IFD" + n ) ; } if ( ! metadata . containsTagId ( TiffTags . getTagId ( "BitsPerSample" ) ) ) { validation . addErrorLoc ( "Mis...
Check CMYK .
6,848
private void CheckYCbCr ( IfdTags metadata , int n ) { if ( ! metadata . containsTagId ( TiffTags . getTagId ( "SamplesPerPixel" ) ) ) { validation . addErrorLoc ( "Missing Samples Per Pixel" , "IFD" + n ) ; } else { long spp = metadata . get ( TiffTags . getTagId ( "SamplesPerPixel" ) ) . getFirstNumericValue ( ) ; if...
Check YCbCr .
6,849
private void CheckCIELab ( IfdTags metadata , int n ) { if ( ! metadata . containsTagId ( TiffTags . getTagId ( "BitsPerSample" ) ) ) { validation . addErrorLoc ( "Missing BitsPerSample" , "IFD" + n ) ; } else { for ( abstractTiffType vi : metadata . get ( TiffTags . getTagId ( "BitsPerSample" ) ) . getValue ( ) ) { if...
Check CIELab .
6,850
private void CheckRGBImage ( IfdTags metadata , int n ) { long samples = metadata . get ( TiffTags . getTagId ( "SamplesPerPixel" ) ) . getFirstNumericValue ( ) ; if ( samples < 3 ) validation . addError ( "Invalid Samples per Pixel" , "IFD" + n , samples ) ; long comp = metadata . get ( TiffTags . getTagId ( "Compress...
Check RGB Image .
6,851
private void CheckStrips ( IfdTags metadata , int n ) { long offset ; int id ; id = TiffTags . getTagId ( "StripOffsets" ) ; offset = metadata . get ( id ) . getFirstNumericValue ( ) ; int nso = metadata . get ( id ) . getCardinality ( ) ; if ( offset <= 0 ) validation . addError ( "Invalid value for field " + TiffTags...
Check that the strips containing the image are well - formed .
6,852
public String loadPreference ( String key , String defaultValue ) { String value = getSharedPreferences ( ) . getString ( key , defaultValue ) ; logLoad ( key , value ) ; return value ; }
Retrieve a string value from the preferences .
6,853
public Boolean loadPreferenceAsBoolean ( String key , Boolean defaultValue ) { Boolean value = defaultValue ; if ( hasPreference ( key ) ) { value = getSharedPreferences ( ) . getBoolean ( key , false ) ; } logLoad ( key , value ) ; return value ; }
Retrieve a boolean value from the preferences .
6,854
public Long loadPreferenceAsLong ( String key , Long defaultValue ) { Long value = defaultValue ; if ( hasPreference ( key ) ) { value = getSharedPreferences ( ) . getLong ( key , 0L ) ; } logLoad ( key , value ) ; return value ; }
Retrieve a long value from the preferences .
6,855
public Integer loadPreferenceAsInteger ( String key , Integer defaultValue ) { Integer value = defaultValue ; if ( hasPreference ( key ) ) { value = getSharedPreferences ( ) . getInt ( key , 0 ) ; } logLoad ( key , value ) ; return value ; }
Retrieve an Integer value from the preferences .
6,856
public Float loadPreferenceAsFloat ( String key , Float defaultValue ) { Float value = defaultValue ; if ( hasPreference ( key ) ) { value = getSharedPreferences ( ) . getFloat ( key , 0 ) ; } logLoad ( key , value ) ; return value ; }
Retrieve a Float value from the preferences .
6,857
protected int mapIdRefToInternalScanNum ( CharArray id ) throws FileParsingException { String idStr = id . toString ( ) ; MZMLIndexElement byId = index . getById ( idStr ) ; if ( byId == null ) { String msg = String . format ( "Could not find a mapping from spectrum id" + " ref to an internal scan number for" + "\n\t f...
Given a scan ID goes to the index and tries to find a mapping .
6,858
public static List < Long > locate ( List < byte [ ] > targets , List < POSITION > locations , InputStream is , long maxOffset ) throws IOException { if ( targets . isEmpty ( ) ) { throw new IllegalArgumentException ( "Targets argument can't be empty" ) ; } if ( locations . size ( ) != targets . size ( ) ) { throw new ...
Locates specific sequences of bytes in the input stream .
6,859
public static boolean advanceReaderToNext ( XMLStreamReader xsr , String tag ) throws javax . xml . stream . XMLStreamException { if ( tag == null ) { throw new IllegalArgumentException ( "Tag name can't be null" ) ; } if ( xsr == null ) { throw new IllegalArgumentException ( "Stream Reader can't be null" ) ; } do { if...
Advances the Stream Reader to the next occurrence of a user - specified tag .
6,860
public static String getString ( int resId , Object ... args ) { return AbstractApplication . get ( ) . getString ( resId , args ) ; }
Returns a formatted string using the localized resource as format and the supplied arguments
6,861
public void connect ( ) { readyState = ReadyState . CONNECTING ; try { if ( webSocketHandler == null ) { webSocketHandler = new WebSocketHandlerAdapter ( ) ; } container . connectToServer ( new SimpleWebSocketClientEndpoint ( ) , ClientEndpointConfig . Builder . create ( ) . build ( ) , websocketURI ) ; } catch ( Excep...
Establishes the connection to the given WebSocket Server Address .
6,862
public void close ( ) { readyState = ReadyState . CLOSING ; try { webSocketSession . close ( new CloseReason ( CloseReason . CloseCodes . NORMAL_CLOSURE , null ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Shutting down the current connection .
6,863
public void add ( LCMSRange range ) { Integer msLevel = range . getMsLevel ( ) ; DoubleRange mzRange = range . getMzRange ( ) ; Range < Integer > scanRange = range . getScanRange ( ) ; if ( msLevel == null ) { anyLvlSet . add ( scanRange ) ; for ( Map . Entry < Integer , MsLevelRangeSet > lvlMapEntry : lvlMap . entrySe...
This add method gradually removes scan - ranges from the input range as it descends down the hierarchy .
6,864
public void subtract ( LCMSRangeSet other ) { anyLvlSet . removeAll ( other . anyLvlSet ) ; for ( Map . Entry < Integer , MsLevelRangeSet > lvlMapEntry : lvlMap . entrySet ( ) ) { Integer msLevel = lvlMapEntry . getKey ( ) ; MsLevelRangeSet msLevelRangeSet = lvlMapEntry . getValue ( ) ; msLevelRangeSet . anyPrecursorSe...
Will modify the set . Intended usage - when unloading data in LCMSData create one range set for data loaded by other users then create a separate range set for the LCMSRange that you want to unload . Subtract the loaded by others from the range set you want to unload . Use this range set for unloading .
6,865
private int classifyTags ( IFD ifd , ArrayList < TagValue > oversized , ArrayList < TagValue > undersized ) { int tagValueSize = 4 ; int n = 0 ; for ( TagValue tag : ifd . getMetadata ( ) . getTags ( ) ) { int tagsize = getTagSize ( tag ) ; if ( tagsize > tagValueSize ) { oversized . add ( tag ) ; } else { undersized ....
Gets the oversized tags .
6,866
private int getTagSize ( TagValue tag ) { int n = tag . getCardinality ( ) ; int id = tag . getId ( ) ; int type = tag . getType ( ) ; if ( id == 330 ) { n = 1000 ; } if ( id == 700 ) { if ( tag . getValue ( ) . size ( ) > 0 ) n = tag . getValue ( ) . get ( 0 ) . toString ( ) . length ( ) ; } if ( id == 33723 ) { n = t...
Gets the tag size .
6,867
private ArrayList < Integer > writeStripData ( IFD ifd ) throws IOException { ArrayList < Integer > newStripOffsets = new ArrayList < Integer > ( ) ; IfdTags metadata = ifd . getMetadata ( ) ; TagValue stripOffsets = metadata . get ( 273 ) ; TagValue stripSizes = metadata . get ( 279 ) ; for ( int i = 0 ; i < stripOffs...
Write strip data .
6,868
private ArrayList < Integer > writeTileData ( IFD ifd ) throws IOException { ArrayList < Integer > newTileOffsets = new ArrayList < Integer > ( ) ; IfdTags metadata = ifd . getMetadata ( ) ; TagValue tileOffsets = metadata . get ( 324 ) ; TagValue tileSizes = metadata . get ( 325 ) ; for ( int i = 0 ; i < tileOffsets ....
Write tile data .
6,869
public List < SubsetMove > getAllMoves ( SubsetSolution solution ) { Set < Integer > removeCandidates = getRemoveCandidates ( solution ) ; Set < Integer > addCandidates = getAddCandidates ( solution ) ; List < SubsetMove > moves = new ArrayList < > ( ) ; if ( canAdd ( solution , addCandidates ) ) { addCandidates . forE...
Generate all valid swap deletion and addition moves that transform the given subset solution into a neighbour within the minimum and maximum allowed subset size . The returned list may be empty if no valid moves exist . If any fixed IDs have been specified these will not be considered for deletion nor addition .
6,870
private boolean canAdd ( SubsetSolution solution , Set < Integer > addCandidates ) { return ! addCandidates . isEmpty ( ) && isValidSubsetSize ( solution . getNumSelectedIDs ( ) + 1 ) ; }
Check if it is allowed to add one more item to the selection .
6,871
private boolean canRemove ( SubsetSolution solution , Set < Integer > deleteCandidates ) { return ! deleteCandidates . isEmpty ( ) && isValidSubsetSize ( solution . getNumSelectedIDs ( ) - 1 ) ; }
Check if it is allowed to remove one more item from the selection .
6,872
private boolean canSwap ( SubsetSolution solution , Set < Integer > addCandidates , Set < Integer > deleteCandidates ) { return ! addCandidates . isEmpty ( ) && ! deleteCandidates . isEmpty ( ) && isValidSubsetSize ( solution . getNumSelectedIDs ( ) ) ; }
Check if it is possible to swap a selected and unselected item .
6,873
public static final LCMSRange create ( Range < Integer > scanRange , Integer msLevel ) { return new LCMSRange ( scanRange , msLevel , null ) ; }
A range that will contain all scans with the scan number range but only at a specific MS - Level .
6,874
public static final LCMSRange create ( Range < Integer > scanRange , Integer msLevel , DoubleRange mzRange ) { return new LCMSRange ( scanRange , msLevel , mzRange ) ; }
A range containing all scans within the scan number range at a specific MS - Level and a specific precursor range .
6,875
public void addValidation ( Object key , Validation validation ) { initMapOnce ( ) ; validations . put ( key , validation ) ; passedAll = passedAll && validation . passed ( ) ; }
Add a validation object . A key is required that can be used to retrieve the validation object .
6,876
public static MsmsPipelineAnalysis parse ( Path path ) throws FileParsingException { try { XMLStreamReader xsr = JaxbUtils . createXmlStreamReader ( path , false ) ; MsmsPipelineAnalysis msmsPipelineAnalysis = JaxbUtils . unmarshal ( MsmsPipelineAnalysis . class , xsr ) ; return msmsPipelineAnalysis ; } catch ( JAXBExc...
The simplest method to parse the whole MsmsPipelineAnalysis from a file .
6,877
public LCMSDataSubset merge ( LCMSDataSubset other ) { LCMSDataSubset merged = new LCMSDataSubset ( ) ; Set < Integer > msLvlsThis = getMsLvls ( ) ; Set < Integer > msLvlsThat = other . getMsLvls ( ) ; if ( msLvlsThis != null && msLvlsThat != null ) { HashSet < Integer > mergedMsLvls = new HashSet < > ( msLvlsThis ) ; ...
Doesn t modify original values always returns a new one .
6,878
public void addStopCriterion ( StopCriterion stopCriterion ) { synchronized ( statusLock ) { assertIdle ( "Cannot add stop criterion." ) ; stopCriterionChecker . add ( stopCriterion ) ; LOGGER . debug ( "{}: added stop criterion {}" , this , stopCriterion ) ; } }
Adds a stop criterion used to decide when the search should stop running . It is verified whether the given stop criterion is compatible with the search and if not an exception is thrown . Note that this method can only be called when the search is idle .
6,879
private static boolean showCheatSheet ( View view , CharSequence text ) { if ( TextUtils . isEmpty ( text ) ) { return false ; } final int [ ] screenPos = new int [ 2 ] ; final Rect displayFrame = new Rect ( ) ; view . getLocationOnScreen ( screenPos ) ; view . getWindowVisibleDisplayFrame ( displayFrame ) ; final Cont...
Internal helper method to show the cheat sheet toast .
6,880
@ RequiresPermission ( anyOf = { Manifest . permission . ACCESS_COARSE_LOCATION , Manifest . permission . ACCESS_FINE_LOCATION } ) public synchronized void startLocalization ( ) { if ( ! started && hasSignificantlyOlderLocation ( ) ) { started = true ; List < String > enabledProviders = locationManager . getProviders (...
Register the listener with the Location Manager to receive location updates
6,881
@ RequiresPermission ( anyOf = { Manifest . permission . ACCESS_COARSE_LOCATION , Manifest . permission . ACCESS_FINE_LOCATION } ) public synchronized void stopLocalization ( ) { if ( started ) { AlarmUtils . cancelAlarm ( getCancelPendingIntent ( ) ) ; locationManager . removeUpdates ( this ) ; if ( location == null )...
Remove the listener to receive location updates
6,882
public static boolean containsWebSocketScheme ( URI uri ) { Objects . requireNonNull ( uri , "no URI object given" ) ; final String scheme = uri . getScheme ( ) ; if ( scheme != null && ( scheme . equals ( WS_SCHEME ) || scheme . equals ( WSS_SCHEME ) ) ) { return true ; } return false ; }
Checks if the given URI is a contains a valid WebSocket scheme
6,883
public static LCMSRunInfo createDummyInfo ( ) { LCMSRunInfo lcmsRunInfo = new LCMSRunInfo ( ) ; lcmsRunInfo . addInstrument ( Instrument . getDummy ( ) , Instrument . ID_UNKNOWN ) ; return lcmsRunInfo ; }
Only use if you can t get real run info .
6,884
public void addInstrument ( Instrument instrument , String id ) { if ( instrument == null || id == null ) { throw new IllegalArgumentException ( "Instruemnt and ID must be non-null values." ) ; } if ( instruments . size ( ) == 0 ) { defaultInstrumentID = id ; } else if ( instruments . size ( ) > 0 && ! isDefaultExplici...
If only one instrument is added it will be set as the default instrument all the scans that you add to the ScanCollection will implicitly refer to this one instrument .
6,885
public void setDefaultInstrumentID ( String id ) { if ( id == null ) { unsetDefaultInstrument ( ) ; return ; } if ( instruments . containsKey ( id ) ) { defaultInstrumentID = id ; isDefaultExplicitlySet = true ; } else { throw new IllegalArgumentException ( "The instrument map did not contain provided instrument ID, " ...
Call with null parameter to unset .
6,886
public Class < ? > getType ( ELContext context , Object base , Object property ) { if ( context == null ) { throw new NullPointerException ( ) ; } if ( base != null && base instanceof List ) { context . setPropertyResolved ( true ) ; List list = ( List ) base ; int index = toInteger ( property ) ; if ( index < 0 || ind...
If the base object is a list returns the most general acceptable type for a value in this list .
6,887
public void undo ( SubsetSolution solution ) { solution . select ( delete ) ; solution . deselect ( add ) ; }
Undo this swap move after it has been successfully applied to the given subset solution by removing the newly added ID and re - adding the deleted ID .
6,888
public final void run ( ) { LOGGER . debug ( "Executing " + getClass ( ) . getSimpleName ( ) ) ; markAsInProgress ( ) ; if ( ! Lists . isNullOrEmpty ( listeners ) ) { Runnable startUseCaseRunnable = new Runnable ( ) { public void run ( ) { for ( UseCaseListener listener : listeners ) { notifyUseCaseStart ( listener ) ;...
Executes the use case .
6,889
public static String encrypt ( String cleartext ) { if ( cleartext != null ) { byte [ ] result = doFinal ( Base64 . decode ( getBase64Key ( ) , Base64 . DEFAULT ) , Cipher . ENCRYPT_MODE , cleartext . getBytes ( ) ) ; return Base64 . encodeToString ( result , Base64 . DEFAULT ) ; } return null ; }
Returns the data encrypted . Avoid calling this method on the UI thread if possible since it may access to shared preferences .
6,890
public static String decrypt ( String base64Encrypted ) { if ( base64Encrypted != null ) { byte [ ] enc = Base64 . decode ( base64Encrypted , Base64 . DEFAULT ) ; byte [ ] result = doFinal ( Base64 . decode ( getBase64Key ( ) , Base64 . DEFAULT ) , Cipher . DECRYPT_MODE , enc ) ; return new String ( result ) ; } return...
Returns the original data . Avoid calling this method on the UI thread if possible since it may access to shared preferences .
6,891
public static String generateShaHash ( String text ) { try { MessageDigest digest = MessageDigest . getInstance ( SHA_ALGORITHM ) ; byte [ ] bytes = text . getBytes ( UTF_8 ) ; bytes = digest . digest ( bytes ) ; return toHexEncode ( bytes ) ; } catch ( Exception e ) { throw new UnexpectedException ( e ) ; } }
Generates the SHA hash for the input string .
6,892
public void undo ( SubsetSolution solution ) { solution . deselectAll ( add ) ; solution . selectAll ( delete ) ; }
Undo this move after it has been successfully applied to the given subset solution by removing all added IDs and adding all removed IDs . If the subset solution has been modified since successful application of this move the result of this operation is undefined .
6,893
public Metadata createMetadata ( ) { Metadata metadata = new Metadata ( ) ; try { for ( DataSet ds : iimFile . getDataSets ( ) ) { Object value = "" ; try { value = ds . getValue ( ) ; } catch ( Exception ex ) { } DataSetInfo info = ds . getInfo ( ) ; metadata . add ( info . getName ( ) , new Text ( value . toString ( ...
Creates the metadata .
6,894
public void read ( TagValue tv , String filename ) { originalValue = tv . getValue ( ) ; File file = new File ( filename ) ; IIMReader reader = null ; SubIIMInputStream subStream = null ; try { int offset = tv . getReadOffset ( ) ; int length = tv . getReadlength ( ) ; subStream = new SubIIMInputStream ( new FileIIMInp...
Reads the IPTC .
6,895
public void onMessageReceived ( RemoteMessage remoteMessage ) { if ( LoggerUtils . isEnabled ( ) ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "Message received. " ) ; builder . append ( "from: " ) ; builder . append ( remoteMessage . getFrom ( ) ) ; if ( remoteMessage . getMessageType ( ) != n...
Called when message is received . Since Android O have a guaranteed life cycle limited to 10 seconds for this method execution
6,896
public IScan getScanByNum ( int scanNum ) { IScan scan = getNum2scan ( ) . get ( scanNum ) ; if ( scan != null ) { return scan ; } return null ; }
The name says it all .
6,897
public IScan getScanByNumLower ( int scanNum ) { IScan scan = getNum2scan ( ) . lowerEntry ( scanNum ) . getValue ( ) ; if ( scan != null ) { return scan ; } return null ; }
Scan with closest Number STRICTLY less than the provided one is returned .
6,898
public IScan getScanByNumUpper ( int scanNum ) { IScan scan = getNum2scan ( ) . ceilingEntry ( scanNum ) . getValue ( ) ; if ( scan != null ) { return scan ; } return null ; }
Scan with the closest Number greater or equal to the provided one is returned .
6,899
public IScan getScanByNumClosest ( int scanNum ) { IScan result = null ; Map . Entry < Integer , IScan > lower = getNum2scan ( ) . lowerEntry ( scanNum ) ; Map . Entry < Integer , IScan > upper = getNum2scan ( ) . ceilingEntry ( scanNum ) ; if ( upper != null && lower != null ) { result = Integer . compare ( lower . ge...
Scan with the closest Number is returned .