signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SVR { /** * Sequential minimal optimization . */ private boolean smo ( double epsgr ) { } }
SupportVector i = svmax ; int ii = gmaxindex ; double old_alpha_i = i . alpha [ ii ] ; if ( i . kcache == null ) { gram ( i ) ; } SupportVector j = svmin ; int jj = gminindex ; double old_alpha_j = j . alpha [ jj ] ; // Second order working set selection . double best = 0.0 ; double gi = ii == 0 ? - i . g [ 0 ] : i . g [ 1 ] ; for ( SupportVector v : sv ) { double curv = i . k + v . k - 2 * kernel . k ( i . x , v . x ) ; if ( curv <= 0.0 ) curv = TAU ; double gj = - v . g [ 0 ] ; if ( v . alpha [ 0 ] > 0.0 && gj < gi ) { double gain = - Math . sqr ( gi - gj ) / curv ; if ( gain < best ) { best = gain ; j = v ; jj = 0 ; old_alpha_j = j . alpha [ 0 ] ; } } gj = v . g [ 1 ] ; if ( v . alpha [ 1 ] < v . C && gj < gi ) { double gain = - Math . sqr ( gi - gj ) / curv ; if ( gain < best ) { best = gain ; j = v ; jj = 1 ; old_alpha_j = j . alpha [ 1 ] ; } } } if ( j . kcache == null ) { gram ( j ) ; } // Determine curvature double curv = i . k + j . k - 2 * kernel . k ( i . x , j . x ) ; if ( curv <= 0.0 ) curv = TAU ; if ( ii != jj ) { double delta = ( - i . g [ ii ] - j . g [ jj ] ) / curv ; double diff = i . alpha [ ii ] - j . alpha [ jj ] ; i . alpha [ ii ] += delta ; j . alpha [ jj ] += delta ; if ( diff > 0.0 ) { // Region III if ( j . alpha [ jj ] < 0.0 ) { j . alpha [ jj ] = 0.0 ; i . alpha [ ii ] = diff ; } } else { // Region IV if ( i . alpha [ ii ] < 0.0 ) { i . alpha [ ii ] = 0.0 ; j . alpha [ jj ] = - diff ; } } if ( diff > i . C - j . C ) { // Region I if ( i . alpha [ ii ] > i . C ) { i . alpha [ ii ] = i . C ; j . alpha [ jj ] = i . C - diff ; } } else { // Region II if ( j . alpha [ jj ] > j . C ) { j . alpha [ jj ] = j . C ; i . alpha [ ii ] = j . C + diff ; } } } else { double delta = ( i . g [ ii ] - j . g [ jj ] ) / curv ; double sum = i . alpha [ ii ] + j . alpha [ jj ] ; i . alpha [ ii ] -= delta ; j . alpha [ jj ] += delta ; if ( sum > i . C ) { if ( i . alpha [ ii ] > i . C ) { i . alpha [ ii ] = i . C ; j . alpha [ jj ] = sum - i . C ; } } else { if ( j . alpha [ jj ] < 0 ) { j . alpha [ jj ] = 0 ; i . alpha [ ii ] = sum ; } } if ( sum > j . C ) { if ( j . alpha [ jj ] > j . C ) { j . alpha [ jj ] = j . C ; i . alpha [ ii ] = sum - j . C ; } } else { if ( i . alpha [ ii ] < 0 ) { i . alpha [ ii ] = 0.0 ; j . alpha [ jj ] = sum ; } } } double delta_alpha_i = i . alpha [ ii ] - old_alpha_i ; double delta_alpha_j = j . alpha [ jj ] - old_alpha_j ; int si = 2 * ii - 1 ; int sj = 2 * jj - 1 ; for ( int k = 0 ; k < sv . size ( ) ; k ++ ) { SupportVector v = sv . get ( k ) ; v . g [ 0 ] -= si * i . kcache . get ( k ) * delta_alpha_i + sj * j . kcache . get ( k ) * delta_alpha_j ; v . g [ 1 ] += si * i . kcache . get ( k ) * delta_alpha_i + sj * j . kcache . get ( k ) * delta_alpha_j ; } // optimality test minmax ( ) ; b = - ( gmax + gmin ) / 2 ; if ( gmax - gmin < epsgr ) { return false ; } return true ;
public class CollationRootElements { /** * Returns the last root CE with a primary weight before p . * Intended only for reordering group boundaries . */ long lastCEWithPrimaryBefore ( long p ) { } }
if ( p == 0 ) { return 0 ; } assert ( p > elements [ ( int ) elements [ IX_FIRST_PRIMARY_INDEX ] ] ) ; int index = findP ( p ) ; long q = elements [ index ] ; long secTer ; if ( p == ( q & 0xffffff00L ) ) { // p = = elements [ index ] is a root primary . Find the CE before it . // We must not be in a primary range . assert ( ( q & PRIMARY_STEP_MASK ) == 0 ) ; secTer = elements [ index - 1 ] ; if ( ( secTer & SEC_TER_DELTA_FLAG ) == 0 ) { // Primary CE just before p . p = secTer & 0xffffff00L ; secTer = Collation . COMMON_SEC_AND_TER_CE ; } else { // secTer = last secondary & tertiary for the previous primary index -= 2 ; for ( ; ; ) { p = elements [ index ] ; if ( ( p & SEC_TER_DELTA_FLAG ) == 0 ) { p &= 0xffffff00L ; break ; } -- index ; } } } else { // p > elements [ index ] which is the previous primary . // Find the last secondary & tertiary weights for it . p = q & 0xffffff00L ; secTer = Collation . COMMON_SEC_AND_TER_CE ; for ( ; ; ) { q = elements [ ++ index ] ; if ( ( q & SEC_TER_DELTA_FLAG ) == 0 ) { // We must not be in a primary range . assert ( ( q & PRIMARY_STEP_MASK ) == 0 ) ; break ; } secTer = q ; } } return ( p << 32 ) | ( secTer & ~ SEC_TER_DELTA_FLAG ) ;
public class JScoreElementAbstract { /** * Add decoration if it hasn ' t been added previously */ protected void addDecoration ( JDecoration decoration ) { } }
if ( m_jDecorations == null ) { m_jDecorations = new Vector ( ) ; } if ( ! m_jDecorations . contains ( decoration ) ) { decoration . setStaffLine ( getStaffLine ( ) ) ; m_jDecorations . add ( decoration ) ; }
public class StoreFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public ServiceSimpleType createServiceSimpleTypeFromString ( EDataType eDataType , String initialValue ) { } }
ServiceSimpleType result = ServiceSimpleType . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class ThreadsParser { /** * A variation of nextElement that verifies the nextElement is not in a different namespace . * @ param reader the XmlExtendedReader to read from . * @ param expectedNamespace the namespace expected . * @ return the element or null if the end is reached * @ throws XMLStreamException if the namespace is wrong or there is a problem accessing the reader */ private static Element nextElement ( XMLExtendedStreamReader reader , String expectedNamespace ) throws XMLStreamException { } }
Element element = Element . forName ( reader . getLocalName ( ) ) ; if ( element == null ) { return element ; } else if ( expectedNamespace . equals ( reader . getNamespaceURI ( ) ) ) { return element ; } throw unexpectedElement ( reader ) ;
public class CmsJspTagContentLoop { /** * Initializes this content loop tag . < p > * @ param container the parent content container that provides the content element to loop */ protected void init ( I_CmsXmlContentContainer container ) { } }
m_container = container ; // append to parent element name ( required for nested schemas ) m_element = CmsXmlUtils . concatXpath ( m_container . getXmlDocumentElement ( ) , m_element ) ; // get loaded content from parent < contentload > tag m_content = m_container . getXmlDocument ( ) ; m_locale = m_container . getXmlDocumentLocale ( ) ; m_index = 0 ; m_currentElement = null ; // the next loop is the first loop m_firstLoop = true ;
public class ScoreTemplate { /** * Sets the size associated to an attribute * @ param unit { @ link SizeUnit # PX } , { @ link SizeUnit # STAFF _ HEIGHT } . . . * @ throws RuntimeException if attribute doesn ' t accept size value */ public void setAttributeSize ( ScoreAttribute sa , float size , SizeUnit unit ) { } }
if ( ! ( sa . getDefaultValue ( ) instanceof ScoreAttribute . Size ) ) throw new RuntimeException ( sa . toString ( ) + " is not a size attribute" ) ; m_attributes . put ( sa . getName ( ) , new ScoreAttribute . Size ( size , unit ) ) ; notifyListeners ( ) ;
public class GVRRenderData { /** * Set the draw mode for this mesh . Default is GL _ TRIANGLES . * @ param drawMode */ public GVRRenderData setDrawMode ( int drawMode ) { } }
if ( drawMode != GL_POINTS && drawMode != GL_LINES && drawMode != GL_LINE_STRIP && drawMode != GL_LINE_LOOP && drawMode != GL_TRIANGLES && drawMode != GL_TRIANGLE_STRIP && drawMode != GL_TRIANGLE_FAN ) { throw new IllegalArgumentException ( "drawMode must be one of GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_FAN, GL_TRIANGLE_STRIP." ) ; } NativeRenderData . setDrawMode ( getNative ( ) , drawMode ) ; return this ;
public class Delete { /** * First it is checked if the user has access to delete the eFaps object * defined in { @ link # instance } . If no access , an exception is thrown . If * the context user has access . the delete is made with * { @ link # executeWithoutAccessCheck } . * @ throws EFapsException if the current context user has no delete access * on given eFaps object . * @ see # executeWithoutAccessCheck ( ) */ public void execute ( ) throws EFapsException { } }
AccessCache . registerUpdate ( getInstance ( ) ) ; final boolean hasAccess = this . instance . getType ( ) . hasAccess ( this . instance , AccessTypeEnums . DELETE . getAccessType ( ) ) ; if ( ! hasAccess ) { throw new EFapsException ( getClass ( ) , "execute.NoAccess" , this . instance ) ; } executeWithoutAccessCheck ( ) ;
public class Cron4jTask { protected void recordJobHistory ( TaskExecutionContext context , Cron4jJob job , Thread jobThread , LocalDateTime activationTime , OptionalThing < RunnerResult > runnerResult , OptionalThing < LocalDateTime > endTime , OptionalThing < Throwable > controllerCause ) { } }
final TaskExecutor taskExecutor = context . getTaskExecutor ( ) ; final Cron4jJobHistory jobHistory = prepareJobHistory ( job , activationTime , runnerResult , endTime , controllerCause ) ; final int historyLimit = getHistoryLimit ( ) ; jobRunner . getHistoryHook ( ) . ifPresent ( hook -> { final Method hookMethod = findHookMethod ( hook , "hookRecord" ) ; arrangeHookThreadCacheContext ( ) ; jobRunner . getAccessContextArranger ( ) . ifPresent ( arranger -> { // for DB control arrangeHookPreparedAccessContext ( arranger , hook , hookMethod , job ) ; } ) ; arrangeHookCallbackContext ( hook , hookMethod , job ) ; try { showJobHistoryHookRecording ( job , hook ) ; hook . hookRecord ( jobHistory , new JobHistoryResource ( historyLimit ) ) ; } finally { clearHookCallbackContext ( ) ; clearHookPreparedAccessContext ( ) ; clearHookThreadCacheContext ( ) ; } } ) ; Cron4jJobHistory . record ( taskExecutor , jobHistory , historyLimit ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcReinforcingElement ( ) { } }
if ( ifcReinforcingElementEClass == null ) { ifcReinforcingElementEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 435 ) ; } return ifcReinforcingElementEClass ;
public class StringsCompleter2 { /** * Add all strings to existing candidates . */ public void addAll ( final Iterable < String > strings ) { } }
checkNotNull ( strings ) ; for ( String string : strings ) { add ( string ) ; }
public class WDialog { /** * Override handleRequest in order to perform processing specific to this component . * @ param request the request being responded to . */ @ Override public void handleRequest ( final Request request ) { } }
// Can only be an active DIALOG if it is AJAX targetted . if ( isAjaxTargeted ( ) ) { if ( getState ( ) == INACTIVE_STATE ) { handleTriggerOpenAction ( request ) ; } getOrCreateComponentModel ( ) . state = ACTIVE_STATE ; } else if ( getState ( ) != INACTIVE_STATE ) { getOrCreateComponentModel ( ) . state = INACTIVE_STATE ; }
public class MalisisCommand { /** * Processes the command . * @ param sender the sender * @ param params the params */ @ Override public void execute ( MinecraftServer server , ICommandSender sender , String [ ] params ) throws CommandException { } }
if ( params . length == 0 ) throw new WrongUsageException ( "malisiscore.commands.usage" ) ; if ( ! parameters . contains ( params [ 0 ] ) ) throw new WrongUsageException ( "malisiscore.commands.usage" ) ; switch ( params [ 0 ] ) { case "config" : configCommand ( sender , params ) ; break ; case "version" : IMalisisMod mod = null ; if ( params . length == 1 ) mod = MalisisCore . instance ; else { mod = MalisisCore . getMod ( params [ 1 ] ) ; if ( mod == null ) MalisisCore . message ( "malisiscore.commands.modnotfound" , params [ 1 ] ) ; } if ( mod != null ) MalisisCore . message ( "malisiscore.commands.modversion" , mod . getName ( ) , mod . getVersion ( ) ) ; break ; case "debug" : debugCommand ( sender , params ) ; break ; default : MalisisCore . message ( "Not yet implemented" ) ; break ; }
public class BigtableAsyncAdmin { /** * < p > modifyColumns . < / p > * @ param modifications a { @ link ModifyTableBuilder } object . */ private CompletableFuture < Void > modifyColumns ( ModifyTableBuilder modifications ) { } }
return toCompletableFuture ( bigtableTableAdminClient . modifyFamiliesAsync ( modifications . build ( ) ) ) . thenApply ( r -> null ) ;
public class Statement { /** * Sets the values value for this Statement . * @ param values * Holds keys and values for bind variables and their values . * The key is the * name of the bind variable . The value is the literal * value of the variable . * In the example { @ code " WHERE status = : bindStatus * ORDER BY id LIMIT 30 " } , * the bind variable , represented by { @ code : bindStatus } * is named { @ code * bindStatus } , which would also be the parameter map * key . The bind variable ' s * value would be represented by a parameter map value * of type * { @ link TextValue } . The final result , for example , * would be an entry of * { @ code " bindStatus " = > StringParam ( " ACTIVE " ) } . */ public void setValues ( com . google . api . ads . admanager . axis . v201902 . String_ValueMapEntry [ ] values ) { } }
this . values = values ;
public class LessParser { /** * Parse and handle an < code > @ import < / code > directive . * @ param currentRule current container . This can be the root or a rule . * @ param name the content of the directive like a file name and keywords * @ throws LessException if any parsing error occurred */ private void importFile ( FormattableContainer currentRule , final String name ) { } }
String filename = name . trim ( ) ; boolean isReference = reader . isReference ( ) ; boolean isCss = false ; boolean isLess = false ; boolean isMultiple = reader . isMultiple ( ) ; boolean isInline = false ; boolean isOptional = false ; if ( filename . startsWith ( "(" ) ) { int endIdx = filename . indexOf ( ')' , 1 ) ; if ( endIdx > 0 ) { StringTokenizer tokenizer = new StringTokenizer ( filename . substring ( 1 , endIdx ) , "," ) ; filename = name . substring ( endIdx + 1 ) . trim ( ) ; while ( tokenizer . hasMoreTokens ( ) ) { String keywordStr = tokenizer . nextToken ( ) . trim ( ) ; switch ( keywordStr ) { case "inline" : isInline = true ; break ; case "optional" : isOptional = true ; break ; case "once" : isMultiple = false ; break ; case "multiple" : isMultiple = true ; break ; case "less" : isLess = true ; isCss = false ; break ; case "css" : isCss = true ; isLess = false ; break ; case "reference" : isReference = true ; break ; default : throw new LessException ( "Unknown @import keyword: " + keywordStr ) ; } } } } Object [ ] old = { reader , baseURL , relativeURL } ; // store on the heap to reduce the stack size try { int i ; boolean isURL ; if ( filename . startsWith ( "url(" ) ) { i = 4 ; isURL = true ; } else { i = 0 ; isURL = false ; } StringBuilder builder = cachesBuilder ; String media = null ; char quote = 0 ; LOOP : for ( ; i < filename . length ( ) ; i ++ ) { char ch = filename . charAt ( i ) ; switch ( ch ) { case '\"' : case '\'' : if ( quote == 0 ) { quote = ch ; } else { quote = 0 ; if ( ! isURL ) { break LOOP ; } } break ; case '\\' : builder . append ( filename . charAt ( ++ i ) ) ; break ; case ')' : if ( quote == 0 ) { break LOOP ; } // $ FALL - THROUGH $ default : builder . append ( ch ) ; } } if ( i < filename . length ( ) - 1 ) { // additional content after url ( . . . ) media = filename . substring ( i + 1 ) . trim ( ) ; Rule rule = new Rule ( reader , currentRule , "@media " + media , null , null ) ; currentRule . add ( rule ) ; currentRule = rule ; } filename = trim ( builder ) ; if ( filename . contains ( "@{" ) ) { // filename with variable name , we need to parse later if ( currentRule != this ) { // import is inside of a mixin and will be process if the mixin will be process currentRule . add ( new CssAtRule ( reader , "@import " + name + ';' ) ) ; return ; } HashMap < String , Expression > importVariables = new DefaultedHashMap < > ( variables ) ; variables = new DefaultedHashMap < > ( importVariables ) ; Formattable lastRuleBefore = rules . size ( ) == 0 ? null : rules . get ( rules . size ( ) - 1 ) ; LazyImport lazy = new LazyImport ( reader , baseURL , name , importVariables , lastRuleBefore ) ; if ( lazyImports == null ) { lazyImports = new ArrayList < > ( ) ; } lazyImports . add ( lazy ) ; return ; } if ( ! isLess && ! isInline && ( isCss || filename . endsWith ( "css" ) ) ) { // filenames ends with " css " will not be inline else a CSS @ import directive is written currentRule . add ( new CssAtRule ( reader , "@import " + name + ';' ) ) ; return ; } baseURL = baseURL == null ? new URL ( filename ) : new URL ( baseURL , filename ) ; if ( ! isLess && ! isInline && baseURL . getPath ( ) . endsWith ( "css" ) ) { // URL path ends with " css " will not be inline else a CSS @ import directive is written currentRule . add ( new CssAtRule ( reader , "@import " + name + ';' ) ) ; return ; } if ( "file" . equals ( baseURL . getProtocol ( ) ) && filename . lastIndexOf ( '.' ) <= filename . lastIndexOf ( '/' ) ) { filename += ".less" ; baseURL = ( URL ) old [ 1 ] ; baseURL = baseURL == null ? new URL ( filename ) : new URL ( baseURL , filename ) ; } relativeURL = new URL ( relativeURL , filename ) ; if ( imports . add ( baseURL ) || isMultiple ) { if ( isReference != reader . isReference ( ) ) { add ( new ReferenceInfo ( isReference ) ) ; } Reader importReader = readerFactory . create ( baseURL ) ; if ( isInline ) { Scanner scanner = new Scanner ( importReader ) . useDelimiter ( "\\A" ) ; if ( scanner . hasNext ( ) ) { currentRule . add ( new CssAtRule ( reader , scanner . next ( ) ) ) ; } } else { reader = new LessLookAheadReader ( importReader , filename , isReference , isMultiple ) ; parse ( currentRule ) ; reader . close ( ) ; } } } catch ( LessException ex ) { throw ex ; } catch ( IOException ex ) { if ( ! isOptional ) { throw new LessException ( ex ) ; } } catch ( Exception ex ) { throw new LessException ( ex ) ; } finally { reader = ( LessLookAheadReader ) old [ 0 ] ; baseURL = ( URL ) old [ 1 ] ; relativeURL = ( URL ) old [ 2 ] ; if ( isReference != reader . isReference ( ) ) { add ( new ReferenceInfo ( reader . isReference ( ) ) ) ; } }
public class QueueContainer { /** * Returns data in the queue . This method triggers store load . * @ return the item data in the queue . */ public List < Data > getAsDataList ( ) { } }
List < Data > dataList = new ArrayList < Data > ( getItemQueue ( ) . size ( ) ) ; for ( QueueItem item : getItemQueue ( ) ) { if ( store . isEnabled ( ) && item . getData ( ) == null ) { try { load ( item ) ; } catch ( Exception e ) { throw new HazelcastException ( e ) ; } } dataList . add ( item . getData ( ) ) ; } return dataList ;
public class FacebookRestClient { /** * Retrieves the membership list of a group * @ param groupId the group id * @ return a T containing four membership lists of * ' members ' , ' admins ' , ' officers ' , and ' not _ replied ' */ public T groups_getMembers ( Number groupId ) throws FacebookException , IOException { } }
assert ( null != groupId ) ; return this . callMethod ( FacebookMethod . GROUPS_GET_MEMBERS , new Pair < String , CharSequence > ( "gid" , groupId . toString ( ) ) ) ;
public class XmlUtils { /** * Parse a < code > File < / code > containing an XML structure into a DOM tree . * @ param input * The input XML file . * @ return The corresponding DOM tree , or < code > null < / code > if the input could not be parsed successfully . */ public static Document parseFile ( final File input ) { } }
Document output = null ; try { final DocumentBuilder db = FACTORY . newDocumentBuilder ( ) ; db . setErrorHandler ( new ParserErrorHandler ( ) ) ; output = db . parse ( input ) ; } catch ( final Exception ex ) { String msg = "Problem parsing the input XML file" ; if ( ex instanceof SAXParseException ) { msg += " at line #" + ( ( SAXParseException ) ex ) . getLineNumber ( ) ; } LOGGER . error ( msg , ex ) ; } return output ;
public class CLI { /** * Main entry point of ixa - pipe - nerc . * @ param args * the arguments passed through the CLI * @ throws IOException * exception if input data not available * @ throws JDOMException * if problems with the xml formatting of NAF */ public static void main ( final String [ ] args ) throws IOException , JDOMException { } }
CLI cmdLine = new CLI ( ) ; cmdLine . parseCLI ( args ) ;
public class CompilerOptions { /** * Create a CompilerOptions object that is appropriate for just doing a * syntax check . * @ param deprecationWarnings * determine what deprecation warnings are provided * @ return CompilerOptions object configured for a syntax check . */ public static CompilerOptions createCheckSyntaxOptions ( DeprecationWarnings deprecationWarnings ) { } }
Pattern debugNsInclude = null ; Pattern debugNsExclude = null ; int maxIteration = 5000 ; int maxRecursion = 50 ; Set < Formatter > formatters = new HashSet < Formatter > ( ) ; File outputDirectory = null ; File annotationDirectory = null ; File annotationBaseDirectory = null ; LinkedList < File > includeDirectories = new LinkedList < File > ( ) ; try { return new CompilerOptions ( debugNsInclude , debugNsExclude , maxIteration , maxRecursion , formatters , outputDirectory , includeDirectories , deprecationWarnings , annotationDirectory , annotationBaseDirectory , null , 0 ) ; } catch ( SyntaxException consumed ) { throw CompilerError . create ( MSG_FILE_BUG_REPORT ) ; }
public class Inventory { /** * Removes the entry with the specified key . * @ param key the key * @ return returns the removed entry */ InventoryEntry remove ( String key ) { } }
InventoryEntry ret = configs . remove ( key ) ; if ( ret != null ) { ret . getPath ( ) . delete ( ) ; } return ret ;
public class Cache { /** * Returns a row if in memory cache . */ public synchronized CachedObject get ( int pos ) { } }
if ( accessCount == Integer . MAX_VALUE ) { resetAccessCount ( ) ; } int lookup = getLookup ( pos ) ; if ( lookup == - 1 ) { return null ; } accessTable [ lookup ] = accessCount ++ ; return ( CachedObject ) objectValueTable [ lookup ] ;
public class AjcHelper { /** * Based on a set of weavedirs returns a set of all the files to be weaved . * @ return * @ throws MojoExecutionException */ public static Set < String > getWeaveSourceFiles ( String [ ] weaveDirs ) throws MojoExecutionException { } }
Set < String > result = new HashSet < String > ( ) ; for ( int i = 0 ; i < weaveDirs . length ; i ++ ) { String weaveDir = weaveDirs [ i ] ; if ( FileUtils . fileExists ( weaveDir ) ) { try { result . addAll ( FileUtils . getFileNames ( new File ( weaveDir ) , "**/*.class" , DEFAULT_EXCLUDES , true ) ) ; } catch ( IOException e ) { throw new MojoExecutionException ( "IO Error resolving weavedirs" , e ) ; } } } return result ;
public class MultiTimingEvent { /** * End the previous stage and record the time spent in that stage . */ public void endStage ( ) { } }
if ( this . currentStage != null ) { long time = System . currentTimeMillis ( ) - this . currentStageStart ; this . timings . add ( new Stage ( this . currentStage , time ) ) ; if ( reportAsMetrics && submitter . getMetricContext ( ) . isPresent ( ) ) { String timerName = submitter . getNamespace ( ) + "." + name + "." + this . currentStage ; submitter . getMetricContext ( ) . get ( ) . timer ( timerName ) . update ( time , TimeUnit . MILLISECONDS ) ; } } this . currentStage = null ;
public class LdiSrl { /** * Get the index of the first - found delimiter . * < pre > * indexOfFirst ( " foo . bar / baz . qux " , " . " , " / " ) * returns the index of " . bar " * < / pre > * @ param str The target string . ( NotNull ) * @ param delimiters The array of delimiters . ( NotNull ) * @ return The information of index . ( NullAllowed : if delimiter not found ) */ public static IndexOfInfo indexOfFirst ( final String str , final String ... delimiters ) { } }
return doIndexOfFirst ( false , str , delimiters ) ;
public class ServiceTools { /** * Get template from parameterizedType * @ param parameterizedType * @ return */ String getTemplateOfParameterizedType ( ParameterizedType parameterizedType , IJsonMarshaller jsonMarshaller ) { } }
Class cls = ( Class ) parameterizedType . getRawType ( ) ; Type [ ] actualTypeArguments = parameterizedType . getActualTypeArguments ( ) ; String res ; if ( Iterable . class . isAssignableFrom ( cls ) ) { res = getTemplateOfIterable ( actualTypeArguments , jsonMarshaller ) ; } else if ( Map . class . isAssignableFrom ( cls ) ) { res = getTemplateOfMap ( actualTypeArguments , jsonMarshaller ) ; } else { res = cls . getSimpleName ( ) . toLowerCase ( Locale . ENGLISH ) ; } return res ;
public class DocumentFactory { /** * Get the document factory . * @ return The document factory . * @ throws LionEngineException If unable to create builder . */ private static synchronized DocumentBuilder getDocumentFactory ( ) { } }
if ( documentBuilder == null ) { final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory . newInstance ( ) ; documentBuilderFactory . setIgnoringElementContentWhitespace ( true ) ; try { documentBuilderFactory . setFeature ( javax . xml . XMLConstants . FEATURE_SECURE_PROCESSING , true ) ; } catch ( final ParserConfigurationException exception ) { Verbose . exception ( exception ) ; } try { documentBuilder = documentBuilderFactory . newDocumentBuilder ( ) ; documentBuilder . setErrorHandler ( null ) ; } catch ( final ParserConfigurationException exception ) { throw new LionEngineException ( exception ) ; } } return documentBuilder ;
public class ntpserver { /** * Use this API to update ntpserver . */ public static base_response update ( nitro_service client , ntpserver resource ) throws Exception { } }
ntpserver updateresource = new ntpserver ( ) ; updateresource . serverip = resource . serverip ; updateresource . servername = resource . servername ; updateresource . minpoll = resource . minpoll ; updateresource . maxpoll = resource . maxpoll ; updateresource . preferredntpserver = resource . preferredntpserver ; updateresource . autokey = resource . autokey ; updateresource . key = resource . key ; return updateresource . update_resource ( client ) ;
public class Tags { /** * Ensures that a given string is a valid metric name or tag name / value . * @ param what A human readable description of what ' s being validated . * @ param s The string to validate . * @ throws IllegalArgumentException if the string isn ' t valid . */ public static void validateString ( final String what , final String s ) { } }
if ( s == null ) { throw new IllegalArgumentException ( "Invalid " + what + ": null" ) ; } else if ( "" . equals ( s ) ) { throw new IllegalArgumentException ( "Invalid " + what + ": empty string" ) ; } final int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) { final char c = s . charAt ( i ) ; if ( ! ( ( 'a' <= c && c <= 'z' ) || ( 'A' <= c && c <= 'Z' ) || ( '0' <= c && c <= '9' ) || c == '-' || c == '_' || c == '.' || c == '/' || Character . isLetter ( c ) || isAllowSpecialChars ( c ) ) ) { throw new IllegalArgumentException ( "Invalid " + what + " (\"" + s + "\"): illegal character: " + c ) ; } }
public class FDBigInt { /** * Multiply a FDBigInt by another FDBigInt . * Result is a new FDBigInt . */ public FDBigInt mult ( FDBigInt other ) { } }
// crudely guess adequate size for r int r [ ] = new int [ nWords + other . nWords ] ; int i ; // I think I am promised zeros . . . for ( i = 0 ; i < this . nWords ; i ++ ) { long v = ( long ) this . data [ i ] & 0xffffffffL ; // UNSIGNED CONVERSION long p = 0L ; int j ; for ( j = 0 ; j < other . nWords ; j ++ ) { p += ( ( long ) r [ i + j ] & 0xffffffffL ) + v * ( ( long ) other . data [ j ] & 0xffffffffL ) ; // UNSIGNED CONVERSIONS ALL ' ROUND . r [ i + j ] = ( int ) p ; p >>>= 32 ; } r [ i + j ] = ( int ) p ; } // compute how much of r we actually needed for all that . for ( i = r . length - 1 ; i > 0 ; i -- ) if ( r [ i ] != 0 ) break ; return new FDBigInt ( r , i + 1 ) ;
public class SerializerIntrinsics { /** * Bit Scan Reverse . */ public final void bsr ( Register dst , Mem src ) { } }
assert ( ! dst . isRegType ( REG_GPB ) ) ; emitX86 ( INST_BSR , dst , src ) ;
public class WhileyFileParser { /** * Check whether we have a duplicate default statement , or a case which * occurs after a default statement ( and , hence , is unreachable ) . * @ param cases */ private void checkForDuplicateDefault ( List < Stmt . Case > cases ) { } }
boolean hasDefault = false ; for ( int i = 0 ; i != cases . size ( ) ; ++ i ) { Stmt . Case c = cases . get ( i ) ; if ( c . getConditions ( ) . size ( ) > 0 && hasDefault ) { syntaxError ( "unreachable code" , c ) ; } else if ( c . getConditions ( ) . size ( ) == 0 && hasDefault ) { syntaxError ( "duplicate default label" , c ) ; } else { hasDefault = c . getConditions ( ) . size ( ) == 0 ; } }
public class Contextualizer { /** * Contextualizes operation with contexts given by { @ link OperationalContext } * @ param retriever the context * @ param instance the instance to wrap ( must comply with given interface ) * @ param interfaze the interface of return object * @ param contextPropagatingInterfaces when a return type of any invocation is one of these interfaces , the given result will be call contextually as well */ public static < T > T contextualize ( final OperationalContext context , final T instance , Class < ? > interfaze , Class < ? > ... contextPropagatingInterfaces ) { } }
OperationalContextRetriver retriever = new OperationalContextRetriver ( ) { @ Override public OperationalContext retrieve ( ) { return context ; } } ; return contextualize ( retriever , instance , interfaze ) ;
public class LObjIntConsumerBuilder { /** * 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 > LObjIntConsumerBuilder < T > objIntConsumer ( Consumer < LObjIntConsumer < T > > consumer ) { } }
return new LObjIntConsumerBuilder ( consumer ) ;
public class DefaultHudsonClient { /** * join a base url to another path or paths - this will handle trailing or non - trailing / ' s */ public static String joinURL ( String base , String [ ] paths ) { } }
StringBuilder result = new StringBuilder ( base ) ; Arrays . stream ( paths ) . map ( path -> path . replaceFirst ( "^(\\/)+" , "" ) ) . forEach ( p -> { if ( result . lastIndexOf ( "/" ) != result . length ( ) - 1 ) { result . append ( '/' ) ; } result . append ( p ) ; } ) ; return result . toString ( ) ;
public class FFMQTopicConnectionFactory { /** * / * ( non - Javadoc ) * @ see javax . jms . TopicConnectionFactory # createTopicConnection ( ) */ @ Override public TopicConnection createTopicConnection ( ) throws JMSException { } }
String username = getStringProperty ( Context . SECURITY_PRINCIPAL , null ) ; String password = getStringProperty ( Context . SECURITY_CREDENTIALS , null ) ; return createTopicConnection ( username , password ) ;
public class UndertowServerEngineFactory { /** * This method removes the Server Engine from the port map and stops it . */ public synchronized void destroyForPort ( int port ) { } }
synchronized ( portMap ) { UndertowServerEngine ref = portMap . remove ( port ) ; if ( ref != null ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Stopping HttpServer Engine on port " + port + "." ) ; } try { ref . stop ( ) ; } catch ( Exception e ) { LOG . warn ( "" , e ) ; } } }
public class Descriptives { /** * Calculates Minimum absolute value . * @ param flatDataCollection * @ return */ public static double minAbsolute ( FlatDataCollection flatDataCollection ) { } }
double minAbs = Double . POSITIVE_INFINITY ; Iterator < Double > it = flatDataCollection . iteratorDouble ( ) ; while ( it . hasNext ( ) ) { Double v = it . next ( ) ; if ( v != null ) { minAbs = Math . min ( minAbs , Math . abs ( v ) ) ; } } return minAbs ;
public class ScriptVars { /** * Sets or removes a global variable . * The variable is removed when the { @ code value } is { @ code null } . * @ param key the key of the variable . * @ param value the value of the variable . * @ throws IllegalArgumentException if one of the following conditions is met : * < ul > * < li > The { @ code key } is { @ code null } or its length is higher than the maximum allowed * ( { @ value # MAX _ KEY _ SIZE } ) ; < / li > * < li > The { @ code value } ' s length is higher than the maximum allowed ( { @ value # MAX _ VALUE _ SIZE } ) ; < / li > * < li > The number of global variables is higher than the maximum allowed ( { @ value # MAX _ GLOBAL _ VARS } ) ; < / li > * < / ul > */ public static void setGlobalVar ( String key , String value ) { } }
validateKey ( key ) ; if ( value == null ) { globalVars . remove ( key ) ; } else { validateValueLength ( value ) ; if ( globalVars . size ( ) > MAX_GLOBAL_VARS ) { throw new IllegalArgumentException ( "Maximum number of global variables reached: " + MAX_GLOBAL_VARS ) ; } globalVars . put ( key , value ) ; }
public class BonusPaymentMarshaller { /** * Marshall the given parameter object . */ public void marshall ( BonusPayment bonusPayment , ProtocolMarshaller protocolMarshaller ) { } }
if ( bonusPayment == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( bonusPayment . getWorkerId ( ) , WORKERID_BINDING ) ; protocolMarshaller . marshall ( bonusPayment . getBonusAmount ( ) , BONUSAMOUNT_BINDING ) ; protocolMarshaller . marshall ( bonusPayment . getAssignmentId ( ) , ASSIGNMENTID_BINDING ) ; protocolMarshaller . marshall ( bonusPayment . getReason ( ) , REASON_BINDING ) ; protocolMarshaller . marshall ( bonusPayment . getGrantTime ( ) , GRANTTIME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class URLConnection { /** * Returns the value of the named field parsed as date . The result is the number of milliseconds * since January 1 , 1970 GMT represented by the named field . * This form of { @ code getHeaderField } exists because some connection types ( e . g . , { @ code http - ng } * ) have pre - parsed headers . Classes for that connection type can override this method and * short - circuit the parsing . * @ param name the name of the header field . * @ param pdefault a default value . * @ return the value of the field , parsed as a date . The value of the { @ code Default } argument is * returned if the field is missing or malformed . */ @ SuppressWarnings ( "deprecation" ) public long getHeaderFieldDate ( final String name , final long pdefault ) { } }
final String value = this . getHeaderField ( name ) ; try { return Date . parse ( value ) ; } catch ( final Exception e ) { // NOPMD } return pdefault ;
public class CmsSetupBean { /** * Returns the URI of a database config page ( in step 3 ) for a specified database key . < p > * @ param key the database key ( e . g . " mysql " , " generic " or " oracle " ) * @ return the URI of a database config page */ public String getDatabaseConfigPage ( String key ) { } }
// don ' t use File . separatorChar here , result must be a valid URL with " / " path delimiters String configUri = FOLDER_DATABASE + key + "/" + "step_4_database_setup.jsp" ; return CmsStringUtil . substitute ( configUri , File . separator , "/" ) ;
public class AssetsInner { /** * List Streaming Locators . * Lists Streaming Locators which are associated with this asset . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ param assetName The Asset name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the ListStreamingLocatorsResponseInner object */ public Observable < ServiceResponse < ListStreamingLocatorsResponseInner > > listStreamingLocatorsWithServiceResponseAsync ( String resourceGroupName , String accountName , String assetName ) { } }
if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( accountName == null ) { throw new IllegalArgumentException ( "Parameter accountName is required and cannot be null." ) ; } if ( assetName == null ) { throw new IllegalArgumentException ( "Parameter assetName is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . listStreamingLocators ( this . client . subscriptionId ( ) , resourceGroupName , accountName , assetName , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < ListStreamingLocatorsResponseInner > > > ( ) { @ Override public Observable < ServiceResponse < ListStreamingLocatorsResponseInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < ListStreamingLocatorsResponseInner > clientResponse = listStreamingLocatorsDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class BusItinerary { @ Override public void revalidate ( ) { } }
// Override this function to be sure that // the invalid and valid collections // has no impact of the iteration on // the elements in this itinerary final BusItineraryHalt [ ] tabV = new BusItineraryHalt [ this . validHalts . size ( ) ] ; this . validHalts . toArray ( tabV ) ; final BusItineraryHalt [ ] tabI = new BusItineraryHalt [ this . invalidHalts . size ( ) ] ; this . invalidHalts . toArray ( tabI ) ; // Revalidate valid halts for ( final BusItineraryHalt halt : tabV ) { assert halt != null ; halt . revalidate ( ) ; } // Revalidate invalid halts for ( final BusItineraryHalt halt : tabI ) { assert halt != null ; halt . revalidate ( ) ; } checkPrimitiveValidity ( ) ;
public class SDBaseOps { /** * Equal to operation : elementwise x = = y < br > * If x and y arrays have equal shape , the output shape is the same as these inputs . < br > * Note : supports broadcasting if x and y have different shapes and are broadcastable . < br > * Returns an array with values 1 where condition is satisfied , or value 0 otherwise . * @ param name Name of the output variable * @ param x Input 1 * @ param y Input 2 * @ return Output SDVariable with values 0 and 1 based on where the condition is satisfied */ public SDVariable eq ( String name , SDVariable x , SDVariable y ) { } }
SDVariable result = f ( ) . eq ( x , y ) ; return updateVariableNameAndReference ( result , name ) ;
public class CPMeasurementUnitLocalServiceBaseImpl { /** * Deletes the cp measurement unit with the primary key from the database . Also notifies the appropriate model listeners . * @ param CPMeasurementUnitId the primary key of the cp measurement unit * @ return the cp measurement unit that was removed * @ throws PortalException if a cp measurement unit with the primary key could not be found */ @ Indexable ( type = IndexableType . DELETE ) @ Override public CPMeasurementUnit deleteCPMeasurementUnit ( long CPMeasurementUnitId ) throws PortalException { } }
return cpMeasurementUnitPersistence . remove ( CPMeasurementUnitId ) ;
public class HybridPersistenceActivator { /** * This method returns a combination of those persistence providers available from * the application classloader in addition to those in the OSGi service registry . * OSGi providers are not cached and should not be cached because bundles can * be moved in and out of the system and it is the job of the the service tracker * to maintain them . */ @ Override public List < PersistenceProvider > getPersistenceProviders ( ) { } }
// try to get the context classloader first , if that fails , use the loader // that loaded this class ClassLoader cl = PrivClassLoader . get ( null ) ; if ( cl == null ) { cl = PrivClassLoader . get ( HybridPersistenceActivator . class ) ; } // Query the provider cache per - classloader List < PersistenceProvider > nonOSGiProviders = providerCache . get ( cl ) ; // Get all providers not registered in OSGi . These will be any third - party providers // available to the application classloader . if ( nonOSGiProviders == null ) { nonOSGiProviders = new ArrayList < PersistenceProvider > ( ) ; try { List < Object > providers = ProviderLocator . getServices ( PersistenceProvider . class . getName ( ) , getClass ( ) , cl ) ; for ( Iterator < Object > provider = providers . iterator ( ) ; provider . hasNext ( ) ; ) { Object o = provider . next ( ) ; if ( o instanceof PersistenceProvider ) { nonOSGiProviders . add ( ( PersistenceProvider ) o ) ; } } // load the providers into the provider cache for the context ( or current ) classloader providerCache . put ( cl , nonOSGiProviders ) ; } catch ( Exception e ) { throw new PersistenceException ( "Failed to load provider from META-INF/services" , e ) ; } } List < PersistenceProvider > combinedProviders = new ArrayList < PersistenceProvider > ( nonOSGiProviders ) ; combinedProviders . addAll ( super . getPersistenceProviders ( ) ) ; return combinedProviders ;
public class WDataTableRenderer { /** * Paint the pagination aspects of the WDataTable . * @ param table the WDataTable being rendered * @ param xml the string builder in use */ private void paintPaginationElement ( final WDataTable table , final XmlStringBuilder xml ) { } }
TableDataModel model = table . getDataModel ( ) ; xml . appendTagOpen ( "ui:pagination" ) ; if ( model instanceof TreeTableDataModel ) { // For tree tables , we only include top - level nodes for pagination . TreeNode firstNode = ( ( TreeTableDataModel ) model ) . getNodeAtLine ( 0 ) ; xml . appendAttribute ( "rows" , firstNode == null ? 0 : firstNode . getParent ( ) . getChildCount ( ) ) ; } else { xml . appendAttribute ( "rows" , model . getRowCount ( ) ) ; } xml . appendAttribute ( "rowsPerPage" , table . getRowsPerPage ( ) ) ; xml . appendAttribute ( "currentPage" , table . getCurrentPage ( ) ) ; switch ( table . getPaginationMode ( ) ) { case CLIENT : xml . appendAttribute ( "mode" , "client" ) ; break ; case DYNAMIC : case SERVER : xml . appendAttribute ( "mode" , "dynamic" ) ; break ; case NONE : break ; default : throw new SystemException ( "Unknown pagination mode: " + table . getPaginationMode ( ) ) ; } xml . appendEnd ( ) ;
public class JdbcCpoAdapter { /** * DOCUMENT ME ! * @ param name DOCUMENT ME ! * @ param criteria DOCUMENT ME ! * @ param result DOCUMENT ME ! * @ param wheres DOCUMENT ME ! * @ param orderBy DOCUMENT ME ! * @ param con DOCUMENT ME ! * @ param useRetrieve DOCUMENT ME ! * @ throws CpoException DOCUMENT ME ! */ protected < T , C > void processSelectGroup ( String name , C criteria , T result , Collection < CpoWhere > wheres , Collection < CpoOrderBy > orderBy , Collection < CpoNativeFunction > nativeExpressions , Connection con , boolean useRetrieve , CpoResultSet < T > resultSet ) throws CpoException { } }
Logger localLogger = criteria == null ? logger : LoggerFactory . getLogger ( criteria . getClass ( ) ) ; PreparedStatement ps = null ; List < CpoFunction > cpoFunctions ; CpoClass criteriaClass ; CpoClass resultClass ; ResultSet rs = null ; ResultSetMetaData rsmd ; int columnCount ; int k ; T obj ; JdbcCpoAttribute [ ] attributes ; JdbcPreparedStatementFactory jpsf ; int i ; if ( criteria == null || result == null ) { throw new CpoException ( "NULL Object passed into retrieveBean or retrieveBeans" ) ; } try { criteriaClass = metaDescriptor . getMetaClass ( criteria ) ; resultClass = metaDescriptor . getMetaClass ( result ) ; if ( useRetrieve ) { localLogger . info ( "=================== Class=<" + criteria . getClass ( ) + "> Type=<" + JdbcCpoAdapter . RETRIEVE_GROUP + "> Name=<" + name + "> =========================" ) ; cpoFunctions = criteriaClass . getFunctionGroup ( JdbcCpoAdapter . RETRIEVE_GROUP , name ) . getFunctions ( ) ; } else { localLogger . info ( "=================== Class=<" + criteria . getClass ( ) + "> Type=<" + JdbcCpoAdapter . LIST_GROUP + "> Name=<" + name + "> =========================" ) ; cpoFunctions = criteriaClass . getFunctionGroup ( JdbcCpoAdapter . LIST_GROUP , name ) . getFunctions ( ) ; } for ( CpoFunction cpoFunction : cpoFunctions ) { jpsf = new JdbcPreparedStatementFactory ( con , this , criteriaClass , cpoFunction , criteria , wheres , orderBy , nativeExpressions ) ; ps = jpsf . getPreparedStatement ( ) ; if ( resultSet . getFetchSize ( ) != - 1 ) { ps . setFetchSize ( resultSet . getFetchSize ( ) ) ; } localLogger . debug ( "Retrieving Records" ) ; rs = ps . executeQuery ( ) ; jpsf . release ( ) ; localLogger . debug ( "Processing Records" ) ; rsmd = rs . getMetaData ( ) ; columnCount = rsmd . getColumnCount ( ) ; attributes = new JdbcCpoAttribute [ columnCount + 1 ] ; for ( k = 1 ; k <= columnCount ; k ++ ) { attributes [ k ] = ( JdbcCpoAttribute ) resultClass . getAttributeData ( rsmd . getColumnLabel ( k ) ) ; } while ( rs . next ( ) ) { try { obj = ( T ) result . getClass ( ) . newInstance ( ) ; } catch ( IllegalAccessException iae ) { localLogger . error ( "=================== Could not access default constructor for Class=<" + result . getClass ( ) + "> ==================" ) ; throw new CpoException ( "Unable to access the constructor of the Return Object" , iae ) ; } catch ( InstantiationException iae ) { throw new CpoException ( "Unable to instantiate Return Object" , iae ) ; } for ( k = 1 ; k <= columnCount ; k ++ ) { if ( attributes [ k ] != null ) { attributes [ k ] . invokeSetter ( obj , new ResultSetCpoData ( JdbcMethodMapper . getMethodMapper ( ) , rs , attributes [ k ] , k ) ) ; } } try { resultSet . put ( obj ) ; } catch ( InterruptedException e ) { localLogger . error ( "Retriever Thread was interrupted" , e ) ; break ; } } resultSetClose ( rs ) ; statementClose ( ps ) ; localLogger . info ( "=================== " + resultSet . size ( ) + " Records - Class=<" + criteria . getClass ( ) + "> Type=<" + JdbcCpoAdapter . LIST_GROUP + "> Name=<" + name + "> Result=<" + result . getClass ( ) + "> ====================" ) ; } } catch ( Throwable t ) { String msg = "ProcessSelectGroup(String name, Object criteria, Object result, CpoWhere where, Collection orderBy, Connection con) failed. Error:" ; localLogger . error ( msg , t ) ; throw new CpoException ( msg , t ) ; } finally { resultSetClose ( rs ) ; statementClose ( ps ) ; }
public class SequenceLabelerME { /** * Returns at most the specified number of taggings for the specified * sentence . * @ param numTaggings * the number of labels to be returned . * @ param tokens * an array of tokens which make up a sentence . * @ return at most the specified number of labels for the specified sentence . */ public Span [ ] [ ] tag ( final int numTaggings , final String [ ] tokens ) { } }
final Sequence [ ] bestSequences = this . model . bestSequences ( numTaggings , tokens , null , this . contextGenerator , this . sequenceValidator ) ; final Span [ ] [ ] tags = new Span [ bestSequences . length ] [ ] ; for ( int i = 0 ; i < tags . length ; i ++ ) { final List < String > c = bestSequences [ i ] . getOutcomes ( ) ; this . contextGenerator . updateAdaptiveData ( tokens , c . toArray ( new String [ c . size ( ) ] ) ) ; final Span [ ] spans = this . seqCodec . decode ( c ) ; tags [ i ] = spans ; } return tags ;
public class ProcessControlHelper { /** * Read in the file containing the location of the java dumps and populate into a map of dump type * to file location * @ param javaDumpLocationFile the file containing the dump locations * @ return a map of java dump action and the corresponding file location or null if we could not successfully read the . dumpedjava file */ public static Map < JavaDumpAction , String > readJavaDumpLocations ( File javaDumpLocationFile ) { } }
Map < JavaDumpAction , String > fileLocations = new EnumMap < JavaDumpAction , String > ( JavaDumpAction . class ) ; BufferedReader reader = null ; try { reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( javaDumpLocationFile ) , "UTF-8" ) ) ; for ( String line ; ( line = reader . readLine ( ) ) != null ; ) { int index = line . indexOf ( '=' ) ; String actionName = line . substring ( 0 , index ) ; String fileName = line . substring ( index + 1 ) . trim ( ) ; fileLocations . put ( JavaDumpAction . valueOf ( actionName ) , fileName ) ; } } catch ( IOException ex ) { return null ; } finally { Utils . tryToClose ( reader ) ; } return fileLocations ;
public class ClassPathImpl { /** * Search list of codebases for named resource . * @ param codeBaseList * list of codebases to search * @ param resourceName * name of resourse * @ return codebase entry for the named resource , or null if the named * resource cannot be found */ private ICodeBaseEntry search ( List < ? extends ICodeBase > codeBaseList , String resourceName ) { } }
for ( ICodeBase codeBase : codeBaseList ) { ICodeBaseEntry resource = codeBase . lookupResource ( resourceName ) ; if ( resource != null ) { return resource ; } // Ignore , continue trying other codebases } return null ;
public class FragmentBuilder { /** * This method returns the state associated with the name and optional * context . * @ param context The optional context * @ param name The name * @ return The state , or null if not found */ public Object getState ( Object context , String name ) { } }
StateInformation si = stateInformation . get ( name ) ; if ( si == null ) { return null ; } return si . get ( context ) ;
public class DocumentSubscriptions { /** * It opens a subscription and starts pulling documents since a last processed document for that subscription . * The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client * needs to acknowledge that batch has been processed . The acknowledgment is sent after all documents are processed by subscription ' s handlers . * There can be only a single client that is connected to a subscription . * @ param clazz Entity class * @ param options Subscription options * @ param < T > Entity class * @ return Subscription object that allows to add / remove subscription handlers . */ public < T > SubscriptionWorker < T > getSubscriptionWorker ( Class < T > clazz , SubscriptionWorkerOptions options ) { } }
return getSubscriptionWorker ( clazz , options , null ) ;
public class ToastJsGenerator { /** * { @ inheritDoc } . */ @ Override protected Map < String , Object > initializeVariables ( final Set < StringTextValue < ? > > allSettings ) { } }
final Map < String , Object > variables = super . initializeVariables ( allSettings ) ; variables . put ( COMMAND , getCommand ( getSettings ( ) ) ) ; return variables ;
public class NetworkInputSettingsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( NetworkInputSettings networkInputSettings , ProtocolMarshaller protocolMarshaller ) { } }
if ( networkInputSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( networkInputSettings . getHlsInputSettings ( ) , HLSINPUTSETTINGS_BINDING ) ; protocolMarshaller . marshall ( networkInputSettings . getServerValidation ( ) , SERVERVALIDATION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DisksInner { /** * Creates or updates a disk . * @ param resourceGroupName The name of the resource group . * @ param diskName The name of the managed disk that is being created . The name can ' t be changed after the disk is created . Supported characters for the name are a - z , A - Z , 0-9 and _ . The maximum name length is 80 characters . * @ param disk Disk object supplied in the body of the Put disk operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the DiskInner object */ public Observable < DiskInner > beginCreateOrUpdateAsync ( String resourceGroupName , String diskName , DiskInner disk ) { } }
return beginCreateOrUpdateWithServiceResponseAsync ( resourceGroupName , diskName , disk ) . map ( new Func1 < ServiceResponse < DiskInner > , DiskInner > ( ) { @ Override public DiskInner call ( ServiceResponse < DiskInner > response ) { return response . body ( ) ; } } ) ;
public class StringUtils { /** * Count stops . * @ param str string * @ return how many stops ' . ' str contains */ public static int countStops ( String str ) { } }
int count = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( str . charAt ( i ) == '.' || str . charAt ( i ) == '?' || str . charAt ( i ) == '!' ) { count ++ ; } } return count ;
public class Operation { /** * This function is used to fixup variables from QNames to stack frame * indexes at stylesheet build time . * @ param vars List of QNames that correspond to variables . This list * should be searched backwards for the first qualified name that * corresponds to the variable reference qname . The position of the * QName in the vector from the start of the vector will be its position * in the stack frame ( but variables above the globalsTop value will need * to be offset to the current stack frame ) . */ public void fixupVariables ( java . util . Vector vars , int globalsSize ) { } }
m_left . fixupVariables ( vars , globalsSize ) ; m_right . fixupVariables ( vars , globalsSize ) ;
public class URIUtils { /** * Returns true if the given character is allowed . * @ param c character to check * @ param allow characters to allow * @ return true if the character is allowed or false if it should be * encoded */ private static boolean isAllowed ( char c , String allow ) { } }
return ( c >= 'A' && c <= 'Z' ) || ( c >= 'a' && c <= 'z' ) || ( c >= '0' && c <= '9' ) || "_-!.~'()*" . indexOf ( c ) != NOT_FOUND || ( allow != null && allow . indexOf ( c ) != NOT_FOUND ) ;
public class MapViewerTemplate { /** * Android Activity life cycle method . * @ param savedInstanceState */ @ Override protected void onCreate ( Bundle savedInstanceState ) { } }
super . onCreate ( savedInstanceState ) ; createSharedPreferences ( ) ; createMapViews ( ) ; createTileCaches ( ) ; checkPermissionsAndCreateLayersAndControls ( ) ;
public class MathBindings { /** * Binding for { @ link java . lang . Math # exp ( double ) } * @ param a the exponent to raise < i > e < / i > to . * @ return the value < i > e < / i > < sup > { @ code a } < / sup > , * where < i > e < / i > is the base of the natural logarithms . */ public static DoubleBinding exp ( final ObservableDoubleValue a ) { } }
return createDoubleBinding ( ( ) -> Math . exp ( a . get ( ) ) , a ) ;
public class Rapids { /** * Parse a list of strings . Strings can be either in single - or in double quotes . */ private AstStrList parseStringList ( ) { } }
ArrayList < String > strs = new ArrayList < > ( 10 ) ; while ( isQuote ( skipWS ( ) ) ) { strs . add ( string ( ) ) ; if ( skipWS ( ) == ',' ) eatChar ( ',' ) ; } return new AstStrList ( strs ) ;
public class WebAppSecurityCollaboratorImpl { /** * Notify the registered listeners of the change to the UserRegistry * configuration . */ private void notifyWebAppSecurityConfigChangeListeners ( List < String > delta ) { } }
WebAppSecurityConfigChangeEvent event = new WebAppSecurityConfigChangeEventImpl ( delta ) ; for ( WebAppSecurityConfigChangeListener listener : webAppSecurityConfigchangeListenerRef . services ( ) ) { listener . notifyWebAppSecurityConfigChanged ( event ) ; }
public class HttpHeaders { /** * @ deprecated Use { @ link # remove ( CharSequence ) } instead . * @ see # removeHeader ( HttpMessage , CharSequence ) */ @ Deprecated public static void removeHeader ( HttpMessage message , String name ) { } }
message . headers ( ) . remove ( name ) ;
public class SecretKeyBackupHelper { /** * Create a { @ link SecretkeyElement } which contains the secret keys listed in { @ code fingerprints } and is encrypted * symmetrically using the { @ code backupCode } . * @ param provider { @ link OpenPgpProvider } for symmetric encryption . * @ param owner owner of the secret keys ( usually our jid ) . * @ param fingerprints set of { @ link OpenPgpV4Fingerprint } s of the keys which are going to be backed up . * @ param backupCode passphrase for symmetric encryption . * @ return { @ link SecretkeyElement } * @ throws PGPException PGP is brittle * @ throws IOException IO is dangerous * @ throws MissingOpenPgpKeyException in case one of the keys whose fingerprint is in { @ code fingerprints } is * not accessible . */ public static SecretkeyElement createSecretkeyElement ( OpenPgpProvider provider , BareJid owner , Set < OpenPgpV4Fingerprint > fingerprints , String backupCode ) throws PGPException , IOException , MissingOpenPgpKeyException { } }
ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; for ( OpenPgpV4Fingerprint fingerprint : fingerprints ) { PGPSecretKeyRing key = provider . getStore ( ) . getSecretKeyRing ( owner , fingerprint ) ; if ( key == null ) { throw new MissingOpenPgpKeyException ( owner , fingerprint ) ; } byte [ ] bytes = key . getEncoded ( ) ; buffer . write ( bytes ) ; } return createSecretkeyElement ( buffer . toByteArray ( ) , backupCode ) ;
public class DBUtils { /** * This method returns approapiate query clauses to be executed within a SQL * statement . * @ param params * the list of parameters - name value * @ param orderParams * the name of the parameters that will be used to sort the * result and also the sorting order . Each entry will be ( column , * sortingOrder ) . * @ return the where and order by clause for a SQL statement */ private String getQueryClauses ( final Map < String , Object > params , final Map < String , Object > orderParams ) { } }
final StringBuffer queryString = new StringBuffer ( ) ; if ( ( params != null ) && ! params . isEmpty ( ) ) { queryString . append ( " where " ) ; for ( final Iterator < Map . Entry < String , Object > > it = params . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { final Map . Entry < String , Object > entry = it . next ( ) ; if ( entry . getValue ( ) instanceof Boolean ) { queryString . append ( entry . getKey ( ) ) . append ( " is " ) . append ( entry . getValue ( ) ) . append ( " " ) ; } else { if ( entry . getValue ( ) instanceof Number ) { queryString . append ( entry . getKey ( ) ) . append ( " = " ) . append ( entry . getValue ( ) ) ; } else { // string equality queryString . append ( entry . getKey ( ) ) . append ( " = '" ) . append ( entry . getValue ( ) ) . append ( "'" ) ; } } if ( it . hasNext ( ) ) { queryString . append ( " and " ) ; } } } if ( ( orderParams != null ) && ! orderParams . isEmpty ( ) ) { queryString . append ( " order by " ) ; for ( final Iterator < Map . Entry < String , Object > > it = orderParams . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { final Map . Entry < String , Object > entry = it . next ( ) ; queryString . append ( entry . getKey ( ) ) . append ( " " ) ; if ( entry . getValue ( ) != null ) { queryString . append ( entry . getValue ( ) ) ; } if ( it . hasNext ( ) ) { queryString . append ( ", " ) ; } } } return queryString . toString ( ) ;
public class Controller { /** * Convenience method for { @ link # redirect ( Class , java . util . Map ) } . * @ param controllerClass controller class where to send redirect . * @ param < T > class extending { @ link Controller } * @ param action action to redirect to . * @ param id id to redirect to . * @ return { @ link HttpSupport . HttpBuilder } , to accept additional information . */ protected < T extends Controller > void redirect ( Class < T > controllerClass , String action , Object id ) { } }
redirect ( controllerClass , CollectionUtil . map ( "action" , action , "id" , id ) ) ;
public class ZookeeperDriverImpl { /** * 通知某个Node更新 * @ param app * @ param env * @ param version * @ param disConfigTypeEnum */ @ Override public void notifyNodeUpdate ( String app , String env , String version , String key , String value , DisConfigTypeEnum disConfigTypeEnum ) { } }
// 获取路径 String baseUrlString = ZooPathMgr . getZooBaseUrl ( zooConfig . getZookeeperUrlPrefix ( ) , app , env , version ) ; String path = "" ; if ( disConfigTypeEnum . equals ( DisConfigTypeEnum . ITEM ) ) { path = ZooPathMgr . getItemZooPath ( baseUrlString ) ; } else { path = ZooPathMgr . getFileZooPath ( baseUrlString ) ; } try { path = ZooPathMgr . joinPath ( path , key ) ; boolean isExist = ZookeeperMgr . getInstance ( ) . exists ( path ) ; if ( ! isExist ) { LOG . info ( path + " not exist. not update ZK." ) ; } else { // 通知 ZookeeperMgr . getInstance ( ) . writePersistentUrl ( path , value ) ; } } catch ( Exception e ) { LOG . error ( e . toString ( ) , e ) ; throw new RemoteException ( "zk.notify.error" , e ) ; }
public class BigDecimalParameter { /** * Write data to socket in binary format . * @ param pos socket output stream * @ throws IOException if socket error occur */ public void writeBinary ( PacketOutputStream pos ) throws IOException { } }
String value = bigDecimal . toPlainString ( ) ; pos . writeFieldLength ( value . length ( ) ) ; pos . write ( value ) ;
public class CommercePriceListUtil { /** * Returns the last commerce price list in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; . * @ param uuid the uuid * @ param companyId the company ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce price list , or < code > null < / code > if a matching commerce price list could not be found */ public static CommercePriceList fetchByUuid_C_Last ( String uuid , long companyId , OrderByComparator < CommercePriceList > orderByComparator ) { } }
return getPersistence ( ) . fetchByUuid_C_Last ( uuid , companyId , orderByComparator ) ;
public class SequenceGibbsSampler { /** * Samples a single position in the sequence . * Destructively modifies the sequence in place . * returns the score of the new sequence * @ param sequence the sequence to start with * @ param pos the position to sample . */ public double samplePosition ( SequenceModel model , int [ ] sequence , int pos , double temperature ) { } }
double [ ] distribution = model . scoresOf ( sequence , pos ) ; if ( temperature != 1.0 ) { if ( temperature == 0.0 ) { // set the max to 1.0 int argmax = ArrayMath . argmax ( distribution ) ; Arrays . fill ( distribution , Double . NEGATIVE_INFINITY ) ; distribution [ argmax ] = 0.0 ; } else { // take all to a power // use the temperature to increase / decrease the entropy of the sampling distribution ArrayMath . multiplyInPlace ( distribution , 1.0 / temperature ) ; } } ArrayMath . logNormalize ( distribution ) ; ArrayMath . expInPlace ( distribution ) ; int oldTag = sequence [ pos ] ; int newTag = ArrayMath . sampleFromDistribution ( distribution , random ) ; // System . out . println ( " Sampled " + oldTag + " - > " + newTag ) ; sequence [ pos ] = newTag ; listener . updateSequenceElement ( sequence , pos , oldTag ) ; return distribution [ newTag ] ;
public class DirectoryLoaderAdaptor { /** * ContainsKey implementation for chunk elements */ protected Boolean containsKeyIntern ( final FileCacheKey fileCacheKey ) throws IOException { } }
for ( String file : directory . listAll ( ) ) { if ( file . equals ( fileCacheKey . getFileName ( ) ) ) { return true ; } } return false ;
public class ExtensionValidator { /** * { @ inheritDoc } */ @ Override public void validate ( ValidationHelper helper , Context context , String key , Object t ) { } }
if ( key != null ) { if ( ! key . startsWith ( "x-" ) ) { final String message = Tr . formatMessage ( tc , "invalidExtensionName" , key ) ; helper . addValidationEvent ( new ValidationEvent ( ValidationEvent . Severity . ERROR , context . getLocation ( ) , message ) ) ; } }
public class CollUtil { /** * 根据Bean的属性排序 * @ param < T > 元素类型 * @ param list List * @ param property 属性名 * @ return 排序后的List * @ since 4.0.6 */ public static < T > List < T > sortByProperty ( List < T > list , String property ) { } }
return sort ( list , new PropertyComparator < > ( property ) ) ;
public class HtmlEmailImpl { /** * Set the message . * This method overrides the MultiPartEmail setMsg ( ) method in order to send an HTML message instead * of a full text message in the mail body . The message is formatted in HTML for the HTML part of * the message , it is let as is in the alternate text part . * @ param msg A String . * @ return An Email . * @ throws EmailException see javax . mail . internet . MimeBodyPart for definitions */ @ Override public Email setMsg ( String msg ) throws EmailException { } }
if ( StringUtil . isEmpty ( msg ) ) { throw new EmailException ( "Invalid message supplied" ) ; } setTextMsg ( msg ) ; setHtmlMsg ( new StringBuffer ( ) . append ( "<html><body><pre>" ) . append ( msg ) . append ( "</pre></body></html>" ) . toString ( ) ) ; return this ;
public class JMStats { /** * https : / / en . wikipedia . org / wiki / Algorithms _ for _ calculating _ variance # cite _ note - : 0-10 */ public static double calPairwiseVariance ( long count1 , double sum1 , double variance1 , long count2 , double sum2 , double variance2 ) { } }
return ( variance1 * ( count1 - 1 ) + variance2 * ( count2 - 1 ) + pow ( sum2 / count2 - sum1 / count1 , 2 ) * count1 * count2 / ( count1 + count2 ) ) / ( count1 + count2 - 1 ) ;
public class EnvironmentResourceDescription { /** * The < code > AutoScalingGroups < / code > used by this environment . * @ param autoScalingGroups * The < code > AutoScalingGroups < / code > used by this environment . */ public void setAutoScalingGroups ( java . util . Collection < AutoScalingGroup > autoScalingGroups ) { } }
if ( autoScalingGroups == null ) { this . autoScalingGroups = null ; return ; } this . autoScalingGroups = new com . amazonaws . internal . SdkInternalList < AutoScalingGroup > ( autoScalingGroups ) ;
public class JobSummaryMarshaller { /** * Marshall the given parameter object . */ public void marshall ( JobSummary jobSummary , ProtocolMarshaller protocolMarshaller ) { } }
if ( jobSummary == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( jobSummary . getJobArn ( ) , JOBARN_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getJobId ( ) , JOBID_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getCommitId ( ) , COMMITID_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getCommitMessage ( ) , COMMITMESSAGE_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getCommitTime ( ) , COMMITTIME_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getStartTime ( ) , STARTTIME_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getEndTime ( ) , ENDTIME_BINDING ) ; protocolMarshaller . marshall ( jobSummary . getJobType ( ) , JOBTYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class math { /** * Get a random position ( object ) from an array of generic objects . < br / > * Using generics saves the trouble of casting the return object . * @ param < T > * the type of the array to get the object from * @ param array * the array with objects * @ return random object from given array or null of array is either null or * empty */ public static < T > T getRandomPosition ( T [ ] array ) { } }
if ( array == null || array . length == 0 ) { return null ; } return array [ getRandomInteger ( array . length - 1 ) ] ;
public class FnShort { /** * Determines whether the target object and the specified object are equal * by calling the < tt > equals < / tt > method on the target object . * @ param object the { @ link Short } to compare to the target * @ return true if both objects are equal , false if not . */ public static final Function < Short , Boolean > eq ( final Short object ) { } }
return ( Function < Short , Boolean > ) ( ( Function ) FnObject . eq ( object ) ) ;
public class DBService { /** * Return true if the given store name is a system table , aka metadata table . System * tables store column values as strings . All other tables use binary column values . * @ param storeName Store name to test . * @ return True if the store name is a system table . */ public static boolean isSystemTable ( String storeName ) { } }
return storeName . equals ( SchemaService . APPS_STORE_NAME ) || storeName . equals ( TaskManagerService . TASKS_STORE_NAME ) || storeName . equals ( TenantService . TENANTS_STORE_NAME ) ;
public class Finishables { /** * If the provided object is { @ link Finishable } , calls { @ link Finishable # finish ( ) } . If an * exception is thrown , it is logged and not propagated . */ public static void finishIfApplicableAndLogException ( Object toFinish ) { } }
try { finishIfApplicable ( ImmutableList . of ( toFinish ) ) ; } catch ( Exception e ) { log . info ( "Exception while finishing {}: {}" , toFinish , e ) ; }
public class StringUtils { /** * 对象数组转string * @ param args 对象 * @ return 不为null执行toString方法 * @ since 5.4.0 */ public static String objectsToString ( Object [ ] args ) { } }
if ( args == null ) { return null ; } else if ( args . length == 0 ) { return "[]" ; } else { StringBuilder sb = new StringBuilder ( ) . append ( "[" ) ; for ( Object arg : args ) { sb . append ( arg . toString ( ) ) . append ( "," ) ; } sb . setCharAt ( sb . length ( ) - 1 , ']' ) ; return sb . toString ( ) ; }
public class CDIContainerImpl { /** * Create BDAs for all runtime extensions that cannot see application bdas * @ param applicationContext * @ return * @ throws CDIException */ private Set < WebSphereBeanDeploymentArchive > createExtensionBDAs ( WebSphereCDIDeployment applicationContext ) throws CDIException { } }
Set < WebSphereBeanDeploymentArchive > extensionBdas = new HashSet < WebSphereBeanDeploymentArchive > ( ) ; Set < ExtensionArchive > extensions = getExtensionArchives ( ) ; if ( extensions != null ) { for ( ExtensionArchive extArchive : extensions ) { WebSphereBeanDeploymentArchive moduleCDIContext = BDAFactory . createBDA ( applicationContext , extArchive , cdiRuntime ) ; extensionBdas . add ( moduleCDIContext ) ; } } return extensionBdas ;
public class AbstractMetricsRunnable { /** * Handles exceptions either by logging and swalling or by rethrowing as * { @ code RuntimeException } depending on the value of { @ code _ swallowException } . * @ param e An instance of < code > Exception < / code > . */ protected void handleException ( final Exception e ) { } }
if ( _swallowException ) { _logger . warn ( "Metrics collection failed." , e ) ; } else { if ( e instanceof RuntimeException ) { throw ( RuntimeException ) e ; } else { throw new RuntimeException ( e ) ; } }
public class XmlParserBase { /** * Compose a resource to a stream , possibly using pretty presentation for a human reader , and maybe a different choice in the xhtml narrative ( used in the spec in one place , but should not be used in production ) */ public void compose ( OutputStream stream , Resource resource , boolean htmlPretty ) throws IOException { } }
XMLWriter writer = new XMLWriter ( stream , "UTF-8" ) ; writer . setPretty ( style == OutputStyle . PRETTY ) ; writer . start ( ) ; compose ( writer , resource , htmlPretty ) ; writer . end ( ) ;
public class HttpOutputStreamImpl { /** * Sets an observer for this output stream . The observer will be * notified when the stream is first written to . */ @ Override public void setObserver ( HttpOutputStreamObserver obs ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "obs ->" + obs ) ; } this . obs = obs ;
public class GreenPepperServerServiceImpl { /** * { @ inheritDoc } */ public Specification createSpecification ( Specification specification ) throws GreenPepperServerException { } }
try { sessionService . startSession ( ) ; sessionService . beginTransaction ( ) ; Repository repository = loadRepository ( specification . getRepository ( ) . getUid ( ) ) ; Specification specificationDb = documentDao . createSpecification ( null , specification . getRepository ( ) . getUid ( ) , specification . getName ( ) ) ; sessionService . commitTransaction ( ) ; log . debug ( "Created Specification: " + specification . getName ( ) ) ; return specificationDb ; } catch ( Exception ex ) { sessionService . rollbackTransaction ( ) ; throw handleException ( SPECIFICATION_CREATE_FAILED , ex ) ; } finally { sessionService . closeSession ( ) ; }
public class CmsMessageBundleEditorModel { /** * Saves the current translations from the container to the respective localization . */ private void saveLocalization ( ) { } }
SortedProperties localization = new SortedProperties ( ) ; for ( Object itemId : m_container . getItemIds ( ) ) { Item item = m_container . getItem ( itemId ) ; String key = item . getItemProperty ( TableProperty . KEY ) . getValue ( ) . toString ( ) ; String value = item . getItemProperty ( TableProperty . TRANSLATION ) . getValue ( ) . toString ( ) ; if ( ! ( key . isEmpty ( ) || value . isEmpty ( ) ) ) { localization . put ( key , value ) ; } } m_keyset . updateKeySet ( m_localizations . get ( m_locale ) . keySet ( ) , localization . keySet ( ) ) ; m_localizations . put ( m_locale , localization ) ;
public class PostgreSqlExceptionTranslator { /** * Package private for testability * @ param pSqlException PostgreSQL exception * @ return translated validation exception */ MolgenisValidationException translateCheckConstraintViolation ( PSQLException pSqlException ) { } }
ServerErrorMessage serverErrorMessage = pSqlException . getServerErrorMessage ( ) ; String tableName = serverErrorMessage . getTable ( ) ; String constraintName = serverErrorMessage . getConstraint ( ) ; // constraint name : < tableName > _ < columnName > _ chk String columnName = constraintName . substring ( tableName . length ( ) + 1 , constraintName . length ( ) - 4 ) ; ConstraintViolation constraintViolation = new ConstraintViolation ( format ( "Unknown enum value for attribute '%s' of entity '%s'." , tryGetAttributeName ( tableName , columnName ) . orElse ( TOKEN_UNKNOWN ) , tryGetEntityTypeName ( tableName ) . orElse ( TOKEN_UNKNOWN ) ) , null ) ; return new MolgenisValidationException ( singleton ( constraintViolation ) ) ;
public class SparseDoubleArray { /** * Divides the specified value to the index by the provided value and stores * the result at the index ( just as { @ code array [ index ] / = value } ) * @ param index the position in the array * @ param value the value by which the value at the index will be divided * @ return the new value stored at the index */ public double dividePrimitive ( int index , double value ) { } }
if ( index < 0 || index >= maxLength ) throw new ArrayIndexOutOfBoundsException ( "invalid index: " + index ) ; int pos = Arrays . binarySearch ( indices , index ) ; // The divide operation is dividing a non - existent value in the // array , which is always 0 , so the corresponding result is 0. // Therefore , we don ' t need to make room . if ( pos < 0 ) return 0 ; else { double newValue = values [ pos ] / value ; // The new value is zero , so remove its position and shift // everything over if ( newValue == 0 ) { int newLength = indices . length - 1 ; int [ ] newIndices = new int [ newLength ] ; double [ ] newValues = new double [ newLength ] ; for ( int i = 0 , j = 0 ; i < indices . length ; ++ i ) { if ( i != pos ) { newIndices [ j ] = indices [ i ] ; newValues [ j ] = values [ i ] ; j ++ ; } } // swap the arrays indices = newIndices ; values = newValues ; } // Otherwise , the new value is still non - zero , so update it in the // array else values [ pos ] = newValue ; return newValue ; }
public class GlobalConfiguration { /** * Loads the configuration files from the specified directory . * XML and YAML are supported as configuration files . If both XML and YAML files exist in the configuration * directory , keys from YAML will overwrite keys from XML . * @ param configDir * the directory which contains the configuration files */ public static void loadConfiguration ( final String configDir ) { } }
if ( configDir == null ) { LOG . warn ( "Given configuration directory is null, cannot load configuration" ) ; return ; } final File confDirFile = new File ( configDir ) ; if ( ! ( confDirFile . exists ( ) ) ) { LOG . warn ( "The given configuration directory name '" + configDir + "' (" + confDirFile . getAbsolutePath ( ) + ") does not describe an existing directory." ) ; return ; } if ( confDirFile . isFile ( ) ) { final File file = new File ( configDir ) ; if ( configDir . endsWith ( ".xml" ) ) { get ( ) . loadXMLResource ( file ) ; } else if ( configDir . endsWith ( ".yaml" ) ) { get ( ) . loadYAMLResource ( file ) ; } else { LOG . warn ( "The given configuration has an unknown extension." ) ; return ; } configuration . confData . put ( CONFIGDIRKEY , file . getAbsolutePath ( ) ) ; return ; } // get all XML and YAML files in the directory final File [ ] xmlFiles = filterFilesBySuffix ( confDirFile , ".xml" ) ; final File [ ] yamlFiles = filterFilesBySuffix ( confDirFile , new String [ ] { ".yaml" , ".yml" } ) ; if ( ( xmlFiles == null || xmlFiles . length == 0 ) && ( yamlFiles == null || yamlFiles . length == 0 ) ) { LOG . warn ( "Unable to get the contents of the config directory '" + configDir + "' (" + confDirFile . getAbsolutePath ( ) + ")." ) ; return ; } // load config files and write into config map for ( File f : xmlFiles ) { get ( ) . loadXMLResource ( f ) ; } // = > if both XML and YAML files exist , the YAML config keys overwrite XML settings for ( File f : yamlFiles ) { get ( ) . loadYAMLResource ( f ) ; } // Store the path to the configuration directory itself if ( configuration != null ) { configuration . confData . put ( CONFIGDIRKEY , configDir ) ; }
public class DescribeAccountAttributesResult { /** * A list of attributes assigned to an account . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setAccountAttributes ( java . util . Collection ) } or { @ link # withAccountAttributes ( java . util . Collection ) } if * you want to override the existing values . * @ param accountAttributes * A list of attributes assigned to an account . * @ return Returns a reference to this object so that method calls can be chained together . */ public DescribeAccountAttributesResult withAccountAttributes ( AccountAttribute ... accountAttributes ) { } }
if ( this . accountAttributes == null ) { setAccountAttributes ( new com . amazonaws . internal . SdkInternalList < AccountAttribute > ( accountAttributes . length ) ) ; } for ( AccountAttribute ele : accountAttributes ) { this . accountAttributes . add ( ele ) ; } return this ;
public class SubscriptionSchedule { /** * Releases the subscription schedule immediately , which will stop scheduling of its phases , but * leave any existing subscription in place . A schedule can only be released if its status is * < code > not _ started < / code > or < code > active < / code > . If the subscription schedule is currently * associated with a subscription , releasing it will remove its < code > subscription < / code > property * and set the subscription ’ s ID to the < code > released _ subscription < / code > property . */ public SubscriptionSchedule release ( ) throws StripeException { } }
return release ( ( Map < String , Object > ) null , ( RequestOptions ) null ) ;
public class Graphics { /** * Rotate a file a given number of degrees * @ param input input image file * @ param output the output image fiel * @ param format the format ( png , jpg , gif , etc . ) * @ param degrees angle to rotote * @ throws IOException */ public static void rotateImage ( File input , File output , String format , int degrees ) throws IOException { } }
BufferedImage inputImage = ImageIO . read ( input ) ; Graphics2D g = ( Graphics2D ) inputImage . getGraphics ( ) ; g . drawImage ( inputImage , 0 , 0 , null ) ; AffineTransform at = new AffineTransform ( ) ; // scale image // at . scale ( 2.0 , 2.0 ) ; // rotate 45 degrees around image center at . rotate ( degrees * Math . PI / 180.0 , inputImage . getWidth ( ) / 2.0 , inputImage . getHeight ( ) / 2.0 ) ; // at . rotate ( Math . toRadians ( degrees ) , inputImage . getWidth ( ) / 2.0 , inputImage . getHeight ( ) / 2.0 ) ; /* * translate to make sure the rotation doesn ' t cut off any image data */ AffineTransform translationTransform ; translationTransform = findTranslation ( at , inputImage ) ; at . preConcatenate ( translationTransform ) ; // instantiate and apply transformation filter BufferedImageOp bio = new AffineTransformOp ( at , AffineTransformOp . TYPE_BILINEAR ) ; BufferedImage destinationBI = bio . filter ( inputImage , null ) ; ImageIO . write ( destinationBI , format , output ) ;
public class HtmlBuilder { /** * Simple element . * @ param element Tag name * @ param id Element Id * @ param cssClass CSS class name */ public T element ( String element , String id , String cssClass ) throws IOException { } }
doBegin ( element , id , cssClass ) ; writer . write ( " />" ) ; return ( T ) this ;
public class CmsSetupDb { /** * Calls the create database script for the given database . < p > * @ param database the name of the database * @ param replacer the replacements to perform in the drop script */ public void createDatabase ( String database , Map < String , String > replacer ) { } }
m_errorLogging = true ; executeSql ( database , "create_db.sql" , replacer , true ) ;