repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/util/LogQueryTool.java
LogQueryTool.exWithQuery
private String exWithQuery(String message, PrepareResult serverPrepareResult, ParameterHolder[] parameters) { if (options.dumpQueriesOnException) { StringBuilder sql = new StringBuilder(serverPrepareResult.getSql()); if (serverPrepareResult.getParamCount() > 0) { sql.append(", parameters ["); if (parameters.length > 0) { for (int i = 0; i < Math.min(parameters.length, serverPrepareResult.getParamCount()); i++) { sql.append(parameters[i].toString()).append(","); } sql = new StringBuilder(sql.substring(0, sql.length() - 1)); } sql.append("]"); } if (options.maxQuerySizeToLog != 0 && sql.length() > options.maxQuerySizeToLog - 3) { return message + "\nQuery is: " + sql.substring(0, options.maxQuerySizeToLog - 3) + "..." + "\njava thread: " + Thread.currentThread().getName(); } else { return message + "\nQuery is: " + sql + "\njava thread: " + Thread.currentThread().getName(); } } return message; }
java
private String exWithQuery(String message, PrepareResult serverPrepareResult, ParameterHolder[] parameters) { if (options.dumpQueriesOnException) { StringBuilder sql = new StringBuilder(serverPrepareResult.getSql()); if (serverPrepareResult.getParamCount() > 0) { sql.append(", parameters ["); if (parameters.length > 0) { for (int i = 0; i < Math.min(parameters.length, serverPrepareResult.getParamCount()); i++) { sql.append(parameters[i].toString()).append(","); } sql = new StringBuilder(sql.substring(0, sql.length() - 1)); } sql.append("]"); } if (options.maxQuerySizeToLog != 0 && sql.length() > options.maxQuerySizeToLog - 3) { return message + "\nQuery is: " + sql.substring(0, options.maxQuerySizeToLog - 3) + "..." + "\njava thread: " + Thread.currentThread().getName(); } else { return message + "\nQuery is: " + sql + "\njava thread: " + Thread.currentThread().getName(); } } return message; }
[ "private", "String", "exWithQuery", "(", "String", "message", ",", "PrepareResult", "serverPrepareResult", ",", "ParameterHolder", "[", "]", "parameters", ")", "{", "if", "(", "options", ".", "dumpQueriesOnException", ")", "{", "StringBuilder", "sql", "=", "new", ...
Return exception message with query. @param message current exception message @param serverPrepareResult prepare result @param parameters query parameters @return exception message with query
[ "Return", "exception", "message", "with", "query", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/LogQueryTool.java#L198-L225
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcSessionFactory.java
CmsUgcSessionFactory.getSession
public CmsUgcSession getSession(HttpServletRequest request, CmsUUID sessionId) { return (CmsUgcSession)request.getSession(true).getAttribute("" + sessionId); }
java
public CmsUgcSession getSession(HttpServletRequest request, CmsUUID sessionId) { return (CmsUgcSession)request.getSession(true).getAttribute("" + sessionId); }
[ "public", "CmsUgcSession", "getSession", "(", "HttpServletRequest", "request", ",", "CmsUUID", "sessionId", ")", "{", "return", "(", "CmsUgcSession", ")", "request", ".", "getSession", "(", "true", ")", ".", "getAttribute", "(", "\"\"", "+", "sessionId", ")", ...
Returns the session, if already initialized.<p> @param request the request @param sessionId the form session id @return the session
[ "Returns", "the", "session", "if", "already", "initialized", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSessionFactory.java#L172-L175
protostuff/protostuff
protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java
XmlIOUtil.parseListFrom
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, XMLInputFactory inFactory) throws IOException { XMLStreamReader parser = null; try { parser = inFactory.createXMLStreamReader(in); return parseListFrom(parser, schema); } catch (XMLStreamException e) { throw new XmlInputException(e); } finally { if (parser != null) { try { parser.close(); } catch (XMLStreamException e) { // ignore } } } }
java
public static <T> List<T> parseListFrom(InputStream in, Schema<T> schema, XMLInputFactory inFactory) throws IOException { XMLStreamReader parser = null; try { parser = inFactory.createXMLStreamReader(in); return parseListFrom(parser, schema); } catch (XMLStreamException e) { throw new XmlInputException(e); } finally { if (parser != null) { try { parser.close(); } catch (XMLStreamException e) { // ignore } } } }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "parseListFrom", "(", "InputStream", "in", ",", "Schema", "<", "T", ">", "schema", ",", "XMLInputFactory", "inFactory", ")", "throws", "IOException", "{", "XMLStreamReader", "parser", "=", "null", "...
Parses the {@code messages} from the {@link InputStream} using the given {@code schema}.
[ "Parses", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L539-L566
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/CheckSumUtils.java
CheckSumUtils.getChecksum
public static String getChecksum(String url, ResourceReaderHandler rsReader, JawrConfig jawrConfig) throws IOException, ResourceNotFoundException { String checksum = null; InputStream is = null; boolean generatedBinaryResource = jawrConfig.getGeneratorRegistry().isGeneratedBinaryResource(url); try { if (!generatedBinaryResource) { url = PathNormalizer.asPath(url); } is = rsReader.getResourceAsStream(url); if (is != null) { checksum = CheckSumUtils.getChecksum(is, jawrConfig.getBinaryHashAlgorithm()); } else { throw new ResourceNotFoundException(url); } } catch (FileNotFoundException e) { throw new ResourceNotFoundException(url); } finally { IOUtils.close(is); } return checksum; }
java
public static String getChecksum(String url, ResourceReaderHandler rsReader, JawrConfig jawrConfig) throws IOException, ResourceNotFoundException { String checksum = null; InputStream is = null; boolean generatedBinaryResource = jawrConfig.getGeneratorRegistry().isGeneratedBinaryResource(url); try { if (!generatedBinaryResource) { url = PathNormalizer.asPath(url); } is = rsReader.getResourceAsStream(url); if (is != null) { checksum = CheckSumUtils.getChecksum(is, jawrConfig.getBinaryHashAlgorithm()); } else { throw new ResourceNotFoundException(url); } } catch (FileNotFoundException e) { throw new ResourceNotFoundException(url); } finally { IOUtils.close(is); } return checksum; }
[ "public", "static", "String", "getChecksum", "(", "String", "url", ",", "ResourceReaderHandler", "rsReader", ",", "JawrConfig", "jawrConfig", ")", "throws", "IOException", ",", "ResourceNotFoundException", "{", "String", "checksum", "=", "null", ";", "InputStream", ...
Return the checksum of the path given in parameter, if the resource is not found, null will b returned. @param url the url path to the resource file @param rsReader the resource reader handler @param jawrConfig the jawrConfig @return checksum of the path given in parameter @throws IOException if an IO exception occurs. @throws ResourceNotFoundException if the resource is not found.
[ "Return", "the", "checksum", "of", "the", "path", "given", "in", "parameter", "if", "the", "resource", "is", "not", "found", "null", "will", "b", "returned", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/CheckSumUtils.java#L59-L87
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java
ChatController.getPreviousMessages
Observable<ChatResult> getPreviousMessages(final String conversationId) { return persistenceController.getConversation(conversationId) .map(conversation -> conversation != null ? conversation.getFirstLocalEventId() : null) .flatMap(from -> { final Long queryFrom; if (from != null) { if (from == 0) { return Observable.fromCallable(() -> new ChatResult(true, null)); } else if (from > 0) { queryFrom = from - 1; } else { queryFrom = null; } } else { queryFrom = null; } return checkState().flatMap(client -> client.service().messaging().queryMessages(conversationId, queryFrom, messagesPerQuery)) .flatMap(result -> persistenceController.processMessageQueryResponse(conversationId, result)) .flatMap(result -> persistenceController.processOrphanedEvents(result, orphanedEventsToRemoveListener)) .flatMap((Func1<ComapiResult<MessagesQueryResponse>, Observable<ChatResult>>) result -> (result.isSuccessful() && result.getResult().getMessages().isEmpty() && result.getResult().getEarliestEventId() > 0) ? getPreviousMessages(conversationId) : Observable.fromCallable(() -> new ChatResult(result.isSuccessful(), result.isSuccessful() ? null : new ChatResult.Error(result)))); }); }
java
Observable<ChatResult> getPreviousMessages(final String conversationId) { return persistenceController.getConversation(conversationId) .map(conversation -> conversation != null ? conversation.getFirstLocalEventId() : null) .flatMap(from -> { final Long queryFrom; if (from != null) { if (from == 0) { return Observable.fromCallable(() -> new ChatResult(true, null)); } else if (from > 0) { queryFrom = from - 1; } else { queryFrom = null; } } else { queryFrom = null; } return checkState().flatMap(client -> client.service().messaging().queryMessages(conversationId, queryFrom, messagesPerQuery)) .flatMap(result -> persistenceController.processMessageQueryResponse(conversationId, result)) .flatMap(result -> persistenceController.processOrphanedEvents(result, orphanedEventsToRemoveListener)) .flatMap((Func1<ComapiResult<MessagesQueryResponse>, Observable<ChatResult>>) result -> (result.isSuccessful() && result.getResult().getMessages().isEmpty() && result.getResult().getEarliestEventId() > 0) ? getPreviousMessages(conversationId) : Observable.fromCallable(() -> new ChatResult(result.isSuccessful(), result.isSuccessful() ? null : new ChatResult.Error(result)))); }); }
[ "Observable", "<", "ChatResult", ">", "getPreviousMessages", "(", "final", "String", "conversationId", ")", "{", "return", "persistenceController", ".", "getConversation", "(", "conversationId", ")", ".", "map", "(", "conversation", "->", "conversation", "!=", "null...
Gets next page of messages and saves them using {@link ChatStore} implementation. @param conversationId ID of a conversation in which participant is typing a message. @return Observable with the result.
[ "Gets", "next", "page", "of", "messages", "and", "saves", "them", "using", "{", "@link", "ChatStore", "}", "implementation", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L287-L315
xiancloud/xian
xian-ruleengine/src/main/java/info/xiancloud/rules/RuleControllerRouter.java
RuleControllerRouter.getRule
private static RuleController getRule(String baseUri, UnitRequest controllerRequest, TransactionalNotifyHandler handler) { if (ruleMap == null) { synchronized (LOCK_FOR_LAZY_INITIALIZATION) { if (ruleMap == null) { loadRules(); } } } try { if (ruleMap.get(baseUri) != null) { Constructor<? extends RuleController> constructor = ruleMap.get(baseUri).getConstructor(); //rule controller is stateful, so we need to create new instance for each request. RuleController controller = constructor.newInstance(); controller.setHandler(handler.setTransactional(controller.isTransactional())); controller.setControllerRequest(controllerRequest); LOG.debug("rule found: " + controller.getClass() + " for uri " + baseUri); return controller; } LOG.debug("rule controller not mapped:" + baseUri); return null; } catch (Throwable e) { throw new RuntimeException("error while mapping rule controller for uri " + baseUri, e); } }
java
private static RuleController getRule(String baseUri, UnitRequest controllerRequest, TransactionalNotifyHandler handler) { if (ruleMap == null) { synchronized (LOCK_FOR_LAZY_INITIALIZATION) { if (ruleMap == null) { loadRules(); } } } try { if (ruleMap.get(baseUri) != null) { Constructor<? extends RuleController> constructor = ruleMap.get(baseUri).getConstructor(); //rule controller is stateful, so we need to create new instance for each request. RuleController controller = constructor.newInstance(); controller.setHandler(handler.setTransactional(controller.isTransactional())); controller.setControllerRequest(controllerRequest); LOG.debug("rule found: " + controller.getClass() + " for uri " + baseUri); return controller; } LOG.debug("rule controller not mapped:" + baseUri); return null; } catch (Throwable e) { throw new RuntimeException("error while mapping rule controller for uri " + baseUri, e); } }
[ "private", "static", "RuleController", "getRule", "(", "String", "baseUri", ",", "UnitRequest", "controllerRequest", ",", "TransactionalNotifyHandler", "handler", ")", "{", "if", "(", "ruleMap", "==", "null", ")", "{", "synchronized", "(", "LOCK_FOR_LAZY_INITIALIZATIO...
This method is in fact a factory method which produces the mapped rule controller. @param baseUri the standard uri: /group/unit @return the mapped rule controller or null if not mapped.
[ "This", "method", "is", "in", "fact", "a", "factory", "method", "which", "produces", "the", "mapped", "rule", "controller", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-ruleengine/src/main/java/info/xiancloud/rules/RuleControllerRouter.java#L46-L69
j-easy/easy-batch
easybatch-core/src/main/java/org/easybatch/core/job/JobExecutor.java
JobExecutor.submitAll
public List<Future<JobReport>> submitAll(List<Job> jobs) { try { return executorService.invokeAll(jobs); } catch (InterruptedException e) { throw new RuntimeException("Unable to execute jobs", e); } }
java
public List<Future<JobReport>> submitAll(List<Job> jobs) { try { return executorService.invokeAll(jobs); } catch (InterruptedException e) { throw new RuntimeException("Unable to execute jobs", e); } }
[ "public", "List", "<", "Future", "<", "JobReport", ">", ">", "submitAll", "(", "List", "<", "Job", ">", "jobs", ")", "{", "try", "{", "return", "executorService", ".", "invokeAll", "(", "jobs", ")", ";", "}", "catch", "(", "InterruptedException", "e", ...
Submit jobs for execution. @param jobs to execute @return the list of job reports in the same order of submission
[ "Submit", "jobs", "for", "execution", "." ]
train
https://github.com/j-easy/easy-batch/blob/46286e1091dae1206674e2a30e0609c31feae36c/easybatch-core/src/main/java/org/easybatch/core/job/JobExecutor.java#L115-L121
SundeepK/CompactCalendarView
library/src/main/java/com/github/sundeepk/compactcalendarview/CompactCalendarController.java
CompactCalendarController.drawEventsWithPlus
private void drawEventsWithPlus(Canvas canvas, float xPosition, float yPosition, List<Event> eventsList) { // k = size() - 1, but since we don't want to draw more than 2 indicators, we just stop after 2 iterations so we can just hard k = -2 instead // we can use the below loop to draw arbitrary eventsByMonthAndYearMap based on the current screen size, for example, larger screens should be able to // display more than 2 evens before displaying plus indicator, but don't draw more than 3 indicators for now for (int j = 0, k = -2; j < 3; j++, k += 2) { Event event = eventsList.get(j); float xStartPosition = xPosition + (xIndicatorOffset * k); if (j == 2) { dayPaint.setColor(multiEventIndicatorColor); dayPaint.setStrokeWidth(multiDayIndicatorStrokeWidth); canvas.drawLine(xStartPosition - smallIndicatorRadius, yPosition, xStartPosition + smallIndicatorRadius, yPosition, dayPaint); canvas.drawLine(xStartPosition, yPosition - smallIndicatorRadius, xStartPosition, yPosition + smallIndicatorRadius, dayPaint); dayPaint.setStrokeWidth(0); } else { drawEventIndicatorCircle(canvas, xStartPosition, yPosition, event.getColor()); } } }
java
private void drawEventsWithPlus(Canvas canvas, float xPosition, float yPosition, List<Event> eventsList) { // k = size() - 1, but since we don't want to draw more than 2 indicators, we just stop after 2 iterations so we can just hard k = -2 instead // we can use the below loop to draw arbitrary eventsByMonthAndYearMap based on the current screen size, for example, larger screens should be able to // display more than 2 evens before displaying plus indicator, but don't draw more than 3 indicators for now for (int j = 0, k = -2; j < 3; j++, k += 2) { Event event = eventsList.get(j); float xStartPosition = xPosition + (xIndicatorOffset * k); if (j == 2) { dayPaint.setColor(multiEventIndicatorColor); dayPaint.setStrokeWidth(multiDayIndicatorStrokeWidth); canvas.drawLine(xStartPosition - smallIndicatorRadius, yPosition, xStartPosition + smallIndicatorRadius, yPosition, dayPaint); canvas.drawLine(xStartPosition, yPosition - smallIndicatorRadius, xStartPosition, yPosition + smallIndicatorRadius, dayPaint); dayPaint.setStrokeWidth(0); } else { drawEventIndicatorCircle(canvas, xStartPosition, yPosition, event.getColor()); } } }
[ "private", "void", "drawEventsWithPlus", "(", "Canvas", "canvas", ",", "float", "xPosition", ",", "float", "yPosition", ",", "List", "<", "Event", ">", "eventsList", ")", "{", "// k = size() - 1, but since we don't want to draw more than 2 indicators, we just stop after 2 ite...
draw 2 eventsByMonthAndYearMap followed by plus indicator to show there are more than 2 eventsByMonthAndYearMap
[ "draw", "2", "eventsByMonthAndYearMap", "followed", "by", "plus", "indicator", "to", "show", "there", "are", "more", "than", "2", "eventsByMonthAndYearMap" ]
train
https://github.com/SundeepK/CompactCalendarView/blob/e74e0eeb913744bdcaea6e9df53268441f9dbf8d/library/src/main/java/com/github/sundeepk/compactcalendarview/CompactCalendarController.java#L845-L862
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.unescapeUriPath
public static void unescapeUriPath(final Reader reader, final Writer writer) throws IOException { unescapeUriPath(reader, writer, DEFAULT_ENCODING); }
java
public static void unescapeUriPath(final Reader reader, final Writer writer) throws IOException { unescapeUriPath(reader, writer, DEFAULT_ENCODING); }
[ "public", "static", "void", "unescapeUriPath", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "unescapeUriPath", "(", "reader", ",", "writer", ",", "DEFAULT_ENCODING", ")", ";", "}" ]
<p> Perform am URI path <strong>unescape</strong> operation on a <tt>Reader</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>. </p> <p> This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use <tt>UTF-8</tt> in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "path", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "using", "<tt", ">", "UTF", "-", "8<", "/", "tt", ">", "as", "encoding", "writing", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L2110-L2113
windup/windup
config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java
Iteration.getPayloadVariableName
public static String getPayloadVariableName(GraphRewrite event, EvaluationContext ctx) throws IllegalStateException { Variables variables = Variables.instance(event); Map<String, Iterable<? extends WindupVertexFrame>> topLayer = variables.peek(); if (topLayer.keySet().size() != 1) { throw new IllegalStateException("Cannot determine Iteration payload variable name because the top " + "layer of " + Variables.class.getSimpleName() + " stack contains " + topLayer.keySet().size() + " variables: " + topLayer.keySet()); } String name = topLayer.keySet().iterator().next(); return name; }
java
public static String getPayloadVariableName(GraphRewrite event, EvaluationContext ctx) throws IllegalStateException { Variables variables = Variables.instance(event); Map<String, Iterable<? extends WindupVertexFrame>> topLayer = variables.peek(); if (topLayer.keySet().size() != 1) { throw new IllegalStateException("Cannot determine Iteration payload variable name because the top " + "layer of " + Variables.class.getSimpleName() + " stack contains " + topLayer.keySet().size() + " variables: " + topLayer.keySet()); } String name = topLayer.keySet().iterator().next(); return name; }
[ "public", "static", "String", "getPayloadVariableName", "(", "GraphRewrite", "event", ",", "EvaluationContext", "ctx", ")", "throws", "IllegalStateException", "{", "Variables", "variables", "=", "Variables", ".", "instance", "(", "event", ")", ";", "Map", "<", "St...
Return the current {@link Iteration} payload variable name. @throws IllegalStateException if there is more than one variable in the {@link Variables} stack, and the payload name cannot be determined.
[ "Return", "the", "current", "{", "@link", "Iteration", "}", "payload", "variable", "name", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/operation/Iteration.java#L378-L390
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java
StylesContainer.writeMasterPageStyles
public void writeMasterPageStyles(final XMLUtil util, final Appendable appendable) throws IOException { for (final MasterPageStyle ps : this.masterPageStylesContainer.getValues()) { ps.appendXMLToMasterStyle(util, appendable); } }
java
public void writeMasterPageStyles(final XMLUtil util, final Appendable appendable) throws IOException { for (final MasterPageStyle ps : this.masterPageStylesContainer.getValues()) { ps.appendXMLToMasterStyle(util, appendable); } }
[ "public", "void", "writeMasterPageStyles", "(", "final", "XMLUtil", "util", ",", "final", "Appendable", "appendable", ")", "throws", "IOException", "{", "for", "(", "final", "MasterPageStyle", "ps", ":", "this", ".", "masterPageStylesContainer", ".", "getValues", ...
Write master page styles. The master page style always belong to to styles .xml/master-styles (3.15.4) @param util an util @param appendable the destination @throws IOException if an I/O error occurs
[ "Write", "master", "page", "styles", ".", "The", "master", "page", "style", "always", "belong", "to", "to", "styles", ".", "xml", "/", "master", "-", "styles", "(", "3", ".", "15", ".", "4", ")" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/StylesContainer.java#L413-L418
facebookarchive/swift
swift-service/src/main/java/com/facebook/swift/service/ThriftClientManager.java
ThriftClientManager.getRemoteAddress
public HostAndPort getRemoteAddress(Object client) { NiftyClientChannel niftyChannel = getNiftyChannel(client); try { Channel nettyChannel = niftyChannel.getNettyChannel(); SocketAddress address = nettyChannel.getRemoteAddress(); InetSocketAddress inetAddress = (InetSocketAddress) address; return HostAndPort.fromParts(inetAddress.getHostString(), inetAddress.getPort()); } catch (NullPointerException | ClassCastException e) { throw new IllegalArgumentException("Invalid swift client object", e); } }
java
public HostAndPort getRemoteAddress(Object client) { NiftyClientChannel niftyChannel = getNiftyChannel(client); try { Channel nettyChannel = niftyChannel.getNettyChannel(); SocketAddress address = nettyChannel.getRemoteAddress(); InetSocketAddress inetAddress = (InetSocketAddress) address; return HostAndPort.fromParts(inetAddress.getHostString(), inetAddress.getPort()); } catch (NullPointerException | ClassCastException e) { throw new IllegalArgumentException("Invalid swift client object", e); } }
[ "public", "HostAndPort", "getRemoteAddress", "(", "Object", "client", ")", "{", "NiftyClientChannel", "niftyChannel", "=", "getNiftyChannel", "(", "client", ")", ";", "try", "{", "Channel", "nettyChannel", "=", "niftyChannel", ".", "getNettyChannel", "(", ")", ";"...
Returns the remote address that a Swift client is connected to @throws IllegalArgumentException if the client is not a Swift client or is not connected through an internet socket
[ "Returns", "the", "remote", "address", "that", "a", "Swift", "client", "is", "connected", "to" ]
train
https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-service/src/main/java/com/facebook/swift/service/ThriftClientManager.java#L335-L348
zafarkhaja/jsemver
src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java
ExpressionParser.versionFor
private Version versionFor(int major, int minor, int patch) { return Version.forIntegers(major, minor, patch); }
java
private Version versionFor(int major, int minor, int patch) { return Version.forIntegers(major, minor, patch); }
[ "private", "Version", "versionFor", "(", "int", "major", ",", "int", "minor", ",", "int", "patch", ")", "{", "return", "Version", ".", "forIntegers", "(", "major", ",", "minor", ",", "patch", ")", ";", "}" ]
Creates a {@code Version} instance for the specified major, minor and patch versions. @param major the major version number @param minor the minor version number @param patch the patch version number @return the version for the specified major, minor and patch versions
[ "Creates", "a", "{", "@code", "Version", "}", "instance", "for", "the", "specified", "major", "minor", "and", "patch", "versions", "." ]
train
https://github.com/zafarkhaja/jsemver/blob/1f4996ea3dab06193c378fd66fd4f8fdc8334cc6/src/main/java/com/github/zafarkhaja/semver/expr/ExpressionParser.java#L482-L484
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doHttpFilePut
public void doHttpFilePut(String url, HttpResponse result, Map<String, Object> headers, File file) { httpClient.put(url, result, headers, file); }
java
public void doHttpFilePut(String url, HttpResponse result, Map<String, Object> headers, File file) { httpClient.put(url, result, headers, file); }
[ "public", "void", "doHttpFilePut", "(", "String", "url", ",", "HttpResponse", "result", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "File", "file", ")", "{", "httpClient", ".", "put", "(", "url", ",", "result", ",", "headers", ",", "...
Performs PUT to supplied url of a file as binary data. @param url url to post to. @param result result containing request, its response will be filled. @param headers headers to add. @param file file containing binary data to post.
[ "Performs", "PUT", "to", "supplied", "url", "of", "a", "file", "as", "binary", "data", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L307-L309
elibom/jogger
src/main/java/com/elibom/jogger/http/servlet/multipart/ParameterParser.java
ParameterParser.isOneOf
private boolean isOneOf(char ch, final char[] charray) { boolean result = false; for (int i = 0; i < charray.length; i++) { if (ch == charray[i]) { result = true; break; } } return result; }
java
private boolean isOneOf(char ch, final char[] charray) { boolean result = false; for (int i = 0; i < charray.length; i++) { if (ch == charray[i]) { result = true; break; } } return result; }
[ "private", "boolean", "isOneOf", "(", "char", "ch", ",", "final", "char", "[", "]", "charray", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "charray", ".", "length", ";", "i", "++", ")", "{", ...
Tests if the given character is present in the array of characters. @param ch the character to test for presense in the array of characters @param charray the array of characters to test against @return <tt>true</tt> if the character is present in the array of characters, <tt>false</tt> otherwise.
[ "Tests", "if", "the", "given", "character", "is", "present", "in", "the", "array", "of", "characters", "." ]
train
https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/http/servlet/multipart/ParameterParser.java#L115-L124
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.decryptString
public final String decryptString(SecretKey sharedKey, byte[] encryptedString) { logger.entry(); try (ByteArrayInputStream input = new ByteArrayInputStream(encryptedString); ByteArrayOutputStream output = new ByteArrayOutputStream()) { decryptStream(sharedKey, input, output); output.flush(); String string = output.toString("UTF-8"); logger.exit(); return string; } catch (IOException e) { // should never happen! RuntimeException exception = new RuntimeException("An unexpected exception occured while trying to decrypt a string.", e); logger.error(exception.toString()); throw exception; } }
java
public final String decryptString(SecretKey sharedKey, byte[] encryptedString) { logger.entry(); try (ByteArrayInputStream input = new ByteArrayInputStream(encryptedString); ByteArrayOutputStream output = new ByteArrayOutputStream()) { decryptStream(sharedKey, input, output); output.flush(); String string = output.toString("UTF-8"); logger.exit(); return string; } catch (IOException e) { // should never happen! RuntimeException exception = new RuntimeException("An unexpected exception occured while trying to decrypt a string.", e); logger.error(exception.toString()); throw exception; } }
[ "public", "final", "String", "decryptString", "(", "SecretKey", "sharedKey", ",", "byte", "[", "]", "encryptedString", ")", "{", "logger", ".", "entry", "(", ")", ";", "try", "(", "ByteArrayInputStream", "input", "=", "new", "ByteArrayInputStream", "(", "encry...
This method decrypts a string using a shared key. @param sharedKey The shared key used for the encryption. @param encryptedString The encrypted string. @return The decrypted string.
[ "This", "method", "decrypts", "a", "string", "using", "a", "shared", "key", "." ]
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L170-L185
ravendb/ravendb-jvm-client
src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java
GenerateEntityIdOnTheClient.tryGetIdFromInstance
public boolean tryGetIdFromInstance(Object entity, Reference<String> idHolder) { if (entity == null) { throw new IllegalArgumentException("Entity cannot be null"); } try { Field identityProperty = getIdentityProperty(entity.getClass()); if (identityProperty != null) { Object value = FieldUtils.readField(identityProperty, entity, true); if (value instanceof String) { idHolder.value = (String)value; return true; } } idHolder.value = null; return false; } catch (IllegalAccessException e) { throw new IllegalStateException(e); } }
java
public boolean tryGetIdFromInstance(Object entity, Reference<String> idHolder) { if (entity == null) { throw new IllegalArgumentException("Entity cannot be null"); } try { Field identityProperty = getIdentityProperty(entity.getClass()); if (identityProperty != null) { Object value = FieldUtils.readField(identityProperty, entity, true); if (value instanceof String) { idHolder.value = (String)value; return true; } } idHolder.value = null; return false; } catch (IllegalAccessException e) { throw new IllegalStateException(e); } }
[ "public", "boolean", "tryGetIdFromInstance", "(", "Object", "entity", ",", "Reference", "<", "String", ">", "idHolder", ")", "{", "if", "(", "entity", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Entity cannot be null\"", ")", ";",...
Attempts to get the document key from an instance @param entity Entity to get id from @param idHolder output parameter which holds document id @return true if id was read from entity
[ "Attempts", "to", "get", "the", "document", "key", "from", "an", "instance" ]
train
https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/identity/GenerateEntityIdOnTheClient.java#L30-L48
bwaldvogel/liblinear-java
src/main/java/de/bwaldvogel/liblinear/Parameter.java
Parameter.setWeights
public void setWeights(double[] weights, int[] weightLabels) { if (weights == null) throw new IllegalArgumentException("'weight' must not be null"); if (weightLabels == null || weightLabels.length != weights.length) throw new IllegalArgumentException("'weightLabels' must have same length as 'weight'"); this.weightLabel = copyOf(weightLabels, weightLabels.length); this.weight = copyOf(weights, weights.length); }
java
public void setWeights(double[] weights, int[] weightLabels) { if (weights == null) throw new IllegalArgumentException("'weight' must not be null"); if (weightLabels == null || weightLabels.length != weights.length) throw new IllegalArgumentException("'weightLabels' must have same length as 'weight'"); this.weightLabel = copyOf(weightLabels, weightLabels.length); this.weight = copyOf(weights, weights.length); }
[ "public", "void", "setWeights", "(", "double", "[", "]", "weights", ",", "int", "[", "]", "weightLabels", ")", "{", "if", "(", "weights", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"'weight' must not be null\"", ")", ";", "if", "("...
<p>nr_weight, weight_label, and weight are used to change the penalty for some classes (If the weight for a class is not changed, it is set to 1). This is useful for training classifier using unbalanced input data or with asymmetric misclassification cost.</p> <p>Each weight[i] corresponds to weight_label[i], meaning that the penalty of class weight_label[i] is scaled by a factor of weight[i].</p> <p>If you do not want to change penalty for any of the classes, just set nr_weight to 0.</p>
[ "<p", ">", "nr_weight", "weight_label", "and", "weight", "are", "used", "to", "change", "the", "penalty", "for", "some", "classes", "(", "If", "the", "weight", "for", "a", "class", "is", "not", "changed", "it", "is", "set", "to", "1", ")", ".", "This",...
train
https://github.com/bwaldvogel/liblinear-java/blob/02b228c23a1e3490ba1f703813b09153c8901c2e/src/main/java/de/bwaldvogel/liblinear/Parameter.java#L68-L74
alkacon/opencms-core
src/org/opencms/ui/components/CmsFileTable.java
CmsFileTable.updateItem
private void updateItem(CmsUUID itemId, boolean remove) { if (remove) { String idStr = itemId != null ? itemId.toString() : null; m_container.removeItem(idStr); return; } CmsObject cms = A_CmsUI.getCmsObject(); try { CmsResource resource = cms.readResource(itemId, CmsResourceFilter.ALL); fillItem(cms, resource, OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)); } catch (CmsVfsResourceNotFoundException e) { m_container.removeItem(itemId); LOG.debug("Failed to update file table item, removing it from view.", e); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } }
java
private void updateItem(CmsUUID itemId, boolean remove) { if (remove) { String idStr = itemId != null ? itemId.toString() : null; m_container.removeItem(idStr); return; } CmsObject cms = A_CmsUI.getCmsObject(); try { CmsResource resource = cms.readResource(itemId, CmsResourceFilter.ALL); fillItem(cms, resource, OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)); } catch (CmsVfsResourceNotFoundException e) { m_container.removeItem(itemId); LOG.debug("Failed to update file table item, removing it from view.", e); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } }
[ "private", "void", "updateItem", "(", "CmsUUID", "itemId", ",", "boolean", "remove", ")", "{", "if", "(", "remove", ")", "{", "String", "idStr", "=", "itemId", "!=", "null", "?", "itemId", ".", "toString", "(", ")", ":", "null", ";", "m_container", "."...
Updates the given item in the file table.<p> @param itemId the item id @param remove true if the item should be removed only
[ "Updates", "the", "given", "item", "in", "the", "file", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsFileTable.java#L1038-L1057
ppicas/custom-typeface
library/src/main/java/cat/ppicas/customtypeface/CustomTypefaceFactory.java
CustomTypefaceFactory.createView
private View createView(String name, String prefix, Context context, AttributeSet attrs) throws ClassNotFoundException, InflateException { Constructor<? extends View> constructor = CONSTRUCTOR_MAP.get(name); Class<? extends View> clazz = null; try { if (constructor == null) { // Class not found in the cache, see if it's real, and try to add it clazz = mContext.getClassLoader().loadClass( prefix != null ? (prefix + name) : name).asSubclass(View.class); constructor = clazz.getConstructor(CONSTRUCTOR_SIGNATURE); constructor.setAccessible(true); CONSTRUCTOR_MAP.put(name, constructor); } mConstructorArgs[0] = context; mConstructorArgs[1] = attrs; return constructor.newInstance(mConstructorArgs); } catch (NoSuchMethodException e) { InflateException ie = new InflateException(attrs.getPositionDescription() + ": Error inflating class " + (prefix != null ? (prefix + name) : name)); ie.initCause(e); throw ie; } catch (ClassCastException e) { // If loaded class is not a View subclass InflateException ie = new InflateException(attrs.getPositionDescription() + ": Class is not a View " + (prefix != null ? (prefix + name) : name)); ie.initCause(e); throw ie; } catch (ClassNotFoundException e) { // If loadClass fails, we should propagate the exception. throw e; } catch (Exception e) { InflateException ie = new InflateException(attrs.getPositionDescription() + ": Error inflating class " + (clazz == null ? "<unknown>" : clazz.getName())); ie.initCause(e); throw ie; } }
java
private View createView(String name, String prefix, Context context, AttributeSet attrs) throws ClassNotFoundException, InflateException { Constructor<? extends View> constructor = CONSTRUCTOR_MAP.get(name); Class<? extends View> clazz = null; try { if (constructor == null) { // Class not found in the cache, see if it's real, and try to add it clazz = mContext.getClassLoader().loadClass( prefix != null ? (prefix + name) : name).asSubclass(View.class); constructor = clazz.getConstructor(CONSTRUCTOR_SIGNATURE); constructor.setAccessible(true); CONSTRUCTOR_MAP.put(name, constructor); } mConstructorArgs[0] = context; mConstructorArgs[1] = attrs; return constructor.newInstance(mConstructorArgs); } catch (NoSuchMethodException e) { InflateException ie = new InflateException(attrs.getPositionDescription() + ": Error inflating class " + (prefix != null ? (prefix + name) : name)); ie.initCause(e); throw ie; } catch (ClassCastException e) { // If loaded class is not a View subclass InflateException ie = new InflateException(attrs.getPositionDescription() + ": Class is not a View " + (prefix != null ? (prefix + name) : name)); ie.initCause(e); throw ie; } catch (ClassNotFoundException e) { // If loadClass fails, we should propagate the exception. throw e; } catch (Exception e) { InflateException ie = new InflateException(attrs.getPositionDescription() + ": Error inflating class " + (clazz == null ? "<unknown>" : clazz.getName())); ie.initCause(e); throw ie; } }
[ "private", "View", "createView", "(", "String", "name", ",", "String", "prefix", ",", "Context", "context", ",", "AttributeSet", "attrs", ")", "throws", "ClassNotFoundException", ",", "InflateException", "{", "Constructor", "<", "?", "extends", "View", ">", "con...
Low-level function for instantiating a view by name. This attempts to instantiate a view class of the given <var>name</var> found in this LayoutInflater's ClassLoader. <p> There are two things that can happen in an error case: either the exception describing the error will be thrown, or a null will be returned. You must deal with both possibilities -- the former will happen the first time createView() is called for a class of a particular name, the latter every time there-after for that class name. @param name The full name of the class to be instantiated. @param context The Context in which this LayoutInflater will create its Views; most importantly, this supplies the theme from which the default values for their attributes are retrieved. @param attrs The XML attributes supplied for this instance. @return View The newly instantiated view, or null.
[ "Low", "-", "level", "function", "for", "instantiating", "a", "view", "by", "name", ".", "This", "attempts", "to", "instantiate", "a", "view", "class", "of", "the", "given", "<var", ">", "name<", "/", "var", ">", "found", "in", "this", "LayoutInflater", ...
train
https://github.com/ppicas/custom-typeface/blob/3a2a68cc8584a72076c545a8b7c9f741f6002241/library/src/main/java/cat/ppicas/customtypeface/CustomTypefaceFactory.java#L173-L217
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java
PoolablePreparedStatement.setAsciiStream
@Override public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { internalStmt.setAsciiStream(parameterIndex, x, length); }
java
@Override public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException { internalStmt.setAsciiStream(parameterIndex, x, length); }
[ "@", "Override", "public", "void", "setAsciiStream", "(", "int", "parameterIndex", ",", "InputStream", "x", ",", "int", "length", ")", "throws", "SQLException", "{", "internalStmt", ".", "setAsciiStream", "(", "parameterIndex", ",", "x", ",", "length", ")", ";...
Method setAsciiStream. @param parameterIndex @param x @param length @throws SQLException @see java.sql.PreparedStatement#setAsciiStream(int, InputStream, int)
[ "Method", "setAsciiStream", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L470-L473
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.addRelationToResource
public void addRelationToResource( CmsDbContext dbc, CmsResource resource, CmsResource target, CmsRelationType type, boolean importCase) throws CmsException { if (type.isDefinedInContent()) { throw new CmsIllegalArgumentException( Messages.get().container( Messages.ERR_ADD_RELATION_IN_CONTENT_3, dbc.removeSiteRoot(resource.getRootPath()), dbc.removeSiteRoot(target.getRootPath()), type.getLocalizedName(dbc.getRequestContext().getLocale()))); } CmsRelation relation = new CmsRelation(resource, target, type); getVfsDriver(dbc).createRelation(dbc, dbc.currentProject().getUuid(), relation); if (!importCase) { // log it log( dbc, new CmsLogEntry( dbc, resource.getStructureId(), CmsLogEntryType.RESOURCE_ADD_RELATION, new String[] {relation.getSourcePath(), relation.getTargetPath()}), false); // touch the resource setDateLastModified(dbc, resource, System.currentTimeMillis()); } }
java
public void addRelationToResource( CmsDbContext dbc, CmsResource resource, CmsResource target, CmsRelationType type, boolean importCase) throws CmsException { if (type.isDefinedInContent()) { throw new CmsIllegalArgumentException( Messages.get().container( Messages.ERR_ADD_RELATION_IN_CONTENT_3, dbc.removeSiteRoot(resource.getRootPath()), dbc.removeSiteRoot(target.getRootPath()), type.getLocalizedName(dbc.getRequestContext().getLocale()))); } CmsRelation relation = new CmsRelation(resource, target, type); getVfsDriver(dbc).createRelation(dbc, dbc.currentProject().getUuid(), relation); if (!importCase) { // log it log( dbc, new CmsLogEntry( dbc, resource.getStructureId(), CmsLogEntryType.RESOURCE_ADD_RELATION, new String[] {relation.getSourcePath(), relation.getTargetPath()}), false); // touch the resource setDateLastModified(dbc, resource, System.currentTimeMillis()); } }
[ "public", "void", "addRelationToResource", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ",", "CmsResource", "target", ",", "CmsRelationType", "type", ",", "boolean", "importCase", ")", "throws", "CmsException", "{", "if", "(", "type", ".", "isDefine...
Adds a new relation to the given resource.<p> @param dbc the database context @param resource the resource to add the relation to @param target the target of the relation @param type the type of the relation @param importCase if importing relations @throws CmsException if something goes wrong
[ "Adds", "a", "new", "relation", "to", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L576-L607
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.columnsToVector
public static ZMatrixRMaj[] columnsToVector(ZMatrixRMaj A, ZMatrixRMaj[] v) { ZMatrixRMaj[]ret; if( v == null || v.length < A.numCols ) { ret = new ZMatrixRMaj[ A.numCols ]; } else { ret = v; } for( int i = 0; i < ret.length; i++ ) { if( ret[i] == null ) { ret[i] = new ZMatrixRMaj(A.numRows,1); } else { ret[i].reshape(A.numRows,1); } ZMatrixRMaj u = ret[i]; int indexU = 0; for( int j = 0; j < A.numRows; j++ ) { int indexA = A.getIndex(j,i); u.data[indexU++] = A.data[indexA++]; u.data[indexU++] = A.data[indexA]; } } return ret; }
java
public static ZMatrixRMaj[] columnsToVector(ZMatrixRMaj A, ZMatrixRMaj[] v) { ZMatrixRMaj[]ret; if( v == null || v.length < A.numCols ) { ret = new ZMatrixRMaj[ A.numCols ]; } else { ret = v; } for( int i = 0; i < ret.length; i++ ) { if( ret[i] == null ) { ret[i] = new ZMatrixRMaj(A.numRows,1); } else { ret[i].reshape(A.numRows,1); } ZMatrixRMaj u = ret[i]; int indexU = 0; for( int j = 0; j < A.numRows; j++ ) { int indexA = A.getIndex(j,i); u.data[indexU++] = A.data[indexA++]; u.data[indexU++] = A.data[indexA]; } } return ret; }
[ "public", "static", "ZMatrixRMaj", "[", "]", "columnsToVector", "(", "ZMatrixRMaj", "A", ",", "ZMatrixRMaj", "[", "]", "v", ")", "{", "ZMatrixRMaj", "[", "]", "ret", ";", "if", "(", "v", "==", "null", "||", "v", ".", "length", "<", "A", ".", "numCols...
Converts the columns in a matrix into a set of vectors. @param A Matrix. Not modified. @param v Optional storage for columns. @return An array of vectors.
[ "Converts", "the", "columns", "in", "a", "matrix", "into", "a", "set", "of", "vectors", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L1232-L1259
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java
File.setExecutable
public boolean setExecutable(boolean executable, boolean ownerOnly) { return doChmod(ownerOnly ? S_IXUSR : (S_IXUSR | S_IXGRP | S_IXOTH), executable); }
java
public boolean setExecutable(boolean executable, boolean ownerOnly) { return doChmod(ownerOnly ? S_IXUSR : (S_IXUSR | S_IXGRP | S_IXOTH), executable); }
[ "public", "boolean", "setExecutable", "(", "boolean", "executable", ",", "boolean", "ownerOnly", ")", "{", "return", "doChmod", "(", "ownerOnly", "?", "S_IXUSR", ":", "(", "S_IXUSR", "|", "S_IXGRP", "|", "S_IXOTH", ")", ",", "executable", ")", ";", "}" ]
Manipulates the execute permissions for the abstract path designated by this file. <p>Note that this method does <i>not</i> throw {@code IOException} on failure. Callers must check the return value. @param executable To allow execute permission if true, otherwise disallow @param ownerOnly To manipulate execute permission only for owner if true, otherwise for everyone. The manipulation will apply to everyone regardless of this value if the underlying system does not distinguish owner and other users. @return true if and only if the operation succeeded. If the user does not have permission to change the access permissions of this abstract pathname the operation will fail. If the underlying file system does not support execute permission and the value of executable is false, this operation will fail. @since 1.6
[ "Manipulates", "the", "execute", "permissions", "for", "the", "abstract", "path", "designated", "by", "this", "file", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java#L695-L697
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java
ClientAsynchEventThreadPool.dispatchAsynchEvent
public void dispatchAsynchEvent(short eventId, Conversation conversation) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchAsynchEvent", new Object[] { ""+eventId, conversation }); // Create a runnable with the data AsynchEventThread thread = new AsynchEventThread(eventId, conversation); dispatchThread(thread); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchAsynchEvent"); }
java
public void dispatchAsynchEvent(short eventId, Conversation conversation) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchAsynchEvent", new Object[] { ""+eventId, conversation }); // Create a runnable with the data AsynchEventThread thread = new AsynchEventThread(eventId, conversation); dispatchThread(thread); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchAsynchEvent"); }
[ "public", "void", "dispatchAsynchEvent", "(", "short", "eventId", ",", "Conversation", "conversation", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", ...
Dispatches the data to be sent to the connection event listeners on a thread. @param eventId @param conversation
[ "Dispatches", "the", "data", "to", "be", "sent", "to", "the", "connection", "event", "listeners", "on", "a", "thread", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L150-L160
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java
ConsumerUtil.validateNbf
void validateNbf(JwtClaims jwtClaims, long clockSkewInMilliseconds) throws InvalidClaimException { if (jwtClaims == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Missing JwtClaims object"); } return; } NumericDate nbf = getNotBeforeClaim(jwtClaims); validateNotBeforeClaim(nbf, clockSkewInMilliseconds); }
java
void validateNbf(JwtClaims jwtClaims, long clockSkewInMilliseconds) throws InvalidClaimException { if (jwtClaims == null) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Missing JwtClaims object"); } return; } NumericDate nbf = getNotBeforeClaim(jwtClaims); validateNotBeforeClaim(nbf, clockSkewInMilliseconds); }
[ "void", "validateNbf", "(", "JwtClaims", "jwtClaims", ",", "long", "clockSkewInMilliseconds", ")", "throws", "InvalidClaimException", "{", "if", "(", "jwtClaims", "==", "null", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", ...
Validates the the {@value Claims#NOT_BEFORE} claim is present and properly formed. Also
[ "Validates", "the", "the", "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L539-L548
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/Vector2ifx.java
Vector2ifx.lengthSquaredProperty
public DoubleProperty lengthSquaredProperty() { if (this.lengthSquareProperty == null) { this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED); this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() -> { return Vector2ifx.this.x.doubleValue() * Vector2ifx.this.x.doubleValue() + Vector2ifx.this.y.doubleValue() * Vector2ifx.this.y.doubleValue(); }, this.x, this.y)); } return this.lengthSquareProperty; }
java
public DoubleProperty lengthSquaredProperty() { if (this.lengthSquareProperty == null) { this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED); this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() -> { return Vector2ifx.this.x.doubleValue() * Vector2ifx.this.x.doubleValue() + Vector2ifx.this.y.doubleValue() * Vector2ifx.this.y.doubleValue(); }, this.x, this.y)); } return this.lengthSquareProperty; }
[ "public", "DoubleProperty", "lengthSquaredProperty", "(", ")", "{", "if", "(", "this", ".", "lengthSquareProperty", "==", "null", ")", "{", "this", ".", "lengthSquareProperty", "=", "new", "ReadOnlyDoubleWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "LE...
Replies the property that represents the length of the vector. @return the length property
[ "Replies", "the", "property", "that", "represents", "the", "length", "of", "the", "vector", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/Vector2ifx.java#L186-L195
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java
Utils.findShapeModelByC2jName
public static ShapeModel findShapeModelByC2jName(IntermediateModel intermediateModel, String shapeC2jName) throws IllegalArgumentException { ShapeModel shapeModel = findShapeModelByC2jNameIfExists(intermediateModel, shapeC2jName); if (shapeModel != null) { return shapeModel; } else { throw new IllegalArgumentException( shapeC2jName + " shape (c2j name) does not exist in the intermediate model."); } }
java
public static ShapeModel findShapeModelByC2jName(IntermediateModel intermediateModel, String shapeC2jName) throws IllegalArgumentException { ShapeModel shapeModel = findShapeModelByC2jNameIfExists(intermediateModel, shapeC2jName); if (shapeModel != null) { return shapeModel; } else { throw new IllegalArgumentException( shapeC2jName + " shape (c2j name) does not exist in the intermediate model."); } }
[ "public", "static", "ShapeModel", "findShapeModelByC2jName", "(", "IntermediateModel", "intermediateModel", ",", "String", "shapeC2jName", ")", "throws", "IllegalArgumentException", "{", "ShapeModel", "shapeModel", "=", "findShapeModelByC2jNameIfExists", "(", "intermediateModel...
Search for intermediate shape model by its c2j name. @return ShapeModel @throws IllegalArgumentException if the specified c2j name is not found in the intermediate model.
[ "Search", "for", "intermediate", "shape", "model", "by", "its", "c2j", "name", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Utils.java#L265-L274
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/InheritanceHelper.java
InheritanceHelper.isProxyOrSubTypeOf
public boolean isProxyOrSubTypeOf(JvmTypeReference candidate, Class<?> jvmSuperType, Class<? extends XtendTypeDeclaration> sarlSuperType, boolean onlyInterface) { if (candidate.eIsProxy()) { return true; } return isSubTypeOf(candidate, jvmSuperType, sarlSuperType, onlyInterface); }
java
public boolean isProxyOrSubTypeOf(JvmTypeReference candidate, Class<?> jvmSuperType, Class<? extends XtendTypeDeclaration> sarlSuperType, boolean onlyInterface) { if (candidate.eIsProxy()) { return true; } return isSubTypeOf(candidate, jvmSuperType, sarlSuperType, onlyInterface); }
[ "public", "boolean", "isProxyOrSubTypeOf", "(", "JvmTypeReference", "candidate", ",", "Class", "<", "?", ">", "jvmSuperType", ",", "Class", "<", "?", "extends", "XtendTypeDeclaration", ">", "sarlSuperType", ",", "boolean", "onlyInterface", ")", "{", "if", "(", "...
Replies if the type candidate is a proxy (unresolved type) or a subtype of the given super type. @param candidate the type to test. @param jvmSuperType the expected JVM super-type. @param sarlSuperType the expected SARL super-type. @param onlyInterface <code>true</code> if only interface types are matching; <code>false</code> if not-interface types are matching. @return <code>true</code> if the candidate is a sub-type of the super-type.
[ "Replies", "if", "the", "type", "candidate", "is", "a", "proxy", "(", "unresolved", "type", ")", "or", "a", "subtype", "of", "the", "given", "super", "type", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/InheritanceHelper.java#L183-L189
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.setTimes
void setTimes(String src, INode inode, long mtime, long atime, boolean force) throws IOException { if (unprotectedSetTimes(src, inode, mtime, atime, force)) { fsImage.getEditLog().logTimes(src, mtime, atime); } }
java
void setTimes(String src, INode inode, long mtime, long atime, boolean force) throws IOException { if (unprotectedSetTimes(src, inode, mtime, atime, force)) { fsImage.getEditLog().logTimes(src, mtime, atime); } }
[ "void", "setTimes", "(", "String", "src", ",", "INode", "inode", ",", "long", "mtime", ",", "long", "atime", ",", "boolean", "force", ")", "throws", "IOException", "{", "if", "(", "unprotectedSetTimes", "(", "src", ",", "inode", ",", "mtime", ",", "atime...
Sets the access time on the file/directory. Logs it in the transaction log
[ "Sets", "the", "access", "time", "on", "the", "file", "/", "directory", ".", "Logs", "it", "in", "the", "transaction", "log" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2807-L2812
nextreports/nextreports-engine
src/ro/nextreports/engine/util/ReportUtil.java
ReportUtil.loadConvertedReport
public static Report loadConvertedReport(InputStream is) { XStream xstream = XStreamFactory.createXStream(); InputStreamReader reader = null; try { reader = new InputStreamReader(is, "UTF-8"); return (Report) xstream.fromXML(reader); } catch (Exception e) { LOG.error(e.getMessage(), e); e.printStackTrace(); return null; } }
java
public static Report loadConvertedReport(InputStream is) { XStream xstream = XStreamFactory.createXStream(); InputStreamReader reader = null; try { reader = new InputStreamReader(is, "UTF-8"); return (Report) xstream.fromXML(reader); } catch (Exception e) { LOG.error(e.getMessage(), e); e.printStackTrace(); return null; } }
[ "public", "static", "Report", "loadConvertedReport", "(", "InputStream", "is", ")", "{", "XStream", "xstream", "=", "XStreamFactory", ".", "createXStream", "(", ")", ";", "InputStreamReader", "reader", "=", "null", ";", "try", "{", "reader", "=", "new", "Input...
Create a report object from an input stream Use this method if you know your report version does not need any conversion from older versions, otherwise see {@link #loadReport(InputStream)} @param is input stream @return the report object created from the input stream or null if cannot be read
[ "Create", "a", "report", "object", "from", "an", "input", "stream" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L109-L120
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java
CommonOps_DSCC.extractColumn
public static DMatrixSparseCSC extractColumn(DMatrixSparseCSC A , int column , @Nullable DMatrixSparseCSC out ) { if( out == null ) out = new DMatrixSparseCSC(1,1,1); int idx0 = A.col_idx[column]; int idx1 = A.col_idx[column+1]; out.reshape(A.numRows,1,idx1-idx0); out.nz_length = idx1-idx0; out.col_idx[0] = 0; out.col_idx[1] = out.nz_length; System.arraycopy(A.nz_values,idx0,out.nz_values,0,out.nz_length); System.arraycopy(A.nz_rows,idx0,out.nz_rows,0,out.nz_length); return out; }
java
public static DMatrixSparseCSC extractColumn(DMatrixSparseCSC A , int column , @Nullable DMatrixSparseCSC out ) { if( out == null ) out = new DMatrixSparseCSC(1,1,1); int idx0 = A.col_idx[column]; int idx1 = A.col_idx[column+1]; out.reshape(A.numRows,1,idx1-idx0); out.nz_length = idx1-idx0; out.col_idx[0] = 0; out.col_idx[1] = out.nz_length; System.arraycopy(A.nz_values,idx0,out.nz_values,0,out.nz_length); System.arraycopy(A.nz_rows,idx0,out.nz_rows,0,out.nz_length); return out; }
[ "public", "static", "DMatrixSparseCSC", "extractColumn", "(", "DMatrixSparseCSC", "A", ",", "int", "column", ",", "@", "Nullable", "DMatrixSparseCSC", "out", ")", "{", "if", "(", "out", "==", "null", ")", "out", "=", "new", "DMatrixSparseCSC", "(", "1", ",",...
Extracts a column from A and stores it into out. @param A (Input) Source matrix. not modified. @param column The column in A @param out (Output, Optional) Storage for column vector @return The column of A.
[ "Extracts", "a", "column", "from", "A", "and", "stores", "it", "into", "out", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L1137-L1155
Appendium/flatpack
flatpack/src/main/java/net/sf/flatpack/util/ParserUtils.java
ParserUtils.getPZMetaDataFromFile
public static MetaData getPZMetaDataFromFile(final String line, final char delimiter, final char qualifier, final Parser p, final boolean addSuffixToDuplicateColumnNames) { final List<ColumnMetaData> results = new ArrayList<>(); final Set<String> dupCheck = new HashSet<>(); final List<String> lineData = splitLine(line, delimiter, qualifier, FPConstants.SPLITLINE_SIZE_INIT, false, false); for (final String colName : lineData) { final ColumnMetaData cmd = new ColumnMetaData(); String colNameToUse = colName; if (dupCheck.contains(colNameToUse)) { if (!addSuffixToDuplicateColumnNames) { throw new FPException("Duplicate Column Name In File: " + colNameToUse); } else { int count = 2; while (dupCheck.contains(colNameToUse + count)) { count++; } colNameToUse = colName + count; } } cmd.setColName(colNameToUse); results.add(cmd); dupCheck.add(cmd.getColName()); } return new MetaData(results, buidColumnIndexMap(results, p)); }
java
public static MetaData getPZMetaDataFromFile(final String line, final char delimiter, final char qualifier, final Parser p, final boolean addSuffixToDuplicateColumnNames) { final List<ColumnMetaData> results = new ArrayList<>(); final Set<String> dupCheck = new HashSet<>(); final List<String> lineData = splitLine(line, delimiter, qualifier, FPConstants.SPLITLINE_SIZE_INIT, false, false); for (final String colName : lineData) { final ColumnMetaData cmd = new ColumnMetaData(); String colNameToUse = colName; if (dupCheck.contains(colNameToUse)) { if (!addSuffixToDuplicateColumnNames) { throw new FPException("Duplicate Column Name In File: " + colNameToUse); } else { int count = 2; while (dupCheck.contains(colNameToUse + count)) { count++; } colNameToUse = colName + count; } } cmd.setColName(colNameToUse); results.add(cmd); dupCheck.add(cmd.getColName()); } return new MetaData(results, buidColumnIndexMap(results, p)); }
[ "public", "static", "MetaData", "getPZMetaDataFromFile", "(", "final", "String", "line", ",", "final", "char", "delimiter", ",", "final", "char", "qualifier", ",", "final", "Parser", "p", ",", "final", "boolean", "addSuffixToDuplicateColumnNames", ")", "{", "final...
Returns a list of ColumnMetaData objects. This is for use with delimited files. The first line of the file which contains data will be used as the column names @param line @param delimiter @param qualifier @param p PZParser used to specify additional option when working with the ColumnMetaData. Can be null @param addSuffixToDuplicateColumnNames @return PZMetaData
[ "Returns", "a", "list", "of", "ColumnMetaData", "objects", ".", "This", "is", "for", "use", "with", "delimited", "files", ".", "The", "first", "line", "of", "the", "file", "which", "contains", "data", "will", "be", "used", "as", "the", "column", "names" ]
train
https://github.com/Appendium/flatpack/blob/5e09875d97db7038e3ba6af9468f5313d99b0082/flatpack/src/main/java/net/sf/flatpack/util/ParserUtils.java#L399-L425
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGraph.java
ManagementGraph.getInputVertex
public ManagementVertex getInputVertex(final int stage, final int index) { if (stage >= this.stages.size()) { return null; } return this.stages.get(stage).getInputManagementVertex(index); }
java
public ManagementVertex getInputVertex(final int stage, final int index) { if (stage >= this.stages.size()) { return null; } return this.stages.get(stage).getInputManagementVertex(index); }
[ "public", "ManagementVertex", "getInputVertex", "(", "final", "int", "stage", ",", "final", "int", "index", ")", "{", "if", "(", "stage", ">=", "this", ".", "stages", ".", "size", "(", ")", ")", "{", "return", "null", ";", "}", "return", "this", ".", ...
Returns the input vertex with the specified index for the given stage. @param stage the index of the stage @param index the index of the input vertex to return @return the input vertex with the specified index or <code>null</code> if no input vertex with such an index exists in that stage
[ "Returns", "the", "input", "vertex", "with", "the", "specified", "index", "for", "the", "given", "stage", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGraph.java#L290-L297
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesInner.java
DatabaseConnectionPoliciesInner.getAsync
public Observable<DatabaseConnectionPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseConnectionPolicyInner>, DatabaseConnectionPolicyInner>() { @Override public DatabaseConnectionPolicyInner call(ServiceResponse<DatabaseConnectionPolicyInner> response) { return response.body(); } }); }
java
public Observable<DatabaseConnectionPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseConnectionPolicyInner>, DatabaseConnectionPolicyInner>() { @Override public DatabaseConnectionPolicyInner call(ServiceResponse<DatabaseConnectionPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DatabaseConnectionPolicyInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ...
Gets a database's connection policy, which is used with table auditing. Table auditing is deprecated, use blob auditing instead. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database for which the connection policy is defined. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabaseConnectionPolicyInner object
[ "Gets", "a", "database", "s", "connection", "policy", "which", "is", "used", "with", "table", "auditing", ".", "Table", "auditing", "is", "deprecated", "use", "blob", "auditing", "instead", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseConnectionPoliciesInner.java#L105-L112
YahooArchive/samoa
samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java
ModelAggregatorProcessor.attemptToSplit
private void attemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){ //Increment the split ID this.splitId++; //Schedule time-out thread ScheduledFuture<?> timeOutHandler = this.executor.schedule(new AggregationTimeOutHandler(this.splitId, this.timedOutSplittingNodes), this.timeOut, TimeUnit.SECONDS); //Keep track of the splitting node information, so that we can continue the split //once we receive all local statistic calculation from Local Statistic PI //this.splittingNodes.put(Long.valueOf(this.splitId), new SplittingNodeInfo(activeLearningNode, foundNode, null)); this.splittingNodes.put(this.splitId, new SplittingNodeInfo(activeLearningNode, foundNode, timeOutHandler)); //Inform Local Statistic PI to perform local statistic calculation activeLearningNode.requestDistributedSuggestions(this.splitId, this); }
java
private void attemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){ //Increment the split ID this.splitId++; //Schedule time-out thread ScheduledFuture<?> timeOutHandler = this.executor.schedule(new AggregationTimeOutHandler(this.splitId, this.timedOutSplittingNodes), this.timeOut, TimeUnit.SECONDS); //Keep track of the splitting node information, so that we can continue the split //once we receive all local statistic calculation from Local Statistic PI //this.splittingNodes.put(Long.valueOf(this.splitId), new SplittingNodeInfo(activeLearningNode, foundNode, null)); this.splittingNodes.put(this.splitId, new SplittingNodeInfo(activeLearningNode, foundNode, timeOutHandler)); //Inform Local Statistic PI to perform local statistic calculation activeLearningNode.requestDistributedSuggestions(this.splitId, this); }
[ "private", "void", "attemptToSplit", "(", "ActiveLearningNode", "activeLearningNode", ",", "FoundNode", "foundNode", ")", "{", "//Increment the split ID", "this", ".", "splitId", "++", ";", "//Schedule time-out thread", "ScheduledFuture", "<", "?", ">", "timeOutHandler", ...
Helper method to represent a split attempt @param activeLearningNode The corresponding active learning node which will be split @param foundNode The data structure to represents the filtering of the instance using the tree model.
[ "Helper", "method", "to", "represent", "a", "split", "attempt" ]
train
https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java#L461-L476
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/debrisvandre/OmsDebrisVandre.java
OmsDebrisVandre.moveToNextTriggerpoint
private boolean moveToNextTriggerpoint( RandomIter triggerIter, RandomIter flowIter, int[] flowDirColRow ) { double tmpFlowValue = flowIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0); if (tmpFlowValue == 10) { return false; } if (!ModelsEngine.go_downstream(flowDirColRow, tmpFlowValue)) throw new ModelsIllegalargumentException("Unable to go downstream: " + flowDirColRow[0] + "/" + flowDirColRow[1], this, pm); while( isNovalue(triggerIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0)) ) { tmpFlowValue = flowIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0); if (tmpFlowValue == 10) { return false; } if (!ModelsEngine.go_downstream(flowDirColRow, tmpFlowValue)) throw new ModelsIllegalargumentException("Unable to go downstream: " + flowDirColRow[0] + "/" + flowDirColRow[1], this, pm); } return true; }
java
private boolean moveToNextTriggerpoint( RandomIter triggerIter, RandomIter flowIter, int[] flowDirColRow ) { double tmpFlowValue = flowIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0); if (tmpFlowValue == 10) { return false; } if (!ModelsEngine.go_downstream(flowDirColRow, tmpFlowValue)) throw new ModelsIllegalargumentException("Unable to go downstream: " + flowDirColRow[0] + "/" + flowDirColRow[1], this, pm); while( isNovalue(triggerIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0)) ) { tmpFlowValue = flowIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0); if (tmpFlowValue == 10) { return false; } if (!ModelsEngine.go_downstream(flowDirColRow, tmpFlowValue)) throw new ModelsIllegalargumentException("Unable to go downstream: " + flowDirColRow[0] + "/" + flowDirColRow[1], this, pm); } return true; }
[ "private", "boolean", "moveToNextTriggerpoint", "(", "RandomIter", "triggerIter", ",", "RandomIter", "flowIter", ",", "int", "[", "]", "flowDirColRow", ")", "{", "double", "tmpFlowValue", "=", "flowIter", ".", "getSampleDouble", "(", "flowDirColRow", "[", "0", "]"...
Moves the flowDirColRow variable to the next trigger point. @param triggerIter @param flowDirColRow @return <code>true</code> if a new trigger was found, <code>false</code> if the exit was reached.
[ "Moves", "the", "flowDirColRow", "variable", "to", "the", "next", "trigger", "point", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/debrisvandre/OmsDebrisVandre.java#L641-L659
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java
LabsInner.getAsync
public Observable<LabInner> getAsync(String resourceGroupName, String labAccountName, String labName) { return getWithServiceResponseAsync(resourceGroupName, labAccountName, labName).map(new Func1<ServiceResponse<LabInner>, LabInner>() { @Override public LabInner call(ServiceResponse<LabInner> response) { return response.body(); } }); }
java
public Observable<LabInner> getAsync(String resourceGroupName, String labAccountName, String labName) { return getWithServiceResponseAsync(resourceGroupName, labAccountName, labName).map(new Func1<ServiceResponse<LabInner>, LabInner>() { @Override public LabInner call(ServiceResponse<LabInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LabInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName",...
Get lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LabInner object
[ "Get", "lab", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L407-L414
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.removeModificationObserver
public void removeModificationObserver (String path, ModificationObserver obs) { ObservedResource resource = _observed.get(path); if (resource != null) { resource.observers.remove(obs); } }
java
public void removeModificationObserver (String path, ModificationObserver obs) { ObservedResource resource = _observed.get(path); if (resource != null) { resource.observers.remove(obs); } }
[ "public", "void", "removeModificationObserver", "(", "String", "path", ",", "ModificationObserver", "obs", ")", "{", "ObservedResource", "resource", "=", "_observed", ".", "get", "(", "path", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "resource",...
Removes a modification observer from the list maintained for the specified resource.
[ "Removes", "a", "modification", "observer", "from", "the", "list", "maintained", "for", "the", "specified", "resource", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L743-L749
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.flingCapturedView
public void flingCapturedView(int minLeft, int minTop, int maxLeft, int maxTop) { if (!mReleaseInProgress) { throw new IllegalStateException("Cannot flingCapturedView outside of a call to " + "Callback#onViewReleased"); } mScroller.fling(mCapturedView.getLeft(), mCapturedView.getTop(), (int) VelocityTrackerCompat.getXVelocity(mVelocityTracker, mActivePointerId), (int) VelocityTrackerCompat.getYVelocity(mVelocityTracker, mActivePointerId), minLeft, maxLeft, minTop, maxTop); setDragState(STATE_SETTLING); }
java
public void flingCapturedView(int minLeft, int minTop, int maxLeft, int maxTop) { if (!mReleaseInProgress) { throw new IllegalStateException("Cannot flingCapturedView outside of a call to " + "Callback#onViewReleased"); } mScroller.fling(mCapturedView.getLeft(), mCapturedView.getTop(), (int) VelocityTrackerCompat.getXVelocity(mVelocityTracker, mActivePointerId), (int) VelocityTrackerCompat.getYVelocity(mVelocityTracker, mActivePointerId), minLeft, maxLeft, minTop, maxTop); setDragState(STATE_SETTLING); }
[ "public", "void", "flingCapturedView", "(", "int", "minLeft", ",", "int", "minTop", ",", "int", "maxLeft", ",", "int", "maxTop", ")", "{", "if", "(", "!", "mReleaseInProgress", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot flingCapturedView o...
Settle the captured view based on standard free-moving fling behavior. The caller should invoke {@link #continueSettling(boolean)} on each subsequent frame to continue the motion until it returns false. @param minLeft Minimum X position for the view's left edge @param minTop Minimum Y position for the view's top edge @param maxLeft Maximum X position for the view's left edge @param maxTop Maximum Y position for the view's top edge
[ "Settle", "the", "captured", "view", "based", "on", "standard", "free", "-", "moving", "fling", "behavior", ".", "The", "caller", "should", "invoke", "{", "@link", "#continueSettling", "(", "boolean", ")", "}", "on", "each", "subsequent", "frame", "to", "con...
train
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L720-L732
strator-dev/greenpepper-open
confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/historic/LinearExecutionChartBuilder.java
LinearExecutionChartBuilder.newInstance
public static AbstractChartBuilder newInstance(HistoricParameters settings, List<Execution> executions) { return new LinearExecutionChartBuilder(settings, executions); }
java
public static AbstractChartBuilder newInstance(HistoricParameters settings, List<Execution> executions) { return new LinearExecutionChartBuilder(settings, executions); }
[ "public", "static", "AbstractChartBuilder", "newInstance", "(", "HistoricParameters", "settings", ",", "List", "<", "Execution", ">", "executions", ")", "{", "return", "new", "LinearExecutionChartBuilder", "(", "settings", ",", "executions", ")", ";", "}" ]
<p>newInstance.</p> @param settings a {@link com.greenpepper.confluence.macros.historic.HistoricParameters} object. @param executions a {@link java.util.List} object. @return a {@link com.greenpepper.confluence.macros.historic.AbstractChartBuilder} object.
[ "<p", ">", "newInstance", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/historic/LinearExecutionChartBuilder.java#L70-L73
playn/playn
scene/src/playn/scene/LayerUtil.java
LayerUtil.layerToParent
public static Point layerToParent(Layer layer, Layer parent, float x, float y) { Point into = new Point(x, y); return layerToParent(layer, parent, into, into); }
java
public static Point layerToParent(Layer layer, Layer parent, float x, float y) { Point into = new Point(x, y); return layerToParent(layer, parent, into, into); }
[ "public", "static", "Point", "layerToParent", "(", "Layer", "layer", ",", "Layer", "parent", ",", "float", "x", ",", "float", "y", ")", "{", "Point", "into", "=", "new", "Point", "(", "x", ",", "y", ")", ";", "return", "layerToParent", "(", "layer", ...
Converts the supplied point from coordinates relative to the specified child layer to coordinates relative to the specified parent layer.
[ "Converts", "the", "supplied", "point", "from", "coordinates", "relative", "to", "the", "specified", "child", "layer", "to", "coordinates", "relative", "to", "the", "specified", "parent", "layer", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L74-L77
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java
CacheProviderWrapper.removeAlias
@Override public void removeAlias(Object alias, boolean askPermission, boolean coordinate) { final String methodName = "removeAlias()"; if (this.featureSupport.isAliasSupported()) { if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet"); } } else { Tr.error(tc, "DYNA1063E", new Object[] { methodName, cacheName, this.cacheProviderName }); } return; }
java
@Override public void removeAlias(Object alias, boolean askPermission, boolean coordinate) { final String methodName = "removeAlias()"; if (this.featureSupport.isAliasSupported()) { if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet"); } } else { Tr.error(tc, "DYNA1063E", new Object[] { methodName, cacheName, this.cacheProviderName }); } return; }
[ "@", "Override", "public", "void", "removeAlias", "(", "Object", "alias", ",", "boolean", "askPermission", ",", "boolean", "coordinate", ")", "{", "final", "String", "methodName", "=", "\"removeAlias()\"", ";", "if", "(", "this", ".", "featureSupport", ".", "i...
Removes an alias from the cache mapping. @param alias the alias assoicated with cache id @param askPermission True implies that execution must ask the coordinating CacheUnit for permission (No effect on CoreCache). @param coordinate Indicates that the value should be set in other caches caching this value. (No effect on CoreCache)
[ "Removes", "an", "alias", "from", "the", "cache", "mapping", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L715-L726
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DirectUpdateDoublesSketchR.java
DirectUpdateDoublesSketchR.checkDirectMemCapacity
static void checkDirectMemCapacity(final int k, final long n, final long memCapBytes) { final int reqBufBytes = getUpdatableStorageBytes(k, n); if (memCapBytes < reqBufBytes) { throw new SketchesArgumentException("Possible corruption: Memory capacity too small: " + memCapBytes + " < " + reqBufBytes); } }
java
static void checkDirectMemCapacity(final int k, final long n, final long memCapBytes) { final int reqBufBytes = getUpdatableStorageBytes(k, n); if (memCapBytes < reqBufBytes) { throw new SketchesArgumentException("Possible corruption: Memory capacity too small: " + memCapBytes + " < " + reqBufBytes); } }
[ "static", "void", "checkDirectMemCapacity", "(", "final", "int", "k", ",", "final", "long", "n", ",", "final", "long", "memCapBytes", ")", "{", "final", "int", "reqBufBytes", "=", "getUpdatableStorageBytes", "(", "k", ",", "n", ")", ";", "if", "(", "memCap...
Checks the validity of the direct memory capacity assuming n, k. @param k the given value of k @param n the given value of n @param memCapBytes the current memory capacity in bytes
[ "Checks", "the", "validity", "of", "the", "direct", "memory", "capacity", "assuming", "n", "k", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DirectUpdateDoublesSketchR.java#L193-L200
EdwardRaff/JSAT
JSAT/src/jsat/driftdetectors/ADWIN.java
ADWIN.setDelta
public void setDelta(double delta) { if(delta <= 0 || delta >= 1 || Double.isNaN(delta)) throw new IllegalArgumentException("delta must be in (0,1), not " + delta); this.delta = delta; }
java
public void setDelta(double delta) { if(delta <= 0 || delta >= 1 || Double.isNaN(delta)) throw new IllegalArgumentException("delta must be in (0,1), not " + delta); this.delta = delta; }
[ "public", "void", "setDelta", "(", "double", "delta", ")", "{", "if", "(", "delta", "<=", "0", "||", "delta", ">=", "1", "||", "Double", ".", "isNaN", "(", "delta", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"delta must be in (0,1), not \""...
Sets the upper bound on the false positive rate for detecting concept drifts @param delta the upper bound on false positives in (0,1)
[ "Sets", "the", "upper", "bound", "on", "the", "false", "positive", "rate", "for", "detecting", "concept", "drifts" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/driftdetectors/ADWIN.java#L98-L103
FXMisc/RichTextFX
richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java
MultiChangeBuilder.insertAbsolutely
public MultiChangeBuilder<PS, SEG, S> insertAbsolutely(int paragraphIndex, int columnPosition, StyledDocument<PS, SEG, S> document) { int pos = area.getAbsolutePosition(paragraphIndex, columnPosition); return replaceAbsolutely(pos, pos, document); }
java
public MultiChangeBuilder<PS, SEG, S> insertAbsolutely(int paragraphIndex, int columnPosition, StyledDocument<PS, SEG, S> document) { int pos = area.getAbsolutePosition(paragraphIndex, columnPosition); return replaceAbsolutely(pos, pos, document); }
[ "public", "MultiChangeBuilder", "<", "PS", ",", "SEG", ",", "S", ">", "insertAbsolutely", "(", "int", "paragraphIndex", ",", "int", "columnPosition", ",", "StyledDocument", "<", "PS", ",", "SEG", ",", "S", ">", "document", ")", "{", "int", "pos", "=", "a...
Inserts the given rich-text content at the position returned from {@code getAbsolutePosition(paragraphIndex, columnPosition)}. <p><b>Caution:</b> see {@link StyledDocument#getAbsolutePosition(int, int)} to know how the column index argument can affect the returned position.</p> @param document The rich-text content to insert.
[ "Inserts", "the", "given", "rich", "-", "text", "content", "at", "the", "position", "returned", "from", "{", "@code", "getAbsolutePosition", "(", "paragraphIndex", "columnPosition", ")", "}", "." ]
train
https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java#L225-L228
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/DocumentEditor.java
DocumentEditor.doSetAllValues
protected void doSetAllValues( Map<? extends String, ?> values ) { if (values != null) { document.putAll(Utility.unwrapValues(values)); } }
java
protected void doSetAllValues( Map<? extends String, ?> values ) { if (values != null) { document.putAll(Utility.unwrapValues(values)); } }
[ "protected", "void", "doSetAllValues", "(", "Map", "<", "?", "extends", "String", ",", "?", ">", "values", ")", "{", "if", "(", "values", "!=", "null", ")", "{", "document", ".", "putAll", "(", "Utility", ".", "unwrapValues", "(", "values", ")", ")", ...
The method that does the actual setting for all of the {@link #putAll(Map)} method. This method may be overridden by subclasses when additional work needs to be performed during this operation. @param values the map containing the fields to be added
[ "The", "method", "that", "does", "the", "actual", "setting", "for", "all", "of", "the", "{", "@link", "#putAll", "(", "Map", ")", "}", "method", ".", "This", "method", "may", "be", "overridden", "by", "subclasses", "when", "additional", "work", "needs", ...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/internal/document/DocumentEditor.java#L615-L619
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.enterTextInWebElement
public void enterTextInWebElement(By by, String text){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "enterTextInWebElement("+by+", \""+text+"\")"); } if(waiter.waitForWebElement(by, 0, Timeout.getSmallTimeout(), false) == null) { Assert.fail("WebElement with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' is not found!"); } webUtils.enterTextIntoWebElement(by, text); }
java
public void enterTextInWebElement(By by, String text){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "enterTextInWebElement("+by+", \""+text+"\")"); } if(waiter.waitForWebElement(by, 0, Timeout.getSmallTimeout(), false) == null) { Assert.fail("WebElement with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' is not found!"); } webUtils.enterTextIntoWebElement(by, text); }
[ "public", "void", "enterTextInWebElement", "(", "By", "by", ",", "String", "text", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"enterTextInWebElement(\"", "+", "by", "+", ...
Enters text in a WebElement matching the specified By object. @param by the By object. Examples are: {@code By.id("id")} and {@code By.name("name")} @param text the text to enter in the {@link WebElement} field
[ "Enters", "text", "in", "a", "WebElement", "matching", "the", "specified", "By", "object", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2695-L2704
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/RSA.java
RSA.encryptStr
@Deprecated public String encryptStr(String data, KeyType keyType, Charset charset) { return encryptBcd(data, keyType, charset); }
java
@Deprecated public String encryptStr(String data, KeyType keyType, Charset charset) { return encryptBcd(data, keyType, charset); }
[ "@", "Deprecated", "public", "String", "encryptStr", "(", "String", "data", ",", "KeyType", "keyType", ",", "Charset", "charset", ")", "{", "return", "encryptBcd", "(", "data", ",", "keyType", ",", "charset", ")", ";", "}" ]
分组加密 @param data 数据 @param keyType 密钥类型 @param charset 加密前编码 @return 加密后的密文 @throws CryptoException 加密异常 @since 3.1.1 @deprecated 请使用 {@link #encryptBcd(String, KeyType, Charset)}
[ "分组加密" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/RSA.java#L143-L146
agmip/agmip-common-functions
src/main/java/org/agmip/common/Event.java
Event.updateEvent
public void updateEvent(String key, String value, boolean useTemp, boolean toNext) { if (isEventExist()) { getCurrentEvent().put(key, value); } else { HashMap tmp; if ("date".equals(key)) { tmp = addEvent(value, useTemp); } else { tmp = addEvent(null, useTemp); } tmp.putAll(template); tmp.put(key, value); } if (toNext) { getNextEventIndex(); } }
java
public void updateEvent(String key, String value, boolean useTemp, boolean toNext) { if (isEventExist()) { getCurrentEvent().put(key, value); } else { HashMap tmp; if ("date".equals(key)) { tmp = addEvent(value, useTemp); } else { tmp = addEvent(null, useTemp); } tmp.putAll(template); tmp.put(key, value); } if (toNext) { getNextEventIndex(); } }
[ "public", "void", "updateEvent", "(", "String", "key", ",", "String", "value", ",", "boolean", "useTemp", ",", "boolean", "toNext", ")", "{", "if", "(", "isEventExist", "(", ")", ")", "{", "getCurrentEvent", "(", ")", ".", "put", "(", "key", ",", "valu...
Update the current event with given key and value, if current event not available, add a new one into array @param key The variable's key for a event @param value The input value for the key @param useTemp The flag for if using the template to build new event @param toNext The flag for if move the pointer to the next event
[ "Update", "the", "current", "event", "with", "given", "key", "and", "value", "if", "current", "event", "not", "available", "add", "a", "new", "one", "into", "array" ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/common/Event.java#L98-L114
google/closure-compiler
src/com/google/javascript/jscomp/StatementFusion.java
StatementFusion.fuseIntoOneStatement
private static Node fuseIntoOneStatement(Node parent, Node first, Node last) { // Nothing to fuse if there is only one statement. if (first.getNext() == last) { return first; } // Step one: Create a comma tree that contains all the statements. Node commaTree = first.removeFirstChild(); Node next = null; for (Node cur = first.getNext(); cur != last; cur = next) { commaTree = fuseExpressionIntoExpression( commaTree, cur.removeFirstChild()); next = cur.getNext(); parent.removeChild(cur); } // Step two: The last EXPR_RESULT will now hold the comma tree with all // the fused statements. first.addChildToBack(commaTree); return first; }
java
private static Node fuseIntoOneStatement(Node parent, Node first, Node last) { // Nothing to fuse if there is only one statement. if (first.getNext() == last) { return first; } // Step one: Create a comma tree that contains all the statements. Node commaTree = first.removeFirstChild(); Node next = null; for (Node cur = first.getNext(); cur != last; cur = next) { commaTree = fuseExpressionIntoExpression( commaTree, cur.removeFirstChild()); next = cur.getNext(); parent.removeChild(cur); } // Step two: The last EXPR_RESULT will now hold the comma tree with all // the fused statements. first.addChildToBack(commaTree); return first; }
[ "private", "static", "Node", "fuseIntoOneStatement", "(", "Node", "parent", ",", "Node", "first", ",", "Node", "last", ")", "{", "// Nothing to fuse if there is only one statement.", "if", "(", "first", ".", "getNext", "(", ")", "==", "last", ")", "{", "return",...
Given a block, fuse a list of statements with comma's. @param parent The parent that contains the statements. @param first The first statement to fuse (inclusive) @param last The last statement to fuse (exclusive) @return A single statement that contains all the fused statement as one.
[ "Given", "a", "block", "fuse", "a", "list", "of", "statements", "with", "comma", "s", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/StatementFusion.java#L164-L185
Impetus/Kundera
src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java
HibernateClient.findByQuery
public List findByQuery(String query, Map<Parameter, Object> parameterMap, int firstResult, int maxResult) { s = getStatelessSession(); Query q = s.createQuery(query); q.setFirstResult(firstResult); q.setMaxResults(maxResult); setParameters(parameterMap, q); return q.list(); }
java
public List findByQuery(String query, Map<Parameter, Object> parameterMap, int firstResult, int maxResult) { s = getStatelessSession(); Query q = s.createQuery(query); q.setFirstResult(firstResult); q.setMaxResults(maxResult); setParameters(parameterMap, q); return q.list(); }
[ "public", "List", "findByQuery", "(", "String", "query", ",", "Map", "<", "Parameter", ",", "Object", ">", "parameterMap", ",", "int", "firstResult", ",", "int", "maxResult", ")", "{", "s", "=", "getStatelessSession", "(", ")", ";", "Query", "q", "=", "s...
Find. @param query the native fquery @param parameterMap the parameter map @param maxResult @param firstResult @return the list
[ "Find", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/HibernateClient.java#L594-L605
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/MkCoPTreeIndex.java
MkCoPTreeIndex.createNewLeafEntry
protected MkCoPEntry createNewLeafEntry(DBID id, O object, double parentDistance) { MkCoPLeafEntry leafEntry = new MkCoPLeafEntry(id, parentDistance, null, null); return leafEntry; }
java
protected MkCoPEntry createNewLeafEntry(DBID id, O object, double parentDistance) { MkCoPLeafEntry leafEntry = new MkCoPLeafEntry(id, parentDistance, null, null); return leafEntry; }
[ "protected", "MkCoPEntry", "createNewLeafEntry", "(", "DBID", "id", ",", "O", "object", ",", "double", "parentDistance", ")", "{", "MkCoPLeafEntry", "leafEntry", "=", "new", "MkCoPLeafEntry", "(", "id", ",", "parentDistance", ",", "null", ",", "null", ")", ";"...
Creates a new leaf entry representing the specified data object in the specified subtree. @param object the data object to be represented by the new entry @param parentDistance the distance from the object to the routing object of the parent node
[ "Creates", "a", "new", "leaf", "entry", "representing", "the", "specified", "data", "object", "in", "the", "specified", "subtree", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkcop/MkCoPTreeIndex.java#L78-L81
Ordinastie/MalisisCore
src/main/java/net/malisis/core/registry/MalisisRegistry.java
MalisisRegistry.registerBlockRenderer
@SideOnly(Side.CLIENT) public static void registerBlockRenderer(Block block, IBlockRenderer renderer) { clientRegistry.blockRenderers.put(checkNotNull(block), checkNotNull(renderer)); Item item = Item.getItemFromBlock(block); if (item != null) clientRegistry.itemRenderers.put(item, renderer); }
java
@SideOnly(Side.CLIENT) public static void registerBlockRenderer(Block block, IBlockRenderer renderer) { clientRegistry.blockRenderers.put(checkNotNull(block), checkNotNull(renderer)); Item item = Item.getItemFromBlock(block); if (item != null) clientRegistry.itemRenderers.put(item, renderer); }
[ "@", "SideOnly", "(", "Side", ".", "CLIENT", ")", "public", "static", "void", "registerBlockRenderer", "(", "Block", "block", ",", "IBlockRenderer", "renderer", ")", "{", "clientRegistry", ".", "blockRenderers", ".", "put", "(", "checkNotNull", "(", "block", "...
Registers a {@link IBlockRenderer} for the {@link Block}, and its {@link Item} if any. @param block the block @param renderer the renderer
[ "Registers", "a", "{", "@link", "IBlockRenderer", "}", "for", "the", "{", "@link", "Block", "}", "and", "its", "{", "@link", "Item", "}", "if", "any", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/MalisisRegistry.java#L198-L205
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java
BaseNeo4jAssociationQueries.createRelationshipforCollectionOfComponents
private void createRelationshipforCollectionOfComponents(AssociationKey associationKey, String collectionRole, String[] embeddedColumnNames, Object[] embeddedColumnValues, StringBuilder queryBuilder) { int offset = associationKey.getEntityKey().getColumnNames().length; if ( isPartOfEmbedded( collectionRole ) ) { String[] pathToEmbedded = appendEmbeddedNodes( collectionRole, queryBuilder ); queryBuilder.append( " MERGE (e) -[r:" ); appendRelationshipType( queryBuilder, pathToEmbedded[pathToEmbedded.length - 1] ); } else { queryBuilder.append( " MERGE (owner) -[r:" ); appendRelationshipType( queryBuilder, collectionRole ); } appendProperties( queryBuilder, associationKey.getMetadata().getRowKeyIndexColumnNames(), offset ); offset += associationKey.getMetadata().getRowKeyIndexColumnNames().length; queryBuilder.append( "]-> " ); queryBuilder.append( "(target:" ); queryBuilder.append( EMBEDDED ); queryBuilder.append( ":" ); escapeIdentifier( queryBuilder, associationKey.getMetadata().getAssociatedEntityKeyMetadata().getEntityKeyMetadata().getTable() ); int index = 0; int embeddedNumber = 0; EmbeddedNodesTree tree = createEmbeddedTree( collectionRole, embeddedColumnNames, embeddedColumnValues, offset ); if ( !hasRowIndex( associationKey ) ) { appendPrimitiveProperties( queryBuilder, index, tree ); } queryBuilder.append( ")" ); // Append relationships representing embedded properties Map<String, EmbeddedNodesTree> children = tree.getChildren(); boolean first = true; for ( Entry<String, EmbeddedNodesTree> entry : children.entrySet() ) { index = 0; String relationshipType = entry.getKey(); EmbeddedNodesTree child = entry.getValue(); if ( first ) { first = false; } else { queryBuilder.append( ", (target)" ); } queryBuilder.append( " - [:" ); appendRelationshipType( queryBuilder, relationshipType ); queryBuilder.append( "] -> " ); queryBuilder.append( "(a" ); queryBuilder.append( embeddedNumber++ ); queryBuilder.append( ":" ); queryBuilder.append( EMBEDDED ); appendPrimitiveProperties( queryBuilder, index, child ); queryBuilder.append( ")" ); } if ( hasRowIndex( associationKey ) && !tree.getProperties().isEmpty() ) { queryBuilder.append( " SET target = " ); appendPrimitiveProperties( queryBuilder, index, tree ); } queryBuilder.append( " RETURN r" ); }
java
private void createRelationshipforCollectionOfComponents(AssociationKey associationKey, String collectionRole, String[] embeddedColumnNames, Object[] embeddedColumnValues, StringBuilder queryBuilder) { int offset = associationKey.getEntityKey().getColumnNames().length; if ( isPartOfEmbedded( collectionRole ) ) { String[] pathToEmbedded = appendEmbeddedNodes( collectionRole, queryBuilder ); queryBuilder.append( " MERGE (e) -[r:" ); appendRelationshipType( queryBuilder, pathToEmbedded[pathToEmbedded.length - 1] ); } else { queryBuilder.append( " MERGE (owner) -[r:" ); appendRelationshipType( queryBuilder, collectionRole ); } appendProperties( queryBuilder, associationKey.getMetadata().getRowKeyIndexColumnNames(), offset ); offset += associationKey.getMetadata().getRowKeyIndexColumnNames().length; queryBuilder.append( "]-> " ); queryBuilder.append( "(target:" ); queryBuilder.append( EMBEDDED ); queryBuilder.append( ":" ); escapeIdentifier( queryBuilder, associationKey.getMetadata().getAssociatedEntityKeyMetadata().getEntityKeyMetadata().getTable() ); int index = 0; int embeddedNumber = 0; EmbeddedNodesTree tree = createEmbeddedTree( collectionRole, embeddedColumnNames, embeddedColumnValues, offset ); if ( !hasRowIndex( associationKey ) ) { appendPrimitiveProperties( queryBuilder, index, tree ); } queryBuilder.append( ")" ); // Append relationships representing embedded properties Map<String, EmbeddedNodesTree> children = tree.getChildren(); boolean first = true; for ( Entry<String, EmbeddedNodesTree> entry : children.entrySet() ) { index = 0; String relationshipType = entry.getKey(); EmbeddedNodesTree child = entry.getValue(); if ( first ) { first = false; } else { queryBuilder.append( ", (target)" ); } queryBuilder.append( " - [:" ); appendRelationshipType( queryBuilder, relationshipType ); queryBuilder.append( "] -> " ); queryBuilder.append( "(a" ); queryBuilder.append( embeddedNumber++ ); queryBuilder.append( ":" ); queryBuilder.append( EMBEDDED ); appendPrimitiveProperties( queryBuilder, index, child ); queryBuilder.append( ")" ); } if ( hasRowIndex( associationKey ) && !tree.getProperties().isEmpty() ) { queryBuilder.append( " SET target = " ); appendPrimitiveProperties( queryBuilder, index, tree ); } queryBuilder.append( " RETURN r" ); }
[ "private", "void", "createRelationshipforCollectionOfComponents", "(", "AssociationKey", "associationKey", ",", "String", "collectionRole", ",", "String", "[", "]", "embeddedColumnNames", ",", "Object", "[", "]", "embeddedColumnValues", ",", "StringBuilder", "queryBuilder",...
/* Example 1: MATCH (owner:ENTITY:MultiAddressAccount {login: {0}}) MERGE (owner) -[r:addresses {name: {1}}]-> (target:EMBEDDED:`MultiAddressAccount_addresses`) SET target = {city: {2}, country: {3}} RETURN r Example 2: MATCH (owner:ENTITY:StoryGame {id: {0}}) - [:goodBranch] -> (e:EMBEDDED) CREATE (e) -[r:additionalEndings {name: {1}]-> (target:EMBEDDED:`StoryGame_goodBranch.additionalEndings` {score: {2}, text: {3}}) RETURN r
[ "/", "*", "Example", "1", ":" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java#L360-L416
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendarWeek.java
ProjectCalendarWeek.setWorkingDay
public void setWorkingDay(Day day, DayType working) { DayType value; if (working == null) { if (isDerived()) { value = DayType.DEFAULT; } else { value = DayType.WORKING; } } else { value = working; } m_days[day.getValue() - 1] = value; }
java
public void setWorkingDay(Day day, DayType working) { DayType value; if (working == null) { if (isDerived()) { value = DayType.DEFAULT; } else { value = DayType.WORKING; } } else { value = working; } m_days[day.getValue() - 1] = value; }
[ "public", "void", "setWorkingDay", "(", "Day", "day", ",", "DayType", "working", ")", "{", "DayType", "value", ";", "if", "(", "working", "==", "null", ")", "{", "if", "(", "isDerived", "(", ")", ")", "{", "value", "=", "DayType", ".", "DEFAULT", ";"...
This is a convenience method provided to allow a day to be set as working or non-working, by using the day number to identify the required day. @param day required day @param working flag indicating if the day is a working day
[ "This", "is", "a", "convenience", "method", "provided", "to", "allow", "a", "day", "to", "be", "set", "as", "working", "or", "non", "-", "working", "by", "using", "the", "day", "number", "to", "identify", "the", "required", "day", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L307-L328
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java
TemplateList.putHead
private void putHead(String key, TemplateSubPatternAssociation assoc) { if (key.equals(PsuedoNames.PSEUDONAME_TEXT)) m_textPatterns = assoc; else if (key.equals(PsuedoNames.PSEUDONAME_ROOT)) m_docPatterns = assoc; else if (key.equals(PsuedoNames.PSEUDONAME_COMMENT)) m_commentPatterns = assoc; m_patternTable.put(key, assoc); }
java
private void putHead(String key, TemplateSubPatternAssociation assoc) { if (key.equals(PsuedoNames.PSEUDONAME_TEXT)) m_textPatterns = assoc; else if (key.equals(PsuedoNames.PSEUDONAME_ROOT)) m_docPatterns = assoc; else if (key.equals(PsuedoNames.PSEUDONAME_COMMENT)) m_commentPatterns = assoc; m_patternTable.put(key, assoc); }
[ "private", "void", "putHead", "(", "String", "key", ",", "TemplateSubPatternAssociation", "assoc", ")", "{", "if", "(", "key", ".", "equals", "(", "PsuedoNames", ".", "PSEUDONAME_TEXT", ")", ")", "m_textPatterns", "=", "assoc", ";", "else", "if", "(", "key",...
Get the head of the assocation list that is keyed by target. @param key @param assoc
[ "Get", "the", "head", "of", "the", "assocation", "list", "that", "is", "keyed", "by", "target", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L842-L853
BoltsFramework/Bolts-Android
bolts-tasks/src/main/java/bolts/Task.java
Task.waitForCompletion
public boolean waitForCompletion(long duration, TimeUnit timeUnit) throws InterruptedException { synchronized (lock) { if (!isCompleted()) { lock.wait(timeUnit.toMillis(duration)); } return isCompleted(); } }
java
public boolean waitForCompletion(long duration, TimeUnit timeUnit) throws InterruptedException { synchronized (lock) { if (!isCompleted()) { lock.wait(timeUnit.toMillis(duration)); } return isCompleted(); } }
[ "public", "boolean", "waitForCompletion", "(", "long", "duration", ",", "TimeUnit", "timeUnit", ")", "throws", "InterruptedException", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "!", "isCompleted", "(", ")", ")", "{", "lock", ".", "wait", "(", ...
Blocks until the task is complete or times out. @return {@code true} if the task completed (has a result, an error, or was cancelled). {@code false} otherwise.
[ "Blocks", "until", "the", "task", "is", "complete", "or", "times", "out", "." ]
train
https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L189-L196
FINRAOS/JTAF-ExtWebDriver
src/main/java/org/finra/jtaf/ewd/widget/element/Element.java
Element.waitForAttributePatternMatcher
private void waitForAttributePatternMatcher(String attributeName, String pattern, long timeout, boolean waitCondition) throws WidgetException { long start = System.currentTimeMillis(); long end = start + timeout; while (System.currentTimeMillis() < end) { String attribute = getAttribute(attributeName); if (attribute != null && attribute.matches(pattern) == waitCondition) return; try { Thread.sleep(DEFAULT_INTERVAL); } catch (InterruptedException e) { throw new RuntimeException(e); } } throw new TimeOutException("waitForAttribute " + " : timeout : Locator : " + locator + " Attribute : " + attributeName); }
java
private void waitForAttributePatternMatcher(String attributeName, String pattern, long timeout, boolean waitCondition) throws WidgetException { long start = System.currentTimeMillis(); long end = start + timeout; while (System.currentTimeMillis() < end) { String attribute = getAttribute(attributeName); if (attribute != null && attribute.matches(pattern) == waitCondition) return; try { Thread.sleep(DEFAULT_INTERVAL); } catch (InterruptedException e) { throw new RuntimeException(e); } } throw new TimeOutException("waitForAttribute " + " : timeout : Locator : " + locator + " Attribute : " + attributeName); }
[ "private", "void", "waitForAttributePatternMatcher", "(", "String", "attributeName", ",", "String", "pattern", ",", "long", "timeout", ",", "boolean", "waitCondition", ")", "throws", "WidgetException", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "...
Matches an attribute value to a pattern that is passed. @param attributeName the attribute whose value os to be compared @param pattern the pattern to which to match @param timeout time in milliseconds after which request timeout occurs @param waitCondition true to match the attribute value and false to not match the value @throws WidgetException
[ "Matches", "an", "attribute", "value", "to", "a", "pattern", "that", "is", "passed", "." ]
train
https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/widget/element/Element.java#L980-L994
spring-projects/spring-social
spring-social-core/src/main/java/org/springframework/social/oauth2/OAuth2Template.java
OAuth2Template.createAccessGrant
protected AccessGrant createAccessGrant(String accessToken, String scope, String refreshToken, Long expiresIn, Map<String, Object> response) { return new AccessGrant(accessToken, scope, refreshToken, expiresIn); }
java
protected AccessGrant createAccessGrant(String accessToken, String scope, String refreshToken, Long expiresIn, Map<String, Object> response) { return new AccessGrant(accessToken, scope, refreshToken, expiresIn); }
[ "protected", "AccessGrant", "createAccessGrant", "(", "String", "accessToken", ",", "String", "scope", ",", "String", "refreshToken", ",", "Long", "expiresIn", ",", "Map", "<", "String", ",", "Object", ">", "response", ")", "{", "return", "new", "AccessGrant", ...
Creates an {@link AccessGrant} given the response from the access token exchange with the provider. May be overridden to create a custom AccessGrant that captures provider-specific information from the access token response. @param accessToken the access token value received from the provider @param scope the scope of the access token @param refreshToken a refresh token value received from the provider @param expiresIn the time (in seconds) remaining before the access token expires. @param response all parameters from the response received in the access token exchange. @return an {@link AccessGrant}
[ "Creates", "an", "{" ]
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-core/src/main/java/org/springframework/social/oauth2/OAuth2Template.java#L260-L262
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java
SparkUtils.writeSchema
public static void writeSchema(String outputPath, Schema schema, JavaSparkContext sc) throws IOException { writeStringToFile(outputPath, schema.toString(), sc); }
java
public static void writeSchema(String outputPath, Schema schema, JavaSparkContext sc) throws IOException { writeStringToFile(outputPath, schema.toString(), sc); }
[ "public", "static", "void", "writeSchema", "(", "String", "outputPath", ",", "Schema", "schema", ",", "JavaSparkContext", "sc", ")", "throws", "IOException", "{", "writeStringToFile", "(", "outputPath", ",", "schema", ".", "toString", "(", ")", ",", "sc", ")",...
Write a schema to a HDFS (or, local) file in a human-readable format @param outputPath Output path to write to @param schema Schema to write @param sc Spark context
[ "Write", "a", "schema", "to", "a", "HDFS", "(", "or", "local", ")", "file", "in", "a", "human", "-", "readable", "format" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java#L227-L229
johnkil/Android-AppMsg
library/src/com/devspark/appmsg/AppMsg.java
AppMsg.setAnimation
public AppMsg setAnimation(int inAnimation, int outAnimation) { return setAnimation(AnimationUtils.loadAnimation(mActivity, inAnimation), AnimationUtils.loadAnimation(mActivity, outAnimation)); }
java
public AppMsg setAnimation(int inAnimation, int outAnimation) { return setAnimation(AnimationUtils.loadAnimation(mActivity, inAnimation), AnimationUtils.loadAnimation(mActivity, outAnimation)); }
[ "public", "AppMsg", "setAnimation", "(", "int", "inAnimation", ",", "int", "outAnimation", ")", "{", "return", "setAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "mActivity", ",", "inAnimation", ")", ",", "AnimationUtils", ".", "loadAnimation", "(",...
Sets the Animations to be used when displaying/removing the Crouton. @param inAnimation the Animation resource ID to be used when displaying. @param outAnimation the Animation resource ID to be used when removing.
[ "Sets", "the", "Animations", "to", "be", "used", "when", "displaying", "/", "removing", "the", "Crouton", "." ]
train
https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L602-L605
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpChain.java
HttpChain.postEvent
private void postEvent(String t, ActiveConfiguration c, Exception e) { Map<String, Object> eventProps = new HashMap<String, Object>(4); eventProps.put(HttpServiceConstants.ENDPOINT_NAME, endpointName); eventProps.put(HttpServiceConstants.ENDPOINT_ACTIVE_PORT, c.activePort); eventProps.put(HttpServiceConstants.ENDPOINT_CONFIG_HOST, c.configHost); eventProps.put(HttpServiceConstants.ENDPOINT_CONFIG_PORT, c.configPort); eventProps.put(HttpServiceConstants.ENDPOINT_IS_HTTPS, isHttps); if (e != null) { eventProps.put(HttpServiceConstants.ENDPOINT_EXCEPTION, e.toString()); } EventAdmin engine = owner.getEventAdmin(); if (engine != null) { Event event = new Event(t, eventProps); engine.postEvent(event); } }
java
private void postEvent(String t, ActiveConfiguration c, Exception e) { Map<String, Object> eventProps = new HashMap<String, Object>(4); eventProps.put(HttpServiceConstants.ENDPOINT_NAME, endpointName); eventProps.put(HttpServiceConstants.ENDPOINT_ACTIVE_PORT, c.activePort); eventProps.put(HttpServiceConstants.ENDPOINT_CONFIG_HOST, c.configHost); eventProps.put(HttpServiceConstants.ENDPOINT_CONFIG_PORT, c.configPort); eventProps.put(HttpServiceConstants.ENDPOINT_IS_HTTPS, isHttps); if (e != null) { eventProps.put(HttpServiceConstants.ENDPOINT_EXCEPTION, e.toString()); } EventAdmin engine = owner.getEventAdmin(); if (engine != null) { Event event = new Event(t, eventProps); engine.postEvent(event); } }
[ "private", "void", "postEvent", "(", "String", "t", ",", "ActiveConfiguration", "c", ",", "Exception", "e", ")", "{", "Map", "<", "String", ",", "Object", ">", "eventProps", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", "4", ")", ";", ...
Publish an event relating to a chain starting/stopping with the given properties set about the chain.
[ "Publish", "an", "event", "relating", "to", "a", "chain", "starting", "/", "stopping", "with", "the", "given", "properties", "set", "about", "the", "chain", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/HttpChain.java#L631-L649
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java
FeatureInfoBuilder.buildResultsInfoMessage
public String buildResultsInfoMessage(FeatureIndexResults results, double tolerance) { return buildResultsInfoMessage(results, tolerance, null, null); }
java
public String buildResultsInfoMessage(FeatureIndexResults results, double tolerance) { return buildResultsInfoMessage(results, tolerance, null, null); }
[ "public", "String", "buildResultsInfoMessage", "(", "FeatureIndexResults", "results", ",", "double", "tolerance", ")", "{", "return", "buildResultsInfoMessage", "(", "results", ",", "tolerance", ",", "null", ",", "null", ")", ";", "}" ]
Build a feature results information message @param results feature index results @param tolerance distance tolerance @return results message or null if no results
[ "Build", "a", "feature", "results", "information", "message" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java#L295-L297
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasTableController.java
CmsAliasTableController.editResourcePath
public void editResourcePath(CmsAliasTableRow row, String path) { row.setEdited(true); row.editResourcePath(path); validate(); }
java
public void editResourcePath(CmsAliasTableRow row, String path) { row.setEdited(true); row.editResourcePath(path); validate(); }
[ "public", "void", "editResourcePath", "(", "CmsAliasTableRow", "row", ",", "String", "path", ")", "{", "row", ".", "setEdited", "(", "true", ")", ";", "row", ".", "editResourcePath", "(", "path", ")", ";", "validate", "(", ")", ";", "}" ]
This method is called when the user has edited the resource path of an alias.<p> @param row the alias the table row @param path the new path
[ "This", "method", "is", "called", "when", "the", "user", "has", "edited", "the", "resource", "path", "of", "an", "alias", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasTableController.java#L217-L222
JodaOrg/joda-time
src/main/java/org/joda/time/TimeOfDay.java
TimeOfDay.withMinuteOfHour
public TimeOfDay withMinuteOfHour(int minute) { int[] newValues = getValues(); newValues = getChronology().minuteOfHour().set(this, MINUTE_OF_HOUR, newValues, minute); return new TimeOfDay(this, newValues); }
java
public TimeOfDay withMinuteOfHour(int minute) { int[] newValues = getValues(); newValues = getChronology().minuteOfHour().set(this, MINUTE_OF_HOUR, newValues, minute); return new TimeOfDay(this, newValues); }
[ "public", "TimeOfDay", "withMinuteOfHour", "(", "int", "minute", ")", "{", "int", "[", "]", "newValues", "=", "getValues", "(", ")", ";", "newValues", "=", "getChronology", "(", ")", ".", "minuteOfHour", "(", ")", ".", "set", "(", "this", ",", "MINUTE_OF...
Returns a copy of this time with the minute of hour field updated. <p> TimeOfDay is immutable, so there are no set methods. Instead, this method returns a new instance with the value of minute of hour changed. @param minute the minute of hour to set @return a copy of this object with the field set @throws IllegalArgumentException if the value is invalid @since 1.3
[ "Returns", "a", "copy", "of", "this", "time", "with", "the", "minute", "of", "hour", "field", "updated", ".", "<p", ">", "TimeOfDay", "is", "immutable", "so", "there", "are", "no", "set", "methods", ".", "Instead", "this", "method", "returns", "a", "new"...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/TimeOfDay.java#L918-L922
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BaseFont.java
BaseFont.getBaseName
protected static String getBaseName(String name) { if (name.endsWith(",Bold")) return name.substring(0, name.length() - 5); else if (name.endsWith(",Italic")) return name.substring(0, name.length() - 7); else if (name.endsWith(",BoldItalic")) return name.substring(0, name.length() - 11); else return name; }
java
protected static String getBaseName(String name) { if (name.endsWith(",Bold")) return name.substring(0, name.length() - 5); else if (name.endsWith(",Italic")) return name.substring(0, name.length() - 7); else if (name.endsWith(",BoldItalic")) return name.substring(0, name.length() - 11); else return name; }
[ "protected", "static", "String", "getBaseName", "(", "String", "name", ")", "{", "if", "(", "name", ".", "endsWith", "(", "\",Bold\"", ")", ")", "return", "name", ".", "substring", "(", "0", ",", "name", ".", "length", "(", ")", "-", "5", ")", ";", ...
Gets the name without the modifiers Bold, Italic or BoldItalic. @param name the full name of the font @return the name without the modifiers Bold, Italic or BoldItalic
[ "Gets", "the", "name", "without", "the", "modifiers", "Bold", "Italic", "or", "BoldItalic", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BaseFont.java#L723-L732
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java
ScriptContext.setNow
@Cmd public void setNow(final String key, final String value) { String resolvedValue = resolveProperty(value); doSet(key, resolvedValue); }
java
@Cmd public void setNow(final String key, final String value) { String resolvedValue = resolveProperty(value); doSet(key, resolvedValue); }
[ "@", "Cmd", "public", "void", "setNow", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "String", "resolvedValue", "=", "resolveProperty", "(", "value", ")", ";", "doSet", "(", "key", ",", "resolvedValue", ")", ";", "}" ]
Sets a property to a given value. Both key and value can contain properties. The following rules apply: <ul> <li>the key will be evaluated on execution of the closure</li> <li>the value will be evaluated on execution of the closure</li> <li>if the value should be evaluated on querying the property you need to use {@link #set(String, String)}</li> </ul> @param key the config key @param value the value to set
[ "Sets", "a", "property", "to", "a", "given", "value", ".", "Both", "key", "and", "value", "can", "contain", "properties", ".", "The", "following", "rules", "apply", ":", "<ul", ">", "<li", ">", "the", "key", "will", "be", "evaluated", "on", "execution", ...
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java#L793-L797
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/id/impl/OgmTableGenerator.java
OgmTableGenerator.determineValueColumnName
protected String determineValueColumnName(Properties params, Dialect dialect) { ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER ); String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN ); return normalizer.toDatabaseIdentifierText( name ); }
java
protected String determineValueColumnName(Properties params, Dialect dialect) { ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER ); String name = ConfigurationHelper.getString( VALUE_COLUMN_PARAM, params, DEF_VALUE_COLUMN ); return normalizer.toDatabaseIdentifierText( name ); }
[ "protected", "String", "determineValueColumnName", "(", "Properties", "params", ",", "Dialect", "dialect", ")", "{", "ObjectNameNormalizer", "normalizer", "=", "(", "ObjectNameNormalizer", ")", "params", ".", "get", "(", "PersistentIdentifierGenerator", ".", "IDENTIFIER...
Determine the name of the column in which we will store the generator persistent value. <p> Called during {@link #configure configuration}. @param params The params supplied in the generator config (plus some standard useful extras). @param dialect The dialect in effect @return The name of the value column
[ "Determine", "the", "name", "of", "the", "column", "in", "which", "we", "will", "store", "the", "generator", "persistent", "value", ".", "<p", ">", "Called", "during", "{", "@link", "#configure", "configuration", "}", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/id/impl/OgmTableGenerator.java#L235-L239
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.appendSeparator
public StrBuilder appendSeparator(final String separator, final int loopIndex) { if (separator != null && loopIndex > 0) { append(separator); } return this; }
java
public StrBuilder appendSeparator(final String separator, final int loopIndex) { if (separator != null && loopIndex > 0) { append(separator); } return this; }
[ "public", "StrBuilder", "appendSeparator", "(", "final", "String", "separator", ",", "final", "int", "loopIndex", ")", "{", "if", "(", "separator", "!=", "null", "&&", "loopIndex", ">", "0", ")", "{", "append", "(", "separator", ")", ";", "}", "return", ...
Appends a separator to the builder if the loop index is greater than zero. Appending a null separator will have no effect. The separator is appended using {@link #append(String)}. <p> This method is useful for adding a separator each time around the loop except the first. </p> <pre> for (int i = 0; i &lt; list.size(); i++) { appendSeparator(",", i); append(list.get(i)); } </pre> Note that for this simple example, you should use {@link #appendWithSeparators(Iterable, String)}. @param separator the separator to use, null means no separator @param loopIndex the loop index @return this, to enable chaining @since 2.3
[ "Appends", "a", "separator", "to", "the", "builder", "if", "the", "loop", "index", "is", "greater", "than", "zero", ".", "Appending", "a", "null", "separator", "will", "have", "no", "effect", ".", "The", "separator", "is", "appended", "using", "{", "@link"...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1437-L1442
spring-projects/spring-social
spring-social-core/src/main/java/org/springframework/social/oauth1/SigningSupport.java
SigningSupport.buildAuthorizationHeaderValue
public String buildAuthorizationHeaderValue(HttpMethod method, URI targetUrl, Map<String, String> oauthParameters, MultiValueMap<String, String> additionalParameters, String consumerSecret, String tokenSecret) { StringBuilder header = new StringBuilder(); header.append("OAuth "); for (Entry<String, String> entry : oauthParameters.entrySet()) { header.append(oauthEncode(entry.getKey())).append("=\"").append(oauthEncode(entry.getValue())).append("\", "); } MultiValueMap<String, String> collectedParameters = new LinkedMultiValueMap<String, String>((int) ((oauthParameters.size() + additionalParameters.size()) / .75 + 1)); collectedParameters.setAll(oauthParameters); collectedParameters.putAll(additionalParameters); String baseString = buildBaseString(method, getBaseStringUri(targetUrl), collectedParameters); String signature = calculateSignature(baseString, consumerSecret, tokenSecret); header.append(oauthEncode("oauth_signature")).append("=\"").append(oauthEncode(signature)).append("\""); return header.toString(); }
java
public String buildAuthorizationHeaderValue(HttpMethod method, URI targetUrl, Map<String, String> oauthParameters, MultiValueMap<String, String> additionalParameters, String consumerSecret, String tokenSecret) { StringBuilder header = new StringBuilder(); header.append("OAuth "); for (Entry<String, String> entry : oauthParameters.entrySet()) { header.append(oauthEncode(entry.getKey())).append("=\"").append(oauthEncode(entry.getValue())).append("\", "); } MultiValueMap<String, String> collectedParameters = new LinkedMultiValueMap<String, String>((int) ((oauthParameters.size() + additionalParameters.size()) / .75 + 1)); collectedParameters.setAll(oauthParameters); collectedParameters.putAll(additionalParameters); String baseString = buildBaseString(method, getBaseStringUri(targetUrl), collectedParameters); String signature = calculateSignature(baseString, consumerSecret, tokenSecret); header.append(oauthEncode("oauth_signature")).append("=\"").append(oauthEncode(signature)).append("\""); return header.toString(); }
[ "public", "String", "buildAuthorizationHeaderValue", "(", "HttpMethod", "method", ",", "URI", "targetUrl", ",", "Map", "<", "String", ",", "String", ">", "oauthParameters", ",", "MultiValueMap", "<", "String", ",", "String", ">", "additionalParameters", ",", "Stri...
Builds the authorization header. The elements in additionalParameters are expected to not be encoded.
[ "Builds", "the", "authorization", "header", ".", "The", "elements", "in", "additionalParameters", "are", "expected", "to", "not", "be", "encoded", "." ]
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-core/src/main/java/org/springframework/social/oauth1/SigningSupport.java#L56-L69
RKumsher/utils
src/main/java/com/github/rkumsher/date/RandomDateUtils.java
RandomDateUtils.randomDate
public static Date randomDate(Date startInclusive, Date endExclusive) { checkArgument(startInclusive != null, "Start must be non-null"); checkArgument(endExclusive != null, "End must be non-null"); Instant startInstant = startInclusive.toInstant(); Instant endInstant = endExclusive.toInstant(); Instant instant = randomInstant(startInstant, endInstant); return Date.from(instant); }
java
public static Date randomDate(Date startInclusive, Date endExclusive) { checkArgument(startInclusive != null, "Start must be non-null"); checkArgument(endExclusive != null, "End must be non-null"); Instant startInstant = startInclusive.toInstant(); Instant endInstant = endExclusive.toInstant(); Instant instant = randomInstant(startInstant, endInstant); return Date.from(instant); }
[ "public", "static", "Date", "randomDate", "(", "Date", "startInclusive", ",", "Date", "endExclusive", ")", "{", "checkArgument", "(", "startInclusive", "!=", "null", ",", "\"Start must be non-null\"", ")", ";", "checkArgument", "(", "endExclusive", "!=", "null", "...
Returns a random {@link Date} within the specified range. @param startInclusive the earliest {@link Date} that can be returned @param endExclusive the upper bound (not included) @return the random {@link Date} @throws IllegalArgumentException if startInclusive or endExclusive are null or if endExclusive is earlier than startInclusive
[ "Returns", "a", "random", "{", "@link", "Date", "}", "within", "the", "specified", "range", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L380-L387
h2oai/h2o-3
h2o-core/src/main/java/water/ExternalFrameUtils.java
ExternalFrameUtils.getConnection
public static ByteChannel getConnection(String h2oNodeHostname, int h2oNodeApiPort, short nodeTimeStamp) throws IOException{ SocketChannelFactory socketFactory = SocketChannelFactory.instance(H2OSecurityManager.instance()); return H2ONode.openChan(TCPReceiverThread.TCP_EXTERNAL, socketFactory, h2oNodeHostname, h2oNodeApiPort +1, nodeTimeStamp); }
java
public static ByteChannel getConnection(String h2oNodeHostname, int h2oNodeApiPort, short nodeTimeStamp) throws IOException{ SocketChannelFactory socketFactory = SocketChannelFactory.instance(H2OSecurityManager.instance()); return H2ONode.openChan(TCPReceiverThread.TCP_EXTERNAL, socketFactory, h2oNodeHostname, h2oNodeApiPort +1, nodeTimeStamp); }
[ "public", "static", "ByteChannel", "getConnection", "(", "String", "h2oNodeHostname", ",", "int", "h2oNodeApiPort", ",", "short", "nodeTimeStamp", ")", "throws", "IOException", "{", "SocketChannelFactory", "socketFactory", "=", "SocketChannelFactory", ".", "instance", "...
Get connection to a specific h2o node. The caller of this method is usually non-H2O node who wants to read H2O frames or write to H2O frames from non-H2O environment, such as Spark executor. This node usually does not have H2O running.
[ "Get", "connection", "to", "a", "specific", "h2o", "node", ".", "The", "caller", "of", "this", "method", "is", "usually", "non", "-", "H2O", "node", "who", "wants", "to", "read", "H2O", "frames", "or", "write", "to", "H2O", "frames", "from", "non", "-"...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/ExternalFrameUtils.java#L49-L52
Wikidata/Wikidata-Toolkit
wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java
ApiConnection.confirmLogin
@Deprecated void confirmLogin(String token, String username, String password) throws IOException, LoginFailedException, MediaWikiApiErrorException { Map<String, String> params = new HashMap<>(); params.put(ApiConnection.PARAM_ACTION, "login"); params.put(ApiConnection.PARAM_LOGIN_USERNAME, username); params.put(ApiConnection.PARAM_LOGIN_PASSWORD, password); params.put(ApiConnection.PARAM_LOGIN_TOKEN, token); JsonNode root = sendJsonRequest("POST", params); String result = root.path("login").path("result").textValue(); if (ApiConnection.LOGIN_RESULT_SUCCESS.equals(result)) { this.loggedIn = true; this.username = username; this.password = password; } else { String message = getLoginErrorMessage(result); logger.warn(message); if (ApiConnection.LOGIN_WRONG_TOKEN.equals(result)) { throw new NeedLoginTokenException(message); } else { throw new LoginFailedException(message); } } }
java
@Deprecated void confirmLogin(String token, String username, String password) throws IOException, LoginFailedException, MediaWikiApiErrorException { Map<String, String> params = new HashMap<>(); params.put(ApiConnection.PARAM_ACTION, "login"); params.put(ApiConnection.PARAM_LOGIN_USERNAME, username); params.put(ApiConnection.PARAM_LOGIN_PASSWORD, password); params.put(ApiConnection.PARAM_LOGIN_TOKEN, token); JsonNode root = sendJsonRequest("POST", params); String result = root.path("login").path("result").textValue(); if (ApiConnection.LOGIN_RESULT_SUCCESS.equals(result)) { this.loggedIn = true; this.username = username; this.password = password; } else { String message = getLoginErrorMessage(result); logger.warn(message); if (ApiConnection.LOGIN_WRONG_TOKEN.equals(result)) { throw new NeedLoginTokenException(message); } else { throw new LoginFailedException(message); } } }
[ "@", "Deprecated", "void", "confirmLogin", "(", "String", "token", ",", "String", "username", ",", "String", "password", ")", "throws", "IOException", ",", "LoginFailedException", ",", "MediaWikiApiErrorException", "{", "Map", "<", "String", ",", "String", ">", ...
Issues a Web API query to confirm that the previous login attempt was successful, and sets the internal state of the API connection accordingly in this case. @deprecated because it will be migrated to {@class PasswordApiConnection}. @param token the login token string @param username the name of the user that was logged in @param password the password used to log in @throws IOException @throws LoginFailedException
[ "Issues", "a", "Web", "API", "query", "to", "confirm", "that", "the", "previous", "login", "attempt", "was", "successful", "and", "sets", "the", "internal", "state", "of", "the", "API", "connection", "accordingly", "in", "this", "case", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/ApiConnection.java#L568-L593
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformTimestampToCalendar.java
TransformTimestampToCalendar.transformOut
@Override public Timestamp transformOut(JdbcPreparedStatementFactory jpsf, Calendar cal) throws CpoException { Timestamp ts = null; if (cal != null) { ts = new Timestamp(cal.getTimeInMillis()); } return ts; }
java
@Override public Timestamp transformOut(JdbcPreparedStatementFactory jpsf, Calendar cal) throws CpoException { Timestamp ts = null; if (cal != null) { ts = new Timestamp(cal.getTimeInMillis()); } return ts; }
[ "@", "Override", "public", "Timestamp", "transformOut", "(", "JdbcPreparedStatementFactory", "jpsf", ",", "Calendar", "cal", ")", "throws", "CpoException", "{", "Timestamp", "ts", "=", "null", ";", "if", "(", "cal", "!=", "null", ")", "{", "ts", "=", "new", ...
Transforms a <code>java.util.Calendar</code> from the CPO Bean into a <code>java.sql.Timestamp</code> to be stored by JDBC @param jpsf a reference to the JdbcPreparedStatementFactory. This is necessary as some DBMSs (ORACLE !#$%^&!) that require access to the connection to deal with certain datatypes. @param A Calendar instance @return A Timestamp object to be stored in the database. @throws CpoException
[ "Transforms", "a", "<code", ">", "java", ".", "util", ".", "Calendar<", "/", "code", ">", "from", "the", "CPO", "Bean", "into", "a", "<code", ">", "java", ".", "sql", ".", "Timestamp<", "/", "code", ">", "to", "be", "stored", "by", "JDBC" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformTimestampToCalendar.java#L90-L97
davidmarquis/fluent-interface-proxy
src/main/java/com/fluentinterface/beans/ObjectWrapper.java
ObjectWrapper.getIndexedValue
public Object getIndexedValue(String propertyName, int index) { return getIndexedValue(object, getPropertyOrThrow(bean, propertyName), index, this); }
java
public Object getIndexedValue(String propertyName, int index) { return getIndexedValue(object, getPropertyOrThrow(bean, propertyName), index, this); }
[ "public", "Object", "getIndexedValue", "(", "String", "propertyName", ",", "int", "index", ")", "{", "return", "getIndexedValue", "(", "object", ",", "getPropertyOrThrow", "(", "bean", ",", "propertyName", ")", ",", "index", ",", "this", ")", ";", "}" ]
Returns the value of the specified indexed property from the wrapped object. @param propertyName the name of the indexed property whose value is to be extracted, cannot be {@code null} @param index the index of the property value to be extracted @return the indexed property value @throws ReflectionException if a reflection error occurs @throws IllegalArgumentException if the propertyName parameter is {@code null} @throws IllegalArgumentException if the indexed object in the wrapped object is not a {@link List}, {@link Iterable} or {@code array} @throws NullPointerException if the indexed {@link List}, {@link Iterable} or {@code array} is {@code null} in the given object @throws NullPointerException if the wrapped object does not have a property with the given name @throws IndexOutOfBoundsException if the specified index is outside the valid range for the underlying indexed property
[ "Returns", "the", "value", "of", "the", "specified", "indexed", "property", "from", "the", "wrapped", "object", "." ]
train
https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/ObjectWrapper.java#L237-L239
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/stream/impl/DefaultJsonWriter.java
DefaultJsonWriter.open
private DefaultJsonWriter open(int empty, String openBracket) { beforeValue(true); push(empty); out.append(openBracket); return this; }
java
private DefaultJsonWriter open(int empty, String openBracket) { beforeValue(true); push(empty); out.append(openBracket); return this; }
[ "private", "DefaultJsonWriter", "open", "(", "int", "empty", ",", "String", "openBracket", ")", "{", "beforeValue", "(", "true", ")", ";", "push", "(", "empty", ")", ";", "out", ".", "append", "(", "openBracket", ")", ";", "return", "this", ";", "}" ]
Enters a new scope by appending any necessary whitespace and the given bracket.
[ "Enters", "a", "new", "scope", "by", "appending", "any", "necessary", "whitespace", "and", "the", "given", "bracket", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/stream/impl/DefaultJsonWriter.java#L276-L281
geomajas/geomajas-project-client-gwt2
plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/service/GeometryIndexService.java
GeometryIndexService.addChildren
public GeometryIndex addChildren(GeometryIndex index, GeometryIndexType type, int... values) { return fromDelegate(delegate.addChildren(toDelegate(index), toDelegate(type), values)); }
java
public GeometryIndex addChildren(GeometryIndex index, GeometryIndexType type, int... values) { return fromDelegate(delegate.addChildren(toDelegate(index), toDelegate(type), values)); }
[ "public", "GeometryIndex", "addChildren", "(", "GeometryIndex", "index", ",", "GeometryIndexType", "type", ",", "int", "...", "values", ")", "{", "return", "fromDelegate", "(", "delegate", ".", "addChildren", "(", "toDelegate", "(", "index", ")", ",", "toDelegat...
Given a certain geometry index, add more levels to it (This method will not change the underlying geometry !). @param index The index to start out from. @param type Add more levels to it, where the deepest level should be of this type. @param values A list of integer values that determine the indices on each level in the index. @return The recursive geometry index resulting from adding the given parameters to the given parent index.
[ "Given", "a", "certain", "geometry", "index", "add", "more", "levels", "to", "it", "(", "This", "method", "will", "not", "change", "the", "underlying", "geometry", "!", ")", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/service/GeometryIndexService.java#L61-L63
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java
TitlePaneMenuButtonPainter.decodeInterior
private Shape decodeInterior(int width, int height) { path.reset(); path.moveTo(1, 1); path.lineTo(width - 2, 1); path.lineTo(width - 2, height - 3); path.lineTo(width - 3, height - 2); path.lineTo(3, height - 2); path.lineTo(2, height - 3); path.closePath(); return path; }
java
private Shape decodeInterior(int width, int height) { path.reset(); path.moveTo(1, 1); path.lineTo(width - 2, 1); path.lineTo(width - 2, height - 3); path.lineTo(width - 3, height - 2); path.lineTo(3, height - 2); path.lineTo(2, height - 3); path.closePath(); return path; }
[ "private", "Shape", "decodeInterior", "(", "int", "width", ",", "int", "height", ")", "{", "path", ".", "reset", "(", ")", ";", "path", ".", "moveTo", "(", "1", ",", "1", ")", ";", "path", ".", "lineTo", "(", "width", "-", "2", ",", "1", ")", "...
Create the button interior shape @param width the width. @param height the height. @return the shape of the button interior.
[ "Create", "the", "button", "interior", "shape" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMenuButtonPainter.java#L197-L208
graknlabs/grakn
server/src/graql/exception/GraqlQueryException.java
GraqlQueryException.insertMultipleProperties
public static GraqlQueryException insertMultipleProperties( Statement varPattern, String property, Object value1, Object value2 ) { String message = "a concept `%s` cannot have multiple properties `%s` and `%s` for `%s`"; return create(message, varPattern, value1, value2, property); }
java
public static GraqlQueryException insertMultipleProperties( Statement varPattern, String property, Object value1, Object value2 ) { String message = "a concept `%s` cannot have multiple properties `%s` and `%s` for `%s`"; return create(message, varPattern, value1, value2, property); }
[ "public", "static", "GraqlQueryException", "insertMultipleProperties", "(", "Statement", "varPattern", ",", "String", "property", ",", "Object", "value1", ",", "Object", "value2", ")", "{", "String", "message", "=", "\"a concept `%s` cannot have multiple properties `%s` and...
Thrown when a concept is inserted with multiple properties when it can only have one. <p> For example: {@code insert $x isa movie; $x isa person;} </p>
[ "Thrown", "when", "a", "concept", "is", "inserted", "with", "multiple", "properties", "when", "it", "can", "only", "have", "one", ".", "<p", ">", "For", "example", ":", "{" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/exception/GraqlQueryException.java#L144-L149
fengwenyi/JavaLib
src/main/java/com/fengwenyi/javalib/third/Base64.java
Base64.base64toInt
private static int base64toInt(char c, byte[] alphaToInt) { int result = alphaToInt[c]; if (result < 0) { throw new IllegalArgumentException("Illegal character " + c); } return result; }
java
private static int base64toInt(char c, byte[] alphaToInt) { int result = alphaToInt[c]; if (result < 0) { throw new IllegalArgumentException("Illegal character " + c); } return result; }
[ "private", "static", "int", "base64toInt", "(", "char", "c", ",", "byte", "[", "]", "alphaToInt", ")", "{", "int", "result", "=", "alphaToInt", "[", "c", "]", ";", "if", "(", "result", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "("...
Translates the specified character, which is assumed to be in the "Base 64 Alphabet" into its equivalent 6-bit positive integer. @throw IllegalArgumentException or ArrayOutOfBoundsException if c is not in the Base64 Alphabet. @param c [ellipsis] @param alphaToInt [ellipsis] @return [ellipsis]
[ "Translates", "the", "specified", "character", "which", "is", "assumed", "to", "be", "in", "the", "Base", "64", "Alphabet", "into", "its", "equivalent", "6", "-", "bit", "positive", "integer", "." ]
train
https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/src/main/java/com/fengwenyi/javalib/third/Base64.java#L195-L201
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/git/GitService.java
GitService.checkinNewContent
public String checkinNewContent(String sourceDirectory, String message) throws Exception { RmCommand remove = git.rm(); boolean hasFiles = false; for(String filename : new File(getBaseDirectory()).list()) { if(!filename.equals(".git")) { remove.addFilepattern(filename); hasFiles = true; } } if(hasFiles) { log.info("Removing old content."); remove.call(); } log.info("Copying in new content."); FileSystemManager.copyAllContent(sourceDirectory, getBaseDirectory(), true); log.info("Adding new content."); AddCommand add = git.add(); for(String filename : new File(getBaseDirectory()).list()) { if(!filename.equals(".git")) { add.addFilepattern(filename); } } add.call(); log.info("Committing new content."); git.commit().setMessage(message).call(); return getCurrentRevision(); }
java
public String checkinNewContent(String sourceDirectory, String message) throws Exception { RmCommand remove = git.rm(); boolean hasFiles = false; for(String filename : new File(getBaseDirectory()).list()) { if(!filename.equals(".git")) { remove.addFilepattern(filename); hasFiles = true; } } if(hasFiles) { log.info("Removing old content."); remove.call(); } log.info("Copying in new content."); FileSystemManager.copyAllContent(sourceDirectory, getBaseDirectory(), true); log.info("Adding new content."); AddCommand add = git.add(); for(String filename : new File(getBaseDirectory()).list()) { if(!filename.equals(".git")) { add.addFilepattern(filename); } } add.call(); log.info("Committing new content."); git.commit().setMessage(message).call(); return getCurrentRevision(); }
[ "public", "String", "checkinNewContent", "(", "String", "sourceDirectory", ",", "String", "message", ")", "throws", "Exception", "{", "RmCommand", "remove", "=", "git", ".", "rm", "(", ")", ";", "boolean", "hasFiles", "=", "false", ";", "for", "(", "String",...
Checks in content from a source directory into the current git repository. @param sourceDirectory The directory to pull content in from. @param message The commit message to use. @return The new SHA revision. @throws Exception
[ "Checks", "in", "content", "from", "a", "source", "directory", "into", "the", "current", "git", "repository", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/git/GitService.java#L578-L604
threerings/nenya
core/src/main/java/com/threerings/cast/CharacterComponent.java
CharacterComponent.getFramePath
public String getFramePath (String action, String type, Set<String> existentPaths) { return _frameProvider.getFramePath(this, action, type, existentPaths); }
java
public String getFramePath (String action, String type, Set<String> existentPaths) { return _frameProvider.getFramePath(this, action, type, existentPaths); }
[ "public", "String", "getFramePath", "(", "String", "action", ",", "String", "type", ",", "Set", "<", "String", ">", "existentPaths", ")", "{", "return", "_frameProvider", ".", "getFramePath", "(", "this", ",", "action", ",", "type", ",", "existentPaths", ")"...
Returns the path to the image frames for the specified action animation or null if no animation for the specified action is available for this component. @param type null for the normal action frames or one of the custom action sub-types: {@link StandardActions#SHADOW_TYPE}, etc. @param existentPaths the set of all paths for which there are valid frames.
[ "Returns", "the", "path", "to", "the", "image", "frames", "for", "the", "specified", "action", "animation", "or", "null", "if", "no", "animation", "for", "the", "specified", "action", "is", "available", "for", "this", "component", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterComponent.java#L88-L91
VoltDB/voltdb
src/frontend/org/voltdb/messaging/FragmentTaskMessage.java
FragmentTaskMessage.addCustomFragment
public void addCustomFragment(byte[] planHash, int outputDepId, ByteBuffer parameterSet, byte[] fragmentPlan, String stmtText) { FragmentData item = new FragmentData(); item.m_planHash = planHash; item.m_outputDepId = outputDepId; item.m_parameterSet = parameterSet; item.m_fragmentPlan = fragmentPlan; item.m_stmtText = stmtText.getBytes(); m_items.add(item); }
java
public void addCustomFragment(byte[] planHash, int outputDepId, ByteBuffer parameterSet, byte[] fragmentPlan, String stmtText) { FragmentData item = new FragmentData(); item.m_planHash = planHash; item.m_outputDepId = outputDepId; item.m_parameterSet = parameterSet; item.m_fragmentPlan = fragmentPlan; item.m_stmtText = stmtText.getBytes(); m_items.add(item); }
[ "public", "void", "addCustomFragment", "(", "byte", "[", "]", "planHash", ",", "int", "outputDepId", ",", "ByteBuffer", "parameterSet", ",", "byte", "[", "]", "fragmentPlan", ",", "String", "stmtText", ")", "{", "FragmentData", "item", "=", "new", "FragmentDat...
Add an unplanned fragment. @param fragmentId @param outputDepId @param parameterSet @param fragmentPlan
[ "Add", "an", "unplanned", "fragment", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/messaging/FragmentTaskMessage.java#L312-L320
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/util/logging/ExceptionLogger.java
ExceptionLogger.getConsumer
@SafeVarargs public static Consumer<Throwable> getConsumer(Predicate<Throwable> logFilter, Class<? extends Throwable>... ignoredThrowableTypes) { return get(logFilter, ignoredThrowableTypes)::apply; }
java
@SafeVarargs public static Consumer<Throwable> getConsumer(Predicate<Throwable> logFilter, Class<? extends Throwable>... ignoredThrowableTypes) { return get(logFilter, ignoredThrowableTypes)::apply; }
[ "@", "SafeVarargs", "public", "static", "Consumer", "<", "Throwable", ">", "getConsumer", "(", "Predicate", "<", "Throwable", ">", "logFilter", ",", "Class", "<", "?", "extends", "Throwable", ">", "...", "ignoredThrowableTypes", ")", "{", "return", "get", "(",...
Returns a consumer that can for example be used in the {@link TextChannel#typeContinuously(Consumer)} method. It unwraps {@link CompletionException CompletionExceptions}, {@link InvocationTargetException InvocationTargetExceptions} and {@link ExecutionException ExecutionExceptions} first, and then adds a fresh {@code CompletionException} as wrapper with the stacktrace of the caller of this method and logs it afterwards. The rewrapped exception is only logged if the given {@code logFilter} predicate allows the exception and the class of it is not in the {@code ignoredThrowableTypes}. @param logFilter The predicate the unwrapped exception is tested against. @param ignoredThrowableTypes The throwable types that should never be logged. @return A consumer which logs the given throwable.
[ "Returns", "a", "consumer", "that", "can", "for", "example", "be", "used", "in", "the", "{", "@link", "TextChannel#typeContinuously", "(", "Consumer", ")", "}", "method", ".", "It", "unwraps", "{", "@link", "CompletionException", "CompletionExceptions", "}", "{"...
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/util/logging/ExceptionLogger.java#L45-L49
Squarespace/cldr
core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java
UnitFactorMap.get
public UnitFactor get(Unit from, Unit to) { Map<Unit, UnitFactor> map = factors.get(from); if (map != null) { UnitFactor factor = map.get(to); if (factor != null) { return factor; } } return null; }
java
public UnitFactor get(Unit from, Unit to) { Map<Unit, UnitFactor> map = factors.get(from); if (map != null) { UnitFactor factor = map.get(to); if (factor != null) { return factor; } } return null; }
[ "public", "UnitFactor", "get", "(", "Unit", "from", ",", "Unit", "to", ")", "{", "Map", "<", "Unit", ",", "UnitFactor", ">", "map", "=", "factors", ".", "get", "(", "from", ")", ";", "if", "(", "map", "!=", "null", ")", "{", "UnitFactor", "factor",...
Find an exact conversion factor between the from and to units, or return null if none exists.
[ "Find", "an", "exact", "conversion", "factor", "between", "the", "from", "and", "to", "units", "or", "return", "null", "if", "none", "exists", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/core/src/main/java/com/squarespace/cldr/units/UnitFactorMap.java#L305-L314
apache/groovy
src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
InvokerHelper.matchRegex
public static boolean matchRegex(Object left, Object right) { if (left == null || right == null) return false; Pattern pattern; if (right instanceof Pattern) { pattern = (Pattern) right; } else { pattern = Pattern.compile(toString(right)); } String stringToCompare = toString(left); Matcher matcher = pattern.matcher(stringToCompare); RegexSupport.setLastMatcher(matcher); return matcher.matches(); }
java
public static boolean matchRegex(Object left, Object right) { if (left == null || right == null) return false; Pattern pattern; if (right instanceof Pattern) { pattern = (Pattern) right; } else { pattern = Pattern.compile(toString(right)); } String stringToCompare = toString(left); Matcher matcher = pattern.matcher(stringToCompare); RegexSupport.setLastMatcher(matcher); return matcher.matches(); }
[ "public", "static", "boolean", "matchRegex", "(", "Object", "left", ",", "Object", "right", ")", "{", "if", "(", "left", "==", "null", "||", "right", "==", "null", ")", "return", "false", ";", "Pattern", "pattern", ";", "if", "(", "right", "instanceof", ...
Find the right hand regex within the left hand string and return a matcher. @param left string to compare @param right regular expression to compare the string to
[ "Find", "the", "right", "hand", "regex", "within", "the", "left", "hand", "string", "and", "return", "a", "matcher", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java#L360-L372
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java
DiscreteDistributions.geometric
public static double geometric(int k, double p) { if(k<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double probability = Math.pow(1-p,k-1)*p; return probability; }
java
public static double geometric(int k, double p) { if(k<=0 || p<0) { throw new IllegalArgumentException("All the parameters must be positive."); } double probability = Math.pow(1-p,k-1)*p; return probability; }
[ "public", "static", "double", "geometric", "(", "int", "k", ",", "double", "p", ")", "{", "if", "(", "k", "<=", "0", "||", "p", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All the parameters must be positive.\"", ")", ";", "}", ...
Returns the probability that the first success requires k trials with probability of success p @param k @param p @return
[ "Returns", "the", "probability", "that", "the", "first", "success", "requires", "k", "trials", "with", "probability", "of", "success", "p" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L153-L161
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/OrganizationHandler.java
OrganizationHandler.addCorporateGroupId
public void addCorporateGroupId(final String organizationId, final String corporateGroupId) { final DbOrganization dbOrganization = getOrganization(organizationId); if(!dbOrganization.getCorporateGroupIdPrefixes().contains(corporateGroupId)){ dbOrganization.getCorporateGroupIdPrefixes().add(corporateGroupId); repositoryHandler.store(dbOrganization); } repositoryHandler.addModulesOrganization(corporateGroupId, dbOrganization); }
java
public void addCorporateGroupId(final String organizationId, final String corporateGroupId) { final DbOrganization dbOrganization = getOrganization(organizationId); if(!dbOrganization.getCorporateGroupIdPrefixes().contains(corporateGroupId)){ dbOrganization.getCorporateGroupIdPrefixes().add(corporateGroupId); repositoryHandler.store(dbOrganization); } repositoryHandler.addModulesOrganization(corporateGroupId, dbOrganization); }
[ "public", "void", "addCorporateGroupId", "(", "final", "String", "organizationId", ",", "final", "String", "corporateGroupId", ")", "{", "final", "DbOrganization", "dbOrganization", "=", "getOrganization", "(", "organizationId", ")", ";", "if", "(", "!", "dbOrganiza...
Adds a corporate groupId to an organization @param organizationId String @param corporateGroupId String
[ "Adds", "a", "corporate", "groupId", "to", "an", "organization" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/OrganizationHandler.java#L90-L99
virgo47/javasimon
core/src/main/java/org/javasimon/callback/quantiles/Buckets.java
Buckets.estimateQuantile
protected double estimateQuantile(Bucket bucket, double expectedCount, double lastCount) { return bucket.getMin() + (expectedCount - lastCount) * (bucket.getMax() - bucket.getMin()) / bucket.getCount(); }
java
protected double estimateQuantile(Bucket bucket, double expectedCount, double lastCount) { return bucket.getMin() + (expectedCount - lastCount) * (bucket.getMax() - bucket.getMin()) / bucket.getCount(); }
[ "protected", "double", "estimateQuantile", "(", "Bucket", "bucket", ",", "double", "expectedCount", ",", "double", "lastCount", ")", "{", "return", "bucket", ".", "getMin", "(", ")", "+", "(", "expectedCount", "-", "lastCount", ")", "*", "(", "bucket", ".", ...
Interpolate quantile located in given Bucket using linear regression. <ul> <li>Quantile is between {@link Bucket#min} and {@link Bucket#max}</li> <li>Expected count is between last count and last count+{@link Bucket#count}</li> </ul> @param bucket Current bucket containing the quantile @param expectedCount Searched value @param lastCount Value of the bucket lower bound @return Compute quantile
[ "Interpolate", "quantile", "located", "in", "given", "Bucket", "using", "linear", "regression", ".", "<ul", ">", "<li", ">", "Quantile", "is", "between", "{", "@link", "Bucket#min", "}", "and", "{", "@link", "Bucket#max", "}", "<", "/", "li", ">", "<li", ...
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/Buckets.java#L140-L142
deephacks/confit
provider-hbase-filter/src/main/java/org/deephacks/confit/internal/hbase/Bytes.java
Bytes.setShort
public static void setShort(final byte[] b, final short n, final int offset) { b[offset + 0] = (byte) (n >>> 8); b[offset + 1] = (byte) (n >>> 0); }
java
public static void setShort(final byte[] b, final short n, final int offset) { b[offset + 0] = (byte) (n >>> 8); b[offset + 1] = (byte) (n >>> 0); }
[ "public", "static", "void", "setShort", "(", "final", "byte", "[", "]", "b", ",", "final", "short", "n", ",", "final", "int", "offset", ")", "{", "b", "[", "offset", "+", "0", "]", "=", "(", "byte", ")", "(", "n", ">>>", "8", ")", ";", "b", "...
Writes a big-endian 2-byte short at an offset in the given array. @param b The array to write to. @param offset The offset in the array to start writing at. @throws IndexOutOfBoundsException if the byte array is too small.
[ "Writes", "a", "big", "-", "endian", "2", "-", "byte", "short", "at", "an", "offset", "in", "the", "given", "array", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-hbase-filter/src/main/java/org/deephacks/confit/internal/hbase/Bytes.java#L108-L111
op4j/op4j
src/main/java/org/op4j/Op.java
Op.onArrayFor
public static <T> Level0ArrayOperator<Long[],Long> onArrayFor(final Long... elements) { return onArrayOf(Types.LONG, VarArgsUtil.asRequiredObjectArray(elements)); }
java
public static <T> Level0ArrayOperator<Long[],Long> onArrayFor(final Long... elements) { return onArrayOf(Types.LONG, VarArgsUtil.asRequiredObjectArray(elements)); }
[ "public", "static", "<", "T", ">", "Level0ArrayOperator", "<", "Long", "[", "]", ",", "Long", ">", "onArrayFor", "(", "final", "Long", "...", "elements", ")", "{", "return", "onArrayOf", "(", "Types", ".", "LONG", ",", "VarArgsUtil", ".", "asRequiredObject...
<p> Creates an array with the specified elements and an <i>operation expression</i> on it. </p> @param elements the elements of the array being created @return an operator, ready for chaining
[ "<p", ">", "Creates", "an", "array", "with", "the", "specified", "elements", "and", "an", "<i", ">", "operation", "expression<", "/", "i", ">", "on", "it", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L919-L921
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.createOrUpdate
public ApplicationGatewayInner createOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).toBlocking().last().body(); }
java
public ApplicationGatewayInner createOrUpdate(String resourceGroupName, String applicationGatewayName, ApplicationGatewayInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, applicationGatewayName, parameters).toBlocking().last().body(); }
[ "public", "ApplicationGatewayInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ",", "ApplicationGatewayInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "applic...
Creates or updates the specified application gateway. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @param parameters Parameters supplied to the create or update application gateway 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 ApplicationGatewayInner object if successful.
[ "Creates", "or", "updates", "the", "specified", "application", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L406-L408
sagiegurari/fax4j
src/main/java/org/fax4j/util/ReflectionHelper.java
ReflectionHelper.getField
public static Field getField(Class<?> type,String fieldName) { Field field=null; try { //get field field=type.getDeclaredField(fieldName); } catch(Exception exception) { throw new FaxException("Unable to extract field: "+fieldName+" from type: "+type,exception); } //set accessible field.setAccessible(true); return field; }
java
public static Field getField(Class<?> type,String fieldName) { Field field=null; try { //get field field=type.getDeclaredField(fieldName); } catch(Exception exception) { throw new FaxException("Unable to extract field: "+fieldName+" from type: "+type,exception); } //set accessible field.setAccessible(true); return field; }
[ "public", "static", "Field", "getField", "(", "Class", "<", "?", ">", "type", ",", "String", "fieldName", ")", "{", "Field", "field", "=", "null", ";", "try", "{", "//get field", "field", "=", "type", ".", "getDeclaredField", "(", "fieldName", ")", ";", ...
This function returns the field wrapper for the requested field @param type The class type @param fieldName The field name @return The field
[ "This", "function", "returns", "the", "field", "wrapper", "for", "the", "requested", "field" ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/ReflectionHelper.java#L157-L174
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/view/zml/ZScreenField.java
ZScreenField.addHiddenParams
public void addHiddenParams(PrintWriter out, Map<String, Object> mapParams) { for (String key : mapParams.keySet()) { if (mapParams.get(key) != null) this.addHiddenParam(out, key, mapParams.get(key).toString()); } }
java
public void addHiddenParams(PrintWriter out, Map<String, Object> mapParams) { for (String key : mapParams.keySet()) { if (mapParams.get(key) != null) this.addHiddenParam(out, key, mapParams.get(key).toString()); } }
[ "public", "void", "addHiddenParams", "(", "PrintWriter", "out", ",", "Map", "<", "String", ",", "Object", ">", "mapParams", ")", "{", "for", "(", "String", "key", ":", "mapParams", ".", "keySet", "(", ")", ")", "{", "if", "(", "mapParams", ".", "get", ...
Display this screen's hidden params. @param out The html out stream. @exception DBException File exception.
[ "Display", "this", "screen", "s", "hidden", "params", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/zml/ZScreenField.java#L332-L339
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/markup/AnnotatedTextBuilder.java
AnnotatedTextBuilder.addGlobalMetaData
public AnnotatedTextBuilder addGlobalMetaData(AnnotatedText.MetaDataKey key, String value) { metaData.put(key, value); return this; }
java
public AnnotatedTextBuilder addGlobalMetaData(AnnotatedText.MetaDataKey key, String value) { metaData.put(key, value); return this; }
[ "public", "AnnotatedTextBuilder", "addGlobalMetaData", "(", "AnnotatedText", ".", "MetaDataKey", "key", ",", "String", "value", ")", "{", "metaData", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add global meta data like document title or receiver name (when writing an email). Some rules may use this information. @since 3.9
[ "Add", "global", "meta", "data", "like", "document", "title", "or", "receiver", "name", "(", "when", "writing", "an", "email", ")", ".", "Some", "rules", "may", "use", "this", "information", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/markup/AnnotatedTextBuilder.java#L64-L67
randomsync/robotframework-mqttlibrary-java
src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java
MQTTLibrary.connectToMQTTBroker
@RobotKeyword("Connect to MQTT Broker") @ArgumentNames({ "broker", "clientId" }) public void connectToMQTTBroker(String broker, String clientId) throws MqttException { client = new MqttClient(broker, clientId); System.out.println("*INFO:" + System.currentTimeMillis() + "* connecting to broker"); client.connect(); System.out.println("*INFO:" + System.currentTimeMillis() + "* connected"); }
java
@RobotKeyword("Connect to MQTT Broker") @ArgumentNames({ "broker", "clientId" }) public void connectToMQTTBroker(String broker, String clientId) throws MqttException { client = new MqttClient(broker, clientId); System.out.println("*INFO:" + System.currentTimeMillis() + "* connecting to broker"); client.connect(); System.out.println("*INFO:" + System.currentTimeMillis() + "* connected"); }
[ "@", "RobotKeyword", "(", "\"Connect to MQTT Broker\"", ")", "@", "ArgumentNames", "(", "{", "\"broker\"", ",", "\"clientId\"", "}", ")", "public", "void", "connectToMQTTBroker", "(", "String", "broker", ",", "String", "clientId", ")", "throws", "MqttException", "...
Connect to an MQTT broker. @param broker Uri of the broker to connect to @param clientId Client Id @throws MqttException if there is an issue connecting to the broker
[ "Connect", "to", "an", "MQTT", "broker", "." ]
train
https://github.com/randomsync/robotframework-mqttlibrary-java/blob/b10e346ea159d86e60a73062297c4a0d57149c89/src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java#L53-L63
shrinkwrap/descriptors
spi/src/main/java/org/jboss/shrinkwrap/descriptor/api/ApiExposition.java
ApiExposition.createFromImplModelType
public static Descriptor createFromImplModelType(final Class<? extends Descriptor> implClass, String descriptorName) throws IllegalArgumentException { return DescriptorInstantiator.createFromImplModelType(implClass, descriptorName); }
java
public static Descriptor createFromImplModelType(final Class<? extends Descriptor> implClass, String descriptorName) throws IllegalArgumentException { return DescriptorInstantiator.createFromImplModelType(implClass, descriptorName); }
[ "public", "static", "Descriptor", "createFromImplModelType", "(", "final", "Class", "<", "?", "extends", "Descriptor", ">", "implClass", ",", "String", "descriptorName", ")", "throws", "IllegalArgumentException", "{", "return", "DescriptorInstantiator", ".", "createFrom...
Creates a {@link Descriptor} instance from the specified implementation class name, also using the specified name @param implClass @param descriptorName @return @throws IllegalArgumentException If either argument is not specified
[ "Creates", "a", "{", "@link", "Descriptor", "}", "instance", "from", "the", "specified", "implementation", "class", "name", "also", "using", "the", "specified", "name" ]
train
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/spi/src/main/java/org/jboss/shrinkwrap/descriptor/api/ApiExposition.java#L55-L58
netty/netty
buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java
CompositeByteBuf.addComponents
public CompositeByteBuf addComponents(int cIndex, ByteBuf... buffers) { checkNotNull(buffers, "buffers"); addComponents0(false, cIndex, buffers, 0); consolidateIfNeeded(); return this; }
java
public CompositeByteBuf addComponents(int cIndex, ByteBuf... buffers) { checkNotNull(buffers, "buffers"); addComponents0(false, cIndex, buffers, 0); consolidateIfNeeded(); return this; }
[ "public", "CompositeByteBuf", "addComponents", "(", "int", "cIndex", ",", "ByteBuf", "...", "buffers", ")", "{", "checkNotNull", "(", "buffers", ",", "\"buffers\"", ")", ";", "addComponents0", "(", "false", ",", "cIndex", ",", "buffers", ",", "0", ")", ";", ...
Add the given {@link ByteBuf}s on the specific index <p> Be aware that this method does not increase the {@code writerIndex} of the {@link CompositeByteBuf}. If you need to have it increased you need to handle it by your own. <p> {@link ByteBuf#release()} ownership of all {@link ByteBuf} objects in {@code buffers} is transferred to this {@link CompositeByteBuf}. @param cIndex the index on which the {@link ByteBuf} will be added. {@link ByteBuf#release()} ownership of all {@link ByteBuf#release()} ownership of all {@link ByteBuf} objects is transferred to this {@link CompositeByteBuf}. @param buffers the {@link ByteBuf}s to add. {@link ByteBuf#release()} ownership of all {@link ByteBuf#release()} ownership of all {@link ByteBuf} objects is transferred to this {@link CompositeByteBuf}.
[ "Add", "the", "given", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java#L335-L340
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/data/codec/RevisionDecoder.java
RevisionDecoder.decodeAdd
private DiffPart decodeAdd(final int blockSize_S, final int blockSize_L) throws UnsupportedEncodingException, DecodingException { if (blockSize_S < 1 || blockSize_L < 1) { throw new DecodingException("Invalid value for blockSize_S: " + blockSize_S + " or blockSize_L: " + blockSize_L); } int s = r.read(blockSize_S); int l = r.read(blockSize_L); ByteArrayOutputStream output = new ByteArrayOutputStream(); for (int i = 0; i < l; i++) { output.write(r.readByte()); } DiffPart part = new DiffPart(DiffAction.INSERT); part.setStart(s); part.setText(output.toString(WIKIPEDIA_ENCODING)); return part; }
java
private DiffPart decodeAdd(final int blockSize_S, final int blockSize_L) throws UnsupportedEncodingException, DecodingException { if (blockSize_S < 1 || blockSize_L < 1) { throw new DecodingException("Invalid value for blockSize_S: " + blockSize_S + " or blockSize_L: " + blockSize_L); } int s = r.read(blockSize_S); int l = r.read(blockSize_L); ByteArrayOutputStream output = new ByteArrayOutputStream(); for (int i = 0; i < l; i++) { output.write(r.readByte()); } DiffPart part = new DiffPart(DiffAction.INSERT); part.setStart(s); part.setText(output.toString(WIKIPEDIA_ENCODING)); return part; }
[ "private", "DiffPart", "decodeAdd", "(", "final", "int", "blockSize_S", ",", "final", "int", "blockSize_L", ")", "throws", "UnsupportedEncodingException", ",", "DecodingException", "{", "if", "(", "blockSize_S", "<", "1", "||", "blockSize_L", "<", "1", ")", "{",...
Decodes an Add operation. @param blockSize_S length of a S block @param blockSize_L length of a L block @return DiffPart, Add operation @throws UnsupportedEncodingException if the character encoding is unsupported @throws DecodingException if the decoding failed
[ "Decodes", "an", "Add", "operation", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/data/codec/RevisionDecoder.java#L230-L252