signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AppLoginModule { /** * Logs out the user * The implementation removes the User associated with the Subject . * @ return true in all cases * @ throws LoginException if logout fails */ @ Override public boolean logout ( ) throws LoginException { } }
if ( mSubject . isReadOnly ( ) ) { throw new LoginException ( "logout Failed: Subject is Readonly." ) ; } if ( mUser != null ) { mSubject . getPrincipals ( ) . remove ( mUser ) ; } return true ;
public class HibernateProjectDao { /** * { @ inheritDoc } */ public Project getByName ( String name ) { } }
final Criteria crit = sessionService . getSession ( ) . createCriteria ( Project . class ) ; crit . add ( Property . forName ( "name" ) . eq ( name ) ) ; Project project = ( Project ) crit . uniqueResult ( ) ; HibernateLazyInitializer . init ( project ) ; return project ;
public class ConnectorServlet { /** * create a connector controller * @ param config * @ return */ protected ConnectorController createConnectorController ( ServletConfig config ) { } }
ConnectorController connectorController = new ConnectorController ( ) ; connectorController . setCommandExecutorFactory ( createCommandExecutorFactory ( config ) ) ; connectorController . setFsServiceFactory ( createServiceFactory ( config ) ) ; return connectorController ;
public class TrivialNoOutlier { /** * Run the actual algorithm . * @ param relation Relation * @ return Result */ public OutlierResult run ( Relation < ? > relation ) { } }
WritableDoubleDataStore scores = DataStoreUtil . makeDoubleStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_HOT ) ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { scores . putDouble ( iditer , 0.0 ) ; } DoubleRelation scoreres = new MaterializedDoubleRelation ( "Trivial no-outlier score" , "no-outlier" , scores , relation . getDBIDs ( ) ) ; OutlierScoreMeta meta = new ProbabilisticOutlierScore ( ) ; return new OutlierResult ( meta , scoreres ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TimeActivity } { @ code > } } */ @ XmlElementDecl ( namespace = "http://schema.intuit.com/finance/v3" , name = "TimeActivity" , substitutionHeadNamespace = "http://schema.intuit.com/finance/v3" , substitutionHeadName = "IntuitObject" ) public JAXBElement < TimeActivity > createTimeActivity ( TimeActivity value ) { } }
return new JAXBElement < TimeActivity > ( _TimeActivity_QNAME , TimeActivity . class , null , value ) ;
public class PVolumeBDGenerator { /** * @ param < S > A phantom type parameter indicating the coordinate space of the * volume * @ return A generator initialized with useful defaults */ public static < S > PVolumeBDGenerator < S > create ( ) { } }
return new PVolumeBDGenerator < > ( new Generator < BigDecimal > ( ) { private final Random random = new Random ( ) ; @ Override public BigDecimal next ( ) { return BigDecimal . valueOf ( Math . abs ( this . random . nextLong ( ) ) ) ; } } ) ;
public class CmsExportpointsEdit { /** * Initializes the module to work with depending on the dialog state and request parameters . < p > */ protected void initModule ( ) { } }
Object o ; CmsModule module ; if ( CmsStringUtil . isEmpty ( getParamAction ( ) ) || CmsDialog . DIALOG_INITIAL . equals ( getParamAction ( ) ) ) { // this is the initial dialog call if ( CmsStringUtil . isNotEmpty ( m_paramModule ) ) { // edit an existing module , get it from manager o = OpenCms . getModuleManager ( ) . getModule ( m_paramModule ) ; } else { // create a new module o = null ; } } else { // this is not the initial call , get module from session o = getDialogObject ( ) ; } if ( ! ( o instanceof CmsModule ) ) { // create a new module module = new CmsModule ( ) ; } else { // reuse module stored in session module = ( CmsModule ) ( ( CmsModule ) o ) . clone ( ) ; } List exportpoints = module . getExportPoints ( ) ; m_exportpoint = new CmsExportPoint ( ) ; if ( ( exportpoints != null ) && ( exportpoints . size ( ) > 0 ) ) { Iterator i = exportpoints . iterator ( ) ; while ( i . hasNext ( ) ) { CmsExportPoint exportpoint = ( CmsExportPoint ) i . next ( ) ; if ( exportpoint . getUri ( ) . equals ( m_paramExportpoint ) ) { m_exportpoint = exportpoint ; } } }
public class Crc32Caucho { /** * Calculates CRC from a char buffer */ public static int generate ( int crc , char [ ] buffer , int offset , int len ) { } }
for ( int i = 0 ; i < len ; i ++ ) { char ch = buffer [ offset + i ] ; if ( ch > 0xff ) { crc = next ( crc , ( ch >> 8 ) ) ; } crc = next ( crc , ch ) ; } return crc ;
public class DatabaseImpl { /** * Read attachment stream to a temporary location and calculate sha1, * prior to being added to the DocumentStore . * Used by replicator when receiving new / updated attachments * @ param att Attachment to be prepared , providing data either from a file or a stream * @ param length Size in bytes of attachment as signalled by " length " metadata property * @ param encodedLength Size in bytes of attachment , after encoding , as signalled by * " encoded _ length " metadata property * @ return A prepared attachment , ready to be added to the DocumentStore * @ throws AttachmentException if there was an error preparing the attachment , e . g . , reading * attachment data . */ public PreparedAttachment prepareAttachment ( Attachment att , long length , long encodedLength ) throws AttachmentException { } }
PreparedAttachment pa = AttachmentManager . prepareAttachment ( attachmentsDir , attachmentStreamFactory , att , length , encodedLength ) ; return pa ;
public class SslContextFactory { /** * Check KeyStore Configuration . Ensures that if keystore has been * configured but there ' s no truststore , that keystore is * used as truststore . * @ throws IllegalStateException if SslContextFactory configuration can ' t be used . */ public void checkKeyStore ( ) { } }
if ( sslContext != null ) return ; // nothing to check if using preconfigured context if ( keyStoreInputStream == null && sslConfig . getKeyStorePath ( ) == null ) { throw new IllegalStateException ( "SSL doesn't have a valid keystore" ) ; } // if the keystore has been configured but there is no // truststore configured , use the keystore as the truststore if ( trustStoreInputStream == null && sslConfig . getTrustStorePath ( ) == null ) { trustStoreInputStream = keyStoreInputStream ; sslConfig . setTrustStorePath ( sslConfig . getKeyStorePath ( ) ) ; sslConfig . setTrustStoreType ( sslConfig . getKeyStoreType ( ) ) ; sslConfig . setTrustStoreProvider ( sslConfig . getKeyStoreProvider ( ) ) ; sslConfig . setTrustStorePassword ( sslConfig . getKeyStorePassword ( ) ) ; sslConfig . setTrustManagerFactoryAlgorithm ( sslConfig . getKeyManagerFactoryAlgorithm ( ) ) ; } // It ' s the same stream we cannot read it twice , so read it once in memory if ( keyStoreInputStream != null && keyStoreInputStream == trustStoreInputStream ) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; streamCopy ( keyStoreInputStream , baos , null , false ) ; keyStoreInputStream . close ( ) ; keyStoreInputStream = new ByteArrayInputStream ( baos . toByteArray ( ) ) ; trustStoreInputStream = new ByteArrayInputStream ( baos . toByteArray ( ) ) ; } catch ( Exception ex ) { throw new IllegalStateException ( ex ) ; } }
public class CanonicalIterator { /** * Get the next canonically equivalent string . * < br > < b > Warning : The strings are not guaranteed to be in any particular order . < / b > * @ return the next string that is canonically equivalent . The value null is returned when * the iteration is done . */ public String next ( ) { } }
if ( done ) return null ; // construct return value buffer . setLength ( 0 ) ; // delete old contents for ( int i = 0 ; i < pieces . length ; ++ i ) { buffer . append ( pieces [ i ] [ current [ i ] ] ) ; } String result = buffer . toString ( ) ; // find next value for next time for ( int i = current . length - 1 ; ; -- i ) { if ( i < 0 ) { done = true ; break ; } current [ i ] ++ ; if ( current [ i ] < pieces [ i ] . length ) break ; // got sequence current [ i ] = 0 ; } return result ;
public class AuditLog { /** * < pre > * The operation response . This may not include all response elements , * such as those that are too large , privacy - sensitive , or duplicated * elsewhere in the log record . * It should never include user - generated data , such as file contents . * When the JSON object represented here has a proto equivalent , the proto * name will be indicated in the ` & # 64 ; type ` property . * < / pre > * < code > . google . protobuf . Struct response = 17 ; < / code > */ public com . google . protobuf . Struct getResponse ( ) { } }
return response_ == null ? com . google . protobuf . Struct . getDefaultInstance ( ) : response_ ;
public class AuditServiceImpl { /** * ( non - Javadoc ) * @ see com . ibm . wsspi . security . audit . AuditService # registerEvents ( ) */ @ Override public void registerEvents ( String handlerName , List < Map < String , Object > > configuredEvents ) throws InvalidConfigurationException { } }
if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "size of configuredEvents: " + configuredEvents . size ( ) ) ; } if ( validateEventsAndOutcomes ( handlerName , configuredEvents ) ) { if ( ! handlerEventsMap . containsKey ( handlerName ) ) { handlerEventsMap . put ( handlerName , configuredEvents ) ; } if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "handlerEventsMap: " + handlerEventsMap . toString ( ) ) ; } auditStarted ( "AuditService" ) ; if ( handlerEventsMap . isEmpty ( ) || handlerEventsMap . containsKey ( AUDIT_FILE_HANDLER_NAME ) ) { AuditMgmtEvent av = new AuditMgmtEvent ( thisConfiguration , "AuditHandler:" + AUDIT_FILE_HANDLER_NAME , "start" ) ; sendEvent ( av ) ; } } else { throw new InvalidConfigurationException ( ) ; }
public class PasswordPolicyService { /** * Verifies that the given user can change their password without violating * password aging policy . If changing the user ' s password would violate the * aging policy , a GuacamoleException will be thrown . * @ param user * The user whose password is changing . * @ throws GuacamoleException * If the user ' s password cannot be changed due to the password aging * policy , or of the password policy cannot be parsed from * guacamole . properties . */ public void verifyPasswordAge ( ModeledUser user ) throws GuacamoleException { } }
// Retrieve password policy from environment PasswordPolicy policy = environment . getPasswordPolicy ( ) ; long minimumAge = policy . getMinimumAge ( ) ; long passwordAge = getPasswordAge ( user ) ; // Require that sufficient time has elapsed before allowing the password // to be changed if ( passwordAge < minimumAge ) throw new PasswordTooYoungException ( "Password was already recently changed." , minimumAge - passwordAge ) ;
public class CPFriendlyURLEntryLocalServiceUtil { /** * Returns all the cp friendly url entries matching the UUID and company . * @ param uuid the UUID of the cp friendly url entries * @ param companyId the primary key of the company * @ return the matching cp friendly url entries , or an empty list if no matches were found */ public static java . util . List < com . liferay . commerce . product . model . CPFriendlyURLEntry > getCPFriendlyURLEntriesByUuidAndCompanyId ( String uuid , long companyId ) { } }
return getService ( ) . getCPFriendlyURLEntriesByUuidAndCompanyId ( uuid , companyId ) ;
public class FiducialDetection { /** * Displays a continuous stream of images */ private void processStream ( CameraPinholeBrown intrinsic , SimpleImageSequence < GrayU8 > sequence , ImagePanel gui , long pauseMilli ) { } }
Font font = new Font ( "Serif" , Font . BOLD , 24 ) ; Se3_F64 fiducialToCamera = new Se3_F64 ( ) ; int frameNumber = 0 ; while ( sequence . hasNext ( ) ) { long before = System . currentTimeMillis ( ) ; GrayU8 input = sequence . next ( ) ; BufferedImage buffered = sequence . getGuiImage ( ) ; try { detector . detect ( input ) ; } catch ( RuntimeException e ) { System . err . println ( "BUG!!! saving image to crash_image.png" ) ; UtilImageIO . saveImage ( buffered , "crash_image.png" ) ; throw e ; } Graphics2D g2 = buffered . createGraphics ( ) ; for ( int i = 0 ; i < detector . totalFound ( ) ; i ++ ) { detector . getFiducialToCamera ( i , fiducialToCamera ) ; long id = detector . getId ( i ) ; double width = detector . getWidth ( i ) ; VisualizeFiducial . drawCube ( fiducialToCamera , intrinsic , width , 3 , g2 ) ; VisualizeFiducial . drawLabelCenter ( fiducialToCamera , intrinsic , "" + id , g2 ) ; } saveResults ( frameNumber ++ ) ; if ( intrinsicPath == null ) { g2 . setColor ( Color . RED ) ; g2 . setFont ( font ) ; g2 . drawString ( "Uncalibrated" , 10 , 20 ) ; } gui . setImage ( buffered ) ; long after = System . currentTimeMillis ( ) ; long time = Math . max ( 0 , pauseMilli - ( after - before ) ) ; if ( time > 0 ) { try { Thread . sleep ( time ) ; } catch ( InterruptedException ignore ) { } } }
public class ObjectContainerPresentationSpaceSizeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . OBJECT_CONTAINER_PRESENTATION_SPACE_SIZE__PDF_SIZE : return PDF_SIZE_EDEFAULT == null ? pdfSize != null : ! PDF_SIZE_EDEFAULT . equals ( pdfSize ) ; } return super . eIsSet ( featureID ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcEventType ( ) { } }
if ( ifcEventTypeEClass == null ) { ifcEventTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 241 ) ; } return ifcEventTypeEClass ;
public class MeterActiveTime { /** * Return the probe ' s next average . */ public final void sample ( ) { } }
synchronized ( _lock ) { long count = _totalCount . get ( ) ; long lastCount = _lastAvgTotalCount ; _lastAvgTotalCount = count ; long sum = _sum . get ( ) ; double lastSum = _lastAvgSum ; _lastAvgSum = sum ; if ( count == lastCount ) { _avg = 0 ; } else { _avg = _scale * ( sum - lastSum ) / ( double ) ( count - lastCount ) ; } }
public class AWSGlueClient { /** * Retrieves the definition of a specified database . * @ param getDatabaseRequest * @ return Result of the GetDatabase operation returned by the service . * @ throws InvalidInputException * The input provided was not valid . * @ throws EntityNotFoundException * A specified entity does not exist * @ throws InternalServiceException * An internal service error occurred . * @ throws OperationTimeoutException * The operation timed out . * @ throws GlueEncryptionException * An encryption operation failed . * @ sample AWSGlue . GetDatabase * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / glue - 2017-03-31 / GetDatabase " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetDatabaseResult getDatabase ( GetDatabaseRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetDatabase ( request ) ;
public class LineWrapper { /** * Emit { @ code s } . This may be buffered to permit line wraps to be inserted . */ void append ( String s ) throws IOException { } }
if ( closed ) throw new IllegalStateException ( "closed" ) ; if ( nextFlush != null ) { int nextNewline = s . indexOf ( '\n' ) ; // If s doesn ' t cause the current line to cross the limit , buffer it and return . We ' ll decide // whether or not we have to wrap it later . if ( nextNewline == - 1 && column + s . length ( ) <= columnLimit ) { buffer . append ( s ) ; column += s . length ( ) ; return ; } // Wrap if appending s would overflow the current line . boolean wrap = nextNewline == - 1 || column + nextNewline > columnLimit ; flush ( wrap ? FlushType . WRAP : nextFlush ) ; } out . append ( s ) ; int lastNewline = s . lastIndexOf ( '\n' ) ; column = lastNewline != - 1 ? s . length ( ) - lastNewline - 1 : column + s . length ( ) ;
public class CalendarDateCalculator { public CalendarDateCalculator moveByDays ( final int days ) { } }
setCurrentIncrement ( days ) ; getCurrentBusinessDate ( ) . add ( Calendar . DAY_OF_MONTH , days ) ; if ( getHolidayHandler ( ) != null ) { setCurrentBusinessDate ( getHolidayHandler ( ) . moveCurrentDate ( this ) ) ; } return this ;
public class Messenger { /** * Toggle video of call * @ param callId Call Id */ @ ObjectiveCName ( "toggleVideoEnabledWithCallId:" ) public void toggleVideoEnabled ( long callId ) { } }
if ( modules . getCallsModule ( ) . getCall ( callId ) . getIsVideoEnabled ( ) . get ( ) ) { modules . getCallsModule ( ) . disableVideo ( callId ) ; } else { modules . getCallsModule ( ) . enableVideo ( callId ) ; }
public class ReportDaoImpl { /** * Generic method to add a element for a parent element given . */ private Element addElement ( Document document , Element parent , Map < ReportKey , Object > reportsData , ReportKey key , String value ) { } }
if ( reportsData . containsKey ( key ) ) { Element child = document . createElement ( key . name ( ) . toLowerCase ( ) ) ; child . appendChild ( document . createTextNode ( value ) ) ; parent . appendChild ( child ) ; return child ; } return null ;
public class DateTimeExtensions { /** * Converts the Calendar to a corresponding { @ link java . time . MonthDay } . If the Calendar has a different * time zone than the system default , the MonthDay will be adjusted into the default time zone . * @ param self a Calendar * @ return a MonthDay * @ since 2.5.0 */ public static MonthDay toMonthDay ( final Calendar self ) { } }
return MonthDay . of ( toMonth ( self ) , self . get ( Calendar . DAY_OF_MONTH ) ) ;
public class GetRelationalDatabaseSnapshotsResult { /** * An object describing the result of your get relational database snapshots request . * @ param relationalDatabaseSnapshots * An object describing the result of your get relational database snapshots request . */ public void setRelationalDatabaseSnapshots ( java . util . Collection < RelationalDatabaseSnapshot > relationalDatabaseSnapshots ) { } }
if ( relationalDatabaseSnapshots == null ) { this . relationalDatabaseSnapshots = null ; return ; } this . relationalDatabaseSnapshots = new java . util . ArrayList < RelationalDatabaseSnapshot > ( relationalDatabaseSnapshots ) ;
public class RemotingDispatcher { /** * 1 . 将 channel 纳入管理中 ( 不存在就加入 ) * 2 . 更新 TaskTracker 节点信息 ( 可用线程数 ) */ private void offerHandler ( Channel channel , RemotingCommand request ) { } }
AbstractRemotingCommandBody commandBody = request . getBody ( ) ; String nodeGroup = commandBody . getNodeGroup ( ) ; String identity = commandBody . getIdentity ( ) ; NodeType nodeType = NodeType . valueOf ( commandBody . getNodeType ( ) ) ; // 1 . 将 channel 纳入管理中 ( 不存在就加入 ) appContext . getChannelManager ( ) . offerChannel ( new ChannelWrapper ( channel , nodeType , nodeGroup , identity ) ) ;
public class ComponentDao { /** * Return list of components that will will mix main and branch components . * Please note that a project can only appear once in the list , it ' s not possible to ask for many branches on same project with this method . */ public List < ComponentDto > selectByKeysAndBranches ( DbSession session , Map < String , String > branchesByKey ) { } }
Set < String > dbKeys = branchesByKey . entrySet ( ) . stream ( ) . map ( entry -> generateBranchKey ( entry . getKey ( ) , entry . getValue ( ) ) ) . collect ( toSet ( ) ) ; return selectByDbKeys ( session , dbKeys ) ;
public class KeyUsageExtension { /** * Encode this extension value */ private void encodeThis ( ) throws IOException { } }
DerOutputStream os = new DerOutputStream ( ) ; os . putTruncatedUnalignedBitString ( new BitArray ( this . bitString ) ) ; this . extensionValue = os . toByteArray ( ) ;
public class AmazonEKSClient { /** * Returns descriptive information about an Amazon EKS cluster . * The API server endpoint and certificate authority data returned by this operation are required for * < code > kubelet < / code > and < code > kubectl < / code > to communicate with your Kubernetes API server . For more * information , see < a href = " https : / / docs . aws . amazon . com / eks / latest / userguide / create - kubeconfig . html " > Create a * kubeconfig for Amazon EKS < / a > . * < note > * The API server endpoint and certificate authority data are not available until the cluster reaches the * < code > ACTIVE < / code > state . * < / note > * @ param describeClusterRequest * @ return Result of the DescribeCluster operation returned by the service . * @ throws ResourceNotFoundException * The specified resource could not be found . You can view your available clusters with < a > ListClusters < / a > . * Amazon EKS clusters are Region - specific . * @ throws ClientException * These errors are usually caused by a client action . Actions can include using an action or resource on * behalf of a user that doesn ' t have permissions to use the action or resource or specifying an identifier * that is not valid . * @ throws ServerException * These errors are usually caused by a server - side issue . * @ throws ServiceUnavailableException * The service is unavailable . Back off and retry the operation . * @ sample AmazonEKS . DescribeCluster * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / eks - 2017-11-01 / DescribeCluster " target = " _ top " > AWS API * Documentation < / a > */ @ Override public DescribeClusterResult describeCluster ( DescribeClusterRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeCluster ( request ) ;
public class MicroServiceTemplateSupport { /** * 20180605 ning */ public Map getMapByIdService4text ( String id , String tableName , String colName ) { } }
Map data = getInfoByIdService ( id , tableName ) ; if ( data == null ) { return null ; } String dataStr = ( String ) data . get ( colName ) ; if ( dataStr == null || "" . equals ( dataStr ) ) { dataStr = "{}" ; } Gson gson = new Gson ( ) ; Map dataMap = gson . fromJson ( dataStr , Map . class ) ; return dataMap ;
public class MapLayer { /** * Replies if this layer accepts the user clicks . * @ return < code > true < / code > if this layer allows mouse click events , otherwise < code > false < / code > */ @ Pure public boolean isClickable ( ) { } }
final AttributeValue val = getAttributeProvider ( ) . getAttribute ( ATTR_CLICKABLE ) ; if ( val != null ) { try { return val . getBoolean ( ) ; } catch ( AttributeException e ) { } } return true ;
public class Utils { /** * Formats the given long value into a human readable notation using the Kilo , Mega , Giga , etc . abbreviations . * @ param value the value to format * @ return the string representation */ public static String humanize ( long value ) { } }
if ( value < 0 ) { return '-' + humanize ( - value ) ; } else if ( value > 1000000000000000000L ) { return Double . toString ( ( value + 500000000000000L ) / 1000000000000000L * 1000000000000000L / 1000000000000000000.0 ) + 'E' ; } else if ( value > 100000000000000000L ) { return Double . toString ( ( value + 50000000000000L ) / 100000000000000L * 100000000000000L / 1000000000000000.0 ) + 'P' ; } else if ( value > 10000000000000000L ) { return Double . toString ( ( value + 5000000000000L ) / 10000000000000L * 10000000000000L / 1000000000000000.0 ) + 'P' ; } else if ( value > 1000000000000000L ) { return Double . toString ( ( value + 500000000000L ) / 1000000000000L * 1000000000000L / 1000000000000000.0 ) + 'P' ; } else if ( value > 100000000000000L ) { return Double . toString ( ( value + 50000000000L ) / 100000000000L * 100000000000L / 1000000000000.0 ) + 'T' ; } else if ( value > 10000000000000L ) { return Double . toString ( ( value + 5000000000L ) / 10000000000L * 10000000000L / 1000000000000.0 ) + 'T' ; } else if ( value > 1000000000000L ) { return Double . toString ( ( value + 500000000 ) / 1000000000 * 1000000000 / 1000000000000.0 ) + 'T' ; } else if ( value > 100000000000L ) { return Double . toString ( ( value + 50000000 ) / 100000000 * 100000000 / 1000000000.0 ) + 'G' ; } else if ( value > 10000000000L ) { return Double . toString ( ( value + 5000000 ) / 10000000 * 10000000 / 1000000000.0 ) + 'G' ; } else if ( value > 1000000000 ) { return Double . toString ( ( value + 500000 ) / 1000000 * 1000000 / 1000000000.0 ) + 'G' ; } else if ( value > 100000000 ) { return Double . toString ( ( value + 50000 ) / 100000 * 100000 / 1000000.0 ) + 'M' ; } else if ( value > 10000000 ) { return Double . toString ( ( value + 5000 ) / 10000 * 10000 / 1000000.0 ) + 'M' ; } else if ( value > 1000000 ) { return Double . toString ( ( value + 500 ) / 1000 * 1000 / 1000000.0 ) + 'M' ; } else if ( value > 100000 ) { return Double . toString ( ( value + 50 ) / 100 * 100 / 1000.0 ) + 'K' ; } else if ( value > 10000 ) { return Double . toString ( ( value + 5 ) / 10 * 10 / 1000.0 ) + 'K' ; } else if ( value > 1000 ) { return Double . toString ( value / 1000.0 ) + 'K' ; } else { return Long . toString ( value ) + ' ' ; }
public class RepresentationModelProcessorInvoker { /** * Invokes all registered { @ link RepresentationModelProcessor } s registered for the given { @ link ResolvableType } . * @ param value the object to process * @ param type * @ return */ private Object invokeProcessorsFor ( Object value , ResolvableType type ) { } }
Object currentValue = value ; // Process actual value for ( RepresentationModelProcessorInvoker . ProcessorWrapper wrapper : this . processors ) { if ( wrapper . supports ( type , currentValue ) ) { currentValue = wrapper . invokeProcessor ( currentValue ) ; } } return currentValue ;
public class ModelUtils { /** * Gets and splits exported variables separated by a comma . * Variable names are not prefixed by the type ' s name . < br / > * Variable values may also be surrounded by quotes . * @ param exportedVariablesDecl the declaration to parse * @ param sourceFile the source file * @ param lineNumber the line number * @ return a non - null map ( key = exported variable name , value = the exported variable ) */ public static Map < String , ExportedVariable > findExportedVariables ( String exportedVariablesDecl , File sourceFile , int lineNumber ) { } }
Map < String , ExportedVariable > result = new HashMap < > ( ) ; Pattern pattern = Pattern . compile ( ParsingConstants . PROPERTY_GRAPH_RANDOM_PATTERN , Pattern . CASE_INSENSITIVE ) ; ExportedVariablesParser exportsParser = new ExportedVariablesParser ( ) ; exportsParser . parse ( exportedVariablesDecl , sourceFile , lineNumber ) ; for ( Map . Entry < String , String > entry : exportsParser . rawNameToVariables . entrySet ( ) ) { ExportedVariable var = new ExportedVariable ( ) ; String variableName = entry . getKey ( ) ; Matcher m = pattern . matcher ( variableName ) ; if ( m . matches ( ) ) { var . setRandom ( true ) ; var . setRawKind ( m . group ( 1 ) ) ; variableName = m . group ( 2 ) . trim ( ) ; } var . setName ( variableName ) ; var . setValue ( entry . getValue ( ) ) ; result . put ( var . getName ( ) , var ) ; } return result ;
public class MapViewProjection { /** * Computes horizontal extend of the map view . * @ return the longitude span of the map in degrees */ public double getLongitudeSpan ( ) { } }
if ( this . mapView . getWidth ( ) > 0 && this . mapView . getHeight ( ) > 0 ) { LatLong left = fromPixels ( 0 , 0 ) ; LatLong right = fromPixels ( this . mapView . getWidth ( ) , 0 ) ; return Math . abs ( left . longitude - right . longitude ) ; } throw new IllegalStateException ( INVALID_MAP_VIEW_DIMENSIONS ) ;
public class FastTrackData { /** * Read data for a single column . * @ param startIndex block start * @ param length block length */ private void readColumn ( int startIndex , int length ) throws Exception { } }
if ( m_currentTable != null ) { int value = FastTrackUtility . getByte ( m_buffer , startIndex ) ; Class < ? > klass = COLUMN_MAP [ value ] ; if ( klass == null ) { klass = UnknownColumn . class ; } FastTrackColumn column = ( FastTrackColumn ) klass . newInstance ( ) ; m_currentColumn = column ; logColumnData ( startIndex , length ) ; column . read ( m_currentTable . getType ( ) , m_buffer , startIndex , length ) ; FastTrackField type = column . getType ( ) ; // Don ' t try to add this data if : // 1 . We don ' t know what type it is // 2 . We have seen the type already if ( type != null && ! m_currentFields . contains ( type ) ) { m_currentFields . add ( type ) ; m_currentTable . addColumn ( column ) ; updateDurationTimeUnit ( column ) ; updateWorkTimeUnit ( column ) ; logColumn ( column ) ; } }
public class FilteredSparseInstanceData { /** * Value of the attribute in the indexAttribute position . * If this value is absent , a NaN value ( marker of missing value ) * is returned , otherwise this method returns the actual value . * @ param indexAttribute the index attribute * @ return the double */ @ Override public double value ( int indexAttribute ) { } }
int location = locateIndex ( indexAttribute ) ; if ( ( location >= 0 ) && ( indexValues [ location ] == indexAttribute ) ) { return attributeValues [ location ] ; } else { // returns a NaN value which represents missing values instead of a 0 ( zero ) return Double . NaN ; }
public class UtilDenoiseWavelet { /** * Computes the universal threshold defined in [ 1 ] , which is the threshold used by * VisuShrink . The same threshold is used by other algorithms . * threshold = & sigma ; sqrt ( 2 * log ( max ( w , h ) ) < br > * where ( w , h ) is the image ' s width and height . * [ 1 ] D . L . Donoho and I . M . Johnstone , " Ideal spatial adaption via wavelet shrinkage . " * Biometrika , vol 81 , pp . 425-455 , 1994 * @ param image Input image . Only the width and height are used in computing this thresold . * @ param noiseSigma Estimated noise sigma . * @ return universal threshold . */ public static double universalThreshold ( ImageGray image , double noiseSigma ) { } }
int w = image . width ; int h = image . height ; return noiseSigma * Math . sqrt ( 2 * Math . log ( Math . max ( w , h ) ) ) ;
public class MethodUtil { /** * Determines the mutator method name based on a field name . * @ param fieldName * a field name * @ return the resulting method name */ public static String determineMutatorName ( @ Nonnull final String fieldName ) { } }
Check . notEmpty ( fieldName , "fieldName" ) ; final Matcher m = PATTERN . matcher ( fieldName ) ; Check . stateIsTrue ( m . find ( ) , "passed field name '%s' is not applicable" , fieldName ) ; final String name = m . group ( ) ; return METHOD_SET_PREFIX + name . substring ( 0 , 1 ) . toUpperCase ( ) + name . substring ( 1 ) ;
public class ColtUtils { /** * Matrix - vector multiplication with diagonal matrix . * @ param diagonalM diagonal matrix M , in the form of a vector of its diagonal elements * @ param vector * @ return M . x */ public static final DoubleMatrix1D diagonalMatrixMult ( DoubleMatrix1D diagonalM , DoubleMatrix1D vector ) { } }
int n = diagonalM . size ( ) ; DoubleMatrix1D ret = DoubleFactory1D . dense . make ( n ) ; for ( int i = 0 ; i < n ; i ++ ) { ret . setQuick ( i , diagonalM . getQuick ( i ) * vector . getQuick ( i ) ) ; } return ret ;
public class TypesafeConfigUtils { /** * Get a configuration as Boolean . Return { @ code null } if missing or wrong type . * @ param config * @ param path * @ return */ public static Optional < Boolean > getBooleanOptional ( Config config , String path ) { } }
return Optional . ofNullable ( getBoolean ( config , path ) ) ;
public class syslog_sslvpn { /** * < pre > * Report for sslvpn syslog message received by this collector . . * < / pre > */ public static syslog_sslvpn [ ] get ( nitro_service client ) throws Exception { } }
syslog_sslvpn resource = new syslog_sslvpn ( ) ; resource . validate ( "get" ) ; return ( syslog_sslvpn [ ] ) resource . get_resources ( client ) ;
public class APIKeysInner { /** * Gets a list of API keys of an Application Insights component . * @ param resourceGroupName The name of the resource group . * @ param resourceName The name of the Application Insights component resource . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the List & lt ; ApplicationInsightsComponentAPIKeyInner & gt ; object */ public Observable < List < ApplicationInsightsComponentAPIKeyInner > > listAsync ( String resourceGroupName , String resourceName ) { } }
return listWithServiceResponseAsync ( resourceGroupName , resourceName ) . map ( new Func1 < ServiceResponse < List < ApplicationInsightsComponentAPIKeyInner > > , List < ApplicationInsightsComponentAPIKeyInner > > ( ) { @ Override public List < ApplicationInsightsComponentAPIKeyInner > call ( ServiceResponse < List < ApplicationInsightsComponentAPIKeyInner > > response ) { return response . body ( ) ; } } ) ;
public class StartupServletContextListener { /** * Publishes the ManagedBeanDestroyerListener instance in the application map . * This allows the FacesConfigurator to access the instance and to set the * correct ManagedBeanDestroyer instance on it . * @ param facesContext */ private void _publishManagedBeanDestroyerListener ( FacesContext facesContext ) { } }
ExternalContext externalContext = facesContext . getExternalContext ( ) ; Map < String , Object > applicationMap = externalContext . getApplicationMap ( ) ; applicationMap . put ( ManagedBeanDestroyerListener . APPLICATION_MAP_KEY , _detroyerListener ) ;
public class AbstractDraweeController { /** * Sets gesture detector . */ protected void setGestureDetector ( @ Nullable GestureDetector gestureDetector ) { } }
mGestureDetector = gestureDetector ; if ( mGestureDetector != null ) { mGestureDetector . setClickListener ( this ) ; }
public class EntityHelper { /** * 获取默认的orderby语句 * @ param entityClass * @ return */ public static String getOrderByClause ( Class < ? > entityClass ) { } }
EntityTable table = getEntityTable ( entityClass ) ; if ( table . getOrderByClause ( ) != null ) { return table . getOrderByClause ( ) ; } List < EntityColumn > orderEntityColumns = new ArrayList < EntityColumn > ( ) ; for ( EntityColumn column : table . getEntityClassColumns ( ) ) { if ( column . getOrderBy ( ) != null ) { orderEntityColumns . add ( column ) ; } } Collections . sort ( orderEntityColumns , new Comparator < EntityColumn > ( ) { @ Override public int compare ( EntityColumn o1 , EntityColumn o2 ) { return o1 . getOrderPriority ( ) - o2 . getOrderPriority ( ) ; } } ) ; StringBuilder orderBy = new StringBuilder ( ) ; for ( EntityColumn column : orderEntityColumns ) { if ( orderBy . length ( ) != 0 ) { orderBy . append ( "," ) ; } orderBy . append ( column . getColumn ( ) ) . append ( " " ) . append ( column . getOrderBy ( ) ) ; } table . setOrderByClause ( orderBy . toString ( ) ) ; return table . getOrderByClause ( ) ;
public class CaseArgumentAnalyser { /** * Finds for each JoinedArgs set the best fitting name . * First it is tried to find a name from the explicitParameterNames list , by comparing the argument values * with the explicit case argument values . If no matching value can be found , the name of the argument is taken . */ private List < String > findArgumentNames ( List < List < JoinedArgs > > joinedArgs , List < List < String > > explicitParameterValues , List < String > explicitParameterNames ) { } }
List < String > argumentNames = Lists . newArrayListWithExpectedSize ( joinedArgs . get ( 0 ) . size ( ) ) ; Multiset < String > paramNames = TreeMultiset . create ( ) ; arguments : for ( int iArg = 0 ; iArg < joinedArgs . get ( 0 ) . size ( ) ; iArg ++ ) { parameters : for ( int iParam = 0 ; iParam < explicitParameterNames . size ( ) ; iParam ++ ) { String paramName = explicitParameterNames . get ( iParam ) ; boolean formattedValueMatches = true ; boolean valueMatches = true ; for ( int iCase = 0 ; iCase < joinedArgs . size ( ) ; iCase ++ ) { JoinedArgs args = joinedArgs . get ( iCase ) . get ( iArg ) ; String parameterValue = explicitParameterValues . get ( iCase ) . get ( iParam ) ; String formattedValue = args . words . get ( 0 ) . getFormattedValue ( ) ; if ( ! formattedValue . equals ( parameterValue ) ) { formattedValueMatches = false ; } String value = args . words . get ( 0 ) . getValue ( ) ; if ( ! value . equals ( parameterValue ) ) { valueMatches = false ; } if ( ! formattedValueMatches && ! valueMatches ) { continue parameters ; } } // on this point either all formatted values match or all values match ( or both ) argumentNames . add ( paramName ) ; paramNames . add ( paramName ) ; continue arguments ; } argumentNames . add ( null ) ; } Set < String > usedNames = Sets . newHashSet ( ) ; for ( int iArg = 0 ; iArg < joinedArgs . get ( 0 ) . size ( ) ; iArg ++ ) { String name = argumentNames . get ( iArg ) ; if ( name == null || paramNames . count ( name ) > 1 ) { String origName = getArgumentName ( joinedArgs , iArg ) ; name = findFreeName ( usedNames , origName ) ; argumentNames . set ( iArg , name ) ; } usedNames . add ( name ) ; } return argumentNames ;
public class AbstractPoint { /** * Returns a new Point ( p1 . x - p2 . x , p1 . y - p2 . y ) * @ param p1 * @ param p2 * @ return Returns a new Point ( p1 . x - p2 . x , p1 . y - p2 . y ) */ public static final Point subtract ( Point p1 , Point p2 ) { } }
return new AbstractPoint ( p1 . getX ( ) - p2 . getX ( ) , p1 . getY ( ) - p2 . getY ( ) ) ;
public class PutMethodRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( PutMethodRequest putMethodRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( putMethodRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( putMethodRequest . getRestApiId ( ) , RESTAPIID_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getHttpMethod ( ) , HTTPMETHOD_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getAuthorizationType ( ) , AUTHORIZATIONTYPE_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getAuthorizerId ( ) , AUTHORIZERID_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getApiKeyRequired ( ) , APIKEYREQUIRED_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getOperationName ( ) , OPERATIONNAME_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getRequestParameters ( ) , REQUESTPARAMETERS_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getRequestModels ( ) , REQUESTMODELS_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getRequestValidatorId ( ) , REQUESTVALIDATORID_BINDING ) ; protocolMarshaller . marshall ( putMethodRequest . getAuthorizationScopes ( ) , AUTHORIZATIONSCOPES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ChooseRandom { /** * { @ inheritDoc } */ @ Override public synchronized String execute ( SampleResult previousResult , Sampler currentSampler ) throws InvalidVariableException { } }
JMeterVariables vars = getVariables ( ) ; String varName = ( ( CompoundVariable ) values [ values . length - 1 ] ) . execute ( ) . trim ( ) ; int index = random . nextInt ( values . length - 1 ) ; String choice = ( ( CompoundVariable ) values [ index ] ) . execute ( ) ; if ( vars != null && varName != null && varName . length ( ) > 0 ) { // vars will be null on TestPlan vars . put ( varName , choice ) ; } return choice ;
public class ScenarioPortrayal { /** * Sets the data for the scatterPlot . * Should be used only the first time . Use * updateDataSerieOnScaterPlot to change the data * @ param scatterID * @ param dataSerie the data . The first dimension MUST BE 2 ( double [ 2 ] [ whatever _ int ] ) */ public void addDataSerieToScatterPlot ( String scatterID , double [ ] [ ] dataSerie ) { } }
if ( this . scatterPlots . containsKey ( scatterID ) ) { this . scatterPlotsData . put ( scatterID , dataSerie ) ; this . scatterPlots . get ( scatterID ) . addSeries ( ( double [ ] [ ] ) this . scatterPlotsData . get ( scatterID ) , scatterID , null ) ; }
public class CmsJspActionElement { /** * Includes the direct edit scriptlet , same as * using the < code > & lt ; cms : editable provider = " . . . " mode = " . . . " file = " . . . " / & gt ; < / code > tag . < p > * @ param provider the direct edit provider class name * @ param mode the direct edit mode to use * @ param filename file with scriptlet code ( may be < code > null < / code > ) * @ throws JspException if something goes wrong */ public void editable ( String provider , String mode , String filename ) throws JspException { } }
CmsJspTagEditable . editableTagAction ( getJspContext ( ) , provider , CmsDirectEditMode . valueOf ( mode ) , filename ) ;
public class Utils { /** * Reads a text file content and returns it as a string . * The file is tried to be read with UTF - 8 encoding . * If it fails , the default system encoding is used . * @ param file the file whose content must be loaded * @ return the file content * @ throws IOException if the file content could not be read */ public static String readFileContent ( File file ) throws IOException { } }
String result = null ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; Utils . copyStream ( file , os ) ; result = os . toString ( "UTF-8" ) ; return result ;
public class AmazonAlexaForBusinessClient { /** * Deletes a contact by the contact ARN . * @ param deleteContactRequest * @ return Result of the DeleteContact operation returned by the service . * @ throws NotFoundException * The resource is not found . * @ throws ConcurrentModificationException * There is a concurrent modification of resources . * @ sample AmazonAlexaForBusiness . DeleteContact * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / alexaforbusiness - 2017-11-09 / DeleteContact " target = " _ top " > AWS * API Documentation < / a > */ @ Override public DeleteContactResult deleteContact ( DeleteContactRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteContact ( request ) ;
public class CmsResource { /** * Returns true if the resource name certainly denotes a folder , that is ends with a " / " . < p > * @ param resource the resource to check * @ return true if the resource name certainly denotes a folder , that is ends with a " / " */ public static boolean isFolder ( String resource ) { } }
return CmsStringUtil . isNotEmpty ( resource ) && ( resource . charAt ( resource . length ( ) - 1 ) == '/' ) ;
public class CmsImportView { /** * Adds an import result to the displayed list of import results . < p > * @ param result the result to add */ protected void addImportResult ( CmsAliasImportResult result ) { } }
String cssClass ; I_Css css = CmsImportResultList . RESOURCES . css ( ) ; switch ( result . getStatus ( ) ) { case aliasChanged : cssClass = css . aliasImportOverwrite ( ) ; break ; case aliasImportError : case aliasParseError : cssClass = css . aliasImportError ( ) ; break ; case aliasNew : default : cssClass = css . aliasImportOk ( ) ; break ; } m_results . addRow ( CmsAliasMessages . messageAliasImportLine ( result ) , result . getMessage ( ) , cssClass ) ;
public class RendererBuilder { /** * Add a Renderer instance as prototype . * @ param renderer to use as prototype . * @ return the current RendererBuilder instance . */ public RendererBuilder < T > withPrototype ( Renderer < ? extends T > renderer ) { } }
if ( renderer == null ) { throw new NeedsPrototypesException ( "RendererBuilder can't use a null Renderer<T> instance as prototype" ) ; } this . prototypes . add ( renderer ) ; return this ;
public class AllocatedEvaluatorImpl { /** * Submit Context and Task with configuration strings . * This method should be called from bridge and the configuration strings are * serialized at . Net side . * @ param evaluatorConfiguration * @ param contextConfiguration * @ param taskConfiguration */ public void submitContextAndTask ( final String evaluatorConfiguration , final String contextConfiguration , final String taskConfiguration ) { } }
this . launchWithConfigurationString ( evaluatorConfiguration , contextConfiguration , Optional . < String > empty ( ) , Optional . of ( taskConfiguration ) ) ;
public class GenericUtils { /** * Utility method to get the ISO English string from the given bytes . If * this an unsupported encoding exception is thrown by the conversion , then * an IllegalArgumentException will be thrown . * @ param data * @ return String * @ exception IllegalArgumentException */ static public String getEnglishString ( byte [ ] data ) { } }
if ( null == data ) { return null ; } char chars [ ] = new char [ data . length ] ; for ( int i = 0 ; i < data . length ; i ++ ) { chars [ i ] = ( char ) ( data [ i ] & 0xff ) ; } return new String ( chars ) ;
public class AIStream { /** * Returns the AnycastInputHandler associated with this AIStream * @ return */ public AnycastInputHandler getAnycastInputHandler ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getAnycastInputHandler" ) ; SibTr . exit ( tc , "getAnycastInputHandler" , _parent ) ; } return _parent ;
public class Val { /** * As object . * @ param clazz the clazz * @ return the object */ public Object asObject ( @ NonNull Class < ? > clazz ) { } }
if ( Map . class . isAssignableFrom ( clazz ) ) { return asMap ( clazz , String . class , String . class ) ; } else if ( Collection . class . isAssignableFrom ( clazz ) ) { return asCollection ( clazz , String . class ) ; } return Object . class . cast ( as ( clazz ) ) ;
public class SSOClient { /** * 验证访问令牌并返回认证信息 * 在Servlet容器中可以通过调用 { @ link SSOUtils # extractAccessToken ( HttpServletRequest ) } 获取到访问令牌 。 * @ throws InvalidTokenException 如果accessToken是无效的 * @ throws TokenExpiredException 如果accessToken已经过期 */ public Authentication verifyAccessToken ( String accessToken ) throws InvalidTokenException , TokenExpiredException { } }
CacheProvider cp = cp ( ) ; Authentication authc = cp . get ( accessToken ) ; if ( null != authc ) { if ( ! authc . isExpired ( ) ) { return authc ; } else { cp . remove ( accessToken ) ; } } boolean jwt = checkJwtToken ( accessToken ) ; if ( jwt ) { authc = tp ( ) . verifyJwtAccessToken ( accessToken ) ; } else { authc = tp ( ) . verifyBearerAccessToken ( accessToken ) ; } cp . put ( accessToken , authc , authc . getExpires ( ) ) ; return authc ;
public class MediaApi { /** * Get the UCS content of the interaction * Get the UCS content of the interaction * @ param mediatype media - type of interaction ( required ) * @ param id id of the interaction ( required ) * @ param getContentData ( optional ) * @ return ApiSuccessResponse * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiSuccessResponse getContentMedia ( String mediatype , String id , GetContentData getContentData ) throws ApiException { } }
ApiResponse < ApiSuccessResponse > resp = getContentMediaWithHttpInfo ( mediatype , id , getContentData ) ; return resp . getData ( ) ;
public class CmsObject { /** * Changes the resource flags of a resource . < p > * The resource flags are used to indicate various " special " conditions * for a resource . Most notably , the " internal only " setting which signals * that a resource can not be directly requested with it ' s URL . < p > * @ param resourcename the name of the resource to change the flags for ( full current site relative path ) * @ param flags the new flags for this resource * @ throws CmsException if something goes wrong */ public void chflags ( String resourcename , int flags ) throws CmsException { } }
CmsResource resource = readResource ( resourcename , CmsResourceFilter . IGNORE_EXPIRATION ) ; getResourceType ( resource ) . chflags ( this , m_securityManager , resource , flags ) ;
public class InsuranceApi { /** * List insurance levels ( asynchronously ) Return available insurance levels * for all ship types - - - This route is cached for up to 3600 seconds * @ param acceptLanguage * Language to use in the response ( optional , default to en - us ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param ifNoneMatch * ETag from a previous request . A 304 will be returned if this * matches the current ETag ( optional ) * @ param language * Language to use in the response , takes precedence over * Accept - Language ( optional , default to en - us ) * @ param callback * The callback to be executed when the API call finishes * @ return The request call * @ throws ApiException * If fail to process the API call , e . g . serializing the request * body object */ public com . squareup . okhttp . Call getInsurancePricesAsync ( String acceptLanguage , String datasource , String ifNoneMatch , String language , final ApiCallback < List < InsurancePricesResponse > > callback ) throws ApiException { } }
com . squareup . okhttp . Call call = getInsurancePricesValidateBeforeCall ( acceptLanguage , datasource , ifNoneMatch , language , callback ) ; Type localVarReturnType = new TypeToken < List < InsurancePricesResponse > > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ;
public class AbstractDataStore { /** * Runtime check that the passed instance of { @ link Data } is not empty ( respectively { @ link Data # EMPTY } ) . * @ param data * instance of { @ code Data } * @ throws IllegalStateException * if the passed instance is empty */ private static Data checkData ( final Data data ) { } }
if ( Data . EMPTY . equals ( data ) ) { throw new IllegalStateException ( "Argument 'data' must not be empty." ) ; } return data ;
public class GitDirLocator { /** * Search up all the maven parent project hierarchy until a . git directory is found . * @ return File which represents the location of the . git directory or NULL if none found . */ @ Nullable private File findProjectGitDirectory ( ) { } }
if ( this . mavenProject == null ) { return null ; } File basedir = mavenProject . getBasedir ( ) ; while ( basedir != null ) { File gitdir = new File ( basedir , Constants . DOT_GIT ) ; if ( gitdir . exists ( ) ) { if ( gitdir . isDirectory ( ) ) { return gitdir ; } else if ( gitdir . isFile ( ) ) { return processGitDirFile ( gitdir ) ; } else { return null ; } } basedir = basedir . getParentFile ( ) ; } return null ;
public class IterableSubject { /** * Checks that the subject does not contain duplicate elements . */ public final void containsNoDuplicates ( ) { } }
List < Entry < ? > > duplicates = newArrayList ( ) ; for ( Multiset . Entry < ? > entry : LinkedHashMultiset . create ( actual ( ) ) . entrySet ( ) ) { if ( entry . getCount ( ) > 1 ) { duplicates . add ( entry ) ; } } if ( ! duplicates . isEmpty ( ) ) { failWithoutActual ( simpleFact ( "expected not to contain duplicates" ) , fact ( "but contained" , duplicates ) , fullContents ( ) ) ; }
public class DeploymentResourceSupport { /** * Checks to see if a subsystem resource has already been registered for the deployment . * @ param subsystemName the name of the subsystem * @ return { @ code true } if the subsystem exists on the deployment otherwise { @ code false } */ public boolean hasDeploymentSubsystemModel ( final String subsystemName ) { } }
final Resource root = deploymentUnit . getAttachment ( DEPLOYMENT_RESOURCE ) ; final PathElement subsystem = PathElement . pathElement ( SUBSYSTEM , subsystemName ) ; return root . hasChild ( subsystem ) ;
public class LocalisationManager { /** * Method addNewRemotePtoPLocalisation * < p > Suppports the addition of a new remote PtoP Localisation of a * destination . * @ param transaction * @ param messagingEngineUuid * @ param destinationLocalizationDefinition * @ param queuePoint * @ return * @ throws SIResourceException */ public PtoPMessageItemStream addNewRemotePtoPLocalization ( TransactionCommon transaction , SIBUuid8 messagingEngineUuid , LocalizationDefinition destinationLocalizationDefinition , boolean queuePoint , AbstractRemoteSupport remoteSupport ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addNewRemotePtoPLocalization" , new Object [ ] { transaction , messagingEngineUuid , destinationLocalizationDefinition , Boolean . valueOf ( queuePoint ) , remoteSupport } ) ; PtoPMessageItemStream newMsgItemStream = null ; // Add to the MessageStore try { if ( queuePoint ) { newMsgItemStream = new PtoPXmitMsgsItemStream ( _baseDestinationHandler , messagingEngineUuid ) ; } transaction . registerCallback ( new LocalizationAddTransactionCallback ( newMsgItemStream ) ) ; Transaction msTran = _messageProcessor . resolveAndEnlistMsgStoreTransaction ( transaction ) ; _baseDestinationHandler . addItemStream ( newMsgItemStream , msTran ) ; // Set the default limits newMsgItemStream . setDefaultDestLimits ( ) ; // Setup any message depth interval checking ( 510343) newMsgItemStream . setDestMsgInterval ( ) ; attachRemotePtoPLocalisation ( newMsgItemStream , remoteSupport ) ; } catch ( OutOfCacheSpace e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addNewRemotePtoPLocalization" , "SIResourceException" ) ; throw new SIResourceException ( e ) ; } catch ( MessageStoreException e ) { // MessageStoreException shouldn ' t occur so FFDC . FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.destination.LocalisationManager.addNewRemotePtoPLocalization" , "1:1562:1.30" , this ) ; SibTr . exception ( tc , e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addNewRemotePtoPLocalization" , e ) ; throw new SIResourceException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addNewRemotePtoPLocalization" , newMsgItemStream ) ; return newMsgItemStream ;
public class PortalApplicationContextLocator { /** * Inits and / or returns already initialized logger . < br > * You have to use this method in order to use the logger , < br > * you should not call the private variable directly . < br > * This was done because Tomcat may instantiate all listeners before calling contextInitialized * on any listener . < br > * Note that there is no synchronization here on purpose . The object returned by getLog for a * logger name is < br > * idempotent and getLog itself is thread safe . Eventually all < br > * threads will see an instance level logger variable and calls to getLog will stop . * @ return the log for this class */ protected static Log getLogger ( ) { } }
Log l = logger ; if ( l == null ) { l = LogFactory . getLog ( LOGGER_NAME ) ; logger = l ; } return l ;
public class SetConverter { /** * { @ inheritDoc } */ @ Override public Set < String > convert ( String value ) { } }
// shouldn ' t ever get called but if it does , the best we can do is return a String set List < String > list = Arrays . asList ( ConversionManager . split ( value ) ) ; Set < String > set = new HashSet < > ( list ) ; return set ;
public class ClassPropertyUsageAnalyzer { /** * Prints the data for a single class to the given stream . This will be a * single line in CSV . * @ param out * the output to write to * @ param classRecord * the class record to write * @ param entityIdValue * the item id that this class record belongs to */ private void printClassRecord ( PrintStream out , ClassRecord classRecord , EntityIdValue entityIdValue ) { } }
printTerms ( out , classRecord . itemDocument , entityIdValue , "\"" + getClassLabel ( entityIdValue ) + "\"" ) ; printImage ( out , classRecord . itemDocument ) ; out . print ( "," + classRecord . itemCount + "," + classRecord . subclassCount ) ; printClassList ( out , classRecord . superClasses ) ; HashSet < EntityIdValue > superClasses = new HashSet < > ( ) ; for ( EntityIdValue superClass : classRecord . superClasses ) { addSuperClasses ( superClass , superClasses ) ; } printClassList ( out , superClasses ) ; printRelatedProperties ( out , classRecord ) ; out . println ( "" ) ;
public class MessageDrivenBeanO { /** * getEJBHome - It is illegal to call this method * message - driven bean methods because there is no EJBHome object * for message - driven beans . */ @ Override public EJBHome getEJBHome ( ) // d116376 { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "getEJBHome" ) ; Tr . error ( tc , "METHOD_NOT_ALLOWED_CNTR0047E" , "MessageDrivenBeanO.getEJBHome()" ) ; throw new IllegalStateException ( "Method Not Allowed Exception: See Message-drive Bean Component Contract section of the applicable EJB Specification." ) ;
public class ConcurrentLinkedHashMap { /** * Runs the pending page replacement policy operations . * @ param tasks the ordered array of the pending operations * @ param maxTaskIndex the maximum index of the array */ @ GuardedBy ( "evictionLock" ) void runTasks ( Task [ ] tasks , int maxTaskIndex ) { } }
for ( int i = 0 ; i <= maxTaskIndex ; i ++ ) { runTasksInChain ( tasks [ i ] ) ; }
public class ClassFieldAccessorFactory { /** * Creates the set method for the given field definition */ protected static void buildSetMethod ( final Class < ? > originalClass , final String className , final Class < ? > superClass , final Method setterMethod , final Class < ? > fieldType , final ClassWriter cw ) { } }
MethodVisitor mv ; // set method { Method overridingMethod ; try { overridingMethod = superClass . getMethod ( getOverridingSetMethodName ( fieldType ) , Object . class , fieldType . isPrimitive ( ) ? fieldType : Object . class ) ; } catch ( final Exception e ) { throw new RuntimeException ( "This is a bug. Please report back to JBoss Rules team." , e ) ; } mv = cw . visitMethod ( Opcodes . ACC_PUBLIC , overridingMethod . getName ( ) , Type . getMethodDescriptor ( overridingMethod ) , null , null ) ; mv . visitCode ( ) ; final Label l0 = new Label ( ) ; mv . visitLabel ( l0 ) ; mv . visitVarInsn ( Opcodes . ALOAD , 1 ) ; mv . visitTypeInsn ( Opcodes . CHECKCAST , Type . getInternalName ( originalClass ) ) ; mv . visitVarInsn ( Type . getType ( fieldType ) . getOpcode ( Opcodes . ILOAD ) , 2 ) ; if ( ! fieldType . isPrimitive ( ) ) { mv . visitTypeInsn ( Opcodes . CHECKCAST , Type . getInternalName ( fieldType ) ) ; } if ( originalClass . isInterface ( ) ) { mv . visitMethodInsn ( Opcodes . INVOKEINTERFACE , Type . getInternalName ( originalClass ) , setterMethod . getName ( ) , Type . getMethodDescriptor ( setterMethod ) ) ; } else { mv . visitMethodInsn ( Opcodes . INVOKEVIRTUAL , Type . getInternalName ( originalClass ) , setterMethod . getName ( ) , Type . getMethodDescriptor ( setterMethod ) ) ; } mv . visitInsn ( Opcodes . RETURN ) ; final Label l1 = new Label ( ) ; mv . visitLabel ( l1 ) ; mv . visitLocalVariable ( "this" , "L" + className + ";" , null , l0 , l1 , 0 ) ; mv . visitLocalVariable ( "bean" , Type . getDescriptor ( Object . class ) , null , l0 , l1 , 1 ) ; mv . visitLocalVariable ( "value" , Type . getDescriptor ( fieldType ) , null , l0 , l1 , 2 ) ; mv . visitMaxs ( 0 , 0 ) ; mv . visitEnd ( ) ; }
public class IntTupleDistanceFunctions { /** * Computes the squared Euclidean distance between the given tuples * when they are interpreted as points of a sphere with the specified * size ( that is , circumference ) . * @ param t0 The first array * @ param t1 The second array * @ param size The size of the sphere * @ return The distance * @ throws IllegalArgumentException If the given tuples do not * have the same { @ link Tuple # getSize ( ) size } */ static long computeWrappedEuclideanSquared ( IntTuple t0 , IntTuple t1 , IntTuple size ) { } }
Utils . checkForEqualSize ( t0 , t1 ) ; Utils . checkForEqualSize ( t0 , size ) ; long sum = 0 ; for ( int i = 0 ; i < t0 . getSize ( ) ; i ++ ) { int d = MathUtils . wrappedDistance ( t0 . get ( i ) , t1 . get ( i ) , size . get ( i ) ) ; sum += d * d ; } return sum ;
public class Pattern { /** * Compares the keys and values of two group - info maps * @ param a the first map to compare * @ param b the other map to compare * @ return { @ code true } if the first map contains all of the other map ' s keys and values ; { @ code false } otherwise */ private boolean groupInfoMatches ( Map < String , List < GroupInfo > > a , Map < String , List < GroupInfo > > b ) { } }
if ( a == null && b == null ) { return true ; } boolean isMatch = false ; if ( a != null && b != null ) { if ( a . isEmpty ( ) && b . isEmpty ( ) ) { isMatch = true ; } else if ( a . size ( ) == b . size ( ) ) { for ( Entry < String , List < GroupInfo > > entry : a . entrySet ( ) ) { List < GroupInfo > otherList = b . get ( entry . getKey ( ) ) ; isMatch = ( otherList != null ) ; if ( ! isMatch ) { break ; } List < GroupInfo > thisList = entry . getValue ( ) ; isMatch = otherList . containsAll ( thisList ) && thisList . containsAll ( otherList ) ; if ( ! isMatch ) { break ; } } } } return isMatch ;
public class ShapeProcessor { /** * Method resize the given { @ code Shape } with respect of its original aspect ratio but independent of its original size . * Note : Out of performance reasons the given object will directly be manipulated . * @ param shape the shape to scale . * @ param width the width of the new shape . * @ param height the height of the new shape . * @ return the scaled { @ code Shape } instance . */ public static < S extends Shape > S resize ( final S shape , final double width , final double height ) { } }
// compute original size final double originalWidth = shape . prefWidth ( - 1 ) ; final double originalHeight = shape . prefHeight ( - 1 ) ; final double scalingFactor = Math . min ( width / originalWidth , height / originalHeight ) ; // rescale shape . setScaleX ( scalingFactor ) ; shape . setScaleY ( scalingFactor ) ; return shape ;
public class OnDiskSnapshotsStore { /** * { @ inheritDoc } * @ throws IllegalStateException if this method is called before { @ link OnDiskSnapshotsStore # initialize ( ) } */ @ SuppressWarnings ( "ConstantConditions" ) @ Override public void storeSnapshot ( ExtendedSnapshotWriter snapshotWriter ) throws StorageException { } }
checkInitialized ( ) ; checkArgument ( snapshotWriter instanceof SnapshotFileWriter , "unknown snapshot request type:%s" , snapshotWriter . getClass ( ) . getSimpleName ( ) ) ; final SnapshotFileWriter snapshotFileWriter = ( SnapshotFileWriter ) snapshotWriter ; checkArgument ( snapshotFileWriter . snapshotStarted ( ) , "snapshot was never started" ) ; try { // first close the output stream ( the snapshotFileWriter may already have done this , but nbd ) snapshotFileWriter . getSnapshotOutputStream ( ) . close ( ) ; // the time we ' ll assign to this snapshot ( both in the filename and the db ) long snapshotTimestamp = System . currentTimeMillis ( ) ; // setup the name / path of the final snapshot file String snapshotFilename = String . format ( "%d-%s.snap" , snapshotTimestamp , UUID . randomUUID ( ) . toString ( ) ) ; File snapshotFile = new File ( snapshotsDirectory , snapshotFilename ) ; // move the temporary file to the final location File tempSnapshotFile = snapshotFileWriter . getSnapshotFile ( ) ; Files . move ( tempSnapshotFile . toPath ( ) , snapshotFile . toPath ( ) , StandardCopyOption . ATOMIC_MOVE ) ; // create the metadata entry for this snapshot // note that this filename does _ not _ include the path , only the filename itself final SnapshotMetadata metadata = new SnapshotMetadata ( snapshotFilename , snapshotTimestamp , snapshotFileWriter . getTerm ( ) , snapshotFileWriter . getIndex ( ) ) ; // actually add this snapshot to the db dbi . withHandle ( new HandleCallback < Void > ( ) { @ Override public Void withHandle ( Handle handle ) throws Exception { SnapshotsDAO dao = handle . attach ( SnapshotsDAO . class ) ; dao . addSnapshot ( metadata ) ; return null ; } } ) ; } catch ( IOException e ) { throw new StorageException ( "fail finalize snapshot file req:" + snapshotFileWriter , e ) ; } catch ( CallbackFailedException e ) { throw new StorageException ( "fail store snapshot metadata req:" + snapshotFileWriter , e . getCause ( ) ) ; } catch ( Exception e ) { throw new StorageException ( "fail store snapshot req:" + snapshotFileWriter , e ) ; }
public class PoiUtil { /** * 查找单元格 。 * @ param sheet 表单 * @ param rowIndex 行索引 * @ param searchKey 单元格中包含的关键字 * @ return 单元格 , 没有找到时返回null */ public static Cell searchRowCell ( Sheet sheet , int rowIndex , String searchKey ) { } }
if ( StringUtils . isEmpty ( searchKey ) ) return null ; return searchRow ( sheet . getRow ( rowIndex ) , searchKey ) ;
public class ProjectStats { /** * Transform summary information to HTML . * @ param htmlWriter * the Writer to write the HTML output to */ public void transformSummaryToHTML ( Writer htmlWriter ) throws IOException , TransformerException { } }
ByteArrayOutputStream summaryOut = new ByteArrayOutputStream ( 8096 ) ; reportSummary ( summaryOut ) ; StreamSource in = new StreamSource ( new ByteArrayInputStream ( summaryOut . toByteArray ( ) ) ) ; StreamResult out = new StreamResult ( htmlWriter ) ; InputStream xslInputStream = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( "summary.xsl" ) ; if ( xslInputStream == null ) { throw new IOException ( "Could not load summary stylesheet" ) ; } StreamSource xsl = new StreamSource ( xslInputStream ) ; TransformerFactory tf = TransformerFactory . newInstance ( ) ; Transformer transformer = tf . newTransformer ( xsl ) ; transformer . transform ( in , out ) ; Reader rdr = in . getReader ( ) ; if ( rdr != null ) { rdr . close ( ) ; } htmlWriter . close ( ) ; InputStream is = xsl . getInputStream ( ) ; if ( is != null ) { is . close ( ) ; }
public class OfferService { /** * Adds blocks of incremental block report back to the * receivedAndDeletedBlockList , when handling an exception * @ param failed - list of blocks * @ param failedPendingRequests - how many of the blocks are received acks . */ private void processFailedBlocks ( Block [ ] failed , int failedPendingRequests ) { } }
synchronized ( receivedAndDeletedBlockList ) { // We are adding to the front of a linked list and hence to preserve // order we should add the blocks in the reverse order . for ( int i = failed . length - 1 ; i >= 0 ; i -- ) { receivedAndDeletedBlockList . add ( 0 , failed [ i ] ) ; } pendingReceivedRequests += failedPendingRequests ; }
public class DJGroupRegistrationManager { /** * When a group expression gets its value from a CustomExpression , a variable must be used otherwise it will fail * to work as expected . < br > < br > * Instead of using : GROUP - > CUSTOM _ EXPRESSION < br > * < br > * we use : GROUP - > VARIABLE - > CUSTOM _ EXPRESSION < br > * < br > < br > * See http : / / jasperforge . org / plugins / mantis / view . php ? id = 4226 for more detail * @ param group * @ param jrExpression * @ param customExpression * @ throws JRException */ protected void useVariableForCustomExpression ( JRDesignGroup group , JRDesignExpression jrExpression , CustomExpression customExpression ) throws JRException { } }
// 1 ) Register CustomExpression object as a parameter String expToGroupByName = group . getName ( ) + "_custom_expression" ; registerCustomExpressionParameter ( expToGroupByName , customExpression ) ; // 2 ) Create a variable which is calculated through the custom expression JRDesignVariable gvar = new JRDesignVariable ( ) ; String varName = group . getName ( ) + "_variable_for_group_expression" ; gvar . setName ( varName ) ; gvar . setCalculation ( CalculationEnum . NOTHING ) ; gvar . setValueClassName ( customExpression . getClassName ( ) ) ; String expText = ExpressionUtils . createCustomExpressionInvocationText ( customExpression , expToGroupByName , false ) ; JRDesignExpression gvarExp = new JRDesignExpression ( ) ; gvarExp . setValueClassName ( customExpression . getClassName ( ) ) ; gvarExp . setText ( expText ) ; gvar . setExpression ( gvarExp ) ; getDjd ( ) . addVariable ( gvar ) ; // 3 ) Make the group expression point to the variable jrExpression . setText ( "$V{" + varName + "}" ) ; jrExpression . setValueClassName ( customExpression . getClassName ( ) ) ; log . debug ( "Expression for CustomExpression usgin variable = \"" + varName + "\" which point to: " + expText ) ;
public class AbstractTimecode { /** * Calculates duration between given inPoint and outPoint . * In case outPoint does not have the same Timecode base and / or dropFrame flag * it will convert it to the same Timecode base and dropFrame flag of the inPoint * @ param inPoint * @ param outPoint * @ return duration */ public static TimecodeDuration calculateDuration ( Timecode inPoint , Timecode outPoint ) { } }
if ( ! inPoint . isCompatible ( outPoint ) ) { MutableTimecode mutableTimecode = new MutableTimecode ( outPoint ) ; mutableTimecode . setTimecodeBase ( inPoint . getTimecodeBase ( ) ) ; mutableTimecode . setDropFrame ( inPoint . isDropFrame ( ) ) ; outPoint = new Timecode ( mutableTimecode ) ; } long frameNumber = outPoint . getFrameNumber ( ) - inPoint . getFrameNumber ( ) ; if ( frameNumber < 0 ) { frameNumber += ( 24 * 6 * inPoint . framesPerTenMinutes ) ; } return new TimecodeDuration ( inPoint . getTimecodeBase ( ) , frameNumber , inPoint . isDropFrame ( ) ) ;
public class SarlAgentBuilderImpl { /** * Change the super type . * @ param superType the qualified name of the super type , * or < code > null < / code > if the default type . */ public void setExtends ( String superType ) { } }
if ( ! Strings . isEmpty ( superType ) && ! Agent . class . getName ( ) . equals ( superType ) ) { JvmParameterizedTypeReference superTypeRef = newTypeRef ( this . sarlAgent , superType ) ; JvmTypeReference baseTypeRef = findType ( this . sarlAgent , Agent . class . getCanonicalName ( ) ) ; if ( isSubTypeOf ( this . sarlAgent , superTypeRef , baseTypeRef ) ) { this . sarlAgent . setExtends ( superTypeRef ) ; return ; } } this . sarlAgent . setExtends ( null ) ;
public class CachedXPathAPI { /** * Evaluate XPath string to an XObject . * XPath namespace prefixes are resolved from the namespaceNode . * The implementation of this is a little slow , since it creates * a number of objects each time it is called . This could be optimized * to keep the same objects around , but then thread - safety issues would arise . * @ param contextNode The node to start searching from . * @ param str A valid XPath string . * @ param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces . * @ return An XObject , which can be used to obtain a string , number , nodelist , etc , should never be null . * @ see org . apache . xpath . objects . XObject * @ see org . apache . xpath . objects . XNull * @ see org . apache . xpath . objects . XBoolean * @ see org . apache . xpath . objects . XNumber * @ see org . apache . xpath . objects . XString * @ see org . apache . xpath . objects . XRTreeFrag * @ throws TransformerException */ public XObject eval ( Node contextNode , String str , Node namespaceNode ) throws TransformerException { } }
// Since we don ' t have a XML Parser involved here , install some default support // for things like namespaces , etc . // ( Changed from : XPathContext xpathSupport = new XPathContext ( ) ; // because XPathContext is weak in a number of areas . . . perhaps // XPathContext should be done away with . ) // Create an object to resolve namespace prefixes . // XPath namespaces are resolved from the input context node ' s document element // if it is a root node , or else the current context node ( for lack of a better // resolution space , given the simplicity of this sample code ) . PrefixResolverDefault prefixResolver = new PrefixResolverDefault ( ( namespaceNode . getNodeType ( ) == Node . DOCUMENT_NODE ) ? ( ( Document ) namespaceNode ) . getDocumentElement ( ) : namespaceNode ) ; // Create the XPath object . XPath xpath = new XPath ( str , null , prefixResolver , XPath . SELECT , null ) ; // Execute the XPath , and have it return the result // return xpath . execute ( xpathSupport , contextNode , prefixResolver ) ; int ctxtNode = xpathSupport . getDTMHandleFromNode ( contextNode ) ; return xpath . execute ( xpathSupport , ctxtNode , prefixResolver ) ;
public class CProductUtil { /** * Removes the c product where uuid = & # 63 ; and groupId = & # 63 ; from the database . * @ param uuid the uuid * @ param groupId the group ID * @ return the c product that was removed */ public static CProduct removeByUUID_G ( String uuid , long groupId ) throws com . liferay . commerce . product . exception . NoSuchCProductException { } }
return getPersistence ( ) . removeByUUID_G ( uuid , groupId ) ;
public class SequenceManagerHighLowImpl { /** * Put new sequence object for given sequence name . * @ param sequenceName Name of the sequence . * @ param seq The sequence object to add . */ private void addSequence ( String sequenceName , HighLowSequence seq ) { } }
// lookup the sequence map for calling DB String jcdAlias = getBrokerForClass ( ) . serviceConnectionManager ( ) . getConnectionDescriptor ( ) . getJcdAlias ( ) ; Map mapForDB = ( Map ) sequencesDBMap . get ( jcdAlias ) ; if ( mapForDB == null ) { mapForDB = new HashMap ( ) ; } mapForDB . put ( sequenceName , seq ) ; sequencesDBMap . put ( jcdAlias , mapForDB ) ;
public class ControlRequestFlushImpl { /** * Get summary trace line for this message * Javadoc description supplied by ControlMessage interface . */ public void getTraceSummaryLine ( StringBuilder buff ) { } }
// Get the common fields for control messages super . getTraceSummaryLine ( buff ) ; buff . append ( "requestID=" ) ; buff . append ( getRequestID ( ) ) ; buff . append ( "indoubtDiscard=" ) ; buff . append ( getIndoubtDiscard ( ) ) ;
public class RelationalOperations { /** * Returns true if multipoint _ a intersects multipoint _ b . */ private static boolean multiPointIntersectsMultiPoint_ ( MultiPoint _multipointA , MultiPoint _multipointB , double tolerance , ProgressTracker progress_tracker ) { } }
MultiPoint multipoint_a ; MultiPoint multipoint_b ; if ( _multipointA . getPointCount ( ) > _multipointB . getPointCount ( ) ) { multipoint_a = _multipointB ; multipoint_b = _multipointA ; } else { multipoint_a = _multipointA ; multipoint_b = _multipointB ; } Envelope2D env_a = new Envelope2D ( ) ; Envelope2D env_b = new Envelope2D ( ) ; Envelope2D envInter = new Envelope2D ( ) ; multipoint_a . queryEnvelope2D ( env_a ) ; multipoint_b . queryEnvelope2D ( env_b ) ; env_a . inflate ( tolerance , tolerance ) ; env_b . inflate ( tolerance , tolerance ) ; envInter . setCoords ( env_a ) ; envInter . intersect ( env_b ) ; Point2D ptA = new Point2D ( ) ; Point2D ptB = new Point2D ( ) ; double tolerance_sq = tolerance * tolerance ; QuadTreeImpl quadTreeB = InternalUtils . buildQuadTree ( ( MultiPointImpl ) ( multipoint_b . _getImpl ( ) ) , envInter ) ; QuadTreeImpl . QuadTreeIteratorImpl qtIterB = quadTreeB . getIterator ( ) ; for ( int vertex_a = 0 ; vertex_a < multipoint_a . getPointCount ( ) ; vertex_a ++ ) { multipoint_a . getXY ( vertex_a , ptA ) ; if ( ! envInter . contains ( ptA ) ) continue ; env_a . setCoords ( ptA . x , ptA . y , ptA . x , ptA . y ) ; qtIterB . resetIterator ( env_a , tolerance ) ; for ( int elementHandleB = qtIterB . next ( ) ; elementHandleB != - 1 ; elementHandleB = qtIterB . next ( ) ) { int vertex_b = quadTreeB . getElement ( elementHandleB ) ; multipoint_b . getXY ( vertex_b , ptB ) ; if ( Point2D . sqrDistance ( ptA , ptB ) <= tolerance_sq ) return true ; } } return false ;
public class CmsVfsResourceBundle { /** * Gets the ( possibly already cached ) message data . < p > * @ return the message data */ private Map < Locale , Map < String , String > > getData ( ) { } }
@ SuppressWarnings ( "unchecked" ) Map < Locale , Map < String , String > > result = ( Map < Locale , Map < String , String > > ) m_cache . getCachedObject ( m_cms , getFilePath ( ) ) ; if ( result == null ) { try { result = m_loader . loadData ( m_cms , m_parameters ) ; m_cache . putCachedObject ( m_cms , getFilePath ( ) , result ) ; } catch ( Exception e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } return result ;
public class AbstractUDPClient { /** * { @ inheritDoc } * Runs the thread . * This will send commands to the server , and receive messages from it . */ @ Override public void run ( ) { } }
try { log . info ( "UDP - client started: " + this . hostname + ":" + this . port ) ; isRunning = true ; buf = new ByteBuffer ( 5000 ) ; buf . setString ( getInitMessage ( ) ) ; // A buffer size of 5000 to handle the server _ param message . socket = new DatagramSocket ( ) ; // Timeout of 3mins to ensure that the coach stays connected . socket . setSoTimeout ( 300000 ) ; DatagramPacket p = new DatagramPacket ( buf . getByteArray ( ) , buf . getByteArray ( ) . length , InetAddress . getByName ( hostname ) , port ) ; socket . send ( p ) ; socket . receive ( p ) ; this . host = p . getAddress ( ) ; this . port = p . getPort ( ) ; received ( buf . getString ( ) ) ; // Continue until the program is closed . This is where sserver messages are received . while ( isRunning ) { buf . reset ( ) ; DatagramPacket packet = new DatagramPacket ( buf . getByteArray ( ) , buf . getByteArray ( ) . length ) ; socket . receive ( packet ) ; received ( buf . getString ( ) ) ; } } catch ( Exception ex ) { log . error ( "Stopped running " + getName ( ) + " " + getDescription ( ) + " because: " + ex . toString ( ) ) ; } // Clean up . socket . close ( ) ; try { buf . close ( ) ; } catch ( IOException ex ) { log . error ( "Error cleaning up thread - " + ex . getMessage ( ) ) ; } try { this . finalize ( ) ; } catch ( Throwable ex ) { log . error ( "Error cleaning up thread - " + ex . getMessage ( ) ) ; } log . info ( "UDP - client terminated: " + this . hostname + ":" + this . port ) ;
public class SubString { /** * < 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 > specify the length of a substring to be extracted < / i > < / div > * < br / > */ public JcString subLength ( int len ) { } }
JcNumber sub = new JcNumber ( len , this . getPredecessor ( ) , OPERATOR . Common . COMMA_SEPARATOR ) ; JcString ret = new JcString ( null , sub , new FunctionInstance ( FUNCTION . String . SUBSTRING , 3 ) ) ; QueryRecorder . recordInvocationConditional ( this , "subLength" , ret , QueryRecorder . literal ( len ) ) ; return ret ;
public class JsonProcessingExceptionMapper { /** * { @ inheritDoc } */ @ Override public Response toResponse ( JsonProcessingException exception ) { } }
Throwable throwable = exception ; while ( throwable != null ) { if ( throwable instanceof PersistenceException ) { return exceptionMappers . get ( ) . findMapping ( throwable ) . toResponse ( throwable ) ; } throwable = throwable . getCause ( ) ; } logger . debug ( "Json Processing error" , exception ) ; String message = exception . getOriginalMessage ( ) ; String desc = null ; String source = null ; if ( mode . isDev ( ) ) { desc = IOUtils . getStackTrace ( exception ) ; JsonLocation location = exception . getLocation ( ) ; if ( location != null ) { source = "line: " + location . getLineNr ( ) + ", column: " + location . getColumnNr ( ) ; } else { source = exception . getStackTrace ( ) [ 0 ] . toString ( ) ; } } ErrorMessage errorMessage = ErrorMessage . fromStatus ( Response . Status . BAD_REQUEST . getStatusCode ( ) ) ; errorMessage . setThrowable ( exception ) ; errorMessage . setCode ( Hashing . murmur3_32 ( ) . hashUnencodedChars ( exception . getClass ( ) . getName ( ) ) . toString ( ) ) ; errorMessage . addError ( new Result . Error ( errorMessage . getCode ( ) , message != null ? message : exception . getMessage ( ) , desc , source ) ) ; return Response . status ( errorMessage . getStatus ( ) ) . entity ( errorMessage ) . type ( ExceptionMapperUtils . getResponseType ( ) ) . build ( ) ;
public class BigDecimal { /** * Converts this { @ code BigDecimal } to a { @ code short } , checking * for lost information . If this { @ code BigDecimal } has a * nonzero fractional part or is out of the possible range for a * { @ code short } result then an { @ code ArithmeticException } is * thrown . * @ return this { @ code BigDecimal } converted to a { @ code short } . * @ throws ArithmeticException if { @ code this } has a nonzero * fractional part , or will not fit in a { @ code short } . * @ since 1.5 */ public short shortValueExact ( ) { } }
long num ; num = this . longValueExact ( ) ; // will check decimal part if ( ( short ) num != num ) throw new java . lang . ArithmeticException ( "Overflow" ) ; return ( short ) num ;
public class LossLayer { /** * Compute score after labels and input have been set . * @ param fullNetRegTerm Regularization score term for the entire network * @ param training whether score should be calculated at train or test time ( this affects things like application of * dropout , etc ) * @ return score ( loss function ) */ @ Override public double computeScore ( double fullNetRegTerm , boolean training , LayerWorkspaceMgr workspaceMgr ) { } }
if ( input == null || labels == null ) throw new IllegalStateException ( "Cannot calculate score without input and labels " + layerId ( ) ) ; this . fullNetworkRegularizationScore = fullNetRegTerm ; INDArray preOut = input ; ILossFunction lossFunction = layerConf ( ) . getLossFn ( ) ; // double score = lossFunction . computeScore ( getLabels2d ( ) , preOut , layerConf ( ) . getActivationFunction ( ) , maskArray , false ) ; double score = lossFunction . computeScore ( getLabels2d ( ) , preOut , layerConf ( ) . getActivationFn ( ) , maskArray , false ) ; score /= getInputMiniBatchSize ( ) ; score += fullNetworkRegularizationScore ; this . score = score ; return score ;
public class GenericFudge { /** * Force a non generic map to be one . */ static public < K , V > Map < K , V > map ( Map < ? , ? > map ) { } }
return ( Map < K , V > ) map ;
public class cacheparameter { /** * Use this API to fetch all the cacheparameter resources that are configured on netscaler . */ public static cacheparameter get ( nitro_service service ) throws Exception { } }
cacheparameter obj = new cacheparameter ( ) ; cacheparameter [ ] response = ( cacheparameter [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ;