repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
EdwardRaff/JSAT
JSAT/src/jsat/distributions/Distribution.java
Distribution.invCdf
public double invCdf(double p) { if (p < 0 || p > 1) throw new ArithmeticException("Value of p must be in the range [0,1], not " + p); double a = Double.isInfinite(min()) ? Double.MIN_VALUE : min(); double b = Double.isInfinite(max()) ? Double.MAX_VALUE : max(); //default case, lets just do a root finding on the CDF for the specific value of p return Zeroin.root(a, b, (x) -> cdf(x) - p); }
java
public double invCdf(double p) { if (p < 0 || p > 1) throw new ArithmeticException("Value of p must be in the range [0,1], not " + p); double a = Double.isInfinite(min()) ? Double.MIN_VALUE : min(); double b = Double.isInfinite(max()) ? Double.MAX_VALUE : max(); //default case, lets just do a root finding on the CDF for the specific value of p return Zeroin.root(a, b, (x) -> cdf(x) - p); }
[ "public", "double", "invCdf", "(", "double", "p", ")", "{", "if", "(", "p", "<", "0", "||", "p", ">", "1", ")", "throw", "new", "ArithmeticException", "(", "\"Value of p must be in the range [0,1], not \"", "+", "p", ")", ";", "double", "a", "=", "Double",...
Computes the inverse Cumulative Density Function (CDF<sup>-1</sup>) at the given point. It takes in a value in the range of [0, 1] and returns the value x, such that CDF(x) = <tt>p</tt> @param p the probability value @return the value such that the CDF would return <tt>p</tt>
[ "Computes", "the", "inverse", "Cumulative", "Density", "Function", "(", "CDF<sup", ">", "-", "1<", "/", "sup", ">", ")", "at", "the", "given", "point", ".", "It", "takes", "in", "a", "value", "in", "the", "range", "of", "[", "0", "1", "]", "and", "...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/Distribution.java#L53-L62
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallGatewaySummary
public static GatewaySummaryBean unmarshallGatewaySummary(Map<String, Object> map) { GatewaySummaryBean bean = new GatewaySummaryBean(); bean.setId(asString(map.get("id"))); bean.setName(asString(map.get("name"))); if (map.containsKey("description")) { bean.setDescription(asString(map.get("description"))); } bean.setType(asEnum(map.get("type"), GatewayType.class)); postMarshall(bean); return bean; }
java
public static GatewaySummaryBean unmarshallGatewaySummary(Map<String, Object> map) { GatewaySummaryBean bean = new GatewaySummaryBean(); bean.setId(asString(map.get("id"))); bean.setName(asString(map.get("name"))); if (map.containsKey("description")) { bean.setDescription(asString(map.get("description"))); } bean.setType(asEnum(map.get("type"), GatewayType.class)); postMarshall(bean); return bean; }
[ "public", "static", "GatewaySummaryBean", "unmarshallGatewaySummary", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "GatewaySummaryBean", "bean", "=", "new", "GatewaySummaryBean", "(", ")", ";", "bean", ".", "setId", "(", "asString", "(", "ma...
Unmarshals the given map source into a bean. @param map the search hit map @return the gateway summary
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L1232-L1242
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Call.java
Call.create
public static Call create(final Map <String, Object>params) throws Exception { assert (params != null); return create(BandwidthClient.getInstance(), params); }
java
public static Call create(final Map <String, Object>params) throws Exception { assert (params != null); return create(BandwidthClient.getInstance(), params); }
[ "public", "static", "Call", "create", "(", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "Exception", "{", "assert", "(", "params", "!=", "null", ")", ";", "return", "create", "(", "BandwidthClient", ".", "getInstance", "(", ...
Dials a call, from a phone number to a phone number. @param params the call params @return the call @throws IOException unexpected error.
[ "Dials", "a", "call", "from", "a", "phone", "number", "to", "a", "phone", "number", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L139-L144
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.security/src/com/ibm/ws/ejbcontainer/security/internal/EJBSecurityCollaboratorImpl.java
EJBSecurityCollaboratorImpl.setUnauthenticatedSubjectIfNeeded
private boolean setUnauthenticatedSubjectIfNeeded(Subject invokedSubject, Subject receivedSubject) { if ((invokedSubject == null) && (receivedSubject == null)) { // create the unauthenticated subject and set as the invocation subject subjectManager.setInvocationSubject(unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject()); return true; } return false; }
java
private boolean setUnauthenticatedSubjectIfNeeded(Subject invokedSubject, Subject receivedSubject) { if ((invokedSubject == null) && (receivedSubject == null)) { // create the unauthenticated subject and set as the invocation subject subjectManager.setInvocationSubject(unauthenticatedSubjectServiceRef.getService().getUnauthenticatedSubject()); return true; } return false; }
[ "private", "boolean", "setUnauthenticatedSubjectIfNeeded", "(", "Subject", "invokedSubject", ",", "Subject", "receivedSubject", ")", "{", "if", "(", "(", "invokedSubject", "==", "null", ")", "&&", "(", "receivedSubject", "==", "null", ")", ")", "{", "// create the...
If invoked and received cred are null, then set the unauthenticated subject. @param invokedSubject @param receivedSubject @return {@code true} if the unauthenticated subject was set, {@code false} otherwise.
[ "If", "invoked", "and", "received", "cred", "are", "null", "then", "set", "the", "unauthenticated", "subject", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.security/src/com/ibm/ws/ejbcontainer/security/internal/EJBSecurityCollaboratorImpl.java#L701-L708
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/ByteArrayUtil.java
ByteArrayUtil.getLongLE
public static long getLongLE(final byte[] array, final int offset) { return ( array[offset ] & 0XFFL ) | ((array[offset + 1] & 0XFFL) << 8) | ((array[offset + 2] & 0XFFL) << 16) | ((array[offset + 3] & 0XFFL) << 24) | ((array[offset + 4] & 0XFFL) << 32) | ((array[offset + 5] & 0XFFL) << 40) | ((array[offset + 6] & 0XFFL) << 48) | ((array[offset + 7] & 0XFFL) << 56); }
java
public static long getLongLE(final byte[] array, final int offset) { return ( array[offset ] & 0XFFL ) | ((array[offset + 1] & 0XFFL) << 8) | ((array[offset + 2] & 0XFFL) << 16) | ((array[offset + 3] & 0XFFL) << 24) | ((array[offset + 4] & 0XFFL) << 32) | ((array[offset + 5] & 0XFFL) << 40) | ((array[offset + 6] & 0XFFL) << 48) | ((array[offset + 7] & 0XFFL) << 56); }
[ "public", "static", "long", "getLongLE", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ")", "{", "return", "(", "array", "[", "offset", "]", "&", "0XFF", "L", ")", "|", "(", "(", "array", "[", "offset", "+", "1", "]", "&...
Get a <i>long</i> from the given byte array starting at the given offset in little endian order. There is no bounds checking. @param array source byte array @param offset source offset @return the <i>long</i>
[ "Get", "a", "<i", ">", "long<", "/", "i", ">", "from", "the", "given", "byte", "array", "starting", "at", "the", "given", "offset", "in", "little", "endian", "order", ".", "There", "is", "no", "bounds", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L125-L134
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java
MapApi.getNullable
public static Object getNullable(final Map map, final Object... path) { return getNullable(map, Object.class, path); }
java
public static Object getNullable(final Map map, final Object... path) { return getNullable(map, Object.class, path); }
[ "public", "static", "Object", "getNullable", "(", "final", "Map", "map", ",", "final", "Object", "...", "path", ")", "{", "return", "getNullable", "(", "map", ",", "Object", ".", "class", ",", "path", ")", ";", "}" ]
Get object value by path. @param map subject @param path nodes to walk in map @return value
[ "Get", "object", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L147-L149
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.splitCostStart
private TimephasedCost splitCostStart(ProjectCalendar calendar, double totalAmount, Date start) { TimephasedCost cost = new TimephasedCost(); cost.setStart(start); cost.setFinish(calendar.getDate(start, Duration.getInstance(1, TimeUnit.DAYS), false)); cost.setAmountPerDay(Double.valueOf(totalAmount)); cost.setTotalAmount(Double.valueOf(totalAmount)); return cost; }
java
private TimephasedCost splitCostStart(ProjectCalendar calendar, double totalAmount, Date start) { TimephasedCost cost = new TimephasedCost(); cost.setStart(start); cost.setFinish(calendar.getDate(start, Duration.getInstance(1, TimeUnit.DAYS), false)); cost.setAmountPerDay(Double.valueOf(totalAmount)); cost.setTotalAmount(Double.valueOf(totalAmount)); return cost; }
[ "private", "TimephasedCost", "splitCostStart", "(", "ProjectCalendar", "calendar", ",", "double", "totalAmount", ",", "Date", "start", ")", "{", "TimephasedCost", "cost", "=", "new", "TimephasedCost", "(", ")", ";", "cost", ".", "setStart", "(", "start", ")", ...
Used for Cost type Resources. Generates a TimphasedCost block for the total amount on the start date. This is useful for Cost resources that have an AccrueAt value of Start. @param calendar calendar used by this assignment @param totalAmount cost amount for this block @param start start date of the timephased cost block @return timephased cost
[ "Used", "for", "Cost", "type", "Resources", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L964-L973
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.photos_addTags
public T photos_addTags(Long photoId, Collection<PhotoTag> tags) throws FacebookException, IOException { assert (photoId > 0); assert (null != tags && !tags.isEmpty()); JSONArray jsonTags = new JSONArray(); for (PhotoTag tag : tags) { jsonTags.add(tag.jsonify()); } return this.callMethod(FacebookMethod.PHOTOS_ADD_TAG, new Pair<String, CharSequence>("pid", photoId.toString()), new Pair<String, CharSequence>("tags", jsonTags.toString())); }
java
public T photos_addTags(Long photoId, Collection<PhotoTag> tags) throws FacebookException, IOException { assert (photoId > 0); assert (null != tags && !tags.isEmpty()); JSONArray jsonTags = new JSONArray(); for (PhotoTag tag : tags) { jsonTags.add(tag.jsonify()); } return this.callMethod(FacebookMethod.PHOTOS_ADD_TAG, new Pair<String, CharSequence>("pid", photoId.toString()), new Pair<String, CharSequence>("tags", jsonTags.toString())); }
[ "public", "T", "photos_addTags", "(", "Long", "photoId", ",", "Collection", "<", "PhotoTag", ">", "tags", ")", "throws", "FacebookException", ",", "IOException", "{", "assert", "(", "photoId", ">", "0", ")", ";", "assert", "(", "null", "!=", "tags", "&&", ...
Adds several tags to a photo. @param photoId The photo id of the photo to be tagged. @param tags A list of PhotoTags. @return a list of booleans indicating whether the tag was successfully added.
[ "Adds", "several", "tags", "to", "a", "photo", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1364-L1377
phax/ph-css
ph-css/src/main/java/com/helger/css/reader/CSSReader.java
CSSReader.readFromStringStream
@Nullable public static CascadingStyleSheet readFromStringStream (@Nonnull final String sCSS, @Nonnull final CSSReaderSettings aSettings) { return readFromStream (new StringInputStreamProvider (sCSS, aSettings.getFallbackCharset ()), aSettings); }
java
@Nullable public static CascadingStyleSheet readFromStringStream (@Nonnull final String sCSS, @Nonnull final CSSReaderSettings aSettings) { return readFromStream (new StringInputStreamProvider (sCSS, aSettings.getFallbackCharset ()), aSettings); }
[ "@", "Nullable", "public", "static", "CascadingStyleSheet", "readFromStringStream", "(", "@", "Nonnull", "final", "String", "sCSS", ",", "@", "Nonnull", "final", "CSSReaderSettings", "aSettings", ")", "{", "return", "readFromStream", "(", "new", "StringInputStreamProv...
Read the CSS from the passed String using a byte stream. @param sCSS The source string containing the CSS to be parsed. May not be <code>null</code>. @param aSettings The settings to be used for reading the CSS. May not be <code>null</code>. @return <code>null</code> if reading failed, the CSS declarations otherwise. @since 3.8.2
[ "Read", "the", "CSS", "from", "the", "passed", "String", "using", "a", "byte", "stream", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/reader/CSSReader.java#L503-L508
heinrichreimer/material-drawer
library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerProfile.java
DrawerProfile.setAvatar
public DrawerProfile setAvatar(Context context, Bitmap avatar) { mAvatar = new BitmapDrawable(context.getResources(), avatar); notifyDataChanged(); return this; }
java
public DrawerProfile setAvatar(Context context, Bitmap avatar) { mAvatar = new BitmapDrawable(context.getResources(), avatar); notifyDataChanged(); return this; }
[ "public", "DrawerProfile", "setAvatar", "(", "Context", "context", ",", "Bitmap", "avatar", ")", "{", "mAvatar", "=", "new", "BitmapDrawable", "(", "context", ".", "getResources", "(", ")", ",", "avatar", ")", ";", "notifyDataChanged", "(", ")", ";", "return...
Sets an avatar image to the drawer profile @param avatar Avatar image to set
[ "Sets", "an", "avatar", "image", "to", "the", "drawer", "profile" ]
train
https://github.com/heinrichreimer/material-drawer/blob/7c2406812d73f710ef8bb73d4a0f4bbef3b275ce/library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerProfile.java#L126-L130
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_output_elasticsearch_index_indexId_PUT
public OvhOperation serviceName_output_elasticsearch_index_indexId_PUT(String serviceName, String indexId, Boolean alertNotifyEnabled, String description) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId}"; StringBuilder sb = path(qPath, serviceName, indexId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "alertNotifyEnabled", alertNotifyEnabled); addBody(o, "description", description); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_output_elasticsearch_index_indexId_PUT(String serviceName, String indexId, Boolean alertNotifyEnabled, String description) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId}"; StringBuilder sb = path(qPath, serviceName, indexId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "alertNotifyEnabled", alertNotifyEnabled); addBody(o, "description", description); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_output_elasticsearch_index_indexId_PUT", "(", "String", "serviceName", ",", "String", "indexId", ",", "Boolean", "alertNotifyEnabled", ",", "String", "description", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas...
Update specified elasticsearch index REST: PUT /dbaas/logs/{serviceName}/output/elasticsearch/index/{indexId} @param serviceName [required] Service name @param indexId [required] Index ID @param alertNotifyEnabled [required] Alert notify enabled @param description [required] Description
[ "Update", "specified", "elasticsearch", "index" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1851-L1859
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberingSystem.java
NumberingSystem.getInstance
public static NumberingSystem getInstance(ULocale locale) { // Check for @numbers boolean nsResolved = true; String numbersKeyword = locale.getKeywordValue("numbers"); if (numbersKeyword != null ) { for ( String keyword : OTHER_NS_KEYWORDS ) { if ( numbersKeyword.equals(keyword)) { nsResolved = false; break; } } } else { numbersKeyword = "default"; nsResolved = false; } if (nsResolved) { NumberingSystem ns = getInstanceByName(numbersKeyword); if (ns != null) { return ns; } // If the @numbers keyword points to a bogus numbering system name, // we return the default for the locale. numbersKeyword = "default"; } // Attempt to get the numbering system from the cache String baseName = locale.getBaseName(); // TODO: Caching by locale+numbersKeyword could yield a large cache. // Try to load for each locale the mappings from OTHER_NS_KEYWORDS and default // to real numbering system names; can we get those from supplemental data? // Then look up those mappings for the locale and resolve the keyword. String key = baseName+"@numbers="+numbersKeyword; LocaleLookupData localeLookupData = new LocaleLookupData(locale, numbersKeyword); return cachedLocaleData.getInstance(key, localeLookupData); }
java
public static NumberingSystem getInstance(ULocale locale) { // Check for @numbers boolean nsResolved = true; String numbersKeyword = locale.getKeywordValue("numbers"); if (numbersKeyword != null ) { for ( String keyword : OTHER_NS_KEYWORDS ) { if ( numbersKeyword.equals(keyword)) { nsResolved = false; break; } } } else { numbersKeyword = "default"; nsResolved = false; } if (nsResolved) { NumberingSystem ns = getInstanceByName(numbersKeyword); if (ns != null) { return ns; } // If the @numbers keyword points to a bogus numbering system name, // we return the default for the locale. numbersKeyword = "default"; } // Attempt to get the numbering system from the cache String baseName = locale.getBaseName(); // TODO: Caching by locale+numbersKeyword could yield a large cache. // Try to load for each locale the mappings from OTHER_NS_KEYWORDS and default // to real numbering system names; can we get those from supplemental data? // Then look up those mappings for the locale and resolve the keyword. String key = baseName+"@numbers="+numbersKeyword; LocaleLookupData localeLookupData = new LocaleLookupData(locale, numbersKeyword); return cachedLocaleData.getInstance(key, localeLookupData); }
[ "public", "static", "NumberingSystem", "getInstance", "(", "ULocale", "locale", ")", "{", "// Check for @numbers", "boolean", "nsResolved", "=", "true", ";", "String", "numbersKeyword", "=", "locale", ".", "getKeywordValue", "(", "\"numbers\"", ")", ";", "if", "("...
Returns the default numbering system for the specified ULocale.
[ "Returns", "the", "default", "numbering", "system", "for", "the", "specified", "ULocale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberingSystem.java#L110-L145
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java
ConfigElementList.removeBy
public E removeBy(String attributeName, String attributeValue) { // traverses the list twice, but reuse code E element = this.getBy(attributeName, attributeValue); if (element != null) { this.remove(element); // this should always return true since we already found the element } return element; }
java
public E removeBy(String attributeName, String attributeValue) { // traverses the list twice, but reuse code E element = this.getBy(attributeName, attributeValue); if (element != null) { this.remove(element); // this should always return true since we already found the element } return element; }
[ "public", "E", "removeBy", "(", "String", "attributeName", ",", "String", "attributeValue", ")", "{", "// traverses the list twice, but reuse code", "E", "element", "=", "this", ".", "getBy", "(", "attributeName", ",", "attributeValue", ")", ";", "if", "(", "eleme...
Removes the first element in this list with a matching attribute name/value @param attributeName the attribute for which to search (Example: jndiName) @param attributeValue the value to match @return the removed element, or null of no element was removed
[ "Removes", "the", "first", "element", "in", "this", "list", "with", "a", "matching", "attribute", "name", "/", "value" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java#L112-L119
salesforce/Argus
ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java
AlertService.updateAlert
public Alert updateAlert(BigInteger alertId, Alert alert) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + alertId.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, alert); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Alert.class); }
java
public Alert updateAlert(BigInteger alertId, Alert alert) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + alertId.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, alert); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Alert.class); }
[ "public", "Alert", "updateAlert", "(", "BigInteger", "alertId", ",", "Alert", "alert", ")", "throws", "IOException", ",", "TokenExpiredException", "{", "String", "requestUrl", "=", "RESOURCE", "+", "\"/\"", "+", "alertId", ".", "toString", "(", ")", ";", "Argu...
Updates an existing alert. @param alertId The alert ID. @param alert The updated alert information. @return The updated alert. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired
[ "Updates", "an", "existing", "alert", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L277-L283
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java
MapDotApi.dotGetMap
public static <A, B> Optional<Map<A, B>> dotGetMap(final Map map, final String pathString) { return dotGet(map, Map.class, pathString).map(m -> (Map<A, B>) m); }
java
public static <A, B> Optional<Map<A, B>> dotGetMap(final Map map, final String pathString) { return dotGet(map, Map.class, pathString).map(m -> (Map<A, B>) m); }
[ "public", "static", "<", "A", ",", "B", ">", "Optional", "<", "Map", "<", "A", ",", "B", ">", ">", "dotGetMap", "(", "final", "Map", "map", ",", "final", "String", "pathString", ")", "{", "return", "dotGet", "(", "map", ",", "Map", ".", "class", ...
Get map value by path. @param <A> map key type @param <B> map value type @param map subject @param pathString nodes to walk in map @return value
[ "Get", "map", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L168-L170
cdk/cdk
storage/pdb/src/main/java/org/openscience/cdk/tools/ProteinBuilderTool.java
ProteinBuilderTool.addAminoAcidAtNTerminus
public static IBioPolymer addAminoAcidAtNTerminus(IBioPolymer protein, IAminoAcid aaToAdd, IStrand strand, IAminoAcid aaToAddTo) { // then add the amino acid addAminoAcid(protein, aaToAdd, strand); // Now think about the protein back bone connection if (protein.getMonomerCount() == 0) { // make the connection between that aminoAcid's C-terminus and the // protein's N-terminus protein.addBond(aaToAdd.getBuilder().newInstance(IBond.class, aaToAddTo.getNTerminus(), aaToAdd.getCTerminus(), IBond.Order.SINGLE)); } // else : no current N-terminus, so nothing special to do return protein; }
java
public static IBioPolymer addAminoAcidAtNTerminus(IBioPolymer protein, IAminoAcid aaToAdd, IStrand strand, IAminoAcid aaToAddTo) { // then add the amino acid addAminoAcid(protein, aaToAdd, strand); // Now think about the protein back bone connection if (protein.getMonomerCount() == 0) { // make the connection between that aminoAcid's C-terminus and the // protein's N-terminus protein.addBond(aaToAdd.getBuilder().newInstance(IBond.class, aaToAddTo.getNTerminus(), aaToAdd.getCTerminus(), IBond.Order.SINGLE)); } // else : no current N-terminus, so nothing special to do return protein; }
[ "public", "static", "IBioPolymer", "addAminoAcidAtNTerminus", "(", "IBioPolymer", "protein", ",", "IAminoAcid", "aaToAdd", ",", "IStrand", "strand", ",", "IAminoAcid", "aaToAddTo", ")", "{", "// then add the amino acid", "addAminoAcid", "(", "protein", ",", "aaToAdd", ...
Builds a protein by connecting a new amino acid at the N-terminus of the given strand. @param protein protein to which the strand belongs @param aaToAdd amino acid to add to the strand of the protein @param strand strand to which the protein is added
[ "Builds", "a", "protein", "by", "connecting", "a", "new", "amino", "acid", "at", "the", "N", "-", "terminus", "of", "the", "given", "strand", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/pdb/src/main/java/org/openscience/cdk/tools/ProteinBuilderTool.java#L60-L72
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunck.java
HornSchunck.process
public void process( T image1 , T image2 , ImageFlow output) { InputSanityCheck.checkSameShape(image1,image2); derivX.reshape(image1.width,image1.height); derivY.reshape(image1.width,image1.height); derivT.reshape(image1.width,image1.height); averageFlow.reshape(output.width,output.height); if( resetOutput ) output.fillZero(); computeDerivX(image1,image2,derivX); computeDerivY(image1,image2,derivY); computeDerivT(image1,image2,derivT); findFlow(derivX,derivY,derivT,output); }
java
public void process( T image1 , T image2 , ImageFlow output) { InputSanityCheck.checkSameShape(image1,image2); derivX.reshape(image1.width,image1.height); derivY.reshape(image1.width,image1.height); derivT.reshape(image1.width,image1.height); averageFlow.reshape(output.width,output.height); if( resetOutput ) output.fillZero(); computeDerivX(image1,image2,derivX); computeDerivY(image1,image2,derivY); computeDerivT(image1,image2,derivT); findFlow(derivX,derivY,derivT,output); }
[ "public", "void", "process", "(", "T", "image1", ",", "T", "image2", ",", "ImageFlow", "output", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "image1", ",", "image2", ")", ";", "derivX", ".", "reshape", "(", "image1", ".", "width", ",", "ima...
Computes dense optical flow from the first image's gradient and the difference between the second and the first image. @param image1 First image @param image2 Second image @param output Found dense optical flow
[ "Computes", "dense", "optical", "flow", "from", "the", "first", "image", "s", "gradient", "and", "the", "difference", "between", "the", "second", "and", "the", "first", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunck.java#L92-L110
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java
JobLauncherFactory.newJobLauncher
public static JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, String launcherTypeValue, SharedResourcesBroker<GobblinScopeTypes> instanceBroker) { return newJobLauncher(sysProps, jobProps, launcherTypeValue, instanceBroker, ImmutableList.of()); }
java
public static JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, String launcherTypeValue, SharedResourcesBroker<GobblinScopeTypes> instanceBroker) { return newJobLauncher(sysProps, jobProps, launcherTypeValue, instanceBroker, ImmutableList.of()); }
[ "public", "static", "JobLauncher", "newJobLauncher", "(", "Properties", "sysProps", ",", "Properties", "jobProps", ",", "String", "launcherTypeValue", ",", "SharedResourcesBroker", "<", "GobblinScopeTypes", ">", "instanceBroker", ")", "{", "return", "newJobLauncher", "(...
Creates a new instance for a JobLauncher with a given type @param sysProps the system/environment properties @param jobProps the job properties @param launcherTypeValue the type of the launcher; either a {@link JobLauncherType} value or the name of the class that extends {@link AbstractJobLauncher} and has a constructor that has a single Properties parameter.. @return the JobLauncher instance @throws RuntimeException if the instantiation fails
[ "Creates", "a", "new", "instance", "for", "a", "JobLauncher", "with", "a", "given", "type" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java#L120-L123
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/MapOutputFile.java
MapOutputFile.getSpillIndexFile
public Path getSpillIndexFile(TaskAttemptID mapTaskId, int spillNumber) throws IOException { return lDirAlloc.getLocalPathToRead(TaskTracker.getIntermediateOutputDir( jobId.toString(), mapTaskId.toString()) + "/spill" + spillNumber + ".out.index", conf); }
java
public Path getSpillIndexFile(TaskAttemptID mapTaskId, int spillNumber) throws IOException { return lDirAlloc.getLocalPathToRead(TaskTracker.getIntermediateOutputDir( jobId.toString(), mapTaskId.toString()) + "/spill" + spillNumber + ".out.index", conf); }
[ "public", "Path", "getSpillIndexFile", "(", "TaskAttemptID", "mapTaskId", ",", "int", "spillNumber", ")", "throws", "IOException", "{", "return", "lDirAlloc", ".", "getLocalPathToRead", "(", "TaskTracker", ".", "getIntermediateOutputDir", "(", "jobId", ".", "toString"...
Return a local map spill index file created earlier @param mapTaskId a map task id @param spillNumber the number
[ "Return", "a", "local", "map", "spill", "index", "file", "created", "earlier" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/MapOutputFile.java#L129-L135
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java
DefaultApplicationObjectConfigurer.configureLabel
protected void configureLabel(LabelConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); String labelStr = loadMessage(objectName + "." + LABEL_KEY); if (StringUtils.hasText(labelStr)) { LabelInfo labelInfo = LabelInfo.valueOf(labelStr); configurable.setLabelInfo(labelInfo); } }
java
protected void configureLabel(LabelConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); String labelStr = loadMessage(objectName + "." + LABEL_KEY); if (StringUtils.hasText(labelStr)) { LabelInfo labelInfo = LabelInfo.valueOf(labelStr); configurable.setLabelInfo(labelInfo); } }
[ "protected", "void", "configureLabel", "(", "LabelConfigurable", "configurable", ",", "String", "objectName", ")", "{", "Assert", ".", "notNull", "(", "configurable", ",", "\"configurable\"", ")", ";", "Assert", ".", "notNull", "(", "objectName", ",", "\"objectNam...
Sets the {@link LabelInfo} of the given object. The label info is created after loading the encoded label string from this instance's {@link MessageSource} using a message code in the format <pre> &lt;objectName&gt;.label </pre> @param configurable The object to be configured. Must not be null. @param objectName The name of the configurable object, unique within the application. Must not be null. @throws IllegalArgumentException if either argument is null.
[ "Sets", "the", "{", "@link", "LabelInfo", "}", "of", "the", "given", "object", ".", "The", "label", "info", "is", "created", "after", "loading", "the", "encoded", "label", "string", "from", "this", "instance", "s", "{", "@link", "MessageSource", "}", "usin...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java#L372-L382
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/CLIQUE.java
CLIQUE.updateMinMax
private void updateMinMax(NumberVector featureVector, double[] minima, double[] maxima) { assert (minima.length == featureVector.getDimensionality()); for(int d = 0; d < featureVector.getDimensionality(); d++) { double v = featureVector.doubleValue(d); if(v == v) { // Avoid NaN. maxima[d] = MathUtil.max(v, maxima[d]); minima[d] = MathUtil.min(v, minima[d]); } } }
java
private void updateMinMax(NumberVector featureVector, double[] minima, double[] maxima) { assert (minima.length == featureVector.getDimensionality()); for(int d = 0; d < featureVector.getDimensionality(); d++) { double v = featureVector.doubleValue(d); if(v == v) { // Avoid NaN. maxima[d] = MathUtil.max(v, maxima[d]); minima[d] = MathUtil.min(v, minima[d]); } } }
[ "private", "void", "updateMinMax", "(", "NumberVector", "featureVector", ",", "double", "[", "]", "minima", ",", "double", "[", "]", "maxima", ")", "{", "assert", "(", "minima", ".", "length", "==", "featureVector", ".", "getDimensionality", "(", ")", ")", ...
Updates the minima and maxima array according to the specified feature vector. @param featureVector the feature vector @param minima the array of minima @param maxima the array of maxima
[ "Updates", "the", "minima", "and", "maxima", "array", "according", "to", "the", "specified", "feature", "vector", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/CLIQUE.java#L304-L313
googleads/googleads-java-lib
modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/AxisHandler.java
AxisHandler.setCompression
@Override public void setCompression(Stub soapClient, boolean compress) { soapClient._setProperty(HTTPConstants.MC_ACCEPT_GZIP, compress); soapClient._setProperty(HTTPConstants.MC_GZIP_REQUEST, compress); }
java
@Override public void setCompression(Stub soapClient, boolean compress) { soapClient._setProperty(HTTPConstants.MC_ACCEPT_GZIP, compress); soapClient._setProperty(HTTPConstants.MC_GZIP_REQUEST, compress); }
[ "@", "Override", "public", "void", "setCompression", "(", "Stub", "soapClient", ",", "boolean", "compress", ")", "{", "soapClient", ".", "_setProperty", "(", "HTTPConstants", ".", "MC_ACCEPT_GZIP", ",", "compress", ")", ";", "soapClient", ".", "_setProperty", "(...
Set whether SOAP requests should use compression. @param soapClient the client to set compression settings for @param compress whether or not to use compression
[ "Set", "whether", "SOAP", "requests", "should", "use", "compression", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_axis/src/main/java/com/google/api/ads/common/lib/soap/axis/AxisHandler.java#L175-L179
apache/flink
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java
PatternStream.flatSelect
public <R> SingleOutputStreamOperator<R> flatSelect( final PatternFlatSelectFunction<T, R> patternFlatSelectFunction, final TypeInformation<R> outTypeInfo) { final PatternProcessFunction<T, R> processFunction = fromFlatSelect(builder.clean(patternFlatSelectFunction)) .build(); return process(processFunction, outTypeInfo); }
java
public <R> SingleOutputStreamOperator<R> flatSelect( final PatternFlatSelectFunction<T, R> patternFlatSelectFunction, final TypeInformation<R> outTypeInfo) { final PatternProcessFunction<T, R> processFunction = fromFlatSelect(builder.clean(patternFlatSelectFunction)) .build(); return process(processFunction, outTypeInfo); }
[ "public", "<", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "flatSelect", "(", "final", "PatternFlatSelectFunction", "<", "T", ",", "R", ">", "patternFlatSelectFunction", ",", "final", "TypeInformation", "<", "R", ">", "outTypeInfo", ")", "{", "final",...
Applies a flat select function to the detected pattern sequence. For each pattern sequence the provided {@link PatternFlatSelectFunction} is called. The pattern flat select function can produce an arbitrary number of resulting elements. @param patternFlatSelectFunction The pattern flat select function which is called for each detected pattern sequence. @param <R> Type of the resulting elements @param outTypeInfo Explicit specification of output type. @return {@link DataStream} which contains the resulting elements from the pattern flat select function.
[ "Applies", "a", "flat", "select", "function", "to", "the", "detected", "pattern", "sequence", ".", "For", "each", "pattern", "sequence", "the", "provided", "{", "@link", "PatternFlatSelectFunction", "}", "is", "called", ".", "The", "pattern", "flat", "select", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java#L358-L367
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.pretrainLayer
public void pretrainLayer(String layerName, MultiDataSetIterator iter) { try{ pretrainLayerHelper(layerName, iter, 1); } catch (OutOfMemoryError e){ CrashReportingUtil.writeMemoryCrashDump(this, e); throw e; } }
java
public void pretrainLayer(String layerName, MultiDataSetIterator iter) { try{ pretrainLayerHelper(layerName, iter, 1); } catch (OutOfMemoryError e){ CrashReportingUtil.writeMemoryCrashDump(this, e); throw e; } }
[ "public", "void", "pretrainLayer", "(", "String", "layerName", ",", "MultiDataSetIterator", "iter", ")", "{", "try", "{", "pretrainLayerHelper", "(", "layerName", ",", "iter", ",", "1", ")", ";", "}", "catch", "(", "OutOfMemoryError", "e", ")", "{", "CrashRe...
Pretrain a specified layer with the given MultiDataSetIterator @param layerName Layer name @param iter Training data
[ "Pretrain", "a", "specified", "layer", "with", "the", "given", "MultiDataSetIterator" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L894-L901
structurizr/java
structurizr-core/src/com/structurizr/model/Model.java
Model.modifyRelationship
public void modifyRelationship(Relationship relationship, String description, String technology) { if (relationship == null) { throw new IllegalArgumentException("A relationship must be specified."); } Relationship newRelationship = new Relationship(relationship.getSource(), relationship.getDestination(), description, technology, relationship.getInteractionStyle()); if (!relationship.getSource().has(newRelationship)) { relationship.setDescription(description); relationship.setTechnology(technology); } else { throw new IllegalArgumentException("This relationship exists already: " + newRelationship); } }
java
public void modifyRelationship(Relationship relationship, String description, String technology) { if (relationship == null) { throw new IllegalArgumentException("A relationship must be specified."); } Relationship newRelationship = new Relationship(relationship.getSource(), relationship.getDestination(), description, technology, relationship.getInteractionStyle()); if (!relationship.getSource().has(newRelationship)) { relationship.setDescription(description); relationship.setTechnology(technology); } else { throw new IllegalArgumentException("This relationship exists already: " + newRelationship); } }
[ "public", "void", "modifyRelationship", "(", "Relationship", "relationship", ",", "String", "description", ",", "String", "technology", ")", "{", "if", "(", "relationship", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A relationship mu...
Provides a way for the description and technology to be modified on an existing relationship. @param relationship a Relationship instance @param description the new description @param technology the new technology
[ "Provides", "a", "way", "for", "the", "description", "and", "technology", "to", "be", "modified", "on", "an", "existing", "relationship", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L795-L807
belaban/JGroups
src/org/jgroups/blocks/MessageDispatcher.java
MessageDispatcher.castMessage
public <T> RspList<T> castMessage(Collection<Address> dests, byte[] data, int offset, int length, RequestOptions opts) throws Exception { return castMessage(dests, new Buffer(data, offset, length), opts); }
java
public <T> RspList<T> castMessage(Collection<Address> dests, byte[] data, int offset, int length, RequestOptions opts) throws Exception { return castMessage(dests, new Buffer(data, offset, length), opts); }
[ "public", "<", "T", ">", "RspList", "<", "T", ">", "castMessage", "(", "Collection", "<", "Address", ">", "dests", ",", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "length", ",", "RequestOptions", "opts", ")", "throws", "Exception", "{"...
Sends a message to all members and expects responses from members in dests (if non-null). @param dests A list of group members from which to expect responses (if the call is blocking). @param data The buffer @param offset the offset into data @param length the number of bytes to send @param opts A set of options that govern the call. See {@link org.jgroups.blocks.RequestOptions} for details @return RspList A list of Rsp elements, or null if the RPC is asynchronous @throws Exception If the request cannot be sent @since 4.0
[ "Sends", "a", "message", "to", "all", "members", "and", "expects", "responses", "from", "members", "in", "dests", "(", "if", "non", "-", "null", ")", "." ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/MessageDispatcher.java#L235-L238
threerings/narya
core/src/main/java/com/threerings/presents/util/ClassUtil.java
ClassUtil.getMethod
public static Method getMethod (String name, Object target, Object[] args) { Class<?> tclass = target.getClass(); Method meth = null; try { MethodFinder finder = new MethodFinder(tclass); meth = finder.findMethod(name, args); } catch (NoSuchMethodException nsme) { // nothing to do here but fall through and return null log.info("No such method", "name", name, "tclass", tclass.getName(), "args", args, "error", nsme); } catch (SecurityException se) { log.warning("Unable to look up method?", "tclass", tclass.getName(), "mname", name); } return meth; }
java
public static Method getMethod (String name, Object target, Object[] args) { Class<?> tclass = target.getClass(); Method meth = null; try { MethodFinder finder = new MethodFinder(tclass); meth = finder.findMethod(name, args); } catch (NoSuchMethodException nsme) { // nothing to do here but fall through and return null log.info("No such method", "name", name, "tclass", tclass.getName(), "args", args, "error", nsme); } catch (SecurityException se) { log.warning("Unable to look up method?", "tclass", tclass.getName(), "mname", name); } return meth; }
[ "public", "static", "Method", "getMethod", "(", "String", "name", ",", "Object", "target", ",", "Object", "[", "]", "args", ")", "{", "Class", "<", "?", ">", "tclass", "=", "target", ".", "getClass", "(", ")", ";", "Method", "meth", "=", "null", ";",...
Looks up the method on the specified object that has a signature that matches the supplied arguments array. This is very expensive, so you shouldn't be doing this for something that happens frequently. @return the best matching method with the specified name that accepts the supplied arguments, or null if no method could be found. @see MethodFinder
[ "Looks", "up", "the", "method", "on", "the", "specified", "object", "that", "has", "a", "signature", "that", "matches", "the", "supplied", "arguments", "array", ".", "This", "is", "very", "expensive", "so", "you", "shouldn", "t", "be", "doing", "this", "fo...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/util/ClassUtil.java#L72-L91
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.extractEpipoles
public static void extractEpipoles( TrifocalTensor tensor , Point3D_F64 e2 , Point3D_F64 e3 ) { TrifocalExtractGeometries e = new TrifocalExtractGeometries(); e.setTensor(tensor); e.extractEpipoles(e2,e3); }
java
public static void extractEpipoles( TrifocalTensor tensor , Point3D_F64 e2 , Point3D_F64 e3 ) { TrifocalExtractGeometries e = new TrifocalExtractGeometries(); e.setTensor(tensor); e.extractEpipoles(e2,e3); }
[ "public", "static", "void", "extractEpipoles", "(", "TrifocalTensor", "tensor", ",", "Point3D_F64", "e2", ",", "Point3D_F64", "e3", ")", "{", "TrifocalExtractGeometries", "e", "=", "new", "TrifocalExtractGeometries", "(", ")", ";", "e", ".", "setTensor", "(", "t...
<p> Computes the epipoles of the first camera in the second and third images. Epipoles are found in homogeneous coordinates and have a norm of 1. </p> <p> Properties: <ul> <li> e2<sup>T</sup>*F12 = 0 <li> e3<sup>T</sup>*F13 = 0 </ul> where F1i is a fundamental matrix from image 1 to i. </p> @see TrifocalExtractGeometries @param tensor Trifocal tensor. Not Modified @param e2 Output: Epipole in image 2. Homogeneous coordinates. Modified @param e3 Output: Epipole in image 3. Homogeneous coordinates. Modified
[ "<p", ">", "Computes", "the", "epipoles", "of", "the", "first", "camera", "in", "the", "second", "and", "third", "images", ".", "Epipoles", "are", "found", "in", "homogeneous", "coordinates", "and", "have", "a", "norm", "of", "1", ".", "<", "/", "p", "...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L603-L607
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/QueryParserBase.java
QueryParserBase.createQueryStringFromNode
public String createQueryStringFromNode(Node node, @Nullable Class<?> domainType) { return createQueryStringFromNode(node, 0, domainType); }
java
public String createQueryStringFromNode(Node node, @Nullable Class<?> domainType) { return createQueryStringFromNode(node, 0, domainType); }
[ "public", "String", "createQueryStringFromNode", "(", "Node", "node", ",", "@", "Nullable", "Class", "<", "?", ">", "domainType", ")", "{", "return", "createQueryStringFromNode", "(", "node", ",", "0", ",", "domainType", ")", ";", "}" ]
Create the plain query string representation of the given node using mapping information derived from the domain type. @param node @param domainType can be {@literal null}. @return @since 4.0
[ "Create", "the", "plain", "query", "string", "representation", "of", "the", "given", "node", "using", "mapping", "information", "derived", "from", "the", "domain", "type", "." ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L163-L165
impossibl/stencil
engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java
StencilOperands.narrowAccept
protected boolean narrowAccept(Class<?> narrow, Class<?> source) { return narrow == null || narrow.equals(source); }
java
protected boolean narrowAccept(Class<?> narrow, Class<?> source) { return narrow == null || narrow.equals(source); }
[ "protected", "boolean", "narrowAccept", "(", "Class", "<", "?", ">", "narrow", ",", "Class", "<", "?", ">", "source", ")", "{", "return", "narrow", "==", "null", "||", "narrow", ".", "equals", "(", "source", ")", ";", "}" ]
Whether we consider the narrow class as a potential candidate for narrowing the source. @param narrow the target narrow class @param source the orginal source class @return true if attempt to narrow source to target is accepted
[ "Whether", "we", "consider", "the", "narrow", "class", "as", "a", "potential", "candidate", "for", "narrowing", "the", "source", "." ]
train
https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L1197-L1199
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/TemplatesApi.java
TemplatesApi.listTabs
public Tabs listTabs(String accountId, String templateId, String recipientId) throws ApiException { return listTabs(accountId, templateId, recipientId, null); }
java
public Tabs listTabs(String accountId, String templateId, String recipientId) throws ApiException { return listTabs(accountId, templateId, recipientId, null); }
[ "public", "Tabs", "listTabs", "(", "String", "accountId", ",", "String", "templateId", ",", "String", "recipientId", ")", "throws", "ApiException", "{", "return", "listTabs", "(", "accountId", ",", "templateId", ",", "recipientId", ",", "null", ")", ";", "}" ]
Gets the tabs information for a signer or sign-in-person recipient in a template. Gets the tabs information for a signer or sign-in-person recipient in a template. @param accountId The external account number (int) or account ID Guid. (required) @param templateId The ID of the template being accessed. (required) @param recipientId The ID of the recipient being accessed. (required) @return Tabs
[ "Gets", "the", "tabs", "information", "for", "a", "signer", "or", "sign", "-", "in", "-", "person", "recipient", "in", "a", "template", ".", "Gets", "the", "tabs", "information", "for", "a", "signer", "or", "sign", "-", "in", "-", "person", "recipient", ...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L2363-L2365
datasalt/pangool
core/src/main/java/com/datasalt/pangool/io/Mutator.java
Mutator.superSetOf
public static Schema superSetOf(Schema schema, Field... newFields) { return superSetOf("superSetSchema" + (COUNTER++), schema, newFields); }
java
public static Schema superSetOf(Schema schema, Field... newFields) { return superSetOf("superSetSchema" + (COUNTER++), schema, newFields); }
[ "public", "static", "Schema", "superSetOf", "(", "Schema", "schema", ",", "Field", "...", "newFields", ")", "{", "return", "superSetOf", "(", "\"superSetSchema\"", "+", "(", "COUNTER", "++", ")", ",", "schema", ",", "newFields", ")", ";", "}" ]
Creates a superset of the input Schema, taking all the Fields in the input schema and adding some new ones. The new fields are fully specified in a Field class. The name of the schema is auto-generated with a static counter.
[ "Creates", "a", "superset", "of", "the", "input", "Schema", "taking", "all", "the", "Fields", "in", "the", "input", "schema", "and", "adding", "some", "new", "ones", ".", "The", "new", "fields", "are", "fully", "specified", "in", "a", "Field", "class", "...
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L73-L75
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java
TypeExtractionUtils.sameTypeVars
public static boolean sameTypeVars(Type t1, Type t2) { return t1 instanceof TypeVariable && t2 instanceof TypeVariable && ((TypeVariable<?>) t1).getName().equals(((TypeVariable<?>) t2).getName()) && ((TypeVariable<?>) t1).getGenericDeclaration().equals(((TypeVariable<?>) t2).getGenericDeclaration()); }
java
public static boolean sameTypeVars(Type t1, Type t2) { return t1 instanceof TypeVariable && t2 instanceof TypeVariable && ((TypeVariable<?>) t1).getName().equals(((TypeVariable<?>) t2).getName()) && ((TypeVariable<?>) t1).getGenericDeclaration().equals(((TypeVariable<?>) t2).getGenericDeclaration()); }
[ "public", "static", "boolean", "sameTypeVars", "(", "Type", "t1", ",", "Type", "t2", ")", "{", "return", "t1", "instanceof", "TypeVariable", "&&", "t2", "instanceof", "TypeVariable", "&&", "(", "(", "TypeVariable", "<", "?", ">", ")", "t1", ")", ".", "ge...
Checks whether two types are type variables describing the same.
[ "Checks", "whether", "two", "types", "are", "type", "variables", "describing", "the", "same", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L280-L285
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/element/position/Positions.java
Positions.rightOf
public static <T extends IPositioned & ISized> IntSupplier rightOf(T other, int spacing) { checkNotNull(other); return () -> { return other.position().x() + other.size().width() + spacing; }; }
java
public static <T extends IPositioned & ISized> IntSupplier rightOf(T other, int spacing) { checkNotNull(other); return () -> { return other.position().x() + other.size().width() + spacing; }; }
[ "public", "static", "<", "T", "extends", "IPositioned", "&", "ISized", ">", "IntSupplier", "rightOf", "(", "T", "other", ",", "int", "spacing", ")", "{", "checkNotNull", "(", "other", ")", ";", "return", "(", ")", "->", "{", "return", "other", ".", "po...
Positions the owner to the right of the other. @param <T> the generic type @param other the other @param spacing the spacing @return the int supplier
[ "Positions", "the", "owner", "to", "the", "right", "of", "the", "other", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L177-L183
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.deleteIteration
public void deleteIteration(UUID projectId, UUID iterationId) { deleteIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); }
java
public void deleteIteration(UUID projectId, UUID iterationId) { deleteIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); }
[ "public", "void", "deleteIteration", "(", "UUID", "projectId", ",", "UUID", "iterationId", ")", "{", "deleteIterationWithServiceResponseAsync", "(", "projectId", ",", "iterationId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", "...
Delete a specific iteration of a project. @param projectId The project id @param iterationId The iteration id @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
[ "Delete", "a", "specific", "iteration", "of", "a", "project", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1881-L1883
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.failoverPriorityChangeAsync
public Observable<Void> failoverPriorityChangeAsync(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) { return failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> failoverPriorityChangeAsync(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) { return failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "failoverPriorityChangeAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "List", "<", "FailoverPolicy", ">", "failoverPolicies", ")", "{", "return", "failoverPriorityChangeWithServiceResponseAsync", "(...
Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param failoverPolicies List of failover policies. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Changes", "the", "failover", "priority", "for", "the", "Azure", "Cosmos", "DB", "database", "account", ".", "A", "failover", "priority", "of", "0", "indicates", "a", "write", "region", ".", "The", "maximum", "value", "for", "a", "failover", "priority", "=",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L796-L803
joelittlejohn/jsonschema2pojo
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PrimitiveTypes.java
PrimitiveTypes.primitiveType
public static JPrimitiveType primitiveType(String name, JCodeModel owner) { try { return (JPrimitiveType) owner.parseType(name); } catch (ClassNotFoundException e) { throw new GenerationException( "Given name does not refer to a primitive type, this type can't be found: " + name, e); } }
java
public static JPrimitiveType primitiveType(String name, JCodeModel owner) { try { return (JPrimitiveType) owner.parseType(name); } catch (ClassNotFoundException e) { throw new GenerationException( "Given name does not refer to a primitive type, this type can't be found: " + name, e); } }
[ "public", "static", "JPrimitiveType", "primitiveType", "(", "String", "name", ",", "JCodeModel", "owner", ")", "{", "try", "{", "return", "(", "JPrimitiveType", ")", "owner", ".", "parseType", "(", "name", ")", ";", "}", "catch", "(", "ClassNotFoundException",...
Create a primitive type reference (for code generation) using the given primitive type name. @param name the name of a primitive Java type @param owner the current code model for type generation @return a type reference created by the given owner
[ "Create", "a", "primitive", "type", "reference", "(", "for", "code", "generation", ")", "using", "the", "given", "primitive", "type", "name", "." ]
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/PrimitiveTypes.java#L61-L69
jenkinsci/jenkins
core/src/main/java/hudson/model/Descriptor.java
Descriptor.getPropertyType
public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) { // in global.jelly, instance==descriptor return instance==this ? getGlobalPropertyType(field) : getPropertyType(field); }
java
public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) { // in global.jelly, instance==descriptor return instance==this ? getGlobalPropertyType(field) : getPropertyType(field); }
[ "public", "@", "CheckForNull", "PropertyType", "getPropertyType", "(", "@", "Nonnull", "Object", "instance", ",", "@", "Nonnull", "String", "field", ")", "{", "// in global.jelly, instance==descriptor", "return", "instance", "==", "this", "?", "getGlobalPropertyType", ...
Used by Jelly to abstract away the handling of global.jelly vs config.jelly databinding difference.
[ "Used", "by", "Jelly", "to", "abstract", "away", "the", "handling", "of", "global", ".", "jelly", "vs", "config", ".", "jelly", "databinding", "difference", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L466-L469
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.getCount
public long getCount(DBObject query, DBObject fields, long limit, long skip) throws MongoException { return dbCollection.getCount(serializeFields(query), fields, limit, skip); }
java
public long getCount(DBObject query, DBObject fields, long limit, long skip) throws MongoException { return dbCollection.getCount(serializeFields(query), fields, limit, skip); }
[ "public", "long", "getCount", "(", "DBObject", "query", ",", "DBObject", "fields", ",", "long", "limit", ",", "long", "skip", ")", "throws", "MongoException", "{", "return", "dbCollection", ".", "getCount", "(", "serializeFields", "(", "query", ")", ",", "fi...
Returns the number of documents in the collection that match the specified query @param query query to select documents to count @param fields fields to return @param limit limit the count to this value @param skip number of entries to skip @return number of documents that match query and fields @throws MongoException If an error occurred
[ "Returns", "the", "number", "of", "documents", "in", "the", "collection", "that", "match", "the", "specified", "query" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L1135-L1137
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/UsersApi.java
UsersApi.getSignatureImage
public byte[] getSignatureImage(String accountId, String userId, String signatureId, String imageType) throws ApiException { return getSignatureImage(accountId, userId, signatureId, imageType, null); }
java
public byte[] getSignatureImage(String accountId, String userId, String signatureId, String imageType) throws ApiException { return getSignatureImage(accountId, userId, signatureId, imageType, null); }
[ "public", "byte", "[", "]", "getSignatureImage", "(", "String", "accountId", ",", "String", "userId", ",", "String", "signatureId", ",", "String", "imageType", ")", "throws", "ApiException", "{", "return", "getSignatureImage", "(", "accountId", ",", "userId", ",...
Retrieves the user initials image or the user signature image for the specified user. Retrieves the specified initials image or signature image for the specified user. The image is returned in the same format as uploaded. In the request you can specify if the chrome (the added line and identifier around the initial image) is returned with the image. The userId property specified in the endpoint must match the authenticated user&#39;s user ID and the user must be a member of the account. The &#x60;signatureId&#x60; parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (&#x60;signatureId&#x60;), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. For example encode \&quot;Bob Smith\&quot; as \&quot;Bob%20Smith\&quot;. ###### Note: Older envelopes might only have chromed images. If getting the non-chromed image fails, try getting the chromed image. @param accountId The external account number (int) or account ID Guid. (required) @param userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. (required) @param signatureId The ID of the signature being accessed. (required) @param imageType One of **signature_image** or **initials_image**. (required) @return byte[]
[ "Retrieves", "the", "user", "initials", "image", "or", "the", "user", "signature", "image", "for", "the", "specified", "user", ".", "Retrieves", "the", "specified", "initials", "image", "or", "signature", "image", "for", "the", "specified", "user", ".", "The",...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/UsersApi.java#L941-L943
Azure/azure-sdk-for-java
postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java
VirtualNetworkRulesInner.createOrUpdate
public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().last().body(); }
java
public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).toBlocking().last().body(); }
[ "public", "VirtualNetworkRuleInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "virtualNetworkRuleName", ",", "VirtualNetworkRuleInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "r...
Creates or updates an existing virtual network rule. @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 virtualNetworkRuleName The name of the virtual network rule. @param parameters The requested virtual Network Rule Resource state. @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 VirtualNetworkRuleInner object if successful.
[ "Creates", "or", "updates", "an", "existing", "virtual", "network", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/VirtualNetworkRulesInner.java#L199-L201
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Util.java
Util.cleanSubOptions
public static String cleanSubOptions(String optionPrefix, Set<String> allowedSubOptions, String s) { StringBuilder sb = new StringBuilder(); if (!s.startsWith(optionPrefix)) return ""; StringTokenizer st = new StringTokenizer(s.substring(optionPrefix.length()), ","); while (st.hasMoreTokens()) { String o = st.nextToken(); int p = o.indexOf('='); if (p>0) { String key = o.substring(0,p); String val = o.substring(p+1); if (allowedSubOptions.contains(key)) { if (sb.length() > 0) sb.append(','); sb.append(key+"="+val); } } } return sb.toString(); }
java
public static String cleanSubOptions(String optionPrefix, Set<String> allowedSubOptions, String s) { StringBuilder sb = new StringBuilder(); if (!s.startsWith(optionPrefix)) return ""; StringTokenizer st = new StringTokenizer(s.substring(optionPrefix.length()), ","); while (st.hasMoreTokens()) { String o = st.nextToken(); int p = o.indexOf('='); if (p>0) { String key = o.substring(0,p); String val = o.substring(p+1); if (allowedSubOptions.contains(key)) { if (sb.length() > 0) sb.append(','); sb.append(key+"="+val); } } } return sb.toString(); }
[ "public", "static", "String", "cleanSubOptions", "(", "String", "optionPrefix", ",", "Set", "<", "String", ">", "allowedSubOptions", ",", "String", "s", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "!", "s", ".", ...
Clean out unwanted sub options supplied inside a primary option. For example to only had portfile remaining from: settings="--server:id=foo,portfile=bar" do settings = cleanOptions("--server:",Util.set("-portfile"),settings); now settings equals "--server:portfile=bar" @param optionPrefix The option name, including colon, eg --server: @param allowsSubOptions A set of the allowed sub options, id portfile etc. @param s The option settings string.
[ "Clean", "out", "unwanted", "sub", "options", "supplied", "inside", "a", "primary", "option", ".", "For", "example", "to", "only", "had", "portfile", "remaining", "from", ":", "settings", "=", "--", "server", ":", "id", "=", "foo", "portfile", "=", "bar", ...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Util.java#L101-L118
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java
SSLUtils.createSSLServerSocketFactory
public static ServerSocketFactory createSSLServerSocketFactory(Configuration config) throws Exception { SSLContext sslContext = createInternalSSLContext(config); if (sslContext == null) { throw new IllegalConfigurationException("SSL is not enabled"); } String[] protocols = getEnabledProtocols(config); String[] cipherSuites = getEnabledCipherSuites(config); SSLServerSocketFactory factory = sslContext.getServerSocketFactory(); return new ConfiguringSSLServerSocketFactory(factory, protocols, cipherSuites); }
java
public static ServerSocketFactory createSSLServerSocketFactory(Configuration config) throws Exception { SSLContext sslContext = createInternalSSLContext(config); if (sslContext == null) { throw new IllegalConfigurationException("SSL is not enabled"); } String[] protocols = getEnabledProtocols(config); String[] cipherSuites = getEnabledCipherSuites(config); SSLServerSocketFactory factory = sslContext.getServerSocketFactory(); return new ConfiguringSSLServerSocketFactory(factory, protocols, cipherSuites); }
[ "public", "static", "ServerSocketFactory", "createSSLServerSocketFactory", "(", "Configuration", "config", ")", "throws", "Exception", "{", "SSLContext", "sslContext", "=", "createInternalSSLContext", "(", "config", ")", ";", "if", "(", "sslContext", "==", "null", ")"...
Creates a factory for SSL Server Sockets from the given configuration. SSL Server Sockets are always part of internal communication.
[ "Creates", "a", "factory", "for", "SSL", "Server", "Sockets", "from", "the", "given", "configuration", ".", "SSL", "Server", "Sockets", "are", "always", "part", "of", "internal", "communication", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L84-L95
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/struct/image/GrayF32.java
GrayF32.get
public float get(int x, int y) { if (!isInBounds(x, y)) throw new ImageAccessException("Requested pixel is out of bounds: ( " + x + " , " + y + " )"); return unsafe_get(x,y); }
java
public float get(int x, int y) { if (!isInBounds(x, y)) throw new ImageAccessException("Requested pixel is out of bounds: ( " + x + " , " + y + " )"); return unsafe_get(x,y); }
[ "public", "float", "get", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "!", "isInBounds", "(", "x", ",", "y", ")", ")", "throw", "new", "ImageAccessException", "(", "\"Requested pixel is out of bounds: ( \"", "+", "x", "+", "\" , \"", "+", "y",...
Returns the value of the specified pixel. @param x pixel coordinate. @param y pixel coordinate. @return Pixel intensity value.
[ "Returns", "the", "value", "of", "the", "specified", "pixel", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/image/GrayF32.java#L55-L60
lamydev/Android-Notification
core/src/zemin/notification/NotificationEntry.java
NotificationEntry.addAction
public void addAction(int icon, CharSequence title, Action.OnActionListener listener) { addAction(icon, title, listener, null, null, null, null); }
java
public void addAction(int icon, CharSequence title, Action.OnActionListener listener) { addAction(icon, title, listener, null, null, null, null); }
[ "public", "void", "addAction", "(", "int", "icon", ",", "CharSequence", "title", ",", "Action", ".", "OnActionListener", "listener", ")", "{", "addAction", "(", "icon", ",", "title", ",", "listener", ",", "null", ",", "null", ",", "null", ",", "null", ")...
Add a action to this notification. Actions are typically displayed as a button adjacent to the notification content. @see android.app.Notification#addAction @param icon @param title @param listener
[ "Add", "a", "action", "to", "this", "notification", ".", "Actions", "are", "typically", "displayed", "as", "a", "button", "adjacent", "to", "the", "notification", "content", "." ]
train
https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationEntry.java#L524-L526
atomix/atomix
protocols/raft/src/main/java/io/atomix/protocols/raft/storage/snapshot/SnapshotStore.java
SnapshotStore.loadSnapshots
private Collection<Snapshot> loadSnapshots() { // Ensure log directories are created. storage.directory().mkdirs(); List<Snapshot> snapshots = new ArrayList<>(); // Iterate through all files in the log directory. for (File file : storage.directory().listFiles(File::isFile)) { // If the file looks like a segment file, attempt to load the segment. if (SnapshotFile.isSnapshotFile(file)) { SnapshotFile snapshotFile = new SnapshotFile(file); SnapshotDescriptor descriptor = new SnapshotDescriptor(FileBuffer.allocate(file, SnapshotDescriptor.BYTES)); // Valid segments will have been locked. Segments that resulting from failures during log cleaning will be // unlocked and should ultimately be deleted from disk. if (descriptor.isLocked()) { log.debug("Loaded disk snapshot: {} ({})", descriptor.index(), snapshotFile.file().getName()); snapshots.add(new FileSnapshot(snapshotFile, descriptor, this)); descriptor.close(); } // If the segment descriptor wasn't locked, close and delete the descriptor. else { log.debug("Deleting partial snapshot: {} ({})", descriptor.index(), snapshotFile.file().getName()); descriptor.close(); descriptor.delete(); } } } return snapshots; }
java
private Collection<Snapshot> loadSnapshots() { // Ensure log directories are created. storage.directory().mkdirs(); List<Snapshot> snapshots = new ArrayList<>(); // Iterate through all files in the log directory. for (File file : storage.directory().listFiles(File::isFile)) { // If the file looks like a segment file, attempt to load the segment. if (SnapshotFile.isSnapshotFile(file)) { SnapshotFile snapshotFile = new SnapshotFile(file); SnapshotDescriptor descriptor = new SnapshotDescriptor(FileBuffer.allocate(file, SnapshotDescriptor.BYTES)); // Valid segments will have been locked. Segments that resulting from failures during log cleaning will be // unlocked and should ultimately be deleted from disk. if (descriptor.isLocked()) { log.debug("Loaded disk snapshot: {} ({})", descriptor.index(), snapshotFile.file().getName()); snapshots.add(new FileSnapshot(snapshotFile, descriptor, this)); descriptor.close(); } // If the segment descriptor wasn't locked, close and delete the descriptor. else { log.debug("Deleting partial snapshot: {} ({})", descriptor.index(), snapshotFile.file().getName()); descriptor.close(); descriptor.delete(); } } } return snapshots; }
[ "private", "Collection", "<", "Snapshot", ">", "loadSnapshots", "(", ")", "{", "// Ensure log directories are created.", "storage", ".", "directory", "(", ")", ".", "mkdirs", "(", ")", ";", "List", "<", "Snapshot", ">", "snapshots", "=", "new", "ArrayList", "<...
Loads all available snapshots from disk. @return A list of available snapshots.
[ "Loads", "all", "available", "snapshots", "from", "disk", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/storage/snapshot/SnapshotStore.java#L116-L147
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java
GeomajasServiceImpl.registerMap
public void registerMap(String applicationId, String mapId, Map map) { HashMap<String, Map> mapMap; if (maps.containsKey(applicationId)) { mapMap = maps.get(applicationId); if (!mapMap.containsKey(mapId)) { mapMap.put(mapId, map); } } else { mapMap = new HashMap<String, Map>(); mapMap.put(mapId, map); maps.put(applicationId, mapMap); } }
java
public void registerMap(String applicationId, String mapId, Map map) { HashMap<String, Map> mapMap; if (maps.containsKey(applicationId)) { mapMap = maps.get(applicationId); if (!mapMap.containsKey(mapId)) { mapMap.put(mapId, map); } } else { mapMap = new HashMap<String, Map>(); mapMap.put(mapId, map); maps.put(applicationId, mapMap); } }
[ "public", "void", "registerMap", "(", "String", "applicationId", ",", "String", "mapId", ",", "Map", "map", ")", "{", "HashMap", "<", "String", ",", "Map", ">", "mapMap", ";", "if", "(", "maps", ".", "containsKey", "(", "applicationId", ")", ")", "{", ...
Register the given {@link Map} with applicationId and mapId. @param applicationId the application id. @param mapId the map id. @param map the map to register.
[ "Register", "the", "given", "{", "@link", "Map", "}", "with", "applicationId", "and", "mapId", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java#L121-L133
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/MySQLCleaningScipts.java
MySQLCleaningScipts.filter
private Collection<String> filter(Collection<String> scripts) { String JCR_ITEM_PRIMARY_KEY = "CONSTRAINT JCR_PK_" + itemTableSuffix + " PRIMARY KEY(ID)"; String JCR_ITEM_FOREIGN_KEY = "CONSTRAINT JCR_FK_" + itemTableSuffix + "_PARENT FOREIGN KEY(PARENT_ID) REFERENCES " + itemTableName + "(ID)"; String JCR_VALUE_PRIMARY_KEY = "CONSTRAINT JCR_PK_" + valueTableSuffix + " PRIMARY KEY(ID)"; String JCR_VALUE_FOREIGN_KEY = "CONSTRAINT JCR_FK_" + valueTableSuffix + "_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES " + itemTableName + "(ID)"; Collection<String> filteredScripts = new ArrayList<String>(); for (String script : scripts) { if (script.contains(JCR_ITEM_PRIMARY_KEY + ",")) { script = script.replace(JCR_ITEM_PRIMARY_KEY + ",", JCR_ITEM_PRIMARY_KEY); script = script.replace(JCR_ITEM_FOREIGN_KEY, ""); } else if (script.contains(JCR_VALUE_PRIMARY_KEY + ",")) { script = script.replace(JCR_VALUE_PRIMARY_KEY + ",", JCR_VALUE_PRIMARY_KEY); script = script.replace(JCR_VALUE_FOREIGN_KEY, ""); } filteredScripts.add(script); } return filteredScripts; }
java
private Collection<String> filter(Collection<String> scripts) { String JCR_ITEM_PRIMARY_KEY = "CONSTRAINT JCR_PK_" + itemTableSuffix + " PRIMARY KEY(ID)"; String JCR_ITEM_FOREIGN_KEY = "CONSTRAINT JCR_FK_" + itemTableSuffix + "_PARENT FOREIGN KEY(PARENT_ID) REFERENCES " + itemTableName + "(ID)"; String JCR_VALUE_PRIMARY_KEY = "CONSTRAINT JCR_PK_" + valueTableSuffix + " PRIMARY KEY(ID)"; String JCR_VALUE_FOREIGN_KEY = "CONSTRAINT JCR_FK_" + valueTableSuffix + "_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES " + itemTableName + "(ID)"; Collection<String> filteredScripts = new ArrayList<String>(); for (String script : scripts) { if (script.contains(JCR_ITEM_PRIMARY_KEY + ",")) { script = script.replace(JCR_ITEM_PRIMARY_KEY + ",", JCR_ITEM_PRIMARY_KEY); script = script.replace(JCR_ITEM_FOREIGN_KEY, ""); } else if (script.contains(JCR_VALUE_PRIMARY_KEY + ",")) { script = script.replace(JCR_VALUE_PRIMARY_KEY + ",", JCR_VALUE_PRIMARY_KEY); script = script.replace(JCR_VALUE_FOREIGN_KEY, ""); } filteredScripts.add(script); } return filteredScripts; }
[ "private", "Collection", "<", "String", ">", "filter", "(", "Collection", "<", "String", ">", "scripts", ")", "{", "String", "JCR_ITEM_PRIMARY_KEY", "=", "\"CONSTRAINT JCR_PK_\"", "+", "itemTableSuffix", "+", "\" PRIMARY KEY(ID)\"", ";", "String", "JCR_ITEM_FOREIGN_KE...
Removing foreign key creation from initialization scripts for table JCR_S(M)ITEM and JCR_S(M)VALUE. It is not possible to create table with such foreign key if the same key exists in another table of database
[ "Removing", "foreign", "key", "creation", "from", "initialization", "scripts", "for", "table", "JCR_S", "(", "M", ")", "ITEM", "and", "JCR_S", "(", "M", ")", "VALUE", ".", "It", "is", "not", "possible", "to", "create", "table", "with", "such", "foreign", ...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/scripts/MySQLCleaningScipts.java#L108-L138
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/deployer/BpmnDeployer.java
BpmnDeployer.adjustStartEventSubscriptions
protected void adjustStartEventSubscriptions(ProcessDefinitionEntity newLatestProcessDefinition, ProcessDefinitionEntity oldLatestProcessDefinition) { removeObsoleteTimers(newLatestProcessDefinition); addTimerDeclarations(newLatestProcessDefinition); removeObsoleteEventSubscriptions(newLatestProcessDefinition, oldLatestProcessDefinition); addEventSubscriptions(newLatestProcessDefinition); }
java
protected void adjustStartEventSubscriptions(ProcessDefinitionEntity newLatestProcessDefinition, ProcessDefinitionEntity oldLatestProcessDefinition) { removeObsoleteTimers(newLatestProcessDefinition); addTimerDeclarations(newLatestProcessDefinition); removeObsoleteEventSubscriptions(newLatestProcessDefinition, oldLatestProcessDefinition); addEventSubscriptions(newLatestProcessDefinition); }
[ "protected", "void", "adjustStartEventSubscriptions", "(", "ProcessDefinitionEntity", "newLatestProcessDefinition", ",", "ProcessDefinitionEntity", "oldLatestProcessDefinition", ")", "{", "removeObsoleteTimers", "(", "newLatestProcessDefinition", ")", ";", "addTimerDeclarations", "...
adjust all event subscriptions responsible to start process instances (timer start event, message start event). The default behavior is to remove the old subscriptions and add new ones for the new deployed process definitions.
[ "adjust", "all", "event", "subscriptions", "responsible", "to", "start", "process", "instances", "(", "timer", "start", "event", "message", "start", "event", ")", ".", "The", "default", "behavior", "is", "to", "remove", "the", "old", "subscriptions", "and", "a...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/deployer/BpmnDeployer.java#L225-L231
vincentk/joptimizer
src/main/java/com/joptimizer/optimizers/LPPrimalDualMethod.java
LPPrimalDualMethod.optimize
@Override public int optimize() throws Exception { log.info("optimize"); LPOptimizationRequest lpRequest = getLPOptimizationRequest(); if(log.isDebugEnabled() && lpRequest.isDumpProblem()){ log.debug("LP problem: " + lpRequest.toString()); } //standard form conversion LPStandardConverter lpConverter = new LPStandardConverter();//the slack variables will have default unboundedUBValue lpConverter.toStandardForm(getC(), getG(), getH(), getA(), getB(), getLb(), getUb()); int nOfSlackVariables = lpConverter.getStandardS(); log.debug("nOfSlackVariables: " + nOfSlackVariables); DoubleMatrix1D standardC = lpConverter.getStandardC(); DoubleMatrix2D standardA = lpConverter.getStandardA(); DoubleMatrix1D standardB = lpConverter.getStandardB(); DoubleMatrix1D standardLb = lpConverter.getStandardLB(); DoubleMatrix1D standardUb = lpConverter.getStandardUB(); //solve the standard form problem LPOptimizationRequest standardLPRequest = lpRequest.cloneMe(); standardLPRequest.setC(standardC); standardLPRequest.setA(standardA); standardLPRequest.setB(standardB); standardLPRequest.setLb(ColtUtils.replaceValues(standardLb, lpConverter.getUnboundedLBValue(), minLBValue));//substitute not-double numbers standardLPRequest.setUb(ColtUtils.replaceValues(standardUb, lpConverter.getUnboundedUBValue(), maxUBValue));//substitute not-double numbers if(getInitialPoint()!=null){ standardLPRequest.setInitialPoint(lpConverter.getStandardComponents(getInitialPoint().toArray())); } if(getNotFeasibleInitialPoint()!=null){ standardLPRequest.setNotFeasibleInitialPoint(lpConverter.getStandardComponents(getNotFeasibleInitialPoint().toArray())); } //optimization LPPrimalDualMethod opt = new LPPrimalDualMethod(minLBValue, maxUBValue); opt.setLPOptimizationRequest(standardLPRequest); if(opt.optimizeStandardLP(nOfSlackVariables) == OptimizationResponse.FAILED){ return OptimizationResponse.FAILED; } //back to original form LPOptimizationResponse lpResponse = opt.getLPOptimizationResponse(); double[] standardSolution = lpResponse.getSolution(); double[] originalSol = lpConverter.postConvert(standardSolution); lpResponse.setSolution(originalSol); setLPOptimizationResponse(lpResponse); return lpResponse.getReturnCode(); }
java
@Override public int optimize() throws Exception { log.info("optimize"); LPOptimizationRequest lpRequest = getLPOptimizationRequest(); if(log.isDebugEnabled() && lpRequest.isDumpProblem()){ log.debug("LP problem: " + lpRequest.toString()); } //standard form conversion LPStandardConverter lpConverter = new LPStandardConverter();//the slack variables will have default unboundedUBValue lpConverter.toStandardForm(getC(), getG(), getH(), getA(), getB(), getLb(), getUb()); int nOfSlackVariables = lpConverter.getStandardS(); log.debug("nOfSlackVariables: " + nOfSlackVariables); DoubleMatrix1D standardC = lpConverter.getStandardC(); DoubleMatrix2D standardA = lpConverter.getStandardA(); DoubleMatrix1D standardB = lpConverter.getStandardB(); DoubleMatrix1D standardLb = lpConverter.getStandardLB(); DoubleMatrix1D standardUb = lpConverter.getStandardUB(); //solve the standard form problem LPOptimizationRequest standardLPRequest = lpRequest.cloneMe(); standardLPRequest.setC(standardC); standardLPRequest.setA(standardA); standardLPRequest.setB(standardB); standardLPRequest.setLb(ColtUtils.replaceValues(standardLb, lpConverter.getUnboundedLBValue(), minLBValue));//substitute not-double numbers standardLPRequest.setUb(ColtUtils.replaceValues(standardUb, lpConverter.getUnboundedUBValue(), maxUBValue));//substitute not-double numbers if(getInitialPoint()!=null){ standardLPRequest.setInitialPoint(lpConverter.getStandardComponents(getInitialPoint().toArray())); } if(getNotFeasibleInitialPoint()!=null){ standardLPRequest.setNotFeasibleInitialPoint(lpConverter.getStandardComponents(getNotFeasibleInitialPoint().toArray())); } //optimization LPPrimalDualMethod opt = new LPPrimalDualMethod(minLBValue, maxUBValue); opt.setLPOptimizationRequest(standardLPRequest); if(opt.optimizeStandardLP(nOfSlackVariables) == OptimizationResponse.FAILED){ return OptimizationResponse.FAILED; } //back to original form LPOptimizationResponse lpResponse = opt.getLPOptimizationResponse(); double[] standardSolution = lpResponse.getSolution(); double[] originalSol = lpConverter.postConvert(standardSolution); lpResponse.setSolution(originalSol); setLPOptimizationResponse(lpResponse); return lpResponse.getReturnCode(); }
[ "@", "Override", "public", "int", "optimize", "(", ")", "throws", "Exception", "{", "log", ".", "info", "(", "\"optimize\"", ")", ";", "LPOptimizationRequest", "lpRequest", "=", "getLPOptimizationRequest", "(", ")", ";", "if", "(", "log", ".", "isDebugEnabled"...
Solves an LP in the form of: min(c) s.t. A.x = b G.x < h lb <= x <= ub
[ "Solves", "an", "LP", "in", "the", "form", "of", ":", "min", "(", "c", ")", "s", ".", "t", ".", "A", ".", "x", "=", "b", "G", ".", "x", "<", "h", "lb", "<", "=", "x", "<", "=", "ub" ]
train
https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/optimizers/LPPrimalDualMethod.java#L111-L160
box/box-java-sdk
src/main/java/com/box/sdk/BoxRetentionPolicyAssignment.java
BoxRetentionPolicyAssignment.createAssignment
private static BoxRetentionPolicyAssignment.Info createAssignment(BoxAPIConnection api, String policyID, JsonObject assignTo, JsonArray filter) { URL url = ASSIGNMENTS_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); JsonObject requestJSON = new JsonObject() .add("policy_id", policyID) .add("assign_to", assignTo); if (filter != null) { requestJSON.add("filter_fields", filter); } request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxRetentionPolicyAssignment createdAssignment = new BoxRetentionPolicyAssignment(api, responseJSON.get("id").asString()); return createdAssignment.new Info(responseJSON); }
java
private static BoxRetentionPolicyAssignment.Info createAssignment(BoxAPIConnection api, String policyID, JsonObject assignTo, JsonArray filter) { URL url = ASSIGNMENTS_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); JsonObject requestJSON = new JsonObject() .add("policy_id", policyID) .add("assign_to", assignTo); if (filter != null) { requestJSON.add("filter_fields", filter); } request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxRetentionPolicyAssignment createdAssignment = new BoxRetentionPolicyAssignment(api, responseJSON.get("id").asString()); return createdAssignment.new Info(responseJSON); }
[ "private", "static", "BoxRetentionPolicyAssignment", ".", "Info", "createAssignment", "(", "BoxAPIConnection", "api", ",", "String", "policyID", ",", "JsonObject", "assignTo", ",", "JsonArray", "filter", ")", "{", "URL", "url", "=", "ASSIGNMENTS_URL_TEMPLATE", ".", ...
Assigns retention policy with givenID to folder or enterprise. @param api the API connection to be used by the created assignment. @param policyID id of the assigned retention policy. @param assignTo object representing folder or enterprise to assign policy to. @return info about created assignment.
[ "Assigns", "retention", "policy", "with", "givenID", "to", "folder", "or", "enterprise", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicyAssignment.java#L112-L131
alkacon/opencms-core
src/org/opencms/gwt/shared/CmsListInfoBean.java
CmsListInfoBean.addAdditionalInfo
public void addAdditionalInfo(String name, String value, String style) { getAdditionalInfo().add(new CmsAdditionalInfoBean(name, value, style)); }
java
public void addAdditionalInfo(String name, String value, String style) { getAdditionalInfo().add(new CmsAdditionalInfoBean(name, value, style)); }
[ "public", "void", "addAdditionalInfo", "(", "String", "name", ",", "String", "value", ",", "String", "style", ")", "{", "getAdditionalInfo", "(", ")", ".", "add", "(", "new", "CmsAdditionalInfoBean", "(", "name", ",", "value", ",", "style", ")", ")", ";", ...
Sets a new additional info.<p> @param name the additional info name @param value the additional info value @param style the CSS style to apply to the info
[ "Sets", "a", "new", "additional", "info", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/shared/CmsListInfoBean.java#L147-L150
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcCallableStatement.java
WSJdbcCallableStatement.getCursor
private Object getCursor(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(tc, "getCursor", this, args[0]); ResultSet rsetImpl = (ResultSet) method.invoke(implObject, args); WSJdbcResultSet rsetWrapper = rsetImpl == null ? null : createWrapper(rsetImpl); if (trace && tc.isEntryEnabled()) Tr.exit(tc, "getCursor", rsetWrapper); return rsetWrapper; }
java
private Object getCursor(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(tc, "getCursor", this, args[0]); ResultSet rsetImpl = (ResultSet) method.invoke(implObject, args); WSJdbcResultSet rsetWrapper = rsetImpl == null ? null : createWrapper(rsetImpl); if (trace && tc.isEntryEnabled()) Tr.exit(tc, "getCursor", rsetWrapper); return rsetWrapper; }
[ "private", "Object", "getCursor", "(", "Object", "implObject", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", ",", "SQLException", "{", "final", "b...
Invokes getCursor and wraps the result set. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method.
[ "Invokes", "getCursor", "and", "wraps", "the", "result", "set", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcCallableStatement.java#L290-L303
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java
JQLBuilder.forEachFields
private static void forEachFields(SQLiteModelMethod method, OnPropertyListener listener) { for (SQLProperty item : method.getEntity().getCollection()) { listener.onProperty(item); } }
java
private static void forEachFields(SQLiteModelMethod method, OnPropertyListener listener) { for (SQLProperty item : method.getEntity().getCollection()) { listener.onProperty(item); } }
[ "private", "static", "void", "forEachFields", "(", "SQLiteModelMethod", "method", ",", "OnPropertyListener", "listener", ")", "{", "for", "(", "SQLProperty", "item", ":", "method", ".", "getEntity", "(", ")", ".", "getCollection", "(", ")", ")", "{", "listener...
For each fields. @param dao the dao @param listener the listener
[ "For", "each", "fields", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java#L1092-L1096
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/simple/SimpleMatrix.java
SimpleMatrix.random_DDRM
public static SimpleMatrix random_DDRM(int numRows, int numCols, double minValue, double maxValue, Random rand) { SimpleMatrix ret = new SimpleMatrix(numRows,numCols); RandomMatrices_DDRM.fillUniform((DMatrixRMaj)ret.mat,minValue,maxValue,rand); return ret; }
java
public static SimpleMatrix random_DDRM(int numRows, int numCols, double minValue, double maxValue, Random rand) { SimpleMatrix ret = new SimpleMatrix(numRows,numCols); RandomMatrices_DDRM.fillUniform((DMatrixRMaj)ret.mat,minValue,maxValue,rand); return ret; }
[ "public", "static", "SimpleMatrix", "random_DDRM", "(", "int", "numRows", ",", "int", "numCols", ",", "double", "minValue", ",", "double", "maxValue", ",", "Random", "rand", ")", "{", "SimpleMatrix", "ret", "=", "new", "SimpleMatrix", "(", "numRows", ",", "n...
<p> Creates a new SimpleMatrix with random elements drawn from a uniform distribution from minValue to maxValue. </p> @see RandomMatrices_DDRM#fillUniform(DMatrixRMaj,java.util.Random) @param numRows The number of rows in the new matrix @param numCols The number of columns in the new matrix @param minValue Lower bound @param maxValue Upper bound @param rand The random number generator that's used to fill the matrix. @return The new random matrix.
[ "<p", ">", "Creates", "a", "new", "SimpleMatrix", "with", "random", "elements", "drawn", "from", "a", "uniform", "distribution", "from", "minValue", "to", "maxValue", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleMatrix.java#L290-L294
springfox/springfox
springfox-core/src/main/java/springfox/documentation/builders/BuilderDefaults.java
BuilderDefaults.defaultIfAbsent
public static <T> T defaultIfAbsent(T newValue, T defaultValue) { return ofNullable(newValue) .orElse(ofNullable(defaultValue) .orElse(null)); }
java
public static <T> T defaultIfAbsent(T newValue, T defaultValue) { return ofNullable(newValue) .orElse(ofNullable(defaultValue) .orElse(null)); }
[ "public", "static", "<", "T", ">", "T", "defaultIfAbsent", "(", "T", "newValue", ",", "T", "defaultValue", ")", "{", "return", "ofNullable", "(", "newValue", ")", ".", "orElse", "(", "ofNullable", "(", "defaultValue", ")", ".", "orElse", "(", "null", ")"...
Returns this default value if the new value is null @param newValue - new value @param defaultValue - default value @param <T> - Represents any type that is nullable @return Coalesces the newValue and defaultValue to return a non-null value
[ "Returns", "this", "default", "value", "if", "the", "new", "value", "is", "null" ]
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-core/src/main/java/springfox/documentation/builders/BuilderDefaults.java#L53-L57
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java
JNStorage.getSyncLogTemporaryFile
File getSyncLogTemporaryFile(long segmentTxId, long endTxId, long stamp) { String name = NNStorage.getFinalizedEditsFileName(segmentTxId, endTxId) + ".tmp=" + stamp; return new File(sd.getCurrentDir(), name); }
java
File getSyncLogTemporaryFile(long segmentTxId, long endTxId, long stamp) { String name = NNStorage.getFinalizedEditsFileName(segmentTxId, endTxId) + ".tmp=" + stamp; return new File(sd.getCurrentDir(), name); }
[ "File", "getSyncLogTemporaryFile", "(", "long", "segmentTxId", ",", "long", "endTxId", ",", "long", "stamp", ")", "{", "String", "name", "=", "NNStorage", ".", "getFinalizedEditsFileName", "(", "segmentTxId", ",", "endTxId", ")", "+", "\".tmp=\"", "+", "stamp", ...
Get name for temporary file used for log syncing, after a journal node crashed.
[ "Get", "name", "for", "temporary", "file", "used", "for", "log", "syncing", "after", "a", "journal", "node", "crashed", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java#L145-L149
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/HFClient.java
HFClient.deSerializeChannel
public Channel deSerializeChannel(byte[] channelBytes) throws IOException, ClassNotFoundException, InvalidArgumentException { Channel channel; ObjectInputStream in = null; try { in = new ObjectInputStream(new ByteArrayInputStream(channelBytes)); channel = (Channel) in.readObject(); final String name = channel.getName(); synchronized (channels) { if (null != getChannel(name)) { channel.shutdown(true); throw new InvalidArgumentException(format("Channel %s already exists in the client", name)); } channels.put(name, channel); channel.client = this; } } finally { try { if (in != null) { in.close(); } } catch (IOException e) { // Best effort here. logger.error(e); } } return channel; }
java
public Channel deSerializeChannel(byte[] channelBytes) throws IOException, ClassNotFoundException, InvalidArgumentException { Channel channel; ObjectInputStream in = null; try { in = new ObjectInputStream(new ByteArrayInputStream(channelBytes)); channel = (Channel) in.readObject(); final String name = channel.getName(); synchronized (channels) { if (null != getChannel(name)) { channel.shutdown(true); throw new InvalidArgumentException(format("Channel %s already exists in the client", name)); } channels.put(name, channel); channel.client = this; } } finally { try { if (in != null) { in.close(); } } catch (IOException e) { // Best effort here. logger.error(e); } } return channel; }
[ "public", "Channel", "deSerializeChannel", "(", "byte", "[", "]", "channelBytes", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "InvalidArgumentException", "{", "Channel", "channel", ";", "ObjectInputStream", "in", "=", "null", ";", "try", "{", ...
Deserialize a channel serialized by {@link Channel#serializeChannel()} @param channelBytes bytes to be deserialized. @return A Channel that has not been initialized. @throws IOException @throws ClassNotFoundException @throws InvalidArgumentException
[ "Deserialize", "a", "channel", "serialized", "by", "{", "@link", "Channel#serializeChannel", "()", "}" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/HFClient.java#L319-L350
apache/groovy
subprojects/groovy-json/src/main/java/groovy/json/JsonLexer.java
JsonLexer.skipWhitespace
public int skipWhitespace() { try { int readChar = 20; char c = SPACE; while (Character.isWhitespace(c)) { reader.mark(1); readChar = reader.read(); c = (char) readChar; } reader.reset(); return readChar; } catch (IOException ioe) { throw new JsonException("An IO exception occurred while reading the JSON payload", ioe); } }
java
public int skipWhitespace() { try { int readChar = 20; char c = SPACE; while (Character.isWhitespace(c)) { reader.mark(1); readChar = reader.read(); c = (char) readChar; } reader.reset(); return readChar; } catch (IOException ioe) { throw new JsonException("An IO exception occurred while reading the JSON payload", ioe); } }
[ "public", "int", "skipWhitespace", "(", ")", "{", "try", "{", "int", "readChar", "=", "20", ";", "char", "c", "=", "SPACE", ";", "while", "(", "Character", ".", "isWhitespace", "(", "c", ")", ")", "{", "reader", ".", "mark", "(", "1", ")", ";", "...
Skips all the whitespace characters and moves the cursor to the next non-space character.
[ "Skips", "all", "the", "whitespace", "characters", "and", "moves", "the", "cursor", "to", "the", "next", "non", "-", "space", "character", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-json/src/main/java/groovy/json/JsonLexer.java#L213-L227
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/SearchFilter.java
SearchFilter.matchValue
public void matchValue(String ElementName, String value, int oper) { // Delete the old search filter m_filter = null; // If not NOT_IN, assume IN // (Since ints are passed by value, it is OK to change it) if (oper != NOT_IN) { oper = IN; // Create a String array in which to hold the one name, // and put that name in the array } String[] ValueArray = new String[1]; ValueArray[0] = value; // Create a leaf node for this list and store it as the filter m_filter = new SearchBaseLeaf(ElementName, oper, ValueArray); }
java
public void matchValue(String ElementName, String value, int oper) { // Delete the old search filter m_filter = null; // If not NOT_IN, assume IN // (Since ints are passed by value, it is OK to change it) if (oper != NOT_IN) { oper = IN; // Create a String array in which to hold the one name, // and put that name in the array } String[] ValueArray = new String[1]; ValueArray[0] = value; // Create a leaf node for this list and store it as the filter m_filter = new SearchBaseLeaf(ElementName, oper, ValueArray); }
[ "public", "void", "matchValue", "(", "String", "ElementName", ",", "String", "value", ",", "int", "oper", ")", "{", "// Delete the old search filter\r", "m_filter", "=", "null", ";", "// If not NOT_IN, assume IN\r", "// (Since ints are passed by value, it is OK to change it)\...
Change the search filter to one that specifies an element to not match one single value. The old search filter is deleted. @param ElementName is the name of the element to be matched @param value is the value to not be matched @param oper is the IN or NOT_IN operator to indicate how to matche
[ "Change", "the", "search", "filter", "to", "one", "that", "specifies", "an", "element", "to", "not", "match", "one", "single", "value", ".", "The", "old", "search", "filter", "is", "deleted", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/SearchFilter.java#L146-L162
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java
Ledgers.readLastAddConfirmed
static long readLastAddConfirmed(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException { LedgerHandle h = null; try { // Here we open the Ledger WITH recovery, to force BookKeeper to reconcile any appends that may have been // interrupted and not properly acked. Otherwise there is no guarantee we can get an accurate value for // LastAddConfirmed. h = openFence(ledgerId, bookKeeper, config); return h.getLastAddConfirmed(); } finally { if (h != null) { close(h); } } }
java
static long readLastAddConfirmed(long ledgerId, BookKeeper bookKeeper, BookKeeperConfig config) throws DurableDataLogException { LedgerHandle h = null; try { // Here we open the Ledger WITH recovery, to force BookKeeper to reconcile any appends that may have been // interrupted and not properly acked. Otherwise there is no guarantee we can get an accurate value for // LastAddConfirmed. h = openFence(ledgerId, bookKeeper, config); return h.getLastAddConfirmed(); } finally { if (h != null) { close(h); } } }
[ "static", "long", "readLastAddConfirmed", "(", "long", "ledgerId", ",", "BookKeeper", "bookKeeper", ",", "BookKeeperConfig", "config", ")", "throws", "DurableDataLogException", "{", "LedgerHandle", "h", "=", "null", ";", "try", "{", "// Here we open the Ledger WITH reco...
Reliably retrieves the LastAddConfirmed for the Ledger with given LedgerId, by opening the Ledger in fencing mode and getting the value. NOTE: this open-fences the Ledger which will effectively stop any writing action on it. @param ledgerId The Id of the Ledger to query. @param bookKeeper A references to the BookKeeper client to use. @param config Configuration to use. @return The LastAddConfirmed for the given LedgerId. @throws DurableDataLogException If an exception occurred. The causing exception is wrapped inside it.
[ "Reliably", "retrieves", "the", "LastAddConfirmed", "for", "the", "Ledger", "with", "given", "LedgerId", "by", "opening", "the", "Ledger", "in", "fencing", "mode", "and", "getting", "the", "value", ".", "NOTE", ":", "this", "open", "-", "fences", "the", "Led...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/Ledgers.java#L107-L120
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseLongObj
@Nullable public static Long parseLongObj (@Nullable final String sStr, @Nullable final Long aDefault) { return parseLongObj (sStr, DEFAULT_RADIX, aDefault); }
java
@Nullable public static Long parseLongObj (@Nullable final String sStr, @Nullable final Long aDefault) { return parseLongObj (sStr, DEFAULT_RADIX, aDefault); }
[ "@", "Nullable", "public", "static", "Long", "parseLongObj", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "Long", "aDefault", ")", "{", "return", "parseLongObj", "(", "sStr", ",", "DEFAULT_RADIX", ",", "aDefault", ")", ";",...
Parse the given {@link String} as {@link Long} with radix {@link #DEFAULT_RADIX}. @param sStr The string to parse. May be <code>null</code>. @param aDefault The default value to be returned if the passed string could not be converted to a valid value. May be <code>null</code>. @return <code>aDefault</code> if the string does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "String", "}", "as", "{", "@link", "Long", "}", "with", "radix", "{", "@link", "#DEFAULT_RADIX", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1133-L1137
JosePaumard/streams-utils
src/main/java/org/paumard/streams/StreamsUtils.java
StreamsUtils.filteringMaxKeys
public static <E extends Comparable<? super E>> Stream<E> filteringMaxKeys(Stream<E> stream, int numberOfMaxes) { return filteringMaxKeys(stream, numberOfMaxes, Comparator.naturalOrder()); }
java
public static <E extends Comparable<? super E>> Stream<E> filteringMaxKeys(Stream<E> stream, int numberOfMaxes) { return filteringMaxKeys(stream, numberOfMaxes, Comparator.naturalOrder()); }
[ "public", "static", "<", "E", "extends", "Comparable", "<", "?", "super", "E", ">", ">", "Stream", "<", "E", ">", "filteringMaxKeys", "(", "Stream", "<", "E", ">", "stream", ",", "int", "numberOfMaxes", ")", "{", "return", "filteringMaxKeys", "(", "strea...
<p>Generates a stream composed of the N greatest different values of the provided stream, compared using the natural order. This method calls the <code>filteringMaxKeys()</code> with the natural order comparator, please refer to this javadoc for details. </p> <p>A <code>NullPointerException</code> will be thrown if the provided stream is null. </p> <p>An <code>IllegalArgumentException</code> is thrown if N is lesser than 1. </p> @param stream the processed stream @param numberOfMaxes the number of different max values that should be returned. Note that the total number of values returned may be larger if there are duplicates in the stream @param <E> the type of the provided stream @return the filtered stream
[ "<p", ">", "Generates", "a", "stream", "composed", "of", "the", "N", "greatest", "different", "values", "of", "the", "provided", "stream", "compared", "using", "the", "natural", "order", ".", "This", "method", "calls", "the", "<code", ">", "filteringMaxKeys", ...
train
https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L1056-L1059
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java
AnnotationTypeFieldBuilder.buildAnnotationTypeMember
public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) throws DocletException { if (writer == null) { return; } if (hasMembersToDocument()) { writer.addAnnotationFieldDetailsMarker(memberDetailsTree); Element lastElement = members.get(members.size() - 1); for (Element member : members) { currentMember = member; Content detailsTree = writer.getMemberTreeHeader(); writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree); Content annotationDocTree = writer.getAnnotationDocTreeHeader(currentMember, detailsTree); buildChildren(node, annotationDocTree); detailsTree.addContent(writer.getAnnotationDoc( annotationDocTree, currentMember == lastElement)); memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); } } }
java
public void buildAnnotationTypeMember(XMLNode node, Content memberDetailsTree) throws DocletException { if (writer == null) { return; } if (hasMembersToDocument()) { writer.addAnnotationFieldDetailsMarker(memberDetailsTree); Element lastElement = members.get(members.size() - 1); for (Element member : members) { currentMember = member; Content detailsTree = writer.getMemberTreeHeader(); writer.addAnnotationDetailsTreeHeader(typeElement, detailsTree); Content annotationDocTree = writer.getAnnotationDocTreeHeader(currentMember, detailsTree); buildChildren(node, annotationDocTree); detailsTree.addContent(writer.getAnnotationDoc( annotationDocTree, currentMember == lastElement)); memberDetailsTree.addContent(writer.getAnnotationDetails(detailsTree)); } } }
[ "public", "void", "buildAnnotationTypeMember", "(", "XMLNode", "node", ",", "Content", "memberDetailsTree", ")", "throws", "DocletException", "{", "if", "(", "writer", "==", "null", ")", "{", "return", ";", "}", "if", "(", "hasMembersToDocument", "(", ")", ")"...
Build the member documentation. @param node the XML element that specifies which components to document @param memberDetailsTree the content tree to which the documentation will be added @throws DocletException if there is a problem while building the documentation
[ "Build", "the", "member", "documentation", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeFieldBuilder.java#L150-L171
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.deferFuture
public static <T> Observable<T> deferFuture(Func0<? extends Future<? extends Observable<? extends T>>> observableFactoryAsync) { return OperatorDeferFuture.deferFuture(observableFactoryAsync); }
java
public static <T> Observable<T> deferFuture(Func0<? extends Future<? extends Observable<? extends T>>> observableFactoryAsync) { return OperatorDeferFuture.deferFuture(observableFactoryAsync); }
[ "public", "static", "<", "T", ">", "Observable", "<", "T", ">", "deferFuture", "(", "Func0", "<", "?", "extends", "Future", "<", "?", "extends", "Observable", "<", "?", "extends", "T", ">", ">", ">", "observableFactoryAsync", ")", "{", "return", "Operato...
Returns an Observable that starts the specified asynchronous factory function whenever a new observer subscribes. <p> <em>Important note</em> subscribing to the resulting Observable blocks until the future completes. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/deferFuture.png" alt=""> @param <T> the result type @param observableFactoryAsync the asynchronous function to start for each observer @return the Observable emitting items produced by the asynchronous observer produced by the factory @see #deferFuture(rx.functions.Func0, rx.Scheduler) @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-deferfuture">RxJava Wiki: deferFuture()</a>
[ "Returns", "an", "Observable", "that", "starts", "the", "specified", "asynchronous", "factory", "function", "whenever", "a", "new", "observer", "subscribes", ".", "<p", ">", "<em", ">", "Important", "note<", "/", "em", ">", "subscribing", "to", "the", "resulti...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1800-L1802
drewnoakes/metadata-extractor
Source/com/drew/metadata/xmp/XmpWriter.java
XmpWriter.write
public static boolean write(OutputStream os, Metadata data) { XmpDirectory dir = data.getFirstDirectoryOfType(XmpDirectory.class); if (dir == null) return false; XMPMeta meta = dir.getXMPMeta(); try { SerializeOptions so = new SerializeOptions().setOmitPacketWrapper(true); XMPMetaFactory.serialize(meta, os, so); } catch (XMPException e) { e.printStackTrace(); return false; } return true; }
java
public static boolean write(OutputStream os, Metadata data) { XmpDirectory dir = data.getFirstDirectoryOfType(XmpDirectory.class); if (dir == null) return false; XMPMeta meta = dir.getXMPMeta(); try { SerializeOptions so = new SerializeOptions().setOmitPacketWrapper(true); XMPMetaFactory.serialize(meta, os, so); } catch (XMPException e) { e.printStackTrace(); return false; } return true; }
[ "public", "static", "boolean", "write", "(", "OutputStream", "os", ",", "Metadata", "data", ")", "{", "XmpDirectory", "dir", "=", "data", ".", "getFirstDirectoryOfType", "(", "XmpDirectory", ".", "class", ")", ";", "if", "(", "dir", "==", "null", ")", "ret...
Serializes the XmpDirectory component of <code>Metadata</code> into an <code>OutputStream</code> @param os Destination for the xmp data @param data populated metadata @return serialize success
[ "Serializes", "the", "XmpDirectory", "component", "of", "<code", ">", "Metadata<", "/", "code", ">", "into", "an", "<code", ">", "OutputStream<", "/", "code", ">" ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/xmp/XmpWriter.java#L19-L36
arquillian/arquillian-cube
docker/reporter/src/main/java/org/arquillian/cube/docker/impl/client/reporter/TakeVncDroneVideo.java
TakeVncDroneVideo.reportScreencastRecording
public void reportScreencastRecording(@Observes AfterVideoRecorded event, ReporterConfiguration reporterConfiguration) { Path videoLocation = event.getVideoLocation(); if (videoLocation != null) { videoLocation = Paths.get(videoLocation.toString().replace("flv", "mp4")); final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory()); final Path relativize = rootDir.relativize(videoLocation); final Method testMethod = getTestMethod(event); Reporter.createReport(new TestMethodReport(testMethod.getName())) .addKeyValueEntry(DockerEnvironmentReportKey.VIDEO_PATH, new FileEntry(relativize)) .inSection(new TestMethodSection(testMethod)) .fire(reportEvent); } }
java
public void reportScreencastRecording(@Observes AfterVideoRecorded event, ReporterConfiguration reporterConfiguration) { Path videoLocation = event.getVideoLocation(); if (videoLocation != null) { videoLocation = Paths.get(videoLocation.toString().replace("flv", "mp4")); final Path rootDir = Paths.get(reporterConfiguration.getRootDirectory()); final Path relativize = rootDir.relativize(videoLocation); final Method testMethod = getTestMethod(event); Reporter.createReport(new TestMethodReport(testMethod.getName())) .addKeyValueEntry(DockerEnvironmentReportKey.VIDEO_PATH, new FileEntry(relativize)) .inSection(new TestMethodSection(testMethod)) .fire(reportEvent); } }
[ "public", "void", "reportScreencastRecording", "(", "@", "Observes", "AfterVideoRecorded", "event", ",", "ReporterConfiguration", "reporterConfiguration", ")", "{", "Path", "videoLocation", "=", "event", ".", "getVideoLocation", "(", ")", ";", "if", "(", "videoLocatio...
Executes after drone recording has finished and file is generated
[ "Executes", "after", "drone", "recording", "has", "finished", "and", "file", "is", "generated" ]
train
https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/docker/reporter/src/main/java/org/arquillian/cube/docker/impl/client/reporter/TakeVncDroneVideo.java#L24-L42
knowm/XChange
xchange-bankera/src/main/java/org/knowm/xchange/bankera/BankeraAdapters.java
BankeraAdapters.adaptTicker
public static Ticker adaptTicker(BankeraTickerResponse ticker, CurrencyPair currencyPair) { BigDecimal high = new BigDecimal(ticker.getTicker().getHigh()); BigDecimal low = new BigDecimal(ticker.getTicker().getLow()); BigDecimal bid = new BigDecimal(ticker.getTicker().getBid()); BigDecimal ask = new BigDecimal(ticker.getTicker().getAsk()); BigDecimal last = new BigDecimal(ticker.getTicker().getLast()); BigDecimal volume = new BigDecimal(ticker.getTicker().getVolume()); Date timestamp = new Date(ticker.getTicker().getTimestamp()); return new Ticker.Builder() .currencyPair(currencyPair) .high(high) .low(low) .bid(bid) .ask(ask) .last(last) .volume(volume) .timestamp(timestamp) .build(); }
java
public static Ticker adaptTicker(BankeraTickerResponse ticker, CurrencyPair currencyPair) { BigDecimal high = new BigDecimal(ticker.getTicker().getHigh()); BigDecimal low = new BigDecimal(ticker.getTicker().getLow()); BigDecimal bid = new BigDecimal(ticker.getTicker().getBid()); BigDecimal ask = new BigDecimal(ticker.getTicker().getAsk()); BigDecimal last = new BigDecimal(ticker.getTicker().getLast()); BigDecimal volume = new BigDecimal(ticker.getTicker().getVolume()); Date timestamp = new Date(ticker.getTicker().getTimestamp()); return new Ticker.Builder() .currencyPair(currencyPair) .high(high) .low(low) .bid(bid) .ask(ask) .last(last) .volume(volume) .timestamp(timestamp) .build(); }
[ "public", "static", "Ticker", "adaptTicker", "(", "BankeraTickerResponse", "ticker", ",", "CurrencyPair", "currencyPair", ")", "{", "BigDecimal", "high", "=", "new", "BigDecimal", "(", "ticker", ".", "getTicker", "(", ")", ".", "getHigh", "(", ")", ")", ";", ...
Adapts Bankera BankeraTickerResponse to a Ticker @param ticker Specific ticker @param currencyPair BankeraCurrency pair (e.g. ETH/BTC) @return Ticker
[ "Adapts", "Bankera", "BankeraTickerResponse", "to", "a", "Ticker" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bankera/src/main/java/org/knowm/xchange/bankera/BankeraAdapters.java#L69-L89
jhunters/jprotobuf
jprotobuf-precompile-plugin/src/main/java/com/baidu/jprotobuf/mojo/PreCompileMojo.java
PreCompileMojo.addRelevantPluginDependenciesToClasspath
private void addRelevantPluginDependenciesToClasspath( List<URL> path ) throws MojoExecutionException { if ( hasCommandlineArgs() ) { arguments = parseCommandlineArgs(); } try { for ( Artifact classPathElement : this.determineRelevantPluginDependencies() ) { getLog().debug( "Adding plugin dependency artifact: " + classPathElement.getArtifactId() + " to classpath" ); path.add( classPathElement.getFile().toURI().toURL() ); } } catch ( MalformedURLException e ) { throw new MojoExecutionException( "Error during setting up classpath", e ); } }
java
private void addRelevantPluginDependenciesToClasspath( List<URL> path ) throws MojoExecutionException { if ( hasCommandlineArgs() ) { arguments = parseCommandlineArgs(); } try { for ( Artifact classPathElement : this.determineRelevantPluginDependencies() ) { getLog().debug( "Adding plugin dependency artifact: " + classPathElement.getArtifactId() + " to classpath" ); path.add( classPathElement.getFile().toURI().toURL() ); } } catch ( MalformedURLException e ) { throw new MojoExecutionException( "Error during setting up classpath", e ); } }
[ "private", "void", "addRelevantPluginDependenciesToClasspath", "(", "List", "<", "URL", ">", "path", ")", "throws", "MojoExecutionException", "{", "if", "(", "hasCommandlineArgs", "(", ")", ")", "{", "arguments", "=", "parseCommandlineArgs", "(", ")", ";", "}", ...
Add any relevant project dependencies to the classpath. Indirectly takes includePluginDependencies and ExecutableDependency into consideration. @param path classpath of {@link java.net.URL} objects @throws MojoExecutionException if a problem happens
[ "Add", "any", "relevant", "project", "dependencies", "to", "the", "classpath", ".", "Indirectly", "takes", "includePluginDependencies", "and", "ExecutableDependency", "into", "consideration", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/jprotobuf-precompile-plugin/src/main/java/com/baidu/jprotobuf/mojo/PreCompileMojo.java#L608-L630
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java
RefinePolyLineCorner.createLine
private void createLine( int index0 , int index1 , List<Point2D_I32> contour , LineGeneral2D_F64 line ) { if( index1 < 0 ) System.out.println("SHIT"); Point2D_I32 p0 = contour.get(index0); Point2D_I32 p1 = contour.get(index1); // System.out.println("createLine "+p0+" "+p1); work.a.set(p0.x, p0.y); work.b.set(p1.x, p1.y); UtilLine2D_F64.convert(work,line); // ensure A*A + B*B = 1 line.normalize(); }
java
private void createLine( int index0 , int index1 , List<Point2D_I32> contour , LineGeneral2D_F64 line ) { if( index1 < 0 ) System.out.println("SHIT"); Point2D_I32 p0 = contour.get(index0); Point2D_I32 p1 = contour.get(index1); // System.out.println("createLine "+p0+" "+p1); work.a.set(p0.x, p0.y); work.b.set(p1.x, p1.y); UtilLine2D_F64.convert(work,line); // ensure A*A + B*B = 1 line.normalize(); }
[ "private", "void", "createLine", "(", "int", "index0", ",", "int", "index1", ",", "List", "<", "Point2D_I32", ">", "contour", ",", "LineGeneral2D_F64", "line", ")", "{", "if", "(", "index1", "<", "0", ")", "System", ".", "out", ".", "println", "(", "\"...
Given segment information create a line in general notation which has been normalized
[ "Given", "segment", "information", "create", "a", "line", "in", "general", "notation", "which", "has", "been", "normalized" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java#L217-L233
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/api/PalDB.java
PalDB.createWriter
public static StoreWriter createWriter(OutputStream stream, Configuration config) { return StoreImpl.createWriter(stream, config); }
java
public static StoreWriter createWriter(OutputStream stream, Configuration config) { return StoreImpl.createWriter(stream, config); }
[ "public", "static", "StoreWriter", "createWriter", "(", "OutputStream", "stream", ",", "Configuration", "config", ")", "{", "return", "StoreImpl", ".", "createWriter", "(", "stream", ",", "config", ")", ";", "}" ]
Creates a store writer with the specified <code>stream</code> as destination. <p> The writer will only write bytes to the stream when {@link StoreWriter#close() } is called. @param stream output stream @param config configuration @return a store writer
[ "Creates", "a", "store", "writer", "with", "the", "specified", "<code", ">", "stream<", "/", "code", ">", "as", "destination", ".", "<p", ">", "The", "writer", "will", "only", "write", "bytes", "to", "the", "stream", "when", "{", "@link", "StoreWriter#clos...
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/api/PalDB.java#L111-L113
box/box-java-sdk
src/main/java/com/box/sdk/MetadataTemplate.java
MetadataTemplate.updateMetadataTemplate
public static MetadataTemplate updateMetadataTemplate(BoxAPIConnection api, String scope, String template, List<FieldOperation> fieldOperations) { JsonArray array = new JsonArray(); for (FieldOperation fieldOperation : fieldOperations) { JsonObject jsonObject = getFieldOperationJsonObject(fieldOperation); array.add(jsonObject); } QueryStringBuilder builder = new QueryStringBuilder(); URL url = METADATA_TEMPLATE_URL_TEMPLATE.build(api.getBaseURL(), scope, template); BoxJSONRequest request = new BoxJSONRequest(api, url, "PUT"); request.setBody(array.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJson = JsonObject.readFrom(response.getJSON()); return new MetadataTemplate(responseJson); }
java
public static MetadataTemplate updateMetadataTemplate(BoxAPIConnection api, String scope, String template, List<FieldOperation> fieldOperations) { JsonArray array = new JsonArray(); for (FieldOperation fieldOperation : fieldOperations) { JsonObject jsonObject = getFieldOperationJsonObject(fieldOperation); array.add(jsonObject); } QueryStringBuilder builder = new QueryStringBuilder(); URL url = METADATA_TEMPLATE_URL_TEMPLATE.build(api.getBaseURL(), scope, template); BoxJSONRequest request = new BoxJSONRequest(api, url, "PUT"); request.setBody(array.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJson = JsonObject.readFrom(response.getJSON()); return new MetadataTemplate(responseJson); }
[ "public", "static", "MetadataTemplate", "updateMetadataTemplate", "(", "BoxAPIConnection", "api", ",", "String", "scope", ",", "String", "template", ",", "List", "<", "FieldOperation", ">", "fieldOperations", ")", "{", "JsonArray", "array", "=", "new", "JsonArray", ...
Updates the schema of an existing metadata template. @param api the API connection to be used @param scope the scope of the object @param template Unique identifier of the template @param fieldOperations the fields that needs to be updated / added in the template @return the updated metadata template
[ "Updates", "the", "schema", "of", "an", "existing", "metadata", "template", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/MetadataTemplate.java#L276-L295
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONAssert.java
JSONAssert.assertNotEquals
public static void assertNotEquals(String message, String expectedStr, String actualStr, JSONComparator comparator) throws JSONException { JSONCompareResult result = JSONCompare.compareJSON(expectedStr, actualStr, comparator); if (result.passed()) { throw new AssertionError(getCombinedMessage(message, result.getMessage())); } }
java
public static void assertNotEquals(String message, String expectedStr, String actualStr, JSONComparator comparator) throws JSONException { JSONCompareResult result = JSONCompare.compareJSON(expectedStr, actualStr, comparator); if (result.passed()) { throw new AssertionError(getCombinedMessage(message, result.getMessage())); } }
[ "public", "static", "void", "assertNotEquals", "(", "String", "message", ",", "String", "expectedStr", ",", "String", "actualStr", ",", "JSONComparator", "comparator", ")", "throws", "JSONException", "{", "JSONCompareResult", "result", "=", "JSONCompare", ".", "comp...
Asserts that the json string provided does not match the expected string. If it is it throws an {@link AssertionError}. @param message Error message to be displayed in case of assertion failure @param expectedStr Expected JSON string @param actualStr String to compare @param comparator Comparator @throws JSONException JSON parsing error
[ "Asserts", "that", "the", "json", "string", "provided", "does", "not", "match", "the", "expected", "string", ".", "If", "it", "is", "it", "throws", "an", "{", "@link", "AssertionError", "}", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L510-L516
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java
NamespaceNotifierClient.haveWatch
public boolean haveWatch(String path, EventType watchType) { return watchedEvents.containsKey(new NamespaceEventKey(path, watchType)); }
java
public boolean haveWatch(String path, EventType watchType) { return watchedEvents.containsKey(new NamespaceEventKey(path, watchType)); }
[ "public", "boolean", "haveWatch", "(", "String", "path", ",", "EventType", "watchType", ")", "{", "return", "watchedEvents", ".", "containsKey", "(", "new", "NamespaceEventKey", "(", "path", ",", "watchType", ")", ")", ";", "}" ]
Tests if a watch is placed at the given path and of the given type. @param path the path where we should test if a watch is placed. For the FILE_ADDED event type, this represents the path of the directory under which the file will be created. @param watchType the type of the event for which we test if a watch is present. @return <code>true</code> if a watch is placed, <code>false</code> otherwise.
[ "Tests", "if", "a", "watch", "is", "placed", "at", "the", "given", "path", "and", "of", "the", "given", "type", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java#L410-L412
haraldk/TwelveMonkeys
imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java
PICTUtil.readDimension
public static Dimension readDimension(final DataInput pStream) throws IOException { int h = pStream.readShort(); int v = pStream.readShort(); return new Dimension(h, v); }
java
public static Dimension readDimension(final DataInput pStream) throws IOException { int h = pStream.readShort(); int v = pStream.readShort(); return new Dimension(h, v); }
[ "public", "static", "Dimension", "readDimension", "(", "final", "DataInput", "pStream", ")", "throws", "IOException", "{", "int", "h", "=", "pStream", ".", "readShort", "(", ")", ";", "int", "v", "=", "pStream", ".", "readShort", "(", ")", ";", "return", ...
Reads a dimension from the given stream. @param pStream the input stream @return the dimension read @throws java.io.IOException if an I/O error occurs during read
[ "Reads", "a", "dimension", "from", "the", "given", "stream", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java#L90-L94
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/util/pseudorandom/impl/ExtendedPseudoRandomGenerator.java
ExtendedPseudoRandomGenerator.randNormal
public double randNormal(double mean, double standardDeviation) { double x1, x2, w, y1; do { x1 = 2.0 * randomGenerator.nextDouble() - 1.0; x2 = 2.0 * randomGenerator.nextDouble() - 1.0; w = x1 * x1 + x2 * x2; } while (w >= 1.0); w = Math.sqrt((-2.0 * Math.log(w)) / w); y1 = x1 * w; y1 = y1 * standardDeviation + mean; return y1; }
java
public double randNormal(double mean, double standardDeviation) { double x1, x2, w, y1; do { x1 = 2.0 * randomGenerator.nextDouble() - 1.0; x2 = 2.0 * randomGenerator.nextDouble() - 1.0; w = x1 * x1 + x2 * x2; } while (w >= 1.0); w = Math.sqrt((-2.0 * Math.log(w)) / w); y1 = x1 * w; y1 = y1 * standardDeviation + mean; return y1; }
[ "public", "double", "randNormal", "(", "double", "mean", ",", "double", "standardDeviation", ")", "{", "double", "x1", ",", "x2", ",", "w", ",", "y1", ";", "do", "{", "x1", "=", "2.0", "*", "randomGenerator", ".", "nextDouble", "(", ")", "-", "1.0", ...
Use the polar form of the Box-Muller transformation to obtain a pseudo random number from a Gaussian distribution Code taken from Maurice Clerc's implementation @param mean @param standardDeviation @return A pseudo random number
[ "Use", "the", "polar", "form", "of", "the", "Box", "-", "Muller", "transformation", "to", "obtain", "a", "pseudo", "random", "number", "from", "a", "Gaussian", "distribution", "Code", "taken", "from", "Maurice", "Clerc", "s", "implementation" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/pseudorandom/impl/ExtendedPseudoRandomGenerator.java#L58-L71
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java
PatternWrapper.matchMidClauses
public boolean matchMidClauses(char[] chars, int start, int length) { return pattern.matchMiddle(chars, start, start+length); }
java
public boolean matchMidClauses(char[] chars, int start, int length) { return pattern.matchMiddle(chars, start, start+length); }
[ "public", "boolean", "matchMidClauses", "(", "char", "[", "]", "chars", ",", "int", "start", ",", "int", "length", ")", "{", "return", "pattern", ".", "matchMiddle", "(", "chars", ",", "start", ",", "start", "+", "length", ")", ";", "}" ]
Test whether the underlying pattern's mid clauses match a set of characters. @param chars @param start @param length @return
[ "Test", "whether", "the", "underlying", "pattern", "s", "mid", "clauses", "match", "a", "set", "of", "characters", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/PatternWrapper.java#L162-L166
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.listNotes
public final ListNotesPagedResponse listNotes(String parent, String filter) { ListNotesRequest request = ListNotesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listNotes(request); }
java
public final ListNotesPagedResponse listNotes(String parent, String filter) { ListNotesRequest request = ListNotesRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listNotes(request); }
[ "public", "final", "ListNotesPagedResponse", "listNotes", "(", "String", "parent", ",", "String", "filter", ")", "{", "ListNotesRequest", "request", "=", "ListNotesRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setFilter", "("...
Lists notes for the specified project. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); String filter = ""; for (Note element : grafeasV1Beta1Client.listNotes(parent.toString(), filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent The name of the project to list notes for in the form of `projects/[PROJECT_ID]`. @param filter The filter expression. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "notes", "for", "the", "specified", "project", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L1090-L1094
r0adkll/PostOffice
library/src/main/java/com/r0adkll/postoffice/PostOffice.java
PostOffice.newAlertMail
public static Delivery newAlertMail(@NotNull Context ctx, @NotNull CharSequence title, @NotNull CharSequence message){ // Create the delivery builder Delivery.Builder builder = newMail(ctx) .setTitle(title) .setMessage(message); // Return the delivery return builder.build(); }
java
public static Delivery newAlertMail(@NotNull Context ctx, @NotNull CharSequence title, @NotNull CharSequence message){ // Create the delivery builder Delivery.Builder builder = newMail(ctx) .setTitle(title) .setMessage(message); // Return the delivery return builder.build(); }
[ "public", "static", "Delivery", "newAlertMail", "(", "@", "NotNull", "Context", "ctx", ",", "@", "NotNull", "CharSequence", "title", ",", "@", "NotNull", "CharSequence", "message", ")", "{", "// Create the delivery builder", "Delivery", ".", "Builder", "builder", ...
Create a new AlertDialog 'Mail' delivery to display @param ctx the application context @param title the dialog title @param message the dialog message @return the delivery
[ "Create", "a", "new", "AlertDialog", "Mail", "delivery", "to", "display" ]
train
https://github.com/r0adkll/PostOffice/blob/f98e365fd66c004ccce64ee87d9f471b97e4e3c2/library/src/main/java/com/r0adkll/postoffice/PostOffice.java#L100-L108
spring-projects/spring-retry
src/main/java/org/springframework/classify/util/MethodInvokerUtils.java
MethodInvokerUtils.getMethodInvokerForSingleArgument
public static <C, T> MethodInvoker getMethodInvokerForSingleArgument(Object target) { final AtomicReference<Method> methodHolder = new AtomicReference<Method>(); ReflectionUtils.doWithMethods(target.getClass(), new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if ((method.getModifiers() & Modifier.PUBLIC) == 0 || method.isBridge()) { return; } if (method.getParameterTypes() == null || method.getParameterTypes().length != 1) { return; } if (method.getReturnType().equals(Void.TYPE) || ReflectionUtils.isEqualsMethod(method)) { return; } Assert.state(methodHolder.get() == null, "More than one non-void public method detected with single argument."); methodHolder.set(method); } }); Method method = methodHolder.get(); return new SimpleMethodInvoker(target, method); }
java
public static <C, T> MethodInvoker getMethodInvokerForSingleArgument(Object target) { final AtomicReference<Method> methodHolder = new AtomicReference<Method>(); ReflectionUtils.doWithMethods(target.getClass(), new ReflectionUtils.MethodCallback() { public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if ((method.getModifiers() & Modifier.PUBLIC) == 0 || method.isBridge()) { return; } if (method.getParameterTypes() == null || method.getParameterTypes().length != 1) { return; } if (method.getReturnType().equals(Void.TYPE) || ReflectionUtils.isEqualsMethod(method)) { return; } Assert.state(methodHolder.get() == null, "More than one non-void public method detected with single argument."); methodHolder.set(method); } }); Method method = methodHolder.get(); return new SimpleMethodInvoker(target, method); }
[ "public", "static", "<", "C", ",", "T", ">", "MethodInvoker", "getMethodInvokerForSingleArgument", "(", "Object", "target", ")", "{", "final", "AtomicReference", "<", "Method", ">", "methodHolder", "=", "new", "AtomicReference", "<", "Method", ">", "(", ")", "...
Create a {@link MethodInvoker} for the delegate from a single public method. @param target an object to search for an appropriate method @return a MethodInvoker that calls a method on the delegate @param <T> the t @param <C> the C
[ "Create", "a", "{" ]
train
https://github.com/spring-projects/spring-retry/blob/e2b0555f96594c2321990d0deeac45fc44d4f123/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java#L212-L237
betfair/cougar
cougar-framework/cougar-zipkin-common/src/main/java/com/betfair/cougar/modules/zipkin/impl/ZipkinEmitter.java
ZipkinEmitter.emitAnnotation
public void emitAnnotation(@Nonnull ZipkinData zipkinData, @Nonnull String s) { long timestampMillis = clock.millis(); long timestampMicros = TimeUnit.MILLISECONDS.toMicros(timestampMillis); ZipkinAnnotationsStore store = prepareEmission(zipkinData, s).addAnnotation(timestampMicros, s); emitAnnotations(store); }
java
public void emitAnnotation(@Nonnull ZipkinData zipkinData, @Nonnull String s) { long timestampMillis = clock.millis(); long timestampMicros = TimeUnit.MILLISECONDS.toMicros(timestampMillis); ZipkinAnnotationsStore store = prepareEmission(zipkinData, s).addAnnotation(timestampMicros, s); emitAnnotations(store); }
[ "public", "void", "emitAnnotation", "(", "@", "Nonnull", "ZipkinData", "zipkinData", ",", "@", "Nonnull", "String", "s", ")", "{", "long", "timestampMillis", "=", "clock", ".", "millis", "(", ")", ";", "long", "timestampMicros", "=", "TimeUnit", ".", "MILLIS...
Emits a single annotation to Zipkin. @param zipkinData Zipkin request data @param s The annotation to emit
[ "Emits", "a", "single", "annotation", "to", "Zipkin", "." ]
train
https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/cougar-zipkin-common/src/main/java/com/betfair/cougar/modules/zipkin/impl/ZipkinEmitter.java#L163-L169
alibaba/java-dns-cache-manipulator
library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java
DnsCacheManipulator.getDnsCache
@Nullable public static DnsCacheEntry getDnsCache(String host) { try { return InetAddressCacheUtil.getInetAddressCache(host); } catch (Exception e) { throw new DnsCacheManipulatorException("Fail to getDnsCache, cause: " + e.toString(), e); } }
java
@Nullable public static DnsCacheEntry getDnsCache(String host) { try { return InetAddressCacheUtil.getInetAddressCache(host); } catch (Exception e) { throw new DnsCacheManipulatorException("Fail to getDnsCache, cause: " + e.toString(), e); } }
[ "@", "Nullable", "public", "static", "DnsCacheEntry", "getDnsCache", "(", "String", "host", ")", "{", "try", "{", "return", "InetAddressCacheUtil", ".", "getInetAddressCache", "(", "host", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "ne...
Get dns cache. @return dns cache. return {@code null} if no entry for host or dns cache is expired. @throws DnsCacheManipulatorException Operation fail
[ "Get", "dns", "cache", "." ]
train
https://github.com/alibaba/java-dns-cache-manipulator/blob/eab50ee5c27671f9159b55458301f9429b2fcc47/library/src/main/java/com/alibaba/dcm/DnsCacheManipulator.java#L133-L140
bazaarvoice/jersey-hmac-auth
client/src/main/java/com/bazaarvoice/auth/hmac/client/RequestEncoder.java
RequestEncoder.getSerializedEntity
private byte[] getSerializedEntity(ClientRequest request) { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { // By using the RequestWriter parent class, we match the behavior of entity writing from // for example, com.sun.jersey.client.urlconnection.URLConnectionClientHandler. writeRequestEntity(request, new RequestEntityWriterListener() { public void onRequestEntitySize(long size) throws IOException { } public OutputStream onGetOutputStream() throws IOException { return outputStream; } }); } catch (IOException e) { throw new ClientHandlerException("Unable to serialize request entity", e); } return outputStream.toByteArray(); }
java
private byte[] getSerializedEntity(ClientRequest request) { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); try { // By using the RequestWriter parent class, we match the behavior of entity writing from // for example, com.sun.jersey.client.urlconnection.URLConnectionClientHandler. writeRequestEntity(request, new RequestEntityWriterListener() { public void onRequestEntitySize(long size) throws IOException { } public OutputStream onGetOutputStream() throws IOException { return outputStream; } }); } catch (IOException e) { throw new ClientHandlerException("Unable to serialize request entity", e); } return outputStream.toByteArray(); }
[ "private", "byte", "[", "]", "getSerializedEntity", "(", "ClientRequest", "request", ")", "{", "final", "ByteArrayOutputStream", "outputStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{", "// By using the RequestWriter parent class, we match the behavio...
Get the serialized representation of the request entity. This is used when generating the client signature, because this is the representation that the server will receive and use when it generates the server-side signature to compare to the client-side signature. @see com.sun.jersey.client.urlconnection.URLConnectionClientHandler
[ "Get", "the", "serialized", "representation", "of", "the", "request", "entity", ".", "This", "is", "used", "when", "generating", "the", "client", "signature", "because", "this", "is", "the", "representation", "that", "the", "server", "will", "receive", "and", ...
train
https://github.com/bazaarvoice/jersey-hmac-auth/blob/17e2a40a4b7b783de4d77ad97f8a623af6baf688/client/src/main/java/com/bazaarvoice/auth/hmac/client/RequestEncoder.java#L98-L118
google/closure-templates
java/src/com/google/template/soy/jbcsrc/ExpressionCompiler.java
ExpressionCompiler.createBasicCompiler
static BasicExpressionCompiler createBasicCompiler( TemplateParameterLookup parameters, TemplateVariableManager varManager, ErrorReporter reporter, SoyTypeRegistry registry) { return new BasicExpressionCompiler(parameters, varManager, reporter, registry); }
java
static BasicExpressionCompiler createBasicCompiler( TemplateParameterLookup parameters, TemplateVariableManager varManager, ErrorReporter reporter, SoyTypeRegistry registry) { return new BasicExpressionCompiler(parameters, varManager, reporter, registry); }
[ "static", "BasicExpressionCompiler", "createBasicCompiler", "(", "TemplateParameterLookup", "parameters", ",", "TemplateVariableManager", "varManager", ",", "ErrorReporter", "reporter", ",", "SoyTypeRegistry", "registry", ")", "{", "return", "new", "BasicExpressionCompiler", ...
Create a basic compiler with trivial detaching logic. <p>All generated detach points are implemented as {@code return} statements and the returned value is boxed, so it is only valid for use by the {@link LazyClosureCompiler}.
[ "Create", "a", "basic", "compiler", "with", "trivial", "detaching", "logic", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ExpressionCompiler.java#L190-L196
tianjing/tgtools.web.develop
src/main/java/tgtools/web/develop/util/ValidHelper.java
ValidHelper.validString
public static void validString(String pContent, String pParamName) throws APPErrorException { if (StringUtil.isNullOrEmpty(pContent)) { throw new APPErrorException(pParamName + " 不能为空"); } }
java
public static void validString(String pContent, String pParamName) throws APPErrorException { if (StringUtil.isNullOrEmpty(pContent)) { throw new APPErrorException(pParamName + " 不能为空"); } }
[ "public", "static", "void", "validString", "(", "String", "pContent", ",", "String", "pParamName", ")", "throws", "APPErrorException", "{", "if", "(", "StringUtil", ".", "isNullOrEmpty", "(", "pContent", ")", ")", "{", "throw", "new", "APPErrorException", "(", ...
验证字符串 不能为空 @param pContent 文本 @param pParamName 参数名称 @throws APPErrorException
[ "验证字符串", "不能为空" ]
train
https://github.com/tianjing/tgtools.web.develop/blob/a18567f3ccf877249f2e33028d1e7c479900e4eb/src/main/java/tgtools/web/develop/util/ValidHelper.java#L36-L40
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java
CouchDatabaseBase.findAny
public <T> T findAny(Class<T> classType, String uri) { assertNotEmpty(classType, "Class"); assertNotEmpty(uri, "uri"); return couchDbClient.get(URI.create(uri), classType); }
java
public <T> T findAny(Class<T> classType, String uri) { assertNotEmpty(classType, "Class"); assertNotEmpty(uri, "uri"); return couchDbClient.get(URI.create(uri), classType); }
[ "public", "<", "T", ">", "T", "findAny", "(", "Class", "<", "T", ">", "classType", ",", "String", "uri", ")", "{", "assertNotEmpty", "(", "classType", ",", "\"Class\"", ")", ";", "assertNotEmpty", "(", "uri", ",", "\"uri\"", ")", ";", "return", "couchD...
This method finds any document given a URI. <p>The URI must be URI-encoded. @param classType The class of type T. @param uri The URI as string. @return An object of type T.
[ "This", "method", "finds", "any", "document", "given", "a", "URI", ".", "<p", ">", "The", "URI", "must", "be", "URI", "-", "encoded", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java#L131-L135
Alluxio/alluxio
shell/src/main/java/alluxio/cli/fs/command/ChgrpCommand.java
ChgrpCommand.chgrp
private void chgrp(AlluxioURI path, String group, boolean recursive) throws AlluxioException, IOException { SetAttributePOptions options = SetAttributePOptions.newBuilder().setGroup(group).setRecursive(recursive).build(); mFileSystem.setAttribute(path, options); System.out.println("Changed group of " + path + " to " + group); }
java
private void chgrp(AlluxioURI path, String group, boolean recursive) throws AlluxioException, IOException { SetAttributePOptions options = SetAttributePOptions.newBuilder().setGroup(group).setRecursive(recursive).build(); mFileSystem.setAttribute(path, options); System.out.println("Changed group of " + path + " to " + group); }
[ "private", "void", "chgrp", "(", "AlluxioURI", "path", ",", "String", "group", ",", "boolean", "recursive", ")", "throws", "AlluxioException", ",", "IOException", "{", "SetAttributePOptions", "options", "=", "SetAttributePOptions", ".", "newBuilder", "(", ")", "."...
Changes the group for the directory or file with the path specified in args. @param path The {@link AlluxioURI} path as the input of the command @param group The group to be updated to the file or directory @param recursive Whether change the group recursively
[ "Changes", "the", "group", "for", "the", "directory", "or", "file", "with", "the", "path", "specified", "in", "args", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/ChgrpCommand.java#L74-L80
jeremylong/DependencyCheck
cli/src/main/java/org/owasp/dependencycheck/CliParser.java
CliParser.hasDisableOption
private boolean hasDisableOption(String argument, String setting) { if (line == null || !line.hasOption(argument)) { try { return !settings.getBoolean(setting); } catch (InvalidSettingException ise) { LOGGER.warn("Invalid property setting '{}' defaulting to false", setting); return false; } } else { return true; } }
java
private boolean hasDisableOption(String argument, String setting) { if (line == null || !line.hasOption(argument)) { try { return !settings.getBoolean(setting); } catch (InvalidSettingException ise) { LOGGER.warn("Invalid property setting '{}' defaulting to false", setting); return false; } } else { return true; } }
[ "private", "boolean", "hasDisableOption", "(", "String", "argument", ",", "String", "setting", ")", "{", "if", "(", "line", "==", "null", "||", "!", "line", ".", "hasOption", "(", "argument", ")", ")", "{", "try", "{", "return", "!", "settings", ".", "...
Utility method to determine if one of the disable options has been set. If not set, this method will check the currently configured settings for the current value to return. Example given `--disableArchive` on the command line would cause this method to return true for the disable archive setting. @param argument the command line argument @param setting the corresponding settings key @return true if the disable option was set, if not set the currently configured value will be returned
[ "Utility", "method", "to", "determine", "if", "one", "of", "the", "disable", "options", "has", "been", "set", ".", "If", "not", "set", "this", "method", "will", "check", "the", "currently", "configured", "settings", "for", "the", "current", "value", "to", ...
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/cli/src/main/java/org/owasp/dependencycheck/CliParser.java#L589-L600
jurmous/etcd4j
src/main/java/mousio/etcd4j/EtcdClient.java
EtcdClient.getVersion
@Deprecated public String getVersion() { try { return new EtcdOldVersionRequest(this.client, retryHandler).send().get(); } catch (IOException | EtcdException | EtcdAuthenticationException | TimeoutException e) { return null; } }
java
@Deprecated public String getVersion() { try { return new EtcdOldVersionRequest(this.client, retryHandler).send().get(); } catch (IOException | EtcdException | EtcdAuthenticationException | TimeoutException e) { return null; } }
[ "@", "Deprecated", "public", "String", "getVersion", "(", ")", "{", "try", "{", "return", "new", "EtcdOldVersionRequest", "(", "this", ".", "client", ",", "retryHandler", ")", ".", "send", "(", ")", ".", "get", "(", ")", ";", "}", "catch", "(", "IOExce...
Get the version of the Etcd server @return version as String @deprecated use version() when using etcd 2.1+.
[ "Get", "the", "version", "of", "the", "Etcd", "server" ]
train
https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/EtcdClient.java#L118-L125
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.beginUpdateTagsAsync
public Observable<VirtualNetworkGatewayConnectionInner> beginUpdateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionInner>, VirtualNetworkGatewayConnectionInner>() { @Override public VirtualNetworkGatewayConnectionInner call(ServiceResponse<VirtualNetworkGatewayConnectionInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkGatewayConnectionInner> beginUpdateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionInner>, VirtualNetworkGatewayConnectionInner>() { @Override public VirtualNetworkGatewayConnectionInner call(ServiceResponse<VirtualNetworkGatewayConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkGatewayConnectionInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginU...
Updates a virtual network gateway connection tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkGatewayConnectionInner object
[ "Updates", "a", "virtual", "network", "gateway", "connection", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L792-L799
rsocket/rsocket-java
rsocket-transport-netty/src/main/java/io/rsocket/transport/netty/server/WebsocketRouteTransport.java
WebsocketRouteTransport.newHandler
public static BiFunction<WebsocketInbound, WebsocketOutbound, Publisher<Void>> newHandler( ConnectionAcceptor acceptor) { return newHandler(acceptor, 0); }
java
public static BiFunction<WebsocketInbound, WebsocketOutbound, Publisher<Void>> newHandler( ConnectionAcceptor acceptor) { return newHandler(acceptor, 0); }
[ "public", "static", "BiFunction", "<", "WebsocketInbound", ",", "WebsocketOutbound", ",", "Publisher", "<", "Void", ">", ">", "newHandler", "(", "ConnectionAcceptor", "acceptor", ")", "{", "return", "newHandler", "(", "acceptor", ",", "0", ")", ";", "}" ]
Creates a new Websocket handler @param acceptor the {@link ConnectionAcceptor} to use with the handler @return a new Websocket handler @throws NullPointerException if {@code acceptor} is {@code null}
[ "Creates", "a", "new", "Websocket", "handler" ]
train
https://github.com/rsocket/rsocket-java/blob/5101748fbd224ec86570351cebd24d079b63fbfc/rsocket-transport-netty/src/main/java/io/rsocket/transport/netty/server/WebsocketRouteTransport.java#L97-L100
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
JQMListItem.addHeaderText
public JQMListItem addHeaderText(int n, String html) { Element e = Document.get().createHElement(n); e.setInnerHTML(html); attachChild(e); return this; }
java
public JQMListItem addHeaderText(int n, String html) { Element e = Document.get().createHElement(n); e.setInnerHTML(html); attachChild(e); return this; }
[ "public", "JQMListItem", "addHeaderText", "(", "int", "n", ",", "String", "html", ")", "{", "Element", "e", "=", "Document", ".", "get", "(", ")", ".", "createHElement", "(", "n", ")", ";", "e", ".", "setInnerHTML", "(", "html", ")", ";", "attachChild"...
Adds a header element containing the given text. @param n - the Hn element to use, e.g. if n is 2 then a {@code <h2>} element is created. @param html - the value to set as the inner html of the {@code <hn>} element.
[ "Adds", "a", "header", "element", "containing", "the", "given", "text", "." ]
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L173-L178
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/filter/PerfFilter.java
PerfFilter.doFilter
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = HttpServletRequest.class.cast(request); long start = System.currentTimeMillis(); try { chain.doFilter(request, response); } finally { long delta = System.currentTimeMillis() - start; HttpServletResponse resp = HttpServletResponse.class.cast(response); updateCounters(req, resp, delta); } }
java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = HttpServletRequest.class.cast(request); long start = System.currentTimeMillis(); try { chain.doFilter(request, response); } finally { long delta = System.currentTimeMillis() - start; HttpServletResponse resp = HttpServletResponse.class.cast(response); updateCounters(req, resp, delta); } }
[ "@", "Override", "public", "void", "doFilter", "(", "ServletRequest", "request", ",", "ServletResponse", "response", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "HttpServletRequest", "req", "=", "HttpServletRequest", ".", ...
Updates performance counters using the Argus monitoring service. @param request The HTTP request. @param response The HTTP response. @param chain The filter chain to execute. @throws IOException If an I/O error occurs. @throws ServletException If an unknown error occurs.
[ "Updates", "performance", "counters", "using", "the", "Argus", "monitoring", "service", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/filter/PerfFilter.java#L97-L110
santhosh-tekuri/jlibs
swing/src/main/java/jlibs/swing/SwingUtil.java
SwingUtil.doAction
public static void doAction(JTextField textField){ String command = null; if(textField.getAction()!=null) command = (String)textField.getAction().getValue(Action.ACTION_COMMAND_KEY); ActionEvent event = null; for(ActionListener listener: textField.getActionListeners()){ if(event==null) event = new ActionEvent(textField, ActionEvent.ACTION_PERFORMED, command, System.currentTimeMillis(), 0); listener.actionPerformed(event); } }
java
public static void doAction(JTextField textField){ String command = null; if(textField.getAction()!=null) command = (String)textField.getAction().getValue(Action.ACTION_COMMAND_KEY); ActionEvent event = null; for(ActionListener listener: textField.getActionListeners()){ if(event==null) event = new ActionEvent(textField, ActionEvent.ACTION_PERFORMED, command, System.currentTimeMillis(), 0); listener.actionPerformed(event); } }
[ "public", "static", "void", "doAction", "(", "JTextField", "textField", ")", "{", "String", "command", "=", "null", ";", "if", "(", "textField", ".", "getAction", "(", ")", "!=", "null", ")", "command", "=", "(", "String", ")", "textField", ".", "getActi...
Programmatically perform action on textfield.This does the same thing as if the user had pressed enter key in textfield. @param textField textField on which action to be preformed
[ "Programmatically", "perform", "action", "on", "textfield", ".", "This", "does", "the", "same", "thing", "as", "if", "the", "user", "had", "pressed", "enter", "key", "in", "textfield", "." ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/swing/src/main/java/jlibs/swing/SwingUtil.java#L56-L67
zaproxy/zaproxy
src/org/parosproxy/paros/core/scanner/VariantAbstractQuery.java
VariantAbstractQuery.setParameters
protected void setParameters(int type, List<org.zaproxy.zap.model.NameValuePair> parameters) { if (parameters == null) { throw new IllegalArgumentException("Parameter parameters must not be null."); } int size = parameters.isEmpty() ? 1 : parameters.size(); listParam = new ArrayList<>(size); originalNames = new ArrayList<>(size); Map<String, MutableInt> arraysMap = new HashMap<>(); int i = 0; for (org.zaproxy.zap.model.NameValuePair parameter : parameters) { String originalName = nonNullString(parameter.getName()); originalNames.add(originalName); String name = isParamArray(originalName) ? getArrayName(originalName, arraysMap) : originalName; listParam.add(new NameValuePair(type, name, nonNullString(parameter.getValue()), i)); i++; } if (i == 0 && addQueryParam) { String param = "query"; // No query params, lets add one just to make sure listParam.add(new NameValuePair(type, param, param, i)); originalNames.add(param); } }
java
protected void setParameters(int type, List<org.zaproxy.zap.model.NameValuePair> parameters) { if (parameters == null) { throw new IllegalArgumentException("Parameter parameters must not be null."); } int size = parameters.isEmpty() ? 1 : parameters.size(); listParam = new ArrayList<>(size); originalNames = new ArrayList<>(size); Map<String, MutableInt> arraysMap = new HashMap<>(); int i = 0; for (org.zaproxy.zap.model.NameValuePair parameter : parameters) { String originalName = nonNullString(parameter.getName()); originalNames.add(originalName); String name = isParamArray(originalName) ? getArrayName(originalName, arraysMap) : originalName; listParam.add(new NameValuePair(type, name, nonNullString(parameter.getValue()), i)); i++; } if (i == 0 && addQueryParam) { String param = "query"; // No query params, lets add one just to make sure listParam.add(new NameValuePair(type, param, param, i)); originalNames.add(param); } }
[ "protected", "void", "setParameters", "(", "int", "type", ",", "List", "<", "org", ".", "zaproxy", ".", "zap", ".", "model", ".", "NameValuePair", ">", "parameters", ")", "{", "if", "(", "parameters", "==", "null", ")", "{", "throw", "new", "IllegalArgum...
Sets the given {@code parameters} of the given {@code type} as the list of parameters handled by this variant. <p> The names and values of the parameters are expected to be in decoded form. @param type the type of parameters @param parameters the actual parameters to add @throws IllegalArgumentException if {@code parameters} is {@code null}. @since 2.5.0 @see #getParamList() @see NameValuePair#TYPE_QUERY_STRING @see NameValuePair#TYPE_POST_DATA
[ "Sets", "the", "given", "{", "@code", "parameters", "}", "of", "the", "given", "{", "@code", "type", "}", "as", "the", "list", "of", "parameters", "handled", "by", "this", "variant", ".", "<p", ">", "The", "names", "and", "values", "of", "the", "parame...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/VariantAbstractQuery.java#L130-L154
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_download_policy.java
ns_conf_download_policy.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_download_policy_responses result = (ns_conf_download_policy_responses) service.get_payload_formatter().string_to_resource(ns_conf_download_policy_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_download_policy_response_array); } ns_conf_download_policy[] result_ns_conf_download_policy = new ns_conf_download_policy[result.ns_conf_download_policy_response_array.length]; for(int i = 0; i < result.ns_conf_download_policy_response_array.length; i++) { result_ns_conf_download_policy[i] = result.ns_conf_download_policy_response_array[i].ns_conf_download_policy[0]; } return result_ns_conf_download_policy; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_download_policy_responses result = (ns_conf_download_policy_responses) service.get_payload_formatter().string_to_resource(ns_conf_download_policy_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_download_policy_response_array); } ns_conf_download_policy[] result_ns_conf_download_policy = new ns_conf_download_policy[result.ns_conf_download_policy_response_array.length]; for(int i = 0; i < result.ns_conf_download_policy_response_array.length; i++) { result_ns_conf_download_policy[i] = result.ns_conf_download_policy_response_array[i].ns_conf_download_policy[0]; } return result_ns_conf_download_policy; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_conf_download_policy_responses", "result", "=", "(", "ns_conf_download_policy_responses", ")", "service", "....
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf_download_policy.java#L234-L251
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java
RedundentExprEliminator.assertIsLocPathIterator
private final void assertIsLocPathIterator(Expression expr1, ExpressionOwner eo) throws RuntimeException { if(!(expr1 instanceof LocPathIterator)) { String errMsg; if(expr1 instanceof Variable) { errMsg = "Programmer's assertion: expr1 not an iterator: "+ ((Variable)expr1).getQName(); } else { errMsg = "Programmer's assertion: expr1 not an iterator: "+ expr1.getClass().getName(); } throw new RuntimeException(errMsg + ", "+ eo.getClass().getName()+" "+ expr1.exprGetParent()); } }
java
private final void assertIsLocPathIterator(Expression expr1, ExpressionOwner eo) throws RuntimeException { if(!(expr1 instanceof LocPathIterator)) { String errMsg; if(expr1 instanceof Variable) { errMsg = "Programmer's assertion: expr1 not an iterator: "+ ((Variable)expr1).getQName(); } else { errMsg = "Programmer's assertion: expr1 not an iterator: "+ expr1.getClass().getName(); } throw new RuntimeException(errMsg + ", "+ eo.getClass().getName()+" "+ expr1.exprGetParent()); } }
[ "private", "final", "void", "assertIsLocPathIterator", "(", "Expression", "expr1", ",", "ExpressionOwner", "eo", ")", "throws", "RuntimeException", "{", "if", "(", "!", "(", "expr1", "instanceof", "LocPathIterator", ")", ")", "{", "String", "errMsg", ";", "if", ...
Assert that the expression is a LocPathIterator, and, if not, try to give some diagnostic info.
[ "Assert", "that", "the", "expression", "is", "a", "LocPathIterator", "and", "if", "not", "try", "to", "give", "some", "diagnostic", "info", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L1241-L1261
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newAuthorizationException
public static AuthorizationException newAuthorizationException(Throwable cause, String message, Object... args) { return new AuthorizationException(format(message, args), cause); }
java
public static AuthorizationException newAuthorizationException(Throwable cause, String message, Object... args) { return new AuthorizationException(format(message, args), cause); }
[ "public", "static", "AuthorizationException", "newAuthorizationException", "(", "Throwable", "cause", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "new", "AuthorizationException", "(", "format", "(", "message", ",", "args", ")", ",",...
Constructs and initializes a new {@link AuthorizationException} with the given {@link Throwable cause} and {@link String message} formatted with the given {@link Object[] arguments}. @param cause {@link Throwable} identified as the reason this {@link AuthorizationException} was thrown. @param message {@link String} describing the {@link AuthorizationException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link AuthorizationException} with the given {@link Throwable cause} and {@link String message}. @see org.cp.elements.security.AuthorizationException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "AuthorizationException", "}", "with", "the", "given", "{", "@link", "Throwable", "cause", "}", "and", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "O...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L627-L629
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/GrammaticalStructure.java
GrammaticalStructure.getDependencyPath
public List<String> getDependencyPath(int nodeIndex, int rootIndex) { TreeGraphNode node = getNodeByIndex(nodeIndex); TreeGraphNode rootTree = getNodeByIndex(rootIndex); return getDependencyPath(node, rootTree); }
java
public List<String> getDependencyPath(int nodeIndex, int rootIndex) { TreeGraphNode node = getNodeByIndex(nodeIndex); TreeGraphNode rootTree = getNodeByIndex(rootIndex); return getDependencyPath(node, rootTree); }
[ "public", "List", "<", "String", ">", "getDependencyPath", "(", "int", "nodeIndex", ",", "int", "rootIndex", ")", "{", "TreeGraphNode", "node", "=", "getNodeByIndex", "(", "nodeIndex", ")", ";", "TreeGraphNode", "rootTree", "=", "getNodeByIndex", "(", "rootIndex...
Returns the dependency path as a list of String, from node to root, it is assumed that that root is an ancestor of node @return A list of dependency labels
[ "Returns", "the", "dependency", "path", "as", "a", "list", "of", "String", "from", "node", "to", "root", "it", "is", "assumed", "that", "that", "root", "is", "an", "ancestor", "of", "node" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/GrammaticalStructure.java#L736-L740
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java
Price.createFromGrossAmount
@Nonnull public static Price createFromGrossAmount (@Nonnull final ICurrencyValue aGrossAmount, @Nonnull final IVATItem aVATItem, @Nonnegative final int nScale, @Nonnull final RoundingMode eRoundingMode) { ValueEnforcer.notNull (aVATItem, "VATItem"); final BigDecimal aFactor = aVATItem.getMultiplicationFactorNetToGross (); if (MathHelper.isEQ1 (aFactor)) { // Shortcut for no VAT (net == gross) return new Price (aGrossAmount, aVATItem); } return new Price (aGrossAmount.getCurrency (), aGrossAmount.getValue ().divide (aFactor, nScale, eRoundingMode), aVATItem); }
java
@Nonnull public static Price createFromGrossAmount (@Nonnull final ICurrencyValue aGrossAmount, @Nonnull final IVATItem aVATItem, @Nonnegative final int nScale, @Nonnull final RoundingMode eRoundingMode) { ValueEnforcer.notNull (aVATItem, "VATItem"); final BigDecimal aFactor = aVATItem.getMultiplicationFactorNetToGross (); if (MathHelper.isEQ1 (aFactor)) { // Shortcut for no VAT (net == gross) return new Price (aGrossAmount, aVATItem); } return new Price (aGrossAmount.getCurrency (), aGrossAmount.getValue ().divide (aFactor, nScale, eRoundingMode), aVATItem); }
[ "@", "Nonnull", "public", "static", "Price", "createFromGrossAmount", "(", "@", "Nonnull", "final", "ICurrencyValue", "aGrossAmount", ",", "@", "Nonnull", "final", "IVATItem", "aVATItem", ",", "@", "Nonnegative", "final", "int", "nScale", ",", "@", "Nonnull", "f...
Create a price from a gross amount. @param aGrossAmount The gross amount to use. May not be <code>null</code>. @param aVATItem The VAT item to use. May not be <code>null</code>. @param nScale The scaling to be used for the resulting amount, in case <code>grossAmount / (1 + perc/100)</code> delivery an inexact result. @param eRoundingMode The rounding mode to be used to create a valid result. @return The created {@link Price}
[ "Create", "a", "price", "from", "a", "gross", "amount", "." ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java#L344-L362