repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDLoss.java
SDLoss.softmaxCrossEntropy
public SDVariable softmaxCrossEntropy(String name, @NonNull SDVariable label, @NonNull SDVariable predictions, @NonNull LossReduce lossReduce) { return softmaxCrossEntropy(name, label, predictions, null, lossReduce, SoftmaxCrossEntropyLoss.DEFAULT_LABEL_SMOOTHING); }
java
public SDVariable softmaxCrossEntropy(String name, @NonNull SDVariable label, @NonNull SDVariable predictions, @NonNull LossReduce lossReduce) { return softmaxCrossEntropy(name, label, predictions, null, lossReduce, SoftmaxCrossEntropyLoss.DEFAULT_LABEL_SMOOTHING); }
[ "public", "SDVariable", "softmaxCrossEntropy", "(", "String", "name", ",", "@", "NonNull", "SDVariable", "label", ",", "@", "NonNull", "SDVariable", "predictions", ",", "@", "NonNull", "LossReduce", "lossReduce", ")", "{", "return", "softmaxCrossEntropy", "(", "na...
See {@link #softmaxCrossEntropy(String, SDVariable, SDVariable, SDVariable, LossReduce, double)}.
[ "See", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDLoss.java#L479-L481
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPOutputHandler.java
PtoPOutputHandler.sendNotFlushedMessage
public void sendNotFlushedMessage(SIBUuid8 ignore, SIBUuid12 streamID, long requestID) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "sendNotFlushedMessage", new Object[]{ignore, streamID, new Long(requestID)}); ControlNotFlushed notFlushed = createControlNotFlushed(streamID, requestID); notFlushed = sourceStreamManager.stampNotFlushed(notFlushed); // If the destination in a Link add Link specific properties to message if( isLink ) { notFlushed = (ControlNotFlushed)addLinkProps(notFlushed); // The following is set so we can create the linkReceiver correctly on the // other side of the link - 499581 notFlushed.setRoutingDestination(routingDestination); } else if( this.isSystemOrTemp ) { // If the destination is system or temporary then the // routingDestination into th message notFlushed.setRoutingDestination(routingDestination); } mpio.sendToMe(routingMEUuid, SIMPConstants.MSG_HIGH_PRIORITY, notFlushed); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendNotFlushedMessage"); }
java
public void sendNotFlushedMessage(SIBUuid8 ignore, SIBUuid12 streamID, long requestID) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "sendNotFlushedMessage", new Object[]{ignore, streamID, new Long(requestID)}); ControlNotFlushed notFlushed = createControlNotFlushed(streamID, requestID); notFlushed = sourceStreamManager.stampNotFlushed(notFlushed); // If the destination in a Link add Link specific properties to message if( isLink ) { notFlushed = (ControlNotFlushed)addLinkProps(notFlushed); // The following is set so we can create the linkReceiver correctly on the // other side of the link - 499581 notFlushed.setRoutingDestination(routingDestination); } else if( this.isSystemOrTemp ) { // If the destination is system or temporary then the // routingDestination into th message notFlushed.setRoutingDestination(routingDestination); } mpio.sendToMe(routingMEUuid, SIMPConstants.MSG_HIGH_PRIORITY, notFlushed); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendNotFlushedMessage"); }
[ "public", "void", "sendNotFlushedMessage", "(", "SIBUuid8", "ignore", ",", "SIBUuid12", "streamID", ",", "long", "requestID", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEna...
/* (non-Javadoc) @see com.ibm.ws.sib.processor.impl.interfaces.DownstreamControl#sendNotFlushedMessage(com.ibm.ws.sib.utils.SIBUuid12) Sends an 'I am not flushed' message in response to a query from a target
[ "/", "*", "(", "non", "-", "Javadoc", ")", "@see", "com", ".", "ibm", ".", "ws", ".", "sib", ".", "processor", ".", "impl", ".", "interfaces", ".", "DownstreamControl#sendNotFlushedMessage", "(", "com", ".", "ibm", ".", "ws", ".", "sib", ".", "utils", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPOutputHandler.java#L1938-L1966
roboconf/roboconf-platform
miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ApplicationWsDelegate.java
ApplicationWsDelegate.bindApplication
public void bindApplication( String applicationName, String boundTplName, String boundApp ) throws ApplicationWsException { this.logger.finer( "Creating a binding for external exports in " + applicationName + "..." ); WebResource path = this.resource.path( UrlConstants.APP ) .path( applicationName ).path( "bind" ) .queryParam( "bound-tpl", boundTplName ) .queryParam( "bound-app", boundApp ); ClientResponse response = this.wsClient.createBuilder( path ).post( ClientResponse.class ); handleResponse( response ); }
java
public void bindApplication( String applicationName, String boundTplName, String boundApp ) throws ApplicationWsException { this.logger.finer( "Creating a binding for external exports in " + applicationName + "..." ); WebResource path = this.resource.path( UrlConstants.APP ) .path( applicationName ).path( "bind" ) .queryParam( "bound-tpl", boundTplName ) .queryParam( "bound-app", boundApp ); ClientResponse response = this.wsClient.createBuilder( path ).post( ClientResponse.class ); handleResponse( response ); }
[ "public", "void", "bindApplication", "(", "String", "applicationName", ",", "String", "boundTplName", ",", "String", "boundApp", ")", "throws", "ApplicationWsException", "{", "this", ".", "logger", ".", "finer", "(", "\"Creating a binding for external exports in \"", "+...
Binds an application for external exports. @param applicationName the application name @param boundTplName the template name (no qualifier as it does not make sense for external exports) @param boundApp the name of the application (instance of <code>tplName</code>) @throws ApplicationWsException if something went wrong
[ "Binds", "an", "application", "for", "external", "exports", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-dm-rest-client/src/main/java/net/roboconf/dm/rest/client/delegates/ApplicationWsDelegate.java#L380-L392
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINKHDBSCANLinearMemory.java
SLINKHDBSCANLinearMemory.step4
private void step4(DBIDRef id, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, DBIDs processedIDs) { DBIDVar p_i = DBIDUtil.newVar(); // for i = 1..n for(DBIDIter it = processedIDs.iter(); it.valid(); it.advance()) { double l_i = lambda.doubleValue(it); pi.assignVar(it, p_i); // p_i = pi(it) double lp_i = lambda.doubleValue(p_i); // if L(i) >= L(P(i)) if(l_i >= lp_i) { // P(i) = n+1 pi.put(it, id); } } }
java
private void step4(DBIDRef id, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, DBIDs processedIDs) { DBIDVar p_i = DBIDUtil.newVar(); // for i = 1..n for(DBIDIter it = processedIDs.iter(); it.valid(); it.advance()) { double l_i = lambda.doubleValue(it); pi.assignVar(it, p_i); // p_i = pi(it) double lp_i = lambda.doubleValue(p_i); // if L(i) >= L(P(i)) if(l_i >= lp_i) { // P(i) = n+1 pi.put(it, id); } } }
[ "private", "void", "step4", "(", "DBIDRef", "id", ",", "WritableDBIDDataStore", "pi", ",", "WritableDoubleDataStore", "lambda", ",", "DBIDs", "processedIDs", ")", "{", "DBIDVar", "p_i", "=", "DBIDUtil", ".", "newVar", "(", ")", ";", "// for i = 1..n", "for", "...
Fourth step: Actualize the clusters if necessary @param id the id of the current object @param pi Pi data store @param lambda Lambda data store @param processedIDs the already processed ids
[ "Fourth", "step", ":", "Actualize", "the", "clusters", "if", "necessary" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/SLINKHDBSCANLinearMemory.java#L215-L229
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java
JPAUtils.copyFetches
public static void copyFetches(Fetch<?, ?> from, Fetch<?, ?> to) { for (Fetch<?, ?> f : from.getFetches()) { Fetch<?, ?> toFetch = to.fetch(f.getAttribute().getName()); // recursively copy fetches copyFetches(f, toFetch); } }
java
public static void copyFetches(Fetch<?, ?> from, Fetch<?, ?> to) { for (Fetch<?, ?> f : from.getFetches()) { Fetch<?, ?> toFetch = to.fetch(f.getAttribute().getName()); // recursively copy fetches copyFetches(f, toFetch); } }
[ "public", "static", "void", "copyFetches", "(", "Fetch", "<", "?", ",", "?", ">", "from", ",", "Fetch", "<", "?", ",", "?", ">", "to", ")", "{", "for", "(", "Fetch", "<", "?", ",", "?", ">", "f", ":", "from", ".", "getFetches", "(", ")", ")",...
Copy Fetches @param from source Fetch @param to dest Fetch
[ "Copy", "Fetches" ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java#L302-L308
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.createOccurrence
public final Occurrence createOccurrence(ProjectName parent, Occurrence occurrence) { CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setOccurrence(occurrence) .build(); return createOccurrence(request); }
java
public final Occurrence createOccurrence(ProjectName parent, Occurrence occurrence) { CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setOccurrence(occurrence) .build(); return createOccurrence(request); }
[ "public", "final", "Occurrence", "createOccurrence", "(", "ProjectName", "parent", ",", "Occurrence", "occurrence", ")", "{", "CreateOccurrenceRequest", "request", "=", "CreateOccurrenceRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "n...
Creates a new occurrence. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); Occurrence occurrence = Occurrence.newBuilder().build(); Occurrence response = grafeasV1Beta1Client.createOccurrence(parent, occurrence); } </code></pre> @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the occurrence is to be created. @param occurrence The occurrence to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "occurrence", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L542-L550
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DCEventSource.java
DCEventSource.shouldInvalidate
public boolean shouldInvalidate (Object id, int sourceOfInvalidation, int causeOfInvalidation) { boolean retVal = true; if (preInvalidationListenerCount > 0) { // In external implementation, catch any exceptions and process try { retVal = currentPreInvalidationListener.shouldInvalidate(id, sourceOfInvalidation, causeOfInvalidation); } catch (Throwable t) { com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.DCEventSource.shouldInvalidate", "120", this); if (tc.isDebugEnabled()) { Tr.debug(tc, "Exception thrown in shouldInvalidate method of PreInvalidationListener\n" + t.toString()); } } } return retVal; //invalidate }
java
public boolean shouldInvalidate (Object id, int sourceOfInvalidation, int causeOfInvalidation) { boolean retVal = true; if (preInvalidationListenerCount > 0) { // In external implementation, catch any exceptions and process try { retVal = currentPreInvalidationListener.shouldInvalidate(id, sourceOfInvalidation, causeOfInvalidation); } catch (Throwable t) { com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.DCEventSource.shouldInvalidate", "120", this); if (tc.isDebugEnabled()) { Tr.debug(tc, "Exception thrown in shouldInvalidate method of PreInvalidationListener\n" + t.toString()); } } } return retVal; //invalidate }
[ "public", "boolean", "shouldInvalidate", "(", "Object", "id", ",", "int", "sourceOfInvalidation", ",", "int", "causeOfInvalidation", ")", "{", "boolean", "retVal", "=", "true", ";", "if", "(", "preInvalidationListenerCount", ">", "0", ")", "{", "// In external imp...
The listeners are called when the preInvalidate method is invoked. @param event The invalidation event to be pre-invalidated.
[ "The", "listeners", "are", "called", "when", "the", "preInvalidate", "method", "is", "invoked", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DCEventSource.java#L148-L164
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ws/ffdc/DiagnosticModule.java
DiagnosticModule.invokeDiagnosticMethod
private final void invokeDiagnosticMethod(Method m, Throwable ex, IncidentStream ffdcis, Object callerThis, Object[] catcherObjects, String sourceId) { try { m.invoke(this, new Object[] { ex, ffdcis, callerThis, catcherObjects, sourceId }); ffdcis.writeLine("+ Data for directive [" + m.getName().substring(FFDC_DUMP_PREFIX.length()) + "] obtained.", ""); } catch (Throwable t) { ffdcis.writeLine("Error while processing directive [" + m.getName().substring(FFDC_DUMP_PREFIX.length()) + "] !!!", t); } }
java
private final void invokeDiagnosticMethod(Method m, Throwable ex, IncidentStream ffdcis, Object callerThis, Object[] catcherObjects, String sourceId) { try { m.invoke(this, new Object[] { ex, ffdcis, callerThis, catcherObjects, sourceId }); ffdcis.writeLine("+ Data for directive [" + m.getName().substring(FFDC_DUMP_PREFIX.length()) + "] obtained.", ""); } catch (Throwable t) { ffdcis.writeLine("Error while processing directive [" + m.getName().substring(FFDC_DUMP_PREFIX.length()) + "] !!!", t); } }
[ "private", "final", "void", "invokeDiagnosticMethod", "(", "Method", "m", ",", "Throwable", "ex", ",", "IncidentStream", "ffdcis", ",", "Object", "callerThis", ",", "Object", "[", "]", "catcherObjects", ",", "String", "sourceId", ")", "{", "try", "{", "m", "...
Invoke dump method @param m The method to be invoked @param ex The exception causing the incident @param ffdcis The incident stream on which to report @param callerThis The object reporting the incident @param catcherObjects Any additional interesting objects @param sourceId The sourceid of the class reporting the problem
[ "Invoke", "dump", "method" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/ffdc/DiagnosticModule.java#L267-L275
lucee/Lucee
core/src/main/java/lucee/runtime/config/ConfigImpl.java
ConfigImpl.setTempDirectory
protected void setTempDirectory(String strTempDirectory, boolean flush) throws ExpressionException { setTempDirectory(resources.getResource(strTempDirectory), flush); }
java
protected void setTempDirectory(String strTempDirectory, boolean flush) throws ExpressionException { setTempDirectory(resources.getResource(strTempDirectory), flush); }
[ "protected", "void", "setTempDirectory", "(", "String", "strTempDirectory", ",", "boolean", "flush", ")", "throws", "ExpressionException", "{", "setTempDirectory", "(", "resources", ".", "getResource", "(", "strTempDirectory", ")", ",", "flush", ")", ";", "}" ]
sets the temp directory @param strTempDirectory temp directory @throws ExpressionException
[ "sets", "the", "temp", "directory" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/ConfigImpl.java#L1624-L1626
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/ops4j/pax/logging/slf4j/Slf4jLoggerFactory.java
Slf4jLoggerFactory.getLogger
public Logger getLogger(String name) { PaxLogger paxLogger; if (m_paxLogging == null) { paxLogger = FallbackLogFactory.createFallbackLog(null, name); } else { paxLogger = m_paxLogging.getLogger(name, Slf4jLogger.SLF4J_FQCN); } Slf4jLogger logger = new Slf4jLogger(name, paxLogger); if (m_paxLogging == null) { // just add the logger which PaxLoggingManager need to be replaced. synchronized (m_loggers) { m_loggers.put(name, logger); } } return logger; }
java
public Logger getLogger(String name) { PaxLogger paxLogger; if (m_paxLogging == null) { paxLogger = FallbackLogFactory.createFallbackLog(null, name); } else { paxLogger = m_paxLogging.getLogger(name, Slf4jLogger.SLF4J_FQCN); } Slf4jLogger logger = new Slf4jLogger(name, paxLogger); if (m_paxLogging == null) { // just add the logger which PaxLoggingManager need to be replaced. synchronized (m_loggers) { m_loggers.put(name, logger); } } return logger; }
[ "public", "Logger", "getLogger", "(", "String", "name", ")", "{", "PaxLogger", "paxLogger", ";", "if", "(", "m_paxLogging", "==", "null", ")", "{", "paxLogger", "=", "FallbackLogFactory", ".", "createFallbackLog", "(", "null", ",", "name", ")", ";", "}", "...
Return an appropriate {@link org.slf4j.Logger} instance as specified by the <code>name</code> parameter. <p> Null-valued name arguments are considered invalid. <p> Certain extremely simple logging systems, e.g. NOP, may always return the same logger instance regardless of the requested name. @param name the name of the Logger to return
[ "Return", "an", "appropriate", "{", "@link", "org", ".", "slf4j", ".", "Logger", "}", "instance", "as", "specified", "by", "the", "<code", ">", "name<", "/", "code", ">", "parameter", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/ops4j/pax/logging/slf4j/Slf4jLoggerFactory.java#L77-L96
JoeKerouac/utils
src/main/java/com/joe/utils/common/DateUtil.java
DateUtil.add
public static Date add(DateUnit dateUnit, int amount, String date, String format) { LocalDateTime localDateTime = getTime(format, date); localDateTime = localDateTime.plus(amount, create(dateUnit)); return Date.from(localDateTime.toInstant(ZoneOffset.ofTotalSeconds(60 * 60 * 8))); }
java
public static Date add(DateUnit dateUnit, int amount, String date, String format) { LocalDateTime localDateTime = getTime(format, date); localDateTime = localDateTime.plus(amount, create(dateUnit)); return Date.from(localDateTime.toInstant(ZoneOffset.ofTotalSeconds(60 * 60 * 8))); }
[ "public", "static", "Date", "add", "(", "DateUnit", "dateUnit", ",", "int", "amount", ",", "String", "date", ",", "String", "format", ")", "{", "LocalDateTime", "localDateTime", "=", "getTime", "(", "format", ",", "date", ")", ";", "localDateTime", "=", "l...
将指定日期增加指定时长 @param dateUnit 单位 @param amount 时长 @param date 指定日期 @param format 指定日期字符串的格式 @return 增加后的日期
[ "将指定日期增加指定时长" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/DateUtil.java#L135-L139
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/compiler/protocols/gosuclass/GosuClassesUrlConnection.java
GosuClassesUrlConnection.hasClassFileOnDiskInParentLoaderPath
private boolean hasClassFileOnDiskInParentLoaderPath( ClassLoader loader, IType type ) { if( !(loader instanceof IInjectableClassLoader) ) { return false; } ClassLoader parent = loader.getParent(); while( parent instanceof IInjectableClassLoader ) { parent = parent.getParent(); } IType outer = TypeLord.getOuterMostEnclosingClass( type ); try { parent.loadClass( outer.getName() ); return true; } catch( ClassNotFoundException e ) { return false; } }
java
private boolean hasClassFileOnDiskInParentLoaderPath( ClassLoader loader, IType type ) { if( !(loader instanceof IInjectableClassLoader) ) { return false; } ClassLoader parent = loader.getParent(); while( parent instanceof IInjectableClassLoader ) { parent = parent.getParent(); } IType outer = TypeLord.getOuterMostEnclosingClass( type ); try { parent.loadClass( outer.getName() ); return true; } catch( ClassNotFoundException e ) { return false; } }
[ "private", "boolean", "hasClassFileOnDiskInParentLoaderPath", "(", "ClassLoader", "loader", ",", "IType", "type", ")", "{", "if", "(", "!", "(", "loader", "instanceof", "IInjectableClassLoader", ")", ")", "{", "return", "false", ";", "}", "ClassLoader", "parent", ...
## perf: this is probably not an insignificant perf issue while class loading i.e., the onslaught of ClassNotFoundExceptions handled here is puke worthy
[ "##", "perf", ":", "this", "is", "probably", "not", "an", "insignificant", "perf", "issue", "while", "class", "loading", "i", ".", "e", ".", "the", "onslaught", "of", "ClassNotFoundExceptions", "handled", "here", "is", "puke", "worthy" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/compiler/protocols/gosuclass/GosuClassesUrlConnection.java#L177-L193
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/database/SqlDocument.java
SqlDocument.processChangedLines
private void processChangedLines( int offset, int length ) throws BadLocationException { String content = doc.getText(0, doc.getLength()); // The lines affected by the latest document update int startLine = rootElement.getElementIndex(offset); int endLine = rootElement.getElementIndex(offset + length); // Make sure all comment lines prior to the start line are commented // and determine if the start line is still in a multi line comment setMultiLineComment(commentLinesBefore(content, startLine)); // Do the actual highlighting for( int i = startLine; i <= endLine; i++ ) applyHighlighting(content, i); // Resolve highlighting to the next end multi line delimiter if (isMultiLineComment()) commentLinesAfter(content, endLine); else highlightLinesAfter(content, endLine); }
java
private void processChangedLines( int offset, int length ) throws BadLocationException { String content = doc.getText(0, doc.getLength()); // The lines affected by the latest document update int startLine = rootElement.getElementIndex(offset); int endLine = rootElement.getElementIndex(offset + length); // Make sure all comment lines prior to the start line are commented // and determine if the start line is still in a multi line comment setMultiLineComment(commentLinesBefore(content, startLine)); // Do the actual highlighting for( int i = startLine; i <= endLine; i++ ) applyHighlighting(content, i); // Resolve highlighting to the next end multi line delimiter if (isMultiLineComment()) commentLinesAfter(content, endLine); else highlightLinesAfter(content, endLine); }
[ "private", "void", "processChangedLines", "(", "int", "offset", ",", "int", "length", ")", "throws", "BadLocationException", "{", "String", "content", "=", "doc", ".", "getText", "(", "0", ",", "doc", ".", "getLength", "(", ")", ")", ";", "// The lines affec...
/* Determine how many lines have been changed, then apply highlighting to each line
[ "/", "*", "Determine", "how", "many", "lines", "have", "been", "changed", "then", "apply", "highlighting", "to", "each", "line" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/database/SqlDocument.java#L106-L122
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java
SiftScaleSpace.applyGaussian
void applyGaussian(GrayF32 input, GrayF32 output, Kernel1D kernel) { tempBlur.reshape(input.width, input.height); GConvolveImageOps.horizontalNormalized(kernel, input, tempBlur); GConvolveImageOps.verticalNormalized(kernel, tempBlur,output); }
java
void applyGaussian(GrayF32 input, GrayF32 output, Kernel1D kernel) { tempBlur.reshape(input.width, input.height); GConvolveImageOps.horizontalNormalized(kernel, input, tempBlur); GConvolveImageOps.verticalNormalized(kernel, tempBlur,output); }
[ "void", "applyGaussian", "(", "GrayF32", "input", ",", "GrayF32", "output", ",", "Kernel1D", "kernel", ")", "{", "tempBlur", ".", "reshape", "(", "input", ".", "width", ",", "input", ".", "height", ")", ";", "GConvolveImageOps", ".", "horizontalNormalized", ...
Applies the separable kernel to the input image and stores the results in the output image.
[ "Applies", "the", "separable", "kernel", "to", "the", "input", "image", "and", "stores", "the", "results", "in", "the", "output", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftScaleSpace.java#L241-L245
ThreeTen/threetenbp
src/main/java/org/threeten/bp/ZonedDateTime.java
ZonedDateTime.now
public static ZonedDateTime now(Clock clock) { Jdk8Methods.requireNonNull(clock, "clock"); final Instant now = clock.instant(); // called once return ofInstant(now, clock.getZone()); }
java
public static ZonedDateTime now(Clock clock) { Jdk8Methods.requireNonNull(clock, "clock"); final Instant now = clock.instant(); // called once return ofInstant(now, clock.getZone()); }
[ "public", "static", "ZonedDateTime", "now", "(", "Clock", "clock", ")", "{", "Jdk8Methods", ".", "requireNonNull", "(", "clock", ",", "\"clock\"", ")", ";", "final", "Instant", "now", "=", "clock", ".", "instant", "(", ")", ";", "// called once", "return", ...
Obtains the current date-time from the specified clock. <p> This will query the specified clock to obtain the current date-time. The zone and offset will be set based on the time-zone in the clock. <p> Using this method allows the use of an alternate clock for testing. The alternate clock may be introduced using {@link Clock dependency injection}. @param clock the clock to use, not null @return the current date-time, not null
[ "Obtains", "the", "current", "date", "-", "time", "from", "the", "specified", "clock", ".", "<p", ">", "This", "will", "query", "the", "specified", "clock", "to", "obtain", "the", "current", "date", "-", "time", ".", "The", "zone", "and", "offset", "will...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/ZonedDateTime.java#L200-L204
Viascom/groundwork
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/annotation/processor/FoxHttpAnnotationParser.java
FoxHttpAnnotationParser.parseInterface
@SuppressWarnings("unchecked") public <T> T parseInterface(final Class<T> serviceInterface, FoxHttpClient foxHttpClient) throws FoxHttpException { try { Method[] methods = serviceInterface.getDeclaredMethods(); for (Method method : methods) { FoxHttpMethodParser foxHttpMethodParser = new FoxHttpMethodParser(); foxHttpMethodParser.parseMethod(method, foxHttpClient); FoxHttpRequestBuilder foxHttpRequestBuilder = new FoxHttpRequestBuilder(foxHttpMethodParser.getUrl(), foxHttpMethodParser.getRequestType(), foxHttpClient) .setRequestHeader(foxHttpMethodParser.getHeaderFields()) .setSkipResponseBody(foxHttpMethodParser.isSkipResponseBody()) .setFollowRedirect(foxHttpMethodParser.isFollowRedirect()); requestCache.put(method, foxHttpRequestBuilder); } return (T) Proxy.newProxyInstance(serviceInterface.getClassLoader(), new Class[]{serviceInterface}, new FoxHttpAnnotationInvocationHandler(requestCache, responseParsers)); } catch (FoxHttpException e) { throw e; } catch (Exception e) { throw new FoxHttpRequestException(e); } }
java
@SuppressWarnings("unchecked") public <T> T parseInterface(final Class<T> serviceInterface, FoxHttpClient foxHttpClient) throws FoxHttpException { try { Method[] methods = serviceInterface.getDeclaredMethods(); for (Method method : methods) { FoxHttpMethodParser foxHttpMethodParser = new FoxHttpMethodParser(); foxHttpMethodParser.parseMethod(method, foxHttpClient); FoxHttpRequestBuilder foxHttpRequestBuilder = new FoxHttpRequestBuilder(foxHttpMethodParser.getUrl(), foxHttpMethodParser.getRequestType(), foxHttpClient) .setRequestHeader(foxHttpMethodParser.getHeaderFields()) .setSkipResponseBody(foxHttpMethodParser.isSkipResponseBody()) .setFollowRedirect(foxHttpMethodParser.isFollowRedirect()); requestCache.put(method, foxHttpRequestBuilder); } return (T) Proxy.newProxyInstance(serviceInterface.getClassLoader(), new Class[]{serviceInterface}, new FoxHttpAnnotationInvocationHandler(requestCache, responseParsers)); } catch (FoxHttpException e) { throw e; } catch (Exception e) { throw new FoxHttpRequestException(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "parseInterface", "(", "final", "Class", "<", "T", ">", "serviceInterface", ",", "FoxHttpClient", "foxHttpClient", ")", "throws", "FoxHttpException", "{", "try", "{", "Method", "...
Parse the given interface for the use of FoxHttp @param serviceInterface interface to parse @param foxHttpClient FoxHttpClient to use @param <T> interface class to parse @return Proxy of the interface @throws FoxHttpRequestException
[ "Parse", "the", "given", "interface", "for", "the", "use", "of", "FoxHttp" ]
train
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/annotation/processor/FoxHttpAnnotationParser.java#L41-L67
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java
ParserAdapter.ignorableWhitespace
public void ignorableWhitespace (char ch[], int start, int length) throws SAXException { if (contentHandler != null) { contentHandler.ignorableWhitespace(ch, start, length); } }
java
public void ignorableWhitespace (char ch[], int start, int length) throws SAXException { if (contentHandler != null) { contentHandler.ignorableWhitespace(ch, start, length); } }
[ "public", "void", "ignorableWhitespace", "(", "char", "ch", "[", "]", ",", "int", "start", ",", "int", "length", ")", "throws", "SAXException", "{", "if", "(", "contentHandler", "!=", "null", ")", "{", "contentHandler", ".", "ignorableWhitespace", "(", "ch",...
Adapter implementation method; do not call. Adapt a SAX1 ignorable whitespace event. @param ch An array of characters. @param start The starting position in the array. @param length The number of characters to use. @exception SAXException The client may raise a processing exception. @see org.xml.sax.DocumentHandler#ignorableWhitespace
[ "Adapter", "implementation", "method", ";", "do", "not", "call", ".", "Adapt", "a", "SAX1", "ignorable", "whitespace", "event", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java#L664-L670
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/HibernateSession.java
HibernateSession.updateAll
public long updateAll(final QueryableCriteria criteria, final Map<String, Object> properties) { return getHibernateTemplate().execute((GrailsHibernateTemplate.HibernateCallback<Integer>) session -> { JpaQueryBuilder builder = new JpaQueryBuilder(criteria); builder.setConversionService(getMappingContext().getConversionService()); builder.setHibernateCompatible(true); PersistentEntity targetEntity = criteria.getPersistentEntity(); PersistentProperty lastUpdated = targetEntity.getPropertyByName(GormProperties.LAST_UPDATED); if(lastUpdated != null && targetEntity.getMapping().getMappedForm().isAutoTimestamp()) { if (timestampProvider == null) { timestampProvider = new DefaultTimestampProvider(); } properties.put(GormProperties.LAST_UPDATED, timestampProvider.createTimestamp(lastUpdated.getType())); } JpaQueryInfo jpaQueryInfo = builder.buildUpdate(properties); org.hibernate.query.Query query = session.createQuery(jpaQueryInfo.getQuery()); getHibernateTemplate().applySettings(query); List parameters = jpaQueryInfo.getParameters(); if (parameters != null) { for (int i = 0, count = parameters.size(); i < count; i++) { query.setParameter(JpaQueryBuilder.PARAMETER_NAME_PREFIX + (i+1), parameters.get(i)); } } HibernateHqlQuery hqlQuery = new HibernateHqlQuery(HibernateSession.this, targetEntity, query); ApplicationEventPublisher applicationEventPublisher = datastore.getApplicationEventPublisher(); applicationEventPublisher.publishEvent(new PreQueryEvent(datastore, hqlQuery)); int result = query.executeUpdate(); applicationEventPublisher.publishEvent(new PostQueryEvent(datastore, hqlQuery, Collections.singletonList(result))); return result; }); }
java
public long updateAll(final QueryableCriteria criteria, final Map<String, Object> properties) { return getHibernateTemplate().execute((GrailsHibernateTemplate.HibernateCallback<Integer>) session -> { JpaQueryBuilder builder = new JpaQueryBuilder(criteria); builder.setConversionService(getMappingContext().getConversionService()); builder.setHibernateCompatible(true); PersistentEntity targetEntity = criteria.getPersistentEntity(); PersistentProperty lastUpdated = targetEntity.getPropertyByName(GormProperties.LAST_UPDATED); if(lastUpdated != null && targetEntity.getMapping().getMappedForm().isAutoTimestamp()) { if (timestampProvider == null) { timestampProvider = new DefaultTimestampProvider(); } properties.put(GormProperties.LAST_UPDATED, timestampProvider.createTimestamp(lastUpdated.getType())); } JpaQueryInfo jpaQueryInfo = builder.buildUpdate(properties); org.hibernate.query.Query query = session.createQuery(jpaQueryInfo.getQuery()); getHibernateTemplate().applySettings(query); List parameters = jpaQueryInfo.getParameters(); if (parameters != null) { for (int i = 0, count = parameters.size(); i < count; i++) { query.setParameter(JpaQueryBuilder.PARAMETER_NAME_PREFIX + (i+1), parameters.get(i)); } } HibernateHqlQuery hqlQuery = new HibernateHqlQuery(HibernateSession.this, targetEntity, query); ApplicationEventPublisher applicationEventPublisher = datastore.getApplicationEventPublisher(); applicationEventPublisher.publishEvent(new PreQueryEvent(datastore, hqlQuery)); int result = query.executeUpdate(); applicationEventPublisher.publishEvent(new PostQueryEvent(datastore, hqlQuery, Collections.singletonList(result))); return result; }); }
[ "public", "long", "updateAll", "(", "final", "QueryableCriteria", "criteria", ",", "final", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "return", "getHibernateTemplate", "(", ")", ".", "execute", "(", "(", "GrailsHibernateTemplate", ".", ...
Updates all objects matching the given criteria and property values. @param criteria The criteria @param properties The properties @return The total number of records updated
[ "Updates", "all", "objects", "matching", "the", "given", "criteria", "and", "property", "values", "." ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/HibernateSession.java#L124-L156
tvesalainen/lpg
src/main/java/org/vesalainen/regex/RegexMatcher.java
RegexMatcher.split
public static Stream<CharSequence> split(CharSequence seq, String regex, Option... options) { return StreamSupport.stream(new SpliteratorImpl(seq, regex, options), false); }
java
public static Stream<CharSequence> split(CharSequence seq, String regex, Option... options) { return StreamSupport.stream(new SpliteratorImpl(seq, regex, options), false); }
[ "public", "static", "Stream", "<", "CharSequence", ">", "split", "(", "CharSequence", "seq", ",", "String", "regex", ",", "Option", "...", "options", ")", "{", "return", "StreamSupport", ".", "stream", "(", "new", "SpliteratorImpl", "(", "seq", ",", "regex",...
Returns stream that contains subsequences delimited by given regex @param seq @param regex @param options @return
[ "Returns", "stream", "that", "contains", "subsequences", "delimited", "by", "given", "regex" ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/RegexMatcher.java#L261-L264
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/TimePickerSettings.java
TimePickerSettings.zApplyAllowKeyboardEditing
private void zApplyAllowKeyboardEditing() { // Set the editability of the time picker text field. parent.getComponentTimeTextField().setEditable(allowKeyboardEditing); // Set the text field border color based on whether the text field is editable. Color textFieldBorderColor = (allowKeyboardEditing) ? InternalConstants.colorEditableTextFieldBorder : InternalConstants.colorNotEditableTextFieldBorder; parent.getComponentTimeTextField().setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, textFieldBorderColor), new EmptyBorder(1, 3, 2, 2))); }
java
private void zApplyAllowKeyboardEditing() { // Set the editability of the time picker text field. parent.getComponentTimeTextField().setEditable(allowKeyboardEditing); // Set the text field border color based on whether the text field is editable. Color textFieldBorderColor = (allowKeyboardEditing) ? InternalConstants.colorEditableTextFieldBorder : InternalConstants.colorNotEditableTextFieldBorder; parent.getComponentTimeTextField().setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, textFieldBorderColor), new EmptyBorder(1, 3, 2, 2))); }
[ "private", "void", "zApplyAllowKeyboardEditing", "(", ")", "{", "// Set the editability of the time picker text field.", "parent", ".", "getComponentTimeTextField", "(", ")", ".", "setEditable", "(", "allowKeyboardEditing", ")", ";", "// Set the text field border color based on w...
zApplyAllowKeyboardEditing, This applies the named setting to the parent component.
[ "zApplyAllowKeyboardEditing", "This", "applies", "the", "named", "setting", "to", "the", "parent", "component", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/TimePickerSettings.java#L884-L893
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/ModifyingCollectionWithItself.java
ModifyingCollectionWithItself.describe
private Description describe(MethodInvocationTree methodInvocationTree, VisitorState state) { ExpressionTree receiver = ASTHelpers.getReceiver(methodInvocationTree); List<? extends ExpressionTree> arguments = methodInvocationTree.getArguments(); ExpressionTree argument; // .addAll(int, Collection); for the true case argument = arguments.size() == 2 ? arguments.get(1) : arguments.get(0); Description.Builder builder = buildDescription(methodInvocationTree); for (Fix fix : buildFixes(methodInvocationTree, state, receiver, argument)) { builder.addFix(fix); } return builder.build(); }
java
private Description describe(MethodInvocationTree methodInvocationTree, VisitorState state) { ExpressionTree receiver = ASTHelpers.getReceiver(methodInvocationTree); List<? extends ExpressionTree> arguments = methodInvocationTree.getArguments(); ExpressionTree argument; // .addAll(int, Collection); for the true case argument = arguments.size() == 2 ? arguments.get(1) : arguments.get(0); Description.Builder builder = buildDescription(methodInvocationTree); for (Fix fix : buildFixes(methodInvocationTree, state, receiver, argument)) { builder.addFix(fix); } return builder.build(); }
[ "private", "Description", "describe", "(", "MethodInvocationTree", "methodInvocationTree", ",", "VisitorState", "state", ")", "{", "ExpressionTree", "receiver", "=", "ASTHelpers", ".", "getReceiver", "(", "methodInvocationTree", ")", ";", "List", "<", "?", "extends", ...
We expect that the lhs is a field and the rhs is an identifier, specifically a parameter to the method. We base our suggested fixes on this expectation. <p>Case 1: If lhs is a field and rhs is an identifier, find a method parameter of the same type and similar name and suggest it as the rhs. (Guess that they have misspelled the identifier.) <p>Case 2: If lhs is a field and rhs is not an identifier, find a method parameter of the same type and similar name and suggest it as the rhs. <p>Case 3: If lhs is not a field and rhs is an identifier, find a class field of the same type and similar name and suggest it as the lhs. <p>Case 4: Otherwise replace with literal meaning of functionality
[ "We", "expect", "that", "the", "lhs", "is", "a", "field", "and", "the", "rhs", "is", "an", "identifier", "specifically", "a", "parameter", "to", "the", "method", ".", "We", "base", "our", "suggested", "fixes", "on", "this", "expectation", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ModifyingCollectionWithItself.java#L101-L114
tzaeschke/zoodb
src/org/zoodb/internal/ZooClassDef.java
ZooClassDef.bootstrapZooClassDef
public static ZooClassDef bootstrapZooClassDef() { ZooClassDef meta = new ZooClassDef(ZooClassDef.class.getName(), 51, 50, 51, 0); ArrayList<ZooFieldDef> fields = new ArrayList<ZooFieldDef>(); fields.add(new ZooFieldDef(meta, "className", String.class.getName(), 0, JdoType.STRING, 70)); fields.add(new ZooFieldDef(meta, "oidSuper", long.class.getName(), 0, JdoType.PRIMITIVE, 71)); fields.add(new ZooFieldDef(meta, "schemaId", long.class.getName(), 0, JdoType.PRIMITIVE, 72)); fields.add(new ZooFieldDef(meta, "versionId", short.class.getName(), 0, JdoType.PRIMITIVE, 73)); fields.add(new ZooFieldDef(meta, "localFields", ArrayList.class.getName(), 0, JdoType.SCO, 74)); fields.add(new ZooFieldDef(meta, "prevVersionOid", long.class.getName(), 0, JdoType.PRIMITIVE, 75)); fields.add(new ZooFieldDef(meta, "evolutionOperations", ArrayList.class.getName(), 0, JdoType.SCO, 76)); //new ZooFieldDef(this, allFields, ZooFieldDef[].class.getName(), typeOid, JdoType.ARRAY); meta.registerFields(fields); meta.cls = ZooClassDef.class; meta.className = ZooClassDef.class.getName(); meta.associateFields(); meta.associateJavaTypes(); return meta; }
java
public static ZooClassDef bootstrapZooClassDef() { ZooClassDef meta = new ZooClassDef(ZooClassDef.class.getName(), 51, 50, 51, 0); ArrayList<ZooFieldDef> fields = new ArrayList<ZooFieldDef>(); fields.add(new ZooFieldDef(meta, "className", String.class.getName(), 0, JdoType.STRING, 70)); fields.add(new ZooFieldDef(meta, "oidSuper", long.class.getName(), 0, JdoType.PRIMITIVE, 71)); fields.add(new ZooFieldDef(meta, "schemaId", long.class.getName(), 0, JdoType.PRIMITIVE, 72)); fields.add(new ZooFieldDef(meta, "versionId", short.class.getName(), 0, JdoType.PRIMITIVE, 73)); fields.add(new ZooFieldDef(meta, "localFields", ArrayList.class.getName(), 0, JdoType.SCO, 74)); fields.add(new ZooFieldDef(meta, "prevVersionOid", long.class.getName(), 0, JdoType.PRIMITIVE, 75)); fields.add(new ZooFieldDef(meta, "evolutionOperations", ArrayList.class.getName(), 0, JdoType.SCO, 76)); //new ZooFieldDef(this, allFields, ZooFieldDef[].class.getName(), typeOid, JdoType.ARRAY); meta.registerFields(fields); meta.cls = ZooClassDef.class; meta.className = ZooClassDef.class.getName(); meta.associateFields(); meta.associateJavaTypes(); return meta; }
[ "public", "static", "ZooClassDef", "bootstrapZooClassDef", "(", ")", "{", "ZooClassDef", "meta", "=", "new", "ZooClassDef", "(", "ZooClassDef", ".", "class", ".", "getName", "(", ")", ",", "51", ",", "50", ",", "51", ",", "0", ")", ";", "ArrayList", "<",...
Methods used for bootstrapping the schema of newly created databases. @return Meta schema instance
[ "Methods", "used", "for", "bootstrapping", "the", "schema", "of", "newly", "created", "databases", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/ZooClassDef.java#L116-L141
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java
MarkdownHelper._appendHexEntity
private static void _appendHexEntity (final StringBuilder out, final char value) { out.append ("&#x").append (Integer.toHexString (value)).append (';'); }
java
private static void _appendHexEntity (final StringBuilder out, final char value) { out.append ("&#x").append (Integer.toHexString (value)).append (';'); }
[ "private", "static", "void", "_appendHexEntity", "(", "final", "StringBuilder", "out", ",", "final", "char", "value", ")", "{", "out", ".", "append", "(", "\"&#x\"", ")", ".", "append", "(", "Integer", ".", "toHexString", "(", "value", ")", ")", ".", "ap...
Append the given char as a hexadecimal HTML entity. @param out The StringBuilder to write to. @param value The character.
[ "Append", "the", "given", "char", "as", "a", "hexadecimal", "HTML", "entity", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java#L373-L376
iipc/webarchive-commons
src/main/java/org/archive/io/ArchiveReader.java
ArchiveReader.getInputStream
protected InputStream getInputStream(final File f, final long offset) throws IOException { FileInputStream fin = new FileInputStream(f); return new BufferedInputStream(fin); }
java
protected InputStream getInputStream(final File f, final long offset) throws IOException { FileInputStream fin = new FileInputStream(f); return new BufferedInputStream(fin); }
[ "protected", "InputStream", "getInputStream", "(", "final", "File", "f", ",", "final", "long", "offset", ")", "throws", "IOException", "{", "FileInputStream", "fin", "=", "new", "FileInputStream", "(", "f", ")", ";", "return", "new", "BufferedInputStream", "(", ...
Convenience method for constructors. @param f File to read. @param offset Offset at which to start reading. @return InputStream to read from. @throws IOException If failed open or fail to get a memory mapped byte buffer on file.
[ "Convenience", "method", "for", "constructors", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ArchiveReader.java#L126-L130
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsOuTree.java
CmsOuTree.addChildrenForGroupsNode
private void addChildrenForGroupsNode(I_CmsOuTreeType type, String ouItem) { try { // Cut of type-specific prefix from ouItem with substring() List<CmsGroup> groups = m_app.readGroupsForOu(m_cms, ouItem.substring(1), type, false); for (CmsGroup group : groups) { Pair<String, CmsUUID> key = Pair.of(type.getId(), group.getId()); Item groupItem = m_treeContainer.addItem(key); if (groupItem == null) { groupItem = getItem(key); } groupItem.getItemProperty(PROP_SID).setValue(group.getId()); groupItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(group, CmsOuTreeType.GROUP)); groupItem.getItemProperty(PROP_TYPE).setValue(type); setChildrenAllowed(key, false); m_treeContainer.setParent(key, ouItem); } } catch (CmsException e) { LOG.error("Can not read group", e); } }
java
private void addChildrenForGroupsNode(I_CmsOuTreeType type, String ouItem) { try { // Cut of type-specific prefix from ouItem with substring() List<CmsGroup> groups = m_app.readGroupsForOu(m_cms, ouItem.substring(1), type, false); for (CmsGroup group : groups) { Pair<String, CmsUUID> key = Pair.of(type.getId(), group.getId()); Item groupItem = m_treeContainer.addItem(key); if (groupItem == null) { groupItem = getItem(key); } groupItem.getItemProperty(PROP_SID).setValue(group.getId()); groupItem.getItemProperty(PROP_NAME).setValue(getIconCaptionHTML(group, CmsOuTreeType.GROUP)); groupItem.getItemProperty(PROP_TYPE).setValue(type); setChildrenAllowed(key, false); m_treeContainer.setParent(key, ouItem); } } catch (CmsException e) { LOG.error("Can not read group", e); } }
[ "private", "void", "addChildrenForGroupsNode", "(", "I_CmsOuTreeType", "type", ",", "String", "ouItem", ")", "{", "try", "{", "// Cut of type-specific prefix from ouItem with substring()", "List", "<", "CmsGroup", ">", "groups", "=", "m_app", ".", "readGroupsForOu", "("...
Add groups for given group parent item. @param type the tree type @param ouItem group parent item
[ "Add", "groups", "for", "given", "group", "parent", "item", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsOuTree.java#L257-L277
jenkinsci/jenkins
core/src/main/java/hudson/model/ItemGroupMixIn.java
ItemGroupMixIn.redirectAfterCreateItem
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException { return req.getContextPath()+'/'+result.getUrl()+"configure"; }
java
protected String redirectAfterCreateItem(StaplerRequest req, TopLevelItem result) throws IOException { return req.getContextPath()+'/'+result.getUrl()+"configure"; }
[ "protected", "String", "redirectAfterCreateItem", "(", "StaplerRequest", "req", ",", "TopLevelItem", "result", ")", "throws", "IOException", "{", "return", "req", ".", "getContextPath", "(", ")", "+", "'", "'", "+", "result", ".", "getUrl", "(", ")", "+", "\...
Computes the redirection target URL for the newly created {@link TopLevelItem}.
[ "Computes", "the", "redirection", "target", "URL", "for", "the", "newly", "created", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ItemGroupMixIn.java#L216-L218
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java
Operators.resolveUnary
OperatorSymbol resolveUnary(DiagnosticPosition pos, JCTree.Tag tag, Type op) { return resolve(tag, unaryOperators, unop -> unop.test(op), unop -> unop.resolve(op), () -> reportErrorIfNeeded(pos, tag, op)); }
java
OperatorSymbol resolveUnary(DiagnosticPosition pos, JCTree.Tag tag, Type op) { return resolve(tag, unaryOperators, unop -> unop.test(op), unop -> unop.resolve(op), () -> reportErrorIfNeeded(pos, tag, op)); }
[ "OperatorSymbol", "resolveUnary", "(", "DiagnosticPosition", "pos", ",", "JCTree", ".", "Tag", "tag", ",", "Type", "op", ")", "{", "return", "resolve", "(", "tag", ",", "unaryOperators", ",", "unop", "->", "unop", ".", "test", "(", "op", ")", ",", "unop"...
Entry point for resolving a unary operator given an operator tag and an argument type.
[ "Entry", "point", "for", "resolving", "a", "unary", "operator", "given", "an", "operator", "tag", "and", "an", "argument", "type", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java#L149-L155
gitblit/fathom
fathom-security/src/main/java/fathom/security/SecurityManager.java
SecurityManager.parseDefinedRealms
protected Collection<Realm> parseDefinedRealms(Config config) { List<Realm> realms = new ArrayList<>(); // Parse the Realms if (config.hasPath("realms")) { log.trace("Parsing Realm definitions"); for (Config realmConfig : config.getConfigList("realms")) { // define the realm name and type String realmType = Strings.emptyToNull(realmConfig.getString("type")); Preconditions.checkNotNull(realmType, "Realm 'type' is null!"); if (ClassUtil.doesClassExist(realmType)) { Class<? extends Realm> realmClass = ClassUtil.getClass(realmType); if (RequireUtil.allowClass(settings, realmClass)) { try { Realm realm = injector.getInstance(realmClass); realm.setup(realmConfig); realms.add(realm); log.debug("Created '{}' named '{}'", realmType, realm.getRealmName()); } catch (Exception e) { log.error("Failed to create '{}' realm", realmType, e); } } } else { throw new FathomException("Unknown realm type '{}'!", realmType); } } } return Collections.unmodifiableList(realms); }
java
protected Collection<Realm> parseDefinedRealms(Config config) { List<Realm> realms = new ArrayList<>(); // Parse the Realms if (config.hasPath("realms")) { log.trace("Parsing Realm definitions"); for (Config realmConfig : config.getConfigList("realms")) { // define the realm name and type String realmType = Strings.emptyToNull(realmConfig.getString("type")); Preconditions.checkNotNull(realmType, "Realm 'type' is null!"); if (ClassUtil.doesClassExist(realmType)) { Class<? extends Realm> realmClass = ClassUtil.getClass(realmType); if (RequireUtil.allowClass(settings, realmClass)) { try { Realm realm = injector.getInstance(realmClass); realm.setup(realmConfig); realms.add(realm); log.debug("Created '{}' named '{}'", realmType, realm.getRealmName()); } catch (Exception e) { log.error("Failed to create '{}' realm", realmType, e); } } } else { throw new FathomException("Unknown realm type '{}'!", realmType); } } } return Collections.unmodifiableList(realms); }
[ "protected", "Collection", "<", "Realm", ">", "parseDefinedRealms", "(", "Config", "config", ")", "{", "List", "<", "Realm", ">", "realms", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Parse the Realms", "if", "(", "config", ".", "hasPath", "(", "\"re...
Parse the Realms from the Config object. @param config @return an ordered collection of Realms
[ "Parse", "the", "Realms", "from", "the", "Config", "object", "." ]
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-security/src/main/java/fathom/security/SecurityManager.java#L256-L288
OpenLiberty/open-liberty
dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxXATerminator.java
TxXATerminator.getTxWrapper
protected JCATranWrapper getTxWrapper(Xid xid, boolean addAssociation) throws XAException { if (tc.isEntryEnabled()) Tr.entry(tc, "getTxWrapper", xid); final JCATranWrapper txWrapper = TxExecutionContextHandler.getTxWrapper(xid, addAssociation); if(txWrapper.getTransaction() == null) { // there was no Transaction for this XID if(tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", "no transaction was found for the specified XID"); throw new XAException(XAException.XAER_NOTA); } if(tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", txWrapper); return txWrapper; }
java
protected JCATranWrapper getTxWrapper(Xid xid, boolean addAssociation) throws XAException { if (tc.isEntryEnabled()) Tr.entry(tc, "getTxWrapper", xid); final JCATranWrapper txWrapper = TxExecutionContextHandler.getTxWrapper(xid, addAssociation); if(txWrapper.getTransaction() == null) { // there was no Transaction for this XID if(tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", "no transaction was found for the specified XID"); throw new XAException(XAException.XAER_NOTA); } if(tc.isEntryEnabled()) Tr.exit(tc, "getTxWrapper", txWrapper); return txWrapper; }
[ "protected", "JCATranWrapper", "getTxWrapper", "(", "Xid", "xid", ",", "boolean", "addAssociation", ")", "throws", "XAException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getTxWrapper\"", ",", "xid", ...
Gets the Transaction from the TxExecutionContextHandler that imported it @param xid @param addAssociation @return @throws XAException (XAER_NOTA) - thrown if the specified XID is invalid
[ "Gets", "the", "Transaction", "from", "the", "TxExecutionContextHandler", "that", "imported", "it" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/TxXATerminator.java#L260-L275
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java
WorkflowTriggersInner.listCallbackUrlAsync
public Observable<WorkflowTriggerCallbackUrlInner> listCallbackUrlAsync(String resourceGroupName, String workflowName, String triggerName) { return listCallbackUrlWithServiceResponseAsync(resourceGroupName, workflowName, triggerName).map(new Func1<ServiceResponse<WorkflowTriggerCallbackUrlInner>, WorkflowTriggerCallbackUrlInner>() { @Override public WorkflowTriggerCallbackUrlInner call(ServiceResponse<WorkflowTriggerCallbackUrlInner> response) { return response.body(); } }); }
java
public Observable<WorkflowTriggerCallbackUrlInner> listCallbackUrlAsync(String resourceGroupName, String workflowName, String triggerName) { return listCallbackUrlWithServiceResponseAsync(resourceGroupName, workflowName, triggerName).map(new Func1<ServiceResponse<WorkflowTriggerCallbackUrlInner>, WorkflowTriggerCallbackUrlInner>() { @Override public WorkflowTriggerCallbackUrlInner call(ServiceResponse<WorkflowTriggerCallbackUrlInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkflowTriggerCallbackUrlInner", ">", "listCallbackUrlAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "triggerName", ")", "{", "return", "listCallbackUrlWithServiceResponseAsync", "(", "resourceGroupName...
Get the callback URL for a workflow trigger. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param triggerName The workflow trigger name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkflowTriggerCallbackUrlInner object
[ "Get", "the", "callback", "URL", "for", "a", "workflow", "trigger", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java#L860-L867
logic-ng/LogicNG
src/main/java/org/logicng/formulas/FormulaFactory.java
FormulaFactory.cc
public PBConstraint cc(final CType comparator, final int rhs, final Collection<Variable> variables) { final int[] coefficients = new int[variables.size()]; Arrays.fill(coefficients, 1); final Variable[] vars = new Variable[variables.size()]; int count = 0; for (final Variable var : variables) vars[count++] = var; return this.constructPBC(comparator, rhs, vars, coefficients); }
java
public PBConstraint cc(final CType comparator, final int rhs, final Collection<Variable> variables) { final int[] coefficients = new int[variables.size()]; Arrays.fill(coefficients, 1); final Variable[] vars = new Variable[variables.size()]; int count = 0; for (final Variable var : variables) vars[count++] = var; return this.constructPBC(comparator, rhs, vars, coefficients); }
[ "public", "PBConstraint", "cc", "(", "final", "CType", "comparator", ",", "final", "int", "rhs", ",", "final", "Collection", "<", "Variable", ">", "variables", ")", "{", "final", "int", "[", "]", "coefficients", "=", "new", "int", "[", "variables", ".", ...
Creates a new cardinality constraint. @param variables the variables of the constraint @param comparator the comparator of the constraint @param rhs the right-hand side of the constraint @return the cardinality constraint @throws IllegalArgumentException if there are negative variables
[ "Creates", "a", "new", "cardinality", "constraint", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/FormulaFactory.java#L759-L767
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.java
OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDifferentIndividualsAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDifferentIndividualsAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDifferentIndividualsAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.java#L74-L77
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java
StringUtils.earliestIndexOfAny
public static int earliestIndexOfAny(String s, Iterable<String> probes, int from) { int earliestIdx = -1; for (final String probe : probes) { final int probeIdx = s.indexOf(probe, from); // if we found something for this probe if (probeIdx >= 0 // and either we haven't found anything else yet or // this is earlier than anything we've found yet && (earliestIdx == -1 || probeIdx < earliestIdx)) { // then this is our new earliest match earliestIdx = probeIdx; } } return earliestIdx; }
java
public static int earliestIndexOfAny(String s, Iterable<String> probes, int from) { int earliestIdx = -1; for (final String probe : probes) { final int probeIdx = s.indexOf(probe, from); // if we found something for this probe if (probeIdx >= 0 // and either we haven't found anything else yet or // this is earlier than anything we've found yet && (earliestIdx == -1 || probeIdx < earliestIdx)) { // then this is our new earliest match earliestIdx = probeIdx; } } return earliestIdx; }
[ "public", "static", "int", "earliestIndexOfAny", "(", "String", "s", ",", "Iterable", "<", "String", ">", "probes", ",", "int", "from", ")", "{", "int", "earliestIdx", "=", "-", "1", ";", "for", "(", "final", "String", "probe", ":", "probes", ")", "{",...
Just like {@link java.lang.String#indexOf(String, int)}, except it searches for all strings in {@code probes}. If none are found, returns -1. If any are found, returns the earliest index of a match. The current implementation naively searches for each string separately. If speed is important, consider an alternative approach.
[ "Just", "like", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L461-L477
gallandarakhneorg/afc
advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeProvider.java
AbstractAttributeProvider.protectNull
protected static Object protectNull(Object rawAttributeValue, AttributeType type) { if (rawAttributeValue == null) { if (type.isNullAllowed()) { return new NullAttribute(type); } throw new NullPointerException(); } return rawAttributeValue; }
java
protected static Object protectNull(Object rawAttributeValue, AttributeType type) { if (rawAttributeValue == null) { if (type.isNullAllowed()) { return new NullAttribute(type); } throw new NullPointerException(); } return rawAttributeValue; }
[ "protected", "static", "Object", "protectNull", "(", "Object", "rawAttributeValue", ",", "AttributeType", "type", ")", "{", "if", "(", "rawAttributeValue", "==", "null", ")", "{", "if", "(", "type", ".", "isNullAllowed", "(", ")", ")", "{", "return", "new", ...
Ensure that the <code>null</code> value for {@code rawAttributeValue} is catched and replaced by a dedicated representant object. This function permits to keep the type of a value even if it is <code>null</code>. @param rawAttributeValue is the value to protect. @param type is the type of the attribute to preserve over time. @return the value, or the representant of the java <code>null</code> value. @see #unprotectNull(Object)
[ "Ensure", "that", "the", "<code", ">", "null<", "/", "code", ">", "value", "for", "{", "@code", "rawAttributeValue", "}", "is", "catched", "and", "replaced", "by", "a", "dedicated", "representant", "object", ".", "This", "function", "permits", "to", "keep", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/AbstractAttributeProvider.java#L62-L70
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java
TasksImpl.listAsync
public ServiceFuture<List<CloudTask>> listAsync(final String jobId, final TaskListOptions taskListOptions, final ListOperationCallback<CloudTask> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listSinglePageAsync(jobId, taskListOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(String nextPageLink) { TaskListNextOptions taskListNextOptions = null; if (taskListOptions != null) { taskListNextOptions = new TaskListNextOptions(); taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); } return listNextSinglePageAsync(nextPageLink, taskListNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<CloudTask>> listAsync(final String jobId, final TaskListOptions taskListOptions, final ListOperationCallback<CloudTask> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listSinglePageAsync(jobId, taskListOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(String nextPageLink) { TaskListNextOptions taskListNextOptions = null; if (taskListOptions != null) { taskListNextOptions = new TaskListNextOptions(); taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); } return listNextSinglePageAsync(nextPageLink, taskListNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "CloudTask", ">", ">", "listAsync", "(", "final", "String", "jobId", ",", "final", "TaskListOptions", "taskListOptions", ",", "final", "ListOperationCallback", "<", "CloudTask", ">", "serviceCallback", ")", "{", "return...
Lists all of the tasks that are associated with the specified job. For multi-instance tasks, information such as affinityId, executionInfo and nodeInfo refer to the primary task. Use the list subtasks API to retrieve information about subtasks. @param jobId The ID of the job. @param taskListOptions Additional parameters for the operation @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Lists", "all", "of", "the", "tasks", "that", "are", "associated", "with", "the", "specified", "job", ".", "For", "multi", "-", "instance", "tasks", "information", "such", "as", "affinityId", "executionInfo", "and", "nodeInfo", "refer", "to", "the", "primary",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L509-L526
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/converter/ColorConverter.java
ColorConverter.parseHtml
protected Color parseHtml(String value) { if (value.length() != 7) { throw new ConversionException(USAGE); } int colorValue = 0; try { colorValue = Integer.parseInt(value.substring(1), 16); return new Color(colorValue); } catch (NumberFormatException ex) { throw new ConversionException(value + "is not a valid Html color", ex); } }
java
protected Color parseHtml(String value) { if (value.length() != 7) { throw new ConversionException(USAGE); } int colorValue = 0; try { colorValue = Integer.parseInt(value.substring(1), 16); return new Color(colorValue); } catch (NumberFormatException ex) { throw new ConversionException(value + "is not a valid Html color", ex); } }
[ "protected", "Color", "parseHtml", "(", "String", "value", ")", "{", "if", "(", "value", ".", "length", "(", ")", "!=", "7", ")", "{", "throw", "new", "ConversionException", "(", "USAGE", ")", ";", "}", "int", "colorValue", "=", "0", ";", "try", "{",...
Parsers a String in the form "#xxxxxx" into an SWT RGB class. @param value the color as String @return RGB
[ "Parsers", "a", "String", "in", "the", "form", "#xxxxxx", "into", "an", "SWT", "RGB", "class", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-properties/src/main/java/org/xwiki/properties/internal/converter/ColorConverter.java#L105-L118
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/PluginManager.java
PluginManager.callFunction
public void callFunction(String className, String methodName, PluginArguments pluginArgs, Object... args) throws Exception { Class<?> cls = getClass(className); ArrayList<Object> newArgs = new ArrayList<>(); newArgs.add(pluginArgs); com.groupon.odo.proxylib.models.Method m = preparePluginMethod(newArgs, className, methodName, args); m.getMethod().invoke(cls, newArgs.toArray(new Object[0])); }
java
public void callFunction(String className, String methodName, PluginArguments pluginArgs, Object... args) throws Exception { Class<?> cls = getClass(className); ArrayList<Object> newArgs = new ArrayList<>(); newArgs.add(pluginArgs); com.groupon.odo.proxylib.models.Method m = preparePluginMethod(newArgs, className, methodName, args); m.getMethod().invoke(cls, newArgs.toArray(new Object[0])); }
[ "public", "void", "callFunction", "(", "String", "className", ",", "String", "methodName", ",", "PluginArguments", "pluginArgs", ",", "Object", "...", "args", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "cls", "=", "getClass", "(", "className", ...
Calls the specified function with the specified arguments. This is used for v2 response overrides @param className name of class @param methodName name of method @param pluginArgs plugin arguments @param args arguments to supply to function @throws Exception exception
[ "Calls", "the", "specified", "function", "with", "the", "specified", "arguments", ".", "This", "is", "used", "for", "v2", "response", "overrides" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/PluginManager.java#L259-L267
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/GeoIntents.java
GeoIntents.newStreetViewIntent
public static Intent newStreetViewIntent(float latitude, float longitude) { return newStreetViewIntent(latitude, longitude, null, null, null, null); }
java
public static Intent newStreetViewIntent(float latitude, float longitude) { return newStreetViewIntent(latitude, longitude, null, null, null, null); }
[ "public", "static", "Intent", "newStreetViewIntent", "(", "float", "latitude", ",", "float", "longitude", ")", "{", "return", "newStreetViewIntent", "(", "latitude", ",", "longitude", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Opens the Street View application to the given location. The URI scheme is based on the syntax used for Street View panorama information in Google Maps URLs. @param latitude Latitude @param longitude Longitude
[ "Opens", "the", "Street", "View", "application", "to", "the", "given", "location", ".", "The", "URI", "scheme", "is", "based", "on", "the", "syntax", "used", "for", "Street", "View", "panorama", "information", "in", "Google", "Maps", "URLs", "." ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/GeoIntents.java#L133-L135
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/FedoraObjectTripleGenerator_3_0.java
FedoraObjectTripleGenerator_3_0.addCommonTriples
private URIReference addCommonTriples(DOReader reader, Set<Triple> set) throws ResourceIndexException { try { URIReference objURI = new SimpleURIReference( new URI(PID.toURI(reader.GetObjectPID()))); addCoreObjectTriples(reader, objURI, set); Datastream[] datastreams = reader.GetDatastreams(null, null); for (Datastream ds : datastreams) { addCoreDatastreamTriples(ds, objURI, set); if (ds.DatastreamID.equals("DC")) { addDCTriples(ds, objURI, set); } } addRelationshipTriples(reader, objURI, set); return objURI; } catch (ResourceIndexException e) { throw e; } catch (Exception e) { throw new ResourceIndexException("Error generating triples", e); } }
java
private URIReference addCommonTriples(DOReader reader, Set<Triple> set) throws ResourceIndexException { try { URIReference objURI = new SimpleURIReference( new URI(PID.toURI(reader.GetObjectPID()))); addCoreObjectTriples(reader, objURI, set); Datastream[] datastreams = reader.GetDatastreams(null, null); for (Datastream ds : datastreams) { addCoreDatastreamTriples(ds, objURI, set); if (ds.DatastreamID.equals("DC")) { addDCTriples(ds, objURI, set); } } addRelationshipTriples(reader, objURI, set); return objURI; } catch (ResourceIndexException e) { throw e; } catch (Exception e) { throw new ResourceIndexException("Error generating triples", e); } }
[ "private", "URIReference", "addCommonTriples", "(", "DOReader", "reader", ",", "Set", "<", "Triple", ">", "set", ")", "throws", "ResourceIndexException", "{", "try", "{", "URIReference", "objURI", "=", "new", "SimpleURIReference", "(", "new", "URI", "(", "PID", ...
Add the common core and datastream triples for the given object.
[ "Add", "the", "common", "core", "and", "datastream", "triples", "for", "the", "given", "object", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/FedoraObjectTripleGenerator_3_0.java#L56-L82
kaazing/gateway
transport/ws/src/main/java/org/kaazing/gateway/transport/ws/util/WsUtils.java
WsUtils.computeHash
public static ByteBuffer computeHash(CharSequence key1, CharSequence key2, ByteBuffer key3) throws WsDigestException, NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("MD5"); ByteBuffer buf = ByteBuffer.allocate(DIGEST_LENGTH); buf.putInt(parseIntKey(key1)); buf.putInt(parseIntKey(key2)); // key3 must be exactly 8 bytes if (key3.remaining() != 8) { throw new WsDigestException("WebSocket key3 must be exactly 8 bytes"); } buf.put(key3); buf.flip(); byte[] input = new byte[DIGEST_LENGTH]; buf.get(input, 0, DIGEST_LENGTH); byte[] digest = md5.digest(input); return ByteBuffer.wrap(digest); }
java
public static ByteBuffer computeHash(CharSequence key1, CharSequence key2, ByteBuffer key3) throws WsDigestException, NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("MD5"); ByteBuffer buf = ByteBuffer.allocate(DIGEST_LENGTH); buf.putInt(parseIntKey(key1)); buf.putInt(parseIntKey(key2)); // key3 must be exactly 8 bytes if (key3.remaining() != 8) { throw new WsDigestException("WebSocket key3 must be exactly 8 bytes"); } buf.put(key3); buf.flip(); byte[] input = new byte[DIGEST_LENGTH]; buf.get(input, 0, DIGEST_LENGTH); byte[] digest = md5.digest(input); return ByteBuffer.wrap(digest); }
[ "public", "static", "ByteBuffer", "computeHash", "(", "CharSequence", "key1", ",", "CharSequence", "key2", ",", "ByteBuffer", "key3", ")", "throws", "WsDigestException", ",", "NoSuchAlgorithmException", "{", "MessageDigest", "md5", "=", "MessageDigest", ".", "getInsta...
/* Compute the MD5 sum of the three WebSocket keys (draft Hixie-76) @param key1 Sec-WebSocket-Key1 value @param key2 Sec-WebSocket-Key2 value @param key3 8 bytes immediately following WebSocket upgrade request @return @throws NoSuchAlgorithmException
[ "/", "*", "Compute", "the", "MD5", "sum", "of", "the", "three", "WebSocket", "keys", "(", "draft", "Hixie", "-", "76", ")" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/util/WsUtils.java#L156-L177
openbase/jul
exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java
StackTracePrinter.printStackTrace
public static void printStackTrace(final Logger logger, final LogLevel logLevel) { printStackTrace((String) null, logger, logLevel); }
java
public static void printStackTrace(final Logger logger, final LogLevel logLevel) { printStackTrace((String) null, logger, logLevel); }
[ "public", "static", "void", "printStackTrace", "(", "final", "Logger", "logger", ",", "final", "LogLevel", "logLevel", ")", "{", "printStackTrace", "(", "(", "String", ")", "null", ",", "logger", ",", "logLevel", ")", ";", "}" ]
Method prints the stack trace of the calling thread in a human readable way. @param logger the logger used for printing. @param logLevel the log level used for logging the stack trace.
[ "Method", "prints", "the", "stack", "trace", "of", "the", "calling", "thread", "in", "a", "human", "readable", "way", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java#L66-L68
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toVariableName
public static String toVariableName(Object o, String defaultValue) { String str = toString(o, null); if (str == null || !Decision.isVariableName(str)) return defaultValue; return str; }
java
public static String toVariableName(Object o, String defaultValue) { String str = toString(o, null); if (str == null || !Decision.isVariableName(str)) return defaultValue; return str; }
[ "public", "static", "String", "toVariableName", "(", "Object", "o", ",", "String", "defaultValue", ")", "{", "String", "str", "=", "toString", "(", "o", ",", "null", ")", ";", "if", "(", "str", "==", "null", "||", "!", "Decision", ".", "isVariableName", ...
cast a Object to a Variable Name @param o Object to cast @param defaultValue @return casted Variable Name
[ "cast", "a", "Object", "to", "a", "Variable", "Name" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L3165-L3170
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/util/ListUtil.java
ListUtil.getInsertionIndex
@Pure public static <T> int getInsertionIndex(List<T> list, Comparator<? super T> comparator, T elt) { return getInsertionIndex(list, comparator, elt, true); }
java
@Pure public static <T> int getInsertionIndex(List<T> list, Comparator<? super T> comparator, T elt) { return getInsertionIndex(list, comparator, elt, true); }
[ "@", "Pure", "public", "static", "<", "T", ">", "int", "getInsertionIndex", "(", "List", "<", "T", ">", "list", ",", "Comparator", "<", "?", "super", "T", ">", "comparator", ",", "T", "elt", ")", "{", "return", "getInsertionIndex", "(", "list", ",", ...
Replies the index at which the given element may be added in a sorted list. <p>This function assumes that the given list is sorted according to the given comparator. A dichotomic algorithm is used. <p>This function assumes that the given {@code elt} may appear many times in the list. @param <T> is the type of the elements. @param comparator is the comparator used to sort the list. @param elt is the element to add in. @param list is the list inside which the element should be added. @return the index at which the element may be added.
[ "Replies", "the", "index", "at", "which", "the", "given", "element", "may", "be", "added", "in", "a", "sorted", "list", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListUtil.java#L290-L293
venmo/cursor-utils
cursor-utils/src/main/java/com/venmo/cursor/CursorUtils.java
CursorUtils.consumeToLinkedList
public static <T> LinkedList<T> consumeToLinkedList(IterableCursor<T> cursor) { return consumeToCollection(cursor, new LinkedList<T>()); }
java
public static <T> LinkedList<T> consumeToLinkedList(IterableCursor<T> cursor) { return consumeToCollection(cursor, new LinkedList<T>()); }
[ "public", "static", "<", "T", ">", "LinkedList", "<", "T", ">", "consumeToLinkedList", "(", "IterableCursor", "<", "T", ">", "cursor", ")", "{", "return", "consumeToCollection", "(", "cursor", ",", "new", "LinkedList", "<", "T", ">", "(", ")", ")", ";", ...
Returns an {@link java.util.LinkedList} of the {@link android.database.Cursor} and closes it.
[ "Returns", "an", "{" ]
train
https://github.com/venmo/cursor-utils/blob/52cf91c4253346632fe70b8d7b7eab8bbcc9b248/cursor-utils/src/main/java/com/venmo/cursor/CursorUtils.java#L50-L52
finnyb/javampd
src/main/java/org/bff/javampd/monitor/MPDTrackMonitor.java
MPDTrackMonitor.fireTrackPositionChangeEvent
protected synchronized void fireTrackPositionChangeEvent(long newTime) { TrackPositionChangeEvent tpce = new TrackPositionChangeEvent(this, newTime); for (TrackPositionChangeListener tpcl : trackListeners) { tpcl.trackPositionChanged(tpce); } }
java
protected synchronized void fireTrackPositionChangeEvent(long newTime) { TrackPositionChangeEvent tpce = new TrackPositionChangeEvent(this, newTime); for (TrackPositionChangeListener tpcl : trackListeners) { tpcl.trackPositionChanged(tpce); } }
[ "protected", "synchronized", "void", "fireTrackPositionChangeEvent", "(", "long", "newTime", ")", "{", "TrackPositionChangeEvent", "tpce", "=", "new", "TrackPositionChangeEvent", "(", "this", ",", "newTime", ")", ";", "for", "(", "TrackPositionChangeListener", "tpcl", ...
Sends the appropriate {@link org.bff.javampd.player.TrackPositionChangeEvent} to all registered {@link TrackPositionChangeListener}s. @param newTime the new elapsed time
[ "Sends", "the", "appropriate", "{", "@link", "org", ".", "bff", ".", "javampd", ".", "player", ".", "TrackPositionChangeEvent", "}", "to", "all", "registered", "{", "@link", "TrackPositionChangeListener", "}", "s", "." ]
train
https://github.com/finnyb/javampd/blob/186736e85fc238b4208cc9ee23373f9249376b4c/src/main/java/org/bff/javampd/monitor/MPDTrackMonitor.java#L86-L92
codeprimate-software/cp-elements
src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java
AbstractConfiguration.getPropertyValue
public String getPropertyValue(final String propertyName, final boolean required) { String propertyValue = doGetPropertyValue(propertyName); if (StringUtils.isBlank(propertyValue) && getParent() != null) { propertyValue = getParent().getPropertyValue(propertyName, required); } if (StringUtils.isBlank(propertyValue) && required) { throw new ConfigurationException(String.format("The property (%1$s) is required!", propertyName)); } return defaultIfUnset(propertyValue, null); }
java
public String getPropertyValue(final String propertyName, final boolean required) { String propertyValue = doGetPropertyValue(propertyName); if (StringUtils.isBlank(propertyValue) && getParent() != null) { propertyValue = getParent().getPropertyValue(propertyName, required); } if (StringUtils.isBlank(propertyValue) && required) { throw new ConfigurationException(String.format("The property (%1$s) is required!", propertyName)); } return defaultIfUnset(propertyValue, null); }
[ "public", "String", "getPropertyValue", "(", "final", "String", "propertyName", ",", "final", "boolean", "required", ")", "{", "String", "propertyValue", "=", "doGetPropertyValue", "(", "propertyName", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "pr...
Gets the value of the configuration property identified by name. The required parameter can be used to indicate the property is not required and that a ConfigurationException should not be thrown if the property is undeclared or undefined. @param propertyName a String value indicating the name of the configuration property. @param required used to indicate whether the configuration property is required to be declared and defined. @return the value of the configuration property identified by name. @throws ConfigurationException if and only if the property is required and the property is either undeclared or undefined.
[ "Gets", "the", "value", "of", "the", "configuration", "property", "identified", "by", "name", ".", "The", "required", "parameter", "can", "be", "used", "to", "indicate", "the", "property", "is", "not", "required", "and", "that", "a", "ConfigurationException", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L194-L206
amaembo/streamex
src/main/java/one/util/streamex/EntryStream.java
EntryStream.append
public EntryStream<K, V> append(Map<K, V> map) { return appendSpliterator(null, map.entrySet().spliterator()); }
java
public EntryStream<K, V> append(Map<K, V> map) { return appendSpliterator(null, map.entrySet().spliterator()); }
[ "public", "EntryStream", "<", "K", ",", "V", ">", "append", "(", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "return", "appendSpliterator", "(", "null", ",", "map", ".", "entrySet", "(", ")", ".", "spliterator", "(", ")", ")", ";", "}" ]
Returns a new {@code EntryStream} which is a concatenation of this stream and the stream created from the supplied map entries. <p> This is a <a href="package-summary.html#StreamOps">quasi-intermediate operation</a>. <p> May return this if the supplied map is empty and non-concurrent. @param map the map to prepend to the stream @return the new stream @since 0.2.1
[ "Returns", "a", "new", "{", "@code", "EntryStream", "}", "which", "is", "a", "concatenation", "of", "this", "stream", "and", "the", "stream", "created", "from", "the", "supplied", "map", "entries", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L274-L276
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/internal/util/SerializationUtils.java
SerializationUtils.serializeFields
public static DBObject serializeFields(ObjectMapper objectMapper, DBObject object) { BasicDBObject serialised = null; for (String field : object.keySet()) { Object value = object.get(field); Object serialisedValue = serializeField(objectMapper, value); if (value != serialisedValue) { // It's changed if (serialised == null) { // Make a shallow copy of the object serialised = new BasicDBObject(); for (String f : object.keySet()) { serialised.put(f, object.get(f)); } } serialised.put(field, serialisedValue); } } if (serialised != null) { return serialised; } else { return object; } }
java
public static DBObject serializeFields(ObjectMapper objectMapper, DBObject object) { BasicDBObject serialised = null; for (String field : object.keySet()) { Object value = object.get(field); Object serialisedValue = serializeField(objectMapper, value); if (value != serialisedValue) { // It's changed if (serialised == null) { // Make a shallow copy of the object serialised = new BasicDBObject(); for (String f : object.keySet()) { serialised.put(f, object.get(f)); } } serialised.put(field, serialisedValue); } } if (serialised != null) { return serialised; } else { return object; } }
[ "public", "static", "DBObject", "serializeFields", "(", "ObjectMapper", "objectMapper", ",", "DBObject", "object", ")", "{", "BasicDBObject", "serialised", "=", "null", ";", "for", "(", "String", "field", ":", "object", ".", "keySet", "(", ")", ")", "{", "Ob...
Serialize the fields of the given object using the given object mapper. This will convert POJOs to DBObjects where necessary. @param objectMapper The object mapper to use to do the serialization @param object The object to serialize the fields of @return The DBObject, safe for serialization to MongoDB
[ "Serialize", "the", "fields", "of", "the", "given", "object", "using", "the", "given", "object", "mapper", ".", "This", "will", "convert", "POJOs", "to", "DBObjects", "where", "necessary", "." ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/internal/util/SerializationUtils.java#L77-L99
grails/grails-core
grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java
GrailsASTUtils.addExpressionToAnnotationMember
public static void addExpressionToAnnotationMember(AnnotationNode annotationNode, String memberName, Expression expression) { Expression exclude = annotationNode.getMember(memberName); if(exclude instanceof ListExpression) { ((ListExpression)exclude).addExpression(expression); } else if(exclude != null) { ListExpression list = new ListExpression(); list.addExpression(exclude); list.addExpression(expression); annotationNode.setMember(memberName, list); } else { annotationNode.setMember(memberName, expression); } }
java
public static void addExpressionToAnnotationMember(AnnotationNode annotationNode, String memberName, Expression expression) { Expression exclude = annotationNode.getMember(memberName); if(exclude instanceof ListExpression) { ((ListExpression)exclude).addExpression(expression); } else if(exclude != null) { ListExpression list = new ListExpression(); list.addExpression(exclude); list.addExpression(expression); annotationNode.setMember(memberName, list); } else { annotationNode.setMember(memberName, expression); } }
[ "public", "static", "void", "addExpressionToAnnotationMember", "(", "AnnotationNode", "annotationNode", ",", "String", "memberName", ",", "Expression", "expression", ")", "{", "Expression", "exclude", "=", "annotationNode", ".", "getMember", "(", "memberName", ")", ";...
Adds the given expression as a member of the given annotation @param annotationNode The annotation node @param memberName The name of the member @param expression The expression
[ "Adds", "the", "given", "expression", "as", "a", "member", "of", "the", "given", "annotation" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L794-L808
GeoLatte/geolatte-common-hibernate
src/main/java/org/geolatte/common/automapper/TableRef.java
TableRef.valueOf
public static TableRef valueOf(String schema, String tableName) { return new TableRef(null, schema, tableName); }
java
public static TableRef valueOf(String schema, String tableName) { return new TableRef(null, schema, tableName); }
[ "public", "static", "TableRef", "valueOf", "(", "String", "schema", ",", "String", "tableName", ")", "{", "return", "new", "TableRef", "(", "null", ",", "schema", ",", "tableName", ")", ";", "}" ]
Creates an instance from catalog and table names <p/> <p>if the schema parameter is an empty String, the catalog or schema will be set to <code>null</code>.</p> @param schema the table schema @param tableName the table name @return a <code>TableRef</code> for the table identified by the specified schema and table name. @throws IllegalArgumentException if the tableName parameter is null
[ "Creates", "an", "instance", "from", "catalog", "and", "table", "names", "<p", "/", ">", "<p", ">", "if", "the", "schema", "parameter", "is", "an", "empty", "String", "the", "catalog", "or", "schema", "will", "be", "set", "to", "<code", ">", "null<", "...
train
https://github.com/GeoLatte/geolatte-common-hibernate/blob/2e871c70e506df2485d91152fbd0955c94de1d39/src/main/java/org/geolatte/common/automapper/TableRef.java#L62-L64
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.findAll
public static List<String> findAll(CharSequence self, CharSequence regex) { return findAll(self, Pattern.compile(regex.toString())); }
java
public static List<String> findAll(CharSequence self, CharSequence regex) { return findAll(self, Pattern.compile(regex.toString())); }
[ "public", "static", "List", "<", "String", ">", "findAll", "(", "CharSequence", "self", ",", "CharSequence", "regex", ")", "{", "return", "findAll", "(", "self", ",", "Pattern", ".", "compile", "(", "regex", ".", "toString", "(", ")", ")", ")", ";", "}...
Returns a (possibly empty) list of all occurrences of a regular expression (provided as a CharSequence) found within a CharSequence. <p> For example, if the regex doesn't match, it returns an empty list: <pre> assert [] == "foo".findAll(/(\w*) Fish/) </pre> Any regular expression matches are returned in a list, and all regex capture groupings are ignored, only the full match is returned: <pre> def expected = ["One Fish", "Two Fish", "Red Fish", "Blue Fish"] assert expected == "One Fish, Two Fish, Red Fish, Blue Fish".findAll(/(\w*) Fish/) </pre> If you need to work with capture groups, then use the closure version of this method or use Groovy's matcher operators or use <tt>eachMatch</tt>. @param self a CharSequence @param regex the capturing regex CharSequence @return a List containing all full matches of the regex within the CharSequence, an empty list will be returned if there are no matches @see #findAll(CharSequence, Pattern) @since 1.8.2
[ "Returns", "a", "(", "possibly", "empty", ")", "list", "of", "all", "occurrences", "of", "a", "regular", "expression", "(", "provided", "as", "a", "CharSequence", ")", "found", "within", "a", "CharSequence", ".", "<p", ">", "For", "example", "if", "the", ...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1050-L1052
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.sizeAt
public SDVariable sizeAt(String name, SDVariable in, int dimension) { SDVariable ret = f().sizeAt(in, dimension); return updateVariableNameAndReference(ret, name); }
java
public SDVariable sizeAt(String name, SDVariable in, int dimension) { SDVariable ret = f().sizeAt(in, dimension); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "sizeAt", "(", "String", "name", ",", "SDVariable", "in", ",", "int", "dimension", ")", "{", "SDVariable", "ret", "=", "f", "(", ")", ".", "sizeAt", "(", "in", ",", "dimension", ")", ";", "return", "updateVariableNameAndReference", ...
Returns a rank 0 (scalar) variable for the size of the specified dimension. For example, if X has shape [10,20,30] then sizeAt(X,1)=20. Similarly, sizeAt(X,-1)=30 @param name Name of the output variable @param in Input variable @param dimension Dimension to get size of @return Scalar SDVariable for size at specified variable
[ "Returns", "a", "rank", "0", "(", "scalar", ")", "variable", "for", "the", "size", "of", "the", "specified", "dimension", ".", "For", "example", "if", "X", "has", "shape", "[", "10", "20", "30", "]", "then", "sizeAt", "(", "X", "1", ")", "=", "20",...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2442-L2445
zafarkhaja/jsemver
src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java
ExpressionParser.parseTildeRange
private CompositeExpression parseTildeRange() { consumeNextToken(TILDE); int major = intOf(consumeNextToken(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return gte(versionFor(major)).and(lt(versionFor(major + 1))); } consumeNextToken(DOT); int minor = intOf(consumeNextToken(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return gte(versionFor(major, minor)).and(lt(versionFor(major, minor + 1))); } consumeNextToken(DOT); int patch = intOf(consumeNextToken(NUMERIC).lexeme); return gte(versionFor(major, minor, patch)).and(lt(versionFor(major, minor + 1))); }
java
private CompositeExpression parseTildeRange() { consumeNextToken(TILDE); int major = intOf(consumeNextToken(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return gte(versionFor(major)).and(lt(versionFor(major + 1))); } consumeNextToken(DOT); int minor = intOf(consumeNextToken(NUMERIC).lexeme); if (!tokens.positiveLookahead(DOT)) { return gte(versionFor(major, minor)).and(lt(versionFor(major, minor + 1))); } consumeNextToken(DOT); int patch = intOf(consumeNextToken(NUMERIC).lexeme); return gte(versionFor(major, minor, patch)).and(lt(versionFor(major, minor + 1))); }
[ "private", "CompositeExpression", "parseTildeRange", "(", ")", "{", "consumeNextToken", "(", "TILDE", ")", ";", "int", "major", "=", "intOf", "(", "consumeNextToken", "(", "NUMERIC", ")", ".", "lexeme", ")", ";", "if", "(", "!", "tokens", ".", "positiveLooka...
Parses the {@literal <tilde-range>} non-terminal. <pre> {@literal <tilde-range> ::= "~" <version> } </pre> @return the expression AST
[ "Parses", "the", "{", "@literal", "<tilde", "-", "range", ">", "}", "non", "-", "terminal", "." ]
train
https://github.com/zafarkhaja/jsemver/blob/1f4996ea3dab06193c378fd66fd4f8fdc8334cc6/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L233-L247
taimos/spring-cxf-daemon
src/main/java/de/taimos/springcxfdaemon/websocket/ClientSocketAdapter.java
ClientSocketAdapter.readMessage
protected final <T> T readMessage(String message, Class<T> clazz) { if ((message == null) || message.isEmpty()) { ClientSocketAdapter.LOGGER.info("Got empty session data"); return null; } try { return this.mapper.readValue(message, clazz); } catch (IOException e1) { ClientSocketAdapter.LOGGER.info("Got invalid session data", e1); return null; } }
java
protected final <T> T readMessage(String message, Class<T> clazz) { if ((message == null) || message.isEmpty()) { ClientSocketAdapter.LOGGER.info("Got empty session data"); return null; } try { return this.mapper.readValue(message, clazz); } catch (IOException e1) { ClientSocketAdapter.LOGGER.info("Got invalid session data", e1); return null; } }
[ "protected", "final", "<", "T", ">", "T", "readMessage", "(", "String", "message", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "(", "message", "==", "null", ")", "||", "message", ".", "isEmpty", "(", ")", ")", "{", "ClientSocketAdapter...
reads the received string into the given class by parsing JSON @param <T> the expected type @param message the JSON string @param clazz the target class of type T @return the parsed object or null if parsing was not possible or message is null
[ "reads", "the", "received", "string", "into", "the", "given", "class", "by", "parsing", "JSON" ]
train
https://github.com/taimos/spring-cxf-daemon/blob/a2f2158043ab7339ac08d9acfc3fe61d5a34b43a/src/main/java/de/taimos/springcxfdaemon/websocket/ClientSocketAdapter.java#L98-L109
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/ParallelStepBuilder.java
ParallelStepBuilder.buildFlowInSplitSubJob
public static JSLJob buildFlowInSplitSubJob(long topLevelJobInstanceId, JobContext jobContext, Split split, Flow flow) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); // Uses the true top-level job instance id, not an internal "subjob" id. String subJobId = generateSubJobId(topLevelJobInstanceId, split.getId(), flow.getId()); subJob.setId(subJobId); //Copy all properties from parent JobContext to flow threads subJob.setProperties(CloneUtility.javaPropsTojslProperties(jobContext.getProperties())); //We don't need to do a deep copy here since each flow is already independent of all others, unlike in a partition //where one step instance can be executed with different properties on multiple threads. subJob.getExecutionElements().add(flow); return subJob; }
java
public static JSLJob buildFlowInSplitSubJob(long topLevelJobInstanceId, JobContext jobContext, Split split, Flow flow) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); // Uses the true top-level job instance id, not an internal "subjob" id. String subJobId = generateSubJobId(topLevelJobInstanceId, split.getId(), flow.getId()); subJob.setId(subJobId); //Copy all properties from parent JobContext to flow threads subJob.setProperties(CloneUtility.javaPropsTojslProperties(jobContext.getProperties())); //We don't need to do a deep copy here since each flow is already independent of all others, unlike in a partition //where one step instance can be executed with different properties on multiple threads. subJob.getExecutionElements().add(flow); return subJob; }
[ "public", "static", "JSLJob", "buildFlowInSplitSubJob", "(", "long", "topLevelJobInstanceId", ",", "JobContext", "jobContext", ",", "Split", "split", ",", "Flow", "flow", ")", "{", "ObjectFactory", "jslFactory", "=", "new", "ObjectFactory", "(", ")", ";", "JSLJob"...
/* Build a generated job with only one flow in it to submit to the BatchKernel. This is used to build subjobs from splits.
[ "/", "*", "Build", "a", "generated", "job", "with", "only", "one", "flow", "in", "it", "to", "submit", "to", "the", "BatchKernel", ".", "This", "is", "used", "to", "build", "subjobs", "from", "splits", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/ParallelStepBuilder.java#L40-L58
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/JqPlotUtils.java
JqPlotUtils.createJquery
public static String createJquery(Chart<?> chart, String divId, String javaScriptVar) { StringBuilder builder = new StringBuilder(); builder.append("$(document).ready(function(){\r\n"); if (javaScriptVar != null) { builder.append(" var ").append(javaScriptVar).append("="); } builder.append(" $.jqplot('").append(divId).append("', "); builder.append(chart.getChartData().toJsonString()); builder.append(", "); builder.append(jqPlotToJson(chart.getChartConfiguration())); builder.append(");\r\n"); builder.append("});\r\n"); return builder.toString(); }
java
public static String createJquery(Chart<?> chart, String divId, String javaScriptVar) { StringBuilder builder = new StringBuilder(); builder.append("$(document).ready(function(){\r\n"); if (javaScriptVar != null) { builder.append(" var ").append(javaScriptVar).append("="); } builder.append(" $.jqplot('").append(divId).append("', "); builder.append(chart.getChartData().toJsonString()); builder.append(", "); builder.append(jqPlotToJson(chart.getChartConfiguration())); builder.append(");\r\n"); builder.append("});\r\n"); return builder.toString(); }
[ "public", "static", "String", "createJquery", "(", "Chart", "<", "?", ">", "chart", ",", "String", "divId", ",", "String", "javaScriptVar", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "\"...
Cria um comando jquery @param chart Chart @param divId id of element div @param javaScriptVar javascript variable @return jquery javascript
[ "Cria", "um", "comando", "jquery" ]
train
https://github.com/inaiat/jqplot4java/blob/35bcd17749442e88695df0438c8330a65a3977cc/src/main/java/br/com/digilabs/jqplot/JqPlotUtils.java#L81-L94
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/CompareHelper.java
CompareHelper.le
public static <T> boolean le(Comparable<T> a, T b) { return le(a.compareTo(b)); }
java
public static <T> boolean le(Comparable<T> a, T b) { return le(a.compareTo(b)); }
[ "public", "static", "<", "T", ">", "boolean", "le", "(", "Comparable", "<", "T", ">", "a", ",", "T", "b", ")", "{", "return", "le", "(", "a", ".", "compareTo", "(", "b", ")", ")", ";", "}" ]
<code>a <= b</code> @param <T> @param a @param b @return true if a <= b
[ "<code", ">", "a", "<", "=", "b<", "/", "code", ">" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/CompareHelper.java#L98-L101
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java
TrailingHeaders.setHeader
public TrailingHeaders setHeader(CharSequence name, Object value) { lastHttpContent.trailingHeaders().set(name, value); return this; }
java
public TrailingHeaders setHeader(CharSequence name, Object value) { lastHttpContent.trailingHeaders().set(name, value); return this; }
[ "public", "TrailingHeaders", "setHeader", "(", "CharSequence", "name", ",", "Object", "value", ")", "{", "lastHttpContent", ".", "trailingHeaders", "(", ")", ".", "set", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Overwrites the current value, if any, of the passed trailing header to the passed value for this request. @param name Name of the header. @param value Value of the header. @return {@code this}.
[ "Overwrites", "the", "current", "value", "if", "any", "of", "the", "passed", "trailing", "header", "to", "the", "passed", "value", "for", "this", "request", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java#L75-L78
tempodb/tempodb-java
src/main/java/com/tempodb/Client.java
Client.readSingleValue
public Result<SingleValue> readSingleValue(Series series, DateTime timestamp, DateTimeZone timezone, Direction direction) { checkNotNull(series); checkNotNull(timestamp); checkNotNull(timezone); checkNotNull(direction); URI uri = null; try { URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/single/", API_VERSION, urlencode(series.getKey()))); addTimestampToURI(builder, timestamp); addTimeZoneToURI(builder, timezone); addDirectionToURI(builder, direction); uri = builder.build(); } catch (URISyntaxException e) { String message = String.format("Could not build URI with inputs: key: %s, timestamp: %s, timezone: %s, direction: %s", series.getKey(), timestamp.toString(), timezone.toString(), direction.toString()); throw new IllegalArgumentException(message, e); } HttpRequest request = buildRequest(uri.toString()); Result<SingleValue> result = execute(request, SingleValue.class); return result; }
java
public Result<SingleValue> readSingleValue(Series series, DateTime timestamp, DateTimeZone timezone, Direction direction) { checkNotNull(series); checkNotNull(timestamp); checkNotNull(timezone); checkNotNull(direction); URI uri = null; try { URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/single/", API_VERSION, urlencode(series.getKey()))); addTimestampToURI(builder, timestamp); addTimeZoneToURI(builder, timezone); addDirectionToURI(builder, direction); uri = builder.build(); } catch (URISyntaxException e) { String message = String.format("Could not build URI with inputs: key: %s, timestamp: %s, timezone: %s, direction: %s", series.getKey(), timestamp.toString(), timezone.toString(), direction.toString()); throw new IllegalArgumentException(message, e); } HttpRequest request = buildRequest(uri.toString()); Result<SingleValue> result = execute(request, SingleValue.class); return result; }
[ "public", "Result", "<", "SingleValue", ">", "readSingleValue", "(", "Series", "series", ",", "DateTime", "timestamp", ",", "DateTimeZone", "timezone", ",", "Direction", "direction", ")", "{", "checkNotNull", "(", "series", ")", ";", "checkNotNull", "(", "timest...
Reads a single value for a series at a specific timestamp. <p>The returned value (datapoint) can be null if there are no datapoints in the series or in the specified direction. @param series The series to read from @param timestamp The timestamp to read a value at @param timezone The timezone of the returned datapoint @param direction The direction to search if an exact timestamp match is not found @return The value at the specified timestamp @see SingleValue @since 1.1.0
[ "Reads", "a", "single", "value", "for", "a", "series", "at", "a", "specific", "timestamp", ".", "<p", ">", "The", "returned", "value", "(", "datapoint", ")", "can", "be", "null", "if", "there", "are", "no", "datapoints", "in", "the", "series", "or", "i...
train
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L453-L474
enioka/jqm
jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java
Helpers.updateNodeConfiguration
static void updateNodeConfiguration(String nodeName, DbConn cnx, int port) { // Node Integer nodeId = null; try { nodeId = cnx.runSelectSingle("node_select_by_key", Integer.class, nodeName); } catch (NoResultException e) { jqmlogger.info("Node " + nodeName + " does not exist in the configuration and will be created with default values"); nodeId = Node.create(cnx, nodeName, port, System.getProperty("user.dir") + "/jobs/", System.getProperty("user.dir") + "/jobs/", System.getProperty("user.dir") + "/tmp/", "localhost", "INFO").getId(); cnx.commit(); } // Deployment parameters long i = cnx.runSelectSingle("dp_select_count_for_node", Integer.class, nodeId); if (i == 0L) { jqmlogger.info("As this node is not bound to any queue, it will be set to poll from the default queue with default parameters"); Integer default_queue_id = cnx.runSelectSingle("q_select_default", 1, Integer.class); DeploymentParameter.create(cnx, nodeId, 5, 1000, default_queue_id); cnx.commit(); } }
java
static void updateNodeConfiguration(String nodeName, DbConn cnx, int port) { // Node Integer nodeId = null; try { nodeId = cnx.runSelectSingle("node_select_by_key", Integer.class, nodeName); } catch (NoResultException e) { jqmlogger.info("Node " + nodeName + " does not exist in the configuration and will be created with default values"); nodeId = Node.create(cnx, nodeName, port, System.getProperty("user.dir") + "/jobs/", System.getProperty("user.dir") + "/jobs/", System.getProperty("user.dir") + "/tmp/", "localhost", "INFO").getId(); cnx.commit(); } // Deployment parameters long i = cnx.runSelectSingle("dp_select_count_for_node", Integer.class, nodeId); if (i == 0L) { jqmlogger.info("As this node is not bound to any queue, it will be set to poll from the default queue with default parameters"); Integer default_queue_id = cnx.runSelectSingle("q_select_default", 1, Integer.class); DeploymentParameter.create(cnx, nodeId, 5, 1000, default_queue_id); cnx.commit(); } }
[ "static", "void", "updateNodeConfiguration", "(", "String", "nodeName", ",", "DbConn", "cnx", ",", "int", "port", ")", "{", "// Node", "Integer", "nodeId", "=", "null", ";", "try", "{", "nodeId", "=", "cnx", ".", "runSelectSingle", "(", "\"node_select_by_key\"...
Creates or updates a node.<br> This method makes the assumption metadata is valid. e.g. there MUST be a single default queue.<br> Call {@link #updateConfiguration(EntityManager)} before to be sure if necessary. @param nodeName name of the node that should be created or updated (if incompletely defined only) @param em an EntityManager on which a transaction will be opened.
[ "Creates", "or", "updates", "a", "node", ".", "<br", ">", "This", "method", "makes", "the", "assumption", "metadata", "is", "valid", ".", "e", ".", "g", ".", "there", "MUST", "be", "a", "single", "default", "queue", ".", "<br", ">", "Call", "{", "@li...
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/Helpers.java#L312-L339
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/InternationalFixedChronology.java
InternationalFixedChronology.dateYearDay
@Override public InternationalFixedDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
java
@Override public InternationalFixedDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
[ "@", "Override", "public", "InternationalFixedDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "return", "dateYearDay", "(", "prolepticYear", "(", "era", ",", "yearOfEra", ")", ",", "dayOfYear", ")", ";", "...
Obtains a local date in International Fixed calendar system from the era, year-of-era and day-of-year fields. @param era the International Fixed era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the International Fixed local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code InternationalFixedEra}
[ "Obtains", "a", "local", "date", "in", "International", "Fixed", "calendar", "system", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/InternationalFixedChronology.java#L255-L258
intellimate/Izou
src/main/java/org/intellimate/izou/system/file/FileManager.java
FileManager.createDefaultFile
public void createDefaultFile(String defaultFilePath, String initMessage) throws IOException { File file = new File(defaultFilePath); BufferedWriter bufferedWriterInit = null; try { if (!file.exists()) { file.createNewFile(); bufferedWriterInit = new BufferedWriter(new FileWriter(defaultFilePath)); bufferedWriterInit.write(initMessage); } } catch (IOException e) { error("unable to create the Default-File", e); } finally { if(bufferedWriterInit != null) { try { bufferedWriterInit.close(); } catch (IOException e) { error("Unable to close input stream", e); } } } }
java
public void createDefaultFile(String defaultFilePath, String initMessage) throws IOException { File file = new File(defaultFilePath); BufferedWriter bufferedWriterInit = null; try { if (!file.exists()) { file.createNewFile(); bufferedWriterInit = new BufferedWriter(new FileWriter(defaultFilePath)); bufferedWriterInit.write(initMessage); } } catch (IOException e) { error("unable to create the Default-File", e); } finally { if(bufferedWriterInit != null) { try { bufferedWriterInit.close(); } catch (IOException e) { error("Unable to close input stream", e); } } } }
[ "public", "void", "createDefaultFile", "(", "String", "defaultFilePath", ",", "String", "initMessage", ")", "throws", "IOException", "{", "File", "file", "=", "new", "File", "(", "defaultFilePath", ")", ";", "BufferedWriter", "bufferedWriterInit", "=", "null", ";"...
Creates a default File in case it does not exist yet. Default files can be used to load other files that are created at runtime (like properties file) @param defaultFilePath path to default file.txt (or where it should be created) @param initMessage the string to write in default file @throws IOException is thrown by bufferedWriter
[ "Creates", "a", "default", "File", "in", "case", "it", "does", "not", "exist", "yet", ".", "Default", "files", "can", "be", "used", "to", "load", "other", "files", "that", "are", "created", "at", "runtime", "(", "like", "properties", "file", ")" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/system/file/FileManager.java#L113-L133
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java
ParameterFormatter.handleLiteralChar
private static void handleLiteralChar(final StringBuilder buffer, final int escapeCounter, final char curChar) { // any other char beside ESCAPE or DELIM_START/STOP-combo // write unescaped escape chars writeUnescapedEscapeChars(escapeCounter, buffer); buffer.append(curChar); }
java
private static void handleLiteralChar(final StringBuilder buffer, final int escapeCounter, final char curChar) { // any other char beside ESCAPE or DELIM_START/STOP-combo // write unescaped escape chars writeUnescapedEscapeChars(escapeCounter, buffer); buffer.append(curChar); }
[ "private", "static", "void", "handleLiteralChar", "(", "final", "StringBuilder", "buffer", ",", "final", "int", "escapeCounter", ",", "final", "char", "curChar", ")", "{", "// any other char beside ESCAPE or DELIM_START/STOP-combo", "// write unescaped escape chars", "writeUn...
16 bytes (allows immediate JVM inlining: < 35 bytes) LOG4J2-1096
[ "16", "bytes", "(", "allows", "immediate", "JVM", "inlining", ":", "<", "35", "bytes", ")", "LOG4J2", "-", "1096" ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java#L307-L312
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.data_smd_smdId_PUT
public OvhSmd data_smd_smdId_PUT(Long smdId, String data) throws IOException { String qPath = "/domain/data/smd/{smdId}"; StringBuilder sb = path(qPath, smdId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "data", data); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhSmd.class); }
java
public OvhSmd data_smd_smdId_PUT(Long smdId, String data) throws IOException { String qPath = "/domain/data/smd/{smdId}"; StringBuilder sb = path(qPath, smdId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "data", data); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhSmd.class); }
[ "public", "OvhSmd", "data_smd_smdId_PUT", "(", "Long", "smdId", ",", "String", "data", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/data/smd/{smdId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "smdId", ")", ";", "Ha...
Modify an existing SMD file REST: PUT /domain/data/smd/{smdId} @param smdId [required] SMD ID @param data [required] SMD content file
[ "Modify", "an", "existing", "SMD", "file" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L155-L162
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwt/src/com/ibm/websphere/security/jwt/JwtBuilder.java
JwtBuilder.signWith
public JwtBuilder signWith(String algorithm, Key key) throws KeyException { builder = builder.signWith(algorithm, key); return this; }
java
public JwtBuilder signWith(String algorithm, Key key) throws KeyException { builder = builder.signWith(algorithm, key); return this; }
[ "public", "JwtBuilder", "signWith", "(", "String", "algorithm", ",", "Key", "key", ")", "throws", "KeyException", "{", "builder", "=", "builder", ".", "signWith", "(", "algorithm", ",", "key", ")", ";", "return", "this", ";", "}" ]
Signing key and algorithm information. @param algorithm This String value represents the signing algorithm. This information will be used to sign the {@code JwtToken} @param key The private key {@code Key} to use for signing JWTs. @return {@code JwtBuilder} object @throws KeyException Thrown if the key is {@code null} or if algorithm is {@code null} or empty
[ "Signing", "key", "and", "algorithm", "information", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/websphere/security/jwt/JwtBuilder.java#L327-L330
realexpayments/rxp-hpp-java
src/main/java/com/realexpayments/hpp/sdk/RealexHpp.java
RealexHpp.requestToJson
public String requestToJson(HppRequest hppRequest, boolean encoded ) { LOGGER.info("Converting HppRequest to JSON."); String json = null; //generate defaults LOGGER.debug("Generating defaults."); hppRequest.generateDefaults(secret); //validate request LOGGER.debug("Validating request."); ValidationUtils.validate(hppRequest); //encode LOGGER.debug("Encoding object."); try { if(encoded){ hppRequest = hppRequest.encode(ENCODING_CHARSET); } } catch (UnsupportedEncodingException ex) { LOGGER.error("Exception encoding HPP request.", ex); throw new RealexException("Exception encoding HPP request.", ex); } //convert to JSON LOGGER.debug("Converting to JSON."); json = JsonUtils.toJson(hppRequest); return json; }
java
public String requestToJson(HppRequest hppRequest, boolean encoded ) { LOGGER.info("Converting HppRequest to JSON."); String json = null; //generate defaults LOGGER.debug("Generating defaults."); hppRequest.generateDefaults(secret); //validate request LOGGER.debug("Validating request."); ValidationUtils.validate(hppRequest); //encode LOGGER.debug("Encoding object."); try { if(encoded){ hppRequest = hppRequest.encode(ENCODING_CHARSET); } } catch (UnsupportedEncodingException ex) { LOGGER.error("Exception encoding HPP request.", ex); throw new RealexException("Exception encoding HPP request.", ex); } //convert to JSON LOGGER.debug("Converting to JSON."); json = JsonUtils.toJson(hppRequest); return json; }
[ "public", "String", "requestToJson", "(", "HppRequest", "hppRequest", ",", "boolean", "encoded", ")", "{", "LOGGER", ".", "info", "(", "\"Converting HppRequest to JSON.\"", ")", ";", "String", "json", "=", "null", ";", "//generate defaults", "LOGGER", ".", "debug"...
<p> Method produces JSON from <code>HppRequest</code> object. Carries out the following actions: <ul> <li>Validates inputs</li> <li>Generates defaults for security hash, order ID and time stamp (if required)</li> <li>Optional to Base64 encode inputs</li> <li>Serialises request object to JSON</li> </ul> </p> @param hppRequest @param encoded <code>true</code> if the JSON values should be encoded. @return String
[ "<p", ">", "Method", "produces", "JSON", "from", "<code", ">", "HppRequest<", "/", "code", ">", "object", ".", "Carries", "out", "the", "following", "actions", ":", "<ul", ">", "<li", ">", "Validates", "inputs<", "/", "li", ">", "<li", ">", "Generates", ...
train
https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/RealexHpp.java#L79-L110
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.veeamCloudConnect_serviceName_upgrade_GET
public ArrayList<String> veeamCloudConnect_serviceName_upgrade_GET(String serviceName, OvhOffer offer) throws IOException { String qPath = "/order/veeamCloudConnect/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "offer", offer); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> veeamCloudConnect_serviceName_upgrade_GET(String serviceName, OvhOffer offer) throws IOException { String qPath = "/order/veeamCloudConnect/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "offer", offer); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "veeamCloudConnect_serviceName_upgrade_GET", "(", "String", "serviceName", ",", "OvhOffer", "offer", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/veeamCloudConnect/{serviceName}/upgrade\"", ";", "StringBuild...
Get allowed durations for 'upgrade' option REST: GET /order/veeamCloudConnect/{serviceName}/upgrade @param offer [required] The offer on which you want to be upgraded @param serviceName [required]
[ "Get", "allowed", "durations", "for", "upgrade", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2040-L2046
contentful/contentful.java
src/main/java/com/contentful/java/cda/TransformQuery.java
TransformQuery.one
public Flowable<Transformed> one(String id) { try { return baseQuery() .one(id) .filter(new Predicate<CDAEntry>() { @Override public boolean test(CDAEntry entry) { return entry.contentType().id() .equals(contentTypeId); } }) .map(new Function<CDAEntry, Transformed>() { @Override public Transformed apply(CDAEntry entry) throws Exception { return TransformQuery.this.transform(entry); } }); } catch (NullPointerException e) { throw new CDAResourceNotFoundException(CDAEntry.class, id); } }
java
public Flowable<Transformed> one(String id) { try { return baseQuery() .one(id) .filter(new Predicate<CDAEntry>() { @Override public boolean test(CDAEntry entry) { return entry.contentType().id() .equals(contentTypeId); } }) .map(new Function<CDAEntry, Transformed>() { @Override public Transformed apply(CDAEntry entry) throws Exception { return TransformQuery.this.transform(entry); } }); } catch (NullPointerException e) { throw new CDAResourceNotFoundException(CDAEntry.class, id); } }
[ "public", "Flowable", "<", "Transformed", ">", "one", "(", "String", "id", ")", "{", "try", "{", "return", "baseQuery", "(", ")", ".", "one", "(", "id", ")", ".", "filter", "(", "new", "Predicate", "<", "CDAEntry", ">", "(", ")", "{", "@", "Overrid...
Retrieve the transformed entry from Contentful. @param id the id of the entry of type Transformed. @return the Transformed entry. @throws CDAResourceNotFoundException if no such resource was found. @throws IllegalStateException if the transformed class could not be created. @throws IllegalStateException if the transformed class could not be accessed.
[ "Retrieve", "the", "transformed", "entry", "from", "Contentful", "." ]
train
https://github.com/contentful/contentful.java/blob/6ecc2ace454c674b218b99489dc50697b1dbffcb/src/main/java/com/contentful/java/cda/TransformQuery.java#L148-L168
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/statistic/Histogram.java
Histogram.setStrategy
public void setStrategy( T minimum, T maximum ) { this.bucketingStrategy = new ExplicitBucketingStrategy(minimum, maximum); this.bucketWidth = null; }
java
public void setStrategy( T minimum, T maximum ) { this.bucketingStrategy = new ExplicitBucketingStrategy(minimum, maximum); this.bucketWidth = null; }
[ "public", "void", "setStrategy", "(", "T", "minimum", ",", "T", "maximum", ")", "{", "this", ".", "bucketingStrategy", "=", "new", "ExplicitBucketingStrategy", "(", "minimum", ",", "maximum", ")", ";", "this", ".", "bucketWidth", "=", "null", ";", "}" ]
Set the histogram to use the supplied minimum and maximum values to determine the bucket size. @param minimum @param maximum
[ "Set", "the", "histogram", "to", "use", "the", "supplied", "minimum", "and", "maximum", "values", "to", "determine", "the", "bucket", "size", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/statistic/Histogram.java#L94-L98
lecho/hellocharts-android
hellocharts-library/src/lecho/lib/hellocharts/model/Axis.java
Axis.generateAxisFromCollection
public static Axis generateAxisFromCollection(List<Float> axisValues, List<String> axisValuesLabels) { if (axisValues.size() != axisValuesLabels.size()) { throw new IllegalArgumentException("Values and labels lists must have the same size!"); } List<AxisValue> values = new ArrayList<AxisValue>(); int index = 0; for (float value : axisValues) { AxisValue axisValue = new AxisValue(value).setLabel(axisValuesLabels.get(index)); values.add(axisValue); ++index; } Axis axis = new Axis(values); return axis; }
java
public static Axis generateAxisFromCollection(List<Float> axisValues, List<String> axisValuesLabels) { if (axisValues.size() != axisValuesLabels.size()) { throw new IllegalArgumentException("Values and labels lists must have the same size!"); } List<AxisValue> values = new ArrayList<AxisValue>(); int index = 0; for (float value : axisValues) { AxisValue axisValue = new AxisValue(value).setLabel(axisValuesLabels.get(index)); values.add(axisValue); ++index; } Axis axis = new Axis(values); return axis; }
[ "public", "static", "Axis", "generateAxisFromCollection", "(", "List", "<", "Float", ">", "axisValues", ",", "List", "<", "String", ">", "axisValuesLabels", ")", "{", "if", "(", "axisValues", ".", "size", "(", ")", "!=", "axisValuesLabels", ".", "size", "(",...
Generates Axis with values and labels from given lists, both lists must have the same size.
[ "Generates", "Axis", "with", "values", "and", "labels", "from", "given", "lists", "both", "lists", "must", "have", "the", "same", "size", "." ]
train
https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/model/Axis.java#L143-L158
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java
RunsInner.beginUpdateAsync
public Observable<RunInner> beginUpdateAsync(String resourceGroupName, String registryName, String runId) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunInner>, RunInner>() { @Override public RunInner call(ServiceResponse<RunInner> response) { return response.body(); } }); }
java
public Observable<RunInner> beginUpdateAsync(String resourceGroupName, String registryName, String runId) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunInner>, RunInner>() { @Override public RunInner call(ServiceResponse<RunInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RunInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "runId", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", ...
Patch the run properties. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param runId The run ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RunInner object
[ "Patch", "the", "run", "properties", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L630-L637
perwendel/spark
src/main/java/spark/RouteImpl.java
RouteImpl.create
public static RouteImpl create(final String path, final Route route) { return create(path, DEFAULT_ACCEPT_TYPE, route); }
java
public static RouteImpl create(final String path, final Route route) { return create(path, DEFAULT_ACCEPT_TYPE, route); }
[ "public", "static", "RouteImpl", "create", "(", "final", "String", "path", ",", "final", "Route", "route", ")", "{", "return", "create", "(", "path", ",", "DEFAULT_ACCEPT_TYPE", ",", "route", ")", ";", "}" ]
Wraps the route in RouteImpl @param path the path @param route the route @return the wrapped route
[ "Wraps", "the", "route", "in", "RouteImpl" ]
train
https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/RouteImpl.java#L53-L55
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getPsi
public static final double getPsi(AminoAcid a, AminoAcid b) throws StructureException { if ( ! isConnected(a,b)) { throw new StructureException( "can not calc Psi - AminoAcids are not connected!"); } Atom a_N = a.getN(); Atom a_CA = a.getCA(); Atom a_C = a.getC(); Atom b_N = b.getN(); // C and N were checked in isConnected already if (a_CA == null) throw new StructureException( "Can not calculate Psi, CA atom is missing"); return torsionAngle(a_N,a_CA,a_C,b_N); }
java
public static final double getPsi(AminoAcid a, AminoAcid b) throws StructureException { if ( ! isConnected(a,b)) { throw new StructureException( "can not calc Psi - AminoAcids are not connected!"); } Atom a_N = a.getN(); Atom a_CA = a.getCA(); Atom a_C = a.getC(); Atom b_N = b.getN(); // C and N were checked in isConnected already if (a_CA == null) throw new StructureException( "Can not calculate Psi, CA atom is missing"); return torsionAngle(a_N,a_CA,a_C,b_N); }
[ "public", "static", "final", "double", "getPsi", "(", "AminoAcid", "a", ",", "AminoAcid", "b", ")", "throws", "StructureException", "{", "if", "(", "!", "isConnected", "(", "a", ",", "b", ")", ")", "{", "throw", "new", "StructureException", "(", "\"can not...
Calculate the psi angle. @param a an AminoAcid object @param b an AminoAcid object @return a double @throws StructureException if aminoacids not connected or if any of the 4 needed atoms missing
[ "Calculate", "the", "psi", "angle", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L308-L327
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatial/rectangleAlgebra/RectangleConstraintSolver.java
RectangleConstraintSolver.drawAlmostCentreRectangle
public String drawAlmostCentreRectangle(long horizon, HashMap<String, Rectangle> rect){ String ret = ""; int j = 1; ret = "set xrange [0:" + horizon +"]"+ "\n"; ret += "set yrange [0:" + horizon +"]" + "\n"; int i = 0; for (String str : rect.keySet()) { //rec ret += "set obj " + j + " rect from " + rect.get(str).getMinX() + "," + rect.get(str).getMinY() +" to " + rect.get(str).getMaxX() + "," + rect.get(str).getMaxY() + " front fs transparent solid 0.0 border " + (i+1) +" lw 2" + "\n"; j++; //label of centre Rec ret += "set label " + "\""+ str +"\""+" at "+ rect.get(str).getCenterX() +"," + rect.get(str).getCenterY() + " textcolor lt " + (i+1) + " font \"9\"" + "\n"; j++; i++; } ret += "plot " + "NaN" + "\n"; ret += "pause -1"; return ret; }
java
public String drawAlmostCentreRectangle(long horizon, HashMap<String, Rectangle> rect){ String ret = ""; int j = 1; ret = "set xrange [0:" + horizon +"]"+ "\n"; ret += "set yrange [0:" + horizon +"]" + "\n"; int i = 0; for (String str : rect.keySet()) { //rec ret += "set obj " + j + " rect from " + rect.get(str).getMinX() + "," + rect.get(str).getMinY() +" to " + rect.get(str).getMaxX() + "," + rect.get(str).getMaxY() + " front fs transparent solid 0.0 border " + (i+1) +" lw 2" + "\n"; j++; //label of centre Rec ret += "set label " + "\""+ str +"\""+" at "+ rect.get(str).getCenterX() +"," + rect.get(str).getCenterY() + " textcolor lt " + (i+1) + " font \"9\"" + "\n"; j++; i++; } ret += "plot " + "NaN" + "\n"; ret += "pause -1"; return ret; }
[ "public", "String", "drawAlmostCentreRectangle", "(", "long", "horizon", ",", "HashMap", "<", "String", ",", "Rectangle", ">", "rect", ")", "{", "String", "ret", "=", "\"\"", ";", "int", "j", "=", "1", ";", "ret", "=", "\"set xrange [0:\"", "+", "horizon",...
Output a Gnuplot-readable script that draws, for each given {@link RectangularRegion}, a rectangle which is close to the "center" of the {@link RectangularRegion}'s domain. @param horizon The maximum X and Y coordinate to be used in the plot. @param rect The set of {@link RectangularRegion}s to draw. @return A Gnuplot script.
[ "Output", "a", "Gnuplot", "-", "readable", "script", "that", "draws", "for", "each", "given", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatial/rectangleAlgebra/RectangleConstraintSolver.java#L142-L164
google/closure-compiler
src/com/google/javascript/jscomp/AstFactory.java
AstFactory.createFor
Node createFor(Node init, Node cond, Node incr, Node body) { return IR.forNode(init, cond, incr, body); }
java
Node createFor(Node init, Node cond, Node incr, Node body) { return IR.forNode(init, cond, incr, body); }
[ "Node", "createFor", "(", "Node", "init", ",", "Node", "cond", ",", "Node", "incr", ",", "Node", "body", ")", "{", "return", "IR", ".", "forNode", "(", "init", ",", "cond", ",", "incr", ",", "body", ")", ";", "}" ]
Returns a new FOR node. <p>Blocks have no type information, so this is functionally the same as calling {@code IR.forNode(init, cond, incr, body)}. It exists so that a pass can be consistent about always using {@code AstFactory} to create new nodes.
[ "Returns", "a", "new", "FOR", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L154-L156
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.findOtherSubMessage
private int findOtherSubMessage(int partIndex) { int count=msgPattern.countParts(); MessagePattern.Part part=msgPattern.getPart(partIndex); if(part.getType().hasNumericValue()) { ++partIndex; } // Iterate over (ARG_SELECTOR [ARG_INT|ARG_DOUBLE] message) tuples // until ARG_LIMIT or end of plural-only pattern. do { part=msgPattern.getPart(partIndex++); MessagePattern.Part.Type type=part.getType(); if(type==MessagePattern.Part.Type.ARG_LIMIT) { break; } assert type==MessagePattern.Part.Type.ARG_SELECTOR; // part is an ARG_SELECTOR followed by an optional explicit value, and then a message if(msgPattern.partSubstringMatches(part, "other")) { return partIndex; } if(msgPattern.getPartType(partIndex).hasNumericValue()) { ++partIndex; // skip the numeric-value part of "=1" etc. } partIndex=msgPattern.getLimitPartIndex(partIndex); } while(++partIndex<count); return 0; }
java
private int findOtherSubMessage(int partIndex) { int count=msgPattern.countParts(); MessagePattern.Part part=msgPattern.getPart(partIndex); if(part.getType().hasNumericValue()) { ++partIndex; } // Iterate over (ARG_SELECTOR [ARG_INT|ARG_DOUBLE] message) tuples // until ARG_LIMIT or end of plural-only pattern. do { part=msgPattern.getPart(partIndex++); MessagePattern.Part.Type type=part.getType(); if(type==MessagePattern.Part.Type.ARG_LIMIT) { break; } assert type==MessagePattern.Part.Type.ARG_SELECTOR; // part is an ARG_SELECTOR followed by an optional explicit value, and then a message if(msgPattern.partSubstringMatches(part, "other")) { return partIndex; } if(msgPattern.getPartType(partIndex).hasNumericValue()) { ++partIndex; // skip the numeric-value part of "=1" etc. } partIndex=msgPattern.getLimitPartIndex(partIndex); } while(++partIndex<count); return 0; }
[ "private", "int", "findOtherSubMessage", "(", "int", "partIndex", ")", "{", "int", "count", "=", "msgPattern", ".", "countParts", "(", ")", ";", "MessagePattern", ".", "Part", "part", "=", "msgPattern", ".", "getPart", "(", "partIndex", ")", ";", "if", "("...
Finds the "other" sub-message. @param partIndex the index of the first PluralFormat argument style part. @return the "other" sub-message start part index.
[ "Finds", "the", "other", "sub", "-", "message", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L1940-L1965
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/TransformationUtils.java
TransformationUtils.getWorldToRectangle
public static AffineTransformation getWorldToRectangle( Envelope worldEnvelope, Rectangle pixelRectangle ) { int cols = (int) pixelRectangle.getWidth(); int rows = (int) pixelRectangle.getHeight(); double worldWidth = worldEnvelope.getWidth(); double worldHeight = worldEnvelope.getHeight(); double x = -worldEnvelope.getMinX(); double y = -worldEnvelope.getMinY(); AffineTransformation translate = AffineTransformation.translationInstance(x, y); double xScale = cols / worldWidth; double yScale = rows / worldHeight; AffineTransformation scale = AffineTransformation.scaleInstance(xScale, yScale); int m00 = 1; int m10 = 0; int m01 = 0; int m11 = -1; int m02 = 0; int m12 = rows; AffineTransformation mirror_y = new AffineTransformation(m00, m01, m02, m10, m11, m12); AffineTransformation world2pixel = new AffineTransformation(translate); world2pixel.compose(scale); world2pixel.compose(mirror_y); return world2pixel; }
java
public static AffineTransformation getWorldToRectangle( Envelope worldEnvelope, Rectangle pixelRectangle ) { int cols = (int) pixelRectangle.getWidth(); int rows = (int) pixelRectangle.getHeight(); double worldWidth = worldEnvelope.getWidth(); double worldHeight = worldEnvelope.getHeight(); double x = -worldEnvelope.getMinX(); double y = -worldEnvelope.getMinY(); AffineTransformation translate = AffineTransformation.translationInstance(x, y); double xScale = cols / worldWidth; double yScale = rows / worldHeight; AffineTransformation scale = AffineTransformation.scaleInstance(xScale, yScale); int m00 = 1; int m10 = 0; int m01 = 0; int m11 = -1; int m02 = 0; int m12 = rows; AffineTransformation mirror_y = new AffineTransformation(m00, m01, m02, m10, m11, m12); AffineTransformation world2pixel = new AffineTransformation(translate); world2pixel.compose(scale); world2pixel.compose(mirror_y); return world2pixel; }
[ "public", "static", "AffineTransformation", "getWorldToRectangle", "(", "Envelope", "worldEnvelope", ",", "Rectangle", "pixelRectangle", ")", "{", "int", "cols", "=", "(", "int", ")", "pixelRectangle", ".", "getWidth", "(", ")", ";", "int", "rows", "=", "(", "...
Get the affine transform that brings from the world envelope to the rectangle. @param worldEnvelope the envelope. @param pixelRectangle the destination rectangle. @return the transform.
[ "Get", "the", "affine", "transform", "that", "brings", "from", "the", "world", "envelope", "to", "the", "rectangle", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/TransformationUtils.java#L69-L94
Netflix/karyon
karyon2-governator/src/main/java/netflix/karyon/Karyon.java
Karyon.forUdpServer
public static KaryonServer forUdpServer(UdpServer<?, ?> server, Module... modules) { return forUdpServer(server, toBootstrapModule(modules)); }
java
public static KaryonServer forUdpServer(UdpServer<?, ?> server, Module... modules) { return forUdpServer(server, toBootstrapModule(modules)); }
[ "public", "static", "KaryonServer", "forUdpServer", "(", "UdpServer", "<", "?", ",", "?", ">", "server", ",", "Module", "...", "modules", ")", "{", "return", "forUdpServer", "(", "server", ",", "toBootstrapModule", "(", "modules", ")", ")", ";", "}" ]
Creates a new {@link KaryonServer} which combines lifecycle of the passed {@link UdpServer} with it's own lifecycle. @param server UDP server @param modules Additional modules if any. @return {@link KaryonServer} which is to be used to start the created server.
[ "Creates", "a", "new", "{", "@link", "KaryonServer", "}", "which", "combines", "lifecycle", "of", "the", "passed", "{", "@link", "UdpServer", "}", "with", "it", "s", "own", "lifecycle", "." ]
train
https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-governator/src/main/java/netflix/karyon/Karyon.java#L231-L233
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java
AbstractSequenceClassifier.classifySentenceStdin
public boolean classifySentenceStdin(DocumentReaderAndWriter<IN> readerWriter) throws IOException { BufferedReader is = new BufferedReader(new InputStreamReader(System.in, flags.inputEncoding)); String line; String text = ""; String eol = "\n"; String sentence = "<s>"; while ((line = is.readLine()) != null) { if (line.trim().equals("")) { text += sentence + eol; ObjectBank<List<IN>> documents = makeObjectBankFromString(text, readerWriter); classifyAndWriteAnswers(documents, readerWriter); text = ""; } else { text += line + eol; } } if (text.trim().equals("")) { return false; } return true; }
java
public boolean classifySentenceStdin(DocumentReaderAndWriter<IN> readerWriter) throws IOException { BufferedReader is = new BufferedReader(new InputStreamReader(System.in, flags.inputEncoding)); String line; String text = ""; String eol = "\n"; String sentence = "<s>"; while ((line = is.readLine()) != null) { if (line.trim().equals("")) { text += sentence + eol; ObjectBank<List<IN>> documents = makeObjectBankFromString(text, readerWriter); classifyAndWriteAnswers(documents, readerWriter); text = ""; } else { text += line + eol; } } if (text.trim().equals("")) { return false; } return true; }
[ "public", "boolean", "classifySentenceStdin", "(", "DocumentReaderAndWriter", "<", "IN", ">", "readerWriter", ")", "throws", "IOException", "{", "BufferedReader", "is", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "System", ".", "in", ",", "...
Classify stdin by senteces seperated by blank line @param readerWriter @return @throws IOException
[ "Classify", "stdin", "by", "senteces", "seperated", "by", "blank", "line" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java#L1013-L1036
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/dialects/MSSQLDialect.java
MSSQLDialect.overrideDriverTypeConversion
@Override public Object overrideDriverTypeConversion(MetaModel mm, String attributeName, Object value) { if (value instanceof String && !Util.blank(value)) { String typeName = mm.getColumnMetadata().get(attributeName).getTypeName(); if ("date".equalsIgnoreCase(typeName)) { return java.sql.Date.valueOf((String) value); } else if ("datetime2".equalsIgnoreCase(typeName)) { return java.sql.Timestamp.valueOf((String) value); } } return value; }
java
@Override public Object overrideDriverTypeConversion(MetaModel mm, String attributeName, Object value) { if (value instanceof String && !Util.blank(value)) { String typeName = mm.getColumnMetadata().get(attributeName).getTypeName(); if ("date".equalsIgnoreCase(typeName)) { return java.sql.Date.valueOf((String) value); } else if ("datetime2".equalsIgnoreCase(typeName)) { return java.sql.Timestamp.valueOf((String) value); } } return value; }
[ "@", "Override", "public", "Object", "overrideDriverTypeConversion", "(", "MetaModel", "mm", ",", "String", "attributeName", ",", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "String", "&&", "!", "Util", ".", "blank", "(", "value", ")", ")"...
TDS converts a number of important data types to String. This isn't what we want, nor helpful. Here, we change them back.
[ "TDS", "converts", "a", "number", "of", "important", "data", "types", "to", "String", ".", "This", "isn", "t", "what", "we", "want", "nor", "helpful", ".", "Here", "we", "change", "them", "back", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/dialects/MSSQLDialect.java#L102-L113
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/validation/SequenceEntryUtils.java
SequenceEntryUtils.deleteDeletedValueQualifiers
public static boolean deleteDeletedValueQualifiers(Feature feature, ArrayList<Qualifier> deleteQualifierList) { boolean deleted = false; for (Qualifier qual : deleteQualifierList) { feature.removeQualifier(qual); deleted = true; } return deleted; }
java
public static boolean deleteDeletedValueQualifiers(Feature feature, ArrayList<Qualifier> deleteQualifierList) { boolean deleted = false; for (Qualifier qual : deleteQualifierList) { feature.removeQualifier(qual); deleted = true; } return deleted; }
[ "public", "static", "boolean", "deleteDeletedValueQualifiers", "(", "Feature", "feature", ",", "ArrayList", "<", "Qualifier", ">", "deleteQualifierList", ")", "{", "boolean", "deleted", "=", "false", ";", "for", "(", "Qualifier", "qual", ":", "deleteQualifierList", ...
deletes the qualifiers which have 'DELETED' value @param feature
[ "deletes", "the", "qualifiers", "which", "have", "DELETED", "value" ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/SequenceEntryUtils.java#L617-L627
apache/incubator-gobblin
gobblin-modules/gobblin-parquet/src/main/java/org/apache/gobblin/writer/ParquetDataWriterBuilder.java
ParquetDataWriterBuilder.getWriter
public ParquetWriter<Group> getWriter(int blockSize, Path stagingFile) throws IOException { State state = this.destination.getProperties(); int pageSize = state.getPropAsInt(getProperty(WRITER_PARQUET_PAGE_SIZE), DEFAULT_PAGE_SIZE); int dictPageSize = state.getPropAsInt(getProperty(WRITER_PARQUET_DICTIONARY_PAGE_SIZE), DEFAULT_BLOCK_SIZE); boolean enableDictionary = state.getPropAsBoolean(getProperty(WRITER_PARQUET_DICTIONARY), DEFAULT_IS_DICTIONARY_ENABLED); boolean validate = state.getPropAsBoolean(getProperty(WRITER_PARQUET_VALIDATE), DEFAULT_IS_VALIDATING_ENABLED); String rootURI = state.getProp(WRITER_FILE_SYSTEM_URI, LOCAL_FS_URI); Path absoluteStagingFile = new Path(rootURI, stagingFile); CompressionCodecName codec = getCodecFromConfig(); GroupWriteSupport support = new GroupWriteSupport(); Configuration conf = new Configuration(); GroupWriteSupport.setSchema(this.schema, conf); ParquetProperties.WriterVersion writerVersion = getWriterVersion(); return new ParquetWriter<>(absoluteStagingFile, support, codec, blockSize, pageSize, dictPageSize, enableDictionary, validate, writerVersion, conf); }
java
public ParquetWriter<Group> getWriter(int blockSize, Path stagingFile) throws IOException { State state = this.destination.getProperties(); int pageSize = state.getPropAsInt(getProperty(WRITER_PARQUET_PAGE_SIZE), DEFAULT_PAGE_SIZE); int dictPageSize = state.getPropAsInt(getProperty(WRITER_PARQUET_DICTIONARY_PAGE_SIZE), DEFAULT_BLOCK_SIZE); boolean enableDictionary = state.getPropAsBoolean(getProperty(WRITER_PARQUET_DICTIONARY), DEFAULT_IS_DICTIONARY_ENABLED); boolean validate = state.getPropAsBoolean(getProperty(WRITER_PARQUET_VALIDATE), DEFAULT_IS_VALIDATING_ENABLED); String rootURI = state.getProp(WRITER_FILE_SYSTEM_URI, LOCAL_FS_URI); Path absoluteStagingFile = new Path(rootURI, stagingFile); CompressionCodecName codec = getCodecFromConfig(); GroupWriteSupport support = new GroupWriteSupport(); Configuration conf = new Configuration(); GroupWriteSupport.setSchema(this.schema, conf); ParquetProperties.WriterVersion writerVersion = getWriterVersion(); return new ParquetWriter<>(absoluteStagingFile, support, codec, blockSize, pageSize, dictPageSize, enableDictionary, validate, writerVersion, conf); }
[ "public", "ParquetWriter", "<", "Group", ">", "getWriter", "(", "int", "blockSize", ",", "Path", "stagingFile", ")", "throws", "IOException", "{", "State", "state", "=", "this", ".", "destination", ".", "getProperties", "(", ")", ";", "int", "pageSize", "=",...
Build a {@link ParquetWriter<Group>} for given file path with a block size. @param blockSize @param stagingFile @return @throws IOException
[ "Build", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-parquet/src/main/java/org/apache/gobblin/writer/ParquetDataWriterBuilder.java#L78-L95
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.indexOf
private static int indexOf(CharSequence cs, int searchChar, int start) { if (cs instanceof String) { return ((String) cs).indexOf(searchChar, start); } else { int sz = cs.length(); if (start < 0) { start = 0; } for (int i = start; i < sz; i++) { if (cs.charAt(i) == searchChar) { return i; } } return -1; } }
java
private static int indexOf(CharSequence cs, int searchChar, int start) { if (cs instanceof String) { return ((String) cs).indexOf(searchChar, start); } else { int sz = cs.length(); if (start < 0) { start = 0; } for (int i = start; i < sz; i++) { if (cs.charAt(i) == searchChar) { return i; } } return -1; } }
[ "private", "static", "int", "indexOf", "(", "CharSequence", "cs", ",", "int", "searchChar", ",", "int", "start", ")", "{", "if", "(", "cs", "instanceof", "String", ")", "{", "return", "(", "(", "String", ")", "cs", ")", ".", "indexOf", "(", "searchChar...
<p> Finds the first index in the {@code CharSequence} that matches the specified character. </p> @param cs the {@code CharSequence} to be processed, not null @param searchChar the char to be searched for @param start the start index, negative starts at the string start @return the index where the search char was found, -1 if not found
[ "<p", ">", "Finds", "the", "first", "index", "in", "the", "{", "@code", "CharSequence", "}", "that", "matches", "the", "specified", "character", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L216-L229
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vod/VodClient.java
VodClient.createNotification
public CreateNotificationResponse createNotification(String name, String endpoint) { CreateNotificationRequest request = new CreateNotificationRequest(); request.withName(name).withEndpoint(endpoint); return createNotification(request); }
java
public CreateNotificationResponse createNotification(String name, String endpoint) { CreateNotificationRequest request = new CreateNotificationRequest(); request.withName(name).withEndpoint(endpoint); return createNotification(request); }
[ "public", "CreateNotificationResponse", "createNotification", "(", "String", "name", ",", "String", "endpoint", ")", "{", "CreateNotificationRequest", "request", "=", "new", "CreateNotificationRequest", "(", ")", ";", "request", ".", "withName", "(", "name", ")", "....
Create a doc notification in the doc stream service. @param name The name of notification. @param endpoint The address to receive notification message.
[ "Create", "a", "doc", "notification", "in", "the", "doc", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L1000-L1004
zaproxy/zaproxy
src/org/parosproxy/paros/view/FindDialog.java
FindDialog.getDialog
public static FindDialog getDialog(Window parent, boolean modal) { if (parent == null) { throw new IllegalArgumentException("The parent must not be null."); } FindDialog activeDialog = getParentsMap().get(parent); if (activeDialog != null) { activeDialog.getTxtFind().requestFocus(); return activeDialog; } FindDialog newDialog = new FindDialog(parent, modal); getParentsMap().put(parent, newDialog); newDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { getParentsMap().remove(parent); } }); return newDialog; }
java
public static FindDialog getDialog(Window parent, boolean modal) { if (parent == null) { throw new IllegalArgumentException("The parent must not be null."); } FindDialog activeDialog = getParentsMap().get(parent); if (activeDialog != null) { activeDialog.getTxtFind().requestFocus(); return activeDialog; } FindDialog newDialog = new FindDialog(parent, modal); getParentsMap().put(parent, newDialog); newDialog.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { getParentsMap().remove(parent); } }); return newDialog; }
[ "public", "static", "FindDialog", "getDialog", "(", "Window", "parent", ",", "boolean", "modal", ")", "{", "if", "(", "parent", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The parent must not be null.\"", ")", ";", "}", "FindDialo...
Get the FindDialog for the parent if there is one or creates and returns a new one. @param parent the parent Window (or Frame) for this FindDialog @param modal a boolean indicating whether the FindDialog should ({@code true}), or shouldn't ({@code false}) be modal. @return The existing FindDialog for the parent (if there is one), or a new FindDialog. @throws IllegalArgumentException if the {@code parent} is {@code null}. @since 2.7.0
[ "Get", "the", "FindDialog", "for", "the", "parent", "if", "there", "is", "one", "or", "creates", "and", "returns", "a", "new", "one", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/FindDialog.java#L148-L167
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/MPConfigAccessorImpl.java
MPConfigAccessorImpl.get
@Override @SuppressWarnings("unchecked") public <T> T get(Object config, String name, T defaultValue) { Class<?> cl = defaultValue == null || defaultValue instanceof Set ? String[].class : defaultValue.getClass(); Optional<T> configuredValue = (Optional<T>) ((Config) config).getOptionalValue(name, cl); T value = configuredValue.orElse(defaultValue); if (value instanceof String[]) { // MicroProfile Config is unclear about whether empty value for String[] results in // an empty String array or a size 1 String array where the element is the empty string. // Allow for both possibilities, String[] arr = ((String[]) value); if (arr.length == 1 && arr[0].length() == 0) { if (defaultValue instanceof Set) value = (T) Collections.EMPTY_SET; else // TODO remove if config annotations are removed value = (T) new String[0]; } else if (defaultValue instanceof Set) { Set<String> set = new LinkedHashSet<String>(); Collections.addAll(set, arr); value = (T) set; } } return value; }
java
@Override @SuppressWarnings("unchecked") public <T> T get(Object config, String name, T defaultValue) { Class<?> cl = defaultValue == null || defaultValue instanceof Set ? String[].class : defaultValue.getClass(); Optional<T> configuredValue = (Optional<T>) ((Config) config).getOptionalValue(name, cl); T value = configuredValue.orElse(defaultValue); if (value instanceof String[]) { // MicroProfile Config is unclear about whether empty value for String[] results in // an empty String array or a size 1 String array where the element is the empty string. // Allow for both possibilities, String[] arr = ((String[]) value); if (arr.length == 1 && arr[0].length() == 0) { if (defaultValue instanceof Set) value = (T) Collections.EMPTY_SET; else // TODO remove if config annotations are removed value = (T) new String[0]; } else if (defaultValue instanceof Set) { Set<String> set = new LinkedHashSet<String>(); Collections.addAll(set, arr); value = (T) set; } } return value; }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "get", "(", "Object", "config", ",", "String", "name", ",", "T", "defaultValue", ")", "{", "Class", "<", "?", ">", "cl", "=", "defaultValue", "==", "null...
Reads a String[] or Integer property value from MicroProfile Config. @param config instance of org.eclipse.microprofile.config.Config. @param name config property name. @param defaultValue value to use if a config property with the specified name is not found. @return value from MicroProfile Config. Otherwise the default value.
[ "Reads", "a", "String", "[]", "or", "Integer", "property", "value", "from", "MicroProfile", "Config", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/MPConfigAccessorImpl.java#L42-L67
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/populate/IdGeneratorImpl.java
IdGeneratorImpl.generateRandomBytes
private byte[] generateRandomBytes(int nBytes, Random random) { byte[] randomBytes = new byte[nBytes]; random.nextBytes(randomBytes); return randomBytes; }
java
private byte[] generateRandomBytes(int nBytes, Random random) { byte[] randomBytes = new byte[nBytes]; random.nextBytes(randomBytes); return randomBytes; }
[ "private", "byte", "[", "]", "generateRandomBytes", "(", "int", "nBytes", ",", "Random", "random", ")", "{", "byte", "[", "]", "randomBytes", "=", "new", "byte", "[", "nBytes", "]", ";", "random", ".", "nextBytes", "(", "randomBytes", ")", ";", "return",...
Generates a number of random bytes. <p>The chance of collisions of k IDs taken from a population of N possibilities is <code> 1 - Math.exp(-0.5 * k * (k - 1) / N)</code> <p>A couple collision chances for 5 bytes <code>N = 256^5</code>: <table> <tr><td> 1 </td><td> 0.0 </td></tr> <tr><td> 10 </td><td> 4.092726157978177e-11 </td></tr> <tr><td> 100 </td><td> 4.501998773775995e-09 </td></tr> <tr><td> 1000 </td><td> 4.5429250039585867e-07 </td></tr> <tr><td> 10000 </td><td> 4.546915386183237e-05 </td></tr> <tr><td> 100000 </td><td> 0.004537104138253034 </td></tr> <tr><td> 1000000 </td><td> 0.36539143049797307 </td></tr> </table> @see <a href="http://preshing.com/20110504/hash-collision-probabilities/">Hash collision probabilities</a>
[ "Generates", "a", "number", "of", "random", "bytes", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/populate/IdGeneratorImpl.java#L70-L74
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.containsKey
public static boolean containsKey(@Nullable Bundle bundle, @Nullable String key) { return bundle != null && bundle.containsKey(key); }
java
public static boolean containsKey(@Nullable Bundle bundle, @Nullable String key) { return bundle != null && bundle.containsKey(key); }
[ "public", "static", "boolean", "containsKey", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "bundle", "!=", "null", "&&", "bundle", ".", "containsKey", "(", "key", ")", ";", "}" ]
Checks if the bundle contains a specified key or not. If bundle is null, this method will return false; @param bundle a bundle. @param key a key. @return true if bundle is not null and the key exists in the bundle, false otherwise. @see android.os.Bundle#containsKey(String)
[ "Checks", "if", "the", "bundle", "contains", "a", "specified", "key", "or", "not", ".", "If", "bundle", "is", "null", "this", "method", "will", "return", "false", ";" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L1079-L1081
paoding-code/paoding-rose
paoding-rose-jade/src/main/java/net/paoding/rose/jade/statement/expression/impl/ExqlCompiler.java
ExqlCompiler.findBrace
private String findBrace(char chLeft, char chRight) { // 从当前位置查找查找匹配的 (...) int left = findLeftBrace(chLeft, position); if (left >= position) { int start = left + 1; int end = findRightBrace(chLeft, chRight, start); if (end >= start) { // 当前位置指向匹配的右括号后一个字符 position = end + 1; // 返回匹配的括号内容 return pattern.substring(start, end); } } return null; // 没有 (...) 匹配 }
java
private String findBrace(char chLeft, char chRight) { // 从当前位置查找查找匹配的 (...) int left = findLeftBrace(chLeft, position); if (left >= position) { int start = left + 1; int end = findRightBrace(chLeft, chRight, start); if (end >= start) { // 当前位置指向匹配的右括号后一个字符 position = end + 1; // 返回匹配的括号内容 return pattern.substring(start, end); } } return null; // 没有 (...) 匹配 }
[ "private", "String", "findBrace", "(", "char", "chLeft", ",", "char", "chRight", ")", "{", "// 从当前位置查找查找匹配的 (...)", "int", "left", "=", "findLeftBrace", "(", "chLeft", ",", "position", ")", ";", "if", "(", "left", ">=", "position", ")", "{", "int", "start...
从当前位置查找匹配的一对括号, 并返回内容。 如果有匹配的括号, 返回后的当前位置指向匹配的右括号后一个字符。 @param chLeft - 匹配的左括号 @param chRight - 匹配的右括号 @return 返回括号内容, 如果没有括号匹配, 返回 <code>null</code>.
[ "从当前位置查找匹配的一对括号", "并返回内容。" ]
train
https://github.com/paoding-code/paoding-rose/blob/8b512704174dd6cba95e544c7d6ab66105cb8ec4/paoding-rose-jade/src/main/java/net/paoding/rose/jade/statement/expression/impl/ExqlCompiler.java#L358-L377
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java
StandardGenerator.generateAnnotation
static TextOutline generateAnnotation(Point2d basePoint, String label, Vector2d direction, double distance, double scale, Font font, AtomSymbol symbol) { boolean italicHint = label.startsWith(ITALIC_DISPLAY_PREFIX); label = italicHint ? label.substring(ITALIC_DISPLAY_PREFIX.length()) : label; Font annFont = italicHint ? font.deriveFont(Font.ITALIC) : font; final TextOutline annOutline = new TextOutline(label, annFont).resize(scale, -scale); // align to the first or last character of the annotation depending on the direction final Point2D center = direction.x > 0.3 ? annOutline.getFirstGlyphCenter() : direction.x < -0.3 ? annOutline .getLastGlyphCenter() : annOutline.getCenter(); // Avoid atom symbol if (symbol != null) { Point2D intersect = symbol.getConvexHull().intersect(VecmathUtil.toAwtPoint(basePoint), VecmathUtil.toAwtPoint(new Point2d(VecmathUtil.sum(basePoint, direction)))); // intersect should never be null be check against this if (intersect != null) basePoint = VecmathUtil.toVecmathPoint(intersect); } direction.scale(distance); direction.add(basePoint); // move to position return annOutline.translate(direction.x - center.getX(), direction.y - center.getY()); }
java
static TextOutline generateAnnotation(Point2d basePoint, String label, Vector2d direction, double distance, double scale, Font font, AtomSymbol symbol) { boolean italicHint = label.startsWith(ITALIC_DISPLAY_PREFIX); label = italicHint ? label.substring(ITALIC_DISPLAY_PREFIX.length()) : label; Font annFont = italicHint ? font.deriveFont(Font.ITALIC) : font; final TextOutline annOutline = new TextOutline(label, annFont).resize(scale, -scale); // align to the first or last character of the annotation depending on the direction final Point2D center = direction.x > 0.3 ? annOutline.getFirstGlyphCenter() : direction.x < -0.3 ? annOutline .getLastGlyphCenter() : annOutline.getCenter(); // Avoid atom symbol if (symbol != null) { Point2D intersect = symbol.getConvexHull().intersect(VecmathUtil.toAwtPoint(basePoint), VecmathUtil.toAwtPoint(new Point2d(VecmathUtil.sum(basePoint, direction)))); // intersect should never be null be check against this if (intersect != null) basePoint = VecmathUtil.toVecmathPoint(intersect); } direction.scale(distance); direction.add(basePoint); // move to position return annOutline.translate(direction.x - center.getX(), direction.y - center.getY()); }
[ "static", "TextOutline", "generateAnnotation", "(", "Point2d", "basePoint", ",", "String", "label", ",", "Vector2d", "direction", ",", "double", "distance", ",", "double", "scale", ",", "Font", "font", ",", "AtomSymbol", "symbol", ")", "{", "boolean", "italicHin...
Generate an annotation 'label' for an atom (located at 'basePoint'). The label is offset from the basePoint by the provided 'distance' and 'direction'. @param basePoint the relative (0,0) reference @param label the annotation text @param direction the direction along which the label is laid out @param distance the distance along the direct to travel @param scale the font scale of the label @param font the font to use @param symbol the atom symbol to avoid overlap with @return the position text outline for the annotation
[ "Generate", "an", "annotation", "label", "for", "an", "atom", "(", "located", "at", "basePoint", ")", ".", "The", "label", "is", "offset", "from", "the", "basePoint", "by", "the", "provided", "distance", "and", "direction", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardGenerator.java#L532-L560
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableVeneerSettingsFactory.java
BigtableVeneerSettingsFactory.buildSampleRowKeysSettings
private static void buildSampleRowKeysSettings(Builder builder, BigtableOptions options) { RetrySettings retrySettings = buildIdempotentRetrySettings(builder.sampleRowKeysSettings().getRetrySettings(), options); builder.sampleRowKeysSettings() .setRetrySettings(retrySettings) .setRetryableCodes(buildRetryCodes(options.getRetryOptions())); }
java
private static void buildSampleRowKeysSettings(Builder builder, BigtableOptions options) { RetrySettings retrySettings = buildIdempotentRetrySettings(builder.sampleRowKeysSettings().getRetrySettings(), options); builder.sampleRowKeysSettings() .setRetrySettings(retrySettings) .setRetryableCodes(buildRetryCodes(options.getRetryOptions())); }
[ "private", "static", "void", "buildSampleRowKeysSettings", "(", "Builder", "builder", ",", "BigtableOptions", "options", ")", "{", "RetrySettings", "retrySettings", "=", "buildIdempotentRetrySettings", "(", "builder", ".", "sampleRowKeysSettings", "(", ")", ".", "getRet...
To build BigtableDataSettings#sampleRowKeysSettings with default Retry settings.
[ "To", "build", "BigtableDataSettings#sampleRowKeysSettings", "with", "default", "Retry", "settings", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/config/BigtableVeneerSettingsFactory.java#L204-L211
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/LogisticDistribution.java
LogisticDistribution.logpdf
public static double logpdf(double val, double loc, double scale) { val = Math.abs((val - loc) / scale); double f = 1.0 + FastMath.exp(-val); return -val - FastMath.log(scale * f * f); }
java
public static double logpdf(double val, double loc, double scale) { val = Math.abs((val - loc) / scale); double f = 1.0 + FastMath.exp(-val); return -val - FastMath.log(scale * f * f); }
[ "public", "static", "double", "logpdf", "(", "double", "val", ",", "double", "loc", ",", "double", "scale", ")", "{", "val", "=", "Math", ".", "abs", "(", "(", "val", "-", "loc", ")", "/", "scale", ")", ";", "double", "f", "=", "1.0", "+", "FastM...
log Probability density function. @param val Value @param loc Location @param scale Scale @return log PDF
[ "log", "Probability", "density", "function", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/LogisticDistribution.java#L132-L136
VoltDB/voltdb
src/frontend/org/voltdb/utils/VoltTypeUtil.java
VoltTypeUtil.getNumericLiteralType
public static VoltType getNumericLiteralType(VoltType vt, String value) { try { Long.parseLong(value); } catch (NumberFormatException e) { // Our DECIMAL may not be bigger/smaller enough to store the constant value return VoltType.DECIMAL; } return vt; }
java
public static VoltType getNumericLiteralType(VoltType vt, String value) { try { Long.parseLong(value); } catch (NumberFormatException e) { // Our DECIMAL may not be bigger/smaller enough to store the constant value return VoltType.DECIMAL; } return vt; }
[ "public", "static", "VoltType", "getNumericLiteralType", "(", "VoltType", "vt", ",", "String", "value", ")", "{", "try", "{", "Long", ".", "parseLong", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "// Our DECIMAL may not b...
If the type is NUMERIC from hsqldb, VoltDB has to decide its real type. It's either INTEGER or DECIMAL according to the SQL Standard. Thanks for Hsqldb 1.9, FLOAT literal values have been handled well with E sign. @param vt @param value @return
[ "If", "the", "type", "is", "NUMERIC", "from", "hsqldb", "VoltDB", "has", "to", "decide", "its", "real", "type", ".", "It", "s", "either", "INTEGER", "or", "DECIMAL", "according", "to", "the", "SQL", "Standard", ".", "Thanks", "for", "Hsqldb", "1", ".", ...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/VoltTypeUtil.java#L352-L360
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java
RouteFiltersInner.beginDelete
public void beginDelete(String resourceGroupName, String routeFilterName) { beginDeleteWithServiceResponseAsync(resourceGroupName, routeFilterName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String routeFilterName) { beginDeleteWithServiceResponseAsync(resourceGroupName, routeFilterName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "routeFilterName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeFilterName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", ...
Deletes the specified route filter. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "the", "specified", "route", "filter", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java#L190-L192
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java
WebSocketHelper.sendBinaryAsync
public void sendBinaryAsync(Session session, InputStream inputStream, ExecutorService threadPool) { if (session == null) { return; } if (inputStream == null) { throw new IllegalArgumentException("inputStream must not be null"); } log.debugf("Attempting to send async binary data to client [%s]", session.getId()); if (session.isOpen()) { if (this.asyncTimeout != null) { // TODO: what to do with timeout? } CopyStreamRunnable runnable = new CopyStreamRunnable(session, inputStream); threadPool.execute(runnable); } return; }
java
public void sendBinaryAsync(Session session, InputStream inputStream, ExecutorService threadPool) { if (session == null) { return; } if (inputStream == null) { throw new IllegalArgumentException("inputStream must not be null"); } log.debugf("Attempting to send async binary data to client [%s]", session.getId()); if (session.isOpen()) { if (this.asyncTimeout != null) { // TODO: what to do with timeout? } CopyStreamRunnable runnable = new CopyStreamRunnable(session, inputStream); threadPool.execute(runnable); } return; }
[ "public", "void", "sendBinaryAsync", "(", "Session", "session", ",", "InputStream", "inputStream", ",", "ExecutorService", "threadPool", ")", "{", "if", "(", "session", "==", "null", ")", "{", "return", ";", "}", "if", "(", "inputStream", "==", "null", ")", ...
Sends binary data to a client asynchronously. @param session the client session where the message will be sent @param inputStream the binary data to send @param threadPool where the job will be submitted so it can execute asynchronously
[ "Sends", "binary", "data", "to", "a", "client", "asynchronously", "." ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java#L113-L134
graphql-java/java-dataloader
src/main/java/org/dataloader/DataLoader.java
DataLoader.newMappedDataLoaderWithTry
public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoader<K, Try<V>> batchLoadFunction) { return newMappedDataLoaderWithTry(batchLoadFunction, null); }
java
public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoader<K, Try<V>> batchLoadFunction) { return newMappedDataLoaderWithTry(batchLoadFunction, null); }
[ "public", "static", "<", "K", ",", "V", ">", "DataLoader", "<", "K", ",", "V", ">", "newMappedDataLoaderWithTry", "(", "MappedBatchLoader", "<", "K", ",", "Try", "<", "V", ">", ">", "batchLoadFunction", ")", "{", "return", "newMappedDataLoaderWithTry", "(", ...
Creates new DataLoader with the specified batch loader function and default options (batching, caching and unlimited batch size) where the batch loader function returns a list of {@link org.dataloader.Try} objects. <p> If its important you to know the exact status of each item in a batch call and whether it threw exceptions then you can use this form to create the data loader. Using Try objects allows you to capture a value returned or an exception that might have occurred trying to get a value. . <p> @param batchLoadFunction the batch load function to use that uses {@link org.dataloader.Try} objects @param <K> the key type @param <V> the value type @return a new DataLoader
[ "Creates", "new", "DataLoader", "with", "the", "specified", "batch", "loader", "function", "and", "default", "options", "(", "batching", "caching", "and", "unlimited", "batch", "size", ")", "where", "the", "batch", "loader", "function", "returns", "a", "list", ...
train
https://github.com/graphql-java/java-dataloader/blob/dfdc8133ead10aa723f896b4a1fa4a1cec9a6fbc/src/main/java/org/dataloader/DataLoader.java#L245-L247
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/AbstractToString.java
AbstractToString.isToString
ToStringKind isToString(Tree parent, ExpressionTree tree, VisitorState state) { // is the enclosing expression string concat? if (isStringConcat(parent, state)) { return ToStringKind.IMPLICIT; } if (parent instanceof ExpressionTree) { ExpressionTree parentExpression = (ExpressionTree) parent; // the enclosing method is print() or println() if (PRINT_STRING.matches(parentExpression, state)) { return ToStringKind.IMPLICIT; } // the enclosing method is String.valueOf() if (VALUE_OF.matches(parentExpression, state)) { return ToStringKind.EXPLICIT; } } return ToStringKind.NONE; }
java
ToStringKind isToString(Tree parent, ExpressionTree tree, VisitorState state) { // is the enclosing expression string concat? if (isStringConcat(parent, state)) { return ToStringKind.IMPLICIT; } if (parent instanceof ExpressionTree) { ExpressionTree parentExpression = (ExpressionTree) parent; // the enclosing method is print() or println() if (PRINT_STRING.matches(parentExpression, state)) { return ToStringKind.IMPLICIT; } // the enclosing method is String.valueOf() if (VALUE_OF.matches(parentExpression, state)) { return ToStringKind.EXPLICIT; } } return ToStringKind.NONE; }
[ "ToStringKind", "isToString", "(", "Tree", "parent", ",", "ExpressionTree", "tree", ",", "VisitorState", "state", ")", "{", "// is the enclosing expression string concat?", "if", "(", "isStringConcat", "(", "parent", ",", "state", ")", ")", "{", "return", "ToStringK...
Classifies expressions that are converted to strings by their enclosing expression.
[ "Classifies", "expressions", "that", "are", "converted", "to", "strings", "by", "their", "enclosing", "expression", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/AbstractToString.java#L162-L179
dnsjava/dnsjava
org/xbill/DNS/DNSInput.java
DNSInput.readByteArray
public void readByteArray(byte [] b, int off, int len) throws WireParseException { require(len); byteBuffer.get(b, off, len); }
java
public void readByteArray(byte [] b, int off, int len) throws WireParseException { require(len); byteBuffer.get(b, off, len); }
[ "public", "void", "readByteArray", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "throws", "WireParseException", "{", "require", "(", "len", ")", ";", "byteBuffer", ".", "get", "(", "b", ",", "off", ",", "len", ")", ";", "}...
Reads a byte array of a specified length from the stream into an existing array. @param b The array to read into. @param off The offset of the array to start copying data into. @param len The number of bytes to copy. @throws WireParseException The end of the stream was reached.
[ "Reads", "a", "byte", "array", "of", "a", "specified", "length", "from", "the", "stream", "into", "an", "existing", "array", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/DNSInput.java#L194-L198
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.multTransB
public static void multTransB(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { if( b.numRows == 1 ) { MatrixVectorMult_DDRM.mult(a, b, c); } else { MatrixMatrixMult_DDRM.multTransB(a, b, c); } }
java
public static void multTransB(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { if( b.numRows == 1 ) { MatrixVectorMult_DDRM.mult(a, b, c); } else { MatrixMatrixMult_DDRM.multTransB(a, b, c); } }
[ "public", "static", "void", "multTransB", "(", "DMatrix1Row", "a", ",", "DMatrix1Row", "b", ",", "DMatrix1Row", "c", ")", "{", "if", "(", "b", ".", "numRows", "==", "1", ")", "{", "MatrixVectorMult_DDRM", ".", "mult", "(", "a", ",", "b", ",", "c", ")...
<p> Performs the following operation:<br> <br> c = a * b<sup>T</sup> <br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "a", "*", "b<sup", ">", "T<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&sum", ";", "<sub", ">", "k", "=", "1", ":",...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L175-L182
lemire/JavaFastPFOR
src/main/java/me/lemire/integercompression/synth/UniformDataGenerator.java
UniformDataGenerator.generateUniform
public int[] generateUniform(int N, int Max) { if (N * 2 > Max) { return negate(generateUniform(Max - N, Max), Max); } if (2048 * N > Max) return generateUniformBitmap(N, Max); return generateUniformHash(N, Max); }
java
public int[] generateUniform(int N, int Max) { if (N * 2 > Max) { return negate(generateUniform(Max - N, Max), Max); } if (2048 * N > Max) return generateUniformBitmap(N, Max); return generateUniformHash(N, Max); }
[ "public", "int", "[", "]", "generateUniform", "(", "int", "N", ",", "int", "Max", ")", "{", "if", "(", "N", "*", "2", ">", "Max", ")", "{", "return", "negate", "(", "generateUniform", "(", "Max", "-", "N", ",", "Max", ")", ",", "Max", ")", ";",...
generates randomly N distinct integers from 0 to Max. @param N number of integers to generate @param Max bound on the value of integers @return an array containing randomly selected integers
[ "generates", "randomly", "N", "distinct", "integers", "from", "0", "to", "Max", "." ]
train
https://github.com/lemire/JavaFastPFOR/blob/ffeea61ab2fdb3854da7b0a557f8d22d674477f4/src/main/java/me/lemire/integercompression/synth/UniformDataGenerator.java#L80-L87