Dataset Viewer
Auto-converted to Parquet Duplicate
repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
sequencelengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/BeanPropertyReaderUtil.java
BeanPropertyReaderUtil.getNullSaveProperty
public static Object getNullSaveProperty(final Object pbean, final String pname) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Object property; try { property = PropertyUtils.getProperty(pbean, pname); } catch (final NestedNullException pexception) { property = null; } return property; }
java
public static Object getNullSaveProperty(final Object pbean, final String pname) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException { Object property; try { property = PropertyUtils.getProperty(pbean, pname); } catch (final NestedNullException pexception) { property = null; } return property; }
[ "public", "static", "Object", "getNullSaveProperty", "(", "final", "Object", "pbean", ",", "final", "String", "pname", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", ",", "NoSuchMethodException", "{", "Object", "property", ";", "try", "{", ...
<p> Return the value of the specified property of the specified bean, no matter which property reference format is used, as a String. </p> <p> If there is a null value in path hierarchy, exception is cached and null returned. </p> @param pbean Bean whose property is to be extracted @param pname Possibly indexed and/or nested name of the property to be extracted @return The property's value, converted to a String @exception IllegalAccessException if the caller does not have access to the property accessor method @exception InvocationTargetException if the property accessor method throws an exception @exception NoSuchMethodException if an accessor method for this property cannot be found @see BeanUtilsBean#getProperty
[ "<p", ">", "Return", "the", "value", "of", "the", "specified", "property", "of", "the", "specified", "bean", "no", "matter", "which", "property", "reference", "format", "is", "used", "as", "a", "String", ".", "<", "/", "p", ">", "<p", ">", "If", "there...
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/BeanPropertyReaderUtil.java#L89-L98
twotoasters/RecyclerViewLib
library/src/main/java/com/twotoasters/anim/PendingItemAnimator.java
PendingItemAnimator.animateMoveImpl
protected ViewPropertyAnimatorCompat animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) { final View view = holder.itemView; final int deltaX = toX - fromX; final int deltaY = toY - fromY; ViewCompat.animate(view).cancel(); if (deltaX != 0) { ViewCompat.animate(view).translationX(0); } if (deltaY != 0) { ViewCompat.animate(view).translationY(0); } // TODO: make EndActions end listeners instead, since end actions aren't called when // vpas are canceled (and can't end them. why?) // need listener functionality in VPACompat for this. Ick. return ViewCompat.animate(view).setInterpolator(null).setDuration(getMoveDuration()); }
java
protected ViewPropertyAnimatorCompat animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) { final View view = holder.itemView; final int deltaX = toX - fromX; final int deltaY = toY - fromY; ViewCompat.animate(view).cancel(); if (deltaX != 0) { ViewCompat.animate(view).translationX(0); } if (deltaY != 0) { ViewCompat.animate(view).translationY(0); } // TODO: make EndActions end listeners instead, since end actions aren't called when // vpas are canceled (and can't end them. why?) // need listener functionality in VPACompat for this. Ick. return ViewCompat.animate(view).setInterpolator(null).setDuration(getMoveDuration()); }
[ "protected", "ViewPropertyAnimatorCompat", "animateMoveImpl", "(", "final", "ViewHolder", "holder", ",", "int", "fromX", ",", "int", "fromY", ",", "int", "toX", ",", "int", "toY", ")", "{", "final", "View", "view", "=", "holder", ".", "itemView", ";", "final...
Preform your animation. You do not need to override this in most cases cause the default is pretty good. Listeners will be overridden *
[ "Preform", "your", "animation", ".", "You", "do", "not", "need", "to", "override", "this", "in", "most", "cases", "cause", "the", "default", "is", "pretty", "good", ".", "Listeners", "will", "be", "overridden", "*" ]
train
https://github.com/twotoasters/RecyclerViewLib/blob/2379fd5bbf57d4dfc8b28046b7ace950905c75f0/library/src/main/java/com/twotoasters/anim/PendingItemAnimator.java#L276-L291
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java
SimpleFormatterImpl.formatRawPattern
public static String formatRawPattern(String pattern, int min, int max, CharSequence... values) { StringBuilder sb = new StringBuilder(); String compiledPattern = compileToStringMinMaxArguments(pattern, sb, min, max); sb.setLength(0); return formatAndAppend(compiledPattern, sb, null, values).toString(); }
java
public static String formatRawPattern(String pattern, int min, int max, CharSequence... values) { StringBuilder sb = new StringBuilder(); String compiledPattern = compileToStringMinMaxArguments(pattern, sb, min, max); sb.setLength(0); return formatAndAppend(compiledPattern, sb, null, values).toString(); }
[ "public", "static", "String", "formatRawPattern", "(", "String", "pattern", ",", "int", "min", ",", "int", "max", ",", "CharSequence", "...", "values", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "String", "compiledPattern", ...
Formats the not-compiled pattern with the given values. Equivalent to compileToStringMinMaxArguments() followed by formatCompiledPattern(). The number of arguments checked against the given limits is the highest argument number plus one, not the number of occurrences of arguments. @param pattern Not-compiled form of a pattern string. @param min The pattern must have at least this many arguments. @param max The pattern must have at most this many arguments. @return The compiled-pattern string. @throws IllegalArgumentException for bad argument syntax and too few or too many arguments.
[ "Formats", "the", "not", "-", "compiled", "pattern", "with", "the", "given", "values", ".", "Equivalent", "to", "compileToStringMinMaxArguments", "()", "followed", "by", "formatCompiledPattern", "()", ".", "The", "number", "of", "arguments", "checked", "against", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java#L205-L210
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.registerApplePush
@ObjectiveCName("registerApplePushWithApnsId:withToken:") public void registerApplePush(int apnsId, String token) { modules.getPushesModule().registerApplePush(apnsId, token); }
java
@ObjectiveCName("registerApplePushWithApnsId:withToken:") public void registerApplePush(int apnsId, String token) { modules.getPushesModule().registerApplePush(apnsId, token); }
[ "@", "ObjectiveCName", "(", "\"registerApplePushWithApnsId:withToken:\"", ")", "public", "void", "registerApplePush", "(", "int", "apnsId", ",", "String", "token", ")", "{", "modules", ".", "getPushesModule", "(", ")", ".", "registerApplePush", "(", "apnsId", ",", ...
Register apple push @param apnsId internal APNS cert key @param token APNS token
[ "Register", "apple", "push" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2688-L2691
UrielCh/ovh-java-sdk
ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java
ApiOvhRouter.serviceName_network_POST
public OvhTask serviceName_network_POST(String serviceName, String description, String ipNet, Long vlanTag) throws IOException { String qPath = "/router/{serviceName}/network"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "ipNet", ipNet); addBody(o, "vlanTag", vlanTag); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_network_POST(String serviceName, String description, String ipNet, Long vlanTag) throws IOException { String qPath = "/router/{serviceName}/network"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "ipNet", ipNet); addBody(o, "vlanTag", vlanTag); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_network_POST", "(", "String", "serviceName", ",", "String", "description", ",", "String", "ipNet", ",", "Long", "vlanTag", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/router/{serviceName}/network\"", ";", "StringBui...
Add a network to your router REST: POST /router/{serviceName}/network @param ipNet [required] Gateway IP / CIDR Netmask, (e.g. 192.168.1.254/24) @param description [required] @param vlanTag [required] Vlan tag from range 1 to 4094 or NULL for untagged traffic @param serviceName [required] The internal name of your Router offer
[ "Add", "a", "network", "to", "your", "router" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L256-L265
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java
NodeReportsInner.listByNodeAsync
public Observable<Page<DscNodeReportInner>> listByNodeAsync(final String resourceGroupName, final String automationAccountName, final String nodeId) { return listByNodeWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId) .map(new Func1<ServiceResponse<Page<DscNodeReportInner>>, Page<DscNodeReportInner>>() { @Override public Page<DscNodeReportInner> call(ServiceResponse<Page<DscNodeReportInner>> response) { return response.body(); } }); }
java
public Observable<Page<DscNodeReportInner>> listByNodeAsync(final String resourceGroupName, final String automationAccountName, final String nodeId) { return listByNodeWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId) .map(new Func1<ServiceResponse<Page<DscNodeReportInner>>, Page<DscNodeReportInner>>() { @Override public Page<DscNodeReportInner> call(ServiceResponse<Page<DscNodeReportInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DscNodeReportInner", ">", ">", "listByNodeAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "automationAccountName", ",", "final", "String", "nodeId", ")", "{", "return", "listByNodeWithServiceRespo...
Retrieve the Dsc node report list by node id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeId The parameters supplied to the list operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DscNodeReportInner&gt; object
[ "Retrieve", "the", "Dsc", "node", "report", "list", "by", "node", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/NodeReportsInner.java#L130-L138
landawn/AbacusUtil
src/com/landawn/abacus/util/Matth.java
Matth.subtractExact
public static long subtractExact(long a, long b) { long result = a - b; checkNoOverflow((a ^ b) >= 0 | (a ^ result) >= 0); return result; }
java
public static long subtractExact(long a, long b) { long result = a - b; checkNoOverflow((a ^ b) >= 0 | (a ^ result) >= 0); return result; }
[ "public", "static", "long", "subtractExact", "(", "long", "a", ",", "long", "b", ")", "{", "long", "result", "=", "a", "-", "b", ";", "checkNoOverflow", "(", "(", "a", "^", "b", ")", ">=", "0", "|", "(", "a", "^", "result", ")", ">=", "0", ")",...
Returns the difference of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a - b} overflows in signed {@code long} arithmetic
[ "Returns", "the", "difference", "of", "{", "@code", "a", "}", "and", "{", "@code", "b", "}", "provided", "it", "does", "not", "overflow", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1404-L1408
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cdn_dedicated_serviceName_backend_duration_GET
public OvhOrder cdn_dedicated_serviceName_backend_duration_GET(String serviceName, String duration, Long backend) throws IOException { String qPath = "/order/cdn/dedicated/{serviceName}/backend/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "backend", backend); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder cdn_dedicated_serviceName_backend_duration_GET(String serviceName, String duration, Long backend) throws IOException { String qPath = "/order/cdn/dedicated/{serviceName}/backend/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "backend", backend); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "cdn_dedicated_serviceName_backend_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "Long", "backend", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cdn/dedicated/{serviceName}/backend/{duration}\"", ";"...
Get prices and contracts information REST: GET /order/cdn/dedicated/{serviceName}/backend/{duration} @param backend [required] Backend number that will be ordered @param serviceName [required] The internal name of your CDN offer @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5229-L5235
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toLong
public static Long toLong(Object value) { if (value == null) { return null; } else if (value instanceof Long) { return (Long) value; } else if (value instanceof Number) { return ((Number) value).longValue(); } else if (value instanceof java.util.Date) { return ((java.util.Date) value).getTime(); } else { try { return Long.valueOf(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to Long", e); } } }
java
public static Long toLong(Object value) { if (value == null) { return null; } else if (value instanceof Long) { return (Long) value; } else if (value instanceof Number) { return ((Number) value).longValue(); } else if (value instanceof java.util.Date) { return ((java.util.Date) value).getTime(); } else { try { return Long.valueOf(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to Long", e); } } }
[ "public", "static", "Long", "toLong", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "value", "instanceof", "Long", ")", "{", "return", "(", "Long", ")", "value", ";", "}...
Converts value to <code>Long</code> if it can. If value is a <code>Long</code>, it is returned, if it is a <code>Number</code>, it is promoted to <code>Long</code> and then returned, if it is a <code>Date</code>, returns its getTime() value, in all other cases, it converts the value to String, then tries to parse Long from it. @param value value to be converted to Long. @return value converted to Long.
[ "Converts", "value", "to", "<code", ">", "Long<", "/", "code", ">", "if", "it", "can", ".", "If", "value", "is", "a", "<code", ">", "Long<", "/", "code", ">", "it", "is", "returned", "if", "it", "is", "a", "<code", ">", "Number<", "/", "code", ">...
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L347-L363
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java
CudaZeroHandler.copyforward
@Override @Deprecated public void copyforward(AllocationPoint point, AllocationShape shape) { /* Technically that's just a case for relocate, with source as HOST and target point.getAllocationStatus() */ log.info("copyforward() called on tp[" + point.getObjectId() + "], shape: " + point.getShape()); //relocate(AllocationStatus.HOST, point.getAllocationStatus(), point, shape); throw new UnsupportedOperationException("Deprecated call"); }
java
@Override @Deprecated public void copyforward(AllocationPoint point, AllocationShape shape) { /* Technically that's just a case for relocate, with source as HOST and target point.getAllocationStatus() */ log.info("copyforward() called on tp[" + point.getObjectId() + "], shape: " + point.getShape()); //relocate(AllocationStatus.HOST, point.getAllocationStatus(), point, shape); throw new UnsupportedOperationException("Deprecated call"); }
[ "@", "Override", "@", "Deprecated", "public", "void", "copyforward", "(", "AllocationPoint", "point", ",", "AllocationShape", "shape", ")", "{", "/*\n Technically that's just a case for relocate, with source as HOST and target point.getAllocationStatus()\n */", "lo...
Copies memory from host buffer to device. Host copy is preserved as is. @param point
[ "Copies", "memory", "from", "host", "buffer", "to", "device", ".", "Host", "copy", "is", "preserved", "as", "is", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java#L470-L479
pebble/pebble-android-sdk
PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java
PebbleDictionary.addInt8
public void addInt8(final int key, final byte b) { PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.INT, PebbleTuple.Width.BYTE, b); addTuple(t); }
java
public void addInt8(final int key, final byte b) { PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.INT, PebbleTuple.Width.BYTE, b); addTuple(t); }
[ "public", "void", "addInt8", "(", "final", "int", "key", ",", "final", "byte", "b", ")", "{", "PebbleTuple", "t", "=", "PebbleTuple", ".", "create", "(", "key", ",", "PebbleTuple", ".", "TupleType", ".", "INT", ",", "PebbleTuple", ".", "Width", ".", "B...
Associate the specified signed byte with the provided key in the dictionary. If another key-value pair with the same key is already present in the dictionary, it will be replaced. @param key key with which the specified value is associated @param b value to be associated with the specified key
[ "Associate", "the", "specified", "signed", "byte", "with", "the", "provided", "key", "in", "the", "dictionary", ".", "If", "another", "key", "-", "value", "pair", "with", "the", "same", "key", "is", "already", "present", "in", "the", "dictionary", "it", "w...
train
https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java#L107-L110
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Parameters.java
Parameters.setValue
public Parameters setValue(@NonNull String name, Object value) { if (name == null) { throw new IllegalArgumentException("name cannot be null."); } if (readonly) { throw new IllegalStateException("Parameters is readonly mode."); } map.put(name, value); return this; }
java
public Parameters setValue(@NonNull String name, Object value) { if (name == null) { throw new IllegalArgumentException("name cannot be null."); } if (readonly) { throw new IllegalStateException("Parameters is readonly mode."); } map.put(name, value); return this; }
[ "public", "Parameters", "setValue", "(", "@", "NonNull", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"name cannot be null.\"", ")", ";", "}", "if", "(", "...
Set a value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The value. @return The self object.
[ "Set", "a", "value", "to", "the", "query", "parameter", "referenced", "by", "the", "given", "name", ".", "A", "query", "parameter", "is", "defined", "by", "using", "the", "Expression", "s", "parameter", "(", "String", "name", ")", "function", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L64-L69
Stratio/stratio-cassandra
src/java/org/apache/cassandra/config/TriggerDefinition.java
TriggerDefinition.deleteFromSchema
public void deleteFromSchema(Mutation mutation, String cfName, long timestamp) { ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF); int ldt = (int) (System.currentTimeMillis() / 1000); Composite prefix = CFMetaData.SchemaTriggersCf.comparator.make(cfName, name); cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt)); }
java
public void deleteFromSchema(Mutation mutation, String cfName, long timestamp) { ColumnFamily cf = mutation.addOrGet(SystemKeyspace.SCHEMA_TRIGGERS_CF); int ldt = (int) (System.currentTimeMillis() / 1000); Composite prefix = CFMetaData.SchemaTriggersCf.comparator.make(cfName, name); cf.addAtom(new RangeTombstone(prefix, prefix.end(), timestamp, ldt)); }
[ "public", "void", "deleteFromSchema", "(", "Mutation", "mutation", ",", "String", "cfName", ",", "long", "timestamp", ")", "{", "ColumnFamily", "cf", "=", "mutation", ".", "addOrGet", "(", "SystemKeyspace", ".", "SCHEMA_TRIGGERS_CF", ")", ";", "int", "ldt", "=...
Drop specified trigger from the schema using given mutation. @param mutation The schema mutation @param cfName The name of the parent ColumnFamily @param timestamp The timestamp to use for the tombstone
[ "Drop", "specified", "trigger", "from", "the", "schema", "using", "given", "mutation", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/TriggerDefinition.java#L99-L106
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/ExposeLinearLayoutManagerEx.java
ExposeLinearLayoutManagerEx.recycleChildren
protected void recycleChildren(RecyclerView.Recycler recycler, int startIndex, int endIndex) { if (startIndex == endIndex) { return; } if (DEBUG) { Log.d(TAG, "Recycling " + Math.abs(startIndex - endIndex) + " items"); } if (endIndex > startIndex) { for (int i = endIndex - 1; i >= startIndex; i--) { removeAndRecycleViewAt(i, recycler); } } else { for (int i = startIndex; i > endIndex; i--) { removeAndRecycleViewAt(i, recycler); } } }
java
protected void recycleChildren(RecyclerView.Recycler recycler, int startIndex, int endIndex) { if (startIndex == endIndex) { return; } if (DEBUG) { Log.d(TAG, "Recycling " + Math.abs(startIndex - endIndex) + " items"); } if (endIndex > startIndex) { for (int i = endIndex - 1; i >= startIndex; i--) { removeAndRecycleViewAt(i, recycler); } } else { for (int i = startIndex; i > endIndex; i--) { removeAndRecycleViewAt(i, recycler); } } }
[ "protected", "void", "recycleChildren", "(", "RecyclerView", ".", "Recycler", "recycler", ",", "int", "startIndex", ",", "int", "endIndex", ")", "{", "if", "(", "startIndex", "==", "endIndex", ")", "{", "return", ";", "}", "if", "(", "DEBUG", ")", "{", "...
Recycles children between given indices. @param startIndex inclusive @param endIndex exclusive
[ "Recycles", "children", "between", "given", "indices", "." ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/ExposeLinearLayoutManagerEx.java#L1015-L1031
jroyalty/jglm
src/main/java/com/hackoeur/jglm/support/FastMathCalc.java
FastMathCalc.expint
static double expint(int p, final double result[]) { //double x = M_E; final double xs[] = new double[2]; final double as[] = new double[2]; final double ys[] = new double[2]; //split(x, xs); //xs[1] = (double)(2.7182818284590452353602874713526625L - xs[0]); //xs[0] = 2.71827697753906250000; //xs[1] = 4.85091998273542816811e-06; //xs[0] = Double.longBitsToDouble(0x4005bf0800000000L); //xs[1] = Double.longBitsToDouble(0x3ed458a2bb4a9b00L); /* E */ xs[0] = 2.718281828459045; xs[1] = 1.4456468917292502E-16; split(1.0, ys); while (p > 0) { if ((p & 1) != 0) { quadMult(ys, xs, as); ys[0] = as[0]; ys[1] = as[1]; } quadMult(xs, xs, as); xs[0] = as[0]; xs[1] = as[1]; p >>= 1; } if (result != null) { result[0] = ys[0]; result[1] = ys[1]; resplit(result); } return ys[0] + ys[1]; }
java
static double expint(int p, final double result[]) { //double x = M_E; final double xs[] = new double[2]; final double as[] = new double[2]; final double ys[] = new double[2]; //split(x, xs); //xs[1] = (double)(2.7182818284590452353602874713526625L - xs[0]); //xs[0] = 2.71827697753906250000; //xs[1] = 4.85091998273542816811e-06; //xs[0] = Double.longBitsToDouble(0x4005bf0800000000L); //xs[1] = Double.longBitsToDouble(0x3ed458a2bb4a9b00L); /* E */ xs[0] = 2.718281828459045; xs[1] = 1.4456468917292502E-16; split(1.0, ys); while (p > 0) { if ((p & 1) != 0) { quadMult(ys, xs, as); ys[0] = as[0]; ys[1] = as[1]; } quadMult(xs, xs, as); xs[0] = as[0]; xs[1] = as[1]; p >>= 1; } if (result != null) { result[0] = ys[0]; result[1] = ys[1]; resplit(result); } return ys[0] + ys[1]; }
[ "static", "double", "expint", "(", "int", "p", ",", "final", "double", "result", "[", "]", ")", "{", "//double x = M_E;", "final", "double", "xs", "[", "]", "=", "new", "double", "[", "2", "]", ";", "final", "double", "as", "[", "]", "=", "new", "d...
Compute exp(p) for a integer p in extended precision. @param p integer whose exponential is requested @param result placeholder where to put the result in extended precision @return exp(p) in standard precision (equal to result[0] + result[1])
[ "Compute", "exp", "(", "p", ")", "for", "a", "integer", "p", "in", "extended", "precision", "." ]
train
https://github.com/jroyalty/jglm/blob/9397c2fcf0d4d62844c64d0b14065ee7bf8cafc6/src/main/java/com/hackoeur/jglm/support/FastMathCalc.java#L490-L528
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java
LatLongUtils.distanceSegmentPoint
public static double distanceSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY) { Point nearest = nearestSegmentPoint(startX, startY, endX, endY, pointX, pointY); return Math.hypot(nearest.x - pointX, nearest.y - pointY); }
java
public static double distanceSegmentPoint(double startX, double startY, double endX, double endY, double pointX, double pointY) { Point nearest = nearestSegmentPoint(startX, startY, endX, endY, pointX, pointY); return Math.hypot(nearest.x - pointX, nearest.y - pointY); }
[ "public", "static", "double", "distanceSegmentPoint", "(", "double", "startX", ",", "double", "startY", ",", "double", "endX", ",", "double", "endY", ",", "double", "pointX", ",", "double", "pointY", ")", "{", "Point", "nearest", "=", "nearestSegmentPoint", "(...
Returns the distance between the given segment and point. <p> libGDX (Apache 2.0)
[ "Returns", "the", "distance", "between", "the", "given", "segment", "and", "point", ".", "<p", ">", "libGDX", "(", "Apache", "2", ".", "0", ")" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java#L167-L170
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.isSubclass
public static boolean isSubclass(String superclass, String otherclass) { String key; key = superclass + "-" + otherclass; if (m_CheckSubClass.containsKey(key)) return m_CheckSubClass.get(key); try { return isSubclass(Class.forName(superclass), Class.forName(otherclass)); } catch (Throwable t) { return false; } }
java
public static boolean isSubclass(String superclass, String otherclass) { String key; key = superclass + "-" + otherclass; if (m_CheckSubClass.containsKey(key)) return m_CheckSubClass.get(key); try { return isSubclass(Class.forName(superclass), Class.forName(otherclass)); } catch (Throwable t) { return false; } }
[ "public", "static", "boolean", "isSubclass", "(", "String", "superclass", ",", "String", "otherclass", ")", "{", "String", "key", ";", "key", "=", "superclass", "+", "\"-\"", "+", "otherclass", ";", "if", "(", "m_CheckSubClass", ".", "containsKey", "(", "key...
Checks whether the "otherclass" is a subclass of the given "superclass". @param superclass the superclass to check against @param otherclass this class is checked whether it is a subclass of the the superclass @return TRUE if "otherclass" is a true subclass
[ "Checks", "whether", "the", "otherclass", "is", "a", "subclass", "of", "the", "given", "superclass", "." ]
train
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L588-L601
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/reflect/AbstractFixture.java
AbstractFixture.getField
protected Field getField(Class type, String name) { return introspector(type).getField( toJavaIdentifierForm(name)); }
java
protected Field getField(Class type, String name) { return introspector(type).getField( toJavaIdentifierForm(name)); }
[ "protected", "Field", "getField", "(", "Class", "type", ",", "String", "name", ")", "{", "return", "introspector", "(", "type", ")", ".", "getField", "(", "toJavaIdentifierForm", "(", "name", ")", ")", ";", "}" ]
<p>getField.</p> @param type a {@link java.lang.Class} object. @param name a {@link java.lang.String} object. @return a {@link java.lang.reflect.Field} object.
[ "<p", ">", "getField", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/reflect/AbstractFixture.java#L106-L109
IBM/ibm-cos-sdk-java
ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/iterable/S3Objects.java
S3Objects.withPrefix
public static S3Objects withPrefix(AmazonS3 s3, String bucketName, String prefix) { S3Objects objects = new S3Objects(s3, bucketName); objects.prefix = prefix; return objects; }
java
public static S3Objects withPrefix(AmazonS3 s3, String bucketName, String prefix) { S3Objects objects = new S3Objects(s3, bucketName); objects.prefix = prefix; return objects; }
[ "public", "static", "S3Objects", "withPrefix", "(", "AmazonS3", "s3", ",", "String", "bucketName", ",", "String", "prefix", ")", "{", "S3Objects", "objects", "=", "new", "S3Objects", "(", "s3", ",", "bucketName", ")", ";", "objects", ".", "prefix", "=", "p...
Constructs an iterable that covers the objects in an Amazon S3 bucket where the key begins with the given prefix. @param s3 The Amazon S3 client. @param bucketName The bucket name. @param prefix The prefix. @return An iterator for object summaries.
[ "Constructs", "an", "iterable", "that", "covers", "the", "objects", "in", "an", "Amazon", "S3", "bucket", "where", "the", "key", "begins", "with", "the", "given", "prefix", "." ]
train
https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/iterable/S3Objects.java#L76-L80
liyiorg/weixin-popular
src/main/java/weixin/popular/api/UserAPI.java
UserAPI.userInfoUpdateremark
public static BaseResult userInfoUpdateremark(String access_token,String openid,String remark){ String postJson = String.format("{\"openid\":\"%1$s\",\"remark\":\"%2$s\"}", openid,remark); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI+"/cgi-bin/user/info/updateremark") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(postJson,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); }
java
public static BaseResult userInfoUpdateremark(String access_token,String openid,String remark){ String postJson = String.format("{\"openid\":\"%1$s\",\"remark\":\"%2$s\"}", openid,remark); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI+"/cgi-bin/user/info/updateremark") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(postJson,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); }
[ "public", "static", "BaseResult", "userInfoUpdateremark", "(", "String", "access_token", ",", "String", "openid", ",", "String", "remark", ")", "{", "String", "postJson", "=", "String", ".", "format", "(", "\"{\\\"openid\\\":\\\"%1$s\\\",\\\"remark\\\":\\\"%2$s\\\"}\"", ...
设置备注名 @param access_token access_token @param openid openid @param remark remark @return BaseResult
[ "设置备注名" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/UserAPI.java#L144-L153
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.getSnapshot
public GetSnapshotResponse getSnapshot(GetSnapshotRequest request) { checkNotNull(request, "request should not be null."); checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX, request.getSnapshotId()); return invokeHttpClient(internalRequest, GetSnapshotResponse.class); }
java
public GetSnapshotResponse getSnapshot(GetSnapshotRequest request) { checkNotNull(request, "request should not be null."); checkStringNotEmpty(request.getSnapshotId(), "request snapshotId should no be empty."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, SNAPSHOT_PREFIX, request.getSnapshotId()); return invokeHttpClient(internalRequest, GetSnapshotResponse.class); }
[ "public", "GetSnapshotResponse", "getSnapshot", "(", "GetSnapshotRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getSnapshotId", "(", ")", ",", "\"request snaps...
Getting the detail information of specified snapshot. @param request The request containing all options for getting the detail information of specified snapshot. @return The response with the snapshot detail information.
[ "Getting", "the", "detail", "information", "of", "specified", "snapshot", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1456-L1462
eclipse/hawkbit
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/groupschart/GroupsPieChart.java
GroupsPieChart.setChartState
public void setChartState(final List<Long> groupTargetCounts, final Long totalTargetsCount) { getState().setGroupTargetCounts(groupTargetCounts); getState().setTotalTargetCount(totalTargetsCount); markAsDirty(); }
java
public void setChartState(final List<Long> groupTargetCounts, final Long totalTargetsCount) { getState().setGroupTargetCounts(groupTargetCounts); getState().setTotalTargetCount(totalTargetsCount); markAsDirty(); }
[ "public", "void", "setChartState", "(", "final", "List", "<", "Long", ">", "groupTargetCounts", ",", "final", "Long", "totalTargetsCount", ")", "{", "getState", "(", ")", ".", "setGroupTargetCounts", "(", "groupTargetCounts", ")", ";", "getState", "(", ")", "....
Updates the state of the chart @param groupTargetCounts list of target counts @param totalTargetsCount total count of targets that are represented by the pie
[ "Updates", "the", "state", "of", "the", "chart" ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/rollout/groupschart/GroupsPieChart.java#L32-L36
googleapis/google-cloud-java
google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java
ConfigClient.createExclusion
public final LogExclusion createExclusion(String parent, LogExclusion exclusion) { CreateExclusionRequest request = CreateExclusionRequest.newBuilder().setParent(parent).setExclusion(exclusion).build(); return createExclusion(request); }
java
public final LogExclusion createExclusion(String parent, LogExclusion exclusion) { CreateExclusionRequest request = CreateExclusionRequest.newBuilder().setParent(parent).setExclusion(exclusion).build(); return createExclusion(request); }
[ "public", "final", "LogExclusion", "createExclusion", "(", "String", "parent", ",", "LogExclusion", "exclusion", ")", "{", "CreateExclusionRequest", "request", "=", "CreateExclusionRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "...
Creates a new exclusion in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource. <p>Sample code: <pre><code> try (ConfigClient configClient = ConfigClient.create()) { ParentName parent = ProjectName.of("[PROJECT]"); LogExclusion exclusion = LogExclusion.newBuilder().build(); LogExclusion response = configClient.createExclusion(parent.toString(), exclusion); } </code></pre> @param parent Required. The parent resource in which to create the exclusion: <p>"projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]" "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" <p>Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. @param exclusion Required. The new exclusion, whose `name` parameter is an exclusion name that is not already used in the parent resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "exclusion", "in", "a", "specified", "parent", "resource", ".", "Only", "log", "entries", "belonging", "to", "that", "resource", "can", "be", "excluded", ".", "You", "can", "have", "up", "to", "10", "exclusions", "in", "a", "resource...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/ConfigClient.java#L1147-L1152
LearnLib/automatalib
util/src/main/java/net/automatalib/util/automata/fsa/DFAs.java
DFAs.isPrefixClosed
public static <S, I> boolean isPrefixClosed(DFA<S, I> dfa, Alphabet<I> alphabet) { return dfa.getStates() .parallelStream() .allMatch(s -> dfa.isAccepting(s) || alphabet.parallelStream().noneMatch(i -> dfa.isAccepting(dfa.getSuccessors(s, i)))); }
java
public static <S, I> boolean isPrefixClosed(DFA<S, I> dfa, Alphabet<I> alphabet) { return dfa.getStates() .parallelStream() .allMatch(s -> dfa.isAccepting(s) || alphabet.parallelStream().noneMatch(i -> dfa.isAccepting(dfa.getSuccessors(s, i)))); }
[ "public", "static", "<", "S", ",", "I", ">", "boolean", "isPrefixClosed", "(", "DFA", "<", "S", ",", "I", ">", "dfa", ",", "Alphabet", "<", "I", ">", "alphabet", ")", "{", "return", "dfa", ".", "getStates", "(", ")", ".", "parallelStream", "(", ")"...
Computes whether the language of the given DFA is prefix-closed. Assumes all states in the given {@link DFA} are reachable from the initial state. @param dfa the DFA to check @param alphabet the Alphabet @param <S> the type of state @param <I> the type of input @return whether the DFA is prefix-closed.
[ "Computes", "whether", "the", "language", "of", "the", "given", "DFA", "is", "prefix", "-", "closed", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/fsa/DFAs.java#L384-L389
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java
LocaleFormatter.getFormatted
@Nonnull public static String getFormatted (@Nonnull final BigDecimal aValue, @Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aValue, "Value"); ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return NumberFormat.getInstance (aDisplayLocale).format (aValue); }
java
@Nonnull public static String getFormatted (@Nonnull final BigDecimal aValue, @Nonnull final Locale aDisplayLocale) { ValueEnforcer.notNull (aValue, "Value"); ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale"); return NumberFormat.getInstance (aDisplayLocale).format (aValue); }
[ "@", "Nonnull", "public", "static", "String", "getFormatted", "(", "@", "Nonnull", "final", "BigDecimal", "aValue", ",", "@", "Nonnull", "final", "Locale", "aDisplayLocale", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aValue", ",", "\"Value\"", ")", ";", ...
Format the passed value according to the rules specified by the given locale. All calls to {@link BigDecimal#toString()} that are displayed to the user should instead use this method. By default a maximum of 3 fraction digits are shown. @param aValue The value to be formatted. May not be <code>null</code>. @param aDisplayLocale The locale to be used. May not be <code>null</code>. @return The formatted string.
[ "Format", "the", "passed", "value", "according", "to", "the", "rules", "specified", "by", "the", "given", "locale", ".", "All", "calls", "to", "{", "@link", "BigDecimal#toString", "()", "}", "that", "are", "displayed", "to", "the", "user", "should", "instead...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java#L134-L141
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java
Strs.endAny
public static boolean endAny(String target, List<String> endWith) { if (isNull(target)) { return false; } return matcher(target).ends(endWith); }
java
public static boolean endAny(String target, List<String> endWith) { if (isNull(target)) { return false; } return matcher(target).ends(endWith); }
[ "public", "static", "boolean", "endAny", "(", "String", "target", ",", "List", "<", "String", ">", "endWith", ")", "{", "if", "(", "isNull", "(", "target", ")", ")", "{", "return", "false", ";", "}", "return", "matcher", "(", "target", ")", ".", "end...
Check if target string ends with any of a list of specified strings. @param target @param endWith @return
[ "Check", "if", "target", "string", "ends", "with", "any", "of", "a", "list", "of", "specified", "strings", "." ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L314-L320
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndex.java
RuleIndex.searchAll
public Iterator<Integer> searchAll(RuleQuery query) { SearchRequestBuilder esSearch = client .prepareSearch(TYPE_RULE) .setScroll(TimeValue.timeValueMinutes(SCROLL_TIME_IN_MINUTES)); optimizeScrollRequest(esSearch); QueryBuilder qb = buildQuery(query); Map<String, QueryBuilder> filters = buildFilters(query); BoolQueryBuilder fb = boolQuery(); for (QueryBuilder filterBuilder : filters.values()) { fb.must(filterBuilder); } esSearch.setQuery(boolQuery().must(qb).filter(fb)); SearchResponse response = esSearch.get(); return scrollIds(client, response, Integer::parseInt); }
java
public Iterator<Integer> searchAll(RuleQuery query) { SearchRequestBuilder esSearch = client .prepareSearch(TYPE_RULE) .setScroll(TimeValue.timeValueMinutes(SCROLL_TIME_IN_MINUTES)); optimizeScrollRequest(esSearch); QueryBuilder qb = buildQuery(query); Map<String, QueryBuilder> filters = buildFilters(query); BoolQueryBuilder fb = boolQuery(); for (QueryBuilder filterBuilder : filters.values()) { fb.must(filterBuilder); } esSearch.setQuery(boolQuery().must(qb).filter(fb)); SearchResponse response = esSearch.get(); return scrollIds(client, response, Integer::parseInt); }
[ "public", "Iterator", "<", "Integer", ">", "searchAll", "(", "RuleQuery", "query", ")", "{", "SearchRequestBuilder", "esSearch", "=", "client", ".", "prepareSearch", "(", "TYPE_RULE", ")", ".", "setScroll", "(", "TimeValue", ".", "timeValueMinutes", "(", "SCROLL...
Return all rule ids matching the search query, without pagination nor facets
[ "Return", "all", "rule", "ids", "matching", "the", "search", "query", "without", "pagination", "nor", "facets" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndex.java#L172-L189
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java
ThreadGroupTracker.getThreadGroup
ThreadGroup getThreadGroup(String identifier, String threadFactoryName, ThreadGroup parentGroup) { ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup = metadataIdentifierToThreadGroups.get(identifier); if (threadFactoryToThreadGroup == null) if (metadataIdentifierService.isMetaDataAvailable(identifier)) { threadFactoryToThreadGroup = new ConcurrentHashMap<String, ThreadGroup>(); ConcurrentHashMap<String, ThreadGroup> added = metadataIdentifierToThreadGroups.putIfAbsent(identifier, threadFactoryToThreadGroup); if (added != null) threadFactoryToThreadGroup = added; } else throw new IllegalStateException(identifier.toString()); ThreadGroup group = threadFactoryToThreadGroup.get(threadFactoryName); if (group == null) group = AccessController.doPrivileged(new CreateThreadGroupIfAbsentAction(parentGroup, threadFactoryName, identifier, threadFactoryToThreadGroup), serverAccessControlContext); return group; }
java
ThreadGroup getThreadGroup(String identifier, String threadFactoryName, ThreadGroup parentGroup) { ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup = metadataIdentifierToThreadGroups.get(identifier); if (threadFactoryToThreadGroup == null) if (metadataIdentifierService.isMetaDataAvailable(identifier)) { threadFactoryToThreadGroup = new ConcurrentHashMap<String, ThreadGroup>(); ConcurrentHashMap<String, ThreadGroup> added = metadataIdentifierToThreadGroups.putIfAbsent(identifier, threadFactoryToThreadGroup); if (added != null) threadFactoryToThreadGroup = added; } else throw new IllegalStateException(identifier.toString()); ThreadGroup group = threadFactoryToThreadGroup.get(threadFactoryName); if (group == null) group = AccessController.doPrivileged(new CreateThreadGroupIfAbsentAction(parentGroup, threadFactoryName, identifier, threadFactoryToThreadGroup), serverAccessControlContext); return group; }
[ "ThreadGroup", "getThreadGroup", "(", "String", "identifier", ",", "String", "threadFactoryName", ",", "ThreadGroup", "parentGroup", ")", "{", "ConcurrentHashMap", "<", "String", ",", "ThreadGroup", ">", "threadFactoryToThreadGroup", "=", "metadataIdentifierToThreadGroups",...
Returns the thread group to use for the specified application component. @param jeeName name of the application component @param threadFactoryName unique identifier for the thread factory @param parentGroup parent thread group @return child thread group for the application component. Null if the application component isn't active. @throws IllegalStateException if the application component is not available.
[ "Returns", "the", "thread", "group", "to", "use", "for", "the", "specified", "application", "component", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java#L107-L123
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java
JpaHelper.toSeparatedString
public static String toSeparatedString(List<?> values, String separator) { return toSeparatedString(values, separator, null); }
java
public static String toSeparatedString(List<?> values, String separator) { return toSeparatedString(values, separator, null); }
[ "public", "static", "String", "toSeparatedString", "(", "List", "<", "?", ">", "values", ",", "String", "separator", ")", "{", "return", "toSeparatedString", "(", "values", ",", "separator", ",", "null", ")", ";", "}" ]
build a single String from a List of objects with a given separator @param values @param separator @return
[ "build", "a", "single", "String", "from", "a", "List", "of", "objects", "with", "a", "given", "separator" ]
train
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/accessimpl/jpa/JpaHelper.java#L285-L287
undertow-io/undertow
core/src/main/java/io/undertow/util/FlexBase64.java
FlexBase64.encodeString
public static String encodeString(byte[] source, boolean wrap) { return Encoder.encodeString(source, 0, source.length, wrap, false); }
java
public static String encodeString(byte[] source, boolean wrap) { return Encoder.encodeString(source, 0, source.length, wrap, false); }
[ "public", "static", "String", "encodeString", "(", "byte", "[", "]", "source", ",", "boolean", "wrap", ")", "{", "return", "Encoder", ".", "encodeString", "(", "source", ",", "0", ",", "source", ".", "length", ",", "wrap", ",", "false", ")", ";", "}" ]
Encodes a fixed and complete byte array into a Base64 String. <p>This method is only useful for applications which require a String and have all data to be encoded up-front. Note that byte arrays or buffers are almost always a better storage choice. They consume half the memory and can be reused (modified). In other words, it is almost always better to use {@link #encodeBytes}, {@link #createEncoder}, or {@link #createEncoderOutputStream} instead. instead. @param source the byte array to encode from @param wrap whether or not to wrap the output at 76 chars with CRLFs @return a new String representing the Base64 output
[ "Encodes", "a", "fixed", "and", "complete", "byte", "array", "into", "a", "Base64", "String", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L148-L150
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/document/association/impl/DocumentHelpers.java
DocumentHelpers.getColumnSharedPrefix
public static String getColumnSharedPrefix(String[] associationKeyColumns) { String prefix = null; for ( String column : associationKeyColumns ) { String newPrefix = getPrefix( column ); if ( prefix == null ) { // first iteration prefix = newPrefix; if ( prefix == null ) { // no prefix, quit break; } } else { // subsequent iterations if ( ! equals( prefix, newPrefix ) ) { // different prefixes prefix = null; break; } } } return prefix; }
java
public static String getColumnSharedPrefix(String[] associationKeyColumns) { String prefix = null; for ( String column : associationKeyColumns ) { String newPrefix = getPrefix( column ); if ( prefix == null ) { // first iteration prefix = newPrefix; if ( prefix == null ) { // no prefix, quit break; } } else { // subsequent iterations if ( ! equals( prefix, newPrefix ) ) { // different prefixes prefix = null; break; } } } return prefix; }
[ "public", "static", "String", "getColumnSharedPrefix", "(", "String", "[", "]", "associationKeyColumns", ")", "{", "String", "prefix", "=", "null", ";", "for", "(", "String", "column", ":", "associationKeyColumns", ")", "{", "String", "newPrefix", "=", "getPrefi...
Returns the shared prefix of these columns. Null otherwise. @param associationKeyColumns the columns sharing a prefix @return the shared prefix of these columns. {@code null} otherwise.
[ "Returns", "the", "shared", "prefix", "of", "these", "columns", ".", "Null", "otherwise", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/association/impl/DocumentHelpers.java#L36-L54
att/AAF
authz/authz-cass/src/main/java/com/att/dao/CachedDAO.java
CachedDAO.read
public Result<List<DATA>> read(final String key, final TRANS trans, final Object ... objs) { DAOGetter getter = new DAOGetter(trans,dao,objs); return get(trans, key, getter); // if(ld!=null) { // return Result.ok(ld);//.emptyList(ld.isEmpty()); // } // // Result Result if exists // if(getter.result==null) { // return Result.err(Status.ERR_NotFound, "No Cache or Lookup found on [%s]",dao.table()); // } // return getter.result; }
java
public Result<List<DATA>> read(final String key, final TRANS trans, final Object ... objs) { DAOGetter getter = new DAOGetter(trans,dao,objs); return get(trans, key, getter); // if(ld!=null) { // return Result.ok(ld);//.emptyList(ld.isEmpty()); // } // // Result Result if exists // if(getter.result==null) { // return Result.err(Status.ERR_NotFound, "No Cache or Lookup found on [%s]",dao.table()); // } // return getter.result; }
[ "public", "Result", "<", "List", "<", "DATA", ">", ">", "read", "(", "final", "String", "key", ",", "final", "TRANS", "trans", ",", "final", "Object", "...", "objs", ")", "{", "DAOGetter", "getter", "=", "new", "DAOGetter", "(", "trans", ",", "dao", ...
Slight Improved performance available when String and Obj versions are known.
[ "Slight", "Improved", "performance", "available", "when", "String", "and", "Obj", "versions", "are", "known", "." ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/CachedDAO.java#L141-L152
Clivern/Racter
src/main/java/com/clivern/racter/senders/templates/MessageTemplate.java
MessageTemplate.setQuickReply
public void setQuickReply(String content_type, String title, String payload, String image_url) { HashMap<String, String> quick_reply = new HashMap<String, String>(); quick_reply.put("content_type", content_type); quick_reply.put("title", title); quick_reply.put("payload", payload); quick_reply.put("image_url", image_url); this.message_quick_replies.add(quick_reply); }
java
public void setQuickReply(String content_type, String title, String payload, String image_url) { HashMap<String, String> quick_reply = new HashMap<String, String>(); quick_reply.put("content_type", content_type); quick_reply.put("title", title); quick_reply.put("payload", payload); quick_reply.put("image_url", image_url); this.message_quick_replies.add(quick_reply); }
[ "public", "void", "setQuickReply", "(", "String", "content_type", ",", "String", "title", ",", "String", "payload", ",", "String", "image_url", ")", "{", "HashMap", "<", "String", ",", "String", ">", "quick_reply", "=", "new", "HashMap", "<", "String", ",", ...
Set Quick Reply @param content_type the content type @param title the title @param payload the payload flag @param image_url the image URL
[ "Set", "Quick", "Reply" ]
train
https://github.com/Clivern/Racter/blob/bbde02f0c2a8a80653ad6b1607376d8408acd71c/src/main/java/com/clivern/racter/senders/templates/MessageTemplate.java#L117-L125
digipost/signature-api-client-java
src/main/java/no/digipost/signature/client/direct/DirectJobStatusResponse.java
DirectJobStatusResponse.noUpdatedStatus
static DirectJobStatusResponse noUpdatedStatus(Instant nextPermittedPollTime) { return new DirectJobStatusResponse(null, null, NO_CHANGES, null, null, null, null, nextPermittedPollTime) { @Override public long getSignatureJobId() { throw new IllegalStateException( "There were " + this + ", and querying the job ID is a programming error. " + "Use the method is(" + DirectJobStatusResponse.class.getSimpleName() + "." + NO_CHANGES.name() + ") " + "to check if there were any status change before attempting to get any further information."); } @Override public String toString() { return "no direct jobs with updated status"; } }; }
java
static DirectJobStatusResponse noUpdatedStatus(Instant nextPermittedPollTime) { return new DirectJobStatusResponse(null, null, NO_CHANGES, null, null, null, null, nextPermittedPollTime) { @Override public long getSignatureJobId() { throw new IllegalStateException( "There were " + this + ", and querying the job ID is a programming error. " + "Use the method is(" + DirectJobStatusResponse.class.getSimpleName() + "." + NO_CHANGES.name() + ") " + "to check if there were any status change before attempting to get any further information."); } @Override public String toString() { return "no direct jobs with updated status"; } }; }
[ "static", "DirectJobStatusResponse", "noUpdatedStatus", "(", "Instant", "nextPermittedPollTime", ")", "{", "return", "new", "DirectJobStatusResponse", "(", "null", ",", "null", ",", "NO_CHANGES", ",", "null", ",", "null", ",", "null", ",", "null", ",", "nextPermit...
This instance indicates that there has been no status updates since the last poll request for {@link DirectJobStatusResponse}. Its status is {@link DirectJobStatus#NO_CHANGES NO_CHANGES}.
[ "This", "instance", "indicates", "that", "there", "has", "been", "no", "status", "updates", "since", "the", "last", "poll", "request", "for", "{" ]
train
https://github.com/digipost/signature-api-client-java/blob/246207571641fbac6beda5ffc585eec188825c45/src/main/java/no/digipost/signature/client/direct/DirectJobStatusResponse.java#L21-L35
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionManager.java
CustomVisionPredictionManager.authenticate
public static PredictionEndpoint authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) { return new PredictionEndpointImpl(baseUrl, credentials).withApiKey(apiKey); }
java
public static PredictionEndpoint authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) { return new PredictionEndpointImpl(baseUrl, credentials).withApiKey(apiKey); }
[ "public", "static", "PredictionEndpoint", "authenticate", "(", "String", "baseUrl", ",", "ServiceClientCredentials", "credentials", ",", "final", "String", "apiKey", ")", "{", "return", "new", "PredictionEndpointImpl", "(", "baseUrl", ",", "credentials", ")", ".", "...
Initializes an instance of Custom Vision Prediction API client. @param baseUrl the base URL of the service @param credentials the management credentials for Azure @param apiKey the Custom Vision Prediction API key @return the Custom Vision Prediction API client
[ "Initializes", "an", "instance", "of", "Custom", "Vision", "Prediction", "API", "client", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionManager.java#L63-L65
apache/flink
flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java
DefaultConfigurableOptionsFactory.setInternal
private void setInternal(String key, String value) { Preconditions.checkArgument(value != null && !value.isEmpty(), "The configuration value must not be empty."); configuredOptions.put(key, value); }
java
private void setInternal(String key, String value) { Preconditions.checkArgument(value != null && !value.isEmpty(), "The configuration value must not be empty."); configuredOptions.put(key, value); }
[ "private", "void", "setInternal", "(", "String", "key", ",", "String", "value", ")", "{", "Preconditions", ".", "checkArgument", "(", "value", "!=", "null", "&&", "!", "value", ".", "isEmpty", "(", ")", ",", "\"The configuration value must not be empty.\"", ")",...
Sets the configuration with (key, value) if the key is predefined, otherwise throws IllegalArgumentException. @param key The configuration key, if key is not predefined, throws IllegalArgumentException out. @param value The configuration value.
[ "Sets", "the", "configuration", "with", "(", "key", "value", ")", "if", "the", "key", "is", "predefined", "otherwise", "throws", "IllegalArgumentException", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/DefaultConfigurableOptionsFactory.java#L407-L412
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java
UnsignedUtils.digit
public static int digit(char c, int radix) { for (int i = 0; i < MAX_RADIX && i < radix; i++) { if (digits[i] == c) { return i; } } return -1; }
java
public static int digit(char c, int radix) { for (int i = 0; i < MAX_RADIX && i < radix; i++) { if (digits[i] == c) { return i; } } return -1; }
[ "public", "static", "int", "digit", "(", "char", "c", ",", "int", "radix", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "MAX_RADIX", "&&", "i", "<", "radix", ";", "i", "++", ")", "{", "if", "(", "digits", "[", "i", "]", "==", ...
Returns the numeric value of the character {@code c} in the specified radix. @param c @param radix @return @see #MAX_RADIX
[ "Returns", "the", "numeric", "value", "of", "the", "character", "{", "@code", "c", "}", "in", "the", "specified", "radix", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java#L55-L62
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/TableDefinition.java
TableDefinition.extractLinkValue
public boolean extractLinkValue(String colName, Map<String, Set<String>> mvLinkValueMap) { // Link column names always begin with '~'. if (colName.length() == 0 || colName.charAt(0) != '~') { return false; } // A '/' should separate the field name and object value. int slashInx = colName.indexOf('/'); if (slashInx < 0) { return false; } // Extract the field name and ensure we know about this field. String fieldName = colName.substring(1, slashInx); // Extract the link value's target object ID and add it to the value set for the field. String linkValue = colName.substring(slashInx + 1); Set<String> valueSet = mvLinkValueMap.get(fieldName); if (valueSet == null) { // First value for this field. valueSet = new HashSet<String>(); mvLinkValueMap.put(fieldName, valueSet); } valueSet.add(linkValue); return true; }
java
public boolean extractLinkValue(String colName, Map<String, Set<String>> mvLinkValueMap) { // Link column names always begin with '~'. if (colName.length() == 0 || colName.charAt(0) != '~') { return false; } // A '/' should separate the field name and object value. int slashInx = colName.indexOf('/'); if (slashInx < 0) { return false; } // Extract the field name and ensure we know about this field. String fieldName = colName.substring(1, slashInx); // Extract the link value's target object ID and add it to the value set for the field. String linkValue = colName.substring(slashInx + 1); Set<String> valueSet = mvLinkValueMap.get(fieldName); if (valueSet == null) { // First value for this field. valueSet = new HashSet<String>(); mvLinkValueMap.put(fieldName, valueSet); } valueSet.add(linkValue); return true; }
[ "public", "boolean", "extractLinkValue", "(", "String", "colName", ",", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "mvLinkValueMap", ")", "{", "// Link column names always begin with '~'.\r", "if", "(", "colName", ".", "length", "(", ")", "==", ...
Examine the given column name and, if it represents an MV link value, add it to the given MV link value map. If a link value is successfully extracted, true is returned. If the column name is not in the format used for MV link values, false is returned. @param colName Column name from an object record belonging to this table (in string form). @param mvLinkValueMap Link value map to be updated if the column represents a valid link value. @return True if a link value is extracted and added to the map; false means the column name was not a link value.
[ "Examine", "the", "given", "column", "name", "and", "if", "it", "represents", "an", "MV", "link", "value", "add", "it", "to", "the", "given", "MV", "link", "value", "map", ".", "If", "a", "link", "value", "is", "successfully", "extracted", "true", "is", ...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/TableDefinition.java#L672-L697
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/Noun.java
Noun.addSingular
public static void addSingular(String match, String rule, boolean insensitive){ singulars.add(0, new Replacer(match, rule, insensitive)); }
java
public static void addSingular(String match, String rule, boolean insensitive){ singulars.add(0, new Replacer(match, rule, insensitive)); }
[ "public", "static", "void", "addSingular", "(", "String", "match", ",", "String", "rule", ",", "boolean", "insensitive", ")", "{", "singulars", ".", "add", "(", "0", ",", "new", "Replacer", "(", "match", ",", "rule", ",", "insensitive", ")", ")", ";", ...
<p>Add a match pattern and replacement rule for converting addSingular forms to addPlural forms.</p> @param match Match pattern regular expression @param rule Replacement rule @param insensitive Flag indicating this match should be case insensitive
[ "<p", ">", "Add", "a", "match", "pattern", "and", "replacement", "rule", "for", "converting", "addSingular", "forms", "to", "addPlural", "forms", ".", "<", "/", "p", ">" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/Noun.java#L106-L108
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/PoissonDistribution.java
PoissonDistribution.rawProbability
public static double rawProbability(double x, double lambda) { // Extreme lambda if(lambda == 0) { return ((x == 0) ? 1. : 0.); } // Extreme values if(Double.isInfinite(lambda) || x < 0) { return 0.; } if(x <= lambda * Double.MIN_NORMAL) { return FastMath.exp(-lambda); } if(lambda < x * Double.MIN_NORMAL) { double r = -lambda + x * FastMath.log(lambda) - GammaDistribution.logGamma(x + 1); return FastMath.exp(r); } final double f = MathUtil.TWOPI * x; final double y = -stirlingError(x) - devianceTerm(x, lambda); return FastMath.exp(y) / FastMath.sqrt(f); }
java
public static double rawProbability(double x, double lambda) { // Extreme lambda if(lambda == 0) { return ((x == 0) ? 1. : 0.); } // Extreme values if(Double.isInfinite(lambda) || x < 0) { return 0.; } if(x <= lambda * Double.MIN_NORMAL) { return FastMath.exp(-lambda); } if(lambda < x * Double.MIN_NORMAL) { double r = -lambda + x * FastMath.log(lambda) - GammaDistribution.logGamma(x + 1); return FastMath.exp(r); } final double f = MathUtil.TWOPI * x; final double y = -stirlingError(x) - devianceTerm(x, lambda); return FastMath.exp(y) / FastMath.sqrt(f); }
[ "public", "static", "double", "rawProbability", "(", "double", "x", ",", "double", "lambda", ")", "{", "// Extreme lambda", "if", "(", "lambda", "==", "0", ")", "{", "return", "(", "(", "x", "==", "0", ")", "?", "1.", ":", "0.", ")", ";", "}", "// ...
Poisson distribution probability, but also for non-integer arguments. <p> lb^x exp(-lb) / x! @param x X @param lambda lambda @return Poisson distribution probability
[ "Poisson", "distribution", "probability", "but", "also", "for", "non", "-", "integer", "arguments", ".", "<p", ">", "lb^x", "exp", "(", "-", "lb", ")", "/", "x!" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/PoissonDistribution.java#L434-L453
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/knxnetip/Discoverer.java
Discoverer.startSearch
public void startSearch(int localPort, NetworkInterface ni, int timeout, boolean wait) throws KNXException { if (timeout < 0) throw new KNXIllegalArgumentException("timeout has to be >= 0"); if (localPort < 0 || localPort > 65535) throw new KNXIllegalArgumentException("port out of range [0..0xFFFF]"); final Receiver r = search(new InetSocketAddress(host, localPort), ni, timeout); if (wait) join(r); }
java
public void startSearch(int localPort, NetworkInterface ni, int timeout, boolean wait) throws KNXException { if (timeout < 0) throw new KNXIllegalArgumentException("timeout has to be >= 0"); if (localPort < 0 || localPort > 65535) throw new KNXIllegalArgumentException("port out of range [0..0xFFFF]"); final Receiver r = search(new InetSocketAddress(host, localPort), ni, timeout); if (wait) join(r); }
[ "public", "void", "startSearch", "(", "int", "localPort", ",", "NetworkInterface", "ni", ",", "int", "timeout", ",", "boolean", "wait", ")", "throws", "KNXException", "{", "if", "(", "timeout", "<", "0", ")", "throw", "new", "KNXIllegalArgumentException", "(",...
Starts a new discovery, the <code>localPort</code> and network interface can be specified. <p> The search will continue for <code>timeout</code> seconds, or infinite if timeout value is zero. During this time, search responses will get collected asynchronous in the background by this {@link Discoverer}.<br> With <code>wait</code> you can force this method into blocking mode to wait until the search finished, otherwise the method returns with the search running in the background.<br> A search is finished if either the <code>timeout</code> was reached or the background receiver stopped.<br> The reason the <code>localPort</code> parameter is specified here, in addition to the port queried at {@link #Discoverer(int, boolean)}, is to distinguish between search responses if more searches are running concurrently.<br> @param localPort the port used to bind the socket, a valid port is 0 to 65535, if localPort is zero an arbitrary unused (ephemeral) port is picked @param ni the {@link NetworkInterface} used for sending outgoing multicast messages, or <code>null</code> to use the default multicast interface @param timeout time window in seconds during which search response messages will get collected, timeout >= 0. If timeout is zero, no timeout is set, the search has to be stopped with {@link #stopSearch()}. @param wait <code>true</code> to block until end of search before return @throws KNXException on network I/O error @see MulticastSocket @see NetworkInterface
[ "Starts", "a", "new", "discovery", "the", "<code", ">", "localPort<", "/", "code", ">", "and", "network", "interface", "can", "be", "specified", ".", "<p", ">", "The", "search", "will", "continue", "for", "<code", ">", "timeout<", "/", "code", ">", "seco...
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/knxnetip/Discoverer.java#L243-L253
apptik/jus
benchmark/src/perf/java/com/android/volley/Request.java
Request.getPostBody
@Deprecated public byte[] getPostBody() throws AuthFailureError { // Note: For compatibility with legacy clients of volley, this implementation must remain // here instead of simply calling the getBody() function because this function must // call getPostParams() and getPostParamsEncoding() since legacy clients would have // overridden these two member functions for POST requests. Map<String, String> postParams = getPostParams(); if (postParams != null && postParams.size() > 0) { return encodeParameters(postParams, getPostParamsEncoding()); } return null; }
java
@Deprecated public byte[] getPostBody() throws AuthFailureError { // Note: For compatibility with legacy clients of volley, this implementation must remain // here instead of simply calling the getBody() function because this function must // call getPostParams() and getPostParamsEncoding() since legacy clients would have // overridden these two member functions for POST requests. Map<String, String> postParams = getPostParams(); if (postParams != null && postParams.size() > 0) { return encodeParameters(postParams, getPostParamsEncoding()); } return null; }
[ "@", "Deprecated", "public", "byte", "[", "]", "getPostBody", "(", ")", "throws", "AuthFailureError", "{", "// Note: For compatibility with legacy clients of volley, this implementation must remain", "// here instead of simply calling the getBody() function because this function must", "...
Returns the raw POST body to be sent. @throws AuthFailureError In the event of auth failure @deprecated Use {@link #getBody()} instead.
[ "Returns", "the", "raw", "POST", "body", "to", "be", "sent", "." ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/benchmark/src/perf/java/com/android/volley/Request.java#L350-L361
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/DateTimePicker.java
DateTimePicker.setGapSize
public void setGapSize(int gapSize, ConstantSize.Unit units) { ConstantSize gapSizeObject = new ConstantSize(gapSize, units); ColumnSpec columnSpec = ColumnSpec.createGap(gapSizeObject); FormLayout layout = (FormLayout) getLayout(); layout.setColumnSpec(2, columnSpec); }
java
public void setGapSize(int gapSize, ConstantSize.Unit units) { ConstantSize gapSizeObject = new ConstantSize(gapSize, units); ColumnSpec columnSpec = ColumnSpec.createGap(gapSizeObject); FormLayout layout = (FormLayout) getLayout(); layout.setColumnSpec(2, columnSpec); }
[ "public", "void", "setGapSize", "(", "int", "gapSize", ",", "ConstantSize", ".", "Unit", "units", ")", "{", "ConstantSize", "gapSizeObject", "=", "new", "ConstantSize", "(", "gapSize", ",", "units", ")", ";", "ColumnSpec", "columnSpec", "=", "ColumnSpec", ".",...
setGapSize, This sets the size of the gap between the date picker and the time picker.
[ "setGapSize", "This", "sets", "the", "size", "of", "the", "gap", "between", "the", "date", "picker", "and", "the", "time", "picker", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DateTimePicker.java#L315-L320
BradleyWood/Software-Quality-Test-Framework
sqtf-core/src/main/java/org/sqtf/assertions/Assert.java
Assert.assertEquals
public static void assertEquals(float expected, float actual, float delta, String message) { if (expected + delta < actual || expected - delta > actual) { fail(message); } }
java
public static void assertEquals(float expected, float actual, float delta, String message) { if (expected + delta < actual || expected - delta > actual) { fail(message); } }
[ "public", "static", "void", "assertEquals", "(", "float", "expected", ",", "float", "actual", ",", "float", "delta", ",", "String", "message", ")", "{", "if", "(", "expected", "+", "delta", "<", "actual", "||", "expected", "-", "delta", ">", "actual", ")...
Asserts that the two floats are equal. If they are not the test will fail @param expected The expected value @param actual The actual value @param delta The maximum amount that expected and actual values may deviate by @param message The message to report on failure
[ "Asserts", "that", "the", "two", "floats", "are", "equal", ".", "If", "they", "are", "not", "the", "test", "will", "fail" ]
train
https://github.com/BradleyWood/Software-Quality-Test-Framework/blob/010dea3bfc8e025a4304ab9ef4a213c1adcb1aa0/sqtf-core/src/main/java/org/sqtf/assertions/Assert.java#L138-L142
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/RequestProcessor.java
RequestProcessor.dontNotifyRequestListenersForRequest
public void dontNotifyRequestListenersForRequest(final CachedSpiceRequest<?> request, final Collection<RequestListener<?>> listRequestListener) { requestProgressManager.dontNotifyRequestListenersForRequest(request, listRequestListener); }
java
public void dontNotifyRequestListenersForRequest(final CachedSpiceRequest<?> request, final Collection<RequestListener<?>> listRequestListener) { requestProgressManager.dontNotifyRequestListenersForRequest(request, listRequestListener); }
[ "public", "void", "dontNotifyRequestListenersForRequest", "(", "final", "CachedSpiceRequest", "<", "?", ">", "request", ",", "final", "Collection", "<", "RequestListener", "<", "?", ">", ">", "listRequestListener", ")", "{", "requestProgressManager", ".", "dontNotifyR...
Disable request listeners notifications for a specific request.<br/> All listeners associated to this request won't be called when request will finish.<br/> @param request Request on which you want to disable listeners @param listRequestListener the collection of listeners associated to request not to be notified
[ "Disable", "request", "listeners", "notifications", "for", "a", "specific", "request", ".", "<br", "/", ">", "All", "listeners", "associated", "to", "this", "request", "won", "t", "be", "called", "when", "request", "will", "finish", ".", "<br", "/", ">" ]
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/RequestProcessor.java#L145-L147
larsga/Duke
duke-core/src/main/java/no/priv/garshol/duke/utils/ObjectUtils.java
ObjectUtils.getEnumConstantByName
public static Object getEnumConstantByName(Class klass, String name) { name = name.toUpperCase(); Object c[] = klass.getEnumConstants(); for (int ix = 0; ix < c.length; ix++) if (c[ix].toString().equals(name)) return c[ix]; throw new DukeConfigException("No such " + klass + ": '" + name + "'"); }
java
public static Object getEnumConstantByName(Class klass, String name) { name = name.toUpperCase(); Object c[] = klass.getEnumConstants(); for (int ix = 0; ix < c.length; ix++) if (c[ix].toString().equals(name)) return c[ix]; throw new DukeConfigException("No such " + klass + ": '" + name + "'"); }
[ "public", "static", "Object", "getEnumConstantByName", "(", "Class", "klass", ",", "String", "name", ")", "{", "name", "=", "name", ".", "toUpperCase", "(", ")", ";", "Object", "c", "[", "]", "=", "klass", ".", "getEnumConstants", "(", ")", ";", "for", ...
Returns the enum constant from the given enum class representing the constant with the given identifier/name.
[ "Returns", "the", "enum", "constant", "from", "the", "given", "enum", "class", "representing", "the", "constant", "with", "the", "given", "identifier", "/", "name", "." ]
train
https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/utils/ObjectUtils.java#L19-L26
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientOptions.java
ClientOptions.of
public static ClientOptions of(ClientOptions baseOptions, ClientOptions options) { // TODO(trustin): Reduce the cost of creating a derived ClientOptions. requireNonNull(baseOptions, "baseOptions"); requireNonNull(options, "options"); return new ClientOptions(baseOptions, options); }
java
public static ClientOptions of(ClientOptions baseOptions, ClientOptions options) { // TODO(trustin): Reduce the cost of creating a derived ClientOptions. requireNonNull(baseOptions, "baseOptions"); requireNonNull(options, "options"); return new ClientOptions(baseOptions, options); }
[ "public", "static", "ClientOptions", "of", "(", "ClientOptions", "baseOptions", ",", "ClientOptions", "options", ")", "{", "// TODO(trustin): Reduce the cost of creating a derived ClientOptions.", "requireNonNull", "(", "baseOptions", ",", "\"baseOptions\"", ")", ";", "requir...
Merges the specified two {@link ClientOptions} into one. @return the merged {@link ClientOptions}
[ "Merges", "the", "specified", "two", "{", "@link", "ClientOptions", "}", "into", "one", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientOptions.java#L137-L142
magro/memcached-session-manager
javolution-serializer/src/main/java/de/javakaffee/web/msm/serializer/javolution/JavolutionTranscoderFactory.java
JavolutionTranscoderFactory.getTranscoder
private JavolutionTranscoder getTranscoder( final SessionManager manager ) { if ( _transcoder == null ) { final CustomXMLFormat<?>[] customFormats = loadCustomFormats( manager ); _transcoder = new JavolutionTranscoder( manager, _copyCollectionsForSerialization, customFormats ); } return _transcoder; }
java
private JavolutionTranscoder getTranscoder( final SessionManager manager ) { if ( _transcoder == null ) { final CustomXMLFormat<?>[] customFormats = loadCustomFormats( manager ); _transcoder = new JavolutionTranscoder( manager, _copyCollectionsForSerialization, customFormats ); } return _transcoder; }
[ "private", "JavolutionTranscoder", "getTranscoder", "(", "final", "SessionManager", "manager", ")", "{", "if", "(", "_transcoder", "==", "null", ")", "{", "final", "CustomXMLFormat", "<", "?", ">", "[", "]", "customFormats", "=", "loadCustomFormats", "(", "manag...
Gets/creates a single instance of {@link JavolutionTranscoder}. We need to have a single instance so that {@link XMLFormat}s are not created twice which would lead to errors. @param manager the manager that will be passed to the transcoder. @return for all invocations the same instance of {@link JavolutionTranscoder}.
[ "Gets", "/", "creates", "a", "single", "instance", "of", "{", "@link", "JavolutionTranscoder", "}", ".", "We", "need", "to", "have", "a", "single", "instance", "so", "that", "{", "@link", "XMLFormat", "}", "s", "are", "not", "created", "twice", "which", ...
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/javolution-serializer/src/main/java/de/javakaffee/web/msm/serializer/javolution/JavolutionTranscoderFactory.java#L53-L59
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java
Counter.incrementAll
public void incrementAll(Collection<T> elements, double inc) { for (T element: elements) { incrementCount(element, inc); } }
java
public void incrementAll(Collection<T> elements, double inc) { for (T element: elements) { incrementCount(element, inc); } }
[ "public", "void", "incrementAll", "(", "Collection", "<", "T", ">", "elements", ",", "double", "inc", ")", "{", "for", "(", "T", "element", ":", "elements", ")", "{", "incrementCount", "(", "element", ",", "inc", ")", ";", "}", "}" ]
This method will increment all elements in collection @param elements @param inc
[ "This", "method", "will", "increment", "all", "elements", "in", "collection" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L64-L68
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.overrideEquivalent
public boolean overrideEquivalent(Type t, Type s) { return hasSameArgs(t, s) || hasSameArgs(t, erasure(s)) || hasSameArgs(erasure(t), s); }
java
public boolean overrideEquivalent(Type t, Type s) { return hasSameArgs(t, s) || hasSameArgs(t, erasure(s)) || hasSameArgs(erasure(t), s); }
[ "public", "boolean", "overrideEquivalent", "(", "Type", "t", ",", "Type", "s", ")", "{", "return", "hasSameArgs", "(", "t", ",", "s", ")", "||", "hasSameArgs", "(", "t", ",", "erasure", "(", "s", ")", ")", "||", "hasSameArgs", "(", "erasure", "(", "t...
Returns true iff these signatures are related by <em>override equivalence</em>. This is the natural extension of isSubSignature to an equivalence relation. @jls section 8.4.2. @see #isSubSignature(Type t, Type s) @param t a signature (possible raw, could be subjected to erasure). @param s a signature (possible raw, could be subjected to erasure). @return true if either argument is a sub signature of the other.
[ "Returns", "true", "iff", "these", "signatures", "are", "related", "by", "<em", ">", "override", "equivalence<", "/", "em", ">", ".", "This", "is", "the", "natural", "extension", "of", "isSubSignature", "to", "an", "equivalence", "relation", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L2515-L2518
glyptodon/guacamole-client
extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java
AuthenticationProviderService.getRadiusChallenge
private CredentialsInfo getRadiusChallenge(RadiusPacket challengePacket) { // Try to get the state attribute - if it's not there, we have a problem RadiusAttribute stateAttr = challengePacket.findAttribute(Attr_State.TYPE); if (stateAttr == null) { logger.error("Something went wrong, state attribute not present."); logger.debug("State Attribute turned up null, which shouldn't happen in AccessChallenge."); return null; } // We need to get the reply message so we know what to ask the user RadiusAttribute replyAttr = challengePacket.findAttribute(Attr_ReplyMessage.TYPE); if (replyAttr == null) { logger.error("No reply message received from the server."); logger.debug("Expecting a Attr_ReplyMessage attribute on this packet, and did not get one."); return null; } // We have the required attributes - convert to strings and then generate the additional login box/field String replyMsg = replyAttr.toString(); String radiusState = BaseEncoding.base16().encode(stateAttr.getValue().getBytes()); Field radiusResponseField = new RadiusChallengeResponseField(replyMsg); Field radiusStateField = new RadiusStateField(radiusState); // Return the CredentialsInfo object that has the state and the expected response. return new CredentialsInfo(Arrays.asList(radiusResponseField,radiusStateField)); }
java
private CredentialsInfo getRadiusChallenge(RadiusPacket challengePacket) { // Try to get the state attribute - if it's not there, we have a problem RadiusAttribute stateAttr = challengePacket.findAttribute(Attr_State.TYPE); if (stateAttr == null) { logger.error("Something went wrong, state attribute not present."); logger.debug("State Attribute turned up null, which shouldn't happen in AccessChallenge."); return null; } // We need to get the reply message so we know what to ask the user RadiusAttribute replyAttr = challengePacket.findAttribute(Attr_ReplyMessage.TYPE); if (replyAttr == null) { logger.error("No reply message received from the server."); logger.debug("Expecting a Attr_ReplyMessage attribute on this packet, and did not get one."); return null; } // We have the required attributes - convert to strings and then generate the additional login box/field String replyMsg = replyAttr.toString(); String radiusState = BaseEncoding.base16().encode(stateAttr.getValue().getBytes()); Field radiusResponseField = new RadiusChallengeResponseField(replyMsg); Field radiusStateField = new RadiusStateField(radiusState); // Return the CredentialsInfo object that has the state and the expected response. return new CredentialsInfo(Arrays.asList(radiusResponseField,radiusStateField)); }
[ "private", "CredentialsInfo", "getRadiusChallenge", "(", "RadiusPacket", "challengePacket", ")", "{", "// Try to get the state attribute - if it's not there, we have a problem", "RadiusAttribute", "stateAttr", "=", "challengePacket", ".", "findAttribute", "(", "Attr_State", ".", ...
Returns the expected credentials from a RADIUS challenge. @param challengePacket The AccessChallenge RadiusPacket received from the RADIUS server. @return A CredentialsInfo object that represents fields that need to be presented to the user in order to complete authentication. One of these must be the RADIUS state.
[ "Returns", "the", "expected", "credentials", "from", "a", "RADIUS", "challenge", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-radius/src/main/java/org/apache/guacamole/auth/radius/AuthenticationProviderService.java#L81-L107
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/progress/ProgressionConsoleMonitor.java
ProgressionConsoleMonitor.setModel
public void setModel(Progression model) { this.model.removeProgressionListener(new WeakListener(this, this.model)); if (model == null) { this.model = new DefaultProgression(); } else { this.model = model; } this.previousValue = this.model.getValue(); this.model.addProgressionListener(new WeakListener(this, this.model)); }
java
public void setModel(Progression model) { this.model.removeProgressionListener(new WeakListener(this, this.model)); if (model == null) { this.model = new DefaultProgression(); } else { this.model = model; } this.previousValue = this.model.getValue(); this.model.addProgressionListener(new WeakListener(this, this.model)); }
[ "public", "void", "setModel", "(", "Progression", "model", ")", "{", "this", ".", "model", ".", "removeProgressionListener", "(", "new", "WeakListener", "(", "this", ",", "this", ".", "model", ")", ")", ";", "if", "(", "model", "==", "null", ")", "{", ...
Change the task progression model. @param model - the task progression model.
[ "Change", "the", "task", "progression", "model", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/progress/ProgressionConsoleMonitor.java#L69-L78
js-lib-com/dom
src/main/java/js/dom/w3c/DocumentImpl.java
DocumentImpl.evaluateXPathNodeList
EList evaluateXPathNodeList(Node contextNode, String expression, Object... args) { return evaluateXPathNodeListNS(contextNode, null, expression, args); }
java
EList evaluateXPathNodeList(Node contextNode, String expression, Object... args) { return evaluateXPathNodeListNS(contextNode, null, expression, args); }
[ "EList", "evaluateXPathNodeList", "(", "Node", "contextNode", ",", "String", "expression", ",", "Object", "...", "args", ")", "{", "return", "evaluateXPathNodeListNS", "(", "contextNode", ",", "null", ",", "expression", ",", "args", ")", ";", "}" ]
Evaluate XPath expression expected to return nodes list. Evaluate expression and return result nodes as elements list. @param contextNode evaluation context node, @param expression XPath expression, formatting tags supported, @param args optional formatting arguments. @return list of result elements, possible empty.
[ "Evaluate", "XPath", "expression", "expected", "to", "return", "nodes", "list", ".", "Evaluate", "expression", "and", "return", "result", "nodes", "as", "elements", "list", "." ]
train
https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentImpl.java#L337-L339
alkacon/opencms-core
src/org/opencms/staticexport/CmsLinkProcessor.java
CmsLinkProcessor.replaceLinks
public String replaceLinks(String content) throws ParserException { m_mode = REPLACE_LINKS; return process(content, m_encoding); }
java
public String replaceLinks(String content) throws ParserException { m_mode = REPLACE_LINKS; return process(content, m_encoding); }
[ "public", "String", "replaceLinks", "(", "String", "content", ")", "throws", "ParserException", "{", "m_mode", "=", "REPLACE_LINKS", ";", "return", "process", "(", "content", ",", "m_encoding", ")", ";", "}" ]
Starts link processing for the given content in replacement mode.<p> Links are replaced by macros.<p> @param content the content to process @return the processed content with replaced links @throws ParserException if something goes wrong
[ "Starts", "link", "processing", "for", "the", "given", "content", "in", "replacement", "mode", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsLinkProcessor.java#L232-L236
avast/syringe
src/main/java/com/avast/syringe/config/internal/Injection.java
Injection.apply
public void apply(Object instance, Map<String, Property> properties, ContextualPropertyResolver resolver) throws Exception { if (property.isContextual() || property.isReference()) { applyContextual(instance, properties, resolver); } else { applyNonContextual(instance, properties, resolver); } }
java
public void apply(Object instance, Map<String, Property> properties, ContextualPropertyResolver resolver) throws Exception { if (property.isContextual() || property.isReference()) { applyContextual(instance, properties, resolver); } else { applyNonContextual(instance, properties, resolver); } }
[ "public", "void", "apply", "(", "Object", "instance", ",", "Map", "<", "String", ",", "Property", ">", "properties", ",", "ContextualPropertyResolver", "resolver", ")", "throws", "Exception", "{", "if", "(", "property", ".", "isContextual", "(", ")", "||", "...
Takes the property from the {@code properties} map, converts it to the correct value and sets it to the {@code instance}'s property.
[ "Takes", "the", "property", "from", "the", "{" ]
train
https://github.com/avast/syringe/blob/762da5e50776f2bc028e0cf17eac9bd09b5b6aab/src/main/java/com/avast/syringe/config/internal/Injection.java#L35-L42
voldemort/voldemort
contrib/collections/src/java/voldemort/collections/VStack.java
VStack.setById
public E setById(final int id, final E element) { VListKey<K> key = new VListKey<K>(_key, id); UpdateElementById<K, E> updateElementAction = new UpdateElementById<K, E>(key, element); if(!_storeClient.applyUpdate(updateElementAction)) throw new ObsoleteVersionException("update failed"); return updateElementAction.getResult(); }
java
public E setById(final int id, final E element) { VListKey<K> key = new VListKey<K>(_key, id); UpdateElementById<K, E> updateElementAction = new UpdateElementById<K, E>(key, element); if(!_storeClient.applyUpdate(updateElementAction)) throw new ObsoleteVersionException("update failed"); return updateElementAction.getResult(); }
[ "public", "E", "setById", "(", "final", "int", "id", ",", "final", "E", "element", ")", "{", "VListKey", "<", "K", ">", "key", "=", "new", "VListKey", "<", "K", ">", "(", "_key", ",", "id", ")", ";", "UpdateElementById", "<", "K", ",", "E", ">", ...
Put the given value to the appropriate id in the stack, using the version of the current list node identified by that id. @param id @param element element to set @return element that was replaced by the new element @throws ObsoleteVersionException when an update fails
[ "Put", "the", "given", "value", "to", "the", "appropriate", "id", "in", "the", "stack", "using", "the", "version", "of", "the", "current", "list", "node", "identified", "by", "that", "id", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/collections/src/java/voldemort/collections/VStack.java#L300-L308
shinesolutions/swagger-aem
java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java
SlingApi.postNodeAsync
public com.squareup.okhttp.Call postNodeAsync(String path, String name, String operation, String deleteAuthorizable, File file, final ApiCallback<Void> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postNodeValidateBeforeCall(path, name, operation, deleteAuthorizable, file, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; }
java
public com.squareup.okhttp.Call postNodeAsync(String path, String name, String operation, String deleteAuthorizable, File file, final ApiCallback<Void> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postNodeValidateBeforeCall(path, name, operation, deleteAuthorizable, file, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "postNodeAsync", "(", "String", "path", ",", "String", "name", ",", "String", "operation", ",", "String", "deleteAuthorizable", ",", "File", "file", ",", "final", "ApiCallback", "<", "Void", ">", ...
(asynchronously) @param path (required) @param name (required) @param operation (optional) @param deleteAuthorizable (optional) @param file (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")" ]
train
https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/SlingApi.java#L3752-L3776
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/Util.java
Util.setBitmapRange
public static void setBitmapRange(long[] bitmap, int start, int end) { if (start == end) { return; } int firstword = start / 64; int endword = (end - 1) / 64; if (firstword == endword) { bitmap[firstword] |= (~0L << start) & (~0L >>> -end); return; } bitmap[firstword] |= ~0L << start; for (int i = firstword + 1; i < endword; i++) { bitmap[i] = ~0L; } bitmap[endword] |= ~0L >>> -end; }
java
public static void setBitmapRange(long[] bitmap, int start, int end) { if (start == end) { return; } int firstword = start / 64; int endword = (end - 1) / 64; if (firstword == endword) { bitmap[firstword] |= (~0L << start) & (~0L >>> -end); return; } bitmap[firstword] |= ~0L << start; for (int i = firstword + 1; i < endword; i++) { bitmap[i] = ~0L; } bitmap[endword] |= ~0L >>> -end; }
[ "public", "static", "void", "setBitmapRange", "(", "long", "[", "]", "bitmap", ",", "int", "start", ",", "int", "end", ")", "{", "if", "(", "start", "==", "end", ")", "{", "return", ";", "}", "int", "firstword", "=", "start", "/", "64", ";", "int",...
set bits at start, start+1,..., end-1 @param bitmap array of words to be modified @param start first index to be modified (inclusive) @param end last index to be modified (exclusive)
[ "set", "bits", "at", "start", "start", "+", "1", "...", "end", "-", "1" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L501-L516
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/metadata/table/ShardingTableMetaData.java
ShardingTableMetaData.containsColumn
public boolean containsColumn(final String tableName, final String column) { return containsTable(tableName) && tables.get(tableName).getColumns().keySet().contains(column.toLowerCase()); }
java
public boolean containsColumn(final String tableName, final String column) { return containsTable(tableName) && tables.get(tableName).getColumns().keySet().contains(column.toLowerCase()); }
[ "public", "boolean", "containsColumn", "(", "final", "String", "tableName", ",", "final", "String", "column", ")", "{", "return", "containsTable", "(", "tableName", ")", "&&", "tables", ".", "get", "(", "tableName", ")", ".", "getColumns", "(", ")", ".", "...
Judge contains column from table meta data or not. @param tableName table name @param column column @return contains column from table meta data or not
[ "Judge", "contains", "column", "from", "table", "meta", "data", "or", "not", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/metadata/table/ShardingTableMetaData.java#L85-L87
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getCurrency
public static CurrencyUnit getCurrency(CurrencyQuery query) { return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow( () -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup.")) .getCurrency(query); }
java
public static CurrencyUnit getCurrency(CurrencyQuery query) { return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow( () -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup.")) .getCurrency(query); }
[ "public", "static", "CurrencyUnit", "getCurrency", "(", "CurrencyQuery", "query", ")", "{", "return", "Optional", ".", "ofNullable", "(", "MONETARY_CURRENCIES_SINGLETON_SPI", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "MonetaryException", "(", ...
Query all currencies matching the given query. @param query The {@link javax.money.CurrencyQuery}, not null. @return the list of known currencies, never null.
[ "Query", "all", "currencies", "matching", "the", "given", "query", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L470-L474
apereo/cas
core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/bypass/CredentialMultifactorAuthenticationProviderBypass.java
CredentialMultifactorAuthenticationProviderBypass.locateMatchingCredentialType
protected static boolean locateMatchingCredentialType(final Authentication authentication, final String credentialClassType) { return StringUtils.isNotBlank(credentialClassType) && authentication.getCredentials() .stream() .anyMatch(e -> e.getCredentialClass().getName().matches(credentialClassType)); }
java
protected static boolean locateMatchingCredentialType(final Authentication authentication, final String credentialClassType) { return StringUtils.isNotBlank(credentialClassType) && authentication.getCredentials() .stream() .anyMatch(e -> e.getCredentialClass().getName().matches(credentialClassType)); }
[ "protected", "static", "boolean", "locateMatchingCredentialType", "(", "final", "Authentication", "authentication", ",", "final", "String", "credentialClassType", ")", "{", "return", "StringUtils", ".", "isNotBlank", "(", "credentialClassType", ")", "&&", "authentication"...
Locate matching credential type boolean. @param authentication the authentication @param credentialClassType the credential class type @return the boolean
[ "Locate", "matching", "credential", "type", "boolean", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/bypass/CredentialMultifactorAuthenticationProviderBypass.java#L53-L57
pawelprazak/java-extended
hamcrest/src/main/java/com/bluecatcode/hamcrest/matchers/LongCloseTo.java
LongCloseTo.closeTo
public static Matcher<Long> closeTo(Long operand, Long error) { return new LongCloseTo(operand, error); }
java
public static Matcher<Long> closeTo(Long operand, Long error) { return new LongCloseTo(operand, error); }
[ "public", "static", "Matcher", "<", "Long", ">", "closeTo", "(", "Long", "operand", ",", "Long", "error", ")", "{", "return", "new", "LongCloseTo", "(", "operand", ",", "error", ")", ";", "}" ]
Creates a matcher of {@link Long}s that matches when an examined Long is equal to the specified <code>operand</code>, within a range of +/- <code>error</code>. The comparison for equality is done by BigDecimals {@link Long#compareTo(Long)} method. For example: <pre>assertThat(103L, is(closeTo(100, 0.03)))</pre> @param operand the expected value of matching Long @param error the delta (+/-) within which matches will be allowed @return the matcher
[ "Creates", "a", "matcher", "of", "{", "@link", "Long", "}", "s", "that", "matches", "when", "an", "examined", "Long", "is", "equal", "to", "the", "specified", "<code", ">", "operand<", "/", "code", ">", "within", "a", "range", "of", "+", "/", "-", "<...
train
https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/hamcrest/src/main/java/com/bluecatcode/hamcrest/matchers/LongCloseTo.java#L33-L35
czyzby/gdx-lml
lml-vis/src/main/java/com/github/czyzby/lml/vis/util/ColorPickerContainer.java
ColorPickerContainer.initiateInstance
public static void initiateInstance(final String title, final String styleName) { INSTANCE = new ColorPicker(styleName, title, null); }
java
public static void initiateInstance(final String title, final String styleName) { INSTANCE = new ColorPicker(styleName, title, null); }
[ "public", "static", "void", "initiateInstance", "(", "final", "String", "title", ",", "final", "String", "styleName", ")", "{", "INSTANCE", "=", "new", "ColorPicker", "(", "styleName", ",", "title", ",", "null", ")", ";", "}" ]
Creates an instance of {@link ColorPicker} which will be accessible through {@link #getInstance()} and {@link #requestInstance()} methods. @param title will become window's title. @param styleName determines the style of {@link ColorPicker}.
[ "Creates", "an", "instance", "of", "{", "@link", "ColorPicker", "}", "which", "will", "be", "accessible", "through", "{", "@link", "#getInstance", "()", "}", "and", "{", "@link", "#requestInstance", "()", "}", "methods", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-vis/src/main/java/com/github/czyzby/lml/vis/util/ColorPickerContainer.java#L63-L65
michael-rapp/AndroidMaterialDialog
library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java
DialogRootView.createListViewScrollListener
@NonNull private AbsListView.OnScrollListener createListViewScrollListener() { return new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(final AbsListView view, final int scrollState) { } @Override public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, final int totalItemCount) { adaptDividerVisibilities(isListViewScrolledToTop(view), isListViewScrolledToBottom(view), true); } }; }
java
@NonNull private AbsListView.OnScrollListener createListViewScrollListener() { return new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(final AbsListView view, final int scrollState) { } @Override public void onScroll(final AbsListView view, final int firstVisibleItem, final int visibleItemCount, final int totalItemCount) { adaptDividerVisibilities(isListViewScrolledToTop(view), isListViewScrolledToBottom(view), true); } }; }
[ "@", "NonNull", "private", "AbsListView", ".", "OnScrollListener", "createListViewScrollListener", "(", ")", "{", "return", "new", "AbsListView", ".", "OnScrollListener", "(", ")", "{", "@", "Override", "public", "void", "onScrollStateChanged", "(", "final", "AbsLis...
Creates and returns a listener, which allows to observe the list view, which is contained by the dialog, is scrolled. @return The listener, which has been created, as an instance of the type {@link android.widget.AbsListView.OnScrollListener}. The listener may not be null
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "observe", "the", "list", "view", "which", "is", "contained", "by", "the", "dialog", "is", "scrolled", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java#L864-L881
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java
LoggingInterceptorSupport.logWebServiceMessage
protected void logWebServiceMessage(String logMessage, WebServiceMessage message, boolean incoming) { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { message.writeTo(os); logMessage(logMessage, os.toString(), incoming); } catch (IOException e) { log.warn("Unable to log WebService message", e); } }
java
protected void logWebServiceMessage(String logMessage, WebServiceMessage message, boolean incoming) { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { message.writeTo(os); logMessage(logMessage, os.toString(), incoming); } catch (IOException e) { log.warn("Unable to log WebService message", e); } }
[ "protected", "void", "logWebServiceMessage", "(", "String", "logMessage", ",", "WebServiceMessage", "message", ",", "boolean", "incoming", ")", "{", "ByteArrayOutputStream", "os", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "{", "message", ".", "wri...
Log WebService message (other than SOAP) with in memory {@link ByteArrayOutputStream} @param logMessage the customized log message. @param message the message to log. @param incoming
[ "Log", "WebService", "message", "(", "other", "than", "SOAP", ")", "with", "in", "memory", "{", "@link", "ByteArrayOutputStream", "}" ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L113-L122
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/UnboundTypeReference.java
UnboundTypeReference.acceptHint
public void acceptHint( LightweightTypeReference hint, BoundTypeArgumentSource source, Object origin, VarianceInfo expectedVariance, VarianceInfo actualVariance) { if (!hint.isValidHint()) throw new IllegalArgumentException("Hint may not be primitive void, <any> or <unknown>"); if (hint instanceof UnboundTypeReference) { if (((UnboundTypeReference) hint).getHandle() == getHandle()) { return; // invalid input, e.g. List<T extends T> } } acceptHint(new LightweightBoundTypeArgument(hint.getWrapperTypeIfPrimitive(), source, origin, expectedVariance, actualVariance)); }
java
public void acceptHint( LightweightTypeReference hint, BoundTypeArgumentSource source, Object origin, VarianceInfo expectedVariance, VarianceInfo actualVariance) { if (!hint.isValidHint()) throw new IllegalArgumentException("Hint may not be primitive void, <any> or <unknown>"); if (hint instanceof UnboundTypeReference) { if (((UnboundTypeReference) hint).getHandle() == getHandle()) { return; // invalid input, e.g. List<T extends T> } } acceptHint(new LightweightBoundTypeArgument(hint.getWrapperTypeIfPrimitive(), source, origin, expectedVariance, actualVariance)); }
[ "public", "void", "acceptHint", "(", "LightweightTypeReference", "hint", ",", "BoundTypeArgumentSource", "source", ",", "Object", "origin", ",", "VarianceInfo", "expectedVariance", ",", "VarianceInfo", "actualVariance", ")", "{", "if", "(", "!", "hint", ".", "isVali...
<p>Attach a resolution hint to this unbound type reference.</p> <p> Only {@link #isValidHint() valid} hints can be accepted. The given source indicates the quality of this hint. The {@link VarianceInfo variances} indicate how the hint was used and how it was expected to be used. A hint from a co-variant location may not have the same impact for a contra-variant usage as a contra-variant hint. Consider a return type of a method</p> <p> <code> &lt;T&gt; Collection&lt;? extends T&gt; m(..) { } </code> </p> and its usage <p> <code> Collection&lt;? super CharSequence&gt; variable = m(..) </code> </p> <p> The hint that stems from the variable declaration may not be very useful since the variances are not compatible. Nevertheless, it can be accepted to produce better error messages.</p> @param hint the reference that provides the hint. @param source the source of this hint, e.g. an inferred hint, or an expectation. @param origin the object that produced the hint. Only for debugging purpose to trace the origin of a hint. @param expectedVariance the expected variance, e.g. where this unbound type reference is used. @param actualVariance how the hint is used. @see LightweightTypeReference#isValidHint()
[ "<p", ">", "Attach", "a", "resolution", "hint", "to", "this", "unbound", "type", "reference", ".", "<", "/", "p", ">", "<p", ">", "Only", "{", "@link", "#isValidHint", "()", "valid", "}", "hints", "can", "be", "accepted", ".", "The", "given", "source",...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/UnboundTypeReference.java#L801-L812
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.createTempFile
public static File createTempFile(File dir, boolean isReCreat) throws IORuntimeException { return createTempFile("hutool", null, dir, isReCreat); }
java
public static File createTempFile(File dir, boolean isReCreat) throws IORuntimeException { return createTempFile("hutool", null, dir, isReCreat); }
[ "public", "static", "File", "createTempFile", "(", "File", "dir", ",", "boolean", "isReCreat", ")", "throws", "IORuntimeException", "{", "return", "createTempFile", "(", "\"hutool\"", ",", "null", ",", "dir", ",", "isReCreat", ")", ";", "}" ]
创建临时文件<br> 创建后的文件名为 prefix[Randon].tmp @param dir 临时文件创建的所在目录 @param isReCreat 是否重新创建文件(删掉原来的,创建新的) @return 临时文件 @throws IORuntimeException IO异常
[ "创建临时文件<br", ">", "创建后的文件名为", "prefix", "[", "Randon", "]", ".", "tmp" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L882-L884
bwkimmel/jdcp
jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java
JobStatus.withProgress
public JobStatus withProgress(double newProgress) { return new JobStatus(jobId, description, state, newProgress, status, eventId); }
java
public JobStatus withProgress(double newProgress) { return new JobStatus(jobId, description, state, newProgress, status, eventId); }
[ "public", "JobStatus", "withProgress", "(", "double", "newProgress", ")", "{", "return", "new", "JobStatus", "(", "jobId", ",", "description", ",", "state", ",", "newProgress", ",", "status", ",", "eventId", ")", ";", "}" ]
Creates a copy of this <code>JobStatus</code> with the progress set to the specified value. @param newProgress The progress toward completion (complete = 1.0). If equal to <code>Double.NaN</code>, the progress is indeterminant. @return A copy of this <code>JobStatus</code> with the progress set to the specified value.
[ "Creates", "a", "copy", "of", "this", "<code", ">", "JobStatus<", "/", "code", ">", "with", "the", "progress", "set", "to", "the", "specified", "value", "." ]
train
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java#L122-L124
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java
JobOperatorImpl.markInstanceExecutionFailed
private void markInstanceExecutionFailed(WSJobInstance jobInstance, WSJobExecution jobExecution, String correlationId) { //Disregard any attempted transitions out of the ABANDONED state. if (jobInstance.getBatchStatus() == BatchStatus.ABANDONED) { if (logger.isLoggable(Level.FINE)) { logger.fine("Attempt to transition from BatchStatus ABANDONED to FAILED is disallowed. "); } return; } getPersistenceManagerService().updateJobInstanceWithInstanceStateAndBatchStatus(jobInstance.getInstanceId(), InstanceState.FAILED, BatchStatus.FAILED, new Date()); publishEvent(jobInstance, BatchEventsPublisher.TOPIC_INSTANCE_FAILED, correlationId); getPersistenceManagerService().updateJobExecutionAndInstanceOnStatusChange(jobExecution.getExecutionId(), BatchStatus.FAILED, new Date()); publishEvent(jobExecution, BatchEventsPublisher.TOPIC_EXECUTION_FAILED, correlationId); }
java
private void markInstanceExecutionFailed(WSJobInstance jobInstance, WSJobExecution jobExecution, String correlationId) { //Disregard any attempted transitions out of the ABANDONED state. if (jobInstance.getBatchStatus() == BatchStatus.ABANDONED) { if (logger.isLoggable(Level.FINE)) { logger.fine("Attempt to transition from BatchStatus ABANDONED to FAILED is disallowed. "); } return; } getPersistenceManagerService().updateJobInstanceWithInstanceStateAndBatchStatus(jobInstance.getInstanceId(), InstanceState.FAILED, BatchStatus.FAILED, new Date()); publishEvent(jobInstance, BatchEventsPublisher.TOPIC_INSTANCE_FAILED, correlationId); getPersistenceManagerService().updateJobExecutionAndInstanceOnStatusChange(jobExecution.getExecutionId(), BatchStatus.FAILED, new Date()); publishEvent(jobExecution, BatchEventsPublisher.TOPIC_EXECUTION_FAILED, correlationId); }
[ "private", "void", "markInstanceExecutionFailed", "(", "WSJobInstance", "jobInstance", ",", "WSJobExecution", "jobExecution", ",", "String", "correlationId", ")", "{", "//Disregard any attempted transitions out of the ABANDONED state.", "if", "(", "jobInstance", ".", "getBatchS...
/* Used to mark job failed if start attempt fails. Example failure is a bad jsl name.
[ "/", "*", "Used", "to", "mark", "job", "failed", "if", "start", "attempt", "fails", ".", "Example", "failure", "is", "a", "bad", "jsl", "name", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/api/impl/JobOperatorImpl.java#L284-L308
openengsb/openengsb
api/core/src/main/java/org/openengsb/core/api/model/ModelWrapper.java
ModelWrapper.getModelDescription
public ModelDescription getModelDescription() { String modelName = retrieveModelName(); String modelVersion = retrieveModelVersion(); if (modelName == null || modelVersion == null) { throw new IllegalArgumentException("Unsufficient information to create model description."); } return new ModelDescription(modelName, modelVersion); }
java
public ModelDescription getModelDescription() { String modelName = retrieveModelName(); String modelVersion = retrieveModelVersion(); if (modelName == null || modelVersion == null) { throw new IllegalArgumentException("Unsufficient information to create model description."); } return new ModelDescription(modelName, modelVersion); }
[ "public", "ModelDescription", "getModelDescription", "(", ")", "{", "String", "modelName", "=", "retrieveModelName", "(", ")", ";", "String", "modelVersion", "=", "retrieveModelVersion", "(", ")", ";", "if", "(", "modelName", "==", "null", "||", "modelVersion", ...
Creates the model description object for the underlying model object.
[ "Creates", "the", "model", "description", "object", "for", "the", "underlying", "model", "object", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/core/src/main/java/org/openengsb/core/api/model/ModelWrapper.java#L64-L71
Stratio/bdt
src/main/java/com/stratio/qa/specs/DcosSpec.java
DcosSpec.convertJSONSchemaToJSON
@Given("^I convert jsonSchema '(.+?)' to json and save it in variable '(.+?)'") public void convertJSONSchemaToJSON(String jsonSchema, String envVar) throws Exception { String json = commonspec.parseJSONSchema(new JSONObject(jsonSchema)).toString(); ThreadProperty.set(envVar, json); }
java
@Given("^I convert jsonSchema '(.+?)' to json and save it in variable '(.+?)'") public void convertJSONSchemaToJSON(String jsonSchema, String envVar) throws Exception { String json = commonspec.parseJSONSchema(new JSONObject(jsonSchema)).toString(); ThreadProperty.set(envVar, json); }
[ "@", "Given", "(", "\"^I convert jsonSchema '(.+?)' to json and save it in variable '(.+?)'\"", ")", "public", "void", "convertJSONSchemaToJSON", "(", "String", "jsonSchema", ",", "String", "envVar", ")", "throws", "Exception", "{", "String", "json", "=", "commonspec", "....
Convert jsonSchema to json @param jsonSchema jsonSchema to be converted to json @param envVar environment variable where to store json @throws Exception exception *
[ "Convert", "jsonSchema", "to", "json" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DcosSpec.java#L307-L311
openengsb/openengsb
components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/JavassistUtils.java
JavassistUtils.hasAnnotation
public static boolean hasAnnotation(CtField field, String annotationName) { FieldInfo info = field.getFieldInfo(); AnnotationsAttribute ainfo = (AnnotationsAttribute) info.getAttribute(AnnotationsAttribute.invisibleTag); AnnotationsAttribute ainfo2 = (AnnotationsAttribute) info.getAttribute(AnnotationsAttribute.visibleTag); return checkAnnotation(ainfo, ainfo2, annotationName); }
java
public static boolean hasAnnotation(CtField field, String annotationName) { FieldInfo info = field.getFieldInfo(); AnnotationsAttribute ainfo = (AnnotationsAttribute) info.getAttribute(AnnotationsAttribute.invisibleTag); AnnotationsAttribute ainfo2 = (AnnotationsAttribute) info.getAttribute(AnnotationsAttribute.visibleTag); return checkAnnotation(ainfo, ainfo2, annotationName); }
[ "public", "static", "boolean", "hasAnnotation", "(", "CtField", "field", ",", "String", "annotationName", ")", "{", "FieldInfo", "info", "=", "field", ".", "getFieldInfo", "(", ")", ";", "AnnotationsAttribute", "ainfo", "=", "(", "AnnotationsAttribute", ")", "in...
Returns true if the given field has an annotation set with the given name, returns false otherwise.
[ "Returns", "true", "if", "the", "given", "field", "has", "an", "annotation", "set", "with", "the", "given", "name", "returns", "false", "otherwise", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/JavassistUtils.java#L49-L56
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java
DataGenerator.genFiles
private void genFiles() throws IOException { // // BufferedReader in = new BufferedReader(new FileReader(new File(inDir, // StructureGenerator.FILE_STRUCTURE_FILE_NAME))); // String line; // while ((line = in.readLine()) != null) { // String[] tokens = line.split(" "); // if (tokens.length != 2) { // throw new IOException("Expect at most 2 tokens per line: " // + line); // } // String fileName = root + tokens[0]; // long fileSize = (long) (BLOCK_SIZE * Double.parseDouble(tokens[1])); // genFile(new Path(fileName), fileSize); // } config = new Configuration(getConf()); config.setInt("dfs.replication", 3); config.set("dfs.rootdir", root.toString()); JobConf job = new JobConf(config, DataGenerator.class); job.setJobName("data-genarator"); FileOutputFormat.setOutputPath(job, new Path("data-generator-result")); // create the input for the map-reduce job Path inputPath = new Path(ROOT + "load_input"); fs.mkdirs(inputPath); fs.copyFromLocalFile(new Path(inDir + "/" + StructureGenerator.FILE_STRUCTURE_FILE_NAME), inputPath); FileInputFormat.setInputPaths(job, new Path(ROOT + "load_input")); job.setInputFormat(TextInputFormat.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setMapperClass(CreateFiles.class); job.setNumMapTasks(nFiles/10); job.setNumReduceTasks(0); JobClient.runJob(job); }
java
private void genFiles() throws IOException { // // BufferedReader in = new BufferedReader(new FileReader(new File(inDir, // StructureGenerator.FILE_STRUCTURE_FILE_NAME))); // String line; // while ((line = in.readLine()) != null) { // String[] tokens = line.split(" "); // if (tokens.length != 2) { // throw new IOException("Expect at most 2 tokens per line: " // + line); // } // String fileName = root + tokens[0]; // long fileSize = (long) (BLOCK_SIZE * Double.parseDouble(tokens[1])); // genFile(new Path(fileName), fileSize); // } config = new Configuration(getConf()); config.setInt("dfs.replication", 3); config.set("dfs.rootdir", root.toString()); JobConf job = new JobConf(config, DataGenerator.class); job.setJobName("data-genarator"); FileOutputFormat.setOutputPath(job, new Path("data-generator-result")); // create the input for the map-reduce job Path inputPath = new Path(ROOT + "load_input"); fs.mkdirs(inputPath); fs.copyFromLocalFile(new Path(inDir + "/" + StructureGenerator.FILE_STRUCTURE_FILE_NAME), inputPath); FileInputFormat.setInputPaths(job, new Path(ROOT + "load_input")); job.setInputFormat(TextInputFormat.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setMapperClass(CreateFiles.class); job.setNumMapTasks(nFiles/10); job.setNumReduceTasks(0); JobClient.runJob(job); }
[ "private", "void", "genFiles", "(", ")", "throws", "IOException", "{", "//", "// BufferedReader in = new BufferedReader(new FileReader(new File(inDir,", "// StructureGenerator.FILE_STRUCTURE_FILE_NAME)));", "// String line;", "// while ((line = in.readLine()) != null) {", "// String[] toke...
Read file structure file under the input directory. Create each file under the specified root. The file names are relative to the root.
[ "Read", "file", "structure", "file", "under", "the", "input", "directory", ".", "Create", "each", "file", "under", "the", "specified", "root", ".", "The", "file", "names", "are", "relative", "to", "the", "root", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java#L117-L157
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java
DataModelFactory.createPromotionDetails
public static PromotionDetails createPromotionDetails(final Boolean canBePromoted, final Boolean isSnapshot, final List<String> unPromotedDependencies, final List<Artifact> doNotUseArtifacts) throws IOException{ try{ final PromotionDetails promotionDetails = new PromotionDetails(); promotionDetails.setPromotable(canBePromoted); promotionDetails.setSnapshot(isSnapshot); promotionDetails.setUnPromotedDependencies(unPromotedDependencies); promotionDetails.setDoNotUseArtifacts(doNotUseArtifacts); return promotionDetails; } catch(Exception e){ throw new IOException(e); } }
java
public static PromotionDetails createPromotionDetails(final Boolean canBePromoted, final Boolean isSnapshot, final List<String> unPromotedDependencies, final List<Artifact> doNotUseArtifacts) throws IOException{ try{ final PromotionDetails promotionDetails = new PromotionDetails(); promotionDetails.setPromotable(canBePromoted); promotionDetails.setSnapshot(isSnapshot); promotionDetails.setUnPromotedDependencies(unPromotedDependencies); promotionDetails.setDoNotUseArtifacts(doNotUseArtifacts); return promotionDetails; } catch(Exception e){ throw new IOException(e); } }
[ "public", "static", "PromotionDetails", "createPromotionDetails", "(", "final", "Boolean", "canBePromoted", ",", "final", "Boolean", "isSnapshot", ",", "final", "List", "<", "String", ">", "unPromotedDependencies", ",", "final", "List", "<", "Artifact", ">", "doNotU...
Generates a PromotionDetails regarding the parameters. @param canBePromoted Boolean @param isSnapshot Boolean @param unPromotedDependencies List<String> @param doNotUseArtifacts List<Artifact> @return PromotionDetails @throws IOException
[ "Generates", "a", "PromotionDetails", "regarding", "the", "parameters", "." ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L180-L194
bramp/ffmpeg-cli-wrapper
src/main/java/net/bramp/ffmpeg/Preconditions.java
Preconditions.checkValidStream
public static URI checkValidStream(URI uri) throws IllegalArgumentException { String scheme = checkNotNull(uri).getScheme(); scheme = checkNotNull(scheme, "URI is missing a scheme").toLowerCase(); if (rtps.contains(scheme)) { return uri; } if (udpTcp.contains(scheme)) { if (uri.getPort() == -1) { throw new IllegalArgumentException("must set port when using udp or tcp scheme"); } return uri; } throw new IllegalArgumentException("not a valid output URL, must use rtp/tcp/udp scheme"); }
java
public static URI checkValidStream(URI uri) throws IllegalArgumentException { String scheme = checkNotNull(uri).getScheme(); scheme = checkNotNull(scheme, "URI is missing a scheme").toLowerCase(); if (rtps.contains(scheme)) { return uri; } if (udpTcp.contains(scheme)) { if (uri.getPort() == -1) { throw new IllegalArgumentException("must set port when using udp or tcp scheme"); } return uri; } throw new IllegalArgumentException("not a valid output URL, must use rtp/tcp/udp scheme"); }
[ "public", "static", "URI", "checkValidStream", "(", "URI", "uri", ")", "throws", "IllegalArgumentException", "{", "String", "scheme", "=", "checkNotNull", "(", "uri", ")", ".", "getScheme", "(", ")", ";", "scheme", "=", "checkNotNull", "(", "scheme", ",", "\...
Checks if the URI is valid for streaming to. @param uri The URI to check @return The passed in URI if it is valid @throws IllegalArgumentException if the URI is not valid.
[ "Checks", "if", "the", "URI", "is", "valid", "for", "streaming", "to", "." ]
train
https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/Preconditions.java#L43-L59
googleapis/google-cloud-java
google-cloud-clients/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/AutoMlClient.java
AutoMlClient.createDataset
public final Dataset createDataset(String parent, Dataset dataset) { CreateDatasetRequest request = CreateDatasetRequest.newBuilder().setParent(parent).setDataset(dataset).build(); return createDataset(request); }
java
public final Dataset createDataset(String parent, Dataset dataset) { CreateDatasetRequest request = CreateDatasetRequest.newBuilder().setParent(parent).setDataset(dataset).build(); return createDataset(request); }
[ "public", "final", "Dataset", "createDataset", "(", "String", "parent", ",", "Dataset", "dataset", ")", "{", "CreateDatasetRequest", "request", "=", "CreateDatasetRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setDataset", "("...
Creates a dataset. <p>Sample code: <pre><code> try (AutoMlClient autoMlClient = AutoMlClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Dataset dataset = Dataset.newBuilder().build(); Dataset response = autoMlClient.createDataset(parent.toString(), dataset); } </code></pre> @param parent The resource name of the project to create the dataset for. @param dataset The dataset to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "dataset", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-automl/src/main/java/com/google/cloud/automl/v1beta1/AutoMlClient.java#L231-L236
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.attributeAccess
private AstNode attributeAccess() throws IOException { int tt = nextToken(), atPos = ts.tokenBeg; switch (tt) { // handles: @name, @ns::name, @ns::*, @ns::[expr] case Token.NAME: return propertyName(atPos, ts.getString(), 0); // handles: @*, @*::name, @*::*, @*::[expr] case Token.MUL: saveNameTokenData(ts.tokenBeg, "*", ts.lineno); return propertyName(atPos, "*", 0); // handles @[expr] case Token.LB: return xmlElemRef(atPos, null, -1); default: reportError("msg.no.name.after.xmlAttr"); return makeErrorNode(); } }
java
private AstNode attributeAccess() throws IOException { int tt = nextToken(), atPos = ts.tokenBeg; switch (tt) { // handles: @name, @ns::name, @ns::*, @ns::[expr] case Token.NAME: return propertyName(atPos, ts.getString(), 0); // handles: @*, @*::name, @*::*, @*::[expr] case Token.MUL: saveNameTokenData(ts.tokenBeg, "*", ts.lineno); return propertyName(atPos, "*", 0); // handles @[expr] case Token.LB: return xmlElemRef(atPos, null, -1); default: reportError("msg.no.name.after.xmlAttr"); return makeErrorNode(); } }
[ "private", "AstNode", "attributeAccess", "(", ")", "throws", "IOException", "{", "int", "tt", "=", "nextToken", "(", ")", ",", "atPos", "=", "ts", ".", "tokenBeg", ";", "switch", "(", "tt", ")", "{", "// handles: @name, @ns::name, @ns::*, @ns::[expr]", "case", ...
Xml attribute expression:<p> {@code @attr}, {@code @ns::attr}, {@code @ns::*}, {@code @ns::*}, {@code @*}, {@code @*::attr}, {@code @*::*}, {@code @ns::[expr]}, {@code @*::[expr]}, {@code @[expr]} <p> Called if we peeked an '@' token.
[ "Xml", "attribute", "expression", ":", "<p", ">", "{" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L2976-L2999
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/bingspellcheck/src/main/java/com/microsoft/azure/cognitiveservices/language/spellcheck/implementation/BingSpellCheckOperationsImpl.java
BingSpellCheckOperationsImpl.spellCheckerAsync
public Observable<SpellCheck> spellCheckerAsync(String text, SpellCheckerOptionalParameter spellCheckerOptionalParameter) { return spellCheckerWithServiceResponseAsync(text, spellCheckerOptionalParameter).map(new Func1<ServiceResponse<SpellCheck>, SpellCheck>() { @Override public SpellCheck call(ServiceResponse<SpellCheck> response) { return response.body(); } }); }
java
public Observable<SpellCheck> spellCheckerAsync(String text, SpellCheckerOptionalParameter spellCheckerOptionalParameter) { return spellCheckerWithServiceResponseAsync(text, spellCheckerOptionalParameter).map(new Func1<ServiceResponse<SpellCheck>, SpellCheck>() { @Override public SpellCheck call(ServiceResponse<SpellCheck> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SpellCheck", ">", "spellCheckerAsync", "(", "String", "text", ",", "SpellCheckerOptionalParameter", "spellCheckerOptionalParameter", ")", "{", "return", "spellCheckerWithServiceResponseAsync", "(", "text", ",", "spellCheckerOptionalParameter", ")...
The Bing Spell Check API lets you perform contextual grammar and spell checking. Bing has developed a web-based spell-checker that leverages machine learning and statistical machine translation to dynamically train a constantly evolving and highly contextual algorithm. The spell-checker is based on a massive corpus of web searches and documents. @param text The text string to check for spelling and grammar errors. The combined length of the text string, preContextText string, and postContextText string may not exceed 10,000 characters. You may specify this parameter in the query string of a GET request or in the body of a POST request. Because of the query string length limit, you'll typically use a POST request unless you're checking only short strings. @param spellCheckerOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SpellCheck object
[ "The", "Bing", "Spell", "Check", "API", "lets", "you", "perform", "contextual", "grammar", "and", "spell", "checking", ".", "Bing", "has", "developed", "a", "web", "-", "based", "spell", "-", "checker", "that", "leverages", "machine", "learning", "and", "sta...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/bingspellcheck/src/main/java/com/microsoft/azure/cognitiveservices/language/spellcheck/implementation/BingSpellCheckOperationsImpl.java#L100-L107
norbsoft/android-typeface-helper
lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java
TypefaceHelper.checkTypefaceStyleThrowing
private static void checkTypefaceStyleThrowing(int style) { switch (style) { case Typeface.NORMAL: case Typeface.BOLD: case Typeface.ITALIC: case Typeface.BOLD_ITALIC: break; default: throw new IllegalArgumentException("Style have to be in (Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC)"); } }
java
private static void checkTypefaceStyleThrowing(int style) { switch (style) { case Typeface.NORMAL: case Typeface.BOLD: case Typeface.ITALIC: case Typeface.BOLD_ITALIC: break; default: throw new IllegalArgumentException("Style have to be in (Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC)"); } }
[ "private", "static", "void", "checkTypefaceStyleThrowing", "(", "int", "style", ")", "{", "switch", "(", "style", ")", "{", "case", "Typeface", ".", "NORMAL", ":", "case", "Typeface", ".", "BOLD", ":", "case", "Typeface", ".", "ITALIC", ":", "case", "Typef...
Check if typeface style int is one of: <ul> <li>{@link android.graphics.Typeface#NORMAL}</li> <li>{@link android.graphics.Typeface#BOLD}</li> <li>{@link android.graphics.Typeface#ITALIC}</li> <li>{@link android.graphics.Typeface#BOLD_ITALIC}</li> </ul> @param style
[ "Check", "if", "typeface", "style", "int", "is", "one", "of", ":", "<ul", ">", "<li", ">", "{" ]
train
https://github.com/norbsoft/android-typeface-helper/blob/f9e12655f01144efa937c1172f5de7f9b29c4df7/lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java#L208-L218
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
5