repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateWord
public static <T extends CharSequence> T validateWord(T value, String errorMsg) throws ValidateException { if (false == isWord(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateWord(T value, String errorMsg) throws ValidateException { if (false == isWord(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateWord", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isWord", "(", "value", ")", ")", "{", "throw", "new", "Va...
验证是否为字母(包括大写和小写字母) @param <T> 字符串类型 @param value 表单值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常 @since 4.1.8
[ "验证是否为字母(包括大写和小写字母)" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L572-L577
UrielCh/ovh-java-sdk
ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java
ApiOvhCaasregistry.serviceName_users_userId_DELETE
public void serviceName_users_userId_DELETE(String serviceName, String userId) throws IOException { String qPath = "/caas/registry/{serviceName}/users/{userId}"; StringBuilder sb = path(qPath, serviceName, userId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void serviceName_users_userId_DELETE(String serviceName, String userId) throws IOException { String qPath = "/caas/registry/{serviceName}/users/{userId}"; StringBuilder sb = path(qPath, serviceName, userId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "serviceName_users_userId_DELETE", "(", "String", "serviceName", ",", "String", "userId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/caas/registry/{serviceName}/users/{userId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath...
Delete user REST: DELETE /caas/registry/{serviceName}/users/{userId} @param serviceName [required] Service name @param userId [required] User id API beta
[ "Delete", "user" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java#L139-L143
zaproxy/zaproxy
src/org/zaproxy/zap/extension/api/API.java
API.validateMandatoryParams
private void validateMandatoryParams(JSONObject params, ApiElement element) throws ApiException { if (element == null) { return; } List<String> mandatoryParams = element.getMandatoryParamNames(); if (mandatoryParams != null) { for (String param : mandatoryParams) { if (!params.has(param) || params.getString(param).length() == 0) { throw new ApiException(ApiException.Type.MISSING_PARAMETER, param); } } } }
java
private void validateMandatoryParams(JSONObject params, ApiElement element) throws ApiException { if (element == null) { return; } List<String> mandatoryParams = element.getMandatoryParamNames(); if (mandatoryParams != null) { for (String param : mandatoryParams) { if (!params.has(param) || params.getString(param).length() == 0) { throw new ApiException(ApiException.Type.MISSING_PARAMETER, param); } } } }
[ "private", "void", "validateMandatoryParams", "(", "JSONObject", "params", ",", "ApiElement", "element", ")", "throws", "ApiException", "{", "if", "(", "element", "==", "null", ")", "{", "return", ";", "}", "List", "<", "String", ">", "mandatoryParams", "=", ...
Validates that the mandatory parameters of the given {@code ApiElement} are present, throwing an {@code ApiException} if not. @param params the parameters of the API request. @param element the API element to validate. @throws ApiException if any of the mandatory parameters is missing.
[ "Validates", "that", "the", "mandatory", "parameters", "of", "the", "given", "{", "@code", "ApiElement", "}", "are", "present", "throwing", "an", "{", "@code", "ApiException", "}", "if", "not", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/API.java#L558-L571
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java
Reflection.findBestMethodWithSignature
public Method findBestMethodWithSignature( String methodName, Class<?>... argumentsClasses ) throws NoSuchMethodException, SecurityException { return findBestMethodWithSignature(methodName, true, argumentsClasses); }
java
public Method findBestMethodWithSignature( String methodName, Class<?>... argumentsClasses ) throws NoSuchMethodException, SecurityException { return findBestMethodWithSignature(methodName, true, argumentsClasses); }
[ "public", "Method", "findBestMethodWithSignature", "(", "String", "methodName", ",", "Class", "<", "?", ">", "...", "argumentsClasses", ")", "throws", "NoSuchMethodException", ",", "SecurityException", "{", "return", "findBestMethodWithSignature", "(", "methodName", ","...
Find the best method on the target class that matches the signature specified with the specified name and the list of argument classes. This method first attempts to find the method with the specified argument classes; if no such method is found, a NoSuchMethodException is thrown. @param methodName the name of the method that is to be invoked. @param argumentsClasses the list of Class instances that correspond to the classes for each argument passed to the method. @return the Method object that references the method that satisfies the requirements, or null if no satisfactory method could be found. @throws NoSuchMethodException if a matching method is not found. @throws SecurityException if access to the information is denied.
[ "Find", "the", "best", "method", "on", "the", "target", "class", "that", "matches", "the", "signature", "specified", "with", "the", "specified", "name", "and", "the", "list", "of", "argument", "classes", ".", "This", "method", "first", "attempts", "to", "fin...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java#L692-L696
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.moveTo
public SVGPath moveTo(double x, double y) { return append(PATH_MOVE).append(x).append(y); }
java
public SVGPath moveTo(double x, double y) { return append(PATH_MOVE).append(x).append(y); }
[ "public", "SVGPath", "moveTo", "(", "double", "x", ",", "double", "y", ")", "{", "return", "append", "(", "PATH_MOVE", ")", ".", "append", "(", "x", ")", ".", "append", "(", "y", ")", ";", "}" ]
Move to the given coordinates. @param x new coordinates @param y new coordinates @return path object, for compact syntax.
[ "Move", "to", "the", "given", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L311-L313
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuGraphAddDependencies
public static int cuGraphAddDependencies(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numDependencies) { return checkResult(cuGraphAddDependenciesNative(hGraph, from, to, numDependencies)); }
java
public static int cuGraphAddDependencies(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numDependencies) { return checkResult(cuGraphAddDependenciesNative(hGraph, from, to, numDependencies)); }
[ "public", "static", "int", "cuGraphAddDependencies", "(", "CUgraph", "hGraph", ",", "CUgraphNode", "from", "[", "]", ",", "CUgraphNode", "to", "[", "]", ",", "long", "numDependencies", ")", "{", "return", "checkResult", "(", "cuGraphAddDependenciesNative", "(", ...
Adds dependency edges to a graph.<br> <br> The number of dependencies to be added is defined by \p numDependencies Elements in \p from and \p to at corresponding indices define a dependency. Each node in \p from and \p to must belong to \p hGraph.<br> <br> If \p numDependencies is 0, elements in \p from and \p to will be ignored. Specifying an existing dependency will return an error.<br> @param hGraph - Graph to which dependencies are added @param from - Array of nodes that provide the dependencies @param to - Array of dependent nodes @param numDependencies - Number of dependencies to be added @return CUDA_SUCCESS, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuGraphRemoveDependencies JCudaDriver#cuGraphGetEdges JCudaDriver#cuGraphNodeGetDependencies JCudaDriver#cuGraphNodeGetDependentNodes
[ "Adds", "dependency", "edges", "to", "a", "graph", ".", "<br", ">", "<br", ">", "The", "number", "of", "dependencies", "to", "be", "added", "is", "defined", "by", "\\", "p", "numDependencies", "Elements", "in", "\\", "p", "from", "and", "\\", "p", "to"...
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12848-L12851
stripe/stripe-java
src/main/java/com/stripe/model/Account.java
Account.persons
public PersonCollection persons() throws StripeException { return persons((Map<String, Object>) null, (RequestOptions) null); }
java
public PersonCollection persons() throws StripeException { return persons((Map<String, Object>) null, (RequestOptions) null); }
[ "public", "PersonCollection", "persons", "(", ")", "throws", "StripeException", "{", "return", "persons", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "null", ",", "(", "RequestOptions", ")", "null", ")", ";", "}" ]
Returns a list of people associated with the account’s legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
[ "Returns", "a", "list", "of", "people", "associated", "with", "the", "account’s", "legal", "entity", ".", "The", "people", "are", "returned", "sorted", "by", "creation", "date", "with", "the", "most", "recent", "people", "appearing", "first", "." ]
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/Account.java#L451-L453
finnyb/javampd
src/main/java/org/bff/javampd/player/MPDPlayer.java
MPDPlayer.firePlayerChangeEvent
protected synchronized void firePlayerChangeEvent(PlayerChangeEvent.Event event) { PlayerChangeEvent pce = new PlayerChangeEvent(this, event); for (PlayerChangeListener pcl : listeners) { pcl.playerChanged(pce); } }
java
protected synchronized void firePlayerChangeEvent(PlayerChangeEvent.Event event) { PlayerChangeEvent pce = new PlayerChangeEvent(this, event); for (PlayerChangeListener pcl : listeners) { pcl.playerChanged(pce); } }
[ "protected", "synchronized", "void", "firePlayerChangeEvent", "(", "PlayerChangeEvent", ".", "Event", "event", ")", "{", "PlayerChangeEvent", "pce", "=", "new", "PlayerChangeEvent", "(", "this", ",", "event", ")", ";", "for", "(", "PlayerChangeListener", "pcl", ":...
Sends the appropriate {@link PlayerChangeEvent} to all registered {@link PlayerChangeListener}s. @param event the {@link PlayerChangeEvent.Event} to send
[ "Sends", "the", "appropriate", "{", "@link", "PlayerChangeEvent", "}", "to", "all", "registered", "{", "@link", "PlayerChangeListener", "}", "s", "." ]
train
https://github.com/finnyb/javampd/blob/186736e85fc238b4208cc9ee23373f9249376b4c/src/main/java/org/bff/javampd/player/MPDPlayer.java#L76-L82
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.sounds_id_PUT
public void sounds_id_PUT(Long id, OvhSound body) throws IOException { String qPath = "/telephony/sounds/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void sounds_id_PUT(Long id, OvhSound body) throws IOException { String qPath = "/telephony/sounds/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "sounds_id_PUT", "(", "Long", "id", ",", "OvhSound", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/sounds/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ")", ";", "exec", "(", ...
Alter this object properties REST: PUT /telephony/sounds/{id} @param body [required] New object properties @param id [required] Sound ID
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8741-L8745
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/GroovyResultSetExtension.java
GroovyResultSetExtension.putAt
public void putAt(int index, Object newValue) throws SQLException { index = normalizeIndex(index); getResultSet().updateObject(index, newValue); }
java
public void putAt(int index, Object newValue) throws SQLException { index = normalizeIndex(index); getResultSet().updateObject(index, newValue); }
[ "public", "void", "putAt", "(", "int", "index", ",", "Object", "newValue", ")", "throws", "SQLException", "{", "index", "=", "normalizeIndex", "(", "index", ")", ";", "getResultSet", "(", ")", ".", "updateObject", "(", "index", ",", "newValue", ")", ";", ...
Supports integer based subscript operators for updating the values of numbered columns starting at zero. Negative indices are supported, they will count from the last column backwards. @param index is the number of the column to look at starting at 1 @param newValue the updated value @throws java.sql.SQLException if something goes wrong @see ResultSet#updateObject(java.lang.String, java.lang.Object)
[ "Supports", "integer", "based", "subscript", "operators", "for", "updating", "the", "values", "of", "numbered", "columns", "starting", "at", "zero", ".", "Negative", "indices", "are", "supported", "they", "will", "count", "from", "the", "last", "column", "backwa...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/GroovyResultSetExtension.java#L166-L169
Activiti/Activiti
activiti-engine/src/main/java/org/activiti/engine/impl/util/json/JSONObject.java
JSONObject.optDouble
public double optDouble(String key, double defaultValue) { try { Object o = opt(key); return o instanceof Number ? ((Number) o).doubleValue() : new Double((String) o).doubleValue(); } catch (Exception e) { return defaultValue; } }
java
public double optDouble(String key, double defaultValue) { try { Object o = opt(key); return o instanceof Number ? ((Number) o).doubleValue() : new Double((String) o).doubleValue(); } catch (Exception e) { return defaultValue; } }
[ "public", "double", "optDouble", "(", "String", "key", ",", "double", "defaultValue", ")", "{", "try", "{", "Object", "o", "=", "opt", "(", "key", ")", ";", "return", "o", "instanceof", "Number", "?", "(", "(", "Number", ")", "o", ")", ".", "doubleVa...
Get an optional double associated with a key, or the defaultValue if there is no such key or if its value is not a number. If the value is a string, an attempt will be made to evaluate it as a number. @param key A key string. @param defaultValue The default. @return An object which is the value.
[ "Get", "an", "optional", "double", "associated", "with", "a", "key", "or", "the", "defaultValue", "if", "there", "is", "no", "such", "key", "or", "if", "its", "value", "is", "not", "a", "number", ".", "If", "the", "value", "is", "a", "string", "an", ...
train
https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/util/json/JSONObject.java#L704-L711
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/stereo/StereoElementFactory.java
StereoElementFactory.using2DCoordinates
public static StereoElementFactory using2DCoordinates(IAtomContainer container) { EdgeToBondMap bondMap = EdgeToBondMap.withSpaceFor(container); int[][] graph = GraphUtil.toAdjList(container, bondMap); return new StereoElementFactory2D(container, graph, bondMap); }
java
public static StereoElementFactory using2DCoordinates(IAtomContainer container) { EdgeToBondMap bondMap = EdgeToBondMap.withSpaceFor(container); int[][] graph = GraphUtil.toAdjList(container, bondMap); return new StereoElementFactory2D(container, graph, bondMap); }
[ "public", "static", "StereoElementFactory", "using2DCoordinates", "(", "IAtomContainer", "container", ")", "{", "EdgeToBondMap", "bondMap", "=", "EdgeToBondMap", ".", "withSpaceFor", "(", "container", ")", ";", "int", "[", "]", "[", "]", "graph", "=", "GraphUtil",...
Create a stereo element factory for creating stereo elements using 2D coordinates and depiction labels (up/down, wedge/hatch). @param container the structure to create the factory for @return the factory instance
[ "Create", "a", "stereo", "element", "factory", "for", "creating", "stereo", "elements", "using", "2D", "coordinates", "and", "depiction", "labels", "(", "up", "/", "down", "wedge", "/", "hatch", ")", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/StereoElementFactory.java#L483-L487
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getNewReleaseDvds
public List<RTMovie> getNewReleaseDvds(String country) throws RottenTomatoesException { return getNewReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
java
public List<RTMovie> getNewReleaseDvds(String country) throws RottenTomatoesException { return getNewReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
[ "public", "List", "<", "RTMovie", ">", "getNewReleaseDvds", "(", "String", "country", ")", "throws", "RottenTomatoesException", "{", "return", "getNewReleaseDvds", "(", "country", ",", "DEFAULT_PAGE", ",", "DEFAULT_PAGE_LIMIT", ")", ";", "}" ]
Retrieves new release DVDs @param country Provides localized data for the selected country @return @throws RottenTomatoesException
[ "Retrieves", "new", "release", "DVDs" ]
train
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L439-L441
liaochong/spring-boot-starter-converter
src/main/java/com/github/liaochong/converter/core/BeanConvertStrategy.java
BeanConvertStrategy.convertBean
public static <T, U> U convertBean(T source, Class<U> targetClass) { return convertBean(source, targetClass, null); }
java
public static <T, U> U convertBean(T source, Class<U> targetClass) { return convertBean(source, targetClass, null); }
[ "public", "static", "<", "T", ",", "U", ">", "U", "convertBean", "(", "T", "source", ",", "Class", "<", "U", ">", "targetClass", ")", "{", "return", "convertBean", "(", "source", ",", "targetClass", ",", "null", ")", ";", "}" ]
单个Bean转换,无指定异常提供 @throws ConvertException 转换异常 @param source 被转换对象 @param targetClass 需要转换到的类型 @param <T> 转换前的类型 @param <U> 转换后的类型 @return 结果
[ "单个Bean转换,无指定异常提供" ]
train
https://github.com/liaochong/spring-boot-starter-converter/blob/a36bea44bd23330a6f43b0372906a804a09285c5/src/main/java/com/github/liaochong/converter/core/BeanConvertStrategy.java#L48-L50
jbundle/jbundle
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/DynamicTreeNode.java
DynamicTreeNode.loadChildren
protected void loadChildren() { DynamicTreeNode newNode; // Font font; // int randomIndex; NodeData dataParent = (NodeData)this.getUserObject(); FieldList fieldList = dataParent.makeRecord(); FieldTable fieldTable = fieldList.getTable(); m_fNameCount = 0; try { fieldTable.close(); // while (fieldTable.hasNext()) while (fieldTable.next() != null) { String objID = fieldList.getField(0).toString(); String strDescription = fieldList.getField(3).toString(); NodeData data = new NodeData(dataParent.getBaseApplet(), dataParent.getRemoteSession(), strDescription, objID, dataParent.getSubRecordClassName()); newNode = new DynamicTreeNode(data); /** Don't use add() here, add calls insert(newNode, getChildCount()) so if you want to use add, just be sure to set hasLoaded = true first. */ this.insert(newNode, (int)m_fNameCount); m_fNameCount++; } } catch (Exception ex) { ex.printStackTrace(); } /** This node has now been loaded, mark it so. */ m_bHasLoaded = true; }
java
protected void loadChildren() { DynamicTreeNode newNode; // Font font; // int randomIndex; NodeData dataParent = (NodeData)this.getUserObject(); FieldList fieldList = dataParent.makeRecord(); FieldTable fieldTable = fieldList.getTable(); m_fNameCount = 0; try { fieldTable.close(); // while (fieldTable.hasNext()) while (fieldTable.next() != null) { String objID = fieldList.getField(0).toString(); String strDescription = fieldList.getField(3).toString(); NodeData data = new NodeData(dataParent.getBaseApplet(), dataParent.getRemoteSession(), strDescription, objID, dataParent.getSubRecordClassName()); newNode = new DynamicTreeNode(data); /** Don't use add() here, add calls insert(newNode, getChildCount()) so if you want to use add, just be sure to set hasLoaded = true first. */ this.insert(newNode, (int)m_fNameCount); m_fNameCount++; } } catch (Exception ex) { ex.printStackTrace(); } /** This node has now been loaded, mark it so. */ m_bHasLoaded = true; }
[ "protected", "void", "loadChildren", "(", ")", "{", "DynamicTreeNode", "newNode", ";", "// Font font;", "// int randomIndex;", "NodeData", "dataParent", "=", "(", "NodeData", ")", "this", ".", "getUserObject", "(", ")", ";", ...
Messaged the first time getChildCount is messaged. Creates children with random names from names.
[ "Messaged", "the", "first", "time", "getChildCount", "is", "messaged", ".", "Creates", "children", "with", "random", "names", "from", "names", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/DynamicTreeNode.java#L67-L97
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.removeByC_NotST
@Override public void removeByC_NotST(long CPDefinitionId, int status) { for (CPInstance cpInstance : findByC_NotST(CPDefinitionId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpInstance); } }
java
@Override public void removeByC_NotST(long CPDefinitionId, int status) { for (CPInstance cpInstance : findByC_NotST(CPDefinitionId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpInstance); } }
[ "@", "Override", "public", "void", "removeByC_NotST", "(", "long", "CPDefinitionId", ",", "int", "status", ")", "{", "for", "(", "CPInstance", "cpInstance", ":", "findByC_NotST", "(", "CPDefinitionId", ",", "status", ",", "QueryUtil", ".", "ALL_POS", ",", "Que...
Removes all the cp instances where CPDefinitionId = &#63; and status &ne; &#63; from the database. @param CPDefinitionId the cp definition ID @param status the status
[ "Removes", "all", "the", "cp", "instances", "where", "CPDefinitionId", "=", "&#63", ";", "and", "status", "&ne", ";", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L5568-L5574
jparsec/jparsec
jparsec/src/main/java/org/jparsec/Scanners.java
Scanners.nestableBlockComment
public static Parser<Void> nestableBlockComment(String begin, String end) { return nestableBlockComment(begin, end, Patterns.isChar(CharPredicates.ALWAYS)); }
java
public static Parser<Void> nestableBlockComment(String begin, String end) { return nestableBlockComment(begin, end, Patterns.isChar(CharPredicates.ALWAYS)); }
[ "public", "static", "Parser", "<", "Void", ">", "nestableBlockComment", "(", "String", "begin", ",", "String", "end", ")", "{", "return", "nestableBlockComment", "(", "begin", ",", "end", ",", "Patterns", ".", "isChar", "(", "CharPredicates", ".", "ALWAYS", ...
A scanner for a nestable block comment that starts with {@code begin} and ends with {@code end}. @param begin begins a block comment @param end ends a block comment @return the block comment scanner.
[ "A", "scanner", "for", "a", "nestable", "block", "comment", "that", "starts", "with", "{", "@code", "begin", "}", "and", "ends", "with", "{", "@code", "end", "}", "." ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/Scanners.java#L472-L474
opencypher/openCypher
tools/grammar/src/main/java/org/opencypher/grammar/Description.java
Description.findStart
private static int findStart( char[] buffer, int start, int end ) { int pos, cp; for ( pos = start; pos < end && isWhitespace( cp = codePointAt( buffer, pos ) ); pos += charCount( cp ) ) { if ( cp == '\n' ) { start = pos + 1; } } return pos >= end ? end : start; }
java
private static int findStart( char[] buffer, int start, int end ) { int pos, cp; for ( pos = start; pos < end && isWhitespace( cp = codePointAt( buffer, pos ) ); pos += charCount( cp ) ) { if ( cp == '\n' ) { start = pos + 1; } } return pos >= end ? end : start; }
[ "private", "static", "int", "findStart", "(", "char", "[", "]", "buffer", ",", "int", "start", ",", "int", "end", ")", "{", "int", "pos", ",", "cp", ";", "for", "(", "pos", "=", "start", ";", "pos", "<", "end", "&&", "isWhitespace", "(", "cp", "=...
Find the beginning of the first line that isn't all whitespace.
[ "Find", "the", "beginning", "of", "the", "first", "line", "that", "isn", "t", "all", "whitespace", "." ]
train
https://github.com/opencypher/openCypher/blob/eb780caea625900ddbedd28a1eac9a5dbe09c5f0/tools/grammar/src/main/java/org/opencypher/grammar/Description.java#L210-L221
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/collection/BiInt2ObjectMap.java
BiInt2ObjectMap.get
public V get(final int keyPartA, final int keyPartB) { final long key = compoundKey(keyPartA, keyPartB); return map.get(key); }
java
public V get(final int keyPartA, final int keyPartB) { final long key = compoundKey(keyPartA, keyPartB); return map.get(key); }
[ "public", "V", "get", "(", "final", "int", "keyPartA", ",", "final", "int", "keyPartB", ")", "{", "final", "long", "key", "=", "compoundKey", "(", "keyPartA", ",", "keyPartB", ")", ";", "return", "map", ".", "get", "(", "key", ")", ";", "}" ]
Retrieve a value from the map. @param keyPartA for the key @param keyPartB for the key @return value matching the key if found or null if not found.
[ "Retrieve", "a", "value", "from", "the", "map", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/collection/BiInt2ObjectMap.java#L109-L113
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/Convolution.java
Convolution.convn
public static INDArray convn(INDArray input, INDArray kernel, Type type, int[] axes) { return Nd4j.getConvolution().convn(input, kernel, type, axes); }
java
public static INDArray convn(INDArray input, INDArray kernel, Type type, int[] axes) { return Nd4j.getConvolution().convn(input, kernel, type, axes); }
[ "public", "static", "INDArray", "convn", "(", "INDArray", "input", ",", "INDArray", "kernel", ",", "Type", "type", ",", "int", "[", "]", "axes", ")", "{", "return", "Nd4j", ".", "getConvolution", "(", ")", ".", "convn", "(", "input", ",", "kernel", ","...
ND Convolution @param input the input to op @param kernel the kerrnel to op with @param type the opType of convolution @param axes the axes to do the convolution along @return the convolution of the given input and kernel
[ "ND", "Convolution" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/Convolution.java#L368-L370
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyDecoder.java
KeyDecoder.decodeSingleNullableDesc
public static byte[] decodeSingleNullableDesc(byte[] src, int prefixPadding, int suffixPadding) throws CorruptEncodingException { try { byte b = src[prefixPadding]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } int length = src.length - suffixPadding - 1 - prefixPadding; if (length == 0) { return EMPTY_BYTE_ARRAY; } byte[] dst = new byte[length]; while (--length >= 0) { dst[length] = (byte) (~src[1 + prefixPadding + length]); } return dst; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static byte[] decodeSingleNullableDesc(byte[] src, int prefixPadding, int suffixPadding) throws CorruptEncodingException { try { byte b = src[prefixPadding]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } int length = src.length - suffixPadding - 1 - prefixPadding; if (length == 0) { return EMPTY_BYTE_ARRAY; } byte[] dst = new byte[length]; while (--length >= 0) { dst[length] = (byte) (~src[1 + prefixPadding + length]); } return dst; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "byte", "[", "]", "decodeSingleNullableDesc", "(", "byte", "[", "]", "src", ",", "int", "prefixPadding", ",", "int", "suffixPadding", ")", "throws", "CorruptEncodingException", "{", "try", "{", "byte", "b", "=", "src", "[", "prefixPadding",...
Decodes the given byte array which was encoded by {@link KeyEncoder#encodeSingleNullableDesc}. Always returns a new byte array instance. @param prefixPadding amount of extra bytes to skip from start of encoded byte array @param suffixPadding amount of extra bytes to skip at end of encoded byte array
[ "Decodes", "the", "given", "byte", "array", "which", "was", "encoded", "by", "{", "@link", "KeyEncoder#encodeSingleNullableDesc", "}", ".", "Always", "returns", "a", "new", "byte", "array", "instance", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L881-L901
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java
StanzaCollector.nextResultOrThrow
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException { P result; try { result = nextResult(timeout); } finally { cancel(); } if (result == null) { if (connectionException != null) { throw new NotConnectedException(connection, packetFilter, connectionException); } if (!connection.isConnected()) { throw new NotConnectedException(connection, packetFilter); } throw NoResponseException.newWith(timeout, this, cancelled); } XMPPErrorException.ifHasErrorThenThrow(result); return result; }
java
public <P extends Stanza> P nextResultOrThrow(long timeout) throws NoResponseException, XMPPErrorException, InterruptedException, NotConnectedException { P result; try { result = nextResult(timeout); } finally { cancel(); } if (result == null) { if (connectionException != null) { throw new NotConnectedException(connection, packetFilter, connectionException); } if (!connection.isConnected()) { throw new NotConnectedException(connection, packetFilter); } throw NoResponseException.newWith(timeout, this, cancelled); } XMPPErrorException.ifHasErrorThenThrow(result); return result; }
[ "public", "<", "P", "extends", "Stanza", ">", "P", "nextResultOrThrow", "(", "long", "timeout", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "InterruptedException", ",", "NotConnectedException", "{", "P", "result", ";", "try", "{", "result...
Returns the next available stanza. The method call will block until a stanza is available or the <tt>timeout</tt> has elapsed. This method does also cancel the collector in every case. <p> Three things can happen when waiting for an response: </p> <ol> <li>A result response arrives.</li> <li>An error response arrives.</li> <li>An timeout occurs.</li> <li>The thread is interrupted</li> </ol> <p> in which this method will </p> <ol> <li>return with the result.</li> <li>throw an {@link XMPPErrorException}.</li> <li>throw an {@link NoResponseException}.</li> <li>throw an {@link InterruptedException}.</li> </ol> <p> Additionally the method will throw a {@link NotConnectedException} if no response was received and the connection got disconnected. </p> @param timeout the amount of time to wait for the next stanza in milliseconds. @param <P> type of the result stanza. @return the next available stanza. @throws NoResponseException if there was no response from the server. @throws XMPPErrorException in case an error response was received. @throws InterruptedException if the calling thread was interrupted. @throws NotConnectedException if there was no response and the connection got disconnected.
[ "Returns", "the", "next", "available", "stanza", ".", "The", "method", "call", "will", "block", "until", "a", "stanza", "is", "available", "or", "the", "<tt", ">", "timeout<", "/", "tt", ">", "has", "elapsed", ".", "This", "method", "does", "also", "canc...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java#L278-L299
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/util/HierarchicalTable.java
HierarchicalTable.setHandle
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException { Record recMain = this.getRecord(); this.setCurrentTable(this.getNextTable()); FieldList record = super.setHandle(bookmark, iHandleType); if (record == null) { // Not found in the main table, try the other tables Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { BaseTable table = iterator.next(); if ((table != null) && (table != this.getNextTable())) { Record recAlt = table.getRecord(); record = recAlt.setHandle(bookmark, iHandleType); if (record != null) { this.syncRecordToBase(recMain, recAlt, false); this.setCurrentTable(table); break; } } } } return record; }
java
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException { Record recMain = this.getRecord(); this.setCurrentTable(this.getNextTable()); FieldList record = super.setHandle(bookmark, iHandleType); if (record == null) { // Not found in the main table, try the other tables Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { BaseTable table = iterator.next(); if ((table != null) && (table != this.getNextTable())) { Record recAlt = table.getRecord(); record = recAlt.setHandle(bookmark, iHandleType); if (record != null) { this.syncRecordToBase(recMain, recAlt, false); this.setCurrentTable(table); break; } } } } return record; }
[ "public", "FieldList", "setHandle", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "Record", "recMain", "=", "this", ".", "getRecord", "(", ")", ";", "this", ".", "setCurrentTable", "(", "this", ".", "getNextTable", ...
Reposition to this record Using this bookmark. @exception DBException File exception.
[ "Reposition", "to", "this", "record", "Using", "this", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/HierarchicalTable.java#L307-L333
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/capability/RuntimeCapability.java
RuntimeCapability.getCapabilityServiceName
public ServiceName getCapabilityServiceName(PathAddress address, Class<?> serviceValueType) { return fromBaseCapability(address).getCapabilityServiceName(serviceValueType); }
java
public ServiceName getCapabilityServiceName(PathAddress address, Class<?> serviceValueType) { return fromBaseCapability(address).getCapabilityServiceName(serviceValueType); }
[ "public", "ServiceName", "getCapabilityServiceName", "(", "PathAddress", "address", ",", "Class", "<", "?", ">", "serviceValueType", ")", "{", "return", "fromBaseCapability", "(", "address", ")", ".", "getCapabilityServiceName", "(", "serviceValueType", ")", ";", "}...
Gets the name of service provided by this capability. @param address the path from which dynamic portion of the capability name is calculated from. Cannot be {@code null} @param serviceValueType the expected type of the service's value. Only used to provide validate that the service value type provided by the capability matches the caller's expectation. May be {@code null} in which case no validation is performed @return the name of the service. Will not be {@code null} @throws IllegalArgumentException if the capability does not provide a service or if its value type is not assignable to {@code serviceValueType} @throws IllegalStateException if {@link #isDynamicallyNamed()} does not return {@code true}
[ "Gets", "the", "name", "of", "service", "provided", "by", "this", "capability", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/capability/RuntimeCapability.java#L215-L217
netty/netty
common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java
GlobalEventExecutor.awaitInactivity
public boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException { if (unit == null) { throw new NullPointerException("unit"); } final Thread thread = this.thread; if (thread == null) { throw new IllegalStateException("thread was not started"); } thread.join(unit.toMillis(timeout)); return !thread.isAlive(); }
java
public boolean awaitInactivity(long timeout, TimeUnit unit) throws InterruptedException { if (unit == null) { throw new NullPointerException("unit"); } final Thread thread = this.thread; if (thread == null) { throw new IllegalStateException("thread was not started"); } thread.join(unit.toMillis(timeout)); return !thread.isAlive(); }
[ "public", "boolean", "awaitInactivity", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "if", "(", "unit", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"unit\"", ")", ";", "}", "final", "...
Waits until the worker thread of this executor has no tasks left in its task queue and terminates itself. Because a new worker thread will be started again when a new task is submitted, this operation is only useful when you want to ensure that the worker thread is terminated <strong>after</strong> your application is shut down and there's no chance of submitting a new task afterwards. @return {@code true} if and only if the worker thread has been terminated
[ "Waits", "until", "the", "worker", "thread", "of", "this", "executor", "has", "no", "tasks", "left", "in", "its", "task", "queue", "and", "terminates", "itself", ".", "Because", "a", "new", "worker", "thread", "will", "be", "started", "again", "when", "a",...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java#L194-L205
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java
Ssh2Session.requestX11Forwarding
boolean requestX11Forwarding(boolean singleconnection, String protocol, String cookie, int screen) throws SshException { ByteArrayWriter request = new ByteArrayWriter(); try { request.writeBoolean(singleconnection); request.writeString(protocol); request.writeString(cookie); request.writeInt(screen); return sendRequest("x11-req", true, request.toByteArray()); } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { request.close(); } catch (IOException e) { } } }
java
boolean requestX11Forwarding(boolean singleconnection, String protocol, String cookie, int screen) throws SshException { ByteArrayWriter request = new ByteArrayWriter(); try { request.writeBoolean(singleconnection); request.writeString(protocol); request.writeString(cookie); request.writeInt(screen); return sendRequest("x11-req", true, request.toByteArray()); } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { request.close(); } catch (IOException e) { } } }
[ "boolean", "requestX11Forwarding", "(", "boolean", "singleconnection", ",", "String", "protocol", ",", "String", "cookie", ",", "int", "screen", ")", "throws", "SshException", "{", "ByteArrayWriter", "request", "=", "new", "ByteArrayWriter", "(", ")", ";", "try", ...
Send a request for X Forwarding. @param singleconnection @param protocol @param cookie @param display @return boolean @throws SshException
[ "Send", "a", "request", "for", "X", "Forwarding", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java#L276-L294
xcesco/kripton
kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java
XMLSerializer.setFeature
public void setFeature(String name, boolean state) throws IllegalArgumentException, IllegalStateException { if (name == null) { throw new IllegalArgumentException("feature name can not be null"); } if (FEATURE_NAMES_INTERNED.equals(name)) { namesInterned = state; } else if (FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE.equals(name)) { attributeUseApostrophe = state; } else { throw new IllegalStateException("unsupported feature " + name); } }
java
public void setFeature(String name, boolean state) throws IllegalArgumentException, IllegalStateException { if (name == null) { throw new IllegalArgumentException("feature name can not be null"); } if (FEATURE_NAMES_INTERNED.equals(name)) { namesInterned = state; } else if (FEATURE_SERIALIZER_ATTVALUE_USE_APOSTROPHE.equals(name)) { attributeUseApostrophe = state; } else { throw new IllegalStateException("unsupported feature " + name); } }
[ "public", "void", "setFeature", "(", "String", "name", ",", "boolean", "state", ")", "throws", "IllegalArgumentException", ",", "IllegalStateException", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"feature nam...
Sets the feature. @param name the name @param state the state @throws IllegalArgumentException the illegal argument exception @throws IllegalStateException the illegal state exception
[ "Sets", "the", "feature", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java#L328-L339
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java
ControlBean.preInvoke
protected void preInvoke(Method m, Object [] args) { try { preInvoke(m, args, null); } catch (InterceptorPivotException ipe) { //this will never happen because no interceptor is passed. } }
java
protected void preInvoke(Method m, Object [] args) { try { preInvoke(m, args, null); } catch (InterceptorPivotException ipe) { //this will never happen because no interceptor is passed. } }
[ "protected", "void", "preInvoke", "(", "Method", "m", ",", "Object", "[", "]", "args", ")", "{", "try", "{", "preInvoke", "(", "m", ",", "args", ",", "null", ")", ";", "}", "catch", "(", "InterceptorPivotException", "ipe", ")", "{", "//this will never ha...
The preinvoke method is called before all operations on the control. It is the basic hook for logging, context initialization, resource management, and other common services
[ "The", "preinvoke", "method", "is", "called", "before", "all", "operations", "on", "the", "control", ".", "It", "is", "the", "basic", "hook", "for", "logging", "context", "initialization", "resource", "management", "and", "other", "common", "services" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L421-L431
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/utils/MiscUtils.java
MiscUtils.readObject
public static Object readObject(String fileName, boolean isInternalFile) throws DISIException { Object result; try { InputStream fos = null; if (isInternalFile == true) { fos = Thread.currentThread().getContextClassLoader().getResource(fileName).openStream(); } else { fos = new FileInputStream(fileName); } BufferedInputStream bis = new BufferedInputStream(fos); ObjectInputStream oos = new ObjectInputStream(bis); try { result = oos.readObject(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } catch (ClassNotFoundException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } oos.close(); bis.close(); fos.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } return result; }
java
public static Object readObject(String fileName, boolean isInternalFile) throws DISIException { Object result; try { InputStream fos = null; if (isInternalFile == true) { fos = Thread.currentThread().getContextClassLoader().getResource(fileName).openStream(); } else { fos = new FileInputStream(fileName); } BufferedInputStream bis = new BufferedInputStream(fos); ObjectInputStream oos = new ObjectInputStream(bis); try { result = oos.readObject(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } catch (ClassNotFoundException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } oos.close(); bis.close(); fos.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } return result; }
[ "public", "static", "Object", "readObject", "(", "String", "fileName", ",", "boolean", "isInternalFile", ")", "throws", "DISIException", "{", "Object", "result", ";", "try", "{", "InputStream", "fos", "=", "null", ";", "if", "(", "isInternalFile", "==", "true"...
Reads Java object from a file. @param fileName the file where the object is stored @parm isInternalFile reads from internal data file in resources folder @return the object @throws DISIException DISIException
[ "Reads", "Java", "object", "from", "a", "file", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/MiscUtils.java#L62-L95
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/Counters.java
Counters.initialize
public void initialize(final MetricContext metricContext, final Class<E> enumClass, final Class<?> instrumentedClass) { Builder<E, Counter> builder = ImmutableMap.builder(); for (E e : Arrays.asList(enumClass.getEnumConstants())) { builder.put(e, metricContext.counter(MetricRegistry.name(instrumentedClass, e.name()))); } counters = builder.build(); }
java
public void initialize(final MetricContext metricContext, final Class<E> enumClass, final Class<?> instrumentedClass) { Builder<E, Counter> builder = ImmutableMap.builder(); for (E e : Arrays.asList(enumClass.getEnumConstants())) { builder.put(e, metricContext.counter(MetricRegistry.name(instrumentedClass, e.name()))); } counters = builder.build(); }
[ "public", "void", "initialize", "(", "final", "MetricContext", "metricContext", ",", "final", "Class", "<", "E", ">", "enumClass", ",", "final", "Class", "<", "?", ">", "instrumentedClass", ")", "{", "Builder", "<", "E", ",", "Counter", ">", "builder", "="...
Creates a {@link Counter} for every value of the enumClass. Use {@link #inc(Enum, long)} to increment the counter associated with a enum value @param metricContext that {@link Counter}s will be registered @param enumClass that define the names of {@link Counter}s. One counter is created per value @param instrumentedClass name that will be prefixed in the metric name
[ "Creates", "a", "{", "@link", "Counter", "}", "for", "every", "value", "of", "the", "enumClass", ".", "Use", "{", "@link", "#inc", "(", "Enum", "long", ")", "}", "to", "increment", "the", "counter", "associated", "with", "a", "enum", "value" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/Counters.java#L45-L54
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java
TaskSlotTable.isValidTimeout
public boolean isValidTimeout(AllocationID allocationId, UUID ticket) { checkInit(); return timerService.isValid(allocationId, ticket); }
java
public boolean isValidTimeout(AllocationID allocationId, UUID ticket) { checkInit(); return timerService.isValid(allocationId, ticket); }
[ "public", "boolean", "isValidTimeout", "(", "AllocationID", "allocationId", ",", "UUID", "ticket", ")", "{", "checkInit", "(", ")", ";", "return", "timerService", ".", "isValid", "(", "allocationId", ",", "ticket", ")", ";", "}" ]
Check whether the timeout with ticket is valid for the given allocation id. @param allocationId to check against @param ticket of the timeout @return True if the timeout is valid; otherwise false
[ "Check", "whether", "the", "timeout", "with", "ticket", "is", "valid", "for", "the", "given", "allocation", "id", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L361-L365
igniterealtime/Smack
smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java
OpenPgpPubSubUtil.fetchPubkeysList
public static PublicKeysListElement fetchPubkeysList(XMPPConnection connection, BareJid contact) throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException, PubSubException.NotALeafNodeException, SmackException.NotConnectedException, PubSubException.NotAPubSubNodeException { PubSubManager pm = PubSubManager.getInstanceFor(connection, contact); LeafNode node = getLeafNode(pm, PEP_NODE_PUBLIC_KEYS); List<PayloadItem<PublicKeysListElement>> list = node.getItems(1); if (list.isEmpty()) { return null; } return list.get(0).getPayload(); }
java
public static PublicKeysListElement fetchPubkeysList(XMPPConnection connection, BareJid contact) throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException, PubSubException.NotALeafNodeException, SmackException.NotConnectedException, PubSubException.NotAPubSubNodeException { PubSubManager pm = PubSubManager.getInstanceFor(connection, contact); LeafNode node = getLeafNode(pm, PEP_NODE_PUBLIC_KEYS); List<PayloadItem<PublicKeysListElement>> list = node.getItems(1); if (list.isEmpty()) { return null; } return list.get(0).getPayload(); }
[ "public", "static", "PublicKeysListElement", "fetchPubkeysList", "(", "XMPPConnection", "connection", ",", "BareJid", "contact", ")", "throws", "InterruptedException", ",", "XMPPException", ".", "XMPPErrorException", ",", "SmackException", ".", "NoResponseException", ",", ...
Consult the public key metadata node of {@code contact} to fetch the list of their published OpenPGP public keys. @see <a href="https://xmpp.org/extensions/xep-0373.html#discover-pubkey-list"> XEP-0373 §4.3: Discovering Public Keys of a User</a> @param connection XMPP connection @param contact {@link BareJid} of the user we want to fetch the list from. @return content of {@code contact}'s metadata node. @throws InterruptedException if the thread gets interrupted. @throws XMPPException.XMPPErrorException in case of an XMPP protocol exception. @throws SmackException.NoResponseException in case the server doesn't respond @throws PubSubException.NotALeafNodeException in case the queried node is not a {@link LeafNode} @throws SmackException.NotConnectedException in case we are not connected @throws PubSubException.NotAPubSubNodeException in case the queried entity is not a PubSub node
[ "Consult", "the", "public", "key", "metadata", "node", "of", "{", "@code", "contact", "}", "to", "fetch", "the", "list", "of", "their", "published", "OpenPGP", "public", "keys", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java#L204-L217
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java
RedundentExprEliminator.createIteratorFromSteps
protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps) { WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver()); try { AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone(); newIter.setFirstWalker(walker); walker.setLocPathIterator(newIter); for(int i = 1; i < numSteps; i++) { AxesWalker next = (AxesWalker)walker.getNextWalker().clone(); walker.setNextWalker(next); next.setLocPathIterator(newIter); walker = next; } walker.setNextWalker(null); } catch(CloneNotSupportedException cnse) { throw new WrappedRuntimeException(cnse); } return newIter; }
java
protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps) { WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver()); try { AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone(); newIter.setFirstWalker(walker); walker.setLocPathIterator(newIter); for(int i = 1; i < numSteps; i++) { AxesWalker next = (AxesWalker)walker.getNextWalker().clone(); walker.setNextWalker(next); next.setLocPathIterator(newIter); walker = next; } walker.setNextWalker(null); } catch(CloneNotSupportedException cnse) { throw new WrappedRuntimeException(cnse); } return newIter; }
[ "protected", "WalkingIterator", "createIteratorFromSteps", "(", "final", "WalkingIterator", "wi", ",", "int", "numSteps", ")", "{", "WalkingIterator", "newIter", "=", "new", "WalkingIterator", "(", "wi", ".", "getPrefixResolver", "(", ")", ")", ";", "try", "{", ...
Create a new WalkingIterator from the steps in another WalkingIterator. @param wi The iterator from where the steps will be taken. @param numSteps The number of steps from the first to copy into the new iterator. @return The new iterator.
[ "Create", "a", "new", "WalkingIterator", "from", "the", "steps", "in", "another", "WalkingIterator", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L487-L509
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.putStringSet
@SuppressWarnings("WeakerAccess") @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void putStringSet(final String key, final Set<String> value) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { final Editor editor = getPreferences().edit(); editor.putStringSet(key, value); editor.apply(); } else { // Workaround for pre-HC's lack of StringSets putOrderedStringSet(key, value); } }
java
@SuppressWarnings("WeakerAccess") @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void putStringSet(final String key, final Set<String> value) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { final Editor editor = getPreferences().edit(); editor.putStringSet(key, value); editor.apply(); } else { // Workaround for pre-HC's lack of StringSets putOrderedStringSet(key, value); } }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "public", "static", "void", "putStringSet", "(", "final", "String", "key", ",", "final", "Set", "<", "String", ">", "value", "...
Stores a Set of Strings. On Honeycomb and later this will call the native implementation in SharedPreferences.Editor, on older SDKs this will call {@link #putOrderedStringSet(String, Set)}. <strong>Note that the native implementation of {@link Editor#putStringSet(String, Set)} does not reliably preserve the order of the Strings in the Set.</strong> @param key The name of the preference to modify. @param value The new value for the preference. @see android.content.SharedPreferences.Editor#putStringSet(String, java.util.Set) @see #putOrderedStringSet(String, Set)
[ "Stores", "a", "Set", "of", "Strings", ".", "On", "Honeycomb", "and", "later", "this", "will", "call", "the", "native", "implementation", "in", "SharedPreferences", ".", "Editor", "on", "older", "SDKs", "this", "will", "call", "{", "@link", "#putOrderedStringS...
train
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L360-L371
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java
CommonMpJwtFat.badAppExpectations
public Expectations badAppExpectations(String errorMessage) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED)); expectations.addExpectation(new ResponseMessageExpectation(MpJwtFatConstants.STRING_CONTAINS, errorMessage, "Did not find the error message: " + errorMessage)); return expectations; }
java
public Expectations badAppExpectations(String errorMessage) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED)); expectations.addExpectation(new ResponseMessageExpectation(MpJwtFatConstants.STRING_CONTAINS, errorMessage, "Did not find the error message: " + errorMessage)); return expectations; }
[ "public", "Expectations", "badAppExpectations", "(", "String", "errorMessage", ")", "throws", "Exception", "{", "Expectations", "expectations", "=", "new", "Expectations", "(", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ResponseStatusExpectation", "...
Set bad app check expectations - sets checks for a 401 status code and the expected error message in the server's messages.log @param errorMessage - the error message to search for in the server's messages.log file @return - newly created Expectations @throws Exception
[ "Set", "bad", "app", "check", "expectations", "-", "sets", "checks", "for", "a", "401", "status", "code", "and", "the", "expected", "error", "message", "in", "the", "server", "s", "messages", ".", "log" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L111-L118
samskivert/pythagoras
src/main/java/pythagoras/f/Quaternion.java
Quaternion.fromAngles
public Quaternion fromAngles (Vector3 angles) { return fromAngles(angles.x, angles.y, angles.z); }
java
public Quaternion fromAngles (Vector3 angles) { return fromAngles(angles.x, angles.y, angles.z); }
[ "public", "Quaternion", "fromAngles", "(", "Vector3", "angles", ")", "{", "return", "fromAngles", "(", "angles", ".", "x", ",", "angles", ".", "y", ",", "angles", ".", "z", ")", ";", "}" ]
Sets this quaternion to one that first rotates about x by the specified number of radians, then rotates about y, then about z.
[ "Sets", "this", "quaternion", "to", "one", "that", "first", "rotates", "about", "x", "by", "the", "specified", "number", "of", "radians", "then", "rotates", "about", "y", "then", "about", "z", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L206-L208
google/closure-compiler
src/com/google/javascript/jscomp/CheckJSDoc.java
CheckJSDoc.validateNoSideEffects
private void validateNoSideEffects(Node n, JSDocInfo info) { // Cannot have @modifies or @nosideeffects in regular (non externs) js. Report errors. if (info == null) { return; } if (n.isFromExterns()) { return; } if (info.hasSideEffectsArgumentsAnnotation() || info.modifiesThis()) { report(n, INVALID_MODIFIES_ANNOTATION); } if (info.isNoSideEffects()) { report(n, INVALID_NO_SIDE_EFFECT_ANNOTATION); } }
java
private void validateNoSideEffects(Node n, JSDocInfo info) { // Cannot have @modifies or @nosideeffects in regular (non externs) js. Report errors. if (info == null) { return; } if (n.isFromExterns()) { return; } if (info.hasSideEffectsArgumentsAnnotation() || info.modifiesThis()) { report(n, INVALID_MODIFIES_ANNOTATION); } if (info.isNoSideEffects()) { report(n, INVALID_NO_SIDE_EFFECT_ANNOTATION); } }
[ "private", "void", "validateNoSideEffects", "(", "Node", "n", ",", "JSDocInfo", "info", ")", "{", "// Cannot have @modifies or @nosideeffects in regular (non externs) js. Report errors.", "if", "(", "info", "==", "null", ")", "{", "return", ";", "}", "if", "(", "n", ...
Check that @nosideeeffects annotations are only present in externs.
[ "Check", "that" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckJSDoc.java#L657-L673
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.bytesToBool
public static final boolean bytesToBool( byte[] data, int[] offset ) { boolean result = true; if (data[offset[0]] == 0) { result = false; } offset[0] += SIZE_BOOL; return result; }
java
public static final boolean bytesToBool( byte[] data, int[] offset ) { boolean result = true; if (data[offset[0]] == 0) { result = false; } offset[0] += SIZE_BOOL; return result; }
[ "public", "static", "final", "boolean", "bytesToBool", "(", "byte", "[", "]", "data", ",", "int", "[", "]", "offset", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "data", "[", "offset", "[", "0", "]", "]", "==", "0", ")", "{", "res...
Return the <code>boolean</code> represented by the bytes in <code>data</code> staring at offset <code>offset[0]</code>. @param data the array from which to read @param offset A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. @return the value of the <code>boolean</code> decoded
[ "Return", "the", "<code", ">", "boolean<", "/", "code", ">", "represented", "by", "the", "bytes", "in", "<code", ">", "data<", "/", "code", ">", "staring", "at", "offset", "<code", ">", "offset", "[", "0", "]", "<", "/", "code", ">", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L312-L322
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java
ReviewsImpl.publishVideoReviewAsync
public Observable<Void> publishVideoReviewAsync(String teamName, String reviewId) { return publishVideoReviewWithServiceResponseAsync(teamName, reviewId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> publishVideoReviewAsync(String teamName, String reviewId) { return publishVideoReviewWithServiceResponseAsync(teamName, reviewId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "publishVideoReviewAsync", "(", "String", "teamName", ",", "String", "reviewId", ")", "{", "return", "publishVideoReviewWithServiceResponseAsync", "(", "teamName", ",", "reviewId", ")", ".", "map", "(", "new", "Func1", "<"...
Publish video review to make it available for review. @param teamName Your team name. @param reviewId Id of the review. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Publish", "video", "review", "to", "make", "it", "available", "for", "review", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1635-L1642
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/price/PriceGraduation.java
PriceGraduation.createSimple
@Nonnull public static IMutablePriceGraduation createSimple (@Nonnull final IMutablePrice aPrice) { final PriceGraduation ret = new PriceGraduation (aPrice.getCurrency ()); ret.addItem (new PriceGraduationItem (1, aPrice.getNetAmount ().getValue ())); return ret; }
java
@Nonnull public static IMutablePriceGraduation createSimple (@Nonnull final IMutablePrice aPrice) { final PriceGraduation ret = new PriceGraduation (aPrice.getCurrency ()); ret.addItem (new PriceGraduationItem (1, aPrice.getNetAmount ().getValue ())); return ret; }
[ "@", "Nonnull", "public", "static", "IMutablePriceGraduation", "createSimple", "(", "@", "Nonnull", "final", "IMutablePrice", "aPrice", ")", "{", "final", "PriceGraduation", "ret", "=", "new", "PriceGraduation", "(", "aPrice", ".", "getCurrency", "(", ")", ")", ...
Create a simple price graduation that contains one item with the minimum quantity of 1. @param aPrice The price to use. May not be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "simple", "price", "graduation", "that", "contains", "one", "item", "with", "the", "minimum", "quantity", "of", "1", "." ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/price/PriceGraduation.java#L218-L224
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WHiddenCommentRenderer.java
WHiddenCommentRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WHiddenComment hiddenComponent = (WHiddenComment) component; XmlStringBuilder xml = renderContext.getWriter(); String hiddenText = hiddenComponent.getText(); if (!Util.empty(hiddenText)) { xml.appendTag("ui:comment"); xml.appendEscaped(hiddenText); xml.appendEndTag("ui:comment"); } }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WHiddenComment hiddenComponent = (WHiddenComment) component; XmlStringBuilder xml = renderContext.getWriter(); String hiddenText = hiddenComponent.getText(); if (!Util.empty(hiddenText)) { xml.appendTag("ui:comment"); xml.appendEscaped(hiddenText); xml.appendEndTag("ui:comment"); } }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WHiddenComment", "hiddenComponent", "=", "(", "WHiddenComment", ")", "component", ";", "XmlStringBuilder", "xml", ...
Paints the given WHiddenComment. @param component the WHiddenComment to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WHiddenComment", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WHiddenCommentRenderer.java#L24-L36
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java
CommerceNotificationTemplatePersistenceImpl.countByG_T_E
@Override public int countByG_T_E(long groupId, String type, boolean enabled) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_T_E; Object[] finderArgs = new Object[] { groupId, type, enabled }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE); query.append(_FINDER_COLUMN_G_T_E_GROUPID_2); boolean bindType = false; if (type == null) { query.append(_FINDER_COLUMN_G_T_E_TYPE_1); } else if (type.equals("")) { query.append(_FINDER_COLUMN_G_T_E_TYPE_3); } else { bindType = true; query.append(_FINDER_COLUMN_G_T_E_TYPE_2); } query.append(_FINDER_COLUMN_G_T_E_ENABLED_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindType) { qPos.add(type); } qPos.add(enabled); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_T_E(long groupId, String type, boolean enabled) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_T_E; Object[] finderArgs = new Object[] { groupId, type, enabled }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE); query.append(_FINDER_COLUMN_G_T_E_GROUPID_2); boolean bindType = false; if (type == null) { query.append(_FINDER_COLUMN_G_T_E_TYPE_1); } else if (type.equals("")) { query.append(_FINDER_COLUMN_G_T_E_TYPE_3); } else { bindType = true; query.append(_FINDER_COLUMN_G_T_E_TYPE_2); } query.append(_FINDER_COLUMN_G_T_E_ENABLED_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindType) { qPos.add(type); } qPos.add(enabled); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_T_E", "(", "long", "groupId", ",", "String", "type", ",", "boolean", "enabled", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_T_E", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[...
Returns the number of commerce notification templates where groupId = &#63; and type = &#63; and enabled = &#63;. @param groupId the group ID @param type the type @param enabled the enabled @return the number of matching commerce notification templates
[ "Returns", "the", "number", "of", "commerce", "notification", "templates", "where", "groupId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "and", "enabled", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L4296-L4361
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/ScaleSceneStructure.java
ScaleSceneStructure.applyScale
public void applyScale( SceneStructureProjective structure , SceneObservations observations ) { if( structure.homogenous ) { applyScaleToPointsHomogenous(structure); } else { computePointStatistics(structure.points); applyScaleToPoints3D(structure); applyScaleTranslation3D(structure); } // Compute pixel scaling to normalize the coordinates computePixelScaling(structure, observations); // scale and translate observations, which changes camera matrix applyScaleToPixelsAndCameraMatrix(structure, observations); }
java
public void applyScale( SceneStructureProjective structure , SceneObservations observations ) { if( structure.homogenous ) { applyScaleToPointsHomogenous(structure); } else { computePointStatistics(structure.points); applyScaleToPoints3D(structure); applyScaleTranslation3D(structure); } // Compute pixel scaling to normalize the coordinates computePixelScaling(structure, observations); // scale and translate observations, which changes camera matrix applyScaleToPixelsAndCameraMatrix(structure, observations); }
[ "public", "void", "applyScale", "(", "SceneStructureProjective", "structure", ",", "SceneObservations", "observations", ")", "{", "if", "(", "structure", ".", "homogenous", ")", "{", "applyScaleToPointsHomogenous", "(", "structure", ")", ";", "}", "else", "{", "co...
Applies the scale transform to the input scene structure. Metric. @param structure 3D scene @param observations Observations of the scene
[ "Applies", "the", "scale", "transform", "to", "the", "input", "scene", "structure", ".", "Metric", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/ScaleSceneStructure.java#L115-L130
syphr42/prom
src/main/java/org/syphr/prom/ManagedProperties.java
ManagedProperties.getProperties
public Properties getProperties(boolean includeDefaults, String propertyName) { Properties tmpProperties = new Properties(defaults); for (Entry<String, ChangeStack<String>> entry : properties.entrySet()) { String entryName = entry.getKey(); /* * If we are only concerned with a single property, we need to grab * the last saved value for all of the other properties. */ String value = propertyName == null || propertyName.equals(entryName) ? entry.getValue().getCurrentValue() : entry.getValue().getSyncedValue(); /* * The value could be null if the property has no default, was set * without saving, and now the saved value is requested. In which * case, like the case of a default value where defaults are not * being included, the property can be skipped. */ if (value == null || (!includeDefaults && value.equals(getDefaultValue(entryName)))) { continue; } tmpProperties.setProperty(entryName, value); } return tmpProperties; }
java
public Properties getProperties(boolean includeDefaults, String propertyName) { Properties tmpProperties = new Properties(defaults); for (Entry<String, ChangeStack<String>> entry : properties.entrySet()) { String entryName = entry.getKey(); /* * If we are only concerned with a single property, we need to grab * the last saved value for all of the other properties. */ String value = propertyName == null || propertyName.equals(entryName) ? entry.getValue().getCurrentValue() : entry.getValue().getSyncedValue(); /* * The value could be null if the property has no default, was set * without saving, and now the saved value is requested. In which * case, like the case of a default value where defaults are not * being included, the property can be skipped. */ if (value == null || (!includeDefaults && value.equals(getDefaultValue(entryName)))) { continue; } tmpProperties.setProperty(entryName, value); } return tmpProperties; }
[ "public", "Properties", "getProperties", "(", "boolean", "includeDefaults", ",", "String", "propertyName", ")", "{", "Properties", "tmpProperties", "=", "new", "Properties", "(", "defaults", ")", ";", "for", "(", "Entry", "<", "String", ",", "ChangeStack", "<", ...
Retrieve a {@link Properties} object that contains the properties managed by this instance. If a non-<code>null</code> property name is given, the values will be the last saved value for each property except the given one. Otherwise, the properties will all be the current values. This is useful for saving a change to a single property to disk without also saving any other changes that have been made. <br> <br> Please note that the returned {@link Properties} object is not connected in any way to this instance and is only a snapshot of what the properties looked like at the time the request was fulfilled. @param includeDefaults if <code>true</code>, values that match the default will be stored directly in the properties map; otherwise values matching the default will only be available through the {@link Properties} concept of defaults (as a fallback and not written to the file system if this object is stored) @param propertyName the name of the property whose current value should be provided while all others will be the last saved value (if this is <code>null</code>, all values will be current) @return a {@link Properties} instance containing the properties managed by this instance (including defaults as defined by the given flag)
[ "Retrieve", "a", "{", "@link", "Properties", "}", "object", "that", "contains", "the", "properties", "managed", "by", "this", "instance", ".", "If", "a", "non", "-", "<code", ">", "null<", "/", "code", ">", "property", "name", "is", "given", "the", "valu...
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L589-L622
softindex/datakernel
cloud-fs/src/main/java/io/datakernel/remotefs/LocalFsClient.java
LocalFsClient.create
public static LocalFsClient create(Eventloop eventloop, Path storageDir, Object lock) { return new LocalFsClient(eventloop, storageDir, Executors.newSingleThreadExecutor(), lock); }
java
public static LocalFsClient create(Eventloop eventloop, Path storageDir, Object lock) { return new LocalFsClient(eventloop, storageDir, Executors.newSingleThreadExecutor(), lock); }
[ "public", "static", "LocalFsClient", "create", "(", "Eventloop", "eventloop", ",", "Path", "storageDir", ",", "Object", "lock", ")", "{", "return", "new", "LocalFsClient", "(", "eventloop", ",", "storageDir", ",", "Executors", ".", "newSingleThreadExecutor", "(", ...
Use this to synchronize multiple LocalFsClient's over some filesystem space that they may all try to access (same storage folder, one storage is subfolder of another etc.)
[ "Use", "this", "to", "synchronize", "multiple", "LocalFsClient", "s", "over", "some", "filesystem", "space", "that", "they", "may", "all", "try", "to", "access", "(", "same", "storage", "folder", "one", "storage", "is", "subfolder", "of", "another", "etc", "...
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/cloud-fs/src/main/java/io/datakernel/remotefs/LocalFsClient.java#L168-L170
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/PGStream.java
PGStream.receive
public void receive(byte[] buf, int off, int siz) throws IOException { int s = 0; while (s < siz) { int w = pgInput.read(buf, off + s, siz - s); if (w < 0) { throw new EOFException(); } s += w; } }
java
public void receive(byte[] buf, int off, int siz) throws IOException { int s = 0; while (s < siz) { int w = pgInput.read(buf, off + s, siz - s); if (w < 0) { throw new EOFException(); } s += w; } }
[ "public", "void", "receive", "(", "byte", "[", "]", "buf", ",", "int", "off", ",", "int", "siz", ")", "throws", "IOException", "{", "int", "s", "=", "0", ";", "while", "(", "s", "<", "siz", ")", "{", "int", "w", "=", "pgInput", ".", "read", "("...
Reads in a given number of bytes from the backend. @param buf buffer to store result @param off offset in buffer @param siz number of bytes to read @throws IOException if a data I/O error occurs
[ "Reads", "in", "a", "given", "number", "of", "bytes", "from", "the", "backend", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/PGStream.java#L473-L483
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractQueryImpl.java
AbstractQueryImpl.bindValue
public void bindValue(InternalQName varName, Value value) throws IllegalArgumentException, RepositoryException { if (!variableNames.contains(varName)) { throw new IllegalArgumentException("not a valid variable in this query"); } else { bindValues.put(varName, value); } }
java
public void bindValue(InternalQName varName, Value value) throws IllegalArgumentException, RepositoryException { if (!variableNames.contains(varName)) { throw new IllegalArgumentException("not a valid variable in this query"); } else { bindValues.put(varName, value); } }
[ "public", "void", "bindValue", "(", "InternalQName", "varName", ",", "Value", "value", ")", "throws", "IllegalArgumentException", ",", "RepositoryException", "{", "if", "(", "!", "variableNames", ".", "contains", "(", "varName", ")", ")", "{", "throw", "new", ...
Binds the given <code>value</code> to the variable named <code>varName</code>. @param varName name of variable in query @param value value to bind @throws IllegalArgumentException if <code>varName</code> is not a valid variable in this query. @throws RepositoryException if an error occurs.
[ "Binds", "the", "given", "<code", ">", "value<", "/", "code", ">", "to", "the", "variable", "named", "<code", ">", "varName<", "/", "code", ">", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractQueryImpl.java#L153-L163
weld/core
impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java
AnnotatedTypes.compareAnnotatedParameters
private static boolean compareAnnotatedParameters(List<? extends AnnotatedParameter<?>> p1, List<? extends AnnotatedParameter<?>> p2) { if (p1.size() != p2.size()) { return false; } for (int i = 0; i < p1.size(); ++i) { if (!compareAnnotated(p1.get(i), p2.get(i))) { return false; } } return true; }
java
private static boolean compareAnnotatedParameters(List<? extends AnnotatedParameter<?>> p1, List<? extends AnnotatedParameter<?>> p2) { if (p1.size() != p2.size()) { return false; } for (int i = 0; i < p1.size(); ++i) { if (!compareAnnotated(p1.get(i), p2.get(i))) { return false; } } return true; }
[ "private", "static", "boolean", "compareAnnotatedParameters", "(", "List", "<", "?", "extends", "AnnotatedParameter", "<", "?", ">", ">", "p1", ",", "List", "<", "?", "extends", "AnnotatedParameter", "<", "?", ">", ">", "p2", ")", "{", "if", "(", "p1", "...
compares two annotated elements to see if they have the same annotations
[ "compares", "two", "annotated", "elements", "to", "see", "if", "they", "have", "the", "same", "annotations" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L435-L445
knowm/XChange
xchange-core/src/main/java/org/knowm/xchange/utils/CertHelper.java
CertHelper.createIncorrectHostnameVerifier
public static HostnameVerifier createIncorrectHostnameVerifier( final String requestHostname, final String certPrincipalName) { return new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { try { String principalName = session.getPeerPrincipal().getName(); if (hostname.equals(requestHostname) && principalName.equals(certPrincipalName)) return true; } catch (SSLPeerUnverifiedException e) { } return HttpsURLConnection.getDefaultHostnameVerifier().verify(hostname, session); } }; }
java
public static HostnameVerifier createIncorrectHostnameVerifier( final String requestHostname, final String certPrincipalName) { return new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { try { String principalName = session.getPeerPrincipal().getName(); if (hostname.equals(requestHostname) && principalName.equals(certPrincipalName)) return true; } catch (SSLPeerUnverifiedException e) { } return HttpsURLConnection.getDefaultHostnameVerifier().verify(hostname, session); } }; }
[ "public", "static", "HostnameVerifier", "createIncorrectHostnameVerifier", "(", "final", "String", "requestHostname", ",", "final", "String", "certPrincipalName", ")", "{", "return", "new", "HostnameVerifier", "(", ")", "{", "@", "Override", "public", "boolean", "veri...
Creates a custom {@link HostnameVerifier} that allows a specific certificate to be accepted for a mismatching hostname. @param requestHostname hostname used to access the service which offers the incorrectly named certificate @param certPrincipalName RFC 2253 name on the certificate @return A {@link HostnameVerifier} that will accept the provided combination of names
[ "Creates", "a", "custom", "{", "@link", "HostnameVerifier", "}", "that", "allows", "a", "specific", "certificate", "to", "be", "accepted", "for", "a", "mismatching", "hostname", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/CertHelper.java#L220-L241
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
JsonRpcClient.readResponse
private Object readResponse(Type returnType, InputStream input, String id) throws Throwable { ReadContext context = ReadContext.getReadContext(input, mapper); ObjectNode jsonObject = getValidResponse(id, context); notifyAnswerListener(jsonObject); handleErrorResponse(jsonObject); if (hasResult(jsonObject)) { if (isReturnTypeInvalid(returnType)) { return null; } return constructResponseObject(returnType, jsonObject); } // no return type return null; }
java
private Object readResponse(Type returnType, InputStream input, String id) throws Throwable { ReadContext context = ReadContext.getReadContext(input, mapper); ObjectNode jsonObject = getValidResponse(id, context); notifyAnswerListener(jsonObject); handleErrorResponse(jsonObject); if (hasResult(jsonObject)) { if (isReturnTypeInvalid(returnType)) { return null; } return constructResponseObject(returnType, jsonObject); } // no return type return null; }
[ "private", "Object", "readResponse", "(", "Type", "returnType", ",", "InputStream", "input", ",", "String", "id", ")", "throws", "Throwable", "{", "ReadContext", "context", "=", "ReadContext", ".", "getReadContext", "(", "input", ",", "mapper", ")", ";", "Obje...
Reads a JSON-PRC response from the server. This blocks until a response is received. If an id is given, responses that do not correspond, are disregarded. @param returnType the expected return type @param input the {@link InputStream} to read from @param id The id used to compare the response with. @return the object returned by the JSON-RPC response @throws Throwable on error
[ "Reads", "a", "JSON", "-", "PRC", "response", "from", "the", "server", ".", "This", "blocks", "until", "a", "response", "is", "received", ".", "If", "an", "id", "is", "given", "responses", "that", "do", "not", "correspond", "are", "disregarded", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L191-L207
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java
TemplateElasticsearchUpdater.removeTemplate
@Deprecated public static void removeTemplate(Client client, String template) { logger.trace("removeTemplate({})", template); client.admin().indices().prepareDeleteTemplate(template).get(); logger.trace("/removeTemplate({})", template); }
java
@Deprecated public static void removeTemplate(Client client, String template) { logger.trace("removeTemplate({})", template); client.admin().indices().prepareDeleteTemplate(template).get(); logger.trace("/removeTemplate({})", template); }
[ "@", "Deprecated", "public", "static", "void", "removeTemplate", "(", "Client", "client", ",", "String", "template", ")", "{", "logger", ".", "trace", "(", "\"removeTemplate({})\"", ",", "template", ")", ";", "client", ".", "admin", "(", ")", ".", "indices",...
Remove a template @param client Elasticsearch client @param template template name @deprecated Will be removed when we don't support TransportClient anymore
[ "Remove", "a", "template" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/template/TemplateElasticsearchUpdater.java#L142-L147
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java
NetworkConfig.createAllOrderers
private void createAllOrderers() throws NetworkConfigurationException { // Sanity check if (orderers != null) { throw new NetworkConfigurationException("INTERNAL ERROR: orderers has already been initialized!"); } orderers = new HashMap<>(); // orderers is a JSON object containing a nested object for each orderers JsonObject jsonOrderers = getJsonObject(jsonConfig, "orderers"); if (jsonOrderers != null) { for (Entry<String, JsonValue> entry : jsonOrderers.entrySet()) { String ordererName = entry.getKey(); JsonObject jsonOrderer = getJsonValueAsObject(entry.getValue()); if (jsonOrderer == null) { throw new NetworkConfigurationException(format("Error loading config. Invalid orderer entry: %s", ordererName)); } Node orderer = createNode(ordererName, jsonOrderer, "url"); if (orderer == null) { throw new NetworkConfigurationException(format("Error loading config. Invalid orderer entry: %s", ordererName)); } orderers.put(ordererName, orderer); } } }
java
private void createAllOrderers() throws NetworkConfigurationException { // Sanity check if (orderers != null) { throw new NetworkConfigurationException("INTERNAL ERROR: orderers has already been initialized!"); } orderers = new HashMap<>(); // orderers is a JSON object containing a nested object for each orderers JsonObject jsonOrderers = getJsonObject(jsonConfig, "orderers"); if (jsonOrderers != null) { for (Entry<String, JsonValue> entry : jsonOrderers.entrySet()) { String ordererName = entry.getKey(); JsonObject jsonOrderer = getJsonValueAsObject(entry.getValue()); if (jsonOrderer == null) { throw new NetworkConfigurationException(format("Error loading config. Invalid orderer entry: %s", ordererName)); } Node orderer = createNode(ordererName, jsonOrderer, "url"); if (orderer == null) { throw new NetworkConfigurationException(format("Error loading config. Invalid orderer entry: %s", ordererName)); } orderers.put(ordererName, orderer); } } }
[ "private", "void", "createAllOrderers", "(", ")", "throws", "NetworkConfigurationException", "{", "// Sanity check", "if", "(", "orderers", "!=", "null", ")", "{", "throw", "new", "NetworkConfigurationException", "(", "\"INTERNAL ERROR: orderers has already been initialized!\...
Creates Node instances representing all the orderers defined in the config file
[ "Creates", "Node", "instances", "representing", "all", "the", "orderers", "defined", "in", "the", "config", "file" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/NetworkConfig.java#L501-L531
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayVariant
public static String getDisplayVariant(String localeID, ULocale displayLocale) { return getDisplayVariantInternal(new ULocale(localeID), displayLocale); }
java
public static String getDisplayVariant(String localeID, ULocale displayLocale) { return getDisplayVariantInternal(new ULocale(localeID), displayLocale); }
[ "public", "static", "String", "getDisplayVariant", "(", "String", "localeID", ",", "ULocale", "displayLocale", ")", "{", "return", "getDisplayVariantInternal", "(", "new", "ULocale", "(", "localeID", ")", ",", "displayLocale", ")", ";", "}" ]
<strong>[icu]</strong> Returns a locale's variant localized for display in the provided locale. This is a cover for the ICU4C API. @param localeID the id of the locale whose variant will be displayed. @param displayLocale the locale in which to display the name. @return the localized variant name.
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "a", "locale", "s", "variant", "localized", "for", "display", "in", "the", "provided", "locale", ".", "This", "is", "a", "cover", "for", "the", "ICU4C", "API", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1652-L1654
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.unescapeProperties
public static void unescapeProperties(final char[] text, final int offset, final int len, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } PropertiesUnescapeUtil.unescape(text, offset, len, writer); }
java
public static void unescapeProperties(final char[] text, final int offset, final int len, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } PropertiesUnescapeUtil.unescape(text, offset, len, writer); }
[ "public", "static", "void", "unescapeProperties", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", "...
<p> Perform a Java Properties (key or value) <strong>unescape</strong> operation on a <tt>char[]</tt> input. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> Java Properties unescape of SECs and u-based escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be unescaped. @param offset the position in <tt>text</tt> at which the unescape operation should start. @param len the number of characters in <tt>text</tt> that should be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "a", "Java", "Properties", "(", "key", "or", "value", ")", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L1476-L1497
square/phrase
src/main/java/com/squareup/phrase/Phrase.java
Phrase.from
public static Phrase from(Fragment f, @StringRes int patternResourceId) { return from(f.getResources(), patternResourceId); }
java
public static Phrase from(Fragment f, @StringRes int patternResourceId) { return from(f.getResources(), patternResourceId); }
[ "public", "static", "Phrase", "from", "(", "Fragment", "f", ",", "@", "StringRes", "int", "patternResourceId", ")", "{", "return", "from", "(", "f", ".", "getResources", "(", ")", ",", "patternResourceId", ")", ";", "}" ]
Entry point into this API. @throws IllegalArgumentException if pattern contains any syntax errors.
[ "Entry", "point", "into", "this", "API", "." ]
train
https://github.com/square/phrase/blob/d91f18e80790832db11b811c462f8e5cd492d97e/src/main/java/com/squareup/phrase/Phrase.java#L78-L80
evernote/android-job
library/src/main/java/com/evernote/android/job/JobConfig.java
JobConfig.setApiEnabled
public static void setApiEnabled(@NonNull JobApi api, boolean enabled) { ENABLED_APIS.put(api, enabled); CAT.w("setApiEnabled - %s, %b", api, enabled); }
java
public static void setApiEnabled(@NonNull JobApi api, boolean enabled) { ENABLED_APIS.put(api, enabled); CAT.w("setApiEnabled - %s, %b", api, enabled); }
[ "public", "static", "void", "setApiEnabled", "(", "@", "NonNull", "JobApi", "api", ",", "boolean", "enabled", ")", "{", "ENABLED_APIS", ".", "put", "(", "api", ",", "enabled", ")", ";", "CAT", ".", "w", "(", "\"setApiEnabled - %s, %b\"", ",", "api", ",", ...
<b>WARNING:</b> Please use this method carefully. It's only meant to be used for testing purposes and could break how the library works. <br> <br> Programmatic switch to enable or disable the given API. This only has an impact for new scheduled jobs. @param api The API which should be enabled or disabled. @param enabled Whether the API should be enabled or disabled.
[ "<b", ">", "WARNING", ":", "<", "/", "b", ">", "Please", "use", "this", "method", "carefully", ".", "It", "s", "only", "meant", "to", "be", "used", "for", "testing", "purposes", "and", "could", "break", "how", "the", "library", "works", ".", "<br", "...
train
https://github.com/evernote/android-job/blob/5ae3d776ad9d80b5b7f60ae3e382d44d0d193faf/library/src/main/java/com/evernote/android/job/JobConfig.java#L110-L113
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PermissionsImpl.java
PermissionsImpl.updateAsync
public Observable<OperationStatus> updateAsync(UUID appId, UpdatePermissionsOptionalParameter updateOptionalParameter) { return updateWithServiceResponseAsync(appId, updateOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateAsync(UUID appId, UpdatePermissionsOptionalParameter updateOptionalParameter) { return updateWithServiceResponseAsync(appId, updateOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateAsync", "(", "UUID", "appId", ",", "UpdatePermissionsOptionalParameter", "updateOptionalParameter", ")", "{", "return", "updateWithServiceResponseAsync", "(", "appId", ",", "updateOptionalParameter", ")", ".", "m...
Replaces the current users access list with the one sent in the body. If an empty list is sent, all access to other users will be removed. @param appId The application ID. @param updateOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Replaces", "the", "current", "users", "access", "list", "with", "the", "one", "sent", "in", "the", "body", ".", "If", "an", "empty", "list", "is", "sent", "all", "access", "to", "other", "users", "will", "be", "removed", "." ]
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/PermissionsImpl.java#L506-L513
phax/ph-web
ph-web/src/main/java/com/helger/web/fileupload/parse/ParameterParser.java
ParameterParser.parse
@Nonnull @ReturnsMutableCopy public ICommonsMap <String, String> parse (@Nullable final String sStr, @Nullable final char [] aSeparators) { if (ArrayHelper.isEmpty (aSeparators)) return new CommonsHashMap <> (); char cSep = aSeparators[0]; if (sStr != null) { // Find the first separator to use int nFirstIndex = sStr.length (); for (final char cSep2 : aSeparators) { final int nCurIndex = sStr.indexOf (cSep2); if (nCurIndex != -1 && nCurIndex < nFirstIndex) { nFirstIndex = nCurIndex; cSep = cSep2; } } } return parse (sStr, cSep); }
java
@Nonnull @ReturnsMutableCopy public ICommonsMap <String, String> parse (@Nullable final String sStr, @Nullable final char [] aSeparators) { if (ArrayHelper.isEmpty (aSeparators)) return new CommonsHashMap <> (); char cSep = aSeparators[0]; if (sStr != null) { // Find the first separator to use int nFirstIndex = sStr.length (); for (final char cSep2 : aSeparators) { final int nCurIndex = sStr.indexOf (cSep2); if (nCurIndex != -1 && nCurIndex < nFirstIndex) { nFirstIndex = nCurIndex; cSep = cSep2; } } } return parse (sStr, cSep); }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "ICommonsMap", "<", "String", ",", "String", ">", "parse", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "char", "[", "]", "aSeparators", ")", "{", "if", "(", "ArrayHelp...
Extracts a map of name/value pairs from the given string. Names are expected to be unique. Multiple separators may be specified and the earliest found in the input string is used. @param sStr the string that contains a sequence of name/value pairs @param aSeparators the name/value pairs separators @return a map of name/value pairs
[ "Extracts", "a", "map", "of", "name", "/", "value", "pairs", "from", "the", "given", "string", ".", "Names", "are", "expected", "to", "be", "unique", ".", "Multiple", "separators", "may", "be", "specified", "and", "the", "earliest", "found", "in", "the", ...
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/fileupload/parse/ParameterParser.java#L231-L254
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/JaspiServiceImpl.java
JaspiServiceImpl.isAnyProviderRegistered
@Override public boolean isAnyProviderRegistered(WebRequest webRequest) { // default to true for case where a custom factory is used (i.e. not our ProviderRegistry) // we will assume that some provider is registered so we will call jaspi to // process the request. boolean result = true; AuthConfigFactory providerFactory = getAuthConfigFactory(); BridgeBuilderService bridgeBuilderService = bridgeBuilderServiceRef.getService(); if (bridgeBuilderService != null) { JaspiRequest jaspiRequest = new JaspiRequest(webRequest, null); //TODO: Some paths have a WebAppConfig that should be taken into accounnt when getting the appContext String appContext = jaspiRequest.getAppContext(); bridgeBuilderService.buildBridgeIfNeeded(appContext, providerFactory); } if (providerFactory != null && providerFactory instanceof ProviderRegistry) { // if the user defined feature provider came or went, process that 1st if (providerConfigModified) { ((ProviderRegistry) providerFactory).setProvider(jaspiProviderServiceRef.getService()); } providerConfigModified = false; result = ((ProviderRegistry) providerFactory).isAnyProviderRegistered(); } return result; }
java
@Override public boolean isAnyProviderRegistered(WebRequest webRequest) { // default to true for case where a custom factory is used (i.e. not our ProviderRegistry) // we will assume that some provider is registered so we will call jaspi to // process the request. boolean result = true; AuthConfigFactory providerFactory = getAuthConfigFactory(); BridgeBuilderService bridgeBuilderService = bridgeBuilderServiceRef.getService(); if (bridgeBuilderService != null) { JaspiRequest jaspiRequest = new JaspiRequest(webRequest, null); //TODO: Some paths have a WebAppConfig that should be taken into accounnt when getting the appContext String appContext = jaspiRequest.getAppContext(); bridgeBuilderService.buildBridgeIfNeeded(appContext, providerFactory); } if (providerFactory != null && providerFactory instanceof ProviderRegistry) { // if the user defined feature provider came or went, process that 1st if (providerConfigModified) { ((ProviderRegistry) providerFactory).setProvider(jaspiProviderServiceRef.getService()); } providerConfigModified = false; result = ((ProviderRegistry) providerFactory).isAnyProviderRegistered(); } return result; }
[ "@", "Override", "public", "boolean", "isAnyProviderRegistered", "(", "WebRequest", "webRequest", ")", "{", "// default to true for case where a custom factory is used (i.e. not our ProviderRegistry)", "// we will assume that some provider is registered so we will call jaspi to", "// process...
/* This is for performance - so we will not call jaspi processing for a request if there are no providers registered. @see com.ibm.ws.webcontainer.security.JaspiService#isAnyProviderRegistered()
[ "/", "*", "This", "is", "for", "performance", "-", "so", "we", "will", "not", "call", "jaspi", "processing", "for", "a", "request", "if", "there", "are", "no", "providers", "registered", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/JaspiServiceImpl.java#L1080-L1103
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java
JavaScriptCompilerMojo.createSourceMapFile
private void createSourceMapFile(File output,SourceMap sourceMap) throws WatchingException{ if (googleClosureMap) { PrintWriter mapWriter = null; File mapFile = new File(output.getPath() + ".map"); FileUtils.deleteQuietly(mapFile); try { mapWriter = new PrintWriter(mapFile, Charset.defaultCharset().name()); sourceMap.appendTo(mapWriter, output.getName()); FileUtils.write(output, "\n//# sourceMappingURL=" + mapFile.getName(), true); } catch (IOException e) { throw new WatchingException("Cannot create source map file for JavaScript file '" + output.getAbsolutePath() + "'", e); } finally { IOUtils.closeQuietly(mapWriter); } } }
java
private void createSourceMapFile(File output,SourceMap sourceMap) throws WatchingException{ if (googleClosureMap) { PrintWriter mapWriter = null; File mapFile = new File(output.getPath() + ".map"); FileUtils.deleteQuietly(mapFile); try { mapWriter = new PrintWriter(mapFile, Charset.defaultCharset().name()); sourceMap.appendTo(mapWriter, output.getName()); FileUtils.write(output, "\n//# sourceMappingURL=" + mapFile.getName(), true); } catch (IOException e) { throw new WatchingException("Cannot create source map file for JavaScript file '" + output.getAbsolutePath() + "'", e); } finally { IOUtils.closeQuietly(mapWriter); } } }
[ "private", "void", "createSourceMapFile", "(", "File", "output", ",", "SourceMap", "sourceMap", ")", "throws", "WatchingException", "{", "if", "(", "googleClosureMap", ")", "{", "PrintWriter", "mapWriter", "=", "null", ";", "File", "mapFile", "=", "new", "File",...
Create a source map file corresponding to the given compiled js file. @param output The compiled js file @param sourceMap The {@link SourceMap} retrieved from the compiler @throws WatchingException If an IOException occurred while creating the source map file.
[ "Create", "a", "source", "map", "file", "corresponding", "to", "the", "given", "compiled", "js", "file", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaScriptCompilerMojo.java#L466-L483
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/ModuleContentTypes.java
ModuleContentTypes.fetchAll
public CMAArray<CMAContentType> fetchAll(String spaceId, String environmentId) { return fetchAll(spaceId, environmentId, new HashMap<>()); }
java
public CMAArray<CMAContentType> fetchAll(String spaceId, String environmentId) { return fetchAll(spaceId, environmentId, new HashMap<>()); }
[ "public", "CMAArray", "<", "CMAContentType", ">", "fetchAll", "(", "String", "spaceId", ",", "String", "environmentId", ")", "{", "return", "fetchAll", "(", "spaceId", ",", "environmentId", ",", "new", "HashMap", "<>", "(", ")", ")", ";", "}" ]
Fetch all Content Types from an Environment, using default query parameter. <p> This fetch uses the default parameter defined in {@link DefaultQueryParameter#FETCH} <p> This method will override the configuration specified through {@link CMAClient.Builder#setSpaceId(String)} and {@link CMAClient.Builder#setEnvironmentId(String)}. @param spaceId Space ID @param environmentId Environment ID @return {@link CMAArray} result instance @throws IllegalArgumentException if spaceId is null.
[ "Fetch", "all", "Content", "Types", "from", "an", "Environment", "using", "default", "query", "parameter", ".", "<p", ">", "This", "fetch", "uses", "the", "default", "parameter", "defined", "in", "{", "@link", "DefaultQueryParameter#FETCH", "}", "<p", ">", "Th...
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleContentTypes.java#L186-L188
bozaro/git-lfs-java
gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/internal/BatchWorker.java
BatchWorker.submitTask
private void submitTask(@NotNull State<T, R> state, @NotNull BatchItem item, @NotNull Link auth) { // Submit task final StateHolder holder = new StateHolder(state); try { state.auth = auth; final Work<R> worker = objectTask(state, item); if (state.future.isDone()) { holder.close(); return; } if (worker == null) { throw new IllegalStateException("Uncompleted task worker is null: " + item); } executeInPool( "task: " + state.getMeta().getOid(), () -> processObject(state, auth, worker), holder::close, true ); } catch (Throwable e) { holder.close(); throw e; } }
java
private void submitTask(@NotNull State<T, R> state, @NotNull BatchItem item, @NotNull Link auth) { // Submit task final StateHolder holder = new StateHolder(state); try { state.auth = auth; final Work<R> worker = objectTask(state, item); if (state.future.isDone()) { holder.close(); return; } if (worker == null) { throw new IllegalStateException("Uncompleted task worker is null: " + item); } executeInPool( "task: " + state.getMeta().getOid(), () -> processObject(state, auth, worker), holder::close, true ); } catch (Throwable e) { holder.close(); throw e; } }
[ "private", "void", "submitTask", "(", "@", "NotNull", "State", "<", "T", ",", "R", ">", "state", ",", "@", "NotNull", "BatchItem", "item", ",", "@", "NotNull", "Link", "auth", ")", "{", "// Submit task", "final", "StateHolder", "holder", "=", "new", "Sta...
Submit object processing task. @param state Current object state @param item Metadata information with upload/download urls. @param auth Urls authentication state.
[ "Submit", "object", "processing", "task", "." ]
train
https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/internal/BatchWorker.java#L208-L231
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java
ArabicShaping.shape
public void shape(char[] source, int start, int length) throws ArabicShapingException { if ((options & LAMALEF_MASK) == LAMALEF_RESIZE) { throw new ArabicShapingException("Cannot shape in place with length option resize."); } shape(source, start, length, source, start, length); }
java
public void shape(char[] source, int start, int length) throws ArabicShapingException { if ((options & LAMALEF_MASK) == LAMALEF_RESIZE) { throw new ArabicShapingException("Cannot shape in place with length option resize."); } shape(source, start, length, source, start, length); }
[ "public", "void", "shape", "(", "char", "[", "]", "source", ",", "int", "start", ",", "int", "length", ")", "throws", "ArabicShapingException", "{", "if", "(", "(", "options", "&", "LAMALEF_MASK", ")", "==", "LAMALEF_RESIZE", ")", "{", "throw", "new", "A...
Convert a range of text in place. This may only be used if the Length option does not grow or shrink the text. @param source An array containing the input text @param start The start of the range of text to convert @param length The length of the range of text to convert @throws ArabicShapingException if the text cannot be converted according to the options.
[ "Convert", "a", "range", "of", "text", "in", "place", ".", "This", "may", "only", "be", "used", "if", "the", "Length", "option", "does", "not", "grow", "or", "shrink", "the", "text", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java#L144-L149
Red5/red5-server-common
src/main/java/org/red5/server/messaging/AbstractPipe.java
AbstractPipe.subscribe
public boolean subscribe(IProvider provider, Map<String, Object> paramMap) { boolean success = providers.addIfAbsent(provider); // register event listener if given and just added if (success && provider instanceof IPipeConnectionListener) { listeners.addIfAbsent((IPipeConnectionListener) provider); } return success; }
java
public boolean subscribe(IProvider provider, Map<String, Object> paramMap) { boolean success = providers.addIfAbsent(provider); // register event listener if given and just added if (success && provider instanceof IPipeConnectionListener) { listeners.addIfAbsent((IPipeConnectionListener) provider); } return success; }
[ "public", "boolean", "subscribe", "(", "IProvider", "provider", ",", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "boolean", "success", "=", "providers", ".", "addIfAbsent", "(", "provider", ")", ";", "// register event listener if given and jus...
Connect provider to this pipe. Doesn't allow to connect one provider twice. Does register event listeners if instance of IPipeConnectionListener is given. @param provider Provider @param paramMap Parameters passed with connection, used in concrete pipe implementations @return true if provider was added, false otherwise
[ "Connect", "provider", "to", "this", "pipe", ".", "Doesn", "t", "allow", "to", "connect", "one", "provider", "twice", ".", "Does", "register", "event", "listeners", "if", "instance", "of", "IPipeConnectionListener", "is", "given", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/AbstractPipe.java#L92-L99
dnsjava/dnsjava
org/xbill/DNS/ZoneTransferIn.java
ZoneTransferIn.newAXFR
public static ZoneTransferIn newAXFR(Name zone, SocketAddress address, TSIG key) { return new ZoneTransferIn(zone, Type.AXFR, 0, false, address, key); }
java
public static ZoneTransferIn newAXFR(Name zone, SocketAddress address, TSIG key) { return new ZoneTransferIn(zone, Type.AXFR, 0, false, address, key); }
[ "public", "static", "ZoneTransferIn", "newAXFR", "(", "Name", "zone", ",", "SocketAddress", "address", ",", "TSIG", "key", ")", "{", "return", "new", "ZoneTransferIn", "(", "zone", ",", "Type", ".", "AXFR", ",", "0", ",", "false", ",", "address", ",", "k...
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer). @param zone The zone to transfer. @param address The host/port from which to transfer the zone. @param key The TSIG key used to authenticate the transfer, or null. @return The ZoneTransferIn object.
[ "Instantiates", "a", "ZoneTransferIn", "object", "to", "do", "an", "AXFR", "(", "full", "zone", "transfer", ")", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L200-L203
joniles/mpxj
src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java
PrimaveraConvert.process
public void process(String driverClass, String connectionString, String projectID, String outputFile) throws Exception { System.out.println("Reading Primavera database started."); Class.forName(driverClass); Properties props = new Properties(); // // This is not a very robust way to detect that we're working with SQLlite... // If you are trying to grab data from // a standalone P6 using SQLite, the SQLite JDBC driver needs this property // in order to correctly parse timestamps. // if (driverClass.equals("org.sqlite.JDBC")) { props.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss"); } Connection c = DriverManager.getConnection(connectionString, props); PrimaveraDatabaseReader reader = new PrimaveraDatabaseReader(); reader.setConnection(c); processProject(reader, Integer.parseInt(projectID), outputFile); }
java
public void process(String driverClass, String connectionString, String projectID, String outputFile) throws Exception { System.out.println("Reading Primavera database started."); Class.forName(driverClass); Properties props = new Properties(); // // This is not a very robust way to detect that we're working with SQLlite... // If you are trying to grab data from // a standalone P6 using SQLite, the SQLite JDBC driver needs this property // in order to correctly parse timestamps. // if (driverClass.equals("org.sqlite.JDBC")) { props.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss"); } Connection c = DriverManager.getConnection(connectionString, props); PrimaveraDatabaseReader reader = new PrimaveraDatabaseReader(); reader.setConnection(c); processProject(reader, Integer.parseInt(projectID), outputFile); }
[ "public", "void", "process", "(", "String", "driverClass", ",", "String", "connectionString", ",", "String", "projectID", ",", "String", "outputFile", ")", "throws", "Exception", "{", "System", ".", "out", ".", "println", "(", "\"Reading Primavera database started.\...
Extract Primavera project data and export in another format. @param driverClass JDBC driver class name @param connectionString JDBC connection string @param projectID project ID @param outputFile output file @throws Exception
[ "Extract", "Primavera", "project", "data", "and", "export", "in", "another", "format", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java#L82-L105
xmlunit/xmlunit
xmlunit-matchers/src/main/java/org/xmlunit/matchers/EvaluateXPathMatcher.java
EvaluateXPathMatcher.hasXPath
@Factory public static EvaluateXPathMatcher hasXPath(String xPath, Matcher<String> valueMatcher) { return new EvaluateXPathMatcher(xPath, valueMatcher); }
java
@Factory public static EvaluateXPathMatcher hasXPath(String xPath, Matcher<String> valueMatcher) { return new EvaluateXPathMatcher(xPath, valueMatcher); }
[ "@", "Factory", "public", "static", "EvaluateXPathMatcher", "hasXPath", "(", "String", "xPath", ",", "Matcher", "<", "String", ">", "valueMatcher", ")", "{", "return", "new", "EvaluateXPathMatcher", "(", "xPath", ",", "valueMatcher", ")", ";", "}" ]
Creates a matcher that matches when the examined XML input has a value at the specified <code>xPath</code> that satisfies the specified <code>valueMatcher</code>. <p>For example:</p> <pre>assertThat(xml, hasXPath(&quot;//fruits/fruit/@name&quot;, equalTo(&quot;apple&quot;))</pre> @param xPath the target xpath @param valueMatcher matcher for the value at the specified xpath @return the xpath matcher
[ "Creates", "a", "matcher", "that", "matches", "when", "the", "examined", "XML", "input", "has", "a", "value", "at", "the", "specified", "<code", ">", "xPath<", "/", "code", ">", "that", "satisfies", "the", "specified", "<code", ">", "valueMatcher<", "/", "...
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-matchers/src/main/java/org/xmlunit/matchers/EvaluateXPathMatcher.java#L96-L99
alkacon/opencms-core
src/org/opencms/xml/types/CmsXmlCategoryValue.java
CmsXmlCategoryValue.fillEntry
public static void fillEntry(Element element, CmsUUID id, String rootPath, CmsRelationType type) { CmsLink link = new CmsLink(CmsXmlCategoryValue.TYPE_VFS_LINK, type, id, rootPath, true); // get xml node Element linkElement = element.element(CmsXmlPage.NODE_LINK); if (linkElement == null) { // create xml node if needed linkElement = element.addElement(CmsXmlPage.NODE_LINK); } // update xml node CmsLinkUpdateUtil.updateXmlForVfsFile(link, linkElement); }
java
public static void fillEntry(Element element, CmsUUID id, String rootPath, CmsRelationType type) { CmsLink link = new CmsLink(CmsXmlCategoryValue.TYPE_VFS_LINK, type, id, rootPath, true); // get xml node Element linkElement = element.element(CmsXmlPage.NODE_LINK); if (linkElement == null) { // create xml node if needed linkElement = element.addElement(CmsXmlPage.NODE_LINK); } // update xml node CmsLinkUpdateUtil.updateXmlForVfsFile(link, linkElement); }
[ "public", "static", "void", "fillEntry", "(", "Element", "element", ",", "CmsUUID", "id", ",", "String", "rootPath", ",", "CmsRelationType", "type", ")", "{", "CmsLink", "link", "=", "new", "CmsLink", "(", "CmsXmlCategoryValue", ".", "TYPE_VFS_LINK", ",", "typ...
Fills the given element with a {@link CmsXmlCategoryValue} for the given data.<p> @param element the element to fill @param id the id to use @param rootPath the path to use @param type the relation type to use
[ "Fills", "the", "given", "element", "with", "a", "{", "@link", "CmsXmlCategoryValue", "}", "for", "the", "given", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/types/CmsXmlCategoryValue.java#L115-L126
microfocus-idol/java-idol-indexing-api
src/main/java/com/autonomy/nonaci/indexing/impl/IndexingServiceImpl.java
IndexingServiceImpl.executeCommand
@Override public int executeCommand(final IndexCommand command) throws IndexingException { LOGGER.trace("executeCommand() called..."); // Execute and return the result... return executeCommand(serverDetails, command); }
java
@Override public int executeCommand(final IndexCommand command) throws IndexingException { LOGGER.trace("executeCommand() called..."); // Execute and return the result... return executeCommand(serverDetails, command); }
[ "@", "Override", "public", "int", "executeCommand", "(", "final", "IndexCommand", "command", ")", "throws", "IndexingException", "{", "LOGGER", ".", "trace", "(", "\"executeCommand() called...\"", ")", ";", "// Execute and return the result...", "return", "executeCommand"...
Executes an index command @param command The index command to execute @return the index queue id for the command @throws com.autonomy.nonaci.indexing.IndexingException if an error response was detected
[ "Executes", "an", "index", "command" ]
train
https://github.com/microfocus-idol/java-idol-indexing-api/blob/178ea844da501318d8d797a35b2f72ff40786b8c/src/main/java/com/autonomy/nonaci/indexing/impl/IndexingServiceImpl.java#L123-L129
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java
FormLayout.setConstraints
public void setConstraints(Component component, CellConstraints constraints) { checkNotNull(component, "The component must not be null."); checkNotNull(constraints, "The constraints must not be null."); constraints.ensureValidGridBounds(getColumnCount(), getRowCount()); constraintMap.put(component, (CellConstraints) constraints.clone()); }
java
public void setConstraints(Component component, CellConstraints constraints) { checkNotNull(component, "The component must not be null."); checkNotNull(constraints, "The constraints must not be null."); constraints.ensureValidGridBounds(getColumnCount(), getRowCount()); constraintMap.put(component, (CellConstraints) constraints.clone()); }
[ "public", "void", "setConstraints", "(", "Component", "component", ",", "CellConstraints", "constraints", ")", "{", "checkNotNull", "(", "component", ",", "\"The component must not be null.\"", ")", ";", "checkNotNull", "(", "constraints", ",", "\"The constraints must not...
Sets the constraints for the specified component in this layout. @param component the component to be modified @param constraints the constraints to be applied @throws NullPointerException if {@code component} or {@code constraints} is {@code null}
[ "Sets", "the", "constraints", "for", "the", "specified", "component", "in", "this", "layout", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L756-L761
spotbugs/spotbugs
spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/MainFrameComponentFactory.java
MainFrameComponentFactory.bugSummaryComponent
public Component bugSummaryComponent(String str, BugInstance bug) { JLabel label = new JLabel(); label.setFont(label.getFont().deriveFont(Driver.getFontSize())); label.setFont(label.getFont().deriveFont(Font.PLAIN)); label.setForeground(Color.BLACK); label.setText(str); SourceLineAnnotation link = bug.getPrimarySourceLineAnnotation(); if (link != null) { label.addMouseListener(new BugSummaryMouseListener(bug, label, link)); } return label; }
java
public Component bugSummaryComponent(String str, BugInstance bug) { JLabel label = new JLabel(); label.setFont(label.getFont().deriveFont(Driver.getFontSize())); label.setFont(label.getFont().deriveFont(Font.PLAIN)); label.setForeground(Color.BLACK); label.setText(str); SourceLineAnnotation link = bug.getPrimarySourceLineAnnotation(); if (link != null) { label.addMouseListener(new BugSummaryMouseListener(bug, label, link)); } return label; }
[ "public", "Component", "bugSummaryComponent", "(", "String", "str", ",", "BugInstance", "bug", ")", "{", "JLabel", "label", "=", "new", "JLabel", "(", ")", ";", "label", ".", "setFont", "(", "label", ".", "getFont", "(", ")", ".", "deriveFont", "(", "Dri...
Creates bug summary component. If obj is a string will create a JLabel with that string as it's text and return it. If obj is an annotation will return a JLabel with the annotation's toString(). If that annotation is a SourceLineAnnotation or has a SourceLineAnnotation connected to it and the source file is available will attach a listener to the label.
[ "Creates", "bug", "summary", "component", ".", "If", "obj", "is", "a", "string", "will", "create", "a", "JLabel", "with", "that", "string", "as", "it", "s", "text", "and", "return", "it", ".", "If", "obj", "is", "an", "annotation", "will", "return", "a...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/MainFrameComponentFactory.java#L293-L307
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java
LayoutUtils.moveBandsElemnts
public static void moveBandsElemnts(int yOffset, JRDesignBand band) { if (band == null) return; for (JRChild jrChild : band.getChildren()) { JRDesignElement elem = (JRDesignElement) jrChild; elem.setY(elem.getY() + yOffset); } }
java
public static void moveBandsElemnts(int yOffset, JRDesignBand band) { if (band == null) return; for (JRChild jrChild : band.getChildren()) { JRDesignElement elem = (JRDesignElement) jrChild; elem.setY(elem.getY() + yOffset); } }
[ "public", "static", "void", "moveBandsElemnts", "(", "int", "yOffset", ",", "JRDesignBand", "band", ")", "{", "if", "(", "band", "==", "null", ")", "return", ";", "for", "(", "JRChild", "jrChild", ":", "band", ".", "getChildren", "(", ")", ")", "{", "J...
Moves the elements contained in "band" in the Y axis "yOffset" @param yOffset @param band
[ "Moves", "the", "elements", "contained", "in", "band", "in", "the", "Y", "axis", "yOffset" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/LayoutUtils.java#L89-L97
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/NodePingUtil.java
NodePingUtil.internalPingNode
static void internalPingNode(Node node, PingCallback callback, NodeHealthChecker healthChecker, XnioIoThread ioThread, ByteBufferPool bufferPool, UndertowClient client, XnioSsl xnioSsl, OptionMap options) { final URI uri = node.getNodeConfig().getConnectionURI(); final long timeout = node.getNodeConfig().getPing(); final RequestExchangeListener exchangeListener = new RequestExchangeListener(callback, healthChecker, true); final HttpClientPingTask r = new HttpClientPingTask(uri, exchangeListener, ioThread, client, xnioSsl, bufferPool, options); // Schedule timeout task scheduleCancelTask(ioThread, exchangeListener, timeout, TimeUnit.SECONDS); ioThread.execute(r); }
java
static void internalPingNode(Node node, PingCallback callback, NodeHealthChecker healthChecker, XnioIoThread ioThread, ByteBufferPool bufferPool, UndertowClient client, XnioSsl xnioSsl, OptionMap options) { final URI uri = node.getNodeConfig().getConnectionURI(); final long timeout = node.getNodeConfig().getPing(); final RequestExchangeListener exchangeListener = new RequestExchangeListener(callback, healthChecker, true); final HttpClientPingTask r = new HttpClientPingTask(uri, exchangeListener, ioThread, client, xnioSsl, bufferPool, options); // Schedule timeout task scheduleCancelTask(ioThread, exchangeListener, timeout, TimeUnit.SECONDS); ioThread.execute(r); }
[ "static", "void", "internalPingNode", "(", "Node", "node", ",", "PingCallback", "callback", ",", "NodeHealthChecker", "healthChecker", ",", "XnioIoThread", "ioThread", ",", "ByteBufferPool", "bufferPool", ",", "UndertowClient", "client", ",", "XnioSsl", "xnioSsl", ","...
Internally ping a node. This should probably use the connections from the nodes pool, if there are any available. @param node the node @param callback the ping callback @param ioThread the xnio i/o thread @param bufferPool the xnio buffer pool @param client the undertow client @param xnioSsl the ssl setup @param options the options
[ "Internally", "ping", "a", "node", ".", "This", "should", "probably", "use", "the", "connections", "from", "the", "nodes", "pool", "if", "there", "are", "any", "available", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/NodePingUtil.java#L170-L179
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/layer/labels/TileBasedLabelStore.java
TileBasedLabelStore.storeMapItems
public synchronized void storeMapItems(Tile tile, List<MapElementContainer> mapItems) { this.put(tile, LayerUtil.collisionFreeOrdered(mapItems)); this.version += 1; }
java
public synchronized void storeMapItems(Tile tile, List<MapElementContainer> mapItems) { this.put(tile, LayerUtil.collisionFreeOrdered(mapItems)); this.version += 1; }
[ "public", "synchronized", "void", "storeMapItems", "(", "Tile", "tile", ",", "List", "<", "MapElementContainer", ">", "mapItems", ")", "{", "this", ".", "put", "(", "tile", ",", "LayerUtil", ".", "collisionFreeOrdered", "(", "mapItems", ")", ")", ";", "this"...
Stores a list of MapElements against a tile. @param tile tile on which the mapItems reside. @param mapItems the map elements.
[ "Stores", "a", "list", "of", "MapElements", "against", "a", "tile", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/labels/TileBasedLabelStore.java#L53-L56
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/parsers/SoapParser.java
SoapParser.parseSoap12Fault
private void parseSoap12Fault(Document soapMessage, PrintWriter logger) throws Exception { Element envelope = soapMessage.getDocumentElement(); Element code = DomUtils.getElementByTagNameNS(envelope, SOAP_12_NAMESPACE, "Code"); String value = DomUtils.getElementByTagNameNS(code, SOAP_12_NAMESPACE, "Value").getTextContent(); String msg = "SOAP Fault received - [code:" + value + "]"; Element subCode = DomUtils.getElementByTagNameNS(code, SOAP_12_NAMESPACE, "Subcode"); if (subCode != null) { value = DomUtils.getElementByTagNameNS(subCode, SOAP_12_NAMESPACE, "Value").getTextContent(); msg += "[subcode:" + value + "]"; } Element reason = DomUtils.getElementByTagNameNS(envelope, SOAP_12_NAMESPACE, "Reason"); Element text = DomUtils.getElementByTagNameNS(reason, SOAP_12_NAMESPACE, "Text"); if (text != null) { value = text.getTextContent(); msg += "[reason:" + value + "]"; } logger.println(msg); }
java
private void parseSoap12Fault(Document soapMessage, PrintWriter logger) throws Exception { Element envelope = soapMessage.getDocumentElement(); Element code = DomUtils.getElementByTagNameNS(envelope, SOAP_12_NAMESPACE, "Code"); String value = DomUtils.getElementByTagNameNS(code, SOAP_12_NAMESPACE, "Value").getTextContent(); String msg = "SOAP Fault received - [code:" + value + "]"; Element subCode = DomUtils.getElementByTagNameNS(code, SOAP_12_NAMESPACE, "Subcode"); if (subCode != null) { value = DomUtils.getElementByTagNameNS(subCode, SOAP_12_NAMESPACE, "Value").getTextContent(); msg += "[subcode:" + value + "]"; } Element reason = DomUtils.getElementByTagNameNS(envelope, SOAP_12_NAMESPACE, "Reason"); Element text = DomUtils.getElementByTagNameNS(reason, SOAP_12_NAMESPACE, "Text"); if (text != null) { value = text.getTextContent(); msg += "[reason:" + value + "]"; } logger.println(msg); }
[ "private", "void", "parseSoap12Fault", "(", "Document", "soapMessage", ",", "PrintWriter", "logger", ")", "throws", "Exception", "{", "Element", "envelope", "=", "soapMessage", ".", "getDocumentElement", "(", ")", ";", "Element", "code", "=", "DomUtils", ".", "g...
A method to parse a SOAP 1.2 fault message. @param soapMessage the SOAP 1.2 fault message to parse @param logger the PrintWriter to log all results to @return void @author Simone Gianfranceschi
[ "A", "method", "to", "parse", "a", "SOAP", "1", ".", "2", "fault", "message", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/parsers/SoapParser.java#L318-L343
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.shiftLeft
protected void shiftLeft(int start, int end) { for (int i = start; i < end; ++i) { positions[i] = positions[i + 1]; bins[i] = bins[i + 1]; } }
java
protected void shiftLeft(int start, int end) { for (int i = start; i < end; ++i) { positions[i] = positions[i + 1]; bins[i] = bins[i + 1]; } }
[ "protected", "void", "shiftLeft", "(", "int", "start", ",", "int", "end", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "end", ";", "++", "i", ")", "{", "positions", "[", "i", "]", "=", "positions", "[", "i", "+", "1", "]", "...
Shifts the given range of histogram bins one slot to the left @param start index of the leftmost empty bin to shift into @param end index of the last bin to shift left
[ "Shifts", "the", "given", "range", "of", "histogram", "bins", "one", "slot", "to", "the", "left" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L465-L471
Chorus-bdd/Chorus
interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/SpringContextSupport.java
SpringContextSupport.injectSpringResources
void injectSpringResources(Object handler, FeatureToken featureToken) throws Exception { log.trace("Looking for SpringContext annotation on handler " + handler); Class<?> handlerClass = handler.getClass(); Annotation[] annotations = handlerClass.getAnnotations(); String contextFileName = findSpringContextFileName(handler, annotations); if (contextFileName != null) { log.debug("Found SpringContext annotation with value " + contextFileName + " will inject spring context"); springInjector.injectSpringContext(handler, featureToken, contextFileName); } }
java
void injectSpringResources(Object handler, FeatureToken featureToken) throws Exception { log.trace("Looking for SpringContext annotation on handler " + handler); Class<?> handlerClass = handler.getClass(); Annotation[] annotations = handlerClass.getAnnotations(); String contextFileName = findSpringContextFileName(handler, annotations); if (contextFileName != null) { log.debug("Found SpringContext annotation with value " + contextFileName + " will inject spring context"); springInjector.injectSpringContext(handler, featureToken, contextFileName); } }
[ "void", "injectSpringResources", "(", "Object", "handler", ",", "FeatureToken", "featureToken", ")", "throws", "Exception", "{", "log", ".", "trace", "(", "\"Looking for SpringContext annotation on handler \"", "+", "handler", ")", ";", "Class", "<", "?", ">", "hand...
Will load a Spring context from the named @ContextConfiguration resource. Will then inject the beans into fields annotated with @Resource where the name of the bean matches the name of the field. @param handler an instance of the handler class that will be used for testing
[ "Will", "load", "a", "Spring", "context", "from", "the", "named", "@ContextConfiguration", "resource", ".", "Will", "then", "inject", "the", "beans", "into", "fields", "annotated", "with", "@Resource", "where", "the", "name", "of", "the", "bean", "matches", "t...
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/SpringContextSupport.java#L92-L101
coursera/courier
generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java
CourierTemplateSpecGenerator.nullTypeNotAllowed
private static IllegalArgumentException nullTypeNotAllowed(ClassTemplateSpec enclosingClass, String memberName) { return new IllegalArgumentException("The null type can only be used in unions, null found" + enclosingClassAndMemberNameToString(enclosingClass, memberName)); }
java
private static IllegalArgumentException nullTypeNotAllowed(ClassTemplateSpec enclosingClass, String memberName) { return new IllegalArgumentException("The null type can only be used in unions, null found" + enclosingClassAndMemberNameToString(enclosingClass, memberName)); }
[ "private", "static", "IllegalArgumentException", "nullTypeNotAllowed", "(", "ClassTemplateSpec", "enclosingClass", ",", "String", "memberName", ")", "{", "return", "new", "IllegalArgumentException", "(", "\"The null type can only be used in unions, null found\"", "+", "enclosingC...
/* Return exception for trying to use null type outside of a union.
[ "/", "*", "Return", "exception", "for", "trying", "to", "use", "null", "type", "outside", "of", "a", "union", "." ]
train
https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java#L251-L254
sahan/IckleBot
icklebot/src/main/java/com/lonepulse/icklebot/fragment/EventFragment.java
EventFragment.onViewCreated
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); EventUtils.link(EVENT_CONFIGURATION); }
java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); EventUtils.link(EVENT_CONFIGURATION); }
[ "@", "Override", "public", "void", "onViewCreated", "(", "View", "view", ",", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onViewCreated", "(", "view", ",", "savedInstanceState", ")", ";", "EventUtils", ".", "link", "(", "EVENT_CONFIGURATION", ")", ...
<p>Performs <b>event listener linking</b> by invoking {@link EventUtils#link()}.</p>
[ "<p", ">", "Performs", "<b", ">", "event", "listener", "linking<", "/", "b", ">", "by", "invoking", "{" ]
train
https://github.com/sahan/IckleBot/blob/a19003ceb3ad7c7ee508dc23a8cb31b5676aa499/icklebot/src/main/java/com/lonepulse/icklebot/fragment/EventFragment.java#L65-L70
WiQuery/wiquery
wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/resizable/ResizableContainment.java
ResizableContainment.setParam
private void setParam(ElementEnum elementEnumParam, String objectParam, LiteralOption selector) { this.elementEnumParam = elementEnumParam; this.objectParam = objectParam; this.selector = selector; }
java
private void setParam(ElementEnum elementEnumParam, String objectParam, LiteralOption selector) { this.elementEnumParam = elementEnumParam; this.objectParam = objectParam; this.selector = selector; }
[ "private", "void", "setParam", "(", "ElementEnum", "elementEnumParam", ",", "String", "objectParam", ",", "LiteralOption", "selector", ")", "{", "this", ".", "elementEnumParam", "=", "elementEnumParam", ";", "this", ".", "objectParam", "=", "objectParam", ";", "th...
Method setting the right parameter @param elementEnumParam elementEnum parameter @param objectParam object parameter @param selector Selector
[ "Method", "setting", "the", "right", "parameter" ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/resizable/ResizableContainment.java#L222-L227
Alluxio/alluxio
core/common/src/main/java/alluxio/conf/AlluxioProperties.java
AlluxioProperties.setSource
@VisibleForTesting public void setSource(PropertyKey key, Source source) { mSources.put(key, source); }
java
@VisibleForTesting public void setSource(PropertyKey key, Source source) { mSources.put(key, source); }
[ "@", "VisibleForTesting", "public", "void", "setSource", "(", "PropertyKey", "key", ",", "Source", "source", ")", "{", "mSources", ".", "put", "(", "key", ",", "source", ")", ";", "}" ]
Sets the source for a given key. @param key property key @param source the source
[ "Sets", "the", "source", "for", "a", "given", "key", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/conf/AlluxioProperties.java#L240-L243
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java
NetworkEnvironmentConfiguration.calculateNewNetworkBufferMemory
@VisibleForTesting public static long calculateNewNetworkBufferMemory(Configuration config, long maxJvmHeapMemory) { // The maximum heap memory has been adjusted as in TaskManagerServices#calculateHeapSizeMB // and we need to invert these calculations. final long jvmHeapNoNet; final MemoryType memoryType = ConfigurationParserUtils.getMemoryType(config); if (memoryType == MemoryType.HEAP) { jvmHeapNoNet = maxJvmHeapMemory; } else if (memoryType == MemoryType.OFF_HEAP) { long configuredMemory = ConfigurationParserUtils.getManagedMemorySize(config) << 20; // megabytes to bytes if (configuredMemory > 0) { // The maximum heap memory has been adjusted according to configuredMemory, i.e. // maxJvmHeap = jvmHeapNoNet - configuredMemory jvmHeapNoNet = maxJvmHeapMemory + configuredMemory; } else { // The maximum heap memory has been adjusted according to the fraction, i.e. // maxJvmHeap = jvmHeapNoNet - jvmHeapNoNet * managedFraction = jvmHeapNoNet * (1 - managedFraction) jvmHeapNoNet = (long) (maxJvmHeapMemory / (1.0 - ConfigurationParserUtils.getManagedMemoryFraction(config))); } } else { throw new RuntimeException("No supported memory type detected."); } // finally extract the network buffer memory size again from: // jvmHeapNoNet = jvmHeap - networkBufBytes // = jvmHeap - Math.min(networkBufMax, Math.max(networkBufMin, jvmHeap * netFraction) // jvmHeap = jvmHeapNoNet / (1.0 - networkBufFraction) float networkBufFraction = config.getFloat(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION); long networkBufSize = (long) (jvmHeapNoNet / (1.0 - networkBufFraction) * networkBufFraction); return calculateNewNetworkBufferMemory(config, networkBufSize, maxJvmHeapMemory); }
java
@VisibleForTesting public static long calculateNewNetworkBufferMemory(Configuration config, long maxJvmHeapMemory) { // The maximum heap memory has been adjusted as in TaskManagerServices#calculateHeapSizeMB // and we need to invert these calculations. final long jvmHeapNoNet; final MemoryType memoryType = ConfigurationParserUtils.getMemoryType(config); if (memoryType == MemoryType.HEAP) { jvmHeapNoNet = maxJvmHeapMemory; } else if (memoryType == MemoryType.OFF_HEAP) { long configuredMemory = ConfigurationParserUtils.getManagedMemorySize(config) << 20; // megabytes to bytes if (configuredMemory > 0) { // The maximum heap memory has been adjusted according to configuredMemory, i.e. // maxJvmHeap = jvmHeapNoNet - configuredMemory jvmHeapNoNet = maxJvmHeapMemory + configuredMemory; } else { // The maximum heap memory has been adjusted according to the fraction, i.e. // maxJvmHeap = jvmHeapNoNet - jvmHeapNoNet * managedFraction = jvmHeapNoNet * (1 - managedFraction) jvmHeapNoNet = (long) (maxJvmHeapMemory / (1.0 - ConfigurationParserUtils.getManagedMemoryFraction(config))); } } else { throw new RuntimeException("No supported memory type detected."); } // finally extract the network buffer memory size again from: // jvmHeapNoNet = jvmHeap - networkBufBytes // = jvmHeap - Math.min(networkBufMax, Math.max(networkBufMin, jvmHeap * netFraction) // jvmHeap = jvmHeapNoNet / (1.0 - networkBufFraction) float networkBufFraction = config.getFloat(TaskManagerOptions.NETWORK_BUFFERS_MEMORY_FRACTION); long networkBufSize = (long) (jvmHeapNoNet / (1.0 - networkBufFraction) * networkBufFraction); return calculateNewNetworkBufferMemory(config, networkBufSize, maxJvmHeapMemory); }
[ "@", "VisibleForTesting", "public", "static", "long", "calculateNewNetworkBufferMemory", "(", "Configuration", "config", ",", "long", "maxJvmHeapMemory", ")", "{", "// The maximum heap memory has been adjusted as in TaskManagerServices#calculateHeapSizeMB", "// and we need to invert th...
Calculates the amount of memory used for network buffers inside the current JVM instance based on the available heap or the max heap size and the according configuration parameters. <p>For containers or when started via scripts, if started with a memory limit and set to use off-heap memory, the maximum heap size for the JVM is adjusted accordingly and we are able to extract the intended values from this. <p>The following configuration parameters are involved: <ul> <li>{@link TaskManagerOptions#MANAGED_MEMORY_SIZE},</li> <li>{@link TaskManagerOptions#MANAGED_MEMORY_FRACTION},</li> <li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_FRACTION},</li> <li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_MIN},</li> <li>{@link TaskManagerOptions#NETWORK_BUFFERS_MEMORY_MAX}, and</li> <li>{@link TaskManagerOptions#NETWORK_NUM_BUFFERS} (fallback if the ones above do not exist)</li> </ul>. @param config configuration object @param maxJvmHeapMemory the maximum JVM heap size (in bytes) @return memory to use for network buffers (in bytes)
[ "Calculates", "the", "amount", "of", "memory", "used", "for", "network", "buffers", "inside", "the", "current", "JVM", "instance", "based", "on", "the", "available", "heap", "or", "the", "max", "heap", "size", "and", "the", "according", "configuration", "param...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/NetworkEnvironmentConfiguration.java#L187-L217
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/output/OutputRegistry.java
OutputRegistry.getOutputComponentType
static OutputType getOutputComponentType(Class<? extends CommandOutput> commandOutputClass) { ClassTypeInformation<? extends CommandOutput> classTypeInformation = ClassTypeInformation.from(commandOutputClass); TypeInformation<?> superTypeInformation = classTypeInformation.getSuperTypeInformation(CommandOutput.class); if (superTypeInformation == null) { return null; } List<TypeInformation<?>> typeArguments = superTypeInformation.getTypeArguments(); return new OutputType(commandOutputClass, typeArguments.get(2), false) { @Override public ResolvableType withCodec(RedisCodec<?, ?> codec) { TypeInformation<?> typeInformation = ClassTypeInformation.from(codec.getClass()); ResolvableType resolvableType = ResolvableType.forType(commandOutputClass, new CodecVariableTypeResolver( typeInformation)); while (!resolvableType.getRawClass().equals(CommandOutput.class)) { resolvableType = resolvableType.getSuperType(); } return resolvableType.getGeneric(2); } }; }
java
static OutputType getOutputComponentType(Class<? extends CommandOutput> commandOutputClass) { ClassTypeInformation<? extends CommandOutput> classTypeInformation = ClassTypeInformation.from(commandOutputClass); TypeInformation<?> superTypeInformation = classTypeInformation.getSuperTypeInformation(CommandOutput.class); if (superTypeInformation == null) { return null; } List<TypeInformation<?>> typeArguments = superTypeInformation.getTypeArguments(); return new OutputType(commandOutputClass, typeArguments.get(2), false) { @Override public ResolvableType withCodec(RedisCodec<?, ?> codec) { TypeInformation<?> typeInformation = ClassTypeInformation.from(codec.getClass()); ResolvableType resolvableType = ResolvableType.forType(commandOutputClass, new CodecVariableTypeResolver( typeInformation)); while (!resolvableType.getRawClass().equals(CommandOutput.class)) { resolvableType = resolvableType.getSuperType(); } return resolvableType.getGeneric(2); } }; }
[ "static", "OutputType", "getOutputComponentType", "(", "Class", "<", "?", "extends", "CommandOutput", ">", "commandOutputClass", ")", "{", "ClassTypeInformation", "<", "?", "extends", "CommandOutput", ">", "classTypeInformation", "=", "ClassTypeInformation", ".", "from"...
Retrieve {@link OutputType} for a {@link CommandOutput} type. @param commandOutputClass @return
[ "Retrieve", "{", "@link", "OutputType", "}", "for", "a", "{", "@link", "CommandOutput", "}", "type", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/output/OutputRegistry.java#L199-L227
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java
LatLongUtils.sphericalDistance
public static double sphericalDistance(LatLong latLong1, LatLong latLong2) { double dLat = Math.toRadians(latLong2.latitude - latLong1.latitude); double dLon = Math.toRadians(latLong2.longitude - latLong1.longitude); double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(Math.toRadians(latLong1.latitude)) * Math.cos(Math.toRadians(latLong2.latitude)) * Math.sin(dLon / 2) * Math.sin(dLon / 2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); return c * LatLongUtils.EQUATORIAL_RADIUS; }
java
public static double sphericalDistance(LatLong latLong1, LatLong latLong2) { double dLat = Math.toRadians(latLong2.latitude - latLong1.latitude); double dLon = Math.toRadians(latLong2.longitude - latLong1.longitude); double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(Math.toRadians(latLong1.latitude)) * Math.cos(Math.toRadians(latLong2.latitude)) * Math.sin(dLon / 2) * Math.sin(dLon / 2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); return c * LatLongUtils.EQUATORIAL_RADIUS; }
[ "public", "static", "double", "sphericalDistance", "(", "LatLong", "latLong1", ",", "LatLong", "latLong2", ")", "{", "double", "dLat", "=", "Math", ".", "toRadians", "(", "latLong2", ".", "latitude", "-", "latLong1", ".", "latitude", ")", ";", "double", "dLo...
Calculate the spherical distance between two LatLongs in meters using the Haversine formula. <p/> This calculation is done using the assumption, that the earth is a sphere, it is not though. If you need a higher precision and can afford a longer execution time you might want to use vincentyDistance. @param latLong1 first LatLong @param latLong2 second LatLong @return distance in meters as a double
[ "Calculate", "the", "spherical", "distance", "between", "two", "LatLongs", "in", "meters", "using", "the", "Haversine", "formula", ".", "<p", "/", ">", "This", "calculation", "is", "done", "using", "the", "assumption", "that", "the", "earth", "is", "a", "sph...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java#L289-L296
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/classpath/ClasspathOrder.java
ClasspathOrder.addSystemClasspathEntry
boolean addSystemClasspathEntry(final String pathEntry, final ClassLoader classLoader) { if (classpathEntryUniqueResolvedPaths.add(pathEntry)) { order.add(new SimpleEntry<>(pathEntry, classLoader)); return true; } return false; }
java
boolean addSystemClasspathEntry(final String pathEntry, final ClassLoader classLoader) { if (classpathEntryUniqueResolvedPaths.add(pathEntry)) { order.add(new SimpleEntry<>(pathEntry, classLoader)); return true; } return false; }
[ "boolean", "addSystemClasspathEntry", "(", "final", "String", "pathEntry", ",", "final", "ClassLoader", "classLoader", ")", "{", "if", "(", "classpathEntryUniqueResolvedPaths", ".", "add", "(", "pathEntry", ")", ")", "{", "order", ".", "add", "(", "new", "Simple...
Add a system classpath entry. @param pathEntry the system classpath entry -- the path string should already have been run through FastPathResolver.resolve(FileUtils.CURR_DIR_PATH, path @param classLoader the classloader @return true, if added and unique
[ "Add", "a", "system", "classpath", "entry", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/classpath/ClasspathOrder.java#L114-L120
jbundle/jbundle
app/program/db/src/main/java/org/jbundle/app/program/db/AnalysisLog.java
AnalysisLog.logRemoveRecord
public void logRemoveRecord(Rec record, int iSystemID) { try { this.getTable().setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE); this.getTable().getDatabase().setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE); this.addNew(); this.getField(AnalysisLog.SYSTEM_ID).setValue(iSystemID); this.getField(AnalysisLog.OBJECT_ID).setValue(Debug.getObjectID(record, true)); this.setKeyArea(AnalysisLog.OBJECT_ID_KEY); if (this.seek(null)) { this.edit(); ((DateTimeField)this.getField(AnalysisLog.FREE_TIME)).setValue(DateTimeField.currentTime()); if (this.getField(AnalysisLog.RECORD_OWNER).isNull()) this.getField(AnalysisLog.RECORD_OWNER).setString(Debug.getClassName(((Record)record).getRecordOwner())); this.set(); } else { // Ignore for now System.exit(1); } } catch (DBException ex) { ex.printStackTrace(); } }
java
public void logRemoveRecord(Rec record, int iSystemID) { try { this.getTable().setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE); this.getTable().getDatabase().setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.FALSE); this.addNew(); this.getField(AnalysisLog.SYSTEM_ID).setValue(iSystemID); this.getField(AnalysisLog.OBJECT_ID).setValue(Debug.getObjectID(record, true)); this.setKeyArea(AnalysisLog.OBJECT_ID_KEY); if (this.seek(null)) { this.edit(); ((DateTimeField)this.getField(AnalysisLog.FREE_TIME)).setValue(DateTimeField.currentTime()); if (this.getField(AnalysisLog.RECORD_OWNER).isNull()) this.getField(AnalysisLog.RECORD_OWNER).setString(Debug.getClassName(((Record)record).getRecordOwner())); this.set(); } else { // Ignore for now System.exit(1); } } catch (DBException ex) { ex.printStackTrace(); } }
[ "public", "void", "logRemoveRecord", "(", "Rec", "record", ",", "int", "iSystemID", ")", "{", "try", "{", "this", ".", "getTable", "(", ")", ".", "setProperty", "(", "DBParams", ".", "SUPRESSREMOTEDBMESSAGES", ",", "DBConstants", ".", "TRUE", ")", ";", "th...
Log that this record has been freed. Call this from the end of record.free @param record the record that is being added.
[ "Log", "that", "this", "record", "has", "been", "freed", ".", "Call", "this", "from", "the", "end", "of", "record", ".", "free" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/AnalysisLog.java#L167-L192
dadoonet/testcontainers-java-module-elasticsearch
src/main/java/fr/pilato/elasticsearch/containers/ElasticsearchContainer.java
ElasticsearchContainer.withSecureSetting
public ElasticsearchContainer withSecureSetting(String key, String value) { securedKeys.put(key, value); return this; }
java
public ElasticsearchContainer withSecureSetting(String key, String value) { securedKeys.put(key, value); return this; }
[ "public", "ElasticsearchContainer", "withSecureSetting", "(", "String", "key", ",", "String", "value", ")", "{", "securedKeys", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Define the elasticsearch docker registry base url @param key Key @param value Value @return this
[ "Define", "the", "elasticsearch", "docker", "registry", "base", "url" ]
train
https://github.com/dadoonet/testcontainers-java-module-elasticsearch/blob/780eec66c2999a1e4814f039b2a4559d6a5da408/src/main/java/fr/pilato/elasticsearch/containers/ElasticsearchContainer.java#L93-L96
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java
Character.offsetByCodePoints
public static int offsetByCodePoints(char[] a, int start, int count, int index, int codePointOffset) { if (count > a.length-start || start < 0 || count < 0 || index < start || index > start+count) { throw new IndexOutOfBoundsException(); } return offsetByCodePointsImpl(a, start, count, index, codePointOffset); }
java
public static int offsetByCodePoints(char[] a, int start, int count, int index, int codePointOffset) { if (count > a.length-start || start < 0 || count < 0 || index < start || index > start+count) { throw new IndexOutOfBoundsException(); } return offsetByCodePointsImpl(a, start, count, index, codePointOffset); }
[ "public", "static", "int", "offsetByCodePoints", "(", "char", "[", "]", "a", ",", "int", "start", ",", "int", "count", ",", "int", "index", ",", "int", "codePointOffset", ")", "{", "if", "(", "count", ">", "a", ".", "length", "-", "start", "||", "sta...
Returns the index within the given {@code char} subarray that is offset from the given {@code index} by {@code codePointOffset} code points. The {@code start} and {@code count} arguments specify a subarray of the {@code char} array. Unpaired surrogates within the text range given by {@code index} and {@code codePointOffset} count as one code point each. @param a the {@code char} array @param start the index of the first {@code char} of the subarray @param count the length of the subarray in {@code char}s @param index the index to be offset @param codePointOffset the offset in code points @return the index within the subarray @exception NullPointerException if {@code a} is null. @exception IndexOutOfBoundsException if {@code start} or {@code count} is negative, or if {@code start + count} is larger than the length of the given array, or if {@code index} is less than {@code start} or larger then {@code start + count}, or if {@code codePointOffset} is positive and the text range starting with {@code index} and ending with {@code start + count - 1} has fewer than {@code codePointOffset} code points, or if {@code codePointOffset} is negative and the text range starting with {@code start} and ending with {@code index - 1} has fewer than the absolute value of {@code codePointOffset} code points. @since 1.5
[ "Returns", "the", "index", "within", "the", "given", "{", "@code", "char", "}", "subarray", "that", "is", "offset", "from", "the", "given", "{", "@code", "index", "}", "by", "{", "@code", "codePointOffset", "}", "code", "points", ".", "The", "{", "@code"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L5410-L5417
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/LocalScanUploadMonitor.java
LocalScanUploadMonitor.resplitPartiallyCompleteTasks
private ScanStatus resplitPartiallyCompleteTasks(ScanStatus status) { boolean anyUpdated = false; int nextTaskId = -1; for (ScanRangeStatus complete : status.getCompleteScanRanges()) { if (complete.getResplitRange().isPresent()) { // This task only partially completed; there are still more data to scan. if (nextTaskId == -1) { nextTaskId = getNextTaskId(status); } ScanRange resplitRange = complete.getResplitRange().get(); // Resplit the un-scanned portion into new ranges List<ScanRange> subRanges = resplit(complete.getPlacement(), resplitRange, status.getOptions().getRangeScanSplitSize()); // Create new tasks for each subrange that are immediately available for being queued. List<ScanRangeStatus> resplitStatuses = Lists.newArrayListWithCapacity(subRanges.size()); for (ScanRange subRange : subRanges) { resplitStatuses.add( new ScanRangeStatus(nextTaskId++, complete.getPlacement(), subRange, complete.getBatchId(), complete.getBlockedByBatchId(), complete.getConcurrencyId())); } _scanStatusDAO.resplitScanRangeTask(status.getScanId(), complete.getTaskId(), resplitStatuses); anyUpdated = true; } } if (!anyUpdated) { return status; } // Slightly inefficient to reload but less risky than trying to keep the DAO and in-memory object in sync return _scanStatusDAO.getScanStatus(status.getScanId()); }
java
private ScanStatus resplitPartiallyCompleteTasks(ScanStatus status) { boolean anyUpdated = false; int nextTaskId = -1; for (ScanRangeStatus complete : status.getCompleteScanRanges()) { if (complete.getResplitRange().isPresent()) { // This task only partially completed; there are still more data to scan. if (nextTaskId == -1) { nextTaskId = getNextTaskId(status); } ScanRange resplitRange = complete.getResplitRange().get(); // Resplit the un-scanned portion into new ranges List<ScanRange> subRanges = resplit(complete.getPlacement(), resplitRange, status.getOptions().getRangeScanSplitSize()); // Create new tasks for each subrange that are immediately available for being queued. List<ScanRangeStatus> resplitStatuses = Lists.newArrayListWithCapacity(subRanges.size()); for (ScanRange subRange : subRanges) { resplitStatuses.add( new ScanRangeStatus(nextTaskId++, complete.getPlacement(), subRange, complete.getBatchId(), complete.getBlockedByBatchId(), complete.getConcurrencyId())); } _scanStatusDAO.resplitScanRangeTask(status.getScanId(), complete.getTaskId(), resplitStatuses); anyUpdated = true; } } if (!anyUpdated) { return status; } // Slightly inefficient to reload but less risky than trying to keep the DAO and in-memory object in sync return _scanStatusDAO.getScanStatus(status.getScanId()); }
[ "private", "ScanStatus", "resplitPartiallyCompleteTasks", "(", "ScanStatus", "status", ")", "{", "boolean", "anyUpdated", "=", "false", ";", "int", "nextTaskId", "=", "-", "1", ";", "for", "(", "ScanRangeStatus", "complete", ":", "status", ".", "getCompleteScanRan...
Checks whether any completed tasks returned before scanning the entire range. If so then the unscanned ranges are resplit and new tasks are created from them.
[ "Checks", "whether", "any", "completed", "tasks", "returned", "before", "scanning", "the", "entire", "range", ".", "If", "so", "then", "the", "unscanned", "ranges", "are", "resplit", "and", "new", "tasks", "are", "created", "from", "them", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/LocalScanUploadMonitor.java#L282-L317
alkacon/opencms-core
src/org/opencms/file/CmsRequestContext.java
CmsRequestContext.setAttribute
public void setAttribute(String key, Object value) { if (m_attributeMap == null) { // hash table is still the most efficient form of a synchronized Map m_attributeMap = new Hashtable<String, Object>(); } m_attributeMap.put(key, value); }
java
public void setAttribute(String key, Object value) { if (m_attributeMap == null) { // hash table is still the most efficient form of a synchronized Map m_attributeMap = new Hashtable<String, Object>(); } m_attributeMap.put(key, value); }
[ "public", "void", "setAttribute", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "m_attributeMap", "==", "null", ")", "{", "// hash table is still the most efficient form of a synchronized Map", "m_attributeMap", "=", "new", "Hashtable", "<", "Stri...
Sets an attribute in the request context.<p> @param key the attribute name @param value the attribute value
[ "Sets", "an", "attribute", "in", "the", "request", "context", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsRequestContext.java#L550-L557
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.absoluteQuadraticToH
public static boolean absoluteQuadraticToH(DMatrix4x4 Q , DMatrixRMaj H ) { DecomposeAbsoluteDualQuadratic alg = new DecomposeAbsoluteDualQuadratic(); if( !alg.decompose(Q) ) return false; return alg.computeRectifyingHomography(H); }
java
public static boolean absoluteQuadraticToH(DMatrix4x4 Q , DMatrixRMaj H ) { DecomposeAbsoluteDualQuadratic alg = new DecomposeAbsoluteDualQuadratic(); if( !alg.decompose(Q) ) return false; return alg.computeRectifyingHomography(H); }
[ "public", "static", "boolean", "absoluteQuadraticToH", "(", "DMatrix4x4", "Q", ",", "DMatrixRMaj", "H", ")", "{", "DecomposeAbsoluteDualQuadratic", "alg", "=", "new", "DecomposeAbsoluteDualQuadratic", "(", ")", ";", "if", "(", "!", "alg", ".", "decompose", "(", ...
Decomposes the absolute quadratic to extract the rectifying homogrpahy H. This is used to go from a projective to metric (calibrated) geometry. See pg 464 in [1]. <p>Q = H*I*H<sup>T</sup></p> <p>where I = diag(1 1 1 0)</p> <ol> <li> R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003 </li> </ol> @see DecomposeAbsoluteDualQuadratic @param Q (Input) Absolute quadratic. Typically found in auto calibration. Not modified. @param H (Output) 4x4 rectifying homography.
[ "Decomposes", "the", "absolute", "quadratic", "to", "extract", "the", "rectifying", "homogrpahy", "H", ".", "This", "is", "used", "to", "go", "from", "a", "projective", "to", "metric", "(", "calibrated", ")", "geometry", ".", "See", "pg", "464", "in", "[",...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1472-L1478
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java
GVRScriptBehavior.invokeFunction
public boolean invokeFunction(String funcName, Object[] args) { mLastError = null; if (mScriptFile != null) { if (mScriptFile.invokeFunction(funcName, args)) { return true; } } mLastError = mScriptFile.getLastError(); if ((mLastError != null) && !mLastError.contains("is not defined")) { getGVRContext().logError(mLastError, this); } return false; }
java
public boolean invokeFunction(String funcName, Object[] args) { mLastError = null; if (mScriptFile != null) { if (mScriptFile.invokeFunction(funcName, args)) { return true; } } mLastError = mScriptFile.getLastError(); if ((mLastError != null) && !mLastError.contains("is not defined")) { getGVRContext().logError(mLastError, this); } return false; }
[ "public", "boolean", "invokeFunction", "(", "String", "funcName", ",", "Object", "[", "]", "args", ")", "{", "mLastError", "=", "null", ";", "if", "(", "mScriptFile", "!=", "null", ")", "{", "if", "(", "mScriptFile", ".", "invokeFunction", "(", "funcName",...
Calls a function script associated with this component. The function is called even if the component is not enabled and not attached to a scene object. @param funcName name of script function to call. @param args function parameters as an array of objects. @return true if function was called, false if no such function @see org.gearvrf.script.GVRScriptFile#invokeFunction(String, Object[]) invokeFunction
[ "Calls", "a", "function", "script", "associated", "with", "this", "component", ".", "The", "function", "is", "called", "even", "if", "the", "component", "is", "not", "enabled", "and", "not", "attached", "to", "a", "scene", "object", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L316-L332
lets-blade/blade
src/main/java/com/blade/kit/EncryptKit.java
EncryptKit.hmacSHA256
public static String hmacSHA256(String data, String key) { return hmacSHA256(data.getBytes(), key.getBytes()); }
java
public static String hmacSHA256(String data, String key) { return hmacSHA256(data.getBytes(), key.getBytes()); }
[ "public", "static", "String", "hmacSHA256", "(", "String", "data", ",", "String", "key", ")", "{", "return", "hmacSHA256", "(", "data", ".", "getBytes", "(", ")", ",", "key", ".", "getBytes", "(", ")", ")", ";", "}" ]
HmacSHA256加密 @param data 明文字符串 @param key 秘钥 @return 16进制密文
[ "HmacSHA256加密" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/EncryptKit.java#L360-L362
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.updateUserData
public ApiSuccessResponse updateUserData(String id, UserDataOperationId userData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = updateUserDataWithHttpInfo(id, userData); return resp.getData(); }
java
public ApiSuccessResponse updateUserData(String id, UserDataOperationId userData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = updateUserDataWithHttpInfo(id, userData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "updateUserData", "(", "String", "id", ",", "UserDataOperationId", "userData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "updateUserDataWithHttpInfo", "(", "id", ",", "userData", ")"...
Update user data for a call Update call data with the provided key/value pairs. This replaces any existing key/value pairs with the same keys. @param id The connection ID of the call. (required) @param userData The data to update. This is an array of objects with the properties key, type, and value. (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Update", "user", "data", "for", "a", "call", "Update", "call", "data", "with", "the", "provided", "key", "/", "value", "pairs", ".", "This", "replaces", "any", "existing", "key", "/", "value", "pairs", "with", "the", "same", "keys", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L5358-L5361
alkacon/opencms-core
src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java
CmsSpellcheckDictionaryIndexer.addDocuments
static void addDocuments(SolrClient client, List<SolrInputDocument> documents, boolean commit) throws IOException, SolrServerException { if ((null == client) || (null == documents)) { return; } if (!documents.isEmpty()) { client.add(documents); } if (commit) { client.commit(); } }
java
static void addDocuments(SolrClient client, List<SolrInputDocument> documents, boolean commit) throws IOException, SolrServerException { if ((null == client) || (null == documents)) { return; } if (!documents.isEmpty()) { client.add(documents); } if (commit) { client.commit(); } }
[ "static", "void", "addDocuments", "(", "SolrClient", "client", ",", "List", "<", "SolrInputDocument", ">", "documents", ",", "boolean", "commit", ")", "throws", "IOException", ",", "SolrServerException", "{", "if", "(", "(", "null", "==", "client", ")", "||", ...
Add a list of documents to the Solr client.<p> @param client The SolrClient instance object. @param documents The documents that should be added. @param commit boolean flag indicating whether a "commit" call should be made after adding the documents @throws IOException in case something goes wrong @throws SolrServerException in case something goes wrong
[ "Add", "a", "list", "of", "documents", "to", "the", "Solr", "client", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/spellchecking/CmsSpellcheckDictionaryIndexer.java#L265-L279
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/menu/EditFeatureAction.java
EditFeatureAction.execute
public boolean execute(Canvas target, Menu menu, MenuItem item) { int count = mapWidget.getMapModel().getNrSelectedFeatures(); if (count == 1) { for (VectorLayer layer : mapWidget.getMapModel().getVectorLayers()) { if (layer.getSelectedFeatures().size() == 1) { // It's already selected, so we assume the feature is fully loaded: feature = layer.getFeatureStore().getPartialFeature(layer.getSelectedFeatures().iterator().next()); return true; } } return true; } return false; }
java
public boolean execute(Canvas target, Menu menu, MenuItem item) { int count = mapWidget.getMapModel().getNrSelectedFeatures(); if (count == 1) { for (VectorLayer layer : mapWidget.getMapModel().getVectorLayers()) { if (layer.getSelectedFeatures().size() == 1) { // It's already selected, so we assume the feature is fully loaded: feature = layer.getFeatureStore().getPartialFeature(layer.getSelectedFeatures().iterator().next()); return true; } } return true; } return false; }
[ "public", "boolean", "execute", "(", "Canvas", "target", ",", "Menu", "menu", ",", "MenuItem", "item", ")", "{", "int", "count", "=", "mapWidget", ".", "getMapModel", "(", ")", ".", "getNrSelectedFeatures", "(", ")", ";", "if", "(", "count", "==", "1", ...
Implementation of the <code>MenuItemIfFunction</code> interface. This will determine if the menu action should be enabled or not. In essence, this action will be enabled if a vector-layer is selected that allows the updating of existing features.
[ "Implementation", "of", "the", "<code", ">", "MenuItemIfFunction<", "/", "code", ">", "interface", ".", "This", "will", "determine", "if", "the", "menu", "action", "should", "be", "enabled", "or", "not", ".", "In", "essence", "this", "action", "will", "be", ...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/EditFeatureAction.java#L102-L115
apache/spark
core/src/main/java/org/apache/spark/util/collection/TimSort.java
TimSort.countRunAndMakeAscending
private int countRunAndMakeAscending(Buffer a, int lo, int hi, Comparator<? super K> c) { assert lo < hi; int runHi = lo + 1; if (runHi == hi) return 1; K key0 = s.newKey(); K key1 = s.newKey(); // Find end of run, and reverse range if descending if (c.compare(s.getKey(a, runHi++, key0), s.getKey(a, lo, key1)) < 0) { // Descending while (runHi < hi && c.compare(s.getKey(a, runHi, key0), s.getKey(a, runHi - 1, key1)) < 0) runHi++; reverseRange(a, lo, runHi); } else { // Ascending while (runHi < hi && c.compare(s.getKey(a, runHi, key0), s.getKey(a, runHi - 1, key1)) >= 0) runHi++; } return runHi - lo; }
java
private int countRunAndMakeAscending(Buffer a, int lo, int hi, Comparator<? super K> c) { assert lo < hi; int runHi = lo + 1; if (runHi == hi) return 1; K key0 = s.newKey(); K key1 = s.newKey(); // Find end of run, and reverse range if descending if (c.compare(s.getKey(a, runHi++, key0), s.getKey(a, lo, key1)) < 0) { // Descending while (runHi < hi && c.compare(s.getKey(a, runHi, key0), s.getKey(a, runHi - 1, key1)) < 0) runHi++; reverseRange(a, lo, runHi); } else { // Ascending while (runHi < hi && c.compare(s.getKey(a, runHi, key0), s.getKey(a, runHi - 1, key1)) >= 0) runHi++; } return runHi - lo; }
[ "private", "int", "countRunAndMakeAscending", "(", "Buffer", "a", ",", "int", "lo", ",", "int", "hi", ",", "Comparator", "<", "?", "super", "K", ">", "c", ")", "{", "assert", "lo", "<", "hi", ";", "int", "runHi", "=", "lo", "+", "1", ";", "if", "...
Returns the length of the run beginning at the specified position in the specified array and reverses the run if it is descending (ensuring that the run will always be ascending when the method returns). A run is the longest ascending sequence with: a[lo] <= a[lo + 1] <= a[lo + 2] <= ... or the longest descending sequence with: a[lo] > a[lo + 1] > a[lo + 2] > ... For its intended use in a stable mergesort, the strictness of the definition of "descending" is needed so that the call can safely reverse a descending sequence without violating stability. @param a the array in which a run is to be counted and possibly reversed @param lo index of the first element in the run @param hi index after the last element that may be contained in the run. It is required that {@code lo < hi}. @param c the comparator to used for the sort @return the length of the run beginning at the specified position in the specified array
[ "Returns", "the", "length", "of", "the", "run", "beginning", "at", "the", "specified", "position", "in", "the", "specified", "array", "and", "reverses", "the", "run", "if", "it", "is", "descending", "(", "ensuring", "that", "the", "run", "will", "always", ...
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/TimSort.java#L260-L280
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java
Organizer.addAll
public static <T> void addAll(Collection<T> pagingResults, Collection<T> paging, BooleanExpression<T> filter) { if (pagingResults == null || paging == null) return; if (filter != null) { for (T obj : paging) { if (filter.apply(obj)) pagingResults.add(obj); } } else { // add independent of a filter for (T obj : paging) { pagingResults.add(obj); } } }
java
public static <T> void addAll(Collection<T> pagingResults, Collection<T> paging, BooleanExpression<T> filter) { if (pagingResults == null || paging == null) return; if (filter != null) { for (T obj : paging) { if (filter.apply(obj)) pagingResults.add(obj); } } else { // add independent of a filter for (T obj : paging) { pagingResults.add(obj); } } }
[ "public", "static", "<", "T", ">", "void", "addAll", "(", "Collection", "<", "T", ">", "pagingResults", ",", "Collection", "<", "T", ">", "paging", ",", "BooleanExpression", "<", "T", ">", "filter", ")", "{", "if", "(", "pagingResults", "==", "null", "...
Add all collections @param <T> the type class @param paging the paging output @param pagingResults the results to add to @param filter remove object where filter.getBoolean() == true
[ "Add", "all", "collections" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Organizer.java#L295-L316
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java
PluginAdapterUtility.buildFieldProperties
public static void buildFieldProperties(final Class<?> aClass, final DescriptionBuilder builder) { for (final Field field : collectClassFields(aClass)) { final PluginProperty annotation = field.getAnnotation(PluginProperty.class); if (null == annotation) { continue; } final Property pbuild = propertyFromField(field, annotation); if (null == pbuild) { continue; } builder.property(pbuild); } }
java
public static void buildFieldProperties(final Class<?> aClass, final DescriptionBuilder builder) { for (final Field field : collectClassFields(aClass)) { final PluginProperty annotation = field.getAnnotation(PluginProperty.class); if (null == annotation) { continue; } final Property pbuild = propertyFromField(field, annotation); if (null == pbuild) { continue; } builder.property(pbuild); } }
[ "public", "static", "void", "buildFieldProperties", "(", "final", "Class", "<", "?", ">", "aClass", ",", "final", "DescriptionBuilder", "builder", ")", "{", "for", "(", "final", "Field", "field", ":", "collectClassFields", "(", "aClass", ")", ")", "{", "fina...
Add properties based on introspection of a class @param aClass class @param builder builder
[ "Add", "properties", "based", "on", "introspection", "of", "a", "class" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java#L151-L163
looly/hutool
hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java
DaoTemplate.del
public <T> int del(String field, T value) throws SQLException { if (StrUtil.isBlank(field)) { return 0; } return this.del(Entity.create(tableName).set(field, value)); }
java
public <T> int del(String field, T value) throws SQLException { if (StrUtil.isBlank(field)) { return 0; } return this.del(Entity.create(tableName).set(field, value)); }
[ "public", "<", "T", ">", "int", "del", "(", "String", "field", ",", "T", "value", ")", "throws", "SQLException", "{", "if", "(", "StrUtil", ".", "isBlank", "(", "field", ")", ")", "{", "return", "0", ";", "}", "return", "this", ".", "del", "(", "...
删除 @param <T> 主键类型 @param field 字段名 @param value 字段值 @return 删除行数 @throws SQLException SQL执行异常
[ "删除" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/DaoTemplate.java#L136-L142