signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ChannelFlushPromiseNotifier { /** * Add a { @ link ChannelPromise } to this { @ link ChannelFlushPromiseNotifier } which will be notified after the given
* { @ code pendingDataSize } was reached . */
public ChannelFlushPromiseNotifier add ( ChannelPromise promise , long pendingDataSize ) { } } | if ( promise == null ) { throw new NullPointerException ( "promise" ) ; } checkPositiveOrZero ( pendingDataSize , "pendingDataSize" ) ; long checkpoint = writeCounter + pendingDataSize ; if ( promise instanceof FlushCheckpoint ) { FlushCheckpoint cp = ( FlushCheckpoint ) promise ; cp . flushCheckpoint ( checkpoint ) ; flushCheckpoints . add ( cp ) ; } else { flushCheckpoints . add ( new DefaultFlushCheckpoint ( checkpoint , promise ) ) ; } return this ; |
public class CheckAccessControls { /** * Returns the deprecation reason for the property if it is marked
* as being deprecated . Returns empty string if the property is deprecated
* but no reason was given . Returns null if the property is not deprecated . */
@ Nullable private static String getPropertyDeprecationInfo ( ObjectType type , String prop ) { } } | String depReason = getDeprecationReason ( type . getOwnPropertyJSDocInfo ( prop ) ) ; if ( depReason != null ) { return depReason ; } ObjectType implicitProto = type . getImplicitPrototype ( ) ; if ( implicitProto != null ) { return getPropertyDeprecationInfo ( implicitProto , prop ) ; } return null ; |
public class PackageIndexFrameWriter { /** * Generate the package index file named " overview - frame . html " .
* @ throws DocletAbortException */
public static void generate ( ConfigurationImpl configuration ) { } } | PackageIndexFrameWriter packgen ; DocPath filename = DocPaths . OVERVIEW_FRAME ; try { packgen = new PackageIndexFrameWriter ( configuration , filename ) ; packgen . buildPackageIndexFile ( "doclet.Window_Overview" , false ) ; packgen . close ( ) ; } catch ( IOException exc ) { configuration . standardmessage . error ( "doclet.exception_encountered" , exc . toString ( ) , filename ) ; throw new DocletAbortException ( exc ) ; } |
public class Util { /** * Given a weekday number , such as { @ code - 1SU } , this method calculates the
* day of the month that it falls on . The weekday number may be refer to a
* week in the current month in some contexts , or a week in the current year
* in other contexts .
* @ param dow0 the day of week of the first day in the current year / month
* @ param nDays the number of days in the current year / month ( must be one of
* the following values [ 28,29,30,31,365,366 ] )
* @ param weekNum the weekday number ( for example , the - 1 in { @ code - 1SU } )
* @ param dow the day of the week ( for example , the SU in { @ code - 1SU } )
* @ param d0 the number of days between the first day of the current
* year / month and the current month
* @ param nDaysInMonth the number of days in the current month
* @ return the day of the month , or 0 if no such day exists */
static int dayNumToDate ( DayOfWeek dow0 , int nDays , int weekNum , DayOfWeek dow , int d0 , int nDaysInMonth ) { } } | // if dow is wednesday , then this is the date of the first wednesday
int firstDateOfGivenDow = 1 + ( ( 7 + dow . getCalendarConstant ( ) - dow0 . getCalendarConstant ( ) ) % 7 ) ; int date ; if ( weekNum > 0 ) { date = ( ( weekNum - 1 ) * 7 ) + firstDateOfGivenDow - d0 ; } else { // count weeks from end of month
// calculate last day of the given dow
// since nDays < = 366 , this should be > nDays
int lastDateOfGivenDow = firstDateOfGivenDow + ( 7 * 54 ) ; lastDateOfGivenDow -= 7 * ( ( lastDateOfGivenDow - nDays + 6 ) / 7 ) ; date = lastDateOfGivenDow + 7 * ( weekNum + 1 ) - d0 ; } return ( date <= 0 || date > nDaysInMonth ) ? 0 : date ; |
public class PrefixedProperties { /** * ( non - Javadoc )
* @ see java . util . Hashtable # entrySet ( ) */
@ Override public Set < Entry < Object , Object > > entrySet ( ) { } } | final Set < Entry < Object , Object > > entrySet = new HashSet < Entry < Object , Object > > ( ) ; lock . readLock ( ) . lock ( ) ; try { final boolean useLocalPrefixes = ! mixDefaultAndLocalPrefixes && hasLocalPrefixConfigurations ( ) ; for ( final Map . Entry < Object , Object > keyEntry : getKeyMap ( false ) . entrySet ( ) ) { final Object value = get ( keyEntry . getValue ( ) , useLocalPrefixes ) ; if ( String . class == keyEntry . getKey ( ) . getClass ( ) ) { entrySet . add ( new PPEntry ( keyEntry . getKey ( ) , value ) ) ; } else { entrySet . add ( new PPEntry ( keyEntry . getKey ( ) , value ) ) ; } } return entrySet ; } finally { lock . readLock ( ) . unlock ( ) ; } |
public class DateUtils { /** * 添加小时
* @ param date 日期
* @ param amount 数量
* @ return 添加后的日期
* @ throws ParseException 异常 */
public static Date addHour ( String date , int amount ) throws ParseException { } } | return add ( date , Calendar . HOUR , amount ) ; |
public class SQSMessagingClientThreadFactory { /** * Constructs a new Thread . Initializes name , daemon status , and ThreadGroup
* if there is any .
* @ param r
* A runnable to be executed by new thread instance
* @ return The constructed thread */
public Thread newThread ( Runnable r ) { } } | Thread t ; if ( threadGroup == null ) { t = new Thread ( r , threadBaseName + threadCounter . incrementAndGet ( ) ) ; t . setDaemon ( isDaemon ) ; } else { t = new Thread ( threadGroup , r , threadBaseName + threadCounter . incrementAndGet ( ) ) ; t . setDaemon ( isDaemon ) ; } return t ; |
public class PhotoUtils { /** * Transfer the Information of a photo from a DOM - object to a Photo - object .
* @ param photoElement
* @ param defaultElement
* @ return Photo */
public static final Photo createPhoto ( Element photoElement , Element defaultElement ) { } } | Photo photo = new Photo ( ) ; photo . setId ( photoElement . getAttribute ( "id" ) ) ; photo . setPlaceId ( photoElement . getAttribute ( "place_id" ) ) ; photo . setSecret ( photoElement . getAttribute ( "secret" ) ) ; photo . setServer ( photoElement . getAttribute ( "server" ) ) ; photo . setFarm ( photoElement . getAttribute ( "farm" ) ) ; photo . setRotation ( photoElement . getAttribute ( "rotation" ) ) ; photo . setFavorite ( "1" . equals ( photoElement . getAttribute ( "isfavorite" ) ) ) ; photo . setLicense ( photoElement . getAttribute ( "license" ) ) ; photo . setOriginalFormat ( photoElement . getAttribute ( "originalformat" ) ) ; photo . setOriginalSecret ( photoElement . getAttribute ( "originalsecret" ) ) ; photo . setIconServer ( photoElement . getAttribute ( "iconserver" ) ) ; photo . setIconFarm ( photoElement . getAttribute ( "iconfarm" ) ) ; photo . setDateTaken ( photoElement . getAttribute ( "datetaken" ) ) ; photo . setDatePosted ( photoElement . getAttribute ( "dateupload" ) ) ; photo . setLastUpdate ( photoElement . getAttribute ( "lastupdate" ) ) ; // flickr . groups . pools . getPhotos provides this value !
photo . setDateAdded ( photoElement . getAttribute ( "dateadded" ) ) ; photo . setOriginalWidth ( photoElement . getAttribute ( "width_o" ) ) ; photo . setOriginalHeight ( photoElement . getAttribute ( "height_o" ) ) ; photo . setMedia ( photoElement . getAttribute ( "media" ) ) ; photo . setMediaStatus ( photoElement . getAttribute ( "media_status" ) ) ; photo . setPathAlias ( photoElement . getAttribute ( "pathalias" ) ) ; photo . setViews ( photoElement . getAttribute ( "views" ) ) ; Element peopleElement = ( Element ) photoElement . getElementsByTagName ( "people" ) . item ( 0 ) ; if ( peopleElement != null ) { photo . setIsHasPeople ( "1" . equals ( peopleElement . getAttribute ( "haspeople" ) ) ) ; } else { photo . setIsHasPeople ( false ) ; } // If the attributes active that contain the image - urls ,
// Size - objects created from them , which are used to override
// the Url - generation .
List < Size > sizes = new ArrayList < Size > ( ) ; String urlTmp = photoElement . getAttribute ( "url_t" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . THUMB ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_t" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_t" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_s" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . SMALL ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_s" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_s" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_sq" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . SQUARE ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_sq" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_sq" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_m" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . MEDIUM ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_m" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_m" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_l" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . LARGE ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_l" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_l" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_o" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . ORIGINAL ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_o" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_o" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_q" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . SQUARE_LARGE ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_q" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_q" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_n" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . SMALL_320 ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_n" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_n" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_z" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . MEDIUM_640 ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_z" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_z" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_c" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . MEDIUM_800 ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_c" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_c" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_h" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . LARGE_1600 ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_h" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_h" ) ) ; sizes . add ( sizeT ) ; } urlTmp = photoElement . getAttribute ( "url_k" ) ; if ( urlTmp != null && urlTmp . startsWith ( "http" ) ) { Size sizeT = new Size ( ) ; sizeT . setLabel ( Size . LARGE_2048 ) ; sizeT . setSource ( urlTmp ) ; sizeT . setWidth ( photoElement . getAttribute ( "width_k" ) ) ; sizeT . setHeight ( photoElement . getAttribute ( "height_k" ) ) ; sizes . add ( sizeT ) ; } if ( sizes . size ( ) > 0 ) { photo . setSizes ( sizes ) ; } // Searches , or other list may contain orginal _ format .
// If not choosen via extras , set jpg as default .
try { if ( photo . getOriginalFormat ( ) == null || photo . getOriginalFormat ( ) . equals ( "" ) ) { String media = photo . getMedia ( ) ; if ( media != null && media . equals ( "video" ) ) photo . setOriginalFormat ( "mov" ) ; // Currently flickr incorrectly returns original _ format as jpg for movies .
else photo . setOriginalFormat ( "jpg" ) ; } } catch ( NullPointerException e ) { photo . setOriginalFormat ( "jpg" ) ; } try { Element ownerElement = ( Element ) photoElement . getElementsByTagName ( "owner" ) . item ( 0 ) ; if ( ownerElement == null ) { User owner = new User ( ) ; owner . setId ( getAttribute ( "owner" , photoElement , defaultElement ) ) ; owner . setUsername ( getAttribute ( "ownername" , photoElement , defaultElement ) ) ; photo . setOwner ( owner ) ; photo . setUrl ( "https://flickr.com/photos/" + owner . getId ( ) + "/" + photo . getId ( ) ) ; } else { User owner = new User ( ) ; owner . setId ( ownerElement . getAttribute ( "nsid" ) ) ; String username = ownerElement . getAttribute ( "username" ) ; String ownername = ownerElement . getAttribute ( "ownername" ) ; // try to get the username either from the " username " attribute or
// from the " ownername " attribute
if ( username != null && ! "" . equals ( username ) ) { owner . setUsername ( username ) ; } else if ( ownername != null && ! "" . equals ( ownername ) ) { owner . setUsername ( ownername ) ; } owner . setUsername ( ownerElement . getAttribute ( "username" ) ) ; owner . setRealName ( ownerElement . getAttribute ( "realname" ) ) ; owner . setLocation ( ownerElement . getAttribute ( "location" ) ) ; photo . setOwner ( owner ) ; photo . setUrl ( "https://flickr.com/photos/" + owner . getId ( ) + "/" + photo . getId ( ) ) ; } } catch ( IndexOutOfBoundsException e ) { User owner = new User ( ) ; owner . setId ( photoElement . getAttribute ( "owner" ) ) ; owner . setUsername ( photoElement . getAttribute ( "ownername" ) ) ; photo . setOwner ( owner ) ; photo . setUrl ( "https://flickr.com/photos/" + owner . getId ( ) + "/" + photo . getId ( ) ) ; } try { photo . setTitle ( XMLUtilities . getChildValue ( photoElement , "title" ) ) ; if ( photo . getTitle ( ) == null ) { photo . setTitle ( photoElement . getAttribute ( "title" ) ) ; } } catch ( IndexOutOfBoundsException e ) { photo . setTitle ( photoElement . getAttribute ( "title" ) ) ; } try { photo . setDescription ( XMLUtilities . getChildValue ( photoElement , "description" ) ) ; } catch ( IndexOutOfBoundsException e ) { } try { // here the flags are set , if the photo is read by getInfo ( ) .
Element visibilityElement = ( Element ) photoElement . getElementsByTagName ( "visibility" ) . item ( 0 ) ; photo . setPublicFlag ( "1" . equals ( visibilityElement . getAttribute ( "ispublic" ) ) ) ; photo . setFriendFlag ( "1" . equals ( visibilityElement . getAttribute ( "isfriend" ) ) ) ; photo . setFamilyFlag ( "1" . equals ( visibilityElement . getAttribute ( "isfamily" ) ) ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { // these flags are set here , if photos read from a list .
photo . setPublicFlag ( "1" . equals ( photoElement . getAttribute ( "ispublic" ) ) ) ; photo . setFriendFlag ( "1" . equals ( photoElement . getAttribute ( "isfriend" ) ) ) ; photo . setFamilyFlag ( "1" . equals ( photoElement . getAttribute ( "isfamily" ) ) ) ; } // Parse either photo by getInfo , or from list
try { Element datesElement = XMLUtilities . getChild ( photoElement , "dates" ) ; photo . setDatePosted ( datesElement . getAttribute ( "posted" ) ) ; photo . setDateTaken ( datesElement . getAttribute ( "taken" ) ) ; photo . setTakenGranularity ( datesElement . getAttribute ( "takengranularity" ) ) ; photo . setLastUpdate ( datesElement . getAttribute ( "lastupdate" ) ) ; } catch ( IndexOutOfBoundsException e ) { photo . setDateTaken ( photoElement . getAttribute ( "datetaken" ) ) ; } catch ( NullPointerException e ) { photo . setDateTaken ( photoElement . getAttribute ( "datetaken" ) ) ; } try { Element permissionsElement = ( Element ) photoElement . getElementsByTagName ( "permissions" ) . item ( 0 ) ; Permissions permissions = new Permissions ( ) ; permissions . setComment ( permissionsElement . getAttribute ( "permcomment" ) ) ; permissions . setAddmeta ( permissionsElement . getAttribute ( "permaddmeta" ) ) ; photo . setPermissions ( permissions ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { // nop
} try { Element editabilityElement = ( Element ) photoElement . getElementsByTagName ( "editability" ) . item ( 0 ) ; Editability editability = new Editability ( ) ; editability . setComment ( "1" . equals ( editabilityElement . getAttribute ( "cancomment" ) ) ) ; editability . setAddmeta ( "1" . equals ( editabilityElement . getAttribute ( "canaddmeta" ) ) ) ; photo . setEditability ( editability ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { // nop
} try { Element publicEditabilityElement = ( Element ) photoElement . getElementsByTagName ( "publiceditability" ) . item ( 0 ) ; Editability publicEditability = new Editability ( ) ; publicEditability . setComment ( "1" . equals ( publicEditabilityElement . getAttribute ( "cancomment" ) ) ) ; publicEditability . setAddmeta ( "1" . equals ( publicEditabilityElement . getAttribute ( "canaddmeta" ) ) ) ; photo . setPublicEditability ( publicEditability ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { // nop
} try { Element usageElement = ( Element ) photoElement . getElementsByTagName ( "usage" ) . item ( 0 ) ; Usage usage = new Usage ( ) ; usage . setIsCanBlog ( "1" . equals ( usageElement . getAttribute ( "canblog" ) ) ) ; usage . setIsCanDownload ( "1" . equals ( usageElement . getAttribute ( "candownload" ) ) ) ; usage . setIsCanShare ( "1" . equals ( usageElement . getAttribute ( "canshare" ) ) ) ; usage . setIsCanPrint ( "1" . equals ( usageElement . getAttribute ( "canprint" ) ) ) ; photo . setUsage ( usage ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { // nop
} try { Element commentsElement = ( Element ) photoElement . getElementsByTagName ( "comments" ) . item ( 0 ) ; photo . setComments ( ( ( Text ) commentsElement . getFirstChild ( ) ) . getData ( ) ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { // nop
} try { Element notesElement = ( Element ) photoElement . getElementsByTagName ( "notes" ) . item ( 0 ) ; List < Note > notes = new ArrayList < Note > ( ) ; NodeList noteNodes = notesElement . getElementsByTagName ( "note" ) ; for ( int i = 0 ; i < noteNodes . getLength ( ) ; i ++ ) { Element noteElement = ( Element ) noteNodes . item ( i ) ; Note note = new Note ( ) ; note . setId ( noteElement . getAttribute ( "id" ) ) ; note . setAuthor ( noteElement . getAttribute ( "author" ) ) ; note . setAuthorName ( noteElement . getAttribute ( "authorname" ) ) ; note . setBounds ( noteElement . getAttribute ( "x" ) , noteElement . getAttribute ( "y" ) , noteElement . getAttribute ( "w" ) , noteElement . getAttribute ( "h" ) ) ; note . setText ( noteElement . getTextContent ( ) ) ; notes . add ( note ) ; } photo . setNotes ( notes ) ; } catch ( IndexOutOfBoundsException e ) { photo . setNotes ( new ArrayList < Note > ( ) ) ; } catch ( NullPointerException e ) { photo . setNotes ( new ArrayList < Note > ( ) ) ; } // Tags coming as space - seperated attribute calling
// InterestingnessInterface # getList ( ) .
// Through PhotoInterface # getInfo ( ) the Photo has a list of
// Elements .
try { List < Tag > tags = new ArrayList < Tag > ( ) ; String tagsAttr = photoElement . getAttribute ( "tags" ) ; if ( ! tagsAttr . equals ( "" ) ) { String [ ] values = tagsAttr . split ( "\\s+" ) ; for ( int i = 0 ; i < values . length ; i ++ ) { Tag tag = new Tag ( ) ; tag . setValue ( values [ i ] ) ; tags . add ( tag ) ; } } else { try { Element tagsElement = ( Element ) photoElement . getElementsByTagName ( "tags" ) . item ( 0 ) ; NodeList tagNodes = tagsElement . getElementsByTagName ( "tag" ) ; for ( int i = 0 ; i < tagNodes . getLength ( ) ; i ++ ) { Element tagElement = ( Element ) tagNodes . item ( i ) ; Tag tag = new Tag ( ) ; tag . setId ( tagElement . getAttribute ( "id" ) ) ; tag . setAuthor ( tagElement . getAttribute ( "author" ) ) ; tag . setRaw ( tagElement . getAttribute ( "raw" ) ) ; tag . setValue ( ( ( Text ) tagElement . getFirstChild ( ) ) . getData ( ) ) ; tags . add ( tag ) ; } } catch ( IndexOutOfBoundsException e ) { } } photo . setTags ( tags ) ; } catch ( NullPointerException e ) { photo . setTags ( new ArrayList < Tag > ( ) ) ; } try { Element urlsElement = ( Element ) photoElement . getElementsByTagName ( "urls" ) . item ( 0 ) ; List < String > urls = new ArrayList < String > ( ) ; NodeList urlNodes = urlsElement . getElementsByTagName ( "url" ) ; for ( int i = 0 ; i < urlNodes . getLength ( ) ; i ++ ) { Element urlElement = ( Element ) urlNodes . item ( i ) ; PhotoUrl photoUrl = new PhotoUrl ( ) ; photo . setPhotoUrl ( photoUrl ) ; photoUrl . setType ( urlElement . getAttribute ( "type" ) ) ; photoUrl . setUrl ( XMLUtilities . getValue ( urlElement ) ) ; if ( photoUrl . getType ( ) . equals ( "photopage" ) ) { photo . setUrl ( photoUrl . getUrl ( ) ) ; urls . add ( photoUrl . getUrl ( ) ) ; } } photo . setUrls ( urls ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { photo . setUrls ( new ArrayList < String > ( ) ) ; } String longitude = null ; String latitude = null ; String accuracy = null ; try { Element geoElement = ( Element ) photoElement . getElementsByTagName ( "location" ) . item ( 0 ) ; longitude = geoElement . getAttribute ( "longitude" ) ; latitude = geoElement . getAttribute ( "latitude" ) ; accuracy = geoElement . getAttribute ( "accuracy" ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { // Geodata may be available as attributes in the photo - tag itself !
try { longitude = photoElement . getAttribute ( "longitude" ) ; latitude = photoElement . getAttribute ( "latitude" ) ; accuracy = photoElement . getAttribute ( "accuracy" ) ; } catch ( NullPointerException e2 ) { // no geodata at all
} } if ( longitude != null && latitude != null ) { if ( longitude . length ( ) > 0 && latitude . length ( ) > 0 && ! ( "0" . equals ( longitude ) && "0" . equals ( latitude ) ) ) { photo . setGeoData ( new GeoData ( longitude , latitude , accuracy ) ) ; } } try { Place place = null ; Element element = ( Element ) photoElement . getElementsByTagName ( "locality" ) . item ( 0 ) ; place = new Place ( element . getAttribute ( "place_id" ) , element . getTextContent ( ) , element . getAttribute ( "woeid" ) ) ; photo . setLocality ( place ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { } try { Place place = null ; Element element = ( Element ) photoElement . getElementsByTagName ( "county" ) . item ( 0 ) ; place = new Place ( element . getAttribute ( "place_id" ) , element . getTextContent ( ) , element . getAttribute ( "woeid" ) ) ; photo . setCounty ( place ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { } try { Place place = null ; Element element = ( Element ) photoElement . getElementsByTagName ( "region" ) . item ( 0 ) ; place = new Place ( element . getAttribute ( "place_id" ) , element . getTextContent ( ) , element . getAttribute ( "woeid" ) ) ; photo . setRegion ( place ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { } try { Place place = null ; Element element = ( Element ) photoElement . getElementsByTagName ( "country" ) . item ( 0 ) ; place = new Place ( element . getAttribute ( "place_id" ) , element . getTextContent ( ) , element . getAttribute ( "woeid" ) ) ; photo . setCountry ( place ) ; } catch ( IndexOutOfBoundsException e ) { } catch ( NullPointerException e ) { } return photo ; |
public class VideoSelectorMarshaller { /** * Marshall the given parameter object . */
public void marshall ( VideoSelector videoSelector , ProtocolMarshaller protocolMarshaller ) { } } | if ( videoSelector == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( videoSelector . getColorSpace ( ) , COLORSPACE_BINDING ) ; protocolMarshaller . marshall ( videoSelector . getColorSpaceUsage ( ) , COLORSPACEUSAGE_BINDING ) ; protocolMarshaller . marshall ( videoSelector . getHdr10Metadata ( ) , HDR10METADATA_BINDING ) ; protocolMarshaller . marshall ( videoSelector . getPid ( ) , PID_BINDING ) ; protocolMarshaller . marshall ( videoSelector . getProgramNumber ( ) , PROGRAMNUMBER_BINDING ) ; protocolMarshaller . marshall ( videoSelector . getRotate ( ) , ROTATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class nspbr6 { /** * Use this API to renumber nspbr6 resources . */
public static base_responses renumber ( nitro_service client , nspbr6 resources [ ] ) throws Exception { } } | base_responses result = null ; if ( resources != null && resources . length > 0 ) { nspbr6 renumberresources [ ] = new nspbr6 [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { renumberresources [ i ] = new nspbr6 ( ) ; } result = perform_operation_bulk_request ( client , renumberresources , "renumber" ) ; } return result ; |
public class DFSClient { /** * Get the checksum of a file .
* @ param src The file path
* @ return The checksum
* @ see DistributedFileSystem # getFileChecksum ( Path ) */
MD5MD5CRC32FileChecksum getFileChecksum ( String src ) throws IOException { } } | checkOpen ( ) ; return getFileChecksum ( dataTransferVersion , src , namenode , namenodeProtocolProxy , socketFactory , socketTimeout ) ; |
public class MapFile { /** * Reads only labels for tile .
* @ param tile tile for which data is requested .
* @ return label data for the tile . */
@ Override public MapReadResult readLabels ( Tile tile ) { } } | return readMapData ( tile , tile , Selector . LABELS ) ; |
public class FileTransferable { /** * { @ inheritDoc } */
@ Override public boolean isDataFlavorSupported ( DataFlavor flavor ) { } } | return flavor . equals ( FLAVORS [ FILE ] ) || flavor . equals ( FLAVORS [ STRING ] ) ; |
public class InputElement { /** * getter for dataset - gets
* @ generated */
public String getDataset ( ) { } } | if ( InputElement_Type . featOkTst && ( ( InputElement_Type ) jcasType ) . casFeat_dataset == null ) jcasType . jcas . throwFeatMissing ( "dataset" , "edu.cmu.lti.oaqa.framework.types.InputElement" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( InputElement_Type ) jcasType ) . casFeatCode_dataset ) ; |
public class JobAgentsInner { /** * Updates a job agent .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param jobAgentName The name of the job agent to be updated .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the JobAgentInner object */
public Observable < ServiceResponse < JobAgentInner > > beginUpdateWithServiceResponseAsync ( String resourceGroupName , String serverName , String jobAgentName ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverName == null ) { throw new IllegalArgumentException ( "Parameter serverName is required and cannot be null." ) ; } if ( jobAgentName == null ) { throw new IllegalArgumentException ( "Parameter jobAgentName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } final Map < String , String > tags = null ; JobAgentUpdate parameters = new JobAgentUpdate ( ) ; parameters . withTags ( null ) ; return service . beginUpdate ( resourceGroupName , serverName , jobAgentName , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , parameters , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < JobAgentInner > > > ( ) { @ Override public Observable < ServiceResponse < JobAgentInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < JobAgentInner > clientResponse = beginUpdateDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class Thin { /** * Takes an image and a kernel and thins it once .
* @ param b the BinaryFast input image
* @ param kernel the thinning kernel
* @ return the thinned BinaryFast image */
private BinaryFast thinBinaryRep ( BinaryFast b , int [ ] kernel ) { } } | Point p ; HashSet < Point > inputHashSet = new HashSet < Point > ( ) ; int [ ] [ ] pixels = b . getPixels ( ) ; if ( kernelNo0s ( kernel ) ) { for ( int j = 0 ; j < b . getHeight ( ) ; ++ j ) { for ( int i = 0 ; i < b . getWidth ( ) ; ++ i ) { if ( pixels [ i ] [ j ] == BinaryFast . FOREGROUND ) { inputHashSet . add ( new Point ( i , j ) ) ; } } } } else { Iterator < Point > it = b . getForegroundEdgePixels ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { inputHashSet . add ( it . next ( ) ) ; } } HashSet < Point > result = hitMissHashSet ( b , inputHashSet , kernel ) ; Iterator < Point > it = result . iterator ( ) ; while ( it . hasNext ( ) ) { p = new Point ( it . next ( ) ) ; // make p a background pixel and update the edge sets
b . removePixel ( p ) ; b . getForegroundEdgePixels ( ) . remove ( p ) ; b . getBackgroundEdgePixels ( ) . add ( p ) ; // check if new foreground pixels are exposed as edges
for ( int j = - 1 ; j < 2 ; ++ j ) { for ( int k = - 1 ; k < 2 ; ++ k ) { if ( p . x + j >= 0 && p . y + k > 0 && p . x + j < b . getWidth ( ) && p . y + k < b . getHeight ( ) && pixels [ p . x + j ] [ p . y + k ] == BinaryFast . FOREGROUND ) { Point p2 = new Point ( p . x + j , p . y + k ) ; b . getForegroundEdgePixels ( ) . add ( p2 ) ; } } } } return b ; |
public class SmartsheetImpl { /** * Sets the max retry time if the HttpClient is an instance of DefaultHttpClient
* @ param maxRetryTimeMillis max retry time */
public void setMaxRetryTimeMillis ( long maxRetryTimeMillis ) { } } | if ( this . httpClient instanceof DefaultHttpClient ) { ( ( DefaultHttpClient ) this . httpClient ) . setMaxRetryTimeMillis ( maxRetryTimeMillis ) ; } else throw new UnsupportedOperationException ( "Invalid operation for class " + this . httpClient . getClass ( ) ) ; |
public class HttpPredicate { /** * An alias for { @ link HttpPredicate # http } .
* Creates a { @ link Predicate } based on a URI template filtering .
* This will listen for DELETE Method .
* @ param uri The string to compile into a URI template and use for matching
* @ return The new { @ link Predicate } .
* @ see Predicate */
public static Predicate < HttpServerRequest > delete ( String uri ) { } } | return http ( uri , null , HttpMethod . DELETE ) ; |
public class AdventureFrame { public void handleRequestGive ( ) { } } | final JOptionPane pane = new JOptionPane ( "xxx msg" ) ; pane . setWantsInput ( true ) ; pane . setInputValue ( "" ) ; pane . setOptions ( new String [ ] { "Yes" , "No" } ) ; JInternalFrame internalFrame = pane . createInternalFrame ( contentPane , "xxx title" ) ; internalFrame . setVisible ( true ) ; pane . show ( ) ; internalFrame . addInternalFrameListener ( new InternalFrameListener ( ) { public void internalFrameOpened ( InternalFrameEvent e ) { } public void internalFrameIconified ( InternalFrameEvent e ) { } public void internalFrameDeiconified ( InternalFrameEvent e ) { } public void internalFrameDeactivated ( InternalFrameEvent e ) { } public void internalFrameClosing ( InternalFrameEvent e ) { } public void internalFrameClosed ( InternalFrameEvent e ) { System . out . println ( pane . getInputValue ( ) + ":" + pane . getValue ( ) ) ; } public void internalFrameActivated ( InternalFrameEvent e ) { } } ) ; |
public class FullscreenVideoView { /** * Initializes all objects FullscreenVideoView depends on
* It does not interfere with configuration properties
* because it is supposed to be called when this Object
* still exists */
protected void initObjects ( ) { } } | Log . d ( TAG , "initObjects" ) ; if ( this . mediaPlayer == null ) { this . mediaPlayer = new MediaPlayer ( ) ; this . mediaPlayer . setOnInfoListener ( this ) ; this . mediaPlayer . setOnErrorListener ( this ) ; this . mediaPlayer . setOnPreparedListener ( this ) ; this . mediaPlayer . setOnCompletionListener ( this ) ; this . mediaPlayer . setOnSeekCompleteListener ( this ) ; this . mediaPlayer . setOnBufferingUpdateListener ( this ) ; this . mediaPlayer . setOnVideoSizeChangedListener ( this ) ; this . mediaPlayer . setAudioStreamType ( AudioManager . STREAM_MUSIC ) ; } RelativeLayout . LayoutParams layoutParams ; View view ; if ( android . os . Build . VERSION . SDK_INT >= Build . VERSION_CODES . ICE_CREAM_SANDWICH ) { if ( this . textureView == null ) { this . textureView = new TextureView ( this . context ) ; this . textureView . setSurfaceTextureListener ( this ) ; } view = this . textureView ; } else { if ( this . surfaceView == null ) { this . surfaceView = new SurfaceView ( context ) ; } view = this . surfaceView ; if ( this . surfaceHolder == null ) { this . surfaceHolder = this . surfaceView . getHolder ( ) ; // noinspection deprecation
this . surfaceHolder . setType ( SurfaceHolder . SURFACE_TYPE_PUSH_BUFFERS ) ; this . surfaceHolder . addCallback ( this ) ; } } layoutParams = new RelativeLayout . LayoutParams ( LayoutParams . MATCH_PARENT , LayoutParams . MATCH_PARENT ) ; layoutParams . addRule ( CENTER_IN_PARENT ) ; view . setLayoutParams ( layoutParams ) ; addView ( view ) ; // Try not reset onProgressView
if ( this . onProgressView == null ) this . onProgressView = new ProgressBar ( context ) ; layoutParams = new RelativeLayout . LayoutParams ( LayoutParams . WRAP_CONTENT , LayoutParams . WRAP_CONTENT ) ; layoutParams . addRule ( CENTER_IN_PARENT ) ; this . onProgressView . setLayoutParams ( layoutParams ) ; addView ( this . onProgressView ) ; stopLoading ( ) ; this . currentState = State . IDLE ; |
public class Stream { /** * Returns a stream consisting of the results of applying the given function to the elements of this stream .
* @ param mapper function to apply to each element
* @ param < R > The element type of the new stream
* @ return the new stream */
public < R > Stream < R > map ( Function < ? super T , ? extends R > mapper ) { } } | List < R > list = new ArrayList < R > ( ) ; while ( iterator . hasNext ( ) ) { list . add ( mapper . apply ( iterator . next ( ) ) ) ; } return Stream . of ( list ) ; |
public class ConciseSet { /** * { @ inheritDoc } */
@ Override public boolean addAll ( IntSet c ) { } } | modCount ++ ; if ( c == null || c . isEmpty ( ) || this == c ) { return false ; } ConciseSet other = convert ( c ) ; if ( other . size == 1 ) { return add ( other . last ) ; } return replaceWith ( performOperation ( convert ( c ) , Operator . OR ) ) ; |
public class DefaultFileCopierUtil { /** * Copy a script file , script source stream , or script string into a temp file , and replace \
* embedded tokens with values from the dataContext for the latter two . Marks the file as
* executable and delete - on - exit . This will not rewrite any content if the input is originally a
* file .
* @ param context execution context
* @ param original local system file , or null
* @ param input input stream to write , or null
* @ param script file content string , or null
* @ param node destination node entry , to provide node data context
* @ return file where the script was stored , this file should later be cleaned up by calling
* { @ link com . dtolabs . rundeck . core . execution . script . ScriptfileUtils # releaseTempFile ( java . io . File ) }
* @ throws com . dtolabs . rundeck . core . execution . service . FileCopierException
* if an IO problem occurs */
@ Override public File writeScriptTempFile ( final ExecutionContext context , final File original , final InputStream input , final String script , final INodeEntry node , final boolean expandTokens ) throws FileCopierException { } } | return writeScriptTempFile ( context , original , input , script , node , null , expandTokens ) ; |
public class Criteria { /** * Creates new { @ link Predicate } for { @ code ! geodist }
* @ param location { @ link Point } in degrees
* @ param distance
* @ return */
public Criteria within ( Point location , @ Nullable Distance distance ) { } } | Assert . notNull ( location , "Location must not be null!" ) ; assertPositiveDistanceValue ( distance ) ; predicates . add ( new Predicate ( OperationKey . WITHIN , new Object [ ] { location , distance != null ? distance : new Distance ( 0 ) } ) ) ; return this ; |
public class IntegralImageOps { /** * Converts a regular image into an integral image .
* @ param input Regular image . Not modified .
* @ param transformed Integral image . If null a new image will be created . Modified .
* @ return Integral image . */
public static GrayF64 transform ( GrayF64 input , GrayF64 transformed ) { } } | transformed = InputSanityCheck . checkDeclare ( input , transformed ) ; ImplIntegralImageOps . transform ( input , transformed ) ; return transformed ; |
public class ZipUtils { /** * Add the content of a folder to the zip .
* If this folder also contains folder ( s ) , this function is called recursively .
* @ param folder
* @ param zipOutput
* @ param folderFromRoot relative path ( from archive root ) of this folder .
* @ return */
private static boolean addFolderContentToZip ( File folder , ZipArchiveOutputStream zipOutput , String folderFromRoot ) { } } | FileInputStream fileInput ; try { for ( File currFile : folder . listFiles ( ) ) { ZipArchiveEntry entry = null ; if ( currFile . isDirectory ( ) ) { // as defined by ZipArchiveEntry :
// Assumes the entry represents a directory if and only if the name ends with a forward slash " / " .
entry = new ZipArchiveEntry ( folderFromRoot + currFile . getName ( ) + "/" ) ; zipOutput . putArchiveEntry ( entry ) ; zipOutput . closeArchiveEntry ( ) ; // now look for the content of this directory
if ( ! addFolderContentToZip ( currFile , zipOutput , folderFromRoot + currFile . getName ( ) + "/" ) ) { return false ; } } else { entry = new ZipArchiveEntry ( folderFromRoot + currFile . getName ( ) ) ; entry . setSize ( currFile . length ( ) ) ; zipOutput . putArchiveEntry ( entry ) ; fileInput = new FileInputStream ( currFile ) ; IOUtils . copy ( fileInput , zipOutput ) ; fileInput . close ( ) ; zipOutput . closeArchiveEntry ( ) ; } } } catch ( FileNotFoundException fnfEx ) { fnfEx . printStackTrace ( ) ; return false ; } catch ( IOException ioEx ) { ioEx . printStackTrace ( ) ; return false ; } return true ; |
public class Output { /** * Use the specialized BYTEARRAY type . */
private void writePrimitiveByteArray ( byte [ ] bytes ) { } } | writeAMF3 ( ) ; this . buf . put ( AMF3 . TYPE_BYTEARRAY ) ; if ( hasReference ( bytes ) ) { putInteger ( getReferenceId ( bytes ) << 1 ) ; return ; } storeReference ( bytes ) ; int length = bytes . length ; putInteger ( length << 1 | 0x1 ) ; this . buf . put ( bytes ) ; |
public class FailoverWatcher { /** * Deal with connection event , exit current process if auth fails or session expires .
* @ param event the ZooKeeper event */
protected void processConnection ( WatchedEvent event ) { } } | switch ( event . getState ( ) ) { case SyncConnected : LOG . info ( hostPort . getHostPort ( ) + " sync connect from ZooKeeper" ) ; try { waitToInitZooKeeper ( 2000 ) ; // init zookeeper in another thread , wait for a while
} catch ( Exception e ) { LOG . fatal ( "Error to init ZooKeeper object after sleeping 2000 ms, exit immediately" ) ; System . exit ( 0 ) ; } break ; case Disconnected : // be triggered when kill the server or the leader of zk cluster
LOG . warn ( hostPort . getHostPort ( ) + " received disconnected from ZooKeeper" ) ; break ; case AuthFailed : LOG . fatal ( hostPort . getHostPort ( ) + " auth fail, exit immediately" ) ; System . exit ( 0 ) ; case Expired : LOG . fatal ( hostPort . getHostPort ( ) + " received expired from ZooKeeper, exit immediately" ) ; System . exit ( 0 ) ; break ; default : break ; } |
public class CalendarDateFormatFactory { /** * Returns DateFormat objects optimized for common iCalendar date patterns . The DateFormats are * not * thread safe .
* Attempts to get or set the Calendar or NumberFormat of an optimized DateFormat will result in an
* UnsupportedOperation exception being thrown .
* @ param pattern a SimpleDateFormat - compatible pattern
* @ return an optimized DateFormat instance if possible , otherwise a normal SimpleDateFormat instance */
public static java . text . DateFormat getInstance ( String pattern ) { } } | java . text . DateFormat instance ; // if ( true ) {
// return new SimpleDateFormat ( pattern ) ;
if ( pattern . equals ( DATETIME_PATTERN ) || pattern . equals ( DATETIME_UTC_PATTERN ) ) { instance = new DateTimeFormat ( pattern ) ; } else if ( pattern . equals ( DATE_PATTERN ) ) { instance = new DateFormat ( pattern ) ; } else if ( pattern . equals ( TIME_PATTERN ) || pattern . equals ( TIME_UTC_PATTERN ) ) { instance = new TimeFormat ( pattern ) ; } else { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "unexpected date format pattern: " + pattern ) ; } instance = new SimpleDateFormat ( pattern ) ; } return instance ; |
public class Logger { /** * This method logs a message at the SEVERE level .
* @ param mesg The message
* @ param t exception to log */
public void severe ( String mesg , Throwable t ) { } } | log ( Level . SEVERE , mesg , t ) ; |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcTextStyleFontModel ( ) { } } | if ( ifcTextStyleFontModelEClass == null ) { ifcTextStyleFontModelEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 604 ) ; } return ifcTextStyleFontModelEClass ; |
public class PreferenceFragment { /** * Initializes the preference , which allows to show a bottom sheet with custom content . */
private void initializeShowCustomBottomSheetPreference ( ) { } } | Preference showCustomBottomSheetPreference = findPreference ( getString ( R . string . show_custom_bottom_sheet_preference_key ) ) ; showCustomBottomSheetPreference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { @ Override public boolean onPreferenceClick ( final Preference preference ) { initializeCustomBottomSheet ( ) ; customBottomSheet . show ( ) ; return true ; } } ) ; |
public class SinkJoinerPlanNode { public void setCosts ( Costs nodeCosts ) { } } | // the plan enumeration logic works as for regular two - input - operators , which is important
// because of the branch handling logic . it does pick redistributing network channels
// between the sink and the sink joiner , because sinks joiner has a different DOP than the sink .
// we discard any cost and simply use the sum of the costs from the two children .
Costs totalCosts = getInput1 ( ) . getSource ( ) . getCumulativeCosts ( ) . clone ( ) ; totalCosts . addCosts ( getInput2 ( ) . getSource ( ) . getCumulativeCosts ( ) ) ; super . setCosts ( totalCosts ) ; |
public class SipServletRequestImpl { /** * ( non - Javadoc )
* @ see org . mobicents . servlet . sip . message . SipServletMessageImpl # send ( ) */
@ Override public void send ( ) throws IOException { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "send - method=" + this . getMethod ( ) ) ; } checkReadOnly ( ) ; // Cope with com . bea . sipservlet . tck . agents . api . javax _ servlet _ sip . SipServletMessageTest . testSend101
// make sure a message received cannot be sent out
checkMessageState ( ) ; final Request request = ( Request ) super . message ; final String requestMethod = getMethod ( ) ; final SipApplicationDispatcher sipApplicationDispatcher = sipFactoryImpl . getSipApplicationDispatcher ( ) ; final MobicentsSipSession session = getSipSession ( ) ; final DNSServerLocator dnsServerLocator = sipApplicationDispatcher . getDNSServerLocator ( ) ; Hop hop = null ; // RFC 3263 support
if ( dnsServerLocator != null ) { if ( Request . CANCEL . equals ( requestMethod ) ) { // RFC 3263 Section 4 : a CANCEL for a particular SIP request MUST be sent to the same SIP
// server that the SIP request was delivered to .
TransactionApplicationData inviteTxAppData = ( ( TransactionApplicationData ) inviteTransactionToCancel . getApplicationData ( ) ) ; if ( inviteTxAppData != null && inviteTxAppData . getHops ( ) != null ) { hop = inviteTxAppData . getHops ( ) . peek ( ) ; } } else { javax . sip . address . URI uriToResolve = request . getRequestURI ( ) ; RouteHeader routeHeader = ( RouteHeader ) request . getHeader ( RouteHeader . NAME ) ; if ( routeHeader != null ) { uriToResolve = routeHeader . getAddress ( ) . getURI ( ) ; } else { // RFC5626 - see if we are to find a flow for this request .
// Note : we should do this even if the " uriToResolve " is coming
// from a route header but since we currently have not implemented
// the correct things for a proxy scenario , only do it for UAS
// scenarios . At least this will minimize the potential for messing
// up right now . . .
uriToResolve = resolveSipOutbound ( uriToResolve ) ; } String uriToResolveTransport = ( ( javax . sip . address . SipURI ) uriToResolve ) . getTransportParam ( ) ; boolean transportParamModified = false ; if ( session . getProxy ( ) == null && session . getTransport ( ) != null && uriToResolve . isSipURI ( ) && uriToResolveTransport == null && // no need to modify the Request URI for UDP which is the default transport
! session . getTransport ( ) . equalsIgnoreCase ( ListeningPoint . UDP ) ) { try { ( ( javax . sip . address . SipURI ) uriToResolve ) . setTransportParam ( session . getTransport ( ) ) ; transportParamModified = true ; } catch ( ParseException e ) { // nothing to do here , will never happen
} } Queue < Hop > hops = dnsServerLocator . locateHops ( uriToResolve ) ; if ( transportParamModified ) { // Issue http : / / code . google . com / p / sipservlets / issues / detail ? id = 186
// Resetting the transport to what is was before the modification to avoid modifying the route set
if ( uriToResolveTransport == null ) { ( ( javax . sip . address . SipURI ) uriToResolve ) . removeParameter ( "transport" ) ; } else { try { ( ( javax . sip . address . SipURI ) uriToResolve ) . setTransportParam ( uriToResolveTransport ) ; } catch ( ParseException e ) { // nothing to do here , will never happen
} } } if ( hops != null && hops . size ( ) > 0 ) { // RFC 3263 support don ' t remove the current hop , it will be the one to reuse for CANCEL and ACK to non 2xx transactions
hop = hops . peek ( ) ; transactionApplicationData . setHops ( hops ) ; } } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "send - calling send(hop) - hop=" + hop ) ; } send ( hop ) ; |
public class StreamSourceProcessor { /** * Send instances .
* @ param inputStream the input stream
* @ param numberInstances the number instances
* @ param isTraining the is training */
public void sendInstances ( Stream inputStream , int numberInstances , boolean isTraining , boolean isTesting ) { } } | int numberSamples = 0 ; while ( streamSource . hasMoreInstances ( ) && numberSamples < numberInstances ) { numberSamples ++ ; numberInstancesSent ++ ; InstanceContentEvent instanceContentEvent = new InstanceContentEvent ( numberInstancesSent , nextInstance ( ) , isTraining , isTesting ) ; inputStream . put ( instanceContentEvent ) ; } InstanceContentEvent instanceContentEvent = new InstanceContentEvent ( numberInstancesSent , null , isTraining , isTesting ) ; instanceContentEvent . setLast ( true ) ; inputStream . put ( instanceContentEvent ) ; |
public class CylinderToEquirectangular_F32 { /** * Configures the rendered cylinder
* @ param width Cylinder width in pixels
* @ param height Cylinder height in pixels
* @ param vfov vertical FOV in radians */
public void configure ( int width , int height , float vfov ) { } } | declareVectors ( width , height ) ; float r = ( float ) Math . tan ( vfov / 2.0f ) ; for ( int pixelY = 0 ; pixelY < height ; pixelY ++ ) { float z = 2 * r * pixelY / ( height - 1 ) - r ; for ( int pixelX = 0 ; pixelX < width ; pixelX ++ ) { float theta = GrlConstants . F_PI2 * pixelX / width - GrlConstants . F_PI ; float x = ( float ) Math . cos ( theta ) ; float y = ( float ) Math . sin ( theta ) ; vectors [ pixelY * width + pixelX ] . set ( x , y , z ) ; } } |
public class WAjaxControl { /** * Get the target WComponents as an array .
* When the AJAX request is triggered only the target component ( s ) will be re - painted . If no targets have been
* registered then an empty array is returned .
* @ return an array of AJAX target components */
public WComponent [ ] getTargetsArray ( ) { } } | List < AjaxTarget > targets = getTargets ( ) ; return targets . toArray ( new WComponent [ targets . size ( ) ] ) ; |
public class UIInput { /** * < p > < span class = " changed _ modified _ 2_0 " > Perform < / span >
* the following algorithm to update the model data
* associated with this { @ link UIInput } , if any , as appropriate . < / p >
* < ul >
* < li > If the < code > valid < / code > property of this component is
* < code > false < / code > , take no further action . < / li >
* < li > If the < code > localValueSet < / code > property of this component is
* < code > false < / code > , take no further action . < / li >
* < li > If no { @ link ValueExpression } for < code > value < / code > exists ,
* take no further action . < / li >
* < li > Call < code > setValue ( ) < / code > method of the { @ link ValueExpression }
* to update the value that the { @ link ValueExpression } points at . < / li >
* < li > If the < code > setValue ( ) < / code > method returns successfully :
* < ul >
* < li > Clear the local value of this { @ link UIInput } . < / li >
* < li > Set the < code > localValueSet < / code > property of this
* { @ link UIInput } to false . < / li >
* < / ul > < / li >
* < li > If the < code > setValue ( ) < / code > method throws an Exception :
* < ul >
* < li class = " changed _ modified _ 2_0 " > Enqueue an error message . Create a
* { @ link FacesMessage } with the id { @ link # UPDATE _ MESSAGE _ ID } . Create a
* { @ link UpdateModelException } , passing the < code > FacesMessage < / code > and
* the caught exception to the constructor . Create an
* { @ link ExceptionQueuedEventContext } , passing the < code > FacesContext < / code > ,
* the < code > UpdateModelException < / code > , this component instance , and
* { @ link PhaseId # UPDATE _ MODEL _ VALUES } to its constructor . Call
* { @ link FacesContext # getExceptionHandler } and then call
* { @ link ExceptionHandler # processEvent } , passing the
* < code > ExceptionQueuedEventContext < / code > .
* < / li >
* < li > Set the < code > valid < / code > property of this { @ link UIInput }
* to < code > false < / code > . < / li >
* < / ul > < / li >
* The exception must not be re - thrown . This enables tree traversal
* to continue for this lifecycle phase , as in all the other lifecycle
* phases .
* < / ul >
* @ param context { @ link FacesContext } for the request we are processing
* @ throws NullPointerException if < code > context < / code >
* is < code > null < / code > */
public void updateModel ( FacesContext context ) { } } | if ( context == null ) { throw new NullPointerException ( ) ; } if ( ! isValid ( ) || ! isLocalValueSet ( ) ) { return ; } ValueExpression ve = getValueExpression ( "value" ) ; if ( ve != null ) { Throwable caught = null ; FacesMessage message = null ; try { ve . setValue ( context . getELContext ( ) , getLocalValue ( ) ) ; resetValue ( ) ; } catch ( ELException e ) { caught = e ; String messageStr = e . getMessage ( ) ; Throwable result = e . getCause ( ) ; while ( null != result && result . getClass ( ) . isAssignableFrom ( ELException . class ) ) { messageStr = result . getMessage ( ) ; result = result . getCause ( ) ; } if ( null == messageStr ) { message = MessageFactory . getMessage ( context , UPDATE_MESSAGE_ID , MessageFactory . getLabel ( context , this ) ) ; } else { message = new FacesMessage ( FacesMessage . SEVERITY_ERROR , messageStr , messageStr ) ; } setValid ( false ) ; } catch ( Exception e ) { caught = e ; message = MessageFactory . getMessage ( context , UPDATE_MESSAGE_ID , MessageFactory . getLabel ( context , this ) ) ; setValid ( false ) ; } if ( caught != null ) { assert ( message != null ) ; // PENDING ( edburns ) : verify this is in the spec .
@ SuppressWarnings ( { "ThrowableInstanceNeverThrown" } ) UpdateModelException toQueue = new UpdateModelException ( message , caught ) ; ExceptionQueuedEventContext eventContext = new ExceptionQueuedEventContext ( context , toQueue , this , PhaseId . UPDATE_MODEL_VALUES ) ; context . getApplication ( ) . publishEvent ( context , ExceptionQueuedEvent . class , eventContext ) ; } } |
public class AssociateRouteTableRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < AssociateRouteTableRequest > getDryRunRequest ( ) { } } | Request < AssociateRouteTableRequest > request = new AssociateRouteTableRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class Parser { /** * A { @ link Parser } that runs { @ code this } for 1 ore more times separated and optionally terminated by { @ code
* delim } . For example : { @ code " foo ; foo ; foo " } and { @ code " foo ; foo ; " } both matches { @ code foo . sepEndBy1 ( semicolon ) } .
* < p > The return values are collected in a { @ link List } . */
public final Parser < List < T > > sepEndBy1 ( final Parser < ? > delim ) { } } | return next ( first -> new DelimitedParser < T > ( this , delim , ListFactory . arrayListFactoryWithFirstElement ( first ) ) ) ; |
public class DistributedCache { public static void writeFileInfoToConfig ( String name , DistributedCacheEntry e , Configuration conf ) { } } | int num = conf . getInteger ( CACHE_FILE_NUM , 0 ) + 1 ; conf . setInteger ( CACHE_FILE_NUM , num ) ; conf . setString ( CACHE_FILE_NAME + num , name ) ; conf . setString ( CACHE_FILE_PATH + num , e . filePath ) ; conf . setBoolean ( CACHE_FILE_EXE + num , e . isExecutable || new File ( e . filePath ) . canExecute ( ) ) ; conf . setBoolean ( CACHE_FILE_DIR + num , e . isZipped || new File ( e . filePath ) . isDirectory ( ) ) ; if ( e . blobKey != null ) { conf . setBytes ( CACHE_FILE_BLOB_KEY + num , e . blobKey ) ; } |
public class HAProxy { /** * TODO cleanup this . . . */
public void generateConfig ( File configFile , ContainerRoot model ) throws IOException { } } | StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( OSHelper . read ( this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( "base.cfg" ) ) ) ; buffer . append ( "\n" ) ; HashMap < String , Backend > backends = new HashMap < String , Backend > ( ) ; for ( ContainerNode node : model . getNodes ( ) ) { for ( ComponentInstance instance : node . getComponents ( ) ) { if ( instance . getTypeDefinition ( ) . getDictionaryType ( ) != null && instance . getTypeDefinition ( ) . getDictionaryType ( ) . findAttributesByID ( "http_port" ) != null && instance . getStarted ( ) && ! instance . getName ( ) . equals ( context . getInstanceName ( ) ) ) { if ( ! backends . containsKey ( instance . getTypeDefinition ( ) . getName ( ) ) ) { Backend backend = new Backend ( ) ; backends . put ( instance . getTypeDefinition ( ) . getName ( ) , backend ) ; } Backend backend = backends . get ( instance . getTypeDefinition ( ) . getName ( ) ) ; backend . setName ( instance . getTypeDefinition ( ) . getName ( ) ) ; Server s = new Server ( ) ; s . setIp ( "127.0.0.1" ) ; s . setName ( instance . getName ( ) ) ; s . setPort ( instance . getDictionary ( ) . findValuesByID ( "http_port" ) . getValue ( ) ) ; backend . getServers ( ) . add ( s ) ; } } } if ( backends . size ( ) > 0 ) { buffer . append ( "default_backend " ) ; String firstKey = backends . keySet ( ) . iterator ( ) . next ( ) ; buffer . append ( backends . get ( firstKey ) . getName ( ) ) ; buffer . append ( "\n" ) ; } for ( String key : backends . keySet ( ) ) { buffer . append ( "\n" ) ; buffer . append ( backends . get ( key ) ) ; buffer . append ( "\n" ) ; } FileWriter writer = new FileWriter ( configFile ) ; writer . write ( buffer . toString ( ) ) ; writer . close ( ) ; |
public class JavaAgent { /** * Parse the Java Agent configuration . The arguments are typically specified to the JVM as a javaagent as
* { @ code - javaagent : / path / to / agent . jar = < CONFIG > } . This method parses the { @ code < CONFIG > } portion .
* @ param args provided agent args
* @ param ifc default bind interface
* @ return configuration to use for our application */
public static Config parseConfig ( String args , String ifc ) { } } | Pattern pattern = Pattern . compile ( "^(?:((?:[\\w.]+)|(?:\\[.+])):)?" + // host name , or ipv4 , or ipv6 address in brackets
"(\\d{1,5}):" + // port
"(.+)" ) ; // config file
Matcher matcher = pattern . matcher ( args ) ; if ( ! matcher . matches ( ) ) { throw new IllegalArgumentException ( "Malformed arguments - " + args ) ; } String givenHost = matcher . group ( 1 ) ; String givenPort = matcher . group ( 2 ) ; String givenConfigFile = matcher . group ( 3 ) ; int port = Integer . parseInt ( givenPort ) ; InetSocketAddress socket ; if ( givenHost != null && ! givenHost . isEmpty ( ) ) { socket = new InetSocketAddress ( givenHost , port ) ; } else { socket = new InetSocketAddress ( ifc , port ) ; givenHost = ifc ; } return new Config ( givenHost , port , givenConfigFile , socket ) ; |
public class FacebookRestClient { /** * Publish the notification of an action taken by a user to newsfeed .
* @ param title the title of the feed story ( up to 60 characters , excluding tags )
* @ param body ( optional ) the body of the feed story ( up to 200 characters , excluding tags )
* @ return whether the story was successfully published ; false in case of permission error
* @ see < a href = " http : / / wiki . developers . facebook . com / index . php / Feed . publishActionOfUser " >
* Developers Wiki : Feed . publishActionOfUser < / a > */
public boolean feed_publishActionOfUser ( CharSequence title , CharSequence body ) throws FacebookException , IOException { } } | return feed_publishActionOfUser ( title , body , null ) ; |
public class ComapiChatClient { /** * Removes listener for changes in profile details .
* @ param profileListener Listener for changes in in profile details . */
public void removeListener ( final ProfileListener profileListener ) { } } | com . comapi . ProfileListener foundationListener = profileListeners . get ( profileListener ) ; if ( foundationListener != null ) { client . removeListener ( foundationListener ) ; profileListeners . remove ( profileListener ) ; } |
public class PersistentExecutorImpl { /** * { @ inheritDoc } */
@ Override public < T > TaskStatus < T > submit ( Runnable runnable , T result ) { } } | TaskInfo taskInfo = new TaskInfo ( false ) ; taskInfo . initForOneShotTask ( 0l ) ; // run immediately
return newTask ( runnable , taskInfo , null , result ) ; |
public class DisconnectHandler { /** * ( non - Javadoc )
* @ see org . restcomm . ss7 . management . console . CommandHandler # handle ( org . mobicents . ss7 . management . console . CommandContext ,
* java . lang . String ) */
@ Override public void handle ( CommandContext ctx , String commandLine ) { } } | if ( commandLine . contains ( "--help" ) ) { this . printHelp ( commandLine , ctx ) ; return ; } String [ ] commands = commandLine . split ( " " ) ; if ( commands . length == 1 ) { ctx . sendMessage ( "disconnect" ) ; ctx . disconnectController ( ) ; } else if ( commands . length == 2 ) { if ( commandLine . contains ( "--help" ) ) { this . printHelp ( "help/disconnect.txt" , ctx ) ; return ; } } else { ctx . printLine ( "Invalid command." ) ; } |
public class ImageRetinaApiImpl { /** * { @ inheritDoc } */
@ Override public ByteArrayInputStream compare ( Integer scalar , ImagePlotShape shape , ImageEncoding imageEncoding , String jsonModel ) throws JsonProcessingException , ApiException { } } | LOG . debug ( "Retrieve image for expression: model: " + jsonModel + " scalar: " + scalar + " shape: " + name ( shape ) + " image encoding: " + name ( imageEncoding ) ) ; String shapeString = null ; if ( shape != null ) { shapeString = shape . name ( ) . toLowerCase ( ) ; } String encodingString = null ; if ( imageEncoding != null ) { encodingString = imageEncoding . machineRepresentation ( ) ; } return api . getOverlayImage ( jsonModel , retinaName , shapeString , scalar , encodingString ) ; |
public class LRUHashMap { /** * documentation inherited from interface */
public V get ( Object key ) { } } | V result = _delegate . get ( key ) ; if ( _tracking ) { if ( result == null ) { if ( _seenKeys . contains ( key ) ) { // only count a miss if we ' ve seen the key before
_misses ++ ; } } else { _hits ++ ; } } return result ; |
public class AuthenticationApi { /** * Perform form - based authentication . ( asynchronously )
* Perform form - based authentication by submitting an agent & # 39 ; s username and password .
* @ param username The agent & # 39 ; s username , formatted as & # 39 ; tenant \ \ username & # 39 ; . ( required )
* @ param password The agent & # 39 ; s password . ( required )
* @ param saml Specifies whether to login using [ Security Assertion Markup Language ] ( https : / / en . wikipedia . org / wiki / Security _ Assertion _ Markup _ Language ) ( SAML ) . ( optional )
* @ param callback The callback to be executed when the API call finishes
* @ return The request call
* @ throws ApiException If fail to process the API call , e . g . serializing the request body object */
public com . squareup . okhttp . Call signInAsync ( String username , String password , Boolean saml , final ApiCallback < Void > callback ) throws ApiException { } } | ProgressResponseBody . ProgressListener progressListener = null ; ProgressRequestBody . ProgressRequestListener progressRequestListener = null ; if ( callback != null ) { progressListener = new ProgressResponseBody . ProgressListener ( ) { @ Override public void update ( long bytesRead , long contentLength , boolean done ) { callback . onDownloadProgress ( bytesRead , contentLength , done ) ; } } ; progressRequestListener = new ProgressRequestBody . ProgressRequestListener ( ) { @ Override public void onRequestProgress ( long bytesWritten , long contentLength , boolean done ) { callback . onUploadProgress ( bytesWritten , contentLength , done ) ; } } ; } com . squareup . okhttp . Call call = signInValidateBeforeCall ( username , password , saml , progressListener , progressRequestListener ) ; apiClient . executeAsync ( call , callback ) ; return call ; |
public class PermissionAwareCrudService { /** * This method removes ( user ) permissions from the passed entity and persists ( ! )
* the permission collection !
* @ param entity The secured entity
* @ param user The user from which the permissions for the entity will be removed
* @ param permissions The permissions to remove */
public void removeAndSaveUserPermissions ( E entity , User user , Permission ... permissions ) { } } | if ( entity == null ) { LOG . error ( "Could not remove permissions: The passed entity is NULL." ) ; return ; } // create a set from the passed array
final HashSet < Permission > permissionsSet = new HashSet < Permission > ( Arrays . asList ( permissions ) ) ; if ( permissionsSet == null || permissionsSet . isEmpty ( ) ) { LOG . error ( "Could not remove permissions: No permissions have been passed." ) ; return ; } // get the existing permission
PermissionCollection userPermissionCollection = entity . getUserPermissions ( ) . get ( user ) ; if ( userPermissionCollection == null ) { LOG . error ( "Could not remove permissions as there is no attached permission collection." ) ; return ; } Set < Permission > userPermissions = userPermissionCollection . getPermissions ( ) ; int originalNrOfPermissions = userPermissions . size ( ) ; // remove the passed permissions from the the existing permission collection
userPermissions . removeAll ( permissionsSet ) ; int newNrOfPermissions = userPermissions . size ( ) ; if ( newNrOfPermissions == 0 ) { LOG . debug ( "The permission collection is empty and will thereby be deleted now." ) ; // remove
entity . getUserPermissions ( ) . remove ( user ) ; this . saveOrUpdate ( entity ) ; permissionCollectionService . delete ( userPermissionCollection ) ; return ; } // only persist if we have " really " removed something
if ( newNrOfPermissions < originalNrOfPermissions ) { LOG . debug ( "Removed the following permissions from an existing permission collection: " + permissionsSet ) ; // persist the permission collection
permissionCollectionService . saveOrUpdate ( userPermissionCollection ) ; LOG . debug ( "Persisted a permission collection" ) ; } |
public class DRL6StrictParser { /** * fromWindow : = WINDOW ID
* @ param pattern
* @ throws org . antlr . runtime . RecognitionException */
private void fromWindow ( PatternDescrBuilder < ? > pattern ) throws RecognitionException { } } | String window = "" ; match ( input , DRL6Lexer . ID , DroolsSoftKeywords . WINDOW , null , DroolsEditorType . KEYWORD ) ; if ( state . failed ) return ; Token id = match ( input , DRL6Lexer . ID , null , null , DroolsEditorType . IDENTIFIER ) ; if ( state . failed ) return ; window = id . getText ( ) ; if ( state . backtracking == 0 ) { pattern . from ( ) . window ( window ) ; if ( input . LA ( 1 ) != DRL6Lexer . EOF ) { helper . emit ( Location . LOCATION_LHS_BEGIN_OF_CONDITION ) ; } } |
public class NoteUpdateMarshaller { /** * Marshall the given parameter object . */
public void marshall ( NoteUpdate noteUpdate , ProtocolMarshaller protocolMarshaller ) { } } | if ( noteUpdate == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( noteUpdate . getText ( ) , TEXT_BINDING ) ; protocolMarshaller . marshall ( noteUpdate . getUpdatedBy ( ) , UPDATEDBY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class SMPPOutboundServerSession { /** * Bind immediately .
* @ param bindParam is the bind parameters .
* @ param timeout is the timeout .
* @ return the SMSC system id .
* @ throws IOException if there is an IO error found . */
public String bind ( BindParameter bindParam , long timeout ) throws IOException { } } | try { String smscSystemId = sendBind ( bindParam . getBindType ( ) , bindParam . getSystemId ( ) , bindParam . getPassword ( ) , bindParam . getSystemType ( ) , bindParam . getInterfaceVersion ( ) , bindParam . getAddrTon ( ) , bindParam . getAddrNpi ( ) , bindParam . getAddressRange ( ) , timeout ) ; sessionContext . bound ( bindParam . getBindType ( ) ) ; logger . info ( "Start EnquireLinkSender" ) ; enquireLinkSender = new EnquireLinkSender ( ) ; enquireLinkSender . start ( ) ; return smscSystemId ; } catch ( PDUException e ) { logger . error ( "Failed sending bind command" , e ) ; throw new IOException ( "Failed sending bind since some string parameter area invalid: " + e . getMessage ( ) , e ) ; } catch ( NegativeResponseException e ) { String message = "Receive negative bind response" ; logger . error ( message , e ) ; close ( ) ; throw new IOException ( message + ": " + e . getMessage ( ) , e ) ; } catch ( InvalidResponseException e ) { String message = "Receive invalid response of bind" ; logger . error ( message , e ) ; close ( ) ; throw new IOException ( message + ": " + e . getMessage ( ) , e ) ; } catch ( ResponseTimeoutException e ) { String message = "Waiting bind response take time too long" ; logger . error ( message , e ) ; close ( ) ; throw new IOException ( message + ": " + e . getMessage ( ) , e ) ; } catch ( IOException e ) { logger . error ( "IO error occurred" , e ) ; close ( ) ; throw e ; } |
public class MessageDigests { /** * Generates an MD5 hash hex string for the input string
* @ param input The input string
* @ return MD5 hash hex string */
public static String md5Hex ( final String input ) { } } | if ( input == null ) { throw new NullPointerException ( "String is null" ) ; } MessageDigest digest = null ; try { digest = MessageDigest . getInstance ( "MD5" ) ; } catch ( NoSuchAlgorithmException e ) { // this should never happen
throw new RuntimeException ( e ) ; } byte [ ] hash = digest . digest ( input . getBytes ( ) ) ; return DatatypeConverter . printHexBinary ( hash ) ; |
public class AbstractMappedClassFieldObserver { /** * Notification about custom field .
* @ param obj the object instance , must not be null
* @ param field the custom field , must not be null
* @ param annotation the annotation for the field , must not be null
* @ param customFieldProcessor processor for custom fields , must not be null
* @ param value the value of the custom field */
protected void onFieldCustom ( final Object obj , final Field field , final Bin annotation , final Object customFieldProcessor , final Object value ) { } } | |
public class QuartzScheduler { /** * Trigger the identified < code > { @ link org . quartz . jobs . Job } < / code > ( execute it now ) - with a
* non - volatile trigger . */
@ Override public void triggerJob ( String jobKey , JobDataMap data ) throws SchedulerException { } } | validateState ( ) ; OperableTrigger operableTrigger = simpleTriggerBuilder ( ) . withIdentity ( jobKey + "-trigger" ) . forJob ( jobKey ) . startAt ( new Date ( ) ) . build ( ) ; // OperableTrigger operableTrigger = TriggerBuilder . newTriggerBuilder ( ) . withIdentity ( jobKey +
// " - trigger " ) . forJob ( jobKey )
// . withTriggerImplementation ( SimpleScheduleBuilder . simpleScheduleBuilderBuilder ( ) . instantiate ( ) ) . startAt ( new Date ( ) ) . build ( ) ;
// TODO what does this accomplish ? ? ? Seems to sets it ' s next fire time internally
operableTrigger . computeFirstFireTime ( null ) ; if ( data != null ) { operableTrigger . setJobDataMap ( data ) ; } boolean collision = true ; while ( collision ) { try { quartzSchedulerResources . getJobStore ( ) . storeTrigger ( operableTrigger , false ) ; collision = false ; } catch ( ObjectAlreadyExistsException oaee ) { operableTrigger . setName ( newTriggerId ( ) ) ; } } notifySchedulerThread ( operableTrigger . getNextFireTime ( ) . getTime ( ) ) ; notifySchedulerListenersScheduled ( operableTrigger ) ; |
public class AbstractLabel { /** * remove a given index that was on this label
* @ param idx the index
* @ param preserveData should we keep the SQL data */
void removeIndex ( Index idx , boolean preserveData ) { } } | this . getSchema ( ) . getTopology ( ) . lock ( ) ; if ( ! uncommittedRemovedIndexes . contains ( idx . getName ( ) ) ) { uncommittedRemovedIndexes . add ( idx . getName ( ) ) ; TopologyManager . removeIndex ( this . sqlgGraph , idx ) ; if ( ! preserveData ) { idx . delete ( sqlgGraph ) ; } this . getSchema ( ) . getTopology ( ) . fire ( idx , "" , TopologyChangeAction . DELETE ) ; } |
public class Matchers { /** * Matches a compound assignment operator AST node which matches a given left - operand matcher , a
* given right - operand matcher , and is one of a set of compound assignment operators . Does not
* match compound assignment operators .
* @ param operators Which compound assignment operators to match against .
* @ param receiverMatcher The matcher to apply to the receiver .
* @ param expressionMatcher The matcher to apply to the expression . */
public static CompoundAssignment compoundAssignment ( Set < Kind > operators , Matcher < ExpressionTree > receiverMatcher , Matcher < ExpressionTree > expressionMatcher ) { } } | return new CompoundAssignment ( operators , receiverMatcher , expressionMatcher ) ; |
public class ApiOvhSupport { /** * Checks whether ticket can be scored
* REST : GET / support / tickets / { ticketId } / canBeScored
* @ param ticketId [ required ] internal ticket identifier */
public Boolean tickets_ticketId_canBeScored_GET ( Long ticketId ) throws IOException { } } | String qPath = "/support/tickets/{ticketId}/canBeScored" ; StringBuilder sb = path ( qPath , ticketId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , Boolean . class ) ; |
public class CommerceNotificationQueueEntryPersistenceImpl { /** * Removes all the commerce notification queue entries where groupId = & # 63 ; from the database .
* @ param groupId the group ID */
@ Override public void removeByGroupId ( long groupId ) { } } | for ( CommerceNotificationQueueEntry commerceNotificationQueueEntry : findByGroupId ( groupId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( commerceNotificationQueueEntry ) ; } |
public class JSONTokener { /** * 将标记回退到第一个字符 , 重新开始解析新的JSON */
public void back ( ) throws JSONException { } } | if ( this . usePrevious || this . index <= 0 ) { throw new JSONException ( "Stepping back two steps is not supported" ) ; } this . index -= 1 ; this . character -= 1 ; this . usePrevious = true ; this . eof = false ; |
public class LdapHelper { /** * Deletes a LDAP - Group .
* @ param node of the LDAP - Group to be deleted .
* @ return true if Group was deleted , otherwise false . */
@ Override public boolean rmGroup ( Node node ) { } } | LdapGroup group = ( LdapGroup ) node ; try { deletionCount ++ ; ctx . unbind ( getOuForNode ( group ) ) ; } catch ( NamingException ex ) { handleNamingException ( group , ex ) ; } Node ldapGroup = getGroup ( group . getCn ( ) ) ; return ldapGroup . isEmpty ( ) ; |
public class ManagedObject { /** * Get multiple properties by their paths
* @ param propPaths an array of strings for property path
* @ return a Hashtable holding with the property path as key , and the value .
* @ throws InvalidProperty
* @ throws RuntimeFault
* @ throws RemoteException */
public Hashtable getPropertiesByPaths ( String [ ] propPaths ) throws InvalidProperty , RuntimeFault , RemoteException { } } | Hashtable [ ] pht = PropertyCollectorUtil . retrieveProperties ( new ManagedObject [ ] { this } , getMOR ( ) . getType ( ) , propPaths ) ; if ( pht . length != 0 ) { return pht [ 0 ] ; } else { return null ; } |
public class RedmineJSONBuilder { /** * Writes a " create project " request .
* @ param writer
* project writer .
* @ param project
* project to create .
* @ throws IllegalArgumentException
* if some project fields are not configured .
* @ throws JSONException
* if IO error occurs . */
public static void writeProject ( JSONWriter writer , Project project ) throws IllegalArgumentException , JSONException { } } | /* Validate project */
if ( project . getName ( ) == null ) throw new IllegalArgumentException ( "Project name must be set to create a new project" ) ; if ( project . getIdentifier ( ) == null ) throw new IllegalArgumentException ( "Project identifier must be set to create a new project" ) ; writeProject ( project , writer ) ; |
public class StringValueArrayComparator { /** * Read the next character from the serialized { @ code StringValue } .
* @ param source the input view containing the record
* @ return the next { @ code char } of the current serialized { @ code StringValue }
* @ throws IOException if the input view raised an exception when reading the length */
private static char readStringChar ( DataInputView source ) throws IOException { } } | int c = source . readByte ( ) & 0xFF ; if ( c >= HIGH_BIT ) { int shift = 7 ; int curr ; c = c & 0x7F ; while ( ( curr = source . readByte ( ) & 0xFF ) >= HIGH_BIT ) { c |= ( curr & 0x7F ) << shift ; shift += 7 ; } c |= curr << shift ; } return ( char ) c ; |
public class UserInfoBaseScreen { /** * Add all the screen listeners . */
public void addListeners ( ) { } } | super . addListeners ( ) ; this . addMainKeyBehavior ( ) ; this . getMainRecord ( ) . getField ( UserInfo . USER_GROUP_ID ) . addListener ( new InitFieldHandler ( this . getRecord ( UserControl . USER_CONTROL_FILE ) . getField ( UserControl . ANON_USER_GROUP_ID ) ) ) ; ( ( UserInfo ) this . getMainRecord ( ) ) . addPropertyListeners ( ) ; |
public class MtasSolrCollectionCache { /** * Gets the automaton by id .
* @ param id the id
* @ return the automaton by id
* @ throws IOException Signals that an I / O exception has occurred . */
public Automaton getAutomatonById ( String id ) throws IOException { } } | if ( idToVersion . containsKey ( id ) ) { List < BytesRef > bytesArray = new ArrayList < > ( ) ; Set < String > data = get ( id ) ; if ( data != null ) { Term term ; for ( String item : data ) { term = new Term ( "dummy" , item ) ; bytesArray . add ( term . bytes ( ) ) ; } Collections . sort ( bytesArray ) ; return Automata . makeStringUnion ( bytesArray ) ; } } return null ; |
public class MiniCluster { /** * Shuts down the mini cluster , failing all currently executing jobs .
* The mini cluster can be started again by calling the { @ link # start ( ) } method again .
* < p > This method shuts down all started services and components ,
* even if an exception occurs in the process of shutting down some component .
* @ return Future which is completed once the MiniCluster has been completely shut down */
@ Override public CompletableFuture < Void > closeAsync ( ) { } } | synchronized ( lock ) { if ( running ) { LOG . info ( "Shutting down Flink Mini Cluster" ) ; try { final long shutdownTimeoutMillis = miniClusterConfiguration . getConfiguration ( ) . getLong ( ClusterOptions . CLUSTER_SERVICES_SHUTDOWN_TIMEOUT ) ; final int numComponents = 2 + miniClusterConfiguration . getNumTaskManagers ( ) ; final Collection < CompletableFuture < Void > > componentTerminationFutures = new ArrayList < > ( numComponents ) ; componentTerminationFutures . addAll ( terminateTaskExecutors ( ) ) ; componentTerminationFutures . add ( shutDownResourceManagerComponents ( ) ) ; final FutureUtils . ConjunctFuture < Void > componentsTerminationFuture = FutureUtils . completeAll ( componentTerminationFutures ) ; final CompletableFuture < Void > metricSystemTerminationFuture = FutureUtils . composeAfterwards ( componentsTerminationFuture , this :: closeMetricSystem ) ; // shut down the RpcServices
final CompletableFuture < Void > rpcServicesTerminationFuture = metricSystemTerminationFuture . thenCompose ( ( Void ignored ) -> terminateRpcServices ( ) ) ; final CompletableFuture < Void > remainingServicesTerminationFuture = FutureUtils . runAfterwards ( rpcServicesTerminationFuture , this :: terminateMiniClusterServices ) ; final CompletableFuture < Void > executorsTerminationFuture = FutureUtils . runAfterwards ( remainingServicesTerminationFuture , ( ) -> terminateExecutors ( shutdownTimeoutMillis ) ) ; executorsTerminationFuture . whenComplete ( ( Void ignored , Throwable throwable ) -> { if ( throwable != null ) { terminationFuture . completeExceptionally ( ExceptionUtils . stripCompletionException ( throwable ) ) ; } else { terminationFuture . complete ( null ) ; } } ) ; } finally { running = false ; } } return terminationFuture ; } |
public class ExpressRouteCrossConnectionsInner { /** * Update the specified ExpressRouteCrossConnection .
* @ param resourceGroupName The name of the resource group .
* @ param crossConnectionName The name of the ExpressRouteCrossConnection .
* @ param parameters Parameters supplied to the update express route crossConnection operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < ExpressRouteCrossConnectionInner > createOrUpdateAsync ( String resourceGroupName , String crossConnectionName , ExpressRouteCrossConnectionInner parameters ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , crossConnectionName , parameters ) . map ( new Func1 < ServiceResponse < ExpressRouteCrossConnectionInner > , ExpressRouteCrossConnectionInner > ( ) { @ Override public ExpressRouteCrossConnectionInner call ( ServiceResponse < ExpressRouteCrossConnectionInner > response ) { return response . body ( ) ; } } ) ; |
public class WsFrameDecoder { /** * Validates opcode w . r . t FIN bit */
private void validateOpcodeUsingFin ( Opcode opcode , boolean fin ) throws ProtocolDecoderException { } } | switch ( opcode ) { case CONTINUATION : if ( prevDataFin ) { throw new ProtocolDecoderException ( "Not expecting CONTINUATION frame" ) ; } break ; case TEXT : case BINARY : if ( ! prevDataFin ) { throw new ProtocolDecoderException ( "Expecting CONTINUATION frame, but got " + opcode + " frame" ) ; } break ; case PING : case PONG : case CLOSE : if ( ! fin ) { throw new ProtocolDecoderException ( "Expected FIN for " + opcode + " frame" ) ; } break ; default : break ; } |
public class FpUtils { /** * Returns unbiased exponent of a { @ code double } ; for
* subnormal values , the number is treated as if it were
* normalized . That is for all finite , non - zero , positive numbers
* < i > x < / i > , < code > scalb ( < i > x < / i > , - ilogb ( < i > x < / i > ) ) < / code > is
* always in the range [ 1 , 2 ) .
* Special cases :
* < ul >
* < li > If the argument is NaN , then the result is 2 < sup > 30 < / sup > .
* < li > If the argument is infinite , then the result is 2 < sup > 28 < / sup > .
* < li > If the argument is zero , then the result is - ( 2 < sup > 28 < / sup > ) .
* < / ul >
* @ param d floating - point number whose exponent is to be extracted
* @ return unbiased exponent of the argument .
* @ author Joseph D . Darcy */
public static int ilogb ( double d ) { } } | int exponent = getExponent ( d ) ; switch ( exponent ) { case DoubleConsts . MAX_EXPONENT + 1 : // NaN or infinity
if ( isNaN ( d ) ) return ( 1 << 30 ) ; // 2 ^ 30
else // infinite value
return ( 1 << 28 ) ; // 2 ^ 28
case DoubleConsts . MIN_EXPONENT - 1 : // zero or subnormal
if ( d == 0.0 ) { return - ( 1 << 28 ) ; // - ( 2 ^ 28)
} else { long transducer = Double . doubleToRawLongBits ( d ) ; /* * To avoid causing slow arithmetic on subnormals ,
* the scaling to determine when d ' s significand
* is normalized is done in integer arithmetic .
* ( there must be at least one " 1 " bit in the
* significand since zero has been screened out . */
// isolate significand bits
transducer &= DoubleConsts . SIGNIF_BIT_MASK ; assert ( transducer != 0L ) ; // This loop is simple and functional . We might be
// able to do something more clever that was faster ;
// e . g . number of leading zero detection on
// ( transducer < < ( # exponent and sign bits ) .
while ( transducer < ( 1L << ( DoubleConsts . SIGNIFICAND_WIDTH - 1 ) ) ) { transducer *= 2 ; exponent -- ; } exponent ++ ; assert ( exponent >= DoubleConsts . MIN_EXPONENT - ( DoubleConsts . SIGNIFICAND_WIDTH - 1 ) && exponent < DoubleConsts . MIN_EXPONENT ) ; return exponent ; } default : assert ( exponent >= DoubleConsts . MIN_EXPONENT && exponent <= DoubleConsts . MAX_EXPONENT ) ; return exponent ; } |
public class SimpleNamespaceResolver { /** * { @ inheritDoc } */
public String getPrefix ( final String namespaceURI ) { } } | if ( namespaceURI == null ) { // Be compliant with the JAXB contract for NamespaceResolver .
throw new IllegalArgumentException ( "Cannot acquire prefix for null namespaceURI." ) ; } return uri2Prefix . get ( namespaceURI ) ; |
public class Step { /** * Save value in memory .
* @ param field
* is name of the field to retrieve .
* @ param targetKey
* is the key to save value to
* @ param page
* is target page .
* @ throws TechnicalException
* is thrown if you have a technical error ( format , configuration , datas , . . . ) in NoraUi .
* Exception with { @ value com . github . noraui . utils . Messages # FAIL _ MESSAGE _ UNABLE _ TO _ FIND _ ELEMENT } message ( with screenshot , with exception ) or with
* { @ value com . github . noraui . utils . Messages # FAIL _ MESSAGE _ UNABLE _ TO _ RETRIEVE _ VALUE } message
* ( with screenshot , with exception )
* @ throws FailureException
* if the scenario encounters a functional error */
protected void saveElementValue ( String field , String targetKey , Page page ) throws TechnicalException , FailureException { } } | logger . debug ( "saveValueInStep: {} to {} in {}." , field , targetKey , page . getApplication ( ) ) ; String txt = "" ; try { final WebElement elem = Utilities . findElement ( page , field ) ; txt = elem . getAttribute ( VALUE ) != null ? elem . getAttribute ( VALUE ) : elem . getText ( ) ; } catch ( final Exception e ) { new Result . Failure < > ( e . getMessage ( ) , Messages . getMessage ( Messages . FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT ) , true , page . getCallBack ( ) ) ; } try { Context . saveValue ( targetKey , txt ) ; Context . getCurrentScenario ( ) . write ( "SAVE " + targetKey + "=" + txt ) ; } catch ( final Exception e ) { new Result . Failure < > ( e . getMessage ( ) , Messages . format ( Messages . getMessage ( Messages . FAIL_MESSAGE_UNABLE_TO_RETRIEVE_VALUE ) , page . getPageElementByKey ( field ) , page . getApplication ( ) ) , true , page . getCallBack ( ) ) ; } |
public class OpenTSDBMain { /** * Reloads the logback configuration to an external file
* @ param fileName The logback configuration file */
protected static void setLogbackExternal ( final String fileName ) { } } | try { final ObjectName logbackObjectName = new ObjectName ( "ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator" ) ; ManagementFactory . getPlatformMBeanServer ( ) . invoke ( logbackObjectName , "reloadByFileName" , new Object [ ] { fileName } , new String [ ] { String . class . getName ( ) } ) ; log . info ( "Set external logback config to [{}]" , fileName ) ; } catch ( Exception ex ) { log . warn ( "Failed to set external logback config to [{}]" , fileName , ex ) ; } |
public class DefaultAuthenticationTransaction { /** * Sanitize credentials set . It ' s important to keep the order of
* the credentials in the final set as they were presented .
* @ param credentials the credentials
* @ return the set */
private static Set < Credential > sanitizeCredentials ( final Credential [ ] credentials ) { } } | if ( credentials != null && credentials . length > 0 ) { return Arrays . stream ( credentials ) . filter ( Objects :: nonNull ) . collect ( Collectors . toCollection ( LinkedHashSet :: new ) ) ; } return new HashSet < > ( 0 ) ; |
public class NotificationManager { /** * Cleanup specified clientID */
public void cleanUp ( RESTRequest request , int clientID ) { } } | ClientNotificationArea inbox = inboxes . get ( clientID ) ; // If somehow the inbox timed out before we came here , then just exit , because the end result is the same .
if ( inbox != null ) { inbox . cleanUp ( request ) ; inboxes . remove ( clientID ) ; } |
public class JaxRsFactoryImplicitBeanCDICustomizer { /** * ( non - Javadoc )
* @ see com . ibm . ws . jaxrs20 . api . JaxRsFactoryBeanCustomizer # isCustomizableBean ( java . lang . Class , java . lang . Object ) */
@ Override public boolean isCustomizableBean ( Class < ? > clazz , Object context ) { } } | if ( context == null ) { return false ; } @ SuppressWarnings ( "unchecked" ) Map < Class < ? > , ManagedObject < ? > > newContext = ( Map < Class < ? > , ManagedObject < ? > > ) ( context ) ; if ( newContext . isEmpty ( ) ) { return false ; } if ( newContext . containsKey ( clazz ) ) { return true ; } return false ; |
public class Graphics { /** * Draw a section of an image at a particular location and scale on the
* screen
* @ param image
* The image to draw a section of
* @ param x
* The x position to draw the image
* @ param y
* The y position to draw the image
* @ param srcx
* The x position of the rectangle to draw from this image ( i . e .
* relative to the image )
* @ param srcy
* The y position of the rectangle to draw from this image ( i . e .
* relative to the image )
* @ param srcx2
* The x position of the bottom right cornder of rectangle to
* draw from this image ( i . e . relative to the image )
* @ param srcy2
* The t position of the bottom right cornder of rectangle to
* draw from this image ( i . e . relative to the image )
* @ param col
* The color to apply to the image as a filter */
public void drawImage ( Image image , float x , float y , float srcx , float srcy , float srcx2 , float srcy2 , Color col ) { } } | drawImage ( image , x , y , x + image . getWidth ( ) , y + image . getHeight ( ) , srcx , srcy , srcx2 , srcy2 , col ) ; |
public class IRFactory { /** * Set the length on the node if we ' re in IDE mode . */
void setLength ( Node node , SourcePosition start , SourcePosition end ) { } } | node . setLength ( end . offset - start . offset ) ; |
public class ContainerDefinition { /** * A list of namespaced kernel parameters to set in the container . This parameter maps to < code > Sysctls < / code > in
* the < a href = " https : / / docs . docker . com / engine / api / v1.35 / # operation / ContainerCreate " > Create a container < / a > section
* of the < a href = " https : / / docs . docker . com / engine / api / v1.35 / " > Docker Remote API < / a > and the < code > - - sysctl < / code >
* option to < a href = " https : / / docs . docker . com / engine / reference / run / " > docker run < / a > .
* < note >
* It is not recommended that you specify network - related < code > systemControls < / code > parameters for multiple
* containers in a single task that also uses either the < code > awsvpc < / code > or < code > host < / code > network modes . For
* tasks that use the < code > awsvpc < / code > network mode , the container that is started last determines which
* < code > systemControls < / code > parameters take effect . For tasks that use the < code > host < / code > network mode , it
* changes the container instance ' s namespaced kernel parameters as well as the containers .
* < / note >
* @ param systemControls
* A list of namespaced kernel parameters to set in the container . This parameter maps to
* < code > Sysctls < / code > in the < a
* href = " https : / / docs . docker . com / engine / api / v1.35 / # operation / ContainerCreate " > Create a container < / a > section
* of the < a href = " https : / / docs . docker . com / engine / api / v1.35 / " > Docker Remote API < / a > and the
* < code > - - sysctl < / code > option to < a href = " https : / / docs . docker . com / engine / reference / run / " > docker
* run < / a > . < / p > < note >
* It is not recommended that you specify network - related < code > systemControls < / code > parameters for multiple
* containers in a single task that also uses either the < code > awsvpc < / code > or < code > host < / code > network
* modes . For tasks that use the < code > awsvpc < / code > network mode , the container that is started last
* determines which < code > systemControls < / code > parameters take effect . For tasks that use the
* < code > host < / code > network mode , it changes the container instance ' s namespaced kernel parameters as well
* as the containers . */
public void setSystemControls ( java . util . Collection < SystemControl > systemControls ) { } } | if ( systemControls == null ) { this . systemControls = null ; return ; } this . systemControls = new com . amazonaws . internal . SdkInternalList < SystemControl > ( systemControls ) ; |
public class CodedInput { /** * Reads a varint from the input one byte at a time from a { @ link DataInput } , so that it does not read any bytes
* after the end of the varint . */
static int readRawVarint32 ( final DataInput input , final byte firstByte ) throws IOException { } } | int result = firstByte & 0x7f ; int offset = 7 ; for ( ; offset < 32 ; offset += 7 ) { final byte b = input . readByte ( ) ; result |= ( b & 0x7f ) << offset ; if ( ( b & 0x80 ) == 0 ) { return result ; } } // Keep reading up to 64 bits .
for ( ; offset < 64 ; offset += 7 ) { final byte b = input . readByte ( ) ; if ( ( b & 0x80 ) == 0 ) { return result ; } } throw ProtobufException . malformedVarint ( ) ; |
public class CompositeRequestParser { /** * / * ( non - Javadoc )
* @ see org . archive . wayback . RequestParser # parse ( javax . servlet . http . HttpServletRequest ) */
public WaybackRequest parse ( HttpServletRequest httpRequest , AccessPoint wbContext ) throws BadQueryException , BetterRequestException { } } | WaybackRequest wbRequest = null ; for ( int i = 0 ; i < parsers . length ; i ++ ) { wbRequest = parsers [ i ] . parse ( httpRequest , wbContext ) ; if ( wbRequest != null ) { break ; } } return wbRequest ; |
public class PurgeJmsQueuesAction { /** * Create queue session .
* @ param connection
* @ return
* @ throws JMSException */
protected Session createSession ( Connection connection ) throws JMSException { } } | if ( connection instanceof QueueConnection ) { return ( ( QueueConnection ) connection ) . createQueueSession ( false , Session . AUTO_ACKNOWLEDGE ) ; } return connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; |
public class ReportService { /** * Gets a unique filename ( that has not been used before in the output folder ) for this report and sets it on the report model . */
public void setUniqueFilename ( ReportModel model , String baseFilename , String extension ) { } } | model . setReportFilename ( this . getUniqueFilename ( baseFilename , extension , true , null ) ) ; |
public class JunitNotifier { /** * ( non - Javadoc )
* @ see com . technophobia . substeps . runner . AbstractBaseNotifier #
* handleNotifyNodeFinished
* ( com . technophobia . substeps . execution . ExecutionNode ) */
public void onNodeFinished ( final IExecutionNode node ) { } } | final Description description = descriptionMap . get ( Long . valueOf ( node . getId ( ) ) ) ; notifyTestFinished ( description ) ; |
public class CommerceWishListItemPersistenceImpl { /** * Returns the commerce wish list items before and after the current commerce wish list item in the ordered set where CProductId = & # 63 ; .
* @ param commerceWishListItemId the primary key of the current commerce wish list item
* @ param CProductId the c product ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next commerce wish list item
* @ throws NoSuchWishListItemException if a commerce wish list item with the primary key could not be found */
@ Override public CommerceWishListItem [ ] findByCProductId_PrevAndNext ( long commerceWishListItemId , long CProductId , OrderByComparator < CommerceWishListItem > orderByComparator ) throws NoSuchWishListItemException { } } | CommerceWishListItem commerceWishListItem = findByPrimaryKey ( commerceWishListItemId ) ; Session session = null ; try { session = openSession ( ) ; CommerceWishListItem [ ] array = new CommerceWishListItemImpl [ 3 ] ; array [ 0 ] = getByCProductId_PrevAndNext ( session , commerceWishListItem , CProductId , orderByComparator , true ) ; array [ 1 ] = commerceWishListItem ; array [ 2 ] = getByCProductId_PrevAndNext ( session , commerceWishListItem , CProductId , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; } |
public class ProcessEngineConfigurationImpl { /** * batch / / / / / */
protected void initBatchHandlers ( ) { } } | if ( batchHandlers == null ) { batchHandlers = new HashMap < String , BatchJobHandler < ? > > ( ) ; MigrationBatchJobHandler migrationHandler = new MigrationBatchJobHandler ( ) ; batchHandlers . put ( migrationHandler . getType ( ) , migrationHandler ) ; ModificationBatchJobHandler modificationHandler = new ModificationBatchJobHandler ( ) ; batchHandlers . put ( modificationHandler . getType ( ) , modificationHandler ) ; DeleteProcessInstancesJobHandler deleteProcessJobHandler = new DeleteProcessInstancesJobHandler ( ) ; batchHandlers . put ( deleteProcessJobHandler . getType ( ) , deleteProcessJobHandler ) ; DeleteHistoricProcessInstancesJobHandler deleteHistoricProcessInstancesJobHandler = new DeleteHistoricProcessInstancesJobHandler ( ) ; batchHandlers . put ( deleteHistoricProcessInstancesJobHandler . getType ( ) , deleteHistoricProcessInstancesJobHandler ) ; SetJobRetriesJobHandler setJobRetriesJobHandler = new SetJobRetriesJobHandler ( ) ; batchHandlers . put ( setJobRetriesJobHandler . getType ( ) , setJobRetriesJobHandler ) ; SetExternalTaskRetriesJobHandler setExternalTaskRetriesJobHandler = new SetExternalTaskRetriesJobHandler ( ) ; batchHandlers . put ( setExternalTaskRetriesJobHandler . getType ( ) , setExternalTaskRetriesJobHandler ) ; RestartProcessInstancesJobHandler restartProcessInstancesJobHandler = new RestartProcessInstancesJobHandler ( ) ; batchHandlers . put ( restartProcessInstancesJobHandler . getType ( ) , restartProcessInstancesJobHandler ) ; UpdateProcessInstancesSuspendStateJobHandler suspendProcessInstancesJobHandler = new UpdateProcessInstancesSuspendStateJobHandler ( ) ; batchHandlers . put ( suspendProcessInstancesJobHandler . getType ( ) , suspendProcessInstancesJobHandler ) ; DeleteHistoricDecisionInstancesJobHandler deleteHistoricDecisionInstancesJobHandler = new DeleteHistoricDecisionInstancesJobHandler ( ) ; batchHandlers . put ( deleteHistoricDecisionInstancesJobHandler . getType ( ) , deleteHistoricDecisionInstancesJobHandler ) ; ProcessSetRemovalTimeJobHandler processSetRemovalTimeJobHandler = new ProcessSetRemovalTimeJobHandler ( ) ; batchHandlers . put ( processSetRemovalTimeJobHandler . getType ( ) , processSetRemovalTimeJobHandler ) ; } if ( customBatchJobHandlers != null ) { for ( BatchJobHandler < ? > customBatchJobHandler : customBatchJobHandlers ) { batchHandlers . put ( customBatchJobHandler . getType ( ) , customBatchJobHandler ) ; } } |
public class Roster { /** * Removes a roster entry from the roster . The roster entry will also be removed from the
* unfiled entries or from any roster group where it could belong and will no longer be part
* of the roster . Note that this is a synchronous call - - Smack must wait for the server
* to send an updated subscription status .
* @ param entry a roster entry .
* @ throws XMPPErrorException if an XMPP error occurs .
* @ throws NotLoggedInException if not logged in .
* @ throws NoResponseException SmackException if there was no response from the server .
* @ throws NotConnectedException
* @ throws InterruptedException */
public void removeEntry ( RosterEntry entry ) throws NotLoggedInException , NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } } | final XMPPConnection connection = getAuthenticatedConnectionOrThrow ( ) ; // Only remove the entry if it ' s in the entry list .
// The actual removal logic takes place in RosterPacketListenerProcess > > Packet ( Packet )
if ( ! entries . containsKey ( entry . getJid ( ) ) ) { return ; } RosterPacket packet = new RosterPacket ( ) ; packet . setType ( IQ . Type . set ) ; RosterPacket . Item item = RosterEntry . toRosterItem ( entry ) ; // Set the item type as REMOVE so that the server will delete the entry
item . setItemType ( RosterPacket . ItemType . remove ) ; packet . addRosterItem ( item ) ; connection . createStanzaCollectorAndSend ( packet ) . nextResultOrThrow ( ) ; |
public class FunctionType { /** * Gets the { @ code prototype } property of this function type . This is equivalent to { @ code
* ( ObjectType ) getPropertyType ( " prototype " ) } . */
public final ObjectType getPrototype ( ) { } } | // lazy initialization of the prototype field
if ( prototypeSlot == null ) { String refName = getReferenceName ( ) ; if ( refName == null ) { // Someone is trying to access the prototype of a structural function .
// We don ' t want to give real properties to this prototype , because
// then it would propagate to all structural functions .
setPrototypeNoCheck ( registry . getNativeObjectType ( JSTypeNative . UNKNOWN_TYPE ) , null ) ; } else { setPrototype ( new PrototypeObjectType ( registry , getReferenceName ( ) + ".prototype" , registry . getNativeObjectType ( OBJECT_TYPE ) , isNativeObjectType ( ) , null ) , null ) ; } } return ( ObjectType ) prototypeSlot . getType ( ) ; |
public class CassandraSchemaManager { /** * Sets the properties .
* @ param ksDef
* the ks def
* @ param strategy _ options
* the strategy _ options */
private void setProperties ( KsDef ksDef , Map < String , String > strategy_options ) { } } | Schema schema = CassandraPropertyReader . csmd . getSchema ( databaseName ) ; if ( schema != null && schema . getName ( ) != null && schema . getName ( ) . equalsIgnoreCase ( databaseName ) && schema . getSchemaProperties ( ) != null ) { setKeyspaceProperties ( ksDef , schema . getSchemaProperties ( ) , strategy_options , schema . getDataCenters ( ) ) ; } else { setDefaultReplicationFactor ( strategy_options ) ; } |
public class BDecoder { /** * 解析重点 */
private static Object decodeInputStream ( InputStream bais , int nesting ) throws IOException { } } | if ( ! bais . markSupported ( ) ) { throw new IOException ( "InputStream must support the mark() method" ) ; } // set a mark
bais . mark ( Integer . MAX_VALUE ) ; // read a byte
int tempByte = bais . read ( ) ; // decide what to do
switch ( tempByte ) { case 'd' : // create a new dictionary object
Map < String , Object > tempMap = new HashMap < String , Object > ( ) ; // get the key
byte [ ] tempByteArray = null ; while ( ( tempByteArray = ( byte [ ] ) BDecoder . decodeInputStream ( bais , nesting + 1 ) ) != null ) { // decode some more
Object value = BDecoder . decodeInputStream ( bais , nesting + 1 ) ; // add the value to the map
tempMap . put ( new String ( tempByteArray , Constants . BYTE_ENCODING ) , value ) ; } if ( bais . available ( ) < nesting ) { throw ( new IOException ( "BDecoder: invalid input data, 'e' missing from end of dictionary" ) ) ; } // return the map
return tempMap ; case 'l' : // create the list
List < Object > tempList = new ArrayList < Object > ( ) ; // create the key
Object tempElement = null ; while ( ( tempElement = BDecoder . decodeInputStream ( bais , nesting + 1 ) ) != null ) { // add the element
tempList . add ( tempElement ) ; } if ( bais . available ( ) < nesting ) { throw ( new IOException ( "BDecoder: invalid input data, 'e' missing from end of list" ) ) ; } // return the list
return tempList ; case 'e' : case - 1 : return null ; case 'i' : return new Long ( BDecoder . getNumberFromStream ( bais , 'e' ) ) ; case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : // move back one
bais . reset ( ) ; // get the string
return BDecoder . getByteArrayFromStream ( bais ) ; default : throw new IOException ( "UNKNOWN COMMAND" ) ; } |
public class BitSetBloomFilter { /** * 将字符串的字节表示进行多哈希编码 .
* @ param str 待添加进过滤器的字符串字节表示 .
* @ param hashNumber 要经过的哈希个数 .
* @ return 各个哈希的结果数组 . */
public static int [ ] createHashes ( String str , int hashNumber ) { } } | int [ ] result = new int [ hashNumber ] ; for ( int i = 0 ; i < hashNumber ; i ++ ) { result [ i ] = hash ( str , i ) ; } return result ; |
public class SpringCamelContextFactory { /** * Create a { @ link SpringCamelContext } list from the given bytes */
public static List < SpringCamelContext > createCamelContextList ( byte [ ] bytes , ClassLoader classsLoader ) throws Exception { } } | SpringCamelContextBootstrap bootstrap = new SpringCamelContextBootstrap ( bytes , classsLoader ) ; return bootstrap . createSpringCamelContexts ( ) ; |
public class TaggedLogger { /** * Checks if a given tag and severity level is covered by the logging provider ' s minimum level .
* @ param tag
* Tag to check
* @ param level
* Severity level to check
* @ return { @ code true } if given severity level is covered , otherwise { @ code false } */
private static boolean isCoveredByMinimumLevel ( final String tag , final Level level ) { } } | return provider . getMinimumLevel ( tag ) . ordinal ( ) <= level . ordinal ( ) ; |
public class PyExpressionGenerator { /** * Generate the given object .
* @ param literal the literal .
* @ param it the target for the generated content .
* @ param context the context .
* @ return the literal . */
@ SuppressWarnings ( "static-method" ) protected XExpression _generate ( XNumberLiteral literal , IAppendable it , IExtraLanguageGeneratorContext context ) { } } | appendReturnIfExpectedReturnedExpression ( it , context ) ; it . append ( literal . getValue ( ) ) ; return literal ; |
public class BasicWorkUnitStream { /** * Apply a filtering function to this stream . */
public WorkUnitStream filter ( Predicate < WorkUnit > predicate ) { } } | if ( this . materializedWorkUnits == null ) { return new BasicWorkUnitStream ( this , Iterators . filter ( this . workUnits , predicate ) , null ) ; } else { return new BasicWorkUnitStream ( this , null , Lists . newArrayList ( Iterables . filter ( this . materializedWorkUnits , predicate ) ) ) ; } |
public class WebsocketUtil { /** * The binary version of createTextHandler */
static public MessageHandler . Whole < byte [ ] > createBinaryHandler ( final MessageHandler . Whole proxy ) { } } | return new MessageHandler . Whole < byte [ ] > ( ) { public void onMessage ( byte [ ] msg ) { proxy . onMessage ( msg ) ; } } ; |
public class MinioClient { /** * Lists object information as { @ code Iterable < Result > < Item > } in given bucket , prefix and recursive flag .
* < / p > < b > Example : < / b > < br >
* < pre > { @ code Iterable < Result < Item > > myObjects = minioClient . listObjects ( " my - bucketname " ) ;
* for ( Result < Item > result : myObjects ) {
* Item item = result . get ( ) ;
* System . out . println ( item . lastModified ( ) + " , " + item . size ( ) + " , " + item . objectName ( ) ) ;
* } } < / pre >
* @ param bucketName Bucket name .
* @ param prefix Prefix string . List objects whose name starts with ` prefix ` .
* @ param recursive when false , emulates a directory structure where each listing returned is either a full object
* or part of the object ' s key up to the first ' / ' . All objects wit the same prefix up to the first
* ' / ' will be merged into one entry .
* @ return an iterator of Result Items .
* @ see # listObjects ( String bucketName )
* @ see # listObjects ( String bucketName , String prefix )
* @ see # listObjects ( String bucketName , String prefix , boolean recursive , boolean useVersion1) */
public Iterable < Result < Item > > listObjects ( final String bucketName , final String prefix , final boolean recursive ) { } } | return listObjects ( bucketName , prefix , recursive , false ) ; |
public class MorphShape { /** * Check if the shape ' s points are all equal
* @ param a The first shape to compare
* @ param b The second shape to compare
* @ return True if the shapes are equal */
private boolean equalShapes ( Shape a , Shape b ) { } } | a . checkPoints ( ) ; b . checkPoints ( ) ; for ( int i = 0 ; i < a . points . length ; i ++ ) { if ( a . points [ i ] != b . points [ i ] ) { return false ; } } return true ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.