repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/JCacheMetrics.java
JCacheMetrics.monitor
public static <K, V, C extends Cache<K, V>> C monitor(MeterRegistry registry, C cache, String... tags) { return monitor(registry, cache, Tags.of(tags)); }
java
public static <K, V, C extends Cache<K, V>> C monitor(MeterRegistry registry, C cache, String... tags) { return monitor(registry, cache, Tags.of(tags)); }
[ "public", "static", "<", "K", ",", "V", ",", "C", "extends", "Cache", "<", "K", ",", "V", ">", ">", "C", "monitor", "(", "MeterRegistry", "registry", ",", "C", "cache", ",", "String", "...", "tags", ")", "{", "return", "monitor", "(", "registry", "...
Record metrics on a JCache cache. @param registry The registry to bind metrics to. @param cache The cache to instrument. @param tags Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags. @param <C> The cache type. @param <K> The cache key type. @param <V> The cache value type. @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
[ "Record", "metrics", "on", "a", "JCache", "cache", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/JCacheMetrics.java#L58-L60
huangp/entityunit
src/main/java/com/github/huangp/entityunit/entity/EntityCleaner.java
EntityCleaner.deleteAll
public static void deleteAll(final EntityManager entityManager, Iterable<Class> entityClasses) { for (Class entityType : entityClasses) { EntityClass entityClass = EntityClass.from(entityType); // delete many to many and element collection tables Iterable<String> associationTables = getAssociationTables(entityClass); for (String table : associationTables) { deleteTable(entityManager, table); } deleteEntity(entityManager, ClassUtil.getEntityName(entityType)); } }
java
public static void deleteAll(final EntityManager entityManager, Iterable<Class> entityClasses) { for (Class entityType : entityClasses) { EntityClass entityClass = EntityClass.from(entityType); // delete many to many and element collection tables Iterable<String> associationTables = getAssociationTables(entityClass); for (String table : associationTables) { deleteTable(entityManager, table); } deleteEntity(entityManager, ClassUtil.getEntityName(entityType)); } }
[ "public", "static", "void", "deleteAll", "(", "final", "EntityManager", "entityManager", ",", "Iterable", "<", "Class", ">", "entityClasses", ")", "{", "for", "(", "Class", "entityType", ":", "entityClasses", ")", "{", "EntityClass", "entityClass", "=", "EntityC...
Delete all records from given entity representing tables and their many to many and element collection tables. <p> The entity classes must be in correct order. Item references Category then Category must in front of the iterable. @param entityManager entity manager @param entityClasses entity class in correct order
[ "Delete", "all", "records", "from", "given", "entity", "representing", "tables", "and", "their", "many", "to", "many", "and", "element", "collection", "tables", ".", "<p", ">", "The", "entity", "classes", "must", "be", "in", "correct", "order", ".", "Item", ...
train
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/entity/EntityCleaner.java#L59-L71
dustin/java-memcached-client
src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java
OperationImpl.matchStatus
protected final OperationStatus matchStatus(String line, OperationStatus... statii) { OperationStatus rv = null; for (OperationStatus status : statii) { if (line.equals(status.getMessage())) { rv = status; } } if (rv == null) { rv = new OperationStatus(false, line, StatusCode.fromAsciiLine(line)); } return rv; }
java
protected final OperationStatus matchStatus(String line, OperationStatus... statii) { OperationStatus rv = null; for (OperationStatus status : statii) { if (line.equals(status.getMessage())) { rv = status; } } if (rv == null) { rv = new OperationStatus(false, line, StatusCode.fromAsciiLine(line)); } return rv; }
[ "protected", "final", "OperationStatus", "matchStatus", "(", "String", "line", ",", "OperationStatus", "...", "statii", ")", "{", "OperationStatus", "rv", "=", "null", ";", "for", "(", "OperationStatus", "status", ":", "statii", ")", "{", "if", "(", "line", ...
Match the status line provided against one of the given OperationStatus objects. If none match, return a failure status with the given line. @param line the current line @param statii several status objects @return the appropriate status object
[ "Match", "the", "status", "line", "provided", "against", "one", "of", "the", "given", "OperationStatus", "objects", ".", "If", "none", "match", "return", "a", "failure", "status", "with", "the", "given", "line", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/ascii/OperationImpl.java#L66-L78
cdk/cdk
descriptor/cip/src/main/java/org/openscience/cdk/geometry/cip/CIPTool.java
CIPTool.defineLigand
public static ILigand defineLigand(IAtomContainer container, VisitedAtoms visitedAtoms, int chiralAtom, int ligandAtom) { if (ligandAtom == HYDROGEN) { return new ImplicitHydrogenLigand(container, visitedAtoms, container.getAtom(chiralAtom)); } else { return new Ligand(container, visitedAtoms, container.getAtom(chiralAtom), container.getAtom(ligandAtom)); } }
java
public static ILigand defineLigand(IAtomContainer container, VisitedAtoms visitedAtoms, int chiralAtom, int ligandAtom) { if (ligandAtom == HYDROGEN) { return new ImplicitHydrogenLigand(container, visitedAtoms, container.getAtom(chiralAtom)); } else { return new Ligand(container, visitedAtoms, container.getAtom(chiralAtom), container.getAtom(ligandAtom)); } }
[ "public", "static", "ILigand", "defineLigand", "(", "IAtomContainer", "container", ",", "VisitedAtoms", "visitedAtoms", ",", "int", "chiralAtom", ",", "int", "ligandAtom", ")", "{", "if", "(", "ligandAtom", "==", "HYDROGEN", ")", "{", "return", "new", "ImplicitH...
Creates a ligand attached to a single chiral atom, where the involved atoms are identified by there index in the {@link IAtomContainer}. For ligand atom, {@link #HYDROGEN} can be passed as index, which will indicate the presence of an implicit hydrogen, not explicitly present in the chemical graph of the given <code>container</code>. @param container {@link IAtomContainer} for which the returned {@link ILigand}s are defined @param visitedAtoms a list of atoms already visited in the analysis @param chiralAtom an integer pointing to the {@link IAtom} index of the chiral atom @param ligandAtom an integer pointing to the {@link IAtom} index of the {@link ILigand} @return the created {@link ILigand}
[ "Creates", "a", "ligand", "attached", "to", "a", "single", "chiral", "atom", "where", "the", "involved", "atoms", "are", "identified", "by", "there", "index", "in", "the", "{", "@link", "IAtomContainer", "}", ".", "For", "ligand", "atom", "{", "@link", "#H...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/cip/src/main/java/org/openscience/cdk/geometry/cip/CIPTool.java#L320-L327
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java
UTF16.delete
public static int delete(char target[], int limit, int offset16) { int count = 1; switch (bounds(target, 0, limit, offset16)) { case LEAD_SURROGATE_BOUNDARY: count++; break; case TRAIL_SURROGATE_BOUNDARY: count++; offset16--; break; } System.arraycopy(target, offset16 + count, target, offset16, limit - (offset16 + count)); target[limit - count] = 0; return limit - count; }
java
public static int delete(char target[], int limit, int offset16) { int count = 1; switch (bounds(target, 0, limit, offset16)) { case LEAD_SURROGATE_BOUNDARY: count++; break; case TRAIL_SURROGATE_BOUNDARY: count++; offset16--; break; } System.arraycopy(target, offset16 + count, target, offset16, limit - (offset16 + count)); target[limit - count] = 0; return limit - count; }
[ "public", "static", "int", "delete", "(", "char", "target", "[", "]", ",", "int", "limit", ",", "int", "offset16", ")", "{", "int", "count", "=", "1", ";", "switch", "(", "bounds", "(", "target", ",", "0", ",", "limit", ",", "offset16", ")", ")", ...
Removes the codepoint at the specified position in this target (shortening target by 1 character if the codepoint is a non-supplementary, 2 otherwise). @param target String buffer to remove codepoint from @param limit End index of the char array, limit &lt;= target.length @param offset16 Offset which the codepoint will be removed @return a new limit size @exception IndexOutOfBoundsException Thrown if offset16 is invalid.
[ "Removes", "the", "codepoint", "at", "the", "specified", "position", "in", "this", "target", "(", "shortening", "target", "by", "1", "character", "if", "the", "codepoint", "is", "a", "non", "-", "supplementary", "2", "otherwise", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L1438-L1452
JOML-CI/JOML
src/org/joml/Matrix3x2f.java
Matrix3x2f.get3x3
public ByteBuffer get3x3(int index, ByteBuffer buffer) { MemUtil.INSTANCE.put3x3(this, index, buffer); return buffer; }
java
public ByteBuffer get3x3(int index, ByteBuffer buffer) { MemUtil.INSTANCE.put3x3(this, index, buffer); return buffer; }
[ "public", "ByteBuffer", "get3x3", "(", "int", "index", ",", "ByteBuffer", "buffer", ")", "{", "MemUtil", ".", "INSTANCE", ".", "put3x3", "(", "this", ",", "index", ",", "buffer", ")", ";", "return", "buffer", ";", "}" ]
Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied {@link ByteBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given ByteBuffer. @param index the absolute position into the ByteBuffer @param buffer will receive the values of this matrix in column-major order @return the passed in buffer
[ "Store", "this", "matrix", "as", "an", "equivalent", "3x3", "matrix", "in", "column", "-", "major", "order", "into", "the", "supplied", "{", "@link", "ByteBuffer", "}", "starting", "at", "the", "specified", "absolute", "buffer", "position", "/", "index", "."...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2f.java#L950-L953
samskivert/samskivert
src/main/java/com/samskivert/util/Config.java
Config.getValue
public boolean getValue (String name, boolean defval) { String val = _props.getProperty(name); if (val != null) { defval = !val.equalsIgnoreCase("false"); } return defval; }
java
public boolean getValue (String name, boolean defval) { String val = _props.getProperty(name); if (val != null) { defval = !val.equalsIgnoreCase("false"); } return defval; }
[ "public", "boolean", "getValue", "(", "String", "name", ",", "boolean", "defval", ")", "{", "String", "val", "=", "_props", ".", "getProperty", "(", "name", ")", ";", "if", "(", "val", "!=", "null", ")", "{", "defval", "=", "!", "val", ".", "equalsIg...
Fetches and returns the value for the specified configuration property. If the value is not specified in the associated properties file, the supplied default value is returned instead. The returned value will be <code>false</code> if the config value is <code>"false"</code> (case-insensitive), else the return value will be true. @param name the name of the property to be fetched. @param defval the value to return if the property is not specified in the config file. @return the value of the requested property.
[ "Fetches", "and", "returns", "the", "value", "for", "the", "specified", "configuration", "property", ".", "If", "the", "value", "is", "not", "specified", "in", "the", "associated", "properties", "file", "the", "supplied", "default", "value", "is", "returned", ...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Config.java#L184-L191
apache/incubator-gobblin
gobblin-restli/gobblin-throttling-service/gobblin-throttling-service-server/src/main/java/org/apache/gobblin/restli/throttling/LimiterServerResource.java
LimiterServerResource.getSync
public PermitAllocation getSync(ComplexResourceKey<PermitRequest, EmptyRecord> key) { try { FutureCallback<PermitAllocation> callback = new FutureCallback<>(); get(key, callback); return callback.get(); } catch (ExecutionException ee) { Throwable t = ee.getCause(); if (t instanceof RestLiServiceException) { throw (RestLiServiceException) t; } else { throw new RuntimeException(t); } } catch (InterruptedException ie) { throw new RuntimeException(ie); } }
java
public PermitAllocation getSync(ComplexResourceKey<PermitRequest, EmptyRecord> key) { try { FutureCallback<PermitAllocation> callback = new FutureCallback<>(); get(key, callback); return callback.get(); } catch (ExecutionException ee) { Throwable t = ee.getCause(); if (t instanceof RestLiServiceException) { throw (RestLiServiceException) t; } else { throw new RuntimeException(t); } } catch (InterruptedException ie) { throw new RuntimeException(ie); } }
[ "public", "PermitAllocation", "getSync", "(", "ComplexResourceKey", "<", "PermitRequest", ",", "EmptyRecord", ">", "key", ")", "{", "try", "{", "FutureCallback", "<", "PermitAllocation", ">", "callback", "=", "new", "FutureCallback", "<>", "(", ")", ";", "get", ...
Request permits from the limiter server. The returned {@link PermitAllocation} specifies the number of permits that the client can use.
[ "Request", "permits", "from", "the", "limiter", "server", ".", "The", "returned", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-restli/gobblin-throttling-service/gobblin-throttling-service-server/src/main/java/org/apache/gobblin/restli/throttling/LimiterServerResource.java#L169-L185
Chorus-bdd/Chorus
interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/HandlerManager.java
HandlerManager.injectResourceFields
private void injectResourceFields(Object handler, Iterable<Object> handlerInstances, Scope... scopes) { Class<?> featureClass = handler.getClass(); List<Field> allFields = new ArrayList<>(); addAllPublicFields(featureClass, allFields); log.trace("Now examining handler fields for ChorusResource annotation " + allFields); HashSet<Scope> scopeSet = new HashSet<>(Arrays.asList(scopes)); for (Field field : allFields) { setChorusResource(handler, handlerInstances, field, scopeSet); } }
java
private void injectResourceFields(Object handler, Iterable<Object> handlerInstances, Scope... scopes) { Class<?> featureClass = handler.getClass(); List<Field> allFields = new ArrayList<>(); addAllPublicFields(featureClass, allFields); log.trace("Now examining handler fields for ChorusResource annotation " + allFields); HashSet<Scope> scopeSet = new HashSet<>(Arrays.asList(scopes)); for (Field field : allFields) { setChorusResource(handler, handlerInstances, field, scopeSet); } }
[ "private", "void", "injectResourceFields", "(", "Object", "handler", ",", "Iterable", "<", "Object", ">", "handlerInstances", ",", "Scope", "...", "scopes", ")", "{", "Class", "<", "?", ">", "featureClass", "=", "handler", ".", "getClass", "(", ")", ";", "...
Here we set the values of any handler fields annotated with @ChorusResource
[ "Here", "we", "set", "the", "values", "of", "any", "handler", "fields", "annotated", "with" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/HandlerManager.java#L217-L228
tvesalainen/util
util/src/main/java/d3/env/TSAGeoMag.java
TSAGeoMag.getEastIntensity
public double getEastIntensity( double dlat, double dlong, double year, double altitude ) { calcGeoMag( dlat, dlong, year, altitude ); return bx; }
java
public double getEastIntensity( double dlat, double dlong, double year, double altitude ) { calcGeoMag( dlat, dlong, year, altitude ); return bx; }
[ "public", "double", "getEastIntensity", "(", "double", "dlat", ",", "double", "dlong", ",", "double", "year", ",", "double", "altitude", ")", "{", "calcGeoMag", "(", "dlat", ",", "dlong", ",", "year", ",", "altitude", ")", ";", "return", "bx", ";", "}" ]
Returns the easterly magnetic field intensity from the Department of Defense geomagnetic model and data in nano Tesla. @param dlat Latitude in decimal degrees. @param dlong Longitude in decimal degrees. @param year Date of the calculation in decimal years. @param altitude Altitude of the calculation in kilometers. @return The easterly component of the magnetic field strength in nano Tesla.
[ "Returns", "the", "easterly", "magnetic", "field", "intensity", "from", "the", "Department", "of", "Defense", "geomagnetic", "model", "and", "data", "in", "nano", "Tesla", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1108-L1112
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
HTMLEncoder.percentEncode
private static void percentEncode(Writer writer, char c, String characterEncoding) throws IOException { String app = null; if (c > (char)((short)0x007F)) { //percent encode in the proper encoding to be consistent //app = percentEncodeNonUsAsciiCharacter(writer c, characterEncoding); percentEncodeNonUsAsciiCharacter(writer, c, characterEncoding); } else { //percent encode US-ASCII char (0x00-0x7F range) //app = "%" + HEX_CHARSET.charAt( ((c >> 0x4) % 0x10)) +HEX_CHARSET.charAt(c % 0x10); writer.write('%'); writer.write(HEX_CHARSET.charAt( ((c >> 0x4) % 0x10))); writer.write(HEX_CHARSET.charAt(c % 0x10)); } //return app; }
java
private static void percentEncode(Writer writer, char c, String characterEncoding) throws IOException { String app = null; if (c > (char)((short)0x007F)) { //percent encode in the proper encoding to be consistent //app = percentEncodeNonUsAsciiCharacter(writer c, characterEncoding); percentEncodeNonUsAsciiCharacter(writer, c, characterEncoding); } else { //percent encode US-ASCII char (0x00-0x7F range) //app = "%" + HEX_CHARSET.charAt( ((c >> 0x4) % 0x10)) +HEX_CHARSET.charAt(c % 0x10); writer.write('%'); writer.write(HEX_CHARSET.charAt( ((c >> 0x4) % 0x10))); writer.write(HEX_CHARSET.charAt(c % 0x10)); } //return app; }
[ "private", "static", "void", "percentEncode", "(", "Writer", "writer", ",", "char", "c", ",", "String", "characterEncoding", ")", "throws", "IOException", "{", "String", "app", "=", "null", ";", "if", "(", "c", ">", "(", "char", ")", "(", "(", "short", ...
Encode a unicode char value in percentEncode, decoding its bytes using a specified characterEncoding. @param c @param characterEncoding @return
[ "Encode", "a", "unicode", "char", "value", "in", "percentEncode", "decoding", "its", "bytes", "using", "a", "specified", "characterEncoding", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java#L1152-L1170
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.inner
public Table inner(Table table2, String col2Name, boolean allowDuplicateColumnNames) { return inner(table2, allowDuplicateColumnNames, col2Name); }
java
public Table inner(Table table2, String col2Name, boolean allowDuplicateColumnNames) { return inner(table2, allowDuplicateColumnNames, col2Name); }
[ "public", "Table", "inner", "(", "Table", "table2", ",", "String", "col2Name", ",", "boolean", "allowDuplicateColumnNames", ")", "{", "return", "inner", "(", "table2", ",", "allowDuplicateColumnNames", ",", "col2Name", ")", ";", "}" ]
Joins the joiner to the table2, using the given column for the second table and returns the resulting table @param table2 The table to join with @param col2Name The column to join on. If col2Name refers to a double column, the join is performed after rounding to integers. @param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name if {@code true} the join will succeed and duplicate columns are renamed* @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "column", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L129-L131
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/StringUtils.java
StringUtils.defaultIfBlank
@NullSafe public static String defaultIfBlank(String value, String... defaultValues) { if (isBlank(value)) { for (String defaultValue : defaultValues) { if (hasText(defaultValue)) { return defaultValue; } } } return value; }
java
@NullSafe public static String defaultIfBlank(String value, String... defaultValues) { if (isBlank(value)) { for (String defaultValue : defaultValues) { if (hasText(defaultValue)) { return defaultValue; } } } return value; }
[ "@", "NullSafe", "public", "static", "String", "defaultIfBlank", "(", "String", "value", ",", "String", "...", "defaultValues", ")", "{", "if", "(", "isBlank", "(", "value", ")", ")", "{", "for", "(", "String", "defaultValue", ":", "defaultValues", ")", "{...
Defaults the given String to the first non-blank default value if the given String is blank, otherwise returns the given String. @param value the String to evaluate if blank. @param defaultValues an array of default String values to use if the given String is blank. @return the first non-blank default String value if the given String is blank. If the given String and all default String values are blank, then the given String is returned. @see #isBlank(String) @see #hasText(String)
[ "Defaults", "the", "given", "String", "to", "the", "first", "non", "-", "blank", "default", "value", "if", "the", "given", "String", "is", "blank", "otherwise", "returns", "the", "given", "String", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L204-L216
alkacon/opencms-core
src/org/opencms/widgets/A_CmsSelectWidget.java
A_CmsSelectWidget.getSelectedValue
protected String getSelectedValue(CmsObject cms, I_CmsWidgetParameter param) { String paramValue = param.getStringValue(cms); if (CmsStringUtil.isEmpty(paramValue)) { CmsSelectWidgetOption option = CmsSelectWidgetOption.getDefaultOption(m_selectOptions); if (option != null) { paramValue = option.getValue(); } } return paramValue; }
java
protected String getSelectedValue(CmsObject cms, I_CmsWidgetParameter param) { String paramValue = param.getStringValue(cms); if (CmsStringUtil.isEmpty(paramValue)) { CmsSelectWidgetOption option = CmsSelectWidgetOption.getDefaultOption(m_selectOptions); if (option != null) { paramValue = option.getValue(); } } return paramValue; }
[ "protected", "String", "getSelectedValue", "(", "CmsObject", "cms", ",", "I_CmsWidgetParameter", "param", ")", "{", "String", "paramValue", "=", "param", ".", "getStringValue", "(", "cms", ")", ";", "if", "(", "CmsStringUtil", ".", "isEmpty", "(", "paramValue", ...
Returns the currently selected value of the select widget.<p> If a value is found in the given parameter, this is used. Otherwise the default value of the select options are used. If there is neither a parameter value nor a default value, <code>null</code> is returned.<p> @param cms the current users OpenCms context @param param the widget parameter of this dialog @return the currently selected value of the select widget
[ "Returns", "the", "currently", "selected", "value", "of", "the", "select", "widget", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/A_CmsSelectWidget.java#L269-L279
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/services/event/EventServicesImpl.java
EventServicesImpl.getProcessInstances
@Override public List<ProcessInstance> getProcessInstances(String masterRequestId, String processName) throws ProcessException, DataAccessException { TransactionWrapper transaction = null; EngineDataAccessDB edao = new EngineDataAccessDB(); try { Process procdef = ProcessCache.getProcess(processName, 0); if (procdef==null) return null; transaction = edao.startTransaction(); return edao.getProcessInstancesByMasterRequestId(masterRequestId, procdef.getId()); } catch (SQLException e) { throw new ProcessException(0, "Failed to remove event waits", e); } finally { edao.stopTransaction(transaction); } }
java
@Override public List<ProcessInstance> getProcessInstances(String masterRequestId, String processName) throws ProcessException, DataAccessException { TransactionWrapper transaction = null; EngineDataAccessDB edao = new EngineDataAccessDB(); try { Process procdef = ProcessCache.getProcess(processName, 0); if (procdef==null) return null; transaction = edao.startTransaction(); return edao.getProcessInstancesByMasterRequestId(masterRequestId, procdef.getId()); } catch (SQLException e) { throw new ProcessException(0, "Failed to remove event waits", e); } finally { edao.stopTransaction(transaction); } }
[ "@", "Override", "public", "List", "<", "ProcessInstance", ">", "getProcessInstances", "(", "String", "masterRequestId", ",", "String", "processName", ")", "throws", "ProcessException", ",", "DataAccessException", "{", "TransactionWrapper", "transaction", "=", "null", ...
Returns the process instances by process name and master request ID. @param processName @param masterRequestId @return the list of process instances. If the process definition is not found, null is returned; if process definition is found but no process instances are found, an empty list is returned. @throws ProcessException @throws DataAccessException
[ "Returns", "the", "process", "instances", "by", "process", "name", "and", "master", "request", "ID", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/event/EventServicesImpl.java#L377-L392
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportReceiveListener.java
ServerTransportReceiveListener.attachConnectionListener
private void attachConnectionListener(Conversation conversation, SICoreConnection conn) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "attachConnectionListener", new Object[] { conversation, conn }); // The connection listener is saved in the link level attachement so that each connection that // uses the same physical link uses the same connection listener // So get the connection listener from the link level state and register ourselves with it ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment(); //d173544 ServerSICoreConnectionListener listener = linkState.getSICoreConnectionListener(); listener.addSICoreConnection(conn, conversation); // Finally attach it to the actual core connection // Start f173765.2 try { conn.addConnectionListener(listener); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".attachConnectionListener", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_CONNGET_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Unable to register connection listener", e); } // End f173765.2 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "attachConnectionListener"); }
java
private void attachConnectionListener(Conversation conversation, SICoreConnection conn) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "attachConnectionListener", new Object[] { conversation, conn }); // The connection listener is saved in the link level attachement so that each connection that // uses the same physical link uses the same connection listener // So get the connection listener from the link level state and register ourselves with it ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment(); //d173544 ServerSICoreConnectionListener listener = linkState.getSICoreConnectionListener(); listener.addSICoreConnection(conn, conversation); // Finally attach it to the actual core connection // Start f173765.2 try { conn.addConnectionListener(listener); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".attachConnectionListener", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_CONNGET_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Unable to register connection listener", e); } // End f173765.2 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "attachConnectionListener"); }
[ "private", "void", "attachConnectionListener", "(", "Conversation", "conversation", ",", "SICoreConnection", "conn", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "ent...
Helper method used to register the SICoreConnection with the connection listener. @param conversation @param conn
[ "Helper", "method", "used", "to", "register", "the", "SICoreConnection", "with", "the", "connection", "listener", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/ServerTransportReceiveListener.java#L1631-L1665
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java
ProfilePackageSummaryBuilder.buildInterfaceSummary
public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) { String interfaceTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Interface_Summary"), configuration.getText("doclet.interfaces")); String[] interfaceTableHeader = new String[] { configuration.getText("doclet.Interface"), configuration.getText("doclet.Description") }; ClassDoc[] interfaces = packageDoc.isIncluded() ? packageDoc.interfaces() : configuration.classDocCatalog.interfaces( Util.getPackageName(packageDoc)); if (interfaces.length > 0) { profilePackageWriter.addClassesSummary( interfaces, configuration.getText("doclet.Interface_Summary"), interfaceTableSummary, interfaceTableHeader, summaryContentTree); } }
java
public void buildInterfaceSummary(XMLNode node, Content summaryContentTree) { String interfaceTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Interface_Summary"), configuration.getText("doclet.interfaces")); String[] interfaceTableHeader = new String[] { configuration.getText("doclet.Interface"), configuration.getText("doclet.Description") }; ClassDoc[] interfaces = packageDoc.isIncluded() ? packageDoc.interfaces() : configuration.classDocCatalog.interfaces( Util.getPackageName(packageDoc)); if (interfaces.length > 0) { profilePackageWriter.addClassesSummary( interfaces, configuration.getText("doclet.Interface_Summary"), interfaceTableSummary, interfaceTableHeader, summaryContentTree); } }
[ "public", "void", "buildInterfaceSummary", "(", "XMLNode", "node", ",", "Content", "summaryContentTree", ")", "{", "String", "interfaceTableSummary", "=", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(",...
Build the summary for the interfaces in this package. @param node the XML element that specifies which components to document @param summaryContentTree the summary tree to which the interface summary will be added
[ "Build", "the", "summary", "for", "the", "interfaces", "in", "this", "package", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java#L180-L200
jenkinsci/jenkins
core/src/main/java/hudson/model/AutoCompletionCandidates.java
AutoCompletionCandidates.ofJobNames
public static <T extends Item> AutoCompletionCandidates ofJobNames(final Class<T> type, final String value, @CheckForNull Item self, ItemGroup container) { if (self==container) container = self.getParent(); return ofJobNames(type, value, container); }
java
public static <T extends Item> AutoCompletionCandidates ofJobNames(final Class<T> type, final String value, @CheckForNull Item self, ItemGroup container) { if (self==container) container = self.getParent(); return ofJobNames(type, value, container); }
[ "public", "static", "<", "T", "extends", "Item", ">", "AutoCompletionCandidates", "ofJobNames", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "String", "value", ",", "@", "CheckForNull", "Item", "self", ",", "ItemGroup", "container", ")", "{", ...
Auto-completes possible job names. @param type Limit the auto-completion to the subtype of this type. @param value The value the user has typed in. Matched as a prefix. @param self The contextual item for which the auto-completion is provided to. For example, if you are configuring a job, this is the job being configured. @param container The nearby contextual {@link ItemGroup} to resolve relative job names from. @since 1.489
[ "Auto", "-", "completes", "possible", "job", "names", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AutoCompletionCandidates.java#L93-L97
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
MapView.getBounds
public Bbox getBounds() { double w = getViewSpaceWidth(); double h = getViewSpaceHeight(); double x = viewState.getX() - w / 2; double y = viewState.getY() - h / 2; return new Bbox(x, y, w, h); }
java
public Bbox getBounds() { double w = getViewSpaceWidth(); double h = getViewSpaceHeight(); double x = viewState.getX() - w / 2; double y = viewState.getY() - h / 2; return new Bbox(x, y, w, h); }
[ "public", "Bbox", "getBounds", "(", ")", "{", "double", "w", "=", "getViewSpaceWidth", "(", ")", ";", "double", "h", "=", "getViewSpaceHeight", "(", ")", ";", "double", "x", "=", "viewState", ".", "getX", "(", ")", "-", "w", "/", "2", ";", "double", ...
Given the information in this MapView object, what is the currently visible area? @return Notice that at this moment an Axis Aligned Bounding Box is returned! This means that rotating is not yet possible.
[ "Given", "the", "information", "in", "this", "MapView", "object", "what", "is", "the", "currently", "visible", "area?" ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L377-L383
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/BufUnwrapper.java
BufUnwrapper.writableNioBuffers
ByteBuffer[] writableNioBuffers(ByteBuf buf) { // Set the writer index to the capacity to guarantee that the returned NIO buffers will have // the capacity available. int readerIndex = buf.readerIndex(); int writerIndex = buf.writerIndex(); buf.readerIndex(writerIndex); buf.writerIndex(buf.capacity()); try { return nioBuffers(buf, singleWriteBuffer); } finally { // Restore the writer index before returning. buf.readerIndex(readerIndex); buf.writerIndex(writerIndex); } }
java
ByteBuffer[] writableNioBuffers(ByteBuf buf) { // Set the writer index to the capacity to guarantee that the returned NIO buffers will have // the capacity available. int readerIndex = buf.readerIndex(); int writerIndex = buf.writerIndex(); buf.readerIndex(writerIndex); buf.writerIndex(buf.capacity()); try { return nioBuffers(buf, singleWriteBuffer); } finally { // Restore the writer index before returning. buf.readerIndex(readerIndex); buf.writerIndex(writerIndex); } }
[ "ByteBuffer", "[", "]", "writableNioBuffers", "(", "ByteBuf", "buf", ")", "{", "// Set the writer index to the capacity to guarantee that the returned NIO buffers will have", "// the capacity available.", "int", "readerIndex", "=", "buf", ".", "readerIndex", "(", ")", ";", "i...
Called to get access to the underlying NIO buffers for a {@link ByteBuf} that will be used for writing.
[ "Called", "to", "get", "access", "to", "the", "underlying", "NIO", "buffers", "for", "a", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/BufUnwrapper.java#L33-L48
damianszczepanik/cucumber-reporting
src/main/java/net/masterthought/cucumber/ReportParser.java
ReportParser.parseForFeature
private Feature[] parseForFeature(String jsonFile) { try (Reader reader = new InputStreamReader(new FileInputStream(jsonFile), StandardCharsets.UTF_8)) { Feature[] features = mapper.readValue(reader, Feature[].class); if (ArrayUtils.isEmpty(features)) { LOG.log(Level.INFO, "File '{}' does not contain features", jsonFile); } return features; } catch (JsonMappingException e) { throw new ValidationException(String.format("File '%s' is not proper Cucumber report!", jsonFile), e); } catch (IOException e) { // IO problem - stop generating and re-throw the problem throw new ValidationException(e); } }
java
private Feature[] parseForFeature(String jsonFile) { try (Reader reader = new InputStreamReader(new FileInputStream(jsonFile), StandardCharsets.UTF_8)) { Feature[] features = mapper.readValue(reader, Feature[].class); if (ArrayUtils.isEmpty(features)) { LOG.log(Level.INFO, "File '{}' does not contain features", jsonFile); } return features; } catch (JsonMappingException e) { throw new ValidationException(String.format("File '%s' is not proper Cucumber report!", jsonFile), e); } catch (IOException e) { // IO problem - stop generating and re-throw the problem throw new ValidationException(e); } }
[ "private", "Feature", "[", "]", "parseForFeature", "(", "String", "jsonFile", ")", "{", "try", "(", "Reader", "reader", "=", "new", "InputStreamReader", "(", "new", "FileInputStream", "(", "jsonFile", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ")", "{"...
Reads passed file and returns parsed features. @param jsonFile JSON file that should be read @return array of parsed features
[ "Reads", "passed", "file", "and", "returns", "parsed", "features", "." ]
train
https://github.com/damianszczepanik/cucumber-reporting/blob/9ffe0d4a9c0aec161b0988a930a8312ba36dc742/src/main/java/net/masterthought/cucumber/ReportParser.java#L91-L104
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitAuthor
@Override public R visitAuthor(AuthorTree node, P p) { return scan(node.getName(), p); }
java
@Override public R visitAuthor(AuthorTree node, P p) { return scan(node.getName(), p); }
[ "@", "Override", "public", "R", "visitAuthor", "(", "AuthorTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getName", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L145-L148
dihedron/dihedron-commons
src/main/java/org/dihedron/core/variables/Variables.java
Variables.replaceVariables
public static final String replaceVariables(String text, ValueProvider... providers) { return replaceVariables(text, DEFAULT_CASE_SENSITIVE, providers); }
java
public static final String replaceVariables(String text, ValueProvider... providers) { return replaceVariables(text, DEFAULT_CASE_SENSITIVE, providers); }
[ "public", "static", "final", "String", "replaceVariables", "(", "String", "text", ",", "ValueProvider", "...", "providers", ")", "{", "return", "replaceVariables", "(", "text", ",", "DEFAULT_CASE_SENSITIVE", ",", "providers", ")", ";", "}" ]
Matches all variables (according to the ${[a-zA-Z_][a-zA-Z0-9_\-]*} pattern) and replaces them with the value provided by the set of value provides. The processing is repeated until no more valid variable names can be found in the input text, or no more variables can be bound (e.g. when some values are not available); the match is performed in a case sensitive fashion. @param text the text possibly containing variable identifiers. @param providers a set of zero or more value providers. @return the text with all variables bound.
[ "Matches", "all", "variables", "(", "according", "to", "the", "$", "{", "[", "a", "-", "zA", "-", "Z_", "]", "[", "a", "-", "zA", "-", "Z0", "-", "9_", "\\", "-", "]", "*", "}", "pattern", ")", "and", "replaces", "them", "with", "the", "value",...
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/variables/Variables.java#L53-L55
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularDistortBase_F32.java
EquirectangularDistortBase_F32.compute
@Override public void compute(int x, int y, Point2D_F32 out ) { // grab precomputed normalized image coordinate at canonical location Point3D_F32 v = vectors[y*outWidth+x]; // move to requested orientation GeometryMath_F32.mult(R,v,n); // TODO make faster by not using an array based matrix // compute pixel coordinate tools.normToEquiFV(n.x,n.y,n.z,out); }
java
@Override public void compute(int x, int y, Point2D_F32 out ) { // grab precomputed normalized image coordinate at canonical location Point3D_F32 v = vectors[y*outWidth+x]; // move to requested orientation GeometryMath_F32.mult(R,v,n); // TODO make faster by not using an array based matrix // compute pixel coordinate tools.normToEquiFV(n.x,n.y,n.z,out); }
[ "@", "Override", "public", "void", "compute", "(", "int", "x", ",", "int", "y", ",", "Point2D_F32", "out", ")", "{", "// grab precomputed normalized image coordinate at canonical location", "Point3D_F32", "v", "=", "vectors", "[", "y", "*", "outWidth", "+", "x", ...
Input is in pinhole camera pixel coordinates. Output is in equirectangular coordinates @param x Pixel x-coordinate in rendered pinhole camera @param y Pixel y-coordinate in rendered pinhole camera
[ "Input", "is", "in", "pinhole", "camera", "pixel", "coordinates", ".", "Output", "is", "in", "equirectangular", "coordinates" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularDistortBase_F32.java#L107-L116
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/descriptivestatistics/Descriptives.java
Descriptives.normalizeExp
public static void normalizeExp(AssociativeArray associativeArray) { double max = max(associativeArray.toFlatDataCollection()); double sum = 0.0; //Prevents numeric underflow by subtracting the max. References: http://www.youtube.com/watch?v=-RVM21Voo7Q for(Map.Entry<Object, Object> entry : associativeArray.entrySet()) { Double value = Math.exp(TypeInference.toDouble(entry.getValue())-max); associativeArray.put(entry.getKey(), value); sum += value; } if(sum!=0.0) { for(Map.Entry<Object, Object> entry : associativeArray.entrySet()) { associativeArray.put(entry.getKey(), TypeInference.toDouble(entry.getValue())/sum); } } }
java
public static void normalizeExp(AssociativeArray associativeArray) { double max = max(associativeArray.toFlatDataCollection()); double sum = 0.0; //Prevents numeric underflow by subtracting the max. References: http://www.youtube.com/watch?v=-RVM21Voo7Q for(Map.Entry<Object, Object> entry : associativeArray.entrySet()) { Double value = Math.exp(TypeInference.toDouble(entry.getValue())-max); associativeArray.put(entry.getKey(), value); sum += value; } if(sum!=0.0) { for(Map.Entry<Object, Object> entry : associativeArray.entrySet()) { associativeArray.put(entry.getKey(), TypeInference.toDouble(entry.getValue())/sum); } } }
[ "public", "static", "void", "normalizeExp", "(", "AssociativeArray", "associativeArray", ")", "{", "double", "max", "=", "max", "(", "associativeArray", ".", "toFlatDataCollection", "(", ")", ")", ";", "double", "sum", "=", "0.0", ";", "//Prevents numeric underflo...
Normalizes the exponentials of provided associative array by using the log-sum-exp trick. @param associativeArray
[ "Normalizes", "the", "exponentials", "of", "provided", "associative", "array", "by", "using", "the", "log", "-", "sum", "-", "exp", "trick", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/descriptivestatistics/Descriptives.java#L706-L723
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationObjUtil.java
ValidationObjUtil.objectDeepCopyWithBlackList
public static <T> T objectDeepCopyWithBlackList(Object from, Object to, String... blockFields) { if (to == null) { to = getNewInstance(from.getClass()); } List<String> whiteList = new ArrayList<>(); Method[] methods = from.getClass().getMethods(); for (Method m : methods) { if (!isGetterMethod(m)) { continue; } if (isBlockFieldMethod(m, blockFields)) { continue; } whiteList.add(getFieldNameFromMethod(m)); } return objectDeepCopyWithWhiteList(from, to, whiteList.toArray(new String[whiteList.size()])); }
java
public static <T> T objectDeepCopyWithBlackList(Object from, Object to, String... blockFields) { if (to == null) { to = getNewInstance(from.getClass()); } List<String> whiteList = new ArrayList<>(); Method[] methods = from.getClass().getMethods(); for (Method m : methods) { if (!isGetterMethod(m)) { continue; } if (isBlockFieldMethod(m, blockFields)) { continue; } whiteList.add(getFieldNameFromMethod(m)); } return objectDeepCopyWithWhiteList(from, to, whiteList.toArray(new String[whiteList.size()])); }
[ "public", "static", "<", "T", ">", "T", "objectDeepCopyWithBlackList", "(", "Object", "from", ",", "Object", "to", ",", "String", "...", "blockFields", ")", "{", "if", "(", "to", "==", "null", ")", "{", "to", "=", "getNewInstance", "(", "from", ".", "g...
Object deep copy with black list t. @param <T> the type parameter @param from the from @param to the to @param blockFields the block fields @return the t
[ "Object", "deep", "copy", "with", "black", "list", "t", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationObjUtil.java#L397-L423
samskivert/samskivert
src/main/java/com/samskivert/text/MessageUtil.java
MessageUtil.tcompose
public static String tcompose (String key, String... args) { for (int ii = 0, nn = args.length; ii < nn; ii++) { args[ii] = taint(args[ii]); } return compose(key, args); }
java
public static String tcompose (String key, String... args) { for (int ii = 0, nn = args.length; ii < nn; ii++) { args[ii] = taint(args[ii]); } return compose(key, args); }
[ "public", "static", "String", "tcompose", "(", "String", "key", ",", "String", "...", "args", ")", "{", "for", "(", "int", "ii", "=", "0", ",", "nn", "=", "args", ".", "length", ";", "ii", "<", "nn", ";", "ii", "++", ")", "{", "args", "[", "ii"...
A convenience method for calling {@link #compose(String,String[])} with an array of argument that will be automatically tainted.
[ "A", "convenience", "method", "for", "calling", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/text/MessageUtil.java#L143-L149
actframework/actframework
src/main/java/act/ws/WebSocketConnectionRegistry.java
WebSocketConnectionRegistry.signOff
public void signOff(String key, WebSocketConnection connection) { ConcurrentMap<WebSocketConnection, WebSocketConnection> connections = registry.get(key); if (null == connections) { return; } connections.remove(connection); }
java
public void signOff(String key, WebSocketConnection connection) { ConcurrentMap<WebSocketConnection, WebSocketConnection> connections = registry.get(key); if (null == connections) { return; } connections.remove(connection); }
[ "public", "void", "signOff", "(", "String", "key", ",", "WebSocketConnection", "connection", ")", "{", "ConcurrentMap", "<", "WebSocketConnection", ",", "WebSocketConnection", ">", "connections", "=", "registry", ".", "get", "(", "key", ")", ";", "if", "(", "n...
Detach a connection from a key. @param key the key @param connection the connection
[ "Detach", "a", "connection", "from", "a", "key", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketConnectionRegistry.java#L203-L209
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java
RequestHeader.withAcceptedResponseProtocols
public RequestHeader withAcceptedResponseProtocols(PSequence<MessageProtocol> acceptedResponseProtocols) { return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, principal, headers, lowercaseHeaders); }
java
public RequestHeader withAcceptedResponseProtocols(PSequence<MessageProtocol> acceptedResponseProtocols) { return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, principal, headers, lowercaseHeaders); }
[ "public", "RequestHeader", "withAcceptedResponseProtocols", "(", "PSequence", "<", "MessageProtocol", ">", "acceptedResponseProtocols", ")", "{", "return", "new", "RequestHeader", "(", "method", ",", "uri", ",", "protocol", ",", "acceptedResponseProtocols", ",", "princi...
Return a copy of this request header with the given accepted response protocols set. @param acceptedResponseProtocols The accepted response protocols to set. @return A copy of this request header.
[ "Return", "a", "copy", "of", "this", "request", "header", "with", "the", "given", "accepted", "response", "protocols", "set", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java#L117-L119
Ordinastie/MalisisCore
src/main/java/net/malisis/core/item/MalisisItemBlock.java
MalisisItemBlock.checkMerge
private IBlockState checkMerge(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { IBlockState state = world.getBlockState(pos); IMergedBlock mergedBlock = getMerged(state); if (mergedBlock == null // || (offset && !mergedBlock.doubleCheckMerge()) || !mergedBlock.canMerge(itemStack, player, world, pos, side)) return null; return mergedBlock.mergeBlock(world, pos, state, itemStack, player, side, hitX, hitY, hitZ); }
java
private IBlockState checkMerge(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) { IBlockState state = world.getBlockState(pos); IMergedBlock mergedBlock = getMerged(state); if (mergedBlock == null // || (offset && !mergedBlock.doubleCheckMerge()) || !mergedBlock.canMerge(itemStack, player, world, pos, side)) return null; return mergedBlock.mergeBlock(world, pos, state, itemStack, player, side, hitX, hitY, hitZ); }
[ "private", "IBlockState", "checkMerge", "(", "ItemStack", "itemStack", ",", "EntityPlayer", "player", ",", "World", "world", ",", "BlockPos", "pos", ",", "EnumFacing", "side", ",", "float", "hitX", ",", "float", "hitY", ",", "float", "hitZ", ")", "{", "IBloc...
Checks whether the block can be merged with the one already in the world. @param itemStack the item stack @param player the player @param world the world @param pos the pos @param side the side @param hitX the hit X @param hitY the hit Y @param hitZ the hit Z @return the i block state
[ "Checks", "whether", "the", "block", "can", "be", "merged", "with", "the", "one", "already", "in", "the", "world", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/item/MalisisItemBlock.java#L183-L192
gsi-upm/BeastTool
beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jade/common/AgentRegistration.java
AgentRegistration.registerAgent
public static void registerAgent(Agent agent, String serviceName, String serviceType) throws FIPAException{ DFAgentDescription dfd = new DFAgentDescription(); ServiceDescription sd = new ServiceDescription(); sd.setType(serviceType); sd.setName(serviceName); //NOTE El serviceType es un string que define el tipo de servicio publicado en el DF por el Agente X. // He escogido crear nombres en clave en jade.common.Definitions para este campo. //NOTE El serviceName es el nombre efectivo del servicio. // Esto es lo que el usuario va a definir en MockConfiguration.DFNameService y no el tipo como estaba puesto. // sd.setType(agentType); // sd.setName(agent.getLocalName()); //Add services?? // Sets the agent description dfd.setName(agent.getAID()); dfd.addServices(sd); // Register the agent DFService.register(agent, dfd); }
java
public static void registerAgent(Agent agent, String serviceName, String serviceType) throws FIPAException{ DFAgentDescription dfd = new DFAgentDescription(); ServiceDescription sd = new ServiceDescription(); sd.setType(serviceType); sd.setName(serviceName); //NOTE El serviceType es un string que define el tipo de servicio publicado en el DF por el Agente X. // He escogido crear nombres en clave en jade.common.Definitions para este campo. //NOTE El serviceName es el nombre efectivo del servicio. // Esto es lo que el usuario va a definir en MockConfiguration.DFNameService y no el tipo como estaba puesto. // sd.setType(agentType); // sd.setName(agent.getLocalName()); //Add services?? // Sets the agent description dfd.setName(agent.getAID()); dfd.addServices(sd); // Register the agent DFService.register(agent, dfd); }
[ "public", "static", "void", "registerAgent", "(", "Agent", "agent", ",", "String", "serviceName", ",", "String", "serviceType", ")", "throws", "FIPAException", "{", "DFAgentDescription", "dfd", "=", "new", "DFAgentDescription", "(", ")", ";", "ServiceDescription", ...
Register the agent in the platform @param agent_name The name of the agent to be registered @param agent The agent to register. @throws FIPAException
[ "Register", "the", "agent", "in", "the", "platform" ]
train
https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jade/common/AgentRegistration.java#L34-L56
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3EncryptionClient.java
AmazonS3EncryptionClient.onAbort
private <T extends Throwable> T onAbort(UploadObjectObserver observer, T t) { observer.onAbort(); return t; }
java
private <T extends Throwable> T onAbort(UploadObjectObserver observer, T t) { observer.onAbort(); return t; }
[ "private", "<", "T", "extends", "Throwable", ">", "T", "onAbort", "(", "UploadObjectObserver", "observer", ",", "T", "t", ")", "{", "observer", ".", "onAbort", "(", ")", ";", "return", "t", ";", "}" ]
Convenient method to notifies the observer to abort the multi-part upload, and returns the original exception.
[ "Convenient", "method", "to", "notifies", "the", "observer", "to", "abort", "the", "multi", "-", "part", "upload", "and", "returns", "the", "original", "exception", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3EncryptionClient.java#L843-L846
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/Img.java
Img.pressText
public Img pressText(String pressText, Color color, Font font, int x, int y, float alpha) { final BufferedImage targetImage = getValidSrcImg(); final Graphics2D g = targetImage.createGraphics(); if(null == font) { // 默认字体 font = new Font("Courier", Font.PLAIN, (int)(targetImage.getHeight() * 0.75)); } // 抗锯齿 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(color); g.setFont(font); // 透明度 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); // 在指定坐标绘制水印文字 final FontMetrics metrics = g.getFontMetrics(font); final int textLength = metrics.stringWidth(pressText); final int textHeight = metrics.getAscent() - metrics.getLeading() - metrics.getDescent(); g.drawString(pressText, Math.abs(targetImage.getWidth() - textLength) / 2 + x, Math.abs(targetImage.getHeight() + textHeight) / 2 + y); g.dispose(); this.targetImage = targetImage; return this; }
java
public Img pressText(String pressText, Color color, Font font, int x, int y, float alpha) { final BufferedImage targetImage = getValidSrcImg(); final Graphics2D g = targetImage.createGraphics(); if(null == font) { // 默认字体 font = new Font("Courier", Font.PLAIN, (int)(targetImage.getHeight() * 0.75)); } // 抗锯齿 g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(color); g.setFont(font); // 透明度 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); // 在指定坐标绘制水印文字 final FontMetrics metrics = g.getFontMetrics(font); final int textLength = metrics.stringWidth(pressText); final int textHeight = metrics.getAscent() - metrics.getLeading() - metrics.getDescent(); g.drawString(pressText, Math.abs(targetImage.getWidth() - textLength) / 2 + x, Math.abs(targetImage.getHeight() + textHeight) / 2 + y); g.dispose(); this.targetImage = targetImage; return this; }
[ "public", "Img", "pressText", "(", "String", "pressText", ",", "Color", "color", ",", "Font", "font", ",", "int", "x", ",", "int", "y", ",", "float", "alpha", ")", "{", "final", "BufferedImage", "targetImage", "=", "getValidSrcImg", "(", ")", ";", "final...
给图片添加文字水印<br> 此方法并不关闭流 @param pressText 水印文字 @param color 水印的字体颜色 @param font {@link Font} 字体相关信息 @param x 修正值。 默认在中间,偏移量相对于中间偏移 @param y 修正值。 默认在中间,偏移量相对于中间偏移 @param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 @return 处理后的图像
[ "给图片添加文字水印<br", ">", "此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/Img.java#L398-L422
RestComm/jss7
m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UARouteManagement.java
M3UARouteManagement.addRoute
protected void addRoute(int dpc, int opc, int si, String asName, int traffmode) throws Exception { AsImpl asImpl = null; for (FastList.Node<As> n = this.m3uaManagement.appServers.head(), end = this.m3uaManagement.appServers.tail(); (n = n .getNext()) != end;) { if (n.getValue().getName().compareTo(asName) == 0) { asImpl = (AsImpl) n.getValue(); break; } } if (asImpl == null) { throw new Exception(String.format(M3UAOAMMessages.NO_AS_FOUND, asName)); } String key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(opc).append(KEY_SEPARATOR).append(si)) .toString(); RouteAsImpl asArray = route.get(key); if (asArray == null) { asArray = new RouteAsImpl(); asArray.setTrafficModeType(new TrafficModeTypeImpl(traffmode)); route.put(key, asArray); asArray.setM3uaManagement(this.m3uaManagement); } asArray.addRoute(dpc, opc, si, asImpl, traffmode); this.addAsToDPC(dpc, asImpl); }
java
protected void addRoute(int dpc, int opc, int si, String asName, int traffmode) throws Exception { AsImpl asImpl = null; for (FastList.Node<As> n = this.m3uaManagement.appServers.head(), end = this.m3uaManagement.appServers.tail(); (n = n .getNext()) != end;) { if (n.getValue().getName().compareTo(asName) == 0) { asImpl = (AsImpl) n.getValue(); break; } } if (asImpl == null) { throw new Exception(String.format(M3UAOAMMessages.NO_AS_FOUND, asName)); } String key = (new StringBuffer().append(dpc).append(KEY_SEPARATOR).append(opc).append(KEY_SEPARATOR).append(si)) .toString(); RouteAsImpl asArray = route.get(key); if (asArray == null) { asArray = new RouteAsImpl(); asArray.setTrafficModeType(new TrafficModeTypeImpl(traffmode)); route.put(key, asArray); asArray.setM3uaManagement(this.m3uaManagement); } asArray.addRoute(dpc, opc, si, asImpl, traffmode); this.addAsToDPC(dpc, asImpl); }
[ "protected", "void", "addRoute", "(", "int", "dpc", ",", "int", "opc", ",", "int", "si", ",", "String", "asName", ",", "int", "traffmode", ")", "throws", "Exception", "{", "AsImpl", "asImpl", "=", "null", ";", "for", "(", "FastList", ".", "Node", "<", ...
Creates key (combination of dpc:opc:si) and adds instance of {@link AsImpl} represented by asName as route for this key @param dpc @param opc @param si @param asName @throws Exception If corresponding {@link AsImpl} doesn't exist or {@link AsImpl} already added
[ "Creates", "key", "(", "combination", "of", "dpc", ":", "opc", ":", "si", ")", "and", "adds", "instance", "of", "{", "@link", "AsImpl", "}", "represented", "by", "asName", "as", "route", "for", "this", "key" ]
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/M3UARouteManagement.java#L191-L221
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/readerwriter/multicast/rmi/RmiJournalReceiver.java
RmiJournalReceiver.openFile
public void openFile(String repositoryHash, String filename) throws JournalException { if (journalFile != null) { throw logAndGetException("Attempting to open file '" + filename + "' when file '" + journalFile.getName() + "' has not been closed."); } try { journalFile = new TransportOutputFile(directory, filename); writer = journalFile.open(); } catch (IOException e) { throw logAndGetException("Problem opening" + filename + "'", e); } currentRepositoryHash = repositoryHash; itemIndex = 0; logger.debug("opened file '" + filename + "', hash is '" + repositoryHash + "'"); }
java
public void openFile(String repositoryHash, String filename) throws JournalException { if (journalFile != null) { throw logAndGetException("Attempting to open file '" + filename + "' when file '" + journalFile.getName() + "' has not been closed."); } try { journalFile = new TransportOutputFile(directory, filename); writer = journalFile.open(); } catch (IOException e) { throw logAndGetException("Problem opening" + filename + "'", e); } currentRepositoryHash = repositoryHash; itemIndex = 0; logger.debug("opened file '" + filename + "', hash is '" + repositoryHash + "'"); }
[ "public", "void", "openFile", "(", "String", "repositoryHash", ",", "String", "filename", ")", "throws", "JournalException", "{", "if", "(", "journalFile", "!=", "null", ")", "{", "throw", "logAndGetException", "(", "\"Attempting to open file '\"", "+", "filename", ...
Request to open a file. Check that: <ul> <li>a file is not already open,</li> <li>we can create a {@link TransportOutputFile}, and open a {@link Writer} on it.</li> </ul>
[ "Request", "to", "open", "a", "file", ".", "Check", "that", ":", "<ul", ">", "<li", ">", "a", "file", "is", "not", "already", "open", "<", "/", "li", ">", "<li", ">", "we", "can", "create", "a", "{" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/readerwriter/multicast/rmi/RmiJournalReceiver.java#L97-L116
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/matchers/DefaultVFBondMatcher.java
DefaultVFBondMatcher.matches
@Override public boolean matches(TargetProperties targetConatiner, IBond targetBond) { if (this.smartQueryBond != null) { return smartQueryBond.matches(targetBond); } else { if (!isBondMatchFlag()) { return true; } if (isBondMatchFlag() && isBondTypeMatch(targetBond)) { return true; } if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetConatiner, targetBond)) { return true; } } return false; }
java
@Override public boolean matches(TargetProperties targetConatiner, IBond targetBond) { if (this.smartQueryBond != null) { return smartQueryBond.matches(targetBond); } else { if (!isBondMatchFlag()) { return true; } if (isBondMatchFlag() && isBondTypeMatch(targetBond)) { return true; } if (isBondMatchFlag() && this.unsaturation == getUnsaturation(targetConatiner, targetBond)) { return true; } } return false; }
[ "@", "Override", "public", "boolean", "matches", "(", "TargetProperties", "targetConatiner", ",", "IBond", "targetBond", ")", "{", "if", "(", "this", ".", "smartQueryBond", "!=", "null", ")", "{", "return", "smartQueryBond", ".", "matches", "(", "targetBond", ...
{@inheritDoc} @param targetConatiner target container @param targetBond target bond @return true if bonds match
[ "{", "@inheritDoc", "}" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/matchers/DefaultVFBondMatcher.java#L114-L130
graknlabs/grakn
server/src/server/kb/concept/RelationReified.java
RelationReified.putRolePlayerEdge
public void putRolePlayerEdge(Role role, Thing toThing) { //Checking if the edge exists GraphTraversal<Vertex, Edge> traversal = vertex().tx().getTinkerTraversal().V(). hasId(this.elementId()). outE(Schema.EdgeLabel.ROLE_PLAYER.getLabel()). has(Schema.EdgeProperty.RELATION_TYPE_LABEL_ID.name(), this.type().labelId().getValue()). has(Schema.EdgeProperty.ROLE_LABEL_ID.name(), role.labelId().getValue()). as("edge"). inV(). hasId(ConceptVertex.from(toThing).elementId()). select("edge"); if (traversal.hasNext()) { return; } //Role player edge does not exist create a new one EdgeElement edge = this.addEdge(ConceptVertex.from(toThing), Schema.EdgeLabel.ROLE_PLAYER); edge.property(Schema.EdgeProperty.RELATION_TYPE_LABEL_ID, this.type().labelId().getValue()); edge.property(Schema.EdgeProperty.ROLE_LABEL_ID, role.labelId().getValue()); Casting casting = Casting.create(edge, owner, role, toThing); vertex().tx().cache().trackForValidation(casting); }
java
public void putRolePlayerEdge(Role role, Thing toThing) { //Checking if the edge exists GraphTraversal<Vertex, Edge> traversal = vertex().tx().getTinkerTraversal().V(). hasId(this.elementId()). outE(Schema.EdgeLabel.ROLE_PLAYER.getLabel()). has(Schema.EdgeProperty.RELATION_TYPE_LABEL_ID.name(), this.type().labelId().getValue()). has(Schema.EdgeProperty.ROLE_LABEL_ID.name(), role.labelId().getValue()). as("edge"). inV(). hasId(ConceptVertex.from(toThing).elementId()). select("edge"); if (traversal.hasNext()) { return; } //Role player edge does not exist create a new one EdgeElement edge = this.addEdge(ConceptVertex.from(toThing), Schema.EdgeLabel.ROLE_PLAYER); edge.property(Schema.EdgeProperty.RELATION_TYPE_LABEL_ID, this.type().labelId().getValue()); edge.property(Schema.EdgeProperty.ROLE_LABEL_ID, role.labelId().getValue()); Casting casting = Casting.create(edge, owner, role, toThing); vertex().tx().cache().trackForValidation(casting); }
[ "public", "void", "putRolePlayerEdge", "(", "Role", "role", ",", "Thing", "toThing", ")", "{", "//Checking if the edge exists", "GraphTraversal", "<", "Vertex", ",", "Edge", ">", "traversal", "=", "vertex", "(", ")", ".", "tx", "(", ")", ".", "getTinkerTravers...
If the edge does not exist then it adds a Schema.EdgeLabel#ROLE_PLAYER edge from this Relation to a target Thing which is playing some Role. If the edge does exist nothing is done. @param role The Role being played by the Thing in this Relation @param toThing The Thing playing a Role in this Relation
[ "If", "the", "edge", "does", "not", "exist", "then", "it", "adds", "a", "Schema", ".", "EdgeLabel#ROLE_PLAYER", "edge", "from", "this", "Relation", "to", "a", "target", "Thing", "which", "is", "playing", "some", "Role", ".", "If", "the", "edge", "does", ...
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/RelationReified.java#L137-L159
networknt/light-rest-4j
swagger-validator/src/main/java/com/networknt/validator/ResponseValidator.java
ResponseValidator.validateResponse
public Status validateResponse(final HttpServerExchange exchange, final SwaggerOperation swaggerOperation) { requireNonNull(exchange, "An exchange is required"); requireNonNull(swaggerOperation, "A swagger operation is required"); io.swagger.models.Response swaggerResponse = swaggerOperation.getOperation().getResponses().get(Integer.toString(exchange.getStatusCode())); if (swaggerResponse == null) { swaggerResponse = swaggerOperation.getOperation().getResponses().get("default"); // try the default response } if (swaggerResponse == null) { return new Status("ERR11015", exchange.getStatusCode(), swaggerOperation.getPathString().original()); } if (swaggerResponse.getSchema() == null) { return null; } String body = exchange.getOutputStream().toString(); if (body == null || body.length() == 0) { return new Status("ERR11016", swaggerOperation.getMethod(), swaggerOperation.getPathString().original()); } return schemaValidator.validate(body, swaggerResponse.getSchema()); }
java
public Status validateResponse(final HttpServerExchange exchange, final SwaggerOperation swaggerOperation) { requireNonNull(exchange, "An exchange is required"); requireNonNull(swaggerOperation, "A swagger operation is required"); io.swagger.models.Response swaggerResponse = swaggerOperation.getOperation().getResponses().get(Integer.toString(exchange.getStatusCode())); if (swaggerResponse == null) { swaggerResponse = swaggerOperation.getOperation().getResponses().get("default"); // try the default response } if (swaggerResponse == null) { return new Status("ERR11015", exchange.getStatusCode(), swaggerOperation.getPathString().original()); } if (swaggerResponse.getSchema() == null) { return null; } String body = exchange.getOutputStream().toString(); if (body == null || body.length() == 0) { return new Status("ERR11016", swaggerOperation.getMethod(), swaggerOperation.getPathString().original()); } return schemaValidator.validate(body, swaggerResponse.getSchema()); }
[ "public", "Status", "validateResponse", "(", "final", "HttpServerExchange", "exchange", ",", "final", "SwaggerOperation", "swaggerOperation", ")", "{", "requireNonNull", "(", "exchange", ",", "\"An exchange is required\"", ")", ";", "requireNonNull", "(", "swaggerOperatio...
Validate the given response against the API operation. @param exchange The exchange to validate @param swaggerOperation The API operation to validate the response against @return A status containing validation error
[ "Validate", "the", "given", "response", "against", "the", "API", "operation", "." ]
train
https://github.com/networknt/light-rest-4j/blob/06b15128e6101351e617284a636ef5d632e6b1fe/swagger-validator/src/main/java/com/networknt/validator/ResponseValidator.java#L50-L72
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java
MutateInBuilder.arrayAddUnique
public <T> MutateInBuilder arrayAddUnique(String path, T value, SubdocOptionsBuilder optionsBuilder) { asyncBuilder.arrayAddUnique(path, value, optionsBuilder); return this; }
java
public <T> MutateInBuilder arrayAddUnique(String path, T value, SubdocOptionsBuilder optionsBuilder) { asyncBuilder.arrayAddUnique(path, value, optionsBuilder); return this; }
[ "public", "<", "T", ">", "MutateInBuilder", "arrayAddUnique", "(", "String", "path", ",", "T", "value", ",", "SubdocOptionsBuilder", "optionsBuilder", ")", "{", "asyncBuilder", ".", "arrayAddUnique", "(", "path", ",", "value", ",", "optionsBuilder", ")", ";", ...
Insert a value in an existing array only if the value isn't already contained in the array (by way of string comparison). @param path the path to mutate in the JSON. @param value the value to insert. @param optionsBuilder {@link SubdocOptionsBuilder}
[ "Insert", "a", "value", "in", "an", "existing", "array", "only", "if", "the", "value", "isn", "t", "already", "contained", "in", "the", "array", "(", "by", "way", "of", "string", "comparison", ")", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L1031-L1034
graknlabs/grakn
server/src/graql/gremlin/sets/LabelFragmentSet.java
LabelFragmentSet.tryExpandSubs
@Nullable LabelFragmentSet tryExpandSubs(Variable typeVar, TransactionOLTP tx) { if (labels().size() != 1) return null; Label oldLabel = Iterables.getOnlyElement(labels()); SchemaConcept concept = tx.getSchemaConcept(oldLabel); if (concept == null) return null; Set<Label> newLabels = concept.subs().map(SchemaConcept::label).collect(toSet()); return new AutoValue_LabelFragmentSet(varProperty(), typeVar, ImmutableSet.copyOf(newLabels)); }
java
@Nullable LabelFragmentSet tryExpandSubs(Variable typeVar, TransactionOLTP tx) { if (labels().size() != 1) return null; Label oldLabel = Iterables.getOnlyElement(labels()); SchemaConcept concept = tx.getSchemaConcept(oldLabel); if (concept == null) return null; Set<Label> newLabels = concept.subs().map(SchemaConcept::label).collect(toSet()); return new AutoValue_LabelFragmentSet(varProperty(), typeVar, ImmutableSet.copyOf(newLabels)); }
[ "@", "Nullable", "LabelFragmentSet", "tryExpandSubs", "(", "Variable", "typeVar", ",", "TransactionOLTP", "tx", ")", "{", "if", "(", "labels", "(", ")", ".", "size", "(", ")", "!=", "1", ")", "return", "null", ";", "Label", "oldLabel", "=", "Iterables", ...
Expand a {@link LabelFragmentSet} to match all sub-concepts of the single existing {@link Label}. Returns null if there is not exactly one label any of the {@link Label}s mentioned are not in the knowledge base.
[ "Expand", "a", "{", "@link", "LabelFragmentSet", "}", "to", "match", "all", "sub", "-", "concepts", "of", "the", "single", "existing", "{", "@link", "Label", "}", "." ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/sets/LabelFragmentSet.java#L58-L70
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/tools/VueGWTTools.java
VueGWTTools.getDeepValue
public static <T> T getDeepValue(Object object, String path) { JsPropertyMap objectMap = (JsPropertyMap) object; String[] pathSplit = path.split("\\."); for (String s : pathSplit) { objectMap = (JsPropertyMap) objectMap.get(s); } return (T) objectMap; }
java
public static <T> T getDeepValue(Object object, String path) { JsPropertyMap objectMap = (JsPropertyMap) object; String[] pathSplit = path.split("\\."); for (String s : pathSplit) { objectMap = (JsPropertyMap) objectMap.get(s); } return (T) objectMap; }
[ "public", "static", "<", "T", ">", "T", "getDeepValue", "(", "Object", "object", ",", "String", "path", ")", "{", "JsPropertyMap", "objectMap", "=", "(", "JsPropertyMap", ")", "object", ";", "String", "[", "]", "pathSplit", "=", "path", ".", "split", "("...
Return a "deep" value in a given object by following an expression in the form: "parent.child.property". This only works if all the chain is exposed using JsInterop. @param object The root object to get on @param path The path to follow @param <T> The type of object we get in return @return The object at the end of the chain
[ "Return", "a", "deep", "value", "in", "a", "given", "object", "by", "following", "an", "expression", "in", "the", "form", ":", "parent", ".", "child", ".", "property", ".", "This", "only", "works", "if", "all", "the", "chain", "is", "exposed", "using", ...
train
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/tools/VueGWTTools.java#L98-L105
VoltDB/voltdb
src/frontend/org/voltdb/SQLStmt.java
SQLStmt.getText
public String getText() { if (sqlTextStr == null) { sqlTextStr = new String(sqlText, Constants.UTF8ENCODING); } return sqlTextStr; }
java
public String getText() { if (sqlTextStr == null) { sqlTextStr = new String(sqlText, Constants.UTF8ENCODING); } return sqlTextStr; }
[ "public", "String", "getText", "(", ")", "{", "if", "(", "sqlTextStr", "==", "null", ")", "{", "sqlTextStr", "=", "new", "String", "(", "sqlText", ",", "Constants", ".", "UTF8ENCODING", ")", ";", "}", "return", "sqlTextStr", ";", "}" ]
Get the text of the SQL statement represented. @return String containing the text of the SQL statement represented.
[ "Get", "the", "text", "of", "the", "SQL", "statement", "represented", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/SQLStmt.java#L201-L206
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.addAll
public static <T> boolean addAll(Collection<T> self, T[] items) { return self.addAll(Arrays.asList(items)); }
java
public static <T> boolean addAll(Collection<T> self, T[] items) { return self.addAll(Arrays.asList(items)); }
[ "public", "static", "<", "T", ">", "boolean", "addAll", "(", "Collection", "<", "T", ">", "self", ",", "T", "[", "]", "items", ")", "{", "return", "self", ".", "addAll", "(", "Arrays", ".", "asList", "(", "items", ")", ")", ";", "}" ]
Modifies the collection by adding all of the elements in the specified array to the collection. The behavior of this operation is undefined if the specified array is modified while the operation is in progress. See also <code>plus</code> or the '+' operator if wanting to produce a new collection containing additional items but while leaving the original collection unchanged. @param self a Collection to be modified @param items array containing elements to be added to this collection @return <tt>true</tt> if this collection changed as a result of the call @see Collection#addAll(Collection) @since 1.7.2
[ "Modifies", "the", "collection", "by", "adding", "all", "of", "the", "elements", "in", "the", "specified", "array", "to", "the", "collection", ".", "The", "behavior", "of", "this", "operation", "is", "undefined", "if", "the", "specified", "array", "is", "mod...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L5136-L5138
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.getSiteDetectorSlotAsync
public Observable<Page<DetectorDefinitionInner>> getSiteDetectorSlotAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName, final String slot) { return getSiteDetectorSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, detectorName, slot) .map(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Page<DetectorDefinitionInner>>() { @Override public Page<DetectorDefinitionInner> call(ServiceResponse<Page<DetectorDefinitionInner>> response) { return response.body(); } }); }
java
public Observable<Page<DetectorDefinitionInner>> getSiteDetectorSlotAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName, final String slot) { return getSiteDetectorSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, detectorName, slot) .map(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Page<DetectorDefinitionInner>>() { @Override public Page<DetectorDefinitionInner> call(ServiceResponse<Page<DetectorDefinitionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DetectorDefinitionInner", ">", ">", "getSiteDetectorSlotAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ",", "final", "String", "diagnosticCategory", ",", "final", "String", "detectorN...
Get Detector. Get Detector. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param detectorName Detector Name @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorDefinitionInner&gt; object
[ "Get", "Detector", ".", "Get", "Detector", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L2267-L2275
s1ck/gdl
src/main/java/org/s1ck/gdl/GDLLoader.java
GDLLoader.processConjunctionExpression
private void processConjunctionExpression(List<TerminalNode> conjunctions) { Predicate conjunctionReuse; for (int i = conjunctions.size() - 1; i >= 0; i--) { Predicate rhs = currentPredicates.removeLast(); Predicate lhs = currentPredicates.removeLast(); switch (conjunctions.get(i).getText().toLowerCase()) { case "and": conjunctionReuse = new And(lhs, rhs); break; case "or": conjunctionReuse = new Or(lhs, rhs); break; default: conjunctionReuse = new Xor(lhs, rhs); break; } currentPredicates.add(conjunctionReuse); } }
java
private void processConjunctionExpression(List<TerminalNode> conjunctions) { Predicate conjunctionReuse; for (int i = conjunctions.size() - 1; i >= 0; i--) { Predicate rhs = currentPredicates.removeLast(); Predicate lhs = currentPredicates.removeLast(); switch (conjunctions.get(i).getText().toLowerCase()) { case "and": conjunctionReuse = new And(lhs, rhs); break; case "or": conjunctionReuse = new Or(lhs, rhs); break; default: conjunctionReuse = new Xor(lhs, rhs); break; } currentPredicates.add(conjunctionReuse); } }
[ "private", "void", "processConjunctionExpression", "(", "List", "<", "TerminalNode", ">", "conjunctions", ")", "{", "Predicate", "conjunctionReuse", ";", "for", "(", "int", "i", "=", "conjunctions", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";"...
Processes a conjuctive expression (AND, OR, XOR) and connects the filter with the corresponding operator @param conjunctions list of conjunction operators
[ "Processes", "a", "conjuctive", "expression", "(", "AND", "OR", "XOR", ")", "and", "connects", "the", "filter", "with", "the", "corresponding", "operator" ]
train
https://github.com/s1ck/gdl/blob/c89b0f83526661823ad3392f338dbf7dc3e3f834/src/main/java/org/s1ck/gdl/GDLLoader.java#L474-L494
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java
KTypeArrayDeque.descendingForEach
private void descendingForEach(KTypePredicate<? super KType> predicate, int fromIndex, final int toIndex) { if (fromIndex == toIndex) return; final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer); int i = toIndex; do { i = oneLeft(i, buffer.length); if (!predicate.apply(buffer[i])) { break; } } while (i != fromIndex); }
java
private void descendingForEach(KTypePredicate<? super KType> predicate, int fromIndex, final int toIndex) { if (fromIndex == toIndex) return; final KType[] buffer = Intrinsics.<KType[]> cast(this.buffer); int i = toIndex; do { i = oneLeft(i, buffer.length); if (!predicate.apply(buffer[i])) { break; } } while (i != fromIndex); }
[ "private", "void", "descendingForEach", "(", "KTypePredicate", "<", "?", "super", "KType", ">", "predicate", ",", "int", "fromIndex", ",", "final", "int", "toIndex", ")", "{", "if", "(", "fromIndex", "==", "toIndex", ")", "return", ";", "final", "KType", "...
Applies <code>predicate</code> to a slice of the deque, <code>toIndex</code>, exclusive, down to <code>fromIndex</code>, inclusive or until the predicate returns <code>false</code>.
[ "Applies", "<code", ">", "predicate<", "/", "code", ">", "to", "a", "slice", "of", "the", "deque", "<code", ">", "toIndex<", "/", "code", ">", "exclusive", "down", "to", "<code", ">", "fromIndex<", "/", "code", ">", "inclusive", "or", "until", "the", "...
train
https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayDeque.java#L746-L758
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java
ExternalScriptable.put
public void put(String name, Scriptable start, Object value) { if (start == this) { synchronized (this) { if (isEmpty(name)) { indexedProps.put(name, value); } else { synchronized (context) { int scope = context.getAttributesScope(name); if (scope == -1) { scope = ScriptContext.ENGINE_SCOPE; } context.setAttribute(name, jsToJava(value), scope); } } } } else { start.put(name, start, value); } }
java
public void put(String name, Scriptable start, Object value) { if (start == this) { synchronized (this) { if (isEmpty(name)) { indexedProps.put(name, value); } else { synchronized (context) { int scope = context.getAttributesScope(name); if (scope == -1) { scope = ScriptContext.ENGINE_SCOPE; } context.setAttribute(name, jsToJava(value), scope); } } } } else { start.put(name, start, value); } }
[ "public", "void", "put", "(", "String", "name", ",", "Scriptable", "start", ",", "Object", "value", ")", "{", "if", "(", "start", "==", "this", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "isEmpty", "(", "name", ")", ")", "{", "inde...
Sets the value of the named property, creating it if need be. @param name the name of the property @param start the object whose property is being set @param value value to set the property to
[ "Sets", "the", "value", "of", "the", "named", "property", "creating", "it", "if", "need", "be", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java#L173-L191
apache/incubator-atlas
webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
DiscoveryREST.searchWithParameters
@Path("basic") @POST @Consumes(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE) public AtlasSearchResult searchWithParameters(SearchParameters parameters) throws AtlasBaseException { AtlasPerfTracer perf = null; try { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.searchWithParameters("+ parameters + ")"); } if (parameters.getLimit() < 0 || parameters.getOffset() < 0) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Limit/offset should be non-negative"); } if (StringUtils.isEmpty(parameters.getTypeName()) && !isEmpty(parameters.getEntityFilters())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "EntityFilters specified without Type name"); } if (StringUtils.isEmpty(parameters.getClassification()) && !isEmpty(parameters.getTagFilters())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "TagFilters specified without tag name"); } return atlasDiscoveryService.searchWithParameters(parameters); } finally { AtlasPerfTracer.log(perf); } }
java
@Path("basic") @POST @Consumes(Servlets.JSON_MEDIA_TYPE) @Produces(Servlets.JSON_MEDIA_TYPE) public AtlasSearchResult searchWithParameters(SearchParameters parameters) throws AtlasBaseException { AtlasPerfTracer perf = null; try { if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) { perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.searchWithParameters("+ parameters + ")"); } if (parameters.getLimit() < 0 || parameters.getOffset() < 0) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Limit/offset should be non-negative"); } if (StringUtils.isEmpty(parameters.getTypeName()) && !isEmpty(parameters.getEntityFilters())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "EntityFilters specified without Type name"); } if (StringUtils.isEmpty(parameters.getClassification()) && !isEmpty(parameters.getTagFilters())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "TagFilters specified without tag name"); } return atlasDiscoveryService.searchWithParameters(parameters); } finally { AtlasPerfTracer.log(perf); } }
[ "@", "Path", "(", "\"basic\"", ")", "@", "POST", "@", "Consumes", "(", "Servlets", ".", "JSON_MEDIA_TYPE", ")", "@", "Produces", "(", "Servlets", ".", "JSON_MEDIA_TYPE", ")", "public", "AtlasSearchResult", "searchWithParameters", "(", "SearchParameters", "paramete...
Attribute based search for entities satisfying the search parameters @param parameters Search parameters @return Atlas search result @throws AtlasBaseException @HTTP 200 On successful search @HTTP 400 Tag/Entity doesn't exist or Tag/entity filter is present without tag/type name
[ "Attribute", "based", "search", "for", "entities", "satisfying", "the", "search", "parameters", "@param", "parameters", "Search", "parameters", "@return", "Atlas", "search", "result", "@throws", "AtlasBaseException" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java#L228-L256
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java
ConditionalCheck.notEmpty
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T> void notEmpty(final boolean condition, @Nonnull final T[] array) { if (condition) { Check.notEmpty(array); } }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T> void notEmpty(final boolean condition, @Nonnull final T[] array) { if (condition) { Check.notEmpty(array); } }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalEmptyArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", ">", "void", "notEmpty", "(", "final", "boolean", "condition", ",", "@", ...
Ensures that a passed map as a parameter of the calling method is not empty. <p> We recommend to use the overloaded method {@link Check#notEmpty(Object[], String)} and pass as second argument the name of the parameter to enhance the exception message. @param condition condition must be {@code true}^ so that the check will be performed @param array a map which should not be empty @throws IllegalNullArgumentException if the given argument {@code array} is {@code null} @throws IllegalEmptyArgumentException if the given argument {@code array} is empty
[ "Ensures", "that", "a", "passed", "map", "as", "a", "parameter", "of", "the", "calling", "method", "is", "not", "empty", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L1415-L1421
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.receiverSameAsArgument
public static Matcher<? super MethodInvocationTree> receiverSameAsArgument(final int argNum) { return new Matcher<MethodInvocationTree>() { @Override public boolean matches(MethodInvocationTree t, VisitorState state) { List<? extends ExpressionTree> args = t.getArguments(); if (args.size() <= argNum) { return false; } ExpressionTree arg = args.get(argNum); JCExpression methodSelect = (JCExpression) t.getMethodSelect(); if (methodSelect instanceof JCFieldAccess) { JCFieldAccess fieldAccess = (JCFieldAccess) methodSelect; return ASTHelpers.sameVariable(fieldAccess.getExpression(), arg); } else if (methodSelect instanceof JCIdent) { // A bare method call: "equals(foo)". Receiver is implicitly "this". return "this".equals(arg.toString()); } return false; } }; }
java
public static Matcher<? super MethodInvocationTree> receiverSameAsArgument(final int argNum) { return new Matcher<MethodInvocationTree>() { @Override public boolean matches(MethodInvocationTree t, VisitorState state) { List<? extends ExpressionTree> args = t.getArguments(); if (args.size() <= argNum) { return false; } ExpressionTree arg = args.get(argNum); JCExpression methodSelect = (JCExpression) t.getMethodSelect(); if (methodSelect instanceof JCFieldAccess) { JCFieldAccess fieldAccess = (JCFieldAccess) methodSelect; return ASTHelpers.sameVariable(fieldAccess.getExpression(), arg); } else if (methodSelect instanceof JCIdent) { // A bare method call: "equals(foo)". Receiver is implicitly "this". return "this".equals(arg.toString()); } return false; } }; }
[ "public", "static", "Matcher", "<", "?", "super", "MethodInvocationTree", ">", "receiverSameAsArgument", "(", "final", "int", "argNum", ")", "{", "return", "new", "Matcher", "<", "MethodInvocationTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", ...
Matches when the receiver of an instance method is the same reference as a particular argument to the method. For example, receiverSameAsArgument(1) would match {@code obj.method("", obj)} @param argNum The number of the argument to compare against (zero-based.
[ "Matches", "when", "the", "receiver", "of", "an", "instance", "method", "is", "the", "same", "reference", "as", "a", "particular", "argument", "to", "the", "method", ".", "For", "example", "receiverSameAsArgument", "(", "1", ")", "would", "match", "{", "@cod...
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L285-L307
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java
Key.toUrlSafe
public String toUrlSafe() { try { return URLEncoder.encode(TextFormat.printToString(toPb()), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Unexpected encoding exception", e); } }
java
public String toUrlSafe() { try { return URLEncoder.encode(TextFormat.printToString(toPb()), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Unexpected encoding exception", e); } }
[ "public", "String", "toUrlSafe", "(", ")", "{", "try", "{", "return", "URLEncoder", ".", "encode", "(", "TextFormat", ".", "printToString", "(", "toPb", "(", ")", ")", ",", "UTF_8", ".", "name", "(", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodi...
Returns the key in an encoded form that can be used as part of a URL.
[ "Returns", "the", "key", "in", "an", "encoded", "form", "that", "can", "be", "used", "as", "part", "of", "a", "URL", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java#L129-L135
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java
PatternsImpl.deletePatternAsync
public Observable<OperationStatus> deletePatternAsync(UUID appId, String versionId, UUID patternId) { return deletePatternWithServiceResponseAsync(appId, versionId, patternId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deletePatternAsync(UUID appId, String versionId, UUID patternId) { return deletePatternWithServiceResponseAsync(appId, versionId, patternId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deletePatternAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "patternId", ")", "{", "return", "deletePatternWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "patternId", ")",...
Deletes the pattern with the specified ID. @param appId The application ID. @param versionId The version ID. @param patternId The pattern ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deletes", "the", "pattern", "with", "the", "specified", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java#L786-L793
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java
InnerMetricContext.getCounters
@Override public SortedMap<String, Counter> getCounters(MetricFilter filter) { return getSimplyNamedMetrics(Counter.class, Optional.of(filter)); }
java
@Override public SortedMap<String, Counter> getCounters(MetricFilter filter) { return getSimplyNamedMetrics(Counter.class, Optional.of(filter)); }
[ "@", "Override", "public", "SortedMap", "<", "String", ",", "Counter", ">", "getCounters", "(", "MetricFilter", "filter", ")", "{", "return", "getSimplyNamedMetrics", "(", "Counter", ".", "class", ",", "Optional", ".", "of", "(", "filter", ")", ")", ";", "...
See {@link com.codahale.metrics.MetricRegistry#getCounters(com.codahale.metrics.MetricFilter)}. <p> This method will return fully-qualified metric names if the {@link MetricContext} is configured to report fully-qualified metric names. </p>
[ "See", "{", "@link", "com", ".", "codahale", ".", "metrics", ".", "MetricRegistry#getCounters", "(", "com", ".", "codahale", ".", "metrics", ".", "MetricFilter", ")", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java#L203-L206
google/auto
value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java
AnnotationOutput.sourceFormForInitializer
static String sourceFormForInitializer( AnnotationValue annotationValue, ProcessingEnvironment processingEnv, String memberName, Element context) { SourceFormVisitor visitor = new InitializerSourceFormVisitor(processingEnv, memberName, context); StringBuilder sb = new StringBuilder(); visitor.visit(annotationValue, sb); return sb.toString(); }
java
static String sourceFormForInitializer( AnnotationValue annotationValue, ProcessingEnvironment processingEnv, String memberName, Element context) { SourceFormVisitor visitor = new InitializerSourceFormVisitor(processingEnv, memberName, context); StringBuilder sb = new StringBuilder(); visitor.visit(annotationValue, sb); return sb.toString(); }
[ "static", "String", "sourceFormForInitializer", "(", "AnnotationValue", "annotationValue", ",", "ProcessingEnvironment", "processingEnv", ",", "String", "memberName", ",", "Element", "context", ")", "{", "SourceFormVisitor", "visitor", "=", "new", "InitializerSourceFormVisi...
Returns a string representation of the given annotation value, suitable for inclusion in a Java source file as the initializer of a variable of the appropriate type.
[ "Returns", "a", "string", "representation", "of", "the", "given", "annotation", "value", "suitable", "for", "inclusion", "in", "a", "Java", "source", "file", "as", "the", "initializer", "of", "a", "variable", "of", "the", "appropriate", "type", "." ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java#L179-L189
paypal/SeLion
server/src/main/java/com/paypal/selion/grid/FileDownloader.java
FileDownloader.checkForDownloads
static void checkForDownloads(InstanceType instanceType, boolean checkTimeStamp, boolean cleanup) { LOGGER.entering(); if (checkTimeStamp && (lastModifiedTime == DOWNLOAD_FILE.lastModified())) { return; } lastModifiedTime = DOWNLOAD_FILE.lastModified(); if (cleanup) { cleanup(); } List<URLChecksumEntity> artifactDetails = new ArrayList<ArtifactDetails.URLChecksumEntity>(); try { artifactDetails = ArtifactDetails.getArtifactDetailsForCurrentPlatformByRole(DOWNLOAD_FILE, instanceType); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Unable to open download.json file", e); throw new RuntimeException(e); } downloadAndExtractArtifacts(artifactDetails); LOGGER.exiting(); }
java
static void checkForDownloads(InstanceType instanceType, boolean checkTimeStamp, boolean cleanup) { LOGGER.entering(); if (checkTimeStamp && (lastModifiedTime == DOWNLOAD_FILE.lastModified())) { return; } lastModifiedTime = DOWNLOAD_FILE.lastModified(); if (cleanup) { cleanup(); } List<URLChecksumEntity> artifactDetails = new ArrayList<ArtifactDetails.URLChecksumEntity>(); try { artifactDetails = ArtifactDetails.getArtifactDetailsForCurrentPlatformByRole(DOWNLOAD_FILE, instanceType); } catch (IOException e) { LOGGER.log(Level.SEVERE, "Unable to open download.json file", e); throw new RuntimeException(e); } downloadAndExtractArtifacts(artifactDetails); LOGGER.exiting(); }
[ "static", "void", "checkForDownloads", "(", "InstanceType", "instanceType", ",", "boolean", "checkTimeStamp", ",", "boolean", "cleanup", ")", "{", "LOGGER", ".", "entering", "(", ")", ";", "if", "(", "checkTimeStamp", "&&", "(", "lastModifiedTime", "==", "DOWNLO...
Check download.json and download files based on {@link InstanceType} @param instanceType the {@link InstanceType} to process downlaods for @param checkTimeStamp whether to check the last modified time stamp of the downlaod.json file. Returns immediately on subsequent calls if <code>true</code> and last modified is unchanged. @param cleanup whether to cleanup previous downloads from a previous call to checkForDownloads in the same JVM
[ "Check", "download", ".", "json", "and", "download", "files", "based", "on", "{", "@link", "InstanceType", "}" ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/grid/FileDownloader.java#L173-L196
threerings/nenya
core/src/main/java/com/threerings/media/animation/FloatingTextAnimation.java
FloatingTextAnimation.paintLabels
protected void paintLabels (Graphics2D gfx, int x, int y) { _label.render(gfx, x, y); }
java
protected void paintLabels (Graphics2D gfx, int x, int y) { _label.render(gfx, x, y); }
[ "protected", "void", "paintLabels", "(", "Graphics2D", "gfx", ",", "int", "x", ",", "int", "y", ")", "{", "_label", ".", "render", "(", "gfx", ",", "x", ",", "y", ")", ";", "}" ]
Derived classes may wish to extend score animation and render more than just the standard single label. @param x the upper left coordinate of the animation. @param y the upper left coordinate of the animation.
[ "Derived", "classes", "may", "wish", "to", "extend", "score", "animation", "and", "render", "more", "than", "just", "the", "standard", "single", "label", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/FloatingTextAnimation.java#L195-L198
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java
QueryBatcherImpl.retryListener
@Override public void retryListener(QueryBatch batch, QueryBatchListener queryBatchListener) { // We get the batch and modify the client alone in order to make use // of the new forest client in case if the original host is unavailable. DatabaseClient client = null; Forest[] forests = batch.getBatcher().getForestConfig().listForests(); for(Forest forest : forests) { if(forest.equals(batch.getForest())) client = getMoveMgr().getForestClient(forest); } QueryBatchImpl retryBatch = new QueryBatchImpl() .withClient( client ) .withBatcher( batch.getBatcher() ) .withTimestamp( batch.getTimestamp() ) .withServerTimestamp( batch.getServerTimestamp() ) .withItems( batch.getItems() ) .withJobTicket( batch.getJobTicket() ) .withJobBatchNumber( batch.getJobBatchNumber() ) .withJobResultsSoFar( batch.getJobResultsSoFar() ) .withForestBatchNumber( batch.getForestBatchNumber() ) .withForestResultsSoFar( batch.getForestResultsSoFar() ) .withForest( batch.getForest() ) .withJobTicket( batch.getJobTicket() ); queryBatchListener.processEvent(retryBatch); }
java
@Override public void retryListener(QueryBatch batch, QueryBatchListener queryBatchListener) { // We get the batch and modify the client alone in order to make use // of the new forest client in case if the original host is unavailable. DatabaseClient client = null; Forest[] forests = batch.getBatcher().getForestConfig().listForests(); for(Forest forest : forests) { if(forest.equals(batch.getForest())) client = getMoveMgr().getForestClient(forest); } QueryBatchImpl retryBatch = new QueryBatchImpl() .withClient( client ) .withBatcher( batch.getBatcher() ) .withTimestamp( batch.getTimestamp() ) .withServerTimestamp( batch.getServerTimestamp() ) .withItems( batch.getItems() ) .withJobTicket( batch.getJobTicket() ) .withJobBatchNumber( batch.getJobBatchNumber() ) .withJobResultsSoFar( batch.getJobResultsSoFar() ) .withForestBatchNumber( batch.getForestBatchNumber() ) .withForestResultsSoFar( batch.getForestResultsSoFar() ) .withForest( batch.getForest() ) .withJobTicket( batch.getJobTicket() ); queryBatchListener.processEvent(retryBatch); }
[ "@", "Override", "public", "void", "retryListener", "(", "QueryBatch", "batch", ",", "QueryBatchListener", "queryBatchListener", ")", "{", "// We get the batch and modify the client alone in order to make use", "// of the new forest client in case if the original host is unavailable.", ...
/* Accepts a QueryBatch which was successfully retrieved from the server and a QueryBatchListener which was failed to apply and retry that listener on the batch.
[ "/", "*", "Accepts", "a", "QueryBatch", "which", "was", "successfully", "retrieved", "from", "the", "server", "and", "a", "QueryBatchListener", "which", "was", "failed", "to", "apply", "and", "retry", "that", "listener", "on", "the", "batch", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/impl/QueryBatcherImpl.java#L201-L225
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java
PixelMath.boundImage
public static void boundImage( GrayU8 img , int min , int max ) { ImplPixelMath.boundImage(img,min,max); }
java
public static void boundImage( GrayU8 img , int min , int max ) { ImplPixelMath.boundImage(img,min,max); }
[ "public", "static", "void", "boundImage", "(", "GrayU8", "img", ",", "int", "min", ",", "int", "max", ")", "{", "ImplPixelMath", ".", "boundImage", "(", "img", ",", "min", ",", "max", ")", ";", "}" ]
Bounds image pixels to be between these two values @param img Image @param min minimum value. @param max maximum value.
[ "Bounds", "image", "pixels", "to", "be", "between", "these", "two", "values" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4298-L4300
brettwooldridge/NuProcess
src/main/java/com/zaxxer/nuprocess/codec/NuAbstractCharsetHandler.java
NuAbstractCharsetHandler.onStdoutChars
protected void onStdoutChars(CharBuffer buffer, boolean closed, CoderResult coderResult) { // Consume the entire buffer by default. buffer.position(buffer.limit()); }
java
protected void onStdoutChars(CharBuffer buffer, boolean closed, CoderResult coderResult) { // Consume the entire buffer by default. buffer.position(buffer.limit()); }
[ "protected", "void", "onStdoutChars", "(", "CharBuffer", "buffer", ",", "boolean", "closed", ",", "CoderResult", "coderResult", ")", "{", "// Consume the entire buffer by default.", "buffer", ".", "position", "(", "buffer", ".", "limit", "(", ")", ")", ";", "}" ]
Override this to receive decoded Unicode Java string data read from stdout. <p> Make sure to set the {@link CharBuffer#position() position} of {@code buffer} to indicate how much data you have read before returning. @param buffer The {@link CharBuffer} receiving Unicode string data.
[ "Override", "this", "to", "receive", "decoded", "Unicode", "Java", "string", "data", "read", "from", "stdout", ".", "<p", ">", "Make", "sure", "to", "set", "the", "{", "@link", "CharBuffer#position", "()", "position", "}", "of", "{", "@code", "buffer", "}"...
train
https://github.com/brettwooldridge/NuProcess/blob/d4abdd195367fce7375a0b45cb2f5eeff1c74d03/src/main/java/com/zaxxer/nuprocess/codec/NuAbstractCharsetHandler.java#L149-L153
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/cdn/CdnClient.java
CdnClient.setHttpsConfig
public SetHttpsConfigResponse setHttpsConfig(SetHttpsConfigRequest request) { checkNotNull(request, "The parameter request should NOT be null."); InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config"); internalRequest.addParameter("https", ""); this.attachRequestToBody(request, internalRequest); return invokeHttpClient(internalRequest, SetHttpsConfigResponse.class); }
java
public SetHttpsConfigResponse setHttpsConfig(SetHttpsConfigRequest request) { checkNotNull(request, "The parameter request should NOT be null."); InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config"); internalRequest.addParameter("https", ""); this.attachRequestToBody(request, internalRequest); return invokeHttpClient(internalRequest, SetHttpsConfigResponse.class); }
[ "public", "SetHttpsConfigResponse", "setHttpsConfig", "(", "SetHttpsConfigRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "request",...
Set HTTPS with certain configuration. @param request The request containing all of the options related to the update request. @return Result of the setHTTPSAcceleration operation returned by the service.
[ "Set", "HTTPS", "with", "certain", "configuration", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L466-L473
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/scalebar/MapScaleBar.java
MapScaleBar.calculateScaleBarLengthAndValue
protected ScaleBarLengthAndValue calculateScaleBarLengthAndValue(DistanceUnitAdapter unitAdapter) { this.prevMapPosition = this.mapViewPosition.getMapPosition(); double groundResolution = MercatorProjection.calculateGroundResolution(this.prevMapPosition.latLong.latitude, MercatorProjection.getMapSize(this.prevMapPosition.zoomLevel, this.displayModel.getTileSize())); groundResolution = groundResolution / unitAdapter.getMeterRatio(); int[] scaleBarValues = unitAdapter.getScaleBarValues(); int scaleBarLength = 0; int mapScaleValue = 0; for (int scaleBarValue : scaleBarValues) { mapScaleValue = scaleBarValue; scaleBarLength = (int) (mapScaleValue / groundResolution); if (scaleBarLength < (this.mapScaleBitmap.getWidth() - 10)) { break; } } return new ScaleBarLengthAndValue(scaleBarLength, mapScaleValue); }
java
protected ScaleBarLengthAndValue calculateScaleBarLengthAndValue(DistanceUnitAdapter unitAdapter) { this.prevMapPosition = this.mapViewPosition.getMapPosition(); double groundResolution = MercatorProjection.calculateGroundResolution(this.prevMapPosition.latLong.latitude, MercatorProjection.getMapSize(this.prevMapPosition.zoomLevel, this.displayModel.getTileSize())); groundResolution = groundResolution / unitAdapter.getMeterRatio(); int[] scaleBarValues = unitAdapter.getScaleBarValues(); int scaleBarLength = 0; int mapScaleValue = 0; for (int scaleBarValue : scaleBarValues) { mapScaleValue = scaleBarValue; scaleBarLength = (int) (mapScaleValue / groundResolution); if (scaleBarLength < (this.mapScaleBitmap.getWidth() - 10)) { break; } } return new ScaleBarLengthAndValue(scaleBarLength, mapScaleValue); }
[ "protected", "ScaleBarLengthAndValue", "calculateScaleBarLengthAndValue", "(", "DistanceUnitAdapter", "unitAdapter", ")", "{", "this", ".", "prevMapPosition", "=", "this", ".", "mapViewPosition", ".", "getMapPosition", "(", ")", ";", "double", "groundResolution", "=", "...
Calculates the required length and value of the scalebar @param unitAdapter the DistanceUnitAdapter to calculate for @return a {@link ScaleBarLengthAndValue} object containing the required scaleBarLength and scaleBarValue
[ "Calculates", "the", "required", "length", "and", "value", "of", "the", "scalebar" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/scalebar/MapScaleBar.java#L205-L225
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java
DiskTypeId.of
public static DiskTypeId of(String zone, String type) { return of(ZoneId.of(null, zone), type); }
java
public static DiskTypeId of(String zone, String type) { return of(ZoneId.of(null, zone), type); }
[ "public", "static", "DiskTypeId", "of", "(", "String", "zone", ",", "String", "type", ")", "{", "return", "of", "(", "ZoneId", ".", "of", "(", "null", ",", "zone", ")", ",", "type", ")", ";", "}" ]
Returns a disk type identity given the zone and disk type names.
[ "Returns", "a", "disk", "type", "identity", "given", "the", "zone", "and", "disk", "type", "names", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java#L116-L118
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/FileSystem.java
FileSystem.uriCaseCheck
public static boolean uriCaseCheck(File file, String matchString) throws java.io.IOException { if (isCaseInsensitive || isWindows) { // security measure to ensure that this check is only performed on case // sensitive servers // begin 154268 matchString = WSUtil.resolveURI(matchString); // (removed since it is changed to "//" inside of resolveURI // matchString = matchString.replace ('/', '\\'); // change string from // url format to Windows format // end 154268 matchString = matchString.replace('/', File.separatorChar); String canPath = file.getCanonicalPath(); // begin 540920 change for drive letter ignore case on Win 2008 int offset = 0; int inx = matchString.length(); if (isWindows && inx > 1 && canPath.length() > 0 && matchString.charAt(1) == ':') { // check that the string to match starts with a drive letter (':'), and // the drive letter is the same as canonical if (!(matchString.substring(0, 1).equalsIgnoreCase(canPath.substring(0, 1)))) { return false; } // make the offset 1 for the regionMatches so that we do not compare the // drive letters offset = 1; } return canPath.regionMatches(canPath.length() - inx + offset, matchString, offset, inx - offset); // end 540920 } return true; }
java
public static boolean uriCaseCheck(File file, String matchString) throws java.io.IOException { if (isCaseInsensitive || isWindows) { // security measure to ensure that this check is only performed on case // sensitive servers // begin 154268 matchString = WSUtil.resolveURI(matchString); // (removed since it is changed to "//" inside of resolveURI // matchString = matchString.replace ('/', '\\'); // change string from // url format to Windows format // end 154268 matchString = matchString.replace('/', File.separatorChar); String canPath = file.getCanonicalPath(); // begin 540920 change for drive letter ignore case on Win 2008 int offset = 0; int inx = matchString.length(); if (isWindows && inx > 1 && canPath.length() > 0 && matchString.charAt(1) == ':') { // check that the string to match starts with a drive letter (':'), and // the drive letter is the same as canonical if (!(matchString.substring(0, 1).equalsIgnoreCase(canPath.substring(0, 1)))) { return false; } // make the offset 1 for the regionMatches so that we do not compare the // drive letters offset = 1; } return canPath.regionMatches(canPath.length() - inx + offset, matchString, offset, inx - offset); // end 540920 } return true; }
[ "public", "static", "boolean", "uriCaseCheck", "(", "File", "file", ",", "String", "matchString", ")", "throws", "java", ".", "io", ".", "IOException", "{", "if", "(", "isCaseInsensitive", "||", "isWindows", ")", "{", "// security measure to ensure that this check i...
Not a problem on UNIX type systems since the OS handles is case sensitive.
[ "Not", "a", "problem", "on", "UNIX", "type", "systems", "since", "the", "OS", "handles", "is", "case", "sensitive", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/FileSystem.java#L35-L66
rythmengine/rythmengine
src/main/java/org/rythmengine/template/TemplateBase.java
TemplateBase.__triggerRenderEvent
protected void __triggerRenderEvent(IEvent<Void, ITemplate> event, RythmEngine engine) { event.trigger(engine, this); }
java
protected void __triggerRenderEvent(IEvent<Void, ITemplate> event, RythmEngine engine) { event.trigger(engine, this); }
[ "protected", "void", "__triggerRenderEvent", "(", "IEvent", "<", "Void", ",", "ITemplate", ">", "event", ",", "RythmEngine", "engine", ")", "{", "event", ".", "trigger", "(", "engine", ",", "this", ")", ";", "}" ]
Trigger render events. <p>Not an API for user application</p> @param event @param engine
[ "Trigger", "render", "events", ".", "<p", ">", "Not", "an", "API", "for", "user", "application<", "/", "p", ">" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L562-L564
hpsa/hpe-application-automation-tools-plugin
src/main/java/com/hp/application/automation/tools/rest/RestClient.java
RestClient.setProxyCfg
public static ProxyInfo setProxyCfg(String host, String port, String userName, String password) { return new ProxyInfo(host, port, userName, password); }
java
public static ProxyInfo setProxyCfg(String host, String port, String userName, String password) { return new ProxyInfo(host, port, userName, password); }
[ "public", "static", "ProxyInfo", "setProxyCfg", "(", "String", "host", ",", "String", "port", ",", "String", "userName", ",", "String", "password", ")", "{", "return", "new", "ProxyInfo", "(", "host", ",", "port", ",", "userName", ",", "password", ")", ";"...
Set proxy configuration. @param host @param port @param userName @param password @return proxyinfo instance
[ "Set", "proxy", "configuration", "." ]
train
https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/rest/RestClient.java#L422-L424
remkop/picocli
src/main/java/picocli/CommandLine.java
CommandLine.addMixin
public CommandLine addMixin(String name, Object mixin) { getCommandSpec().addMixin(name, CommandSpec.forAnnotatedObject(mixin, factory)); return this; }
java
public CommandLine addMixin(String name, Object mixin) { getCommandSpec().addMixin(name, CommandSpec.forAnnotatedObject(mixin, factory)); return this; }
[ "public", "CommandLine", "addMixin", "(", "String", "name", ",", "Object", "mixin", ")", "{", "getCommandSpec", "(", ")", ".", "addMixin", "(", "name", ",", "CommandSpec", ".", "forAnnotatedObject", "(", "mixin", ",", "factory", ")", ")", ";", "return", "t...
Adds the options and positional parameters in the specified mixin to this command. <p>The specified object may be a {@link CommandSpec CommandSpec} object, or it may be a user object with {@code @Option} and {@code @Parameters}-annotated fields, in which case picocli automatically constructs a {@code CommandSpec} from this user object. </p> @param name the name by which the mixin object may later be retrieved @param mixin an annotated user object or a {@link CommandSpec CommandSpec} object whose options and positional parameters to add to this command @return this CommandLine object, to allow method chaining @since 3.0
[ "Adds", "the", "options", "and", "positional", "parameters", "in", "the", "specified", "mixin", "to", "this", "command", ".", "<p", ">", "The", "specified", "object", "may", "be", "a", "{" ]
train
https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/CommandLine.java#L240-L243
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/ZipUtil.java
ZipUtil.extractZip
public static void extractZip(final String path, final File dest) throws IOException { extractZip(path, dest, null); }
java
public static void extractZip(final String path, final File dest) throws IOException { extractZip(path, dest, null); }
[ "public", "static", "void", "extractZip", "(", "final", "String", "path", ",", "final", "File", "dest", ")", "throws", "IOException", "{", "extractZip", "(", "path", ",", "dest", ",", "null", ")", ";", "}" ]
Extracts all contents of the file to the destination directory @param path zip file path @param dest destination directory @throws IOException on io error
[ "Extracts", "all", "contents", "of", "the", "file", "to", "the", "destination", "directory" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/ZipUtil.java#L45-L47
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.regenerateKey
public void regenerateKey(String resourceGroupName, String accountName, KeyKind keyKind) { regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).toBlocking().last().body(); }
java
public void regenerateKey(String resourceGroupName, String accountName, KeyKind keyKind) { regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).toBlocking().last().body(); }
[ "public", "void", "regenerateKey", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "KeyKind", "keyKind", ")", "{", "regenerateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "keyKind", ")", ".", "toBlocking", "("...
Regenerates an access key for the specified Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Regenerates", "an", "access", "key", "for", "the", "specified", "Azure", "Cosmos", "DB", "database", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1800-L1802
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
ZooKeeperUtils.useNamespaceAndEnsurePath
public static CuratorFramework useNamespaceAndEnsurePath(final CuratorFramework client, final String path) throws Exception { Preconditions.checkNotNull(client, "client must not be null"); Preconditions.checkNotNull(path, "path must not be null"); // Ensure that the checkpoints path exists client.newNamespaceAwareEnsurePath(path) .ensure(client.getZookeeperClient()); // All operations will have the path as root return client.usingNamespace(generateZookeeperPath(client.getNamespace(), path)); }
java
public static CuratorFramework useNamespaceAndEnsurePath(final CuratorFramework client, final String path) throws Exception { Preconditions.checkNotNull(client, "client must not be null"); Preconditions.checkNotNull(path, "path must not be null"); // Ensure that the checkpoints path exists client.newNamespaceAwareEnsurePath(path) .ensure(client.getZookeeperClient()); // All operations will have the path as root return client.usingNamespace(generateZookeeperPath(client.getNamespace(), path)); }
[ "public", "static", "CuratorFramework", "useNamespaceAndEnsurePath", "(", "final", "CuratorFramework", "client", ",", "final", "String", "path", ")", "throws", "Exception", "{", "Preconditions", ".", "checkNotNull", "(", "client", ",", "\"client must not be null\"", ")"...
Returns a facade of the client that uses the specified namespace, and ensures that all nodes in the path exist. @param client ZK client @param path the new namespace @return ZK Client that uses the new namespace @throws Exception ZK errors
[ "Returns", "a", "facade", "of", "the", "client", "that", "uses", "the", "specified", "namespace", "and", "ensures", "that", "all", "nodes", "in", "the", "path", "exist", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java#L392-L402
mikepenz/FastAdapter
library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/scroll/EndlessScrollHelper.java
EndlessScrollHelper.onLoadMore
protected void onLoadMore(@NonNull ResultReceiver<Model> out, int currentPage) { OnLoadMoreHandler<Model> loadMoreHandler = this.mOnLoadMoreHandler; try { loadMoreHandler.onLoadMore(out, currentPage); } catch (NullPointerException npe) { // Lazy null checking! If this was our npe, then throw with an appropriate message. throw loadMoreHandler != null ? npe : new NullPointerException("You must provide an `OnLoadMoreHandler`"); } }
java
protected void onLoadMore(@NonNull ResultReceiver<Model> out, int currentPage) { OnLoadMoreHandler<Model> loadMoreHandler = this.mOnLoadMoreHandler; try { loadMoreHandler.onLoadMore(out, currentPage); } catch (NullPointerException npe) { // Lazy null checking! If this was our npe, then throw with an appropriate message. throw loadMoreHandler != null ? npe : new NullPointerException("You must provide an `OnLoadMoreHandler`"); } }
[ "protected", "void", "onLoadMore", "(", "@", "NonNull", "ResultReceiver", "<", "Model", ">", "out", ",", "int", "currentPage", ")", "{", "OnLoadMoreHandler", "<", "Model", ">", "loadMoreHandler", "=", "this", ".", "mOnLoadMoreHandler", ";", "try", "{", "loadMo...
The default implementation takes care of calling the previously set {@link OnLoadMoreHandler OnLoadMoreHandler}. @param out @param currentPage @see #withOnLoadMoreHandler(OnLoadMoreHandler) withOnLoadMoreHandler(OnLoadMoreHandler)
[ "The", "default", "implementation", "takes", "care", "of", "calling", "the", "previously", "set", "{", "@link", "OnLoadMoreHandler", "OnLoadMoreHandler", "}", "." ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/scroll/EndlessScrollHelper.java#L222-L231
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java
StringSupport.containsCharacters
public static boolean containsCharacters(String in, String chars) { for (int i = 0; i < chars.length(); i++) { if (in.indexOf(chars.charAt(i)) != -1) { return true; } } return false; }
java
public static boolean containsCharacters(String in, String chars) { for (int i = 0; i < chars.length(); i++) { if (in.indexOf(chars.charAt(i)) != -1) { return true; } } return false; }
[ "public", "static", "boolean", "containsCharacters", "(", "String", "in", ",", "String", "chars", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chars", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "in", ".", "indexO...
tells whether one or more characters in a String are part of a given String @param in String to evaluate @param chars characters which are to be tested in the given String
[ "tells", "whether", "one", "or", "more", "characters", "in", "a", "String", "are", "part", "of", "a", "given", "String" ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L415-L422
wcm-io-caravan/caravan-hal
resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java
HalResource.addEmbedded
public HalResource addEmbedded(String relation, Iterable<HalResource> resources) { return addEmbedded(relation, Iterables.toArray(resources, HalResource.class)); }
java
public HalResource addEmbedded(String relation, Iterable<HalResource> resources) { return addEmbedded(relation, Iterables.toArray(resources, HalResource.class)); }
[ "public", "HalResource", "addEmbedded", "(", "String", "relation", ",", "Iterable", "<", "HalResource", ">", "resources", ")", "{", "return", "addEmbedded", "(", "relation", ",", "Iterables", ".", "toArray", "(", "resources", ",", "HalResource", ".", "class", ...
Embed resources for the given relation @param relation Embedded resource relation @param resources Resources to embed @return HAL resource
[ "Embed", "resources", "for", "the", "given", "relation" ]
train
https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java#L362-L364
wcm-io-caravan/caravan-hal
resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java
HalResource.addLinks
public HalResource addLinks(String relation, Iterable<Link> links) { return addLinks(relation, Iterables.toArray(links, Link.class)); }
java
public HalResource addLinks(String relation, Iterable<Link> links) { return addLinks(relation, Iterables.toArray(links, Link.class)); }
[ "public", "HalResource", "addLinks", "(", "String", "relation", ",", "Iterable", "<", "Link", ">", "links", ")", "{", "return", "addLinks", "(", "relation", ",", "Iterables", ".", "toArray", "(", "links", ",", "Link", ".", "class", ")", ")", ";", "}" ]
Adds links for the given relation @param relation Link relation @param links Links to add @return HAL resource
[ "Adds", "links", "for", "the", "given", "relation" ]
train
https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/resource/src/main/java/io/wcm/caravan/hal/resource/HalResource.java#L327-L329
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.createMessageReceiverFromConnectionString
public static IMessageReceiver createMessageReceiverFromConnectionString(String amqpConnectionString, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(createMessageReceiverFromConnectionStringAsync(amqpConnectionString, receiveMode)); }
java
public static IMessageReceiver createMessageReceiverFromConnectionString(String amqpConnectionString, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(createMessageReceiverFromConnectionStringAsync(amqpConnectionString, receiveMode)); }
[ "public", "static", "IMessageReceiver", "createMessageReceiverFromConnectionString", "(", "String", "amqpConnectionString", ",", "ReceiveMode", "receiveMode", ")", "throws", "InterruptedException", ",", "ServiceBusException", "{", "return", "Utils", ".", "completeFuture", "("...
Create {@link IMessageReceiver} in default {@link ReceiveMode#PEEKLOCK} mode from service bus connection string with <a href="https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-sas">Shared Access Signatures</a> @param amqpConnectionString the connection string @param receiveMode {@link ReceiveMode} PeekLock or ReceiveAndDelete @return {@link IMessageReceiver} instance @throws InterruptedException if the current thread was interrupted while waiting @throws ServiceBusException if the receiver cannot be created
[ "Create", "{", "@link", "IMessageReceiver", "}", "in", "default", "{", "@link", "ReceiveMode#PEEKLOCK", "}", "mode", "from", "service", "bus", "connection", "string", "with", "<a", "href", "=", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L237-L239
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java
JCRAssert.assertMixinNodeType
public static void assertMixinNodeType(final Node node, final String mixinType) throws RepositoryException { for (final NodeType nt : node.getMixinNodeTypes()) { if (mixinType.equals(nt.getName())) { return; } } fail("Node " + node.getPath() + " has no mixin type " + mixinType); }
java
public static void assertMixinNodeType(final Node node, final String mixinType) throws RepositoryException { for (final NodeType nt : node.getMixinNodeTypes()) { if (mixinType.equals(nt.getName())) { return; } } fail("Node " + node.getPath() + " has no mixin type " + mixinType); }
[ "public", "static", "void", "assertMixinNodeType", "(", "final", "Node", "node", ",", "final", "String", "mixinType", ")", "throws", "RepositoryException", "{", "for", "(", "final", "NodeType", "nt", ":", "node", ".", "getMixinNodeTypes", "(", ")", ")", "{", ...
Asserts one of the node's mixin type equals the specified nodetype @param node the node whose mixin types should be checked @param mixinType the node type that is asserted to be one of the mixin types of the node @throws RepositoryException
[ "Asserts", "one", "of", "the", "node", "s", "mixin", "type", "equals", "the", "specified", "nodetype" ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java#L187-L194
Stratio/stratio-cassandra
src/java/org/apache/cassandra/tools/SSTableExport.java
SSTableExport.writeKey
private static void writeKey(PrintStream out, String value) { writeJSON(out, value); out.print(": "); }
java
private static void writeKey(PrintStream out, String value) { writeJSON(out, value); out.print(": "); }
[ "private", "static", "void", "writeKey", "(", "PrintStream", "out", ",", "String", "value", ")", "{", "writeJSON", "(", "out", ",", "value", ")", ";", "out", ".", "print", "(", "\": \"", ")", ";", "}" ]
JSON Hash Key serializer @param out The output steam to write data @param value value to set as a key
[ "JSON", "Hash", "Key", "serializer" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/tools/SSTableExport.java#L91-L95
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java
FileUtils.removeDuplicatesFromOutputDirectory
public static void removeDuplicatesFromOutputDirectory(File outputDirectory, File originDirectory) { if (originDirectory.isDirectory()) { for (String name : originDirectory.list()) { File targetFile = new File(outputDirectory, name); if (targetFile.exists() && targetFile.canWrite()) { if (!targetFile.isDirectory()) { targetFile.delete(); } else { FileUtils.removeDuplicatesFromOutputDirectory(targetFile, new File(originDirectory, name)); } } } } }
java
public static void removeDuplicatesFromOutputDirectory(File outputDirectory, File originDirectory) { if (originDirectory.isDirectory()) { for (String name : originDirectory.list()) { File targetFile = new File(outputDirectory, name); if (targetFile.exists() && targetFile.canWrite()) { if (!targetFile.isDirectory()) { targetFile.delete(); } else { FileUtils.removeDuplicatesFromOutputDirectory(targetFile, new File(originDirectory, name)); } } } } }
[ "public", "static", "void", "removeDuplicatesFromOutputDirectory", "(", "File", "outputDirectory", ",", "File", "originDirectory", ")", "{", "if", "(", "originDirectory", ".", "isDirectory", "(", ")", ")", "{", "for", "(", "String", "name", ":", "originDirectory",...
Utility to remove duplicate files from an "output" directory if they already exist in an "origin". Recursively scans the origin directory looking for files (not directories) that exist in both places and deleting the copy. @param outputDirectory the output directory @param originDirectory the origin directory
[ "Utility", "to", "remove", "duplicate", "files", "from", "an", "output", "directory", "if", "they", "already", "exist", "in", "an", "origin", ".", "Recursively", "scans", "the", "origin", "directory", "looking", "for", "files", "(", "not", "directories", ")", ...
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/FileUtils.java#L41-L57
structurizr/java
structurizr-core/src/com/structurizr/model/Model.java
Model.addDeploymentNode
@Nonnull public DeploymentNode addDeploymentNode(@Nonnull String name, String description, String technology, int instances, Map<String, String> properties) { return addDeploymentNode(DeploymentElement.DEFAULT_DEPLOYMENT_ENVIRONMENT, name, description, technology, instances, properties); }
java
@Nonnull public DeploymentNode addDeploymentNode(@Nonnull String name, String description, String technology, int instances, Map<String, String> properties) { return addDeploymentNode(DeploymentElement.DEFAULT_DEPLOYMENT_ENVIRONMENT, name, description, technology, instances, properties); }
[ "@", "Nonnull", "public", "DeploymentNode", "addDeploymentNode", "(", "@", "Nonnull", "String", "name", ",", "String", "description", ",", "String", "technology", ",", "int", "instances", ",", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", ...
Adds a top-level deployment node to this model. @param name the name of the deployment node @param description the description of the deployment node @param technology the technology associated with the deployment node @param instances the number of instances of the deployment node @param properties a map of name/value properties associated with the deployment node @return a DeploymentNode instance @throws IllegalArgumentException if the name is not specified, or a top-level deployment node with the same name already exists in the model
[ "Adds", "a", "top", "-", "level", "deployment", "node", "to", "this", "model", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L620-L623
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/DirectCompilerVisitor.java
DirectCompilerVisitor.groundToNullIfAnyIsNull
private Expression groundToNullIfAnyIsNull(Expression originalOperation, Expression... arguments) { // Q: What is heavier, checking a list of arguments each one is not null, or just doing the operation on the arguments and try-catch the NPE, please? // A: raising exceptions is a lot heavier BinaryExpr nullChecks = Stream.of(arguments) .map(e -> new BinaryExpr(new EnclosedExpr(e), new NullLiteralExpr(), BinaryExpr.Operator.EQUALS)) .reduce( (x, y) -> new BinaryExpr(x, y, BinaryExpr.Operator.OR) ) .get(); return new ConditionalExpr(new EnclosedExpr(nullChecks), new NullLiteralExpr(), originalOperation); }
java
private Expression groundToNullIfAnyIsNull(Expression originalOperation, Expression... arguments) { // Q: What is heavier, checking a list of arguments each one is not null, or just doing the operation on the arguments and try-catch the NPE, please? // A: raising exceptions is a lot heavier BinaryExpr nullChecks = Stream.of(arguments) .map(e -> new BinaryExpr(new EnclosedExpr(e), new NullLiteralExpr(), BinaryExpr.Operator.EQUALS)) .reduce( (x, y) -> new BinaryExpr(x, y, BinaryExpr.Operator.OR) ) .get(); return new ConditionalExpr(new EnclosedExpr(nullChecks), new NullLiteralExpr(), originalOperation); }
[ "private", "Expression", "groundToNullIfAnyIsNull", "(", "Expression", "originalOperation", ",", "Expression", "...", "arguments", ")", "{", "// Q: What is heavier, checking a list of arguments each one is not null, or just doing the operation on the arguments and try-catch the NPE, please?"...
PLEASE NOTICE: operation may perform a check for null-literal values, but might need this utility for runtime purposes.
[ "PLEASE", "NOTICE", ":", "operation", "may", "perform", "a", "check", "for", "null", "-", "literal", "values", "but", "might", "need", "this", "utility", "for", "runtime", "purposes", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/DirectCompilerVisitor.java#L318-L327
eclipse/xtext-core
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java
IdeContentProposalCreator.createProposal
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context, final Procedure1<? super ContentAssistEntry> init) { return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, init); }
java
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context, final Procedure1<? super ContentAssistEntry> init) { return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, init); }
[ "public", "ContentAssistEntry", "createProposal", "(", "final", "String", "proposal", ",", "final", "ContentAssistContext", "context", ",", "final", "Procedure1", "<", "?", "super", "ContentAssistEntry", ">", "init", ")", "{", "return", "this", ".", "createProposal"...
Returns an entry with the given proposal and the prefix from the context, or null if the proposal is not valid. If it is valid, the initializer function is applied to it.
[ "Returns", "an", "entry", "with", "the", "given", "proposal", "and", "the", "prefix", "from", "the", "context", "or", "null", "if", "the", "proposal", "is", "not", "valid", ".", "If", "it", "is", "valid", "the", "initializer", "function", "is", "applied", ...
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java#L55-L57
google/closure-compiler
src/com/google/javascript/jscomp/FunctionArgumentInjector.java
FunctionArgumentInjector.inject
static Node inject( AbstractCompiler compiler, Node node, Node parent, Map<String, Node> replacements) { return inject(compiler, node, parent, replacements, /* replaceThis */ true); }
java
static Node inject( AbstractCompiler compiler, Node node, Node parent, Map<String, Node> replacements) { return inject(compiler, node, parent, replacements, /* replaceThis */ true); }
[ "static", "Node", "inject", "(", "AbstractCompiler", "compiler", ",", "Node", "node", ",", "Node", "parent", ",", "Map", "<", "String", ",", "Node", ">", "replacements", ")", "{", "return", "inject", "(", "compiler", ",", "node", ",", "parent", ",", "rep...
With the map provided, replace the names with expression trees. @param node The root node of the tree within which to perform the substitutions. @param parent The parent root node. @param replacements The map of names to template node trees with which to replace the name Nodes. @return The root node or its replacement.
[ "With", "the", "map", "provided", "replace", "the", "names", "with", "expression", "trees", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FunctionArgumentInjector.java#L65-L68
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java
PrepareRequestInterceptor.addEntityID
private void addEntityID(Map<String, String> requestParameters, StringBuilder uri) { if (StringUtils.hasText(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_ID))) { uri.append("/").append(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_ID)); } }
java
private void addEntityID(Map<String, String> requestParameters, StringBuilder uri) { if (StringUtils.hasText(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_ID))) { uri.append("/").append(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_ID)); } }
[ "private", "void", "addEntityID", "(", "Map", "<", "String", ",", "String", ">", "requestParameters", ",", "StringBuilder", "uri", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "requestParameters", ".", "get", "(", "RequestElements", ".", "REQ_PARAM...
adding the entity id in the URI, which is required for READ operation @param requestParameters @param uri
[ "adding", "the", "entity", "id", "in", "the", "URI", "which", "is", "required", "for", "READ", "operation" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java#L337-L341
alkacon/opencms-core
src/org/opencms/ui/components/fileselect/CmsResourceSelectDialog.java
CmsResourceSelectDialog.createTree
protected CmsResourceTreeTable createTree(CmsObject cms, CmsResource root) { return new CmsResourceTreeTable(cms, root, m_filter); }
java
protected CmsResourceTreeTable createTree(CmsObject cms, CmsResource root) { return new CmsResourceTreeTable(cms, root, m_filter); }
[ "protected", "CmsResourceTreeTable", "createTree", "(", "CmsObject", "cms", ",", "CmsResource", "root", ")", "{", "return", "new", "CmsResourceTreeTable", "(", "cms", ",", "root", ",", "m_filter", ")", ";", "}" ]
Creates the resource tree for the given root.<p> @param cms the CMS context @param root the root resource @return the resource tree
[ "Creates", "the", "resource", "tree", "for", "the", "given", "root", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/fileselect/CmsResourceSelectDialog.java#L360-L363
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java
ClusterJoinManager.sendMasterQuestion
public boolean sendMasterQuestion(Address toAddress) { checkNotNull(toAddress, "No endpoint is specified!"); BuildInfo buildInfo = node.getBuildInfo(); Address thisAddress = node.getThisAddress(); JoinMessage joinMessage = new JoinMessage(Packet.VERSION, buildInfo.getBuildNumber(), node.getVersion(), thisAddress, clusterService.getThisUuid(), node.isLiteMember(), node.createConfigCheck()); return nodeEngine.getOperationService().send(new WhoisMasterOp(joinMessage), toAddress); }
java
public boolean sendMasterQuestion(Address toAddress) { checkNotNull(toAddress, "No endpoint is specified!"); BuildInfo buildInfo = node.getBuildInfo(); Address thisAddress = node.getThisAddress(); JoinMessage joinMessage = new JoinMessage(Packet.VERSION, buildInfo.getBuildNumber(), node.getVersion(), thisAddress, clusterService.getThisUuid(), node.isLiteMember(), node.createConfigCheck()); return nodeEngine.getOperationService().send(new WhoisMasterOp(joinMessage), toAddress); }
[ "public", "boolean", "sendMasterQuestion", "(", "Address", "toAddress", ")", "{", "checkNotNull", "(", "toAddress", ",", "\"No endpoint is specified!\"", ")", ";", "BuildInfo", "buildInfo", "=", "node", ".", "getBuildInfo", "(", ")", ";", "Address", "thisAddress", ...
Send a {@link WhoisMasterOp} to designated address. @param toAddress the address to which the operation will be sent. @return {@code true} if the operation was sent, otherwise {@code false}.
[ "Send", "a", "{", "@link", "WhoisMasterOp", "}", "to", "designated", "address", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterJoinManager.java#L554-L562
mikepenz/Android-Iconics
library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java
IconicsDrawable.updateTintFilter
private void updateTintFilter() { if (mTint == null) { mTintFilter = null; return; } // setMode, setColor of PorterDuffColorFilter are not public method in SDK v7. (Thanks @Google still not accessible in API v24) // Therefore we create a new one all the time here. Don't expect this is called often. int color = mTint.getColorForState(getState(), Color.TRANSPARENT); mTintFilter = new PorterDuffColorFilter(color, mTintMode); }
java
private void updateTintFilter() { if (mTint == null) { mTintFilter = null; return; } // setMode, setColor of PorterDuffColorFilter are not public method in SDK v7. (Thanks @Google still not accessible in API v24) // Therefore we create a new one all the time here. Don't expect this is called often. int color = mTint.getColorForState(getState(), Color.TRANSPARENT); mTintFilter = new PorterDuffColorFilter(color, mTintMode); }
[ "private", "void", "updateTintFilter", "(", ")", "{", "if", "(", "mTint", "==", "null", ")", "{", "mTintFilter", "=", "null", ";", "return", ";", "}", "// setMode, setColor of PorterDuffColorFilter are not public method in SDK v7. (Thanks @Google still not accessible in API v...
Ensures the tint filter is consistent with the current tint color and mode.
[ "Ensures", "the", "tint", "filter", "is", "consistent", "with", "the", "current", "tint", "color", "and", "mode", "." ]
train
https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L1477-L1486
CycloneDX/cyclonedx-core-java
src/main/java/org/cyclonedx/BomGenerator10.java
BomGenerator10.generate
public Document generate() throws ParserConfigurationException { final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); docFactory.setNamespaceAware(true); final DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); this.doc = docBuilder.newDocument(); doc.setXmlStandalone(true); // Create root <bom> node final Element bomNode = createRootElement("bom", null, new Attribute("xmlns", NS_BOM_10), new Attribute("version", "1")); final Element componentsNode = createElement(bomNode, "components"); createComponentsNode(componentsNode, bom.getComponents()); return doc; }
java
public Document generate() throws ParserConfigurationException { final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); docFactory.setNamespaceAware(true); final DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); this.doc = docBuilder.newDocument(); doc.setXmlStandalone(true); // Create root <bom> node final Element bomNode = createRootElement("bom", null, new Attribute("xmlns", NS_BOM_10), new Attribute("version", "1")); final Element componentsNode = createElement(bomNode, "components"); createComponentsNode(componentsNode, bom.getComponents()); return doc; }
[ "public", "Document", "generate", "(", ")", "throws", "ParserConfigurationException", "{", "final", "DocumentBuilderFactory", "docFactory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "docFactory", ".", "setNamespaceAware", "(", "true", ")", ";",...
Creates a CycloneDX BoM from a set of Components. @return an XML Document representing a CycloneDX BoM @since 1.1.0
[ "Creates", "a", "CycloneDX", "BoM", "from", "a", "set", "of", "Components", "." ]
train
https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/BomGenerator10.java#L63-L78
structurizr/java
structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java
DocumentationTemplate.addSection
public Section addSection(Component component, String title, Format format, String content) { return add(component, title, format, content); }
java
public Section addSection(Component component, String title, Format format, String content) { return add(component, title, format, content); }
[ "public", "Section", "addSection", "(", "Component", "component", ",", "String", "title", ",", "Format", "format", ",", "String", "content", ")", "{", "return", "add", "(", "component", ",", "title", ",", "format", ",", "content", ")", ";", "}" ]
Adds a section relating to a {@link Component}. @param component the {@link Component} the documentation content relates to @param title the section title @param format the {@link Format} of the documentation content @param content a String containing the documentation content @return a documentation {@link Section}
[ "Adds", "a", "section", "relating", "to", "a", "{", "@link", "Component", "}", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L139-L141
tumblr/jumblr
src/main/java/com/tumblr/jumblr/request/RequestBuilder.java
RequestBuilder.postXAuth
public Token postXAuth(final String email, final String password) { OAuthRequest request = constructXAuthPost(email, password); setToken("", ""); // Empty token is required for Scribe to execute XAuth. sign(request); return clearXAuth(request.send()); }
java
public Token postXAuth(final String email, final String password) { OAuthRequest request = constructXAuthPost(email, password); setToken("", ""); // Empty token is required for Scribe to execute XAuth. sign(request); return clearXAuth(request.send()); }
[ "public", "Token", "postXAuth", "(", "final", "String", "email", ",", "final", "String", "password", ")", "{", "OAuthRequest", "request", "=", "constructXAuthPost", "(", "email", ",", "password", ")", ";", "setToken", "(", "\"\"", ",", "\"\"", ")", ";", "/...
Posts an XAuth request. A new method is needed because the response from the server is not a standard Tumblr JSON response. @param email the user's login email. @param password the user's password. @return the login token.
[ "Posts", "an", "XAuth", "request", ".", "A", "new", "method", "is", "needed", "because", "the", "response", "from", "the", "server", "is", "not", "a", "standard", "Tumblr", "JSON", "response", "." ]
train
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/request/RequestBuilder.java#L74-L79
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java
DatabasesInner.beginCreateImportOperationAsync
public Observable<ImportExportResponseInner> beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<ImportExportResponseInner>, ImportExportResponseInner>() { @Override public ImportExportResponseInner call(ServiceResponse<ImportExportResponseInner> response) { return response.body(); } }); }
java
public Observable<ImportExportResponseInner> beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<ImportExportResponseInner>, ImportExportResponseInner>() { @Override public ImportExportResponseInner call(ServiceResponse<ImportExportResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ImportExportResponseInner", ">", "beginCreateImportOperationAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "ImportExtensionRequest", "parameters", ")", "{", "return", "beginCreateImp...
Creates an import operation that imports a bacpac into an existing database. The existing database must be empty. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database to import into @param parameters The required parameters for importing a Bacpac into a database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImportExportResponseInner object
[ "Creates", "an", "import", "operation", "that", "imports", "a", "bacpac", "into", "an", "existing", "database", ".", "The", "existing", "database", "must", "be", "empty", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L2024-L2031
alkacon/opencms-core
src/org/opencms/workplace/CmsDialog.java
CmsDialog.pageHtml
public String pageHtml(int segment, String helpUrl, String title) { if (segment == HTML_START) { String stylesheet = null; if (isPopup() && !useNewStyle()) { stylesheet = "popup.css"; } StringBuffer result = new StringBuffer(pageHtmlStyle(segment, title, stylesheet)); if (getSettings().isViewExplorer()) { result.append("<script type=\"text/javascript\" src=\""); result.append(getSkinUri()); result.append("commons/explorer.js\"></script>\n"); } result.append("<script type=\"text/javascript\">\n"); result.append(dialogScriptSubmit()); if (helpUrl != null) { result.append("if (top.head && top.head.helpUrl) {\n"); result.append("\ttop.head.helpUrl=\""); result.append(helpUrl + "\";\n"); result.append("}\n\n"); } // the variable that may be set as path: if non-null this will be // used as path for the online help window. This is needed because there are pages // e.g. /administration/accounts/users/new that perform a jsp - forward while leaving the // path parameter on the old page: no correct online help possible. result.append("var onlineHelpUriCustom = "); result.append(getOnlineHelpUriCustom()); result.append(";\n"); result.append("</script>\n"); return result.toString(); } else { return super.pageHtml(segment, null); } }
java
public String pageHtml(int segment, String helpUrl, String title) { if (segment == HTML_START) { String stylesheet = null; if (isPopup() && !useNewStyle()) { stylesheet = "popup.css"; } StringBuffer result = new StringBuffer(pageHtmlStyle(segment, title, stylesheet)); if (getSettings().isViewExplorer()) { result.append("<script type=\"text/javascript\" src=\""); result.append(getSkinUri()); result.append("commons/explorer.js\"></script>\n"); } result.append("<script type=\"text/javascript\">\n"); result.append(dialogScriptSubmit()); if (helpUrl != null) { result.append("if (top.head && top.head.helpUrl) {\n"); result.append("\ttop.head.helpUrl=\""); result.append(helpUrl + "\";\n"); result.append("}\n\n"); } // the variable that may be set as path: if non-null this will be // used as path for the online help window. This is needed because there are pages // e.g. /administration/accounts/users/new that perform a jsp - forward while leaving the // path parameter on the old page: no correct online help possible. result.append("var onlineHelpUriCustom = "); result.append(getOnlineHelpUriCustom()); result.append(";\n"); result.append("</script>\n"); return result.toString(); } else { return super.pageHtml(segment, null); } }
[ "public", "String", "pageHtml", "(", "int", "segment", ",", "String", "helpUrl", ",", "String", "title", ")", "{", "if", "(", "segment", "==", "HTML_START", ")", "{", "String", "stylesheet", "=", "null", ";", "if", "(", "isPopup", "(", ")", "&&", "!", ...
Builds the start html of the page, including setting of DOCTYPE and inserting a header with the content-type.<p> This overloads the default method of the parent class.<p> @param segment the HTML segment (START / END) @param helpUrl the url for the online help to include on the page @param title the title for the page @return the start html of the page
[ "Builds", "the", "start", "html", "of", "the", "page", "including", "setting", "of", "DOCTYPE", "and", "inserting", "a", "header", "with", "the", "content", "-", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L1476-L1510
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java
SparseCpuLevel1.ddoti
@Override protected double ddoti(long N, INDArray X, DataBuffer indx, INDArray Y) { return cblas_ddoti((int) N, (DoublePointer) X.data().addressPointer(),(IntPointer) indx.addressPointer(), (DoublePointer) Y.data().addressPointer()); }
java
@Override protected double ddoti(long N, INDArray X, DataBuffer indx, INDArray Y) { return cblas_ddoti((int) N, (DoublePointer) X.data().addressPointer(),(IntPointer) indx.addressPointer(), (DoublePointer) Y.data().addressPointer()); }
[ "@", "Override", "protected", "double", "ddoti", "(", "long", "N", ",", "INDArray", "X", ",", "DataBuffer", "indx", ",", "INDArray", "Y", ")", "{", "return", "cblas_ddoti", "(", "(", "int", ")", "N", ",", "(", "DoublePointer", ")", "X", ".", "data", ...
Computes the dot product of a compressed sparse double vector by a full-storage real vector. @param N The number of elements in x and indx @param X an sparse INDArray. Size at least N @param indx an Databuffer that Specifies the indices for the elements of x. Size at least N @param Y a dense INDArray. Size at least max(indx[i])
[ "Computes", "the", "dot", "product", "of", "a", "compressed", "sparse", "double", "vector", "by", "a", "full", "-", "storage", "real", "vector", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L44-L48
outbrain/ob1k
ob1k-cache/src/main/java/com/outbrain/ob1k/cache/memcache/folsom/MemcachedClientBuilder.java
MemcachedClientBuilder.newMessagePackClient
public static <T> MemcachedClientBuilder<T> newMessagePackClient(final Type valueType) { return newMessagePackClient(DefaultMessagePackHolder.INSTANCE, valueType); }
java
public static <T> MemcachedClientBuilder<T> newMessagePackClient(final Type valueType) { return newMessagePackClient(DefaultMessagePackHolder.INSTANCE, valueType); }
[ "public", "static", "<", "T", ">", "MemcachedClientBuilder", "<", "T", ">", "newMessagePackClient", "(", "final", "Type", "valueType", ")", "{", "return", "newMessagePackClient", "(", "DefaultMessagePackHolder", ".", "INSTANCE", ",", "valueType", ")", ";", "}" ]
Create a client builder for MessagePack values. @return The builder
[ "Create", "a", "client", "builder", "for", "MessagePack", "values", "." ]
train
https://github.com/outbrain/ob1k/blob/9e43ab39230c5787065053da0f766d822d0fe4e7/ob1k-cache/src/main/java/com/outbrain/ob1k/cache/memcache/folsom/MemcachedClientBuilder.java#L72-L74
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonHash.java
JsonHash.fromParser
public static JsonHash fromParser(JsonPullParser parser) throws IOException, JsonFormatException { State state = parser.getEventType(); if (state == State.VALUE_NULL) { return null; } else if (state != State.START_HASH) { throw new JsonFormatException("unexpected token. token=" + state, parser); } JsonHash jsonHash = new JsonHash(); while ((state = parser.lookAhead()) != State.END_HASH) { state = parser.getEventType(); if (state != State.KEY) { throw new JsonFormatException("unexpected token. token=" + state, parser); } String key = parser.getValueString(); state = parser.lookAhead(); jsonHash.put(key, getValue(parser), state); } parser.getEventType(); return jsonHash; }
java
public static JsonHash fromParser(JsonPullParser parser) throws IOException, JsonFormatException { State state = parser.getEventType(); if (state == State.VALUE_NULL) { return null; } else if (state != State.START_HASH) { throw new JsonFormatException("unexpected token. token=" + state, parser); } JsonHash jsonHash = new JsonHash(); while ((state = parser.lookAhead()) != State.END_HASH) { state = parser.getEventType(); if (state != State.KEY) { throw new JsonFormatException("unexpected token. token=" + state, parser); } String key = parser.getValueString(); state = parser.lookAhead(); jsonHash.put(key, getValue(parser), state); } parser.getEventType(); return jsonHash; }
[ "public", "static", "JsonHash", "fromParser", "(", "JsonPullParser", "parser", ")", "throws", "IOException", ",", "JsonFormatException", "{", "State", "state", "=", "parser", ".", "getEventType", "(", ")", ";", "if", "(", "state", "==", "State", ".", "VALUE_NU...
Parses the given JSON data as a hash. @param parser {@link JsonPullParser} with some JSON-formatted data @return {@link JsonHash} @throws IOException @throws JsonFormatException @author vvakame
[ "Parses", "the", "given", "JSON", "data", "as", "a", "hash", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonHash.java#L63-L86
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Widgets.java
Widgets.newHTML
public static HTML newHTML (String text, String... styles) { return setStyleNames(new HTML(text), styles); }
java
public static HTML newHTML (String text, String... styles) { return setStyleNames(new HTML(text), styles); }
[ "public", "static", "HTML", "newHTML", "(", "String", "text", ",", "String", "...", "styles", ")", "{", "return", "setStyleNames", "(", "new", "HTML", "(", "text", ")", ",", "styles", ")", ";", "}" ]
Creates a new HTML element with the specified contents and style.
[ "Creates", "a", "new", "HTML", "element", "with", "the", "specified", "contents", "and", "style", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L255-L258
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.groupBy
public static Map groupBy(Iterable self, List<Closure> closures) { return groupBy(self, closures.toArray()); }
java
public static Map groupBy(Iterable self, List<Closure> closures) { return groupBy(self, closures.toArray()); }
[ "public", "static", "Map", "groupBy", "(", "Iterable", "self", ",", "List", "<", "Closure", ">", "closures", ")", "{", "return", "groupBy", "(", "self", ",", "closures", ".", "toArray", "(", ")", ")", ";", "}" ]
Sorts all Iterable members into (sub)groups determined by the supplied mapping closures. Each closure should return the key that this item should be grouped by. The returned LinkedHashMap will have an entry for each distinct 'key path' returned from the closures, with each value being a list of items for that 'group path'. Example usage: <pre class="groovyTestCase"> def result = [1,2,3,4,5,6].groupBy([{ it % 2 }, { it {@code <} 4 }]) assert result == [1:[(true):[1, 3], (false):[5]], 0:[(true):[2], (false):[4, 6]]] </pre> Another example: <pre> def sql = groovy.sql.Sql.newInstance(/&ast; ... &ast;/) def data = sql.rows("SELECT * FROM a_table").groupBy([{ it.column1 }, { it.column2 }, { it.column3 }]) if (data.val1.val2.val3) { // there exists a record where: // a_table.column1 == val1 // a_table.column2 == val2, and // a_table.column3 == val3 } else { // there is no such record } </pre> If an empty list of closures is supplied the IDENTITY Closure will be used. @param self a collection to group @param closures a list of closures, each mapping entries on keys @return a new Map grouped by keys on each criterion @since 2.2.0 @see Closure#IDENTITY
[ "Sorts", "all", "Iterable", "members", "into", "(", "sub", ")", "groups", "determined", "by", "the", "supplied", "mapping", "closures", ".", "Each", "closure", "should", "return", "the", "key", "that", "this", "item", "should", "be", "grouped", "by", ".", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L5662-L5664
liyiorg/weixin-popular
src/main/java/weixin/popular/api/PayMchAPI.java
PayMchAPI.mmpaymkttransfersSendredpack
public static SendredpackResult mmpaymkttransfersSendredpack(Sendredpack sendredpack,String key){ Map<String,String> map = MapUtil.objectToMap( sendredpack); String sign = SignatureUtil.generateSign(map,sendredpack.getSign_type(),key); sendredpack.setSign(sign); String secapiPayRefundXML = XMLConverUtil.convertToXML( sendredpack); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(xmlHeader) .setUri(baseURI()+ "/mmpaymkttransfers/sendredpack") .setEntity(new StringEntity(secapiPayRefundXML,Charset.forName("utf-8"))) .build(); return LocalHttpClient.keyStoreExecuteXmlResult(sendredpack.getMch_id(),httpUriRequest,SendredpackResult.class,sendredpack.getSign_type(),key); }
java
public static SendredpackResult mmpaymkttransfersSendredpack(Sendredpack sendredpack,String key){ Map<String,String> map = MapUtil.objectToMap( sendredpack); String sign = SignatureUtil.generateSign(map,sendredpack.getSign_type(),key); sendredpack.setSign(sign); String secapiPayRefundXML = XMLConverUtil.convertToXML( sendredpack); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(xmlHeader) .setUri(baseURI()+ "/mmpaymkttransfers/sendredpack") .setEntity(new StringEntity(secapiPayRefundXML,Charset.forName("utf-8"))) .build(); return LocalHttpClient.keyStoreExecuteXmlResult(sendredpack.getMch_id(),httpUriRequest,SendredpackResult.class,sendredpack.getSign_type(),key); }
[ "public", "static", "SendredpackResult", "mmpaymkttransfersSendredpack", "(", "Sendredpack", "sendredpack", ",", "String", "key", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "MapUtil", ".", "objectToMap", "(", "sendredpack", ")", ";", "String...
现金红包 <br> 1.发送频率限制------默认1800/min <br> 2.发送个数上限------按照默认1800/min算<br> 3.金额上限------根据传入场景id不同默认上限不同,可以在商户平台产品设置进行设置和申请,最大不大于4999元/个<br> 4.其他的“量”上的限制还有哪些?------用户当天的领取上限次数,默认是10<br> 5.如果量上满足不了我们的需求,如何提高各个上限?------金额上限和用户当天领取次数上限可以在商户平台进行设置<br> 注 <br> 1:如果你是服务商,希望代你的特约商户发红包,你可以申请获得你特约商户的“现金红包产品授权”。操作路径如下:【登录商户平台-产品中心- 特约商户授权产品】(即将上线) <br> 2:红包金额大于200时,请求参数scene_id必传 @param sendredpack sendredpack @param key key @return SendredpackResult
[ "现金红包", "<br", ">" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/PayMchAPI.java#L502-L513
nakamura5akihito/six-util
src/main/java/jp/go/aist/six/util/core/xml/spring327/CastorMarshaller.java
CastorMarshaller.convertCastorException
protected XmlMappingException convertCastorException(XMLException ex, boolean marshalling) { if (ex instanceof ValidationException) { return new ValidationFailureException("Castor validation exception", ex); } else if (ex instanceof MarshalException) { if (marshalling) { return new MarshallingFailureException("Castor marshalling exception", ex); } else { return new UnmarshallingFailureException("Castor unmarshalling exception", ex); } } else { // fallback return new UncategorizedMappingException("Unknown Castor exception", ex); } }
java
protected XmlMappingException convertCastorException(XMLException ex, boolean marshalling) { if (ex instanceof ValidationException) { return new ValidationFailureException("Castor validation exception", ex); } else if (ex instanceof MarshalException) { if (marshalling) { return new MarshallingFailureException("Castor marshalling exception", ex); } else { return new UnmarshallingFailureException("Castor unmarshalling exception", ex); } } else { // fallback return new UncategorizedMappingException("Unknown Castor exception", ex); } }
[ "protected", "XmlMappingException", "convertCastorException", "(", "XMLException", "ex", ",", "boolean", "marshalling", ")", "{", "if", "(", "ex", "instanceof", "ValidationException", ")", "{", "return", "new", "ValidationFailureException", "(", "\"Castor validation excep...
Convert the given {@code XMLException} to an appropriate exception from the {@code org.springframework.oxm} hierarchy. <p>A boolean flag is used to indicate whether this exception occurs during marshalling or unmarshalling, since Castor itself does not make this distinction in its exception hierarchy. @param ex Castor {@code XMLException} that occurred @param marshalling indicates whether the exception occurs during marshalling ({@code true}), or unmarshalling ({@code false}) @return the corresponding {@code XmlMappingException}
[ "Convert", "the", "given", "{" ]
train
https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/core/xml/spring327/CastorMarshaller.java#L699-L715
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/TransformsInner.java
TransformsInner.createOrUpdateAsync
public Observable<TransformInner> createOrUpdateAsync(String resourceGroupName, String accountName, String transformName, TransformInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, transformName, parameters).map(new Func1<ServiceResponse<TransformInner>, TransformInner>() { @Override public TransformInner call(ServiceResponse<TransformInner> response) { return response.body(); } }); }
java
public Observable<TransformInner> createOrUpdateAsync(String resourceGroupName, String accountName, String transformName, TransformInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, transformName, parameters).map(new Func1<ServiceResponse<TransformInner>, TransformInner>() { @Override public TransformInner call(ServiceResponse<TransformInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TransformInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "transformName", ",", "TransformInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", ...
Create or Update Transform. Creates or updates a new Transform. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param transformName The Transform name. @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TransformInner object
[ "Create", "or", "Update", "Transform", ".", "Creates", "or", "updates", "a", "new", "Transform", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/TransformsInner.java#L500-L507
nohana/Amalgam
amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java
PackageManagerUtils.getPermissionPackageInfo
public static PackageInfo getPermissionPackageInfo(Context context, String targetPackage) throws NameNotFoundException { PackageManager manager = context.getPackageManager(); return manager.getPackageInfo(targetPackage, PackageManager.GET_PERMISSIONS); }
java
public static PackageInfo getPermissionPackageInfo(Context context, String targetPackage) throws NameNotFoundException { PackageManager manager = context.getPackageManager(); return manager.getPackageInfo(targetPackage, PackageManager.GET_PERMISSIONS); }
[ "public", "static", "PackageInfo", "getPermissionPackageInfo", "(", "Context", "context", ",", "String", "targetPackage", ")", "throws", "NameNotFoundException", "{", "PackageManager", "manager", "=", "context", ".", "getPackageManager", "(", ")", ";", "return", "mana...
Get the {@link android.content.pm.PackageInfo} that contains permission declaration for the context. @param context the context. @param targetPackage the target package name. @return the {@link android.content.pm.PackageInfo}. @throws NameNotFoundException if no package found.
[ "Get", "the", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L220-L223
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/memory/provider/BasicWorkspaceManager.java
BasicWorkspaceManager.getAndActivateWorkspace
@Override public MemoryWorkspace getAndActivateWorkspace(@NonNull WorkspaceConfiguration configuration, @NonNull String id) { return getWorkspaceForCurrentThread(configuration, id).notifyScopeEntered(); }
java
@Override public MemoryWorkspace getAndActivateWorkspace(@NonNull WorkspaceConfiguration configuration, @NonNull String id) { return getWorkspaceForCurrentThread(configuration, id).notifyScopeEntered(); }
[ "@", "Override", "public", "MemoryWorkspace", "getAndActivateWorkspace", "(", "@", "NonNull", "WorkspaceConfiguration", "configuration", ",", "@", "NonNull", "String", "id", ")", "{", "return", "getWorkspaceForCurrentThread", "(", "configuration", ",", "id", ")", ".",...
This method gets & activates default with a given configuration and Id @param configuration @param id @return
[ "This", "method", "gets", "&", "activates", "default", "with", "a", "given", "configuration", "and", "Id" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/memory/provider/BasicWorkspaceManager.java#L233-L236