signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Session { /** * Synchronous call to save a session . * @ param fileName * @ throws Exception */ protected void save ( String fileName ) throws Exception { } }
configuration . save ( new File ( fileName ) ) ; if ( isNewState ( ) ) { model . moveSessionDb ( fileName ) ; } else { if ( ! this . fileName . equals ( fileName ) ) { // copy file to new fileName model . copySessionDb ( this . fileName , fileName ) ; } } this . fileName = fileName ; if ( ! Constant . isLowMemoryOptionSet ( ) ) { synchronized ( siteTree ) { saveSiteTree ( siteTree . getRoot ( ) ) ; } } model . getDb ( ) . getTableSession ( ) . update ( getSessionId ( ) , getSessionName ( ) ) ;
public class ReadWriteMultipleRequest { /** * setRegisters - Sets the registers to be written with this * < tt > ReadWriteMultipleRequest < / tt > . * @ param registers the registers to be written as < tt > Register [ ] < / tt > . */ public void setRegisters ( Register [ ] registers ) { } }
writeCount = registers != null ? registers . length : 0 ; this . registers = registers != null ? Arrays . copyOf ( registers , registers . length ) : null ;
public class OptionsUtil { /** * Retrieves the { @ link Point } object with the given wickedChartsId from the * given { @ link Options } object . Returns null if a Point with the given ID * does not exist . * @ param options Chartoptions * @ param wickedChartsId corresponding ID * @ return Point object */ public static Point getPointWithWickedChartsId ( final Options options , final int wickedChartsId ) { } }
for ( Series < ? > series : options . getSeries ( ) ) { for ( Object object : series . getData ( ) ) { if ( ! ( object instanceof Point ) ) { break ; } else { Point point = ( Point ) object ; if ( point . getWickedChartsId ( ) == wickedChartsId ) { return point ; } } } } return null ;
public class ConnectionImpl { /** * Checks to see if the destination is temporary and the connection * used to create the temp destination is the same as the one trying to * access it . * Checking skipped if this is a mqinterop request * @ param destination * @ param mqinterop * @ throws SITemporaryDestinationNotFoundException If the temp destination wasn ' t * created using the current connection . */ private void checkTemporary ( DestinationHandler destination , boolean mqinterop ) throws SITemporaryDestinationNotFoundException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkTemporary" , new Object [ ] { destination , Boolean . valueOf ( mqinterop ) } ) ; // If a Temporary Destination , ensure it is on this connection unless mqinterop if ( destination . isTemporary ( ) && ! mqinterop && ( _temporaryDestinations . indexOf ( destination . getName ( ) ) == - 1 ) ) { SIMPTemporaryDestinationNotFoundException e = new SIMPTemporaryDestinationNotFoundException ( nls . getFormattedMessage ( "TEMPORARY_DESTINATION_CONNECTION_ERROR_CWSIP0099" , new Object [ ] { destination . getName ( ) } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exception ( tc , e ) ; SibTr . exit ( tc , "checkTemporary" , e ) ; } throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkTemporary" ) ;
public class KeyValueSelectBucketHandler { /** * Once the channel is marked as active , select bucket command is sent if the HELLO request has SELECT _ BUCKET feature * enabled . * @ param ctx the handler context . * @ throws Exception if something goes wrong during communicating to the server . */ @ Override public void channelActive ( final ChannelHandlerContext ctx ) throws Exception { } }
this . ctx = ctx ; if ( selectBucketEnabled ) { byte [ ] key = bucket . getBytes ( ) ; short keyLength = ( short ) bucket . length ( ) ; BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest ( key ) ; request . setOpcode ( SELECT_BUCKET_OPCODE ) ; request . setKeyLength ( keyLength ) ; request . setTotalBodyLength ( keyLength ) ; this . ctx . writeAndFlush ( request ) ; } else { // remove the handler if the feature is not enabled originalPromise . setSuccess ( ) ; this . ctx . pipeline ( ) . remove ( this ) ; this . ctx . fireChannelActive ( ) ; }
public class VoidParameterServer { /** * This method checks for designated role , according to local IP addresses and configuration passed into method * @ param voidConfiguration * @ param localIPs * @ return */ protected Pair < NodeRole , String > getRole ( @ NonNull VoidConfiguration voidConfiguration , @ NonNull Collection < String > localIPs ) { } }
NodeRole result = NodeRole . CLIENT ; for ( String ip : voidConfiguration . getShardAddresses ( ) ) { String cleansed = ip . replaceAll ( ":.*" , "" ) ; if ( localIPs . contains ( cleansed ) ) return Pair . create ( NodeRole . SHARD , ip ) ; } if ( voidConfiguration . getBackupAddresses ( ) != null ) for ( String ip : voidConfiguration . getBackupAddresses ( ) ) { String cleansed = ip . replaceAll ( ":.*" , "" ) ; if ( localIPs . contains ( cleansed ) ) return Pair . create ( NodeRole . BACKUP , ip ) ; } String sparkIp = null ; if ( sparkIp == null && voidConfiguration . getNetworkMask ( ) != null ) { NetworkOrganizer organizer = new NetworkOrganizer ( voidConfiguration . getNetworkMask ( ) ) ; sparkIp = organizer . getMatchingAddress ( ) ; } // last resort here . . . if ( sparkIp == null ) sparkIp = System . getenv ( ND4JEnvironmentVars . DL4J_VOID_IP ) ; log . info ( "Got [{}] as sparkIp" , sparkIp ) ; if ( sparkIp == null ) throw new ND4JIllegalStateException ( "Can't get IP address for UDP communcation" ) ; // local IP from pair is used for shard only , so we don ' t care return Pair . create ( result , sparkIp + ":" + voidConfiguration . getUnicastControllerPort ( ) ) ;
public class SocketChannel { /** * Opens a socket channel and connects it to a remote address . * < p > This convenience method works as if by invoking the { @ link # open ( ) } * method , invoking the { @ link # connect ( SocketAddress ) connect } method upon * the resulting socket channel , passing it < tt > remote < / tt > , and then * returning that channel . < / p > * @ param remote * The remote address to which the new channel is to be connected * @ return A new , and connected , socket channel * @ throws AsynchronousCloseException * If another thread closes this channel * while the connect operation is in progress * @ throws ClosedByInterruptException * If another thread interrupts the current thread * while the connect operation is in progress , thereby * closing the channel and setting the current thread ' s * interrupt status * @ throws UnresolvedAddressException * If the given remote address is not fully resolved * @ throws UnsupportedAddressTypeException * If the type of the given remote address is not supported * @ throws SecurityException * If a security manager has been installed * and it does not permit access to the given remote endpoint * @ throws IOException * If some other I / O error occurs */ public static SocketChannel open ( SocketAddress remote ) throws IOException { } }
SocketChannel sc = open ( ) ; try { sc . connect ( remote ) ; } catch ( Throwable x ) { try { sc . close ( ) ; } catch ( Throwable suppressed ) { x . addSuppressed ( suppressed ) ; } throw x ; } assert sc . isConnected ( ) ; return sc ;
public class VaultsInner { /** * The List operation gets information about the vaults associated with the subscription . * @ param top Maximum number of results to return . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PagedList & lt ; VaultInner & gt ; object if successful . */ public PagedList < VaultInner > listBySubscription ( final Integer top ) { } }
ServiceResponse < Page < VaultInner > > response = listBySubscriptionSinglePageAsync ( top ) . toBlocking ( ) . single ( ) ; return new PagedList < VaultInner > ( response . body ( ) ) { @ Override public Page < VaultInner > nextPage ( String nextPageLink ) { return listBySubscriptionNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class Text { /** * Copies substring from the current line upto the end to the specified destination . * @ param other the destination object */ public void copyRemainder ( Text other ) { } }
other . chars = this . chars ; other . pos = this . linePointer + 1 ; other . len = this . len - this . linePointer - 1 ;
public class VirtualMachine { /** * Détachement du singleton . * @ throws Exception e */ public static synchronized void detach ( ) throws Exception { } }
// NOPMD if ( jvmVirtualMachine != null ) { final Class < ? > virtualMachineClass = jvmVirtualMachine . getClass ( ) ; final Method detachMethod = virtualMachineClass . getMethod ( "detach" ) ; jvmVirtualMachine = invoke ( detachMethod , jvmVirtualMachine ) ; jvmVirtualMachine = null ; }
public class BoundingBox { /** * Expand the bounding box max longitude above the max possible projection * value if needed to create a bounding box where the max longitude is * numerically larger than the min longitude . * @ param maxProjectionLongitude * max longitude of the world for the current bounding box units * @ return expanded bounding box * @ since 2.0.0 */ public BoundingBox expandCoordinates ( double maxProjectionLongitude ) { } }
BoundingBox expanded = new BoundingBox ( this ) ; double minLongitude = getMinLongitude ( ) ; double maxLongitude = getMaxLongitude ( ) ; if ( minLongitude > maxLongitude ) { int worldWraps = 1 + ( int ) ( ( minLongitude - maxLongitude ) / ( 2 * maxProjectionLongitude ) ) ; maxLongitude += ( worldWraps * 2 * maxProjectionLongitude ) ; expanded . setMaxLongitude ( maxLongitude ) ; } return expanded ;
public class JmsConnectionImpl { /** * Returns the state . * @ return int */ protected int getState ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getState" ) ; int tempState ; synchronized ( stateLock ) { tempState = state ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getState" , state ) ; return tempState ;
public class URLUtils { /** * Create new URI with a given fragment . * @ param path URI to set fragment on * @ param fragment new fragment , { @ code null } for no fragment * @ return new URI instance with given fragment */ public static URI setFragment ( final URI path , final String fragment ) { } }
try { if ( path . getPath ( ) != null ) { return new URI ( path . getScheme ( ) , path . getUserInfo ( ) , path . getHost ( ) , path . getPort ( ) , path . getPath ( ) , path . getQuery ( ) , fragment ) ; } else { return new URI ( path . getScheme ( ) , path . getSchemeSpecificPart ( ) , fragment ) ; } } catch ( final URISyntaxException e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; }
public class SourceLineAnnotation { /** * Create from Method and InstructionHandle in a visited class . * @ param classContext * ClassContext of visited class * @ param method * Method in visited class * @ param handle * InstructionHandle in visited class * @ return SourceLineAnnotation describing visited instruction */ public static SourceLineAnnotation fromVisitedInstruction ( ClassContext classContext , Method method , InstructionHandle handle ) { } }
return fromVisitedInstruction ( classContext , method , handle . getPosition ( ) ) ;
public class XMLCaster { /** * casts a value to a XML Attribute Object * @ param doc XML Document * @ param o Object to cast * @ return XML Comment Object * @ throws PageException */ public static Attr toAttr ( Document doc , Object o ) throws PageException { } }
if ( o instanceof Attr ) return ( Attr ) o ; if ( o instanceof Struct && ( ( Struct ) o ) . size ( ) == 1 ) { Struct sct = ( Struct ) o ; Entry < Key , Object > e = sct . entryIterator ( ) . next ( ) ; Attr attr = doc . createAttribute ( e . getKey ( ) . getString ( ) ) ; attr . setValue ( Caster . toString ( e . getValue ( ) ) ) ; return attr ; } throw new XMLException ( "can't cast Object of type " + Caster . toClassName ( o ) + " to a XML Attribute" ) ;
public class JwKRetriever { /** * Either kid or x5t will work . But not both */ public PublicKey getPublicKeyFromJwk ( String kid , String x5t , boolean useSystemPropertiesForHttpClientConnections ) throws PrivilegedActionException , IOException , KeyStoreException , InterruptedException { } }
return getPublicKeyFromJwk ( kid , x5t , null , useSystemPropertiesForHttpClientConnections ) ;
public class Example2 { /** * Uses the raw { @ link StateLocalInputSUL } to infer a ( potentially ) partial { @ link MealyMachine } . */ static void runPartialLearner ( boolean withCache ) { } }
// setup SULs and counters StateLocalInputSUL < Integer , Character > target = SUL ; ResetCounterStateLocalInputSUL < Integer , Character > resetCounter = new ResetCounterStateLocalInputSUL < > ( "Resets" , target ) ; SymbolCounterStateLocalInputSUL < Integer , Character > symbolCounter = new SymbolCounterStateLocalInputSUL < > ( "Symbols" , resetCounter ) ; // construct a ( state local input ) simulator membership query oracle StateLocalInputMealyOracle < Integer , OutputAndLocalInputs < Integer , Character > > mqOracle = new StateLocalInputSULOracle < > ( symbolCounter ) ; // construct storage for EquivalenceOracle chain , because we want to use the potential cache as well List < EquivalenceOracle < StateLocalInputMealyMachine < ? , Integer , ? , Character > , Integer , Word < OutputAndLocalInputs < Integer , Character > > > > eqOracles = new ArrayList < > ( 2 ) ; if ( withCache ) { StateLocalInputMealyCacheOracle < Integer , Character > mqCache = MealyCaches . createStateLocalInputTreeCache ( mqOracle . definedInputs ( Word . epsilon ( ) ) , mqOracle ) ; eqOracles . add ( mqCache . createStateLocalInputCacheConsistencyTest ( ) ) ; mqOracle = mqCache ; } // construct L * instance PartialLStarMealy < Integer , Character > lstar = new PartialLStarMealyBuilder < Integer , Character > ( ) . withOracle ( mqOracle ) . withCexHandler ( ObservationTableCEXHandlers . RIVEST_SCHAPIRE ) . create ( ) ; // here , we simply fallback to an equivalence check for the original automaton model eqOracles . add ( new StateLocalInputMealySimulatorEQOracle < > ( TARGET ) ) ; // construct single EQ oracle EquivalenceOracle < StateLocalInputMealyMachine < ? , Integer , ? , Character > , Integer , Word < OutputAndLocalInputs < Integer , Character > > > eqOracle = new EQOracleChain < > ( eqOracles ) ; // construct the experiment // note , we can ' t use the regular MealyExperiment ( or MooreExperiment ) because the output type of our hypothesis // is different from our membership query type Experiment < StateLocalInputMealyMachine < ? , Integer , ? , Character > > experiment = new Experiment < > ( lstar , eqOracle , INPUTS ) ; // run experiment experiment . run ( ) ; // report results System . out . println ( "Partial Hypothesis" + ( withCache ? ", with cache" : "" ) ) ; System . out . println ( "-------------------------------------------------------" ) ; System . out . println ( resetCounter . getStatisticalData ( ) . getSummary ( ) ) ; System . out . println ( symbolCounter . getStatisticalData ( ) . getSummary ( ) ) ; System . out . println ( "-------------------------------------------------------" ) ;
public class LocalClustererProcessor { /** * Update stats . * @ param event the event */ private void updateStats ( ContentEvent event ) { } }
Instance instance ; if ( event instanceof ClusteringContentEvent ) { // Local Clustering ClusteringContentEvent ev = ( ClusteringContentEvent ) event ; instance = ev . getInstance ( ) ; DataPoint point = new DataPoint ( instance , Integer . parseInt ( event . getKey ( ) ) ) ; model . trainOnInstance ( point ) ; instancesCount ++ ; } if ( event instanceof ClusteringResultContentEvent ) { // Global Clustering ClusteringResultContentEvent ev = ( ClusteringResultContentEvent ) event ; Clustering clustering = ev . getClustering ( ) ; for ( int i = 0 ; i < clustering . size ( ) ; i ++ ) { instance = new DenseInstance ( 1.0 , clustering . get ( i ) . getCenter ( ) ) ; instance . setDataset ( model . getDataset ( ) ) ; DataPoint point = new DataPoint ( instance , Integer . parseInt ( event . getKey ( ) ) ) ; model . trainOnInstance ( point ) ; instancesCount ++ ; } } if ( instancesCount % this . sampleFrequency == 0 ) { logger . info ( "Trained model using {} events with classifier id {}" , instancesCount , this . modelId ) ; // getId ( ) ) ; }
public class CompactSparseTypedEdgeSet { /** * Adds the edge to this set if one of the vertices is the root vertex and * if the non - root vertex has a greater index that this vertex . */ public boolean add ( TypedEdge < T > e ) { } }
if ( e . from ( ) == rootVertex ) return add ( edges , e . to ( ) , e . edgeType ( ) ) ; else if ( e . to ( ) == rootVertex ) return add ( edges , e . from ( ) , e . edgeType ( ) ) ; return false ;
public class TimelineModel { /** * Adds all given groups to the model . * @ param groups collection of groups to be added */ public void addAllGroups ( Collection < TimelineGroup > groups ) { } }
if ( groups == null ) { groups = new ArrayList < > ( ) ; } groups . addAll ( groups ) ;
public class DataSourceService { /** * Create unique ; if existing convert an existing { @ link DataSourceModel } if one exists . */ public synchronized DataSourceModel createUnique ( Set < ProjectModel > applications , String dataSourceName , String jndiName ) { } }
JNDIResourceModel jndiResourceModel = new JNDIResourceService ( getGraphContext ( ) ) . createUnique ( applications , jndiName ) ; final DataSourceModel dataSourceModel ; if ( jndiResourceModel instanceof DataSourceModel ) { dataSourceModel = ( DataSourceModel ) jndiResourceModel ; } else { dataSourceModel = addTypeToModel ( jndiResourceModel ) ; } dataSourceModel . setName ( dataSourceName ) ; return dataSourceModel ;
public class BitArray { /** * Sets the bit at the given index . * @ param index The index of the bit to set . * @ return Indicates if the bit was changed . */ public boolean set ( long index ) { } }
if ( ! ( index < size ) ) throw new IndexOutOfBoundsException ( ) ; if ( ! get ( index ) ) { bytes . writeLong ( offset ( index ) , bytes . readLong ( offset ( index ) ) | ( 1l << position ( index ) ) ) ; count ++ ; return true ; } return false ;
public class BOCImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . BOC__OBJ_CNAME : return getObjCName ( ) ; case AfplibPackage . BOC__TRIPLETS : return getTriplets ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class MainActivity { @ Override protected Class < ? extends MvcFragment > mapFragmentRouting ( Class < ? extends FragmentController > controllerClass ) { } }
String controllerPackage = controllerClass . getPackage ( ) . getName ( ) ; // Find the classes of fragment under package . view and named in form of xxxScreen // For example // a . b . c . CounterMasterController - > a . b . c . view . CounterMasterScreen String viewPkgName = controllerPackage . substring ( 0 , controllerPackage . lastIndexOf ( "." ) ) + ".view" ; String fragmentClassName = viewPkgName + "." + controllerClass . getSimpleName ( ) . replace ( "Controller" , "Screen" ) ; try { return ( Class < ? extends MvcFragment > ) Class . forName ( fragmentClassName ) ; } catch ( ClassNotFoundException e ) { String msg = String . format ( "Fragment class(%s) for controller(%s) can not be found" , fragmentClassName , controllerClass . getName ( ) ) ; throw new RuntimeException ( msg , e ) ; }
public class OmsLineSmootherMcMaster { /** * Checks if the given geometry is connected to any other line . * @ param geometryN the geometry to test . * @ return true if the geometry is alone in the space , i . e . not connected at * one of the ends to any other geometry . */ private boolean isAlone ( Geometry geometryN ) { } }
Coordinate [ ] coordinates = geometryN . getCoordinates ( ) ; if ( coordinates . length > 1 ) { Coordinate first = coordinates [ 0 ] ; Coordinate last = coordinates [ coordinates . length - 1 ] ; for ( SimpleFeature line : linesList ) { Geometry lineGeom = ( Geometry ) line . getDefaultGeometry ( ) ; int numGeometries = lineGeom . getNumGeometries ( ) ; for ( int i = 0 ; i < numGeometries ; i ++ ) { Geometry subGeom = lineGeom . getGeometryN ( i ) ; Coordinate [ ] lineCoordinates = subGeom . getCoordinates ( ) ; if ( lineCoordinates . length < 2 ) { continue ; } else { Coordinate tmpFirst = lineCoordinates [ 0 ] ; Coordinate tmpLast = lineCoordinates [ lineCoordinates . length - 1 ] ; if ( tmpFirst . distance ( first ) < SAMEPOINTTHRESHOLD || tmpFirst . distance ( last ) < SAMEPOINTTHRESHOLD || tmpLast . distance ( first ) < SAMEPOINTTHRESHOLD || tmpLast . distance ( last ) < SAMEPOINTTHRESHOLD ) { return false ; } } } } } // 1 point line or no connection , mark it as alone for removal return true ;
public class CmsJspNavBuilder { /** * This method builds a complete navigation tree with entries of all branches * from the specified folder . < p > * @ param folder folder the root folder of the navigation tree * @ param visibility controls whether entries hidden from navigation or not in navigation at all should be included * @ param endLevel the end level of the navigation * @ return list of navigation elements , in depth first order */ public List < CmsJspNavElement > getSiteNavigation ( String folder , Visibility visibility , int endLevel ) { } }
folder = CmsFileUtil . addTrailingSeparator ( folder ) ; // check if a specific end level was given , if not , build the complete navigation boolean noLimit = false ; if ( endLevel < 0 ) { noLimit = true ; } List < CmsJspNavElement > list = new ArrayList < CmsJspNavElement > ( ) ; // get the navigation for this folder List < CmsJspNavElement > curnav = getNavigationForFolder ( folder , visibility , CmsResourceFilter . DEFAULT ) ; // loop through all navigation entries for ( CmsJspNavElement ne : curnav ) { // add the navigation entry to the result list list . add ( ne ) ; // check if navigation entry is a folder or navigation level and below the max level - > if so , get the navigation from this folder as well if ( ( ne . isFolderLink ( ) || ne . isNavigationLevel ( ) ) && ( noLimit || ( ne . getNavTreeLevel ( ) < endLevel ) ) ) { List < CmsJspNavElement > subnav = getSiteNavigation ( m_cms . getSitePath ( ne . getResource ( ) ) , visibility , endLevel ) ; // copy the result of the subfolder to the result list list . addAll ( subnav ) ; } } return list ;
public class OperandStack { /** * Remove amount elements from the operand stack , without using pop . * For example after a method invocation */ public void remove ( int amount ) { } }
int size = stack . size ( ) ; for ( int i = size - 1 ; i > size - 1 - amount ; i -- ) { popWithMessage ( i ) ; }
public class InternalSARLParser { /** * InternalSARL . g : 8745:1 : entryRuleXMultiplicativeExpression returns [ EObject current = null ] : iv _ ruleXMultiplicativeExpression = ruleXMultiplicativeExpression EOF ; */ public final EObject entryRuleXMultiplicativeExpression ( ) throws RecognitionException { } }
EObject current = null ; EObject iv_ruleXMultiplicativeExpression = null ; try { // InternalSARL . g : 8745:66 : ( iv _ ruleXMultiplicativeExpression = ruleXMultiplicativeExpression EOF ) // InternalSARL . g : 8746:2 : iv _ ruleXMultiplicativeExpression = ruleXMultiplicativeExpression EOF { if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXMultiplicativeExpressionRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleXMultiplicativeExpression = ruleXMultiplicativeExpression ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleXMultiplicativeExpression ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ;
public class Object2IntHashMap { /** * Overloaded version of { @ link Map # remove ( Object ) } that takes a primitive int key . * Due to type erasure have to rename the method * @ param key for indexing the { @ link Map } * @ return the value if found otherwise missingValue */ public int removeKey ( final K key ) { } }
@ DoNotSub final int mask = values . length - 1 ; @ DoNotSub int index = Hashing . hash ( key , mask ) ; int value ; while ( missingValue != ( value = values [ index ] ) ) { if ( key . equals ( keys [ index ] ) ) { keys [ index ] = null ; values [ index ] = missingValue ; -- size ; compactChain ( index ) ; break ; } index = ++ index & mask ; } return value ;
public class DBRestore { /** * { @ inheritDoc } */ public void restore ( ) throws BackupException { } }
try { for ( Entry < String , TableTransformationRule > entry : tables . entrySet ( ) ) { String tableName = entry . getKey ( ) ; TableTransformationRule restoreRule = entry . getValue ( ) ; restoreTable ( storageDir , jdbcConn , tableName , restoreRule ) ; } } catch ( IOException e ) { throw new BackupException ( e ) ; } catch ( SQLException e ) { throw new BackupException ( "SQL Exception: " + JDBCUtils . getFullMessage ( e ) , e ) ; }
public class BusinessUtils { /** * Checks that classes satisfying a specification are assignable to a base class and return a * typed stream of it . */ @ SuppressWarnings ( "unchecked" ) public static < T > Stream < Class < ? extends T > > streamClasses ( Collection < Class < ? > > classes , Class < ? extends T > baseClass ) { } }
return classes . stream ( ) . filter ( ClassPredicates . classIsDescendantOf ( baseClass ) ) . map ( c -> ( Class < T > ) c ) ;
public class ErrorHandlerMixin { /** * { @ inheritDoc } */ @ Override public void setErrorHandlerType ( ErrorHandlerType type ) { } }
if ( errorHandler != null ) { errorHandler . cleanup ( ) ; } errorHandlerType = type == null ? ErrorHandlerType . DEFAULT : type ; switch ( errorHandlerType ) { case NONE : errorHandler = null ; break ; case DEFAULT : errorHandler = new DefaultErrorHandler ( inputWidget ) ; }
public class PubchemFingerprinter { /** * based on NCBI C implementation */ private static byte [ ] base64Decode ( String data ) { } }
int len = data . length ( ) ; byte [ ] b64 = new byte [ len * 3 / 4 ] ; byte [ ] buf = new byte [ 4 ] ; boolean done = false ; for ( int i = 0 , j , k = 0 ; i < len && ! done ; ) { buf [ 0 ] = buf [ 1 ] = buf [ 2 ] = buf [ 3 ] = 0 ; for ( j = 0 ; j < 4 && i < len ; ++ j ) { char c = data . charAt ( i ) ; if ( c >= 'A' && c <= 'Z' ) { c -= 'A' ; } else if ( c >= 'a' && c <= 'z' ) { c = ( char ) ( c - 'a' + 26 ) ; } else if ( c >= '0' && c <= '9' ) { c = ( char ) ( c - '0' + 52 ) ; } else if ( c == '+' ) { c = 62 ; } else if ( c == '/' ) { c = 63 ; } else if ( c == '=' || c == '-' ) { done = true ; break ; } else { ++ i ; -- j ; continue ; } buf [ j ] = ( byte ) c ; ++ i ; } if ( k < b64 . length && j >= 1 ) { b64 [ k ++ ] = ( byte ) ( ( buf [ 0 ] << 2 ) | ( ( buf [ 1 ] & 0x30 ) >> 4 ) ) ; } if ( k < b64 . length && j >= 3 ) { b64 [ k ++ ] = ( byte ) ( ( ( buf [ 1 ] & 0x0f ) << 4 ) | ( ( buf [ 2 ] & 0x3c ) >> 2 ) ) ; } if ( k < b64 . length && j >= 4 ) { b64 [ k ++ ] = ( byte ) ( ( ( buf [ 2 ] & 0x03 ) << 6 ) | ( buf [ 3 ] & 0x3f ) ) ; } } return b64 ;
public class CmsExportParameters { /** * Sets the file path , should be a zip file . < p > * @ param path the file path */ public void setPath ( String path ) { } }
if ( CmsStringUtil . isEmpty ( path ) || ! path . trim ( ) . equals ( path ) ) { throw new CmsIllegalArgumentException ( Messages . get ( ) . container ( Messages . ERR_BAD_FILE_NAME_1 , path ) ) ; } m_path = path ;
public class InstanceTemplateClient { /** * Creates an instance template in the specified project using the data that is included in the * request . If you are creating a new template to update an existing instance group , your new * instance template must use the same network or , if applicable , the same subnetwork as the * original template . * < p > Sample code : * < pre > < code > * try ( InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient . create ( ) ) { * ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ; * InstanceTemplate instanceTemplateResource = InstanceTemplate . newBuilder ( ) . build ( ) ; * Operation response = instanceTemplateClient . insertInstanceTemplate ( project . toString ( ) , instanceTemplateResource ) ; * < / code > < / pre > * @ param project Project ID for this request . * @ param instanceTemplateResource An Instance Template resource . ( = = resource _ for * beta . instanceTemplates = = ) ( = = resource _ for v1 . instanceTemplates = = ) * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation insertInstanceTemplate ( String project , InstanceTemplate instanceTemplateResource ) { } }
InsertInstanceTemplateHttpRequest request = InsertInstanceTemplateHttpRequest . newBuilder ( ) . setProject ( project ) . setInstanceTemplateResource ( instanceTemplateResource ) . build ( ) ; return insertInstanceTemplate ( request ) ;
public class ZooKeeperUtils { /** * Ensures the given { @ code path } exists in the ZK cluster accessed by { @ code zkClient } . If the * path already exists , nothing is done ; however if any portion of the path is missing , it will be * created with the given { @ code acl } as a persistent zookeeper node . The given { @ code path } must * be a valid zookeeper absolute path . * @ param zkClient the client to use to access the ZK cluster * @ param acl the acl to use if creating path nodes * @ param path the path to ensure exists * @ throws ZooKeeperConnectionException if there was a problem accessing the ZK cluster * @ throws InterruptedException if we were interrupted attempting to connect to the ZK cluster * @ throws KeeperException if there was a problem in ZK */ public static void ensurePath ( ZooKeeperClient zkClient , List < ACL > acl , String path ) throws ZooKeeperConnectionException , InterruptedException , KeeperException { } }
Objects . requireNonNull ( zkClient ) ; Objects . requireNonNull ( path ) ; if ( ! path . startsWith ( "/" ) ) { throw new IllegalArgumentException ( ) ; } ensurePathInternal ( zkClient , acl , path ) ;
public class ForeignDestination { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . admin . Controllable # getName ( ) */ public String getName ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getName" ) ; String name = foreignDest . getName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getName" , name ) ; return name ;
public class SQSMessageConsumerPrefetch { /** * Helper that notifies PrefetchThread that message is dispatched and AutoAcknowledge */ private javax . jms . Message messageHandler ( MessageManager messageManager ) throws JMSException { } }
if ( messageManager == null ) { return null ; } javax . jms . Message message = messageManager . getMessage ( ) ; // Notify PrefetchThread that message is dispatched this . messageDispatched ( ) ; acknowledger . notifyMessageReceived ( ( SQSMessage ) message ) ; return message ;
public class TimeParametersImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case BpsimPackage . TIME_PARAMETERS__TRANSFER_TIME : setTransferTime ( ( Parameter ) newValue ) ; return ; case BpsimPackage . TIME_PARAMETERS__QUEUE_TIME : setQueueTime ( ( Parameter ) newValue ) ; return ; case BpsimPackage . TIME_PARAMETERS__WAIT_TIME : setWaitTime ( ( Parameter ) newValue ) ; return ; case BpsimPackage . TIME_PARAMETERS__SET_UP_TIME : setSetUpTime ( ( Parameter ) newValue ) ; return ; case BpsimPackage . TIME_PARAMETERS__PROCESSING_TIME : setProcessingTime ( ( Parameter ) newValue ) ; return ; case BpsimPackage . TIME_PARAMETERS__VALIDATION_TIME : setValidationTime ( ( Parameter ) newValue ) ; return ; case BpsimPackage . TIME_PARAMETERS__REWORK_TIME : setReworkTime ( ( Parameter ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class GsonScriptModuleSpecSerializer { /** * Convert the input JSON String to a { @ link ScriptModuleSpec } */ @ Override public ScriptModuleSpec deserialize ( String json ) { } }
Objects . requireNonNull ( json , "json" ) ; ScriptModuleSpec moduleSpec = SERIALIZER . fromJson ( json , ScriptModuleSpec . class ) ; return moduleSpec ;
public class CheckBox { /** * Render the checkbox . * @ throws JspException if a JSP exception has occurred */ public int doEndTag ( ) throws JspException { } }
Tag parent = getParent ( ) ; if ( parent instanceof CheckBoxGroup ) registerTagError ( Bundle . getString ( "Tags_CheckBoxGroupChildError" ) , null ) ; Object val = evaluateDataSource ( ) ; if ( hasErrors ( ) ) return reportAndExit ( EVAL_PAGE ) ; ByRef ref = new ByRef ( ) ; nameHtmlControl ( _state , ref ) ; String hiddenParamName = _state . name + OLDVALUE_SUFFIX ; ServletRequest req = pageContext . getRequest ( ) ; if ( val instanceof String ) { if ( val != null && Boolean . valueOf ( val . toString ( ) ) . booleanValue ( ) ) _state . checked = true ; else _state . checked = false ; } else if ( val instanceof Boolean ) { _state . checked = ( ( Boolean ) val ) . booleanValue ( ) ; } else { String oldCheckBoxValue = req . getParameter ( hiddenParamName ) ; if ( oldCheckBoxValue != null ) { _state . checked = new Boolean ( oldCheckBoxValue ) . booleanValue ( ) ; } else { _state . checked = evaluateDefaultValue ( ) ; } } _state . disabled = isDisabled ( ) ; // Create a hidden field to store the CheckBox oldValue String oldValue = req . getParameter ( _state . name ) ; WriteRenderAppender writer = new WriteRenderAppender ( pageContext ) ; // if the checkbox is disabled we need to not write out the hidden // field because it can cause the default state to change from // true to false . Disabled check boxes do not postback . if ( ! _state . disabled ) { _hiddenState . name = hiddenParamName ; if ( oldValue == null ) { _hiddenState . value = "false" ; } else { _hiddenState . value = oldValue ; } TagRenderingBase hiddenTag = TagRenderingBase . Factory . getRendering ( TagRenderingBase . INPUT_HIDDEN_TAG , req ) ; hiddenTag . doStartTag ( writer , _hiddenState ) ; hiddenTag . doEndTag ( writer ) ; } _state . type = INPUT_CHECKBOX ; TagRenderingBase br = TagRenderingBase . Factory . getRendering ( TagRenderingBase . INPUT_BOOLEAN_TAG , req ) ; br . doStartTag ( writer , _state ) ; if ( ! ref . isNull ( ) ) write ( ( String ) ref . getRef ( ) ) ; // Continue processing this page localRelease ( ) ; return EVAL_PAGE ;
public class ArrowConverter { /** * Create an ndarray vector that stores structs * of { @ link INDArray } * based on the { @ link org . apache . arrow . flatbuf . Tensor } * format * @ param allocator the allocator to use * @ param name the name of the vector * @ param length the number of vectors to store * @ return */ public static VarBinaryVector ndarrayVectorOf ( BufferAllocator allocator , String name , int length ) { } }
VarBinaryVector ret = new VarBinaryVector ( name , allocator ) ; ret . allocateNewSafe ( ) ; ret . setValueCount ( length ) ; return ret ;
public class Ec2IaasHandler { /** * Parses the properties and saves them in a Java bean . * @ param targetProperties the IaaS properties * @ throws TargetException */ static void parseProperties ( Map < String , String > targetProperties ) throws TargetException { } }
// Quick check String [ ] properties = { Ec2Constants . EC2_ENDPOINT , Ec2Constants . EC2_ACCESS_KEY , Ec2Constants . EC2_SECRET_KEY , Ec2Constants . AMI_VM_NODE , Ec2Constants . VM_INSTANCE_TYPE , Ec2Constants . SSH_KEY_NAME , Ec2Constants . SECURITY_GROUP_NAME } ; for ( String property : properties ) { if ( StringUtils . isBlank ( targetProperties . get ( property ) ) ) throw new TargetException ( "The value for " + property + " cannot be null or empty." ) ; }
public class NumberParser { /** * Parse an Integer from a String . If the String is not an integer < b > null < / b > is returned and * no exception is thrown . * @ param str the String to parse * @ return The Integer represented by the String , or null if it could not be parsed . */ public static Integer parseInt ( final String str ) { } }
if ( null != str ) { try { return new Integer ( Integer . parseInt ( str . trim ( ) ) ) ; } catch ( final Exception e ) { // : IGNORE : } } return null ;
public class StringGroovyMethods { /** * Replaces the first occurrence of a captured group by the result of a closure call on that text . * For example ( with some replaceAll variants thrown in for comparison purposes ) , * < pre > * assert " hellO world " = = " hello world " . replaceFirst ( ~ " ( o ) " ) { it [ 0 ] . toUpperCase ( ) } / / first match * assert " hellO wOrld " = = " hello world " . replaceAll ( ~ " ( o ) " ) { it [ 0 ] . toUpperCase ( ) } / / all matches * assert ' 1 - FISH , two fish ' = = " one fish , two fish " . replaceFirst ( ~ / ( [ a - z ] { 3 } ) \ s ( [ a - z ] { 4 } ) / ) { [ one : 1 , two : 2 ] [ it [ 1 ] ] + ' - ' + it [ 2 ] . toUpperCase ( ) } * assert ' 1 - FISH , 2 - FISH ' = = " one fish , two fish " . replaceAll ( ~ / ( [ a - z ] { 3 } ) \ s ( [ a - z ] { 4 } ) / ) { [ one : 1 , two : 2 ] [ it [ 1 ] ] + ' - ' + it [ 2 ] . toUpperCase ( ) } * < / pre > * @ param self a CharSequence * @ param pattern the capturing regex Pattern * @ param closure the closure to apply on the first captured group * @ return a CharSequence with replaced content * @ since 1.8.2 */ public static String replaceFirst ( final CharSequence self , final Pattern pattern , final @ ClosureParams ( value = FromString . class , options = { } }
"List<String>" , "String[]" } ) Closure closure ) { final String s = self . toString ( ) ; final Matcher matcher = pattern . matcher ( s ) ; if ( matcher . find ( ) ) { final StringBuffer sb = new StringBuffer ( s . length ( ) + 16 ) ; String replacement = getReplacement ( matcher , closure ) ; matcher . appendReplacement ( sb , Matcher . quoteReplacement ( replacement ) ) ; matcher . appendTail ( sb ) ; return sb . toString ( ) ; } else { return s ; }
public class StoreDataflowFactory { /** * ( non - Javadoc ) * @ see * edu . umd . cs . findbugs . classfile . IAnalysisEngine # analyze ( edu . umd . cs . findbugs * . classfile . IAnalysisCache , java . lang . Object ) */ @ Override public StoreDataflow analyze ( IAnalysisCache analysisCache , MethodDescriptor descriptor ) throws CheckedAnalysisException { } }
MethodGen methodGen = getMethodGen ( analysisCache , descriptor ) ; if ( methodGen == null ) { return null ; } StoreAnalysis analysis = new StoreAnalysis ( getDepthFirstSearch ( analysisCache , descriptor ) , getConstantPoolGen ( analysisCache , descriptor . getClassDescriptor ( ) ) ) ; StoreDataflow dataflow = new StoreDataflow ( getCFG ( analysisCache , descriptor ) , analysis ) ; dataflow . execute ( ) ; return dataflow ;
public class SOARecord { /** * Convert to a String */ String rrToString ( ) { } }
StringBuffer sb = new StringBuffer ( ) ; sb . append ( host ) ; sb . append ( " " ) ; sb . append ( admin ) ; if ( Options . check ( "multiline" ) ) { sb . append ( " (\n\t\t\t\t\t" ) ; sb . append ( serial ) ; sb . append ( "\t; serial\n\t\t\t\t\t" ) ; sb . append ( refresh ) ; sb . append ( "\t; refresh\n\t\t\t\t\t" ) ; sb . append ( retry ) ; sb . append ( "\t; retry\n\t\t\t\t\t" ) ; sb . append ( expire ) ; sb . append ( "\t; expire\n\t\t\t\t\t" ) ; sb . append ( minimum ) ; sb . append ( " )\t; minimum" ) ; } else { sb . append ( " " ) ; sb . append ( serial ) ; sb . append ( " " ) ; sb . append ( refresh ) ; sb . append ( " " ) ; sb . append ( retry ) ; sb . append ( " " ) ; sb . append ( expire ) ; sb . append ( " " ) ; sb . append ( minimum ) ; } return sb . toString ( ) ;
public class ByteIOUtils { /** * Writes a specific integer value ( 4 bytes ) to the output byte array at the given offset . * @ param buf output byte array * @ param pos offset into the byte buffer to write * @ param v int value to write */ public static void writeInt ( byte [ ] buf , int pos , int v ) { } }
checkBoundary ( buf , pos , 4 ) ; buf [ pos ++ ] = ( byte ) ( 0xff & ( v >> 24 ) ) ; buf [ pos ++ ] = ( byte ) ( 0xff & ( v >> 16 ) ) ; buf [ pos ++ ] = ( byte ) ( 0xff & ( v >> 8 ) ) ; buf [ pos ] = ( byte ) ( 0xff & v ) ;
public class GeoPackageJavaProperties { /** * Get a property by key * @ param key * key * @ param required * required flag * @ return property value */ public static synchronized String getProperty ( String key , boolean required ) { } }
if ( mProperties == null ) { mProperties = initializeConfigurationProperties ( ) ; } String value = mProperties . getProperty ( key ) ; if ( value == null && required ) { throw new RuntimeException ( "Property not found: " + key ) ; } return value ;
public class SarlProcessorInstanceForJvmTypeProvider { /** * Filter the type in order to create the correct processor . * @ param type the type of the processor specified into the { @ code @ Active } annotation . * @ param services the type services of the framework . * @ return the real type of the processor to instance . */ public static JvmType filterActiveProcessorType ( JvmType type , CommonTypeComputationServices services ) { } }
if ( AccessorsProcessor . class . getName ( ) . equals ( type . getQualifiedName ( ) ) ) { return services . getTypeReferences ( ) . findDeclaredType ( SarlAccessorsProcessor . class , type ) ; } return type ;
public class Expressions { /** * Create a new Path expression * @ param type type of expression * @ param variable variable name * @ return path expression */ public static < T extends Comparable < ? > > DateTimePath < T > dateTimePath ( Class < ? extends T > type , String variable ) { } }
return new DateTimePath < T > ( type , PathMetadataFactory . forVariable ( variable ) ) ;
public class AbstractListenableFuture { /** * Notify a specific listener of completion . * @ param executor the executor to use . * @ param future the future to hand over . * @ param listener the listener to notify . */ protected void notifyListener ( final ExecutorService executor , final Future < ? > future , final GenericCompletionListener listener ) { } }
executor . submit ( new Runnable ( ) { @ Override public void run ( ) { try { listener . onComplete ( future ) ; } catch ( Throwable t ) { getLogger ( ) . warn ( "Exception thrown wile executing " + listener . getClass ( ) . getName ( ) + ".operationComplete()" , t ) ; } } } ) ;
public class QueryBuilder { /** * Appends given fragment and arguments to this query . */ public @ NotNull QueryBuilder append ( @ NotNull String sql , @ NotNull Collection < ? > args ) { } }
query . append ( requireNonNull ( sql ) ) ; addArguments ( args ) ; return this ;
public class OstrichOwnerGroup { /** * Returns true if the Guava service entered the RUNNING state within the specified time period . */ private boolean awaitRunning ( Service service , long timeoutAt ) { } }
if ( service . isRunning ( ) ) { return true ; } long waitMillis = timeoutAt - System . currentTimeMillis ( ) ; if ( waitMillis <= 0 ) { return false ; } try { service . start ( ) . get ( waitMillis , TimeUnit . MILLISECONDS ) ; } catch ( Exception e ) { // Fall through } return service . isRunning ( ) ;
public class Rc4Utils { /** * Decrypt data bytes using RC4 * @ param data data bytes to be decrypted * @ param key rc4 key ( 40 . . 2048 bits ) * @ return decrypted data bytes */ public static byte [ ] decrypt ( byte [ ] data , byte [ ] key ) { } }
checkNotNull ( data ) ; checkNotNull ( key ) ; checkArgument ( key . length >= 5 && key . length <= 256 ) ; StreamCipher rc4 = new RC4Engine ( ) ; rc4 . init ( false , new KeyParameter ( key ) ) ; byte [ ] decrypted = new byte [ data . length ] ; rc4 . processBytes ( data , 0 , data . length , decrypted , 0 ) ; return decrypted ;
public class GeoDB { /** * Returns any GeoLocation which matches all tests and is unique in deltaNM * range . * @ param deltaNM * @ param searches * @ return */ public GeoLocation search ( double deltaNM , GeoSearch ... searches ) { } }
List < GeoLocation > list = search ( false , searches ) ; if ( ! list . isEmpty ( ) && GeoDB . isUnique ( list , deltaNM ) ) { return list . get ( 0 ) ; } else { list . removeIf ( ( gl ) -> ! gl . match ( true , searches ) ) ; if ( ! list . isEmpty ( ) && GeoDB . isUnique ( list , deltaNM ) ) { return list . get ( 0 ) ; } else { return null ; } }
public class ServerConfiguration { /** * Sets the value for the appropriate key in the { @ link Properties } . * @ param key the key to set * @ param value the value for the key */ public static void set ( PropertyKey key , Object value ) { } }
set ( key , String . valueOf ( value ) , Source . RUNTIME ) ;
public class CmsMailSettings { /** * Adds a new mail host to the internal list of mail hosts with default port 25 . < p > * @ param hostname the name of the mail host * @ param order the order in which the host is tried * @ param protocol the protocol to use ( default " smtp " ) * @ param username the user name to use for authentication * @ param password the password to use for authentication */ public void addMailHost ( String hostname , String order , String protocol , String username , String password ) { } }
addMailHost ( hostname , "25" , order , protocol , null , username , password ) ;
public class StorageBatch { /** * Adds a request representing the " get blob " operation to this batch . The { @ code options } can be * used in the same way as for { @ link Storage # get ( BlobId , BlobGetOption . . . ) } . Calling { @ link * StorageBatchResult # get ( ) } on the return value yields the requested { @ link Blob } if successful , * { @ code null } if no such blob exists , or throws a { @ link StorageException } if the operation * failed . */ public StorageBatchResult < Blob > get ( BlobId blob , BlobGetOption ... options ) { } }
StorageBatchResult < Blob > result = new StorageBatchResult < > ( ) ; RpcBatch . Callback < StorageObject > callback = createGetCallback ( this . options , result ) ; Map < StorageRpc . Option , ? > optionMap = StorageImpl . optionMap ( blob , options ) ; batch . addGet ( blob . toPb ( ) , callback , optionMap ) ; return result ;
public class ParallelUniverseCompat { @ Override public void resetStaticState ( Config config ) { } }
Robolectric . reset ( ) ; if ( ! loggingInitialized ) { ShadowLog . setupLogging ( ) ; loggingInitialized = true ; }
public class CoreV1Api { /** * ( asynchronously ) * connect PUT requests to proxy of Pod * @ param name name of the PodProxyOptions ( required ) * @ param namespace object name and auth scope , such as for teams and projects ( required ) * @ param path Path is the URL path to use for the current proxy request to pod . ( optional ) * @ param callback The callback to be executed when the API call finishes * @ return The request call * @ throws ApiException If fail to process the API call , e . g . serializing the request body object */ public com . squareup . okhttp . Call connectPutNamespacedPodProxyAsync ( String name , String namespace , String path , final ApiCallback < String > callback ) throws ApiException { } }
ProgressResponseBody . ProgressListener progressListener = null ; ProgressRequestBody . ProgressRequestListener progressRequestListener = null ; if ( callback != null ) { progressListener = new ProgressResponseBody . ProgressListener ( ) { @ Override public void update ( long bytesRead , long contentLength , boolean done ) { callback . onDownloadProgress ( bytesRead , contentLength , done ) ; } } ; progressRequestListener = new ProgressRequestBody . ProgressRequestListener ( ) { @ Override public void onRequestProgress ( long bytesWritten , long contentLength , boolean done ) { callback . onUploadProgress ( bytesWritten , contentLength , done ) ; } } ; } com . squareup . okhttp . Call call = connectPutNamespacedPodProxyValidateBeforeCall ( name , namespace , path , progressListener , progressRequestListener ) ; Type localVarReturnType = new TypeToken < String > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ;
public class DebugHelper { /** * When in debugging mode , adds a border to the image and calls { @ link VectorPrintDocument # addHook ( com . vectorprint . report . itext . VectorPrintDocument . AddElementHook ) * } to be able to print debugging info and link for the image * @ param canvas * @ param img * @ param bordercolor * @ param styleClass * @ param extraInfo * @ param settings * @ param layerAware * @ param document */ public static void debugImage ( PdfContentByte canvas , Image img , Color bordercolor , String styleClass , String extraInfo , EnhancedMap settings , LayerManager layerAware , VectorPrintDocument document ) { } }
if ( null != img ) { img . setBorder ( Rectangle . BOX ) ; img . setBorderWidth ( 0.3f ) ; img . setBorderColor ( itextHelper . fromColor ( bordercolor ) ) ; if ( styleClass == null ) { log . warning ( "not showing link to styleClass because there is no styleClass" ) ; return ; } img . setAnnotation ( new Annotation ( DEBUG , "click for link to styleClass information (" + styleClass + extraInfo + ")" ) ) ; document . addHook ( new VectorPrintDocument . AddElementHook ( VectorPrintDocument . AddElementHook . INTENTION . DEBUGIMAGE , img , null , styleClass ) ) ; }
import java . io . * ; import java . lang . * ; class SumSquaresOddNumbers { /** * The function calculates the sum of squares of the first ' order ' odd natural numbers . * Args : * order : The number of first odd natural numbers to consider * Returns : * An integer value sum of squares of the first ' order ' odd natural numbers * Examples : * > > > sumSquaresOddNumbers ( 2) * 10 * > > > sumSquaresOddNumbers ( 3) * 35 * > > > sumSquaresOddNumbers ( 4) * 84 */ public static int sumSquaresOddNumbers ( int order ) { } }
return ( order * ( ( 4 * order * order ) - 1 ) ) / 3 ;
public class FastAdapter { /** * deselects an item and removes its position in the selections list * also takes an iterator to remove items from the map * @ param position the global position * @ param entries the iterator which is used to deselect all * @ deprecated deprecated in favor of { @ link SelectExtension # deselect ( int , Iterator ) } , Retrieve it via { @ link # getExtension ( Class ) } */ @ Deprecated public void deselect ( int position , Iterator < Integer > entries ) { } }
mSelectExtension . deselect ( position , entries ) ;
public class WebStatFilter { /** * < p > getRemoteAddress . < / p > * @ param request a { @ link javax . ws . rs . container . ContainerRequestContext } object . * @ return a { @ link java . lang . String } object . */ protected String getRemoteAddress ( ContainerRequestContext request ) { } }
String ip = null ; if ( realIpHeader != null && realIpHeader . length ( ) != 0 ) { ip = request . getHeaderString ( realIpHeader ) ; } if ( StringUtils . isBlank ( ip ) ) { ip = request . getHeaderString ( "x-forwarded-for" ) ; if ( StringUtils . isBlank ( ip ) || "unknown" . equalsIgnoreCase ( ip ) ) { ip = request . getHeaderString ( "Proxy-Client-IP" ) ; } if ( StringUtils . isBlank ( ip ) || "unknown" . equalsIgnoreCase ( ip ) ) { ip = request . getHeaderString ( "WL-Proxy-Client-IP" ) ; } if ( StringUtils . isBlank ( ip ) || "unknown" . equalsIgnoreCase ( ip ) ) { ip = "unknown" ; } } return ip ;
public class ValueFileIOHelper { /** * Write streamed value to a file . * @ param file * File * @ param value * ValueData * @ return size of wrote content * @ throws IOException * if error occurs */ protected long writeStreamedValue ( File file , ValueData value ) throws IOException { } }
long size ; // stream Value if ( value instanceof StreamPersistedValueData ) { StreamPersistedValueData streamed = ( StreamPersistedValueData ) value ; if ( streamed . isPersisted ( ) ) { // already persisted in another Value , copy it to this Value size = copyClose ( streamed . getAsStream ( ) , new FileOutputStream ( file ) ) ; } else { // the Value not yet persisted , i . e . or in client stream or spooled to a temp file File tempFile ; if ( ( tempFile = streamed . getTempFile ( ) ) != null ) { // it ' s spooled Value , try move its file to VS if ( ! tempFile . renameTo ( file ) ) { // not succeeded - copy bytes , temp file will be deleted by transient ValueData if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Value spool file move (rename) to Values Storage is not succeeded. " + "Trying bytes copy. Spool file: " + tempFile . getAbsolutePath ( ) + ". Destination: " + file . getAbsolutePath ( ) ) ; } size = copyClose ( new FileInputStream ( tempFile ) , new FileOutputStream ( file ) ) ; } else { size = file . length ( ) ; } } else { // not spooled , use client InputStream size = copyClose ( streamed . getStream ( ) , new FileOutputStream ( file ) ) ; } // link this Value to file in VS streamed . setPersistedFile ( file ) ; } } else { // copy from Value stream to the file , e . g . from FilePersistedValueData to this Value size = copyClose ( value . getAsStream ( ) , new FileOutputStream ( file ) ) ; } return size ;
public class DeleteScheduledActionRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteScheduledActionRequest deleteScheduledActionRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteScheduledActionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteScheduledActionRequest . getServiceNamespace ( ) , SERVICENAMESPACE_BINDING ) ; protocolMarshaller . marshall ( deleteScheduledActionRequest . getScheduledActionName ( ) , SCHEDULEDACTIONNAME_BINDING ) ; protocolMarshaller . marshall ( deleteScheduledActionRequest . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( deleteScheduledActionRequest . getScalableDimension ( ) , SCALABLEDIMENSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CppUtil { /** * Uppercase the first character of a given String . * @ param str to have the first character upper cased . * @ return a new String with the first character in uppercase . */ public static String toUpperFirstChar ( final String str ) { } }
return Character . toUpperCase ( str . charAt ( 0 ) ) + str . substring ( 1 ) ;
public class CmsExportPointDriver { /** * Writes file data to the RFS . < p > * @ param file the RFS file location * @ param content the file content */ protected void writeResource ( File file , byte [ ] content ) { } }
try { File folder ; if ( content == null ) { // a folder is to be created folder = file ; } else { // a file is to be written folder = file . getParentFile ( ) ; } // make sure the parent folder exists if ( ! folder . exists ( ) ) { boolean success = folder . mkdirs ( ) ; if ( ! success ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_CREATE_FOLDER_FAILED_1 , folder . getAbsolutePath ( ) ) ) ; } } if ( content != null ) { // now write the file to the real file system OutputStream s = new FileOutputStream ( file ) ; s . write ( content ) ; s . close ( ) ; } } catch ( Exception e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_WRITE_EXPORT_POINT_FAILED_1 , file . getAbsolutePath ( ) ) , e ) ; }
public class ServerSentEventService { /** * Closes all connections for a given URI resource * @ param uri The URI resource for the connection */ public void close ( String uri ) { } }
Objects . requireNonNull ( uri , Required . URI . toString ( ) ) ; final Set < ServerSentEventConnection > uriConnections = getConnections ( uri ) ; if ( uriConnections != null ) { uriConnections . forEach ( ( ServerSentEventConnection connection ) -> { if ( connection . isOpen ( ) ) { MangooUtils . closeQuietly ( connection ) ; } } ) ; removeConnections ( uri ) ; }
public class DubiousListCollection { /** * overrides the visitor to record all method calls on List fields . If a method * is not a set based method , remove it from further consideration * @ param seen the current opcode parsed . */ @ Override public void sawOpcode ( final int seen ) { } }
try { stack . precomputation ( this ) ; if ( seen == Const . INVOKEINTERFACE ) { processInvokeInterface ( ) ; } else if ( seen == Const . INVOKEVIRTUAL ) { processInvokeVirtual ( ) ; } else if ( ( seen == Const . ARETURN ) && ( stack . getStackDepth ( ) > 0 ) ) { OpcodeStack . Item item = stack . getStackItem ( 0 ) ; XField field = item . getXField ( ) ; if ( field != null ) { String fieldName = field . getName ( ) ; fieldsReported . remove ( fieldName ) ; if ( fieldsReported . isEmpty ( ) ) { throw new StopOpcodeParsingException ( ) ; } } } } finally { stack . sawOpcode ( this , seen ) ; }
public class DiagnosticOrder { /** * syntactic sugar */ public DiagnosticOrder addEvent ( DiagnosticOrderEventComponent t ) { } }
if ( t == null ) return this ; if ( this . event == null ) this . event = new ArrayList < DiagnosticOrderEventComponent > ( ) ; this . event . add ( t ) ; return this ;
public class ErrorStatsServiceClient { /** * Lists the specified events . * < p > Sample code : * < pre > < code > * try ( ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient . create ( ) ) { * ProjectName projectName = ProjectName . of ( " [ PROJECT ] " ) ; * String groupId = " " ; * for ( ErrorEvent element : errorStatsServiceClient . listEvents ( projectName , groupId ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param projectName [ Required ] The resource name of the Google Cloud Platform project . Written * as ` projects / ` plus the [ Google Cloud Platform project * ID ] ( https : / / support . google . com / cloud / answer / 6158840 ) . Example : ` projects / my - project - 123 ` . * @ param groupId [ Required ] The group for which events shall be returned . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final ListEventsPagedResponse listEvents ( ProjectName projectName , String groupId ) { } }
ListEventsRequest request = ListEventsRequest . newBuilder ( ) . setProjectName ( projectName == null ? null : projectName . toString ( ) ) . setGroupId ( groupId ) . build ( ) ; return listEvents ( request ) ;
public class JsonArray { /** * see { @ link List # add ( Object ) } . * this method is alternative of { @ link # add ( Object , Type ) } call with { @ link Type # BOOLEAN } . * @ param value * @ return see { @ link List # add ( Object ) } * @ since 1.4.12 * @ author vvakame */ public boolean add ( Boolean value ) { } }
if ( value == null ) { stateList . add ( Type . NULL ) ; } else { stateList . add ( Type . BOOLEAN ) ; } return super . add ( value ) ;
public class UcsApi { /** * Assign the interaction to a contact * @ param id id of the Interaction ( required ) * @ param assignInteractionToContactData ( required ) * @ 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 > assignInteractionToContactWithHttpInfo ( String id , AssignInteractionToContactData assignInteractionToContactData ) throws ApiException { } }
com . squareup . okhttp . Call call = assignInteractionToContactValidateBeforeCall ( id , assignInteractionToContactData , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class CodedOutputStream { /** * Write a { @ code string } field to the stream . */ public void writeStringNoTag ( final String value ) throws IOException { } }
// Unfortunately there does not appear to be any way to tell Java to encode // UTF - 8 directly into our buffer , so we have to let it create its own byte // array and then copy . final byte [ ] bytes = value . getBytes ( "UTF-8" ) ; writeRawVarint32 ( bytes . length ) ; writeRawBytes ( bytes ) ;
public class Matrix4d { /** * Pre - multiply a translation to this matrix by translating by the given number of * units in x , y and z and store the result in < code > dest < / code > . * If < code > M < / code > is < code > this < / code > matrix and < code > T < / code > the translation * matrix , then the new matrix will be < code > T * M < / code > . So when * transforming a vector < code > v < / code > with the new matrix by using * < code > T * M * v < / code > , the translation will be applied last ! * In order to set the matrix to a translation transformation without pre - multiplying * it , use { @ link # translation ( double , double , double ) } . * @ see # translation ( double , double , double ) * @ param x * the offset to translate in x * @ param y * the offset to translate in y * @ param z * the offset to translate in z * @ param dest * will hold the result * @ return dest */ public Matrix4d translateLocal ( double x , double y , double z , Matrix4d dest ) { } }
if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . translation ( x , y , z ) ; return translateLocalGeneric ( x , y , z , dest ) ;
public class RoleAliasDescriptionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RoleAliasDescription roleAliasDescription , ProtocolMarshaller protocolMarshaller ) { } }
if ( roleAliasDescription == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( roleAliasDescription . getRoleAlias ( ) , ROLEALIAS_BINDING ) ; protocolMarshaller . marshall ( roleAliasDescription . getRoleAliasArn ( ) , ROLEALIASARN_BINDING ) ; protocolMarshaller . marshall ( roleAliasDescription . getRoleArn ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( roleAliasDescription . getOwner ( ) , OWNER_BINDING ) ; protocolMarshaller . marshall ( roleAliasDescription . getCredentialDurationSeconds ( ) , CREDENTIALDURATIONSECONDS_BINDING ) ; protocolMarshaller . marshall ( roleAliasDescription . getCreationDate ( ) , CREATIONDATE_BINDING ) ; protocolMarshaller . marshall ( roleAliasDescription . getLastModifiedDate ( ) , LASTMODIFIEDDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DeleteRuleGroupRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteRuleGroupRequest deleteRuleGroupRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteRuleGroupRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteRuleGroupRequest . getRuleGroupId ( ) , RULEGROUPID_BINDING ) ; protocolMarshaller . marshall ( deleteRuleGroupRequest . getChangeToken ( ) , CHANGETOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SpiFactory { /** * Create new SpiDevice instance * @ param channel * spi channel to use * @ param mode * spi mode ( see http : / / en . wikipedia . org / wiki / Serial _ Peripheral _ Interface _ Bus # Mode _ numbers ) * @ return Return a new SpiDevice impl instance . * @ throws java . io . IOException */ public static SpiDevice getInstance ( SpiChannel channel , SpiMode mode ) throws IOException { } }
return new SpiDeviceImpl ( channel , mode ) ;
public class TemplateElasticsearchUpdater { /** * Create a new template in Elasticsearch * @ param client Elasticsearch client * @ param template Template name * @ param json JSon content for the template * @ param force set it to true if you want to force cleaning template before adding it * @ throws Exception if something goes wrong */ public static void createTemplateWithJson ( RestClient client , String template , String json , boolean force ) throws Exception { } }
if ( isTemplateExist ( client , template ) ) { if ( force ) { logger . debug ( "Template [{}] already exists. Force is set. Removing it." , template ) ; removeTemplate ( client , template ) ; } else { logger . debug ( "Template [{}] already exists." , template ) ; } } if ( ! isTemplateExist ( client , template ) ) { logger . debug ( "Template [{}] doesn't exist. Creating it." , template ) ; createTemplateWithJsonInElasticsearch ( client , template , json ) ; }
public class NavigationPreference { /** * Obtains the color state list to tint the preference ' s icon from a specific typed array . * @ param typedArray * The typed array , the color state list should be obtained from , as an instance of the * class { @ link TypedArray } . The typed array may not be null */ private void obtainTint ( @ NonNull final TypedArray typedArray ) { } }
setIconTintList ( typedArray . getColorStateList ( R . styleable . NavigationPreference_android_tint ) ) ;
public class DocumentCrossValidationIterator { /** * Shuffles the elements of this list among several smaller lists . * @ param fraction * A list of numbers ( not necessarily summing to 1 ) which , when * normalized , correspond to the proportion of elements in each * returned sublist . This method ( and all the split methods ) do * not transfer the Instance weights to the resulting * InstanceLists . * @ param r * The source of randomness to use in shuffling . * @ return one < code > InstanceList < / code > for each element of * < code > proportions < / code > */ public InstanceList [ ] split ( java . util . Random r , int _nfolds ) { } }
List < Integer > articleIds = newArrayList ( instanceArticles . keySet ( ) ) ; Collections . shuffle ( articleIds , r ) ; final int nrSentences = instanceArticles . size ( ) ; final int nrSentencesPerSplit = ( int ) ( nrSentences / ( double ) _nfolds ) ; int runningSplitId = 0 ; int runningSentencesPerSplit = 0 ; InstanceList [ ] splitted = new InstanceList [ _nfolds ] ; for ( int i = 0 ; i < splitted . length ; i ++ ) { splitted [ i ] = new InstanceList ( pipe ) ; } for ( int i = 0 ; i < articleIds . size ( ) ; i ++ ) { // add all sentences from this article for ( Instance sentence : instanceArticles . get ( articleIds . get ( i ) ) ) { // System . out . println ( format ( " adding { } to split { } " , // sentence . name , runningSplitId ) ) ; splitted [ runningSplitId ] . add ( sentence ) ; runningSentencesPerSplit ++ ; } // move to next split ? if ( runningSentencesPerSplit > nrSentencesPerSplit && runningSplitId < ( _nfolds - 1 ) ) { runningSplitId ++ ; runningSentencesPerSplit -= nrSentencesPerSplit ; } } // some stats LOG . debug ( "{} sentences in {} splits" , nrSentences , _nfolds ) ; for ( InstanceList iList : splitted ) { LOG . debug ( "size:: " + iList . size ( ) ) ; } return splitted ;
public class SendingEntityBody { /** * Increment the next expected sequence number and trigger the pipelining logic . * @ param outboundResponseMsg Represent the outbound response */ private void triggerPipeliningLogic ( HttpCarbonMessage outboundResponseMsg ) { } }
String httpVersion = ( String ) inboundRequestMsg . getProperty ( Constants . HTTP_VERSION ) ; if ( outboundResponseMsg . isPipeliningEnabled ( ) && Constants . HTTP_1_1_VERSION . equalsIgnoreCase ( httpVersion ) ) { Queue responseQueue ; synchronized ( sourceContext . channel ( ) . attr ( Constants . RESPONSE_QUEUE ) . get ( ) ) { responseQueue = sourceContext . channel ( ) . attr ( Constants . RESPONSE_QUEUE ) . get ( ) ; Long nextSequenceNumber = sourceContext . channel ( ) . attr ( Constants . NEXT_SEQUENCE_NUMBER ) . get ( ) ; // IMPORTANT : Next sequence number should never be incremented for interim 100 continue response // because the body of the request is yet to come . Only when the actual response is sent out , this // next sequence number should be updated . nextSequenceNumber ++ ; sourceContext . channel ( ) . attr ( Constants . NEXT_SEQUENCE_NUMBER ) . set ( nextSequenceNumber ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Current sequence id of the response : {}" , outboundResponseMsg . getSequenceId ( ) ) ; LOG . debug ( "Updated next sequence id to : {}" , nextSequenceNumber ) ; } } if ( ! responseQueue . isEmpty ( ) ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Pipelining logic is triggered from transport" ) ; } // Notify ballerina to send the response which is next in queue . This is needed because , // if the other responses got ready before the nextSequenceNumber gets updated then the // ballerina respond ( ) won ' t start serializing the responses in queue . This is to trigger // that process again . if ( outboundResponseMsg . getPipeliningFuture ( ) != null ) { EventExecutorGroup pipeliningExecutor = sourceContext . channel ( ) . attr ( Constants . PIPELINING_EXECUTOR ) . get ( ) ; // IMPORTANT : Pipelining logic should never be executed in an I / O thread as it might lead to I / O // thread blocking scenarios in outbound trottling . Here , the pipelining logic runs in a thread that // belongs to the pipelining thread pool . pipeliningExecutor . execute ( ( ) -> outboundResponseMsg . getPipeliningFuture ( ) . notifyPipeliningListener ( sourceContext ) ) ; } } }
public class Converters { /** * 获取属性设置属性 * @ param clazz * @ param field * @ return */ private static < T > Method tryGetSetMethod ( Class < T > clazz , Field field , String methodName ) { } }
try { return clazz . getDeclaredMethod ( methodName , field . getType ( ) ) ; } catch ( Exception e ) { return null ; }
public class Util { /** * Mix multiple hashcodes into one . * @ param hash1 First hashcode to mix * @ param hash2 Second hashcode to mix * @ param hash3 Third hashcode to mix * @ return Mixed hash code */ public static int mixHashCodes ( int hash1 , int hash2 , int hash3 ) { } }
long result = hash1 * HASHPRIME + hash2 ; return ( int ) ( result * HASHPRIME + hash3 ) ;
public class Net { /** * Drop membership of IPv6 multicast group */ static void drop6 ( FileDescriptor fd , byte [ ] group , int index , byte [ ] source ) throws IOException { } }
joinOrDrop6 ( false , fd , group , index , source ) ;
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public String convertGBARFLAGSToString ( EDataType eDataType , Object instanceValue ) { } }
return instanceValue == null ? null : instanceValue . toString ( ) ;
public class AggregateEventAnalysisEngine { /** * Determines the time between the { @ link Event } at the head of the queue and the * { @ link Event } at the tail of the queue . * @ param queue a queue of { @ link Event } s * @ param tailEvent the { @ link Event } at the tail of the queue * @ return the duration of the queue as an { @ link Interval } */ public Interval getQueueInterval ( Queue < Event > queue , Event tailEvent ) { } }
DateTime endTime = DateUtils . fromString ( tailEvent . getTimestamp ( ) ) ; DateTime startTime = DateUtils . fromString ( queue . peek ( ) . getTimestamp ( ) ) ; return new Interval ( ( int ) endTime . minus ( startTime . getMillis ( ) ) . getMillis ( ) , "milliseconds" ) ;
public class TranslationsResourceIT { /** * Checks the outdated scenario . * 1 ) A key is added * 2 ) Add fr translation * 3 ) Update default translation = > key become outdated * 4 ) Update en translation = > key is still outdated * 5 ) Update fr translation = > key is no longer outdated */ @ Test public void outdated_scenario ( ) throws JSONException { } }
httpPost ( "keys" , jsonKey . toString ( ) , 201 ) ; try { // Add two outdated translations sendTranslationUpdate ( "zztranslation" , EN , true ) ; sendTranslationUpdate ( "translation" , FR , true ) ; // Update the default translation jsonKey . put ( "translation" , "updated translation" ) ; httpPut ( "keys/" + keyName , jsonKey . toString ( ) , 200 ) ; // The key should remain outdated assertOutdatedStatus ( true ) ; // Update English translations sendTranslationUpdate ( "updated translation" , EN , false ) ; // The key should remain outdated assertOutdatedStatus ( true ) ; // Update French translations sendTranslationUpdate ( "updated translation" , FR , false ) ; // Now , all the translation have been updated assertOutdatedStatus ( false ) ; } finally { // clean the repo httpDelete ( "keys/" + keyName , 204 ) ; }
public class JmsDestinationImpl { /** * Utility method update a property . * Checks that the value is different to the existing value and clears the cache if necessary . * Needs package / protected access as also used by subclasses ( in the same package ) . * @ param key The name of the property * @ param value The new value */ protected void updateProperty ( String key , Object value ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "updateProperty" , new Object [ ] { key , value } ) ; // check the value is different to the existing one if ( isDifferent ( key , value ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "new value for " + key + ": " + value ) ; // clear the cached encodings clearCachedEncodings ( ) ; if ( value == null ) { properties . remove ( key ) ; } else { // put new value properties . put ( key , value ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "value for " + key + " same as existing" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "updateProperty" ) ;
public class ForwardingRuleClient { /** * Retrieves an aggregated list of forwarding rules . * < p > Sample code : * < pre > < code > * try ( ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient . create ( ) ) { * ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ; * for ( ForwardingRulesScopedList element : forwardingRuleClient . aggregatedListForwardingRules ( project . toString ( ) ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param project Project ID for this request . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final AggregatedListForwardingRulesPagedResponse aggregatedListForwardingRules ( String project ) { } }
AggregatedListForwardingRulesHttpRequest request = AggregatedListForwardingRulesHttpRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return aggregatedListForwardingRules ( request ) ;
public class OrganizationResourceImpl { /** * Does the same thing as getClientVersion ( ) but accepts the ' hasPermission ' param , * which lets callers dictate whether the user has clientView permission for the org . * @ param organizationId * @ param clientId * @ param version * @ param hasPermission */ protected ClientVersionBean getClientVersionInternal ( String organizationId , String clientId , String version , boolean hasPermission ) { } }
try { storage . beginTx ( ) ; ClientVersionBean clientVersion = storage . getClientVersion ( organizationId , clientId , version ) ; if ( clientVersion == null ) { throw ExceptionFactory . clientVersionNotFoundException ( clientId , version ) ; } // Hide some data if the user doesn ' t have the clientView permission if ( ! hasPermission ) { clientVersion . setApikey ( null ) ; } storage . commitTx ( ) ; log . debug ( String . format ( "Got new client version %s: %s" , clientVersion . getClient ( ) . getName ( ) , clientVersion ) ) ; // $ NON - NLS - 1 $ return clientVersion ; } catch ( AbstractRestException e ) { storage . rollbackTx ( ) ; throw e ; } catch ( Exception e ) { storage . rollbackTx ( ) ; throw new SystemErrorException ( e ) ; }
public class Aggregations { /** * Returns an aggregation to calculate the integer sum of all supplied values . < br / > * This aggregation is similar to : < pre > SELECT SUM ( value ) FROM x < / pre > * @ param < Key > the input key type * @ param < Value > the supplied value type * @ return the sum over all supplied values */ public static < Key , Value > Aggregation < Key , Integer , Integer > integerSum ( ) { } }
return new AggregationAdapter ( new IntegerSumAggregation < Key , Value > ( ) ) ;
public class User { /** * Activates a user if a given token matches the one stored . * @ param token the email confirmation token . see { @ link # generateEmailConfirmationToken ( ) } * @ return true if successful */ public final boolean activateWithEmailToken ( String token ) { } }
Sysprop s = CoreUtils . getInstance ( ) . getDao ( ) . read ( getAppid ( ) , identifier ) ; if ( isValidToken ( s , Config . _EMAIL_TOKEN , token ) ) { s . removeProperty ( Config . _EMAIL_TOKEN ) ; CoreUtils . getInstance ( ) . getDao ( ) . update ( getAppid ( ) , s ) ; setActive ( true ) ; update ( ) ; return true ; } return false ;
public class DigitPickerPreference { /** * Obtains the number of digits of the numbers , the preference allows to choose , from a specific * typed array . * @ param typedArray * The typed array , the number of digits should be obtained from , as an instance of the * class { @ link TypedArray } . The typed array may not be null */ private void obtainNumberOfDigits ( @ NonNull final TypedArray typedArray ) { } }
int defaultValue = getContext ( ) . getResources ( ) . getInteger ( R . integer . digit_picker_preference_default_number_of_digits ) ; setNumberOfDigits ( typedArray . getInteger ( R . styleable . DigitPickerPreference_numberOfDigits , defaultValue ) ) ;
public class ApiOvhPrice { /** * Get the monthly price for an office license * REST : GET / price / license / office / { officeName } * @ param officeName [ required ] Office */ public OvhPrice license_office_officeName_GET ( net . minidev . ovh . api . price . license . OvhOfficeEnum officeName ) throws IOException { } }
String qPath = "/price/license/office/{officeName}" ; StringBuilder sb = path ( qPath , officeName ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhPrice . class ) ;
public class CmsHtmlConverterJTidy { /** * Converts the given HTML code according to the settings of this converter . < p > * @ param htmlInput HTML input stored in a string * @ return string containing the converted HTML * @ throws UnsupportedEncodingException if the encoding set for the conversion is not supported */ @ Override public String convertToString ( String htmlInput ) throws UnsupportedEncodingException { } }
// initialize the modes initModes ( ) ; // only do parsing if the mode is not set to disabled if ( m_modeEnabled ) { // do a maximum of 10 loops int max = m_modeWord ? 10 : 1 ; int count = 0 ; // we may have to do several parsing runs until all tags are removed int oldSize = htmlInput . length ( ) ; String workHtml = regExp ( htmlInput ) ; while ( count < max ) { count ++ ; // first add the optional header if in word mode if ( m_modeWord ) { workHtml = adjustHtml ( workHtml ) ; } // now use tidy to parse and format the HTML workHtml = parse ( workHtml ) ; if ( m_modeWord ) { // cut off the line separator , which is always appended workHtml = workHtml . substring ( 0 , workHtml . length ( ) - m_lineSeparatorLength ) ; } if ( workHtml . length ( ) == oldSize ) { // no change in HTML code after last processing loop workHtml = regExp ( workHtml ) ; break ; } oldSize = workHtml . length ( ) ; workHtml = regExp ( workHtml ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_PARSING_RUNS_2 , this . getClass ( ) . getName ( ) , new Integer ( count ) ) ) ; } htmlInput = workHtml ; } return htmlInput ;
public class Credential { /** * { @ inheritDoc } * Default implementation checks if { @ code WWW - Authenticate } exists and contains a " Bearer " value * ( see < a href = " http : / / tools . ietf . org / html / rfc6750 # section - 3.1 " > rfc6750 section 3.1 < / a > for more * details ) . If so , it calls { @ link # refreshToken } in case the error code contains * { @ code invalid _ token } . If there is no " Bearer " in { @ code WWW - Authenticate } and the status code * is { @ link HttpStatusCodes # STATUS _ CODE _ UNAUTHORIZED } it calls { @ link # refreshToken } . If * { @ link # executeRefreshToken ( ) } throws an I / O exception , this implementation will log the * exception and return { @ code false } . Subclasses may override . */ public boolean handleResponse ( HttpRequest request , HttpResponse response , boolean supportsRetry ) { } }
boolean refreshToken = false ; boolean bearer = false ; List < String > authenticateList = response . getHeaders ( ) . getAuthenticateAsList ( ) ; // TODO ( peleyal ) : this logic should be implemented as a pluggable interface , in the same way we // implement different AccessMethods // if authenticate list is not null we will check if one of the entries contains " Bearer " if ( authenticateList != null ) { for ( String authenticate : authenticateList ) { if ( authenticate . startsWith ( BearerToken . AuthorizationHeaderAccessMethod . HEADER_PREFIX ) ) { // mark that we found a " Bearer " value , and check if there is a invalid _ token error bearer = true ; refreshToken = BearerToken . INVALID_TOKEN_ERROR . matcher ( authenticate ) . find ( ) ; break ; } } } // if " Bearer " wasn ' t found , we will refresh the token , if we got 401 if ( ! bearer ) { refreshToken = response . getStatusCode ( ) == HttpStatusCodes . STATUS_CODE_UNAUTHORIZED ; } if ( refreshToken ) { try { lock . lock ( ) ; try { // need to check if another thread has already refreshed the token return ! Objects . equal ( accessToken , method . getAccessTokenFromRequest ( request ) ) || refreshToken ( ) ; } finally { lock . unlock ( ) ; } } catch ( IOException exception ) { LOGGER . log ( Level . SEVERE , "unable to refresh token" , exception ) ; } } return false ;
public class CacheControl { /** * This creates a cache control hint for the specified path * @ param path the path to the field that has the cache control hint * @ param scope the scope of the cache control hint * @ return this object builder style */ public CacheControl hint ( ExecutionPath path , Scope scope ) { } }
return hint ( path , null , scope ) ;