signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class XNElement { /** * Set an attribute value identified by a local name and namespace . * @ param name the attribute name * @ param namespace the attribute namespace * @ param value the value , if null , the attribute will be removed */ public void set ( String name , String namespace , Object value ) { } }
if ( value != null ) { if ( value instanceof Date ) { attributes . put ( new XAttributeName ( name , namespace , null ) , formatDateTime ( ( Date ) value ) ) ; } else { attributes . put ( new XAttributeName ( name , namespace , null ) , value . toString ( ) ) ; } } else { attributes . remove ( new XAttributeName ( name , namespace , null ) ) ; }
public class PathMetadataFactory { /** * Create a new PathMetadata instance for indexed list access * @ param parent parent path * @ param index index of element * @ return list access path */ public static PathMetadata forListAccess ( Path < ? > parent , @ Nonnegative int index ) { } }
return new PathMetadata ( parent , index , PathType . LISTVALUE_CONSTANT ) ;
public class PerspectiveOps { /** * Given the intrinsic parameters create a calibration matrix * @ param param Intrinsic parameters structure that is to be converted into a matrix * @ param K Storage for calibration matrix , must be 3x3 . If null then a new matrix is declared * @ return Calibration matrix 3x3 */ public static DMatrixRMaj pinholeToMatrix ( CameraPinhole param , DMatrixRMaj K ) { } }
return ImplPerspectiveOps_F64 . pinholeToMatrix ( param , K ) ;
public class GeometryEngine { /** * Creates the symmetric difference of two geometries . * See OperatorSymmetricDifference . * @ param leftGeometry * is one of the Geometry instances in the XOR operation . * @ param rightGeometry * is one of the Geometry instances in the XOR operation . * @ param spatialReference * The spatial reference of the geometries . * @ return Returns the result of the symmetric difference . */ public static Geometry symmetricDifference ( Geometry leftGeometry , Geometry rightGeometry , SpatialReference spatialReference ) { } }
OperatorSymmetricDifference op = ( OperatorSymmetricDifference ) factory . getOperator ( Operator . Type . SymmetricDifference ) ; Geometry result = op . execute ( leftGeometry , rightGeometry , spatialReference , null ) ; return result ;
public class XMLResultsParser { /** * Returns the new base URI , based on the old base URI and the xml : base value in the current element . */ static private String getBase ( String oldBase , XMLStreamReader rdr ) { } }
String newBase = resolve ( oldBase , rdr . getAttributeValue ( XML_NS , BASE ) ) ; if ( newBase != oldBase ) { logger . debug ( "xml:base is now {}" , newBase ) ; } return newBase ;
public class SelectResultSet { /** * { inheritDoc } . */ public Blob getBlob ( int columnIndex ) throws SQLException { } }
checkObjectRange ( columnIndex ) ; if ( row . lastValueWasNull ( ) ) { return null ; } return new MariaDbBlob ( row . buf , row . pos , row . length ) ;
public class GraphUtils { /** * Debugging : dot representation of a set of connected nodes . The resulting * dot representation will use { @ code Node . toString } to display node labels * and { @ code Node . printDependency } to display edge labels . The resulting * representation is also customizable with a graph name and a header . */ public static < D , N extends DottableNode < D , N > > String toDot ( Collection < ? extends N > nodes , String name , String header ) { } }
StringBuilder buf = new StringBuilder ( ) ; buf . append ( String . format ( "digraph %s {\n" , name ) ) ; buf . append ( String . format ( "label = %s;\n" , DotVisitor . wrap ( header ) ) ) ; DotVisitor < D , N > dotVisitor = new DotVisitor < > ( ) ; dotVisitor . visit ( nodes , buf ) ; buf . append ( "}\n" ) ; return buf . toString ( ) ;
public class CPAttachmentFileEntryPersistenceImpl { /** * Returns the cp attachment file entry where uuid = & # 63 ; and groupId = & # 63 ; or returns < code > null < / code > if it could not be found . Uses the finder cache . * @ param uuid the uuid * @ param groupId the group ID * @ return the matching cp attachment file entry , or < code > null < / code > if a matching cp attachment file entry could not be found */ @ Override public CPAttachmentFileEntry fetchByUUID_G ( String uuid , long groupId ) { } }
return fetchByUUID_G ( uuid , groupId , true ) ;
public class Op { /** * Splits the string around the given delimiter * @ param string is the string to split * @ param delimiter is the substrings on which the string will be split * @ param ignoreEmpty whether the empty strings are discarded * @ return the string split around the given delimiter */ public static List < String > split ( String string , String delimiter , boolean ignoreEmpty ) { } }
List < String > result = new ArrayList < String > ( ) ; if ( string . isEmpty ( ) || delimiter . isEmpty ( ) ) { result . add ( string ) ; return result ; } int position = 0 , next = 0 ; while ( next >= 0 ) { next = string . indexOf ( delimiter , position ) ; String token ; if ( next < 0 ) { token = string . substring ( position ) ; } else { token = string . substring ( position , next ) ; } if ( ! ( token . isEmpty ( ) && ignoreEmpty ) ) { result . add ( token ) ; } if ( next >= 0 ) { position = next + delimiter . length ( ) ; } } return result ;
public class FlashImpl { /** * Restore any saved FacesMessages from the previous request . * Note that we don ' t need to save the keepMessages value for this request , * because we just have to check if the value for FLASH _ KEEP _ MESSAGES _ LIST exists . * @ param facesContext */ @ SuppressWarnings ( "unchecked" ) private void _restoreMessages ( FacesContext facesContext ) { } }
List < MessageEntry > messageList = ( List < MessageEntry > ) _getExecuteFlashMap ( facesContext ) . get ( FLASH_KEEP_MESSAGES_LIST ) ; if ( messageList != null ) { Iterator < MessageEntry > iterMessages = messageList . iterator ( ) ; while ( iterMessages . hasNext ( ) ) { MessageEntry entry = iterMessages . next ( ) ; facesContext . addMessage ( entry . clientId , entry . message ) ; } // we can now remove the messagesList from the flashMap _getExecuteFlashMap ( facesContext ) . remove ( FLASH_KEEP_MESSAGES_LIST ) ; }
public class JsonConfig { /** * Returns a set of default excludes with user - defined excludes . < br > * Takes into account any additional excludes per matching class . * [ Java - & gt ; JSON ] */ public Collection getMergedExcludes ( Class target ) { } }
if ( target == null ) { return getMergedExcludes ( ) ; } Collection exclusionSet = getMergedExcludes ( ) ; if ( ! exclusionMap . isEmpty ( ) ) { Object key = propertyExclusionClassMatcher . getMatch ( target , exclusionMap . keySet ( ) ) ; Set set = ( Set ) exclusionMap . get ( key ) ; if ( set != null && ! set . isEmpty ( ) ) { for ( Iterator i = set . iterator ( ) ; i . hasNext ( ) ; ) { Object e = i . next ( ) ; if ( ! exclusionSet . contains ( e ) ) { exclusionSet . add ( e ) ; } } } } return exclusionSet ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcFilterType ( ) { } }
if ( ifcFilterTypeEClass == null ) { ifcFilterTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 238 ) ; } return ifcFilterTypeEClass ;
public class CsvProcessor { /** * Read in all of the entities in the file passed in . * @ param file * Where to read the header and entities from . It will be closed when the method returns . * @ param parseErrors * If not null , any errors will be added to the collection and null will be returned . If validateHeader * is true and the header does not match then no additional lines will be returned . If this is null then * a ParseException will be thrown on parsing problems . * @ return A list of entities read in or null if validateHeader is true and the first - line header was not valid . * @ throws ParseException * Thrown on any parsing problems . If parseErrors is not null then parse errors will be added there and * an exception should not be thrown . * @ throws IOException * If there are any IO exceptions thrown when reading . */ public List < T > readAll ( File file , Collection < ParseError > parseErrors ) throws IOException , ParseException { } }
checkEntityConfig ( ) ; return readAll ( new FileReader ( file ) , parseErrors ) ;
public class ImageHandlerBuilder { /** * Uses compression quality of < code > qualityPercent < / code > . * Can be applied multiple times * @ param qualityPercent the percentage of compression quality wanted . Must be between 0.0 and 1.0 * @ return this for chaining */ public ImageHandlerBuilder reduceQuality ( float qualityPercent ) { } }
ImageWriter imageWriter = ImageIO . getImageWritersByFormatName ( fn . extension ( ) ) . next ( ) ; if ( imageWriter != null ) { ImageWriteParam writeParam = imageWriter . getDefaultWriteParam ( ) ; writeParam . setCompressionMode ( ImageWriteParam . MODE_EXPLICIT ) ; writeParam . setCompressionQuality ( qualityPercent ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; imageWriter . setOutput ( new MemoryCacheImageOutputStream ( baos ) ) ; try { imageWriter . write ( null , new IIOImage ( image , null , null ) , writeParam ) ; imageWriter . dispose ( ) ; } catch ( IOException e ) { throw new ControllerException ( e ) ; } try { BufferedImage lowImage = ImageIO . read ( new ByteArrayInputStream ( baos . toByteArray ( ) ) ) ; image . flush ( ) ; image = lowImage ; } catch ( IOException e ) { throw new ControllerException ( e ) ; } } return this ;
public class HttpResponse { /** * 强制同步 , 用于初始化 < br > * 强制同步后变化如下 : * < pre > * 1 、 读取body内容到内存 * 2 、 异步状态设为false ( 变为同步状态 ) * 3 、 关闭Http流 * 4 、 断开与服务器连接 * < / pre > * @ return this */ private HttpResponse forceSync ( ) { } }
// 非同步状态转为同步状态 try { this . readBody ( this . in ) ; } catch ( IORuntimeException e ) { if ( e . getCause ( ) instanceof FileNotFoundException ) { // 服务器无返回内容 , 忽略之 } else { throw new HttpException ( e ) ; } } finally { if ( this . isAsync ) { this . isAsync = false ; } this . close ( ) ; } return this ;
public class MqttSpout { /** * { @ inheritDoc } */ @ Override public void ack ( Object msgId ) { } }
Message message = this . ackWaitMap . remove ( msgId ) ; if ( message != null ) { message . ack ( ) ; }
public class Signature { /** * Returns the return type for the provided string . * @ param s String * @ return { @ link ReturnType } */ private static ReturnType returnType ( final String s ) { } }
String [ ] args = ARGS_REGEX . split ( s ) ; return ReturnType . getReturnType ( args [ args . length - 1 ] ) ;
public class WebAuthenticatorProxy { /** * Get the appropriate Authenticator based on the authType * @ param authType the auth type , either FORM or BASIC * @ param the WebRequest * @ return The WebAuthenticator or { @ code null } if the authType is unknown */ private WebAuthenticator getAuthenticatorForFailOver ( String authType , WebRequest webRequest ) { } }
WebAuthenticator authenticator = null ; if ( LoginConfiguration . FORM . equals ( authType ) ) { authenticator = createFormLoginAuthenticator ( webRequest ) ; } else if ( LoginConfiguration . BASIC . equals ( authType ) ) { authenticator = getBasicAuthAuthenticator ( ) ; } return authenticator ;
public class HttpRemoteTaskRunner { /** * held . See https : / / github . com / apache / incubator - druid / issues / 6201 */ private void taskComplete ( HttpRemoteTaskRunnerWorkItem taskRunnerWorkItem , WorkerHolder workerHolder , TaskStatus taskStatus ) { } }
Preconditions . checkState ( ! Thread . holdsLock ( statusLock ) , "Current thread must not hold statusLock." ) ; Preconditions . checkNotNull ( taskRunnerWorkItem , "taskRunnerWorkItem" ) ; Preconditions . checkNotNull ( taskStatus , "taskStatus" ) ; if ( workerHolder != null ) { log . info ( "Worker[%s] completed task[%s] with status[%s]" , workerHolder . getWorker ( ) . getHost ( ) , taskStatus . getId ( ) , taskStatus . getStatusCode ( ) ) ; // Worker is done with this task workerHolder . setLastCompletedTaskTime ( DateTimes . nowUtc ( ) ) ; } // Notify interested parties taskRunnerWorkItem . setResult ( taskStatus ) ; TaskRunnerUtils . notifyStatusChanged ( listeners , taskStatus . getId ( ) , taskStatus ) ; // Update success / failure counters , Blacklist node if there are too many failures . if ( workerHolder != null ) { blacklistWorkerIfNeeded ( taskStatus , workerHolder ) ; } synchronized ( statusLock ) { statusLock . notifyAll ( ) ; }
public class ProcedureRunnerNT { /** * Send a response back to the proc caller . Refactored out of coreCall for both * regular and exceptional paths . */ private void completeCall ( ClientResponseImpl response ) { } }
// if we ' re keeping track , calculate result size if ( m_perCallStats . samplingProcedure ( ) ) { m_perCallStats . setResultSize ( response . getResults ( ) ) ; } m_statsCollector . endProcedure ( response . getStatus ( ) == ClientResponse . USER_ABORT , ( response . getStatus ( ) != ClientResponse . USER_ABORT ) && ( response . getStatus ( ) != ClientResponse . SUCCESS ) , m_perCallStats ) ; // allow the GC to collect per - call stats if this proc isn ' t called for a while m_perCallStats = null ; // send the response to the caller // must be done as IRM to CI mailbox for backpressure accounting response . setClientHandle ( m_clientHandle ) ; InitiateResponseMessage irm = InitiateResponseMessage . messageForNTProcResponse ( m_ciHandle , m_ccxn . connectionId ( ) , response ) ; m_mailbox . deliver ( irm ) ; m_ntProcService . handleNTProcEnd ( ProcedureRunnerNT . this ) ;
public class Database { /** * Returns the schema and authorisation statements for the database . */ public Result getScript ( boolean indexRoots ) { } }
Result r = Result . newSingleColumnResult ( "COMMAND" , Type . SQL_VARCHAR ) ; String [ ] list = getSettingsSQL ( ) ; addRows ( r , list ) ; list = getGranteeManager ( ) . getSQL ( ) ; addRows ( r , list ) ; // schemas and schema objects such as tables , sequences , etc . list = schemaManager . getSQLArray ( ) ; addRows ( r , list ) ; // index roots if ( indexRoots ) { list = schemaManager . getIndexRootsSQL ( ) ; addRows ( r , list ) ; } // user session start schema names list = getUserManager ( ) . getInitialSchemaSQL ( ) ; addRows ( r , list ) ; // grantee rights list = getGranteeManager ( ) . getRightstSQL ( ) ; addRows ( r , list ) ; list = getPropertiesSQL ( ) ; addRows ( r , list ) ; return r ;
public class LPPresolver { /** * This method is just for testing scope . */ private void checkProgress ( DoubleMatrix1D c , DoubleMatrix2D A , DoubleMatrix1D b , DoubleMatrix1D lb , DoubleMatrix1D ub , DoubleMatrix1D ylb , DoubleMatrix1D yub , DoubleMatrix1D zlb , DoubleMatrix1D zub ) { } }
if ( this . expectedSolution == null ) { return ; } if ( Double . isNaN ( this . expectedTolerance ) ) { // for this to work properly , this method must be called at least one time before presolving operations start RealVector X = MatrixUtils . createRealVector ( expectedSolution ) ; RealMatrix AMatrix = MatrixUtils . createRealMatrix ( A . toArray ( ) ) ; RealVector Bvector = MatrixUtils . createRealVector ( b . toArray ( ) ) ; RealVector Axb = AMatrix . operate ( X ) . subtract ( Bvector ) ; double norm = Axb . getNorm ( ) ; this . expectedTolerance = Math . max ( 1.e-7 , 1.01 * norm ) ; } double tolerance = this . expectedTolerance ; log . debug ( "tolerance: " + tolerance ) ; RealVector X = MatrixUtils . createRealVector ( expectedSolution ) ; RealMatrix AMatrix = MatrixUtils . createRealMatrix ( A . toArray ( ) ) ; RealVector Bvector = MatrixUtils . createRealVector ( b . toArray ( ) ) ; // logger . debug ( " A . X - b : " + ArrayUtils . toString ( originalA . operate ( X ) . subtract ( originalB ) ) ) ; // nz rows for ( int i = 0 ; i < vRowPositions . length ; i ++ ) { short [ ] vRowPositionsI = vRowPositions [ i ] ; for ( short nzJ : vRowPositionsI ) { if ( Double . compare ( A . getQuick ( i , nzJ ) , 0. ) == 0 ) { log . debug ( "entry " + i + "," + nzJ + " est zero: " + A . getQuick ( i , nzJ ) ) ; throw new IllegalStateException ( ) ; } } } // nz columns for ( int j = 0 ; j < vColPositions . length ; j ++ ) { short [ ] vColPositionsJ = vColPositions [ j ] ; for ( short nzI : vColPositionsJ ) { if ( Double . compare ( A . getQuick ( nzI , j ) , 0. ) == 0 ) { log . debug ( "entry (" + nzI + "," + j + ") est zero: " + A . getQuick ( nzI , j ) ) ; throw new IllegalStateException ( ) ; } } } // nz Aij for ( int i = 0 ; i < A . rows ( ) ; i ++ ) { short [ ] vRowPositionsI = vRowPositions [ i ] ; for ( int j = 0 ; j < A . columns ( ) ; j ++ ) { if ( Double . compare ( Math . abs ( A . getQuick ( i , j ) ) , 0. ) != 0 ) { if ( ! ArrayUtils . contains ( vRowPositionsI , ( short ) j ) ) { log . debug ( "entry " + i + "," + j + " est non-zero: " + A . getQuick ( i , j ) ) ; throw new IllegalStateException ( ) ; } if ( ! ArrayUtils . contains ( vColPositions [ j ] , ( short ) i ) ) { log . debug ( "entry " + i + "," + j + " est non-zero: " + A . getQuick ( i , j ) ) ; throw new IllegalStateException ( ) ; } } } } // A . x = b RealVector Axb = AMatrix . operate ( X ) . subtract ( Bvector ) ; double norm = Axb . getNorm ( ) ; log . debug ( "|| A.x-b ||: " + norm ) ; if ( norm > tolerance ) { // where is the error ? for ( int i = 0 ; i < Axb . getDimension ( ) ; i ++ ) { if ( Math . abs ( Axb . getEntry ( i ) ) > tolerance ) { log . debug ( "entry " + i + ": " + Axb . getEntry ( i ) ) ; throw new IllegalStateException ( ) ; } } throw new IllegalStateException ( ) ; } // upper e lower for ( int i = 0 ; i < X . getDimension ( ) ; i ++ ) { if ( X . getEntry ( i ) + tolerance < lb . getQuick ( i ) ) { log . debug ( "lower bound " + i + " not respected: lb=" + lb . getQuick ( i ) + ", value=" + X . getEntry ( i ) ) ; throw new IllegalStateException ( ) ; } if ( X . getEntry ( i ) > ub . getQuick ( i ) + tolerance ) { log . debug ( "upper bound " + i + " not respected: ub=" + ub . getQuick ( i ) + ", value=" + X . getEntry ( i ) ) ; throw new IllegalStateException ( ) ; } }
public class AbstractSegment3F { /** * Replies the projection a point on a segment . * @ param px * is the coordiante of the point to project * @ param py * is the coordiante of the point to project * @ param pz * is the coordiante of the point to project * @ param s1x * is the x - coordinate of the first line point . * @ param s1y * is the y - coordinate of the first line point . * @ param s1z * is the z - coordinate of the first line point . * @ param s2x * is the x - coordinate of the second line point . * @ param s2y * is the y - coordinate of the second line point . * @ param s2z * is the z - coordinate of the second line point . * @ return the projection of the specified point on the line . * If equal to { @ code 0 } , the projection is equal to the first segment point . * If equal to { @ code 1 } , the projection is equal to the second segment point . * If inside { @ code ] 0;1 [ } , the projection is between the two segment points . * If inside { @ code ] - inf ; 0 [ } , the projection is outside on the side of the first segment point . * If inside { @ code ] 1 ; + inf [ } , the projection is outside on the side of the second segment point . */ @ Pure public static double getPointProjectionFactorOnSegmentLine ( double px , double py , double pz , double s1x , double s1y , double s1z , double s2x , double s2y , double s2z ) { } }
double dx = s2x - s1x ; double dy = s2y - s1y ; double dz = s2z - s1z ; if ( dx == 0. && dy == 0. && dz == 0. ) return 0. ; return ( ( px - s1x ) * dx + ( py - s1y ) * dy + ( pz - s1z ) * dz ) / ( dx * dx + dy * dy + dz * dz ) ;
public class Stream { /** * Returns a Stream concatenating zero or more Iterables . If an input Iterable is a Stream , it * is closed as soon as exhausted or as iteration completes . * @ param iterables * an Iterable with the Iterables or Streams to concatenate * @ param < T > * the type of elements * @ return the resulting concatenated Stream */ public static < T > Stream < T > concat ( final Iterable < ? extends Iterable < ? extends T > > iterables ) { } }
return new ConcatStream < Iterable < ? extends T > , T > ( create ( iterables ) ) ;
public class HelpUtil { /** * Remove and optionally close the help viewer associated with the specified page . * @ param page The page owning the help viewer . * @ param close If true , close the help viewer after removing it . */ protected static void removeViewer ( Page page , boolean close ) { } }
IHelpViewer viewer = ( IHelpViewer ) page . removeAttribute ( VIEWER_ATTRIB ) ; if ( viewer != null && close ) { viewer . close ( ) ; }
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcMaterialDefinitionRepresentation ( ) { } }
if ( ifcMaterialDefinitionRepresentationEClass == null ) { ifcMaterialDefinitionRepresentationEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 308 ) ; } return ifcMaterialDefinitionRepresentationEClass ;
public class ProjectEntityExtensionController { /** * Gets the list of information extensions for an entity */ @ RequestMapping ( value = "information/{entityType}/{id}" , method = RequestMethod . GET ) public Resources < EntityInformation > getInformation ( @ PathVariable ProjectEntityType entityType , @ PathVariable ID id ) { } }
// Gets the entity ProjectEntity entity = getEntity ( entityType , id ) ; // List of informations to return List < EntityInformation > informations = extensionManager . getExtensions ( EntityInformationExtension . class ) . stream ( ) . map ( x -> x . getInformation ( entity ) ) . filter ( Optional :: isPresent ) . map ( Optional :: get ) . collect ( Collectors . toList ( ) ) ; // OK return Resources . of ( informations , uri ( MvcUriComponentsBuilder . on ( getClass ( ) ) . getInformation ( entityType , id ) ) ) ;
public class ExtensionFactory { /** * Store and return a weak reference equals to the passed version . * @ param rawVersion the version to find * @ return unique instance of { @ link VersionConstraint } equals to the passed one */ public Version getVersion ( String rawVersion ) { } }
Version version = this . versions . get ( rawVersion ) ; if ( version == null ) { version = new DefaultVersion ( rawVersion ) ; this . versions . put ( rawVersion , version ) ; } return version ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcPump ( ) { } }
if ( ifcPumpEClass == null ) { ifcPumpEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 485 ) ; } return ifcPumpEClass ;
public class ElemLiteralResult { /** * Get a literal result attribute by name . The name is namespaceURI : localname * if namespace is not null . * @ param name Name of literal result attribute to get * @ return literal result attribute ( AVT ) */ public AVT getLiteralResultAttribute ( String name ) { } }
if ( null != m_avts ) { int nAttrs = m_avts . size ( ) ; String namespace = null ; for ( int i = ( nAttrs - 1 ) ; i >= 0 ; i -- ) { AVT avt = ( AVT ) m_avts . get ( i ) ; namespace = avt . getURI ( ) ; if ( ( namespace != null && ( ! namespace . equals ( "" ) ) && ( namespace + ":" + avt . getName ( ) ) . equals ( name ) ) || ( ( namespace == null || namespace . equals ( "" ) ) && avt . getRawName ( ) . equals ( name ) ) ) { return avt ; } } // end for } return null ;
public class KeyValueStoreSessionIdManager { @ Override protected void doStart ( ) throws Exception { } }
log . info ( "starting..." ) ; super . doStart ( ) ; _client = newClient ( _serverString ) ; if ( _client == null ) { throw new IllegalStateException ( "newClient(" + _serverString + ") returns null." ) ; } log . info ( "use " + _client . getClass ( ) . getSimpleName ( ) + " as client factory." ) ; _client . establish ( ) ; log . info ( "started." ) ;
public class PackagesScanListener { /** * Get the projectID if this directory has any files in it . * Otherwise , return 0 meaning I don ' t have to specify this package . */ public boolean directoryContainsFiles ( File fileDir ) { } }
boolean containsFiles = false ; File [ ] files = fileDir . listFiles ( ) ; if ( files != null ) { for ( File file : files ) { if ( ! file . isDirectory ( ) ) containsFiles = true ; } } return containsFiles ;
public class LocalTime { /** * Returns an adjusted copy of this time . * This returns a { @ code LocalTime } , based on this one , with the time adjusted . * The adjustment takes place using the specified adjuster strategy object . * Read the documentation of the adjuster to understand what adjustment will be made . * A simple adjuster might simply set the one of the fields , such as the hour field . * A more complex adjuster might set the time to the last hour of the day . * The result of this method is obtained by invoking the * { @ link TemporalAdjuster # adjustInto ( Temporal ) } method on the * specified adjuster passing { @ code this } as the argument . * This instance is immutable and unaffected by this method call . * @ param adjuster the adjuster to use , not null * @ return a { @ code LocalTime } based on { @ code this } with the adjustment made , not null * @ throws DateTimeException if the adjustment cannot be made * @ throws ArithmeticException if numeric overflow occurs */ @ Override public LocalTime with ( TemporalAdjuster adjuster ) { } }
// optimizations if ( adjuster instanceof LocalTime ) { return ( LocalTime ) adjuster ; } return ( LocalTime ) adjuster . adjustInto ( this ) ;
public class ADMath { /** * Some of this might need to change for optimal AD */ public static DoubleAD logSum ( DoubleAD [ ] logInputs , int fromIndex , int toIndex ) { } }
if ( logInputs . length == 0 ) throw new IllegalArgumentException ( ) ; if ( fromIndex >= 0 && toIndex < logInputs . length && fromIndex >= toIndex ) return new DoubleAD ( Double . NEGATIVE_INFINITY , Double . NEGATIVE_INFINITY ) ; int maxIdx = fromIndex ; double max = logInputs [ fromIndex ] . getval ( ) ; double maxdot = logInputs [ fromIndex ] . getdot ( ) ; for ( int i = fromIndex + 1 ; i < toIndex ; i ++ ) { if ( logInputs [ i ] . getval ( ) > max ) { maxIdx = i ; maxdot = logInputs [ i ] . getdot ( ) ; max = logInputs [ i ] . getval ( ) ; } } DoubleAD ret = new DoubleAD ( ) ; boolean haveTerms = false ; double intermediate = 0.0 ; double intermediateDot = 0.0 ; double curEXP ; double cutoff = max - SloppyMath . LOGTOLERANCE ; // we avoid rearranging the array and so test indices each time ! for ( int i = fromIndex ; i < toIndex ; i ++ ) { if ( i != maxIdx && logInputs [ i ] . getval ( ) > cutoff ) { haveTerms = true ; curEXP = Math . exp ( logInputs [ i ] . getval ( ) - max ) ; intermediate += curEXP ; intermediateDot += curEXP * logInputs [ i ] . getdot ( ) ; } } if ( haveTerms ) { ret . setval ( max + Math . log ( 1.0 + intermediate ) ) ; ret . setdot ( ( maxdot + intermediateDot ) / ( 1.0 + intermediate ) ) ; } else { ret . setval ( max ) ; ret . setdot ( maxdot ) ; } return ret ;
public class Decoder { /** * Decode a media packet with audio samples into an { @ code AudioFrame } . * @ param mediaPacket packet with audio samples . * @ return an { @ code AudioFrame } with normalized PCM audio samples . * @ throws JavaAVException if audio packet could not be decoded . */ public AudioFrame decodeAudio ( MediaPacket mediaPacket ) throws JavaAVException { } }
if ( state != State . Opened ) throw new JavaAVException ( "Could not decode audio, decoder is not opened." ) ; if ( codec . getType ( ) != MediaType . AUDIO ) throw new JavaAVException ( "Could not decode audio, this is a non-audio decoder." ) ; if ( mediaPacket == null ) throw new JavaAVException ( "No audio passed to decode." ) ; AudioFrame frame = null ; ByteBuffer packetData = mediaPacket . getData ( ) ; if ( packetData != null ) { avPacket . data ( new BytePointer ( packetData ) ) ; avPacket . size ( packetData . limit ( ) ) ; } else { avPacket . data ( null ) ; avPacket . size ( 0 ) ; } while ( avPacket . size ( ) > 0 ) { // reset frame values avcodec_get_frame_defaults ( avFrame ) ; int len = avcodec_decode_audio4 ( avContext , avFrame , gotFrame , avPacket ) ; if ( len > 0 ) { avPacket . data ( avPacket . data ( ) . position ( len ) ) ; avPacket . size ( avPacket . size ( ) - len ) ; } if ( len > 0 && gotFrame [ 0 ] != 0 ) { AVRational time_base = avContext . time_base ( ) ; long pts = av_frame_get_best_effort_timestamp ( avFrame ) ; long timestamp = 1000000L * pts * time_base . num ( ) / time_base . den ( ) ; int sampleFormat = avFrame . format ( ) ; int isPlanar = av_sample_fmt_is_planar ( sampleFormat ) ; int planes = isPlanar != 0 ? avFrame . channels ( ) : 1 ; int bufferSize = av_samples_get_buffer_size ( ( int [ ] ) null , avContext . channels ( ) , avFrame . nb_samples ( ) , avContext . sample_fmt ( ) , 1 ) / planes ; SampleFormat format = SampleFormat . byId ( sampleFormat ) ; ChannelLayout channelLayout = ChannelLayout . byId ( avFrame . channel_layout ( ) ) ; AudioFormat audioFormat = new AudioFormat ( format , channelLayout , avFrame . channels ( ) , avFrame . sample_rate ( ) ) ; frame = new AudioFrame ( audioFormat , avFrame . nb_samples ( ) ) ; frame . setKeyFrame ( avFrame . key_frame ( ) != 0 ) ; frame . setTimestamp ( timestamp ) ; for ( int i = 0 ; i < planes ; i ++ ) { BytePointer pointer = avFrame . data ( i ) . capacity ( bufferSize ) ; ByteBuffer buffer = pointer . asBuffer ( ) ; buffer . position ( 0 ) ; frame . getPlane ( i ) . asByteBuffer ( ) . put ( buffer ) ; } } else { break ; } } av_free_packet ( avPacket ) ; return frame ;
public class WValidationErrors { /** * Sets the message box title . * @ param title the message box title to set , using { @ link MessageFormat } syntax . * @ param args optional arguments for the message format string . */ public void setTitleText ( final String title , final Serializable ... args ) { } }
ValidationErrorsModel model = getOrCreateComponentModel ( ) ; model . title = I18nUtilities . asMessage ( title , args ) ;
public class GetReconciliationOrderReportsForReconciliationReport { /** * Runs the example . * @ param adManagerServices the services factory . * @ param session the session . * @ param reconciliationReportId the ID of the reconciliation report . * @ throws ApiException if the API request failed with one or more service errors . * @ throws RemoteException if the API request failed due to other errors . */ public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , long reconciliationReportId ) throws RemoteException { } }
ReconciliationOrderReportServiceInterface reconciliationOrderReportService = adManagerServices . get ( session , ReconciliationOrderReportServiceInterface . class ) ; // Create a statement to select reconciliation order reports . StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "reconciliationReportId = :reconciliationReportId" ) . orderBy ( "id ASC" ) . limit ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) . withBindVariableValue ( "reconciliationReportId" , reconciliationReportId ) ; // Retrieve a small amount of reconciliation order reports at a time , paging through // until all reconciliation order reports have been retrieved . int totalResultSetSize = 0 ; do { ReconciliationOrderReportPage page = reconciliationOrderReportService . getReconciliationOrderReportsByStatement ( statementBuilder . toStatement ( ) ) ; if ( page . getResults ( ) != null ) { // Print out some information for each reconciliation order report . totalResultSetSize = page . getTotalResultSetSize ( ) ; int i = page . getStartIndex ( ) ; for ( ReconciliationOrderReport reconciliationOrderReport : page . getResults ( ) ) { System . out . printf ( "%d) Reconciliation order report with ID %d and status '%s' was found.%n" , i ++ , reconciliationOrderReport . getId ( ) , reconciliationOrderReport . getStatus ( ) ) ; } } statementBuilder . increaseOffsetBy ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) ; } while ( statementBuilder . getOffset ( ) < totalResultSetSize ) ; System . out . printf ( "Number of results found: %d%n" , totalResultSetSize ) ;
public class TransparentDataEncryptionsInner { /** * Gets a database ' s transparent data encryption configuration . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param databaseName The name of the database for which the transparent data encryption applies . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the TransparentDataEncryptionInner object */ public Observable < TransparentDataEncryptionInner > getAsync ( String resourceGroupName , String serverName , String databaseName ) { } }
return getWithServiceResponseAsync ( resourceGroupName , serverName , databaseName ) . map ( new Func1 < ServiceResponse < TransparentDataEncryptionInner > , TransparentDataEncryptionInner > ( ) { @ Override public TransparentDataEncryptionInner call ( ServiceResponse < TransparentDataEncryptionInner > response ) { return response . body ( ) ; } } ) ;
public class EvaluateVarianceRatioCriteria { /** * Update the global centroid . * @ param overallCentroid Centroid to udpate * @ param rel Data relation * @ param clusters Clusters * @ param centroids Cluster centroids * @ return Number of clusters */ public static int globalCentroid ( Centroid overallCentroid , Relation < ? extends NumberVector > rel , List < ? extends Cluster < ? > > clusters , NumberVector [ ] centroids , NoiseHandling noiseOption ) { } }
int clustercount = 0 ; Iterator < ? extends Cluster < ? > > ci = clusters . iterator ( ) ; for ( int i = 0 ; ci . hasNext ( ) ; i ++ ) { Cluster < ? > cluster = ci . next ( ) ; if ( cluster . size ( ) <= 1 || cluster . isNoise ( ) ) { switch ( noiseOption ) { case IGNORE_NOISE : continue ; // Ignore completely case TREAT_NOISE_AS_SINGLETONS : clustercount += cluster . size ( ) ; // Update global centroid : for ( DBIDIter it = cluster . getIDs ( ) . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { overallCentroid . put ( rel . get ( it ) ) ; } continue ; // With NEXT cluster . case MERGE_NOISE : break ; // Treat as cluster below : } } // Update centroid : assert ( centroids [ i ] != null ) ; overallCentroid . put ( centroids [ i ] , cluster . size ( ) ) ; ++ clustercount ; } return clustercount ;
public class CompromisedCredentialsActionsTypeMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CompromisedCredentialsActionsType compromisedCredentialsActionsType , ProtocolMarshaller protocolMarshaller ) { } }
if ( compromisedCredentialsActionsType == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( compromisedCredentialsActionsType . getEventAction ( ) , EVENTACTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AmazonRekognitionClient { /** * Gets the face search results for Amazon Rekognition Video face search started by < a > StartFaceSearch < / a > . The * search returns faces in a collection that match the faces of persons detected in a video . It also includes the * time ( s ) that faces are matched in the video . * Face search in a video is an asynchronous operation . You start face search by calling to < a > StartFaceSearch < / a > * which returns a job identifier ( < code > JobId < / code > ) . When the search operation finishes , Amazon Rekognition Video * publishes a completion status to the Amazon Simple Notification Service topic registered in the initial call to * < code > StartFaceSearch < / code > . To get the search results , first check that the status value published to the * Amazon SNS topic is < code > SUCCEEDED < / code > . If so , call < code > GetFaceSearch < / code > and pass the job identifier ( * < code > JobId < / code > ) from the initial call to < code > StartFaceSearch < / code > . * For more information , see Searching Faces in a Collection in the Amazon Rekognition Developer Guide . * The search results are retured in an array , < code > Persons < / code > , of < a > PersonMatch < / a > objects . Each * < code > PersonMatch < / code > element contains details about the matching faces in the input collection , person * information ( facial attributes , bounding boxes , and person identifer ) for the matched person , and the time the * person was matched in the video . * < note > * < code > GetFaceSearch < / code > only returns the default facial attributes ( < code > BoundingBox < / code > , * < code > Confidence < / code > , < code > Landmarks < / code > , < code > Pose < / code > , and < code > Quality < / code > ) . The other facial * attributes listed in the < code > Face < / code > object of the following response syntax are not returned . For more * information , see FaceDetail in the Amazon Rekognition Developer Guide . * < / note > * By default , the < code > Persons < / code > array is sorted by the time , in milliseconds from the start of the video , * persons are matched . You can also sort by persons by specifying < code > INDEX < / code > for the < code > SORTBY < / code > * input parameter . * @ param getFaceSearchRequest * @ return Result of the GetFaceSearch operation returned by the service . * @ throws AccessDeniedException * You are not authorized to perform the action . * @ throws InternalServerErrorException * Amazon Rekognition experienced a service issue . Try your call again . * @ throws InvalidParameterException * Input parameter violated a constraint . Validate your parameter before calling the API operation again . * @ throws InvalidPaginationTokenException * Pagination token in the request is not valid . * @ throws ProvisionedThroughputExceededException * The number of requests exceeded your throughput limit . If you want to increase this limit , contact Amazon * Rekognition . * @ throws ResourceNotFoundException * The collection specified in the request cannot be found . * @ throws ThrottlingException * Amazon Rekognition is temporarily unable to process the request . Try your call again . * @ sample AmazonRekognition . GetFaceSearch */ @ Override public GetFaceSearchResult getFaceSearch ( GetFaceSearchRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetFaceSearch ( request ) ;
public class SSLSocketChannel { /** * Creates connection to a named peer using given SSLContext . Connection * is in client mode but can be changed before read / write . * @ param peer * @ param port * @ param sslContext * @ return * @ throws IOException */ public static SSLSocketChannel open ( String peer , int port , SSLContext sslContext ) throws IOException { } }
SSLEngine engine = sslContext . createSSLEngine ( peer , port ) ; engine . setUseClientMode ( true ) ; SSLParameters sslParameters = engine . getSSLParameters ( ) ; SNIServerName hostName = new SNIHostName ( peer ) ; List < SNIServerName > list = new ArrayList < > ( ) ; list . add ( hostName ) ; sslParameters . setServerNames ( list ) ; engine . setSSLParameters ( sslParameters ) ; InetSocketAddress address = new InetSocketAddress ( peer , port ) ; SocketChannel socketChannel = SocketChannel . open ( address ) ; SSLSocketChannel sslSocketChannel = new SSLSocketChannel ( socketChannel , engine , null , false ) ; return sslSocketChannel ;
public class VodClient { /** * Gets the properties of specific media resource managed by VOD service . * The caller < i > must < / i > authenticate with a valid BCE Access Key / Private Key pair . * @ param mediaId The unique ID for each media resource * @ return The properties of the specific media resource */ public GetMediaResourceResponse getMediaResource ( String mediaId ) { } }
GetMediaResourceRequest request = new GetMediaResourceRequest ( ) . withMediaId ( mediaId ) ; return getMediaResource ( request ) ;
public class LogManager { /** * default value . */ String getStringProperty ( String name , String defaultValue ) { } }
String val = getProperty ( name ) ; if ( val == null ) { return defaultValue ; } return val . trim ( ) ;
public class Converter { /** * Returns a converter based on < i > existing < / i > forward and backward * functions . Note that it is unnecessary to create < i > new < / i > classes * implementing { @ code Function } just to pass them in here . Instead , simply * subclass { @ code Converter } and implement its { @ link # doForward } and * { @ link # doBackward } methods directly . * These functions will never be passed { @ code null } and must not under any * circumstances return { @ code null } . If a value cannot be converted , the * function should throw an unchecked exception ( typically , but not * necessarily , { @ link IllegalArgumentException } ) . * The returned converter is serializable if both provided functions are . * @ param < A > * the generic type * @ param < B > * the generic type * @ param forwardFunction * the forward function * @ param backwardFunction * the backward function * @ return the converter * @ since 17.0 */ public static < A , B > Converter < A , B > from ( Function < ? super A , ? extends B > forwardFunction , Function < ? super B , ? extends A > backwardFunction ) { } }
return new FunctionBasedConverter < A , B > ( forwardFunction , backwardFunction ) ;
public class Sign { /** * 返回用户访问资源的签名 * @ param cred * 包含用户秘钥信息 * @ param bucketName * bucket名 * @ param cosPath * 要签名的cos路径 * @ param expired * 超时时间 * @ param uploadFlag * 除了生成下载签名 , 其他情况updateFlag皆为true * @ return 返回base64编码的字符串 * @ throws AbstractCosException */ private static String appSignatureBase ( Credentials cred , String bucketName , String cosPath , long expired , boolean uploadFlag ) throws AbstractCosException { } }
int appId = cred . getAppId ( ) ; String secretId = cred . getSecretId ( ) ; String secretKey = cred . getSecretKey ( ) ; long now = System . currentTimeMillis ( ) / 1000 ; int rdm = Math . abs ( new Random ( ) . nextInt ( ) ) ; String fileId = null ; if ( uploadFlag ) { fileId = String . format ( "/%s/%s%s" , appId , bucketName , cosPath ) ; } else { fileId = cosPath ; } fileId = CommonPathUtils . encodeRemotePath ( fileId ) ; String plainText = String . format ( "a=%s&k=%s&e=%d&t=%d&r=%d&f=%s&b=%s" , appId , secretId , expired , now , rdm , fileId , bucketName ) ; byte [ ] hmacDigest ; try { hmacDigest = CommonCodecUtils . HmacSha1 ( plainText , secretKey ) ; } catch ( Exception e ) { throw new UnknownException ( e . getMessage ( ) ) ; } byte [ ] signContent = new byte [ hmacDigest . length + plainText . getBytes ( ) . length ] ; System . arraycopy ( hmacDigest , 0 , signContent , 0 , hmacDigest . length ) ; System . arraycopy ( plainText . getBytes ( ) , 0 , signContent , hmacDigest . length , plainText . getBytes ( ) . length ) ; return CommonCodecUtils . Base64Encode ( signContent ) ;
public class BGRImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . BGR__GDO_NAME : setGdoName ( GDO_NAME_EDEFAULT ) ; return ; case AfplibPackage . BGR__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class XMLProperties { /** * Inserts elements to the given document one by one , and creates all its * parents if needed . * @ param pDocument the document to insert to . * @ param pName the name of the property element . * @ param pValue the value of the property element . * @ param pFormat * @ todo I guess this implementation could use some optimisaztion , as * we do a lot of unneccessary looping . */ private static void insertElement ( Document pDocument , String pName , Object pValue , String pFormat ) { } }
// Get names of all elements we need String [ ] names = StringUtil . toStringArray ( pName , "." ) ; // Get value formatted as string String value = null ; if ( pValue != null ) { if ( pValue instanceof Date ) { // Special threatment of Date if ( pFormat != null ) { value = new SimpleDateFormat ( pFormat ) . format ( pValue ) ; } else { value = sDefaultFormat . format ( pValue ) ; } } else { value = String . valueOf ( pValue ) ; } } // Loop through document from root , and insert parents as needed Element element = pDocument . getDocumentElement ( ) ; for ( int i = 0 ; i < names . length ; i ++ ) { boolean found = false ; // Get children NodeList children = element . getElementsByTagName ( PROPERTY ) ; Element child = null ; // Search for correct name for ( int j = 0 ; j < children . getLength ( ) ; j ++ ) { child = ( Element ) children . item ( j ) ; if ( names [ i ] . equals ( child . getAttribute ( PROPERTY_NAME ) ) ) { // Found found = true ; element = child ; break ; // Next name } } // Test if the node was not found , otherwise we need to insert if ( ! found ) { // Not found child = pDocument . createElement ( PROPERTY ) ; child . setAttribute ( PROPERTY_NAME , names [ i ] ) ; // Insert it element . appendChild ( child ) ; element = child ; } // If it ' s the destination node , set the value if ( ( i + 1 ) == names . length ) { // If the value string contains special data , // use a CDATA block instead of the " value " attribute if ( StringUtil . contains ( value , "\n" ) || StringUtil . contains ( value , "\t" ) || StringUtil . contains ( value , "\"" ) || StringUtil . contains ( value , "&" ) || StringUtil . contains ( value , "<" ) || StringUtil . contains ( value , ">" ) ) { // Create value element Element valueElement = pDocument . createElement ( PROPERTY_VALUE ) ; // Set type attribute String className = pValue . getClass ( ) . getName ( ) ; className = StringUtil . replace ( className , "java.lang." , "" ) ; if ( ! DEFAULT_TYPE . equals ( className ) ) { valueElement . setAttribute ( PROPERTY_TYPE , className ) ; } // Set format attribute if ( pFormat != null ) { valueElement . setAttribute ( PROPERTY_FORMAT , pFormat ) ; } // Crate cdata section CDATASection cdata = pDocument . createCDATASection ( value ) ; // Append to document tree valueElement . appendChild ( cdata ) ; child . appendChild ( valueElement ) ; } else { // Just set normal attribute value child . setAttribute ( PROPERTY_VALUE , value ) ; // Set type attribute String className = pValue . getClass ( ) . getName ( ) ; className = StringUtil . replace ( className , "java.lang." , "" ) ; if ( ! DEFAULT_TYPE . equals ( className ) ) { child . setAttribute ( PROPERTY_TYPE , className ) ; } // If format is set , store in attribute if ( pFormat != null ) { child . setAttribute ( PROPERTY_FORMAT , pFormat ) ; } } } }
public class UIDataAdaptor { /** * Copied from Richfaces UIDataAdapter # visitTree . */ @ Override public boolean visitTree ( VisitContext visitContext , VisitCallback callback ) { } }
// First check to see whether we are visitable . If not // short - circuit out of this subtree , though allow the // visit to proceed through to other subtrees . if ( ! isVisitable ( visitContext ) ) { return false ; } // Clear out the row index is one is set so that // we start from a clean slate . FacesContext facesContext = visitContext . getFacesContext ( ) ; // NOTE : that the visitRows local will be obsolete once the // appropriate visit hints have been added to the API boolean visitRows = requiresRowIteration ( visitContext ) ; Integer oldRowKey = null ; if ( visitRows ) { oldRowKey = getRowKey ( ) ; setRowKey ( facesContext , null ) ; } // Push ourselves to EL pushComponentToEL ( facesContext , null ) ; try { // Visit ourselves . Note that we delegate to the // VisitContext to actually perform the visit . VisitResult result = visitContext . invokeVisitCallback ( this , callback ) ; // If the visit is complete , short - circuit out and end the visit if ( result == VisitResult . COMPLETE ) { return true ; } // Visit children , short - circuiting as necessary if ( ( result == VisitResult . ACCEPT ) ) { if ( visitDataChildren ( visitContext , callback , visitRows ) ) { return true ; } } } catch ( IOException e ) { // TODO handle exception LOG . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } finally { // Clean up - pop EL and restore old row index popComponentFromEL ( facesContext ) ; if ( visitRows ) { try { setRowKey ( facesContext , oldRowKey ) ; restoreOrigValue ( facesContext ) ; } catch ( Exception e ) { // TODO : handle exception LOG . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } } // Return false to allow the visit to continue return false ;
public class SharedObjectMessage { /** * { @ inheritDoc } */ public boolean addEvent ( ISharedObjectEvent . Type type , String key , Object value ) { } }
return events . add ( new SharedObjectEvent ( type , key , value ) ) ;
public class ArraySortedMap { /** * This does a linear scan which is simpler than a binary search . For a small collection size this * still should be as fast as binary search . */ private int findKeyOrInsertPosition ( K key ) { } }
int newPos = 0 ; while ( newPos < this . keys . length && this . comparator . compare ( this . keys [ newPos ] , key ) < 0 ) { newPos ++ ; } return newPos ;
public class GetSingleConversationOptions { /** * Used when setting the " visible " field in the response . See the " List Conversations " docs for details * @ param filters Filter strings to be applied to the visibility of conversations * @ return this to continue building options */ public GetSingleConversationOptions filters ( List < String > filters ) { } }
if ( filters . size ( ) == 1 ) { // Canvas API doesn ' t want the [ ] if it is only one value addSingleItem ( "filter" , filters . get ( 0 ) ) ; } else { optionsMap . put ( "filter[]" , filters ) ; } return this ;
public class JMTimeUtil { /** * Change timestamp to new format with default zone id string . * @ param isoTimestamp the iso timestamp * @ param newFormat the new format * @ return the string */ public static String changeTimestampToNewFormatWithDefaultZoneId ( String isoTimestamp , DateTimeFormatter newFormat ) { } }
return changeTimestampToNewFormat ( isoTimestamp , getZoneId ( DEFAULT_ZONE_ID ) , newFormat ) ;
public class ConvexVolumeTool { /** * returns number of points on hull . */ List < Integer > convexhull ( List < Float > pts ) { } }
int npts = pts . size ( ) / 3 ; List < Integer > out = new ArrayList < > ( ) ; // Find lower - leftmost point . int hull = 0 ; for ( int i = 1 ; i < npts ; ++ i ) { float [ ] a = new float [ ] { pts . get ( i * 3 ) , pts . get ( i * 3 + 1 ) , pts . get ( i * 3 + 2 ) } ; float [ ] b = new float [ ] { pts . get ( hull * 3 ) , pts . get ( hull * 3 + 1 ) , pts . get ( hull * 3 + 2 ) } ; if ( cmppt ( a , b ) ) { hull = i ; } } // Gift wrap hull . int endpt = 0 ; do { out . add ( hull ) ; endpt = 0 ; for ( int j = 1 ; j < npts ; ++ j ) { float [ ] a = new float [ ] { pts . get ( hull * 3 ) , pts . get ( hull * 3 + 1 ) , pts . get ( hull * 3 + 2 ) } ; float [ ] b = new float [ ] { pts . get ( endpt * 3 ) , pts . get ( endpt * 3 + 1 ) , pts . get ( endpt * 3 + 2 ) } ; float [ ] c = new float [ ] { pts . get ( j * 3 ) , pts . get ( j * 3 + 1 ) , pts . get ( j * 3 + 2 ) } ; if ( hull == endpt || left ( a , b , c ) ) { endpt = j ; } } hull = endpt ; } while ( endpt != out . get ( 0 ) ) ; return out ;
public class Algebras { /** * TODO : unit test . */ public static double convertAlgebra ( double value , Algebra src , Algebra dst ) { } }
if ( dst . equals ( src ) ) { return value ; } else if ( src . equals ( RealAlgebra . getInstance ( ) ) ) { return dst . fromReal ( value ) ; } else if ( src . equals ( LogSemiring . getInstance ( ) ) ) { return dst . fromLogProb ( value ) ; } else if ( dst . equals ( RealAlgebra . getInstance ( ) ) ) { return src . toReal ( value ) ; } else if ( dst . equals ( LogSemiring . getInstance ( ) ) ) { return src . toLogProb ( value ) ; } else { // We pivot through the real numbers , but this could cause a loss of // floating point precision . log . warn ( "FOR TESTING ONLY: unsafe conversion from " + src + " to " + dst ) ; return dst . fromReal ( src . toReal ( value ) ) ; }
public class CmsDriverManager { /** * Adds a resource to the given organizational unit . < p > * @ param dbc the current db context * @ param orgUnit the organizational unit to add the resource to * @ param resource the resource that is to be added to the organizational unit * @ throws CmsException if something goes wrong * @ see org . opencms . security . CmsOrgUnitManager # addResourceToOrgUnit ( CmsObject , String , String ) * @ see org . opencms . security . CmsOrgUnitManager # addResourceToOrgUnit ( CmsObject , String , String ) */ public void addResourceToOrgUnit ( CmsDbContext dbc , CmsOrganizationalUnit orgUnit , CmsResource resource ) throws CmsException { } }
m_monitor . flushCache ( CmsMemoryMonitor . CacheType . HAS_ROLE , CmsMemoryMonitor . CacheType . ROLE_LIST ) ; getUserDriver ( dbc ) . addResourceToOrganizationalUnit ( dbc , orgUnit , resource ) ;
public class UrlSyntaxProviderImpl { /** * Parse the parameter name and the optional portlet window id from a fully qualified query * parameter . */ protected Tuple < String , IPortletWindowId > parsePortletParameterName ( HttpServletRequest request , String name , Set < String > additionalPortletIds ) { } }
// Look for a 2nd separator which might indicate a portlet window id for ( final String additionalPortletId : additionalPortletIds ) { final int windowIdIdx = name . indexOf ( additionalPortletId ) ; if ( windowIdIdx == - 1 ) { continue ; } final String paramName = name . substring ( PORTLET_PARAM_PREFIX . length ( ) + additionalPortletId . length ( ) + SEPARATOR . length ( ) ) ; final IPortletWindowId portletWindowId = this . portletWindowRegistry . getPortletWindowId ( request , additionalPortletId ) ; return new Tuple < String , IPortletWindowId > ( paramName , portletWindowId ) ; } final String paramName = this . safeSubstringAfter ( PORTLET_PARAM_PREFIX , name ) ; return new Tuple < String , IPortletWindowId > ( paramName , null ) ;
public class QueryGenerator { /** * Wraps the query in a nested query when a query is done on a reference entity . Returns the * original query when it is applied to the current entity . */ private QueryBuilder nestedQueryBuilder ( List < Attribute > attributePath , QueryBuilder queryBuilder ) { } }
if ( attributePath . size ( ) == 1 ) { return queryBuilder ; } else if ( attributePath . size ( ) == 2 ) { return QueryBuilders . nestedQuery ( getQueryFieldName ( attributePath . get ( 0 ) ) , queryBuilder , ScoreMode . Avg ) ; } else { throw new UnsupportedOperationException ( CANNOT_FILTER_DEEP_REFERENCE_MSG ) ; }
public class AlarmSchedulerFlusher { /** * / * only exposed for testing not dealing directly with alarm logic */ @ VisibleForTesting boolean scheduleExact ( long interval ) { } }
if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . KITKAT ) { manager . setExact ( AlarmManager . ELAPSED_REALTIME , SystemClock . elapsedRealtime ( ) + interval , pendingIntent ) ; return true ; } return false ;
public class CmsSecurityManager { /** * Adds a resource to the given organizational unit . < p > * @ param context the current request context * @ param orgUnit the organizational unit to add the resource to * @ param resource the resource that is to be added to the organizational unit * @ throws CmsException if something goes wrong * @ see org . opencms . security . CmsOrgUnitManager # addResourceToOrgUnit ( CmsObject , String , String ) * @ see org . opencms . security . CmsOrgUnitManager # removeResourceFromOrgUnit ( CmsObject , String , String ) */ public void addResourceToOrgUnit ( CmsRequestContext context , CmsOrganizationalUnit orgUnit , CmsResource resource ) throws CmsException { } }
CmsDbContext dbc = m_dbContextFactory . getDbContext ( context ) ; try { checkOfflineProject ( dbc ) ; checkRole ( dbc , CmsRole . ADMINISTRATOR . forOrgUnit ( orgUnit . getName ( ) ) ) ; m_driverManager . addResourceToOrgUnit ( dbc , orgUnit , resource ) ; } catch ( Exception e ) { dbc . report ( null , Messages . get ( ) . container ( Messages . ERR_ADD_RESOURCE_TO_ORGUNIT_2 , orgUnit . getName ( ) , dbc . removeSiteRoot ( resource . getRootPath ( ) ) ) , e ) ; } finally { dbc . clear ( ) ; }
public class IpCamDeviceRegistry { /** * Is device with given URL registered ? * @ param url the URL used by device * @ return True if device is registered , false otherwise */ public static boolean isRegistered ( URL url ) { } }
if ( url == null ) { throw new IllegalArgumentException ( "Camera device URL cannot be null" ) ; } try { return isRegistered ( url . toURI ( ) ) ; } catch ( URISyntaxException e ) { throw new WebcamException ( e ) ; }
public class PoolOperations { /** * Gets the result of evaluating an automatic scaling formula on the specified * pool . This is primarily for validating an autoscale formula , as it simply * returns the result without applying the formula to the pool . * @ param poolId * The ID of the pool . * @ param autoScaleFormula * The formula to be evaluated on the pool . * @ return The result of evaluating the formula on the specified pool . * @ throws BatchErrorException * Exception thrown when an error response is received from the * Batch service . * @ throws IOException * Exception thrown when there is an error in * serialization / deserialization of data sent to / received from the * Batch service . */ public AutoScaleRun evaluateAutoScale ( String poolId , String autoScaleFormula ) throws BatchErrorException , IOException { } }
return evaluateAutoScale ( poolId , autoScaleFormula , null ) ;
public class Converters { /** * Converts an entity to a DBObject * @ param containingObject The object to convert * @ param mf the MappedField to extract * @ param dbObj the DBObject to populate * @ param opts the options to apply */ public void toDBObject ( final Object containingObject , final MappedField mf , final DBObject dbObj , final MapperOptions opts ) { } }
final Object fieldValue = mf . getFieldValue ( containingObject ) ; final TypeConverter enc = getEncoder ( fieldValue , mf ) ; final Object encoded = enc . encode ( fieldValue , mf ) ; if ( encoded != null || opts . isStoreNulls ( ) ) { dbObj . put ( mf . getNameToStore ( ) , encoded ) ; }
public class ConfigCheckReport { /** * < pre > * Scope name as key * < / pre > * < code > map & lt ; string , . alluxio . grpc . meta . InconsistentProperties & gt ; errors = 1 ; < / code > */ public java . util . Map < java . lang . String , alluxio . grpc . InconsistentProperties > getErrorsMap ( ) { } }
return internalGetErrors ( ) . getMap ( ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getIfcBuildingElementProxyTypeEnum ( ) { } }
if ( ifcBuildingElementProxyTypeEnumEEnum == null ) { ifcBuildingElementProxyTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 788 ) ; } return ifcBuildingElementProxyTypeEnumEEnum ;
public class OAIResponder { /** * resumptionToken may be null */ private void respondToListRecords ( Map < String , String > args , String baseURL , List < ? > records , ResumptionToken resumptionToken , PrintWriter out ) { } }
appendTop ( out ) ; appendRequest ( args , baseURL , out ) ; out . println ( " <ListRecords>" ) ; for ( int i = 0 ; i < records . size ( ) ; i ++ ) { appendRecord ( " " , ( Record ) records . get ( i ) , out ) ; } appendResumptionToken ( resumptionToken , out ) ; out . println ( " </ListRecords>" ) ; appendBottom ( out ) ;
public class RandomGUID { /** * Returns a nice neat formatted string . * @ param str * unformatted string * @ return formatted string */ public static String getPrettyFormatted ( String str ) { } }
return String . format ( "%s-%s-%s-%s-%s" , new Object [ ] { str . substring ( 0 , 8 ) , str . substring ( 8 , 12 ) , str . substring ( 12 , 16 ) , str . substring ( 16 , 20 ) , str . substring ( 20 ) } ) ;
public class OptionUtil { /** * If thread number option is true , returns thread number . If false , returns default number . * @ return If true , local mode . */ public int getThreadNumber ( ) { } }
if ( cli . hasOption ( THREAD_NUMBER ) ) { return Integer . valueOf ( cli . getOptionValue ( THREAD_NUMBER ) ) ; } return DEFAULT_THREAD_NUMBER ;
public class UndoManagerImpl { /** * Helper method for reducing code duplication * @ param isChangeAvailable same as ` isUndoAvailable ( ) ` [ Undo ] or ` isRedoAvailable ( ) ` [ Redo ] * @ param changeToApply same as ` invert . apply ( queue . prev ( ) ) ` [ Undo ] or ` queue . next ( ) ` [ Redo ] */ private boolean applyChange ( boolean isChangeAvailable , Supplier < C > changeToApply ) { } }
if ( isChangeAvailable ) { canMerge = false ; // perform change C change = changeToApply . get ( ) ; this . expectedChange = change ; performingAction . suspendWhile ( ( ) -> apply . accept ( change ) ) ; if ( this . expectedChange != null ) { throw new IllegalStateException ( "Expected change not received:\n" + this . expectedChange ) ; } invalidateProperties ( ) ; return true ; } else { return false ; }
public class FileSystem { /** * Make the given filename absolute from the given root if it is not already absolute . * < table border = " 1 " width = " 100 % " summary = " Cases " > * < thead > * < tr > * < td > { @ code filename } < / td > < td > { @ code current } < / td > < td > Result < / td > * < / tr > * < / thead > * < tr > * < td > < code > null < / code > < / td > * < td > < code > null < / code > < / td > * < td > < code > null < / code > < / td > * < / tr > * < tr > * < td > < code > null < / code > < / td > * < td > < code > / myroot < / code > < / td > * < td > < code > null < / code > < / td > * < / tr > * < tr > * < td > < code > / path / to / file < / code > < / td > * < td > < code > null < / code > < / td > * < td > < code > / path / to / file < / code > < / td > * < / tr > * < tr > * < td > < code > path / to / file < / code > < / td > * < td > < code > null < / code > < / td > * < td > < code > path / to / file < / code > < / td > * < / tr > * < tr > * < td > < code > / path / to / file < / code > < / td > * < td > < code > / myroot < / code > < / td > * < td > < code > / path / to / file < / code > < / td > * < / tr > * < tr > * < td > < code > path / to / file < / code > < / td > * < td > < code > / myroot < / code > < / td > * < td > < code > / myroot / path / to / file < / code > < / td > * < / tr > * < / table > * @ param filename is the name to make absolute . * @ param current is the current directory which permits to make absolute . * @ return an absolute filename . */ @ Pure public static File makeAbsolute ( File filename , File current ) { } }
if ( filename == null ) { return null ; } if ( current != null && ! filename . isAbsolute ( ) ) { try { return new File ( current . getCanonicalFile ( ) , filename . getPath ( ) ) ; } catch ( IOException exception ) { return new File ( current . getAbsoluteFile ( ) , filename . getPath ( ) ) ; } } return filename ;
public class FeatureSet { /** * Returns a feature set combining all the features from { @ code this } and { @ code feature } . */ public FeatureSet with ( Feature feature ) { } }
if ( features . contains ( feature ) ) { return this ; } return new FeatureSet ( add ( features , feature ) ) ;
public class ReflectionCollector { /** * Retrieves key / value pairs from static getters of a class ( get * ( ) or is * ( ) ) . * @ param someClass the class to be inspected . */ private void collectStaticGettersResults ( @ NonNull Class < ? > someClass , @ NonNull JSONObject container ) throws JSONException { } }
final Method [ ] methods = someClass . getMethods ( ) ; for ( final Method method : methods ) { if ( method . getParameterTypes ( ) . length == 0 && ( method . getName ( ) . startsWith ( "get" ) || method . getName ( ) . startsWith ( "is" ) ) && ! "getClass" . equals ( method . getName ( ) ) ) { try { container . put ( method . getName ( ) , method . invoke ( null , ( Object [ ] ) null ) ) ; } catch ( @ NonNull IllegalArgumentException ignored ) { // NOOP } catch ( @ NonNull InvocationTargetException ignored ) { // NOOP } catch ( @ NonNull IllegalAccessException ignored ) { // NOOP } } }
public class ObserverBuilder { /** * Multiple Objects Observer . */ public static < T extends AVObject > CollectionObserver < T > buildSingleObserver ( FindCallback < T > callback ) { } }
return new CollectionObserver < T > ( callback ) ;
public class BasicHttpClient { /** * Returns the response body of the HTTP method , if any , as an { @ link InputStream } . * If response body is not available , returns < tt > null < / tt > * @ return InputStream response body * @ throws HttpException */ public InputStream getResponseBodyAsStream ( ) throws HttpException { } }
try { HttpEntity ent = getResponseEntity ( ) ; if ( ent == null ) { return null ; } return ent . getContent ( ) ; } catch ( Throwable t ) { throw new HttpException ( t . getLocalizedMessage ( ) , t ) ; }
public class ReceiveMessageBuilder { /** * Expect a control message in this receive action . * @ param controlMessage * @ return */ public T message ( Message controlMessage ) { } }
StaticMessageContentBuilder staticMessageContentBuilder = StaticMessageContentBuilder . withMessage ( controlMessage ) ; staticMessageContentBuilder . setMessageHeaders ( getMessageContentBuilder ( ) . getMessageHeaders ( ) ) ; getAction ( ) . setMessageBuilder ( staticMessageContentBuilder ) ; return self ;
public class MPPUtility { /** * Utility method to remove ampersands embedded in names . * @ param name name text * @ return name text without embedded ampersands */ public static final String removeAmpersands ( String name ) { } }
if ( name != null ) { if ( name . indexOf ( '&' ) != - 1 ) { StringBuilder sb = new StringBuilder ( ) ; int index = 0 ; char c ; while ( index < name . length ( ) ) { c = name . charAt ( index ) ; if ( c != '&' ) { sb . append ( c ) ; } ++ index ; } name = sb . toString ( ) ; } } return ( name ) ;
public class NanoHTTPD { /** * Override this to customize the server . < p > * ( By default , this delegates to serveFile ( ) and allows directory listing . ) * @ param uriPercent - decoded URI without parameters , for example " / index . cgi " * @ param method " GET " , " POST " etc . * @ param parmsParsed , percent decoded parameters from URI and , in case of POST , data . * @ param headerHeader entries , percent decoded * @ return HTTP response , see class Response for details */ public Response serve ( String uri , String method , Properties header , Properties parms ) { } }
System . out . println ( method + " '" + uri + "' " ) ; Enumeration < ? > e = header . propertyNames ( ) ; while ( e . hasMoreElements ( ) ) { String value = ( String ) e . nextElement ( ) ; System . out . println ( " HDR: '" + value + "' = '" + header . getProperty ( value ) + "'" ) ; } e = parms . propertyNames ( ) ; while ( e . hasMoreElements ( ) ) { String value = ( String ) e . nextElement ( ) ; System . out . println ( " PRM: '" + value + "' = '" + parms . getProperty ( value ) + "'" ) ; } return serveFile ( uri , header , new File ( "." ) , true ) ;
public class JpaPersistence { /** * { @ inheritDoc } */ @ SuppressWarnings ( "rawtypes" ) @ Override public EntityManagerFactory createContainerEntityManagerFactory ( final PersistenceUnitInfo info , final Map map ) { } }
initJpaCounter ( ) ; final PersistenceProvider persistenceProvider = findDelegate ( map ) ; // on surcharge PersistenceUnitInfo . getPersistenceProviderClassName ( ) // pour retourner le PersistenceProvider délégué et pas nous même final PersistenceUnitInfo proxiedInfo = createPersistentUnitInfoProxy ( info , persistenceProvider ) ; final EntityManagerFactory entityManagerFactory = persistenceProvider . createContainerEntityManagerFactory ( proxiedInfo , map ) ; if ( entityManagerFactory == null ) { return null ; } return JpaWrapper . createEntityManagerFactoryProxy ( entityManagerFactory ) ;
public class BaseTraceFormatter { /** * Format the given record into the desired trace format * @ param genData GenericData pass information needed * @ return String */ public String traceFormatGenData ( GenericData genData ) { } }
KeyValuePair [ ] pairs = genData . getPairs ( ) ; KeyValuePair kvp = null ; String txt = null ; Integer id = null ; String objId ; Integer levelVal = null ; String name ; String className = null ; String method = null ; String loggerName = null ; Long ibm_datetime = null ; String corrId = null ; String org = null ; String prod = null ; String component = null ; String sym = null ; String logLevel = null ; String threadName = null ; String stackTrace = null ; for ( KeyValuePair p : pairs ) { if ( p != null && ! p . isList ( ) ) { kvp = p ; if ( kvp . getKey ( ) . equals ( LogFieldConstants . MESSAGE ) ) { txt = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . IBM_DATETIME ) ) { ibm_datetime = kvp . getLongValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . SEVERITY ) ) { sym = " " + kvp . getStringValue ( ) + " " ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . IBM_CLASSNAME ) ) { className = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . IBM_METHODNAME ) ) { method = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . MODULE ) ) { loggerName = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . OBJECT_ID ) ) { id = kvp . getIntValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . CORRELATION_ID ) ) { corrId = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . ORG ) ) { org = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . PRODUCT ) ) { prod = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . COMPONENT ) ) { component = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . LOGLEVEL ) ) { logLevel = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . THREADNAME ) ) { threadName = kvp . getStringValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . LEVELVALUE ) ) { levelVal = kvp . getIntValue ( ) ; } else if ( kvp . getKey ( ) . equals ( LogFieldConstants . THROWABLE ) ) { stackTrace = kvp . getStringValue ( ) ; } } } StringBuilder sb = new StringBuilder ( 256 ) ; // Common header sb . append ( '[' ) . append ( DateFormatHelper . formatTime ( ibm_datetime , useIsoDateFormat ) ) . append ( "] " ) ; sb . append ( DataFormatHelper . getThreadId ( ) ) ; switch ( traceFormat ) { default : case ENHANCED : objId = generateObjectId ( id , true ) ; name = nonNullString ( className , loggerName ) ; sb . append ( " id=" ) . append ( objId ) . append ( ' ' ) ; formatFixedString ( sb , name , enhancedNameLength ) ; sb . append ( sym ) ; // sym has built - in padding if ( method != null ) { sb . append ( method ) . append ( ' ' ) ; } // append formatted message - - txt includes formatted args sb . append ( txt ) ; if ( stackTrace != null ) sb . append ( LoggingConstants . nl ) . append ( stackTrace ) ; break ; case BASIC : name = nonNullString ( loggerName , className ) ; sb . append ( ' ' ) ; // pad after thread id fixedClassString ( sb , name , basicNameLength ) ; sb . append ( sym ) ; if ( className != null ) sb . append ( className ) ; sb . append ( ' ' ) ; // yes , this space is always there . if ( method != null ) sb . append ( method ) ; sb . append ( ' ' ) ; // yes , this space is always there . // append formatted message - - includes formatted args sb . append ( txt ) ; if ( stackTrace != null ) sb . append ( nlBasicPadding ) . append ( stackTrace ) ; break ; case ADVANCED : objId = generateObjectId ( id , false ) ; name = nonNullString ( loggerName , null ) ; sb . append ( ' ' ) ; // pad after thread id sb . append ( sym ) ; // next append the correlation id . sb . append ( "UOW=" ) ; if ( corrId != null ) sb . append ( corrId ) ; // next enter the logger name . sb . append ( " source=" ) . append ( name ) ; // append className if non - null if ( className != null ) sb . append ( " class=" ) . append ( className ) ; // append methodName if non - null if ( method != null ) sb . append ( " method=" ) . append ( method ) ; if ( id != null ) sb . append ( " id=" ) . append ( objId ) ; // check the comparison to WsLogRecord if ( org != null && prod != null && component != null ) { // next append org , prod , component , if set . Reference equality check is ok here . sb . append ( " org=" ) ; sb . append ( org ) ; sb . append ( " prod=" ) ; sb . append ( prod ) ; sb . append ( " component=" ) ; sb . append ( component ) ; // get thread name } else { // ibm _ threadId replace check if you can use this as the thread sb . append ( " thread=[" ) . append ( threadName ) . append ( "]" ) ; } // append formatted message - - txt includes formatted args sb . append ( nlAdvancedPadding ) . append ( txt ) ; if ( stackTrace != null ) sb . append ( nlAdvancedPadding ) . append ( stackTrace ) ; break ; } return sb . toString ( ) ;
public class WalletService { /** * 如果doTryPay的入参为集成了EasyTransRequest并带有BusinessIdentiffer的话则无需指定cfgClass */ @ Transactional @ EtTcc ( confirmMethod = "doConfirmPay" , cancelMethod = "doCancelPay" , idempotentType = BusinessProvider . IDENPOTENT_TYPE_FRAMEWORK , cfgClass = WalletPayRequestCfg . class ) public WalletPayResponseVO doTryPay ( WalletPayRequestVO param ) { } }
int update = jdbcTemplate . update ( "update `wallet` set freeze_amount = freeze_amount + ? where user_id = ? and (total_amount - freeze_amount) >= ?;" , param . getPayAmount ( ) , param . getUserId ( ) , param . getPayAmount ( ) ) ; if ( update != 1 ) { throw new RuntimeException ( "can not find specific user id or have not enought money" ) ; } WalletPayResponseVO walletPayTccMethodResult = new WalletPayResponseVO ( ) ; walletPayTccMethodResult . setFreezeAmount ( param . getPayAmount ( ) ) ; return walletPayTccMethodResult ;
public class IpAddress { /** * Create a IpAddressUpdater to execute update . * @ param pathAccountSid The unique sid that identifies this account * @ param pathIpAccessControlListSid The IpAccessControlList Sid that * identifies the IpAddress resources to * update * @ param pathSid A string that identifies the IpAddress resource to update * @ return IpAddressUpdater capable of executing the update */ public static IpAddressUpdater updater ( final String pathAccountSid , final String pathIpAccessControlListSid , final String pathSid ) { } }
return new IpAddressUpdater ( pathAccountSid , pathIpAccessControlListSid , pathSid ) ;
public class GitlabAPI { /** * Get all awards for a merge request * @ param mergeRequest */ public List < GitlabAward > getAllAwards ( GitlabMergeRequest mergeRequest ) { } }
String tailUrl = GitlabProject . URL + "/" + mergeRequest . getProjectId ( ) + GitlabMergeRequest . URL + "/" + mergeRequest . getIid ( ) + GitlabAward . URL + PARAM_MAX_ITEMS_PER_PAGE ; return retrieve ( ) . getAll ( tailUrl , GitlabAward [ ] . class ) ;
public class BusinessUtils { /** * Resolve generics of a class relatively to a superclass . * @ param superType the superclass . * @ param subType the subclass . * @ param < T > the type of the superclass . * @ return the resolved types . */ public static < T > Class < ? > [ ] resolveGenerics ( Class < T > superType , Class < ? extends T > subType ) { } }
checkNotNull ( superType , "superType should not be null" ) ; checkNotNull ( subType , "subType should not be null" ) ; Class < ? > subTypeWithoutProxy = ProxyUtils . cleanProxy ( subType ) ; return TypeResolver . resolveRawArguments ( TypeResolver . resolveGenericType ( superType , subTypeWithoutProxy ) , subTypeWithoutProxy ) ;
public class LRActivity { /** * Add a verb object to this activity * @ param action The action type of the verb ( required ) * @ param dateStart The start date of the action described * @ param dateEnd The end date of the action described * @ param description An array of descriptions of this action * @ param comment A comment on this verb * @ return True if added , false if not ( due to missing required fields ) */ public boolean addVerb ( String action , Date dateStart , Date dateEnd , String [ ] description , String comment ) { } }
Map < String , Object > container = new HashMap < String , Object > ( ) ; if ( action != null ) { container . put ( "action" , action ) ; } else { return false ; } if ( dateStart != null && dateEnd != null ) { container . put ( "date" , df . format ( dateStart ) + "/" + df . format ( dateEnd ) ) ; } else if ( dateStart != null ) { container . put ( "date" , df . format ( dateStart ) ) ; } if ( description != null && description . length > 0 ) { container . put ( "description" , description ) ; } if ( comment != null ) { container . put ( "comment" , comment ) ; } return addChild ( "verb" , container , null ) ;
public class CompressPacketOutputStream { /** * Write an empty packet . * @ throws IOException if socket error occur . */ public void writeEmptyPacket ( ) throws IOException { } }
buf [ 0 ] = ( byte ) 4 ; buf [ 1 ] = ( byte ) 0x00 ; buf [ 2 ] = ( byte ) 0x00 ; buf [ 3 ] = ( byte ) this . compressSeqNo ++ ; buf [ 4 ] = ( byte ) 0x00 ; buf [ 5 ] = ( byte ) 0x00 ; buf [ 6 ] = ( byte ) 0x00 ; buf [ 7 ] = ( byte ) 0x00 ; buf [ 8 ] = ( byte ) 0x00 ; buf [ 9 ] = ( byte ) 0x00 ; buf [ 10 ] = ( byte ) this . seqNo ++ ; out . write ( buf , 0 , 11 ) ; if ( traceCache != null ) { traceCache . put ( new TraceObject ( true , COMPRESSED_PROTOCOL_NOT_COMPRESSED_PACKET , Arrays . copyOfRange ( buf , 0 , 11 ) ) ) ; } if ( logger . isTraceEnabled ( ) ) { logger . trace ( "send uncompress:{}{}" , serverThreadLog , Utils . hexdump ( maxQuerySizeToLog , 0 , 11 , buf ) ) ; }
public class AbstractApplicationPage { /** * Closes the given < code > PageComponent < / code > . This method disposes the < code > PageComponent < / code > , triggers all * necessary events ( " focus lost " and " closed " ) , and will activate another < code > PageComponent < / code > ( if there is * one ) . * Returns < code > false < / code > if this < code > ApplicationPage < / code > doesn ' t contain the given * < code > PageComponent < / code > . * @ param pageComponent * the < code > PageComponent < / code > * @ return boolean < code > true < / code > if pageComponent was successfully closed . */ public boolean close ( PageComponent pageComponent ) { } }
if ( ! pageComponent . canClose ( ) ) { return false ; } if ( ! pageComponents . contains ( pageComponent ) ) { return false ; } if ( pageComponent == activeComponent ) { fireFocusLost ( pageComponent ) ; activeComponent = null ; } doRemovePageComponent ( pageComponent ) ; pageComponents . remove ( pageComponent ) ; pageComponent . removePropertyChangeListener ( pageComponentUpdater ) ; if ( pageComponent instanceof ApplicationListener && getApplicationEventMulticaster ( ) != null ) { getApplicationEventMulticaster ( ) . removeApplicationListener ( ( ApplicationListener ) pageComponent ) ; } pageComponent . dispose ( ) ; fireClosed ( pageComponent ) ; if ( activeComponent == null ) { setActiveComponent ( ) ; } return true ;
public class QueryWhere { /** * clear & clone */ public void clear ( ) { } }
this . union = true ; this . type = QueryCriteriaType . NORMAL ; this . ancestry . clear ( ) ; if ( this . criteria != null ) { this . criteria . clear ( ) ; } this . currentCriteria = this . criteria ; this . maxResults = null ; this . offset = null ; this . orderByListId = null ; this . ascOrDesc = null ; this . joinPredicates = null ;
public class BTCTurkAdapters { /** * Adapts a BTCTurkTicker to a Ticker Object * @ param btcTurkTicker The exchange specific ticker * @ return The ticker */ public static Ticker adaptTicker ( BTCTurkTicker btcTurkTicker ) { } }
CurrencyPair pair = btcTurkTicker . getPair ( ) ; BigDecimal high = btcTurkTicker . getHigh ( ) ; BigDecimal last = btcTurkTicker . getLast ( ) ; Date timestamp = new Date ( btcTurkTicker . getTimestamp ( ) ) ; BigDecimal bid = btcTurkTicker . getBid ( ) ; BigDecimal volume = btcTurkTicker . getVolume ( ) ; BigDecimal low = btcTurkTicker . getLow ( ) ; BigDecimal ask = btcTurkTicker . getAsk ( ) ; BigDecimal open = btcTurkTicker . getOpen ( ) ; BigDecimal average = btcTurkTicker . getAverage ( ) ; return new Ticker . Builder ( ) . currencyPair ( pair != null ? pair : null ) . last ( last ) . bid ( bid ) . ask ( ask ) . high ( high ) . low ( low ) . vwap ( average ) . open ( open ) . volume ( volume ) . timestamp ( timestamp ) . build ( ) ;
public class HighLevelAbstractionFinder { /** * Determines if a list of abstract parameters satisfies a complex * abstraction definition . * @ param def * the { @ link HighLevelAbstractionDefinition } that we ' re looking * for . * @ param potentialInstance * a { @ link List } of { @ link TemporalProposition } objects * containing one instance of each component abstraction * definition in < code > def < / code > . * @ return < code > true < / code > if < code > def < / code > was found , * < code > false < / code > otherwise . It also returns < code > true < / code > * if no relations are defined . */ static boolean find ( Map < List < TemporalExtendedPropositionDefinition > , Relation > epdToRelation , List < List < TemporalExtendedPropositionDefinition > > epdPairs , Map < TemporalExtendedPropositionDefinition , TemporalProposition > potentialInstance ) { } }
/* * Loop through the abstraction definition pairs for each defined * relation . If a relation is not found , then set found to false . */ for ( List < TemporalExtendedPropositionDefinition > tepd : epdPairs ) { if ( ! hasRelation ( epdToRelation , potentialInstance , tepd ) ) { return false ; } } return true ;
public class ChronoLocalDateTime { /** * Checks if this date - time is equal to the specified date - time ignoring the chronology . * This method differs from the comparison in { @ link # compareTo } in that it * only compares the underlying date and time and not the chronology . * This allows date - times in different calendar systems to be compared based * on the time - line position . * @ param other the other date - time to compare to , not null * @ return true if the underlying date - time is equal to the specified date - time on the timeline */ public boolean isEqual ( ChronoLocalDateTime < ? > other ) { } }
// Do the time check first , it is cheaper than computing EPOCH day . return this . toLocalTime ( ) . toNanoOfDay ( ) == other . toLocalTime ( ) . toNanoOfDay ( ) && this . toLocalDate ( ) . toEpochDay ( ) == other . toLocalDate ( ) . toEpochDay ( ) ;
public class CmsResourceSelectDialog { /** * Creates the resource tree for the given root . < p > * @ param cms the CMS context * @ param root the root resource * @ return the resource tree */ protected CmsResourceTreeTable createTree ( CmsObject cms , CmsResource root ) { } }
return new CmsResourceTreeTable ( cms , root , m_filter ) ;
public class PackageManagerUtils { /** * Checks if the device has a fake touch feature . * @ param manager the package manager . * @ return { @ code true } if the device has a fake touch feature . */ @ TargetApi ( Build . VERSION_CODES . HONEYCOMB ) public static boolean hasFakeTouchFeature ( PackageManager manager ) { } }
return manager . hasSystemFeature ( PackageManager . FEATURE_FAKETOUCH ) ;
public class RequestEvents { /** * Marks the end of a query identified by the provided correlationId * @ param query - Query data * @ param correlationId - Identifier * @ param type - allows queries to be grouped by type * @ return */ public static < T > RemoveQuery < T > finish ( T query , long correlationId , String type ) { } }
return new RemoveQuery < > ( RequestData . builder ( ) . query ( query ) . correlationId ( correlationId ) . type ( type ) . build ( ) ) ;
public class Criteria { /** * Adds BETWEEN criteria , * customer _ id between 1 and 10 * @ param attribute The field name to be used * @ param value1 The lower boundary * @ param value2 The upper boundary */ public void addBetween ( Object attribute , Object value1 , Object value2 ) { } }
// PAW // addSelectionCriteria ( ValueCriteria . buildBeweenCriteria ( attribute , value1 , value2 , getAlias ( ) ) ) ; addSelectionCriteria ( ValueCriteria . buildBeweenCriteria ( attribute , value1 , value2 , getUserAlias ( attribute ) ) ) ;
public class ElementList { /** * Renames all subnodes with a certain name * @ param oldName * @ param newName */ public void renameNodesInTree ( String oldName , String newName ) { } }
List < Node > nodes = getNodesFromTreeByName ( oldName ) ; Iterator i = nodes . iterator ( ) ; while ( i . hasNext ( ) ) { Node n = ( Node ) i . next ( ) ; n . setName ( newName ) ; }
public class CommitLogSegmentManager { /** * Resets all the segments , for testing purposes . DO NOT USE THIS OUTSIDE OF TESTS . */ public void resetUnsafe ( ) { } }
logger . debug ( "Closing and clearing existing commit log segments..." ) ; while ( ! segmentManagementTasks . isEmpty ( ) ) Thread . yield ( ) ; for ( CommitLogSegment segment : activeSegments ) segment . close ( ) ; activeSegments . clear ( ) ; for ( CommitLogSegment segment : availableSegments ) segment . close ( ) ; availableSegments . clear ( ) ; allocatingFrom = null ;
public class RunJMeterServerMojo { /** * Load the JMeter server * @ throws MojoExecutionException MojoExecutionException */ @ Override public void doExecute ( ) throws MojoExecutionException { } }
getLog ( ) . info ( " " ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( " S T A R T I N G J M E T E R S E R V E R " ) ; getLog ( ) . info ( LINE_SEPARATOR ) ; getLog ( ) . info ( String . format ( " Host: %s" , exportedRmiHostname ) ) ; getLog ( ) . info ( String . format ( " Port: %s" , serverPort ) ) ; startJMeterServer ( initializeJMeterArgumentsArray ( ) ) ;
public class EventSourceImpl { /** * The ready state indicates the stream status , Possible values are 0 ( CONNECTING ) , 1 ( OPEN ) and 2 ( CLOSED ) * @ return current state */ public ReadyState getReadyState ( ) { } }
if ( stream == null ) { return EventSource . ReadyState . CONNECTING ; } else { switch ( stream . getReadyState ( ) ) { case CONNECTING : return EventSource . ReadyState . CONNECTING ; case OPEN : return EventSource . ReadyState . OPEN ; case CLOSING : case CLOSED : default : return EventSource . ReadyState . CLOSED ; } }
public class OnDiskSemanticSpace { /** * Loads a vector from the backing semantic space file in { @ code BINARY } * format using the predetermined offet for the word . * @ param word a word in the semantic space * @ return the vector for the word or { @ code null } if the word does not * exist in the semantic space */ private double [ ] loadBinaryVector ( String word ) throws IOException { } }
Long byteOffset = termToOffset . get ( word ) ; if ( byteOffset == null ) return null ; binarySSpace . seek ( byteOffset ) ; double [ ] vector = new double [ dimensions ] ; for ( int col = 0 ; col < dimensions ; ++ col ) { vector [ col ] = binarySSpace . readDouble ( ) ; } return vector ;
public class POIProxy { /** * This method is used to get the pois from a service and return a list of * { @ link JTSFeature } document with the data retrieved given a bounding box * corners * @ param id * The id of the service * @ param minX * @ param minY * @ param maxX * @ param maxY * @ return A list of { @ link JTSFeature } */ public ArrayList < JTSFeature > getFeatures ( String id , double minX , double minY , double maxX , double maxY , List < Param > optionalParams ) throws Exception { } }
DescribeService describeService = getDescribeServiceByID ( id ) ; return getFeatures ( id , optionalParams , describeService , minX , minY , maxX , maxY , 0 , 0 ) ;