signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class CmsCoreProvider { /** * Returns the absolute link to the given root path . < p >
* @ param rootPath the root path
* @ param callback the callback to execute */
public void substituteLinkForRootPath ( final String rootPath , final I_CmsSimpleCallback < String > callback ) { } }
|
CmsRpcAction < String > action = new CmsRpcAction < String > ( ) { @ Override public void execute ( ) { getVfsService ( ) . substituteLinkForRootPath ( getSiteRoot ( ) , rootPath , this ) ; } @ Override protected void onResponse ( String result ) { callback . execute ( result ) ; } } ; action . execute ( ) ;
|
public class DWR3BeanGenerator { /** * Get all interfaces in one script
* @ param context
* The GeneratorContext
* @ return All interfaces scripts as a single string
* @ throws IOException */
private String getAllPublishedInterfaces ( final GeneratorContext context ) throws IOException { } }
|
StringBuilder sb = new StringBuilder ( ) ; Container container = getContainer ( context ) ; // The creatormanager holds the list of beans
CreatorManager ctManager = ( CreatorManager ) container . getBean ( CreatorManager . class . getName ( ) ) ; if ( null != ctManager ) { Collection < String > creators ; if ( ctManager instanceof DefaultCreatorManager ) { DefaultCreatorManager creatorManager = ( DefaultCreatorManager ) ctManager ; boolean currentDebugValue = creatorManager . isDebug ( ) ; creatorManager . setDebug ( true ) ; // DWR will throw a
// SecurityException if not in
// debug mode . . .
creators = ctManager . getCreatorNames ( false ) ; creatorManager . setDebug ( currentDebugValue ) ; } else { log . warn ( "Getting creator names from an unknown CreatorManager. This may fail ..." ) ; creators = ctManager . getCreatorNames ( false ) ; } List < String > creatorList = new ArrayList < > ( creators ) ; Collections . sort ( creatorList ) ; for ( String name : creatorList ) { if ( log . isDebugEnabled ( ) ) log . debug ( "_** mapping: generating found interface named: " + name ) ; InterfaceHandler handler = ( InterfaceHandler ) ContainerUtil . getHandlerForUrlProperty ( container , INTERFACE_HANDLER_URL ) ; sb . append ( handler . generateInterfaceScript ( context . getServletContext ( ) . getContextPath ( ) , context . getConfig ( ) . getDwrMapping ( ) , name ) ) ; } } return sb . toString ( ) ;
|
public class CacheHeader { /** * Compares the " If - Modified - Since header " of the incoming request with the last modification date of an aggregated
* resource . If the resource was not modified since the client retrieved the resource , a 304 - redirect is send to the
* response ( and the method returns true ) . If the resource has changed ( or the client didn ' t ) supply the
* " If - Modified - Since " header a " Last - Modified " header is set so future requests can be cached .
* Expires header is automatically set on author instance , and not set on publish instance .
* @ param dateProvider abstraction layer that calculates the last - modification time of an aggregated resource
* @ param request Request
* @ param response Response
* @ return true if the method send a 304 redirect , so that the caller shouldn ' t write any output to the response
* stream
* @ throws IOException I / O exception */
public static boolean isNotModified ( @ NotNull ModificationDateProvider dateProvider , @ NotNull SlingHttpServletRequest request , @ NotNull SlingHttpServletResponse response ) throws IOException { } }
|
boolean isAuthor = WCMMode . fromRequest ( request ) != WCMMode . DISABLED ; return isNotModified ( dateProvider , request , response , isAuthor ) ;
|
public class TreeGraphNode { /** * Return a set of node - node dependencies , represented as Dependency
* objects , for the Tree .
* @ param hf The HeadFinder to use to identify the head of constituents .
* If this is < code > null < / code > , then nodes are assumed to already
* be marked with their heads .
* @ return Set of dependencies ( each a < code > Dependency < / code > ) */
public Set < Dependency < Label , Label , Object > > dependencies ( Filter < Dependency < Label , Label , Object > > f , HeadFinder hf ) { } }
|
Set < Dependency < Label , Label , Object > > deps = Generics . newHashSet ( ) ; for ( Tree t : this ) { TreeGraphNode node = safeCast ( t ) ; if ( node == null || node . isLeaf ( ) || node . children ( ) . length < 2 ) { continue ; } TreeGraphNode headWordNode ; if ( hf != null ) { headWordNode = safeCast ( node . headTerminal ( hf ) ) ; } else { headWordNode = node . headWordNode ( ) ; } for ( Tree k : node . children ( ) ) { TreeGraphNode kid = safeCast ( k ) ; if ( kid == null ) { continue ; } TreeGraphNode kidHeadWordNode ; if ( hf != null ) { kidHeadWordNode = safeCast ( kid . headTerminal ( hf ) ) ; } else { kidHeadWordNode = kid . headWordNode ( ) ; } if ( headWordNode != null && headWordNode != kidHeadWordNode && kidHeadWordNode != null ) { int headWordNodeIndex = headWordNode . index ( ) ; int kidHeadWordNodeIndex = kidHeadWordNode . index ( ) ; // If the two indices are equal , then the leaves haven ' t been indexed . Just return an ordinary
// UnnamedDependency . This mirrors the implementation of super . dependencies ( ) .
Dependency < Label , Label , Object > d = ( headWordNodeIndex == kidHeadWordNodeIndex ) ? new UnnamedDependency ( headWordNode , kidHeadWordNode ) : new UnnamedConcreteDependency ( headWordNode , headWordNodeIndex , kidHeadWordNode , kidHeadWordNodeIndex ) ; if ( f . accept ( d ) ) { deps . add ( d ) ; } } } } return deps ;
|
public class DefaultExchangeRate { /** * Internal method to set the rate chain , which also ensure that the chain
* passed , when not null , contains valid elements .
* @ param chain the chain to set . */
private void setExchangeRateChain ( List < ExchangeRate > chain ) { } }
|
this . chain . clear ( ) ; if ( chain == null || chain . isEmpty ( ) ) { this . chain . add ( this ) ; } else { for ( ExchangeRate rate : chain ) { if ( rate == null ) { throw new IllegalArgumentException ( "Rate Chain element can not be null." ) ; } } this . chain . addAll ( chain ) ; }
|
public class NavigationDrawerFragment { /** * Users of this fragment must call this method to set up the navigation drawer interactions .
* @ param fragmentId The android : id of this fragment in its activity ' s layout .
* @ param drawerLayout The DrawerLayout containing this fragment ' s UI . */
public void setUp ( int fragmentId , DrawerLayout drawerLayout ) { } }
|
mFragmentContainerView = getActivity ( ) . findViewById ( fragmentId ) ; mDrawerLayout = drawerLayout ; mActionBarToolbar = ( Toolbar ) getActivity ( ) . findViewById ( R . id . toolbar ) ; // set a custom shadow that overlays the main content when the drawer opens
mDrawerLayout . setDrawerShadow ( R . drawable . drawer_shadow , GravityCompat . START ) ; // set up the drawer ' s list view with items and click listener
// ActionBarDrawerToggle ties together the the proper interactions
// between the navigation drawer and the action bar app icon .
mDrawerToggle = new JToggle ( getActivity ( ) , /* host Activity */
mDrawerLayout , /* DrawerLayout object */
mActionBarToolbar , /* nav drawer image to replace ' Up ' caret */
R . string . navigation_drawer_open , /* " open drawer " description for accessibility */
R . string . navigation_drawer_close /* " close drawer " description for accessibility */
) { @ Override public void onDrawerClosed ( View drawerView ) { super . onDrawerClosed ( drawerView ) ; if ( ! isAdded ( ) ) { return ; } getActivity ( ) . supportInvalidateOptionsMenu ( ) ; // calls onPrepareOptionsMenu ( )
} @ Override public void onDrawerOpened ( View drawerView ) { super . onDrawerOpened ( drawerView ) ; if ( ! isAdded ( ) ) { return ; } if ( ! mUserLearnedDrawer ) { // The user manually opened the drawer ; store this flag to prevent auto - showing
// the navigation drawer automatically in the future .
mUserLearnedDrawer = true ; SharedPreferences sp = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; sp . edit ( ) . putBoolean ( PREF_USER_LEARNED_DRAWER , true ) . apply ( ) ; } getActivity ( ) . supportInvalidateOptionsMenu ( ) ; // calls onPrepareOptionsMenu ( )
} } ; // If the user hasn ' t ' learned ' about the drawer , open it to introduce them to the drawer ,
// per the navigation drawer design guidelines .
if ( ! mUserLearnedDrawer && ! mFromSavedInstanceState ) { mDrawerLayout . openDrawer ( mFragmentContainerView ) ; } // Defer code dependent on restoration of previous instance state .
mDrawerLayout . post ( new Runnable ( ) { @ Override public void run ( ) { mDrawerToggle . syncState ( ) ; } } ) ; mDrawerLayout . setDrawerListener ( mDrawerToggle ) ;
|
public class DwgEllipse { /** * Read a Ellipse in the DWG format Version 15
* @ param data Array of unsigned bytes obtained from the DWG binary file
* @ param offset The current bit offset where the value begins
* @ throws Exception If an unexpected bit value is found in the DWG file . Occurs
* when we are looking for LwPolylines . */
public void readDwgEllipseV15 ( int [ ] data , int offset ) throws Exception { } }
|
int bitPos = offset ; bitPos = readObjectHeaderV15 ( data , bitPos ) ; Vector v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; double x = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; double y = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; double z = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; double [ ] coord = new double [ ] { x , y , z } ; center = coord ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; x = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; y = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; z = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; coord = new double [ ] { x , y , z } ; majorAxisVector = coord ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; x = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; y = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; z = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; coord = new double [ ] { x , y , z } ; extrusion = coord ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; double val = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; axisRatio = val ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; val = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; initAngle = val ; v = DwgUtil . getBitDouble ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; val = ( ( Double ) v . get ( 1 ) ) . doubleValue ( ) ; endAngle = val ; bitPos = readObjectTailV15 ( data , bitPos ) ;
|
public class NotifySettings { /** * Set type of Notify ( CSS style class name ) . Default is INFO .
* @ param type one of INFO , WARNING , DANGER , SUCCESS
* @ see NotifyType */
public final void setType ( final NotifyType type ) { } }
|
setType ( ( type != null ) ? type . getCssName ( ) : NotifyType . INFO . getCssName ( ) ) ;
|
public class StartServersHandler { /** * { @ inheritDoc } */
@ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { } }
|
if ( ! context . isBooting ( ) ) { throw new OperationFailedException ( HostControllerLogger . ROOT_LOGGER . invocationNotAllowedAfterBoot ( operation . require ( OP ) ) ) ; } if ( context . getRunningMode ( ) == RunningMode . ADMIN_ONLY ) { throw new OperationFailedException ( HostControllerLogger . ROOT_LOGGER . cannotStartServersInvalidMode ( context . getRunningMode ( ) ) ) ; } final ModelNode domainModel = Resource . Tools . readModel ( context . readResourceFromRoot ( PathAddress . EMPTY_ADDRESS , true ) ) ; context . addStep ( new OperationStepHandler ( ) { @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { // start servers
final Resource resource = context . readResource ( PathAddress . EMPTY_ADDRESS ) ; final ModelNode hostModel = Resource . Tools . readModel ( resource ) ; if ( hostModel . hasDefined ( SERVER_CONFIG ) ) { final ModelNode servers = hostModel . get ( SERVER_CONFIG ) . clone ( ) ; if ( hostControllerEnvironment . isRestart ( ) || runningModeControl . getRestartMode ( ) == RestartMode . HC_ONLY ) { restartedHcStartOrReconnectServers ( servers , domainModel , context ) ; runningModeControl . setRestartMode ( RestartMode . SERVERS ) ; } else { cleanStartServers ( servers , domainModel , context ) ; } } context . completeStep ( OperationContext . RollbackHandler . NOOP_ROLLBACK_HANDLER ) ; } } , OperationContext . Stage . RUNTIME ) ;
|
public class JMMap { /** * Put get new v .
* @ param < V > the type parameter
* @ param < K > the type parameter
* @ param map the map
* @ param key the key
* @ param newValue the new value
* @ return the v */
public static < V , K > V putGetNew ( Map < K , V > map , K key , V newValue ) { } }
|
synchronized ( map ) { map . put ( key , newValue ) ; return newValue ; }
|
public class AskServlet { /** * Processes requests for both HTTP < code > GET < / code > and < code > POST < / code >
* methods .
* @ param request servlet request
* @ param response servlet response
* @ throws ServletException if a servlet - specific error occurs
* @ throws IOException if an I / O error occurs */
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { } }
|
response . setContentType ( "application/json;charset=UTF-8" ) ; response . setCharacterEncoding ( "UTF-8" ) ; request . setCharacterEncoding ( "UTF-8" ) ; String questionStr = request . getParameter ( "q" ) ; String n = request . getParameter ( "n" ) ; int topN = - 1 ; if ( n != null && StringUtils . isNumeric ( n ) ) { topN = Integer . parseInt ( n ) ; } Question question = null ; List < CandidateAnswer > candidateAnswers = null ; if ( questionStr != null && questionStr . trim ( ) . length ( ) > 3 ) { question = SharedQuestionAnsweringSystem . getInstance ( ) . answerQuestion ( questionStr ) ; if ( question != null ) { candidateAnswers = question . getAllCandidateAnswer ( ) ; } } LOG . info ( "问题:" + questionStr ) ; try ( PrintWriter out = response . getWriter ( ) ) { String json = JsonGenerator . generate ( candidateAnswers , topN ) ; out . println ( json ) ; LOG . info ( "答案:" + json ) ; }
|
public class InjectInjectionObjectFactory { /** * / * support method . . . Purely for debug purposes */
@ Trivial private static final void debugInjectionObjects ( Object [ ] injectionObjects ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { if ( injectionObjects . length == 0 ) { Tr . debug ( tc , " []" ) ; return ; } StringBuilder buffer = new StringBuilder ( injectionObjects . length * 16 ) ; buffer . append ( '[' ) ; for ( int i = 0 ; i < injectionObjects . length ; i ++ ) { if ( injectionObjects [ i ] != injectionObjects ) { buffer . append ( Util . identity ( injectionObjects [ i ] ) ) ; } else { buffer . append ( "(this Collection)" ) ; } if ( i < injectionObjects . length - 1 ) { buffer . append ( ',' ) ; } } buffer . append ( ']' ) ; Tr . debug ( tc , "SUCCESS " + buffer . toString ( ) ) ; }
|
public class VoiceApi { /** * Cancel call forwarding
* Cancel call forwarding for the current agent .
* @ param cancelForwardBody Request parameters . ( optional )
* @ return ApiResponse & lt ; ApiSuccessResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < ApiSuccessResponse > cancelForwardWithHttpInfo ( CancelForwardBody cancelForwardBody ) throws ApiException { } }
|
com . squareup . okhttp . Call call = cancelForwardValidateBeforeCall ( cancelForwardBody , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
|
public class FullDTDReader { /** * Method that handles rest of external entity declaration , after
* it ' s been figured out entity is not internal ( does not continue
* with a quote ) .
* @ param inputSource Input source for the start of the declaration .
* Needed for resolving relative system references , if any .
* @ param isParam True if this a parameter entity declaration ; false
* if general entity declaration
* @ param evtLoc Location where entity declaration directive started ;
* needed when construction event Objects for declarations . */
private EntityDecl handleExternalEntityDecl ( WstxInputSource inputSource , boolean isParam , String id , char c , Location evtLoc ) throws XMLStreamException { } }
|
boolean isPublic = checkPublicSystemKeyword ( c ) ; String pubId = null ; // Ok , now we can parse the reference ; first public id if needed :
if ( isPublic ) { c = skipObligatoryDtdWs ( ) ; if ( c != '"' && c != '\'' ) { throwDTDUnexpectedChar ( c , "; expected a quote to start the public identifier" ) ; } pubId = parsePublicId ( c , getErrorMsg ( ) ) ; /* 30 - Sep - 2005 , TSa : SGML has public ids that miss the system
* id . Although not legal with XML DTDs , let ' s give bit more
* meaningful error in those cases . . . */
c = getNextExpanded ( ) ; if ( c <= CHAR_SPACE ) { // good
c = skipDtdWs ( true ) ; } else { // not good . . .
// Let ' s just push it back and generate normal error then :
if ( c != '>' ) { // this is handled below though
-- mInputPtr ; c = skipObligatoryDtdWs ( ) ; } } /* But here let ' s deal with one case that we are familiar with :
* SGML does NOT require system id after public one . . . */
if ( c == '>' ) { _reportWFCViolation ( "Unexpected end of ENTITY declaration (expected a system id after public id): trying to use an SGML DTD instead of XML one?" ) ; } } else { // Just need some white space here
c = skipObligatoryDtdWs ( ) ; } if ( c != '"' && c != '\'' ) { throwDTDUnexpectedChar ( c , "; expected a quote to start the system identifier" ) ; } String sysId = parseSystemId ( c , mNormalizeLFs , getErrorMsg ( ) ) ; // Ok ; how about notation ?
String notationId = null ; /* Ok ; PEs are simpler , as they always are parsed ( see production
* # 72 in xml 1.0 specs ) */
if ( isParam ) { c = skipDtdWs ( true ) ; } else { /* GEs can be unparsed , too , so it ' s bit more complicated ;
* if we get ' > ' , don ' t need space ; otherwise need separating
* space ( or PE boundary ) . Thus , need bit more code . */
int i = peekNext ( ) ; if ( i == '>' ) { // good
c = '>' ; ++ mInputPtr ; } else if ( i < 0 ) { // local EOF , ok
c = skipDtdWs ( true ) ; } else if ( i == '%' ) { c = getNextExpanded ( ) ; } else { ++ mInputPtr ; c = ( char ) i ; if ( ! isSpaceChar ( c ) ) { throwDTDUnexpectedChar ( c , "; expected a separating space or closing '>'" ) ; } c = skipDtdWs ( true ) ; } if ( c != '>' ) { if ( ! isNameStartChar ( c ) ) { throwDTDUnexpectedChar ( c , "; expected either NDATA keyword, or closing '>'" ) ; } String keyw = checkDTDKeyword ( "DATA" ) ; if ( keyw != null ) { _reportWFCViolation ( "Unrecognized keyword '" + keyw + "'; expected NOTATION (or closing '>')" ) ; } c = skipObligatoryDtdWs ( ) ; notationId = readNotationEntry ( c , null , evtLoc ) ; c = skipDtdWs ( true ) ; } } // Ok , better have ' > ' now :
if ( c != '>' ) { throwDTDUnexpectedChar ( c , "; expected closing '>'" ) ; } URL ctxt ; try { ctxt = inputSource . getSource ( ) ; } catch ( IOException e ) { throw new WstxIOException ( e ) ; } if ( notationId == null ) { // parsed entity :
return new ParsedExtEntity ( evtLoc , id , ctxt , pubId , sysId ) ; } return new UnparsedExtEntity ( evtLoc , id , ctxt , pubId , sysId , notationId ) ;
|
public class RoaringArray { /** * Create a ContainerPointer for this RoaringArray
* @ param startIndex starting index in the container list
* @ return a ContainerPointer */
public ContainerPointer getContainerPointer ( final int startIndex ) { } }
|
return new ContainerPointer ( ) { int k = startIndex ; @ Override public void advance ( ) { ++ k ; } @ Override public ContainerPointer clone ( ) { try { return ( ContainerPointer ) super . clone ( ) ; } catch ( CloneNotSupportedException e ) { return null ; // will not happen
} } @ Override public int compareTo ( ContainerPointer o ) { if ( key ( ) != o . key ( ) ) { return Util . toIntUnsigned ( key ( ) ) - Util . toIntUnsigned ( o . key ( ) ) ; } return o . getCardinality ( ) - getCardinality ( ) ; } @ Override public int getCardinality ( ) { return getContainer ( ) . getCardinality ( ) ; } @ Override public Container getContainer ( ) { if ( k >= RoaringArray . this . size ) { return null ; } return RoaringArray . this . values [ k ] ; } @ Override public boolean isBitmapContainer ( ) { return getContainer ( ) instanceof BitmapContainer ; } @ Override public boolean isRunContainer ( ) { return getContainer ( ) instanceof RunContainer ; } @ Override public short key ( ) { return RoaringArray . this . keys [ k ] ; } } ;
|
public class ConnectorServiceImpl { /** * Declarative Services method for unsetting the AuthDataService reference .
* @ param ref reference to the service */
protected void unsetAuthDataService ( ServiceReference < AuthDataService > ref ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "unsetAuthDataService" , ref ) ; authDataServiceRef . unsetReference ( ref ) ;
|
public class HtmlOutputLink { /** * < p > Set the value of the < code > fragment < / code > property . < / p > */
public void setFragment ( java . lang . String fragment ) { } }
|
getStateHelper ( ) . put ( PropertyKeys . fragment , fragment ) ;
|
public class Beta { /** * Continued fraction expansion # 1 for incomplete beta integral .
* @ param a Value .
* @ param b Value .
* @ param x Value .
* @ return Result . */
public static double Incbcf ( double a , double b , double x ) { } }
|
double xk , pk , pkm1 , pkm2 , qk , qkm1 , qkm2 ; double k1 , k2 , k3 , k4 , k5 , k6 , k7 , k8 ; double r , t , ans , thresh ; int n ; double big = 4.503599627370496e15 ; double biginv = 2.22044604925031308085e-16 ; k1 = a ; k2 = a + b ; k3 = a ; k4 = a + 1.0 ; k5 = 1.0 ; k6 = b - 1.0 ; k7 = k4 ; k8 = a + 2.0 ; pkm2 = 0.0 ; qkm2 = 1.0 ; pkm1 = 1.0 ; qkm1 = 1.0 ; ans = 1.0 ; r = 1.0 ; n = 0 ; thresh = 3.0 * Constants . DoubleEpsilon ; do { xk = - ( x * k1 * k2 ) / ( k3 * k4 ) ; pk = pkm1 + pkm2 * xk ; qk = qkm1 + qkm2 * xk ; pkm2 = pkm1 ; pkm1 = pk ; qkm2 = qkm1 ; qkm1 = qk ; xk = ( x * k5 * k6 ) / ( k7 * k8 ) ; pk = pkm1 + pkm2 * xk ; qk = qkm1 + qkm2 * xk ; pkm2 = pkm1 ; pkm1 = pk ; qkm2 = qkm1 ; qkm1 = qk ; if ( qk != 0 ) r = pk / qk ; if ( r != 0 ) { t = Math . abs ( ( ans - r ) / r ) ; ans = r ; } else t = 1.0 ; if ( t < thresh ) return ans ; k1 += 1.0 ; k2 += 1.0 ; k3 += 2.0 ; k4 += 2.0 ; k5 += 1.0 ; k6 -= 1.0 ; k7 += 2.0 ; k8 += 2.0 ; if ( ( Math . abs ( qk ) + Math . abs ( pk ) ) > big ) { pkm2 *= biginv ; pkm1 *= biginv ; qkm2 *= biginv ; qkm1 *= biginv ; } if ( ( Math . abs ( qk ) < biginv ) || ( Math . abs ( pk ) < biginv ) ) { pkm2 *= big ; pkm1 *= big ; qkm2 *= big ; qkm1 *= big ; } } while ( ++ n < 300 ) ; return ans ;
|
public class MapView { /** * sets the value of the mapType property in the OL map . */
private void setMapTypeInMap ( ) { } }
|
if ( getInitialized ( ) ) { final String mapTypeName = getMapType ( ) . toString ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "setting map type in OpenLayers map: {}" , mapTypeName ) ; } bingMapsApiKey . ifPresent ( apiKey -> jsMapView . call ( "setBingMapsApiKey" , apiKey ) ) ; wmsParam . ifPresent ( wmsParam -> { jsMapView . call ( "newWMSParams" ) ; jsMapView . call ( "setWMSParamsUrl" , wmsParam . getUrl ( ) ) ; wmsParam . getParams ( ) . forEach ( ( key , value ) -> jsMapView . call ( "addWMSParamsParams" , key , value ) ) ; } ) ; xyzParam . ifPresent ( xyzParam -> { jsMapView . call ( "setXYZParams" , xyzParam . toJSON ( ) ) ; } ) ; jsMapView . call ( "setMapType" , mapTypeName ) ; }
|
public class PDTWebDateHelper { /** * Parses a Date out of a String with a date in RFC822 format . < br >
* It parsers the following formats :
* < ul >
* < li > " EEE , dd MMM uuuu HH : mm : ss z " < / li >
* < li > " EEE , dd MMM uuuu HH : mm z " < / li >
* < li > " EEE , dd MMM uu HH : mm : ss z " < / li >
* < li > " EEE , dd MMM uu HH : mm z " < / li >
* < li > " dd MMM uuuu HH : mm : ss z " < / li >
* < li > " dd MMM uuuu HH : mm z " < / li >
* < li > " dd MMM uu HH : mm : ss z " < / li >
* < li > " dd MMM uu HH : mm z " < / li >
* < / ul >
* Refer to the java . text . SimpleDateFormat javadocs for details on the format
* of each element .
* @ param sDate
* string to parse for a date . May be < code > null < / code > .
* @ return the Date represented by the given RFC822 string . It returns
* < b > null < / b > if it was not possible to parse the given string into a
* { @ link ZonedDateTime } or if the passed { @ link String } was
* < code > null < / code > . */
@ Nullable public static ZonedDateTime getDateTimeFromRFC822 ( @ Nullable final String sDate ) { } }
|
if ( StringHelper . hasNoText ( sDate ) ) return null ; final WithZoneId aPair = extractDateTimeZone ( sDate . trim ( ) ) ; return parseZonedDateTimeUsingMask ( RFC822_MASKS , aPair . getString ( ) , aPair . getZoneId ( ) ) ;
|
public class FeatureUtilities { /** * Convert a csv file to a FeatureCollection .
* < b > This for now supports only point geometries < / b > . < br >
* For different crs it also performs coor transformation .
* < b > NOTE : this doesn ' t support date attributes < / b >
* @ param csvFile the csv file .
* @ param crs the crs to use .
* @ param fieldsAndTypes the { @ link Map } of filed names and { @ link JGrassConstants # CSVTYPESARRAY types } .
* @ param pm progress monitor .
* @ param separatorthe separator to use , if null , comma is used .
* @ return the created { @ link FeatureCollection }
* @ throws Exception */
public static SimpleFeatureCollection csvFileToFeatureCollection ( File csvFile , CoordinateReferenceSystem crs , LinkedHashMap < String , Integer > fieldsAndTypesIndex , String separator , IHMProgressMonitor pm ) throws Exception { } }
|
GeometryFactory gf = new GeometryFactory ( ) ; Map < String , Class < ? > > typesMap = JGrassConstants . CSVTYPESCLASSESMAP ; String [ ] typesArray = JGrassConstants . CSVTYPESARRAY ; if ( separator == null ) { separator = "," ; } SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder ( ) ; b . setName ( "csvimport" ) ; b . setCRS ( crs ) ; b . add ( "the_geom" , Point . class ) ; int xIndex = - 1 ; int yIndex = - 1 ; Set < String > fieldNames = fieldsAndTypesIndex . keySet ( ) ; String [ ] fieldNamesArray = ( String [ ] ) fieldNames . toArray ( new String [ fieldNames . size ( ) ] ) ; for ( int i = 0 ; i < fieldNamesArray . length ; i ++ ) { String fieldName = fieldNamesArray [ i ] ; Integer typeIndex = fieldsAndTypesIndex . get ( fieldName ) ; if ( typeIndex == 0 ) { xIndex = i ; } else if ( typeIndex == 1 ) { yIndex = i ; } else { Class < ? > class1 = typesMap . get ( typesArray [ typeIndex ] ) ; b . add ( fieldName , class1 ) ; } } SimpleFeatureType featureType = b . buildFeatureType ( ) ; DefaultFeatureCollection newCollection = new DefaultFeatureCollection ( ) ; Collection < Integer > orderedTypeIndexes = fieldsAndTypesIndex . values ( ) ; Integer [ ] orderedTypeIndexesArray = ( Integer [ ] ) orderedTypeIndexes . toArray ( new Integer [ orderedTypeIndexes . size ( ) ] ) ; BufferedReader bR = null ; try { bR = new BufferedReader ( new FileReader ( csvFile ) ) ; String line = null ; int featureId = 0 ; pm . beginTask ( "Importing raw data" , - 1 ) ; while ( ( line = bR . readLine ( ) ) != null ) { pm . worked ( 1 ) ; if ( line . startsWith ( "#" ) ) { continue ; } SimpleFeatureBuilder builder = new SimpleFeatureBuilder ( featureType ) ; Object [ ] values = new Object [ fieldNames . size ( ) - 1 ] ; String [ ] lineSplit = line . split ( separator ) ; double x = Double . parseDouble ( lineSplit [ xIndex ] ) ; double y = Double . parseDouble ( lineSplit [ yIndex ] ) ; Point point = gf . createPoint ( new Coordinate ( x , y ) ) ; values [ 0 ] = point ; int objIndex = 1 ; for ( int i = 0 ; i < lineSplit . length ; i ++ ) { if ( i == xIndex || i == yIndex ) { continue ; } String value = lineSplit [ i ] ; int typeIndex = orderedTypeIndexesArray [ i ] ; String typeName = typesArray [ typeIndex ] ; if ( typeName . equals ( typesArray [ 3 ] ) ) { values [ objIndex ] = value ; } else if ( typeName . equals ( typesArray [ 4 ] ) ) { values [ objIndex ] = new Double ( value ) ; } else if ( typeName . equals ( typesArray [ 5 ] ) ) { values [ objIndex ] = new Integer ( value ) ; } else { throw new IllegalArgumentException ( "An undefined value type was found" ) ; } objIndex ++ ; } builder . addAll ( values ) ; SimpleFeature feature = builder . buildFeature ( featureType . getTypeName ( ) + "." + featureId ) ; featureId ++ ; newCollection . add ( feature ) ; } } finally { if ( bR != null ) bR . close ( ) ; } pm . done ( ) ; return newCollection ;
|
public class SolrTemplate { /** * ( non - Javadoc )
* @ see org . springframework . data . solr . core . SolrOperations # convertBeanToSolrInputDocument ( java . lang . Object ) */
@ Override public SolrInputDocument convertBeanToSolrInputDocument ( Object bean ) { } }
|
if ( bean instanceof SolrInputDocument ) { return ( SolrInputDocument ) bean ; } SolrInputDocument document = new SolrInputDocument ( ) ; getConverter ( ) . write ( bean , document ) ; return document ;
|
public class GeoPackageCoreImpl { /** * { @ inheritDoc } */
@ Override public TileMatrixSet createTileTableWithMetadata ( ContentsDataType dataType , String tableName , BoundingBox contentsBoundingBox , long contentsSrsId , BoundingBox tileMatrixSetBoundingBox , long tileMatrixSetSrsId ) { } }
|
TileMatrixSet tileMatrixSet = null ; // Get the SRS
SpatialReferenceSystem contentsSrs = getSrs ( contentsSrsId ) ; SpatialReferenceSystem tileMatrixSetSrs = getSrs ( tileMatrixSetSrsId ) ; // Create the Tile Matrix Set and Tile Matrix tables
createTileMatrixSetTable ( ) ; createTileMatrixTable ( ) ; // Create the user tile table
List < TileColumn > columns = TileTable . createRequiredColumns ( ) ; TileTable table = new TileTable ( tableName , columns ) ; createTileTable ( table ) ; try { // Create the contents
Contents contents = new Contents ( ) ; contents . setTableName ( tableName ) ; contents . setDataType ( dataType ) ; contents . setIdentifier ( tableName ) ; // contents . setLastChange ( new Date ( ) ) ;
contents . setMinX ( contentsBoundingBox . getMinLongitude ( ) ) ; contents . setMinY ( contentsBoundingBox . getMinLatitude ( ) ) ; contents . setMaxX ( contentsBoundingBox . getMaxLongitude ( ) ) ; contents . setMaxY ( contentsBoundingBox . getMaxLatitude ( ) ) ; contents . setSrs ( contentsSrs ) ; getContentsDao ( ) . create ( contents ) ; table . setContents ( contents ) ; // Create new matrix tile set
tileMatrixSet = new TileMatrixSet ( ) ; tileMatrixSet . setContents ( contents ) ; tileMatrixSet . setSrs ( tileMatrixSetSrs ) ; tileMatrixSet . setMinX ( tileMatrixSetBoundingBox . getMinLongitude ( ) ) ; tileMatrixSet . setMinY ( tileMatrixSetBoundingBox . getMinLatitude ( ) ) ; tileMatrixSet . setMaxX ( tileMatrixSetBoundingBox . getMaxLongitude ( ) ) ; tileMatrixSet . setMaxY ( tileMatrixSetBoundingBox . getMaxLatitude ( ) ) ; getTileMatrixSetDao ( ) . create ( tileMatrixSet ) ; } catch ( RuntimeException e ) { deleteTableQuietly ( tableName ) ; throw e ; } catch ( SQLException e ) { deleteTableQuietly ( tableName ) ; throw new GeoPackageException ( "Failed to create table and metadata: " + tableName , e ) ; } return tileMatrixSet ;
|
public class HttpClient { /** * Perform a post against the WSAPI
* @ param url the request url
* @ param body the body of the post
* @ return the JSON encoded string response
* @ throws IOException if a non - 200 response code is returned or if some other
* problem occurs while executing the request */
public String doPost ( String url , String body ) throws IOException { } }
|
HttpPost httpPost = new HttpPost ( getWsapiUrl ( ) + url ) ; httpPost . setEntity ( new StringEntity ( body , "utf-8" ) ) ; return doRequest ( httpPost ) ;
|
public class PackageIndexWriter { /** * Adds the overview comment as provided in the file specified by the
* " - overview " option on the command line .
* @ param htmltree the documentation tree to which the overview comment will
* be added */
protected void addOverviewComment ( Content htmltree ) { } }
|
if ( ! utils . getFullBody ( configuration . overviewElement ) . isEmpty ( ) ) { addInlineComment ( configuration . overviewElement , htmltree ) ; }
|
public class RoleGraphEditingPlugin { /** * If startVertex is non - null , and the mouse is released over an
* existing vertex , create an undirected edge from startVertex to
* the vertex under the mouse pointer . If shift was also pressed ,
* create a directed edge instead . */
@ SuppressWarnings ( "unchecked" ) public void mouseReleased ( MouseEvent e ) { } }
|
if ( checkModifiers ( e ) ) { final VisualizationViewer < String , String > vv = ( VisualizationViewer < String , String > ) e . getSource ( ) ; final Point2D p = e . getPoint ( ) ; Layout < String , String > layout = vv . getModel ( ) . getGraphLayout ( ) ; GraphElementAccessor < String , String > pickSupport = vv . getPickSupport ( ) ; if ( pickSupport != null ) { final String vertex = pickSupport . getVertex ( layout , p . getX ( ) , p . getY ( ) ) ; if ( vertex != null && startVertex != null ) { Graph < String , String > graph = vv . getGraphLayout ( ) . getGraph ( ) ; try { if ( graph . addEdge ( startVertex + "-" + vertex , startVertex , vertex , EdgeType . DIRECTED ) ) { notifyListeners ( startVertex , vertex ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } vv . repaint ( ) ; } startVertex = null ; down = null ; vv . removePostRenderPaintable ( edgePaintable ) ; vv . removePostRenderPaintable ( arrowPaintable ) ; }
|
public class ShadowClassLoader { /** * Defines the package for this class by trying to load the manifest for the package and if that fails just sets all of the package properties to < code > null < / code > .
* @ param classBytesResourceInformation
* @ param packageName */
@ FFDCIgnore ( IllegalArgumentException . class ) private void definePackage ( final ByteResourceInformation classBytesResourceInformation , String packageName ) { } }
|
/* * We don ' t extend URL classloader so we automatically pass the manifest from the JAR to our supertype , still try to get hold of it though so that we can see if
* we can load the information ourselves from it */
Manifest manifest = classBytesResourceInformation . getManifest ( ) ; try { if ( manifest == null ) { definePackage ( packageName , null , null , null , null , null , null , null ) ; } else { String classResourceName = classBytesResourceInformation . getResourcePath ( ) ; /* * Strip the class name off the end of the package , should always have at least one ' / ' as we have at least one . in the name , also end with a trailing
* ' / ' to match the name style for package definitions in manifest files */
String packageResourceName = classResourceName . substring ( 0 , classResourceName . lastIndexOf ( '/' ) + 1 ) ; // Default all of the package info to null
String specTitle = null ; String specVersion = null ; String specVendor = null ; String implTitle = null ; String implVersion = null ; String implVendor = null ; URL sealBaseUrl = null ; // See if there is a package defined in the manifest
Attributes packageAttributes = manifest . getAttributes ( packageResourceName ) ; if ( packageAttributes != null && ! packageAttributes . isEmpty ( ) ) { specTitle = packageAttributes . getValue ( Attributes . Name . SPECIFICATION_TITLE ) ; specVersion = packageAttributes . getValue ( Attributes . Name . SPECIFICATION_VERSION ) ; specVendor = packageAttributes . getValue ( Attributes . Name . SPECIFICATION_VENDOR ) ; implTitle = packageAttributes . getValue ( Attributes . Name . IMPLEMENTATION_TITLE ) ; implVersion = packageAttributes . getValue ( Attributes . Name . IMPLEMENTATION_VERSION ) ; implVendor = packageAttributes . getValue ( Attributes . Name . IMPLEMENTATION_VENDOR ) ; String sealedValue = packageAttributes . getValue ( Attributes . Name . SEALED ) ; if ( sealedValue != null && Boolean . parseBoolean ( sealedValue ) ) { sealBaseUrl = classBytesResourceInformation . getResourceUrl ( ) ; } } definePackage ( packageName , specTitle , specVersion , specVendor , implTitle , implVersion , implVendor , sealBaseUrl ) ; } } catch ( IllegalArgumentException ignored ) { // This happens if the package is already defined but it is hard to guard against this in a thread safe way . See :
// http : / / bugs . sun . com / view _ bug . do ? bug _ id = 4841786
}
|
public class FloatingIOWriter { /** * count number of bits from high - order 1 bit to low - order 1 bit ,
* inclusive . */
private static int countBits ( long v ) { } }
|
// the strategy is to shift until we get a non - zero sign bit
// then shift until we have no bits left , counting the difference .
// we do byte shifting as a hack . Hope it helps .
if ( v == 0L ) return 0 ; while ( ( v & highbyte ) == 0L ) { v <<= 8 ; } while ( v > 0L ) { // i . e . while ( ( v & highbit ) = = 0L )
v <<= 1 ; } int n = 0 ; while ( ( v & lowbytes ) != 0L ) { v <<= 8 ; n += 8 ; } while ( v != 0L ) { v <<= 1 ; n += 1 ; } return n ;
|
public class Kernel { /** * Determine the total execution time of all previous Kernel . execute ( range ) calls for all threads
* that ran this kernel for the device used in the last kernel execution .
* < br / >
* < b > Note1 : < / b > This is kept for backwards compatibility only , usage of
* { @ link # getAccumulatedExecutionTimeAllThreads ( Device ) } is encouraged instead . < br / >
* < b > Note2 : < / b > Calling this method is not recommended when using more than a single thread to execute
* the same kernel on multiple devices concurrently . < br / >
* < br / >
* Note that this will include the initial conversion time .
* @ return < ul > < li > The total time spent executing the kernel ( ms ) < / li >
* < li > NaN , if no profiling information is available < / li > < / ul >
* @ see # getAccumulatedExecutionTime ( Device ) ) ;
* @ see # getProfileReport ( Device )
* @ see # registerProfileReportObserver ( IProfileReportObserver )
* @ see # getExecutionTime ( ) ;
* @ see # getConversionTime ( ) ; */
public double getAccumulatedExecutionTime ( ) { } }
|
KernelProfile profile = KernelManager . instance ( ) . getProfile ( getClass ( ) ) ; synchronized ( profile ) { return profile . getAccumulatedTotalTime ( ) ; }
|
public class JmsJcaManagedConnectionFactoryImpl { /** * Returns an object containing the username and password with which to
* connect . In order of precedence :
* < ol >
* < li > If passed a < code > Subject < / code > and it contains a
* < code > PasswordCredential < / code > for this managed connection factory
* then use the user name and password from that . < / li >
* < li > If passed a < code > Subject < / code > and it does not contain a
* suitable < code > PasswordCredential < / code > then return < code > null < / code >
* so that we attempt to authenticate with the entire < code > Subject < / code > /
* < / li >
* < li > If we are not passed a < code > Subject < / code > but the application
* specified a username and password then use those . < / li >
* < li > If we are not passed a < code > Subject < / code > and the application
* did not specify a username and password then use the defaults specified
* on this managed connection factory . < / li >
* < / ol >
* @ param subject
* subject to check for user name and password
* @ param requestInfo
* request information to check for user name and password
* @ return object containing user name and password or < code > null < / code >
* if the subject should be used */
JmsJcaUserDetails getUserDetails ( final Subject subject , final ConnectionRequestInfo requestInfo ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , "getUserDetails" , new Object [ ] { JmsJcaManagedConnection . subjectToString ( subject ) , requestInfo } ) ; } JmsJcaUserDetails result = null ; if ( subject == null ) { // We don ' t have a subject ( case 3 or 4)
String userName = null ; String password = null ; if ( requestInfo instanceof JmsJcaConnectionRequestInfo ) { // See if the request information contains any user details
JmsJcaConnectionRequestInfo jmsJcaConnReq = ( JmsJcaConnectionRequestInfo ) requestInfo ; result = jmsJcaConnReq . getUserDetails ( ) ; } if ( result == null ) { // The request information did not contain any user details
// ( case 4)
userName = getUserName ( ) ; password = getPassword ( ) ; result = new JmsJcaUserDetails ( userName , password ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( this , TRACE , "Using default credentials from " + "managed connection factory" ) ; } } else { // The request information did contain user details ( case 3)
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( this , TRACE , "Using credentials passed by application" ) ; } } } else { // We were passed a Subject ( case 1 or 2)
// See if the credential set for the Subject contains a
// PasswordCredential for this managed connection factory
PasswordCredential credential = ( PasswordCredential ) AccessController . doPrivileged ( new PrivilegedAction ( ) { @ Override public Object run ( ) { final Set credentialSet = subject . getPrivateCredentials ( PasswordCredential . class ) ; for ( final Iterator iterator = credentialSet . iterator ( ) ; iterator . hasNext ( ) ; ) { final Object next = iterator . next ( ) ; if ( next instanceof PasswordCredential ) { final PasswordCredential subjectCredential = ( PasswordCredential ) next ; if ( JmsJcaManagedConnectionFactoryImpl . this . equals ( subjectCredential . getManagedConnectionFactory ( ) ) ) { return subjectCredential ; } } } return null ; } } ) ; if ( credential == null ) { // Subject didn ' t contain a suitable PasswordCredential ( case 2)
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( this , TRACE , "No PasswordCredential in Subject - " + "using Subject for authentication" ) ; } } else { // Subject did contain a PasswordCredential ( case 1)
if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( TRACE , "Using PasswordCredential from Subject" ) ; } result = new JmsJcaUserDetails ( credential . getUserName ( ) , String . valueOf ( credential . getPassword ( ) ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { if ( result != null ) { SibTr . debug ( this , TRACE , "Credential contains userName" , result . getUserName ( ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , "getUserDetails" , result ) ; } return result ;
|
public class NtpClient { /** * returns the offest from the ntp server to local system
* @ return
* @ throws IOException */
public long getOffset ( ) throws IOException { } }
|
// / Send request
DatagramSocket socket = null ; try { socket = new DatagramSocket ( ) ; socket . setSoTimeout ( 20000 ) ; InetAddress address = InetAddress . getByName ( serverName ) ; byte [ ] buf = new NtpMessage ( ) . toByteArray ( ) ; DatagramPacket packet = new DatagramPacket ( buf , buf . length , address , 123 ) ; // Set the transmit timestamp * just * before sending the packet
NtpMessage . encodeTimestamp ( packet . getData ( ) , 40 , ( System . currentTimeMillis ( ) / 1000.0 ) + 2208988800.0 ) ; socket . send ( packet ) ; // Get response
packet = new DatagramPacket ( buf , buf . length ) ; socket . receive ( packet ) ; // Immediately record the incoming timestamp
double destinationTimestamp = ( System . currentTimeMillis ( ) / 1000.0 ) + 2208988800.0 ; // Process response
NtpMessage msg = new NtpMessage ( packet . getData ( ) ) ; // double roundTripDelay = ( destinationTimestamp - msg . originateTimestamp ) -
// ( msg . receiveTimestamp - msg . transmitTimestamp ) ;
double localClockOffset = ( ( msg . receiveTimestamp - msg . originateTimestamp ) + ( msg . transmitTimestamp - destinationTimestamp ) ) / 2 ; return ( long ) ( localClockOffset * 1000 ) ; } finally { IOUtil . closeEL ( socket ) ; }
|
public class JdiDefaultExecutionControl { /** * Interrupts a running remote invoke by manipulating remote variables
* and sending a stop via JDI .
* @ throws EngineTerminationException the execution engine has terminated
* @ throws InternalException an internal problem occurred */
@ Override public void stop ( ) throws EngineTerminationException , InternalException { } }
|
synchronized ( STOP_LOCK ) { if ( ! userCodeRunning ) { return ; } vm ( ) . suspend ( ) ; try { OUTER : for ( ThreadReference thread : vm ( ) . allThreads ( ) ) { // could also tag the thread ( e . g . using name ) , to find it easier
for ( StackFrame frame : thread . frames ( ) ) { if ( remoteAgent . equals ( frame . location ( ) . declaringType ( ) . name ( ) ) && ( "invoke" . equals ( frame . location ( ) . method ( ) . name ( ) ) || "varValue" . equals ( frame . location ( ) . method ( ) . name ( ) ) ) ) { ObjectReference thiz = frame . thisObject ( ) ; Field inClientCode = thiz . referenceType ( ) . fieldByName ( "inClientCode" ) ; Field expectingStop = thiz . referenceType ( ) . fieldByName ( "expectingStop" ) ; Field stopException = thiz . referenceType ( ) . fieldByName ( "stopException" ) ; if ( ( ( BooleanValue ) thiz . getValue ( inClientCode ) ) . value ( ) ) { thiz . setValue ( expectingStop , vm ( ) . mirrorOf ( true ) ) ; ObjectReference stopInstance = ( ObjectReference ) thiz . getValue ( stopException ) ; vm ( ) . resume ( ) ; debug ( "Attempting to stop the client code...\n" ) ; thread . stop ( stopInstance ) ; thiz . setValue ( expectingStop , vm ( ) . mirrorOf ( false ) ) ; } break OUTER ; } } } } catch ( ClassNotLoadedException | IncompatibleThreadStateException | InvalidTypeException ex ) { throw new InternalException ( "Exception on remote stop: " + ex ) ; } finally { vm ( ) . resume ( ) ; } }
|
public class Configs { /** * Add a config to a Yaml configuration map .
* @ param content the Yaml configuration map .
* @ param config the configuration .
* @ param injector the injector to be used for creating the configuration objects . */
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) public static void defineConfig ( Map < String , Object > content , ConfigMetadataNode config , Injector injector ) { } }
|
assert content != null ; assert config != null ; final Class < ? > type = ( Class < ? > ) config . getType ( ) ; final String sectionName = config . getName ( ) ; final Pattern setPattern = Pattern . compile ( "^set([A-Z])([a-zA-Z0-9]+)$" ) ; // $ NON - NLS - 1 $
Object theConfig = null ; for ( final Method setterMethod : type . getMethods ( ) ) { final Matcher matcher = setPattern . matcher ( setterMethod . getName ( ) ) ; if ( matcher . matches ( ) ) { final String firstLetter = matcher . group ( 1 ) ; final String rest = matcher . group ( 2 ) ; final String getterName = "get" + firstLetter + rest ; // $ NON - NLS - 1 $
Method getterMethod = null ; try { getterMethod = type . getMethod ( getterName ) ; } catch ( Throwable exception ) { } if ( getterMethod != null && Modifier . isPublic ( getterMethod . getModifiers ( ) ) && ! Modifier . isAbstract ( getterMethod . getModifiers ( ) ) && ! Modifier . isStatic ( getterMethod . getModifiers ( ) ) ) { try { if ( theConfig == null ) { theConfig = injector . getInstance ( type ) ; } if ( theConfig != null ) { final Object value = filterValue ( getterMethod . getReturnType ( ) , getterMethod . invoke ( theConfig ) ) ; final String id = sectionName + "." + firstLetter . toLowerCase ( ) + rest ; // $ NON - NLS - 1 $
defineScalar ( content , id , value ) ; } } catch ( Throwable exception ) { } } } }
|
public class AbstractDataflowAnalysis { /** * Get the dataflow fact representing the point just after given Location .
* Note " after " is meant in the logical sense , so for backward analyses ,
* after means before the location in the control flow sense .
* @ param location
* the location
* @ return the fact at the point just after the location */
@ Override public Fact getFactAfterLocation ( Location location ) throws DataflowAnalysisException { } }
|
BasicBlock basicBlock = location . getBasicBlock ( ) ; InstructionHandle handle = location . getHandle ( ) ; if ( handle == ( isForwards ( ) ? basicBlock . getLastInstruction ( ) : basicBlock . getFirstInstruction ( ) ) ) { return getResultFact ( basicBlock ) ; } else { return getFactAtLocation ( new Location ( isForwards ( ) ? handle . getNext ( ) : handle . getPrev ( ) , basicBlock ) ) ; }
|
public class CachedFwAssistantDirector { public FwAssistDirection assistAssistDirection ( ) { } }
|
if ( assistDirection != null ) { return assistDirection ; } synchronized ( this ) { if ( assistDirection != null ) { return assistDirection ; } final FwAssistDirection direction = createAssistDirection ( ) ; prepareAssistDirection ( direction ) ; assistDirection = direction ; } return assistDirection ;
|
public class QueryBasedExtractor { /** * Remove all upper bounds in the predicateList used for pulling data */
private void removeDataPullUpperBounds ( ) { } }
|
log . info ( "Removing data pull upper bound for last work unit" ) ; Iterator < Predicate > it = predicateList . iterator ( ) ; while ( it . hasNext ( ) ) { Predicate predicate = it . next ( ) ; if ( predicate . getType ( ) == Predicate . PredicateType . HWM ) { log . info ( "Remove predicate: " + predicate . condition ) ; it . remove ( ) ; } }
|
public class ProtoUtils { /** * Returns true if fieldDescriptor holds a map where the values are a sanitized proto type . */
public static boolean isSanitizedContentMap ( FieldDescriptor fieldDescriptor ) { } }
|
if ( ! fieldDescriptor . isMapField ( ) ) { return false ; } Descriptor valueDesc = getMapValueMessageType ( fieldDescriptor ) ; if ( valueDesc == null ) { return false ; } return SAFE_PROTO_TYPES . contains ( valueDesc . getFullName ( ) ) ;
|
public class Utils { /** * The inverse operation of backQuoteChars ( ) .
* Converts back - quoted carriage returns and new lines in a string
* to the corresponding character ( ' \ r ' and ' \ n ' ) .
* Also " un " - back - quotes the following characters : ` " \ \ t and %
* @ param string the string
* @ return the converted string
* @ see # backQuoteChars ( String ) */
public static String unbackQuoteChars ( String string ) { } }
|
int index ; StringBuffer newStringBuffer ; // replace each of the following characters with the backquoted version
String charsFind [ ] = { "\\\\" , "\\'" , "\\t" , "\\n" , "\\r" , "\\\"" , "\\%" , "\\u001E" } ; char charsReplace [ ] = { '\\' , '\'' , '\t' , '\n' , '\r' , '"' , '%' , '\u001E' } ; int pos [ ] = new int [ charsFind . length ] ; int curPos ; String str = new String ( string ) ; newStringBuffer = new StringBuffer ( ) ; while ( str . length ( ) > 0 ) { // get positions and closest character to replace
curPos = str . length ( ) ; index = - 1 ; for ( int i = 0 ; i < pos . length ; i ++ ) { pos [ i ] = str . indexOf ( charsFind [ i ] ) ; if ( ( pos [ i ] > - 1 ) && ( pos [ i ] < curPos ) ) { index = i ; curPos = pos [ i ] ; } } // replace character if found , otherwise finished
if ( index == - 1 ) { newStringBuffer . append ( str ) ; str = "" ; } else { newStringBuffer . append ( str . substring ( 0 , pos [ index ] ) ) ; newStringBuffer . append ( charsReplace [ index ] ) ; str = str . substring ( pos [ index ] + charsFind [ index ] . length ( ) ) ; } } return newStringBuffer . toString ( ) ;
|
public class Quaterniond { /** * Apply a rotation to < code > this < / code > that rotates the < code > fromDir < / code > vector to point along < code > toDir < / code > .
* Since there can be multiple possible rotations , this method chooses the one with the shortest arc .
* If < code > Q < / code > is < code > this < / code > quaternion and < code > R < / code > the quaternion representing the
* specified rotation , then the new quaternion will be < code > Q * R < / code > . So when transforming a
* vector < code > v < / code > with the new quaternion by using < code > Q * R * v < / code > , the
* rotation added by this method will be applied first !
* @ see # rotateTo ( double , double , double , double , double , double , Quaterniond )
* @ param fromDirX
* the x - coordinate of the direction to rotate into the destination direction
* @ param fromDirY
* the y - coordinate of the direction to rotate into the destination direction
* @ param fromDirZ
* the z - coordinate of the direction to rotate into the destination direction
* @ param toDirX
* the x - coordinate of the direction to rotate to
* @ param toDirY
* the y - coordinate of the direction to rotate to
* @ param toDirZ
* the z - coordinate of the direction to rotate to
* @ return this */
public Quaterniond rotateTo ( double fromDirX , double fromDirY , double fromDirZ , double toDirX , double toDirY , double toDirZ ) { } }
|
return rotateTo ( fromDirX , fromDirY , fromDirZ , toDirX , toDirY , toDirZ , this ) ;
|
public class InternalXtextParser { /** * InternalXtext . g : 779:1 : ruleTerminalRuleCall : ( ( rule _ _ TerminalRuleCall _ _ RuleAssignment ) ) ; */
public final void ruleTerminalRuleCall ( ) throws RecognitionException { } }
|
int stackSize = keepStackSize ( ) ; try { // InternalXtext . g : 783:2 : ( ( ( rule _ _ TerminalRuleCall _ _ RuleAssignment ) ) )
// InternalXtext . g : 784:2 : ( ( rule _ _ TerminalRuleCall _ _ RuleAssignment ) )
{ // InternalXtext . g : 784:2 : ( ( rule _ _ TerminalRuleCall _ _ RuleAssignment ) )
// InternalXtext . g : 785:3 : ( rule _ _ TerminalRuleCall _ _ RuleAssignment )
{ before ( grammarAccess . getTerminalRuleCallAccess ( ) . getRuleAssignment ( ) ) ; // InternalXtext . g : 786:3 : ( rule _ _ TerminalRuleCall _ _ RuleAssignment )
// InternalXtext . g : 786:4 : rule _ _ TerminalRuleCall _ _ RuleAssignment
{ pushFollow ( FollowSets000 . FOLLOW_2 ) ; rule__TerminalRuleCall__RuleAssignment ( ) ; state . _fsp -- ; } after ( grammarAccess . getTerminalRuleCallAccess ( ) . getRuleAssignment ( ) ) ; } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ;
|
public class Input { /** * Reads the 1-5 byte int part of a varint flag . The position is advanced so if the boolean part is needed it should be read
* first with { @ link # readVarIntFlag ( ) } . */
public int readVarIntFlag ( boolean optimizePositive ) { } }
|
if ( require ( 1 ) < 5 ) return readVarIntFlag_slow ( optimizePositive ) ; int b = buffer [ position ++ ] ; int result = b & 0x3F ; // Mask first 6 bits .
if ( ( b & 0x40 ) != 0 ) { // Bit 7 means another byte , bit 8 means UTF8.
byte [ ] buffer = this . buffer ; int p = position ; b = buffer [ p ++ ] ; result |= ( b & 0x7F ) << 6 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( b & 0x7F ) << 13 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( b & 0x7F ) << 20 ; if ( ( b & 0x80 ) != 0 ) { b = buffer [ p ++ ] ; result |= ( b & 0x7F ) << 27 ; } } } position = p ; } return optimizePositive ? result : ( ( result >>> 1 ) ^ - ( result & 1 ) ) ;
|
public class MyFiles { /** * 删除文件
* @ param filename */
public static void delete ( String filename ) { } }
|
File file = new File ( filename ) ; if ( file . exists ( ) ) { file . delete ( ) ; }
|
public class DemoActivity { /** * ISimpleDialogListener */
@ Override public void onPositiveButtonClicked ( int requestCode ) { } }
|
if ( requestCode == REQUEST_SIMPLE_DIALOG ) { Toast . makeText ( c , "Positive button clicked" , Toast . LENGTH_SHORT ) . show ( ) ; }
|
public class SerializationUtils { /** * Deserialize a { @ link JsonNode } , with custom class loader .
* @ param json
* @ param clazz
* @ return
* @ since 0.6.2 */
public static < T > T fromJson ( JsonNode json , Class < T > clazz , ClassLoader classLoader ) { } }
|
if ( json == null ) { return null ; } ClassLoader oldClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( classLoader != null ) { Thread . currentThread ( ) . setContextClassLoader ( classLoader ) ; } try { ObjectMapper mapper = poolMapper . borrowObject ( ) ; if ( mapper != null ) { try { return mapper . readValue ( json . toString ( ) , clazz ) ; } finally { poolMapper . returnObject ( mapper ) ; } } throw new DeserializationException ( "No ObjectMapper instance avaialble!" ) ; } catch ( Exception e ) { throw e instanceof DeserializationException ? ( DeserializationException ) e : new DeserializationException ( e ) ; } finally { Thread . currentThread ( ) . setContextClassLoader ( oldClassLoader ) ; }
|
public class DTDNmTokenAttr { /** * Method called by the validator
* to let the attribute do necessary normalization and / or validation
* for the value . */
@ Override public String validate ( DTDValidatorBase v , char [ ] cbuf , int start , int end , boolean normalize ) throws XMLStreamException { } }
|
int origLen = end - start ; // Let ' s trim leading white space first . . .
while ( start < end && WstxInputData . isSpaceChar ( cbuf [ start ] ) ) { ++ start ; } // Empty value ?
if ( start >= end ) { return reportValidationProblem ( v , "Empty NMTOKEN value" ) ; } -- end ; // so that it now points to the last char
while ( end > start && WstxInputData . isSpaceChar ( cbuf [ end ] ) ) { -- end ; } // Ok , need to check char validity
for ( int i = start ; i <= end ; ++ i ) { char c = cbuf [ i ] ; if ( ! WstxInputData . isNameChar ( c , mCfgNsAware , mCfgXml11 ) ) { return reportInvalidChar ( v , c , "not valid NMTOKEN character" ) ; } } if ( normalize ) { // Let ' s only create the String if we trimmed something
int len = ( end - start ) + 1 ; if ( len != origLen ) { return new String ( cbuf , start , len ) ; } } return null ;
|
public class ActivityChooserModel { /** * Adds a historical record .
* @ param historicalRecord The record to add .
* @ return True if the record was added . */
private boolean addHisoricalRecord ( HistoricalRecord historicalRecord ) { } }
|
final boolean added = mHistoricalRecords . add ( historicalRecord ) ; if ( added ) { mHistoricalRecordsChanged = true ; pruneExcessiveHistoricalRecordsIfNeeded ( ) ; persistHistoricalDataIfNeeded ( ) ; sortActivitiesIfNeeded ( ) ; notifyChanged ( ) ; } return added ;
|
public class LongTaskTimer { /** * Creates a timer for tracking long running tasks .
* @ param registry
* Registry to use .
* @ param id
* Identifier for the metric being registered .
* @ return
* Timer instance . */
public static LongTaskTimer get ( Registry registry , Id id ) { } }
|
ConcurrentMap < Id , Object > state = registry . state ( ) ; Object obj = Utils . computeIfAbsent ( state , id , i -> { LongTaskTimer timer = new LongTaskTimer ( registry , id ) ; PolledMeter . using ( registry ) . withId ( id ) . withTag ( Statistic . activeTasks ) . monitorValue ( timer , LongTaskTimer :: activeTasks ) ; PolledMeter . using ( registry ) . withId ( id ) . withTag ( Statistic . duration ) . monitorValue ( timer , t -> t . duration ( ) / NANOS_PER_SECOND ) ; return timer ; } ) ; if ( ! ( obj instanceof LongTaskTimer ) ) { Utils . propagateTypeError ( registry , id , LongTaskTimer . class , obj . getClass ( ) ) ; obj = new LongTaskTimer ( new NoopRegistry ( ) , id ) ; } return ( LongTaskTimer ) obj ;
|
public class JAXBContextFactory { /** * Creates a new { @ link javax . xml . bind . Marshaller } that handles the supplied class . */
public Marshaller createMarshaller ( Class < ? > clazz ) throws JAXBException { } }
|
Marshaller marshaller = getContext ( clazz ) . createMarshaller ( ) ; setMarshallerProperties ( marshaller ) ; return marshaller ;
|
public class ContainerDefinition { /** * The list of port mappings for the container . Port mappings allow containers to access ports on the host container
* instance to send or receive traffic .
* For task definitions that use the < code > awsvpc < / code > network mode , you should only specify the
* < code > containerPort < / code > . The < code > hostPort < / code > can be left blank or it must be the same value as the
* < code > containerPort < / code > .
* Port mappings on Windows use the < code > NetNAT < / code > gateway address rather than < code > localhost < / code > . There is
* no loopback for port mappings on Windows , so you cannot access a container ' s mapped port from the host itself .
* This parameter maps to < code > PortBindings < / 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 > - - publish < / code > option
* to < a href = " https : / / docs . docker . com / engine / reference / run / " > docker run < / a > . If the network mode of a task
* definition is set to < code > none < / code > , then you can ' t specify port mappings . If the network mode of a task
* definition is set to < code > host < / code > , then host ports must either be undefined or they must match the container
* port in the port mapping .
* < note >
* After a task reaches the < code > RUNNING < / code > status , manual and automatic host and container port assignments
* are visible in the < b > Network Bindings < / b > section of a container description for a selected task in the Amazon
* ECS console . The assignments are also visible in the < code > networkBindings < / code > section < a > DescribeTasks < / a >
* responses .
* < / note >
* @ param portMappings
* The list of port mappings for the container . Port mappings allow containers to access ports on the host
* container instance to send or receive traffic . < / p >
* For task definitions that use the < code > awsvpc < / code > network mode , you should only specify the
* < code > containerPort < / code > . The < code > hostPort < / code > can be left blank or it must be the same value as
* the < code > containerPort < / code > .
* Port mappings on Windows use the < code > NetNAT < / code > gateway address rather than < code > localhost < / code > .
* There is no loopback for port mappings on Windows , so you cannot access a container ' s mapped port from the
* host itself .
* This parameter maps to < code > PortBindings < / 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 > - - publish < / code > option to < a href = " https : / / docs . docker . com / engine / reference / run / " > docker run < / a > .
* If the network mode of a task definition is set to < code > none < / code > , then you can ' t specify port
* mappings . If the network mode of a task definition is set to < code > host < / code > , then host ports must
* either be undefined or they must match the container port in the port mapping .
* < note >
* After a task reaches the < code > RUNNING < / code > status , manual and automatic host and container port
* assignments are visible in the < b > Network Bindings < / b > section of a container description for a selected
* task in the Amazon ECS console . The assignments are also visible in the < code > networkBindings < / code >
* section < a > DescribeTasks < / a > responses . */
public void setPortMappings ( java . util . Collection < PortMapping > portMappings ) { } }
|
if ( portMappings == null ) { this . portMappings = null ; return ; } this . portMappings = new com . amazonaws . internal . SdkInternalList < PortMapping > ( portMappings ) ;
|
public class DiscordianDate { /** * Obtains a { @ code DiscordianDate } representing a date in the Discordian calendar
* system from the proleptic - year , month - of - year and day - of - month fields .
* This returns a { @ code DiscordianDate } with the specified fields .
* The day must be valid for the year and month , otherwise an exception will be thrown .
* St . Tib ' s Day is indicated by specifying 0 for both month and day - of - month .
* @ param prolepticYear the Discordian proleptic - year
* @ param month the Discordian month - of - year , from 1 to 5
* @ param dayOfMonth the Discordian day - of - month , from 1 to 73
* @ return the date in Discordian calendar system , not null
* @ throws DateTimeException if the value of any field is out of range ,
* or if the day - of - month is invalid for the month - year */
public static DiscordianDate of ( int prolepticYear , int month , int dayOfMonth ) { } }
|
return DiscordianDate . create ( prolepticYear , month , dayOfMonth ) ;
|
public class HelpParser { /** * Output this screen using HTML . */
public void printHtmlTechInfo ( PrintWriter out , String strTag , String strParams , String strData ) { } }
|
if ( m_recDetail . getClassType ( ) . equalsIgnoreCase ( "Record" ) ) { m_recDetail . printHtmlTechInfo ( out , strTag , strParams , strData ) ; }
|
public class AmazonEC2Client { /** * Purchase a reservation with configurations that match those of your Dedicated Host . You must have active
* Dedicated Hosts in your account before you purchase a reservation . This action results in the specified
* reservation being purchased and charged to your account .
* @ param purchaseHostReservationRequest
* @ return Result of the PurchaseHostReservation operation returned by the service .
* @ sample AmazonEC2 . PurchaseHostReservation
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / PurchaseHostReservation " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public PurchaseHostReservationResult purchaseHostReservation ( PurchaseHostReservationRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executePurchaseHostReservation ( request ) ;
|
public class NASAOtherProjectInformationV1_0Generator { /** * This method creates { @ link XmlObject } of type
* { @ link NASAOtherProjectInformationDocument } by populating data from the
* given { @ link ProposalDevelopmentDocumentContract }
* @ param proposalDevelopmentDocument
* for which the { @ link XmlObject } needs to be created
* @ return { @ link XmlObject } which is generated using the given
* { @ link ProposalDevelopmentDocumentContract } */
@ Override public NASAOtherProjectInformationDocument getFormObject ( ProposalDevelopmentDocumentContract proposalDevelopmentDocument ) { } }
|
this . pdDoc = proposalDevelopmentDocument ; answerHeaders = getPropDevQuestionAnswerService ( ) . getQuestionnaireAnswerHeaders ( pdDoc . getDevelopmentProposal ( ) . getProposalNumber ( ) ) ; return getNasaOtherProjectInformation ( ) ;
|
public class OAuth2AuthorizationActivity { /** * Adds a callback on the web view to catch the redirect URL */
private void prepareWebView ( ) { } }
|
mWebView . getSettings ( ) . setJavaScriptEnabled ( true ) ; mWebView . setVisibility ( View . VISIBLE ) ; mWebView . setWebViewClient ( new WebViewClient ( ) { private boolean done = false ; @ Override public void onPageFinished ( WebView view , String url ) { // Catch the redirect url with the parameters added by the provider auth web page
if ( ! done && url . startsWith ( mAppInfo . getRedirectUrl ( ) ) ) { done = true ; getCredentials ( url ) ; mWebView . setVisibility ( View . INVISIBLE ) ; } } } ) ;
|
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } */
@ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "folderId" , scope = RemoveObjectFromFolder . class ) public JAXBElement < String > createRemoveObjectFromFolderFolderId ( String value ) { } }
|
return new JAXBElement < String > ( _CreateDocumentFolderId_QNAME , String . class , RemoveObjectFromFolder . class , value ) ;
|
public class GeocoderUtilService { /** * Transform a { @ link Envelope } from the source to the target CRS .
* @ param source source geometry
* @ param sourceCrs source CRS
* @ param targetCrs target CRS
* @ return transformed source , now in target CRS
* @ throws GeomajasException building the transformation or doing the transformation is not possible */
public Envelope transform ( Envelope source , CoordinateReferenceSystem sourceCrs , CoordinateReferenceSystem targetCrs ) throws GeomajasException { } }
|
if ( sourceCrs == targetCrs ) { // NOPMD
// only works when the caching of the CRSs works
return source ; } CrsTransform crsTransform = geoService . getCrsTransform ( sourceCrs , targetCrs ) ; return geoService . transform ( source , crsTransform ) ;
|
public class IterableExtensions { /** * Returns a set that contains all the unique entries of the given iterable in the order of their appearance . If the
* iterable is of type { @ link Set } , itself is returned . Therefore an unchecked cast is performed .
* In all other cases , the result set is a copy of the iterable with stable order .
* @ param iterable
* the iterable . May not be < code > null < / code > .
* @ return a set with the unique entries of the given iterable . May be the same as the given iterable iff it
* implements { @ link Set } , otherwise a copy is returned . Never < code > null < / code > . */
@ Beta public static < T > Set < T > toSet ( Iterable < T > iterable ) { } }
|
if ( iterable instanceof Set < ? > ) { Set < T > result = ( Set < T > ) iterable ; return result ; } return Sets . newLinkedHashSet ( iterable ) ;
|
public class AdaptiveRandomNeighborhood { /** * Add random neighbors to all the neighborhoods */
private void addRandomNeighbors ( ) { } }
|
for ( int i = 0 ; i < solutionListSize ; i ++ ) { while ( neighbours . get ( i ) . size ( ) <= numberOfRandomNeighbours ) { int random = randomGenerator . getRandomValue ( 0 , solutionListSize - 1 ) ; neighbours . get ( i ) . add ( random ) ; } }
|
public class A_CmsUsersList { /** * Adds an " activate " column . < p >
* @ param metadata the list metadata
* @ param enable the action for enabling
* @ param deactivate the action for disabling */
private void addActivateColumn ( CmsListMetadata metadata , CmsListDirectAction enable , CmsListDirectAction deactivate ) { } }
|
// create column for activation / deactivation
CmsListColumnDefinition actCol = new CmsListColumnDefinition ( LIST_COLUMN_ACTIVATE ) ; actCol . setName ( Messages . get ( ) . container ( Messages . GUI_USERS_LIST_COLS_ACTIVATE_0 ) ) ; actCol . setHelpText ( Messages . get ( ) . container ( Messages . GUI_USERS_LIST_COLS_ACTIVATE_HELP_0 ) ) ; actCol . setWidth ( "20" ) ; actCol . setAlign ( CmsListColumnAlignEnum . ALIGN_CENTER ) ; actCol . setListItemComparator ( new CmsListItemActionIconComparator ( ) ) ; actCol . addDirectAction ( enable ) ; actCol . addDirectAction ( deactivate ) ; // add it to the list definition
metadata . addColumn ( actCol ) ;
|
public class JsonConfig { /** * Finds a JsonBeanProcessor registered to the target class . < br >
* Returns null if none is registered . < br >
* [ Java - & gt ; JSON ]
* @ param target a class used for searching a JsonBeanProcessor . */
public JsonBeanProcessor findJsonBeanProcessor ( Class target ) { } }
|
if ( ! beanProcessorMap . isEmpty ( ) ) { Object key = jsonBeanProcessorMatcher . getMatch ( target , beanProcessorMap . keySet ( ) ) ; return ( JsonBeanProcessor ) beanProcessorMap . get ( key ) ; } return null ;
|
public class StepFactory { /** * Step that runs a Pig script on your job flow using the specified Pig version .
* @ param script
* The script to run .
* @ param pigVersion
* The Pig version to use .
* @ param scriptArgs
* Arguments that get passed to the script .
* @ return HadoopJarStepConfig that can be passed to your job flow . */
public HadoopJarStepConfig newRunPigScriptStep ( String script , String pigVersion , String ... scriptArgs ) { } }
|
List < String > pigArgs = new ArrayList < String > ( ) ; pigArgs . add ( "--pig-versions" ) ; pigArgs . add ( pigVersion ) ; pigArgs . add ( "--run-pig-script" ) ; pigArgs . add ( "--args" ) ; pigArgs . add ( "-f" ) ; pigArgs . add ( script ) ; pigArgs . addAll ( Arrays . asList ( scriptArgs ) ) ; return newHivePigStep ( "pig" , pigArgs . toArray ( new String [ 0 ] ) ) ;
|
public class NotesAddDialog { /** * This method initializes btnStop
* @ return javax . swing . JButton */
private JButton getBtnCancel ( ) { } }
|
if ( btnCancel == null ) { btnCancel = new JButton ( ) ; btnCancel . setText ( Constant . messages . getString ( "all.button.cancel" ) ) ; btnCancel . setMaximumSize ( new java . awt . Dimension ( 100 , 40 ) ) ; btnCancel . setMinimumSize ( new java . awt . Dimension ( 70 , 30 ) ) ; btnCancel . setPreferredSize ( new java . awt . Dimension ( 70 , 30 ) ) ; btnCancel . setEnabled ( true ) ; btnCancel . addActionListener ( e -> clearAndDispose ( ) ) ; } return btnCancel ;
|
public class CmsOrganizationalUnit { /** * Returns the last name of the given fully qualified name . < p >
* @ param fqn the fully qualified name to get the last name from
* @ return the last name of the given fully qualified name */
public static final String getSimpleName ( String fqn ) { } }
|
String parentFqn = getParentFqn ( fqn ) ; if ( parentFqn != null ) { fqn = fqn . substring ( parentFqn . length ( ) ) ; } if ( ( fqn != null ) && fqn . startsWith ( CmsOrganizationalUnit . SEPARATOR ) ) { fqn = fqn . substring ( CmsOrganizationalUnit . SEPARATOR . length ( ) ) ; } return fqn ;
|
public class Jronn { /** * Calculates the disordered regions of the sequence . More formally , the regions for which the
* probability of disorder is greater then 0.50.
* @ param sequence an instance of FastaSequence object , holding the name and the sequence .
* @ return the array of ranges if there are any residues predicted to have the
* probability of disorder greater then 0.5 , null otherwise . */
public static Range [ ] getDisorder ( FastaSequence sequence ) { } }
|
float [ ] scores = getDisorderScores ( sequence ) ; return scoresToRanges ( scores , RonnConstraint . DEFAULT_RANGE_PROBABILITY_THRESHOLD ) ;
|
public class MongoDbTicketRegistry { /** * Calculate the time at which the ticket is eligible for automated deletion by MongoDb .
* Makes the assumption that the CAS server date and the Mongo server date are in sync . */
private static Date getExpireAt ( final Ticket ticket ) { } }
|
val expirationPolicy = ticket . getExpirationPolicy ( ) ; val ttl = ticket instanceof TicketState ? expirationPolicy . getTimeToLive ( ( TicketState ) ticket ) : expirationPolicy . getTimeToLive ( ) ; if ( ttl < 1 ) { return null ; } return new Date ( System . currentTimeMillis ( ) + TimeUnit . SECONDS . toMillis ( ttl ) ) ;
|
public class DateMapper { /** * { @ inheritDoc } */
@ Override public Optional < Field > indexedField ( String name , Long value ) { } }
|
return Optional . of ( new LongField ( name , value , STORE ) ) ;
|
public class ClassFile { /** * Add a method to this class . This method is handy for implementing
* methods defined by a pre - existing interface . */
public MethodInfo addMethod ( Method method ) { } }
|
Modifiers modifiers = Modifiers . getInstance ( method . getModifiers ( ) ) . toAbstract ( false ) ; MethodInfo mi = addMethod ( modifiers , method . getName ( ) , MethodDesc . forMethod ( method ) ) ; // exception stuff . . .
Class [ ] exceptions = method . getExceptionTypes ( ) ; for ( int i = 0 ; i < exceptions . length ; i ++ ) { mi . addException ( TypeDesc . forClass ( exceptions [ i ] ) ) ; } return mi ;
|
public class PushNotificationManager { /** * Read and process any pending error - responses .
* If an error - response packet is received for a particular message , this
* method assumes that messages following the one identified in the packet
* were completely ignored by Apple , and as such automatically retries to
* send all messages after the problematic one .
* @ return the number of error - response packets received
* @ throws CommunicationException thrown if a communication error occurs
* @ throws KeystoreException thrown if there is a problem with your keystore */
private int processedFailedNotifications ( ) throws CommunicationException , KeystoreException { } }
|
if ( useEnhancedNotificationFormat ) { logger . debug ( "Reading responses" ) ; int responsesReceived = ResponsePacketReader . processResponses ( this ) ; while ( responsesReceived > 0 ) { PushedNotification skippedNotification = null ; List < PushedNotification > notificationsToResend = new ArrayList < PushedNotification > ( ) ; boolean foundFirstFail = false ; for ( PushedNotification notification : pushedNotifications . values ( ) ) { if ( foundFirstFail || ! notification . isSuccessful ( ) ) { if ( foundFirstFail ) notificationsToResend . add ( notification ) ; else { foundFirstFail = true ; skippedNotification = notification ; } } } pushedNotifications . clear ( ) ; int toResend = notificationsToResend . size ( ) ; logger . debug ( "Found " + toResend + " notifications that must be re-sent" ) ; if ( toResend > 0 ) { logger . debug ( "Restarting connection to resend notifications" ) ; restartPreviousConnection ( ) ; for ( PushedNotification pushedNotification : notificationsToResend ) { sendNotification ( pushedNotification , false ) ; } } int remaining = responsesReceived = ResponsePacketReader . processResponses ( this ) ; if ( remaining == 0 ) { logger . debug ( "No notifications remaining to be resent" ) ; return 0 ; } } return responsesReceived ; } else { logger . debug ( "Not reading responses because using simple notification format" ) ; return 0 ; }
|
public class MisoUtil { /** * Convert the given screen - based pixel coordinates to their
* corresponding tile - based coordinates . Converted coordinates
* are placed in the given point object .
* @ param sx the screen x - position pixel coordinate .
* @ param sy the screen y - position pixel coordinate .
* @ param tpos the point object to place coordinates in .
* @ return the point instance supplied via the < code > tpos < / code >
* parameter . */
public static Point screenToTile ( MisoSceneMetrics metrics , int sx , int sy , Point tpos ) { } }
|
// determine the upper - left of the quadrant that contains our point
int zx = ( int ) Math . floor ( ( float ) sx / metrics . tilewid ) ; int zy = ( int ) Math . floor ( ( float ) sy / metrics . tilehei ) ; // these are the screen coordinates of the tile ' s top
int ox = ( zx * metrics . tilewid ) , oy = ( zy * metrics . tilehei ) ; // these are the tile coordinates
tpos . x = zy + zx ; tpos . y = zy - zx ; // now determine which of the four tiles our point occupies
int dx = sx - ox , dy = sy - oy ; if ( Math . round ( metrics . slopeY * dx + metrics . tilehei ) <= dy ) { tpos . x += 1 ; } if ( Math . round ( metrics . slopeX * dx ) > dy ) { tpos . y -= 1 ; } // Log . info ( " Converted [ sx = " + sx + " , sy = " + sy +
// " , zx = " + zx + " , zy = " + zy +
// " , ox = " + ox + " , oy = " + oy +
// " , dx = " + dx + " , dy = " + dy +
// " , tpos . x = " + tpos . x + " , tpos . y = " + tpos . y + " ] . " ) ;
return tpos ;
|
public class MenuScreen { /** * OpenMainFile Method .
* @ return The new main file . */
public Record openMainRecord ( ) { } }
|
Record record = Record . makeRecordFromClassName ( MenusModel . THICK_CLASS , this ) ; record . setOpenMode ( DBConstants . OPEN_READ_ONLY ) ; // This will optimize the cache when client is remote .
return record ;
|
public class NonBlockingReader { /** * Returns a new callable for reading strings from a reader with a given timeout .
* @ param reader input stream to read from
* @ param timeout read timeout in milliseconds , very low numbers and 0 are accepted but might result in strange behavior
* @ param emptyPrint a printout to realize on an empty readline string , for prompts , set null if not required
* @ return null if input stream is null , results of read on input stream otherwise */
public static Callable < String > getCallWTimeout ( BufferedReader reader , int timeout , HasPrompt emptyPrint ) { } }
|
return new Callable < String > ( ) { @ Override public String call ( ) throws IOException { String ret = "" ; while ( "" . equals ( ret ) ) { try { while ( ! reader . ready ( ) ) { Thread . sleep ( timeout ) ; } ret = reader . readLine ( ) ; if ( "" . equals ( ret ) && emptyPrint != null ) { System . out . print ( emptyPrint . prompt ( ) ) ; } } catch ( InterruptedException e ) { return null ; } } return ret ; } } ;
|
public class CmsReplaceDialog { /** * Sets the file input . < p >
* @ param fileInput the file input */
protected void setFileInput ( CmsFileInput fileInput ) { } }
|
// only accept file inputs with a single selected file
if ( fileInput . getFiles ( ) . length == 1 ) { if ( m_okButton != null ) { m_okButton . enable ( ) ; } if ( m_fileInput != null ) { m_fileInput . removeFromParent ( ) ; } m_fileInput = fileInput ; RootPanel . get ( ) . add ( m_fileInput ) ; m_mainPanel . setContainerWidget ( createFileWidget ( m_fileInput . getFiles ( ) [ 0 ] ) ) ; }
|
public class AtomPlacer3D { /** * Calculates the geometric center of all placed atoms in the atomcontainer .
* @ param molecule
* @ return Point3d the geometric center */
public Point3d geometricCenterAllPlacedAtoms ( IAtomContainer molecule ) { } }
|
IAtomContainer allPlacedAtoms = getAllPlacedAtoms ( molecule ) ; return GeometryUtil . get3DCenter ( allPlacedAtoms ) ;
|
public class FoundationFileRollingAppender { /** * < b > Warning < / b > Use of this property requires Java 6.
* @ param value */
public void setMinFreeDiskSpace ( String value ) { } }
|
if ( value == null ) { LogLog . warn ( "Null min free disk space supplied for appender [" + this . getName ( ) + "], defaulting to " + this . getProperties ( ) . getMinFreeDiscSpace ( ) ) ; return ; } value = value . trim ( ) ; if ( "" . equals ( value ) ) { LogLog . warn ( "Empty min free disk space supplied for appender [" + this . getName ( ) + "], defaulting to " + this . getProperties ( ) . getMinFreeDiscSpace ( ) ) ; return ; } final long defaultMinFreeDiskSpace = this . getProperties ( ) . getMinFreeDiscSpace ( ) ; final long minFreeDiskSpace = OptionConverter . toFileSize ( value , defaultMinFreeDiskSpace ) ; this . getProperties ( ) . setMinFreeDiscSpace ( minFreeDiskSpace ) ;
|
public class UnbilledCharge { public static InvoiceUnbilledChargesRequest invoiceUnbilledCharges ( ) throws IOException { } }
|
String uri = uri ( "unbilled_charges" , "invoice_unbilled_charges" ) ; return new InvoiceUnbilledChargesRequest ( Method . POST , uri ) ;
|
public class HystrixRollingNumber { /** * Force a reset of all rolling counters ( clear all buckets ) so that statistics start being gathered from scratch .
* This does NOT reset the CumulativeSum values . */
public void reset ( ) { } }
|
// if we are resetting , that means the lastBucket won ' t have a chance to be captured in CumulativeSum , so let ' s do it here
Bucket lastBucket = buckets . peekLast ( ) ; if ( lastBucket != null ) { cumulativeSum . addBucket ( lastBucket ) ; } // clear buckets so we start over again
buckets . clear ( ) ;
|
public class ProxyTask { /** * Get application properties from proxy properties .
* @ return Just the application properties */
public Map < String , Object > getApplicationProperties ( Map < String , Object > properties ) { } }
|
if ( properties == null ) return null ; Map < String , Object > propApp = new Hashtable < String , Object > ( ) ; if ( properties . get ( DBParams . LANGUAGE ) != null ) propApp . put ( DBParams . LANGUAGE , properties . get ( DBParams . LANGUAGE ) ) ; if ( properties . get ( DBParams . DOMAIN ) != null ) propApp . put ( DBParams . DOMAIN , properties . get ( DBParams . DOMAIN ) ) ; return propApp ;
|
public class ProvisioningArtifactParameterMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ProvisioningArtifactParameter provisioningArtifactParameter , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( provisioningArtifactParameter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( provisioningArtifactParameter . getParameterKey ( ) , PARAMETERKEY_BINDING ) ; protocolMarshaller . marshall ( provisioningArtifactParameter . getDefaultValue ( ) , DEFAULTVALUE_BINDING ) ; protocolMarshaller . marshall ( provisioningArtifactParameter . getParameterType ( ) , PARAMETERTYPE_BINDING ) ; protocolMarshaller . marshall ( provisioningArtifactParameter . getIsNoEcho ( ) , ISNOECHO_BINDING ) ; protocolMarshaller . marshall ( provisioningArtifactParameter . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( provisioningArtifactParameter . getParameterConstraints ( ) , PARAMETERCONSTRAINTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class JppFactory { /** * Why support for invalid JSON data at JsonFactory ! ? It ' s crazy ! ! > : ( */
StubParser adhocSolutions ( String value ) { } }
|
if ( Boolean . toString ( true ) . equals ( value ) ) { return new StubParser ( this ) { @ Override public JsonToken nextToken ( ) { return JsonToken . VALUE_TRUE ; } @ Override public JsonToken getCurrentToken ( ) { return JsonToken . VALUE_TRUE ; } } ; } else if ( Boolean . toString ( false ) . equals ( value ) ) { return new StubParser ( this ) { @ Override public JsonToken nextToken ( ) { return JsonToken . VALUE_FALSE ; } @ Override public JsonToken getCurrentToken ( ) { return JsonToken . VALUE_FALSE ; } } ; } else if ( "null" . equals ( value ) ) { return new StubParser ( this ) { @ Override public JsonToken nextToken ( ) { return JsonToken . VALUE_NULL ; } @ Override public JsonToken getCurrentToken ( ) { return JsonToken . VALUE_NULL ; } } ; } else if ( value . startsWith ( "\"" ) && value . endsWith ( "\"" ) ) { final StringBuilder builder = new StringBuilder ( value ) ; builder . deleteCharAt ( 0 ) ; builder . setLength ( builder . length ( ) - 1 ) ; return new StubParser ( this ) { @ Override public JsonToken nextToken ( ) { return JsonToken . VALUE_STRING ; } @ Override public JsonToken getCurrentToken ( ) { return JsonToken . VALUE_STRING ; } @ Override public String getText ( ) { return builder . toString ( ) ; } } ; } else { try { final BigDecimal decimal = new BigDecimal ( value ) ; return new StubParser ( this ) { @ Override public JsonToken nextToken ( ) { try { decimal . longValueExact ( ) ; return JsonToken . VALUE_NUMBER_INT ; } catch ( ArithmeticException e ) { return JsonToken . VALUE_NUMBER_FLOAT ; } } @ Override public JsonToken getCurrentToken ( ) { try { decimal . longValueExact ( ) ; return JsonToken . VALUE_NUMBER_INT ; } catch ( ArithmeticException e ) { return JsonToken . VALUE_NUMBER_FLOAT ; } } @ Override public short getShortValue ( ) { return decimal . shortValue ( ) ; } @ Override public int getIntValue ( ) { return decimal . intValue ( ) ; } @ Override public float getFloatValue ( ) { return decimal . floatValue ( ) ; } @ Override public long getLongValue ( ) { return decimal . longValue ( ) ; } @ Override public double getDoubleValue ( ) { return decimal . doubleValue ( ) ; } @ Override public BigInteger getBigIntegerValue ( ) { return decimal . toBigInteger ( ) ; } @ Override public BigDecimal getDecimalValue ( ) { return decimal ; } } ; } catch ( NumberFormatException e ) { } } return null ;
|
public class BaseTransport { /** * Add this method param to the param list .
* @ param strParam The param name .
* @ param strValue The param value . */
public void addParam ( String strParam , Object obj ) { } }
|
String strValue = this . objectToString ( obj ) ; this . addParam ( strParam , strValue ) ;
|
public class ToolArbitrateEvent { /** * 查询当前的remedy index记录 */
public List < RemedyIndexEventData > listRemedyIndexs ( Long pipelineId ) { } }
|
String path = StagePathUtils . getRemedyRoot ( pipelineId ) ; List < RemedyIndexEventData > datas = new ArrayList < RemedyIndexEventData > ( ) ; try { List < String > nodes = zookeeper . getChildren ( path ) ; for ( String node : nodes ) { RemedyIndexEventData data = RemedyIndexEventData . parseNodeName ( node ) ; data . setPipelineId ( pipelineId ) ; datas . add ( data ) ; } } catch ( ZkException e ) { throw new ArbitrateException ( "listRemedyIndexs" , pipelineId . toString ( ) , e ) ; } Collections . sort ( datas , new RemedyIndexComparator ( ) ) ; // 做一下排序
return datas ;
|
public class TextBuffer { /** * Method used to determine size of the next segment to
* allocate to contain textual content . */
private int calcNewSize ( int latestSize ) { } }
|
// Let ' s grow segments by 50 % , when over 8k
int incr = ( latestSize < 8000 ) ? latestSize : ( latestSize >> 1 ) ; int size = latestSize + incr ; // but let ' s not create too big chunks
return Math . min ( size , MAX_SEGMENT_LENGTH ) ;
|
public class CodeChunk { /** * { @ link # doFormatInitialStatements } and { @ link Expression # doFormatOutputExpr } are the main
* methods subclasses should override to control their formatting . Subclasses should only override
* this method in the special case that a code chunk needs to control its formatting when it is
* the only chunk being serialized . TODO ( brndn ) : only one override , can probably be declared
* final .
* @ param startingIndent The indent level of the foreign code into which this code will be
* inserted . This doesn ' t affect the correctness of the composed code , only its readability . */
@ ForOverride String getCode ( int startingIndent ) { } }
|
FormattingContext initialStatements = new FormattingContext ( startingIndent ) ; initialStatements . appendInitialStatements ( this ) ; FormattingContext outputExprs = new FormattingContext ( startingIndent ) ; if ( this instanceof Expression ) { outputExprs . appendOutputExpression ( ( Expression ) this ) ; outputExprs . append ( ';' ) . endLine ( ) ; } return initialStatements . concat ( outputExprs ) . toString ( ) ;
|
public class TypeVariableUtils { /** * The same as { @ link GenericsUtils # resolveTypeVariables ( Type [ ] , Map ) } , except it also process
* { @ link ExplicitTypeVariable } variables . Useful for special cases when variables tracking is used .
* For example , type resolved with variables as a template and then used to create dynamic types
* ( according to context parametrization ) .
* @ param types types to resolve
* @ param generics root class generics mapping and { @ link ExplicitTypeVariable } variable values .
* @ return types without variables */
public static Type [ ] resolveAllTypeVariables ( final Type [ ] types , final Map < String , Type > generics ) { } }
|
return GenericsUtils . resolveTypeVariables ( types , generics , true ) ;
|
public class XDSSourceAuditor { /** * Audits an ITI - 15 Provide And Register Document Set event for XDS . a Document Source actors .
* @ param eventOutcome The event outcome indicator
* @ param repositoryEndpointUri The endpoint of the repository in this transaction
* @ param submissionSetUniqueId The UniqueID of the Submission Set provided
* @ param patientId The Patient Id that this submission pertains to */
public void auditProvideAndRegisterDocumentSetEvent ( RFC3881EventOutcomeCodes eventOutcome , String repositoryEndpointUri , String userName , String submissionSetUniqueId , String patientId ) { } }
|
if ( ! isAuditorEnabled ( ) ) { return ; } auditProvideAndRegisterEvent ( new IHETransactionEventTypeCodes . ProvideAndRegisterDocumentSet ( ) , eventOutcome , repositoryEndpointUri , userName , submissionSetUniqueId , patientId , null , null ) ;
|
public class PopupMenu { /** * Shows menu below ( or above if not enough space ) given actor .
* @ param stage stage instance that this menu is being added to
* @ param actor used to get calculate menu position in stage , menu will be displayed above or below it */
public void showMenu ( Stage stage , Actor actor ) { } }
|
Vector2 pos = actor . localToStageCoordinates ( tmpVector . setZero ( ) ) ; float menuY ; if ( pos . y - getHeight ( ) <= 0 ) { menuY = pos . y + actor . getHeight ( ) + getHeight ( ) - sizes . borderSize ; } else { menuY = pos . y + sizes . borderSize ; } showMenu ( stage , pos . x , menuY ) ;
|
public class AutoscalerClient { /** * Updates an autoscaler in the specified project using the data included in the request . This
* method supports PATCH semantics and uses the JSON merge patch format and processing rules .
* < p > Sample code :
* < pre > < code >
* try ( AutoscalerClient autoscalerClient = AutoscalerClient . create ( ) ) {
* String autoscaler = " " ;
* ProjectZoneName zone = ProjectZoneName . of ( " [ PROJECT ] " , " [ ZONE ] " ) ;
* Autoscaler autoscalerResource = Autoscaler . newBuilder ( ) . build ( ) ;
* List & lt ; String & gt ; fieldMask = new ArrayList & lt ; & gt ; ( ) ;
* Operation response = autoscalerClient . patchAutoscaler ( autoscaler , zone , autoscalerResource , fieldMask ) ;
* < / code > < / pre >
* @ param autoscaler Name of the autoscaler to patch .
* @ param zone Name of the zone for this request .
* @ param autoscalerResource Represents an Autoscaler resource . Autoscalers allow you to
* automatically scale virtual machine instances in managed instance groups according to an
* autoscaling policy that you define . For more information , read Autoscaling Groups of
* Instances . ( = = resource _ for beta . autoscalers = = ) ( = = resource _ for v1 . autoscalers = = ) ( = =
* resource _ for beta . regionAutoscalers = = ) ( = = resource _ for v1 . regionAutoscalers = = )
* @ param fieldMask The fields that should be serialized ( even if they have empty values ) . If the
* containing message object has a non - null fieldmask , then all the fields in the field mask
* ( and only those fields in the field mask ) will be serialized . If the containing object does
* not have a fieldmask , then only non - empty fields will be serialized .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation patchAutoscaler ( String autoscaler , ProjectZoneName zone , Autoscaler autoscalerResource , List < String > fieldMask ) { } }
|
PatchAutoscalerHttpRequest request = PatchAutoscalerHttpRequest . newBuilder ( ) . setAutoscaler ( autoscaler ) . setZone ( zone == null ? null : zone . toString ( ) ) . setAutoscalerResource ( autoscalerResource ) . addAllFieldMask ( fieldMask ) . build ( ) ; return patchAutoscaler ( request ) ;
|
public class DataConverters { /** * Convert this string to a Date .
* Runs sequentually through the following formats : DateTime , DateShortTime ,
* Date , DateShort , Time .
* @ param strString string to convert .
* @ return Date value .
* @ throws Exception NumberFormatException . */
public static Date stringToDate ( String strString , int ibScale ) throws Exception { } }
|
Date objData ; Exception except = null ; initGlobals ( ) ; // Make sure you have the utilities
if ( ( strString == null ) || ( strString . equals ( Constant . BLANK ) ) ) return null ; for ( int i = 1 ; i <= 6 ; i ++ ) { DateFormat df = null ; switch ( i ) { case 1 : df = gDateTimeFormat ; break ; case 2 : df = gDateShortTimeFormat ; break ; case 3 : df = gDateFormat ; break ; case 4 : df = gDateShortFormat ; break ; case 5 : default : df = gTimeFormat ; break ; case 6 : df = gGMTDateTimeFormat ; break ; } try { synchronized ( gCalendar ) { objData = df . parse ( strString ) ; if ( ibScale != - 1 ) { DataConverters . gCalendar . setTime ( objData ) ; if ( ibScale == Constant . DATE_ONLY ) { DataConverters . gCalendar . set ( Calendar . HOUR_OF_DAY , 0 ) ; DataConverters . gCalendar . set ( Calendar . MINUTE , 0 ) ; DataConverters . gCalendar . set ( Calendar . SECOND , 0 ) ; DataConverters . gCalendar . set ( Calendar . MILLISECOND , 0 ) ; } if ( ibScale == Constant . TIME_ONLY ) { DataConverters . gCalendar . set ( Calendar . YEAR , Constant . FIRST_YEAR ) ; DataConverters . gCalendar . set ( Calendar . MONTH , Calendar . JANUARY ) ; DataConverters . gCalendar . set ( Calendar . DATE , 1 ) ; } DataConverters . gCalendar . set ( Calendar . MILLISECOND , 0 ) ; objData = DataConverters . gCalendar . getTime ( ) ; } } return objData ; } catch ( ParseException ex ) { except = ex ; // continue with the next parse
} } if ( except != null ) throw except ; return null ;
|
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcDaylightSavingHour ( ) { } }
|
if ( ifcDaylightSavingHourEClass == null ) { ifcDaylightSavingHourEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 664 ) ; } return ifcDaylightSavingHourEClass ;
|
public class authenticationcertpolicy_vpnvserver_binding { /** * Use this API to fetch authenticationcertpolicy _ vpnvserver _ binding resources of given name . */
public static authenticationcertpolicy_vpnvserver_binding [ ] get ( nitro_service service , String name ) throws Exception { } }
|
authenticationcertpolicy_vpnvserver_binding obj = new authenticationcertpolicy_vpnvserver_binding ( ) ; obj . set_name ( name ) ; authenticationcertpolicy_vpnvserver_binding response [ ] = ( authenticationcertpolicy_vpnvserver_binding [ ] ) obj . get_resources ( service ) ; return response ;
|
public class JSONValue { /** * Check Json Syntax from input Reader
* @ return if the input is valid */
public static boolean isValidJson ( Reader in ) throws IOException { } }
|
try { new JSONParser ( DEFAULT_PERMISSIVE_MODE ) . parse ( in , FakeMapper . DEFAULT ) ; return true ; } catch ( ParseException e ) { return false ; }
|
public class ExceptionUtils { /** * Does the throwable ' s causal chain have an immediate or wrapped exception
* of the given type ?
* @ param chain
* The root of a Throwable causal chain .
* @ param type
* The exception type to test .
* @ return true , if chain is an instance of type or is an
* UndeclaredThrowableException wrapping a cause .
* @ since 3.5
* @ see # wrapAndThrow ( Throwable ) */
@ GwtIncompatible ( "incompatible method" ) public static boolean hasCause ( Throwable chain , final Class < ? extends Throwable > type ) { } }
|
if ( chain instanceof UndeclaredThrowableException ) { chain = chain . getCause ( ) ; } return type . isInstance ( chain ) ;
|
public class ColorUtils { /** * Resolves a color resource .
* @ param color the color resource
* @ param context the current context
* @ return a color int */
@ SuppressWarnings ( "deprecation" ) public static @ ColorInt int resolveColor ( @ ColorRes int color , Context context ) { } }
|
if ( Build . VERSION . SDK_INT >= 23 ) { return context . getResources ( ) . getColor ( color , context . getTheme ( ) ) ; } else { return context . getResources ( ) . getColor ( color ) ; }
|
public class TargetPoolClient { /** * Adds an instance to a target pool .
* < p > Sample code :
* < pre > < code >
* try ( TargetPoolClient targetPoolClient = TargetPoolClient . create ( ) ) {
* ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ TARGET _ POOL ] " ) ;
* TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = TargetPoolsAddInstanceRequest . newBuilder ( ) . build ( ) ;
* Operation response = targetPoolClient . addInstanceTargetPool ( targetPool , targetPoolsAddInstanceRequestResource ) ;
* < / code > < / pre >
* @ param targetPool Name of the TargetPool resource to add instances to .
* @ param targetPoolsAddInstanceRequestResource
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation addInstanceTargetPool ( ProjectRegionTargetPoolName targetPool , TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource ) { } }
|
AddInstanceTargetPoolHttpRequest request = AddInstanceTargetPoolHttpRequest . newBuilder ( ) . setTargetPool ( targetPool == null ? null : targetPool . toString ( ) ) . setTargetPoolsAddInstanceRequestResource ( targetPoolsAddInstanceRequestResource ) . build ( ) ; return addInstanceTargetPool ( request ) ;
|
public class LCSQoSImpl { /** * ( non - Javadoc )
* @ see org . restcomm . protocols . ss7 . map . api . primitives . MAPAsnPrimitive # encodeData
* ( org . mobicents . protocols . asn . AsnOutputStream ) */
public void encodeData ( AsnOutputStream asnOs ) throws MAPException { } }
|
if ( this . horizontalAccuracy != null ) { try { asnOs . writeOctetString ( Tag . CLASS_CONTEXT_SPECIFIC , _TAG_HORIZONTAL_ACCURACY , new byte [ ] { this . horizontalAccuracy . byteValue ( ) } ) ; } catch ( IOException e ) { throw new MAPException ( "IOException when encoding parameter horizontalAccuracy: " , e ) ; } catch ( AsnException e ) { throw new MAPException ( "AsnException when encoding parameter horizontalAccuracy: " , e ) ; } } if ( this . verticalCoordinateRequest ) { try { asnOs . writeNull ( Tag . CLASS_CONTEXT_SPECIFIC , _TAG_VERTICAL_COORDINATE_REQUEST ) ; } catch ( IOException e ) { throw new MAPException ( "IOException when encoding parameter verticalCoordinateRequest: " , e ) ; } catch ( AsnException e ) { throw new MAPException ( "IOException when encoding parameter verticalCoordinateRequest: " , e ) ; } } if ( this . verticalAccuracy != null ) { try { asnOs . writeOctetString ( Tag . CLASS_CONTEXT_SPECIFIC , _TAG_VERTICAL_ACCURACY , new byte [ ] { this . verticalAccuracy . byteValue ( ) } ) ; } catch ( IOException e ) { throw new MAPException ( "IOException when encoding parameter verticalAccuracy: " , e ) ; } catch ( AsnException e ) { throw new MAPException ( "AsnException when encoding parameter verticalAccuracy: " , e ) ; } } if ( this . responseTime != null ) { ( ( ResponseTimeImpl ) this . responseTime ) . encodeAll ( asnOs , Tag . CLASS_CONTEXT_SPECIFIC , _TAG_RESPONSE_TIME ) ; } if ( this . extensionContainer != null ) { ( ( MAPExtensionContainerImpl ) this . extensionContainer ) . encodeAll ( asnOs , Tag . CLASS_CONTEXT_SPECIFIC , _TAG_EXTENSION_CONTAINER ) ; }
|
public class DynamicAccessModule { /** * Perform a dissemination for a method that belongs to a dynamic
* disseminator that is associate with the digital object . The method
* belongs to the dynamic service definition and is implemented by a
* dynamic Service Deployment ( which is an internal service in the
* repository access subsystem ) .
* @ param context
* @ param PID
* identifier of the digital object being disseminated
* @ param sDefPID
* identifier of dynamic Service Definition
* @ param methodName
* @ param userParms
* @ param asOfDateTime
* @ return a MIME - typed stream containing the dissemination result
* @ throws ServerException */
public MIMETypedStream getDissemination ( Context context , String PID , String sDefPID , String methodName , Property [ ] userParms , Date asOfDateTime ) throws ServerException { } }
|
setParameter ( "useCachedObject" , "" + false ) ; // < < < STILL REQUIRED ?
return da . getDissemination ( context , PID , sDefPID , methodName , userParms , asOfDateTime , m_manager . getReader ( Server . USE_DEFINITIVE_STORE , context , PID ) ) ;
|
public class JVnTextPro { /** * Process the text and return the processed text
* pipeline : sentence segmentation , tokenization , word segmentation , part of speech tagging .
* @ param text text to be processed
* @ return processed text */
public String process ( String text ) { } }
|
String ret = text ; // Pipeline
ret = convertor . convert ( ret ) ; ret = senSegment ( ret ) ; ret = senTokenize ( ret ) ; ret = wordSegment ( ret ) ; ret = postProcessing ( ret ) ; ret = posTagging ( ret ) ; return ret ;
|
public class UserApi { /** * Get a Pager of users .
* < pre > < code > GitLab Endpoint : GET / users < / code > < / pre >
* @ param itemsPerPage the number of User instances that will be fetched per page
* @ return a Pager of User
* @ throws GitLabApiException if any exception occurs */
public Pager < User > getUsers ( int itemsPerPage ) throws GitLabApiException { } }
|
return ( new Pager < User > ( this , User . class , itemsPerPage , createGitLabApiForm ( ) . asMap ( ) , "users" ) ) ;
|
public class ItemsSketch { /** * From an existing sketch , this creates a new sketch that can have a smaller value of K .
* The original sketch is not modified .
* @ param newK the new value of K that must be smaller than current value of K .
* It is required that this . getK ( ) = newK * 2 ^ ( nonnegative integer ) .
* @ return the new sketch . */
public ItemsSketch < T > downSample ( final int newK ) { } }
|
final ItemsSketch < T > newSketch = ItemsSketch . getInstance ( newK , comparator_ ) ; ItemsMergeImpl . downSamplingMergeInto ( this , newSketch ) ; return newSketch ;
|
public class PropertiesManager { /** * Save the given property using an Enum constant . See
* { @ link # saveProperty ( Object , String ) } for additional details . < br >
* < br >
* Please note that the Enum value saved here is case insensitive . See
* { @ link # getEnumProperty ( Object , Class ) } for additional details .
* @ param < E >
* the type of Enum value to save
* @ param property
* the property whose value is being saved
* @ param value
* the value to save
* @ throws IOException
* if there is an error while attempting to write the property
* to the file */
public < E extends Enum < E > > void saveProperty ( T property , E value ) throws IOException { } }
|
saveProperty ( property , value . name ( ) ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.