repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
dnsjava/dnsjava
org/xbill/DNS/utils/base64.java
base64.formatString
public static String formatString(byte [] b, int lineLength, String prefix, boolean addClose) { String s = toString(b); StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i += lineLength) { sb.append (prefix); if (i + lineLength >= s.length()) { sb.append(s.substring(i)); if (addClose) sb.append(" )"); } else { sb.append(s.substring(i, i + lineLength)); sb.append("\n"); } } return sb.toString(); }
java
public static String formatString(byte [] b, int lineLength, String prefix, boolean addClose) { String s = toString(b); StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i += lineLength) { sb.append (prefix); if (i + lineLength >= s.length()) { sb.append(s.substring(i)); if (addClose) sb.append(" )"); } else { sb.append(s.substring(i, i + lineLength)); sb.append("\n"); } } return sb.toString(); }
[ "public", "static", "String", "formatString", "(", "byte", "[", "]", "b", ",", "int", "lineLength", ",", "String", "prefix", ",", "boolean", "addClose", ")", "{", "String", "s", "=", "toString", "(", "b", ")", ";", "StringBuffer", "sb", "=", "new", "St...
Formats data into a nicely formatted base64 encoded String @param b An array containing binary data @param lineLength The number of characters per line @param prefix A string prefixing the characters on each line @param addClose Whether to add a close parenthesis or not @return A String representing the formatted output
[ "Formats", "data", "into", "a", "nicely", "formatted", "base64", "encoded", "String" ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/utils/base64.java#L69-L86
powermock/powermock
powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/HotSpotVirtualMachine.java
HotSpotVirtualMachine.loadAgent
@Override public void loadAgent(String agent, String options) throws AgentLoadException, AgentInitializationException, IOException { String args = agent; if (options != null) { args = args + "=" + options; } try { loadAgentLibrary("instrument", args); } catch (AgentLoadException x) { throw new InternalError("instrument library is missing in target VM"); } catch (AgentInitializationException x) { /* * Translate interesting errors into the right exception and * message (FIXME: create a better interface to the instrument * implementation so this isn't necessary) */ int rc = x.returnValue(); switch (rc) { case JNI_ENOMEM: throw new AgentLoadException("Insuffient memory"); case ATTACH_ERROR_BADJAR: throw new AgentLoadException("Agent JAR not found or no Agent-Class attribute"); case ATTACH_ERROR_NOTONCP: throw new AgentLoadException("Unable to add JAR file to system class path"); case ATTACH_ERROR_STARTFAIL: throw new AgentInitializationException("Agent JAR loaded but agent failed to initialize"); default : throw new AgentLoadException("Failed to load agent - unknown reason: " + rc); } } }
java
@Override public void loadAgent(String agent, String options) throws AgentLoadException, AgentInitializationException, IOException { String args = agent; if (options != null) { args = args + "=" + options; } try { loadAgentLibrary("instrument", args); } catch (AgentLoadException x) { throw new InternalError("instrument library is missing in target VM"); } catch (AgentInitializationException x) { /* * Translate interesting errors into the right exception and * message (FIXME: create a better interface to the instrument * implementation so this isn't necessary) */ int rc = x.returnValue(); switch (rc) { case JNI_ENOMEM: throw new AgentLoadException("Insuffient memory"); case ATTACH_ERROR_BADJAR: throw new AgentLoadException("Agent JAR not found or no Agent-Class attribute"); case ATTACH_ERROR_NOTONCP: throw new AgentLoadException("Unable to add JAR file to system class path"); case ATTACH_ERROR_STARTFAIL: throw new AgentInitializationException("Agent JAR loaded but agent failed to initialize"); default : throw new AgentLoadException("Failed to load agent - unknown reason: " + rc); } } }
[ "@", "Override", "public", "void", "loadAgent", "(", "String", "agent", ",", "String", "options", ")", "throws", "AgentLoadException", ",", "AgentInitializationException", ",", "IOException", "{", "String", "args", "=", "agent", ";", "if", "(", "options", "!=", ...
/* Load JPLIS agent which will load the agent JAR file and invoke the agentmain method.
[ "/", "*", "Load", "JPLIS", "agent", "which", "will", "load", "the", "agent", "JAR", "file", "and", "invoke", "the", "agentmain", "method", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/HotSpotVirtualMachine.java#L96-L128
ansell/restlet-utils
src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java
FixedRedirectCookieAuthenticator.getCredentialsCookie
protected CookieSetting getCredentialsCookie(final Request request, final Response response) { CookieSetting credentialsCookie = response.getCookieSettings().getFirst(this.getCookieName()); if(credentialsCookie == null) { credentialsCookie = new CookieSetting(this.getCookieName(), null); credentialsCookie.setAccessRestricted(true); // authCookie.setVersion(1); if(request.getRootRef() != null) { final String p = request.getRootRef().getPath(); credentialsCookie.setPath(p == null ? "/" : p); } else { // authCookie.setPath("/"); } response.getCookieSettings().add(credentialsCookie); } return credentialsCookie; }
java
protected CookieSetting getCredentialsCookie(final Request request, final Response response) { CookieSetting credentialsCookie = response.getCookieSettings().getFirst(this.getCookieName()); if(credentialsCookie == null) { credentialsCookie = new CookieSetting(this.getCookieName(), null); credentialsCookie.setAccessRestricted(true); // authCookie.setVersion(1); if(request.getRootRef() != null) { final String p = request.getRootRef().getPath(); credentialsCookie.setPath(p == null ? "/" : p); } else { // authCookie.setPath("/"); } response.getCookieSettings().add(credentialsCookie); } return credentialsCookie; }
[ "protected", "CookieSetting", "getCredentialsCookie", "(", "final", "Request", "request", ",", "final", "Response", "response", ")", "{", "CookieSetting", "credentialsCookie", "=", "response", ".", "getCookieSettings", "(", ")", ".", "getFirst", "(", "this", ".", ...
Returns the credentials cookie setting. It first try to find an existing cookie. If necessary, it creates a new one. @param request The current request. @param response The current response. @return The credentials cookie setting.
[ "Returns", "the", "credentials", "cookie", "setting", ".", "It", "first", "try", "to", "find", "an", "existing", "cookie", ".", "If", "necessary", "it", "creates", "a", "new", "one", "." ]
train
https://github.com/ansell/restlet-utils/blob/6c39a3e91aa8295936af1dbfccd6ba27230c40a9/src/main/java/com/github/ansell/restletutils/FixedRedirectCookieAuthenticator.java#L432-L456
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/internal/MessagingSecurityServiceImpl.java
MessagingSecurityServiceImpl.modify
@Modified protected void modify(ComponentContext cc, Map<String, Object> properties) { SibTr.entry(tc, CLASS_NAME + "modify", properties); this.properties = properties; populateDestinationPermissions(); runtimeSecurityService.modifyMessagingServices(this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "modify"); } }
java
@Modified protected void modify(ComponentContext cc, Map<String, Object> properties) { SibTr.entry(tc, CLASS_NAME + "modify", properties); this.properties = properties; populateDestinationPermissions(); runtimeSecurityService.modifyMessagingServices(this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "modify"); } }
[ "@", "Modified", "protected", "void", "modify", "(", "ComponentContext", "cc", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "CLASS_NAME", "+", "\"modify\"", ",", "properties", ")", ";", "th...
Called by OSGI framework when there is a modification in server.xml for tag associated with this component @param cc Component Context object @param properties Properties for this component from server.xml
[ "Called", "by", "OSGI", "framework", "when", "there", "is", "a", "modification", "in", "server", ".", "xml", "for", "tag", "associated", "with", "this", "component" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.security/src/com/ibm/ws/messaging/security/internal/MessagingSecurityServiceImpl.java#L140-L150
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/ExpressionUtil.java
ExpressionUtil.substituteImages
public static String substituteImages(String input, Map<String,String> imageMap) { StringBuffer substituted = new StringBuffer(input.length()); Matcher matcher = tokenPattern.matcher(input); int index = 0; while (matcher.find()) { String match = matcher.group(); substituted.append(input.substring(index, matcher.start())); if (imageMap != null && (match.startsWith("${image:"))) { String imageFile = match.substring(8, match.length() - 1); String imageId = imageFile.substring(imageFile.lastIndexOf('/') + 1); substituted.append("cid:" + imageId); imageMap.put(imageId, imageFile); } else { // ignore everything but images substituted.append(match); } index = matcher.end(); } substituted.append(input.substring(index)); return substituted.toString(); }
java
public static String substituteImages(String input, Map<String,String> imageMap) { StringBuffer substituted = new StringBuffer(input.length()); Matcher matcher = tokenPattern.matcher(input); int index = 0; while (matcher.find()) { String match = matcher.group(); substituted.append(input.substring(index, matcher.start())); if (imageMap != null && (match.startsWith("${image:"))) { String imageFile = match.substring(8, match.length() - 1); String imageId = imageFile.substring(imageFile.lastIndexOf('/') + 1); substituted.append("cid:" + imageId); imageMap.put(imageId, imageFile); } else { // ignore everything but images substituted.append(match); } index = matcher.end(); } substituted.append(input.substring(index)); return substituted.toString(); }
[ "public", "static", "String", "substituteImages", "(", "String", "input", ",", "Map", "<", "String", ",", "String", ">", "imageMap", ")", "{", "StringBuffer", "substituted", "=", "new", "StringBuffer", "(", "input", ".", "length", "(", ")", ")", ";", "Matc...
Input is email template with image tags: <code> &lt;img src="${image:com.centurylink.mdw.base/mdw.png}" alt="MDW"&gt; </code> Uses the unqualified image name as its CID. Populates imageMap with results.
[ "Input", "is", "email", "template", "with", "image", "tags", ":", "<code", ">", "&lt", ";", "img", "src", "=", "$", "{", "image", ":", "com", ".", "centurylink", ".", "mdw", ".", "base", "/", "mdw", ".", "png", "}", "alt", "=", "MDW", "&gt", ";",...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/ExpressionUtil.java#L144-L165
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricValue.java
MetricValue.valueOf
public static MetricValue valueOf(BigDecimal val, final String format) { if (val instanceof MetricValue) { // TODO: check that val.format == format return (MetricValue) val; } return new MetricValue(val, new DecimalFormat(format)); }
java
public static MetricValue valueOf(BigDecimal val, final String format) { if (val instanceof MetricValue) { // TODO: check that val.format == format return (MetricValue) val; } return new MetricValue(val, new DecimalFormat(format)); }
[ "public", "static", "MetricValue", "valueOf", "(", "BigDecimal", "val", ",", "final", "String", "format", ")", "{", "if", "(", "val", "instanceof", "MetricValue", ")", "{", "// TODO: check that val.format == format", "return", "(", "MetricValue", ")", "val", ";", ...
Returns the MetricValue representation of the passed in BigDecimal. If <code>val</code> is already a {@link MetricValue} object, val is returned. WARNING: as of this version, no check is performed that the passed in value format, if a {@link MetricValue}, is equal to <code>format</code> @param val value to be converted @param format format of the resulting output @return the converted value
[ "Returns", "the", "MetricValue", "representation", "of", "the", "passed", "in", "BigDecimal", ".", "If", "<code", ">", "val<", "/", "code", ">", "is", "already", "a", "{", "@link", "MetricValue", "}", "object", "val", "is", "returned", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/plugins/MetricValue.java#L176-L182
kiegroup/jbpmmigration
src/main/java/org/jbpm/migration/XmlUtils.java
XmlUtils.createTransformer
private static Transformer createTransformer(final Source xsltSource) throws Exception { final TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = null; if (xsltSource != null) { // Create a resolver for imported sheets (assumption: available from classpath or the root of the jar). final URIResolver resolver = new URIResolver() { @Override public Source resolve(final String href, final String base) throws TransformerException { return new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(href)); } }; transformerFactory.setURIResolver(resolver); // Transformer using the given sheet. transformer = transformerFactory.newTransformer(xsltSource); transformer.setURIResolver(resolver); } else { // Transformer without a sheet, i.e. for "identity transform" (e.g. formatting). transformer = transformerFactory.newTransformer(); } if (LOGGER.isDebugEnabled()) { instrumentTransformer(transformer); } return transformer; }
java
private static Transformer createTransformer(final Source xsltSource) throws Exception { final TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = null; if (xsltSource != null) { // Create a resolver for imported sheets (assumption: available from classpath or the root of the jar). final URIResolver resolver = new URIResolver() { @Override public Source resolve(final String href, final String base) throws TransformerException { return new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(href)); } }; transformerFactory.setURIResolver(resolver); // Transformer using the given sheet. transformer = transformerFactory.newTransformer(xsltSource); transformer.setURIResolver(resolver); } else { // Transformer without a sheet, i.e. for "identity transform" (e.g. formatting). transformer = transformerFactory.newTransformer(); } if (LOGGER.isDebugEnabled()) { instrumentTransformer(transformer); } return transformer; }
[ "private", "static", "Transformer", "createTransformer", "(", "final", "Source", "xsltSource", ")", "throws", "Exception", "{", "final", "TransformerFactory", "transformerFactory", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "Transformer", "transformer...
Create a {@link Transformer} from the given sheet. @param xsltSource The sheet to be used for the transformation, or <code>null</code> if an identity transformator is needed. @return The created {@link Transformer} @throws Exception If the creation or instrumentation of the {@link Transformer} runs into trouble.
[ "Create", "a", "{", "@link", "Transformer", "}", "from", "the", "given", "sheet", "." ]
train
https://github.com/kiegroup/jbpmmigration/blob/5e133e2824aa38f316a2eb061123313a7276aba0/src/main/java/org/jbpm/migration/XmlUtils.java#L238-L264
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableDocument.java
MutableDocument.setDouble
@NonNull @Override public MutableDocument setDouble(@NonNull String key, double value) { return setValue(key, value); }
java
@NonNull @Override public MutableDocument setDouble(@NonNull String key, double value) { return setValue(key, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableDocument", "setDouble", "(", "@", "NonNull", "String", "key", ",", "double", "value", ")", "{", "return", "setValue", "(", "key", ",", "value", ")", ";", "}" ]
Set a double value for the given key @param key the key. @param key the double value. @return this MutableDocument instance
[ "Set", "a", "double", "value", "for", "the", "given", "key" ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDocument.java#L223-L227
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java
AbstractTypeVisitor6.visitIntersection
@Override public R visitIntersection(IntersectionType t, P p) { return visitUnknown(t, p); }
java
@Override public R visitIntersection(IntersectionType t, P p) { return visitUnknown(t, p); }
[ "@", "Override", "public", "R", "visitIntersection", "(", "IntersectionType", "t", ",", "P", "p", ")", "{", "return", "visitUnknown", "(", "t", ",", "p", ")", ";", "}" ]
{@inheritDoc} @implSpec Visits an {@code IntersectionType} element by calling {@code visitUnknown}. @param t {@inheritDoc} @param p {@inheritDoc} @return the result of {@code visitUnknown} @since 1.8
[ "{", "@inheritDoc", "}" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java#L135-L138
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java
RouteTablesInner.beginCreateOrUpdate
public RouteTableInner beginCreateOrUpdate(String resourceGroupName, String routeTableName, RouteTableInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).toBlocking().single().body(); }
java
public RouteTableInner beginCreateOrUpdate(String resourceGroupName, String routeTableName, RouteTableInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).toBlocking().single().body(); }
[ "public", "RouteTableInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "routeTableName", ",", "RouteTableInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeTableName", "...
Create or updates a route table in a specified resource group. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @param parameters Parameters supplied to the create or update route table operation. @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 @return the RouteTableInner object if successful.
[ "Create", "or", "updates", "a", "route", "table", "in", "a", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L519-L521
graphhopper/graphhopper
core/src/main/java/com/graphhopper/util/EngineWarmUp.java
EngineWarmUp.warmUp
public static void warmUp(GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); if (ghStorage == null) throw new IllegalArgumentException("The storage of GraphHopper must not be empty"); try { if (ghStorage.isCHPossible()) warmUpCHSubNetwork(graphHopper, iterations); else warmUpNonCHSubNetwork(graphHopper, iterations); } catch (Exception ex) { LOGGER.warn("Problem while sending warm up queries", ex); } }
java
public static void warmUp(GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); if (ghStorage == null) throw new IllegalArgumentException("The storage of GraphHopper must not be empty"); try { if (ghStorage.isCHPossible()) warmUpCHSubNetwork(graphHopper, iterations); else warmUpNonCHSubNetwork(graphHopper, iterations); } catch (Exception ex) { LOGGER.warn("Problem while sending warm up queries", ex); } }
[ "public", "static", "void", "warmUp", "(", "GraphHopper", "graphHopper", ",", "int", "iterations", ")", "{", "GraphHopperStorage", "ghStorage", "=", "graphHopper", ".", "getGraphHopperStorage", "(", ")", ";", "if", "(", "ghStorage", "==", "null", ")", "throw", ...
Do the 'warm up' for the specified GraphHopper instance. @param iterations the 'intensity' of the warm up procedure
[ "Do", "the", "warm", "up", "for", "the", "specified", "GraphHopper", "instance", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/util/EngineWarmUp.java#L40-L53
openbase/jul
exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java
StackTracePrinter.printAllStackTraces
public static void printAllStackTraces(final String filter, final Logger logger, final LogLevel logLevel) { for (Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) { if (filter == null || entry.getKey().getName().contains(filter)) { StackTracePrinter.printStackTrace("Thread[" + entry.getKey().getName() + "] state[" + entry.getKey().getState().name() + "]", entry.getValue(), logger, logLevel); } } }
java
public static void printAllStackTraces(final String filter, final Logger logger, final LogLevel logLevel) { for (Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) { if (filter == null || entry.getKey().getName().contains(filter)) { StackTracePrinter.printStackTrace("Thread[" + entry.getKey().getName() + "] state[" + entry.getKey().getState().name() + "]", entry.getValue(), logger, logLevel); } } }
[ "public", "static", "void", "printAllStackTraces", "(", "final", "String", "filter", ",", "final", "Logger", "logger", ",", "final", "LogLevel", "logLevel", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Thread", ",", "StackTraceElement", "[", "]", ">", ...
Method prints the stack traces of all running java threads via the given logger. @param filter only thread where the name of the thread contains this given {@code filter} key are printed. If the filter is null, no filtering will be performed. @param logger the logger used for printing. @param logLevel the level to print.
[ "Method", "prints", "the", "stack", "traces", "of", "all", "running", "java", "threads", "via", "the", "given", "logger", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java#L150-L156
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/Csv2ExtJsLocaleService.java
Csv2ExtJsLocaleService.detectColumnIndexOfLocale
private int detectColumnIndexOfLocale(String locale, CSVReader csvReader) throws Exception { int indexOfLocale = -1; List<String> headerLine = Arrays.asList(ArrayUtils.nullToEmpty(csvReader.readNext())); if (headerLine == null || headerLine.isEmpty()) { throw new Exception("CSV locale file seems to be empty."); } if (headerLine.size() < 3) { // we expect at least three columns: component;field;locale1 throw new Exception("CSV locale file is invalid: Not enough columns."); } // start with the third column as the first two columns must not be a // locale column for (int i = 2; i < headerLine.size(); i++) { String columnName = headerLine.get(i); if (locale.equalsIgnoreCase(columnName)) { indexOfLocale = headerLine.indexOf(columnName); break; } } if (indexOfLocale < 0) { throw new Exception("Could not find locale " + locale + " in CSV file"); } return indexOfLocale; }
java
private int detectColumnIndexOfLocale(String locale, CSVReader csvReader) throws Exception { int indexOfLocale = -1; List<String> headerLine = Arrays.asList(ArrayUtils.nullToEmpty(csvReader.readNext())); if (headerLine == null || headerLine.isEmpty()) { throw new Exception("CSV locale file seems to be empty."); } if (headerLine.size() < 3) { // we expect at least three columns: component;field;locale1 throw new Exception("CSV locale file is invalid: Not enough columns."); } // start with the third column as the first two columns must not be a // locale column for (int i = 2; i < headerLine.size(); i++) { String columnName = headerLine.get(i); if (locale.equalsIgnoreCase(columnName)) { indexOfLocale = headerLine.indexOf(columnName); break; } } if (indexOfLocale < 0) { throw new Exception("Could not find locale " + locale + " in CSV file"); } return indexOfLocale; }
[ "private", "int", "detectColumnIndexOfLocale", "(", "String", "locale", ",", "CSVReader", "csvReader", ")", "throws", "Exception", "{", "int", "indexOfLocale", "=", "-", "1", ";", "List", "<", "String", ">", "headerLine", "=", "Arrays", ".", "asList", "(", "...
Extracts the column index of the given locale in the CSV file. @param locale @param csvReader @return @throws IOException @throws Exception
[ "Extracts", "the", "column", "index", "of", "the", "given", "locale", "in", "the", "CSV", "file", "." ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/Csv2ExtJsLocaleService.java#L140-L166
craterdog/java-security-framework
java-certificate-management-providers/src/main/java/craterdog/security/RsaCertificateManager.java
RsaCertificateManager.signCertificateRequest
public X509Certificate signCertificateRequest(PrivateKey caPrivateKey, X509Certificate caCertificate, PKCS10CertificationRequest request, BigInteger serialNumber, long lifetime) { try { logger.entry(); logger.debug("Extract public key and subject from the CSR..."); PublicKey publicKey = new JcaPEMKeyConverter().getPublicKey(request.getSubjectPublicKeyInfo()); String subject = request.getSubject().toString(); logger.debug("Generate and sign the certificate..."); X509Certificate result = createCertificate(caPrivateKey, caCertificate, publicKey, subject, serialNumber, lifetime); logger.exit(); return result; } catch (PEMException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to sign a certificate.", e); logger.error(exception.toString()); throw exception; } }
java
public X509Certificate signCertificateRequest(PrivateKey caPrivateKey, X509Certificate caCertificate, PKCS10CertificationRequest request, BigInteger serialNumber, long lifetime) { try { logger.entry(); logger.debug("Extract public key and subject from the CSR..."); PublicKey publicKey = new JcaPEMKeyConverter().getPublicKey(request.getSubjectPublicKeyInfo()); String subject = request.getSubject().toString(); logger.debug("Generate and sign the certificate..."); X509Certificate result = createCertificate(caPrivateKey, caCertificate, publicKey, subject, serialNumber, lifetime); logger.exit(); return result; } catch (PEMException e) { RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to sign a certificate.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "X509Certificate", "signCertificateRequest", "(", "PrivateKey", "caPrivateKey", ",", "X509Certificate", "caCertificate", ",", "PKCS10CertificationRequest", "request", ",", "BigInteger", "serialNumber", ",", "long", "lifetime", ")", "{", "try", "{", "logger", "...
This method signs a certificate signing request (CSR) using the specified certificate authority (CA). This is a convenience method that really should be part of the <code>CertificateManagement</code> interface except that it depends on a Bouncy Castle class in the signature. The java security framework does not have a similar class so it has been left out of the interface. @param caPrivateKey The private key for the certificate authority. @param caCertificate The certificate containing the public key for the certificate authority. @param request The certificate signing request (CSR) to be signed. @param serialNumber The serial number for the new certificate. @param lifetime How long the certificate should be valid. @return The newly signed certificate.
[ "This", "method", "signs", "a", "certificate", "signing", "request", "(", "CSR", ")", "using", "the", "specified", "certificate", "authority", "(", "CA", ")", ".", "This", "is", "a", "convenience", "method", "that", "really", "should", "be", "part", "of", ...
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-certificate-management-providers/src/main/java/craterdog/security/RsaCertificateManager.java#L150-L170
stickfigure/batchfb
src/main/java/com/googlecode/batchfb/impl/Batch.java
Batch.addParams
private void addParams(RequestBuilder call, Param[] params) { // Once upon a time this was necessary, now it isn't //call.addParam("format", "json"); if (this.accessToken != null) call.addParam("access_token", this.accessToken); if (this.appSecretProof != null) call.addParam("appsecret_proof", this.appSecretProof); if (params != null) { for (Param param: params) { if (param instanceof BinaryParam) { call.addParam(param.name, (InputStream)param.value, ((BinaryParam)param).contentType, "irrelevant"); } else { String paramValue = StringUtils.stringifyValue(param, this.mapper); call.addParam(param.name, paramValue); } } } }
java
private void addParams(RequestBuilder call, Param[] params) { // Once upon a time this was necessary, now it isn't //call.addParam("format", "json"); if (this.accessToken != null) call.addParam("access_token", this.accessToken); if (this.appSecretProof != null) call.addParam("appsecret_proof", this.appSecretProof); if (params != null) { for (Param param: params) { if (param instanceof BinaryParam) { call.addParam(param.name, (InputStream)param.value, ((BinaryParam)param).contentType, "irrelevant"); } else { String paramValue = StringUtils.stringifyValue(param, this.mapper); call.addParam(param.name, paramValue); } } } }
[ "private", "void", "addParams", "(", "RequestBuilder", "call", ",", "Param", "[", "]", "params", ")", "{", "// Once upon a time this was necessary, now it isn't\r", "//call.addParam(\"format\", \"json\");\r", "if", "(", "this", ".", "accessToken", "!=", "null", ")", "ca...
Adds the appropriate parameters to the call, including boilerplate ones (access token, format). @param params can be null or empty
[ "Adds", "the", "appropriate", "parameters", "to", "the", "call", "including", "boilerplate", "ones", "(", "access", "token", "format", ")", "." ]
train
https://github.com/stickfigure/batchfb/blob/ceeda78aa6d8397eec032ab1d8997adb7378e9e2/src/main/java/com/googlecode/batchfb/impl/Batch.java#L449-L470
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ObjectUtils.java
ObjectUtils.doOperationSafely
public static <T> T doOperationSafely(ExceptionThrowingOperation<T> operation, T defaultValue) { try { return operation.doExceptionThrowingOperation(); } catch (Exception cause) { return returnValueOrThrowIfNull(defaultValue, newIllegalStateException(cause, "Failed to execute operation [%s]", operation)); } }
java
public static <T> T doOperationSafely(ExceptionThrowingOperation<T> operation, T defaultValue) { try { return operation.doExceptionThrowingOperation(); } catch (Exception cause) { return returnValueOrThrowIfNull(defaultValue, newIllegalStateException(cause, "Failed to execute operation [%s]", operation)); } }
[ "public", "static", "<", "T", ">", "T", "doOperationSafely", "(", "ExceptionThrowingOperation", "<", "T", ">", "operation", ",", "T", "defaultValue", ")", "{", "try", "{", "return", "operation", ".", "doExceptionThrowingOperation", "(", ")", ";", "}", "catch",...
Safely executes the given {@link ExceptionThrowingOperation} handling any checked {@link Exception} thrown during the normal execution of the operation by returning the given {@link Object default value} or rethrowing an {@link IllegalStateException} if the {@link Object default value} is {@literal null}. @param <T> {@link Class type} of the return value. @param operation {@link ExceptionThrowingOperation} to execute. @param defaultValue {@link Object} to return if the {@link ExceptionThrowingOperation} throws a checked {@link Exception}. @return the {@link Object result} of the {@link ExceptionThrowingOperation} or {@link Object default value} if the {@link ExceptionThrowingOperation} throws a checked {@link Exception}. @see org.cp.elements.lang.ObjectUtils.ExceptionThrowingOperation @see #returnValueOrThrowIfNull(Object, RuntimeException)
[ "Safely", "executes", "the", "given", "{", "@link", "ExceptionThrowingOperation", "}", "handling", "any", "checked", "{", "@link", "Exception", "}", "thrown", "during", "the", "normal", "execution", "of", "the", "operation", "by", "returning", "the", "given", "{...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ObjectUtils.java#L170-L179
googleapis/google-cloud-java
google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java
ProductSearchClient.formatProductName
@Deprecated public static final String formatProductName(String project, String location, String product) { return PRODUCT_PATH_TEMPLATE.instantiate( "project", project, "location", location, "product", product); }
java
@Deprecated public static final String formatProductName(String project, String location, String product) { return PRODUCT_PATH_TEMPLATE.instantiate( "project", project, "location", location, "product", product); }
[ "@", "Deprecated", "public", "static", "final", "String", "formatProductName", "(", "String", "project", ",", "String", "location", ",", "String", "product", ")", "{", "return", "PRODUCT_PATH_TEMPLATE", ".", "instantiate", "(", "\"project\"", ",", "project", ",", ...
Formats a string containing the fully-qualified path to represent a product resource. @deprecated Use the {@link ProductName} class instead.
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "product", "resource", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java#L163-L169
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsSitemapView.java
CmsSitemapView.setElementVisible
protected void setElementVisible(Widget widget, boolean visible) { if (visible) { widget.getElement().getStyle().clearDisplay(); } else { widget.getElement().getStyle().setDisplay(Display.NONE); } }
java
protected void setElementVisible(Widget widget, boolean visible) { if (visible) { widget.getElement().getStyle().clearDisplay(); } else { widget.getElement().getStyle().setDisplay(Display.NONE); } }
[ "protected", "void", "setElementVisible", "(", "Widget", "widget", ",", "boolean", "visible", ")", "{", "if", "(", "visible", ")", "{", "widget", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "clearDisplay", "(", ")", ";", "}", "else", "...
Shows or hides the element for a widget.<p> @param widget the widget to show or hide @param visible true if the widget should be shown
[ "Shows", "or", "hides", "the", "element", "for", "a", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapView.java#L1431-L1439
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/EmailUtils.java
EmailUtils.sendJobCompletionEmail
public static void sendJobCompletionEmail(String jobId, String message, String state, State jobState) throws EmailException { sendEmail(jobState, String.format("Gobblin notification: job %s has completed with state %s", jobId, state), message); }
java
public static void sendJobCompletionEmail(String jobId, String message, String state, State jobState) throws EmailException { sendEmail(jobState, String.format("Gobblin notification: job %s has completed with state %s", jobId, state), message); }
[ "public", "static", "void", "sendJobCompletionEmail", "(", "String", "jobId", ",", "String", "message", ",", "String", "state", ",", "State", "jobState", ")", "throws", "EmailException", "{", "sendEmail", "(", "jobState", ",", "String", ".", "format", "(", "\"...
Send a job completion notification email. @param jobId job name @param message email message @param state job state @param jobState a {@link State} object carrying job configuration properties @throws EmailException if there is anything wrong sending the email
[ "Send", "a", "job", "completion", "notification", "email", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/EmailUtils.java#L93-L97
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.updateAsync
public Observable<RunInner> updateAsync(String resourceGroupName, String registryName, String runId) { return updateWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunInner>, RunInner>() { @Override public RunInner call(ServiceResponse<RunInner> response) { return response.body(); } }); }
java
public Observable<RunInner> updateAsync(String resourceGroupName, String registryName, String runId) { return updateWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunInner>, RunInner>() { @Override public RunInner call(ServiceResponse<RunInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RunInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "runId", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "runId", ...
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 for the request
[ "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#L474-L481
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java
DemuxingIoHandler.exceptionCaught
@Override public void exceptionCaught(IoSession session, Throwable cause) throws Exception { ExceptionHandler<Throwable> handler = findExceptionHandler(cause.getClass()); if (handler != null) { handler.exceptionCaught(session, cause); } else { throw new UnknownMessageTypeException( "No handler found for exception type: " + cause.getClass().getSimpleName()); } }
java
@Override public void exceptionCaught(IoSession session, Throwable cause) throws Exception { ExceptionHandler<Throwable> handler = findExceptionHandler(cause.getClass()); if (handler != null) { handler.exceptionCaught(session, cause); } else { throw new UnknownMessageTypeException( "No handler found for exception type: " + cause.getClass().getSimpleName()); } }
[ "@", "Override", "public", "void", "exceptionCaught", "(", "IoSession", "session", ",", "Throwable", "cause", ")", "throws", "Exception", "{", "ExceptionHandler", "<", "Throwable", ">", "handler", "=", "findExceptionHandler", "(", "cause", ".", "getClass", "(", ...
Invoked when any exception is thrown by user IoHandler implementation or by MINA. If cause is an instance of IOException, MINA will close the connection automatically. <b>Warning !</b> If you are to overload this method, be aware that you _must_ call the messageHandler in your own method, otherwise it won't be called.
[ "Invoked", "when", "any", "exception", "is", "thrown", "by", "user", "IoHandler", "implementation", "or", "by", "MINA", ".", "If", "cause", "is", "an", "instance", "of", "IOException", "MINA", "will", "close", "the", "connection", "automatically", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java#L264-L274
contentful/contentful.java
src/main/java/com/contentful/java/cda/rich/RichTextFactory.java
RichTextFactory.resolveRichLink
private static void resolveRichLink(ArrayResource array, CDAEntry entry, CDAField field) { final Map<String, Object> rawValue = (Map<String, Object>) entry.rawFields().get(field.id()); if (rawValue == null) { return; } for (final String locale : rawValue.keySet()) { final CDARichDocument document = entry.getField(locale, field.id()); for (final CDARichNode node : document.getContent()) { resolveOneLink(array, field, locale, node); } } }
java
private static void resolveRichLink(ArrayResource array, CDAEntry entry, CDAField field) { final Map<String, Object> rawValue = (Map<String, Object>) entry.rawFields().get(field.id()); if (rawValue == null) { return; } for (final String locale : rawValue.keySet()) { final CDARichDocument document = entry.getField(locale, field.id()); for (final CDARichNode node : document.getContent()) { resolveOneLink(array, field, locale, node); } } }
[ "private", "static", "void", "resolveRichLink", "(", "ArrayResource", "array", ",", "CDAEntry", "entry", ",", "CDAField", "field", ")", "{", "final", "Map", "<", "String", ",", "Object", ">", "rawValue", "=", "(", "Map", "<", "String", ",", "Object", ">", ...
Resolve all links if possible. If linked to entry is not found, null it's field. @param array the array containing the complete response @param entry the entry to be completed. @param field the field pointing to a link.
[ "Resolve", "all", "links", "if", "possible", ".", "If", "linked", "to", "entry", "is", "not", "found", "null", "it", "s", "field", "." ]
train
https://github.com/contentful/contentful.java/blob/6ecc2ace454c674b218b99489dc50697b1dbffcb/src/main/java/com/contentful/java/cda/rich/RichTextFactory.java#L350-L362
vladmihalcea/flexy-pool
flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java
ReflectionUtils.getFieldValue
public static <T> T getFieldValue(Object target, String fieldName) { try { Field field = target.getClass().getDeclaredField(fieldName); field.setAccessible(true); @SuppressWarnings("unchecked") T returnValue = (T) field.get(target); return returnValue; } catch (NoSuchFieldException e) { throw handleException(fieldName, e); } catch (IllegalAccessException e) { throw handleException(fieldName, e); } }
java
public static <T> T getFieldValue(Object target, String fieldName) { try { Field field = target.getClass().getDeclaredField(fieldName); field.setAccessible(true); @SuppressWarnings("unchecked") T returnValue = (T) field.get(target); return returnValue; } catch (NoSuchFieldException e) { throw handleException(fieldName, e); } catch (IllegalAccessException e) { throw handleException(fieldName, e); } }
[ "public", "static", "<", "T", ">", "T", "getFieldValue", "(", "Object", "target", ",", "String", "fieldName", ")", "{", "try", "{", "Field", "field", "=", "target", ".", "getClass", "(", ")", ".", "getDeclaredField", "(", "fieldName", ")", ";", "field", ...
Get target object field value @param target target object @param fieldName field name @param <T> field type @return field value
[ "Get", "target", "object", "field", "value" ]
train
https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java#L35-L47
KostyaSha/yet-another-docker-plugin
yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/client/ClientBuilderForConnector.java
ClientBuilderForConnector.forServer
public ClientBuilderForConnector forServer(String uri, @Nullable String version) { configBuilder.withDockerHost(URI.create(uri).toString()) .withApiVersion(version); return this; }
java
public ClientBuilderForConnector forServer(String uri, @Nullable String version) { configBuilder.withDockerHost(URI.create(uri).toString()) .withApiVersion(version); return this; }
[ "public", "ClientBuilderForConnector", "forServer", "(", "String", "uri", ",", "@", "Nullable", "String", "version", ")", "{", "configBuilder", ".", "withDockerHost", "(", "URI", ".", "create", "(", "uri", ")", ".", "toString", "(", ")", ")", ".", "withApiVe...
Method to setup url and docker-api version. Convenient for test-connection purposes and quick requests @param uri docker server uri @param version docker-api version @return this newClientBuilderForConnector
[ "Method", "to", "setup", "url", "and", "docker", "-", "api", "version", ".", "Convenient", "for", "test", "-", "connection", "purposes", "and", "quick", "requests" ]
train
https://github.com/KostyaSha/yet-another-docker-plugin/blob/40b12e39ff94c3834cff7e028c3dd01c88e87d77/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/client/ClientBuilderForConnector.java#L119-L123
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java
ESResponseWrapper.isValidBucket
private boolean isValidBucket(InternalAggregations internalAgg, KunderaQuery query, Expression conditionalExpression) { if (conditionalExpression instanceof ComparisonExpression) { Expression expression = ((ComparisonExpression) conditionalExpression).getLeftExpression(); Object leftValue = getAggregatedResult(internalAgg, ((AggregateFunction) expression).getIdentifier(), expression); String rightValue = ((ComparisonExpression) conditionalExpression).getRightExpression().toParsedText(); return validateBucket(leftValue.toString(), rightValue, ((ComparisonExpression) conditionalExpression).getIdentifier()); } else if (LogicalExpression.class.isAssignableFrom(conditionalExpression.getClass())) { Expression leftExpression = null, rightExpression = null; if (conditionalExpression instanceof AndExpression) { AndExpression andExpression = (AndExpression) conditionalExpression; leftExpression = andExpression.getLeftExpression(); rightExpression = andExpression.getRightExpression(); } else { OrExpression orExpression = (OrExpression) conditionalExpression; leftExpression = orExpression.getLeftExpression(); rightExpression = orExpression.getRightExpression(); } return validateBucket(isValidBucket(internalAgg, query, leftExpression), isValidBucket(internalAgg, query, rightExpression), ((LogicalExpression) conditionalExpression).getIdentifier()); } else { logger.error("Expression " + conditionalExpression + " in having clause is not supported in Kundera"); throw new UnsupportedOperationException(conditionalExpression + " in having clause is not supported in Kundera"); } }
java
private boolean isValidBucket(InternalAggregations internalAgg, KunderaQuery query, Expression conditionalExpression) { if (conditionalExpression instanceof ComparisonExpression) { Expression expression = ((ComparisonExpression) conditionalExpression).getLeftExpression(); Object leftValue = getAggregatedResult(internalAgg, ((AggregateFunction) expression).getIdentifier(), expression); String rightValue = ((ComparisonExpression) conditionalExpression).getRightExpression().toParsedText(); return validateBucket(leftValue.toString(), rightValue, ((ComparisonExpression) conditionalExpression).getIdentifier()); } else if (LogicalExpression.class.isAssignableFrom(conditionalExpression.getClass())) { Expression leftExpression = null, rightExpression = null; if (conditionalExpression instanceof AndExpression) { AndExpression andExpression = (AndExpression) conditionalExpression; leftExpression = andExpression.getLeftExpression(); rightExpression = andExpression.getRightExpression(); } else { OrExpression orExpression = (OrExpression) conditionalExpression; leftExpression = orExpression.getLeftExpression(); rightExpression = orExpression.getRightExpression(); } return validateBucket(isValidBucket(internalAgg, query, leftExpression), isValidBucket(internalAgg, query, rightExpression), ((LogicalExpression) conditionalExpression).getIdentifier()); } else { logger.error("Expression " + conditionalExpression + " in having clause is not supported in Kundera"); throw new UnsupportedOperationException(conditionalExpression + " in having clause is not supported in Kundera"); } }
[ "private", "boolean", "isValidBucket", "(", "InternalAggregations", "internalAgg", ",", "KunderaQuery", "query", ",", "Expression", "conditionalExpression", ")", "{", "if", "(", "conditionalExpression", "instanceof", "ComparisonExpression", ")", "{", "Expression", "expres...
Checks if is valid bucket. @param internalAgg the internal agg @param query the query @param conditionalExpression the conditional expression @return true, if is valid bucket
[ "Checks", "if", "is", "valid", "bucket", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java#L395-L433
google/closure-templates
java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java
AbstractGenerateSoyEscapingDirectiveCode.writeStringLiteral
protected void writeStringLiteral(String value, StringBuilder out) { out.append('\'').append(escapeOutputString(value)).append('\''); }
java
protected void writeStringLiteral(String value, StringBuilder out) { out.append('\'').append(escapeOutputString(value)).append('\''); }
[ "protected", "void", "writeStringLiteral", "(", "String", "value", ",", "StringBuilder", "out", ")", "{", "out", ".", "append", "(", "'", "'", ")", ".", "append", "(", "escapeOutputString", "(", "value", ")", ")", ".", "append", "(", "'", "'", ")", ";"...
Appends a string literal with the given value onto the given buffer.
[ "Appends", "a", "string", "literal", "with", "the", "given", "value", "onto", "the", "given", "buffer", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/shared/internal/AbstractGenerateSoyEscapingDirectiveCode.java#L455-L457
rhuss/jolokia
agent/core/src/main/java/org/jolokia/request/JmxSearchRequest.java
JmxSearchRequest.newCreator
static RequestCreator<JmxSearchRequest> newCreator() { return new RequestCreator<JmxSearchRequest>() { /** {@inheritDoc} */ public JmxSearchRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException { return new JmxSearchRequest(pStack.pop(),pParams); } /** {@inheritDoc} */ public JmxSearchRequest create(Map<String, ?> requestMap, ProcessingParameters pParams) throws MalformedObjectNameException { return new JmxSearchRequest(requestMap,pParams); } }; }
java
static RequestCreator<JmxSearchRequest> newCreator() { return new RequestCreator<JmxSearchRequest>() { /** {@inheritDoc} */ public JmxSearchRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException { return new JmxSearchRequest(pStack.pop(),pParams); } /** {@inheritDoc} */ public JmxSearchRequest create(Map<String, ?> requestMap, ProcessingParameters pParams) throws MalformedObjectNameException { return new JmxSearchRequest(requestMap,pParams); } }; }
[ "static", "RequestCreator", "<", "JmxSearchRequest", ">", "newCreator", "(", ")", "{", "return", "new", "RequestCreator", "<", "JmxSearchRequest", ">", "(", ")", "{", "/** {@inheritDoc} */", "public", "JmxSearchRequest", "create", "(", "Stack", "<", "String", ">",...
Creator for {@link JmxSearchRequest}s @return the creator implementation
[ "Creator", "for", "{", "@link", "JmxSearchRequest", "}", "s" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/request/JmxSearchRequest.java#L76-L89
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java
PrepareRequestInterceptor.isSendEmail
private boolean isSendEmail(Map<String, String> map) { return StringUtils.hasText(map.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR)) && map.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR).equalsIgnoreCase(RequestElements.PARAM_SEND_SELECTOR); }
java
private boolean isSendEmail(Map<String, String> map) { return StringUtils.hasText(map.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR)) && map.get(RequestElements.REQ_PARAM_ENTITY_SELECTOR).equalsIgnoreCase(RequestElements.PARAM_SEND_SELECTOR); }
[ "private", "boolean", "isSendEmail", "(", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "return", "StringUtils", ".", "hasText", "(", "map", ".", "get", "(", "RequestElements", ".", "REQ_PARAM_ENTITY_SELECTOR", ")", ")", "&&", "map", ".", "get...
Method returns true if this request should be send as email @param map @return
[ "Method", "returns", "true", "if", "this", "request", "should", "be", "send", "as", "email" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java#L586-L589
samskivert/samskivert
src/main/java/com/samskivert/servlet/user/UserManager.java
UserManager.init
public void init (Properties config, ConnectionProvider conprov) throws PersistenceException { init(config, conprov, null); }
java
public void init (Properties config, ConnectionProvider conprov) throws PersistenceException { init(config, conprov, null); }
[ "public", "void", "init", "(", "Properties", "config", ",", "ConnectionProvider", "conprov", ")", "throws", "PersistenceException", "{", "init", "(", "config", ",", "conprov", ",", "null", ")", ";", "}" ]
Prepares this user manager for operation. Presently the user manager requires the following configuration information: <ul> <li><code>login_url</code>: Should be set to the URL to which to redirect a requester if they are required to login before accessing the requested page. For example: <pre> login_url = /usermgmt/login.ajsp?return=%R </pre> The <code>%R</code> will be replaced with the URL encoded URL the user is currently requesting (complete with query parameters) so that the login code can redirect the user back to this request once they are authenticated. </ul> @param config the user manager configuration properties. @param conprov the database connection provider that will be used to obtain a connection to the user database.
[ "Prepares", "this", "user", "manager", "for", "operation", ".", "Presently", "the", "user", "manager", "requires", "the", "following", "configuration", "information", ":" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/user/UserManager.java#L89-L93
foundation-runtime/service-directory
1.2/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/HttpUtils.java
HttpUtils.postJson
public static HttpResponse postJson(String urlStr, String body) throws IOException, ServiceException { URL url = new URL(urlStr); HttpURLConnection urlConnection = (HttpURLConnection) url .openConnection(); if (urlConnection instanceof HttpsURLConnection) { setTLSConnection((HttpsURLConnection)urlConnection); } urlConnection.addRequestProperty("Accept", "application/json"); urlConnection.setRequestMethod("POST"); urlConnection.addRequestProperty("Content-Type", "application/json"); urlConnection.addRequestProperty("Content-Length", Integer.toString(body.length())); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); OutputStream out = urlConnection.getOutputStream(); out.write(body.getBytes()); ByteStreams.copy(new ByteArrayInputStream(body.getBytes()), out); return getHttpResponse(urlConnection); }
java
public static HttpResponse postJson(String urlStr, String body) throws IOException, ServiceException { URL url = new URL(urlStr); HttpURLConnection urlConnection = (HttpURLConnection) url .openConnection(); if (urlConnection instanceof HttpsURLConnection) { setTLSConnection((HttpsURLConnection)urlConnection); } urlConnection.addRequestProperty("Accept", "application/json"); urlConnection.setRequestMethod("POST"); urlConnection.addRequestProperty("Content-Type", "application/json"); urlConnection.addRequestProperty("Content-Length", Integer.toString(body.length())); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); OutputStream out = urlConnection.getOutputStream(); out.write(body.getBytes()); ByteStreams.copy(new ByteArrayInputStream(body.getBytes()), out); return getHttpResponse(urlConnection); }
[ "public", "static", "HttpResponse", "postJson", "(", "String", "urlStr", ",", "String", "body", ")", "throws", "IOException", ",", "ServiceException", "{", "URL", "url", "=", "new", "URL", "(", "urlStr", ")", ";", "HttpURLConnection", "urlConnection", "=", "("...
Invoke REST Service using POST method. @param urlStr the REST service URL String @param body the Http Body String. @return the HttpResponse. @throws IOException @throws ServiceException
[ "Invoke", "REST", "Service", "using", "POST", "method", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/HttpUtils.java#L74-L97
agmip/agmip-common-functions
src/main/java/org/agmip/functions/PTSaxton2006.java
PTSaxton2006.calcAdjustedDensity
public static String calcAdjustedDensity(String slsnd, String slcly, String omPct, String df) { if (compare(df, "0.9", CompareMode.NOTLESS) && compare(df, "1.3", CompareMode.NOTGREATER)) { String normalDensity = calcNormalDensity(slsnd, slcly, omPct); String ret = product(normalDensity, df); LOG.debug("Calculate result for Adjusted density, g/cm-3 is {}", ret); return ret; } else { LOG.error("Density adjustment Factor is out of range (0.9 - 1.3) : {}", df); return null; } }
java
public static String calcAdjustedDensity(String slsnd, String slcly, String omPct, String df) { if (compare(df, "0.9", CompareMode.NOTLESS) && compare(df, "1.3", CompareMode.NOTGREATER)) { String normalDensity = calcNormalDensity(slsnd, slcly, omPct); String ret = product(normalDensity, df); LOG.debug("Calculate result for Adjusted density, g/cm-3 is {}", ret); return ret; } else { LOG.error("Density adjustment Factor is out of range (0.9 - 1.3) : {}", df); return null; } }
[ "public", "static", "String", "calcAdjustedDensity", "(", "String", "slsnd", ",", "String", "slcly", ",", "String", "omPct", ",", "String", "df", ")", "{", "if", "(", "compare", "(", "df", ",", "\"0.9\"", ",", "CompareMode", ".", "NOTLESS", ")", "&&", "c...
Equation 7 for calculating Adjusted density, g/cm-3 @param slsnd Sand weight percentage by layer ([0,100]%) @param slcly Clay weight percentage by layer ([0,100]%) @param omPct Organic matter weight percentage by layer ([0,100]%), (= SLOC * 1.72) @param df Density adjustment Factor (0.9–1.3)
[ "Equation", "7", "for", "calculating", "Adjusted", "density", "g", "/", "cm", "-", "3" ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L243-L254
camunda/camunda-bpmn-model
src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java
AbstractThrowEventBuilder.signalEventDefinition
public SignalEventDefinitionBuilder signalEventDefinition(String signalName) { SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName); element.getEventDefinitions().add(signalEventDefinition); return new SignalEventDefinitionBuilder(modelInstance, signalEventDefinition); }
java
public SignalEventDefinitionBuilder signalEventDefinition(String signalName) { SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName); element.getEventDefinitions().add(signalEventDefinition); return new SignalEventDefinitionBuilder(modelInstance, signalEventDefinition); }
[ "public", "SignalEventDefinitionBuilder", "signalEventDefinition", "(", "String", "signalName", ")", "{", "SignalEventDefinition", "signalEventDefinition", "=", "createSignalEventDefinition", "(", "signalName", ")", ";", "element", ".", "getEventDefinitions", "(", ")", ".",...
Sets an event definition for the given Signal name. If a signal with this name already exists it will be used, otherwise a new signal is created. It returns a builder for the Signal Event Definition. @param signalName the name of the signal @return the signal event definition builder object
[ "Sets", "an", "event", "definition", "for", "the", "given", "Signal", "name", ".", "If", "a", "signal", "with", "this", "name", "already", "exists", "it", "will", "be", "used", "otherwise", "a", "new", "signal", "is", "created", ".", "It", "returns", "a"...
train
https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractThrowEventBuilder.java#L98-L103
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.createNicePartialMockAndInvokeDefaultConstructor
public static <T> T createNicePartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames) throws Exception { return createNiceMock(type, new ConstructorArgs(Whitebox.getConstructor(type)), Whitebox.getMethods(type, methodNames)); }
java
public static <T> T createNicePartialMockAndInvokeDefaultConstructor(Class<T> type, String... methodNames) throws Exception { return createNiceMock(type, new ConstructorArgs(Whitebox.getConstructor(type)), Whitebox.getMethods(type, methodNames)); }
[ "public", "static", "<", "T", ">", "T", "createNicePartialMockAndInvokeDefaultConstructor", "(", "Class", "<", "T", ">", "type", ",", "String", "...", "methodNames", ")", "throws", "Exception", "{", "return", "createNiceMock", "(", "type", ",", "new", "Construct...
A utility method that may be used to nicely mock several methods in an easy way (by just passing in the method names of the method you wish to mock). The mock object created will support mocking of final methods and invokes the default constructor (even if it's private). @param <T> the type of the mock object @param type the type of the mock object @param methodNames The names of the methods that should be mocked. If {@code null}, then this method will have the same effect as just calling {@link #createMock(Class, Method...)} with the second parameter as {@code new Method[0]} (i.e. all methods in that class will be mocked). @return the mock object.
[ "A", "utility", "method", "that", "may", "be", "used", "to", "nicely", "mock", "several", "methods", "in", "an", "easy", "way", "(", "by", "just", "passing", "in", "the", "method", "names", "of", "the", "method", "you", "wish", "to", "mock", ")", ".", ...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L859-L863
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java
XPath10ParserImpl.postProcessOperands
private void postProcessOperands(OperatorImpl opImpl, String fullPath) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "postProcessOperands", "opImpl: " + opImpl + ", fullPath: " + fullPath); // Check for Identifiers with ampersand strings for(int i = 0; i< opImpl.operands.length; i++) { Selector sel = opImpl.operands[i]; postProcessSelectorTree(sel, fullPath); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "postProcessOperands"); }
java
private void postProcessOperands(OperatorImpl opImpl, String fullPath) throws InvalidXPathSyntaxException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "postProcessOperands", "opImpl: " + opImpl + ", fullPath: " + fullPath); // Check for Identifiers with ampersand strings for(int i = 0; i< opImpl.operands.length; i++) { Selector sel = opImpl.operands[i]; postProcessSelectorTree(sel, fullPath); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(this,cclass, "postProcessOperands"); }
[ "private", "void", "postProcessOperands", "(", "OperatorImpl", "opImpl", ",", "String", "fullPath", ")", "throws", "InvalidXPathSyntaxException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", "...
Traverse an Operator tree handling special character substitution. @param opImpl @throws InvalidXPathSyntaxException
[ "Traverse", "an", "Operator", "tree", "handling", "special", "character", "substitution", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/selector/impl/XPath10ParserImpl.java#L873-L888
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_backupStorage_GET
public ArrayList<String> dedicated_server_serviceName_backupStorage_GET(String serviceName, OvhBackupStorageCapacityEnum capacity) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/backupStorage"; StringBuilder sb = path(qPath, serviceName); query(sb, "capacity", capacity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> dedicated_server_serviceName_backupStorage_GET(String serviceName, OvhBackupStorageCapacityEnum capacity) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/backupStorage"; StringBuilder sb = path(qPath, serviceName); query(sb, "capacity", capacity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "dedicated_server_serviceName_backupStorage_GET", "(", "String", "serviceName", ",", "OvhBackupStorageCapacityEnum", "capacity", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicated/server/{serviceName}/backup...
Get allowed durations for 'backupStorage' option REST: GET /order/dedicated/server/{serviceName}/backupStorage @param capacity [required] The capacity in gigabytes of your backup storage @param serviceName [required] The internal name of your dedicated server
[ "Get", "allowed", "durations", "for", "backupStorage", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2484-L2490
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java
POIUtils.mergeCells
public static CellRangeAddress mergeCells(final Sheet sheet, int startCol, int startRow, int endCol, int endRow) { ArgUtils.notNull(sheet, "sheet"); // 結合先のセルの値を空に設定する for(int r=startRow; r <= endRow; r++) { for(int c=startCol; c <= endCol; c++) { if(r == startRow && c == startCol) { continue; } Cell cell = getCell(sheet, c, r); cell.setCellType(CellType.BLANK); } } final CellRangeAddress range = new CellRangeAddress(startRow, endRow, startCol, endCol); sheet.addMergedRegion(range); return range; }
java
public static CellRangeAddress mergeCells(final Sheet sheet, int startCol, int startRow, int endCol, int endRow) { ArgUtils.notNull(sheet, "sheet"); // 結合先のセルの値を空に設定する for(int r=startRow; r <= endRow; r++) { for(int c=startCol; c <= endCol; c++) { if(r == startRow && c == startCol) { continue; } Cell cell = getCell(sheet, c, r); cell.setCellType(CellType.BLANK); } } final CellRangeAddress range = new CellRangeAddress(startRow, endRow, startCol, endCol); sheet.addMergedRegion(range); return range; }
[ "public", "static", "CellRangeAddress", "mergeCells", "(", "final", "Sheet", "sheet", ",", "int", "startCol", ",", "int", "startRow", ",", "int", "endCol", ",", "int", "endRow", ")", "{", "ArgUtils", ".", "notNull", "(", "sheet", ",", "\"sheet\"", ")", ";"...
指定した範囲のセルを結合する。 @param sheet @param startCol @param startRow @param endCol @param endRow @return 結合した範囲のアドレス情報 @throws IllegalArgumentException {@literal sheet == null}
[ "指定した範囲のセルを結合する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L335-L354
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setStart
public void setStart(int index, Date value) { set(selectField(AssignmentFieldLists.CUSTOM_START, index), value); }
java
public void setStart(int index, Date value) { set(selectField(AssignmentFieldLists.CUSTOM_START, index), value); }
[ "public", "void", "setStart", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "CUSTOM_START", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a start value. @param index start index (1-10) @param value start value
[ "Set", "a", "start", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1540-L1543
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerUpdatePolicy.java
ServerUpdatePolicy.recordServerResult
public void recordServerResult(ServerIdentity server, ModelNode response) { if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) { throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server); } boolean serverFailed = response.has(FAILURE_DESCRIPTION); DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Recording server result for '%s': failed = %s", server, server); synchronized (this) { int previousFailed = failureCount; if (serverFailed) { failureCount++; } else { successCount++; } if (previousFailed <= maxFailed) { if (!serverFailed && (successCount + failureCount) == servers.size()) { // All results are in; notify parent of success parent.recordServerGroupResult(serverGroupName, false); } else if (serverFailed && failureCount > maxFailed) { parent.recordServerGroupResult(serverGroupName, true); } } } }
java
public void recordServerResult(ServerIdentity server, ModelNode response) { if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) { throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server); } boolean serverFailed = response.has(FAILURE_DESCRIPTION); DomainControllerLogger.HOST_CONTROLLER_LOGGER.tracef("Recording server result for '%s': failed = %s", server, server); synchronized (this) { int previousFailed = failureCount; if (serverFailed) { failureCount++; } else { successCount++; } if (previousFailed <= maxFailed) { if (!serverFailed && (successCount + failureCount) == servers.size()) { // All results are in; notify parent of success parent.recordServerGroupResult(serverGroupName, false); } else if (serverFailed && failureCount > maxFailed) { parent.recordServerGroupResult(serverGroupName, true); } } } }
[ "public", "void", "recordServerResult", "(", "ServerIdentity", "server", ",", "ModelNode", "response", ")", "{", "if", "(", "!", "serverGroupName", ".", "equals", "(", "server", ".", "getServerGroupName", "(", ")", ")", "||", "!", "servers", ".", "contains", ...
Records the result of updating a server. @param server the id of the server. Cannot be <code>null</code> @param response the result of the updates
[ "Records", "the", "result", "of", "updating", "a", "server", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerUpdatePolicy.java#L130-L160
apache/incubator-heron
heron/common/src/java/org/apache/heron/common/network/HeronClient.java
HeronClient.sendRequest
public void sendRequest(Message request, Message.Builder responseBuilder) { sendRequest(request, null, responseBuilder, Duration.ZERO); }
java
public void sendRequest(Message request, Message.Builder responseBuilder) { sendRequest(request, null, responseBuilder, Duration.ZERO); }
[ "public", "void", "sendRequest", "(", "Message", "request", ",", "Message", ".", "Builder", "responseBuilder", ")", "{", "sendRequest", "(", "request", ",", "null", ",", "responseBuilder", ",", "Duration", ".", "ZERO", ")", ";", "}" ]
Convenience method of the above method with no timeout or context
[ "Convenience", "method", "of", "the", "above", "method", "with", "no", "timeout", "or", "context" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/common/src/java/org/apache/heron/common/network/HeronClient.java#L214-L216
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.putAuthenticationResult
public static void putAuthenticationResult(final AuthenticationResult authenticationResult, final RequestContext context) { context.getConversationScope().put(PARAMETER_AUTHENTICATION_RESULT, authenticationResult); }
java
public static void putAuthenticationResult(final AuthenticationResult authenticationResult, final RequestContext context) { context.getConversationScope().put(PARAMETER_AUTHENTICATION_RESULT, authenticationResult); }
[ "public", "static", "void", "putAuthenticationResult", "(", "final", "AuthenticationResult", "authenticationResult", ",", "final", "RequestContext", "context", ")", "{", "context", ".", "getConversationScope", "(", ")", ".", "put", "(", "PARAMETER_AUTHENTICATION_RESULT", ...
Put authentication result. @param authenticationResult the authentication result @param context the context
[ "Put", "authentication", "result", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L533-L535
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromComputeNodeWithServiceResponseAsync
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { return listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; if (fileListFromComputeNodeOptions != null) { fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); } return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions)); } }); }
java
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { return listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; if (fileListFromComputeNodeOptions != null) { fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); } return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions)); } }); }
[ "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ">", "listFromComputeNodeWithServiceResponseAsync", "(", "final", "String", "poolId", ",", "final", "String", "nodeId", ",", "final"...
Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeFile&gt; object
[ "Lists", "all", "of", "the", "files", "in", "task", "directories", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2126-L2145
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java
ExcelUtil.getReader
public static ExcelReader getReader(File bookFile, String sheetName) { try { return new ExcelReader(bookFile, sheetName); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
java
public static ExcelReader getReader(File bookFile, String sheetName) { try { return new ExcelReader(bookFile, sheetName); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
[ "public", "static", "ExcelReader", "getReader", "(", "File", "bookFile", ",", "String", "sheetName", ")", "{", "try", "{", "return", "new", "ExcelReader", "(", "bookFile", ",", "sheetName", ")", ";", "}", "catch", "(", "NoClassDefFoundError", "e", ")", "{", ...
获取Excel读取器,通过调用{@link ExcelReader}的read或readXXX方法读取Excel内容 @param bookFile Excel文件 @param sheetName sheet名,第一个默认是sheet1 @return {@link ExcelReader}
[ "获取Excel读取器,通过调用", "{", "@link", "ExcelReader", "}", "的read或readXXX方法读取Excel内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L245-L251
sahan/RoboZombie
robozombie/src/main/java/com/lonepulse/robozombie/util/Assert.java
Assert.assertAssignable
public static <T extends Object> T assertAssignable(Object arg, Class<T> type) { assertNotNull(arg); assertNotNull(type); if(!type.isAssignableFrom(arg.getClass())) { throw new ClassCastException(new StringBuilder("The instance of type <") .append(arg.getClass().getName()).append("> cannot be assigned to a <") .append(type.getName()) .append(">").toString()); } return type.cast(arg); }
java
public static <T extends Object> T assertAssignable(Object arg, Class<T> type) { assertNotNull(arg); assertNotNull(type); if(!type.isAssignableFrom(arg.getClass())) { throw new ClassCastException(new StringBuilder("The instance of type <") .append(arg.getClass().getName()).append("> cannot be assigned to a <") .append(type.getName()) .append(">").toString()); } return type.cast(arg); }
[ "public", "static", "<", "T", "extends", "Object", ">", "T", "assertAssignable", "(", "Object", "arg", ",", "Class", "<", "T", ">", "type", ")", "{", "assertNotNull", "(", "arg", ")", ";", "assertNotNull", "(", "type", ")", ";", "if", "(", "!", "type...
<p>Asserts that the given Object is assignable to the specified type. If either the generic Object or the {@link Class} is {@code null} a {@link NullPointerException} will be thrown with the message, <i>"The supplied argument was found to be &lt;null&gt;"</i>. If the object was not found to be in conformance with the specified type, a {@link ClassCastException} will be thrown with the message, <i>"The instance of type &lt;argument-type&gt; cannot be assigned to a &lt;specified-type&gt;"</i>.</p> @param arg the argument to be asserted for type conformance <br><br> @param type the {@link Class} type to which the argument must conform <br><br> @return the argument which was asserted to conform to the specified type <br><br> @throws ClassCastException if the supplied argument does not conform to the specified type <br><br> @since 1.3.0
[ "<p", ">", "Asserts", "that", "the", "given", "Object", "is", "assignable", "to", "the", "specified", "type", ".", "If", "either", "the", "generic", "Object", "or", "the", "{", "@link", "Class", "}", "is", "{", "@code", "null", "}", "a", "{", "@link", ...
train
https://github.com/sahan/RoboZombie/blob/2e02f0d41647612e9d89360c5c48811ea86b33c8/robozombie/src/main/java/com/lonepulse/robozombie/util/Assert.java#L68-L82
liferay/com-liferay-commerce
commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java
CommerceAccountPersistenceImpl.findByU_T
@Override public List<CommerceAccount> findByU_T(long userId, int type, int start, int end, OrderByComparator<CommerceAccount> orderByComparator) { return findByU_T(userId, type, start, end, orderByComparator, true); }
java
@Override public List<CommerceAccount> findByU_T(long userId, int type, int start, int end, OrderByComparator<CommerceAccount> orderByComparator) { return findByU_T(userId, type, start, end, orderByComparator, true); }
[ "@", "Override", "public", "List", "<", "CommerceAccount", ">", "findByU_T", "(", "long", "userId", ",", "int", "type", ",", "int", "start", ",", "int", "end", ",", "OrderByComparator", "<", "CommerceAccount", ">", "orderByComparator", ")", "{", "return", "f...
Returns an ordered range of all the commerce accounts where userId = &#63; and type = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAccountModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param userId the user ID @param type the type @param start the lower bound of the range of commerce accounts @param end the upper bound of the range of commerce accounts (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce accounts
[ "Returns", "an", "ordered", "range", "of", "all", "the", "commerce", "accounts", "where", "userId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java#L1038-L1042
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java
AttributeLocalizedContentUrl.updateLocalizedContentUrl
public static MozuUrl updateLocalizedContentUrl(String attributeFQN, String localeCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("localeCode", localeCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateLocalizedContentUrl(String attributeFQN, String localeCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}?responseFields={responseFields}"); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("localeCode", localeCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateLocalizedContentUrl", "(", "String", "attributeFQN", ",", "String", "localeCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/attributedefinitio...
Get Resource Url for UpdateLocalizedContent @param attributeFQN Fully qualified name for an attribute. @param localeCode The two character country code that sets the locale, such as US for United States. Sites, tenants, and catalogs use locale codes for localizing content, such as translated product text per supported country. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateLocalizedContent" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/attributedefinition/attributes/AttributeLocalizedContentUrl.java#L77-L84
ziccardi/jnrpe
jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/Shell.java
Shell.executeSystemCommandAndGetOutput
public final String executeSystemCommandAndGetOutput(final String[] command, final String encoding) throws IOException { Process p = Runtime.getRuntime().exec(command); StreamManager sm = new StreamManager(); try { InputStream input = sm.handle(p.getInputStream()); StringBuffer lines = new StringBuffer(); String line; BufferedReader in = (BufferedReader) sm.handle(new BufferedReader(new InputStreamReader(input, encoding))); while ((line = in.readLine()) != null) { lines.append(line).append('\n'); } return lines.toString(); } finally { sm.closeAll(); } }
java
public final String executeSystemCommandAndGetOutput(final String[] command, final String encoding) throws IOException { Process p = Runtime.getRuntime().exec(command); StreamManager sm = new StreamManager(); try { InputStream input = sm.handle(p.getInputStream()); StringBuffer lines = new StringBuffer(); String line; BufferedReader in = (BufferedReader) sm.handle(new BufferedReader(new InputStreamReader(input, encoding))); while ((line = in.readLine()) != null) { lines.append(line).append('\n'); } return lines.toString(); } finally { sm.closeAll(); } }
[ "public", "final", "String", "executeSystemCommandAndGetOutput", "(", "final", "String", "[", "]", "command", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "Process", "p", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", ...
Executes a system command with arguments and returns the output. @param command command to be executed @param encoding encoding to be used @return command output @throws IOException on any error
[ "Executes", "a", "system", "command", "with", "arguments", "and", "returns", "the", "output", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/Shell.java#L55-L72
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/URIClassLoader.java
URIClassLoader.isSealed
private boolean isSealed(String name, Manifest man) { String path = name.replace('.', '/').concat("/"); Attributes attr = man.getAttributes(path); String sealed = null; if (attr != null) { sealed = attr.getValue(Name.SEALED); } if (sealed == null) { if ((attr = man.getMainAttributes()) != null) { sealed = attr.getValue(Name.SEALED); } } return "true".equalsIgnoreCase(sealed); }
java
private boolean isSealed(String name, Manifest man) { String path = name.replace('.', '/').concat("/"); Attributes attr = man.getAttributes(path); String sealed = null; if (attr != null) { sealed = attr.getValue(Name.SEALED); } if (sealed == null) { if ((attr = man.getMainAttributes()) != null) { sealed = attr.getValue(Name.SEALED); } } return "true".equalsIgnoreCase(sealed); }
[ "private", "boolean", "isSealed", "(", "String", "name", ",", "Manifest", "man", ")", "{", "String", "path", "=", "name", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "concat", "(", "\"/\"", ")", ";", "Attributes", "attr", "=", "man", "....
returns true if the specified package name is sealed according to the given manifest.
[ "returns", "true", "if", "the", "specified", "package", "name", "is", "sealed", "according", "to", "the", "given", "manifest", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/URIClassLoader.java#L244-L258
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java
MetricContext.contextAwareMeter
public ContextAwareMeter contextAwareMeter(String name, ContextAwareMetricFactory<ContextAwareMeter> factory) { return this.innerMetricContext.getOrCreate(name, factory); }
java
public ContextAwareMeter contextAwareMeter(String name, ContextAwareMetricFactory<ContextAwareMeter> factory) { return this.innerMetricContext.getOrCreate(name, factory); }
[ "public", "ContextAwareMeter", "contextAwareMeter", "(", "String", "name", ",", "ContextAwareMetricFactory", "<", "ContextAwareMeter", ">", "factory", ")", "{", "return", "this", ".", "innerMetricContext", ".", "getOrCreate", "(", "name", ",", "factory", ")", ";", ...
Get a {@link ContextAwareMeter} with a given name. @param name name of the {@link ContextAwareMeter} @param factory a {@link ContextAwareMetricFactory} for building {@link ContextAwareMeter}s @return the {@link ContextAwareMeter} with the given name
[ "Get", "a", "{", "@link", "ContextAwareMeter", "}", "with", "a", "given", "name", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java#L457-L459
motown-io/motown
chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java
DomainService.createEvse
public Evse createEvse(Long chargingStationTypeId, Evse evse) throws ResourceAlreadyExistsException { ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId); if (getEvseByIdentifier(chargingStationType, evse.getIdentifier()) != null) { throw new ResourceAlreadyExistsException(String.format("Evse with identifier '%s' already exists.", evse.getIdentifier())); } chargingStationType.getEvses().add(evse); chargingStationType = chargingStationTypeRepository.createOrUpdate(chargingStationType); return getEvseByIdentifier(chargingStationType, evse.getIdentifier()); }
java
public Evse createEvse(Long chargingStationTypeId, Evse evse) throws ResourceAlreadyExistsException { ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId); if (getEvseByIdentifier(chargingStationType, evse.getIdentifier()) != null) { throw new ResourceAlreadyExistsException(String.format("Evse with identifier '%s' already exists.", evse.getIdentifier())); } chargingStationType.getEvses().add(evse); chargingStationType = chargingStationTypeRepository.createOrUpdate(chargingStationType); return getEvseByIdentifier(chargingStationType, evse.getIdentifier()); }
[ "public", "Evse", "createEvse", "(", "Long", "chargingStationTypeId", ",", "Evse", "evse", ")", "throws", "ResourceAlreadyExistsException", "{", "ChargingStationType", "chargingStationType", "=", "chargingStationTypeRepository", ".", "findOne", "(", "chargingStationTypeId", ...
Creates a Evse in a charging station type. @param chargingStationTypeId charging station type identifier. @param evse evse object @return created Evse
[ "Creates", "a", "Evse", "in", "a", "charging", "station", "type", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L73-L84
opentelecoms-org/zrtp-java
src/zorg/platform/android/AndroidCacheEntry.java
AndroidCacheEntry.fromString
public static ZrtpCacheEntry fromString(String key, String value) { String data = null; String number = null; int sep = value.indexOf(','); if (sep > 0) { data = value.substring(0, sep); number = value.substring(sep + 1); } else { data = value; number = ""; } byte[] buffer = new byte[data.length() / 2]; for (int i = 0; i < buffer.length; i++) { buffer[i] = (byte) Short.parseShort( data.substring(i * 2, i * 2 + 2), 16); } AndroidCacheEntry entry = new AndroidCacheEntry(key, buffer, number); return entry; }
java
public static ZrtpCacheEntry fromString(String key, String value) { String data = null; String number = null; int sep = value.indexOf(','); if (sep > 0) { data = value.substring(0, sep); number = value.substring(sep + 1); } else { data = value; number = ""; } byte[] buffer = new byte[data.length() / 2]; for (int i = 0; i < buffer.length; i++) { buffer[i] = (byte) Short.parseShort( data.substring(i * 2, i * 2 + 2), 16); } AndroidCacheEntry entry = new AndroidCacheEntry(key, buffer, number); return entry; }
[ "public", "static", "ZrtpCacheEntry", "fromString", "(", "String", "key", ",", "String", "value", ")", "{", "String", "data", "=", "null", ";", "String", "number", "=", "null", ";", "int", "sep", "=", "value", ".", "indexOf", "(", "'", "'", ")", ";", ...
Create a Cache Entry, from the Zid string and the CSV representation of HEX RAW data and phone number @param key ZID string @param value CSV of HEX raw data and phone number, for example "E84FE07E054660FFF5CF90B4,+3943332233323" @return a new ZRTP cache entry
[ "Create", "a", "Cache", "Entry", "from", "the", "Zid", "string", "and", "the", "CSV", "representation", "of", "HEX", "RAW", "data", "and", "phone", "number" ]
train
https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/android/AndroidCacheEntry.java#L108-L126
square/wire
wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/SyntaxReader.java
SyntaxReader.readDataType
public String readDataType(String name) { if (name.equals("map")) { if (readChar() != '<') throw unexpected("expected '<'"); String keyType = readDataType(); if (readChar() != ',') throw unexpected("expected ','"); String valueType = readDataType(); if (readChar() != '>') throw unexpected("expected '>'"); return String.format("map<%s, %s>", keyType, valueType); } else { return name; } }
java
public String readDataType(String name) { if (name.equals("map")) { if (readChar() != '<') throw unexpected("expected '<'"); String keyType = readDataType(); if (readChar() != ',') throw unexpected("expected ','"); String valueType = readDataType(); if (readChar() != '>') throw unexpected("expected '>'"); return String.format("map<%s, %s>", keyType, valueType); } else { return name; } }
[ "public", "String", "readDataType", "(", "String", "name", ")", "{", "if", "(", "name", ".", "equals", "(", "\"map\"", ")", ")", "{", "if", "(", "readChar", "(", ")", "!=", "'", "'", ")", "throw", "unexpected", "(", "\"expected '<'\"", ")", ";", "Str...
Reads a scalar, map, or type name with {@code name} as a prefix word.
[ "Reads", "a", "scalar", "map", "or", "type", "name", "with", "{" ]
train
https://github.com/square/wire/blob/4a9a00dfadfc14d6a0780b85810418f9cbc78a49/wire-schema/src/main/java/com/squareup/wire/schema/internal/parser/SyntaxReader.java#L177-L188
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.getComputeNodeRemoteLoginSettings
public ComputeNodeGetRemoteLoginSettingsResult getComputeNodeRemoteLoginSettings(String poolId, String nodeId) throws BatchErrorException, IOException { return getComputeNodeRemoteLoginSettings(poolId, nodeId, null); }
java
public ComputeNodeGetRemoteLoginSettingsResult getComputeNodeRemoteLoginSettings(String poolId, String nodeId) throws BatchErrorException, IOException { return getComputeNodeRemoteLoginSettings(poolId, nodeId, null); }
[ "public", "ComputeNodeGetRemoteLoginSettingsResult", "getComputeNodeRemoteLoginSettings", "(", "String", "poolId", ",", "String", "nodeId", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "getComputeNodeRemoteLoginSettings", "(", "poolId", ",", "nodeI...
Gets the settings required for remote login to a compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node for which to get a remote login settings. @return The remote settings for the specified compute node. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Gets", "the", "settings", "required", "for", "remote", "login", "to", "a", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L476-L478
baratine/baratine
framework/src/main/java/com/caucho/v5/ramp/db/DatabaseServiceRamp.java
DatabaseServiceRamp.find
public void find(ResultStream<Cursor> result, String sql, Object ...args) { _kraken.findStream(sql, args, result); }
java
public void find(ResultStream<Cursor> result, String sql, Object ...args) { _kraken.findStream(sql, args, result); }
[ "public", "void", "find", "(", "ResultStream", "<", "Cursor", ">", "result", ",", "String", "sql", ",", "Object", "...", "args", ")", "{", "_kraken", ".", "findStream", "(", "sql", ",", "args", ",", "result", ")", ";", "}" ]
Queries the database, returning values to a result sink. @param sql the select query for the search @param result callback for the result iterator @param args arguments to the sql
[ "Queries", "the", "database", "returning", "values", "to", "a", "result", "sink", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/ramp/db/DatabaseServiceRamp.java#L157-L160
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java
XPathParser.parseOccuranceIndicator
private char parseOccuranceIndicator() { char wildcard; if (is(TokenType.STAR, true)) { wildcard = '*'; } else if (is(TokenType.PLUS, true)) { wildcard = '+'; } else { consume(TokenType.INTERROGATION, true); wildcard = '?'; } return wildcard; }
java
private char parseOccuranceIndicator() { char wildcard; if (is(TokenType.STAR, true)) { wildcard = '*'; } else if (is(TokenType.PLUS, true)) { wildcard = '+'; } else { consume(TokenType.INTERROGATION, true); wildcard = '?'; } return wildcard; }
[ "private", "char", "parseOccuranceIndicator", "(", ")", "{", "char", "wildcard", ";", "if", "(", "is", "(", "TokenType", ".", "STAR", ",", "true", ")", ")", "{", "wildcard", "=", "'", "'", ";", "}", "else", "if", "(", "is", "(", "TokenType", ".", "...
Parses the the rule OccuranceIndicator according to the following production rule: <p> [50] OccurrenceIndicator ::= "?" | "*" | "+" . </p> @return wildcard
[ "Parses", "the", "the", "rule", "OccuranceIndicator", "according", "to", "the", "following", "production", "rule", ":", "<p", ">", "[", "50", "]", "OccurrenceIndicator", "::", "=", "?", "|", "*", "|", "+", ".", "<", "/", "p", ">" ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L1373-L1388
belaban/JGroups
src/org/jgroups/util/RingBuffer.java
RingBuffer.drainTo
public int drainTo(Collection<? super T> c, int max_elements) { int num=Math.min(count, max_elements); // count may increase in the mean time, but that's ok if(num == 0) return num; int read_index=ri; // no lock as we're the only reader for(int i=0; i < num; i++) { int real_index=realIndex(read_index +i); c.add(buf[real_index]); buf[real_index]=null; } publishReadIndex(num); return num; }
java
public int drainTo(Collection<? super T> c, int max_elements) { int num=Math.min(count, max_elements); // count may increase in the mean time, but that's ok if(num == 0) return num; int read_index=ri; // no lock as we're the only reader for(int i=0; i < num; i++) { int real_index=realIndex(read_index +i); c.add(buf[real_index]); buf[real_index]=null; } publishReadIndex(num); return num; }
[ "public", "int", "drainTo", "(", "Collection", "<", "?", "super", "T", ">", "c", ",", "int", "max_elements", ")", "{", "int", "num", "=", "Math", ".", "min", "(", "count", ",", "max_elements", ")", ";", "// count may increase in the mean time, but that's ok", ...
Removes a number of messages and adds them to c. Same semantics as {@link java.util.concurrent.BlockingQueue#drainTo(Collection,int)}. @param c The collection to which to add the removed messages. @param max_elements The max number of messages to remove. The actual number of messages removed may be smaller if the buffer has fewer elements @return The number of messages removed @throws NullPointerException If c is null
[ "Removes", "a", "number", "of", "messages", "and", "adds", "them", "to", "c", ".", "Same", "semantics", "as", "{" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/RingBuffer.java#L173-L185
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/Database.java
Database.findOptionalLong
public @NotNull OptionalLong findOptionalLong(@NotNull @SQL String sql, Object... args) { return findOptionalLong(SqlQuery.query(sql, args)); }
java
public @NotNull OptionalLong findOptionalLong(@NotNull @SQL String sql, Object... args) { return findOptionalLong(SqlQuery.query(sql, args)); }
[ "public", "@", "NotNull", "OptionalLong", "findOptionalLong", "(", "@", "NotNull", "@", "SQL", "String", "sql", ",", "Object", "...", "args", ")", "{", "return", "findOptionalLong", "(", "SqlQuery", ".", "query", "(", "sql", ",", "args", ")", ")", ";", "...
Finds a unique result from database, converting the database row to long using default mechanisms. Returns empty if there are no results or if single null result is returned. @throws NonUniqueResultException if there are multiple result rows
[ "Finds", "a", "unique", "result", "from", "database", "converting", "the", "database", "row", "to", "long", "using", "default", "mechanisms", ".", "Returns", "empty", "if", "there", "are", "no", "results", "or", "if", "single", "null", "result", "is", "retur...
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L433-L435
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/lsh/RandomProjectionLSH.java
RandomProjectionLSH.rawBucketOf
INDArray rawBucketOf(INDArray query){ INDArray pattern = hash(query); INDArray res = Nd4j.zeros(DataType.BOOL, index.shape()); Nd4j.getExecutioner().exec(new BroadcastEqualTo(index, pattern, res, -1)); return res.castTo(Nd4j.defaultFloatingPointType()).min(-1); }
java
INDArray rawBucketOf(INDArray query){ INDArray pattern = hash(query); INDArray res = Nd4j.zeros(DataType.BOOL, index.shape()); Nd4j.getExecutioner().exec(new BroadcastEqualTo(index, pattern, res, -1)); return res.castTo(Nd4j.defaultFloatingPointType()).min(-1); }
[ "INDArray", "rawBucketOf", "(", "INDArray", "query", ")", "{", "INDArray", "pattern", "=", "hash", "(", "query", ")", ";", "INDArray", "res", "=", "Nd4j", ".", "zeros", "(", "DataType", ".", "BOOL", ",", "index", ".", "shape", "(", ")", ")", ";", "Nd...
data elements in the same bucket as the query, without entropy
[ "data", "elements", "in", "the", "same", "bucket", "as", "the", "query", "without", "entropy" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/lsh/RandomProjectionLSH.java#L163-L169
nwillc/almost-functional
src/main/java/almost/functional/utils/Iterables.java
Iterables.contains
public static <T> boolean contains(final Iterable<T> iterable, final T value) { return any(iterable, Predicates.isEqual(value)); }
java
public static <T> boolean contains(final Iterable<T> iterable, final T value) { return any(iterable, Predicates.isEqual(value)); }
[ "public", "static", "<", "T", ">", "boolean", "contains", "(", "final", "Iterable", "<", "T", ">", "iterable", ",", "final", "T", "value", ")", "{", "return", "any", "(", "iterable", ",", "Predicates", ".", "isEqual", "(", "value", ")", ")", ";", "}"...
Does an iterable contain a value as determined by Object.isEqual(Object, Object). @param iterable the iterable @param value the value @param <T> the type of the iterable and object @return true if iterable contain a value as determined by Object.isEqual(Object, Object).
[ "Does", "an", "iterable", "contain", "a", "value", "as", "determined", "by", "Object", ".", "isEqual", "(", "Object", "Object", ")", "." ]
train
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L115-L117
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/service/ContainerTracker.java
ContainerTracker.registerContainer
public synchronized void registerContainer(String containerId, ImageConfiguration imageConfig, GavLabel gavLabel) { ContainerShutdownDescriptor descriptor = new ContainerShutdownDescriptor(imageConfig, containerId); shutdownDescriptorPerContainerMap.put(containerId, descriptor); updatePomLabelMap(gavLabel, descriptor); updateImageToContainerMapping(imageConfig, containerId); }
java
public synchronized void registerContainer(String containerId, ImageConfiguration imageConfig, GavLabel gavLabel) { ContainerShutdownDescriptor descriptor = new ContainerShutdownDescriptor(imageConfig, containerId); shutdownDescriptorPerContainerMap.put(containerId, descriptor); updatePomLabelMap(gavLabel, descriptor); updateImageToContainerMapping(imageConfig, containerId); }
[ "public", "synchronized", "void", "registerContainer", "(", "String", "containerId", ",", "ImageConfiguration", "imageConfig", ",", "GavLabel", "gavLabel", ")", "{", "ContainerShutdownDescriptor", "descriptor", "=", "new", "ContainerShutdownDescriptor", "(", "imageConfig", ...
Register a started container to this tracker @param containerId container id to register @param imageConfig configuration of associated image @param gavLabel pom label to identifying the reactor project where the container was created
[ "Register", "a", "started", "container", "to", "this", "tracker" ]
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/service/ContainerTracker.java#L34-L41
OpenTSDB/opentsdb
src/tsd/RpcHandler.java
RpcHandler.handleTelnetRpc
private void handleTelnetRpc(final Channel chan, final String[] command) { TelnetRpc rpc = rpc_manager.lookupTelnetRpc(command[0]); if (rpc == null) { rpc = unknown_cmd; } telnet_rpcs_received.incrementAndGet(); rpc.execute(tsdb, chan, command); }
java
private void handleTelnetRpc(final Channel chan, final String[] command) { TelnetRpc rpc = rpc_manager.lookupTelnetRpc(command[0]); if (rpc == null) { rpc = unknown_cmd; } telnet_rpcs_received.incrementAndGet(); rpc.execute(tsdb, chan, command); }
[ "private", "void", "handleTelnetRpc", "(", "final", "Channel", "chan", ",", "final", "String", "[", "]", "command", ")", "{", "TelnetRpc", "rpc", "=", "rpc_manager", ".", "lookupTelnetRpc", "(", "command", "[", "0", "]", ")", ";", "if", "(", "rpc", "==",...
Finds the right handler for a telnet-style RPC and executes it. @param chan The channel on which the RPC was received. @param command The split telnet-style command.
[ "Finds", "the", "right", "handler", "for", "a", "telnet", "-", "style", "RPC", "and", "executes", "it", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/RpcHandler.java#L155-L162
jparsec/jparsec
jparsec/src/main/java/org/jparsec/Terminals.java
Terminals.caseInsensitive
@Deprecated public static Terminals caseInsensitive(String[] ops, String[] keywords) { return operators(ops).words(Scanners.IDENTIFIER).caseInsensitiveKeywords(asList(keywords)).build(); }
java
@Deprecated public static Terminals caseInsensitive(String[] ops, String[] keywords) { return operators(ops).words(Scanners.IDENTIFIER).caseInsensitiveKeywords(asList(keywords)).build(); }
[ "@", "Deprecated", "public", "static", "Terminals", "caseInsensitive", "(", "String", "[", "]", "ops", ",", "String", "[", "]", "keywords", ")", "{", "return", "operators", "(", "ops", ")", ".", "words", "(", "Scanners", ".", "IDENTIFIER", ")", ".", "cas...
Returns a {@link Terminals} object for lexing and parsing the operators with names specified in {@code ops}, and for lexing and parsing the keywords case insensitively. Parsers for operators and keywords can be obtained through {@link #token}; parsers for identifiers through {@link #identifier}. <p>In detail, keywords and operators are lexed as {@link Tokens.Fragment} with {@link Tag#RESERVED} tag. Words that are not among {@code keywords} are lexed as {@code Fragment} with {@link Tag#IDENTIFIER} tag. <p>A word is defined as an alphanumeric string that starts with {@code [_a - zA - Z]}, with 0 or more {@code [0 - 9_a - zA - Z]} following. @param ops the operator names. @param keywords the keyword names. @return the Terminals instance. @deprecated Use {@code operators(ops) .words(Scanners.IDENTIFIER) .caseInsensitiveKeywords(keywords) .build()} instead.
[ "Returns", "a", "{", "@link", "Terminals", "}", "object", "for", "lexing", "and", "parsing", "the", "operators", "with", "names", "specified", "in", "{", "@code", "ops", "}", "and", "for", "lexing", "and", "parsing", "the", "keywords", "case", "insensitively...
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/Terminals.java#L241-L244
elki-project/elki
elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/ClassicMultidimensionalScalingTransform.java
ClassicMultidimensionalScalingTransform.computeSquaredDistanceMatrix
protected static <I> double[][] computeSquaredDistanceMatrix(final List<I> col, PrimitiveDistanceFunction<? super I> dist) { final int size = col.size(); double[][] imat = new double[size][size]; boolean squared = dist.isSquared(); FiniteProgress dprog = LOG.isVerbose() ? new FiniteProgress("Computing distance matrix", (size * (size - 1)) >>> 1, LOG) : null; for(int x = 0; x < size; x++) { final I ox = col.get(x); for(int y = x + 1; y < size; y++) { final I oy = col.get(y); double distance = dist.distance(ox, oy); distance *= squared ? -.5 : (-.5 * distance); imat[x][y] = imat[y][x] = distance; } if(dprog != null) { dprog.setProcessed(dprog.getProcessed() + size - x - 1, LOG); } } LOG.ensureCompleted(dprog); return imat; }
java
protected static <I> double[][] computeSquaredDistanceMatrix(final List<I> col, PrimitiveDistanceFunction<? super I> dist) { final int size = col.size(); double[][] imat = new double[size][size]; boolean squared = dist.isSquared(); FiniteProgress dprog = LOG.isVerbose() ? new FiniteProgress("Computing distance matrix", (size * (size - 1)) >>> 1, LOG) : null; for(int x = 0; x < size; x++) { final I ox = col.get(x); for(int y = x + 1; y < size; y++) { final I oy = col.get(y); double distance = dist.distance(ox, oy); distance *= squared ? -.5 : (-.5 * distance); imat[x][y] = imat[y][x] = distance; } if(dprog != null) { dprog.setProcessed(dprog.getProcessed() + size - x - 1, LOG); } } LOG.ensureCompleted(dprog); return imat; }
[ "protected", "static", "<", "I", ">", "double", "[", "]", "[", "]", "computeSquaredDistanceMatrix", "(", "final", "List", "<", "I", ">", "col", ",", "PrimitiveDistanceFunction", "<", "?", "super", "I", ">", "dist", ")", "{", "final", "int", "size", "=", ...
Compute the squared distance matrix. @param col Input data @param dist Distance function @return Distance matrix.
[ "Compute", "the", "squared", "distance", "matrix", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/ClassicMultidimensionalScalingTransform.java#L158-L177
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
HtmlTree.FRAME
public static HtmlTree FRAME(String src, String name, String title) { return FRAME(src, name, title, null); }
java
public static HtmlTree FRAME(String src, String name, String title) { return FRAME(src, name, title, null); }
[ "public", "static", "HtmlTree", "FRAME", "(", "String", "src", ",", "String", "name", ",", "String", "title", ")", "{", "return", "FRAME", "(", "src", ",", "name", ",", "title", ",", "null", ")", ";", "}" ]
Generates a Frame tag. @param src the url of the document to be shown in the frame @param name specifies the name of the frame @param title the title for the frame @return an HtmlTree object for the SPAN tag
[ "Generates", "a", "Frame", "tag", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L357-L359
james-hu/jabb-core
src/main/java/net/sf/jabb/util/prop/PlaceHolderReplacer.java
PlaceHolderReplacer.replaceWithProperties
static public String replaceWithProperties(final String str, final Properties props){ String result = null; switch (IMPL_TYPE){ case JBOSS_IMPL: result = StringPropertyReplacer.replaceProperties(str, props); break; default: result = str; } return result; }
java
static public String replaceWithProperties(final String str, final Properties props){ String result = null; switch (IMPL_TYPE){ case JBOSS_IMPL: result = StringPropertyReplacer.replaceProperties(str, props); break; default: result = str; } return result; }
[ "static", "public", "String", "replaceWithProperties", "(", "final", "String", "str", ",", "final", "Properties", "props", ")", "{", "String", "result", "=", "null", ";", "switch", "(", "IMPL_TYPE", ")", "{", "case", "JBOSS_IMPL", ":", "result", "=", "String...
If running inside JBoss, it replace any occurrence of ${p} with the System.getProperty(p) value. If there is no such property p defined, then the ${p} reference will remain unchanged. If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned. If the property reference is of the form ${p1,p2} or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before returning either the unchanged input, or the default value. The property ${/} is replaced with System.getProperty("file.separator") value and the property ${:} is replaced with System.getProperty("path.separator"). @param str the input string that substitution will be performed upon. @param props the properties to be used instead of System.getProerty() @return the output string that had been replaced
[ "If", "running", "inside", "JBoss", "it", "replace", "any", "occurrence", "of", "$", "{", "p", "}", "with", "the", "System", ".", "getProperty", "(", "p", ")", "value", ".", "If", "there", "is", "no", "such", "property", "p", "defined", "then", "the", ...
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/prop/PlaceHolderReplacer.java#L75-L85
haraldk/TwelveMonkeys
imageio/imageio-hdr/src/main/java/com/twelvemonkeys/imageio/plugins/hdr/RGBE.java
RGBE.rgbe2float
public static void rgbe2float(float[] rgb, byte[] rgbe, int startRGBEOffset) { float f; if (rgbe[startRGBEOffset + 3] != 0) { // nonzero pixel f = (float) ldexp(1.0, (rgbe[startRGBEOffset + 3] & 0xFF) - (128 + 8)); rgb[0] = (rgbe[startRGBEOffset + 0] & 0xFF) * f; rgb[1] = (rgbe[startRGBEOffset + 1] & 0xFF) * f; rgb[2] = (rgbe[startRGBEOffset + 2] & 0xFF) * f; } else { rgb[0] = 0; rgb[1] = 0; rgb[2] = 0; } }
java
public static void rgbe2float(float[] rgb, byte[] rgbe, int startRGBEOffset) { float f; if (rgbe[startRGBEOffset + 3] != 0) { // nonzero pixel f = (float) ldexp(1.0, (rgbe[startRGBEOffset + 3] & 0xFF) - (128 + 8)); rgb[0] = (rgbe[startRGBEOffset + 0] & 0xFF) * f; rgb[1] = (rgbe[startRGBEOffset + 1] & 0xFF) * f; rgb[2] = (rgbe[startRGBEOffset + 2] & 0xFF) * f; } else { rgb[0] = 0; rgb[1] = 0; rgb[2] = 0; } }
[ "public", "static", "void", "rgbe2float", "(", "float", "[", "]", "rgb", ",", "byte", "[", "]", "rgbe", ",", "int", "startRGBEOffset", ")", "{", "float", "f", ";", "if", "(", "rgbe", "[", "startRGBEOffset", "+", "3", "]", "!=", "0", ")", "{", "// n...
Standard conversion from rgbe to float pixels. Note: Ward uses ldexp(col+0.5,exp-(128+8)). However we wanted pixels in the range [0,1] to map back into the range [0,1].
[ "Standard", "conversion", "from", "rgbe", "to", "float", "pixels", ".", "Note", ":", "Ward", "uses", "ldexp", "(", "col", "+", "0", ".", "5", "exp", "-", "(", "128", "+", "8", "))", ".", "However", "we", "wanted", "pixels", "in", "the", "range", "[...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-hdr/src/main/java/com/twelvemonkeys/imageio/plugins/hdr/RGBE.java#L320-L334
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java
EventServiceImpl.registerListenerInternal
private EventRegistration registerListenerInternal(String serviceName, String topic, EventFilter filter, Object listener, boolean localOnly) { if (listener == null) { throw new IllegalArgumentException("Listener required!"); } if (filter == null) { throw new IllegalArgumentException("EventFilter required!"); } EventServiceSegment segment = getSegment(serviceName, true); String id = UuidUtil.newUnsecureUuidString(); Registration reg = new Registration(id, serviceName, topic, filter, nodeEngine.getThisAddress(), listener, localOnly); if (!segment.addRegistration(topic, reg)) { return null; } if (!localOnly) { Supplier<Operation> supplier = new RegistrationOperationSupplier(reg, nodeEngine.getClusterService()); invokeOnAllMembers(supplier); } return reg; }
java
private EventRegistration registerListenerInternal(String serviceName, String topic, EventFilter filter, Object listener, boolean localOnly) { if (listener == null) { throw new IllegalArgumentException("Listener required!"); } if (filter == null) { throw new IllegalArgumentException("EventFilter required!"); } EventServiceSegment segment = getSegment(serviceName, true); String id = UuidUtil.newUnsecureUuidString(); Registration reg = new Registration(id, serviceName, topic, filter, nodeEngine.getThisAddress(), listener, localOnly); if (!segment.addRegistration(topic, reg)) { return null; } if (!localOnly) { Supplier<Operation> supplier = new RegistrationOperationSupplier(reg, nodeEngine.getClusterService()); invokeOnAllMembers(supplier); } return reg; }
[ "private", "EventRegistration", "registerListenerInternal", "(", "String", "serviceName", ",", "String", "topic", ",", "EventFilter", "filter", ",", "Object", "listener", ",", "boolean", "localOnly", ")", "{", "if", "(", "listener", "==", "null", ")", "{", "thro...
Registers the listener for events matching the service name, topic and filter. If {@code localOnly} is {@code true}, it will register only for events published on this node, otherwise, the registration is sent to other nodes and the listener will listen for events on all cluster members. @param serviceName the service name for which we are registering @param topic the event topic for which we are registering @param filter the filter for the listened events @param listener the event listener @param localOnly whether to register on local events or on events on all cluster members @return the event registration @throws IllegalArgumentException if the listener or filter is null
[ "Registers", "the", "listener", "for", "events", "matching", "the", "service", "name", "topic", "and", "filter", ".", "If", "{", "@code", "localOnly", "}", "is", "{", "@code", "true", "}", "it", "will", "register", "only", "for", "events", "published", "on...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java#L276-L296
EsotericSoftware/jsonbeans
src/com/esotericsoftware/jsonbeans/Json.java
Json.addClassTag
public void addClassTag (String tag, Class type) { tagToClass.put(tag, type); classToTag.put(type, tag); }
java
public void addClassTag (String tag, Class type) { tagToClass.put(tag, type); classToTag.put(type, tag); }
[ "public", "void", "addClassTag", "(", "String", "tag", ",", "Class", "type", ")", "{", "tagToClass", ".", "put", "(", "tag", ",", "type", ")", ";", "classToTag", ".", "put", "(", "type", ",", "tag", ")", ";", "}" ]
Sets a tag to use instead of the fully qualifier class name. This can make the JSON easier to read.
[ "Sets", "a", "tag", "to", "use", "instead", "of", "the", "fully", "qualifier", "class", "name", ".", "This", "can", "make", "the", "JSON", "easier", "to", "read", "." ]
train
https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L96-L99
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java
KickflipApiClient.getStreamInfo
public void getStreamInfo(String streamId, final KickflipCallback cb) { GenericData data = new GenericData(); data.put("stream_id", streamId); post(GET_META, new UrlEncodedContent(data), Stream.class, cb); }
java
public void getStreamInfo(String streamId, final KickflipCallback cb) { GenericData data = new GenericData(); data.put("stream_id", streamId); post(GET_META, new UrlEncodedContent(data), Stream.class, cb); }
[ "public", "void", "getStreamInfo", "(", "String", "streamId", ",", "final", "KickflipCallback", "cb", ")", "{", "GenericData", "data", "=", "new", "GenericData", "(", ")", ";", "data", ".", "put", "(", "\"stream_id\"", ",", "streamId", ")", ";", "post", "(...
Get Stream Metadata for a a public {@link io.kickflip.sdk.api.json.Stream#mStreamId}. The target Stream must belong a User within your Kickflip app. <p/> This method is useful when digesting a Kickflip.io/<stream_id> url, where only the StreamId String is known. @param streamId the stream Id of the given stream. This is the value that appears in urls of form kickflip.io/<stream_id> @param cb A callback to receive the current {@link io.kickflip.sdk.api.json.Stream} upon request completion
[ "Get", "Stream", "Metadata", "for", "a", "a", "public", "{", "@link", "io", ".", "kickflip", ".", "sdk", ".", "api", ".", "json", ".", "Stream#mStreamId", "}", ".", "The", "target", "Stream", "must", "belong", "a", "User", "within", "your", "Kickflip", ...
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L458-L463
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
JpaControllerManagement.cancelAction
@Override @Modifying @Transactional(isolation = Isolation.READ_COMMITTED) public Action cancelAction(final long actionId) { LOG.debug("cancelAction({})", actionId); final JpaAction action = actionRepository.findById(actionId) .orElseThrow(() -> new EntityNotFoundException(Action.class, actionId)); if (action.isCancelingOrCanceled()) { throw new CancelActionNotAllowedException("Actions in canceling or canceled state cannot be canceled"); } if (action.isActive()) { LOG.debug("action ({}) was still active. Change to {}.", action, Status.CANCELING); action.setStatus(Status.CANCELING); // document that the status has been retrieved actionStatusRepository.save(new JpaActionStatus(action, Status.CANCELING, System.currentTimeMillis(), "manual cancelation requested")); final Action saveAction = actionRepository.save(action); cancelAssignDistributionSetEvent((JpaTarget) action.getTarget(), action.getId()); return saveAction; } else { throw new CancelActionNotAllowedException( "Action [id: " + action.getId() + "] is not active and cannot be canceled"); } }
java
@Override @Modifying @Transactional(isolation = Isolation.READ_COMMITTED) public Action cancelAction(final long actionId) { LOG.debug("cancelAction({})", actionId); final JpaAction action = actionRepository.findById(actionId) .orElseThrow(() -> new EntityNotFoundException(Action.class, actionId)); if (action.isCancelingOrCanceled()) { throw new CancelActionNotAllowedException("Actions in canceling or canceled state cannot be canceled"); } if (action.isActive()) { LOG.debug("action ({}) was still active. Change to {}.", action, Status.CANCELING); action.setStatus(Status.CANCELING); // document that the status has been retrieved actionStatusRepository.save(new JpaActionStatus(action, Status.CANCELING, System.currentTimeMillis(), "manual cancelation requested")); final Action saveAction = actionRepository.save(action); cancelAssignDistributionSetEvent((JpaTarget) action.getTarget(), action.getId()); return saveAction; } else { throw new CancelActionNotAllowedException( "Action [id: " + action.getId() + "] is not active and cannot be canceled"); } }
[ "@", "Override", "@", "Modifying", "@", "Transactional", "(", "isolation", "=", "Isolation", ".", "READ_COMMITTED", ")", "public", "Action", "cancelAction", "(", "final", "long", "actionId", ")", "{", "LOG", ".", "debug", "(", "\"cancelAction({})\"", ",", "act...
Cancels given {@link Action} for this {@link Target}. The method will immediately add a {@link Status#CANCELED} status to the action. However, it might be possible that the controller will continue to work on the cancelation. The controller needs to acknowledge or reject the cancelation using {@link DdiRootController#postCancelActionFeedback}. @param actionId to be canceled @return canceled {@link Action} @throws CancelActionNotAllowedException in case the given action is not active or is already canceled @throws EntityNotFoundException if action with given actionId does not exist.
[ "Cancels", "given", "{", "@link", "Action", "}", "for", "this", "{", "@link", "Target", "}", ".", "The", "method", "will", "immediately", "add", "a", "{", "@link", "Status#CANCELED", "}", "status", "to", "the", "action", ".", "However", "it", "might", "b...
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java#L1004-L1032
mozilla/rhino
src/org/mozilla/javascript/NativeArray.java
NativeArray.deleteElem
private static void deleteElem(Scriptable target, long index) { int i = (int)index; if (i == index) { target.delete(i); } else { target.delete(Long.toString(index)); } }
java
private static void deleteElem(Scriptable target, long index) { int i = (int)index; if (i == index) { target.delete(i); } else { target.delete(Long.toString(index)); } }
[ "private", "static", "void", "deleteElem", "(", "Scriptable", "target", ",", "long", "index", ")", "{", "int", "i", "=", "(", "int", ")", "index", ";", "if", "(", "i", "==", "index", ")", "{", "target", ".", "delete", "(", "i", ")", ";", "}", "el...
/* Utility functions to encapsulate index > Integer.MAX_VALUE handling. Also avoids unnecessary object creation that would be necessary to use the general ScriptRuntime.get/setElem functions... though this is probably premature optimization.
[ "/", "*", "Utility", "functions", "to", "encapsulate", "index", ">", "Integer", ".", "MAX_VALUE", "handling", ".", "Also", "avoids", "unnecessary", "object", "creation", "that", "would", "be", "necessary", "to", "use", "the", "general", "ScriptRuntime", ".", "...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeArray.java#L780-L784
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java
DiscreteDistributions.bernoulliCdf
public static double bernoulliCdf(int k, double p) { if(p<0) { throw new IllegalArgumentException("The probability p can't be negative."); } double probabilitySum=0.0; if(k<0) { } else if(k<1) { //aka k==0 probabilitySum=(1-p); } else { //k>=1 aka k==1 probabilitySum=1.0; } return probabilitySum; }
java
public static double bernoulliCdf(int k, double p) { if(p<0) { throw new IllegalArgumentException("The probability p can't be negative."); } double probabilitySum=0.0; if(k<0) { } else if(k<1) { //aka k==0 probabilitySum=(1-p); } else { //k>=1 aka k==1 probabilitySum=1.0; } return probabilitySum; }
[ "public", "static", "double", "bernoulliCdf", "(", "int", "k", ",", "double", "p", ")", "{", "if", "(", "p", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The probability p can't be negative.\"", ")", ";", "}", "double", "probabilityS...
Returns the cumulative probability under bernoulli @param k @param p @return
[ "Returns", "the", "cumulative", "probability", "under", "bernoulli" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L49-L66
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java
FieldAccessor.getValueOfMap
@SuppressWarnings("unchecked") public Object getValueOfMap(final Object key, final Object targetObj) { ArgUtils.notNull(targetObj, "targetObj"); if(!Map.class.isAssignableFrom(targetType)) { throw new IllegalStateException("this method cannot call Map. This target type is " + targetType.getName()); } final Map<Object, Object> map = (Map<Object, Object>) getValue(targetObj); if(map == null) { return null; } return map.get(key); }
java
@SuppressWarnings("unchecked") public Object getValueOfMap(final Object key, final Object targetObj) { ArgUtils.notNull(targetObj, "targetObj"); if(!Map.class.isAssignableFrom(targetType)) { throw new IllegalStateException("this method cannot call Map. This target type is " + targetType.getName()); } final Map<Object, Object> map = (Map<Object, Object>) getValue(targetObj); if(map == null) { return null; } return map.get(key); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Object", "getValueOfMap", "(", "final", "Object", "key", ",", "final", "Object", "targetObj", ")", "{", "ArgUtils", ".", "notNull", "(", "targetObj", ",", "\"targetObj\"", ")", ";", "if", "(", "!...
フィールドがマップ形式の場合に、キーを指定して値を取得する。 @param key マップキーの値 @param targetObj オブジェクト(インスタンス) @return マップの値 @throws IllegalArgumentException {@literal targetObj == null.} @throws IllegalStateException {@literal フィールドのタイプがMap出ない場合}
[ "フィールドがマップ形式の場合に、キーを指定して値を取得する。" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java#L229-L244
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.decomposeAbsDualQuadratic
public static boolean decomposeAbsDualQuadratic( DMatrix4x4 Q , DMatrix3x3 w , DMatrix3 p ) { DecomposeAbsoluteDualQuadratic alg = new DecomposeAbsoluteDualQuadratic(); if( !alg.decompose(Q) ) return false; w.set(alg.getW()); p.set(alg.getP()); return true; }
java
public static boolean decomposeAbsDualQuadratic( DMatrix4x4 Q , DMatrix3x3 w , DMatrix3 p ) { DecomposeAbsoluteDualQuadratic alg = new DecomposeAbsoluteDualQuadratic(); if( !alg.decompose(Q) ) return false; w.set(alg.getW()); p.set(alg.getP()); return true; }
[ "public", "static", "boolean", "decomposeAbsDualQuadratic", "(", "DMatrix4x4", "Q", ",", "DMatrix3x3", "w", ",", "DMatrix3", "p", ")", "{", "DecomposeAbsoluteDualQuadratic", "alg", "=", "new", "DecomposeAbsoluteDualQuadratic", "(", ")", ";", "if", "(", "!", "alg",...
Decomposes the absolute dual quadratic into the following submatrices: Q=[w -w*p;-p'*w p'*w*p] @see DecomposeAbsoluteDualQuadratic @param Q (Input) Absolute quadratic. Typically found in auto calibration. Not modified. @param w (Output) 3x3 symmetric matrix @param p (Output) 3x1 vector @return true if successful or false if it failed
[ "Decomposes", "the", "absolute", "dual", "quadratic", "into", "the", "following", "submatrices", ":", "Q", "=", "[", "w", "-", "w", "*", "p", ";", "-", "p", "*", "w", "p", "*", "w", "*", "p", "]" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1609-L1616
resilience4j/resilience4j
resilience4j-spring/src/main/java/io/github/resilience4j/bulkhead/configure/BulkheadAspect.java
BulkheadAspect.handleJoinPointCompletableFuture
private Object handleJoinPointCompletableFuture(ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.bulkhead.Bulkhead bulkhead) { return bulkhead.executeCompletionStage(() -> { try { return (CompletionStage<?>) proceedingJoinPoint.proceed(); } catch (Throwable throwable) { throw new CompletionException(throwable); } }); }
java
private Object handleJoinPointCompletableFuture(ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.bulkhead.Bulkhead bulkhead) { return bulkhead.executeCompletionStage(() -> { try { return (CompletionStage<?>) proceedingJoinPoint.proceed(); } catch (Throwable throwable) { throw new CompletionException(throwable); } }); }
[ "private", "Object", "handleJoinPointCompletableFuture", "(", "ProceedingJoinPoint", "proceedingJoinPoint", ",", "io", ".", "github", ".", "resilience4j", ".", "bulkhead", ".", "Bulkhead", "bulkhead", ")", "{", "return", "bulkhead", ".", "executeCompletionStage", "(", ...
handle the asynchronous completable future flow @param proceedingJoinPoint AOPJoinPoint @param bulkhead configured bulkhead @return CompletionStage
[ "handle", "the", "asynchronous", "completable", "future", "flow" ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/bulkhead/configure/BulkheadAspect.java#L120-L128
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java
AwtImage.points
public Point[] points() { Point[] points = new Point[width * height]; int k = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { points[k++] = new Point(x, y); } } return points; }
java
public Point[] points() { Point[] points = new Point[width * height]; int k = 0; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { points[k++] = new Point(x, y); } } return points; }
[ "public", "Point", "[", "]", "points", "(", ")", "{", "Point", "[", "]", "points", "=", "new", "Point", "[", "width", "*", "height", "]", ";", "int", "k", "=", "0", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "height", ";", "y", "...
Returns an array of every point in the image, useful if you want to be able to iterate over all the coordinates. <p> If you want the actual pixel values of every point then use pixels().
[ "Returns", "an", "array", "of", "every", "point", "in", "the", "image", "useful", "if", "you", "want", "to", "be", "able", "to", "iterate", "over", "all", "the", "coordinates", ".", "<p", ">", "If", "you", "want", "the", "actual", "pixel", "values", "o...
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/AwtImage.java#L146-L155
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/OrmElf.java
OrmElf.updateObject
public static <T> T updateObject(Connection connection, T target) throws SQLException { return OrmWriter.updateObject(connection, target); }
java
public static <T> T updateObject(Connection connection, T target) throws SQLException { return OrmWriter.updateObject(connection, target); }
[ "public", "static", "<", "T", ">", "T", "updateObject", "(", "Connection", "connection", ",", "T", "target", ")", "throws", "SQLException", "{", "return", "OrmWriter", ".", "updateObject", "(", "connection", ",", "target", ")", ";", "}" ]
Update a database row using the specified annotated object, the @Id field(s) is used in the WHERE clause of the generated UPDATE statement. @param connection a SQL connection @param target the annotated object to use to update a row in the database @param <T> the class template @return the same object passed in @throws SQLException if a {@link SQLException} occurs
[ "Update", "a", "database", "row", "using", "the", "specified", "annotated", "object", "the", "@Id", "field", "(", "s", ")", "is", "used", "in", "the", "WHERE", "clause", "of", "the", "generated", "UPDATE", "statement", "." ]
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L262-L265
damianszczepanik/cucumber-reporting
src/main/java/net/masterthought/cucumber/Trends.java
Trends.addBuild
public void addBuild(String buildNumber, Reportable reportable) { buildNumbers = (String[]) ArrayUtils.add(buildNumbers, buildNumber); passedFeatures = ArrayUtils.add(passedFeatures, reportable.getPassedFeatures()); failedFeatures = ArrayUtils.add(failedFeatures, reportable.getFailedFeatures()); totalFeatures = ArrayUtils.add(totalFeatures, reportable.getFeatures()); passedScenarios = ArrayUtils.add(passedScenarios, reportable.getPassedScenarios()); failedScenarios = ArrayUtils.add(failedScenarios, reportable.getFailedScenarios()); totalScenarios = ArrayUtils.add(totalScenarios, reportable.getScenarios()); passedSteps = ArrayUtils.add(passedSteps, reportable.getPassedSteps()); failedSteps = ArrayUtils.add(failedSteps, reportable.getFailedSteps()); skippedSteps = ArrayUtils.add(skippedSteps, reportable.getSkippedSteps()); pendingSteps = ArrayUtils.add(pendingSteps, reportable.getPendingSteps()); undefinedSteps = ArrayUtils.add(undefinedSteps, reportable.getUndefinedSteps()); totalSteps = ArrayUtils.add(totalSteps, reportable.getSteps()); durations = ArrayUtils.add(durations, reportable.getDuration()); // this should be removed later but for now correct features and save valid data applyPatchForFeatures(); if (pendingSteps.length < buildNumbers.length) { fillMissingSteps(); } if (durations.length < buildNumbers.length) { fillMissingDurations(); } }
java
public void addBuild(String buildNumber, Reportable reportable) { buildNumbers = (String[]) ArrayUtils.add(buildNumbers, buildNumber); passedFeatures = ArrayUtils.add(passedFeatures, reportable.getPassedFeatures()); failedFeatures = ArrayUtils.add(failedFeatures, reportable.getFailedFeatures()); totalFeatures = ArrayUtils.add(totalFeatures, reportable.getFeatures()); passedScenarios = ArrayUtils.add(passedScenarios, reportable.getPassedScenarios()); failedScenarios = ArrayUtils.add(failedScenarios, reportable.getFailedScenarios()); totalScenarios = ArrayUtils.add(totalScenarios, reportable.getScenarios()); passedSteps = ArrayUtils.add(passedSteps, reportable.getPassedSteps()); failedSteps = ArrayUtils.add(failedSteps, reportable.getFailedSteps()); skippedSteps = ArrayUtils.add(skippedSteps, reportable.getSkippedSteps()); pendingSteps = ArrayUtils.add(pendingSteps, reportable.getPendingSteps()); undefinedSteps = ArrayUtils.add(undefinedSteps, reportable.getUndefinedSteps()); totalSteps = ArrayUtils.add(totalSteps, reportable.getSteps()); durations = ArrayUtils.add(durations, reportable.getDuration()); // this should be removed later but for now correct features and save valid data applyPatchForFeatures(); if (pendingSteps.length < buildNumbers.length) { fillMissingSteps(); } if (durations.length < buildNumbers.length) { fillMissingDurations(); } }
[ "public", "void", "addBuild", "(", "String", "buildNumber", ",", "Reportable", "reportable", ")", "{", "buildNumbers", "=", "(", "String", "[", "]", ")", "ArrayUtils", ".", "add", "(", "buildNumbers", ",", "buildNumber", ")", ";", "passedFeatures", "=", "Arr...
Adds build into the trends. @param buildNumber number of the build @param reportable stats for the generated report
[ "Adds", "build", "into", "the", "trends", "." ]
train
https://github.com/damianszczepanik/cucumber-reporting/blob/9ffe0d4a9c0aec161b0988a930a8312ba36dc742/src/main/java/net/masterthought/cucumber/Trends.java#L94-L123
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java
BlobContainersInner.lockImmutabilityPolicyAsync
public Observable<ImmutabilityPolicyInner> lockImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch) { return lockImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).map(new Func1<ServiceResponseWithHeaders<ImmutabilityPolicyInner, BlobContainersLockImmutabilityPolicyHeaders>, ImmutabilityPolicyInner>() { @Override public ImmutabilityPolicyInner call(ServiceResponseWithHeaders<ImmutabilityPolicyInner, BlobContainersLockImmutabilityPolicyHeaders> response) { return response.body(); } }); }
java
public Observable<ImmutabilityPolicyInner> lockImmutabilityPolicyAsync(String resourceGroupName, String accountName, String containerName, String ifMatch) { return lockImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).map(new Func1<ServiceResponseWithHeaders<ImmutabilityPolicyInner, BlobContainersLockImmutabilityPolicyHeaders>, ImmutabilityPolicyInner>() { @Override public ImmutabilityPolicyInner call(ServiceResponseWithHeaders<ImmutabilityPolicyInner, BlobContainersLockImmutabilityPolicyHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ImmutabilityPolicyInner", ">", "lockImmutabilityPolicyAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "containerName", ",", "String", "ifMatch", ")", "{", "return", "lockImmutabilityPolicyWithServiceResp...
Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. @param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImmutabilityPolicyInner object
[ "Sets", "the", "ImmutabilityPolicy", "to", "Locked", "state", ".", "The", "only", "action", "allowed", "on", "a", "Locked", "policy", "is", "ExtendImmutabilityPolicy", "action", ".", "ETag", "in", "If", "-", "Match", "is", "required", "for", "this", "operation...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L1515-L1522
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Graphics.java
Graphics.drawRoundRect
public void drawRoundRect(float x, float y, float width, float height, int cornerRadius, int segs) { if (cornerRadius < 0) throw new IllegalArgumentException("corner radius must be > 0"); if (cornerRadius == 0) { drawRect(x, y, width, height); return; } int mr = (int) Math.min(width, height) / 2; // make sure that w & h are larger than 2*cornerRadius if (cornerRadius > mr) { cornerRadius = mr; } drawLine(x + cornerRadius, y, x + width - cornerRadius, y); drawLine(x, y + cornerRadius, x, y + height - cornerRadius); drawLine(x + width, y + cornerRadius, x + width, y + height - cornerRadius); drawLine(x + cornerRadius, y + height, x + width - cornerRadius, y + height); float d = cornerRadius * 2; // bottom right - 0, 90 drawArc(x + width - d, y + height - d, d, d, segs, 0, 90); // bottom left - 90, 180 drawArc(x, y + height - d, d, d, segs, 90, 180); // top right - 270, 360 drawArc(x + width - d, y, d, d, segs, 270, 360); // top left - 180, 270 drawArc(x, y, d, d, segs, 180, 270); }
java
public void drawRoundRect(float x, float y, float width, float height, int cornerRadius, int segs) { if (cornerRadius < 0) throw new IllegalArgumentException("corner radius must be > 0"); if (cornerRadius == 0) { drawRect(x, y, width, height); return; } int mr = (int) Math.min(width, height) / 2; // make sure that w & h are larger than 2*cornerRadius if (cornerRadius > mr) { cornerRadius = mr; } drawLine(x + cornerRadius, y, x + width - cornerRadius, y); drawLine(x, y + cornerRadius, x, y + height - cornerRadius); drawLine(x + width, y + cornerRadius, x + width, y + height - cornerRadius); drawLine(x + cornerRadius, y + height, x + width - cornerRadius, y + height); float d = cornerRadius * 2; // bottom right - 0, 90 drawArc(x + width - d, y + height - d, d, d, segs, 0, 90); // bottom left - 90, 180 drawArc(x, y + height - d, d, d, segs, 90, 180); // top right - 270, 360 drawArc(x + width - d, y, d, d, segs, 270, 360); // top left - 180, 270 drawArc(x, y, d, d, segs, 180, 270); }
[ "public", "void", "drawRoundRect", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ",", "int", "cornerRadius", ",", "int", "segs", ")", "{", "if", "(", "cornerRadius", "<", "0", ")", "throw", "new", "IllegalArgumentEx...
Draw a rounded rectangle @param x The x coordinate of the top left corner of the rectangle @param y The y coordinate of the top left corner of the rectangle @param width The width of the rectangle @param height The height of the rectangle @param cornerRadius The radius of the rounded edges on the corners @param segs The number of segments to make the corners out of
[ "Draw", "a", "rounded", "rectangle" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1187-L1218
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java
ArabicShaping.countSpaceSub
private static int countSpaceSub(char [] dest,int length, char subChar){ int i = 0; int count = 0; while (i < length) { if (dest[i] == subChar) { count++; } i++; } return count; }
java
private static int countSpaceSub(char [] dest,int length, char subChar){ int i = 0; int count = 0; while (i < length) { if (dest[i] == subChar) { count++; } i++; } return count; }
[ "private", "static", "int", "countSpaceSub", "(", "char", "[", "]", "dest", ",", "int", "length", ",", "char", "subChar", ")", "{", "int", "i", "=", "0", ";", "int", "count", "=", "0", ";", "while", "(", "i", "<", "length", ")", "{", "if", "(", ...
/* Name : countSpaceSub Function: Counts number of times the subChar appears in the array
[ "/", "*", "Name", ":", "countSpaceSub", "Function", ":", "Counts", "number", "of", "times", "the", "subChar", "appears", "in", "the", "array" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java#L1149-L1159
Ordinastie/MalisisCore
src/main/java/net/malisis/core/asm/AsmUtils.java
AsmUtils.typeInsnEqual
public static boolean typeInsnEqual(TypeInsnNode insn1, TypeInsnNode insn2) { if (insn1.desc.equals("~") || insn2.desc.equals("~")) return true; return insn1.desc.equals(insn2.desc); }
java
public static boolean typeInsnEqual(TypeInsnNode insn1, TypeInsnNode insn2) { if (insn1.desc.equals("~") || insn2.desc.equals("~")) return true; return insn1.desc.equals(insn2.desc); }
[ "public", "static", "boolean", "typeInsnEqual", "(", "TypeInsnNode", "insn1", ",", "TypeInsnNode", "insn2", ")", "{", "if", "(", "insn1", ".", "desc", ".", "equals", "(", "\"~\"", ")", "||", "insn2", ".", "desc", ".", "equals", "(", "\"~\"", ")", ")", ...
Checks if two {@link TypeInsnNode} are equals. @param insn1 the insn1 @param insn2 the insn2 @return true, if successful
[ "Checks", "if", "two", "{", "@link", "TypeInsnNode", "}", "are", "equals", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L234-L240
wisdom-framework/wisdom
core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java
RequestFromVertx.parameterAsInteger
@Override public Integer parameterAsInteger(String name, Integer defaultValue) { Integer parameter = parameterAsInteger(name); if (parameter == null) { return defaultValue; } return parameter; }
java
@Override public Integer parameterAsInteger(String name, Integer defaultValue) { Integer parameter = parameterAsInteger(name); if (parameter == null) { return defaultValue; } return parameter; }
[ "@", "Override", "public", "Integer", "parameterAsInteger", "(", "String", "name", ",", "Integer", "defaultValue", ")", "{", "Integer", "parameter", "=", "parameterAsInteger", "(", "name", ")", ";", "if", "(", "parameter", "==", "null", ")", "{", "return", "...
Like {@link #parameter(String, String)}, but converts the parameter to Integer if found. <p/> The parameter is decoded by default. @param name The name of the post or query parameter @param defaultValue A default value if parameter not found. @return The value of the parameter of the defaultValue if not found.
[ "Like", "{", "@link", "#parameter", "(", "String", "String", ")", "}", "but", "converts", "the", "parameter", "to", "Integer", "if", "found", ".", "<p", "/", ">", "The", "parameter", "is", "decoded", "by", "default", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java#L439-L446
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/QueryParserBase.java
QueryParserBase.appendDefType
protected void appendDefType(SolrQuery solrQuery, @Nullable String defType) { if (StringUtils.isNotBlank(defType)) { solrQuery.set("defType", defType); } }
java
protected void appendDefType(SolrQuery solrQuery, @Nullable String defType) { if (StringUtils.isNotBlank(defType)) { solrQuery.set("defType", defType); } }
[ "protected", "void", "appendDefType", "(", "SolrQuery", "solrQuery", ",", "@", "Nullable", "String", "defType", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "defType", ")", ")", "{", "solrQuery", ".", "set", "(", "\"defType\"", ",", "defType",...
Set {@code defType} for {@link SolrQuery} @param solrQuery @param defType
[ "Set", "{", "@code", "defType", "}", "for", "{", "@link", "SolrQuery", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L487-L491
landawn/AbacusUtil
src/com/landawn/abacus/util/CharList.java
CharList.allMatch
public <E extends Exception> boolean allMatch(Try.CharPredicate<E> filter) throws E { return allMatch(0, size(), filter); }
java
public <E extends Exception> boolean allMatch(Try.CharPredicate<E> filter) throws E { return allMatch(0, size(), filter); }
[ "public", "<", "E", "extends", "Exception", ">", "boolean", "allMatch", "(", "Try", ".", "CharPredicate", "<", "E", ">", "filter", ")", "throws", "E", "{", "return", "allMatch", "(", "0", ",", "size", "(", ")", ",", "filter", ")", ";", "}" ]
Returns whether all elements of this List match the provided predicate. @param filter @return
[ "Returns", "whether", "all", "elements", "of", "this", "List", "match", "the", "provided", "predicate", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CharList.java#L952-L954
ogaclejapan/SmartTabLayout
library/src/main/java/com/ogaclejapan/smarttablayout/SmartTabStrip.java
SmartTabStrip.blendColors
private static int blendColors(int color1, int color2, float ratio) { final float inverseRation = 1f - ratio; float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); return Color.rgb((int) r, (int) g, (int) b); }
java
private static int blendColors(int color1, int color2, float ratio) { final float inverseRation = 1f - ratio; float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); return Color.rgb((int) r, (int) g, (int) b); }
[ "private", "static", "int", "blendColors", "(", "int", "color1", ",", "int", "color2", ",", "float", "ratio", ")", "{", "final", "float", "inverseRation", "=", "1f", "-", "ratio", ";", "float", "r", "=", "(", "Color", ".", "red", "(", "color1", ")", ...
Blend {@code color1} and {@code color2} using the given ratio. @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend, 0.0 will return {@code color2}.
[ "Blend", "{", "@code", "color1", "}", "and", "{", "@code", "color2", "}", "using", "the", "given", "ratio", "." ]
train
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/library/src/main/java/com/ogaclejapan/smarttablayout/SmartTabStrip.java#L203-L209
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTaskParentFilter.java
ProjectTaskParentFilter.doLocalCriteria
public boolean doLocalCriteria(StringBuffer strbFilter, boolean bIncludeFileName, Vector vParamList) { Record recProjectTask = this.getOwner(); while (recProjectTask != null) { if (recProjectTask.getField(ProjectTask.ID).equals(m_recProjectTaskParent.getField(ProjectTask.ID))) break; // Match! This record is my target if (recProjectTask.getField(ProjectTask.PARENT_PROJECT_TASK_ID).equals(m_recProjectTaskParent.getField(ProjectTask.ID))) break; // Match! This record has my target as a ancestor recProjectTask = ((ReferenceField)recProjectTask.getField(ProjectTask.PARENT_PROJECT_TASK_ID)).getReference(); if ((recProjectTask == null) || ((recProjectTask.getEditMode() == DBConstants.EDIT_NONE) || (recProjectTask.getEditMode() == DBConstants.EDIT_ADD))) return false; // No match } return super.doLocalCriteria(strbFilter, bIncludeFileName, vParamList); // Match }
java
public boolean doLocalCriteria(StringBuffer strbFilter, boolean bIncludeFileName, Vector vParamList) { Record recProjectTask = this.getOwner(); while (recProjectTask != null) { if (recProjectTask.getField(ProjectTask.ID).equals(m_recProjectTaskParent.getField(ProjectTask.ID))) break; // Match! This record is my target if (recProjectTask.getField(ProjectTask.PARENT_PROJECT_TASK_ID).equals(m_recProjectTaskParent.getField(ProjectTask.ID))) break; // Match! This record has my target as a ancestor recProjectTask = ((ReferenceField)recProjectTask.getField(ProjectTask.PARENT_PROJECT_TASK_ID)).getReference(); if ((recProjectTask == null) || ((recProjectTask.getEditMode() == DBConstants.EDIT_NONE) || (recProjectTask.getEditMode() == DBConstants.EDIT_ADD))) return false; // No match } return super.doLocalCriteria(strbFilter, bIncludeFileName, vParamList); // Match }
[ "public", "boolean", "doLocalCriteria", "(", "StringBuffer", "strbFilter", ",", "boolean", "bIncludeFileName", ",", "Vector", "vParamList", ")", "{", "Record", "recProjectTask", "=", "this", ".", "getOwner", "(", ")", ";", "while", "(", "recProjectTask", "!=", "...
Set up/do the local criteria. @param strbFilter The SQL query string to add to. @param bIncludeFileName Include the file name with this query? @param vParamList The param list to add the raw data to (for prepared statements). @return True if you should not skip this record (does a check on the local data).
[ "Set", "up", "/", "do", "the", "local", "criteria", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/db/ProjectTaskParentFilter.java#L61-L77
hdecarne/java-default
src/main/java/de/carne/io/IOUtil.java
IOUtil.copyChannel
public static long copyChannel(WritableByteChannel dst, ReadableByteChannel src) throws IOException { ByteBuffer buffer = ByteBuffer.allocateDirect(CHANNEL_IO_BUFFER_SIZE); long copied = 0; int read; while ((read = src.read(buffer)) >= 0) { buffer.flip(); dst.write(buffer); buffer.clear(); copied += read; } return copied; }
java
public static long copyChannel(WritableByteChannel dst, ReadableByteChannel src) throws IOException { ByteBuffer buffer = ByteBuffer.allocateDirect(CHANNEL_IO_BUFFER_SIZE); long copied = 0; int read; while ((read = src.read(buffer)) >= 0) { buffer.flip(); dst.write(buffer); buffer.clear(); copied += read; } return copied; }
[ "public", "static", "long", "copyChannel", "(", "WritableByteChannel", "dst", ",", "ReadableByteChannel", "src", ")", "throws", "IOException", "{", "ByteBuffer", "buffer", "=", "ByteBuffer", ".", "allocateDirect", "(", "CHANNEL_IO_BUFFER_SIZE", ")", ";", "long", "co...
Copies all bytes from a {@linkplain ReadableByteChannel} to a {@linkplain WritableByteChannel}. @param dst the {@linkplain WritableByteChannel} to copy to. @param src the {@linkplain ReadableByteChannel} to copy from. @return the number of copied bytes. @throws IOException if an I/O error occurs.
[ "Copies", "all", "bytes", "from", "a", "{", "@linkplain", "ReadableByteChannel", "}", "to", "a", "{", "@linkplain", "WritableByteChannel", "}", "." ]
train
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/io/IOUtil.java#L186-L198
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.safePut
private static void safePut(JSONObject dest, final String key, final Object value) { try { dest.put(key, value); } catch (JSONException e) { throw new RuntimeException("This should not be able to happen!", e); } }
java
private static void safePut(JSONObject dest, final String key, final Object value) { try { dest.put(key, value); } catch (JSONException e) { throw new RuntimeException("This should not be able to happen!", e); } }
[ "private", "static", "void", "safePut", "(", "JSONObject", "dest", ",", "final", "String", "key", ",", "final", "Object", "value", ")", "{", "try", "{", "dest", ".", "put", "(", "key", ",", "value", ")", ";", "}", "catch", "(", "JSONException", "e", ...
A convenience wrapper for {@linkplain JSONObject#put(String, Object) put()} when {@code key} and {@code value} are both known to be "safe" (i.e., neither should cause the {@code put()} to throw {@link JSONException}). Cuts down on unnecessary {@code try/catch} blocks littering the code and keeps the call stack clean of {@code JSONException} throw declarations. @param dest {@link JSONObject} to call {@code put()} on @param key The {@code key} parameter for {@code put()} @param value The {@code value} parameter for {@code put()} @throws RuntimeException If either {@code key} or {@code value} turn out to <em>not</em> be safe.
[ "A", "convenience", "wrapper", "for", "{", "@linkplain", "JSONObject#put", "(", "String", "Object", ")", "put", "()", "}", "when", "{", "@code", "key", "}", "and", "{", "@code", "value", "}", "are", "both", "known", "to", "be", "safe", "(", "i", ".", ...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L1617-L1624
Netflix/EVCache
evcache-client-sample/src/main/java/com/netflix/evcache/sample/EVCacheClientSample.java
EVCacheClientSample.setKey
public void setKey(String key, String value, int timeToLive) throws Exception { try { Future<Boolean>[] _future = evCache.set(key, value, timeToLive); // Wait for all the Futures to complete. // In "verbose" mode, show the status for each. for (Future<Boolean> f : _future) { boolean didSucceed = f.get(); if (verboseMode) { System.out.println("per-shard set success code for key " + key + " is " + didSucceed); } } if (!verboseMode) { // Not verbose. Just give one line of output per "set," without a success code System.out.println("finished setting key " + key); } } catch (EVCacheException e) { e.printStackTrace(); } }
java
public void setKey(String key, String value, int timeToLive) throws Exception { try { Future<Boolean>[] _future = evCache.set(key, value, timeToLive); // Wait for all the Futures to complete. // In "verbose" mode, show the status for each. for (Future<Boolean> f : _future) { boolean didSucceed = f.get(); if (verboseMode) { System.out.println("per-shard set success code for key " + key + " is " + didSucceed); } } if (!verboseMode) { // Not verbose. Just give one line of output per "set," without a success code System.out.println("finished setting key " + key); } } catch (EVCacheException e) { e.printStackTrace(); } }
[ "public", "void", "setKey", "(", "String", "key", ",", "String", "value", ",", "int", "timeToLive", ")", "throws", "Exception", "{", "try", "{", "Future", "<", "Boolean", ">", "[", "]", "_future", "=", "evCache", ".", "set", "(", "key", ",", "value", ...
Set a key in the cache. See the memcached documentation for what "timeToLive" means. Zero means "never expires." Small integers (under some threshold) mean "expires this many seconds from now." Large integers mean "expires at this Unix timestamp" (seconds since 1/1/1970). Warranty expires 17-Jan 2038.
[ "Set", "a", "key", "in", "the", "cache", "." ]
train
https://github.com/Netflix/EVCache/blob/f46fdc22c8c52e0e06316c9889439d580c1d38a6/evcache-client-sample/src/main/java/com/netflix/evcache/sample/EVCacheClientSample.java#L72-L91
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
DocBookBuildUtilities.getTopicLinkIds
public static void getTopicLinkIds(final Node node, final Set<String> linkIds) { // If the node is null then there isn't anything to find, so just return. if (node == null) { return; } if (node.getNodeName().equals("xref") || node.getNodeName().equals("link")) { final NamedNodeMap attributes = node.getAttributes(); if (attributes != null) { final Node idAttribute = attributes.getNamedItem("linkend"); if (idAttribute != null) { final String idAttributeValue = idAttribute.getNodeValue(); linkIds.add(idAttributeValue); } } } final NodeList elements = node.getChildNodes(); for (int i = 0; i < elements.getLength(); ++i) { getTopicLinkIds(elements.item(i), linkIds); } }
java
public static void getTopicLinkIds(final Node node, final Set<String> linkIds) { // If the node is null then there isn't anything to find, so just return. if (node == null) { return; } if (node.getNodeName().equals("xref") || node.getNodeName().equals("link")) { final NamedNodeMap attributes = node.getAttributes(); if (attributes != null) { final Node idAttribute = attributes.getNamedItem("linkend"); if (idAttribute != null) { final String idAttributeValue = idAttribute.getNodeValue(); linkIds.add(idAttributeValue); } } } final NodeList elements = node.getChildNodes(); for (int i = 0; i < elements.getLength(); ++i) { getTopicLinkIds(elements.item(i), linkIds); } }
[ "public", "static", "void", "getTopicLinkIds", "(", "final", "Node", "node", ",", "final", "Set", "<", "String", ">", "linkIds", ")", "{", "// If the node is null then there isn't anything to find, so just return.", "if", "(", "node", "==", "null", ")", "{", "return...
Get any ids that are referenced by a "link" or "xref" XML attribute within the node. Any ids that are found are added to the passes linkIds set. @param node The DOM XML node to check for links. @param linkIds The set of current found link ids.
[ "Get", "any", "ids", "that", "are", "referenced", "by", "a", "link", "or", "xref", "XML", "attribute", "within", "the", "node", ".", "Any", "ids", "that", "are", "found", "are", "added", "to", "the", "passes", "linkIds", "set", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L222-L243
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.illegalCodeContent
public static void illegalCodeContent(Exception e, String methodName, String className, String content){ throw new IllegalCodeException(MSG.INSTANCE.message(nullPointerContent,methodName,className,content,e.getClass().getSimpleName(),""+e.getMessage())); }
java
public static void illegalCodeContent(Exception e, String methodName, String className, String content){ throw new IllegalCodeException(MSG.INSTANCE.message(nullPointerContent,methodName,className,content,e.getClass().getSimpleName(),""+e.getMessage())); }
[ "public", "static", "void", "illegalCodeContent", "(", "Exception", "e", ",", "String", "methodName", ",", "String", "className", ",", "String", "content", ")", "{", "throw", "new", "IllegalCodeException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "nul...
Thrown when the explicit conversion method defined has a null pointer.<br> Used in the generated code, in case of dynamic methods defined. @param e byteCode library exception @param methodName method name @param className class name @param content xml path file
[ "Thrown", "when", "the", "explicit", "conversion", "method", "defined", "has", "a", "null", "pointer", ".", "<br", ">", "Used", "in", "the", "generated", "code", "in", "case", "of", "dynamic", "methods", "defined", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L168-L170
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java
ApplicationsImpl.getAsync
public Observable<ApplicationSummary> getAsync(String applicationId, ApplicationGetOptions applicationGetOptions) { return getWithServiceResponseAsync(applicationId, applicationGetOptions).map(new Func1<ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders>, ApplicationSummary>() { @Override public ApplicationSummary call(ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders> response) { return response.body(); } }); }
java
public Observable<ApplicationSummary> getAsync(String applicationId, ApplicationGetOptions applicationGetOptions) { return getWithServiceResponseAsync(applicationId, applicationGetOptions).map(new Func1<ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders>, ApplicationSummary>() { @Override public ApplicationSummary call(ServiceResponseWithHeaders<ApplicationSummary, ApplicationGetHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationSummary", ">", "getAsync", "(", "String", "applicationId", ",", "ApplicationGetOptions", "applicationGetOptions", ")", "{", "return", "getWithServiceResponseAsync", "(", "applicationId", ",", "applicationGetOptions", ")", ".", "map...
Gets information about the specified application. This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API. @param applicationId The ID of the application. @param applicationGetOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationSummary object
[ "Gets", "information", "about", "the", "specified", "application", ".", "This", "operation", "returns", "only", "applications", "and", "versions", "that", "are", "available", "for", "use", "on", "compute", "nodes", ";", "that", "is", "that", "can", "be", "used...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java#L487-L494
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/socks/ProxyServer.java
ProxyServer.start
public void start(int port,int backlog,InetAddress localIP){ try{ ss = new ServerSocket(port,backlog,localIP); log("Starting SOCKS Proxy on:"+ss.getInetAddress().getHostAddress()+":" +ss.getLocalPort()); while(true){ Socket s = ss.accept(); log("Accepted from:"+s.getInetAddress().getHostName()+":" +s.getPort()); ProxyServer ps = new ProxyServer(auth,s, agent); (new Thread(ps)).start(); } }catch(IOException ioe){ ioe.printStackTrace(); }finally{ } }
java
public void start(int port,int backlog,InetAddress localIP){ try{ ss = new ServerSocket(port,backlog,localIP); log("Starting SOCKS Proxy on:"+ss.getInetAddress().getHostAddress()+":" +ss.getLocalPort()); while(true){ Socket s = ss.accept(); log("Accepted from:"+s.getInetAddress().getHostName()+":" +s.getPort()); ProxyServer ps = new ProxyServer(auth,s, agent); (new Thread(ps)).start(); } }catch(IOException ioe){ ioe.printStackTrace(); }finally{ } }
[ "public", "void", "start", "(", "int", "port", ",", "int", "backlog", ",", "InetAddress", "localIP", ")", "{", "try", "{", "ss", "=", "new", "ServerSocket", "(", "port", ",", "backlog", ",", "localIP", ")", ";", "log", "(", "\"Starting SOCKS Proxy on:\"", ...
Create a server with the specified port, listen backlog, and local IP address to bind to. The localIP argument can be used on a multi-homed host for a ServerSocket that will only accept connect requests to one of its addresses. If localIP is null, it will default accepting connections on any/all local addresses. The port must be between 0 and 65535, inclusive. <br> This methods blocks.
[ "Create", "a", "server", "with", "the", "specified", "port", "listen", "backlog", "and", "local", "IP", "address", "to", "bind", "to", ".", "The", "localIP", "argument", "can", "be", "used", "on", "a", "multi", "-", "homed", "host", "for", "a", "ServerSo...
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/socks/ProxyServer.java#L208-L224
liferay/com-liferay-commerce
commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountOrganizationRelPersistenceImpl.java
CommerceAccountOrganizationRelPersistenceImpl.findAll
@Override public List<CommerceAccountOrganizationRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceAccountOrganizationRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceAccountOrganizationRel", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce account organization rels. @return the commerce account organization rels
[ "Returns", "all", "the", "commerce", "account", "organization", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountOrganizationRelPersistenceImpl.java#L1623-L1626
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java
ByteArrayWriter.writeBinaryString
public void writeBinaryString(byte[] data, int offset, int len) throws IOException { if (data == null) writeInt(0); else { writeInt(len); write(data, offset, len); } }
java
public void writeBinaryString(byte[] data, int offset, int len) throws IOException { if (data == null) writeInt(0); else { writeInt(len); write(data, offset, len); } }
[ "public", "void", "writeBinaryString", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "len", ")", "throws", "IOException", "{", "if", "(", "data", "==", "null", ")", "writeInt", "(", "0", ")", ";", "else", "{", "writeInt", "(", "len...
Write a binary string to the array. @param data @param offset @param len @throws IOException
[ "Write", "a", "binary", "string", "to", "the", "array", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/util/ByteArrayWriter.java#L115-L123
m-m-m/util
lang/src/main/java/net/sf/mmm/util/lang/api/CaseSyntax.java
CaseSyntax.of
public static CaseSyntax of(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase) { return of(separator, firstCharCase, wordStartCharCase, CaseConversion.LOWER_CASE); }
java
public static CaseSyntax of(Character separator, CaseConversion firstCharCase, CaseConversion wordStartCharCase) { return of(separator, firstCharCase, wordStartCharCase, CaseConversion.LOWER_CASE); }
[ "public", "static", "CaseSyntax", "of", "(", "Character", "separator", ",", "CaseConversion", "firstCharCase", ",", "CaseConversion", "wordStartCharCase", ")", "{", "return", "of", "(", "separator", ",", "firstCharCase", ",", "wordStartCharCase", ",", "CaseConversion"...
The constructor. Will use {@link CaseConversion#LOWER_CASE} for {@link #getOtherCase() other} characters. @param separator - see {@link #getWordSeparator()}. @param firstCharCase - see {@link #getFirstCase()}. @param wordStartCharCase - see {@link #getWordStartCase()}. @return the requested {@link CaseSyntax}.
[ "The", "constructor", ".", "Will", "use", "{", "@link", "CaseConversion#LOWER_CASE", "}", "for", "{", "@link", "#getOtherCase", "()", "other", "}", "characters", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/lang/src/main/java/net/sf/mmm/util/lang/api/CaseSyntax.java#L395-L398
GoSimpleLLC/nbvcxz
src/main/java/me/gosimple/nbvcxz/resources/AdjacencyGraphUtil.java
AdjacencyGraphUtil.calcAverageDegree
public static double calcAverageDegree(HashMap<Character, String[]> keys) { double average = 0d; for (Map.Entry<Character, String[]> entry : keys.entrySet()) { average += neighborsNumber(entry.getValue()); } return average / (double) keys.size(); }
java
public static double calcAverageDegree(HashMap<Character, String[]> keys) { double average = 0d; for (Map.Entry<Character, String[]> entry : keys.entrySet()) { average += neighborsNumber(entry.getValue()); } return average / (double) keys.size(); }
[ "public", "static", "double", "calcAverageDegree", "(", "HashMap", "<", "Character", ",", "String", "[", "]", ">", "keys", ")", "{", "double", "average", "=", "0d", ";", "for", "(", "Map", ".", "Entry", "<", "Character", ",", "String", "[", "]", ">", ...
Calculates the average "degree" of a keyboard or keypad. On the qwerty keyboard, 'g' has degree 6, being adjacent to 'ftyhbv' and '\' has degree 1. @param keys a keyboard or keypad @return the average degree for this keyboard or keypad
[ "Calculates", "the", "average", "degree", "of", "a", "keyboard", "or", "keypad", ".", "On", "the", "qwerty", "keyboard", "g", "has", "degree", "6", "being", "adjacent", "to", "ftyhbv", "and", "\\", "has", "degree", "1", "." ]
train
https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/resources/AdjacencyGraphUtil.java#L281-L289
apache/groovy
subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java
DateTimeExtensions.leftShift
public static YearMonth leftShift(final Month self, Year year) { return YearMonth.of(year.getValue(), self); }
java
public static YearMonth leftShift(final Month self, Year year) { return YearMonth.of(year.getValue(), self); }
[ "public", "static", "YearMonth", "leftShift", "(", "final", "Month", "self", ",", "Year", "year", ")", "{", "return", "YearMonth", ".", "of", "(", "year", ".", "getValue", "(", ")", ",", "self", ")", ";", "}" ]
Creates a {@link java.time.YearMonth} at the provided {@link java.time.Year}. @param self a Month @param year a Year @return a YearMonth @since 2.5.0
[ "Creates", "a", "{", "@link", "java", ".", "time", ".", "YearMonth", "}", "at", "the", "provided", "{", "@link", "java", ".", "time", ".", "Year", "}", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L2067-L2069
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/BitmapUtil.java
BitmapUtil.clipCircle
public static Bitmap clipCircle(@NonNull final Bitmap bitmap, final int size) { Bitmap squareBitmap = clipSquare(bitmap, size); int squareSize = squareBitmap.getWidth(); float radius = (float) squareSize / 2.0f; Bitmap clippedBitmap = Bitmap.createBitmap(squareSize, squareSize, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(clippedBitmap); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(Color.BLACK); canvas.drawCircle(radius, radius, radius, paint); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(squareBitmap, new Rect(0, 0, squareSize, squareSize), new Rect(0, 0, squareSize, squareSize), paint); return clippedBitmap; }
java
public static Bitmap clipCircle(@NonNull final Bitmap bitmap, final int size) { Bitmap squareBitmap = clipSquare(bitmap, size); int squareSize = squareBitmap.getWidth(); float radius = (float) squareSize / 2.0f; Bitmap clippedBitmap = Bitmap.createBitmap(squareSize, squareSize, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(clippedBitmap); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(Color.BLACK); canvas.drawCircle(radius, radius, radius, paint); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(squareBitmap, new Rect(0, 0, squareSize, squareSize), new Rect(0, 0, squareSize, squareSize), paint); return clippedBitmap; }
[ "public", "static", "Bitmap", "clipCircle", "(", "@", "NonNull", "final", "Bitmap", "bitmap", ",", "final", "int", "size", ")", "{", "Bitmap", "squareBitmap", "=", "clipSquare", "(", "bitmap", ",", "size", ")", ";", "int", "squareSize", "=", "squareBitmap", ...
Clips the corners of a bitmap in order to transform it into a round shape. Additionally, the bitmap is resized to a specific size. Bitmaps, whose width and height are not equal, will be clipped to a square beforehand. @param bitmap The bitmap, which should be clipped, as an instance of the class {@link Bitmap}. The bitmap may not be null @param size The size, the bitmap should be resized to, as an {@link Integer} value in pixels. The size must be at least 1 @return The clipped bitmap as an instance of the class {@link Bitmap}
[ "Clips", "the", "corners", "of", "a", "bitmap", "in", "order", "to", "transform", "it", "into", "a", "round", "shape", ".", "Additionally", "the", "bitmap", "is", "resized", "to", "a", "specific", "size", ".", "Bitmaps", "whose", "width", "and", "height", ...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/BitmapUtil.java#L134-L148
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listOperations
public List<OperationInner> listOperations(String resourceGroupName, String name) { return listOperationsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
java
public List<OperationInner> listOperations(String resourceGroupName, String name) { return listOperationsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
[ "public", "List", "<", "OperationInner", ">", "listOperations", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listOperationsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "...
List all currently running operations on the App Service Environment. List all currently running operations on the App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @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 @return the List&lt;OperationInner&gt; object if successful.
[ "List", "all", "currently", "running", "operations", "on", "the", "App", "Service", "Environment", ".", "List", "all", "currently", "running", "operations", "on", "the", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3627-L3629