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
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.email_pro_service_account_GET
public ArrayList<String> email_pro_service_account_GET(String service, Long number) throws IOException { String qPath = "/order/email/pro/{service}/account"; StringBuilder sb = path(qPath, service); query(sb, "number", number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> email_pro_service_account_GET(String service, Long number) throws IOException { String qPath = "/order/email/pro/{service}/account"; StringBuilder sb = path(qPath, service); query(sb, "number", number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "email_pro_service_account_GET", "(", "String", "service", ",", "Long", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/email/pro/{service}/account\"", ";", "StringBuilder", "sb", "=", "path", ...
Get allowed durations for 'account' option REST: GET /order/email/pro/{service}/account @param number [required] Number of Accounts to order @param service [required] The internal name of your pro organization
[ "Get", "allowed", "durations", "for", "account", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4078-L4084
virgo47/javasimon
core/src/main/java/org/javasimon/utils/GoogleChartImageGenerator.java
GoogleChartImageGenerator.barChart
public static String barChart(String title, SimonUnit unit, boolean showMaxMin, StopwatchSample... samples) { return new GoogleChartImageGenerator(samples, title, unit, showMaxMin).process(); }
java
public static String barChart(String title, SimonUnit unit, boolean showMaxMin, StopwatchSample... samples) { return new GoogleChartImageGenerator(samples, title, unit, showMaxMin).process(); }
[ "public", "static", "String", "barChart", "(", "String", "title", ",", "SimonUnit", "unit", ",", "boolean", "showMaxMin", ",", "StopwatchSample", "...", "samples", ")", "{", "return", "new", "GoogleChartImageGenerator", "(", "samples", ",", "title", ",", "unit",...
Generates Google bar chart URL for the provided samples. @param title chart title @param unit unit requested for displaying results @param showMaxMin true if additional datasets for max and min values should be shown @param samples stopwatch samples @return URL generating the bar chart
[ "Generates", "Google", "bar", "chart", "URL", "for", "the", "provided", "samples", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/GoogleChartImageGenerator.java#L67-L69
grails/grails-core
grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java
DefaultGrailsApplication.addArtefact
public GrailsClass addArtefact(String artefactType, @SuppressWarnings("rawtypes") Class artefactClass) { return addArtefact(artefactType, artefactClass, false); }
java
public GrailsClass addArtefact(String artefactType, @SuppressWarnings("rawtypes") Class artefactClass) { return addArtefact(artefactType, artefactClass, false); }
[ "public", "GrailsClass", "addArtefact", "(", "String", "artefactType", ",", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Class", "artefactClass", ")", "{", "return", "addArtefact", "(", "artefactType", ",", "artefactClass", ",", "false", ")", ";", "}" ]
Adds an artefact of the given type for the given Class. @param artefactType The type of the artefact as defined by a ArtefactHandler instance @param artefactClass A Class instance that matches the type defined by the ArtefactHandler @return The GrailsClass if successful or null if it couldn't be added @throws GrailsConfigurationException If the specified Class is not the same as the type defined by the ArtefactHandler @see grails.core.ArtefactHandler
[ "Adds", "an", "artefact", "of", "the", "given", "type", "for", "the", "given", "Class", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java#L503-L505
michael-rapp/AndroidMaterialDialog
library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java
DialogRootView.addDivider
@NonNull private Divider addDivider() { Divider divider = new Divider(getContext()); divider.setVisibility(View.INVISIBLE); divider.setBackgroundColor(dividerColor); LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, dpToPixels(getContext(), 1)); layoutParams.leftMargin = dividerMargin; layoutParams.rightMargin = dividerMargin; addView(divider, layoutParams); return divider; }
java
@NonNull private Divider addDivider() { Divider divider = new Divider(getContext()); divider.setVisibility(View.INVISIBLE); divider.setBackgroundColor(dividerColor); LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, dpToPixels(getContext(), 1)); layoutParams.leftMargin = dividerMargin; layoutParams.rightMargin = dividerMargin; addView(divider, layoutParams); return divider; }
[ "@", "NonNull", "private", "Divider", "addDivider", "(", ")", "{", "Divider", "divider", "=", "new", "Divider", "(", "getContext", "(", ")", ")", ";", "divider", ".", "setVisibility", "(", "View", ".", "INVISIBLE", ")", ";", "divider", ".", "setBackgroundC...
Adds a divider to the view. @return The divider, which has been added to the view, as an instance of the class {@link Divider}. The divider may not be null
[ "Adds", "a", "divider", "to", "the", "view", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java#L470-L481
centic9/commons-dost
src/main/java/org/dstadler/commons/net/SocketUtils.java
SocketUtils.getNextFreePort
@SuppressForbidden(reason = "We want to bind to any address here when checking for free ports") public static int getNextFreePort(int portRangeStart, int portRangeEnd) throws IOException { for (int port = portRangeStart; port <= portRangeEnd; port++) { try (ServerSocket sock = new ServerSocket()) { sock.setReuseAddress(true); sock.bind(new InetSocketAddress(port)); return port; } catch (IOException e) { // seems to be taken, try next one log.warning("Port " + port + " seems to be used already, trying next one..."); } } throw new IOException("No free port found in the range of [" + portRangeStart + " - " + portRangeEnd + "]"); }
java
@SuppressForbidden(reason = "We want to bind to any address here when checking for free ports") public static int getNextFreePort(int portRangeStart, int portRangeEnd) throws IOException { for (int port = portRangeStart; port <= portRangeEnd; port++) { try (ServerSocket sock = new ServerSocket()) { sock.setReuseAddress(true); sock.bind(new InetSocketAddress(port)); return port; } catch (IOException e) { // seems to be taken, try next one log.warning("Port " + port + " seems to be used already, trying next one..."); } } throw new IOException("No free port found in the range of [" + portRangeStart + " - " + portRangeEnd + "]"); }
[ "@", "SuppressForbidden", "(", "reason", "=", "\"We want to bind to any address here when checking for free ports\"", ")", "public", "static", "int", "getNextFreePort", "(", "int", "portRangeStart", ",", "int", "portRangeEnd", ")", "throws", "IOException", "{", "for", "("...
Method that is used to find the next available port. It used the two constants PORT_RANGE_START and PORT_RANGE_END defined above to limit the range of ports that are tried. @param portRangeStart The first port that is tried @param portRangeEnd The last port that is tried @return A port number that can be used. @throws IOException If no available port is found.
[ "Method", "that", "is", "used", "to", "find", "the", "next", "available", "port", ".", "It", "used", "the", "two", "constants", "PORT_RANGE_START", "and", "PORT_RANGE_END", "defined", "above", "to", "limit", "the", "range", "of", "ports", "that", "are", "tri...
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/net/SocketUtils.java#L34-L49
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java
LayoutRefiner.haveCrossingBonds
private boolean haveCrossingBonds(int u, int v) { int[] us = adjList[u]; int[] vs = adjList[v]; for (int u1 : us) { for (int v1 : vs) { if (u1 == v || v1 == u || u1 == v1) continue; if (isCrossed(atoms[u].getPoint2d(), atoms[u1].getPoint2d(), atoms[v].getPoint2d(), atoms[v1].getPoint2d())) return true; } } return false; }
java
private boolean haveCrossingBonds(int u, int v) { int[] us = adjList[u]; int[] vs = adjList[v]; for (int u1 : us) { for (int v1 : vs) { if (u1 == v || v1 == u || u1 == v1) continue; if (isCrossed(atoms[u].getPoint2d(), atoms[u1].getPoint2d(), atoms[v].getPoint2d(), atoms[v1].getPoint2d())) return true; } } return false; }
[ "private", "boolean", "haveCrossingBonds", "(", "int", "u", ",", "int", "v", ")", "{", "int", "[", "]", "us", "=", "adjList", "[", "u", "]", ";", "int", "[", "]", "vs", "=", "adjList", "[", "v", "]", ";", "for", "(", "int", "u1", ":", "us", "...
Check if any of the bonds adjacent to u, v (not bonded) are crossing. @param u an atom (idx) @param v another atom (idx) @return there are crossing bonds
[ "Check", "if", "any", "of", "the", "bonds", "adjacent", "to", "u", "v", "(", "not", "bonded", ")", "are", "crossing", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L304-L316
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/model/ValidationResult.java
ValidationResult.iaddError
private void iaddError(String desc, String value, String loc) { if (!validate) return; ValidationEvent ve = new ValidationEvent(desc, value, loc); errors.add(ve); correct = false; }
java
private void iaddError(String desc, String value, String loc) { if (!validate) return; ValidationEvent ve = new ValidationEvent(desc, value, loc); errors.add(ve); correct = false; }
[ "private", "void", "iaddError", "(", "String", "desc", ",", "String", "value", ",", "String", "loc", ")", "{", "if", "(", "!", "validate", ")", "return", ";", "ValidationEvent", "ve", "=", "new", "ValidationEvent", "(", "desc", ",", "value", ",", "loc", ...
Adds an error. @param desc error description @param value the value that caused the error @param loc the error location
[ "Adds", "an", "error", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/model/ValidationResult.java#L78-L83
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java
DatabasesInner.addPrincipalsAsync
public Observable<DatabasePrincipalListResultInner> addPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, List<DatabasePrincipalInner> value) { return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).map(new Func1<ServiceResponse<DatabasePrincipalListResultInner>, DatabasePrincipalListResultInner>() { @Override public DatabasePrincipalListResultInner call(ServiceResponse<DatabasePrincipalListResultInner> response) { return response.body(); } }); }
java
public Observable<DatabasePrincipalListResultInner> addPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, List<DatabasePrincipalInner> value) { return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).map(new Func1<ServiceResponse<DatabasePrincipalListResultInner>, DatabasePrincipalListResultInner>() { @Override public DatabasePrincipalListResultInner call(ServiceResponse<DatabasePrincipalListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DatabasePrincipalListResultInner", ">", "addPrincipalsAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "List", "<", "DatabasePrincipalInner", ">", "value", ")", "{", "return", "...
Add Database principals permissions. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param value The list of Kusto database principals. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DatabasePrincipalListResultInner object
[ "Add", "Database", "principals", "permissions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L1164-L1171
messagebird/java-rest-api
api/src/main/java/com/messagebird/MessageBirdClient.java
MessageBirdClient.listAllVoiceCalls
public VoiceCallResponseList listAllVoiceCalls(Integer page, Integer pageSize) throws GeneralException, UnauthorizedException { String url = String.format("%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH); return messageBirdService.requestList(url, new PagedPaging(page, pageSize), VoiceCallResponseList.class); }
java
public VoiceCallResponseList listAllVoiceCalls(Integer page, Integer pageSize) throws GeneralException, UnauthorizedException { String url = String.format("%s%s", VOICE_CALLS_BASE_URL, VOICECALLSPATH); return messageBirdService.requestList(url, new PagedPaging(page, pageSize), VoiceCallResponseList.class); }
[ "public", "VoiceCallResponseList", "listAllVoiceCalls", "(", "Integer", "page", ",", "Integer", "pageSize", ")", "throws", "GeneralException", ",", "UnauthorizedException", "{", "String", "url", "=", "String", ".", "format", "(", "\"%s%s\"", ",", "VOICE_CALLS_BASE_URL...
Function to list all voice calls @return VoiceCallResponseList @throws UnauthorizedException if client is unauthorized @throws GeneralException general exception
[ "Function", "to", "list", "all", "voice", "calls" ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L935-L938
line/armeria
core/src/main/java/com/linecorp/armeria/server/file/AbstractHttpFileBuilder.java
AbstractHttpFileBuilder.entityTag
public final B entityTag(BiFunction<String, HttpFileAttributes, String> entityTagFunction) { this.entityTagFunction = requireNonNull(entityTagFunction, "entityTagFunction"); return self(); }
java
public final B entityTag(BiFunction<String, HttpFileAttributes, String> entityTagFunction) { this.entityTagFunction = requireNonNull(entityTagFunction, "entityTagFunction"); return self(); }
[ "public", "final", "B", "entityTag", "(", "BiFunction", "<", "String", ",", "HttpFileAttributes", ",", "String", ">", "entityTagFunction", ")", "{", "this", ".", "entityTagFunction", "=", "requireNonNull", "(", "entityTagFunction", ",", "\"entityTagFunction\"", ")",...
Sets the function which generates the entity tag that's used for setting the {@code "etag"} header automatically. @param entityTagFunction the entity tag function that generates the entity tag, or {@code null} to disable setting the {@code "etag"} header.
[ "Sets", "the", "function", "which", "generates", "the", "entity", "tag", "that", "s", "used", "for", "setting", "the", "{", "@code", "etag", "}", "header", "automatically", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/AbstractHttpFileBuilder.java#L153-L156
xcesco/kripton
kripton/src/main/java/com/abubusoft/kripton/xml/XmlAttributeUtils.java
XmlAttributeUtils.getAttributeAsBoolean
public static boolean getAttributeAsBoolean(XmlPullParser parser, String attributeName, boolean defaultValue) throws Exception { // parser.getText() String value = parser.getAttributeValue(null, attributeName); if (!StringUtils.hasText(value)) { return defaultValue; } return Boolean.parseBoolean(value); }
java
public static boolean getAttributeAsBoolean(XmlPullParser parser, String attributeName, boolean defaultValue) throws Exception { // parser.getText() String value = parser.getAttributeValue(null, attributeName); if (!StringUtils.hasText(value)) { return defaultValue; } return Boolean.parseBoolean(value); }
[ "public", "static", "boolean", "getAttributeAsBoolean", "(", "XmlPullParser", "parser", ",", "String", "attributeName", ",", "boolean", "defaultValue", ")", "throws", "Exception", "{", "// parser.getText()", "String", "value", "=", "parser", ".", "getAttributeValue", ...
Gets the attribute as boolean. @param parser the parser @param attributeName the attribute name @param defaultValue the default value @return get attribute as boolean @throws Exception the exception
[ "Gets", "the", "attribute", "as", "boolean", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XmlAttributeUtils.java#L37-L46
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/internal/BcUtils.java
BcUtils.updateDEREncodedObject
public static Signer updateDEREncodedObject(Signer signer, ASN1Encodable tbsObj) throws IOException { OutputStream sOut = signer.getOutputStream(); DEROutputStream dOut = new DEROutputStream(sOut); dOut.writeObject(tbsObj); sOut.close(); return signer; }
java
public static Signer updateDEREncodedObject(Signer signer, ASN1Encodable tbsObj) throws IOException { OutputStream sOut = signer.getOutputStream(); DEROutputStream dOut = new DEROutputStream(sOut); dOut.writeObject(tbsObj); sOut.close(); return signer; }
[ "public", "static", "Signer", "updateDEREncodedObject", "(", "Signer", "signer", ",", "ASN1Encodable", "tbsObj", ")", "throws", "IOException", "{", "OutputStream", "sOut", "=", "signer", ".", "getOutputStream", "(", ")", ";", "DEROutputStream", "dOut", "=", "new",...
DER encode an ASN.1 object into the given signer and return the signer. @param signer a signer. @param tbsObj the object to sign. @return a the signer for chaining. @throws java.io.IOException on encoding error.
[ "DER", "encode", "an", "ASN", ".", "1", "object", "into", "the", "given", "signer", "and", "return", "the", "signer", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/internal/BcUtils.java#L177-L188
phax/ph-commons
ph-datetime/src/main/java/com/helger/datetime/util/PDTXMLConverter.java
PDTXMLConverter.getXMLCalendarDate
@Nonnull public static XMLGregorianCalendar getXMLCalendarDate (final int nYear, final int nMonth, final int nDay) { return getXMLCalendarDate (nYear, nMonth, nDay, DatatypeConstants.FIELD_UNDEFINED); }
java
@Nonnull public static XMLGregorianCalendar getXMLCalendarDate (final int nYear, final int nMonth, final int nDay) { return getXMLCalendarDate (nYear, nMonth, nDay, DatatypeConstants.FIELD_UNDEFINED); }
[ "@", "Nonnull", "public", "static", "XMLGregorianCalendar", "getXMLCalendarDate", "(", "final", "int", "nYear", ",", "final", "int", "nMonth", ",", "final", "int", "nDay", ")", "{", "return", "getXMLCalendarDate", "(", "nYear", ",", "nMonth", ",", "nDay", ",",...
<p> Create a Java representation of XML Schema builtin datatype <code>date</code> or <code>g*</code>. </p> <p> For example, an instance of <code>gYear</code> can be created invoking this factory with <code>month</code> and <code>day</code> parameters set to {@link DatatypeConstants#FIELD_UNDEFINED}. </p> <p> A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set. </p> @param nYear Year to be created. @param nMonth Month to be created. @param nDay Day to be created. @return <code>XMLGregorianCalendar</code> created from parameter values. @see DatatypeConstants#FIELD_UNDEFINED @throws IllegalArgumentException If any individual parameter's value is outside the maximum value constraint for the field as determined by the Date/Time Data Mapping table in {@link XMLGregorianCalendar} or if the composite values constitute an invalid <code>XMLGregorianCalendar</code> instance as determined by {@link XMLGregorianCalendar#isValid()}.
[ "<p", ">", "Create", "a", "Java", "representation", "of", "XML", "Schema", "builtin", "datatype", "<code", ">", "date<", "/", "code", ">", "or", "<code", ">", "g", "*", "<", "/", "code", ">", ".", "<", "/", "p", ">", "<p", ">", "For", "example", ...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTXMLConverter.java#L283-L287
grpc/grpc-java
stub/src/main/java/io/grpc/stub/AbstractStub.java
AbstractStub.withDeadline
public final S withDeadline(@Nullable Deadline deadline) { return build(channel, callOptions.withDeadline(deadline)); }
java
public final S withDeadline(@Nullable Deadline deadline) { return build(channel, callOptions.withDeadline(deadline)); }
[ "public", "final", "S", "withDeadline", "(", "@", "Nullable", "Deadline", "deadline", ")", "{", "return", "build", "(", "channel", ",", "callOptions", ".", "withDeadline", "(", "deadline", ")", ")", ";", "}" ]
Returns a new stub with an absolute deadline. <p>This is mostly used for propagating an existing deadline. {@link #withDeadlineAfter} is the recommended way of setting a new deadline, @since 1.0.0 @param deadline the deadline or {@code null} for unsetting the deadline.
[ "Returns", "a", "new", "stub", "with", "an", "absolute", "deadline", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/AbstractStub.java#L113-L115
apache/groovy
src/main/groovy/groovy/lang/Sequence.java
Sequence.checkType
protected void checkType(Object object) { if (object == null) { throw new NullPointerException("Sequences cannot contain null, use a List instead"); } if (type != null) { if (!type.isInstance(object)) { throw new IllegalArgumentException( "Invalid type of argument for sequence of type: " + type.getName() + " cannot add object: " + object); } } }
java
protected void checkType(Object object) { if (object == null) { throw new NullPointerException("Sequences cannot contain null, use a List instead"); } if (type != null) { if (!type.isInstance(object)) { throw new IllegalArgumentException( "Invalid type of argument for sequence of type: " + type.getName() + " cannot add object: " + object); } } }
[ "protected", "void", "checkType", "(", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Sequences cannot contain null, use a List instead\"", ")", ";", "}", "if", "(", "type", "!=", "null"...
Checks that the given object instance is of the correct type otherwise a runtime exception is thrown
[ "Checks", "that", "the", "given", "object", "instance", "is", "of", "the", "correct", "type", "otherwise", "a", "runtime", "exception", "is", "thrown" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/Sequence.java#L203-L216
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java
SyncGroupsInner.beginRefreshHubSchemaAsync
public Observable<Void> beginRefreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { return beginRefreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginRefreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { return beginRefreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginRefreshHubSchemaAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "syncGroupName", ")", "{", "return", "beginRefreshHubSchemaWithServiceResponseAsync", "("...
Refreshes a hub database schema. @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 on which the sync group is hosted. @param syncGroupName The name of the sync group. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Refreshes", "a", "hub", "database", "schema", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java#L381-L388
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/support/AbstractPropertyAccessStrategy.java
AbstractPropertyAccessStrategy.getUserMetadataFor
protected Object getUserMetadataFor(String propertyPath, String key) { final Map allMetadata = getAllUserMetadataFor(propertyPath); return allMetadata != null ? allMetadata.get(key) : null; }
java
protected Object getUserMetadataFor(String propertyPath, String key) { final Map allMetadata = getAllUserMetadataFor(propertyPath); return allMetadata != null ? allMetadata.get(key) : null; }
[ "protected", "Object", "getUserMetadataFor", "(", "String", "propertyPath", ",", "String", "key", ")", "{", "final", "Map", "allMetadata", "=", "getAllUserMetadataFor", "(", "propertyPath", ")", ";", "return", "allMetadata", "!=", "null", "?", "allMetadata", ".", ...
Subclasses may override this method to supply user metadata for the specified <code>propertyPath</code> and <code>key</code>. The default implementation invokes {@link #getAllUserMetadataFor(String)} and uses the returned Map with the <code>key</code> parameter to find the correlated value. @param propertyPath path of property relative to this bean @param key @return metadata associated with the specified key for the property or <code>null</code> if there is no custom metadata associated with the property and key.
[ "Subclasses", "may", "override", "this", "method", "to", "supply", "user", "metadata", "for", "the", "specified", "<code", ">", "propertyPath<", "/", "code", ">", "and", "<code", ">", "key<", "/", "code", ">", ".", "The", "default", "implementation", "invoke...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/support/AbstractPropertyAccessStrategy.java#L109-L112
wdullaer/MaterialDateTimePicker
library/src/main/java/com/wdullaer/materialdatetimepicker/time/AmPmCirclesView.java
AmPmCirclesView.getIsTouchingAmOrPm
public int getIsTouchingAmOrPm(float xCoord, float yCoord) { if (!mDrawValuesReady) { return -1; } int squaredYDistance = (int) ((yCoord - mAmPmYCenter)*(yCoord - mAmPmYCenter)); int distanceToAmCenter = (int) Math.sqrt((xCoord - mAmXCenter)*(xCoord - mAmXCenter) + squaredYDistance); if (distanceToAmCenter <= mAmPmCircleRadius && !mAmDisabled) { return AM; } int distanceToPmCenter = (int) Math.sqrt((xCoord - mPmXCenter)*(xCoord - mPmXCenter) + squaredYDistance); if (distanceToPmCenter <= mAmPmCircleRadius && !mPmDisabled) { return PM; } // Neither was close enough. return -1; }
java
public int getIsTouchingAmOrPm(float xCoord, float yCoord) { if (!mDrawValuesReady) { return -1; } int squaredYDistance = (int) ((yCoord - mAmPmYCenter)*(yCoord - mAmPmYCenter)); int distanceToAmCenter = (int) Math.sqrt((xCoord - mAmXCenter)*(xCoord - mAmXCenter) + squaredYDistance); if (distanceToAmCenter <= mAmPmCircleRadius && !mAmDisabled) { return AM; } int distanceToPmCenter = (int) Math.sqrt((xCoord - mPmXCenter)*(xCoord - mPmXCenter) + squaredYDistance); if (distanceToPmCenter <= mAmPmCircleRadius && !mPmDisabled) { return PM; } // Neither was close enough. return -1; }
[ "public", "int", "getIsTouchingAmOrPm", "(", "float", "xCoord", ",", "float", "yCoord", ")", "{", "if", "(", "!", "mDrawValuesReady", ")", "{", "return", "-", "1", ";", "}", "int", "squaredYDistance", "=", "(", "int", ")", "(", "(", "yCoord", "-", "mAm...
Calculate whether the coordinates are touching the AM or PM circle.
[ "Calculate", "whether", "the", "coordinates", "are", "touching", "the", "AM", "or", "PM", "circle", "." ]
train
https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/AmPmCirclesView.java#L135-L156
inkstand-io/scribble
scribble-core/src/main/java/io/inkstand/scribble/rules/BaseRule.java
BaseRule.apply
@Override public Statement apply(final Statement base, final Description description) { if (outerRule != null) { return outerRule.apply(base, description); } return base; }
java
@Override public Statement apply(final Statement base, final Description description) { if (outerRule != null) { return outerRule.apply(base, description); } return base; }
[ "@", "Override", "public", "Statement", "apply", "(", "final", "Statement", "base", ",", "final", "Description", "description", ")", "{", "if", "(", "outerRule", "!=", "null", ")", "{", "return", "outerRule", ".", "apply", "(", "base", ",", "description", ...
Invokes the outer rule - if set - around the base {@link Statement}
[ "Invokes", "the", "outer", "rule", "-", "if", "set", "-", "around", "the", "base", "{" ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-core/src/main/java/io/inkstand/scribble/rules/BaseRule.java#L61-L67
Chorus-bdd/Chorus
interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/assertion/ChorusAssert.java
ChorusAssert.assertEquals
static public void assertEquals(String message, short expected, short actual) { assertEquals(message, new Short(expected), new Short(actual)); }
java
static public void assertEquals(String message, short expected, short actual) { assertEquals(message, new Short(expected), new Short(actual)); }
[ "static", "public", "void", "assertEquals", "(", "String", "message", ",", "short", "expected", ",", "short", "actual", ")", "{", "assertEquals", "(", "message", ",", "new", "Short", "(", "expected", ")", ",", "new", "Short", "(", "actual", ")", ")", ";"...
Asserts that two shorts are equal. If they are not an AssertionFailedError is thrown with the given message.
[ "Asserts", "that", "two", "shorts", "are", "equal", ".", "If", "they", "are", "not", "an", "AssertionFailedError", "is", "thrown", "with", "the", "given", "message", "." ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-util/src/main/java/org/chorusbdd/chorus/util/assertion/ChorusAssert.java#L215-L217
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withYears
public Period withYears(int years) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.YEAR_INDEX, values, years); return new Period(values, getPeriodType()); }
java
public Period withYears(int years) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.YEAR_INDEX, values, years); return new Period(values, getPeriodType()); }
[ "public", "Period", "withYears", "(", "int", "years", ")", "{", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "setIndexedField", "(", "this", ",", "PeriodType", ".", "YEAR_INDEX", ",", "values", ...
Returns a new period with the specified number of years. <p> This period instance is immutable and unaffected by this method call. @param years the amount of years to add, may be negative @return the new period with the increased years @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "with", "the", "specified", "number", "of", "years", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L914-L918
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.visitCompilationUnit
@Override public R visitCompilationUnit(CompilationUnitTree node, P p) { R r = scan(node.getPackage(), p); r = scanAndReduce(node.getImports(), p, r); r = scanAndReduce(node.getTypeDecls(), p, r); return r; }
java
@Override public R visitCompilationUnit(CompilationUnitTree node, P p) { R r = scan(node.getPackage(), p); r = scanAndReduce(node.getImports(), p, r); r = scanAndReduce(node.getTypeDecls(), p, r); return r; }
[ "@", "Override", "public", "R", "visitCompilationUnit", "(", "CompilationUnitTree", "node", ",", "P", "p", ")", "{", "R", "r", "=", "scan", "(", "node", ".", "getPackage", "(", ")", ",", "p", ")", ";", "r", "=", "scanAndReduce", "(", "node", ".", "ge...
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L140-L146
lets-blade/blade-jdbc
blade-jdbc-core/src/main/java/com/blade/jdbc/core/SqlBuilder.java
SqlBuilder.parseFieldsSql
private static String parseFieldsSql(String tableName, Supplier<ConditionEnum>[] conditions) { final String[] sql = {"SELECT * FROM " + tableName}; if (null == conditions) { return sql[0]; } Stream.of(conditions) .filter(conditionEnumSupplier -> conditionEnumSupplier.get().equals(ConditionEnum.FIELDS)) .findFirst() .ifPresent(conditionEnumSupplier -> { Fields fields = (Fields) conditionEnumSupplier; Set<String> fieldsSet = fields.getFields(); sql[0] = "SELECT " + fieldsSet.stream().collect(Collectors.joining(",")) + " FROM " + tableName; }); return sql[0]; }
java
private static String parseFieldsSql(String tableName, Supplier<ConditionEnum>[] conditions) { final String[] sql = {"SELECT * FROM " + tableName}; if (null == conditions) { return sql[0]; } Stream.of(conditions) .filter(conditionEnumSupplier -> conditionEnumSupplier.get().equals(ConditionEnum.FIELDS)) .findFirst() .ifPresent(conditionEnumSupplier -> { Fields fields = (Fields) conditionEnumSupplier; Set<String> fieldsSet = fields.getFields(); sql[0] = "SELECT " + fieldsSet.stream().collect(Collectors.joining(",")) + " FROM " + tableName; }); return sql[0]; }
[ "private", "static", "String", "parseFieldsSql", "(", "String", "tableName", ",", "Supplier", "<", "ConditionEnum", ">", "[", "]", "conditions", ")", "{", "final", "String", "[", "]", "sql", "=", "{", "\"SELECT * FROM \"", "+", "tableName", "}", ";", "if", ...
解析Model字段 @param tableName 表名 @param conditions 条件 @return 返回sql语句
[ "解析Model字段" ]
train
https://github.com/lets-blade/blade-jdbc/blob/f9348b6da2eaae5d953bc3cdb49f8fea1cc8b75c/blade-jdbc-core/src/main/java/com/blade/jdbc/core/SqlBuilder.java#L329-L343
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientOptions.java
ClientOptions.of
public static ClientOptions of(ClientOptions baseOptions, Iterable<ClientOptionValue<?>> options) { // TODO(trustin): Reduce the cost of creating a derived ClientOptions. requireNonNull(baseOptions, "baseOptions"); requireNonNull(options, "options"); return new ClientOptions(baseOptions, options); }
java
public static ClientOptions of(ClientOptions baseOptions, Iterable<ClientOptionValue<?>> options) { // TODO(trustin): Reduce the cost of creating a derived ClientOptions. requireNonNull(baseOptions, "baseOptions"); requireNonNull(options, "options"); return new ClientOptions(baseOptions, options); }
[ "public", "static", "ClientOptions", "of", "(", "ClientOptions", "baseOptions", ",", "Iterable", "<", "ClientOptionValue", "<", "?", ">", ">", "options", ")", "{", "// TODO(trustin): Reduce the cost of creating a derived ClientOptions.", "requireNonNull", "(", "baseOptions"...
Merges the specified {@link ClientOptions} and {@link ClientOptionValue}s. @return the merged {@link ClientOptions}
[ "Merges", "the", "specified", "{", "@link", "ClientOptions", "}", "and", "{", "@link", "ClientOptionValue", "}", "s", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientOptions.java#L125-L130
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/wrapper/SQLSelect.java
SQLSelect.addColumnPart
public SQLSelect addColumnPart(final Integer _tableIndex, final String _columnName) { parts.add(new Column(tablePrefix, _tableIndex, _columnName)); return this; }
java
public SQLSelect addColumnPart(final Integer _tableIndex, final String _columnName) { parts.add(new Column(tablePrefix, _tableIndex, _columnName)); return this; }
[ "public", "SQLSelect", "addColumnPart", "(", "final", "Integer", "_tableIndex", ",", "final", "String", "_columnName", ")", "{", "parts", ".", "add", "(", "new", "Column", "(", "tablePrefix", ",", "_tableIndex", ",", "_columnName", ")", ")", ";", "return", "...
Add a column as part. @param _tableIndex index of the table @param _columnName name of the column @return this
[ "Add", "a", "column", "as", "part", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/wrapper/SQLSelect.java#L392-L397
sporniket/core
sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java
XmlStringTools.getClosingTag
public static String getClosingTag(String tag) { StringBuffer _result = new StringBuffer(); return doAppendClosingTag(_result, tag).toString(); }
java
public static String getClosingTag(String tag) { StringBuffer _result = new StringBuffer(); return doAppendClosingTag(_result, tag).toString(); }
[ "public", "static", "String", "getClosingTag", "(", "String", "tag", ")", "{", "StringBuffer", "_result", "=", "new", "StringBuffer", "(", ")", ";", "return", "doAppendClosingTag", "(", "_result", ",", "tag", ")", ".", "toString", "(", ")", ";", "}" ]
Create a string containing a closing tag. @param tag the closing tag to generate. @return the closing tag.
[ "Create", "a", "string", "containing", "a", "closing", "tag", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L553-L557
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/demo/TableEditorsDemo.java
TableEditorsDemo.createAndShowTableDemoFrame
public static void createAndShowTableDemoFrame() { // Create and set up the frame and the table demo panel. JFrame frame = new JFrame("LGoodDatePicker Table Editors Demo " + InternalUtilities.getProjectVersionString()); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); TableEditorsDemo tableDemoPanel = new TableEditorsDemo(); frame.setContentPane(tableDemoPanel); tableDemoPanel.setOpaque(true); //Display the frame. frame.pack(); frame.setSize(new Dimension(1000, 700)); frame.setLocationRelativeTo(null); frame.setVisible(true); }
java
public static void createAndShowTableDemoFrame() { // Create and set up the frame and the table demo panel. JFrame frame = new JFrame("LGoodDatePicker Table Editors Demo " + InternalUtilities.getProjectVersionString()); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); TableEditorsDemo tableDemoPanel = new TableEditorsDemo(); frame.setContentPane(tableDemoPanel); tableDemoPanel.setOpaque(true); //Display the frame. frame.pack(); frame.setSize(new Dimension(1000, 700)); frame.setLocationRelativeTo(null); frame.setVisible(true); }
[ "public", "static", "void", "createAndShowTableDemoFrame", "(", ")", "{", "// Create and set up the frame and the table demo panel.", "JFrame", "frame", "=", "new", "JFrame", "(", "\"LGoodDatePicker Table Editors Demo \"", "+", "InternalUtilities", ".", "getProjectVersionString",...
createAndShowTableDemoFrame, This creates and displays a frame with the table demo.
[ "createAndShowTableDemoFrame", "This", "creates", "and", "displays", "a", "frame", "with", "the", "table", "demo", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/demo/TableEditorsDemo.java#L104-L118
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_migration_migrationId_PUT
public OvhMigration project_serviceName_migration_migrationId_PUT(String serviceName, String migrationId, Date date) throws IOException { String qPath = "/cloud/project/{serviceName}/migration/{migrationId}"; StringBuilder sb = path(qPath, serviceName, migrationId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "date", date); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhMigration.class); }
java
public OvhMigration project_serviceName_migration_migrationId_PUT(String serviceName, String migrationId, Date date) throws IOException { String qPath = "/cloud/project/{serviceName}/migration/{migrationId}"; StringBuilder sb = path(qPath, serviceName, migrationId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "date", date); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhMigration.class); }
[ "public", "OvhMigration", "project_serviceName_migration_migrationId_PUT", "(", "String", "serviceName", ",", "String", "migrationId", ",", "Date", "date", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/migration/{migrationId}\"", "...
Update planned migration REST: PUT /cloud/project/{serviceName}/migration/{migrationId} @param date [required] Migration date (RFC3339) @param migrationId [required] Migration id @param serviceName [required] Service name API beta
[ "Update", "planned", "migration" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1057-L1064
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifier.java
LinearClassifier.printHistCounts
private static void printHistCounts(int ind, String title, PrintWriter pw, double[][] hist, Object[][] histEg) { pw.println(title); for (int i = 0; i < 200; i++) { int intpart, fracpart; if (i < 100) { intpart = 10 - ((i + 9) / 10); fracpart = (10 - (i % 10)) % 10; } else { intpart = (i / 10) - 10; fracpart = i % 10; } pw.print("[" + ((i < 100) ? "-" : "") + intpart + "." + fracpart + ", " + ((i < 100) ? "-" : "") + intpart + "." + fracpart + "+0.1): " + hist[ind][i]); if (histEg[ind][i] != null) { pw.print(" [" + histEg[ind][i] + ((hist[ind][i] > 1) ? ", ..." : "") + "]"); } pw.println(); } }
java
private static void printHistCounts(int ind, String title, PrintWriter pw, double[][] hist, Object[][] histEg) { pw.println(title); for (int i = 0; i < 200; i++) { int intpart, fracpart; if (i < 100) { intpart = 10 - ((i + 9) / 10); fracpart = (10 - (i % 10)) % 10; } else { intpart = (i / 10) - 10; fracpart = i % 10; } pw.print("[" + ((i < 100) ? "-" : "") + intpart + "." + fracpart + ", " + ((i < 100) ? "-" : "") + intpart + "." + fracpart + "+0.1): " + hist[ind][i]); if (histEg[ind][i] != null) { pw.print(" [" + histEg[ind][i] + ((hist[ind][i] > 1) ? ", ..." : "") + "]"); } pw.println(); } }
[ "private", "static", "void", "printHistCounts", "(", "int", "ind", ",", "String", "title", ",", "PrintWriter", "pw", ",", "double", "[", "]", "[", "]", "hist", ",", "Object", "[", "]", "[", "]", "histEg", ")", "{", "pw", ".", "println", "(", "title",...
Print histogram counts from hist and examples over a certain range
[ "Print", "histogram", "counts", "from", "hist", "and", "examples", "over", "a", "certain", "range" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L826-L843
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java
AbstractRedisStorage.removeTrigger
public boolean removeTrigger(TriggerKey triggerKey, T jedis) throws JobPersistenceException, ClassNotFoundException { return removeTrigger(triggerKey, true, jedis); }
java
public boolean removeTrigger(TriggerKey triggerKey, T jedis) throws JobPersistenceException, ClassNotFoundException { return removeTrigger(triggerKey, true, jedis); }
[ "public", "boolean", "removeTrigger", "(", "TriggerKey", "triggerKey", ",", "T", "jedis", ")", "throws", "JobPersistenceException", ",", "ClassNotFoundException", "{", "return", "removeTrigger", "(", "triggerKey", ",", "true", ",", "jedis", ")", ";", "}" ]
Remove (delete) the <code>{@link org.quartz.Trigger}</code> with the given key. If the associated job is non-durable and has no triggers after the given trigger is removed, the job will be removed, as well. @param triggerKey the key of the trigger to be removed @param jedis a thread-safe Redis connection @return true if the trigger was found and removed
[ "Remove", "(", "delete", ")", "the", "<code", ">", "{" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L235-L237
dita-ot/dita-ot
src/main/java/org/dita/dost/util/XMLUtils.java
XMLUtils.addOrSetAttribute
public static void addOrSetAttribute(final AttributesImpl atts, final String localName, final String value) { addOrSetAttribute(atts, NULL_NS_URI, localName, localName, "CDATA", value); }
java
public static void addOrSetAttribute(final AttributesImpl atts, final String localName, final String value) { addOrSetAttribute(atts, NULL_NS_URI, localName, localName, "CDATA", value); }
[ "public", "static", "void", "addOrSetAttribute", "(", "final", "AttributesImpl", "atts", ",", "final", "String", "localName", ",", "final", "String", "value", ")", "{", "addOrSetAttribute", "(", "atts", ",", "NULL_NS_URI", ",", "localName", ",", "localName", ","...
Add or set attribute. Convenience method for {@link #addOrSetAttribute(AttributesImpl, String, String, String, String, String)}. @param atts attributes @param localName local name @param value attribute value
[ "Add", "or", "set", "attribute", ".", "Convenience", "method", "for", "{", "@link", "#addOrSetAttribute", "(", "AttributesImpl", "String", "String", "String", "String", "String", ")", "}", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLUtils.java#L380-L382
theHilikus/JRoboCom
jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/player/Bank.java
Bank.plugInterfaces
final public void plugInterfaces(RobotAction newControl, RobotStatus newStatus, WorldInfo newWorld) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new GamePermission("connectBank")); } control = newControl; info = newStatus; world = newWorld; }
java
final public void plugInterfaces(RobotAction newControl, RobotStatus newStatus, WorldInfo newWorld) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new GamePermission("connectBank")); } control = newControl; info = newStatus; world = newWorld; }
[ "final", "public", "void", "plugInterfaces", "(", "RobotAction", "newControl", ",", "RobotStatus", "newStatus", ",", "WorldInfo", "newWorld", ")", "{", "SecurityManager", "sm", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "sm", "!=", "nu...
Attaches a control to a bank @param newControl control to attach @param newStatus status provider to attach @param newWorld world info provider to attach
[ "Attaches", "a", "control", "to", "a", "bank" ]
train
https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/player/Bank.java#L75-L84
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java
CSSErrorStrategy.recoverInline
public Token recoverInline(Parser recognizer) throws RecognitionException { throw new RecognitionException(recognizer, recognizer.getInputStream(), recognizer.getContext()); }
java
public Token recoverInline(Parser recognizer) throws RecognitionException { throw new RecognitionException(recognizer, recognizer.getInputStream(), recognizer.getContext()); }
[ "public", "Token", "recoverInline", "(", "Parser", "recognizer", ")", "throws", "RecognitionException", "{", "throw", "new", "RecognitionException", "(", "recognizer", ",", "recognizer", ".", "getInputStream", "(", ")", ",", "recognizer", ".", "getContext", "(", "...
throws RecognitionException to handle in parser's catch block
[ "throws", "RecognitionException", "to", "handle", "in", "parser", "s", "catch", "block" ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L49-L51
janus-project/guava.janusproject.io
guava/src/com/google/common/util/concurrent/MoreExecutors.java
MoreExecutors.renamingDecorator
static Executor renamingDecorator(final Executor executor, final Supplier<String> nameSupplier) { checkNotNull(executor); checkNotNull(nameSupplier); if (isAppEngine()) { // AppEngine doesn't support thread renaming, so don't even try return executor; } return new Executor() { @Override public void execute(Runnable command) { executor.execute(Callables.threadRenaming(command, nameSupplier)); } }; }
java
static Executor renamingDecorator(final Executor executor, final Supplier<String> nameSupplier) { checkNotNull(executor); checkNotNull(nameSupplier); if (isAppEngine()) { // AppEngine doesn't support thread renaming, so don't even try return executor; } return new Executor() { @Override public void execute(Runnable command) { executor.execute(Callables.threadRenaming(command, nameSupplier)); } }; }
[ "static", "Executor", "renamingDecorator", "(", "final", "Executor", "executor", ",", "final", "Supplier", "<", "String", ">", "nameSupplier", ")", "{", "checkNotNull", "(", "executor", ")", ";", "checkNotNull", "(", "nameSupplier", ")", ";", "if", "(", "isApp...
Creates an {@link Executor} that renames the {@link Thread threads} that its tasks run in. <p>The names are retrieved from the {@code nameSupplier} on the thread that is being renamed right before each task is run. The renaming is best effort, if a {@link SecurityManager} prevents the renaming then it will be skipped but the tasks will still execute. @param executor The executor to decorate @param nameSupplier The source of names for each task
[ "Creates", "an", "{", "@link", "Executor", "}", "that", "renames", "the", "{", "@link", "Thread", "threads", "}", "that", "its", "tasks", "run", "in", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/util/concurrent/MoreExecutors.java#L840-L852
structurizr/java
structurizr-core/src/com/structurizr/documentation/StructurizrDocumentationTemplate.java
StructurizrDocumentationTemplate.addCodeSection
@Nonnull public Section addCodeSection(@Nullable Component component, File... files) throws IOException { return addSection(component, "Code", files); }
java
@Nonnull public Section addCodeSection(@Nullable Component component, File... files) throws IOException { return addSection(component, "Code", files); }
[ "@", "Nonnull", "public", "Section", "addCodeSection", "(", "@", "Nullable", "Component", "component", ",", "File", "...", "files", ")", "throws", "IOException", "{", "return", "addSection", "(", "component", ",", "\"Code\"", ",", "files", ")", ";", "}" ]
Adds a "Code" section relating to a {@link Component} from one or more files. @param component the {@link Component} the documentation content relates to @param files one or more File objects that point to the documentation content @return a documentation {@link Section} @throws IOException if there is an error reading the files
[ "Adds", "a", "Code", "section", "relating", "to", "a", "{", "@link", "Component", "}", "from", "one", "or", "more", "files", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/StructurizrDocumentationTemplate.java#L265-L268
bwkimmel/jdcp
jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptFacade.java
ScriptFacade.submitJob
public UUID submitJob(ParallelizableJob job) throws Exception { return submitJob(job, job.getClass().getSimpleName()); }
java
public UUID submitJob(ParallelizableJob job) throws Exception { return submitJob(job, job.getClass().getSimpleName()); }
[ "public", "UUID", "submitJob", "(", "ParallelizableJob", "job", ")", "throws", "Exception", "{", "return", "submitJob", "(", "job", ",", "job", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "}" ]
Submits a job to be processed. @param job The <code>ParallelizableJob</code> to submit. @return The <code>UUID</code> identifying the submitted job. @throws Exception if an error occurs in delegating the request to the configured job service
[ "Submits", "a", "job", "to", "be", "processed", "." ]
train
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptFacade.java#L103-L105
IBM/ibm-cos-sdk-java
ibm-cos-java-sdk-core/src/main/java/com/ibm/cloud/objectstorage/internal/http/JsonErrorCodeParser.java
JsonErrorCodeParser.parseErrorCode
public String parseErrorCode(HttpResponse response, JsonContent jsonContent) { String errorCodeFromHeader = parseErrorCodeFromHeader(response.getHeaders()); if (errorCodeFromHeader != null) { return errorCodeFromHeader; } else if (jsonContent != null) { return parseErrorCodeFromContents(jsonContent.getJsonNode()); } else { return null; } }
java
public String parseErrorCode(HttpResponse response, JsonContent jsonContent) { String errorCodeFromHeader = parseErrorCodeFromHeader(response.getHeaders()); if (errorCodeFromHeader != null) { return errorCodeFromHeader; } else if (jsonContent != null) { return parseErrorCodeFromContents(jsonContent.getJsonNode()); } else { return null; } }
[ "public", "String", "parseErrorCode", "(", "HttpResponse", "response", ",", "JsonContent", "jsonContent", ")", "{", "String", "errorCodeFromHeader", "=", "parseErrorCodeFromHeader", "(", "response", ".", "getHeaders", "(", ")", ")", ";", "if", "(", "errorCodeFromHea...
Parse the error code from the response. @return Error Code of exceptional response or null if it can't be determined
[ "Parse", "the", "error", "code", "from", "the", "response", "." ]
train
https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-core/src/main/java/com/ibm/cloud/objectstorage/internal/http/JsonErrorCodeParser.java#L48-L57
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.checkExistenceAsync
public Observable<Boolean> checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { return checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1<ServiceResponse<Boolean>, Boolean>() { @Override public Boolean call(ServiceResponse<Boolean> response) { return response.body(); } }); }
java
public Observable<Boolean> checkExistenceAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String apiVersion) { return checkExistenceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).map(new Func1<ServiceResponse<Boolean>, Boolean>() { @Override public Boolean call(ServiceResponse<Boolean> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Boolean", ">", "checkExistenceAsync", "(", "String", "resourceGroupName", ",", "String", "resourceProviderNamespace", ",", "String", "parentResourcePath", ",", "String", "resourceType", ",", "String", "resourceName", ",", "String", "apiVers...
Checks whether a resource exists. @param resourceGroupName The name of the resource group containing the resource to check. The name is case insensitive. @param resourceProviderNamespace The resource provider of the resource to check. @param parentResourcePath The parent resource identity. @param resourceType The resource type. @param resourceName The name of the resource to check whether it exists. @param apiVersion The API version to use for the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Boolean object
[ "Checks", "whether", "a", "resource", "exists", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L1009-L1016
syphr42/prom
src/main/java/org/syphr/prom/PropertiesManager.java
PropertiesManager.setProperty
public void setProperty(T property, Object value) throws IllegalArgumentException { if (value == null) { throw new IllegalArgumentException("Cannot set a null value, use reset instead"); } setProperty(property, value.toString()); }
java
public void setProperty(T property, Object value) throws IllegalArgumentException { if (value == null) { throw new IllegalArgumentException("Cannot set a null value, use reset instead"); } setProperty(property, value.toString()); }
[ "public", "void", "setProperty", "(", "T", "property", ",", "Object", "value", ")", "throws", "IllegalArgumentException", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot set a null value, use reset instead\""...
Set the given property using an object's string representation. This will not write the new value to the file system. @see #saveProperty(Object, Object) @param property the property whose value is being set @param value the value to set @throws IllegalArgumentException if a <code>null</code> value is given (see {@link #resetProperty(Object)})
[ "Set", "the", "given", "property", "using", "an", "object", "s", "string", "representation", ".", "This", "will", "not", "write", "the", "new", "value", "to", "the", "file", "system", "." ]
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManager.java#L915-L923
line/armeria
core/src/main/java/com/linecorp/armeria/common/CacheControlBuilder.java
CacheControlBuilder.validateDuration
protected static long validateDuration(@Nullable Duration value, String name) { if (value == null) { return -1; } checkArgument(!value.isNegative(), "%s: %s (expected: >= 0)", name, value); return value.getSeconds(); }
java
protected static long validateDuration(@Nullable Duration value, String name) { if (value == null) { return -1; } checkArgument(!value.isNegative(), "%s: %s (expected: >= 0)", name, value); return value.getSeconds(); }
[ "protected", "static", "long", "validateDuration", "(", "@", "Nullable", "Duration", "value", ",", "String", "name", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "-", "1", ";", "}", "checkArgument", "(", "!", "value", ".", "isNegative"...
Makes sure the specified {@link Duration} is not negative. @param value the duration @param name the name of the parameter @return the duration converted into seconds
[ "Makes", "sure", "the", "specified", "{", "@link", "Duration", "}", "is", "not", "negative", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/CacheControlBuilder.java#L133-L140
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java
MarshallUtil.unmarshallCollection
public static <E, T extends Collection<E>> T unmarshallCollection(ObjectInput in, CollectionBuilder<E, T> builder, ElementReader<E> reader) throws IOException, ClassNotFoundException { final int size = unmarshallSize(in); if (size == NULL_VALUE) { return null; } T collection = Objects.requireNonNull(builder, "CollectionBuilder must be non-null").build(size); for (int i = 0; i < size; ++i) { //noinspection unchecked collection.add(reader.readFrom(in)); } return collection; }
java
public static <E, T extends Collection<E>> T unmarshallCollection(ObjectInput in, CollectionBuilder<E, T> builder, ElementReader<E> reader) throws IOException, ClassNotFoundException { final int size = unmarshallSize(in); if (size == NULL_VALUE) { return null; } T collection = Objects.requireNonNull(builder, "CollectionBuilder must be non-null").build(size); for (int i = 0; i < size; ++i) { //noinspection unchecked collection.add(reader.readFrom(in)); } return collection; }
[ "public", "static", "<", "E", ",", "T", "extends", "Collection", "<", "E", ">", ">", "T", "unmarshallCollection", "(", "ObjectInput", "in", ",", "CollectionBuilder", "<", "E", ",", "T", ">", "builder", ",", "ElementReader", "<", "E", ">", "reader", ")", ...
Unmarshal a {@link Collection}. @param in {@link ObjectInput} to read. @param builder {@link CollectionBuilder} builds the concrete {@link Collection} based on size. @param reader {@link ElementReader} reads one element from the input. @param <E> Collection's element type. @param <T> {@link Collection} implementation. @return The concrete {@link Collection} implementation. @throws IOException If any of the usual Input/Output related exceptions occur. @throws ClassNotFoundException If the class of a serialized object cannot be found.
[ "Unmarshal", "a", "{", "@link", "Collection", "}", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L268-L279
aws/aws-sdk-java
aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/StartBackupJobRequest.java
StartBackupJobRequest.withRecoveryPointTags
public StartBackupJobRequest withRecoveryPointTags(java.util.Map<String, String> recoveryPointTags) { setRecoveryPointTags(recoveryPointTags); return this; }
java
public StartBackupJobRequest withRecoveryPointTags(java.util.Map<String, String> recoveryPointTags) { setRecoveryPointTags(recoveryPointTags); return this; }
[ "public", "StartBackupJobRequest", "withRecoveryPointTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "recoveryPointTags", ")", "{", "setRecoveryPointTags", "(", "recoveryPointTags", ")", ";", "return", "this", ";", "}" ]
<p> To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a key-value pair. </p> @param recoveryPointTags To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a key-value pair. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "To", "help", "organize", "your", "resources", "you", "can", "assign", "your", "own", "metadata", "to", "the", "resources", "that", "you", "create", ".", "Each", "tag", "is", "a", "key", "-", "value", "pair", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/StartBackupJobRequest.java#L497-L500
h2oai/h2o-3
h2o-algos/src/main/java/hex/deeplearning/DeepLearningTask.java
DeepLearningTask.processRow
@Override public final void processRow(long seed, DataInfo.Row r, int mb) { if (_localmodel.get_params()._reproducible) { seed += _localmodel.get_processed_global(); //avoid periodicity } else { seed = _dropout_rng.nextLong(); // non-reproducible case - make a fast & good random number } _localmodel.checkMissingCats(r.binIds); ((Neurons.Input) _neurons[0]).setInput(seed, r.isSparse() ? r.numIds : null, r.numVals, r.nBins, r.binIds, mb); }
java
@Override public final void processRow(long seed, DataInfo.Row r, int mb) { if (_localmodel.get_params()._reproducible) { seed += _localmodel.get_processed_global(); //avoid periodicity } else { seed = _dropout_rng.nextLong(); // non-reproducible case - make a fast & good random number } _localmodel.checkMissingCats(r.binIds); ((Neurons.Input) _neurons[0]).setInput(seed, r.isSparse() ? r.numIds : null, r.numVals, r.nBins, r.binIds, mb); }
[ "@", "Override", "public", "final", "void", "processRow", "(", "long", "seed", ",", "DataInfo", ".", "Row", "r", ",", "int", "mb", ")", "{", "if", "(", "_localmodel", ".", "get_params", "(", ")", ".", "_reproducible", ")", "{", "seed", "+=", "_localmod...
Process one training row at a time (online learning) @param seed Seed is only used if reproducible mode is enabled @param r Row (must be dense for now) @param mb mini-batch internal index
[ "Process", "one", "training", "row", "at", "a", "time", "(", "online", "learning", ")" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/deeplearning/DeepLearningTask.java#L101-L109
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/struct/image/InterleavedU8.java
InterleavedU8.get24
public int get24( int x , int y ) { int i = startIndex + y*stride+x*3; return ((data[i]&0xFF) << 16) | ((data[i+1]&0xFF) << 8) | (data[i+2]&0xFF); }
java
public int get24( int x , int y ) { int i = startIndex + y*stride+x*3; return ((data[i]&0xFF) << 16) | ((data[i+1]&0xFF) << 8) | (data[i+2]&0xFF); }
[ "public", "int", "get24", "(", "int", "x", ",", "int", "y", ")", "{", "int", "i", "=", "startIndex", "+", "y", "*", "stride", "+", "x", "*", "3", ";", "return", "(", "(", "data", "[", "i", "]", "&", "0xFF", ")", "<<", "16", ")", "|", "(", ...
Returns an integer formed from 3 bands. a[i] << 16 | a[i+1]<<8 | a[i+2] @param x column @param y row @return 32 bit integer
[ "Returns", "an", "integer", "formed", "from", "3", "bands", ".", "a", "[", "i", "]", "<<", "16", "|", "a", "[", "i", "+", "1", "]", "<<8", "|", "a", "[", "i", "+", "2", "]" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/image/InterleavedU8.java#L68-L71
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java
IntersectionImpl.initNewDirectInstance
static IntersectionImpl initNewDirectInstance(final long seed, final WritableMemory dstMem) { final IntersectionImpl impl = new IntersectionImpl(dstMem, seed, true); //Load Preamble insertPreLongs(dstMem, CONST_PREAMBLE_LONGS); //RF not used = 0 insertSerVer(dstMem, SER_VER); insertFamilyID(dstMem, Family.INTERSECTION.getID()); //Note: Intersection does not use lgNomLongs or k, per se. //set lgArrLongs initially to minimum. Don't clear cache in mem insertLgArrLongs(dstMem, MIN_LG_ARR_LONGS); insertFlags(dstMem, 0); //bigEndian = readOnly = compact = ordered = empty = false; //seedHash loaded and checked in private constructor insertCurCount(dstMem, -1); insertP(dstMem, (float) 1.0); insertThetaLong(dstMem, Long.MAX_VALUE); //Initialize impl.lgArrLongs_ = MIN_LG_ARR_LONGS; impl.curCount_ = -1; //set in mem below impl.thetaLong_ = Long.MAX_VALUE; impl.empty_ = false; impl.maxLgArrLongs_ = checkMaxLgArrLongs(dstMem); //Only Off Heap return impl; }
java
static IntersectionImpl initNewDirectInstance(final long seed, final WritableMemory dstMem) { final IntersectionImpl impl = new IntersectionImpl(dstMem, seed, true); //Load Preamble insertPreLongs(dstMem, CONST_PREAMBLE_LONGS); //RF not used = 0 insertSerVer(dstMem, SER_VER); insertFamilyID(dstMem, Family.INTERSECTION.getID()); //Note: Intersection does not use lgNomLongs or k, per se. //set lgArrLongs initially to minimum. Don't clear cache in mem insertLgArrLongs(dstMem, MIN_LG_ARR_LONGS); insertFlags(dstMem, 0); //bigEndian = readOnly = compact = ordered = empty = false; //seedHash loaded and checked in private constructor insertCurCount(dstMem, -1); insertP(dstMem, (float) 1.0); insertThetaLong(dstMem, Long.MAX_VALUE); //Initialize impl.lgArrLongs_ = MIN_LG_ARR_LONGS; impl.curCount_ = -1; //set in mem below impl.thetaLong_ = Long.MAX_VALUE; impl.empty_ = false; impl.maxLgArrLongs_ = checkMaxLgArrLongs(dstMem); //Only Off Heap return impl; }
[ "static", "IntersectionImpl", "initNewDirectInstance", "(", "final", "long", "seed", ",", "final", "WritableMemory", "dstMem", ")", "{", "final", "IntersectionImpl", "impl", "=", "new", "IntersectionImpl", "(", "dstMem", ",", "seed", ",", "true", ")", ";", "//Lo...
Construct a new Intersection target direct to the given destination Memory. Called by SetOperation.Builder. @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Seed</a> @param dstMem destination Memory. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @return a new IntersectionImpl that may be off-heap
[ "Construct", "a", "new", "Intersection", "target", "direct", "to", "the", "given", "destination", "Memory", ".", "Called", "by", "SetOperation", ".", "Builder", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/IntersectionImpl.java#L74-L98
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/cache/CacheManager.java
CacheManager.getKey
public String getKey(String tableName, String query, Object[] params) { return tableName + query + (params == null ? null : Arrays.asList(params).toString()); }
java
public String getKey(String tableName, String query, Object[] params) { return tableName + query + (params == null ? null : Arrays.asList(params).toString()); }
[ "public", "String", "getKey", "(", "String", "tableName", ",", "String", "query", ",", "Object", "[", "]", "params", ")", "{", "return", "tableName", "+", "query", "+", "(", "params", "==", "null", "?", "null", ":", "Arrays", ".", "asList", "(", "param...
Generates a cache key. Subclasses may override this implementation. @param tableName name of a table @param query query @param params query parameters. @return generated key for tied to these parameters.
[ "Generates", "a", "cache", "key", ".", "Subclasses", "may", "override", "this", "implementation", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/cache/CacheManager.java#L138-L140
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifier.java
LinearClassifier.topFeaturesToString
public String topFeaturesToString(List<Triple<F,L,Double>> topFeatures) { // find longest key length (for pretty printing) with a limit int maxLeng = 0; for (Triple<F,L,Double> t : topFeatures) { String key = "(" + t.first + "," + t.second + ")"; int leng = key.length(); if (leng > maxLeng) { maxLeng = leng; } } maxLeng = Math.min(64, maxLeng); // set up pretty printing of weights NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(4); nf.setMaximumFractionDigits(4); if (nf instanceof DecimalFormat) { ((DecimalFormat) nf).setPositivePrefix(" "); } //print high weight features to a String StringBuilder sb = new StringBuilder(); for (Triple<F,L,Double> t : topFeatures) { String key = "(" + t.first + "," + t.second + ")"; sb.append(StringUtils.pad(key, maxLeng)); sb.append(" "); double cnt = t.third(); if (Double.isInfinite(cnt)) { sb.append(cnt); } else { sb.append(nf.format(cnt)); } sb.append("\n"); } return sb.toString(); }
java
public String topFeaturesToString(List<Triple<F,L,Double>> topFeatures) { // find longest key length (for pretty printing) with a limit int maxLeng = 0; for (Triple<F,L,Double> t : topFeatures) { String key = "(" + t.first + "," + t.second + ")"; int leng = key.length(); if (leng > maxLeng) { maxLeng = leng; } } maxLeng = Math.min(64, maxLeng); // set up pretty printing of weights NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMinimumFractionDigits(4); nf.setMaximumFractionDigits(4); if (nf instanceof DecimalFormat) { ((DecimalFormat) nf).setPositivePrefix(" "); } //print high weight features to a String StringBuilder sb = new StringBuilder(); for (Triple<F,L,Double> t : topFeatures) { String key = "(" + t.first + "," + t.second + ")"; sb.append(StringUtils.pad(key, maxLeng)); sb.append(" "); double cnt = t.third(); if (Double.isInfinite(cnt)) { sb.append(cnt); } else { sb.append(nf.format(cnt)); } sb.append("\n"); } return sb.toString(); }
[ "public", "String", "topFeaturesToString", "(", "List", "<", "Triple", "<", "F", ",", "L", ",", "Double", ">", ">", "topFeatures", ")", "{", "// find longest key length (for pretty printing) with a limit\r", "int", "maxLeng", "=", "0", ";", "for", "(", "Triple", ...
Returns string representation of a list of top features @param topFeatures List of triples indicating feature, label, weight @return String representation of the list of features
[ "Returns", "string", "representation", "of", "a", "list", "of", "top", "features" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L532-L568
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/PartialUpdate.java
PartialUpdate.addValueToField
public void addValueToField(String fieldName, Object value) { add(new SimpleUpdateField(fieldName, value, UpdateAction.ADD)); }
java
public void addValueToField(String fieldName, Object value) { add(new SimpleUpdateField(fieldName, value, UpdateAction.ADD)); }
[ "public", "void", "addValueToField", "(", "String", "fieldName", ",", "Object", "value", ")", "{", "add", "(", "new", "SimpleUpdateField", "(", "fieldName", ",", "value", ",", "UpdateAction", ".", "ADD", ")", ")", ";", "}" ]
Add field with given name and value using {@link UpdateAction#ADD} to the fields to be updated. @param fieldName @param value
[ "Add", "field", "with", "given", "name", "and", "value", "using", "{", "@link", "UpdateAction#ADD", "}", "to", "the", "fields", "to", "be", "updated", "." ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/PartialUpdate.java#L79-L81
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeMaker.java
TypeMaker.typeParametersString
static String typeParametersString(DocEnv env, Symbol sym, boolean full) { if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) { return ""; } StringBuilder s = new StringBuilder(); for (Type t : sym.type.getTypeArguments()) { s.append(s.length() == 0 ? "<" : ", "); s.append(TypeVariableImpl.typeVarToString(env, (TypeVar)t, full)); } s.append(">"); return s.toString(); }
java
static String typeParametersString(DocEnv env, Symbol sym, boolean full) { if (env.legacyDoclet || sym.type.getTypeArguments().isEmpty()) { return ""; } StringBuilder s = new StringBuilder(); for (Type t : sym.type.getTypeArguments()) { s.append(s.length() == 0 ? "<" : ", "); s.append(TypeVariableImpl.typeVarToString(env, (TypeVar)t, full)); } s.append(">"); return s.toString(); }
[ "static", "String", "typeParametersString", "(", "DocEnv", "env", ",", "Symbol", "sym", ",", "boolean", "full", ")", "{", "if", "(", "env", ".", "legacyDoclet", "||", "sym", ".", "type", ".", "getTypeArguments", "(", ")", ".", "isEmpty", "(", ")", ")", ...
Return the formal type parameters of a class or method as an angle-bracketed string. Each parameter is a type variable with optional bounds. Class names are qualified if "full" is true. Return "" if there are no type parameters or we're hiding generics.
[ "Return", "the", "formal", "type", "parameters", "of", "a", "class", "or", "method", "as", "an", "angle", "-", "bracketed", "string", ".", "Each", "parameter", "is", "a", "type", "variable", "with", "optional", "bounds", ".", "Class", "names", "are", "qual...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/TypeMaker.java#L184-L195
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/AuthenticationServiceImpl.java
AuthenticationServiceImpl.updateCacheState
private void updateCacheState(Map<String, Object> props) { getAuthenticationConfig(props); if (cacheEnabled) { authCacheServiceRef.activate(cc); } else { authCacheServiceRef.deactivate(cc); } }
java
private void updateCacheState(Map<String, Object> props) { getAuthenticationConfig(props); if (cacheEnabled) { authCacheServiceRef.activate(cc); } else { authCacheServiceRef.deactivate(cc); } }
[ "private", "void", "updateCacheState", "(", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "getAuthenticationConfig", "(", "props", ")", ";", "if", "(", "cacheEnabled", ")", "{", "authCacheServiceRef", ".", "activate", "(", "cc", ")", ";", "}...
Based on the configuration properties, the auth cache should either be active or not. @param props
[ "Based", "on", "the", "configuration", "properties", "the", "auth", "cache", "should", "either", "be", "active", "or", "not", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/internal/AuthenticationServiceImpl.java#L141-L149
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java
Translate.translateEdgeValues
public static <K, OLD, NEW> DataSet<Edge<K, NEW>> translateEdgeValues(DataSet<Edge<K, OLD>> edges, TranslateFunction<OLD, NEW> translator) { return translateEdgeValues(edges, translator, PARALLELISM_DEFAULT); }
java
public static <K, OLD, NEW> DataSet<Edge<K, NEW>> translateEdgeValues(DataSet<Edge<K, OLD>> edges, TranslateFunction<OLD, NEW> translator) { return translateEdgeValues(edges, translator, PARALLELISM_DEFAULT); }
[ "public", "static", "<", "K", ",", "OLD", ",", "NEW", ">", "DataSet", "<", "Edge", "<", "K", ",", "NEW", ">", ">", "translateEdgeValues", "(", "DataSet", "<", "Edge", "<", "K", ",", "OLD", ">", ">", "edges", ",", "TranslateFunction", "<", "OLD", ",...
Translate {@link Edge} values using the given {@link TranslateFunction}. @param edges input edges @param translator implements conversion from {@code OLD} to {@code NEW} @param <K> edge ID type @param <OLD> old edge value type @param <NEW> new edge value type @return translated edges
[ "Translate", "{", "@link", "Edge", "}", "values", "using", "the", "given", "{", "@link", "TranslateFunction", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java#L304-L306
Azure/azure-sdk-for-java
dns/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/dns/v2017_10_01/implementation/ZonesInner.java
ZonesInner.updateAsync
public Observable<ZoneInner> updateAsync(String resourceGroupName, String zoneName, String ifMatch, Map<String, String> tags) { return updateWithServiceResponseAsync(resourceGroupName, zoneName, ifMatch, tags).map(new Func1<ServiceResponse<ZoneInner>, ZoneInner>() { @Override public ZoneInner call(ServiceResponse<ZoneInner> response) { return response.body(); } }); }
java
public Observable<ZoneInner> updateAsync(String resourceGroupName, String zoneName, String ifMatch, Map<String, String> tags) { return updateWithServiceResponseAsync(resourceGroupName, zoneName, ifMatch, tags).map(new Func1<ServiceResponse<ZoneInner>, ZoneInner>() { @Override public ZoneInner call(ServiceResponse<ZoneInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ZoneInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "zoneName", ",", "String", "ifMatch", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateWithServiceResponseAsync", "(...
Updates a DNS zone. Does not modify DNS records within the zone. @param resourceGroupName The name of the resource group. @param zoneName The name of the DNS zone (without a terminating dot). @param ifMatch The etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally overwritting any concurrent changes. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ZoneInner object
[ "Updates", "a", "DNS", "zone", ".", "Does", "not", "modify", "DNS", "records", "within", "the", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/dns/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/dns/v2017_10_01/implementation/ZonesInner.java#L820-L827
fernandospr/javapns-jdk16
src/main/java/javapns/notification/Payload.java
Payload.addCustomDictionary
public void addCustomDictionary(String name, String value) throws JSONException { logger.debug("Adding custom Dictionary [" + name + "] = [" + value + "]"); put(name, value, payload, false); }
java
public void addCustomDictionary(String name, String value) throws JSONException { logger.debug("Adding custom Dictionary [" + name + "] = [" + value + "]"); put(name, value, payload, false); }
[ "public", "void", "addCustomDictionary", "(", "String", "name", ",", "String", "value", ")", "throws", "JSONException", "{", "logger", ".", "debug", "(", "\"Adding custom Dictionary [\"", "+", "name", "+", "\"] = [\"", "+", "value", "+", "\"]\"", ")", ";", "pu...
Add a custom dictionnary with a string value @param name @param value @throws JSONException
[ "Add", "a", "custom", "dictionnary", "with", "a", "string", "value" ]
train
https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/notification/Payload.java#L77-L80
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java
ForwardCurve.createForwardCurveFromForwards
public static ForwardCurve createForwardCurveFromForwards(String name, LocalDate referenceDate, String paymentOffsetCode, InterpolationEntityForward interpolationEntityForward, String discountCurveName, AnalyticModelInterface model, double[] times, double[] givenForwards) { ForwardCurve forwardCurve = new ForwardCurve(name, referenceDate, paymentOffsetCode, interpolationEntityForward, discountCurveName); for(int timeIndex=0; timeIndex<times.length;timeIndex++) { forwardCurve.addForward(model, times[timeIndex], givenForwards[timeIndex], false); } return forwardCurve; }
java
public static ForwardCurve createForwardCurveFromForwards(String name, LocalDate referenceDate, String paymentOffsetCode, InterpolationEntityForward interpolationEntityForward, String discountCurveName, AnalyticModelInterface model, double[] times, double[] givenForwards) { ForwardCurve forwardCurve = new ForwardCurve(name, referenceDate, paymentOffsetCode, interpolationEntityForward, discountCurveName); for(int timeIndex=0; timeIndex<times.length;timeIndex++) { forwardCurve.addForward(model, times[timeIndex], givenForwards[timeIndex], false); } return forwardCurve; }
[ "public", "static", "ForwardCurve", "createForwardCurveFromForwards", "(", "String", "name", ",", "LocalDate", "referenceDate", ",", "String", "paymentOffsetCode", ",", "InterpolationEntityForward", "interpolationEntityForward", ",", "String", "discountCurveName", ",", "Analy...
Create a forward curve from given times and given forwards. @param name The name of this curve. @param referenceDate The reference date for this code, i.e., the date which defines t=0. @param paymentOffsetCode The maturity of the index modeled by this curve. @param interpolationEntityForward Interpolation entity used for forward rate interpolation. @param discountCurveName The name of a discount curve associated with this index (associated with it's funding or collateralization), if any. @param model The model to be used to fetch the discount curve, if needed. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @return A new ForwardCurve object.
[ "Create", "a", "forward", "curve", "from", "given", "times", "and", "given", "forwards", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java#L208-L216
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
AnnotationTypeRequiredMemberBuilder.buildDeprecationInfo
public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) { writer.addDeprecated((MemberDoc) members.get(currentMemberIndex), annotationDocTree); }
java
public void buildDeprecationInfo(XMLNode node, Content annotationDocTree) { writer.addDeprecated((MemberDoc) members.get(currentMemberIndex), annotationDocTree); }
[ "public", "void", "buildDeprecationInfo", "(", "XMLNode", "node", ",", "Content", "annotationDocTree", ")", "{", "writer", ".", "addDeprecated", "(", "(", "MemberDoc", ")", "members", ".", "get", "(", "currentMemberIndex", ")", ",", "annotationDocTree", ")", ";"...
Build the deprecation information. @param node the XML element that specifies which components to document @param annotationDocTree the content tree to which the documentation will be added
[ "Build", "the", "deprecation", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java#L202-L205
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.addItemToList
public static void addItemToList(final Object target, final String fieldName, final Object value) { try { List list = (List) getFieldValue(target, fieldName); list.add(value); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void addItemToList(final Object target, final String fieldName, final Object value) { try { List list = (List) getFieldValue(target, fieldName); list.add(value); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "addItemToList", "(", "final", "Object", "target", ",", "final", "String", "fieldName", ",", "final", "Object", "value", ")", "{", "try", "{", "List", "list", "=", "(", "List", ")", "getFieldValue", "(", "target", ",", "fieldNam...
Adds the item to list. @param target the target @param fieldName the field name @param value the value
[ "Adds", "the", "item", "to", "list", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L284-L291
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/flow/FlowPath.java
FlowPath.setRewindPosition
public void setRewindPosition(@NonNull String frameName, int position) { frames.get(frameName).setRewindPosition(position); }
java
public void setRewindPosition(@NonNull String frameName, int position) { frames.get(frameName).setRewindPosition(position); }
[ "public", "void", "setRewindPosition", "(", "@", "NonNull", "String", "frameName", ",", "int", "position", ")", "{", "frames", ".", "get", "(", "frameName", ")", ".", "setRewindPosition", "(", "position", ")", ";", "}" ]
This method allows to set position for next rewind within graph @param frameName @param position
[ "This", "method", "allows", "to", "set", "position", "for", "next", "rewind", "within", "graph" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/flow/FlowPath.java#L197-L199
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedinstallationTemplate/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedinstallationTemplate.java
ApiOvhDedicatedinstallationTemplate.templateName_partitionScheme_schemeName_partition_mountpoint_GET
public OvhTemplatePartitions templateName_partitionScheme_schemeName_partition_mountpoint_GET(String templateName, String schemeName, String mountpoint) throws IOException { String qPath = "/dedicated/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint}"; StringBuilder sb = path(qPath, templateName, schemeName, mountpoint); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTemplatePartitions.class); }
java
public OvhTemplatePartitions templateName_partitionScheme_schemeName_partition_mountpoint_GET(String templateName, String schemeName, String mountpoint) throws IOException { String qPath = "/dedicated/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint}"; StringBuilder sb = path(qPath, templateName, schemeName, mountpoint); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTemplatePartitions.class); }
[ "public", "OvhTemplatePartitions", "templateName_partitionScheme_schemeName_partition_mountpoint_GET", "(", "String", "templateName", ",", "String", "schemeName", ",", "String", "mountpoint", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/installationT...
Get this object properties REST: GET /dedicated/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint} @param templateName [required] This template name @param schemeName [required] name of this partitioning scheme @param mountpoint [required] partition mount point
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedinstallationTemplate/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedinstallationTemplate.java#L88-L93
brianwhu/xillium
base/src/main/java/org/xillium/base/beans/Strings.java
Strings.splitCamelCase
public static String splitCamelCase(String text, String separator) { return CAMEL_REGEX.matcher(text).replaceAll(separator); }
java
public static String splitCamelCase(String text, String separator) { return CAMEL_REGEX.matcher(text).replaceAll(separator); }
[ "public", "static", "String", "splitCamelCase", "(", "String", "text", ",", "String", "separator", ")", "{", "return", "CAMEL_REGEX", ".", "matcher", "(", "text", ")", ".", "replaceAll", "(", "separator", ")", ";", "}" ]
Splits a single camel-case word into a word sequence. @param text - a single camel-case word @param separator - a word separator @return a word sequence with each word separated by the given separator
[ "Splits", "a", "single", "camel", "-", "case", "word", "into", "a", "word", "sequence", "." ]
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/beans/Strings.java#L138-L140
Red5/red5-server-common
src/main/java/org/red5/server/so/SharedObjectService.java
SharedObjectService.getStore
private IPersistenceStore getStore(IScope scope, boolean persistent) { IPersistenceStore store; if (!persistent) { // Use special store for non-persistent shared objects if (!scope.hasAttribute(SO_TRANSIENT_STORE)) { store = new RamPersistence(scope); scope.setAttribute(SO_TRANSIENT_STORE, store); return store; } return (IPersistenceStore) scope.getAttribute(SO_TRANSIENT_STORE); } // Evaluate configuration for persistent shared objects if (!scope.hasAttribute(SO_PERSISTENCE_STORE)) { try { store = PersistenceUtils.getPersistenceStore(scope, persistenceClassName); log.info("Created persistence store {} for shared objects", store); } catch (Exception err) { log.warn("Could not create persistence store ({}) for shared objects, falling back to Ram persistence", persistenceClassName, err); store = new RamPersistence(scope); } scope.setAttribute(SO_PERSISTENCE_STORE, store); return store; } return (IPersistenceStore) scope.getAttribute(SO_PERSISTENCE_STORE); }
java
private IPersistenceStore getStore(IScope scope, boolean persistent) { IPersistenceStore store; if (!persistent) { // Use special store for non-persistent shared objects if (!scope.hasAttribute(SO_TRANSIENT_STORE)) { store = new RamPersistence(scope); scope.setAttribute(SO_TRANSIENT_STORE, store); return store; } return (IPersistenceStore) scope.getAttribute(SO_TRANSIENT_STORE); } // Evaluate configuration for persistent shared objects if (!scope.hasAttribute(SO_PERSISTENCE_STORE)) { try { store = PersistenceUtils.getPersistenceStore(scope, persistenceClassName); log.info("Created persistence store {} for shared objects", store); } catch (Exception err) { log.warn("Could not create persistence store ({}) for shared objects, falling back to Ram persistence", persistenceClassName, err); store = new RamPersistence(scope); } scope.setAttribute(SO_PERSISTENCE_STORE, store); return store; } return (IPersistenceStore) scope.getAttribute(SO_PERSISTENCE_STORE); }
[ "private", "IPersistenceStore", "getStore", "(", "IScope", "scope", ",", "boolean", "persistent", ")", "{", "IPersistenceStore", "store", ";", "if", "(", "!", "persistent", ")", "{", "// Use special store for non-persistent shared objects\r", "if", "(", "!", "scope", ...
Return scope store @param scope Scope @param persistent Persistent store or not? @return Scope's store
[ "Return", "scope", "store" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/SharedObjectService.java#L112-L136
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java
SeaGlassButtonUI.paintBackground
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) { if (((AbstractButton) c).isContentAreaFilled()) { context.getPainter().paintButtonBackground(context, g, 0, 0, c.getWidth(), c.getHeight()); } }
java
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) { if (((AbstractButton) c).isContentAreaFilled()) { context.getPainter().paintButtonBackground(context, g, 0, 0, c.getWidth(), c.getHeight()); } }
[ "void", "paintBackground", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ",", "JComponent", "c", ")", "{", "if", "(", "(", "(", "AbstractButton", ")", "c", ")", ".", "isContentAreaFilled", "(", ")", ")", "{", "context", ".", "getPainter", "(", ...
Paint the button background. @param context the Synth context. @param g the Graphics context. @param c the button component.
[ "Paint", "the", "button", "background", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L341-L345
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.generateThumbnailInStreamAsync
public Observable<InputStream> generateThumbnailInStreamAsync(int width, int height, byte[] image, GenerateThumbnailInStreamOptionalParameter generateThumbnailInStreamOptionalParameter) { return generateThumbnailInStreamWithServiceResponseAsync(width, height, image, generateThumbnailInStreamOptionalParameter).map(new Func1<ServiceResponse<InputStream>, InputStream>() { @Override public InputStream call(ServiceResponse<InputStream> response) { return response.body(); } }); }
java
public Observable<InputStream> generateThumbnailInStreamAsync(int width, int height, byte[] image, GenerateThumbnailInStreamOptionalParameter generateThumbnailInStreamOptionalParameter) { return generateThumbnailInStreamWithServiceResponseAsync(width, height, image, generateThumbnailInStreamOptionalParameter).map(new Func1<ServiceResponse<InputStream>, InputStream>() { @Override public InputStream call(ServiceResponse<InputStream> response) { return response.body(); } }); }
[ "public", "Observable", "<", "InputStream", ">", "generateThumbnailInStreamAsync", "(", "int", "width", ",", "int", "height", ",", "byte", "[", "]", "image", ",", "GenerateThumbnailInStreamOptionalParameter", "generateThumbnailInStreamOptionalParameter", ")", "{", "return...
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. @param width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. @param image An image stream. @param generateThumbnailInStreamOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the InputStream object
[ "This", "operation", "generates", "a", "thumbnail", "image", "with", "the", "user", "-", "specified", "width", "and", "height", ".", "By", "default", "the", "service", "analyzes", "the", "image", "identifies", "the", "region", "of", "interest", "(", "ROI", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L934-L941
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.getTopology
public TopologyInner getTopology(String resourceGroupName, String networkWatcherName, TopologyParameters parameters) { return getTopologyWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
java
public TopologyInner getTopology(String resourceGroupName, String networkWatcherName, TopologyParameters parameters) { return getTopologyWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
[ "public", "TopologyInner", "getTopology", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "TopologyParameters", "parameters", ")", "{", "return", "getTopologyWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ",", "...
Gets the current network topology by resource group. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param parameters Parameters that define the representation of topology. @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 TopologyInner object if successful.
[ "Gets", "the", "current", "network", "topology", "by", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L866-L868
google/closure-compiler
src/com/google/javascript/jscomp/PeepholeRemoveDeadCode.java
PeepholeRemoveDeadCode.removeCase
private void removeCase(Node switchNode, Node caseNode) { NodeUtil.redeclareVarsInsideBranch(caseNode); switchNode.removeChild(caseNode); reportChangeToEnclosingScope(switchNode); }
java
private void removeCase(Node switchNode, Node caseNode) { NodeUtil.redeclareVarsInsideBranch(caseNode); switchNode.removeChild(caseNode); reportChangeToEnclosingScope(switchNode); }
[ "private", "void", "removeCase", "(", "Node", "switchNode", ",", "Node", "caseNode", ")", "{", "NodeUtil", ".", "redeclareVarsInsideBranch", "(", "caseNode", ")", ";", "switchNode", ".", "removeChild", "(", "caseNode", ")", ";", "reportChangeToEnclosingScope", "("...
Remove the case from the switch redeclaring any variables declared in it. @param caseNode The case to remove.
[ "Remove", "the", "case", "from", "the", "switch", "redeclaring", "any", "variables", "declared", "in", "it", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PeepholeRemoveDeadCode.java#L651-L655
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createMessageElement
private void createMessageElement(StringBuilder sb, RepositoryLogRecord record){ // 660484 elim string concat sb.append(lineSeparator).append(INDENT[0]).append("<msgDataElement msgLocale=\"").append(record.getMessageLocale()).append("\">"); if (record.getParameters() != null) { // how many params do we have? for (int c = 0; c < record.getParameters().length; c++) { sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogTokens value=\""). append(MessageFormat.format("{" + c + "}", record.getParameters())).append("\"/>"); } } // IBM SWG MsgID if (record.getMessageID() != null) { // Seems to be a IBM SWG ID. sb.append(lineSeparator).append(INDENT[1]).append("<msgId>").append(record.getMessageID()).append("</msgId>"); // IBM SWG MsgType sb.append(lineSeparator).append(INDENT[1]).append("<msgIdType>"); if (record.getMessageID().length() == 10) sb.append("IBM5.4.1"); else sb.append("IBM4.4.1"); sb.append("</msgIdType>"); } if (record.getRawMessage() != null && record.getResourceBundleName() != null) { sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogId>").append(record.getRawMessage()).append("</msgCatalogId>"); sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogType>Java</msgCatalogType>"); sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalog>").append(record.getResourceBundleName()).append("</msgCatalog>"); } sb.append(lineSeparator).append(INDENT[0]).append("</msgDataElement>"); }
java
private void createMessageElement(StringBuilder sb, RepositoryLogRecord record){ // 660484 elim string concat sb.append(lineSeparator).append(INDENT[0]).append("<msgDataElement msgLocale=\"").append(record.getMessageLocale()).append("\">"); if (record.getParameters() != null) { // how many params do we have? for (int c = 0; c < record.getParameters().length; c++) { sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogTokens value=\""). append(MessageFormat.format("{" + c + "}", record.getParameters())).append("\"/>"); } } // IBM SWG MsgID if (record.getMessageID() != null) { // Seems to be a IBM SWG ID. sb.append(lineSeparator).append(INDENT[1]).append("<msgId>").append(record.getMessageID()).append("</msgId>"); // IBM SWG MsgType sb.append(lineSeparator).append(INDENT[1]).append("<msgIdType>"); if (record.getMessageID().length() == 10) sb.append("IBM5.4.1"); else sb.append("IBM4.4.1"); sb.append("</msgIdType>"); } if (record.getRawMessage() != null && record.getResourceBundleName() != null) { sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogId>").append(record.getRawMessage()).append("</msgCatalogId>"); sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalogType>Java</msgCatalogType>"); sb.append(lineSeparator).append(INDENT[1]).append("<msgCatalog>").append(record.getResourceBundleName()).append("</msgCatalog>"); } sb.append(lineSeparator).append(INDENT[0]).append("</msgDataElement>"); }
[ "private", "void", "createMessageElement", "(", "StringBuilder", "sb", ",", "RepositoryLogRecord", "record", ")", "{", "// 660484 elim string concat", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", ")", ".", "append"...
Appends the CBE Message Element XML element of a record to a String buffer @param sb the string buffer the element will be added to @param record the record that represents the common base event
[ "Appends", "the", "CBE", "Message", "Element", "XML", "element", "of", "a", "record", "to", "a", "String", "buffer" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L209-L238
ThreeTen/threetenbp
src/main/java/org/threeten/bp/LocalDate.java
LocalDate.plus
@Override public LocalDate plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { ChronoUnit f = (ChronoUnit) unit; switch (f) { case DAYS: return plusDays(amountToAdd); case WEEKS: return plusWeeks(amountToAdd); case MONTHS: return plusMonths(amountToAdd); case YEARS: return plusYears(amountToAdd); case DECADES: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 10)); case CENTURIES: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 100)); case MILLENNIA: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 1000)); case ERAS: return with(ERA, Jdk8Methods.safeAdd(getLong(ERA), amountToAdd)); } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.addTo(this, amountToAdd); }
java
@Override public LocalDate plus(long amountToAdd, TemporalUnit unit) { if (unit instanceof ChronoUnit) { ChronoUnit f = (ChronoUnit) unit; switch (f) { case DAYS: return plusDays(amountToAdd); case WEEKS: return plusWeeks(amountToAdd); case MONTHS: return plusMonths(amountToAdd); case YEARS: return plusYears(amountToAdd); case DECADES: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 10)); case CENTURIES: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 100)); case MILLENNIA: return plusYears(Jdk8Methods.safeMultiply(amountToAdd, 1000)); case ERAS: return with(ERA, Jdk8Methods.safeAdd(getLong(ERA), amountToAdd)); } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.addTo(this, amountToAdd); }
[ "@", "Override", "public", "LocalDate", "plus", "(", "long", "amountToAdd", ",", "TemporalUnit", "unit", ")", "{", "if", "(", "unit", "instanceof", "ChronoUnit", ")", "{", "ChronoUnit", "f", "=", "(", "ChronoUnit", ")", "unit", ";", "switch", "(", "f", "...
Returns a copy of this date with the specified period added. <p> This method returns a new date based on this date with the specified period added. This can be used to add any period that is defined by a unit, for example to add years, months or days. The unit is responsible for the details of the calculation, including the resolution of any edge cases in the calculation. <p> This instance is immutable and unaffected by this method call. @param amountToAdd the amount of the unit to add to the result, may be negative @param unit the unit of the period to add, not null @return a {@code LocalDate} based on this date with the specified period added, not null @throws DateTimeException if the unit cannot be added to this type
[ "Returns", "a", "copy", "of", "this", "date", "with", "the", "specified", "period", "added", ".", "<p", ">", "This", "method", "returns", "a", "new", "date", "based", "on", "this", "date", "with", "the", "specified", "period", "added", ".", "This", "can"...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/LocalDate.java#L1065-L1082
OpenLiberty/open-liberty
dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasMethodAdapter.java
AbstractRasMethodAdapter.visitTryCatchBlock
@Override public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { if (type != null) { handlers.put(handler, type); } super.visitTryCatchBlock(start, end, handler, type); }
java
@Override public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { if (type != null) { handlers.put(handler, type); } super.visitTryCatchBlock(start, end, handler, type); }
[ "@", "Override", "public", "void", "visitTryCatchBlock", "(", "Label", "start", ",", "Label", "end", ",", "Label", "handler", ",", "String", "type", ")", "{", "if", "(", "type", "!=", "null", ")", "{", "handlers", ".", "put", "(", "handler", ",", "type...
Visit a try catch block. We will use this to determine the exception handler labels for the try block. @param start the beginning of the try block @param end the end of the try block @param handler the exception handler @param type the internal name of the throwable being handled
[ "Visit", "a", "try", "catch", "block", ".", "We", "will", "use", "this", "to", "determine", "the", "exception", "handler", "labels", "for", "the", "try", "block", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasMethodAdapter.java#L1006-L1012
sahan/IckleBot
icklebot/src/main/java/com/lonepulse/icklebot/state/StateUtils.java
StateUtils.onRestoreInstanceState
public static void onRestoreInstanceState(Object context, Bundle savedInstanceState) { if(ProfileService.getInstance(context).isActive(context, Profile.STATE) && savedInstanceState != null) { long millis = System.currentTimeMillis(); StateService.newInstance(ContextUtils.discover(context)).restore(context, savedInstanceState); millis = System.currentTimeMillis() - millis; Log.i("INSTRUMENTATION:IckleStateProfile#onRestoreInstanceState", StateUtils.class.getClass().getSimpleName() + ": " + millis + "ms"); } }
java
public static void onRestoreInstanceState(Object context, Bundle savedInstanceState) { if(ProfileService.getInstance(context).isActive(context, Profile.STATE) && savedInstanceState != null) { long millis = System.currentTimeMillis(); StateService.newInstance(ContextUtils.discover(context)).restore(context, savedInstanceState); millis = System.currentTimeMillis() - millis; Log.i("INSTRUMENTATION:IckleStateProfile#onRestoreInstanceState", StateUtils.class.getClass().getSimpleName() + ": " + millis + "ms"); } }
[ "public", "static", "void", "onRestoreInstanceState", "(", "Object", "context", ",", "Bundle", "savedInstanceState", ")", "{", "if", "(", "ProfileService", ".", "getInstance", "(", "context", ")", ".", "isActive", "(", "context", ",", "Profile", ".", "STATE", ...
<p><b>Restores</b> instance variables annotated with {@code @Stateful}.</p>
[ "<p", ">", "<b", ">", "Restores<", "/", "b", ">", "instance", "variables", "annotated", "with", "{" ]
train
https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/state/StateUtils.java#L73-L86
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Query.java
Query.insideBoundingBox
public Query insideBoundingBox(float latitudeP1, float longitudeP1, float latitudeP2, float longitudeP2) { if (insideBoundingBox == null) { insideBoundingBox = "insideBoundingBox=" + latitudeP1 + "," + longitudeP1 + "," + latitudeP2 + "," + longitudeP2; } else if (insideBoundingBox.length() > 18) { insideBoundingBox += "," + latitudeP1 + "," + longitudeP1 + "," + latitudeP2 + "," + longitudeP2; } return this; }
java
public Query insideBoundingBox(float latitudeP1, float longitudeP1, float latitudeP2, float longitudeP2) { if (insideBoundingBox == null) { insideBoundingBox = "insideBoundingBox=" + latitudeP1 + "," + longitudeP1 + "," + latitudeP2 + "," + longitudeP2; } else if (insideBoundingBox.length() > 18) { insideBoundingBox += "," + latitudeP1 + "," + longitudeP1 + "," + latitudeP2 + "," + longitudeP2; } return this; }
[ "public", "Query", "insideBoundingBox", "(", "float", "latitudeP1", ",", "float", "longitudeP1", ",", "float", "latitudeP2", ",", "float", "longitudeP2", ")", "{", "if", "(", "insideBoundingBox", "==", "null", ")", "{", "insideBoundingBox", "=", "\"insideBoundingB...
Search for entries inside a given area defined by the two extreme points of a rectangle. At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form "_geoloc":{"lat":48.853409, "lng":2.348800} or "_geoloc":[{"lat":48.853409, "lng":2.348800},{"lat":48.547456, "lng":2.972075}] if you have several geo-locations in your record). <p> You can use several bounding boxes (OR) by calling this method several times.
[ "Search", "for", "entries", "inside", "a", "given", "area", "defined", "by", "the", "two", "extreme", "points", "of", "a", "rectangle", ".", "At", "indexing", "you", "should", "specify", "geoloc", "of", "an", "object", "with", "the", "_geoloc", "attribute", ...
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Query.java#L528-L535
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/util/SourceWriteUtil.java
SourceWriteUtil.createFieldInjection
public SourceSnippet createFieldInjection(final FieldLiteral<?> field, final String injecteeName, NameGenerator nameGenerator, List<InjectorMethod> methodsOutput) throws NoSourceNameException { final boolean hasInjectee = injecteeName != null; final boolean useNativeMethod = field.isPrivate() || ReflectUtil.isPrivate(field.getDeclaringType()) || field.isLegacyFinalField(); // Determine method signature parts. final String injecteeTypeName = ReflectUtil.getSourceName(field.getRawDeclaringType()); String fieldTypeName = ReflectUtil.getSourceName(field.getFieldType()); String methodBaseName = nameGenerator.convertToValidMemberName(injecteeTypeName + "_" + field.getName() + "_fieldInjection"); final String methodName = nameGenerator.createMethodName(methodBaseName); // Field injections are performed in the package of the class declaring the // field. Any private types referenced by the injection must be visible // from there. final String packageName = ReflectUtil.getUserPackageName(field.getDeclaringType()); String signatureParams = fieldTypeName + " value"; boolean isLongAcccess = field.getFieldType().getRawType().equals(Long.TYPE); if (hasInjectee) { signatureParams = injecteeTypeName + " injectee, " + signatureParams; } // Compose method implementation and invocation. String annotation; if (isLongAcccess) { annotation = "@com.google.gwt.core.client.UnsafeNativeLong "; } else { annotation = ""; } String header = useNativeMethod ? "public native " : "public "; String signature = annotation + header + "void " + methodName + "(" + signatureParams + ")"; InjectorMethod injectionMethod = new AbstractInjectorMethod(useNativeMethod, signature, packageName) { public String getMethodBody(InjectorWriteContext writeContext) throws NoSourceNameException { if (!useNativeMethod) { return (hasInjectee ? "injectee." : injecteeTypeName + ".") + field.getName() + " = value;"; } else { return (hasInjectee ? "injectee." : "") + getJsniSignature(field) + " = value;"; } } }; methodsOutput.add(injectionMethod); return new SourceSnippet() { public String getSource(InjectorWriteContext writeContext) { List<String> callParams = new ArrayList<String>(); if (hasInjectee) { callParams.add(injecteeName); } callParams.add(writeContext.callGetter(guiceUtil.getKey(field))); return writeContext.callMethod(methodName, packageName, callParams) + ";\n"; } }; }
java
public SourceSnippet createFieldInjection(final FieldLiteral<?> field, final String injecteeName, NameGenerator nameGenerator, List<InjectorMethod> methodsOutput) throws NoSourceNameException { final boolean hasInjectee = injecteeName != null; final boolean useNativeMethod = field.isPrivate() || ReflectUtil.isPrivate(field.getDeclaringType()) || field.isLegacyFinalField(); // Determine method signature parts. final String injecteeTypeName = ReflectUtil.getSourceName(field.getRawDeclaringType()); String fieldTypeName = ReflectUtil.getSourceName(field.getFieldType()); String methodBaseName = nameGenerator.convertToValidMemberName(injecteeTypeName + "_" + field.getName() + "_fieldInjection"); final String methodName = nameGenerator.createMethodName(methodBaseName); // Field injections are performed in the package of the class declaring the // field. Any private types referenced by the injection must be visible // from there. final String packageName = ReflectUtil.getUserPackageName(field.getDeclaringType()); String signatureParams = fieldTypeName + " value"; boolean isLongAcccess = field.getFieldType().getRawType().equals(Long.TYPE); if (hasInjectee) { signatureParams = injecteeTypeName + " injectee, " + signatureParams; } // Compose method implementation and invocation. String annotation; if (isLongAcccess) { annotation = "@com.google.gwt.core.client.UnsafeNativeLong "; } else { annotation = ""; } String header = useNativeMethod ? "public native " : "public "; String signature = annotation + header + "void " + methodName + "(" + signatureParams + ")"; InjectorMethod injectionMethod = new AbstractInjectorMethod(useNativeMethod, signature, packageName) { public String getMethodBody(InjectorWriteContext writeContext) throws NoSourceNameException { if (!useNativeMethod) { return (hasInjectee ? "injectee." : injecteeTypeName + ".") + field.getName() + " = value;"; } else { return (hasInjectee ? "injectee." : "") + getJsniSignature(field) + " = value;"; } } }; methodsOutput.add(injectionMethod); return new SourceSnippet() { public String getSource(InjectorWriteContext writeContext) { List<String> callParams = new ArrayList<String>(); if (hasInjectee) { callParams.add(injecteeName); } callParams.add(writeContext.callGetter(guiceUtil.getKey(field))); return writeContext.callMethod(methodName, packageName, callParams) + ";\n"; } }; }
[ "public", "SourceSnippet", "createFieldInjection", "(", "final", "FieldLiteral", "<", "?", ">", "field", ",", "final", "String", "injecteeName", ",", "NameGenerator", "nameGenerator", ",", "List", "<", "InjectorMethod", ">", "methodsOutput", ")", "throws", "NoSource...
Creates a field injecting method and returns a string that invokes the written method. @param field field to be injected @param injecteeName variable that references the object into which values are injected, in the context of the returned call string @param nameGenerator NameGenerator to be used for ensuring method name uniqueness @return string calling the generated method
[ "Creates", "a", "field", "injecting", "method", "and", "returns", "a", "string", "that", "invokes", "the", "written", "method", "." ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/util/SourceWriteUtil.java#L93-L155
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java
Partitioner.getAppendLimitType
private static AppendMaxLimitType getAppendLimitType(ExtractType extractType, String maxLimit) { LOG.debug("Getting append limit type"); AppendMaxLimitType limitType; switch (extractType) { case APPEND_DAILY: limitType = AppendMaxLimitType.CURRENTDATE; break; case APPEND_HOURLY: limitType = AppendMaxLimitType.CURRENTHOUR; break; default: limitType = null; break; } if (!Strings.isNullOrEmpty(maxLimit)) { LOG.debug("Getting append limit type from the config"); String[] limitParams = maxLimit.split("-"); if (limitParams.length >= 1) { limitType = AppendMaxLimitType.valueOf(limitParams[0]); } } return limitType; }
java
private static AppendMaxLimitType getAppendLimitType(ExtractType extractType, String maxLimit) { LOG.debug("Getting append limit type"); AppendMaxLimitType limitType; switch (extractType) { case APPEND_DAILY: limitType = AppendMaxLimitType.CURRENTDATE; break; case APPEND_HOURLY: limitType = AppendMaxLimitType.CURRENTHOUR; break; default: limitType = null; break; } if (!Strings.isNullOrEmpty(maxLimit)) { LOG.debug("Getting append limit type from the config"); String[] limitParams = maxLimit.split("-"); if (limitParams.length >= 1) { limitType = AppendMaxLimitType.valueOf(limitParams[0]); } } return limitType; }
[ "private", "static", "AppendMaxLimitType", "getAppendLimitType", "(", "ExtractType", "extractType", ",", "String", "maxLimit", ")", "{", "LOG", ".", "debug", "(", "\"Getting append limit type\"", ")", ";", "AppendMaxLimitType", "limitType", ";", "switch", "(", "extrac...
Get append max limit type from the input @param extractType Extract type @param maxLimit @return Max limit type
[ "Get", "append", "max", "limit", "type", "from", "the", "input" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java#L550-L573
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/LineString.java
LineString.fromLngLats
public static LineString fromLngLats(@NonNull MultiPoint multiPoint) { return new LineString(TYPE, null, multiPoint.coordinates()); }
java
public static LineString fromLngLats(@NonNull MultiPoint multiPoint) { return new LineString(TYPE, null, multiPoint.coordinates()); }
[ "public", "static", "LineString", "fromLngLats", "(", "@", "NonNull", "MultiPoint", "multiPoint", ")", "{", "return", "new", "LineString", "(", "TYPE", ",", "null", ",", "multiPoint", ".", "coordinates", "(", ")", ")", ";", "}" ]
Create a new instance of this class by defining a {@link MultiPoint} object and passing. The multipoint object should comply with the GeoJson specifications described in the documentation. @param multiPoint which will make up the LineString geometry @return a new instance of this class defined by the values passed inside this static factory method @since 3.0.0
[ "Create", "a", "new", "instance", "of", "this", "class", "by", "defining", "a", "{", "@link", "MultiPoint", "}", "object", "and", "passing", ".", "The", "multipoint", "object", "should", "comply", "with", "the", "GeoJson", "specifications", "described", "in", ...
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/LineString.java#L90-L92
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java
ActorSDK.startAfterLoginActivity
public void startAfterLoginActivity(Context context, Bundle extras) { if (!startDelegateActivity(context, delegate.getStartAfterLoginIntent(), extras)) { startMessagingActivity(context, extras); } }
java
public void startAfterLoginActivity(Context context, Bundle extras) { if (!startDelegateActivity(context, delegate.getStartAfterLoginIntent(), extras)) { startMessagingActivity(context, extras); } }
[ "public", "void", "startAfterLoginActivity", "(", "Context", "context", ",", "Bundle", "extras", ")", "{", "if", "(", "!", "startDelegateActivity", "(", "context", ",", "delegate", ".", "getStartAfterLoginIntent", "(", ")", ",", "extras", ")", ")", "{", "start...
Method is used internally for starting default activity or activity added in delegate @param context current context @param extras activity extras
[ "Method", "is", "used", "internally", "for", "starting", "default", "activity", "or", "activity", "added", "in", "delegate" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/ActorSDK.java#L912-L916
OpenLiberty/open-liberty
dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/ltc/embeddable/impl/EmbeddableLTCUOWCallback.java
EmbeddableLTCUOWCallback.contextChange
@Override public void contextChange(int typeOfChange, UOWScope scope) throws IllegalStateException { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "contextChange", new Object[] { typeOfChange, scope, this }); try { // Determine the Tx change type and process. Ensure we do what // we need to do as close to the context switch as possible switch (typeOfChange) { case PRE_BEGIN: try { LTCCallbacks.instance().contextChange(typeOfChange); } finally { uowPreBegin(); } break; case POST_BEGIN: try { uowPostBegin(scope); } finally { LTCCallbacks.instance().contextChange(typeOfChange); } break; case PRE_END: try { LTCCallbacks.instance().contextChange(typeOfChange); } finally { uowPreEnd(scope); } break; case POST_END: try { uowPostEnd(); } finally { LTCCallbacks.instance().contextChange(typeOfChange); } break; default: if (traceOn && tc.isDebugEnabled()) Tr.debug(tc, "Unknown typeOfChange: " + typeOfChange); } } catch (IllegalStateException ise) { if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "contextChange", ise); throw ise; } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "contextChange"); }
java
@Override public void contextChange(int typeOfChange, UOWScope scope) throws IllegalStateException { final boolean traceOn = TraceComponent.isAnyTracingEnabled(); if (traceOn && tc.isEntryEnabled()) Tr.entry(tc, "contextChange", new Object[] { typeOfChange, scope, this }); try { // Determine the Tx change type and process. Ensure we do what // we need to do as close to the context switch as possible switch (typeOfChange) { case PRE_BEGIN: try { LTCCallbacks.instance().contextChange(typeOfChange); } finally { uowPreBegin(); } break; case POST_BEGIN: try { uowPostBegin(scope); } finally { LTCCallbacks.instance().contextChange(typeOfChange); } break; case PRE_END: try { LTCCallbacks.instance().contextChange(typeOfChange); } finally { uowPreEnd(scope); } break; case POST_END: try { uowPostEnd(); } finally { LTCCallbacks.instance().contextChange(typeOfChange); } break; default: if (traceOn && tc.isDebugEnabled()) Tr.debug(tc, "Unknown typeOfChange: " + typeOfChange); } } catch (IllegalStateException ise) { if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "contextChange", ise); throw ise; } if (traceOn && tc.isEntryEnabled()) Tr.exit(tc, "contextChange"); }
[ "@", "Override", "public", "void", "contextChange", "(", "int", "typeOfChange", ",", "UOWScope", "scope", ")", "throws", "IllegalStateException", "{", "final", "boolean", "traceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "tr...
/* Notification from UserTransaction or UserActivitySession interface implementations that the state of a bean-managed UOW has changed. As a result of this bean-managed UOW change we may have to change the LTC that's on the thread.
[ "/", "*", "Notification", "from", "UserTransaction", "or", "UserActivitySession", "interface", "implementations", "that", "the", "state", "of", "a", "bean", "-", "managed", "UOW", "has", "changed", ".", "As", "a", "result", "of", "this", "bean", "-", "managed"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/ltc/embeddable/impl/EmbeddableLTCUOWCallback.java#L50-L102
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteRequest.java
CreateRouteRequest.withRequestParameters
public CreateRouteRequest withRequestParameters(java.util.Map<String, ParameterConstraints> requestParameters) { setRequestParameters(requestParameters); return this; }
java
public CreateRouteRequest withRequestParameters(java.util.Map<String, ParameterConstraints> requestParameters) { setRequestParameters(requestParameters); return this; }
[ "public", "CreateRouteRequest", "withRequestParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "ParameterConstraints", ">", "requestParameters", ")", "{", "setRequestParameters", "(", "requestParameters", ")", ";", "return", "this", ";", "}" ]
<p> The request parameters for the route. </p> @param requestParameters The request parameters for the route. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "request", "parameters", "for", "the", "route", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteRequest.java#L549-L552
att/AAF
cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AbsAAFLur.java
AbsAAFLur.fishOneOf
public<A> void fishOneOf(String bait, A obj, String type, String instance, List<Action<A>> actions) { User<PERM> user = getUser(bait); if(user==null || (user.noPerms() && user.permExpired()))user = loadUser(bait); // return user==null?false:user.contains(pond); if(user!=null) { ReuseAAFPermission perm = new ReuseAAFPermission(type,instance); for(Action<A> action : actions) { perm.setAction(action.getName()); if(user.contains(perm)) { if(action.exec(obj))return; } } } }
java
public<A> void fishOneOf(String bait, A obj, String type, String instance, List<Action<A>> actions) { User<PERM> user = getUser(bait); if(user==null || (user.noPerms() && user.permExpired()))user = loadUser(bait); // return user==null?false:user.contains(pond); if(user!=null) { ReuseAAFPermission perm = new ReuseAAFPermission(type,instance); for(Action<A> action : actions) { perm.setAction(action.getName()); if(user.contains(perm)) { if(action.exec(obj))return; } } } }
[ "public", "<", "A", ">", "void", "fishOneOf", "(", "String", "bait", ",", "A", "obj", ",", "String", "type", ",", "String", "instance", ",", "List", "<", "Action", "<", "A", ">", ">", "actions", ")", "{", "User", "<", "PERM", ">", "user", "=", "g...
This special case minimizes loops, avoids multiple Set hits, and calls all the appropriate Actions found. @param bait @param obj @param type @param instance @param actions
[ "This", "special", "case", "minimizes", "loops", "avoids", "multiple", "Set", "hits", "and", "calls", "all", "the", "appropriate", "Actions", "found", "." ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/v2_0/AbsAAFLur.java#L210-L223
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/HasPositionalPredChecker.java
HasPositionalPredChecker.visitFunction
public boolean visitFunction(ExpressionOwner owner, Function func) { if((func instanceof FuncPosition) || (func instanceof FuncLast)) m_hasPositionalPred = true; return true; }
java
public boolean visitFunction(ExpressionOwner owner, Function func) { if((func instanceof FuncPosition) || (func instanceof FuncLast)) m_hasPositionalPred = true; return true; }
[ "public", "boolean", "visitFunction", "(", "ExpressionOwner", "owner", ",", "Function", "func", ")", "{", "if", "(", "(", "func", "instanceof", "FuncPosition", ")", "||", "(", "func", "instanceof", "FuncLast", ")", ")", "m_hasPositionalPred", "=", "true", ";",...
Visit a function. @param owner The owner of the expression, to which the expression can be reset if rewriting takes place. @param func The function reference object. @return true if the sub expressions should be traversed.
[ "Visit", "a", "function", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/HasPositionalPredChecker.java#L64-L70
firebase/geofire-java
common/src/main/java/com/firebase/geofire/GeoFire.java
GeoFire.getLocation
public void getLocation(String key, LocationCallback callback) { DatabaseReference keyRef = this.getDatabaseRefForKey(key); LocationValueEventListener valueListener = new LocationValueEventListener(callback); keyRef.addListenerForSingleValueEvent(valueListener); }
java
public void getLocation(String key, LocationCallback callback) { DatabaseReference keyRef = this.getDatabaseRefForKey(key); LocationValueEventListener valueListener = new LocationValueEventListener(callback); keyRef.addListenerForSingleValueEvent(valueListener); }
[ "public", "void", "getLocation", "(", "String", "key", ",", "LocationCallback", "callback", ")", "{", "DatabaseReference", "keyRef", "=", "this", ".", "getDatabaseRefForKey", "(", "key", ")", ";", "LocationValueEventListener", "valueListener", "=", "new", "LocationV...
Gets the current location for a key and calls the callback with the current value. @param key The key whose location to get @param callback The callback that is called once the location is retrieved
[ "Gets", "the", "current", "location", "for", "a", "key", "and", "calls", "the", "callback", "with", "the", "current", "value", "." ]
train
https://github.com/firebase/geofire-java/blob/c46ff339060d150741a8d0d40c8e73b78edca6c3/common/src/main/java/com/firebase/geofire/GeoFire.java#L225-L229
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java
JobsInner.get
public JobInner get(String resourceGroupName, String automationAccountName, UUID jobId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body(); }
java
public JobInner get(String resourceGroupName, String automationAccountName, UUID jobId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId).toBlocking().single().body(); }
[ "public", "JobInner", "get", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "UUID", "jobId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "jobId", ")", ".", "toBlockin...
Retrieve the job identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobInner object if successful.
[ "Retrieve", "the", "job", "identified", "by", "job", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobsInner.java#L481-L483
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/ResourceBundleELResolver.java
ResourceBundleELResolver.setValue
@Override public void setValue(ELContext context, Object base, Object property, Object value) { if (context == null) { throw new NullPointerException("context is null"); } if (isResolvable(base)) { throw new PropertyNotWritableException("resolver is read-only"); } }
java
@Override public void setValue(ELContext context, Object base, Object property, Object value) { if (context == null) { throw new NullPointerException("context is null"); } if (isResolvable(base)) { throw new PropertyNotWritableException("resolver is read-only"); } }
[ "@", "Override", "public", "void", "setValue", "(", "ELContext", "context", ",", "Object", "base", ",", "Object", "property", ",", "Object", "value", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"co...
If the base object is a ResourceBundle, throw a {@link PropertyNotWritableException}. @param context The context of this evaluation. @param base The bundle to analyze. Only bases of type ResourceBundle are handled by this resolver. @param property The name of the property to analyze. Will be coerced to a String. @param value The value to be set. @throws NullPointerException if context is null. @throws PropertyNotWritableException Always thrown if base is an instance of ResourceBundle.
[ "If", "the", "base", "object", "is", "a", "ResourceBundle", "throw", "a", "{", "@link", "PropertyNotWritableException", "}", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/ResourceBundleELResolver.java#L216-L224
carewebframework/carewebframework-vista
org.carewebframework.vista.security-parent/org.carewebframework.vista.security.base/src/main/java/org/carewebframework/vista/security/base/BaseSecurityService.java
BaseSecurityService.changePassword
@Override public String changePassword(final String oldPassword, final String newPassword) { return Security.changePassword(brokerSession, oldPassword, newPassword); }
java
@Override public String changePassword(final String oldPassword, final String newPassword) { return Security.changePassword(brokerSession, oldPassword, newPassword); }
[ "@", "Override", "public", "String", "changePassword", "(", "final", "String", "oldPassword", ",", "final", "String", "newPassword", ")", "{", "return", "Security", ".", "changePassword", "(", "brokerSession", ",", "oldPassword", ",", "newPassword", ")", ";", "}...
Changes the user's password. @param oldPassword Current password. @param newPassword New password. @return Null or empty if succeeded. Otherwise, displayable reason why change failed.
[ "Changes", "the", "user", "s", "password", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.security-parent/org.carewebframework.vista.security.base/src/main/java/org/carewebframework/vista/security/base/BaseSecurityService.java#L59-L62
uber/rides-java-sdk
samples/servlet-sample/src/main/java/com/uber/sdk/rides/samples/servlet/SampleServlet.java
SampleServlet.service
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { SessionConfiguration config = Server.createSessionConfiguration(); if (oAuth2Credentials == null) { oAuth2Credentials = Server.createOAuth2Credentials(config); } // Load the user from their user ID (derived from the request). HttpSession httpSession = req.getSession(true); if (httpSession.getAttribute(Server.USER_SESSION_ID) == null) { httpSession.setAttribute(Server.USER_SESSION_ID, new Random().nextLong()); } credential = oAuth2Credentials.loadCredential(httpSession.getAttribute(Server.USER_SESSION_ID).toString()); if (credential != null && credential.getAccessToken() != null) { if (uberRidesService == null) { CredentialsSession session = new CredentialsSession(config, credential); // Set up the Uber API Service once the user is authenticated. UberRidesApi api = UberRidesApi.with(session).build(); uberRidesService = api.createService(); } super.service(req, resp); } else { resp.sendRedirect(oAuth2Credentials.getAuthorizationUrl()); } }
java
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { SessionConfiguration config = Server.createSessionConfiguration(); if (oAuth2Credentials == null) { oAuth2Credentials = Server.createOAuth2Credentials(config); } // Load the user from their user ID (derived from the request). HttpSession httpSession = req.getSession(true); if (httpSession.getAttribute(Server.USER_SESSION_ID) == null) { httpSession.setAttribute(Server.USER_SESSION_ID, new Random().nextLong()); } credential = oAuth2Credentials.loadCredential(httpSession.getAttribute(Server.USER_SESSION_ID).toString()); if (credential != null && credential.getAccessToken() != null) { if (uberRidesService == null) { CredentialsSession session = new CredentialsSession(config, credential); // Set up the Uber API Service once the user is authenticated. UberRidesApi api = UberRidesApi.with(session).build(); uberRidesService = api.createService(); } super.service(req, resp); } else { resp.sendRedirect(oAuth2Credentials.getAuthorizationUrl()); } }
[ "@", "Override", "protected", "void", "service", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "IOException", ",", "ServletException", "{", "SessionConfiguration", "config", "=", "Server", ".", "createSessionConfiguration", "(", ...
Before each request, fetch an OAuth2 credential for the user or redirect them to the OAuth2 login page instead.
[ "Before", "each", "request", "fetch", "an", "OAuth2", "credential", "for", "the", "user", "or", "redirect", "them", "to", "the", "OAuth2", "login", "page", "instead", "." ]
train
https://github.com/uber/rides-java-sdk/blob/6c75570ab7884f8ecafaad312ef471dd33f64c42/samples/servlet-sample/src/main/java/com/uber/sdk/rides/samples/servlet/SampleServlet.java#L66-L95
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/cache/CachedResponseImpl.java
CachedResponseImpl.writeContentsTo
public void writeContentsTo(final OutputStream pStream) throws IOException { if (content == null) { throw new IOException("Cache is null, no content to write."); } content.writeTo(pStream); }
java
public void writeContentsTo(final OutputStream pStream) throws IOException { if (content == null) { throw new IOException("Cache is null, no content to write."); } content.writeTo(pStream); }
[ "public", "void", "writeContentsTo", "(", "final", "OutputStream", "pStream", ")", "throws", "IOException", "{", "if", "(", "content", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Cache is null, no content to write.\"", ")", ";", "}", "content", ...
Writes the cached content to the response @param pStream the response stream @throws java.io.IOException
[ "Writes", "the", "cached", "content", "to", "the", "response" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/cache/CachedResponseImpl.java#L106-L112
sonatype/sisu-guice
core/src/com/google/inject/internal/InternalInjectorCreator.java
InternalInjectorCreator.loadEagerSingletons
void loadEagerSingletons(InjectorImpl injector, Stage stage, final Errors errors) { List<BindingImpl<?>> candidateBindings = new ArrayList<>(); @SuppressWarnings("unchecked") // casting Collection<Binding> to Collection<BindingImpl> is safe Collection<BindingImpl<?>> bindingsAtThisLevel = (Collection) injector.state.getExplicitBindingsThisLevel().values(); candidateBindings.addAll(bindingsAtThisLevel); synchronized (injector.state.lock()) { // jit bindings must be accessed while holding the lock. candidateBindings.addAll(injector.jitBindings.values()); } InternalContext context = injector.enterContext(); try { for (BindingImpl<?> binding : candidateBindings) { if (isEagerSingleton(injector, binding, stage)) { Dependency<?> dependency = Dependency.get(binding.getKey()); Dependency previous = context.pushDependency(dependency, binding.getSource()); try { binding.getInternalFactory().get(context, dependency, false); } catch (InternalProvisionException e) { errors.withSource(dependency).merge(e); } finally { context.popStateAndSetDependency(previous); } } } } finally { context.close(); } }
java
void loadEagerSingletons(InjectorImpl injector, Stage stage, final Errors errors) { List<BindingImpl<?>> candidateBindings = new ArrayList<>(); @SuppressWarnings("unchecked") // casting Collection<Binding> to Collection<BindingImpl> is safe Collection<BindingImpl<?>> bindingsAtThisLevel = (Collection) injector.state.getExplicitBindingsThisLevel().values(); candidateBindings.addAll(bindingsAtThisLevel); synchronized (injector.state.lock()) { // jit bindings must be accessed while holding the lock. candidateBindings.addAll(injector.jitBindings.values()); } InternalContext context = injector.enterContext(); try { for (BindingImpl<?> binding : candidateBindings) { if (isEagerSingleton(injector, binding, stage)) { Dependency<?> dependency = Dependency.get(binding.getKey()); Dependency previous = context.pushDependency(dependency, binding.getSource()); try { binding.getInternalFactory().get(context, dependency, false); } catch (InternalProvisionException e) { errors.withSource(dependency).merge(e); } finally { context.popStateAndSetDependency(previous); } } } } finally { context.close(); } }
[ "void", "loadEagerSingletons", "(", "InjectorImpl", "injector", ",", "Stage", "stage", ",", "final", "Errors", "errors", ")", "{", "List", "<", "BindingImpl", "<", "?", ">", ">", "candidateBindings", "=", "new", "ArrayList", "<>", "(", ")", ";", "@", "Supp...
Loads eager singletons, or all singletons if we're in Stage.PRODUCTION. Bindings discovered while we're binding these singletons are not be eager.
[ "Loads", "eager", "singletons", "or", "all", "singletons", "if", "we", "re", "in", "Stage", ".", "PRODUCTION", ".", "Bindings", "discovered", "while", "we", "re", "binding", "these", "singletons", "are", "not", "be", "eager", "." ]
train
https://github.com/sonatype/sisu-guice/blob/45f5c89834c189c5338640bf55e6e6181b9b5611/core/src/com/google/inject/internal/InternalInjectorCreator.java#L194-L223
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/GridScreen.java
GridScreen.getNextLocation
public ScreenLocation getNextLocation(short position, short setNewAnchor) { if (position == ScreenConstants.NEXT_LOGICAL) position = ScreenConstants.RIGHT_OF_LAST; if (position == ScreenConstants.FIRST_LOCATION) position = ScreenConstants.FIRST_DISPLAY_LOCATION; if (position == ScreenConstants.ADD_SCREEN_VIEW_BUFFER) position = ScreenConstants.ADD_GRID_SCREEN_BUFFER; // No buffer around frame! return super.getNextLocation(position, setNewAnchor); }
java
public ScreenLocation getNextLocation(short position, short setNewAnchor) { if (position == ScreenConstants.NEXT_LOGICAL) position = ScreenConstants.RIGHT_OF_LAST; if (position == ScreenConstants.FIRST_LOCATION) position = ScreenConstants.FIRST_DISPLAY_LOCATION; if (position == ScreenConstants.ADD_SCREEN_VIEW_BUFFER) position = ScreenConstants.ADD_GRID_SCREEN_BUFFER; // No buffer around frame! return super.getNextLocation(position, setNewAnchor); }
[ "public", "ScreenLocation", "getNextLocation", "(", "short", "position", ",", "short", "setNewAnchor", ")", "{", "if", "(", "position", "==", "ScreenConstants", ".", "NEXT_LOGICAL", ")", "position", "=", "ScreenConstants", ".", "RIGHT_OF_LAST", ";", "if", "(", "...
Code this position and Anchor to add it to the LayoutManager. @param position The location constant (see ScreenConstants). @param setNewAnchor The anchor constant. @return The new screen location object.
[ "Code", "this", "position", "and", "Anchor", "to", "add", "it", "to", "the", "LayoutManager", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/GridScreen.java#L100-L109
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/Timecode.java
Timecode.getInstance
@Deprecated public static final Timecode getInstance(SampleCount samples, boolean dropFrame, boolean supportDays) { final Timecode timecode = getInstance(samples, dropFrame); if (!supportDays && timecode.getDaysPart() != 0) { throw new IllegalArgumentException("supportDays disabled but resulting timecode had a days component: " + timecode.toEncodedString()); } else { return timecode; } }
java
@Deprecated public static final Timecode getInstance(SampleCount samples, boolean dropFrame, boolean supportDays) { final Timecode timecode = getInstance(samples, dropFrame); if (!supportDays && timecode.getDaysPart() != 0) { throw new IllegalArgumentException("supportDays disabled but resulting timecode had a days component: " + timecode.toEncodedString()); } else { return timecode; } }
[ "@", "Deprecated", "public", "static", "final", "Timecode", "getInstance", "(", "SampleCount", "samples", ",", "boolean", "dropFrame", ",", "boolean", "supportDays", ")", "{", "final", "Timecode", "timecode", "=", "getInstance", "(", "samples", ",", "dropFrame", ...
@param samples @param dropFrame @param supportDays @return @deprecated use method without supportDays (supportDays is now implicitly true) or dropFrame (drop frame timecode is not correctly supported currently)
[ "@param", "samples", "@param", "dropFrame", "@param", "supportDays" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/Timecode.java#L769-L783
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/deployment/scanning/ProcessApplicationScanningUtil.java
ProcessApplicationScanningUtil.checkDiagram
protected static boolean checkDiagram(String fileName, String modelFileName, String[] diagramSuffixes, String[] modelSuffixes) { for (String modelSuffix : modelSuffixes) { if (modelFileName.endsWith(modelSuffix)) { String caseFilePrefix = modelFileName.substring(0, modelFileName.length() - modelSuffix.length()); if (fileName.startsWith(caseFilePrefix)) { for (String diagramResourceSuffix : diagramSuffixes) { if (fileName.endsWith(diagramResourceSuffix)) { return true; } } } } } return false; }
java
protected static boolean checkDiagram(String fileName, String modelFileName, String[] diagramSuffixes, String[] modelSuffixes) { for (String modelSuffix : modelSuffixes) { if (modelFileName.endsWith(modelSuffix)) { String caseFilePrefix = modelFileName.substring(0, modelFileName.length() - modelSuffix.length()); if (fileName.startsWith(caseFilePrefix)) { for (String diagramResourceSuffix : diagramSuffixes) { if (fileName.endsWith(diagramResourceSuffix)) { return true; } } } } } return false; }
[ "protected", "static", "boolean", "checkDiagram", "(", "String", "fileName", ",", "String", "modelFileName", ",", "String", "[", "]", "diagramSuffixes", ",", "String", "[", "]", "modelSuffixes", ")", "{", "for", "(", "String", "modelSuffix", ":", "modelSuffixes"...
Checks, whether a filename is a diagram for the given modelFileName. @param fileName filename to check. @param modelFileName model file name. @param diagramSuffixes suffixes of the diagram files. @param modelSuffixes suffixes of model files. @return true, if a file is a diagram for the model.
[ "Checks", "whether", "a", "filename", "is", "a", "diagram", "for", "the", "given", "modelFileName", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/deployment/scanning/ProcessApplicationScanningUtil.java#L115-L129
WASdev/tool.accelerate.core
liberty-starter-application/src/main/java/com/ibm/liberty/starter/GitHubConnector.java
GitHubConnector.createGitRepository
public File createGitRepository(String repositoryName) throws IOException { RepositoryService service = new RepositoryService(); service.getClient().setOAuth2Token(oAuthToken); Repository repository = new Repository(); repository.setName(repositoryName); repository = service.createRepository(repository); repositoryLocation = repository.getHtmlUrl(); CloneCommand cloneCommand = Git.cloneRepository() .setURI(repository.getCloneUrl()) .setDirectory(localGitDirectory); addAuth(cloneCommand); try { localRepository = cloneCommand.call(); } catch (GitAPIException e) { throw new IOException("Error cloning to local file system", e); } return localGitDirectory; }
java
public File createGitRepository(String repositoryName) throws IOException { RepositoryService service = new RepositoryService(); service.getClient().setOAuth2Token(oAuthToken); Repository repository = new Repository(); repository.setName(repositoryName); repository = service.createRepository(repository); repositoryLocation = repository.getHtmlUrl(); CloneCommand cloneCommand = Git.cloneRepository() .setURI(repository.getCloneUrl()) .setDirectory(localGitDirectory); addAuth(cloneCommand); try { localRepository = cloneCommand.call(); } catch (GitAPIException e) { throw new IOException("Error cloning to local file system", e); } return localGitDirectory; }
[ "public", "File", "createGitRepository", "(", "String", "repositoryName", ")", "throws", "IOException", "{", "RepositoryService", "service", "=", "new", "RepositoryService", "(", ")", ";", "service", ".", "getClient", "(", ")", ".", "setOAuth2Token", "(", "oAuthTo...
Creates a repository on GitHub and in a local temporary directory. This is a one time operation as once it is created on GitHub and locally it cannot be recreated.
[ "Creates", "a", "repository", "on", "GitHub", "and", "in", "a", "local", "temporary", "directory", ".", "This", "is", "a", "one", "time", "operation", "as", "once", "it", "is", "created", "on", "GitHub", "and", "locally", "it", "cannot", "be", "recreated",...
train
https://github.com/WASdev/tool.accelerate.core/blob/6511da654a69a25a76573eb76eefff349d9c4d80/liberty-starter-application/src/main/java/com/ibm/liberty/starter/GitHubConnector.java#L52-L70
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java
EventServiceImpl.accept
@Override public void accept(Packet packet) { try { eventExecutor.execute(new RemoteEventProcessor(this, packet)); } catch (RejectedExecutionException e) { rejectedCount.inc(); if (eventExecutor.isLive()) { Connection conn = packet.getConn(); String endpoint = conn.getEndPoint() != null ? conn.getEndPoint().toString() : conn.toString(); logFailure("EventQueue overloaded! Failed to process event packet sent from: %s", endpoint); } } }
java
@Override public void accept(Packet packet) { try { eventExecutor.execute(new RemoteEventProcessor(this, packet)); } catch (RejectedExecutionException e) { rejectedCount.inc(); if (eventExecutor.isLive()) { Connection conn = packet.getConn(); String endpoint = conn.getEndPoint() != null ? conn.getEndPoint().toString() : conn.toString(); logFailure("EventQueue overloaded! Failed to process event packet sent from: %s", endpoint); } } }
[ "@", "Override", "public", "void", "accept", "(", "Packet", "packet", ")", "{", "try", "{", "eventExecutor", ".", "execute", "(", "new", "RemoteEventProcessor", "(", "this", ",", "packet", ")", ")", ";", "}", "catch", "(", "RejectedExecutionException", "e", ...
{@inheritDoc} Handles an asynchronous remote event with a {@link RemoteEventProcessor}. The processor may determine the thread which will handle the event. If the execution is rejected, the rejection count is increased and a failure is logged. The event processing is not retried. @param packet the response packet to handle @see #sendEvent(Address, EventEnvelope, int)
[ "{", "@inheritDoc", "}", "Handles", "an", "asynchronous", "remote", "event", "with", "a", "{", "@link", "RemoteEventProcessor", "}", ".", "The", "processor", "may", "determine", "the", "thread", "which", "will", "handle", "the", "event", ".", "If", "the", "e...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java#L592-L605
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/TileEntityUtils.java
TileEntityUtils.linkTileEntityToGui
@SideOnly(Side.CLIENT) public static void linkTileEntityToGui(TileEntity te, MalisisGui gui) { currentTileEntity = te; currenGui = gui; currenGui.updateGui(); }
java
@SideOnly(Side.CLIENT) public static void linkTileEntityToGui(TileEntity te, MalisisGui gui) { currentTileEntity = te; currenGui = gui; currenGui.updateGui(); }
[ "@", "SideOnly", "(", "Side", ".", "CLIENT", ")", "public", "static", "void", "linkTileEntityToGui", "(", "TileEntity", "te", ",", "MalisisGui", "gui", ")", "{", "currentTileEntity", "=", "te", ";", "currenGui", "=", "gui", ";", "currenGui", ".", "updateGui"...
Links the {@link TileEntity} to the {@link MalisisGui}.<br> Allows the TileEntity to notify the MalisisGui of updates. @param te the TileEntity @param gui the MalisisGui
[ "Links", "the", "{", "@link", "TileEntity", "}", "to", "the", "{", "@link", "MalisisGui", "}", ".", "<br", ">", "Allows", "the", "TileEntity", "to", "notify", "the", "MalisisGui", "of", "updates", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/TileEntityUtils.java#L77-L83
RKumsher/utils
src/main/java/com/github/rkumsher/date/RandomDateUtils.java
RandomDateUtils.randomYear
public static Year randomYear(Year startInclusive, Year endExclusive) { checkArgument(startInclusive != null, "Start must be non-null"); checkArgument(endExclusive != null, "End must be non-null"); return randomYear(startInclusive.getValue(), endExclusive.getValue()); }
java
public static Year randomYear(Year startInclusive, Year endExclusive) { checkArgument(startInclusive != null, "Start must be non-null"); checkArgument(endExclusive != null, "End must be non-null"); return randomYear(startInclusive.getValue(), endExclusive.getValue()); }
[ "public", "static", "Year", "randomYear", "(", "Year", "startInclusive", ",", "Year", "endExclusive", ")", "{", "checkArgument", "(", "startInclusive", "!=", "null", ",", "\"Start must be non-null\"", ")", ";", "checkArgument", "(", "endExclusive", "!=", "null", "...
Returns a random {@link Year} within the specified range. @param startInclusive the earliest {@link Year} that can be returned @param endExclusive the upper bound (not included) @return the random {@link Year} @throws IllegalArgumentException if startInclusive or endExclusive are null, if endExclusive is earlier than startInclusive, if either are before {@link RandomDateUtils#MIN_INSTANT}, or if either are after {@link RandomDateUtils#MAX_INSTANT}
[ "Returns", "a", "random", "{", "@link", "Year", "}", "within", "the", "specified", "range", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L879-L883
EMCECS/nfs-client-java
src/main/java/com/emc/ecs/nfsclient/portmap/Portmapper.java
Portmapper.handleRpcException
private static void handleRpcException(RpcException e, int attemptNumber, String server) throws IOException { String messageStart; if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) { messageStart = "network"; } else { // check whether to retry if (attemptNumber + 1 < _maxRetry) { return; } messageStart = "rpc"; } throw new IOException( String.format("%s error, server: %s, RPC error: %s", messageStart, server, e.getMessage()), e); }
java
private static void handleRpcException(RpcException e, int attemptNumber, String server) throws IOException { String messageStart; if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) { messageStart = "network"; } else { // check whether to retry if (attemptNumber + 1 < _maxRetry) { return; } messageStart = "rpc"; } throw new IOException( String.format("%s error, server: %s, RPC error: %s", messageStart, server, e.getMessage()), e); }
[ "private", "static", "void", "handleRpcException", "(", "RpcException", "e", ",", "int", "attemptNumber", ",", "String", "server", ")", "throws", "IOException", "{", "String", "messageStart", ";", "if", "(", "!", "(", "e", ".", "getStatus", "(", ")", ".", ...
Decide whether to retry or throw exception. @param e The exception. @param attemptNumber The number of attempts so far. @throws IOException
[ "Decide", "whether", "to", "retry", "or", "throw", "exception", "." ]
train
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/portmap/Portmapper.java#L113-L126
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/files/KeyValueSources.java
KeyValueSources.fromZip
@Nonnull public static ImmutableKeyValueSource<Symbol, ByteSource> fromZip(final ZipFile zipFile) { return fromZip(zipFile, SymbolUtils.symbolizeFunction()); }
java
@Nonnull public static ImmutableKeyValueSource<Symbol, ByteSource> fromZip(final ZipFile zipFile) { return fromZip(zipFile, SymbolUtils.symbolizeFunction()); }
[ "@", "Nonnull", "public", "static", "ImmutableKeyValueSource", "<", "Symbol", ",", "ByteSource", ">", "fromZip", "(", "final", "ZipFile", "zipFile", ")", "{", "return", "fromZip", "(", "zipFile", ",", "SymbolUtils", ".", "symbolizeFunction", "(", ")", ")", ";"...
Creates a new source using a zip file where each value is located at an entry with the same name as the key. The caller must ensure that the zip file is not closed or modified, otherwise all behavior is undefined. All files in the zip file will be used; there is currently no way to exclude specific files. To specify a function that defines the mapping between keys and the entry used for their values, see {@link #fromZip(ZipFile, Function)}. @param zipFile the zip file to use as a source @return a new key-value source backed by the specified zip file @see #fromZip(ZipFile, Function)
[ "Creates", "a", "new", "source", "using", "a", "zip", "file", "where", "each", "value", "is", "located", "at", "an", "entry", "with", "the", "same", "name", "as", "the", "key", ".", "The", "caller", "must", "ensure", "that", "the", "zip", "file", "is",...
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/KeyValueSources.java#L65-L68
box/box-java-sdk
src/main/java/com/box/sdk/BoxMetadataCascadePolicy.java
BoxMetadataCascadePolicy.getAll
public static Iterable<BoxMetadataCascadePolicy.Info> getAll(final BoxAPIConnection api, String folderID, String ownerEnterpriseID, int limit, String... fields) { QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam("folder_id", folderID); if (ownerEnterpriseID != null) { builder.appendParam("owner_enterprise_id", ownerEnterpriseID); } if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<Info>(api, GET_ALL_METADATA_CASCADE_POLICIES_URL_TEMPLATE .buildWithQuery(api.getBaseURL(), builder.toString()), limit) { @Override protected BoxMetadataCascadePolicy.Info factory(JsonObject jsonObject) { BoxMetadataCascadePolicy cascadePolicy = new BoxMetadataCascadePolicy(api, jsonObject.get("id").asString()); return cascadePolicy.new Info(jsonObject); } }; }
java
public static Iterable<BoxMetadataCascadePolicy.Info> getAll(final BoxAPIConnection api, String folderID, String ownerEnterpriseID, int limit, String... fields) { QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam("folder_id", folderID); if (ownerEnterpriseID != null) { builder.appendParam("owner_enterprise_id", ownerEnterpriseID); } if (fields.length > 0) { builder.appendParam("fields", fields); } return new BoxResourceIterable<Info>(api, GET_ALL_METADATA_CASCADE_POLICIES_URL_TEMPLATE .buildWithQuery(api.getBaseURL(), builder.toString()), limit) { @Override protected BoxMetadataCascadePolicy.Info factory(JsonObject jsonObject) { BoxMetadataCascadePolicy cascadePolicy = new BoxMetadataCascadePolicy(api, jsonObject.get("id").asString()); return cascadePolicy.new Info(jsonObject); } }; }
[ "public", "static", "Iterable", "<", "BoxMetadataCascadePolicy", ".", "Info", ">", "getAll", "(", "final", "BoxAPIConnection", "api", ",", "String", "folderID", ",", "String", "ownerEnterpriseID", ",", "int", "limit", ",", "String", "...", "fields", ")", "{", ...
Retrieves list of Box Metadata Cascade Policies that belong to your Enterprise as an Iterable. @param api the API connection to be used by the resource. @param folderID the ID of the folder to retrieve cascade policies for. @param ownerEnterpriseID the ID of the enterprise to retrieve Metadata Cascade Policies for. @param limit the number of entries for cascade policies to retrieve. @param fields optional fields to retrieve for cascade policies. @return the Iterable of Box Metadata Cascade Policies in your enterprise.
[ "Retrieves", "list", "of", "Box", "Metadata", "Cascade", "Policies", "that", "belong", "to", "your", "Enterprise", "as", "an", "Iterable", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxMetadataCascadePolicy.java#L67-L89
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorImpl.java
PersistentExecutorImpl.setTaskStore
@Reference(target = "(id=unbound)") protected void setTaskStore(DatabaseStore svc, Map<String, Object> props) { persistentStore = svc; persistentStoreDisplayId = (String) props.get("config.displayId"); }
java
@Reference(target = "(id=unbound)") protected void setTaskStore(DatabaseStore svc, Map<String, Object> props) { persistentStore = svc; persistentStoreDisplayId = (String) props.get("config.displayId"); }
[ "@", "Reference", "(", "target", "=", "\"(id=unbound)\"", ")", "protected", "void", "setTaskStore", "(", "DatabaseStore", "svc", ",", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "persistentStore", "=", "svc", ";", "persistentStoreDisplayId", "...
Declarative Services method for setting the database store @param svc the service @param props service properties
[ "Declarative", "Services", "method", "for", "setting", "the", "database", "store" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/PersistentExecutorImpl.java#L1643-L1647
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfAction.java
PdfAction.javaScript
public static PdfAction javaScript(String code, PdfWriter writer) { return javaScript(code, writer, false); }
java
public static PdfAction javaScript(String code, PdfWriter writer) { return javaScript(code, writer, false); }
[ "public", "static", "PdfAction", "javaScript", "(", "String", "code", ",", "PdfWriter", "writer", ")", "{", "return", "javaScript", "(", "code", ",", "writer", ",", "false", ")", ";", "}" ]
Creates a JavaScript action. If the JavaScript is smaller than 50 characters it will be place as a string, otherwise it will be placed as a compressed stream. @param code the JavaScript code @param writer the writer for this action @return the JavaScript action
[ "Creates", "a", "JavaScript", "action", ".", "If", "the", "JavaScript", "is", "smaller", "than", "50", "characters", "it", "will", "be", "place", "as", "a", "string", "otherwise", "it", "will", "be", "placed", "as", "a", "compressed", "stream", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L322-L324
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java
MachinetagsApi.getRecentValues
public Values getRecentValues(String namespace, String predicate, String addedSince, boolean sign) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getRecentValues"); if (!JinxUtils.isNullOrEmpty(namespace)) { params.put("namespace", namespace); } if (!JinxUtils.isNullOrEmpty(predicate)) { params.put("predicate", predicate); } if (!JinxUtils.isNullOrEmpty(addedSince)) { params.put("added_since", addedSince); } // if (perPage > 0) { // params.put("per_page", Integer.toString(perPage)); // } // if (page > 0) { // params.put("page", Integer.toString(page)); // } return jinx.flickrGet(params, Values.class, sign); }
java
public Values getRecentValues(String namespace, String predicate, String addedSince, boolean sign) throws JinxException { Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getRecentValues"); if (!JinxUtils.isNullOrEmpty(namespace)) { params.put("namespace", namespace); } if (!JinxUtils.isNullOrEmpty(predicate)) { params.put("predicate", predicate); } if (!JinxUtils.isNullOrEmpty(addedSince)) { params.put("added_since", addedSince); } // if (perPage > 0) { // params.put("per_page", Integer.toString(perPage)); // } // if (page > 0) { // params.put("page", Integer.toString(page)); // } return jinx.flickrGet(params, Values.class, sign); }
[ "public", "Values", "getRecentValues", "(", "String", "namespace", ",", "String", "predicate", ",", "String", "addedSince", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", ...
Fetch recently used (or created) machine tags values. <br> This method does not require authentication. @param namespace (Optional) A namespace that all values should be restricted to. @param predicate (Optional) A predicate that all values should be restricted to. @param addedSince (Optional) Only return machine tags values that have been added since this timestamp, in epoch seconds. @param sign if true, the request will be signed. @return object containing a list of recently used or created machine tags values. @throws JinxException if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.machinetags.getRecentValues.html">flickr.machinetags.getRecentValues</a>
[ "Fetch", "recently", "used", "(", "or", "created", ")", "machine", "tags", "values", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java#L151-L170
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/csv/internal/CsvParser.java
CsvParser.isNextCharacterEscapedQuote
private boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i) { return inQuotes // we are in quotes, therefore there can be escaped // quotes in here. && nextLine.length() > (i + 1) // there is indeed another // character to check. && format.isDelimiter(nextLine.charAt(i + 1)); }
java
private boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i) { return inQuotes // we are in quotes, therefore there can be escaped // quotes in here. && nextLine.length() > (i + 1) // there is indeed another // character to check. && format.isDelimiter(nextLine.charAt(i + 1)); }
[ "private", "boolean", "isNextCharacterEscapedQuote", "(", "String", "nextLine", ",", "boolean", "inQuotes", ",", "int", "i", ")", "{", "return", "inQuotes", "// we are in quotes, therefore there can be escaped", "// quotes in here.", "&&", "nextLine", ".", "length", "(", ...
precondition: the current character is a quote or an escape @param nextLine the current line @param inQuotes true if the current context is quoted @param i current index in line @return true if the following character is a quote
[ "precondition", ":", "the", "current", "character", "is", "a", "quote", "or", "an", "escape" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/csv/internal/CsvParser.java#L202-L208
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.tableStyle
public static String tableStyle(String style, String... content) { return tagStyle(Html.Tag.TABLE, style, content); }
java
public static String tableStyle(String style, String... content) { return tagStyle(Html.Tag.TABLE, style, content); }
[ "public", "static", "String", "tableStyle", "(", "String", "style", ",", "String", "...", "content", ")", "{", "return", "tagStyle", "(", "Html", ".", "Tag", ".", "TABLE", ",", "style", ",", "content", ")", ";", "}" ]
Build a HTML Table with given CSS style for a string. Given content does <b>not</b> consists of HTML snippets and as such is being prepared with {@link HtmlBuilder#htmlEncode(String)}. @param style style for table element @param content content string @return HTML table element as string
[ "Build", "a", "HTML", "Table", "with", "given", "CSS", "style", "for", "a", "string", ".", "Given", "content", "does", "<b", ">", "not<", "/", "b", ">", "consists", "of", "HTML", "snippets", "and", "as", "such", "is", "being", "prepared", "with", "{", ...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L80-L82
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/Client.java
Client.dataEventHandler
public void dataEventHandler(final DataEventHandler dataEventHandler) { env.setDataEventHandler(new DataEventHandler() { @Override public void onEvent(ChannelFlowController flowController, ByteBuf event) { if (DcpMutationMessage.is(event)) { short partition = DcpMutationMessage.partition(event); PartitionState ps = sessionState().get(partition); ps.setStartSeqno(DcpMutationMessage.bySeqno(event)); sessionState().set(partition, ps); } else if (DcpDeletionMessage.is(event)) { short partition = DcpDeletionMessage.partition(event); PartitionState ps = sessionState().get(partition); ps.setStartSeqno(DcpDeletionMessage.bySeqno(event)); sessionState().set(partition, ps); } else if (DcpExpirationMessage.is(event)) { short partition = DcpExpirationMessage.partition(event); PartitionState ps = sessionState().get(partition); ps.setStartSeqno(DcpExpirationMessage.bySeqno(event)); sessionState().set(partition, ps); } // Forward event to user. dataEventHandler.onEvent(flowController, event); } }); }
java
public void dataEventHandler(final DataEventHandler dataEventHandler) { env.setDataEventHandler(new DataEventHandler() { @Override public void onEvent(ChannelFlowController flowController, ByteBuf event) { if (DcpMutationMessage.is(event)) { short partition = DcpMutationMessage.partition(event); PartitionState ps = sessionState().get(partition); ps.setStartSeqno(DcpMutationMessage.bySeqno(event)); sessionState().set(partition, ps); } else if (DcpDeletionMessage.is(event)) { short partition = DcpDeletionMessage.partition(event); PartitionState ps = sessionState().get(partition); ps.setStartSeqno(DcpDeletionMessage.bySeqno(event)); sessionState().set(partition, ps); } else if (DcpExpirationMessage.is(event)) { short partition = DcpExpirationMessage.partition(event); PartitionState ps = sessionState().get(partition); ps.setStartSeqno(DcpExpirationMessage.bySeqno(event)); sessionState().set(partition, ps); } // Forward event to user. dataEventHandler.onEvent(flowController, event); } }); }
[ "public", "void", "dataEventHandler", "(", "final", "DataEventHandler", "dataEventHandler", ")", "{", "env", ".", "setDataEventHandler", "(", "new", "DataEventHandler", "(", ")", "{", "@", "Override", "public", "void", "onEvent", "(", "ChannelFlowController", "flowC...
Stores a {@link DataEventHandler} to be called when data events happen. <p> All events (passed as {@link ByteBuf}s) that the callback receives need to be handled and at least released (by using {@link ByteBuf#release()}, otherwise they will leak. <p> The following messages can happen and should be handled depending on the needs of the client: <p> - {@link DcpMutationMessage}: A mutation has occurred. Needs to be acknowledged. - {@link DcpDeletionMessage}: A deletion has occurred. Needs to be acknowledged. - {@link DcpExpirationMessage}: An expiration has occurred. Note that current server versions (as of 4.5.0) are not emitting this event, but in any case you should at least release it to be forwards compatible. Needs to be acknowledged. <p> Keep in mind that the callback is executed on the IO thread (netty's thread pool for the event loops) so further synchronization is needed if the data needs to be used on a different thread in a thread safe manner. @param dataEventHandler the event handler to use.
[ "Stores", "a", "{", "@link", "DataEventHandler", "}", "to", "be", "called", "when", "data", "events", "happen", ".", "<p", ">", "All", "events", "(", "passed", "as", "{", "@link", "ByteBuf", "}", "s", ")", "that", "the", "callback", "receives", "need", ...
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/Client.java#L292-L317