idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
6,900 | public List < IScan > getScansByRtLower ( double rt ) { Map . Entry < Double , List < IScan > > lowerEntry = getRt2scan ( ) . lowerEntry ( rt ) ; if ( lowerEntry == null ) { return null ; } List < IScan > scans = lowerEntry . getValue ( ) ; if ( scans != null ) { return scans ; } return null ; } | Scan List with closest RT less or equal to the provided one are returned . |
6,901 | public List < IScan > getScansByRtUpper ( double rt ) { Map . Entry < Double , List < IScan > > ceilingEntry = getMapRt2scan ( ) . ceilingEntry ( rt ) ; if ( ceilingEntry == null ) { return null ; } List < IScan > scans = ceilingEntry . getValue ( ) ; if ( scans != null ) { return scans ; } return null ; } | Scan List with the closest RT greater or equal to the provided one are returned . |
6,902 | public List < IScan > getScansByRtClosest ( double rt ) { List < IScan > result = null ; Map . Entry < Double , List < IScan > > lower = getMapRt2scan ( ) . lowerEntry ( rt ) ; Map . Entry < Double , List < IScan > > upper = getMapRt2scan ( ) . ceilingEntry ( rt ) ; if ( upper != null && lower != null ) { if ( Math . abs ( rt - lower . getKey ( ) ) <= Math . abs ( rt - upper . getKey ( ) ) ) { result = lower . getValue ( ) ; } else { result = upper . getValue ( ) ; } } else if ( upper != null ) { result = upper . getValue ( ) ; } else if ( lower != null ) { result = lower . getValue ( ) ; } return result ; } | Scans with the closest RT are returned . |
6,903 | public Integer getScanCountAtMsLevel ( int msLevel ) { TreeMap < Integer , IScan > msLevelScanMap = getMapMsLevel2index ( ) . get ( msLevel ) . getNum2scan ( ) ; if ( msLevelScanMap != null ) { return msLevelScanMap . size ( ) ; } return null ; } | If the msLevel doesn t exist in this ScanCollectionDefault returns null |
6,904 | private NavigableMap < Integer , IScan > getScansInSubsetByNumber ( NavigableMap < Integer , IScan > scanMap , LCMSDataSubset subset ) { NavigableMap < Integer , IScan > scansInSubsetByNumber = scanMap ; if ( subset . getScanNumLo ( ) != null ) { scansInSubsetByNumber . subMap ( subset . getScanNumLo ( ) , true , scansInSubsetByNumber . lastKey ( ) , true ) ; } if ( subset . getScanNumHi ( ) != null ) { scansInSubsetByNumber . subMap ( scansInSubsetByNumber . firstKey ( ) , true , subset . getScanNumHi ( ) , true ) ; } return scansInSubsetByNumber ; } | It won t filter the scanMap according the the full subset predicate it only selects scan number range . Further checks for ms - levels and precursor ranges is required . It s just a convenience method . |
6,905 | public void ensureHasSpace ( int numBytesToAdd ) { if ( numBytesToAdd < 0 ) { throw new IllegalArgumentException ( "Number of bytes can't be negative" ) ; } int capacityLeft = getCapacityLeft ( ) ; if ( capacityLeft < numBytesToAdd ) { grow ( numBytesToAdd - capacityLeft , true ) ; } } | Checks if there is enough space in the buffer to write N additional bytes . Will grow the buffer if necessary . It takes current position in the buffer into account . |
6,906 | public void setValue ( ELContext context , Object base , Object property , Object value ) { if ( context == null ) { throw new NullPointerException ( ) ; } if ( base == null && property instanceof String ) { String beanName = ( String ) property ; if ( beanNameResolver . isNameResolved ( beanName ) || beanNameResolver . canCreateBean ( beanName ) ) { beanNameResolver . setBeanValue ( beanName , value ) ; context . setPropertyResolved ( base , property ) ; } } } | If the base is null and the property is a name that is resolvable by the BeanNameResolver the bean in the BeanNameResolver is set to the given value . |
6,907 | public Class < ? > getType ( ELContext context , Object base , Object property ) { if ( context == null ) { throw new NullPointerException ( ) ; } if ( base == null && property instanceof String ) { if ( beanNameResolver . isNameResolved ( ( String ) property ) ) { context . setPropertyResolved ( true ) ; return beanNameResolver . getBean ( ( String ) property ) . getClass ( ) ; } } return null ; } | If the base is null and the property is a name resolvable by the BeanNameResolver return the type of the bean . |
6,908 | public boolean isReadOnly ( ELContext context , Object base , Object property ) { if ( context == null ) { throw new NullPointerException ( ) ; } if ( base == null && property instanceof String ) { if ( beanNameResolver . isNameResolved ( ( String ) property ) ) { context . setPropertyResolved ( true ) ; return beanNameResolver . isReadOnly ( ( String ) property ) ; } } return false ; } | If the base is null and the property is a name resolvable by the BeanNameResolver attempts to determine if the bean is writable . |
6,909 | private void validateIfdLW ( IFD ifd , int p ) { IfdTags metadata = ifd . getMetadata ( ) ; if ( p == 1 ) { checkRequiredTag ( metadata , "NewSubfileType" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "ImageLength" , 1 ) ; checkRequiredTag ( metadata , "ImageWidth" , 1 ) ; checkRequiredTag ( metadata , "SamplesPerPixel" , 1 , new long [ ] { 1 } ) ; if ( p == 0 ) { checkRequiredTag ( metadata , "BitsPerSample" , 1 , new long [ ] { 4 } ) ; } else { checkRequiredTag ( metadata , "BitsPerSample" , 1 , new long [ ] { 8 } ) ; } checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 32896 } ) ; checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 , new long [ ] { 5 } ) ; checkRequiredTag ( metadata , "StripOffsets" , 1 ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 } ) ; } checkRequiredTag ( metadata , "StripBYTECount" , 1 ) ; checkRequiredTag ( metadata , "XResolution" , 1 ) ; checkRequiredTag ( metadata , "YResolution" , 1 ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "ResolutionUnit" , 1 , new long [ ] { 2 , 3 } ) ; checkRequiredTag ( metadata , "InkSet" , 1 , new long [ ] { 1 } ) ; checkRequiredTag ( metadata , "NumberOfInks" , 1 , new long [ ] { 4 } ) ; } if ( p == 1 ) { checkRequiredTag ( metadata , "DotRange" , 2 , new long [ ] { 0 , 255 } ) ; } checkRequiredTag ( metadata , "ColorTable" , - 1 ) ; } | Validate Line Work . |
6,910 | private void validateIfdHC ( IFD ifd , int p ) { IfdTags metadata = ifd . getMetadata ( ) ; int spp = - 1 ; if ( metadata . containsTagId ( TiffTags . getTagId ( "SampesPerPixel" ) ) ) { spp = ( int ) metadata . get ( TiffTags . getTagId ( "SampesPerPixel" ) ) . getFirstNumericValue ( ) ; } if ( p == 1 ) { checkRequiredTag ( metadata , "NewSubfileType" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "ImageLength" , 1 ) ; checkRequiredTag ( metadata , "ImageWidth" , 1 ) ; checkRequiredTag ( metadata , "BitsPerSample" , spp ) ; if ( p == 1 ) { checkRequiredTag ( metadata , "BitsPerSample" , 4 , new long [ ] { 8 } ) ; } checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 32897 } ) ; checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 , new long [ ] { 5 } ) ; checkRequiredTag ( metadata , "StripOffsets" , 1 ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 } ) ; } if ( p == 1 ) { checkRequiredTag ( metadata , "SamplesPerPixel" , 1 , new long [ ] { 4 } ) ; } checkRequiredTag ( metadata , "StripBYTECount" , 1 ) ; checkRequiredTag ( metadata , "XResolution" , 1 ) ; checkRequiredTag ( metadata , "YResolution" , 1 ) ; checkRequiredTag ( metadata , "PlanarConfiguration" , 1 , new long [ ] { 1 } ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "ResolutionUnit" , 1 , new long [ ] { 2 , 3 } ) ; checkRequiredTag ( metadata , "InkSet" , 1 , new long [ ] { 1 } ) ; checkRequiredTag ( metadata , "NumberOfInks" , 1 , new long [ ] { 4 } ) ; checkRequiredTag ( metadata , "DotRange" , 2 , new long [ ] { 0 , 255 } ) ; } checkRequiredTag ( metadata , "TransparencyIndicator" , 1 , new long [ ] { 0 , 1 } ) ; } | Validate High - Resolution Continuous - Tone . |
6,911 | private void validateIfdMP ( IFD ifd , int p ) { IfdTags metadata = ifd . getMetadata ( ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "NewSubfileType" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "ImageLength" , 1 ) ; checkRequiredTag ( metadata , "ImageWidth" , 1 ) ; if ( p == 1 ) { checkRequiredTag ( metadata , "BitsPerSample" , 1 , new long [ ] { 8 , 16 } ) ; } else { checkRequiredTag ( metadata , "BitsPerSample" , 1 , new long [ ] { 8 } ) ; } if ( p == 0 ) { checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 1 , 7 , 8 , 32895 } ) ; } else if ( p == 1 ) { checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 1 } ) ; } else { checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 1 , 7 , 8 } ) ; } if ( p == 0 ) { checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 ) ; } else { checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "StripOffsets" , 1 ) ; if ( p == 0 ) { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 , 4 , 5 , 8 } ) ; } else { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 } ) ; } if ( p == 1 ) { checkRequiredTag ( metadata , "SamplesPerPixel" , 1 , new long [ ] { 1 } ) ; } checkRequiredTag ( metadata , "StripBYTECount" , 1 ) ; checkRequiredTag ( metadata , "XResolution" , 1 ) ; checkRequiredTag ( metadata , "YResolution" , 1 ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "ResolutionUnit" , 1 , new long [ ] { 2 , 3 } ) ; checkRequiredTag ( metadata , "DotRange" , 2 , new long [ ] { 0 , 255 } ) ; checkRequiredTag ( metadata , "PixelIntensityRange" , 2 , new long [ ] { 0 , 255 } ) ; } checkRequiredTag ( metadata , "ImageColorIndicator" , 1 , new long [ ] { 0 , 1 } ) ; } | Validate Monochrome Picture . |
6,912 | private void validateIfdBP ( IFD ifd , int p ) { IfdTags metadata = ifd . getMetadata ( ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "NewSubfileType" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "ImageLength" , 1 ) ; checkRequiredTag ( metadata , "ImageWidth" , 1 ) ; checkRequiredTag ( metadata , "BitsPerSample" , 1 , new long [ ] { 1 } ) ; if ( p == 0 ) { checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 1 , 4 , 8 } ) ; } else if ( p == 1 ) { checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 1 } ) ; } else { checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 1 , 4 , 8 } ) ; } if ( p == 0 ) { checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 ) ; } else { checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "StripOffsets" , 1 ) ; if ( p == 0 ) { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 , 4 , 5 , 8 } ) ; } else { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 } ) ; } checkRequiredTag ( metadata , "SamplesPerPixel" , 1 , new long [ ] { 1 } ) ; checkRequiredTag ( metadata , "StripBYTECount" , 1 ) ; checkRequiredTag ( metadata , "XResolution" , 1 ) ; checkRequiredTag ( metadata , "YResolution" , 1 ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "ResolutionUnit" , 1 , new long [ ] { 2 , 3 } ) ; checkRequiredTag ( metadata , "DotRange" , 2 , new long [ ] { 0 , 255 } ) ; } checkRequiredTag ( metadata , "ImageColorIndicator" , 1 , new long [ ] { 0 , 1 , 2 } ) ; checkRequiredTag ( metadata , "BackgroundColorIndicator" , 1 , new long [ ] { 0 , 1 , 2 } ) ; } | Validate Binary Picture . |
6,913 | private void validateIfdBL ( IFD ifd , int p ) { IfdTags metadata = ifd . getMetadata ( ) ; if ( p == 1 ) { checkRequiredTag ( metadata , "NewSubfileType" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "ImageLength" , 1 ) ; checkRequiredTag ( metadata , "ImageWidth" , 1 ) ; checkRequiredTag ( metadata , "BitsPerSample" , 1 , new long [ ] { 1 } ) ; checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 32898 } ) ; if ( p == 0 ) { checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 , new long [ ] { 0 , 1 } ) ; } else { checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "StripOffsets" , 1 ) ; if ( p == 0 ) { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 , 4 , 5 , 8 } ) ; } else { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 } ) ; } checkRequiredTag ( metadata , "SamplesPerPixel" , 1 , new long [ ] { 1 } ) ; checkRequiredTag ( metadata , "StripBYTECount" , 1 ) ; checkRequiredTag ( metadata , "XResolution" , 1 ) ; checkRequiredTag ( metadata , "YResolution" , 1 ) ; if ( p == 1 ) { checkRequiredTag ( metadata , "ResolutionUnit" , 1 , new long [ ] { 2 , 3 } ) ; checkRequiredTag ( metadata , "DotRange" , 2 , new long [ ] { 0 , 255 } ) ; } checkRequiredTag ( metadata , "ImageColorIndicator" , 1 , new long [ ] { 0 , 1 , 2 } ) ; checkRequiredTag ( metadata , "BackgroundColorIndicator" , 1 , new long [ ] { 0 , 1 , 2 } ) ; } | Validate Binary Lineart . |
6,914 | private void validateIfdSD ( IFD ifd , int p ) { IfdTags metadata = ifd . getMetadata ( ) ; if ( p == 2 ) { checkRequiredTag ( metadata , "NewSubfileType" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "ImageLength" , 1 ) ; checkRequiredTag ( metadata , "ImageWidth" , 1 ) ; checkRequiredTag ( metadata , "BitsPerSample" , 1 , new long [ ] { 1 } ) ; checkRequiredTag ( metadata , "Compression" , 1 , new long [ ] { 1 , 4 , 8 } ) ; checkRequiredTag ( metadata , "PhotometricInterpretation" , 1 , new long [ ] { 5 } ) ; checkRequiredTag ( metadata , "StripOffsets" , 1 ) ; if ( p == 0 ) { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 , 4 , 5 , 8 } ) ; } else { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 } ) ; } if ( p == 2 ) { checkRequiredTag ( metadata , "SamplesPerPixel" , 1 , new long [ ] { 1 , 4 } ) ; } checkRequiredTag ( metadata , "StripBYTECount" , 1 ) ; checkRequiredTag ( metadata , "XResolution" , 1 ) ; checkRequiredTag ( metadata , "YResolution" , 1 ) ; checkRequiredTag ( metadata , "PlanarConfiguration" , 1 , new long [ ] { 2 } ) ; if ( p == 2 ) { checkRequiredTag ( metadata , "ResolutionUnit" , 1 , new long [ ] { 2 , 3 } ) ; checkRequiredTag ( metadata , "NumberOfInks" , 1 , new long [ ] { 4 } ) ; } checkRequiredTag ( metadata , "InkSet" , 1 , new long [ ] { 1 } ) ; checkRequiredTag ( metadata , "BackgroundColorIndicator" , 1 , new long [ ] { 0 , 1 , 2 } ) ; } | Validate Screened Data image . |
6,915 | private void validateIfdFP ( IFD ifd , int p ) { IfdTags metadata = ifd . getMetadata ( ) ; checkRequiredTag ( metadata , "ImageDescription" , 1 ) ; checkRequiredTag ( metadata , "StripOffsets" , 1 ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "StripOffsets" , 1 , new long [ ] { 0 } ) ; } checkRequiredTag ( metadata , "NewSubfileType" , 1 ) ; checkRequiredTag ( metadata , "ImageLength" , 1 ) ; checkRequiredTag ( metadata , "ImageWidth" , 1 ) ; checkRequiredTag ( metadata , "StripOffsets" , 1 ) ; if ( p == 0 ) { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 , 4 , 5 , 8 } ) ; } else { checkRequiredTag ( metadata , "Orientation" , 1 , new long [ ] { 1 } ) ; } checkRequiredTag ( metadata , "StripBYTECount" , 1 ) ; checkRequiredTag ( metadata , "XResolution" , 1 ) ; checkRequiredTag ( metadata , "YResolution" , 1 ) ; checkRequiredTag ( metadata , "PlanarConfiguration" , 1 , new long [ ] { 2 } ) ; if ( p == 1 || p == 2 ) { checkRequiredTag ( metadata , "ResolutionUnit" , 1 , new long [ ] { 2 , 3 } ) ; checkRequiredTag ( metadata , "NumberOfInks" , 1 , new long [ ] { 4 } ) ; } } | Validate Final Page . |
6,916 | private boolean checkRequiredTag ( IfdTags metadata , String tagName , int cardinality , long [ ] possibleValues ) { boolean ok = true ; int tagid = TiffTags . getTagId ( tagName ) ; if ( ! metadata . containsTagId ( tagid ) ) { validation . addErrorLoc ( "Missing required tag for TiffIT" + profile + " " + tagName , "IFD" + currentIfd ) ; ok = false ; } else if ( cardinality != - 1 && metadata . get ( tagid ) . getCardinality ( ) != cardinality ) { validation . addError ( "Invalid cardinality for TiffIT" + profile + " tag " + tagName , "IFD" + currentIfd , metadata . get ( tagid ) . getCardinality ( ) ) ; } else if ( cardinality == 1 && possibleValues != null ) { long val = metadata . get ( tagid ) . getFirstNumericValue ( ) ; boolean contained = false ; int i = 0 ; while ( i < possibleValues . length && ! contained ) { contained = possibleValues [ i ] == val ; i ++ ; } if ( ! contained ) validation . addError ( "Invalid value for TiffIT" + profile + " tag " + tagName , "IFD" + currentIfd , val ) ; } return ok ; } | Check required tag is present and its cardinality and value is correct . |
6,917 | private boolean checkRequiredTag ( IfdTags metadata , String tagName , int cardinality ) { return checkRequiredTag ( metadata , tagName , cardinality , null ) ; } | Check a required tag is present . |
6,918 | public void importStatic ( String name ) throws ELException { int i = name . lastIndexOf ( '.' ) ; if ( i <= 0 ) { throw new ELException ( "The name " + name + " is not a full static member name" ) ; } String memberName = name . substring ( i + 1 ) ; String className = name . substring ( 0 , i ) ; staticNameMap . put ( memberName , className ) ; } | Import a static field or method . |
6,919 | public void importClass ( String name ) throws ELException { int i = name . lastIndexOf ( '.' ) ; if ( i <= 0 ) { throw new ELException ( "The name " + name + " is not a full class name" ) ; } String className = name . substring ( i + 1 ) ; classNameMap . put ( className , name ) ; } | Import a class . |
6,920 | public Class < ? > resolveClass ( String name ) { String className = classNameMap . get ( name ) ; if ( className != null ) { return resolveClassFor ( className ) ; } for ( String packageName : packages ) { String fullClassName = packageName + "." + name ; Class < ? > c = resolveClassFor ( fullClassName ) ; if ( c != null ) { classNameMap . put ( name , fullClassName ) ; return c ; } } return null ; } | Resolve a class name . |
6,921 | public Class < ? > resolveStatic ( String name ) { String className = staticNameMap . get ( name ) ; if ( className != null ) { Class < ? > c = resolveClassFor ( className ) ; if ( c != null ) { return c ; } } return null ; } | Resolve a static field or method name . |
6,922 | public static XMLStreamReader createXmlStreamReader ( Path path , boolean namespaceAware ) throws JAXBException { XMLInputFactory xif = getXmlInputFactory ( namespaceAware ) ; XMLStreamReader xsr = null ; try { xsr = xif . createXMLStreamReader ( new StreamSource ( path . toFile ( ) ) ) ; } catch ( XMLStreamException e ) { throw new JAXBException ( e ) ; } return xsr ; } | Creates an XMLStreamReader based on a file path . |
6,923 | public static XMLStreamReader createXmlStreamReader ( InputStream is , boolean namespaceAware ) throws JAXBException { XMLInputFactory xif = getXmlInputFactory ( namespaceAware ) ; XMLStreamReader xsr = null ; try { xsr = xif . createXMLStreamReader ( is ) ; } catch ( XMLStreamException e ) { throw new JAXBException ( e ) ; } return xsr ; } | Creates an XMLStreamReader based on an input stream . |
6,924 | public static XMLStreamReader createXmlStreamReader ( Reader reader , boolean namespaceAware ) throws JAXBException { XMLInputFactory xif = getXmlInputFactory ( namespaceAware ) ; XMLStreamReader xsr = null ; try { xsr = xif . createXMLStreamReader ( reader ) ; } catch ( XMLStreamException e ) { throw new JAXBException ( e ) ; } return xsr ; } | Creates an XMLStreamReader based on a Reader . |
6,925 | public static < T > T unmarshal ( Class < T > cl , String s ) throws JAXBException { return unmarshal ( cl , new StringReader ( s ) ) ; } | Convert a string to an object of a given class . |
6,926 | public static < T > T unmarshal ( Class < T > cl , File f ) throws JAXBException { return unmarshal ( cl , new StreamSource ( f ) ) ; } | Convert the contents of a file to an object of a given class . |
6,927 | public static < T > T unmarshal ( Class < T > cl , Reader r ) throws JAXBException { return unmarshal ( cl , new StreamSource ( r ) ) ; } | Convert the contents of a Reader to an object of a given class . |
6,928 | public static < T > T unmarshal ( Class < T > cl , InputStream s ) throws JAXBException { return unmarshal ( cl , new StreamSource ( s ) ) ; } | Convert the contents of an InputStream to an object of a given class . |
6,929 | public static < T > T unmarshal ( Class < T > cl , Source s ) throws JAXBException { JAXBContext ctx = JAXBContext . newInstance ( cl ) ; Unmarshaller u = ctx . createUnmarshaller ( ) ; return u . unmarshal ( s , cl ) . getValue ( ) ; } | Convert the contents of a Source to an object of a given class . |
6,930 | public static < T > List < T > unmarshalCollection ( Class < T > cl , String s ) throws JAXBException { return unmarshalCollection ( cl , new StringReader ( s ) ) ; } | Converts the contents of the string to a List with objects of the given class . |
6,931 | public static < T > List < T > unmarshalCollection ( Class < T > cl , Reader r ) throws JAXBException { return unmarshalCollection ( cl , new StreamSource ( r ) ) ; } | Converts the contents of the Reader to a List with objects of the given class . |
6,932 | public static < T > List < T > unmarshalCollection ( Class < T > cl , InputStream s ) throws JAXBException { return unmarshalCollection ( cl , new StreamSource ( s ) ) ; } | Converts the contents of the InputStream to a List with objects of the given class . |
6,933 | public static < T > List < T > unmarshalCollection ( Class < T > cl , Source s ) throws JAXBException { JAXBContext ctx = JAXBContext . newInstance ( JAXBCollection . class , cl ) ; Unmarshaller u = ctx . createUnmarshaller ( ) ; JAXBCollection < T > collection = u . unmarshal ( s , JAXBCollection . class ) . getValue ( ) ; return collection . getItems ( ) ; } | Converts the contents of the Source to a List with objects of the given class . |
6,934 | public static < T > String marshal ( T obj ) throws JAXBException { StringWriter sw = new StringWriter ( ) ; marshal ( obj , sw ) ; return sw . toString ( ) ; } | Convert an object to a string . |
6,935 | public static < T > void marshal ( T obj , Writer wr ) throws JAXBException { JAXBContext ctx = JAXBContext . newInstance ( obj . getClass ( ) ) ; Marshaller m = ctx . createMarshaller ( ) ; m . marshal ( obj , wr ) ; } | Convert an object to a string and send it to a Writer . |
6,936 | public static < T > void marshal ( T obj , File f ) throws JAXBException { JAXBContext ctx = JAXBContext . newInstance ( obj . getClass ( ) ) ; Marshaller m = ctx . createMarshaller ( ) ; m . marshal ( obj , f ) ; } | Convert an object to a string and save it to a File . |
6,937 | public static < T > void marshal ( T obj , OutputStream s ) throws JAXBException { JAXBContext ctx = JAXBContext . newInstance ( obj . getClass ( ) ) ; Marshaller m = ctx . createMarshaller ( ) ; m . marshal ( obj , s ) ; } | Convert an object to a string and send it to an OutputStream . |
6,938 | public static < T > String marshal ( String rootName , Collection < T > c ) throws JAXBException { StringWriter sw = new StringWriter ( ) ; marshal ( rootName , c , sw ) ; return sw . toString ( ) ; } | Convert a collection to a string . |
6,939 | public static < T > void marshal ( String rootName , Collection < T > c , Writer w ) throws JAXBException { JAXBContext ctx = JAXBContext . newInstance ( findTypes ( c ) ) ; Marshaller m = ctx . createMarshaller ( ) ; JAXBElement element = createCollectionElement ( rootName , c ) ; m . marshal ( element , w ) ; } | Convert a collection to a string and sends it to the Writer . |
6,940 | protected static < T > Class [ ] findTypes ( Collection < T > c ) { Set < Class > types = new HashSet < > ( ) ; types . add ( JAXBCollection . class ) ; for ( T o : c ) { if ( o != null ) { types . add ( o . getClass ( ) ) ; } } return types . toArray ( new Class [ 0 ] ) ; } | Discovers all the classes in the given Collection . These need to be in the JAXBContext if you want to marshal those objects . Unfortunatly there s no way of getting the generic type at runtime . |
6,941 | protected static < T > JAXBElement createCollectionElement ( String rootName , Collection < T > c ) { JAXBCollection collection = new JAXBCollection ( c ) ; return new JAXBElement < > ( new QName ( rootName ) , JAXBCollection . class , collection ) ; } | Create a JAXBElement containing a JAXBCollection . Needed for marshalling a generic collection without a seperate wrapper class . |
6,942 | protected Column getColumn ( String name ) { for ( Column column : getColumns ( ) ) { if ( column . getColumnName ( ) . equals ( name ) ) { return column ; } } return null ; } | Find for the column associated with the given name . |
6,943 | public void replaceStringChildren ( List < String > strings , String parentId ) { ArrayList < StringEntity > entities = new ArrayList < > ( ) ; for ( String string : strings ) { if ( string != null ) { StringEntity entity = new StringEntity ( ) ; entity . setParentId ( parentId ) ; entity . setValue ( string ) ; entities . add ( entity ) ; } } replaceChildren ( entities , parentId ) ; } | This method allows to replace all string 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,944 | public void replaceStringChildren ( List < String > strings ) { ArrayList < StringEntity > entities = new ArrayList < > ( ) ; for ( String string : strings ) { StringEntity entity = new StringEntity ( ) ; entity . setValue ( string ) ; entities . add ( entity ) ; } replaceAll ( entities ) ; } | This method allows to replace all string children it will remove any children which are not in the list add the new ones and update which are in the list . |
6,945 | public List < String > getStringChildren ( Long parentId ) { ArrayList < String > strings = new ArrayList < > ( ) ; List < StringEntity > entities = getByField ( Column . PARENT_ID , parentId ) ; for ( StringEntity entity : entities ) { strings . add ( entity . getValue ( ) ) ; } return strings ; } | This method returns the list of strings associated with given parent id . |
6,946 | public List < String > getAllString ( ) { ArrayList < String > strings = new ArrayList < > ( ) ; List < StringEntity > entities = getAll ( ) ; for ( StringEntity entity : entities ) { strings . add ( entity . getValue ( ) ) ; } return strings ; } | Returns all strings . |
6,947 | public double overlapRelative ( DoubleRange other ) { double lenThis = length ( ) ; double lenOther = other . length ( ) ; if ( lenThis == 0 && lenOther == 0 ) { return this . equals ( other ) ? 1 : 0 ; } double overlapAbs = overlapAbsolute ( other ) ; return overlapAbs / Math . max ( lenThis , lenOther ) ; } | Relative overlap that is the overlap divided by the length of the largest interval . If both intervals are single points and they re equal - returns 1 |
6,948 | protected void searchDisposed ( ) { pool . shutdown ( ) ; searches . forEach ( s -> s . dispose ( ) ) ; super . searchDisposed ( ) ; } | When disposing a basic parallel search each of the searches that have been added to the parallel algorithm are disposed and the thread pool used for concurrent search execution is released . |
6,949 | public IScan add ( IScan scan ) { int num = scan . getNum ( ) ; IScan oldScan = getNum2scan ( ) . put ( num , scan ) ; log . trace ( "Adding scan #{} to ScanIndex. num2scan map already contained a scan for scanNum: {}" , num , num ) ; final Double rt = scan . getRt ( ) ; final TreeMap < Double , List < IScan > > rt2scan = getRt2scan ( ) ; if ( scan . getRt ( ) != null ) { List < IScan > scans = rt2scan . get ( rt ) ; if ( scans == null ) { scans = new ArrayList < > ( 1 ) ; scans . add ( scan ) ; getRt2scan ( ) . put ( rt , scans ) ; } else { boolean replaced = false ; for ( int i = 0 ; i < scans . size ( ) ; i ++ ) { IScan s = scans . get ( i ) ; if ( s . getNum ( ) == scan . getNum ( ) ) { scans . set ( i , scan ) ; replaced = true ; break ; } } if ( ! replaced ) { scans . add ( scan ) ; } } } else { log . debug ( "Adding scan # to ScanIndex. No RT." , num ) ; } return oldScan ; } | Adds a scan to the index . If the scan has RT set to non - null will also add it to RT index . If a scan with the same scan number was already in the index then it will get replaced . |
6,950 | protected boolean beginTransaction ( SQLiteDatabase db ) { boolean endTransaction = false ; if ( ! db . inTransaction ( ) ) { db . beginTransaction ( ) ; endTransaction = true ; LOGGER . trace ( "Begin transaction" ) ; } return endTransaction ; } | Begins a transaction if there is not a transaction started yet . |
6,951 | public String getCreateTableSQL ( ) { StringBuilder builder = new StringBuilder ( ) ; for ( Column column : getColumns ( ) ) { addColumn ( builder , column ) ; builder . append ( ", " ) ; } StringBuilder referencesBuilder = new StringBuilder ( ) ; for ( Column column : getColumns ( ) ) { if ( column . getReference ( ) != null ) { referencesBuilder . append ( "FOREIGN KEY(" ) . append ( column . getColumnName ( ) ) . append ( ") REFERENCES " ) . append ( column . getReference ( ) . getTableName ( ) ) . append ( "(" ) . append ( column . getReference ( ) . getColumn ( ) . getColumnName ( ) ) . append ( ") ON DELETE CASCADE, " ) ; } } StringBuilder uniqueBuilder = new StringBuilder ( ) ; boolean first = true ; for ( Column column : getColumns ( ) ) { if ( column . isUnique ( ) ) { if ( ! first ) { uniqueBuilder . append ( ", " ) ; } first = false ; uniqueBuilder . append ( column . getColumnName ( ) ) ; } } return getCreateTableSQL ( builder . toString ( ) , referencesBuilder . toString ( ) , uniqueBuilder . toString ( ) ) ; } | Creates the SQL statement to create the table according columns definitions . |
6,952 | private String getCreateTableSQL ( String columns , String references , String uniqueColumns ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "CREATE TABLE " ) . append ( getTableName ( ) ) . append ( "(" ) ; builder . append ( columns ) ; builder . append ( references ) ; builder . append ( "UNIQUE (" ) . append ( uniqueColumns ) . append ( ") ON CONFLICT REPLACE" ) ; builder . append ( ");" ) ; return builder . toString ( ) ; } | Creates the SQL statement to create the table using given columns definitions . |
6,953 | private void addColumn ( StringBuilder builder , Column column ) { builder . append ( column . getColumnName ( ) ) ; builder . append ( " " ) ; builder . append ( column . getDataType ( ) . getType ( ) ) ; Boolean optional = column . isOptional ( ) ; if ( optional != null ) { builder . append ( optional ? " NULL" : " NOT NULL" ) ; } String extraQualifier = column . getExtraQualifier ( ) ; if ( extraQualifier != null ) { builder . append ( " " ) ; builder . append ( extraQualifier ) ; } } | Generate the SQL definition for a column . |
6,954 | public boolean contains ( Node node2 ) { if ( ( getBeginLine ( ) < node2 . getBeginLine ( ) ) || ( ( getBeginLine ( ) == node2 . getBeginLine ( ) ) && getBeginColumn ( ) <= node2 . getBeginColumn ( ) ) ) { if ( getEndLine ( ) > node2 . getEndLine ( ) ) { return true ; } else if ( ( getEndLine ( ) == node2 . getEndLine ( ) ) && getEndColumn ( ) >= node2 . getEndColumn ( ) ) { return true ; } } return false ; } | Return if this node contains another node according their line numbers and columns |
6,955 | public boolean isInEqualLocation ( Node node2 ) { if ( ! isNewNode ( ) && ! node2 . isNewNode ( ) ) { return getBeginLine ( ) == node2 . getBeginLine ( ) && getBeginColumn ( ) == node2 . getBeginColumn ( ) && getEndLine ( ) == node2 . getEndLine ( ) && getEndColumn ( ) == node2 . getEndColumn ( ) ; } return false ; } | Return if this node has the same columns and lines than another one . |
6,956 | public boolean isPreviousThan ( Node node ) { if ( getEndLine ( ) < node . getBeginLine ( ) ) { return true ; } else if ( ( getEndLine ( ) == node . getBeginLine ( ) ) && ( getEndColumn ( ) <= node . getBeginColumn ( ) ) ) { return true ; } return false ; } | Return if this node is previous than another one according their line and column numbers |
6,957 | public void add ( ELResolver elResolver ) { if ( elResolver == null ) { throw new NullPointerException ( ) ; } if ( size >= elResolvers . length ) { ELResolver [ ] newResolvers = new ELResolver [ size * 2 ] ; System . arraycopy ( elResolvers , 0 , newResolvers , 0 , size ) ; elResolvers = newResolvers ; } elResolvers [ size ++ ] = elResolver ; } | Adds the given resolver to the list of component resolvers . |
6,958 | public Object convertToType ( ELContext context , Object obj , Class < ? > targetType ) { context . setPropertyResolved ( false ) ; Object value = null ; for ( int i = 0 ; i < size ; i ++ ) { value = elResolvers [ i ] . convertToType ( context , obj , targetType ) ; if ( context . isPropertyResolved ( ) ) { return value ; } } return null ; } | Converts an object to a specific type . |
6,959 | public DesignSpec setBaselineGridColor ( int color ) { if ( mBaselineGridPaint . getColor ( ) == color ) { return this ; } mBaselineGridPaint . setColor ( color ) ; invalidateSelf ( ) ; return this ; } | Sets the baseline grid color . |
6,960 | public DesignSpec setKeylinesColor ( int color ) { if ( mKeylinesPaint . getColor ( ) == color ) { return this ; } mKeylinesPaint . setColor ( color ) ; invalidateSelf ( ) ; return this ; } | Sets the keyline color . |
6,961 | public DesignSpec setSpacingsColor ( int color ) { if ( mSpacingsPaint . getColor ( ) == color ) { return this ; } mSpacingsPaint . setColor ( color ) ; invalidateSelf ( ) ; return this ; } | Sets the spacing mark color . |
6,962 | public List < Scan . ScanOrigin > getScanOrigin ( ) { if ( scanOrigin == null ) { scanOrigin = new ArrayList < Scan . ScanOrigin > ( ) ; } return this . scanOrigin ; } | Gets the value of the scanOrigin property . |
6,963 | public List < Scan . PrecursorMz > getPrecursorMz ( ) { if ( precursorMz == null ) { precursorMz = new ArrayList < Scan . PrecursorMz > ( ) ; } return this . precursorMz ; } | Gets the value of the precursorMz property . |
6,964 | public List < Scan . Peaks > getPeaks ( ) { if ( peaks == null ) { peaks = new ArrayList < Scan . Peaks > ( ) ; } return this . peaks ; } | Gets the value of the peaks property . |
6,965 | private void selectPage ( long offset ) { if ( currentBuffer == null || currentBuffer . seekSuccessful ( offset ) ) { currentBuffer = null ; int i = 0 ; while ( i < pages . size ( ) && currentBuffer == null ) { if ( pages . get ( i ) . seekSuccessful ( offset ) ) currentBuffer = pages . get ( i ) ; i ++ ; } if ( currentBuffer == null ) { if ( pages . size ( ) >= MaxPages ) pages . remove ( 0 ) ; pages . add ( new InputBuffer ( input ) ) ; currentBuffer = pages . get ( pages . size ( ) - 1 ) ; } } } | Select buffer . |
6,966 | public List < SubsetMove > getAllMoves ( SubsetSolution solution ) { if ( minSizeReached ( solution ) ) { return Collections . emptyList ( ) ; } Set < Integer > removeCandidates = getRemoveCandidates ( solution ) ; if ( removeCandidates . isEmpty ( ) ) { return Collections . emptyList ( ) ; } return removeCandidates . stream ( ) . map ( del -> new DeletionMove ( del ) ) . collect ( Collectors . toList ( ) ) ; } | Generates a list of all possible deletion moves that remove a single ID from the selection of a given subset solution . Possible fixed IDs are not considered to be removed and the minimum subset size is taken into account . May return an empty list if no deletion moves can be generated . |
6,967 | protected boolean updateCurrentAndBestSolution ( SolutionType solution , Evaluation evaluation , Validation validation ) { updateCurrentSolution ( solution , evaluation , validation ) ; return updateBestSolution ( solution , evaluation , validation ) ; } | Update the current and best solution during search given that the respective solution has already been evaluated and validated . The current solution is always updated also if it is invalid . Conversely the best solution is only updated if the given solution is valid and improves over the best solution found so far . |
6,968 | public static boolean launchOrDownloadApp ( String applicationId ) { boolean isAppInstalled = isAppInstalled ( applicationId ) ; if ( isAppInstalled ) { launchExternalApp ( applicationId ) ; } else { GooglePlayUtils . launchAppDetails ( applicationId ) ; } return isAppInstalled ; } | Launch applicationId app or open Google Play to download . |
6,969 | public static < T extends Enum < T > > T getEnumFromString ( Class < T > c , String string ) { if ( c != null && string != null ) { return Enum . valueOf ( c , string . trim ( ) . toUpperCase ( ) ) ; } return null ; } | A common method for all enums since they can t have another base class |
6,970 | protected void searchStep ( ) { Move < ? super SolutionType > move = getNeighbourhood ( ) . getRandomMove ( getCurrentSolution ( ) , getRandom ( ) ) ; if ( move != null ) { if ( isImprovement ( move ) ) { accept ( move ) ; } else { reject ( move ) ; } } else { stop ( ) ; } } | Creates a random neighbour of the current solution and accepts it if it improves over the current solution . |
6,971 | protected void searchStep ( ) { List < ? extends Move < ? super SolutionType > > moves = getNeighbourhood ( ) . getAllMoves ( getCurrentSolution ( ) ) ; Collections . shuffle ( moves ) ; Move < ? super SolutionType > move = getBestMove ( moves , false , true , getTabuFilter ( ) ) ; if ( move != null ) { accept ( move ) ; } else { stop ( ) ; } } | One step of the first - best - admissible tabu search algorithm . All possible moves are inspected in random order and either the first admissible improvement if any or else the best admissible move is applied to the current solution . |
6,972 | private void newBuffer ( int offset ) { if ( maxBufferSize >= 0 ) { buffer = new int [ maxBufferSize ] ; isByte = new boolean [ maxBufferSize ] ; bufferOffset = offset ; currentBufferSize = 0 ; } } | New buffer . |
6,973 | private void writeBuffer ( ) throws IOException { for ( int pos = 0 ; pos < currentBufferSize ; pos ++ ) { if ( isByte [ pos ] ) { aFile . write ( ( byte ) buffer [ pos ] ) ; } else { aFile . write ( buffer [ pos ] ) ; } } } | Write buffer . |
6,974 | public final void reset ( ) { isNonMassSpectrum = false ; curScan = null ; defaultArrayLength = null ; spectrumIndex = null ; spectrumId = null ; precursorSpectrumIndex = null ; activationMethodAbbreviation = null ; precursors = new ArrayList < > ( 1 ) ; precursorIsoWndTarget = null ; precursorIsoWndLoOffset = null ; precursorIsoWndHiOffset = null ; precursorIntensity = null ; offsetLo = null ; offsetHi = null ; length = null ; precision = null ; compressions = null ; binDataType = null ; mzData = null ; intensityData = null ; imData = null ; } | Resets all held variables to their default values . |
6,975 | private void prettyPrint ( Node < K , V > n ) { if ( n . left != null ) { prettyPrint ( n . left ) ; } System . out . println ( n ) ; if ( n . right != null ) { prettyPrint ( n . right ) ; } } | Recursively prints the tree . |
6,976 | public void put ( Interval1D < K > interval , V value ) { Node < K , V > origNode = get ( interval ) ; if ( origNode != null ) { origNode . setValue ( value ) ; } else { root = randomizedInsert ( root , interval , value ) ; } } | Insert a new node in the tree . If the tree contained that interval already the value is replaced . |
6,977 | private Node < K , V > randomizedInsert ( Node < K , V > x , Interval1D < K > interval , V value ) { if ( x == null ) { return new Node < > ( interval , value ) ; } if ( java . lang . Math . random ( ) * size ( x ) < 1.0 ) { return rootInsert ( x , interval , value ) ; } int cmp = interval . compareTo ( x . interval ) ; if ( cmp < 0 ) { x . left = randomizedInsert ( x . left , interval , value ) ; } else { x . right = randomizedInsert ( x . right , interval , value ) ; } fix ( x ) ; return x ; } | make new node the root with uniform probability |
6,978 | public Node < K , V > remove ( Interval1D < K > interval ) { Node < K , V > node = get ( interval ) ; root = remove ( root , interval ) ; return node ; } | Remove and return value associated with given interval . |
6,979 | private boolean searchAll ( Node < K , V > x , Interval1D < K > interval , List < Node < K , V > > toAppend ) { boolean found1 = false ; boolean found2 = false ; boolean found3 = false ; if ( x == null ) { return false ; } if ( interval . intersects ( x . interval ) ) { toAppend . add ( x ) ; found1 = true ; } if ( x . left != null && x . left . max . compareTo ( interval . lo ) >= 0 ) { found2 = searchAll ( x . left , interval , toAppend ) ; } if ( found2 || x . left == null || x . left . max . compareTo ( interval . lo ) < 0 ) { found3 = searchAll ( x . right , interval , toAppend ) ; } return found1 || found2 || found3 ; } | look in subtree rooted at x |
6,980 | public boolean isThumbnail ( ) { if ( tags . containsTagId ( 254 ) ) { if ( tags . get ( 254 ) . getCardinality ( ) > 0 ) return BigInteger . valueOf ( tags . get ( 254 ) . getFirstNumericValue ( ) ) . testBit ( 0 ) ; } if ( tags . containsTagId ( 255 ) ) { if ( tags . get ( 255 ) . getCardinality ( ) > 0 ) return tags . get ( 255 ) . getFirstNumericValue ( ) == 2 ; } if ( hasSubIFD ( ) && getImageSize ( ) < getsubIFD ( ) . getImageSize ( ) ) { return true ; } if ( hasParent ( ) && getImageSize ( ) < getParent ( ) . getImageSize ( ) ) { return true ; } return false ; } | Is thumbnail boolean . |
6,981 | public List < IFD > getSubIFD ( ) { List < IFD > l = new ArrayList < IFD > ( ) ; if ( hasSubIFD ( ) ) { for ( abstractTiffType o : tags . get ( 330 ) . getValue ( ) ) { l . add ( ( IFD ) o ) ; } } return l ; } | Gets sub ifds . |
6,982 | public Metadata createMetadata ( ) { Metadata metadata = new Metadata ( ) ; for ( TagValue tag : getMetadata ( ) . getTags ( ) ) { if ( tag . getCardinality ( ) == 1 ) { abstractTiffType t = tag . getValue ( ) . get ( 0 ) ; if ( t . isIFD ( ) ) { Metadata metadata2 = ( ( IFD ) t ) . createMetadata ( ) ; for ( String key : metadata2 . keySet ( ) ) { metadata . add ( key , metadata2 . get ( key ) ) ; } } else if ( t . containsMetadata ( ) ) { try { Metadata meta = t . createMetadata ( ) ; metadata . addMetadata ( meta ) ; } catch ( Exception ex ) { } } } } return metadata ; } | Create IFD metadata . |
6,983 | public void printTags ( ) { for ( TagValue ie : tags . getTags ( ) ) { try { String name = "" + ie . getId ( ) ; if ( TiffTags . hasTag ( ie . getId ( ) ) ) name = TiffTags . getTag ( ie . getId ( ) ) . getName ( ) ; String val = ie . toString ( ) ; String type = TiffTags . tagTypes . get ( ie . getType ( ) ) ; System . out . println ( name + "(" + ie . getType ( ) + "->" + type + "): " + val ) ; } catch ( Exception ex ) { System . out . println ( "Tag error" ) ; } } } | Prints the tags . |
6,984 | private void showCheatsheet ( Context context , View view ) { final int [ ] screenPos = new int [ 2 ] ; final Rect displayFrame = new Rect ( ) ; view . getLocationOnScreen ( screenPos ) ; view . getWindowVisibleDisplayFrame ( displayFrame ) ; final int width = view . getWidth ( ) ; final int height = view . getHeight ( ) ; final int midy = screenPos [ 1 ] + ( height / 2 ) ; final int screenWidth = context . getResources ( ) . getDisplayMetrics ( ) . widthPixels ; Toast cheatSheet = Toast . makeText ( context , title , Toast . LENGTH_SHORT ) ; if ( midy < displayFrame . height ( ) ) { cheatSheet . setGravity ( Gravity . TOP | Gravity . RIGHT , screenWidth - screenPos [ 0 ] - ( width / 2 ) , height ) ; } else { cheatSheet . setGravity ( Gravity . BOTTOM | Gravity . CENTER_HORIZONTAL , 0 , height ) ; } cheatSheet . show ( ) ; } | Slightly modified code from Jake Wharton s ABS |
6,985 | public boolean add ( E e ) { if ( set . contains ( e ) ) { return false ; } queue . add ( e ) ; set . add ( e ) ; while ( queue . size ( ) > sizeLimit ) { remove ( ) ; } return true ; } | Add an element at the tail of the queue replacing the least recently added item if the queue is full . The item is only added to the queue if it is not already contained . Runs in constant time assuming the hash function disperses the elements properly among the buckets of the underlying hash set . |
6,986 | public boolean addAll ( Collection < E > items ) { boolean modified = false ; for ( E e : items ) { modified = add ( e ) || modified ; } return modified ; } | Add the given collection of items . Only those items which are not yet contained in the queue are added in the order of iteration through the given collection . Runs in linear time assuming the hash function disperses the elements properly among the buckets of the underlying hash set . |
6,987 | public void propertyChange ( PropertyChangeEvent evt ) { originalValue = getValue ( ) ; if ( deliverValueChangeEvents ) { mediatedValueHolder . setValue ( originalValue ) ; updateDirtyState ( ) ; } } | called by the wrapped value model |
6,988 | protected void updateDirtyState ( ) { boolean dirty = isDirty ( ) ; if ( oldDirty != dirty ) { oldDirty = dirty ; firePropertyChange ( DIRTY_PROPERTY , ! dirty , dirty ) ; } } | Check the dirty state and fire events if needed . |
6,989 | protected final void firePropertyChange ( String propertyName , boolean oldValue , boolean newValue ) { if ( DIRTY_PROPERTY . equals ( propertyName ) ) { PropertyChangeEvent evt = new PropertyChangeEvent ( this , propertyName , Boolean . valueOf ( oldValue ) , Boolean . valueOf ( newValue ) ) ; for ( Iterator i = dirtyChangeListeners . iterator ( ) ; i . hasNext ( ) ; ) { ( ( PropertyChangeListener ) i . next ( ) ) . propertyChange ( evt ) ; } } } | Handles the dirty event firing . |
6,990 | public Hashtable < Integer , JLabel > getSliderLabels ( ) { Hashtable < Integer , JLabel > dict = new Hashtable < Integer , JLabel > ( ) ; for ( Map . Entry < Integer , String > entry : labels . entrySet ( ) ) { dict . put ( entry . getKey ( ) , new JLabel ( entry . getValue ( ) ) ) ; } return dict ; } | Gets a map with integer values with the corresponding JLabel for that value |
6,991 | protected Binder findBinderByPropertyName ( Class parentObjectType , String propertyName ) { PropertyNameKey key = new PropertyNameKey ( parentObjectType , propertyName ) ; Binder binder = ( Binder ) propertyNameBinders . get ( key ) ; if ( binder == null ) { final Map potentialMatchingBinders = new HashMap ( ) ; for ( Iterator i = propertyNameBinders . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) i . next ( ) ; if ( ( ( PropertyNameKey ) entry . getKey ( ) ) . getPropertyName ( ) . equals ( propertyName ) ) { potentialMatchingBinders . put ( ( ( PropertyNameKey ) entry . getKey ( ) ) . getParentObjectType ( ) , entry . getValue ( ) ) ; } } binder = ( Binder ) ClassUtils . getValueFromMapForClass ( parentObjectType , potentialMatchingBinders ) ; if ( binder != null ) { registerBinderForPropertyName ( parentObjectType , propertyName , binder ) ; } } return binder ; } | Try to find a binder for the provided parentObjectType and propertyName . If no direct match found try to find binder for any superclass of the provided objectType which also has the same propertyName . |
6,992 | public void setBindersForPropertyTypes ( Map binders ) { for ( Iterator i = binders . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) i . next ( ) ; registerBinderForPropertyType ( ( Class ) entry . getKey ( ) , ( Binder ) entry . getValue ( ) ) ; } } | Registers property type binders by extracting the key and value from each entry in the provided map using the key to specify the property type and the value to specify the binder . |
6,993 | public void setBindersForControlTypes ( Map binders ) { for ( Iterator i = binders . entrySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) i . next ( ) ; registerBinderForControlType ( ( Class ) entry . getKey ( ) , ( Binder ) entry . getValue ( ) ) ; } } | Registers control type binders by extracting the key and value from each entry in the provided map using the key to specify the property type and the value to specify the binder . |
6,994 | private Rules createContactRules ( ) { return new Rules ( Contact . class ) { protected void initRules ( ) { add ( "firstName" , NAME_CONSTRAINT ) ; add ( "lastName" , NAME_CONSTRAINT ) ; add ( not ( eqProperty ( "firstName" , "lastName" ) ) ) ; add ( "dateOfBirth" , lt ( new Date ( ) ) ) ; add ( "emailAddress" , EMAIL_CONSTRAINT ) ; add ( "homePhone" , PHONE_CONSTRAINT ) ; add ( "workPhone" , PHONE_CONSTRAINT ) ; add ( "contactType" , required ( ) ) ; add ( "address.address1" , required ( ) ) ; add ( "address.city" , required ( ) ) ; add ( "address.state" , required ( ) ) ; add ( "address.zip" , ZIPCODE_CONSTRAINT ) ; add ( "memo" , required ( ) ) ; } } ; } | Construct the rules that are used to validate a Contact domain object . |
6,995 | private VLDockingViewDescriptor getTemplate ( ViewDescriptor viewDescriptor ) { Assert . notNull ( viewDescriptor , "viewDescriptor" ) ; final VLDockingViewDescriptor vlDockingViewDescriptor ; vlDockingViewDescriptor = new VLDockingViewDescriptor ( ) ; return vlDockingViewDescriptor ; } | Gets the configured template for the given view descriptor . |
6,996 | private void createPageControls ( ) { WizardPage [ ] pages = wizard . getPages ( ) ; for ( int i = 0 ; i < pages . length ; i ++ ) { JComponent c = pages [ i ] . getControl ( ) ; GuiStandardUtils . attachDialogBorder ( c ) ; Dimension size = c . getPreferredSize ( ) ; if ( size . width > largestPageWidth ) { largestPageWidth = size . width ; } if ( size . height > largestPageHeight ) { largestPageHeight = size . height ; } } } | Allow the wizard s pages to pre - create their page controls . This allows the wizard dialog to open to the correct size . |
6,997 | public AbstractButton configure ( AbstractButton button ) { Assert . notNull ( button , "The button to configure is required" ) ; button . setIcon ( icon ) ; button . setSelectedIcon ( selectedIcon ) ; button . setDisabledIcon ( disabledIcon ) ; button . setPressedIcon ( pressedIcon ) ; button . setRolloverIcon ( rolloverIcon ) ; return button ; } | Configures the given command button with the icon values from this instance . |
6,998 | protected void applyContext ( ShuttleListBinding binding , Map context ) { if ( context . containsKey ( MODEL_KEY ) ) { binding . setModel ( ( ListModel ) context . get ( MODEL_KEY ) ) ; } if ( context . containsKey ( SELECTABLE_ITEMS_HOLDER_KEY ) ) { binding . setSelectableItemsHolder ( ( ValueModel ) context . get ( SELECTABLE_ITEMS_HOLDER_KEY ) ) ; } if ( context . containsKey ( SELECTED_ITEMS_HOLDER_KEY ) ) { binding . setSelectedItemsHolder ( ( ValueModel ) context . get ( SELECTED_ITEMS_HOLDER_KEY ) ) ; } if ( context . containsKey ( RENDERER_KEY ) ) { binding . setRenderer ( ( ListCellRenderer ) context . get ( RENDERER_KEY ) ) ; } if ( context . containsKey ( COMPARATOR_KEY ) ) { binding . setComparator ( ( Comparator ) context . get ( COMPARATOR_KEY ) ) ; } if ( context . containsKey ( SELECTED_ITEM_TYPE_KEY ) ) { binding . setSelectedItemType ( ( Class ) context . get ( SELECTED_ITEM_TYPE_KEY ) ) ; } if ( context . containsKey ( FORM_ID ) ) { binding . setFormId ( ( String ) context . get ( FORM_ID ) ) ; } } | Apply the values from the context to the specified binding . |
6,999 | public Binder getIdBoundBinder ( String id ) { Binder binder = idBoundBinders . get ( id ) ; if ( binder == null ) { Object binderBean = getApplicationContext ( ) . getBean ( id ) ; if ( binderBean instanceof Binder ) { if ( binderBean != null ) { idBoundBinders . put ( id , ( Binder ) binderBean ) ; binder = ( Binder ) binderBean ; } } else { throw new IllegalArgumentException ( "Bean '" + id + "' was found, but was not a binder" ) ; } } return binder ; } | Try to find a binder with a specified id . If no binder is found try to locate it into the application context check whether it s a binder and add it to the id bound binder map . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.