signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class MockServerClient { /** * Bind new ports to listen on */ public List < Integer > bind ( Integer ... ports ) { } }
String boundPorts = sendRequest ( request ( ) . withMethod ( "PUT" ) . withPath ( calculatePath ( "bind" ) ) . withBody ( portBindingSerializer . serialize ( portBinding ( ports ) ) , StandardCharsets . UTF_8 ) ) . getBodyAsString ( ) ; return portBindingSerializer . deserialize ( boundPorts ) . getPorts ( ) ;
public class Matrix4d { /** * Apply rotation of < code > angles . z < / code > radians about the Z axis , followed by a rotation of < code > angles . y < / code > radians about the Y axis and * followed by a rotation of < code > angles . x < / code > radians about the X axis . * When used with a right - handed coordinate system , the produced rotation will rotate a vector * counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin . * When used with a left - handed coordinate system , the rotation is clockwise . * If < code > M < / code > is < code > this < / code > matrix and < code > R < / code > the rotation matrix , * then the new matrix will be < code > M * R < / code > . So when transforming a * vector < code > v < / code > with the new matrix by using < code > M * R * v < / code > , the * rotation will be applied first ! * This method is equivalent to calling : < code > rotateZ ( angles . z ) . rotateY ( angles . y ) . rotateX ( angles . x ) < / code > * @ param angles * the Euler angles * @ return this */ public Matrix4d rotateZYX ( Vector3d angles ) { } }
return rotateZYX ( angles . z , angles . y , angles . x ) ;
public class RemoteFieldTable { /** * I ' m done with the model , free the resources . */ public void free ( ) { } }
try { if ( m_tableRemote != null ) m_tableRemote . freeRemoteSession ( ) ; } catch ( RemoteException ex ) { ex . printStackTrace ( ) ; } m_tableRemote = null ; super . free ( ) ;
public class DomXmlEnsure { /** * Ensure that the nodeList is either null or empty . * @ param nodeList the nodeList to ensure to be either null or empty * @ param expression the expression was used to fine the nodeList * @ throws SpinXPathException if the nodeList is either null or empty */ public static void ensureXPathNotEmpty ( NodeList nodeList , String expression ) { } }
if ( nodeList == null || nodeList . getLength ( ) == 0 ) { throw LOG . unableToFindXPathExpression ( expression ) ; }
public class Quaternionf { /** * / * ( non - Javadoc ) * @ see org . joml . Quaternionfc # positiveZ ( org . joml . Vector3f ) */ public Vector3f positiveZ ( Vector3f dir ) { } }
float invNorm = 1.0f / ( x * x + y * y + z * z + w * w ) ; float nx = - x * invNorm ; float ny = - y * invNorm ; float nz = - z * invNorm ; float nw = w * invNorm ; float dx = nx + nx ; float dy = ny + ny ; float dz = nz + nz ; dir . x = nx * dz + nw * dy ; dir . y = ny * dz - nw * dx ; dir . z = - nx * dx - ny * dy + 1.0f ; return dir ;
public class NativeLoader { /** * Determine the right linux library depending on the architecture . * @ param library The library name . * @ param osName The operating system name . * @ param osArch The system architecture . * @ return The library resource . * @ throws UnsupportedOperationException Throw an exception if no native library for this platform * was found . */ private static String determineLinuxLibrary ( final String library , final String osName , final String osArch ) { } }
String resourceName ; String platform = null ; String fileExtension = "so" ; switch ( osArch ) { case ARCH_AMD64 : case ARCH_X86_64 : platform = "linux-x64" ; break ; case ARCH_ARM : platform = "linux-armhf32" ; break ; case ARCH_AARCH64 : platform = "linux-aarch64" ; break ; default : unsupportedPlatform ( osName , osArch ) ; } resourceName = "/" + platform + "/" + library + "." + fileExtension ; return resourceName ;
public class ReadableWrappersImpl { /** * Converts the List to PagedList . * @ param list list to be converted in to paged list * @ param < InnerT > the wrapper inner type * @ return the Paged list for the inner type . */ public static < InnerT > PagedList < InnerT > convertToPagedList ( List < InnerT > list ) { } }
PageImpl < InnerT > page = new PageImpl < > ( ) ; page . setItems ( list ) ; page . setNextPageLink ( null ) ; return new PagedList < InnerT > ( page ) { @ Override public Page < InnerT > nextPage ( String nextPageLink ) { return null ; } } ;
public class HSMDependenceMeasure { /** * Count the number of cells above the threshold . * @ param mat Matrix * @ param threshold Threshold * @ return Number of elements above the threshold . */ private int countAboveThreshold ( int [ ] [ ] mat , double threshold ) { } }
int ret = 0 ; for ( int i = 0 ; i < mat . length ; i ++ ) { int [ ] row = mat [ i ] ; for ( int j = 0 ; j < row . length ; j ++ ) { if ( row [ j ] >= threshold ) { ret ++ ; } } } return ret ;
public class BeanCodeGen { /** * Main method . * This calls { @ code System . exit } . * @ param args the arguments , not null */ public static void main ( String [ ] args ) { } }
BeanCodeGen gen ; try { gen = createFromArgs ( args ) ; } catch ( RuntimeException ex ) { System . out . println ( ex . getMessage ( ) ) ; System . out . println ( "" ) ; System . out . println ( "Code generator" ) ; System . out . println ( " Usage java org.joda.beans.gen.BeanCodeGen [file]" ) ; System . out . println ( " Options" ) ; System . out . println ( " -R process all files recursively, default false" ) ; System . out . println ( " -indent=tab use a tab for indenting, default 4 spaces" ) ; System . out . println ( " -indent=[n] use n spaces for indenting, default 4" ) ; System . out . println ( " -prefix=[p] field prefix of p should be removed, no default" ) ; System . out . println ( " -config=[f] config file: 'jdk'/'guava', default guava" ) ; System . out . println ( " -style=[s] default bean style: 'light'/'minimal'/'full', default smart" ) ; System . out . println ( " -verbose=[v] output logging with verbosity from 0 to 3, default 1" ) ; System . out . println ( " -nowrite output messages rather than writing, default is to write" ) ; System . exit ( 0 ) ; throw new InternalError ( "Unreachable" ) ; } try { int changed = gen . process ( ) ; System . out . println ( "Finished, found " + changed + " changed files" ) ; System . exit ( 0 ) ; } catch ( Exception ex ) { System . out . println ( ) ; ex . printStackTrace ( System . out ) ; System . exit ( 1 ) ; }
public class VarOptItemsSketch { /** * Returns a copy of the items ( no weights ) in the sketch as members of Class < em > clazz < / em > , * or null if empty . The returned array length may be smaller than the total capacity . * < p > This method allocates an array of class < em > clazz < / em > , which must either match or * extend T . This method should be used when objects in the array are all instances of T but * are not necessarily instances of the base class . < / p > * @ param clazz A class to which the items are cast before returning * @ return A copy of the sample array */ @ SuppressWarnings ( "unchecked" ) private T [ ] getDataSamples ( final Class < ? > clazz ) { } }
assert ( h_ + r_ ) > 0 ; // are 2 Array . asList ( data _ . subList ( ) ) copies better ? final T [ ] prunedList = ( T [ ] ) Array . newInstance ( clazz , getNumSamples ( ) ) ; int i = 0 ; for ( T item : data_ ) { if ( item != null ) { prunedList [ i ++ ] = item ; } } return prunedList ;
public class DomainConfigurationMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DomainConfiguration domainConfiguration , ProtocolMarshaller protocolMarshaller ) { } }
if ( domainConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( domainConfiguration . getWorkflowExecutionRetentionPeriodInDays ( ) , WORKFLOWEXECUTIONRETENTIONPERIODINDAYS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class HttpMessage { /** * Returns the names of the parameters of the given { @ code type } . * @ param type the type of the parameters that will be extracted from the message * @ return a { @ code TreeSet } with the names of the parameters of the given { @ code type } , never { @ code null } * @ since 2.4.2 */ public TreeSet < String > getParamNameSet ( HtmlParameter . Type type ) { } }
TreeSet < String > set = new TreeSet < > ( ) ; Map < String , String > paramMap = Model . getSingleton ( ) . getSession ( ) . getParams ( this , type ) ; for ( Entry < String , String > param : paramMap . entrySet ( ) ) { set . add ( param . getKey ( ) ) ; } return set ;
public class ListDataKey { /** * creates a list data key with the given name and type . Null types are allowed . * @ param < T > the type of the value * @ param name the name of the key that is stored in the xdata file * @ param dataClass the class of the type * @ return */ public static < T > ListDataKey < T > create ( String name , Class < T > dataClass ) { } }
return create ( name , dataClass , true ) ;
public class AvatarNode { /** * Returns the address of the remote namenode */ static InetSocketAddress getRemoteNamenodeAddress ( Configuration conf , InstanceId instance ) throws IOException { } }
String fs = null ; if ( instance == InstanceId . NODEZERO ) { fs = conf . get ( DFS_NAMENODE_RPC_ADDRESS1_KEY ) ; if ( fs == null ) fs = conf . get ( "fs.default.name1" ) ; } else if ( instance == InstanceId . NODEONE ) { fs = conf . get ( DFS_NAMENODE_RPC_ADDRESS0_KEY ) ; if ( fs == null ) fs = conf . get ( "fs.default.name0" ) ; } else { throw new IOException ( "Unknown instance " + instance ) ; } if ( fs != null ) { Configuration newConf = new Configuration ( conf ) ; newConf . set ( FSConstants . DFS_NAMENODE_RPC_ADDRESS_KEY , fs ) ; conf = newConf ; } return NameNode . getClientProtocolAddress ( conf ) ;
public class FloatMapper { /** * { @ inheritDoc } */ @ Override protected Float doBase ( String name , Object value ) { } }
if ( value instanceof Number ) { return ( ( Number ) value ) . floatValue ( ) ; } else if ( value instanceof String ) { try { return Double . valueOf ( ( String ) value ) . floatValue ( ) ; } catch ( NumberFormatException e ) { throw new IndexException ( "Field '{}' with value '{}' can not be parsed as float" , name , value ) ; } } throw new IndexException ( "Field '{}' requires a float, but found '{}'" , name , value ) ;
public class ApiOvhSms { /** * The senders that are attached to your personal informations or OVH services and that can be automatically validated * REST : GET / sms / { serviceName } / sendersAvailableForValidation * @ param referer [ required ] Information type * @ param serviceName [ required ] The internal name of your SMS offer */ public ArrayList < OvhSenderAvailable > serviceName_sendersAvailableForValidation_GET ( String serviceName , OvhSenderRefererEnum referer ) throws IOException { } }
String qPath = "/sms/{serviceName}/sendersAvailableForValidation" ; StringBuilder sb = path ( qPath , serviceName ) ; query ( sb , "referer" , referer ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t3 ) ;
public class CmsHtmlList { /** * Returns all items of the current page . < p > * @ return all items of the current page , a list of { @ link CmsListItem } objects */ public List < CmsListItem > getCurrentPageItems ( ) { } }
if ( getSize ( ) == 0 ) { return Collections . emptyList ( ) ; } if ( m_metadata . isSelfManaged ( ) ) { return getContent ( ) ; } return Collections . unmodifiableList ( getContent ( ) . subList ( displayedFrom ( ) - 1 , displayedTo ( ) ) ) ;
public class TagValuesMarshaller { /** * Marshall the given parameter object . */ public void marshall ( TagValues tagValues , ProtocolMarshaller protocolMarshaller ) { } }
if ( tagValues == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( tagValues . getKey ( ) , KEY_BINDING ) ; protocolMarshaller . marshall ( tagValues . getValues ( ) , VALUES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SignatureRequest { /** * Removes the signer from the list . If that user does not exist , this will * throw a HelloSignException . * @ param email String * @ throws HelloSignException thrown if there is a problem removing the * signer . */ public void removeSigner ( String email ) throws HelloSignException { } }
if ( email == null ) { throw new HelloSignException ( "Cannot remove null signer" ) ; } for ( int i = 0 ; i < signers . size ( ) ; i ++ ) { if ( email . equalsIgnoreCase ( signers . get ( i ) . getEmail ( ) ) ) { signers . remove ( i ) ; } }
public class FTPConnection { /** * Internally registers a command * @ param label The command name * @ param help The help message * @ param cmd The command function * @ param needsAuth Whether authentication is required to run this command */ protected void addCommand ( String label , String help , Command cmd , boolean needsAuth ) { } }
commands . put ( label . toUpperCase ( ) , new CommandInfo ( cmd , help , needsAuth ) ) ;
public class ExperimentsInner { /** * Gets a list of Experiments within the specified Workspace . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param workspaceName The name of the workspace . Workspace names can only contain a combination of alphanumeric characters along with dash ( - ) and underscore ( _ ) . The name must be from 1 through 64 characters long . * @ param experimentsListByWorkspaceOptions Additional parameters for the operation * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; ExperimentInner & gt ; object */ public Observable < Page < ExperimentInner > > listByWorkspaceAsync ( final String resourceGroupName , final String workspaceName , final ExperimentsListByWorkspaceOptions experimentsListByWorkspaceOptions ) { } }
return listByWorkspaceWithServiceResponseAsync ( resourceGroupName , workspaceName , experimentsListByWorkspaceOptions ) . map ( new Func1 < ServiceResponse < Page < ExperimentInner > > , Page < ExperimentInner > > ( ) { @ Override public Page < ExperimentInner > call ( ServiceResponse < Page < ExperimentInner > > response ) { return response . body ( ) ; } } ) ;
public class HBaseTapCollector { /** * Method collect writes the given values to the { @ link Tap } this instance * encapsulates . * @ param writableComparable * of type WritableComparable * @ param writable * of type Writable * @ throws IOException * when */ public void collect ( Object writableComparable , Object writable ) throws IOException { } }
if ( hadoopFlowProcess instanceof HadoopFlowProcess ) ( ( HadoopFlowProcess ) hadoopFlowProcess ) . getReporter ( ) . progress ( ) ; writer . write ( writableComparable , writable ) ;
public class SmartBinder { /** * Terminate this binder by looking up the named static method on the * given target type . Perform the actual method lookup using the given * Lookup object . If the lookup fails , a RuntimeException will be raised , * containing the actual reason . This method is for convenience in ( for * example ) field declarations , where checked exceptions noise up code * that can ' t recover anyway . * Use this in situations where you would not expect your library to be * usable if the target method can ' t be acquired . * @ param lookup the Lookup to use for handle lookups * @ param target the type on which to find the static method * @ param name the name of the target static method * @ return a SmartHandle with this binder ' s starting signature , bound * to the target method */ public SmartHandle invokeStaticQuiet ( Lookup lookup , Class < ? > target , String name ) { } }
return new SmartHandle ( start , binder . invokeStaticQuiet ( lookup , target , name ) ) ;
public class CheckedInputStream { /** * Skips specified number of bytes of input . * @ param n the number of bytes to skip * @ return the actual number of bytes skipped * @ exception IOException if an I / O error has occurred */ public long skip ( long n ) throws IOException { } }
byte [ ] buf = new byte [ 512 ] ; long total = 0 ; while ( total < n ) { long len = n - total ; len = read ( buf , 0 , len < buf . length ? ( int ) len : buf . length ) ; if ( len == - 1 ) { return total ; } total += len ; } return total ;
public class ParserContext { /** * Processes the XML document at the provided { @ link URL } and returns a result from the namespace element handlers . */ public < T > T processDocument ( URI uri ) throws ConfigurationException { } }
DocumentBuilderFactory dbFactory = DocumentBuilderFactory . newInstance ( ) ; dbFactory . setNamespaceAware ( true ) ; DocumentBuilder dBuilder = null ; try { dBuilder = dbFactory . newDocumentBuilder ( ) ; } catch ( Exception e ) { throw new WindupException ( "Failed to build xml parser due to: " + e . getMessage ( ) , e ) ; } try { Document doc = dBuilder . parse ( uri . toString ( ) ) ; return processElement ( doc . getDocumentElement ( ) ) ; } catch ( Exception e ) { throw new WindupException ( "Failed to parse document at: " + uri + ", due to: " + e . getMessage ( ) , e ) ; }
public class XmlBeanMapper { /** * This method loads the JAXB - bean as XML from the given { @ code inputStream } . * @ param inputStream is the { @ link InputStream } with the XML to parse . * @ return the parsed XML converted to the according JAXB - bean . * @ param source describes the source of the invalid XML . Typically this will be the filename where the XML was read * from . It is used in in the exception message . This will help to find the problem easier . */ public T loadXml ( InputStream inputStream , Object source ) { } }
try { Object unmarshalledObject = getOrCreateUnmarshaller ( ) . unmarshal ( inputStream ) ; T jaxbBean = this . xmlBeanClass . cast ( unmarshalledObject ) ; validate ( jaxbBean ) ; return jaxbBean ; } catch ( JAXBException e ) { throw new XmlInvalidException ( e , source ) ; }
public class LocalFileSystem { /** * Moves files to a bad file directory on the same device , so that their * storage will not be reused . */ public boolean reportChecksumFailure ( Path p , FSDataInputStream in , long inPos , FSDataInputStream sums , long sumsPos ) { } }
try { // canonicalize f File f = ( ( RawLocalFileSystem ) fs ) . pathToFile ( p ) . getCanonicalFile ( ) ; // find highest writable parent dir of f on the same device String device = new DF ( f , getConf ( ) ) . getMount ( ) ; File parent = f . getParentFile ( ) ; File dir = null ; while ( parent != null && parent . canWrite ( ) && parent . toString ( ) . startsWith ( device ) ) { dir = parent ; parent = parent . getParentFile ( ) ; } if ( dir == null ) { throw new IOException ( "not able to find the highest writable parent dir" ) ; } // move the file there File badDir = new File ( dir , "bad_files" ) ; if ( ! badDir . mkdirs ( ) ) { if ( ! badDir . isDirectory ( ) ) { throw new IOException ( "Mkdirs failed to create " + badDir . toString ( ) ) ; } } String suffix = "." + rand . nextInt ( ) ; File badFile = new File ( badDir , f . getName ( ) + suffix ) ; LOG . warn ( "Moving bad file " + f + " to " + badFile ) ; in . close ( ) ; // close it first f . renameTo ( badFile ) ; // rename it // move checksum file too File checkFile = ( ( RawLocalFileSystem ) fs ) . pathToFile ( getChecksumFile ( p ) ) ; checkFile . renameTo ( new File ( badDir , checkFile . getName ( ) + suffix ) ) ; } catch ( IOException e ) { LOG . warn ( "Error moving bad file " + p + ": " + e ) ; } return false ;
public class ChannelClientImpl { /** * Called when the link is closing . */ @ Override public void shutdown ( ShutdownModeAmp mode ) { } }
// jamp / 3210 // getReadMailbox ( ) . close ( ) ; try { getServiceRefOut ( ) . shutdown ( mode ) ; } catch ( Throwable e ) { log . log ( Level . FINER , e . toString ( ) , e ) ; } for ( ServiceRefAmp service : _linkServiceMap . values ( ) ) { service . shutdown ( mode ) ; } for ( StubAmp actor : _closeList ) { actor . onShutdown ( mode ) ; }
public class LssClient { /** * List all your live sessions with given status . * @ param status Live session status . * @ return The list of all your live sessions . */ public ListSessionsResponse listSessions ( String status ) { } }
ListSessionsRequest request = new ListSessionsRequest ( ) . withStatus ( status ) ; return listSessions ( request ) ;
public class Assertions { /** * Check an object by a validator . * @ param < T > object type * @ param obj object to be checked * @ param validator validator for the operation * @ return the object if it is valid * @ throws InvalidObjectError will be thrown if the object is invalid * @ since 1.0.2 */ @ Nullable public static < T > T assertIsValid ( @ Nullable T obj , @ Nonnull Validator < T > validator ) { } }
if ( assertNotNull ( validator ) . isValid ( obj ) ) { return obj ; } else { final InvalidObjectError error = new InvalidObjectError ( "Detected invalid object" , obj ) ; MetaErrorListeners . fireError ( "Invalid object" , error ) ; throw error ; }
public class GVRLight { /** * Bind an { @ code int } to the shader uniform { @ code key } . * Throws an exception of the key does not exist . * @ param key Name of the shader uniform * @ param value New data */ public void setInt ( String key , int value ) { } }
checkKeyIsUniform ( key ) ; NativeLight . setInt ( getNative ( ) , key , value ) ;
public class Humanize { /** * For dates that are the current day or within one day , return ' today ' , * ' tomorrow ' or ' yesterday ' , as appropriate . Otherwise , returns a string * formatted according to a locale sensitive DateFormat . * @ param style * The style of the Date * @ param then * The date ( GMT ) * @ return String with ' today ' , ' tomorrow ' or ' yesterday ' compared to * current day . Otherwise , returns a string formatted according to a * locale sensitive DateFormat . */ public static String naturalDay ( int style , Date then ) { } }
Date today = new Date ( ) ; long delta = then . getTime ( ) - today . getTime ( ) ; long days = delta / ND_FACTOR ; if ( days == 0 ) return context . get ( ) . getMessage ( "today" ) ; else if ( days == 1 ) return context . get ( ) . getMessage ( "tomorrow" ) ; else if ( days == - 1 ) return context . get ( ) . getMessage ( "yesterday" ) ; return formatDate ( style , then ) ;
public class JmesPathContainsFunction { /** * Retrieves the subject ( lhs expression ) which could be an array * or string , the search ( rhs expression ) which could be any JmesPath * expression . If subject is an array , this function returns true if * one of the elements in the array is equal to the provided search * value . If the provided subject is a string , this function returns * true if the string contains the provided search argument . * @ param evaluatedArgs List of input expressions * @ return True subject contains search ; * False otherwise */ @ Override public JsonNode evaluate ( List < JsonNode > evaluatedArgs ) { } }
JsonNode subject = evaluatedArgs . get ( 0 ) ; JsonNode search = evaluatedArgs . get ( 1 ) ; if ( subject . isArray ( ) ) { return doesArrayContain ( subject , search ) ; } else if ( subject . isTextual ( ) ) { return doesStringContain ( subject , search ) ; } throw new InvalidTypeException ( "Type mismatch. Expecting a string or an array." ) ;
public class AmqpClient { /** * Opens a channel on server . * @ return AmqpChannel */ public AmqpChannel openChannel ( ) { } }
int id = ++ this . channelCount ; AmqpChannel chan = new AmqpChannel ( id , this ) ; channels . put ( id , chan ) ; return chan ;
public class DefaultDedupEventStore { /** * Copies events matching the specified predicate from one dedup queue to another . * Note : this method expects both " from " and " to " are dedup queues . If " from " queue is not , use * { @ link # copyFromRawChannel } instead to avoid starting a DedupQueueService for " from " that will * drain it and move its data to a sorted queue . */ @ Override public void copy ( String from , String to , Predicate < ByteBuffer > filter , Date since ) { } }
checkNotNull ( from , "from" ) ; checkNotNull ( to , "to" ) ; ScanSink sink = newCopySink ( to ) ; _delegate . scan ( _channels . writeChannel ( from ) , filter , sink , COPY_BATCH_SIZE , since ) ; SortedQueue source = getQueueReadOnly ( from , SERVICE_SLOW_WAIT_DURATION ) ; Iterator < List < ByteBuffer > > it = Iterators . partition ( source . scan ( null , Long . MAX_VALUE ) , COPY_BATCH_SIZE ) ; while ( it . hasNext ( ) ) { List < ByteBuffer > events = it . next ( ) ; sink . accept ( ImmutableList . copyOf ( Iterables . filter ( events , filter ) ) ) ; // Copy so filter is evaluated only once per record . } _delegate . scan ( _channels . readChannel ( from ) , filter , sink , COPY_BATCH_SIZE , since ) ;
public class VisualizationUtils { /** * Plots the MSD curve with the trajectory t and adds the fitted model for confined diffusion above . * @ param t Trajectory to calculate the msd curve * @ param lagMin Minimum timelag ( e . g . 1,2,3 . . ) lagMin * timelag = elapsed time in seconds * @ param lagMax Maximum timelag ( e . g . 1,2,3 . . ) lagMax * timelag = elapsed time in seconds * @ param timelag Elapsed time between two frames . * @ param a Parameter alpha * @ param b Shape parameter 1 * @ param c Shape parameter 2 * @ param d Diffusion coefficient */ public static Chart getMSDLineWithConfinedModelChart ( Trajectory t , int lagMin , int lagMax , double timelag , double a , double b , double c , double d ) { } }
double [ ] xData = new double [ lagMax - lagMin + 1 ] ; double [ ] yData = new double [ lagMax - lagMin + 1 ] ; double [ ] modelData = new double [ lagMax - lagMin + 1 ] ; MeanSquaredDisplacmentFeature msdeval = new MeanSquaredDisplacmentFeature ( t , lagMin ) ; msdeval . setTrajectory ( t ) ; msdeval . setTimelag ( lagMin ) ; for ( int i = lagMin ; i < lagMax + 1 ; i ++ ) { msdeval . setTimelag ( i ) ; double msdhelp = msdeval . evaluate ( ) [ 0 ] ; xData [ i - lagMin ] = i ; yData [ i - lagMin ] = msdhelp ; modelData [ i - lagMin ] = a * ( 1 - b * Math . exp ( ( - 4 * d ) * ( ( i * timelag ) / a ) * c ) ) ; } // Create Chart Chart chart = QuickChart . getChart ( "MSD Line" , "LAG" , "MSD" , "MSD" , xData , yData ) ; if ( Math . abs ( 1 - b ) < 0.00001 && Math . abs ( 1 - a ) < 0.00001 ) { chart . addSeries ( "y=a*(1-exp(-4*D*t/a))" , xData , modelData ) ; } else { chart . addSeries ( "y=a*(1-b*exp(-4*c*D*t/a))" , xData , modelData ) ; } // Show it // new SwingWrapper ( chart ) . displayChart ( ) ; return chart ;
public class EntityProcessor { /** * < p > Accepts the { @ link InvocationContext } of an { @ link HttpEntityEnclosingRequest } and inserts * < b > the < / b > request parameter which is annotated with @ { @ link Entity } into its body . < / p > * < p > < b > Note < / b > that it makes no sense to scope multiple entities within the same entity enclosing * request ( HTTP / 1.1 < a href = " http : / / www . w3 . org / Protocols / rfc2616 / rfc2616 - sec9 . html " > RFC - 2616 < / a > ) . * This processor fails for the following scenarios : < / p > * < ul > * < li > < b > No entity < / b > was found in the endpoint method definition . < / li > * < li > < b > Multiple entities < / b > were found in the endpoint method definition . < / li > * < li > The annotated entity < b > failed to be resolved < / b > to a matching { @ link HttpEntity } . < / li > * < / ul > * < p > Parameter types are resolved to their { @ link HttpEntity } as specified in * { @ link Entities # resolve ( Object ) } . If an attached @ { @ link Serialize } is discovered , the entity * will be serialized using the specified serializer before translation to an { @ link HttpEntity } . < / p > * < p > See { @ link AbstractRequestProcessor # process ( InvocationContext , HttpRequestBase ) } . < / p > * @ param context * the { @ link InvocationContext } which is used to retrieve the entity * < br > < br > * @ param request * an instance of { @ link HttpEntityEnclosingRequestBase } which allows the inclusion of an * { @ link HttpEntity } in its body * < br > < br > * @ return the same instance of { @ link HttpRequestBase } which was given for processing entities * < br > < br > * @ throws RequestProcessorException * if an { @ link HttpEntityEnclosingRequestBase } was discovered and yet the entity failed to * be resolved and inserted into the request body * < br > < br > * @ since 1.3.0 */ @ Override @ SuppressWarnings ( "unchecked" ) // welcomes a ClassCastException on misuse of @ Serialize ( Custom . class ) protected HttpRequestBase process ( InvocationContext context , HttpRequestBase request ) { } }
try { if ( request instanceof HttpEntityEnclosingRequestBase ) { List < Entry < Entity , Object > > entities = Metadata . onParams ( Entity . class , context ) ; if ( entities . isEmpty ( ) ) { throw new MissingEntityException ( context ) ; } if ( entities . size ( ) > 1 ) { throw new MultipleEntityException ( context ) ; } Object entity = entities . get ( 0 ) . getValue ( ) ; Serialize metadata = ( metadata = context . getRequest ( ) . getAnnotation ( Serialize . class ) ) == null ? context . getEndpoint ( ) . getAnnotation ( Serialize . class ) : metadata ; if ( metadata != null && ! isDetached ( context , Serialize . class ) ) { @ SuppressWarnings ( "rawtypes" ) // no restrictions on custom serializer types with @ Serialize AbstractSerializer serializer = ( metadata . value ( ) == UNDEFINED ) ? Serializers . resolve ( metadata . type ( ) ) : Serializers . resolve ( metadata . value ( ) ) ; entity = serializer . run ( context , entity ) ; } HttpEntity httpEntity = Entities . resolve ( entity ) ; ( ( HttpEntityEnclosingRequestBase ) request ) . setHeader ( HttpHeaders . CONTENT_TYPE , ContentType . getOrDefault ( httpEntity ) . getMimeType ( ) ) ; ( ( HttpEntityEnclosingRequestBase ) request ) . setEntity ( httpEntity ) ; } } catch ( MissingEntityException mee ) { // violates HTTP 1.1 specification , be more verbose if ( ! ( request instanceof HttpPost ) ) { // allow leeway for POST requests StringBuilder errorContext = new StringBuilder ( "It is imperative that this request encloses an entity." ) . append ( " Identify exactly one entity by annotating an argument with @" ) . append ( Entity . class . getSimpleName ( ) ) ; throw new RequestProcessorException ( errorContext . toString ( ) , mee ) ; } } catch ( MultipleEntityException mee ) { // violates HTTP 1.1 specification , be more verbose StringBuilder errorContext = new StringBuilder ( "This request is only able to enclose exactly one entity." ) . append ( " Remove all @" ) . append ( Entity . class . getSimpleName ( ) ) . append ( " annotations except for a single entity which is identified by this URI. " ) ; throw new RequestProcessorException ( errorContext . toString ( ) , mee ) ; } catch ( EntityResolutionFailedException erfe ) { // violates HTTP 1.1 specification , be more verbose StringBuilder errorContext = new StringBuilder ( "This request cannot proceed without an enclosing entity." ) . append ( " Ensure that the entity which is annotated with " ) . append ( Entity . class . getSimpleName ( ) ) . append ( " complies with the supported types as documented in " ) . append ( RequestUtils . class . getName ( ) ) . append ( "#resolveHttpEntity(Object)" ) ; throw new RequestProcessorException ( errorContext . toString ( ) , erfe ) ; } catch ( Exception e ) { throw new RequestProcessorException ( context , getClass ( ) , e ) ; } return request ;
public class OrExpressionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case SimpleExpressionsPackage . OR_EXPRESSION__LEFT : return left != null ; case SimpleExpressionsPackage . OR_EXPRESSION__RIGHT : return right != null ; } return super . eIsSet ( featureID ) ;
public class EncryptedCachedDiskStringsTable { /** * Get an item from the shared string table * @ param idx index of the entry * @ return entry */ @ Override public RichTextString getItemAt ( int idx ) { } }
try { return new XSSFRichTextString ( this . getString ( idx ) ) ; } catch ( IOException e ) { LOG . error ( "Cannot read from temporary shared String table. Exception: " + e ) ; } return new XSSFRichTextString ( "" ) ;
public class CmsLoginController { /** * Logs out the current user redirecting to the login form afterwards . < p > * @ param cms the cms context * @ param request the servlet request * @ param response the servlet response * @ throws IOException if writing to the response fails */ public static void logout ( CmsObject cms , HttpServletRequest request , HttpServletResponse response ) throws IOException { } }
String loggedInUser = cms . getRequestContext ( ) . getCurrentUser ( ) . getName ( ) ; HttpSession session = request . getSession ( false ) ; if ( session != null ) { session . invalidate ( ) ; /* we need this because a new session might be created after this method , but before the session info is updated in OpenCmsCore . showResource . */ cms . getRequestContext ( ) . setUpdateSessionEnabled ( false ) ; } // logout was successful if ( LOG . isInfoEnabled ( ) ) { LOG . info ( org . opencms . jsp . Messages . get ( ) . getBundle ( ) . key ( org . opencms . jsp . Messages . LOG_LOGOUT_SUCCESFUL_3 , loggedInUser , cms . getRequestContext ( ) . addSiteRoot ( cms . getRequestContext ( ) . getUri ( ) ) , cms . getRequestContext ( ) . getRemoteAddress ( ) ) ) ; } response . sendRedirect ( getFormLink ( cms ) ) ;
public class NodeUtil { /** * Creates a node representing a qualified name . * @ param name A qualified name ( e . g . " foo " or " foo . bar . baz " ) * @ return A VAR node , or an EXPR _ RESULT node containing an ASSIGN or NAME node . */ public static Node newQNameDeclaration ( AbstractCompiler compiler , String name , Node value , JSDocInfo info ) { } }
return newQNameDeclaration ( compiler , name , value , info , Token . VAR ) ;
public class AbstractWriteHandler { /** * Handles request complete event . */ public void onCompleted ( ) { } }
mSerializingExecutor . execute ( ( ) -> { Preconditions . checkState ( mContext != null ) ; try { completeRequest ( mContext ) ; replySuccess ( ) ; } catch ( Exception e ) { LogUtils . warnWithException ( LOG , "Exception occurred while completing write request {}." , mContext . getRequest ( ) , e ) ; Throwables . throwIfUnchecked ( e ) ; abort ( new Error ( AlluxioStatusException . fromCheckedException ( e ) , true ) ) ; } } ) ;
public class PageUtil { /** * 根据总数计算总页数 * @ param totalCount 总数 * @ param pageSize 每页数 * @ return 总页数 */ public static int totalPage ( int totalCount , int pageSize ) { } }
if ( pageSize == 0 ) { return 0 ; } return totalCount % pageSize == 0 ? ( totalCount / pageSize ) : ( totalCount / pageSize + 1 ) ;
public class Util { /** * Is this a CData string ? * @ param string The string to analyze . * @ return true if this string must be a CDATA area ( if it has carriage - returns ) . */ public static boolean isCData ( String string ) { } }
if ( string != null ) { for ( int i = 0 ; i < string . length ( ) ; i ++ ) { char chChar = string . charAt ( i ) ; if ( ( chChar == 0x9 ) || ( chChar == 0xD ) || ( chChar == 0xA ) ) return true ; // Carriage return / Line feed / newline } } return false ;
public class StaplerResponseWrapper { /** * { @ inheritDoc } */ @ Override public void sendError ( int sc , String msg ) throws IOException { } }
getWrapped ( ) . sendError ( sc , msg ) ;
public class TaxRate { /** * Creates a new tax rate . */ public static TaxRate create ( TaxRateCreateParams params , RequestOptions options ) throws StripeException { } }
String url = String . format ( "%s%s" , Stripe . getApiBase ( ) , "/v1/tax_rates" ) ; return request ( ApiResource . RequestMethod . POST , url , params , TaxRate . class , options ) ;
public class Validate { /** * < p > Validate that the specified argument string is * neither < code > null < / code > nor a length of zero ( no characters ) ; * otherwise throwing an exception with the specified message . * < pre > Validate . notEmpty ( myString , " The string must not be empty " ) ; < / pre > * @ param string the string to check * @ param message the exception message if invalid * @ throws IllegalArgumentException if the string is empty */ public static void notEmpty ( String string , String message ) { } }
if ( string == null || string . length ( ) == 0 ) { throw new IllegalArgumentException ( message ) ; }
public class FindbugsPropertyPage { /** * Triggers FB analysis on given project * @ param myProject opened project with FindBugs nature */ private static void runBuild ( @ Nonnull IProject myProject ) { } }
StructuredSelection selection = new StructuredSelection ( myProject ) ; FindBugsAction action = new FindBugsAction ( ) ; action . selectionChanged ( null , selection ) ; action . run ( null ) ;
public class WITH { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > return the result of a collection expression < / i > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > Use Factory Class < b > C < / b > to create a Collection Expressions < / i > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > e . g . < b > WITH . collection ( C . COLLECT ( ) . property ( " name " ) . from ( nds ) ) < b > < / i > < / div > * < br / > */ public static RElement < RElement < ? > > collection ( ICollectExpression C ) { } }
RElement < RElement < ? > > ret = RFactory . resultOf ( C ) ; ASTNode an = APIObjectAccess . getAstNode ( ret ) ; an . setClauseType ( ClauseType . WITH ) ; return ret ;
public class TransformerComponentBuilder { /** * Notification method invoked when transformer is removed . */ @ Override protected void onRemovedInternal ( ) { } }
final List < TransformerChangeListener > listeners = getAllListeners ( ) ; for ( final TransformerChangeListener listener : listeners ) { listener . onOutputChanged ( this , new LinkedList < > ( ) ) ; listener . onRemove ( this ) ; }
public class Mac { /** * Finishes the MAC operation . * < p > A call to this method resets this < code > Mac < / code > object to the * state it was in when previously initialized via a call to * < code > init ( Key ) < / code > or * < code > init ( Key , AlgorithmParameterSpec ) < / code > . * That is , the object is reset and available to generate another MAC from * the same key , if desired , via new calls to < code > update < / code > and * < code > doFinal < / code > . * ( In order to reuse this < code > Mac < / code > object with a different key , * it must be reinitialized via a call to < code > init ( Key ) < / code > or * < code > init ( Key , AlgorithmParameterSpec ) < / code > . * @ return the MAC result . * @ exception IllegalStateException if this < code > Mac < / code > has not been * initialized . */ public final byte [ ] doFinal ( ) throws IllegalStateException { } }
chooseFirstProvider ( ) ; if ( initialized == false ) { throw new IllegalStateException ( "MAC not initialized" ) ; } byte [ ] mac = spi . engineDoFinal ( ) ; spi . engineReset ( ) ; return mac ;
public class SlotManager { /** * Suspends the component . This clears the internal state of the slot manager . */ public void suspend ( ) { } }
LOG . info ( "Suspending the SlotManager." ) ; // stop the timeout checks for the TaskManagers and the SlotRequests if ( taskManagerTimeoutCheck != null ) { taskManagerTimeoutCheck . cancel ( false ) ; taskManagerTimeoutCheck = null ; } if ( slotRequestTimeoutCheck != null ) { slotRequestTimeoutCheck . cancel ( false ) ; slotRequestTimeoutCheck = null ; } for ( PendingSlotRequest pendingSlotRequest : pendingSlotRequests . values ( ) ) { cancelPendingSlotRequest ( pendingSlotRequest ) ; } pendingSlotRequests . clear ( ) ; ArrayList < InstanceID > registeredTaskManagers = new ArrayList < > ( taskManagerRegistrations . keySet ( ) ) ; for ( InstanceID registeredTaskManager : registeredTaskManagers ) { unregisterTaskManager ( registeredTaskManager ) ; } resourceManagerId = null ; resourceActions = null ; started = false ;
public class IterableSubject { /** * Checks that a actual iterable contains none of the excluded objects or fails . ( Duplicates are * irrelevant to this test , which fails if any of the actual elements equal any of the excluded . ) */ public final void containsNoneOf ( @ NullableDecl Object firstExcluded , @ NullableDecl Object secondExcluded , @ NullableDecl Object ... restOfExcluded ) { } }
containsNoneIn ( accumulate ( firstExcluded , secondExcluded , restOfExcluded ) ) ;
public class TregexPatternCompiler { /** * Create a TregexPattern from this tregex string using the headFinder and * basicCat function this TregexPatternCompiler was created with . * < i > Implementation note : < / i > If there is an invalid token in the Tregex * parser , JavaCC will throw a TokenMgrError . This is a class * that extends Error , not Exception ( OMG ! - bad ! ) , and so rather than * requiring clients to catch it , we wrap it in a ParseException . * ( The original Error ' s are thrown in TregexParserTokenManager . ) * @ param tregex The pattern to parse * @ return A new TregexPattern object based on this string * @ throws TregexParseException If the expression is syntactically invalid */ public TregexPattern compile ( String tregex ) { } }
for ( Pair < String , String > macro : macros ) { tregex = tregex . replaceAll ( macro . first ( ) , macro . second ( ) ) ; } TregexPattern pattern ; try { TregexParser parser = new TregexParser ( new StringReader ( tregex + '\n' ) , basicCatFunction , headFinder ) ; pattern = parser . Root ( ) ; } catch ( TokenMgrError tme ) { throw new TregexParseException ( "Could not parse " + tregex , tme ) ; } catch ( ParseException e ) { throw new TregexParseException ( "Could not parse " + tregex , e ) ; } pattern . setPatternString ( tregex ) ; return pattern ;
public class Validator { /** * Validates a field to be a valid IPv4 address * @ param name The field to check * @ param message A custom error message instead of the default one */ public void expectIpv4 ( String name , String message ) { } }
String value = Optional . ofNullable ( get ( name ) ) . orElse ( "" ) ; if ( ! InetAddressValidator . getInstance ( ) . isValidInet4Address ( value ) ) { addError ( name , Optional . ofNullable ( message ) . orElse ( messages . get ( Validation . IPV4_KEY . name ( ) , name ) ) ) ; }
public class V2ExtraJaxbClassModel { /** * { @ inheritDoc } */ @ Override public ExtraJaxbClassModel setClazz ( Class < ? > clazz ) { } }
String c = clazz != null ? clazz . getName ( ) : null ; setModelValue ( c ) ; return this ;
public class OutSegment { /** * < pre > * u8 type = 0 * u8 isCont * < / pre > */ private int fillFooter ( byte [ ] buffer , int offset , int entryTail , boolean isCont ) { } }
BitsUtil . writeInt16 ( buffer , offset , entryTail ) ; offset += 2 ; buffer [ offset ] = ( byte ) ( isCont ? 1 : 0 ) ; offset ++ ; return offset ;
public class OSMTablesFactory { /** * Create the relation table . * @ param connection * @ param relationTable * @ return * @ throws SQLException */ public static PreparedStatement createRelationTable ( Connection connection , String relationTable ) throws SQLException { } }
try ( Statement stmt = connection . createStatement ( ) ) { StringBuilder sb = new StringBuilder ( "CREATE TABLE " ) ; sb . append ( relationTable ) ; sb . append ( "(ID_RELATION BIGINT PRIMARY KEY," + "USER_NAME VARCHAR," + "UID BIGINT," + "VISIBLE BOOLEAN," + "VERSION INTEGER," + "CHANGESET INTEGER," + "LAST_UPDATE TIMESTAMP);" ) ; stmt . execute ( sb . toString ( ) ) ; } return connection . prepareStatement ( "INSERT INTO " + relationTable + " VALUES ( ?,?,?,?,?,?,?);" ) ;
public class SubunitCluster { /** * Tells whether the other SubunitCluster contains exactly the same Subunit . * This is checked by String equality of their residue one - letter sequences . * @ param other * SubunitCluster * @ return true if the SubunitClusters are identical , false otherwise */ public boolean isIdenticalTo ( SubunitCluster other ) { } }
String thisSequence = this . subunits . get ( this . representative ) . getProteinSequenceString ( ) ; String otherSequence = other . subunits . get ( other . representative ) . getProteinSequenceString ( ) ; return thisSequence . equals ( otherSequence ) ;
public class Preconditions { /** * A { @ code double } specialized version of { @ link # checkPrecondition ( Object , * boolean , Function ) } * @ param value The value * @ param condition The predicate * @ param describer The describer of the predicate * @ return value * @ throws PreconditionViolationException If the predicate is false */ public static double checkPreconditionD ( final double value , final boolean condition , final DoubleFunction < String > describer ) { } }
return innerCheckD ( value , condition , describer ) ;
public class AmazonGlacierClient { /** * This operation lists all the tags attached to a vault . The operation returns an empty map if there are no tags . * For more information about tags , see < a * href = " http : / / docs . aws . amazon . com / amazonglacier / latest / dev / tagging . html " > Tagging Amazon Glacier Resources < / a > . * @ param listTagsForVaultRequest * The input value for < code > ListTagsForVaultInput < / code > . * @ return Result of the ListTagsForVault operation returned by the service . * @ throws InvalidParameterValueException * Returned if a parameter of the request is incorrectly specified . * @ throws MissingParameterValueException * Returned if a required header or parameter is missing from the request . * @ throws ResourceNotFoundException * Returned if the specified resource ( such as a vault , upload ID , or job ID ) doesn ' t exist . * @ throws ServiceUnavailableException * Returned if the service cannot complete the request . * @ sample AmazonGlacier . ListTagsForVault */ @ Override public ListTagsForVaultResult listTagsForVault ( ListTagsForVaultRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListTagsForVault ( request ) ;
public class Caster { /** * cast a value to a value defined by type argument * @ param pc * @ param type type of the returning Value * @ param o Object to cast * @ return casted Value * @ throws PageException */ public static Object castTo ( PageContext pc , String type , Object o , boolean alsoPattern ) throws PageException { } }
type = StringUtil . toLowerCase ( type ) . trim ( ) ; if ( type . length ( ) > 2 ) { char first = type . charAt ( 0 ) ; switch ( first ) { case 'a' : if ( type . equals ( "any" ) ) { return o ; } else if ( type . equals ( "array" ) ) { return toArray ( o ) ; } break ; case 'b' : if ( type . equals ( "boolean" ) || type . equals ( "bool" ) ) { return toBoolean ( o ) ; } else if ( type . equals ( "binary" ) ) { return toBinary ( o ) ; } else if ( type . equals ( "byte[]" ) ) { return toBinary ( o ) ; } else if ( type . equals ( "base64" ) ) { return toBase64 ( o , null ) ; } else if ( type . equals ( "bigdecimal" ) || type . equals ( "big_decimal" ) ) { return toBigDecimal ( o ) ; } else if ( type . equals ( "biginteger" ) || type . equals ( "big_integer" ) ) { return toBigInteger ( o ) ; } break ; case 'c' : if ( alsoPattern && type . equals ( "creditcard" ) ) { return toCreditCard ( o ) ; } break ; case 'd' : if ( type . equals ( "date" ) ) { return DateCaster . toDateAdvanced ( o , pc . getTimeZone ( ) ) ; } else if ( type . equals ( "datetime" ) ) { return DateCaster . toDateAdvanced ( o , pc . getTimeZone ( ) ) ; } else if ( type . equals ( "double" ) ) { return toDouble ( o ) ; } else if ( type . equals ( "decimal" ) ) { return toDecimal ( o ) ; } break ; case 'e' : if ( type . equals ( "eurodate" ) ) { return DateCaster . toEuroDate ( o , pc . getTimeZone ( ) ) ; } else if ( alsoPattern && type . equals ( "email" ) ) { return toEmail ( o ) ; } break ; case 'f' : if ( type . equals ( "float" ) ) { return toDouble ( o ) ; } else if ( type . equals ( "function" ) ) { return toFunction ( o ) ; } break ; case 'g' : if ( type . equals ( "guid" ) ) { return toGUId ( o ) ; } break ; case 'i' : if ( type . equals ( "integer" ) || type . equals ( "int" ) ) { return toInteger ( o ) ; } break ; case 'l' : if ( type . equals ( "long" ) ) { return toLong ( o ) ; } break ; case 'n' : if ( type . equals ( "numeric" ) ) { return toDouble ( o ) ; } else if ( type . equals ( "number" ) ) { return toDouble ( o ) ; } else if ( type . equals ( "node" ) ) { return toXML ( o ) ; } break ; case 'o' : if ( type . equals ( "object" ) ) { return o ; } else if ( type . equals ( "other" ) ) { return o ; } break ; case 'p' : if ( alsoPattern && type . equals ( "phone" ) ) { return toPhone ( o ) ; } break ; case 'q' : if ( type . equals ( "query" ) ) { return toQuery ( o ) ; } break ; case 's' : if ( type . equals ( "string" ) ) { return toString ( o ) ; } else if ( type . equals ( "struct" ) ) { return toStruct ( o ) ; } else if ( type . equals ( "short" ) ) { return toShort ( o ) ; } else if ( alsoPattern && ( type . equals ( "ssn" ) || type . equals ( "social_security_number" ) ) ) { return toSSN ( o ) ; } break ; case 't' : if ( type . equals ( "timespan" ) ) { return toTimespan ( o ) ; } if ( type . equals ( "time" ) ) { return DateCaster . toDateAdvanced ( o , pc . getTimeZone ( ) ) ; } if ( alsoPattern && type . equals ( "telephone" ) ) { return toPhone ( o ) ; } break ; case 'u' : if ( type . equals ( "uuid" ) ) { return toUUId ( o ) ; } if ( alsoPattern && type . equals ( "url" ) ) { return toURL ( o ) ; } if ( type . equals ( "usdate" ) ) { return DateCaster . toUSDate ( o , pc . getTimeZone ( ) ) ; // return DateCaster . toDate ( o , pc . getTimeZone ( ) ) ; } break ; case 'v' : if ( type . equals ( "variablename" ) ) { return toVariableName ( o ) ; } else if ( type . equals ( "void" ) ) { return toVoid ( o ) ; } else if ( type . equals ( "variable_name" ) ) { return toVariableName ( o ) ; } else if ( type . equals ( "variable-name" ) ) { return toVariableName ( o ) ; } break ; case 'x' : if ( type . equals ( "xml" ) ) { return toXML ( o ) ; } case 'z' : if ( alsoPattern && ( type . equals ( "zip" ) || type . equals ( "zipcode" ) ) ) { return toZip ( o ) ; } break ; } } // < type > [ ] if ( type . endsWith ( "[]" ) ) { String componentType = type . substring ( 0 , type . length ( ) - 2 ) ; Object [ ] src = toNativeArray ( o ) ; Array trg = new ArrayImpl ( ) ; for ( int i = 0 ; i < src . length ; i ++ ) { if ( src [ i ] == null ) { continue ; } trg . setE ( i + 1 , castTo ( pc , componentType , src [ i ] , alsoPattern ) ) ; } return trg ; } return _castTo ( pc , type , o ) ;
public class HessianInput { /** * Reads a byte array from the stream . */ public int readString ( char [ ] buffer , int offset , int length ) throws IOException { } }
int readLength = 0 ; if ( _chunkLength == END_OF_DATA ) { _chunkLength = 0 ; return - 1 ; } else if ( _chunkLength == 0 ) { int tag = read ( ) ; switch ( tag ) { case 'N' : return - 1 ; case 'S' : case 's' : case 'X' : case 'x' : _isLastChunk = tag == 'S' || tag == 'X' ; _chunkLength = ( read ( ) << 8 ) + read ( ) ; break ; default : throw new IOException ( "expected 'S' at " + ( char ) tag ) ; } } while ( length > 0 ) { if ( _chunkLength > 0 ) { buffer [ offset ++ ] = ( char ) parseUTF8Char ( ) ; _chunkLength -- ; length -- ; readLength ++ ; } else if ( _isLastChunk ) { if ( readLength == 0 ) return - 1 ; else { _chunkLength = END_OF_DATA ; return readLength ; } } else { int tag = read ( ) ; switch ( tag ) { case 'S' : case 's' : case 'X' : case 'x' : _isLastChunk = tag == 'S' || tag == 'X' ; _chunkLength = ( read ( ) << 8 ) + read ( ) ; break ; default : throw new IOException ( "expected 'S' at " + ( char ) tag ) ; } } } if ( readLength == 0 ) return - 1 ; else if ( _chunkLength > 0 || ! _isLastChunk ) return readLength ; else { _chunkLength = END_OF_DATA ; return readLength ; }
public class InterfaceAnalyzer { /** * Analyzes the source code of an interface . The specified interface must not contain methods , that changes the * state of the corresponding object itself . * @ param code * source code of an interface which describes how to generate the < i > immutable < / i > * @ return analysis result */ @ Nonnull public static InterfaceAnalysis analyze ( @ Nonnull final String code ) { } }
Check . notNull ( code , "code" ) ; final CompilationUnit unit = Check . notNull ( SourceCodeReader . parse ( code ) , "compilationUnit" ) ; final List < TypeDeclaration > types = Check . notEmpty ( unit . getTypes ( ) , "typeDeclarations" ) ; Check . stateIsTrue ( types . size ( ) == 1 , "only one interface declaration per analysis is supported" ) ; final ClassOrInterfaceDeclaration type = ( ClassOrInterfaceDeclaration ) types . get ( 0 ) ; final Imports imports = SourceCodeReader . findImports ( unit . getImports ( ) ) ; final Package pkg = unit . getPackage ( ) != null ? new Package ( unit . getPackage ( ) . getName ( ) . toString ( ) ) : Package . UNDEFINED ; final List < Annotation > annotations = SourceCodeReader . findAnnotations ( type . getAnnotations ( ) , imports ) ; final List < Method > methods = SourceCodeReader . findMethods ( type . getMembers ( ) , imports ) ; Check . stateIsTrue ( ! hasPossibleMutatingMethods ( methods ) , "The passed interface '%s' seems to have mutating methods" , type . getName ( ) ) ; final List < Interface > extendsInterfaces = SourceCodeReader . findExtends ( type ) ; final String interfaceName = type . getName ( ) ; return new ImmutableInterfaceAnalysis ( annotations , extendsInterfaces , imports . asList ( ) , interfaceName , methods , pkg ) ;
public class TagLibFactory { /** * Laedt eine einzelne TagLib . * @ param file TLD die geladen werden soll . * @ param saxParser Definition des Sax Parser mit dem die TagLib eingelsesen werden soll . * @ return TagLib * @ throws TagLibException */ public static TagLib loadFromFile ( Resource res , Identification id ) throws TagLibException { } }
// Read in XML TagLib lib = TagLibFactory . getHashLib ( FunctionLibFactory . id ( res ) ) ; if ( lib == null ) { lib = new TagLibFactory ( null , res , id ) . getLib ( ) ; TagLibFactory . hashLib . put ( FunctionLibFactory . id ( res ) , lib ) ; } lib . setSource ( res . toString ( ) ) ; return lib ;
public class CacheUtil { /** * in difference to the getInstance method of the CacheConnection this method produces a wrapper * Cache ( if necessary ) that creates Entry objects to make sure the Cache has meta data . * @ param cc * @ param config * @ return * @ throws IOException */ public static Cache getInstance ( CacheConnection cc , Config config ) throws IOException { } }
return cc . getInstance ( config ) ;
public class AbstractProject { /** * { @ inheritDoc } * A project must be blocked if its own previous build is in progress , * or if the blockBuildWhenUpstreamBuilding option is true and an upstream * project is building , but derived classes can also check other conditions . */ @ Override public CauseOfBlockage getCauseOfBlockage ( ) { } }
// Block builds until they are done with post - production if ( ! isConcurrentBuild ( ) && isLogUpdated ( ) ) { final R lastBuild = getLastBuild ( ) ; if ( lastBuild != null ) { return new BlockedBecauseOfBuildInProgress ( lastBuild ) ; } else { // The build has been likely deleted after the isLogUpdated ( ) call . // Another cause may be an API implementation glitсh in the implementation for AbstractProject . // Anyway , we should let the code go then . LOGGER . log ( Level . FINE , "The last build has been deleted during the non-concurrent cause creation. The build is not blocked anymore" ) ; } } if ( blockBuildWhenDownstreamBuilding ( ) ) { AbstractProject < ? , ? > bup = getBuildingDownstream ( ) ; if ( bup != null ) return new BecauseOfDownstreamBuildInProgress ( bup ) ; } if ( blockBuildWhenUpstreamBuilding ( ) ) { AbstractProject < ? , ? > bup = getBuildingUpstream ( ) ; if ( bup != null ) return new BecauseOfUpstreamBuildInProgress ( bup ) ; } return null ;
public class Quaternion { /** * Sets this quaternion to one that first rotates about x by the specified number of radians , * then rotates about y , then about z . */ public Quaternion fromAngles ( Vector3 angles ) { } }
return fromAngles ( angles . x , angles . y , angles . z ) ;
public class ScanSpec { /** * Write to log . * @ param log * The { @ link LogNode } to log to . */ public void log ( final LogNode log ) { } }
if ( log != null ) { final LogNode scanSpecLog = log . log ( "ScanSpec:" ) ; for ( final Field field : ScanSpec . class . getDeclaredFields ( ) ) { try { scanSpecLog . log ( field . getName ( ) + ": " + field . get ( this ) ) ; } catch ( final ReflectiveOperationException e ) { // Ignore } } }
public class RottenTomatoesApi { /** * Retrieves movies currently in theaters * @ param country Provides localized data for the selected country * @ return * @ throws RottenTomatoesException */ public List < RTMovie > getInTheaters ( String country ) throws RottenTomatoesException { } }
return getInTheaters ( country , DEFAULT_PAGE , DEFAULT_PAGE_LIMIT ) ;
public class CandidateCluster { /** * Adds the data point with the specified index to the facility */ public void add ( int index , DoubleVector v ) { } }
boolean added = indices . add ( index ) ; assert added : "Adding duplicate indices to candidate facility" ; if ( sumVector == null ) { sumVector = ( v instanceof SparseVector ) ? new SparseHashDoubleVector ( v ) : new DenseVector ( v ) ; } else { VectorMath . add ( sumVector , v ) ; centroid = null ; }
public class Function3Args { /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time . * @ param vars List of QNames that correspond to variables . This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname . The position of the * QName in the vector from the start of the vector will be its position * in the stack frame ( but variables above the globalsTop value will need * to be offset to the current stack frame ) . */ public void fixupVariables ( java . util . Vector vars , int globalsSize ) { } }
super . fixupVariables ( vars , globalsSize ) ; if ( null != m_arg2 ) m_arg2 . fixupVariables ( vars , globalsSize ) ;
public class ConcurrentTaskScheduler { /** * { @ inheritDoc } * @ see org . audit4j . core . schedule . TaskScheduler # schedule ( java . lang . Runnable , * java . util . Date ) */ @ Override public ScheduledFuture < ? > schedule ( Runnable task , Date startTime ) { } }
long initialDelay = startTime . getTime ( ) - System . currentTimeMillis ( ) ; try { return this . scheduledExecutor . schedule ( decorateTask ( task , false ) , initialDelay , TimeUnit . MILLISECONDS ) ; } catch ( RejectedExecutionException ex ) { throw new TaskRejectedException ( "Executor [" + this . scheduledExecutor + "] did not accept task: " + task , ex ) ; }
public class StatementInsert { /** * Executes an INSERT _ SELECT statement . It is assumed that the argument * is of the correct type . * @ return the result of executing the statement */ Result getResult ( Session session ) { } }
Table table = baseTable ; Result resultOut = null ; RowSetNavigator generatedNavigator = null ; PersistentStore store = session . sessionData . getRowStore ( baseTable ) ; if ( generatedIndexes != null ) { resultOut = Result . newUpdateCountResult ( generatedResultMetaData , 0 ) ; generatedNavigator = resultOut . getChainedResult ( ) . getNavigator ( ) ; } RowSetNavigator newDataNavigator = queryExpression == null ? getInsertValuesNavigator ( session ) : getInsertSelectNavigator ( session ) ; Expression checkCondition = null ; RangeIteratorBase checkIterator = null ; if ( targetTable != baseTable ) { QuerySpecification select = ( ( TableDerived ) targetTable ) . getQueryExpression ( ) . getMainSelect ( ) ; checkCondition = select . checkQueryCondition ; if ( checkCondition != null ) { checkIterator = select . rangeVariables [ 0 ] . getIterator ( session ) ; } } while ( newDataNavigator . hasNext ( ) ) { Object [ ] data = newDataNavigator . getNext ( ) ; if ( checkCondition != null ) { checkIterator . currentData = data ; boolean check = checkCondition . testCondition ( session ) ; if ( ! check ) { throw Error . error ( ErrorCode . X_44000 ) ; } } table . insertRow ( session , store , data ) ; if ( generatedNavigator != null ) { Object [ ] generatedValues = getGeneratedColumns ( data ) ; generatedNavigator . add ( generatedValues ) ; } } newDataNavigator . beforeFirst ( ) ; table . fireAfterTriggers ( session , Trigger . INSERT_AFTER , newDataNavigator ) ; if ( resultOut == null ) { resultOut = Result . getUpdateCountResult ( newDataNavigator . getSize ( ) ) ; } else { resultOut . setUpdateCount ( newDataNavigator . getSize ( ) ) ; } return resultOut ;
public class GeometricCumulativeDoubleBondFactory { /** * Create an encoder for axial 2D stereochemistry for the given start and * end atoms . * @ param container the molecule * @ param start start of the cumulated system * @ param end end of the cumulated system * @ return an encoder or null if there are no coordinated */ static StereoEncoder axialEncoder ( IAtomContainer container , IAtom start , IAtom end ) { } }
List < IBond > startBonds = container . getConnectedBondsList ( start ) ; List < IBond > endBonds = container . getConnectedBondsList ( end ) ; if ( startBonds . size ( ) < 2 || endBonds . size ( ) < 2 ) return null ; if ( has2DCoordinates ( startBonds ) && has2DCoordinates ( endBonds ) ) { return axial2DEncoder ( container , start , startBonds , end , endBonds ) ; } else if ( has3DCoordinates ( startBonds ) && has3DCoordinates ( endBonds ) ) { return axial3DEncoder ( container , start , startBonds , end , endBonds ) ; } return null ;
public class AmazonLightsailClient { /** * Returns the names of all active ( not deleted ) resources . * @ param getActiveNamesRequest * @ return Result of the GetActiveNames operation returned by the service . * @ throws ServiceException * A general service exception . * @ throws InvalidInputException * Lightsail throws this exception when user input does not conform to the validation rules of an input * field . < / p > < note > * Domain - related APIs are only available in the N . Virginia ( us - east - 1 ) Region . Please set your AWS Region * configuration to us - east - 1 to create , view , or edit these resources . * @ throws NotFoundException * Lightsail throws this exception when it cannot find a resource . * @ throws OperationFailureException * Lightsail throws this exception when an operation fails to execute . * @ throws AccessDeniedException * Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to * access a resource . * @ throws AccountSetupInProgressException * Lightsail throws this exception when an account is still in the setup in progress state . * @ throws UnauthenticatedException * Lightsail throws this exception when the user has not been authenticated . * @ sample AmazonLightsail . GetActiveNames * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lightsail - 2016-11-28 / GetActiveNames " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetActiveNamesResult getActiveNames ( GetActiveNamesRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetActiveNames ( request ) ;
public class ReadFileRecordRequest { /** * readData - - read all the data for this request . * @ throws java . io . IOException If the data cannot be read */ public void readData ( DataInput din ) throws IOException { } }
int byteCount = din . readUnsignedByte ( ) ; int recordCount = byteCount / 7 ; records = new RecordRequest [ recordCount ] ; for ( int i = 0 ; i < recordCount ; i ++ ) { if ( din . readByte ( ) != 6 ) { throw new IOException ( ) ; } int file = din . readUnsignedShort ( ) ; int record = din . readUnsignedShort ( ) ; if ( record < 0 || record >= 10000 ) { throw new IOException ( ) ; } int count = din . readUnsignedShort ( ) ; records [ i ] = new RecordRequest ( file , record , count ) ; }
public class Config { public static Integer getPropertyInteger ( Class < ? > cls , String key ) { } }
return getSettings ( ) . getPropertyInteger ( cls , key ) ;
public class DocLint { /** * Simple API entry point . * @ param args Options and operands for doclint * @ throws BadArgs if an error is detected in any args * @ throws IOException if there are problems with any of the file arguments */ public void run ( String ... args ) throws BadArgs , IOException { } }
PrintWriter out = new PrintWriter ( System . out ) ; try { run ( out , args ) ; } finally { out . flush ( ) ; }
public class SimulatorImpl { /** * Schedules the specified task for execution after the specified delay . * @ param task Python object callable without arguments , to schedule * @ param delay delay in seconds before task is to be executed */ public void scheduleTask ( PyObject task , double delay ) { } }
mTimer . schedule ( new PythonCallTimerTask ( task ) , Math . round ( delay * 1000 ) ) ;
public class IfcPortImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) public EList < IfcRelConnectsPorts > getConnectedTo ( ) { } }
return ( EList < IfcRelConnectsPorts > ) eGet ( Ifc2x3tc1Package . Literals . IFC_PORT__CONNECTED_TO , true ) ;
public class BlobInputStream { /** * Repositions this stream to the position at the time the < code > mark < / code > method was last * called on this input stream . NB : If mark is not called we move to the beginning . * @ see java . io . InputStream # mark ( int ) * @ see java . io . IOException */ public synchronized void reset ( ) throws IOException { } }
checkClosed ( ) ; try { if ( mpos <= Integer . MAX_VALUE ) { lo . seek ( ( int ) mpos ) ; } else { lo . seek64 ( mpos , LargeObject . SEEK_SET ) ; } buffer = null ; apos = mpos ; } catch ( SQLException se ) { throw new IOException ( se . toString ( ) ) ; }
public class Utilities { /** * Encrypt a string with AES - 128 using the specified key . * @ param message Input string . * @ param key Encryption key . * @ return Encrypted output . */ @ SuppressWarnings ( "InsecureCryptoUsage" ) // Only used in known - weak crypto " legacy " mode . static byte [ ] aes128Encrypt ( StringBuilder message , String key ) { } }
try { key = normalizeString ( key , 16 ) ; rightPadString ( message , '{' , 16 ) ; Cipher cipher = Cipher . getInstance ( "AES/ECB/NoPadding" ) ; cipher . init ( Cipher . ENCRYPT_MODE , new SecretKeySpec ( key . getBytes ( ) , "AES" ) ) ; return cipher . doFinal ( message . toString ( ) . getBytes ( ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class MaterialCalendarView { /** * Clear the currently selected date ( s ) */ public void clearSelection ( ) { } }
List < CalendarDay > dates = getSelectedDates ( ) ; adapter . clearSelections ( ) ; for ( CalendarDay day : dates ) { dispatchOnDateSelected ( day , false ) ; }
public class Parameters { /** * Gets a parameter whose value is a ( possibly empty ) comma - separated list of Strings . */ public List < String > getStringList ( final String param ) { } }
return get ( param , new StringToStringList ( "," ) , new AlwaysValid < List < String > > ( ) , "comma-separated list of strings" ) ;
public class DescribeLoadBalancerPolicyTypesRequest { /** * The names of the policy types . If no names are specified , describes all policy types defined by Elastic Load * Balancing . * @ return The names of the policy types . If no names are specified , describes all policy types defined by Elastic * Load Balancing . */ public java . util . List < String > getPolicyTypeNames ( ) { } }
if ( policyTypeNames == null ) { policyTypeNames = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return policyTypeNames ;
public class AWSServiceCatalogClient { /** * Get the Access Status for AWS Organization portfolio share feature . This API can only be called by the master * account in the organization . * @ param getAWSOrganizationsAccessStatusRequest * @ return Result of the GetAWSOrganizationsAccessStatus operation returned by the service . * @ throws ResourceNotFoundException * The specified resource was not found . * @ throws OperationNotSupportedException * The operation is not supported . * @ sample AWSServiceCatalog . GetAWSOrganizationsAccessStatus * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / servicecatalog - 2015-12-10 / GetAWSOrganizationsAccessStatus " * target = " _ top " > AWS API Documentation < / a > */ @ Override public GetAWSOrganizationsAccessStatusResult getAWSOrganizationsAccessStatus ( GetAWSOrganizationsAccessStatusRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetAWSOrganizationsAccessStatus ( request ) ;
public class GenerateParseInfoVisitor { /** * Private helper to build the human - readable string for referring to a template in the generated * code ' s javadoc . * @ param currSoyFile The current Soy file for which we ' re generating parse - info code . * @ param template The template that we want to refer to in the generated javadoc . Note that this * template may not be in the current Soy file . * @ return The human - readable string for referring to the given template in the generated code ' s * javadoc . */ private static String buildTemplateNameForJavadoc ( SoyFileNode currSoyFile , TemplateMetadata template ) { } }
StringBuilder resultSb = new StringBuilder ( ) ; if ( template . getSourceLocation ( ) . getFilePath ( ) . equals ( currSoyFile . getFilePath ( ) ) && template . getTemplateKind ( ) != TemplateMetadata . Kind . DELTEMPLATE ) { resultSb . append ( template . getTemplateName ( ) . substring ( template . getTemplateName ( ) . lastIndexOf ( '.' ) ) ) ; } else { switch ( template . getTemplateKind ( ) ) { case BASIC : case ELEMENT : resultSb . append ( template . getTemplateName ( ) ) ; break ; case DELTEMPLATE : resultSb . append ( template . getDelTemplateName ( ) ) ; if ( ! template . getDelTemplateVariant ( ) . isEmpty ( ) ) { resultSb . append ( ':' ) ; resultSb . append ( template . getDelTemplateVariant ( ) ) ; } break ; } } if ( template . getVisibility ( ) != Visibility . PUBLIC ) { resultSb . append ( " (private)" ) ; } if ( template . getTemplateKind ( ) == TemplateMetadata . Kind . DELTEMPLATE ) { resultSb . append ( " (delegate)" ) ; } return resultSb . toString ( ) ;
public class MpxjConvert { /** * Use the universal project reader to open the file . * Throw an exception if we can ' t determine the file type . * @ param inputFile file name * @ return ProjectFile instance */ private ProjectFile readFile ( String inputFile ) throws MPXJException { } }
ProjectReader reader = new UniversalProjectReader ( ) ; ProjectFile projectFile = reader . read ( inputFile ) ; if ( projectFile == null ) { throw new IllegalArgumentException ( "Unsupported file type" ) ; } return projectFile ;
public class PortalApplicationContextLocator { /** * If running in a web application the existing { @ link WebApplicationContext } will be returned . * if not a singleton { @ link ApplicationContext } is created if needed and returned . Unless a * { @ link WebApplicationContext } is specifically needed this method should be used as it will * work both when running in and out of a web application * @ return The { @ link ApplicationContext } for the portal . */ public static ApplicationContext getApplicationContext ( ) { } }
final ServletContext context = servletContext ; if ( context != null ) { getLogger ( ) . debug ( "Using WebApplicationContext" ) ; if ( applicationContextCreator . isCreated ( ) ) { final IllegalStateException createException = new IllegalStateException ( "A portal managed ApplicationContext has already been created but now a ServletContext is available and a WebApplicationContext will be returned. " + "This situation should be resolved by delaying calls to this class until after the web-application has completely initialized." ) ; getLogger ( ) . error ( createException , createException ) ; getLogger ( ) . error ( "Stack trace of original ApplicationContext creator" , directCreatorThrowable ) ; throw createException ; } final WebApplicationContext webApplicationContext = WebApplicationContextUtils . getWebApplicationContext ( context ) ; if ( webApplicationContext == null ) { throw new IllegalStateException ( "ServletContext is available but WebApplicationContextUtils.getWebApplicationContext(ServletContext) returned null. Either the application context failed to load or is not yet done loading." ) ; } return webApplicationContext ; } return applicationContextCreator . get ( ) ;
public class SpringApplicationBuilder { /** * Default properties for the environment . Multiple calls to this method are * cumulative . * @ param defaults the default properties * @ return the current builder * @ see SpringApplicationBuilder # properties ( String . . . ) */ public SpringApplicationBuilder properties ( Map < String , Object > defaults ) { } }
this . defaultProperties . putAll ( defaults ) ; this . application . setDefaultProperties ( this . defaultProperties ) ; if ( this . parent != null ) { this . parent . properties ( this . defaultProperties ) ; this . parent . environment ( this . environment ) ; } return this ;
public class CmsAliasList { /** * Adds the controls for a single alias to the widget . < p > * @ param alias the alias for which the controls should be added */ public void addAlias ( final CmsAliasBean alias ) { } }
final HorizontalPanel hp = new HorizontalPanel ( ) ; hp . getElement ( ) . getStyle ( ) . setMargin ( 2 , Unit . PX ) ; final CmsTextBox textbox = createTextBox ( ) ; textbox . setFormValueAsString ( alias . getSitePath ( ) ) ; hp . add ( textbox ) ; CmsSelectBox selectbox = createSelectBox ( ) ; selectbox . setFormValueAsString ( alias . getMode ( ) . toString ( ) ) ; hp . add ( selectbox ) ; PushButton deleteButton = createDeleteButton ( ) ; hp . add ( deleteButton ) ; final AliasControls controls = new AliasControls ( alias , textbox , selectbox ) ; m_aliasControls . put ( controls . getId ( ) , controls ) ; selectbox . addValueChangeHandler ( new ValueChangeHandler < String > ( ) { public void onValueChange ( ValueChangeEvent < String > event ) { onChangePath ( controls ) ; } } ) ; deleteButton . addClickHandler ( new ClickHandler ( ) { public void onClick ( ClickEvent e ) { m_aliasControls . remove ( controls . getId ( ) ) ; hp . removeFromParent ( ) ; validateFull ( m_structureId , getAliasPaths ( ) , m_defaultValidationHandler ) ; } } ) ; textbox . addValueChangeHandler ( new ValueChangeHandler < String > ( ) { public void onValueChange ( ValueChangeEvent < String > e ) { onChangePath ( controls ) ; validateFull ( m_structureId , getAliasPaths ( ) , m_defaultValidationHandler ) ; } } ) ; textbox . addKeyPressHandler ( new KeyPressHandler ( ) { public void onKeyPress ( KeyPressEvent event ) { onChangePath ( controls ) ; } } ) ; m_changeBox . add ( hp ) ; CmsDomUtil . resizeAncestor ( this ) ;
public class AmazonRedshiftClient { /** * Returns a list of Amazon Redshift parameter groups , including parameter groups you created and the default * parameter group . For each parameter group , the response includes the parameter group name , description , and * parameter group family name . You can optionally specify a name to retrieve the description of a specific * parameter group . * For more information about parameters and parameter groups , go to < a * href = " https : / / docs . aws . amazon . com / redshift / latest / mgmt / working - with - parameter - groups . html " > Amazon Redshift * Parameter Groups < / a > in the < i > Amazon Redshift Cluster Management Guide < / i > . * If you specify both tag keys and tag values in the same request , Amazon Redshift returns all parameter groups * that match any combination of the specified keys and values . For example , if you have < code > owner < / code > and * < code > environment < / code > for tag keys , and < code > admin < / code > and < code > test < / code > for tag values , all parameter * groups that have any combination of those values are returned . * If both tag keys and values are omitted from the request , parameter groups are returned regardless of whether * they have tag keys or values associated with them . * @ param describeClusterParameterGroupsRequest * @ return Result of the DescribeClusterParameterGroups operation returned by the service . * @ throws ClusterParameterGroupNotFoundException * The parameter group name does not refer to an existing parameter group . * @ throws InvalidTagException * The tag is invalid . * @ sample AmazonRedshift . DescribeClusterParameterGroups * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / redshift - 2012-12-01 / DescribeClusterParameterGroups " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeClusterParameterGroupsResult describeClusterParameterGroups ( DescribeClusterParameterGroupsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeClusterParameterGroups ( request ) ;
public class AbstractFileSystem { /** * { @ inheritDoc } * Sets up a lazy connection to Alluxio through mFileSystem . This must be called before client * operations . * If it is called twice on the same object concurrently , one of the thread will do the * initialization work , the other will wait until initialization is done . * If it is called after initialized , then this is a noop . */ @ Override public synchronized void initialize ( URI uri , org . apache . hadoop . conf . Configuration conf ) throws IOException { } }
initialize ( uri , conf , null ) ;
public class RaftNodeImpl { /** * Restores the snapshot sent by the leader if it ' s not applied before . * @ return true if snapshot is restores , false otherwise . */ public boolean installSnapshot ( SnapshotEntry snapshot ) { } }
long commitIndex = state . commitIndex ( ) ; if ( commitIndex > snapshot . index ( ) ) { logger . info ( "Ignored stale " + snapshot + ", commit index at: " + commitIndex ) ; return false ; } else if ( commitIndex == snapshot . index ( ) ) { logger . info ( "Ignored " + snapshot + " since commit index is same." ) ; return true ; } state . commitIndex ( snapshot . index ( ) ) ; int truncated = state . log ( ) . setSnapshot ( snapshot ) ; if ( truncated > 0 ) { logger . info ( truncated + " entries are truncated to install " + snapshot ) ; } raftIntegration . restoreSnapshot ( snapshot . operation ( ) , snapshot . index ( ) ) ; // If I am installing a snapshot , it means I am still present in the last member list , // but it is possible that the last entry I appended before the snapshot could be a membership change . // Because of this , I need to update my status . // Nevertheless , I may not be present in the restored member list , which is ok . setStatus ( ACTIVE ) ; state . restoreGroupMembers ( snapshot . groupMembersLogIndex ( ) , snapshot . groupMembers ( ) ) ; printMemberState ( ) ; state . lastApplied ( snapshot . index ( ) ) ; invalidateFuturesUntil ( snapshot . index ( ) , new StaleAppendRequestException ( state . leader ( ) ) ) ; logger . info ( snapshot + " is installed." ) ; return true ;
public class XMLConverUtil { /** * XML to Object * @ param < T > * @ param clazz * clazz * @ param inputStream * inputStream * @ param charset * charset * @ return T */ public static < T > T convertToObject ( Class < T > clazz , InputStream inputStream , Charset charset ) { } }
return convertToObject ( clazz , new InputStreamReader ( inputStream , charset ) ) ;
public class DefaultSocketManager { /** * Open the read and write selectors . This needs to be done before data can * be send through this socket manager using its own API ( not the * { @ link # redirectChannel ( ) redirected channel } ) . These selectors should be * { @ link # closeSelectors ( ) closed } before redirecting the channel to * prevent corruption . * @ throws IOException * if an error occurs while opening either selector */ private void openSelectors ( ) throws IOException { } }
readSelector = Selector . open ( ) ; socket . register ( readSelector , SelectionKey . OP_READ ) ; writeSelector = Selector . open ( ) ; socket . register ( writeSelector , SelectionKey . OP_WRITE ) ;
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public String convertIfcLoadGroupTypeEnumToString ( EDataType eDataType , Object instanceValue ) { } }
return instanceValue == null ? null : instanceValue . toString ( ) ;
public class CompositedActionFrames { /** * documentation inherited from interface */ public int getYOrigin ( int orient , int frameIdx ) { } }
CompositedMultiFrameImage cmfi = ( CompositedMultiFrameImage ) getFrames ( orient ) ; return cmfi . getYOrigin ( frameIdx ) ;
public class GridSyncRecordMessageFilterHandler { /** * On select , synchronize the records . */ public int doRecordChange ( FieldInfo field , int iChangeType , boolean bDisplayOption ) { } }
// Read a valid record int iErrorCode = super . doRecordChange ( field , iChangeType , bDisplayOption ) ; // Initialize the record if ( iErrorCode == DBConstants . NORMAL_RETURN ) { if ( iChangeType == DBConstants . AFTER_ADD_TYPE ) { Object bookmark = this . getOwner ( ) . getLastModified ( m_iHandleType ) ; if ( bookmark != null ) this . addBookmarkFilter ( bookmark ) ; } if ( iChangeType == DBConstants . AFTER_REQUERY_TYPE ) { String strKeyName = null ; Object objKeyData = null ; if ( this . getOwner ( ) . getDefaultOrder ( ) > 0 ) { strKeyName = this . getOwner ( ) . getKeyArea ( ) . getKeyName ( ) ; KeyField keyField = this . getOwner ( ) . getKeyArea ( ) . getKeyField ( 0 ) ; BaseField fldKey = keyField . getField ( DBConstants . FILE_KEY_AREA ) ; if ( fldKey instanceof ReferenceField ) { if ( ! keyField . getField ( DBConstants . END_SELECT_KEY ) . isNull ( ) ) if ( keyField . getField ( DBConstants . END_SELECT_KEY ) . equals ( keyField . getField ( DBConstants . START_SELECT_KEY ) ) ) { fldKey = keyField . getField ( DBConstants . START_SELECT_KEY ) ; // On a requery this should be the key objKeyData = fldKey . getData ( ) ; } } } this . clearBookmarkFilters ( strKeyName , objKeyData ) ; } } return iErrorCode ;