signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class VcfToEntity { /** * Returns a mapping of VCF info field keys to MOLGENIS attribute names * @ param vcfMeta VCF metadata * @ param entityTypeId entity name ( that could be used to create a MOLGENIS attribute name ) * @ return map of VCF info field keys to MOLGENIS attribute names */ private static Map < String , String > createInfoFieldKeyToAttrNameMap ( VcfMeta vcfMeta , String entityTypeId ) { } }
Map < String , String > infoFieldIdToAttrNameMap = newHashMapWithExpectedSize ( size ( vcfMeta . getInfoMeta ( ) ) ) ; for ( VcfMetaInfo info : vcfMeta . getInfoMeta ( ) ) { // according to the VCF standard it is allowed to have info columns with names that equal // default VCF cols . // rename these info columns in the meta data to prevent collisions . String postFix = "" ; switch ( info . getId ( ) ) { case INTERNAL_ID : case CHROM : case ALT : case POS : case REF : case FILTER : case QUAL : case ID : postFix = '_' + entityTypeId ; break ; default : break ; } String name = info . getId ( ) ; if ( NameValidator . KEYWORDS . contains ( name ) || NameValidator . KEYWORDS . contains ( name . toUpperCase ( ) ) ) { name = name + '_' ; } infoFieldIdToAttrNameMap . put ( info . getId ( ) , name + postFix ) ; } return infoFieldIdToAttrNameMap ;
public class FormPanel { /** * Adds a form entry to the panel * @ param mainLabel * @ param minorLabel * @ param component */ public void addFormEntry ( final JLabel mainLabel , final JLabel minorLabel , final JComponent component ) { } }
add ( mainLabel , new GridBagConstraints ( 0 , _rowCounter , 1 , 1 , 0d , 0d , GridBagConstraints . NORTHWEST , GridBagConstraints . BOTH , INSETS , 0 , 0 ) ) ; if ( minorLabel != null ) { add ( minorLabel , new GridBagConstraints ( 0 , _rowCounter + 1 , 1 , 1 , 0d , 1d , GridBagConstraints . NORTHWEST , GridBagConstraints . BOTH , INSETS , 0 , 0 ) ) ; } add ( component , new GridBagConstraints ( 1 , _rowCounter , 1 , 2 , 1d , 1d , GridBagConstraints . NORTHEAST , GridBagConstraints . BOTH , INSETS , 0 , 0 ) ) ; // each property spans two " rows " _rowCounter = _rowCounter + 2 ;
public class EventProcessor { /** * / * default */ void add ( EventQueue source ) { } }
while ( true ) { EventChannelsTuple entry = source . poll ( ) ; if ( entry == null ) { break ; } entry . event . processedBy ( this ) ; queue . add ( entry ) ; } synchronized ( this ) { if ( ! isExecuting ) { GeneratorRegistry . instance ( ) . add ( this ) ; isExecuting = true ; executorService . execute ( this ) ; } }
public class DecadeProcessor { /** * This function replaces function calls from the resource files with their TIMEX value . * @ author Hans - Peter Pfeiffer * @ param jcas */ public void evaluateFunctions ( JCas jcas ) { } }
// build up a list with all found TIMEX expressions List < Timex3 > linearDates = new ArrayList < Timex3 > ( ) ; FSIterator iterTimex = jcas . getAnnotationIndex ( Timex3 . type ) . iterator ( ) ; // Create List of all Timexes of types " date " and " time " while ( iterTimex . hasNext ( ) ) { Timex3 timex = ( Timex3 ) iterTimex . next ( ) ; if ( timex . getTimexType ( ) . equals ( "DATE" ) ) { linearDates . add ( timex ) ; } } // go through list of Date and Time timexes / / // compile regex pattern for validating commands / arguments Pattern cmd_p = Pattern . compile ( "(\\w\\w\\w\\w)-(\\w\\w)-(\\w\\w)\\s+decadeCalc\\((\\d+)\\)" ) ; Matcher cmd_m ; String year ; String valueNew ; String argument ; for ( int i = 0 ; i < linearDates . size ( ) ; i ++ ) { Timex3 t_i = ( Timex3 ) linearDates . get ( i ) ; String value_i = t_i . getTimexValue ( ) ; cmd_m = cmd_p . matcher ( value_i ) ; valueNew = value_i ; if ( cmd_m . matches ( ) ) { year = cmd_m . group ( 1 ) ; argument = cmd_m . group ( 4 ) ; valueNew = year . substring ( 0 , Math . min ( 2 , year . length ( ) ) ) + argument . substring ( 0 , 1 ) ; } t_i . removeFromIndexes ( ) ; t_i . setTimexValue ( valueNew ) ; t_i . addToIndexes ( ) ; linearDates . set ( i , t_i ) ; }
public class device_profile { /** * < pre > * Use this operation to get device profiles . * < / pre > */ public static device_profile [ ] get ( nitro_service client ) throws Exception { } }
device_profile resource = new device_profile ( ) ; resource . validate ( "get" ) ; return ( device_profile [ ] ) resource . get_resources ( client ) ;
public class ConcatVector { /** * Static function to deserialize a concat vector from an input stream . * @ param stream the stream to read from , assuming protobuf encoding * @ return a new concat vector * @ throws IOException passed through from the stream */ public static ConcatVector readFromStream ( InputStream stream ) throws IOException { } }
return readFromProto ( ConcatVectorProto . ConcatVector . parseDelimitedFrom ( stream ) ) ;
public class ZoneOffsetTransitionRule { /** * Writes the state to the stream . * @ param out the output stream , not null * @ throws IOException if an error occurs */ void writeExternal ( DataOutput out ) throws IOException { } }
final int timeSecs = time . toSecondOfDay ( ) + adjustDays * SECS_PER_DAY ; final int stdOffset = standardOffset . getTotalSeconds ( ) ; final int beforeDiff = offsetBefore . getTotalSeconds ( ) - stdOffset ; final int afterDiff = offsetAfter . getTotalSeconds ( ) - stdOffset ; final int timeByte = ( timeSecs % 3600 == 0 && timeSecs <= SECS_PER_DAY ? ( timeSecs == SECS_PER_DAY ? 24 : time . getHour ( ) ) : 31 ) ; final int stdOffsetByte = ( stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255 ) ; final int beforeByte = ( beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3 ) ; final int afterByte = ( afterDiff == 0 || afterDiff == 1800 || afterDiff == 3600 ? afterDiff / 1800 : 3 ) ; final int dowByte = ( dow == null ? 0 : dow . getValue ( ) ) ; int b = ( month . getValue ( ) << 28 ) + // 4 bits ( ( dom + 32 ) << 22 ) + // 6 bits ( dowByte << 19 ) + // 3 bits ( timeByte << 14 ) + // 5 bits ( timeDefinition . ordinal ( ) << 12 ) + // 2 bits ( stdOffsetByte << 4 ) + // 8 bits ( beforeByte << 2 ) + // 2 bits afterByte ; // 2 bits out . writeInt ( b ) ; if ( timeByte == 31 ) { out . writeInt ( timeSecs ) ; } if ( stdOffsetByte == 255 ) { out . writeInt ( stdOffset ) ; } if ( beforeByte == 3 ) { out . writeInt ( offsetBefore . getTotalSeconds ( ) ) ; } if ( afterByte == 3 ) { out . writeInt ( offsetAfter . getTotalSeconds ( ) ) ; }
public class Imports { /** * Adds the passed { @ code Imports } to the current set and returns them as new instance of { @ code Imports } . * @ param imports * { @ code Imports } to add * @ return new instance of { @ code Imports } */ @ Nonnull public Imports copyAndAdd ( final Imports imports ) { } }
Check . notNull ( imports , "imports" ) ; return copyAndAdd ( imports . asList ( ) ) ;
public class ResultSetMetaData { /** * @ see org . eclipse . datatools . connectivity . oda . IResultSetMetaData # getColumnTypeName ( int ) */ public String getColumnTypeName ( int index ) throws OdaException { } }
int nativeTypeCode = getColumnType ( index ) ; return Driver . getNativeDataTypeName ( nativeTypeCode ) ;
public class EvolvingImages { /** * GEN - LAST : event _ origImagePanelComponentResized */ private void pauseButtonActionPerformed ( java . awt . event . ActionEvent evt ) { } }
// GEN - FIRST : event _ pauseButtonActionPerformed switch ( pauseButton . getText ( ) ) { case "Pause" : _worker . pause ( ) ; pauseButton . setText ( "Resume" ) ; break ; case "Resume" : _worker . resume ( ) ; pauseButton . setText ( "Pause" ) ; break ; default : }
public class NearestNeighborAffinityMatrixBuilder { /** * Compute H ( observed perplexity ) for row i , and the row pij _ i . * @ param dist _ i Distances to neighbors * @ param pij _ row Row pij [ i ] ( output ) * @ param mbeta { @ code - 1 . / ( 2 * sigma * sigma ) } * @ return Observed perplexity */ protected static double computeH ( DoubleArray dist_i , double [ ] pij_row , double mbeta ) { } }
final int len = dist_i . size ( ) ; assert ( pij_row . length == len ) ; double sumP = 0. ; for ( int j = 0 ; j < len ; j ++ ) { sumP += ( pij_row [ j ] = FastMath . exp ( dist_i . get ( j ) * mbeta ) ) ; } if ( ! ( sumP > 0 ) ) { // All pij are zero . Bad news . return Double . NEGATIVE_INFINITY ; } final double s = 1. / sumP ; // Scaling factor double sum = 0. ; // While we could skip pi [ i ] , it should be 0 anyway . for ( int j = 0 ; j < len ; j ++ ) { sum += dist_i . get ( j ) * ( pij_row [ j ] *= s ) ; } return FastMath . log ( sumP ) - mbeta * sum ;
public class Chunks { /** * call directly after construction , todo move to constructor or static factory */ public Chunks withDefault ( int defaultValue ) { } }
this . defaultValue = defaultValue ; if ( defaultValue != 0 ) { for ( int [ ] chunk : chunks ) { Arrays . fill ( chunk , defaultValue ) ; } } return this ;
public class StreamUtil { /** * Reads a null - terminated string of bytes from the specified input stream . * @ param in The < code > InputStream < / code > to read from . * @ return The < code > String < / code > read from the file . * @ throws IOException If an I / O error occurs * @ throws EOFException If the end of the file is reached before a null * byte is read . */ public static String readNullTerminatedString ( InputStream in ) throws IOException , EOFException { } }
return readNullTerminatedString ( ( DataInput ) new DataInputStream ( in ) ) ;
public class GBSIterator { /** * Search to re - establish current iterator position . * < p > This is called when the iterator can find no more entries and is * either known to have hit eof or is just about to confirm that fact . * It sets _ eof true and saves the current index vno in _ current1 . If * the search succeeds it sets _ eof false . < / p > */ private void internalSearchNext ( DeleteStack stack , int v1 , int x1 ) { } }
SearchComparator comp = searchComparator ( SearchComparator . GT ) ; _s = 0 ; _p = null ; _eof = true ; _current1 . setVersion ( v1 ) ; SearchNode sn = searchNode ( ) ; Object q = _index . iteratorFind ( _dstack , comp , _last1 . key ( ) , sn ) ; if ( q != null ) { _current1 . setLocation ( sn . foundNode ( ) , sn . foundIndex ( ) ) ; _current1 . setLocation ( sn . key ( ) , v1 , x1 ) ; _s = NodeStack . VISIT_RIGHT ; _p = sn . foundNode ( ) ; _eof = false ; }
public class SpdySessionHandler { /** * need to synchronize to prevent new streams from being created while updating active streams */ private void updateInitialReceiveWindowSize ( int newInitialWindowSize ) { } }
int deltaWindowSize = newInitialWindowSize - initialReceiveWindowSize ; initialReceiveWindowSize = newInitialWindowSize ; spdySession . updateAllReceiveWindowSizes ( deltaWindowSize ) ;
public class cuComplex { /** * Returns the absolute value of the given complex number . < br / > * < br / > * Original comment : < br / > * < br / > * This implementation guards against intermediate underflow and overflow * by scaling . Otherwise the we ' d lose half the exponent range . There are * various ways of doing guarded computation . For now chose the simplest * and fastest solution , however this may suffer from inaccuracies if sqrt * and division are not IEEE compliant . * @ param x The complex number whose absolute value should be returned * @ return The absolute value of the given complex number */ public static float cuCabs ( cuComplex x ) { } }
float p = cuCreal ( x ) ; float q = cuCimag ( x ) ; float r ; if ( p == 0 ) return q ; if ( q == 0 ) return p ; p = ( float ) Math . sqrt ( p ) ; q = ( float ) Math . sqrt ( q ) ; if ( p < q ) { r = p ; p = q ; q = r ; } r = q / p ; return p * ( float ) Math . sqrt ( 1.0f + r * r ) ;
public class DefaultSchemaOperations { /** * ( non - Javadoc ) * @ see org . springframework . data . solr . core . schema . SchemaOperations # getSchemaName ( ) */ @ Override public String getSchemaName ( ) { } }
return template . execute ( solrClient -> new SchemaRequest . SchemaName ( ) . process ( solrClient , collection ) . getSchemaName ( ) ) ;
public class TangoPeriodic { public void removeTangoPeriodicListener ( ITangoPeriodicListener listener ) throws DevFailed { } }
event_listeners . remove ( ITangoPeriodicListener . class , listener ) ; if ( event_listeners . size ( ) == 0 ) unsubscribe_event ( event_identifier ) ;
public class CalendarText { /** * / * [ deutsch ] * < p > Liefert das lokalisierte Uhrzeitmuster geeignet f & uuml ; r die * Formatierung von Instanzen des Typs { @ code PlainTime } . < / p > * @ param mode display mode * @ param locale language and country setting * @ return localized time pattern * @ see net . time4j . PlainTime * @ since 3.13/4.10 */ public static String patternForTime ( DisplayMode mode , Locale locale ) { } }
return FORMAT_PATTERN_PROVIDER . getTimePattern ( mode , locale ) ;
public class DcerpcPipeHandle { /** * { @ inheritDoc } * @ see jcifs . dcerpc . DcerpcHandle # doSendReceiveFragment ( byte [ ] , int , int , byte [ ] ) */ @ Override protected int doSendReceiveFragment ( byte [ ] buf , int off , int length , byte [ ] inB ) throws IOException { } }
if ( this . handle . isStale ( ) ) { throw new IOException ( "DCERPC pipe is no longer open" ) ; } int have = this . handle . sendrecv ( buf , off , length , inB , getMaxRecv ( ) ) ; int fraglen = Encdec . dec_uint16le ( inB , 8 ) ; if ( fraglen > getMaxRecv ( ) ) { throw new IOException ( "Unexpected fragment length: " + length ) ; } while ( have < fraglen ) { int r = this . handle . recv ( buf , have , length - have ) ; if ( r == 0 ) { throw new IOException ( "Unexpected EOF" ) ; } have += r ; } return have ;
public class AbstractGeneratedPrefsTransform { /** * ( non - Javadoc ) * @ see * com . abubusoft . kripton . processor . sharedprefs . transform . PrefsTransform # * generateWriteProperty ( com . squareup . javapoet . MethodSpec . Builder , * java . lang . String , com . squareup . javapoet . TypeName , java . lang . String , * com . abubusoft . kripton . processor . sharedprefs . model . PrefsProperty ) */ @ Override public void generateWriteProperty ( Builder methodBuilder , String editorName , TypeName beanClass , String beanName , PrefsProperty property ) { } }
Converter < String , String > formatter = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; methodBuilder . beginControlFlow ( "if ($L!=null) " , getter ( beanName , beanClass , property ) ) ; methodBuilder . addStatement ( "String temp=serialize$L($L)" , formatter . convert ( property . getName ( ) ) , getter ( beanName , beanClass , property ) ) ; methodBuilder . addStatement ( "$L.putString($S,temp)" , editorName , property . getPreferenceKey ( ) ) ; methodBuilder . nextControlFlow ( " else " ) ; methodBuilder . addStatement ( "$L.remove($S)" , editorName , property . getPreferenceKey ( ) ) ; methodBuilder . endControlFlow ( ) ;
public class VarRef { /** * 计算所有表达式 , 知道最后一值 , 用于a . b [ xx ] . c = 1 赋值 , 只计算到a . b [ xx ] * @ param ctx * @ return */ public Object evaluateUntilLast ( Context ctx ) { } }
if ( attributes . length == 0 ) { // 不可能发生 , 除非beetl写错了 , 先放在着 throw new RuntimeException ( ) ; } Result ret = this . getValue ( ctx ) ; Object value = ret . value ; if ( value == null ) { BeetlException ex = new BeetlException ( BeetlException . NULL ) ; ex . pushToken ( this . firstToken ) ; throw ex ; } for ( int i = 0 ; i < attributes . length - 1 ; i ++ ) { VarAttribute attr = attributes [ i ] ; if ( value == null ) { BeetlException be = new BeetlException ( BeetlException . NULL , "空指针" ) ; if ( i == 0 ) { be . pushToken ( this . firstToken ) ; } else { be . pushToken ( attributes [ i - 1 ] . token ) ; } throw be ; } try { value = attr . evaluate ( ctx , value ) ; } catch ( BeetlException ex ) { ex . pushToken ( attr . token ) ; throw ex ; } catch ( RuntimeException ex ) { BeetlException be = new BeetlException ( BeetlException . ATTRIBUTE_INVALID , "属性访问出错" , ex ) ; be . pushToken ( attr . token ) ; throw be ; } } return value ;
public class EntityUtilities { /** * Gets a list of Revision ' s from the CSProcessor database for a specific content spec */ public static RevisionList getTopicRevisionsById ( final TopicProvider topicProvider , final Integer csId ) { } }
final List < Revision > results = new ArrayList < Revision > ( ) ; CollectionWrapper < TopicWrapper > topicRevisions = topicProvider . getTopic ( csId ) . getRevisions ( ) ; // Create the unique array from the revisions if ( topicRevisions != null && topicRevisions . getItems ( ) != null ) { final List < TopicWrapper > topicRevs = topicRevisions . getItems ( ) ; for ( final TopicWrapper topicRev : topicRevs ) { Revision revision = new Revision ( ) ; revision . setRevision ( topicRev . getRevision ( ) ) ; revision . setDate ( topicRev . getLastModified ( ) ) ; results . add ( revision ) ; } Collections . sort ( results , new EnversRevisionSort ( ) ) ; return new RevisionList ( csId , "Topic" , results ) ; } else { return null ; }
public class ProgressSupport { /** * Adds the number of bytes to be expected in the response . */ @ Override public void addResponseContentLength ( long contentLength ) { } }
if ( contentLength < 0 ) throw new IllegalArgumentException ( ) ; synchronized ( lock ) { if ( this . responseContentLength == - 1 ) this . responseContentLength = contentLength ; else this . responseContentLength += contentLength ; }
public class FuzzyConditionBuilder { /** * Returns the { @ link FuzzyCondition } represented by this builder . * @ return The { @ link FuzzyCondition } represented by this builder . */ @ Override public FuzzyCondition build ( ) { } }
return new FuzzyCondition ( boost , field , value , maxEdits , prefixLength , maxExpansions , transpositions ) ;
public class GVRCameraRig { /** * Constructs a camera rig with cameras attached . An owner scene object is automatically * created for the camera rig . * Do not try to change the owner object of the camera rig - not supported currently and will * lead to native crashes . */ public static GVRCameraRig makeInstance ( GVRContext gvrContext ) { } }
final GVRCameraRig result = gvrContext . getApplication ( ) . getDelegate ( ) . makeCameraRig ( gvrContext ) ; result . init ( gvrContext ) ; return result ;
public class AbstrCFMLExprTransformer { /** * Transfomiert eine Or ( or ) Operation . Im Gegensatz zu CFMX , werden " | | " Zeichen auch als Or * Operatoren anerkannt . < br / > * EBNF : < br / > * < code > andOp { ( " or " | " | | " ) spaces andOp } ; ( * " | | " Existiert in CFMX nicht * ) < / code > * @ return CFXD Element * @ throws TemplateException */ private Expression orOp ( Data data ) throws TemplateException { } }
Expression expr = andOp ( data ) ; while ( data . srcCode . forwardIfCurrent ( "||" ) || data . srcCode . forwardIfCurrentAndNoWordAfter ( "or" ) ) { comments ( data ) ; expr = data . factory . opBool ( expr , andOp ( data ) , Factory . OP_BOOL_OR ) ; } return expr ;
public class TabbedPaneView { /** * Draw marker . * @ param x the x * @ param y the y */ public void drawMarker ( final ToggleButton dragged , final double x , final double y ) { } }
final int draggedIdx = getBox ( ) . getChildren ( ) . indexOf ( dragged ) ; final int markerIdx = getBox ( ) . getChildren ( ) . indexOf ( this . marker ) ; int idx = 0 ; Node tempHoverNode = null ; final int xx = 0 ; for ( final Node n : getBox ( ) . getChildren ( ) ) { if ( n . getBoundsInParent ( ) . contains ( x , y ) ) { tempHoverNode = n ; break ; } if ( n != this . marker ) { idx ++ ; } } if ( tempHoverNode == this . hoverNode ) { return ; } else { this . hoverNode = tempHoverNode ; } System . out . println ( "marker" + markerIdx + " idx " + idx ) ; if ( markerIdx != idx ) { if ( this . marker != null ) { getBox ( ) . getChildren ( ) . remove ( this . marker ) ; } if ( draggedIdx != idx ) { this . marker = model ( ) . object ( ) . orientation ( ) == TabbedPaneOrientation . bottom || model ( ) . object ( ) . orientation ( ) == TabbedPaneOrientation . top ? new Rectangle ( 10 , getBox ( ) . getHeight ( ) ) : new Rectangle ( getBox ( ) . getWidth ( ) , 4 ) ; this . marker . setFill ( Color . LIGHTGREEN ) ; getBox ( ) . getChildren ( ) . add ( idx , this . marker ) ; } }
public class ByteUtils { /** * reverse a byte array in place WARNING the parameter array is altered and * returned . * @ param data * ori data * @ return reverse data */ public static byte [ ] reverse ( byte [ ] data ) { } }
for ( int i = 0 , j = data . length - 1 ; i < data . length / 2 ; i ++ , j -- ) { data [ i ] ^= data [ j ] ; data [ j ] ^= data [ i ] ; data [ i ] ^= data [ j ] ; } return data ;
public class JSONUtils { /** * Escape a string to be surrounded in double quotes in JSON . * @ param unsafeStr * the unsafe str * @ param buf * the buf */ static void escapeJSONString ( final String unsafeStr , final StringBuilder buf ) { } }
if ( unsafeStr == null ) { return ; } // Fast path boolean needsEscaping = false ; for ( int i = 0 , n = unsafeStr . length ( ) ; i < n ; i ++ ) { final char c = unsafeStr . charAt ( i ) ; if ( c > 0xff || JSON_CHAR_REPLACEMENTS [ c ] != null ) { needsEscaping = true ; break ; } } if ( ! needsEscaping ) { buf . append ( unsafeStr ) ; return ; } // Slow path for ( int i = 0 , n = unsafeStr . length ( ) ; i < n ; i ++ ) { final char c = unsafeStr . charAt ( i ) ; if ( c > 0xff ) { buf . append ( "\\u" ) ; final int nibble3 = ( ( c ) & 0xf000 ) >> 12 ; buf . append ( nibble3 <= 9 ? ( char ) ( '0' + nibble3 ) : ( char ) ( 'A' + nibble3 - 10 ) ) ; final int nibble2 = ( ( c ) & 0xf00 ) >> 8 ; buf . append ( nibble2 <= 9 ? ( char ) ( '0' + nibble2 ) : ( char ) ( 'A' + nibble2 - 10 ) ) ; final int nibble1 = ( ( c ) & 0xf0 ) >> 4 ; buf . append ( nibble1 <= 9 ? ( char ) ( '0' + nibble1 ) : ( char ) ( 'A' + nibble1 - 10 ) ) ; final int nibble0 = ( ( c ) & 0xf ) ; buf . append ( nibble0 <= 9 ? ( char ) ( '0' + nibble0 ) : ( char ) ( 'A' + nibble0 - 10 ) ) ; } else { final String replacement = JSON_CHAR_REPLACEMENTS [ c ] ; if ( replacement == null ) { buf . append ( c ) ; } else { buf . append ( replacement ) ; } } }
public class ServerMonitor { /** * Registers a failed request . */ public synchronized void onRequestFailed ( Throwable reason ) { } }
allRequestsTracker . onRequestFailed ( reason ) ; recentRequestsTracker . onRequestFailed ( reason ) ; meter . mark ( ) ;
public class Search { /** * Get the amount of time elapsed during the < i > current < / i > ( or last ) run , without finding any further improvement * ( in milliseconds ) . The precise return value depends on the status of the search : * < ul > * < li > * If the search is either RUNNING or TERMINATING , but no improvements have yet been made during the current * run , the returned value is equal to the current runtime ; else it reflects the time elapsed since the last * improvement during the current run . * < / li > * < li > * If the search is IDLE or DISPOSED , but has been run before , the time without improvement observed during the * last run , up to the point when this run completed , is returned . Before the first run , the return value is * { @ link JamesConstants # INVALID _ TIME _ SPAN } . * < / li > * < li > * While INITIALIZING the current run , { @ link JamesConstants # INVALID _ TIME _ SPAN } is returned . * < / li > * < / ul > * The return value is always positive , except in those cases when { @ link JamesConstants # INVALID _ TIME _ SPAN } * is returned . * @ return time without finding improvements during the current ( or last ) run , in milliseconds */ public long getTimeWithoutImprovement ( ) { } }
// depends on status : synchronize with status updates synchronized ( statusLock ) { if ( status == SearchStatus . INITIALIZING ) { // initializing return JamesConstants . INVALID_TIME_SPAN ; } else { // idle , running , terminating or disposed : check last improvement time if ( lastImprovementTime == JamesConstants . INVALID_TIMESTAMP ) { // no improvement made during current / last run , or did not yet run : equal to total runtime return getRuntime ( ) ; } else { // running or ran before , and improvement made during current / last run if ( status == SearchStatus . IDLE || status == SearchStatus . DISPOSED ) { // idle or disposed : return last time without improvement of previous run return stopTime - lastImprovementTime ; } else { // running or terminating : return time elapsed since last improvement return System . currentTimeMillis ( ) - lastImprovementTime ; } } } }
public class RegExUtil { /** * < p > Removes each substring of the source String that matches the given regular expression using the DOTALL option . < / p > * This call is a { @ code null } safe equivalent to : * < ul > * < li > { @ code text . replaceAll ( & quot ; ( ? s ) & quot ; + regex , N . EMPTY _ STRING ) } < / li > * < li > { @ code Pattern . compile ( regex , Pattern . DOTALL ) . matcher ( text ) . replaceAll ( N . EMPTY _ STRING ) } < / li > * < / ul > * < p > A { @ code null } reference passed to this method is a no - op . < / p > * < pre > * StringUtils . removePattern ( null , * ) = null * StringUtils . removePattern ( " any " , ( String ) null ) = " any " * StringUtils . removePattern ( " A & lt ; _ _ & gt ; \ n & lt ; _ _ & gt ; B " , " & lt ; . * & gt ; " ) = " AB " * StringUtils . removePattern ( " ABCabc123 " , " [ a - z ] " ) = " ABC123" * < / pre > * @ param text * the source string * @ param regex * the regular expression to which this string is to be matched * @ return The resulting { @ code String } * @ see # replacePattern ( String , String , String ) * @ see String # replaceAll ( String , String ) * @ see Pattern # DOTALL */ public static String removePattern ( final String text , final String regex ) { } }
return replacePattern ( text , regex , N . EMPTY_STRING ) ;
public class XMLRoadUtil { /** * Write the XML description for the given road . * @ param primitive is the road to output . * @ param builder is the tool to create XML nodes . * @ param resources is the tool that permits to gather the resources . * @ return the XML node of the map element . * @ throws IOException in case of error . */ public static Element writeRoadSegment ( RoadSegment primitive , XMLBuilder builder , XMLResources resources ) throws IOException { } }
if ( primitive instanceof RoadPolyline ) { return writeRoadPolyline ( ( RoadPolyline ) primitive , builder , resources ) ; } throw new IOException ( "unsupported type of primitive: " + primitive ) ; // $ NON - NLS - 1 $
public class RecipesMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Recipes recipes , ProtocolMarshaller protocolMarshaller ) { } }
if ( recipes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( recipes . getSetup ( ) , SETUP_BINDING ) ; protocolMarshaller . marshall ( recipes . getConfigure ( ) , CONFIGURE_BINDING ) ; protocolMarshaller . marshall ( recipes . getDeploy ( ) , DEPLOY_BINDING ) ; protocolMarshaller . marshall ( recipes . getUndeploy ( ) , UNDEPLOY_BINDING ) ; protocolMarshaller . marshall ( recipes . getShutdown ( ) , SHUTDOWN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Selection { /** * Analyze . * @ param _ stmtProvider the stmt provider * @ return the selection * @ throws EFapsException on error */ private Selection analyze ( final IStmtProvider _stmtProvider ) throws EFapsException { } }
final Type type = evalMainType ( _stmtProvider . getTypes ( ) ) ; final IStatement < ? > stmt = _stmtProvider . getStmt ( ) ; for ( final ISelect sel : ( ( IPrintStatement < ? > ) stmt ) . getSelection ( ) . getSelects ( ) ) { final Select select = Select . get ( sel . getAlias ( ) ) ; if ( this . selects . isEmpty ( ) ) { this . instSelects . put ( BASEPATH , Select . get ( ) . addElement ( new InstanceElement ( type ) ) ) ; } this . selects . add ( select ) ; Type currentType = type ; for ( final ISelectElement ele : sel . getElements ( ) ) { if ( ele instanceof IAttributeSelectElement ) { final String attrName = ( ( IAttributeSelectElement ) ele ) . getName ( ) ; final Attribute attr = currentType . getAttribute ( attrName ) ; if ( attr == null ) { LOG . error ( "Could not find Attribute '{}' on Type '{}'" , attrName , currentType . getName ( ) ) ; } final AttributeElement element = new AttributeElement ( ) . setAttribute ( attr ) ; select . addElement ( element ) ; } else if ( ele instanceof ILinktoSelectElement ) { final String attrName = ( ( ILinktoSelectElement ) ele ) . getName ( ) ; final Attribute attr = currentType . getAttribute ( attrName ) ; final LinktoElement element = new LinktoElement ( ) . setAttribute ( attr ) ; select . addElement ( element ) ; currentType = attr . getLink ( ) ; addInstSelect ( select , element , attr , currentType ) ; } else if ( ele instanceof ILinkfromSelectElement ) { final String typeName = ( ( ILinkfromSelectElement ) ele ) . getTypeName ( ) ; final String attrName = ( ( ILinkfromSelectElement ) ele ) . getAttribute ( ) ; final Type linkFromType = Type . get ( typeName ) ; final Attribute attr = linkFromType . getAttribute ( attrName ) ; final LinkfromElement element = new LinkfromElement ( ) . setAttribute ( attr ) . setStartType ( currentType ) ; select . addElement ( element ) ; addInstSelect ( select , element , attr , currentType ) ; currentType = linkFromType ; } else if ( ele instanceof IClassSelectElement ) { final String typeName = ( ( IClassSelectElement ) ele ) . getName ( ) ; final Classification classification = Classification . get ( typeName ) ; final ClassElement element = new ClassElement ( ) . setClassification ( classification ) . setType ( currentType ) ; select . addElement ( element ) ; addInstSelect ( select , element , classification , currentType ) ; currentType = classification ; } else if ( ele instanceof IAttributeSetSelectElement ) { final String attrSetName = ( ( IAttributeSetSelectElement ) ele ) . getName ( ) ; final AttributeSet attributeSet = AttributeSet . find ( currentType . getName ( ) , attrSetName ) ; final AttributeSetElement element = new AttributeSetElement ( ) . setAttributeSet ( attributeSet ) . setType ( currentType ) ; select . addElement ( element ) ; addInstSelect ( select , element , attributeSet , currentType ) ; currentType = attributeSet ; } else if ( ele instanceof IBaseSelectElement ) { switch ( ( ( IBaseSelectElement ) ele ) . getElement ( ) ) { case INSTANCE : select . addElement ( new InstanceElement ( currentType ) ) ; break ; case OID : select . addElement ( new OIDElement ( currentType ) ) ; break ; case STATUS : select . addElement ( new StatusElement ( currentType ) ) ; break ; case TYPE : select . addElement ( new TypeElement ( currentType ) ) ; break ; case KEY : select . addElement ( new KeyElement ( ) ) ; break ; case LABEL : select . addElement ( new LabelElement ( ) ) ; break ; case NAME : select . addElement ( new NameElement ( ) ) ; break ; case ID : select . addElement ( new IDElement ( ) ) ; break ; case UUID : select . addElement ( new UUIDElement ( ) ) ; break ; case FIRST : select . addElement ( new FirstElement ( ) ) ; break ; case LAST : select . addElement ( new LastElement ( ) ) ; break ; default : break ; } } else if ( ele instanceof IFormatSelectElement ) { final String pattern = ( ( IFormatSelectElement ) ele ) . getPattern ( ) ; select . addElement ( new FormatElement ( ) . setPattern ( pattern ) ) ; } else if ( ele instanceof IExecSelectElement ) { select . addElement ( new ExecElement ( currentType ) . setEsjp ( ( ( IExecSelectElement ) ele ) . getClassName ( ) ) . setParameters ( ( ( IExecSelectElement ) ele ) . getParameters ( ) ) ) ; } } } return this ;
public class CustomField { /** * Once processed with a position , height , and width , HelloSign will * estimate the number of lines a custom field can contain , along with the * number of characters per line . This method will return the estimated * average number of characters per line this field can hold . * @ return Integer or null if not set */ public Integer getEstimatedCharsPerLine ( ) { } }
if ( ! dataObj . has ( CUSTOM_FIELD_AVG_TEXT_LENGTH ) ) { return null ; } Integer numLines = null ; try { JSONObject obj = dataObj . getJSONObject ( CUSTOM_FIELD_AVG_TEXT_LENGTH ) ; numLines = obj . getInt ( CUSTOM_FIELD_NUM_CHARS_PER_LINE ) ; } catch ( JSONException e ) { } return numLines ;
public class SegmentFactory { /** * TODO createSegment for RemoteBase */ public Segment createSegment ( RemoteBase remoteBase ) throws SQLException , IOException { } }
if ( connection == null && entryDAOUtils == null ) return null ; else { if ( remoteBase != null ) { String accession = remoteBase . getAccession ( ) + ( remoteBase . getVersion ( ) == null ? "" : ( "." + remoteBase . getVersion ( ) . toString ( ) ) ) ; if ( entryDAOUtils == null ) { setEntryDAOUtils ( new EntryDAOUtilsImpl ( connection ) ) ; } byte [ ] subSequence = entryDAOUtils . getSubSequence ( accession , remoteBase . getBeginPosition ( ) , ( remoteBase . getEndPosition ( ) - remoteBase . getBeginPosition ( ) ) + 1 ) ; if ( subSequence == null ) { throw new SQLException ( "Invalid Accession " + accession + " , which does not exist in database" ) ; } if ( remoteBase . getLength ( ) != subSequence . length ) { StringBuilder lcoationString = new StringBuilder ( ) ; LocationToStringCoverter . renderLocation ( lcoationString , remoteBase , false , false ) ; throw new SQLException ( "invalid Remote Base:" + lcoationString . toString ( ) + ", not within the entry \"" + remoteBase . getAccession ( ) + "\" sequence length" ) ; } if ( remoteBase . isComplement ( ) ) { ReverseComplementer reversecomplementer = new ReverseComplementer ( ) ; return new Segment ( remoteBase , reversecomplementer . reverseComplementByte ( subSequence ) ) ; } return new Segment ( remoteBase , subSequence ) ; } } return null ;
public class TagUtils { /** * These are normally NMTOKEN type in attributes * String - - > String [ ] * @ param value * @ return */ public static String [ ] getStringArray ( Object value ) throws ParseException { } }
if ( value == null ) { return null ; } return getTokensArray ( value . toString ( ) ) ;
public class ShortAttribute { /** * ShortAttribute operands */ public IntegerAttribute plus ( com . gs . fw . finder . attribute . ShortAttribute attribute ) { } }
return IntegerNumericType . getInstance ( ) . createCalculatedAttribute ( IntegerNumericType . getInstance ( ) . createAdditionCalculator ( this , ( ShortAttribute ) attribute ) ) ;
public class AtomContainer { /** * { @ inheritDoc } */ @ Override public void removeAllElectronContainers ( ) { } }
removeAllBonds ( ) ; lonePairs = new ILonePair [ growArraySize ] ; singleElectrons = new ISingleElectron [ growArraySize ] ; lonePairCount = 0 ; singleElectronCount = 0 ;
public class GraphicalModel { /** * Recreates an in - memory GraphicalModel from a proto serialization , recursively creating all the ConcatVectorTable ' s * and ConcatVector ' s in memory as well . * @ param proto the proto to read * @ return an in - memory GraphicalModel */ public static GraphicalModel readFromProto ( GraphicalModelProto . GraphicalModel proto ) { } }
if ( proto == null ) return null ; GraphicalModel model = new GraphicalModel ( ) ; model . modelMetaData = readMetaDataFromProto ( proto . getMetaData ( ) ) ; model . variableMetaData = new ArrayList < > ( ) ; for ( int i = 0 ; i < proto . getVariableMetaDataCount ( ) ; i ++ ) { model . variableMetaData . add ( readMetaDataFromProto ( proto . getVariableMetaData ( i ) ) ) ; } for ( int i = 0 ; i < proto . getFactorCount ( ) ; i ++ ) { model . factors . add ( Factor . readFromProto ( proto . getFactor ( i ) ) ) ; } return model ;
public class ApiOvhOrder { /** * Create order * REST : POST / order / dedicated / server / { serviceName } / ip / { duration } * @ param blockSize [ required ] IP block size * @ param organisationId [ required ] Your organisation id to add on block informations * @ param country [ required ] IP localization * @ param type [ required ] The type of IP * @ param serviceName [ required ] The internal name of your dedicated server * @ param duration [ required ] Duration */ public OvhOrder dedicated_server_serviceName_ip_duration_POST ( String serviceName , String duration , OvhIpBlockSizeEnum blockSize , OvhIpCountryEnum country , String organisationId , OvhIpTypeOrderableEnum type ) throws IOException { } }
String qPath = "/order/dedicated/server/{serviceName}/ip/{duration}" ; StringBuilder sb = path ( qPath , serviceName , duration ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "blockSize" , blockSize ) ; addBody ( o , "country" , country ) ; addBody ( o , "organisationId" , organisationId ) ; addBody ( o , "type" , type ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhOrder . class ) ;
public class LCMSDataSubset { /** * Checks if data ranges described by this subset fully contain ranges specified in another set . * According to this definition , for example { @ link # WHOLE _ RUN } contains any other subset , * including itself . */ public boolean contains ( LCMSDataSubset other ) { } }
// compare ms levels Set < Integer > msLvlsThis = getMsLvls ( ) ; Set < Integer > msLvlsThat = other . getMsLvls ( ) ; // if ms levels are null , this definitely matches any other subset // so we need to check msLevelsThis frist ! if ( msLvlsThis != null && msLvlsThat != null ) { if ( ! msLvlsThis . containsAll ( msLvlsThat ) ) { return false ; } } // compare mz ranges List < DoubleRange > mzRangesThis = getMzRanges ( ) ; List < DoubleRange > mzRangesThat = other . getMzRanges ( ) ; if ( mzRangesThis != null && mzRangesThat != null ) { if ( ! mzRangesThis . containsAll ( mzRangesThat ) ) { return false ; } } // compare scan number ranges Integer scanNumLoThis = getScanNumLo ( ) ; Integer scanNumLoThat = other . getScanNumLo ( ) ; if ( scanNumLoThis != null && scanNumLoThat != null ) { if ( scanNumLoThis > scanNumLoThat ) { return false ; } } Integer scanNumHiThis = getScanNumHi ( ) ; Integer scanNumHiThat = other . getScanNumHi ( ) ; if ( scanNumHiThis != null && scanNumHiThat != null ) { if ( scanNumHiThis < scanNumHiThat ) { return false ; } } return true ;
public class AbstractExpression { /** * Constant literals have a place - holder type of NUMERIC . These types * need to be converted to DECIMAL or FLOAT when used in a binary operator , * the choice based on the other operand ' s type * - - DECIMAL goes with DECIMAL , FLOAT goes with anything else . * This gets specialized as a NO - OP for leaf Expressions ( AbstractValueExpression ) */ public void normalizeOperandTypes_recurse ( ) { } }
// Depth first search for NUMERIC children . if ( m_left != null ) { m_left . normalizeOperandTypes_recurse ( ) ; } if ( m_right != null ) { m_right . normalizeOperandTypes_recurse ( ) ; // XXX : There ' s no check here that the Numeric operands are actually constants . // Can a sub - expression of type Numeric arise in any other case ? // Would that case always be amenable to having its valueType / valueSize redefined here ? if ( m_left != null ) { if ( m_left . m_valueType == VoltType . NUMERIC ) { m_left . refineOperandType ( m_right . m_valueType ) ; } if ( m_right . m_valueType == VoltType . NUMERIC ) { m_right . refineOperandType ( m_left . m_valueType ) ; } } } if ( m_args != null ) { for ( AbstractExpression argument : m_args ) { argument . normalizeOperandTypes_recurse ( ) ; } }
public class Function { /** * Extend User Role . * extend the Expiration data , according to Organization rules . * @ param trans * @ param org * @ param urData * @ return */ public Result < Void > extendUserRole ( AuthzTrans trans , UserRoleDAO . Data urData , boolean checkForExist ) { } }
// Check if record still exists if ( checkForExist && q . userRoleDAO . read ( trans , urData ) . notOKorIsEmpty ( ) ) { return Result . err ( Status . ERR_UserRoleNotFound , "User Role does not exist" ) ; } if ( q . roleDAO . read ( trans , urData . ns , urData . rname ) . notOKorIsEmpty ( ) ) { return Result . err ( Status . ERR_RoleNotFound , "Role [%s.%s] does not exist" , urData . ns , urData . rname ) ; } // Special case for " Admin " roles . Issue brought forward with Prod // problem 9/26 urData . expires = trans . org ( ) . expiration ( null , Expiration . UserInRole ) . getTime ( ) ; // get // Full // time // starting // today return q . userRoleDAO . update ( trans , urData ) ;
public class LastGrantedAuthoritiesProperty { /** * Removes the recorded information */ public void invalidate ( ) throws IOException { } }
if ( roles != null ) { roles = null ; timestamp = System . currentTimeMillis ( ) ; user . save ( ) ; }
public class Logger { /** * Log . */ public void info ( String message ) { } }
if ( getLevel ( ) > Level . INFO . ordinal ( ) ) return ; logMessage ( Level . INFO , message , null ) ;
public class CommerceCurrencyPersistenceImpl { /** * Returns the last commerce currency in the ordered set where uuid = & # 63 ; . * @ param uuid the uuid * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce currency * @ throws NoSuchCurrencyException if a matching commerce currency could not be found */ @ Override public CommerceCurrency findByUuid_Last ( String uuid , OrderByComparator < CommerceCurrency > orderByComparator ) throws NoSuchCurrencyException { } }
CommerceCurrency commerceCurrency = fetchByUuid_Last ( uuid , orderByComparator ) ; if ( commerceCurrency != null ) { return commerceCurrency ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "uuid=" ) ; msg . append ( uuid ) ; msg . append ( "}" ) ; throw new NoSuchCurrencyException ( msg . toString ( ) ) ;
public class HadoopServer { /** * Overwrite this location with settings available in the given XML file . * The existing configuration is preserved if the XML file is invalid . * @ param file the file path of the XML file * @ return validity of the XML file * @ throws ParserConfigurationException * @ throws IOException * @ throws SAXException */ public boolean loadFromXML ( File file ) throws ParserConfigurationException , SAXException , IOException { } }
Configuration newConf = new Configuration ( this . conf ) ; DocumentBuilder builder = DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) ; Document document = builder . parse ( file ) ; Element root = document . getDocumentElement ( ) ; if ( ! "configuration" . equals ( root . getTagName ( ) ) ) return false ; NodeList props = root . getChildNodes ( ) ; for ( int i = 0 ; i < props . getLength ( ) ; i ++ ) { Node propNode = props . item ( i ) ; if ( ! ( propNode instanceof Element ) ) continue ; Element prop = ( Element ) propNode ; if ( ! "property" . equals ( prop . getTagName ( ) ) ) return false ; NodeList fields = prop . getChildNodes ( ) ; String attr = null ; String value = null ; for ( int j = 0 ; j < fields . getLength ( ) ; j ++ ) { Node fieldNode = fields . item ( j ) ; if ( ! ( fieldNode instanceof Element ) ) continue ; Element field = ( Element ) fieldNode ; if ( "name" . equals ( field . getTagName ( ) ) ) attr = ( ( Text ) field . getFirstChild ( ) ) . getData ( ) ; if ( "value" . equals ( field . getTagName ( ) ) && field . hasChildNodes ( ) ) value = ( ( Text ) field . getFirstChild ( ) ) . getData ( ) ; } if ( attr != null && value != null ) newConf . set ( attr , value ) ; } this . conf = newConf ; return true ;
public class CmsPreviewService { /** * Tries to read a resource either from the current site or from the root site . < p > * @ param cms the CMS context to use * @ param name the resource path * @ return the resource which was read * @ throws CmsException if something goes wrong */ private CmsResource readResourceFromCurrentOrRootSite ( CmsObject cms , String name ) throws CmsException { } }
CmsResource resource = null ; try { resource = cms . readResource ( name , CmsResourceFilter . IGNORE_EXPIRATION ) ; } catch ( CmsVfsResourceNotFoundException e ) { String originalSiteRoot = cms . getRequestContext ( ) . getSiteRoot ( ) ; try { cms . getRequestContext ( ) . setSiteRoot ( "" ) ; resource = cms . readResource ( name , CmsResourceFilter . IGNORE_EXPIRATION ) ; } finally { cms . getRequestContext ( ) . setSiteRoot ( originalSiteRoot ) ; } } return resource ;
public class UnsupportedLanguagePairException { /** * The language code for the language of the input text . * @ param sourceLanguageCode * The language code for the language of the input text . */ @ com . fasterxml . jackson . annotation . JsonProperty ( "SourceLanguageCode" ) public void setSourceLanguageCode ( String sourceLanguageCode ) { } }
this . sourceLanguageCode = sourceLanguageCode ;
public class Heap { /** * Combined operation that removes the top element , and inserts a new element * instead . * @ param e New element to insert * @ return Previous top element of the heap */ @ SuppressWarnings ( "unchecked" ) public E replaceTopElement ( E e ) { } }
E oldroot = ( E ) queue [ 0 ] ; heapifyDown ( 0 , e ) ; heapModified ( ) ; return oldroot ;
public class StreamSegmentStorageReader { /** * Reads a range of bytes from a Segment in Storage . * @ param segmentInfo A SegmentProperties describing the Segment to read . * @ param startOffset The first offset within the Segment to read from . * @ param maxReadLength The maximum number of bytes to read . * @ param readBlockSize The maximum number of bytes to read at once ( the returned StreamSegmentReadResult will be * broken down into Entries smaller than or equal to this size ) . * @ param storage A ReadOnlyStorage to execute the reads against . * @ return A StreamSegmentReadResult that can be used to process the data . This will be made up of ReadResultEntries * of the following types : Storage , Truncated or EndOfSegment . */ public static StreamSegmentReadResult read ( SegmentProperties segmentInfo , long startOffset , int maxReadLength , int readBlockSize , ReadOnlyStorage storage ) { } }
Exceptions . checkArgument ( startOffset >= 0 , "startOffset" , "startOffset must be a non-negative number." ) ; Exceptions . checkArgument ( maxReadLength >= 0 , "maxReadLength" , "maxReadLength must be a non-negative number." ) ; Preconditions . checkNotNull ( segmentInfo , "segmentInfo" ) ; Preconditions . checkNotNull ( storage , "storage" ) ; String traceId = String . format ( "Read[%s]" , segmentInfo . getName ( ) ) ; return new StreamSegmentReadResult ( startOffset , maxReadLength , new SegmentReader ( segmentInfo , null , readBlockSize , storage ) , traceId ) ;
public class PyCodeBuilder { /** * Provide the output object as a string . Since we store all data in the output variables as a * list for concatenation performance , this step does the joining to convert the output into a * String . * @ return A PyExpr object of the output joined into a String . */ PyStringExpr getOutputAsString ( ) { } }
Preconditions . checkState ( getOutputVarName ( ) != null ) ; initOutputVarIfNecessary ( ) ; return new PyListExpr ( getOutputVarName ( ) , Integer . MAX_VALUE ) . toPyString ( ) ;
public class JCGLTextureFormats { /** * Check that the texture format is a depth - renderable format . * @ param t The texture format * @ throws JCGLExceptionFormatError If the texture is not of the correct * format */ public static void checkDepthRenderableTexture2D ( final JCGLTextureFormat t ) throws JCGLExceptionFormatError { } }
if ( ! isDepthRenderable ( t ) ) { final String m = String . format ( "Format %s is not depth-renderable for 2D textures" , t ) ; assert m != null ; throw new JCGLExceptionFormatError ( m ) ; }
public class AtomicCounter { /** * Add an increment to the counter with ordered store semantics . * @ param increment to be added with ordered store semantics . * @ return the previous value of the counter */ public long getAndAddOrdered ( final long increment ) { } }
final long currentValue = UnsafeAccess . UNSAFE . getLong ( byteArray , addressOffset ) ; UnsafeAccess . UNSAFE . putOrderedLong ( byteArray , addressOffset , currentValue + increment ) ; return currentValue ;
public class TreeBuilder { /** * Routes the parsed value to the proper processing method for altering the * display name depending on the current rule . This can route to the regex * handler or the split processor . Or if neither splits or regex are specified * for the rule , the parsed value is set as the branch name . * @ param parsed _ value The value parsed from the calling parser method * @ throws IllegalStateException if a valid processor couldn ' t be found . This * should never happen but you never know . */ private void processParsedValue ( final String parsed_value ) { } }
if ( rule . getCompiledRegex ( ) == null && ( rule . getSeparator ( ) == null || rule . getSeparator ( ) . isEmpty ( ) ) ) { // we don ' t have a regex and we don ' t need to separate , so just use the // name of the timseries setCurrentName ( parsed_value , parsed_value ) ; } else if ( rule . getCompiledRegex ( ) != null ) { // we have a regex rule , so deal with it processRegexRule ( parsed_value ) ; } else if ( rule . getSeparator ( ) != null && ! rule . getSeparator ( ) . isEmpty ( ) ) { // we have a split rule , so deal with it processSplit ( parsed_value ) ; } else { throw new IllegalStateException ( "Unable to find a processor for rule: " + rule ) ; }
public class DownloadRequestQueue { /** * Cancels all the pending & running requests and releases all the dispatchers . */ void release ( ) { } }
if ( mCurrentRequests != null ) { synchronized ( mCurrentRequests ) { mCurrentRequests . clear ( ) ; mCurrentRequests = null ; } } if ( mDownloadQueue != null ) { mDownloadQueue = null ; } if ( mDownloadDispatchers != null ) { stop ( ) ; for ( int i = 0 ; i < mDownloadDispatchers . length ; i ++ ) { mDownloadDispatchers [ i ] = null ; } mDownloadDispatchers = null ; }
public class IPDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setIOCAdat ( byte [ ] newIOCAdat ) { } }
byte [ ] oldIOCAdat = iocAdat ; iocAdat = newIOCAdat ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . IPD__IOC_ADAT , oldIOCAdat , iocAdat ) ) ;
public class BasePretrainNetwork { /** * Corrupts the given input by doing a binomial sampling * given the corruption level * @ param x the input to corrupt * @ param corruptionLevel the corruption value * @ return the binomial sampled corrupted input */ public INDArray getCorruptedInput ( INDArray x , double corruptionLevel ) { } }
INDArray corrupted = Nd4j . getDistributions ( ) . createBinomial ( 1 , 1 - corruptionLevel ) . sample ( x . ulike ( ) ) ; corrupted . muli ( x . castTo ( corrupted . dataType ( ) ) ) ; return corrupted ;
public class GVRViewSceneObject { /** * Set the default size of the texture buffers . You can call this to reduce the buffer size * of views with anti - aliasing issue . * The max value to the buffer size should be the Math . max ( width , height ) of attached view . * @ param size buffer size . Value > 0 and < = Math . max ( width , height ) . */ public void setTextureBufferSize ( final int size ) { } }
mRootViewGroup . post ( new Runnable ( ) { @ Override public void run ( ) { mRootViewGroup . setTextureBufferSize ( size ) ; } } ) ;
public class JKObjectUtil { public static String fixPropertyName ( String name ) { } }
// captialize every char after the underscore , and remove underscores final char [ ] charArray = name . toCharArray ( ) ; for ( int i = 0 ; i < charArray . length ; i ++ ) { if ( charArray [ i ] == '_' ) { charArray [ i + 1 ] = Character . toUpperCase ( charArray [ i + 1 ] ) ; } } name = new String ( charArray ) . replaceAll ( "_" , "" ) ; return name ;
public class VectorApproximation { /** * objekte */ public static int byteOnDisk ( int numberOfDimensions , int numberOfPartitions ) { } }
// ( partition * dimension + id ) alles in Bit 32bit für 4 byte id return ( int ) ( Math . ceil ( numberOfDimensions * ( ( FastMath . log ( numberOfPartitions ) / FastMath . log ( 2 ) ) ) + 32 ) / ByteArrayUtil . SIZE_DOUBLE ) ;
public class JavaGeneratingProcessor { /** * Generates a source file from the specified { @ link io . sundr . codegen . model . TypeDef } . * @ param model The model of the class to generate . * @ param fileObject Where to save the generated class . * @ param resourceName The template to use . * @ throws IOException If it fails to create the source file . */ public void generateFromResources ( TypeDef model , JavaFileObject fileObject , String resourceName ) throws IOException { } }
if ( classExists ( model ) ) { System . err . println ( "Skipping: " + model . getFullyQualifiedName ( ) + ". Class already exists." ) ; return ; } System . err . println ( "Generating: " + model . getFullyQualifiedName ( ) ) ; new CodeGeneratorBuilder < TypeDef > ( ) . withContext ( context ) . withModel ( model ) . withWriter ( fileObject . openWriter ( ) ) . withTemplateResource ( resourceName ) . build ( ) . generate ( ) ;
public class RecoveryHelper { /** * Delete all persisted files older than the number of hours set by { @ link # PERSIST _ RETENTION _ KEY } . * @ throws IOException */ public void purgeOldPersistedFile ( ) throws IOException { } }
if ( ! this . persistDir . isPresent ( ) || ! this . fs . exists ( this . persistDir . get ( ) ) ) { log . info ( "No persist directory to clean." ) ; return ; } long retentionMillis = TimeUnit . HOURS . toMillis ( this . retentionHours ) ; long now = System . currentTimeMillis ( ) ; for ( FileStatus fileStatus : this . fs . listStatus ( this . persistDir . get ( ) ) ) { if ( now - fileStatus . getModificationTime ( ) > retentionMillis ) { if ( ! this . fs . delete ( fileStatus . getPath ( ) , true ) ) { log . warn ( "Failed to delete path " + fileStatus . getPath ( ) ) ; } } }
public class KerasLayer { /** * Register a custom layer * @ param layerName name of custom layer class * @ param configClass class of custom layer */ public static void registerCustomLayer ( String layerName , Class < ? extends KerasLayer > configClass ) { } }
customLayers . put ( layerName , configClass ) ;
public class HttpDownUtil { /** * 关闭tcp连接和文件描述符 */ public static void safeClose ( Channel channel , Closeable ... fileChannels ) throws IOException { } }
if ( channel != null && channel . isOpen ( ) ) { // 关闭旧的下载连接 channel . close ( ) ; } if ( fileChannels != null && fileChannels . length > 0 ) { for ( Closeable closeable : fileChannels ) { if ( closeable != null ) { // 关闭旧的下载文件连接 closeable . close ( ) ; } } }
public class KinesisStreamsInputUpdateMarshaller { /** * Marshall the given parameter object . */ public void marshall ( KinesisStreamsInputUpdate kinesisStreamsInputUpdate , ProtocolMarshaller protocolMarshaller ) { } }
if ( kinesisStreamsInputUpdate == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( kinesisStreamsInputUpdate . getResourceARNUpdate ( ) , RESOURCEARNUPDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class CPDefinitionUtil { /** * Returns the first cp definition in the ordered set where groupId = & # 63 ; and status & ne ; & # 63 ; . * @ param groupId the group ID * @ param status the status * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching cp definition , or < code > null < / code > if a matching cp definition could not be found */ public static CPDefinition fetchByG_NotS_First ( long groupId , int status , OrderByComparator < CPDefinition > orderByComparator ) { } }
return getPersistence ( ) . fetchByG_NotS_First ( groupId , status , orderByComparator ) ;
public class LToDblFunctionBuilder { /** * One of ways of creating builder . This might be the only way ( considering all _ functional _ builders ) that might be utilize to specify generic params only once . */ @ Nonnull public static < T > LToDblFunctionBuilder < T > toDblFunction ( Consumer < LToDblFunction < T > > consumer ) { } }
return new LToDblFunctionBuilder ( consumer ) ;
public class CommerceWishListPersistenceImpl { /** * Returns the commerce wish list 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 commerce wish list , or < code > null < / code > if a matching commerce wish list could not be found */ @ Override public CommerceWishList fetchByUUID_G ( String uuid , long groupId ) { } }
return fetchByUUID_G ( uuid , groupId , true ) ;
public class ServiceQuery { /** * Returns the total number of inner landscape points in the criterion bid landscape page . If the * page has a null { @ code entries } array , returns { @ code 0 } . */ private int getTotalLandscapePointsInPage ( CriterionBidLandscapePage page ) { } }
if ( page . getEntries ( ) == null ) { return 0 ; } int totalLandscapePointsInPage = 0 ; for ( CriterionBidLandscape criterionBidLandscape : page . getEntries ( ) ) { totalLandscapePointsInPage += criterionBidLandscape . getLandscapePoints ( ) . length ; } return totalLandscapePointsInPage ;
public class ScpUploader { /** * Utils method */ protected ScpController getScpController ( ) { } }
String scpOptions = ScpContext . scpOptions ( config ) ; String scpConnection = ScpContext . scpConnection ( config ) ; String sshOptions = ScpContext . sshOptions ( config ) ; String sshConnection = ScpContext . sshConnection ( config ) ; if ( scpOptions == null ) { throw new RuntimeException ( "Missing " + ScpContext . HERON_UPLOADER_SCP_OPTIONS + " config value" ) ; } if ( scpConnection == null ) { throw new RuntimeException ( "Missing " + ScpContext . HERON_UPLOADER_SCP_CONNECTION + " config value" ) ; } if ( sshOptions == null ) { throw new RuntimeException ( "Missing " + ScpContext . HERON_UPLOADER_SSH_OPTIONS + " config value" ) ; } if ( sshConnection == null ) { throw new RuntimeException ( "Missing " + ScpContext . HERON_UPLOADER_SSH_CONNECTION + " config value" ) ; } return new ScpController ( scpOptions , scpConnection , sshOptions , sshConnection , Context . verbose ( config ) ) ;
public class DBaseFileReader { /** * Move the reading head by the specified record count amount . * < p > If the count of records to skip puts the reading head after * the last record , the exception { @ link EOFException } is thrown . * @ param skipAmount is the count of records to skip . * @ throws IOException in case of error . */ public void skip ( int skipAmount ) throws IOException { } }
if ( this . recordCount == - 1 ) { throw new MustCallReadHeaderFunctionException ( ) ; } if ( ( this . readingPosition + skipAmount ) >= this . recordCount ) { throw new EOFException ( ) ; } if ( skipAmount > 0 ) { this . readingPosition += skipAmount ; // this . stream . reset ( ) ; // this . stream . skipBytes ( this . recordSize * this . readingPosition ) ; final long skippedAmount = this . stream . skipBytes ( this . recordSize * skipAmount ) ; // use skipBytes because it force to skip the specified amount , instead of skip ( ) assert skippedAmount == this . recordSize * skipAmount ; }
public class UKMeans { /** * Get expected distance between a Vector and an uncertain object * @ param rep A vector , e . g . a cluster representative * @ param uo A discrete uncertain object * @ return The distance */ protected double getExpectedRepDistance ( NumberVector rep , DiscreteUncertainObject uo ) { } }
SquaredEuclideanDistanceFunction euclidean = SquaredEuclideanDistanceFunction . STATIC ; int counter = 0 ; double sum = 0.0 ; for ( int i = 0 ; i < uo . getNumberSamples ( ) ; i ++ ) { sum += euclidean . distance ( rep , uo . getSample ( i ) ) ; counter ++ ; } return sum / counter ;
public class SchemaDiff { /** * This will perform a difference on the two schemas . The reporter callback * interface will be called when differences are encountered . * @ param diffSet the two schemas to compare for difference * @ param reporter the place to report difference events to * @ return the number of API breaking changes */ @ SuppressWarnings ( "unchecked" ) public int diffSchema ( DiffSet diffSet , DifferenceReporter reporter ) { } }
CountingReporter countingReporter = new CountingReporter ( reporter ) ; diffSchemaImpl ( diffSet , countingReporter ) ; return countingReporter . breakingCount ;
public class NodeLbStatus { /** * Update the load balancing status . * @ return */ synchronized boolean update ( ) { } }
int elected = this . elected ; int oldelected = this . oldelected ; int lbfactor = this . lbfactor ; if ( lbfactor > 0 ) { this . lbstatus = ( ( elected - oldelected ) * 1000 ) / lbfactor ; } this . oldelected = elected ; return elected != oldelected ; // ping if they are equal
public class SchedulerImpl { /** * Request for graceful stop then blocks until process is stopped . * Returns immediately if the process is disabled in configuration . */ private void stopProcess ( ProcessId processId ) { } }
SQProcess process = processesById . get ( processId ) ; if ( process != null ) { process . stop ( 1 , TimeUnit . MINUTES ) ; }
public class Configuration { /** * Read Mangopay version from mangopay properties * @ return String Mangopay Version */ private String readMangopayVersion ( ) { } }
try { Properties prop = new Properties ( ) ; InputStream input = getClass ( ) . getResourceAsStream ( "mangopay.properties" ) ; prop . load ( input ) ; return prop . getProperty ( "version" ) ; } catch ( IOException ex ) { Logger . getLogger ( Configuration . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } return "unknown" ;
public class Op { /** * Returns a valid name for variables * @ param name * @ return an name whose characters are in ` [ a - zA - Z _ 0-9 . ] ` */ public static String validName ( String name ) { } }
if ( name == null || name . trim ( ) . isEmpty ( ) ) { return "unnamed" ; } StringBuilder result = new StringBuilder ( ) ; for ( char c : name . toCharArray ( ) ) { if ( c == '_' || c == '.' || Character . isLetterOrDigit ( c ) ) { result . append ( c ) ; } } return result . toString ( ) ;
public class Mopac7Writer { /** * { @ inheritDoc } */ @ Override public synchronized void write ( IChemObject arg0 ) throws CDKException { } }
customizeJob ( ) ; if ( arg0 instanceof IAtomContainer ) try { IAtomContainer container = ( IAtomContainer ) arg0 ; writer . write ( mopacCommands . getSetting ( ) ) ; int formalCharge = AtomContainerManipulator . getTotalFormalCharge ( container ) ; if ( formalCharge != 0 ) writer . write ( " CHARGE=" + formalCharge ) ; writer . write ( '\n' ) ; if ( container . getProperty ( "Names" ) != null ) writer . write ( container . getProperty ( "Names" ) . toString ( ) ) ; writer . write ( '\n' ) ; writer . write ( getTitle ( ) ) ; writer . write ( '\n' ) ; for ( int i = 0 ; i < container . getAtomCount ( ) ; i ++ ) { IAtom atom = container . getAtom ( i ) ; if ( atom . getPoint3d ( ) != null ) { Point3d point = atom . getPoint3d ( ) ; writeAtom ( atom , point . x , point . y , point . z , optimize . isSet ( ) ? 1 : 0 ) ; } else if ( atom . getPoint2d ( ) != null ) { Point2d point = atom . getPoint2d ( ) ; writeAtom ( atom , point . x , point . y , 0 , optimize . isSet ( ) ? 1 : 0 ) ; } else writeAtom ( atom , 0 , 0 , 0 , 1 ) ; } writer . write ( "0" ) ; writer . write ( '\n' ) ; } catch ( IOException ioException ) { logger . error ( ioException ) ; throw new CDKException ( ioException . getMessage ( ) , ioException ) ; } else throw new CDKException ( "Unsupported object!\t" + arg0 . getClass ( ) . getName ( ) ) ;
public class CPRuleUserSegmentRelLocalServiceBaseImpl { /** * Adds the cp rule user segment rel to the database . Also notifies the appropriate model listeners . * @ param cpRuleUserSegmentRel the cp rule user segment rel * @ return the cp rule user segment rel that was added */ @ Indexable ( type = IndexableType . REINDEX ) @ Override public CPRuleUserSegmentRel addCPRuleUserSegmentRel ( CPRuleUserSegmentRel cpRuleUserSegmentRel ) { } }
cpRuleUserSegmentRel . setNew ( true ) ; return cpRuleUserSegmentRelPersistence . update ( cpRuleUserSegmentRel ) ;
public class JJDoc { /** * Assembles the command line arguments for the invocation of JJDoc according * to the configuration . * @ return A string array that represents the arguments to use for JJDoc . */ private String [ ] _generateArguments ( ) { } }
final List < String > argsList = new ArrayList < > ( ) ; if ( StringUtils . isNotEmpty ( this . grammarEncoding ) ) { argsList . add ( "-GRAMMAR_ENCODING=" + this . grammarEncoding ) ; } if ( StringUtils . isNotEmpty ( this . outputEncoding ) ) { argsList . add ( "-OUTPUT_ENCODING=" + this . outputEncoding ) ; } if ( this . text != null ) { argsList . add ( "-TEXT=" + this . text ) ; } if ( this . bnf != null ) { argsList . add ( "-BNF=" + this . bnf ) ; } if ( this . oneTable != null ) { argsList . add ( "-ONE_TABLE=" + this . oneTable ) ; } if ( this . outputFile != null ) { argsList . add ( "-OUTPUT_FILE=" + this . outputFile . getAbsolutePath ( ) ) ; } if ( StringUtils . isNotEmpty ( this . cssHref ) ) { argsList . add ( "-CSS=" + this . cssHref ) ; } if ( this . inputFile != null ) { argsList . add ( this . inputFile . getAbsolutePath ( ) ) ; } return argsList . toArray ( new String [ argsList . size ( ) ] ) ;
public class AjaxScreenSession { /** * GetScreen Method . */ public BaseScreen getScreen ( Map < String , Object > properties ) { } }
if ( m_topScreen == null ) m_topScreen = ( ScreenModel ) this . createTopScreen ( this . getTask ( ) , null ) ; BaseScreen screen = null ; if ( m_topScreen . getSFieldCount ( ) > 0 ) screen = ( BaseScreen ) m_topScreen . getSField ( 0 ) ; this . setProperties ( properties ) ; BaseScreen newScreen = ( BaseScreen ) m_topScreen . getScreen ( screen , this ) ; return newScreen ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TemporalCSRefType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link TemporalCSRefType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "temporalCSRef" ) public JAXBElement < TemporalCSRefType > createTemporalCSRef ( TemporalCSRefType value ) { } }
return new JAXBElement < TemporalCSRefType > ( _TemporalCSRef_QNAME , TemporalCSRefType . class , null , value ) ;
public class MapEntry { /** * Sets our entry ' s value and writes through to the map . The * value to return is somewhat arbitrary here . Since we do not * necessarily track asynchronous changes , the most recent * " previous " value could be different from what we return ( or * could even have been removed , in which case the put will * re - establish ) . We do not and cannot guarantee more . */ public V setValue ( V value ) { } }
if ( value == null ) throw new NullPointerException ( ) ; V v = val ; val = value ; map . put ( key , value ) ; return v ;
public class AbstractProcessExecutor { /** * This function executes the given command and returns the process output . * @ param configurationHolder * The configuration holder used when invoking the process * @ param command * The command to execute * @ return The process output * @ throws IOException * Any IO exception * @ throws InterruptedException * If thread interrupted during waitFor for the process */ public ProcessOutput executeProcess ( ConfigurationHolder configurationHolder , String command ) throws IOException , InterruptedException { } }
// validate command provided if ( ( command == null ) || ( command . length ( ) == 0 ) ) { throw new FaxException ( "Command not provided." ) ; } // trim command and validate String updatedCommand = command . trim ( ) ; if ( updatedCommand . length ( ) == 0 ) { throw new FaxException ( "Command not provided." ) ; } // validate configuration holder provided if ( configurationHolder == null ) { throw new FaxException ( "Configuration holder not provided." ) ; } this . LOGGER . logDebug ( new Object [ ] { "Invoking command: " , updatedCommand } , null ) ; // execute process ProcessOutput processOutput = this . executeProcessImpl ( configurationHolder , updatedCommand ) ; int exitCode = processOutput . getExitCode ( ) ; String outputText = processOutput . getOutputText ( ) ; String errorText = processOutput . getErrorText ( ) ; this . LOGGER . logDebug ( new Object [ ] { "Invoked command: " , updatedCommand , " Exit Code: " , String . valueOf ( exitCode ) , Logger . SYSTEM_EOL , "Output Text:" , Logger . SYSTEM_EOL , outputText , Logger . SYSTEM_EOL , "Error Text:" , Logger . SYSTEM_EOL , errorText } , null ) ; return processOutput ;
public class ScrollableViewHelper { /** * Returns the current scroll position of the scrollable view . If this method returns zero or * less , it means at the scrollable view is in a position such as the panel should handle * scrolling . If the method returns anything above zero , then the panel will let the scrollable * view handle the scrolling * @ param scrollableView the scrollable view * @ param isSlidingUp whether or not the panel is sliding up or down * @ return the scroll position */ public int getScrollableViewScrollPosition ( View scrollableView , boolean isSlidingUp ) { } }
if ( scrollableView == null ) return 0 ; if ( scrollableView instanceof ScrollView ) { if ( isSlidingUp ) { return scrollableView . getScrollY ( ) ; } else { ScrollView sv = ( ( ScrollView ) scrollableView ) ; View child = sv . getChildAt ( 0 ) ; return ( child . getBottom ( ) - ( sv . getHeight ( ) + sv . getScrollY ( ) ) ) ; } } else if ( scrollableView instanceof ListView && ( ( ListView ) scrollableView ) . getChildCount ( ) > 0 ) { ListView lv = ( ( ListView ) scrollableView ) ; if ( lv . getAdapter ( ) == null ) return 0 ; if ( isSlidingUp ) { View firstChild = lv . getChildAt ( 0 ) ; // Approximate the scroll position based on the top child and the first visible item return lv . getFirstVisiblePosition ( ) * firstChild . getHeight ( ) - firstChild . getTop ( ) ; } else { View lastChild = lv . getChildAt ( lv . getChildCount ( ) - 1 ) ; // Approximate the scroll position based on the bottom child and the last visible item return ( lv . getAdapter ( ) . getCount ( ) - lv . getLastVisiblePosition ( ) - 1 ) * lastChild . getHeight ( ) + lastChild . getBottom ( ) - lv . getBottom ( ) ; } } else if ( scrollableView instanceof RecyclerView && ( ( RecyclerView ) scrollableView ) . getChildCount ( ) > 0 ) { RecyclerView rv = ( ( RecyclerView ) scrollableView ) ; RecyclerView . LayoutManager lm = rv . getLayoutManager ( ) ; if ( rv . getAdapter ( ) == null ) return 0 ; if ( isSlidingUp ) { View firstChild = rv . getChildAt ( 0 ) ; // Approximate the scroll position based on the top child and the first visible item return rv . getChildLayoutPosition ( firstChild ) * lm . getDecoratedMeasuredHeight ( firstChild ) - lm . getDecoratedTop ( firstChild ) ; } else { View lastChild = rv . getChildAt ( rv . getChildCount ( ) - 1 ) ; // Approximate the scroll position based on the bottom child and the last visible item return ( rv . getAdapter ( ) . getItemCount ( ) - 1 ) * lm . getDecoratedMeasuredHeight ( lastChild ) + lm . getDecoratedBottom ( lastChild ) - rv . getBottom ( ) ; } } else { return 0 ; }
public class DotProgressBar { /** * Circle radius is grow */ private void drawCircleUp ( @ NonNull Canvas canvas , float step , float radius ) { } }
canvas . drawCircle ( xCoordinate + step , getMeasuredHeight ( ) / 2 , dotRadius + radius , startPaint ) ;
public class TableUnits { /** * Get map relationship between data source and logic tables via data sources ' names . * @ param dataSourceNames data sources ' names * @ return map relationship between data source and logic tables */ public Map < String , Set < String > > getDataSourceLogicTablesMap ( final Collection < String > dataSourceNames ) { } }
Map < String , Set < String > > result = new HashMap < > ( ) ; for ( String each : dataSourceNames ) { Set < String > logicTableNames = getLogicTableNames ( each ) ; if ( ! logicTableNames . isEmpty ( ) ) { result . put ( each , logicTableNames ) ; } } return result ;
public class ClassLoaderFiles { /** * Get or create a { @ link SourceFolder } with the given name . * @ param name the name of the folder * @ return an existing or newly added { @ link SourceFolder } */ protected final SourceFolder getOrCreateSourceFolder ( String name ) { } }
SourceFolder sourceFolder = this . sourceFolders . get ( name ) ; if ( sourceFolder == null ) { sourceFolder = new SourceFolder ( name ) ; this . sourceFolders . put ( name , sourceFolder ) ; } return sourceFolder ;
public class Merge { /** * Sort the array in descending order using this algorithm . * @ param < E > the type of elements in this array . * @ param intArray the array that we want to sort */ public static < E extends Comparable < E > > void sortDescending ( E [ ] intArray ) { } }
Merge . sort ( intArray , 0 , intArray . length - 1 , true ) ;
public class CommerceCountryLocalServiceWrapper { /** * Returns a range of all the commerce countries . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . model . impl . CommerceCountryModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param start the lower bound of the range of commerce countries * @ param end the upper bound of the range of commerce countries ( not inclusive ) * @ return the range of commerce countries */ @ Override public java . util . List < com . liferay . commerce . model . CommerceCountry > getCommerceCountries ( int start , int end ) { } }
return _commerceCountryLocalService . getCommerceCountries ( start , end ) ;
public class SFTrustManager { /** * Is OCSP Response cached ? * @ param pairIssuerSubjectList a list of pair of issuer and subject certificates * @ return true if all of OCSP response are cached else false */ private boolean isCached ( List < SFPair < Certificate , Certificate > > pairIssuerSubjectList ) { } }
long currentTimeSecond = new Date ( ) . getTime ( ) / 1000L ; boolean isCached = true ; try { for ( SFPair < Certificate , Certificate > pairIssuerSubject : pairIssuerSubjectList ) { OCSPReq req = createRequest ( pairIssuerSubject ) ; CertificateID certificateId = req . getRequestList ( ) [ 0 ] . getCertID ( ) ; LOGGER . debug ( CertificateIDToString ( certificateId ) ) ; CertID cid = certificateId . toASN1Primitive ( ) ; OcspResponseCacheKey k = new OcspResponseCacheKey ( cid . getIssuerNameHash ( ) . getEncoded ( ) , cid . getIssuerKeyHash ( ) . getEncoded ( ) , cid . getSerialNumber ( ) . getValue ( ) ) ; SFPair < Long , String > res = OCSP_RESPONSE_CACHE . get ( k ) ; if ( res == null ) { LOGGER . debug ( "Not all OCSP responses for the certificate is in the cache." ) ; isCached = false ; break ; } else if ( currentTimeSecond - CACHE_EXPIRATION_IN_SECONDS > res . left ) { LOGGER . debug ( "Cache for CertID expired." ) ; isCached = false ; break ; } else { try { validateRevocationStatusMain ( pairIssuerSubject , res . right ) ; } catch ( CertificateException ex ) { LOGGER . debug ( "Cache includes invalid OCSPResponse. " + "Will download the OCSP cache from Snowflake OCSP server" ) ; isCached = false ; } } } } catch ( IOException ex ) { LOGGER . debug ( "Failed to encode CertID." ) ; } return isCached ;
public class ApiClient { /** * Set HTTP client * @ param httpClient * An instance of OkHttpClient * @ return Api Client */ public ApiClient setHttpClient ( OkHttpClient newHttpClient ) { } }
if ( ! httpClient . equals ( newHttpClient ) ) { newHttpClient . networkInterceptors ( ) . addAll ( httpClient . networkInterceptors ( ) ) ; httpClient . networkInterceptors ( ) . clear ( ) ; newHttpClient . interceptors ( ) . addAll ( httpClient . interceptors ( ) ) ; httpClient . interceptors ( ) . clear ( ) ; this . httpClient = newHttpClient ; } return this ;
public class HttpInboundLink { /** * Find out whether we ' ve served the maximum number of requests allowed * on this connection already . * @ return boolean */ protected boolean maxRequestsServed ( ) { } }
// PK12235 , check for a partial or full stop if ( getChannel ( ) . isStopping ( ) ) { // channel has stopped , no more keep - alives if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Channel stopped, disabling keep-alive request" ) ; } return true ; } if ( ! getChannel ( ) . getHttpConfig ( ) . isKeepAliveEnabled ( ) ) { // keep alives are disabled , no need to check the max request number return true ; } int max = getChannel ( ) . getHttpConfig ( ) . getMaximumPersistentRequests ( ) ; // -1 is unlimited , 0 . . 1 is 1 request , any above that is that exact // number of requests if ( 0 <= max ) { return ( this . numRequestsProcessed >= max ) ; } return false ;
public class AuditCollectorUtil { /** * Construct audit api url */ protected static String getAuditAPIUrl ( Dashboard dashboard , AuditSettings settings , long beginDate , long endDate ) { } }
LOGGER . info ( "NFRR Audit Collector creates Audit API URL" ) ; if ( CollectionUtils . isEmpty ( settings . getServers ( ) ) ) { LOGGER . error ( "No Server Found to run NoFearRelease audit collector" ) ; throw new MBeanServerNotFoundException ( "No Server Found to run NoFearRelease audit collector" ) ; } URIBuilder auditURI = new URIBuilder ( ) ; auditURI . setPath ( settings . getServers ( ) . get ( 0 ) + HYGIEIA_AUDIT_URL ) ; auditURI . addParameter ( AUDIT_PARAMS . title . name ( ) , dashboard . getTitle ( ) ) ; auditURI . addParameter ( AUDIT_PARAMS . businessService . name ( ) , dashboard . getConfigurationItemBusServName ( ) ) ; auditURI . addParameter ( AUDIT_PARAMS . businessApplication . name ( ) , dashboard . getConfigurationItemBusAppName ( ) ) ; auditURI . addParameter ( AUDIT_PARAMS . beginDate . name ( ) , String . valueOf ( beginDate ) ) ; auditURI . addParameter ( AUDIT_PARAMS . endDate . name ( ) , String . valueOf ( endDate ) ) ; auditURI . addParameter ( AUDIT_PARAMS . auditType . name ( ) , "" ) ; String auditURIStr = auditURI . toString ( ) . replace ( "+" , " " ) ; return auditURIStr + AUDITTYPES_PARAM ;
public class RunMap { /** * Walks through builds , newer ones first . */ public Iterator < R > iterator ( ) { } }
return new Iterator < R > ( ) { R last = null ; R next = newestBuild ( ) ; public boolean hasNext ( ) { return next != null ; } public R next ( ) { last = next ; if ( last != null ) next = last . getPreviousBuild ( ) ; else throw new NoSuchElementException ( ) ; return last ; } public void remove ( ) { if ( last == null ) throw new UnsupportedOperationException ( ) ; removeValue ( last ) ; } } ;
public class FloatLabel { /** * Sets the EditText ' s text without animating the label * @ param resid int String resource ID * @ param type TextView . BufferType */ public void setTextWithoutAnimation ( int resid , TextView . BufferType type ) { } }
mSkipAnimation = true ; mEditText . setText ( resid , type ) ;