repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java
CmsMessageBundleEditorOptions.updateShownOptions
public void updateShownOptions(boolean showModeSwitch, boolean showAddKeyOption) { if (showModeSwitch != m_showModeSwitch) { m_upperLeftComponent.removeAllComponents(); m_upperLeftComponent.addComponent(m_languageSwitch); if (showModeSwitch) { m_upperLeftComponent.addComponent(m_modeSwitch); } m_upperLeftComponent.addComponent(m_filePathLabel); m_showModeSwitch = showModeSwitch; } if (showAddKeyOption != m_showAddKeyOption) { if (showAddKeyOption) { m_optionsComponent.addComponent(m_lowerLeftComponent, 0, 1); m_optionsComponent.addComponent(m_lowerRightComponent, 1, 1); } else { m_optionsComponent.removeComponent(0, 1); m_optionsComponent.removeComponent(1, 1); } m_showAddKeyOption = showAddKeyOption; } }
java
public void updateShownOptions(boolean showModeSwitch, boolean showAddKeyOption) { if (showModeSwitch != m_showModeSwitch) { m_upperLeftComponent.removeAllComponents(); m_upperLeftComponent.addComponent(m_languageSwitch); if (showModeSwitch) { m_upperLeftComponent.addComponent(m_modeSwitch); } m_upperLeftComponent.addComponent(m_filePathLabel); m_showModeSwitch = showModeSwitch; } if (showAddKeyOption != m_showAddKeyOption) { if (showAddKeyOption) { m_optionsComponent.addComponent(m_lowerLeftComponent, 0, 1); m_optionsComponent.addComponent(m_lowerRightComponent, 1, 1); } else { m_optionsComponent.removeComponent(0, 1); m_optionsComponent.removeComponent(1, 1); } m_showAddKeyOption = showAddKeyOption; } }
[ "public", "void", "updateShownOptions", "(", "boolean", "showModeSwitch", ",", "boolean", "showAddKeyOption", ")", "{", "if", "(", "showModeSwitch", "!=", "m_showModeSwitch", ")", "{", "m_upperLeftComponent", ".", "removeAllComponents", "(", ")", ";", "m_upperLeftComp...
Update which options are shown. @param showModeSwitch flag, indicating if the mode switch should be shown. @param showAddKeyOption flag, indicating if the "Add key" row should be shown.
[ "Update", "which", "options", "are", "shown", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L170-L191
MTDdk/jawn
jawn-core/src/main/java/net/javapla/jawn/core/util/StringUtil.java
StringUtil.camelize
public static String camelize(String underscored, boolean capitalizeFirstChar){ String result = ""; StringTokenizer st = new StringTokenizer(underscored, "_"); while(st.hasMoreTokens()){ result += capitalize(st.nextToken()); } return capitalizeFirstChar? result :result.substring(0, 1).toLowerCase() + result.substring(1); }
java
public static String camelize(String underscored, boolean capitalizeFirstChar){ String result = ""; StringTokenizer st = new StringTokenizer(underscored, "_"); while(st.hasMoreTokens()){ result += capitalize(st.nextToken()); } return capitalizeFirstChar? result :result.substring(0, 1).toLowerCase() + result.substring(1); }
[ "public", "static", "String", "camelize", "(", "String", "underscored", ",", "boolean", "capitalizeFirstChar", ")", "{", "String", "result", "=", "\"\"", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "underscored", ",", "\"_\"", ")", ";", "...
Generates a camel case version of a phrase from underscore. <pre> if {@code capitalicapitalizeFirstChar} "alice_in_wonderland" becomes: "AliceInWonderLand" else "alice_in_wonderland" becomes: "aliceInWonderLand" </pre> @param underscored underscored version of a word to converted to camel case. @param capitalizeFirstChar set to true if first character needs to be capitalized, false if not. @return camel case version of underscore.
[ "Generates", "a", "camel", "case", "version", "of", "a", "phrase", "from", "underscore", "." ]
train
https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/util/StringUtil.java#L129-L136
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageDrawing.java
ImageDrawing.drawMasked
public static void drawMasked(Bitmap src, Drawable mask, Bitmap dest) { drawMasked(src, mask, dest, CLEAR_COLOR); }
java
public static void drawMasked(Bitmap src, Drawable mask, Bitmap dest) { drawMasked(src, mask, dest, CLEAR_COLOR); }
[ "public", "static", "void", "drawMasked", "(", "Bitmap", "src", ",", "Drawable", "mask", ",", "Bitmap", "dest", ")", "{", "drawMasked", "(", "src", ",", "mask", ",", "dest", ",", "CLEAR_COLOR", ")", ";", "}" ]
Drawing src bitmap to dest bitmap with applied mask. @param src source bitmap @param mask bitmap mask @param dest destination bitmap
[ "Drawing", "src", "bitmap", "to", "dest", "bitmap", "with", "applied", "mask", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageDrawing.java#L69-L71
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.getAsync
public Observable<CloudJob> getAsync(String jobId, JobGetOptions jobGetOptions) { return getWithServiceResponseAsync(jobId, jobGetOptions).map(new Func1<ServiceResponseWithHeaders<CloudJob, JobGetHeaders>, CloudJob>() { @Override public CloudJob call(ServiceResponseWithHeaders<CloudJob, JobGetHeaders> response) { return response.body(); } }); }
java
public Observable<CloudJob> getAsync(String jobId, JobGetOptions jobGetOptions) { return getWithServiceResponseAsync(jobId, jobGetOptions).map(new Func1<ServiceResponseWithHeaders<CloudJob, JobGetHeaders>, CloudJob>() { @Override public CloudJob call(ServiceResponseWithHeaders<CloudJob, JobGetHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CloudJob", ">", "getAsync", "(", "String", "jobId", ",", "JobGetOptions", "jobGetOptions", ")", "{", "return", "getWithServiceResponseAsync", "(", "jobId", ",", "jobGetOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceRes...
Gets information about the specified job. @param jobId The ID of the job. @param jobGetOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CloudJob object
[ "Gets", "information", "about", "the", "specified", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L714-L721
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addPolymerNotation
public final static void addPolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().add(position, polymer); }
java
public final static void addPolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().add(position, polymer); }
[ "public", "final", "static", "void", "addPolymerNotation", "(", "int", "position", ",", "PolymerNotation", "polymer", ",", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfPolymers", "(", ")", ".", "add", "(", "position", ",", "polymer",...
method to add a PolymerNotation at a specific position of the HELM2Notation @param position position of the PolymerNotation @param polymer new PolymerNotation @param helm2notation input HELM2Notation
[ "method", "to", "add", "a", "PolymerNotation", "at", "a", "specific", "position", "of", "the", "HELM2Notation" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L410-L412
groupon/odo
proxyserver/src/main/java/com/groupon/odo/Proxy.java
Proxy.executeProxyRequest
private void executeProxyRequest(HttpMethod httpMethodProxyRequest, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, History history) { try { RequestInformation requestInfo = requestInformation.get(); // Execute the request // set virtual host so the server knows how to direct the request // If the host header exists then this uses that value // Otherwise the hostname from the URL is used processVirtualHostName(httpMethodProxyRequest, httpServletRequest); cullDisabledPaths(); // check for existence of ODO_PROXY_HEADER // finding it indicates a bad loop back through the proxy if (httpServletRequest.getHeader(Constants.ODO_PROXY_HEADER) != null) { logger.error("Request has looped back into the proxy. This will not be executed: {}", httpServletRequest.getRequestURL()); return; } // set ODO_PROXY_HEADER httpMethodProxyRequest.addRequestHeader(Constants.ODO_PROXY_HEADER, "proxied"); requestInfo.blockRequest = hasRequestBlock(); PluginResponse responseWrapper = new PluginResponse(httpServletResponse); requestInfo.jsonpCallback = stripJSONPToOutstr(httpServletRequest, responseWrapper); if (!requestInfo.blockRequest) { logger.info("Sending request to server"); history.setModified(requestInfo.modified); history.setRequestSent(true); executeRequest(httpMethodProxyRequest, httpServletRequest, responseWrapper, history); } else { history.setRequestSent(false); } logOriginalResponseHistory(responseWrapper, history); applyResponseOverrides(responseWrapper, httpServletRequest, httpMethodProxyRequest, history); // store history history.setModified(requestInfo.modified); logRequestHistory(httpMethodProxyRequest, responseWrapper, history); writeResponseOutput(responseWrapper, requestInfo.jsonpCallback); } catch (Exception e) { e.printStackTrace(); } }
java
private void executeProxyRequest(HttpMethod httpMethodProxyRequest, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, History history) { try { RequestInformation requestInfo = requestInformation.get(); // Execute the request // set virtual host so the server knows how to direct the request // If the host header exists then this uses that value // Otherwise the hostname from the URL is used processVirtualHostName(httpMethodProxyRequest, httpServletRequest); cullDisabledPaths(); // check for existence of ODO_PROXY_HEADER // finding it indicates a bad loop back through the proxy if (httpServletRequest.getHeader(Constants.ODO_PROXY_HEADER) != null) { logger.error("Request has looped back into the proxy. This will not be executed: {}", httpServletRequest.getRequestURL()); return; } // set ODO_PROXY_HEADER httpMethodProxyRequest.addRequestHeader(Constants.ODO_PROXY_HEADER, "proxied"); requestInfo.blockRequest = hasRequestBlock(); PluginResponse responseWrapper = new PluginResponse(httpServletResponse); requestInfo.jsonpCallback = stripJSONPToOutstr(httpServletRequest, responseWrapper); if (!requestInfo.blockRequest) { logger.info("Sending request to server"); history.setModified(requestInfo.modified); history.setRequestSent(true); executeRequest(httpMethodProxyRequest, httpServletRequest, responseWrapper, history); } else { history.setRequestSent(false); } logOriginalResponseHistory(responseWrapper, history); applyResponseOverrides(responseWrapper, httpServletRequest, httpMethodProxyRequest, history); // store history history.setModified(requestInfo.modified); logRequestHistory(httpMethodProxyRequest, responseWrapper, history); writeResponseOutput(responseWrapper, requestInfo.jsonpCallback); } catch (Exception e) { e.printStackTrace(); } }
[ "private", "void", "executeProxyRequest", "(", "HttpMethod", "httpMethodProxyRequest", ",", "HttpServletRequest", "httpServletRequest", ",", "HttpServletResponse", "httpServletResponse", ",", "History", "history", ")", "{", "try", "{", "RequestInformation", "requestInfo", "...
Execute a request through Odo processing @param httpMethodProxyRequest @param httpServletRequest @param httpServletResponse @param history
[ "Execute", "a", "request", "through", "Odo", "processing" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyserver/src/main/java/com/groupon/odo/Proxy.java#L895-L947
Netflix/EVCache
evcache-client/src/main/java/com/netflix/evcache/pool/EVCacheClientPoolManager.java
EVCacheClientPoolManager.initEVCache
public final synchronized void initEVCache(String app) { if (app == null || (app = app.trim()).length() == 0) throw new IllegalArgumentException( "param app name null or space"); final String APP = getAppName(app); if (poolMap.containsKey(APP)) return; final EVCacheNodeList provider; if (EVCacheConfig.getInstance().getChainedBooleanProperty(APP + ".use.simple.node.list.provider", "evcache.use.simple.node.list.provider", Boolean.FALSE, null).get()) { provider = new SimpleNodeListProvider(); } else { provider = new DiscoveryNodeListProvider(applicationInfoManager, discoveryClient, APP); } final EVCacheClientPool pool = new EVCacheClientPool(APP, provider, asyncExecutor, this); scheduleRefresh(pool); poolMap.put(APP, pool); }
java
public final synchronized void initEVCache(String app) { if (app == null || (app = app.trim()).length() == 0) throw new IllegalArgumentException( "param app name null or space"); final String APP = getAppName(app); if (poolMap.containsKey(APP)) return; final EVCacheNodeList provider; if (EVCacheConfig.getInstance().getChainedBooleanProperty(APP + ".use.simple.node.list.provider", "evcache.use.simple.node.list.provider", Boolean.FALSE, null).get()) { provider = new SimpleNodeListProvider(); } else { provider = new DiscoveryNodeListProvider(applicationInfoManager, discoveryClient, APP); } final EVCacheClientPool pool = new EVCacheClientPool(APP, provider, asyncExecutor, this); scheduleRefresh(pool); poolMap.put(APP, pool); }
[ "public", "final", "synchronized", "void", "initEVCache", "(", "String", "app", ")", "{", "if", "(", "app", "==", "null", "||", "(", "app", "=", "app", ".", "trim", "(", ")", ")", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "IllegalArg...
Will init the given EVCache app call. If one is already initialized for the given app method returns without doing anything. @param app - name of the evcache app
[ "Will", "init", "the", "given", "EVCache", "app", "call", ".", "If", "one", "is", "already", "initialized", "for", "the", "given", "app", "method", "returns", "without", "doing", "anything", "." ]
train
https://github.com/Netflix/EVCache/blob/f46fdc22c8c52e0e06316c9889439d580c1d38a6/evcache-client/src/main/java/com/netflix/evcache/pool/EVCacheClientPoolManager.java#L170-L185
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.findAllGroup0
public static List<String> findAllGroup0(Pattern pattern, CharSequence content) { return findAll(pattern, content, 0); }
java
public static List<String> findAllGroup0(Pattern pattern, CharSequence content) { return findAll(pattern, content, 0); }
[ "public", "static", "List", "<", "String", ">", "findAllGroup0", "(", "Pattern", "pattern", ",", "CharSequence", "content", ")", "{", "return", "findAll", "(", "pattern", ",", "content", ",", "0", ")", ";", "}" ]
取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组0的内容 @param pattern 编译后的正则模式 @param content 被查找的内容 @return 结果列表 @since 3.1.2
[ "取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组0的内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L418-L420
geomajas/geomajas-project-client-gwt2
plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/service/GeometryIndexService.java
GeometryIndexService.getLinearRingIndex
public GeometryIndex getLinearRingIndex(Geometry geometry, Coordinate location) { return fromDelegate(GeometryService.getLinearRingIndex(geometry, location)); }
java
public GeometryIndex getLinearRingIndex(Geometry geometry, Coordinate location) { return fromDelegate(GeometryService.getLinearRingIndex(geometry, location)); }
[ "public", "GeometryIndex", "getLinearRingIndex", "(", "Geometry", "geometry", ",", "Coordinate", "location", ")", "{", "return", "fromDelegate", "(", "GeometryService", ".", "getLinearRingIndex", "(", "geometry", ",", "location", ")", ")", ";", "}" ]
Get the index of the (smallest) linear ring of the geometry that contains this coordinate. @param geometry @param c @return the index (empty array indicates no containment) @since 2.1.0
[ "Get", "the", "index", "of", "the", "(", "smallest", ")", "linear", "ring", "of", "the", "geometry", "that", "contains", "this", "coordinate", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/editing/common/src/main/java/org/geomajas/plugin/editing/client/service/GeometryIndexService.java#L374-L376
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/nlp/AipNlp.java
AipNlp.wordSimEmbedding
public JSONObject wordSimEmbedding(String word1, String word2, HashMap<String, Object> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("word_1", word1); request.addBody("word_2", word2); if (options != null) { request.addBody(options); } request.setUri(NlpConsts.WORD_SIM_EMBEDDING); request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK); request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
java
public JSONObject wordSimEmbedding(String word1, String word2, HashMap<String, Object> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("word_1", word1); request.addBody("word_2", word2); if (options != null) { request.addBody(options); } request.setUri(NlpConsts.WORD_SIM_EMBEDDING); request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK); request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "wordSimEmbedding", "(", "String", "word1", ",", "String", "word2", ",", "HashMap", "<", "String", ",", "Object", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "reques...
词义相似度接口 输入两个词,得到两个词的相似度结果。 @param word1 - 词1(GBK编码),最大64字节* @param word2 - 词1(GBK编码),最大64字节 @param options - 可选参数对象,key: value都为string类型 options - options列表: mode 预留字段,可选择不同的词义相似度模型。默认值为0,目前仅支持mode=0 @return JSONObject
[ "词义相似度接口", "输入两个词,得到两个词的相似度结果。" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/nlp/AipNlp.java#L174-L191
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setCharacterStream
public void setCharacterStream(final int parameterIndex, final Reader reader) throws SQLException { if(reader == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new BufferedReaderParameter(reader)); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read reader", e); } }
java
public void setCharacterStream(final int parameterIndex, final Reader reader) throws SQLException { if(reader == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new BufferedReaderParameter(reader)); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read reader", e); } }
[ "public", "void", "setCharacterStream", "(", "final", "int", "parameterIndex", ",", "final", "Reader", "reader", ")", "throws", "SQLException", "{", "if", "(", "reader", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Types", ".", "BLOB", ")"...
Sets the designated parameter to the given <code>Reader</code> object. When a very large UNICODE value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.Reader</code> object. The data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char format. <p/> <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. <P><B>Note:</B> Consult your JDBC driver documentation to determine if it might be more efficient to use a version of <code>setCharacterStream</code> which takes a length parameter. @param parameterIndex the first parameter is 1, the second is 2, ... @param reader the <code>java.io.Reader</code> object that contains the Unicode data @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> @throws java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support this method @since 1.6
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "<code", ">", "Reader<", "/", "code", ">", "object", ".", "When", "a", "very", "large", "UNICODE", "value", "is", "input", "to", "a", "<code", ">", "LONGVARCHAR<", "/", "code", ">", "paramet...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L926-L938
js-lib-com/commons
src/main/java/js/util/Params.java
Params.notNullOrEmpty
public static void notNullOrEmpty(File parameter, String name) throws IllegalArgumentException { if (parameter == null || parameter.getPath().isEmpty()) { throw new IllegalArgumentException(name + " path is null or empty."); } }
java
public static void notNullOrEmpty(File parameter, String name) throws IllegalArgumentException { if (parameter == null || parameter.getPath().isEmpty()) { throw new IllegalArgumentException(name + " path is null or empty."); } }
[ "public", "static", "void", "notNullOrEmpty", "(", "File", "parameter", ",", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parameter", "==", "null", "||", "parameter", ".", "getPath", "(", ")", ".", "isEmpty", "(", ")", ")", ...
Test if file parameter is not null and has not empty path. @param parameter invocation file parameter, @param name the name of invocation parameter. @throws IllegalArgumentException if <code>parameter</code> is null or its path is empty.
[ "Test", "if", "file", "parameter", "is", "not", "null", "and", "has", "not", "empty", "path", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L107-L111
dita-ot/dita-ot
src/main/java/org/dita/dost/module/DebugAndFilterModule.java
DebugAndFilterModule.getPathtoProject
public static File getPathtoProject(final File filename, final File traceFilename, final File inputMap, final Job job) { if (job.getGeneratecopyouter() != Job.Generate.OLDSOLUTION) { if (isOutFile(traceFilename, inputMap)) { return toFile(getRelativePathFromOut(traceFilename.getAbsoluteFile(), job)); } else { return getRelativePath(traceFilename.getAbsoluteFile(), inputMap.getAbsoluteFile()).getParentFile(); } } else { return FileUtils.getRelativePath(filename); } }
java
public static File getPathtoProject(final File filename, final File traceFilename, final File inputMap, final Job job) { if (job.getGeneratecopyouter() != Job.Generate.OLDSOLUTION) { if (isOutFile(traceFilename, inputMap)) { return toFile(getRelativePathFromOut(traceFilename.getAbsoluteFile(), job)); } else { return getRelativePath(traceFilename.getAbsoluteFile(), inputMap.getAbsoluteFile()).getParentFile(); } } else { return FileUtils.getRelativePath(filename); } }
[ "public", "static", "File", "getPathtoProject", "(", "final", "File", "filename", ",", "final", "File", "traceFilename", ",", "final", "File", "inputMap", ",", "final", "Job", "job", ")", "{", "if", "(", "job", ".", "getGeneratecopyouter", "(", ")", "!=", ...
Get path to base directory @param filename relative input file path from base directory @param traceFilename absolute input file @param inputMap absolute path to start file @return path to base directory, {@code null} if not available
[ "Get", "path", "to", "base", "directory" ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L511-L521
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/sql/JCRSQLQueryBuilder.java
JCRSQLQueryBuilder.createQuery
public static QueryRootNode createQuery(String statement, LocationFactory resolver, QueryNodeFactory factory) throws InvalidQueryException { try { // get parser JCRSQLParser parser; synchronized (parsers) { parser = parsers.get(resolver); if (parser == null) { parser = new JCRSQLParser(new StringReader(statement)); //parser.setNameResolver(resolver); parser.setLocationfactory(resolver); parsers.put(resolver, parser); } } JCRSQLQueryBuilder builder; // guard against concurrent use within same session synchronized (parser) { parser.ReInit(new StringReader(statement)); builder = new JCRSQLQueryBuilder(parser.Query(), resolver, factory); } return builder.getRootNode(); } catch (ParseException e) { throw new InvalidQueryException(e.getMessage()); } catch (IllegalArgumentException e) { throw new InvalidQueryException(e.getMessage()); } catch (Throwable t) //NOSONAR { log.error(t.getLocalizedMessage(), t); // javacc parser may also throw an error in some cases throw new InvalidQueryException(t.getMessage(), t); } }
java
public static QueryRootNode createQuery(String statement, LocationFactory resolver, QueryNodeFactory factory) throws InvalidQueryException { try { // get parser JCRSQLParser parser; synchronized (parsers) { parser = parsers.get(resolver); if (parser == null) { parser = new JCRSQLParser(new StringReader(statement)); //parser.setNameResolver(resolver); parser.setLocationfactory(resolver); parsers.put(resolver, parser); } } JCRSQLQueryBuilder builder; // guard against concurrent use within same session synchronized (parser) { parser.ReInit(new StringReader(statement)); builder = new JCRSQLQueryBuilder(parser.Query(), resolver, factory); } return builder.getRootNode(); } catch (ParseException e) { throw new InvalidQueryException(e.getMessage()); } catch (IllegalArgumentException e) { throw new InvalidQueryException(e.getMessage()); } catch (Throwable t) //NOSONAR { log.error(t.getLocalizedMessage(), t); // javacc parser may also throw an error in some cases throw new InvalidQueryException(t.getMessage(), t); } }
[ "public", "static", "QueryRootNode", "createQuery", "(", "String", "statement", ",", "LocationFactory", "resolver", ",", "QueryNodeFactory", "factory", ")", "throws", "InvalidQueryException", "{", "try", "{", "// get parser", "JCRSQLParser", "parser", ";", "synchronized...
Creates a <code>QueryNode</code> tree from a SQL <code>statement</code> using the passed query node <code>factory</code>. @param statement the SQL statement. @param resolver the namespace resolver to use. @return the <code>QueryNode</code> tree. @throws InvalidQueryException if <code>statement</code> is malformed.
[ "Creates", "a", "<code", ">", "QueryNode<", "/", "code", ">", "tree", "from", "a", "SQL", "<code", ">", "statement<", "/", "code", ">", "using", "the", "passed", "query", "node", "<code", ">", "factory<", "/", "code", ">", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/sql/JCRSQLQueryBuilder.java#L142-L184
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/DefaultExceptionResolver.java
DefaultExceptionResolver.createJsonRpcClientException
private JsonRpcClientException createJsonRpcClientException(ObjectNode errorObject) { int code = errorObject.has(JsonRpcBasicServer.ERROR_CODE) ? errorObject.get(JsonRpcBasicServer.ERROR_CODE).asInt() : 0; return new JsonRpcClientException(code, errorObject.get(JsonRpcBasicServer.ERROR_MESSAGE).asText(), errorObject.get(JsonRpcBasicServer.DATA)); }
java
private JsonRpcClientException createJsonRpcClientException(ObjectNode errorObject) { int code = errorObject.has(JsonRpcBasicServer.ERROR_CODE) ? errorObject.get(JsonRpcBasicServer.ERROR_CODE).asInt() : 0; return new JsonRpcClientException(code, errorObject.get(JsonRpcBasicServer.ERROR_MESSAGE).asText(), errorObject.get(JsonRpcBasicServer.DATA)); }
[ "private", "JsonRpcClientException", "createJsonRpcClientException", "(", "ObjectNode", "errorObject", ")", "{", "int", "code", "=", "errorObject", ".", "has", "(", "JsonRpcBasicServer", ".", "ERROR_CODE", ")", "?", "errorObject", ".", "get", "(", "JsonRpcBasicServer"...
Creates a {@link JsonRpcClientException} from the given {@link ObjectNode}. @param errorObject the error object @return the exception
[ "Creates", "a", "{", "@link", "JsonRpcClientException", "}", "from", "the", "given", "{", "@link", "ObjectNode", "}", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/DefaultExceptionResolver.java#L51-L54
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java
SwiftAPIClient.getMergedPath
private String getMergedPath(String hostName, Path p, String objectName) { if ((p.getParent() != null) && (p.getName() != null) && (p.getParent().toString().equals(hostName))) { if (objectName.equals(p.getName())) { return p.toString(); } if (objectName.startsWith(p.getName())) { return p.getParent() + objectName; } return p.toString(); } return hostName + objectName; }
java
private String getMergedPath(String hostName, Path p, String objectName) { if ((p.getParent() != null) && (p.getName() != null) && (p.getParent().toString().equals(hostName))) { if (objectName.equals(p.getName())) { return p.toString(); } if (objectName.startsWith(p.getName())) { return p.getParent() + objectName; } return p.toString(); } return hostName + objectName; }
[ "private", "String", "getMergedPath", "(", "String", "hostName", ",", "Path", "p", ",", "String", "objectName", ")", "{", "if", "(", "(", "p", ".", "getParent", "(", ")", "!=", "null", ")", "&&", "(", "p", ".", "getName", "(", ")", "!=", "null", ")...
Merge between two paths @param hostName @param p path @param objectName @return merged path
[ "Merge", "between", "two", "paths" ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/swift/SwiftAPIClient.java#L613-L625
groupon/monsoon
remote_history/src/main/java/com/groupon/monsoon/remote/history/Client.java
Client.getFileSize
@Override public long getFileSize() { try { final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_UDP); try { return BlockingWrapper.execute(() -> client.getFileSize_1()); } finally { client.close(); } } catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) { LOG.log(Level.SEVERE, "getFileSize RPC call failed", ex); throw new RuntimeException("RPC call failed", ex); } }
java
@Override public long getFileSize() { try { final rh_protoClient client = getRpcClient(OncRpcProtocols.ONCRPC_UDP); try { return BlockingWrapper.execute(() -> client.getFileSize_1()); } finally { client.close(); } } catch (OncRpcException | IOException | InterruptedException | RuntimeException ex) { LOG.log(Level.SEVERE, "getFileSize RPC call failed", ex); throw new RuntimeException("RPC call failed", ex); } }
[ "@", "Override", "public", "long", "getFileSize", "(", ")", "{", "try", "{", "final", "rh_protoClient", "client", "=", "getRpcClient", "(", "OncRpcProtocols", ".", "ONCRPC_UDP", ")", ";", "try", "{", "return", "BlockingWrapper", ".", "execute", "(", "(", ")"...
Check disk space usage (bytes). @return The disk space used for storing metrics.
[ "Check", "disk", "space", "usage", "(", "bytes", ")", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/remote_history/src/main/java/com/groupon/monsoon/remote/history/Client.java#L152-L165
LearnLib/automatalib
api/src/main/java/net/automatalib/words/Word.java
Word.subWord
@Nonnull public final Word<I> subWord(int fromIndex) { if (fromIndex <= 0) { if (fromIndex == 0) { return this; } throw new IndexOutOfBoundsException("Invalid subword range [" + fromIndex + ",)"); } return subWordInternal(fromIndex, length()); }
java
@Nonnull public final Word<I> subWord(int fromIndex) { if (fromIndex <= 0) { if (fromIndex == 0) { return this; } throw new IndexOutOfBoundsException("Invalid subword range [" + fromIndex + ",)"); } return subWordInternal(fromIndex, length()); }
[ "@", "Nonnull", "public", "final", "Word", "<", "I", ">", "subWord", "(", "int", "fromIndex", ")", "{", "if", "(", "fromIndex", "<=", "0", ")", "{", "if", "(", "fromIndex", "==", "0", ")", "{", "return", "this", ";", "}", "throw", "new", "IndexOutO...
Retrieves the subword of this word starting at the given index and extending until the end of this word. Calling this method is equivalent to calling <pre>w.subWord(fromIndex, w.length())</pre> @param fromIndex the first index, inclusive @return the word representing the specified subrange
[ "Retrieves", "the", "subword", "of", "this", "word", "starting", "at", "the", "given", "index", "and", "extending", "until", "the", "end", "of", "this", "word", ".", "Calling", "this", "method", "is", "equivalent", "to", "calling", "<pre", ">", "w", ".", ...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/api/src/main/java/net/automatalib/words/Word.java#L349-L358
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java
TmdbConfiguration.getConfig
public Configuration getConfig() throws MovieDbException { if (config == null) { URL configUrl = new ApiUrl(apiKey, MethodBase.CONFIGURATION).buildUrl(); String webpage = httpTools.getRequest(configUrl); try { WrapperConfig wc = MAPPER.readValue(webpage, WrapperConfig.class); config = wc.getTmdbConfiguration(); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to read configuration", configUrl, ex); } } return config; }
java
public Configuration getConfig() throws MovieDbException { if (config == null) { URL configUrl = new ApiUrl(apiKey, MethodBase.CONFIGURATION).buildUrl(); String webpage = httpTools.getRequest(configUrl); try { WrapperConfig wc = MAPPER.readValue(webpage, WrapperConfig.class); config = wc.getTmdbConfiguration(); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to read configuration", configUrl, ex); } } return config; }
[ "public", "Configuration", "getConfig", "(", ")", "throws", "MovieDbException", "{", "if", "(", "config", "==", "null", ")", "{", "URL", "configUrl", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "CONFIGURATION", ")", ".", "buildUrl", "(", "...
Get the configuration<br/> If the configuration has been previously retrieved, use that instead @return @throws MovieDbException
[ "Get", "the", "configuration<br", "/", ">", "If", "the", "configuration", "has", "been", "previously", "retrieved", "use", "that", "instead" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java#L71-L84
apache/groovy
src/main/groovy/groovy/lang/GroovyClassLoader.java
GroovyClassLoader.parseClass
public Class parseClass(final GroovyCodeSource codeSource, boolean shouldCacheSource) throws CompilationFailedException { // it's better to cache class instances by the source code // GCL will load the unique class instance for the same source code // and avoid occupying Permanent Area/Metaspace repeatedly String cacheKey = genSourceCacheKey(codeSource); return ((StampedCommonCache<String, Class>) sourceCache).getAndPut( cacheKey, new EvictableCache.ValueProvider<String, Class>() { @Override public Class provide(String key) { return doParseClass(codeSource); } }, shouldCacheSource ); }
java
public Class parseClass(final GroovyCodeSource codeSource, boolean shouldCacheSource) throws CompilationFailedException { // it's better to cache class instances by the source code // GCL will load the unique class instance for the same source code // and avoid occupying Permanent Area/Metaspace repeatedly String cacheKey = genSourceCacheKey(codeSource); return ((StampedCommonCache<String, Class>) sourceCache).getAndPut( cacheKey, new EvictableCache.ValueProvider<String, Class>() { @Override public Class provide(String key) { return doParseClass(codeSource); } }, shouldCacheSource ); }
[ "public", "Class", "parseClass", "(", "final", "GroovyCodeSource", "codeSource", ",", "boolean", "shouldCacheSource", ")", "throws", "CompilationFailedException", "{", "// it's better to cache class instances by the source code", "// GCL will load the unique class instance for the same...
Parses the given code source into a Java class. If there is a class file for the given code source, then no parsing is done, instead the cached class is returned. @param shouldCacheSource if true then the generated class will be stored in the source cache @return the main class defined in the given script
[ "Parses", "the", "given", "code", "source", "into", "a", "Java", "class", ".", "If", "there", "is", "a", "class", "file", "for", "the", "given", "code", "source", "then", "no", "parsing", "is", "done", "instead", "the", "cached", "class", "is", "returned...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L319-L335
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.data_smd_GET
public ArrayList<Long> data_smd_GET(String protectedLabels_label) throws IOException { String qPath = "/domain/data/smd"; StringBuilder sb = path(qPath); query(sb, "protectedLabels.label", protectedLabels_label); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<Long> data_smd_GET(String protectedLabels_label) throws IOException { String qPath = "/domain/data/smd"; StringBuilder sb = path(qPath); query(sb, "protectedLabels.label", protectedLabels_label); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "Long", ">", "data_smd_GET", "(", "String", "protectedLabels_label", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/data/smd\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "...
List all your SMD files REST: GET /domain/data/smd @param protectedLabels_label [required] Filter the value of protectedLabels.label property (=)
[ "List", "all", "your", "SMD", "files" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L112-L118
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitionsConfig.java
TransitionsConfig.exports
public static void exports(Media media, Collection<Media> levels, Media sheetsMedia, Media groupsMedia) { Check.notNull(media); Check.notNull(levels); Check.notNull(sheetsMedia); Check.notNull(groupsMedia); final TransitionsExtractor extractor = new TransitionsExtractorImpl(); final Map<Transition, Collection<TileRef>> transitions = extractor.getTransitions(levels, sheetsMedia, groupsMedia); exports(media, transitions); }
java
public static void exports(Media media, Collection<Media> levels, Media sheetsMedia, Media groupsMedia) { Check.notNull(media); Check.notNull(levels); Check.notNull(sheetsMedia); Check.notNull(groupsMedia); final TransitionsExtractor extractor = new TransitionsExtractorImpl(); final Map<Transition, Collection<TileRef>> transitions = extractor.getTransitions(levels, sheetsMedia, groupsMedia); exports(media, transitions); }
[ "public", "static", "void", "exports", "(", "Media", "media", ",", "Collection", "<", "Media", ">", "levels", ",", "Media", "sheetsMedia", ",", "Media", "groupsMedia", ")", "{", "Check", ".", "notNull", "(", "media", ")", ";", "Check", ".", "notNull", "(...
Export all transitions to media. @param media The export media output (must not be <code>null</code>). @param levels The level rips used (must not be <code>null</code>). @param sheetsMedia The sheets media (must not be <code>null</code>). @param groupsMedia The groups media (must not be <code>null</code>). @throws LionEngineException If error on export.
[ "Export", "all", "transitions", "to", "media", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitionsConfig.java#L96-L108
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java
EJSContainer.setCustomFinderAccessIntentThreadState
public void setCustomFinderAccessIntentThreadState(boolean cfwithupdateaccess, boolean readonly, String methodname) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d532639.2 // create a thread local context for ContainerManagedBeanO to determine CF Access Information if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "setCustomFinderAccessIntentThreadState"); //CMP11CustomFinderAIContext = new WSThreadLocal(); deleted PQ95614 CMP11CustomFinderAccIntentState _state = new CMP11CustomFinderAccIntentState(methodname, cfwithupdateaccess, readonly); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "current thread CMP11 Finder state" + _state); svThreadData.get().ivCMP11CustomFinderAccIntentState = _state; // d630940 if (isTraceOn && tc.isEntryEnabled()) //PQ95614 Tr.exit(tc, "setCustomFinderAccessIntentThreadState"); }
java
public void setCustomFinderAccessIntentThreadState(boolean cfwithupdateaccess, boolean readonly, String methodname) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); // d532639.2 // create a thread local context for ContainerManagedBeanO to determine CF Access Information if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "setCustomFinderAccessIntentThreadState"); //CMP11CustomFinderAIContext = new WSThreadLocal(); deleted PQ95614 CMP11CustomFinderAccIntentState _state = new CMP11CustomFinderAccIntentState(methodname, cfwithupdateaccess, readonly); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "current thread CMP11 Finder state" + _state); svThreadData.get().ivCMP11CustomFinderAccIntentState = _state; // d630940 if (isTraceOn && tc.isEntryEnabled()) //PQ95614 Tr.exit(tc, "setCustomFinderAccessIntentThreadState"); }
[ "public", "void", "setCustomFinderAccessIntentThreadState", "(", "boolean", "cfwithupdateaccess", ",", "boolean", "readonly", ",", "String", "methodname", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "// ...
d112604.5 Method called after first set of 25 CMP11 entities returned during a lazy enumeration custom finder execution. Called for each set of instances to be hydrated via the RemoteEnumerator code path.
[ "d112604", ".", "5" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L1047-L1066
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_redirect_serviceName_PUT
public void billingAccount_redirect_serviceName_PUT(String billingAccount, String serviceName, OvhRedirect body) throws IOException { String qPath = "/telephony/{billingAccount}/redirect/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_redirect_serviceName_PUT(String billingAccount, String serviceName, OvhRedirect body) throws IOException { String qPath = "/telephony/{billingAccount}/redirect/{serviceName}"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_redirect_serviceName_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhRedirect", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/redirect/{serviceName}\"", ";", ...
Alter this object properties REST: PUT /telephony/{billingAccount}/redirect/{serviceName} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "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#L8300-L8304
alkacon/opencms-core
src-modules/org/opencms/workplace/help/CmsHelpNavigationListView.java
CmsHelpNavigationListView.createNavigationInternal
private void createNavigationInternal(StringBuffer buffer, List<CmsJspNavElement> navElements) { // take the element to render. CmsJspNavElement element = navElements.remove(0); int elementLevel = element.getNavTreeLevel(); String spacing = getSpaces(elementLevel * 2); // render element: buffer.append(spacing).append("<li>\n"); buffer.append(spacing).append(" <a href=\""); buffer.append(m_jsp.link(element.getResourceName())); buffer.append("\" title=\""); buffer.append(element.getNavText()); buffer.append("\""); if (elementLevel == 1) { buffer.append(" class=\"bold\""); } buffer.append(">"); buffer.append(element.getNavText()); buffer.append("</a>\n"); // peek at the next (list is depth - first by contract) if (!navElements.isEmpty()) { CmsJspNavElement child = navElements.get(0); int childLevel = child.getNavTreeLevel(); if (elementLevel < childLevel) { // next one goes down a level: it is a child by tree means buffer.append(spacing).append(" <ul>\n"); } else if (elementLevel == childLevel) { // it is a sibling: close our list item, no recursion buffer.append(spacing).append("</li>\n"); } else { // next element gets up one layer // this has to happen because of the depth-first contract! buffer.append(spacing).append(" </li>\n").append(spacing).append("</ul>\n"); } createNavigationInternal(buffer, navElements); } else { // no more next elements: get back and close all lists (by using the recursion we are in) buffer.append(spacing).append(" </li>\n").append(spacing).append("</ul>\n"); } }
java
private void createNavigationInternal(StringBuffer buffer, List<CmsJspNavElement> navElements) { // take the element to render. CmsJspNavElement element = navElements.remove(0); int elementLevel = element.getNavTreeLevel(); String spacing = getSpaces(elementLevel * 2); // render element: buffer.append(spacing).append("<li>\n"); buffer.append(spacing).append(" <a href=\""); buffer.append(m_jsp.link(element.getResourceName())); buffer.append("\" title=\""); buffer.append(element.getNavText()); buffer.append("\""); if (elementLevel == 1) { buffer.append(" class=\"bold\""); } buffer.append(">"); buffer.append(element.getNavText()); buffer.append("</a>\n"); // peek at the next (list is depth - first by contract) if (!navElements.isEmpty()) { CmsJspNavElement child = navElements.get(0); int childLevel = child.getNavTreeLevel(); if (elementLevel < childLevel) { // next one goes down a level: it is a child by tree means buffer.append(spacing).append(" <ul>\n"); } else if (elementLevel == childLevel) { // it is a sibling: close our list item, no recursion buffer.append(spacing).append("</li>\n"); } else { // next element gets up one layer // this has to happen because of the depth-first contract! buffer.append(spacing).append(" </li>\n").append(spacing).append("</ul>\n"); } createNavigationInternal(buffer, navElements); } else { // no more next elements: get back and close all lists (by using the recursion we are in) buffer.append(spacing).append(" </li>\n").append(spacing).append("</ul>\n"); } }
[ "private", "void", "createNavigationInternal", "(", "StringBuffer", "buffer", ",", "List", "<", "CmsJspNavElement", ">", "navElements", ")", "{", "// take the element to render.", "CmsJspNavElement", "element", "=", "navElements", ".", "remove", "(", "0", ")", ";", ...
Creates the HTML for the internal help.<p> @param buffer the StringBuffer to which the Navigation will be appended @param navElements the navigation elements to build the navigation for
[ "Creates", "the", "HTML", "for", "the", "internal", "help", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/help/CmsHelpNavigationListView.java#L212-L253
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.getAt
public static CharSequence getAt(CharSequence text, Range range) { RangeInfo info = subListBorders(text.length(), range); CharSequence sequence = text.subSequence(info.from, info.to); return info.reverse ? reverse(sequence) : sequence; }
java
public static CharSequence getAt(CharSequence text, Range range) { RangeInfo info = subListBorders(text.length(), range); CharSequence sequence = text.subSequence(info.from, info.to); return info.reverse ? reverse(sequence) : sequence; }
[ "public", "static", "CharSequence", "getAt", "(", "CharSequence", "text", ",", "Range", "range", ")", "{", "RangeInfo", "info", "=", "subListBorders", "(", "text", ".", "length", "(", ")", ",", "range", ")", ";", "CharSequence", "sequence", "=", "text", "....
Support the range subscript operator for CharSequence @param text a CharSequence @param range a Range @return the subsequence CharSequence @since 1.0
[ "Support", "the", "range", "subscript", "operator", "for", "CharSequence" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1289-L1293
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/text/TextProtocolBackendHandlerFactory.java
TextProtocolBackendHandlerFactory.newInstance
public static TextProtocolBackendHandler newInstance(final String sql, final BackendConnection backendConnection) { if (sql.toUpperCase().startsWith(ShardingCTLBackendHandlerFactory.SCTL)) { return ShardingCTLBackendHandlerFactory.newInstance(sql, backendConnection); } // TODO use sql parser engine instead of string compare Optional<TransactionOperationType> transactionOperationType = TransactionOperationType.getOperationType(sql.toUpperCase()); if (transactionOperationType.isPresent()) { return new TransactionBackendHandler(transactionOperationType.get(), backendConnection); } if (sql.toUpperCase().contains(SET_AUTOCOMMIT_1)) { return backendConnection.getStateHandler().isInTransaction() ? new TransactionBackendHandler(TransactionOperationType.COMMIT, backendConnection) : new SkipBackendHandler(); } SQLStatement sqlStatement = new SQLJudgeEngine(sql).judge(); return SQLType.DAL == sqlStatement.getType() ? createDALBackendHandler(sqlStatement, sql, backendConnection) : new QueryBackendHandler(sql, backendConnection); }
java
public static TextProtocolBackendHandler newInstance(final String sql, final BackendConnection backendConnection) { if (sql.toUpperCase().startsWith(ShardingCTLBackendHandlerFactory.SCTL)) { return ShardingCTLBackendHandlerFactory.newInstance(sql, backendConnection); } // TODO use sql parser engine instead of string compare Optional<TransactionOperationType> transactionOperationType = TransactionOperationType.getOperationType(sql.toUpperCase()); if (transactionOperationType.isPresent()) { return new TransactionBackendHandler(transactionOperationType.get(), backendConnection); } if (sql.toUpperCase().contains(SET_AUTOCOMMIT_1)) { return backendConnection.getStateHandler().isInTransaction() ? new TransactionBackendHandler(TransactionOperationType.COMMIT, backendConnection) : new SkipBackendHandler(); } SQLStatement sqlStatement = new SQLJudgeEngine(sql).judge(); return SQLType.DAL == sqlStatement.getType() ? createDALBackendHandler(sqlStatement, sql, backendConnection) : new QueryBackendHandler(sql, backendConnection); }
[ "public", "static", "TextProtocolBackendHandler", "newInstance", "(", "final", "String", "sql", ",", "final", "BackendConnection", "backendConnection", ")", "{", "if", "(", "sql", ".", "toUpperCase", "(", ")", ".", "startsWith", "(", "ShardingCTLBackendHandlerFactory"...
Create new instance of text protocol backend handler. @param sql SQL to be executed @param backendConnection backend connection @return instance of text protocol backend handler
[ "Create", "new", "instance", "of", "text", "protocol", "backend", "handler", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/text/TextProtocolBackendHandlerFactory.java#L61-L75
mercadopago/dx-java
src/main/java/com/mercadopago/net/MPRestClient.java
MPRestClient.getClient
private HttpClient getClient(int retries, int connectionTimeout, int socketTimeout) { HttpClient httpClient = new DefaultHttpClient(); HttpParams httpParams = httpClient.getParams(); // Retries if (retries > 0) { DefaultHttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler(retries, true); ((AbstractHttpClient) httpClient).setHttpRequestRetryHandler(retryHandler); } // Timeouts if (connectionTimeout > 0) { httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectionTimeout); } if (socketTimeout > 0) { httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, socketTimeout); } //Proxy if (StringUtils.isNotEmpty(proxyHostName)) { HttpHost proxy = new HttpHost(proxyHostName, proxyPort); httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } return httpClient; }
java
private HttpClient getClient(int retries, int connectionTimeout, int socketTimeout) { HttpClient httpClient = new DefaultHttpClient(); HttpParams httpParams = httpClient.getParams(); // Retries if (retries > 0) { DefaultHttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler(retries, true); ((AbstractHttpClient) httpClient).setHttpRequestRetryHandler(retryHandler); } // Timeouts if (connectionTimeout > 0) { httpParams.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectionTimeout); } if (socketTimeout > 0) { httpParams.setParameter(CoreConnectionPNames.SO_TIMEOUT, socketTimeout); } //Proxy if (StringUtils.isNotEmpty(proxyHostName)) { HttpHost proxy = new HttpHost(proxyHostName, proxyPort); httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); } return httpClient; }
[ "private", "HttpClient", "getClient", "(", "int", "retries", ",", "int", "connectionTimeout", ",", "int", "socketTimeout", ")", "{", "HttpClient", "httpClient", "=", "new", "DefaultHttpClient", "(", ")", ";", "HttpParams", "httpParams", "=", "httpClient", ".", "...
Returns a DefaultHttpClient instance with retries and timeouts settings If proxy information exists, its setted on the client. @param retries int with the retries for the api request @param connectionTimeout int with the connection timeout for the api request expressed in milliseconds @param socketTimeout int with the socket timeout for the api request expressed in milliseconds @return a DefaultHttpClient
[ "Returns", "a", "DefaultHttpClient", "instance", "with", "retries", "and", "timeouts", "settings", "If", "proxy", "information", "exists", "its", "setted", "on", "the", "client", "." ]
train
https://github.com/mercadopago/dx-java/blob/9df65a6bfb4db0c1fddd7699a5b109643961b03f/src/main/java/com/mercadopago/net/MPRestClient.java#L146-L171
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientOptions.java
ClientOptions.of
public static ClientOptions of(ClientOptions baseOptions, ClientOptionValue<?>... options) { // TODO(trustin): Reduce the cost of creating a derived ClientOptions. requireNonNull(baseOptions, "baseOptions"); requireNonNull(options, "options"); if (options.length == 0) { return baseOptions; } return new ClientOptions(baseOptions, options); }
java
public static ClientOptions of(ClientOptions baseOptions, ClientOptionValue<?>... options) { // TODO(trustin): Reduce the cost of creating a derived ClientOptions. requireNonNull(baseOptions, "baseOptions"); requireNonNull(options, "options"); if (options.length == 0) { return baseOptions; } return new ClientOptions(baseOptions, options); }
[ "public", "static", "ClientOptions", "of", "(", "ClientOptions", "baseOptions", ",", "ClientOptionValue", "<", "?", ">", "...", "options", ")", "{", "// TODO(trustin): Reduce the cost of creating a derived ClientOptions.", "requireNonNull", "(", "baseOptions", ",", "\"baseO...
Merges the specified {@link ClientOptions} and {@link ClientOptionValue}s. @return the merged {@link ClientOptions}
[ "Merges", "the", "specified", "{", "@link", "ClientOptions", "}", "and", "{", "@link", "ClientOptionValue", "}", "s", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientOptions.java#L110-L118
bluelinelabs/Conductor
conductor/src/main/java/com/bluelinelabs/conductor/changehandler/SharedElementTransitionChangeHandler.java
SharedElementTransitionChangeHandler.addSharedElement
protected final void addSharedElement(@NonNull String fromName, @NonNull String toName) { sharedElementNames.put(fromName, toName); }
java
protected final void addSharedElement(@NonNull String fromName, @NonNull String toName) { sharedElementNames.put(fromName, toName); }
[ "protected", "final", "void", "addSharedElement", "(", "@", "NonNull", "String", "fromName", ",", "@", "NonNull", "String", "toName", ")", "{", "sharedElementNames", ".", "put", "(", "fromName", ",", "toName", ")", ";", "}" ]
Used to register an element that will take part in the shared element transition. Maps the name used in the "from" view to the name used in the "to" view if they are not the same. @param fromName The transition name used in the "from" view @param toName The transition name used in the "to" view
[ "Used", "to", "register", "an", "element", "that", "will", "take", "part", "in", "the", "shared", "element", "transition", ".", "Maps", "the", "name", "used", "in", "the", "from", "view", "to", "the", "name", "used", "in", "the", "to", "view", "if", "t...
train
https://github.com/bluelinelabs/Conductor/blob/94c9121bb16f93b481954513a8e3905846829fb2/conductor/src/main/java/com/bluelinelabs/conductor/changehandler/SharedElementTransitionChangeHandler.java#L563-L565
Harium/keel
src/main/java/jdt/triangulation/DelaunayTriangulation.java
DelaunayTriangulation.findnext2
private static Triangle findnext2(Vector3 p, Triangle v) { if (v.abnext != null && !v.abnext.halfplane) return v.abnext; if (v.bcnext != null && !v.bcnext.halfplane) return v.bcnext; if (v.canext != null && !v.canext.halfplane) return v.canext; return null; }
java
private static Triangle findnext2(Vector3 p, Triangle v) { if (v.abnext != null && !v.abnext.halfplane) return v.abnext; if (v.bcnext != null && !v.bcnext.halfplane) return v.bcnext; if (v.canext != null && !v.canext.halfplane) return v.canext; return null; }
[ "private", "static", "Triangle", "findnext2", "(", "Vector3", "p", ",", "Triangle", "v", ")", "{", "if", "(", "v", ".", "abnext", "!=", "null", "&&", "!", "v", ".", "abnext", ".", "halfplane", ")", "return", "v", ".", "abnext", ";", "if", "(", "v",...
assumes v is an halfplane! - returns another (none halfplane) triangle
[ "assumes", "v", "is", "an", "halfplane!", "-", "returns", "another", "(", "none", "halfplane", ")", "triangle" ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/jdt/triangulation/DelaunayTriangulation.java#L1097-L1105
grpc/grpc-java
core/src/main/java/io/grpc/internal/CensusTracingModule.java
CensusTracingModule.generateTraceSpanName
@VisibleForTesting static String generateTraceSpanName(boolean isServer, String fullMethodName) { String prefix = isServer ? "Recv" : "Sent"; return prefix + "." + fullMethodName.replace('/', '.'); }
java
@VisibleForTesting static String generateTraceSpanName(boolean isServer, String fullMethodName) { String prefix = isServer ? "Recv" : "Sent"; return prefix + "." + fullMethodName.replace('/', '.'); }
[ "@", "VisibleForTesting", "static", "String", "generateTraceSpanName", "(", "boolean", "isServer", ",", "String", "fullMethodName", ")", "{", "String", "prefix", "=", "isServer", "?", "\"Recv\"", ":", "\"Sent\"", ";", "return", "prefix", "+", "\".\"", "+", "full...
Convert a full method name to a tracing span name. @param isServer {@code false} if the span is on the client-side, {@code true} if on the server-side @param fullMethodName the method name as returned by {@link MethodDescriptor#getFullMethodName}.
[ "Convert", "a", "full", "method", "name", "to", "a", "tracing", "span", "name", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/CensusTracingModule.java#L415-L419
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuProfilerInitialize
public static int cuProfilerInitialize(String configFile, String outputFile, int outputMode) { return checkResult(cuProfilerInitializeNative(configFile, outputFile, outputMode)); }
java
public static int cuProfilerInitialize(String configFile, String outputFile, int outputMode) { return checkResult(cuProfilerInitializeNative(configFile, outputFile, outputMode)); }
[ "public", "static", "int", "cuProfilerInitialize", "(", "String", "configFile", ",", "String", "outputFile", ",", "int", "outputMode", ")", "{", "return", "checkResult", "(", "cuProfilerInitializeNative", "(", "configFile", ",", "outputFile", ",", "outputMode", ")",...
Initialize the profiling. <pre> CUresult cuProfilerInitialize ( const char* configFile, const char* outputFile, CUoutput_mode outputMode ) </pre> <div> <p>Initialize the profiling. Using this API user can initialize the CUDA profiler by specifying the configuration file, output file and output file format. This API is generally used to profile different set of counters by looping the kernel launch. The <tt>configFile</tt> parameter can be used to select profiling options including profiler counters. Refer to the "Compute Command Line Profiler User Guide" for supported profiler options and counters. </p> <p>Limitation: The CUDA profiler cannot be initialized with this API if another profiling tool is already active, as indicated by the CUDA_ERROR_PROFILER_DISABLED return code. </p> <p>Typical usage of the profiling APIs is as follows: </p> <p>for each set of counters/options { cuProfilerInitialize(); //Initialize profiling, set the counters or options in the config file ... cuProfilerStart(); // code to be profiled cuProfilerStop(); ... cuProfilerStart(); // code to be profiled cuProfilerStop(); ... } </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param configFile Name of the config file that lists the counters/options for profiling. @param outputFile Name of the outputFile where the profiling results will be stored. @param outputMode outputMode, can be CU_OUT_KEY_VALUE_PAIR or CU_OUT_CSV. @return CUDA_SUCCESS, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_PROFILER_DISABLED @see JCudaDriver#cuProfilerStart @see JCudaDriver#cuProfilerStop
[ "Initialize", "the", "profiling", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L17535-L17538
mlhartme/mork
src/main/java/net/oneandone/mork/mapping/Mapper.java
Mapper.newInstance
public Mapper newInstance() { Mapper mapper; mapper = new Mapper(name, parser.newInstance(), oag.newInstance()); mapper.setLogging(logParsing, logAttribution); return mapper; }
java
public Mapper newInstance() { Mapper mapper; mapper = new Mapper(name, parser.newInstance(), oag.newInstance()); mapper.setLogging(logParsing, logAttribution); return mapper; }
[ "public", "Mapper", "newInstance", "(", ")", "{", "Mapper", "mapper", ";", "mapper", "=", "new", "Mapper", "(", "name", ",", "parser", ".", "newInstance", "(", ")", ",", "oag", ".", "newInstance", "(", ")", ")", ";", "mapper", ".", "setLogging", "(", ...
Creates a new mapper instance. Shares common data (esp. scanner and parser table with this instance.
[ "Creates", "a", "new", "mapper", "instance", ".", "Shares", "common", "data", "(", "esp", ".", "scanner", "and", "parser", "table", "with", "this", "instance", "." ]
train
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/mapping/Mapper.java#L88-L94
code4everything/util
src/main/java/com/zhazhapan/util/LoggerUtils.java
LoggerUtils.error
public static void error(Class<?> clazz, String message, String... values) { getLogger(clazz).error(formatString(message, values)); }
java
public static void error(Class<?> clazz, String message, String... values) { getLogger(clazz).error(formatString(message, values)); }
[ "public", "static", "void", "error", "(", "Class", "<", "?", ">", "clazz", ",", "String", "message", ",", "String", "...", "values", ")", "{", "getLogger", "(", "clazz", ")", ".", "error", "(", "formatString", "(", "message", ",", "values", ")", ")", ...
错误 @param clazz 类 @param message 消息 @param values 格式化参数 @since 1.0.8
[ "错误" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/LoggerUtils.java#L177-L179
Chorus-bdd/Chorus
interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/SpringContextSupport.java
SpringContextSupport.findSpringContextFileName
private String findSpringContextFileName(Object handler, Annotation[] annotations) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { String contextFileName = null; for (Annotation a : annotations) { String n = a.annotationType().getSimpleName(); if ( n.equals("ContextConfiguration") || n.equals("SpringContext")) { log.trace("Found an spring context annotation " + a); contextFileName = getContextPathFromSpringAnnotation(handler, a, n); if ( contextFileName != null) { break; } } } return contextFileName; }
java
private String findSpringContextFileName(Object handler, Annotation[] annotations) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { String contextFileName = null; for (Annotation a : annotations) { String n = a.annotationType().getSimpleName(); if ( n.equals("ContextConfiguration") || n.equals("SpringContext")) { log.trace("Found an spring context annotation " + a); contextFileName = getContextPathFromSpringAnnotation(handler, a, n); if ( contextFileName != null) { break; } } } return contextFileName; }
[ "private", "String", "findSpringContextFileName", "(", "Object", "handler", ",", "Annotation", "[", "]", "annotations", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "String", "contextFileName", "=", "null", ...
we have to use reflection for this since Spring is not a mandatory dependency / not necessarily on the classpath for chorus core
[ "we", "have", "to", "use", "reflection", "for", "this", "since", "Spring", "is", "not", "a", "mandatory", "dependency", "/", "not", "necessarily", "on", "the", "classpath", "for", "chorus", "core" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/SpringContextSupport.java#L105-L118
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/KeyStoreManager.java
KeyStoreManager.addKeyStoreToMap
public void addKeyStoreToMap(String keyStoreName, WSKeyStore ks) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "addKeyStoreToMap: " + keyStoreName + ", ks=" + ks); if (keyStoreMap.containsKey(keyStoreName)) keyStoreMap.remove(keyStoreName); keyStoreMap.put(keyStoreName, ks); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "addKeyStoreToMap"); }
java
public void addKeyStoreToMap(String keyStoreName, WSKeyStore ks) throws Exception { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "addKeyStoreToMap: " + keyStoreName + ", ks=" + ks); if (keyStoreMap.containsKey(keyStoreName)) keyStoreMap.remove(keyStoreName); keyStoreMap.put(keyStoreName, ks); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "addKeyStoreToMap"); }
[ "public", "void", "addKeyStoreToMap", "(", "String", "keyStoreName", ",", "WSKeyStore", "ks", ")", "throws", "Exception", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "en...
* Adds the keyStore to the keyStoreMap. @param keyStoreName @param ks @throws Exception *
[ "*", "Adds", "the", "keyStore", "to", "the", "keyStoreMap", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/KeyStoreManager.java#L114-L124
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/WordUtils.java
WordUtils.capitalizeFully
@GwtIncompatible("incompatible method") public static String capitalizeFully(String str, final char... delimiters) { final int delimLen = delimiters == null ? -1 : delimiters.length; if (StringUtils.isEmpty(str) || delimLen == 0) { return str; } str = str.toLowerCase(); return capitalize(str, delimiters); }
java
@GwtIncompatible("incompatible method") public static String capitalizeFully(String str, final char... delimiters) { final int delimLen = delimiters == null ? -1 : delimiters.length; if (StringUtils.isEmpty(str) || delimLen == 0) { return str; } str = str.toLowerCase(); return capitalize(str, delimiters); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "String", "capitalizeFully", "(", "String", "str", ",", "final", "char", "...", "delimiters", ")", "{", "final", "int", "delimLen", "=", "delimiters", "==", "null", "?", "-", "1",...
<p>Converts all the delimiter separated words in a String into capitalized words, that is each word is made up of a titlecase character and then a series of lowercase characters. </p> <p>The delimiters represent a set of characters understood to separate words. The first string character and the first non-delimiter character after a delimiter will be capitalized. </p> <p>A <code>null</code> input String returns <code>null</code>. Capitalization uses the Unicode title case, normally equivalent to upper case.</p> <pre> WordUtils.capitalizeFully(null, *) = null WordUtils.capitalizeFully("", *) = "" WordUtils.capitalizeFully(*, null) = * WordUtils.capitalizeFully(*, new char[0]) = * WordUtils.capitalizeFully("i aM.fine", {'.'}) = "I am.Fine" </pre> @param str the String to capitalize, may be null @param delimiters set of characters to determine capitalization, null means whitespace @return capitalized String, <code>null</code> if null String input @since 2.1
[ "<p", ">", "Converts", "all", "the", "delimiter", "separated", "words", "in", "a", "String", "into", "capitalized", "words", "that", "is", "each", "word", "is", "made", "up", "of", "a", "titlecase", "character", "and", "then", "a", "series", "of", "lowerca...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/WordUtils.java#L486-L494
airlift/slice
src/main/java/io/airlift/slice/UnsafeSliceFactory.java
UnsafeSliceFactory.newSlice
public Slice newSlice(long address, int size) { if (address <= 0) { throw new IllegalArgumentException("Invalid address: " + address); } if (size == 0) { return Slices.EMPTY_SLICE; } return new Slice(null, address, size, 0, null); }
java
public Slice newSlice(long address, int size) { if (address <= 0) { throw new IllegalArgumentException("Invalid address: " + address); } if (size == 0) { return Slices.EMPTY_SLICE; } return new Slice(null, address, size, 0, null); }
[ "public", "Slice", "newSlice", "(", "long", "address", ",", "int", "size", ")", "{", "if", "(", "address", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid address: \"", "+", "address", ")", ";", "}", "if", "(", "size", "=...
Creates a slice for directly a raw memory address. This is inherently unsafe as it may be used to access arbitrary memory. @param address the raw memory address base @param size the size of the slice @return the unsafe slice
[ "Creates", "a", "slice", "for", "directly", "a", "raw", "memory", "address", ".", "This", "is", "inherently", "unsafe", "as", "it", "may", "be", "used", "to", "access", "arbitrary", "memory", "." ]
train
https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/UnsafeSliceFactory.java#L64-L73
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Scroller.java
Scroller.scrollWebView
public boolean scrollWebView(final WebView webView, int direction, final boolean allTheWay){ if (direction == DOWN) { inst.runOnMainSync(new Runnable(){ public void run(){ canScroll = webView.pageDown(allTheWay); } }); } if(direction == UP){ inst.runOnMainSync(new Runnable(){ public void run(){ canScroll = webView.pageUp(allTheWay); } }); } return canScroll; }
java
public boolean scrollWebView(final WebView webView, int direction, final boolean allTheWay){ if (direction == DOWN) { inst.runOnMainSync(new Runnable(){ public void run(){ canScroll = webView.pageDown(allTheWay); } }); } if(direction == UP){ inst.runOnMainSync(new Runnable(){ public void run(){ canScroll = webView.pageUp(allTheWay); } }); } return canScroll; }
[ "public", "boolean", "scrollWebView", "(", "final", "WebView", "webView", ",", "int", "direction", ",", "final", "boolean", "allTheWay", ")", "{", "if", "(", "direction", "==", "DOWN", ")", "{", "inst", ".", "runOnMainSync", "(", "new", "Runnable", "(", ")...
Scrolls a WebView. @param webView the WebView to scroll @param direction the direction to scroll @param allTheWay {@code true} to scroll the view all the way up or down, {@code false} to scroll one page up or down or down. @return {@code true} if more scrolling can be done
[ "Scrolls", "a", "WebView", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Scroller.java#L225-L242
zxing/zxing
core/src/main/java/com/google/zxing/common/BitArray.java
BitArray.appendBits
public void appendBits(int value, int numBits) { if (numBits < 0 || numBits > 32) { throw new IllegalArgumentException("Num bits must be between 0 and 32"); } ensureCapacity(size + numBits); for (int numBitsLeft = numBits; numBitsLeft > 0; numBitsLeft--) { appendBit(((value >> (numBitsLeft - 1)) & 0x01) == 1); } }
java
public void appendBits(int value, int numBits) { if (numBits < 0 || numBits > 32) { throw new IllegalArgumentException("Num bits must be between 0 and 32"); } ensureCapacity(size + numBits); for (int numBitsLeft = numBits; numBitsLeft > 0; numBitsLeft--) { appendBit(((value >> (numBitsLeft - 1)) & 0x01) == 1); } }
[ "public", "void", "appendBits", "(", "int", "value", ",", "int", "numBits", ")", "{", "if", "(", "numBits", "<", "0", "||", "numBits", ">", "32", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Num bits must be between 0 and 32\"", ")", ";", "}...
Appends the least-significant bits, from value, in order from most-significant to least-significant. For example, appending 6 bits from 0x000001E will append the bits 0, 1, 1, 1, 1, 0 in that order. @param value {@code int} containing bits to append @param numBits bits from value to append
[ "Appends", "the", "least", "-", "significant", "bits", "from", "value", "in", "order", "from", "most", "-", "significant", "to", "least", "-", "significant", ".", "For", "example", "appending", "6", "bits", "from", "0x000001E", "will", "append", "the", "bits...
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitArray.java#L232-L240
strator-dev/greenpepper
samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java
AccountManager.deleteUser
public boolean deleteUser(String name) { if (ADMIN_USER_ID.equals(name)) { throw new SystemException(String.format("Cannot delete '%s' user.", ADMIN_USER_ID)); } if (!isUserExist(name)) { throw new SystemException(String.format("User '%s' does not exist.", name)); } allAssociations.remove(name); return allUsers.remove(name); }
java
public boolean deleteUser(String name) { if (ADMIN_USER_ID.equals(name)) { throw new SystemException(String.format("Cannot delete '%s' user.", ADMIN_USER_ID)); } if (!isUserExist(name)) { throw new SystemException(String.format("User '%s' does not exist.", name)); } allAssociations.remove(name); return allUsers.remove(name); }
[ "public", "boolean", "deleteUser", "(", "String", "name", ")", "{", "if", "(", "ADMIN_USER_ID", ".", "equals", "(", "name", ")", ")", "{", "throw", "new", "SystemException", "(", "String", ".", "format", "(", "\"Cannot delete '%s' user.\"", ",", "ADMIN_USER_ID...
<p>deleteUser.</p> @param name a {@link java.lang.String} object. @return a boolean.
[ "<p", ">", "deleteUser", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java#L138-L153
eserating/siren4j
src/main/java/com/google/code/siren4j/util/ReflectionUtils.java
ReflectionUtils.getFieldInfoByName
public static ReflectedInfo getFieldInfoByName(List<ReflectedInfo> infoList, String name) { if (infoList == null) { throw new IllegalArgumentException("infoList cannot be null."); } if (StringUtils.isBlank(name)) { throw new IllegalArgumentException("name cannot be null or empty."); } ReflectedInfo result = null; for (ReflectedInfo info : infoList) { if (info.getField() == null) { continue; //should never happen. } if (name.equals(info.getField().getName())) { result = info; break; } } return result; }
java
public static ReflectedInfo getFieldInfoByName(List<ReflectedInfo> infoList, String name) { if (infoList == null) { throw new IllegalArgumentException("infoList cannot be null."); } if (StringUtils.isBlank(name)) { throw new IllegalArgumentException("name cannot be null or empty."); } ReflectedInfo result = null; for (ReflectedInfo info : infoList) { if (info.getField() == null) { continue; //should never happen. } if (name.equals(info.getField().getName())) { result = info; break; } } return result; }
[ "public", "static", "ReflectedInfo", "getFieldInfoByName", "(", "List", "<", "ReflectedInfo", ">", "infoList", ",", "String", "name", ")", "{", "if", "(", "infoList", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"infoList cannot be nu...
Helper method to find the field info by its name from the passed in list of info. @param infoList cannot be <code>null</code>. @param name cannot be <code>null</code> or empty. @return the info or <code>null</code> if not found.
[ "Helper", "method", "to", "find", "the", "field", "info", "by", "its", "name", "from", "the", "passed", "in", "list", "of", "info", "." ]
train
https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/util/ReflectionUtils.java#L500-L518
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java
SeaGlassGraphicsUtils.drawEmphasizedText
public void drawEmphasizedText(Graphics g, Color foreground, Color emphasis, String s, int underlinedIndex, int x, int y) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setColor(emphasis); BasicGraphicsUtils.drawStringUnderlineCharAt(g2d, s, underlinedIndex, x, y + 1); g2d.setColor(foreground); BasicGraphicsUtils.drawStringUnderlineCharAt(g2d, s, underlinedIndex, x, y); }
java
public void drawEmphasizedText(Graphics g, Color foreground, Color emphasis, String s, int underlinedIndex, int x, int y) { Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setColor(emphasis); BasicGraphicsUtils.drawStringUnderlineCharAt(g2d, s, underlinedIndex, x, y + 1); g2d.setColor(foreground); BasicGraphicsUtils.drawStringUnderlineCharAt(g2d, s, underlinedIndex, x, y); }
[ "public", "void", "drawEmphasizedText", "(", "Graphics", "g", ",", "Color", "foreground", ",", "Color", "emphasis", ",", "String", "s", ",", "int", "underlinedIndex", ",", "int", "x", ",", "int", "y", ")", "{", "Graphics2D", "g2d", "=", "(", "Graphics2D", ...
Draw text with an emphasized background. @param g the Graphics context to draw with. @param foreground the foreground color. @param emphasis the emphasis color. @param s the text to draw. @param underlinedIndex the index to underline. @param x the x coordinate to draw at. @param y the y coordinate to draw at.
[ "Draw", "text", "with", "an", "emphasized", "background", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/util/SeaGlassGraphicsUtils.java#L365-L374
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java
AVIMConversation.queryMessages
public void queryMessages(final AVIMMessageInterval interval, AVIMMessageQueryDirection direction, final int limit, final AVIMMessagesQueryCallback callback) { if (null == interval || limit < 0) { if (null != callback) { callback.internalDone(null, new AVException(new IllegalArgumentException("interval must not null, or limit must great than 0."))); } return; } String mid = null; long ts = 0; boolean startClosed = false; String tmid = null; long tts = 0; boolean endClosed = false; if (null != interval.startIntervalBound) { mid = interval.startIntervalBound.messageId; ts = interval.startIntervalBound.timestamp; startClosed = interval.startIntervalBound.closed; } if (null != interval.endIntervalBound) { tmid = interval.endIntervalBound.messageId; tts = interval.endIntervalBound.timestamp; endClosed = interval.endIntervalBound.closed; } queryMessagesFromServer(mid, ts, startClosed, tmid, tts, endClosed, direction, limit, callback); }
java
public void queryMessages(final AVIMMessageInterval interval, AVIMMessageQueryDirection direction, final int limit, final AVIMMessagesQueryCallback callback) { if (null == interval || limit < 0) { if (null != callback) { callback.internalDone(null, new AVException(new IllegalArgumentException("interval must not null, or limit must great than 0."))); } return; } String mid = null; long ts = 0; boolean startClosed = false; String tmid = null; long tts = 0; boolean endClosed = false; if (null != interval.startIntervalBound) { mid = interval.startIntervalBound.messageId; ts = interval.startIntervalBound.timestamp; startClosed = interval.startIntervalBound.closed; } if (null != interval.endIntervalBound) { tmid = interval.endIntervalBound.messageId; tts = interval.endIntervalBound.timestamp; endClosed = interval.endIntervalBound.closed; } queryMessagesFromServer(mid, ts, startClosed, tmid, tts, endClosed, direction, limit, callback); }
[ "public", "void", "queryMessages", "(", "final", "AVIMMessageInterval", "interval", ",", "AVIMMessageQueryDirection", "direction", ",", "final", "int", "limit", ",", "final", "AVIMMessagesQueryCallback", "callback", ")", "{", "if", "(", "null", "==", "interval", "||...
根据指定的区间来查询历史消息,可以指定区间开闭、查询方向以及最大条目限制 @param interval - 区间,由起止 AVIMMessageIntervalBound 组成 @param direction - 查询方向,支持向前(AVIMMessageQueryDirection.AVIMMessageQueryDirectionFromNewToOld) 或向后(AVIMMessageQueryDirection.AVIMMessageQueryDirectionFromOldToNew)查询 @param limit - 结果最大条目限制 @param callback - 结果回调函数
[ "根据指定的区间来查询历史消息,可以指定区间开闭、查询方向以及最大条目限制" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java#L1094-L1120
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigServerFactory.java
XMLConfigServerFactory.reloadInstance
public static void reloadInstance(CFMLEngine engine, ConfigServerImpl configServer) throws SAXException, ClassException, PageException, IOException, TagLibException, FunctionLibException, BundleException { Resource configFile = configServer.getConfigFile(); if (configFile == null) return; if (second(configServer.getLoadTime()) > second(configFile.lastModified())) return; int iDoNew = doNew(engine, configServer.getConfigDir(), false).updateType; boolean doNew = iDoNew != NEW_NONE; load(configServer, loadDocument(configFile), true, doNew); ((CFMLEngineImpl) ConfigWebUtil.getEngine(configServer)).onStart(configServer, true); }
java
public static void reloadInstance(CFMLEngine engine, ConfigServerImpl configServer) throws SAXException, ClassException, PageException, IOException, TagLibException, FunctionLibException, BundleException { Resource configFile = configServer.getConfigFile(); if (configFile == null) return; if (second(configServer.getLoadTime()) > second(configFile.lastModified())) return; int iDoNew = doNew(engine, configServer.getConfigDir(), false).updateType; boolean doNew = iDoNew != NEW_NONE; load(configServer, loadDocument(configFile), true, doNew); ((CFMLEngineImpl) ConfigWebUtil.getEngine(configServer)).onStart(configServer, true); }
[ "public", "static", "void", "reloadInstance", "(", "CFMLEngine", "engine", ",", "ConfigServerImpl", "configServer", ")", "throws", "SAXException", ",", "ClassException", ",", "PageException", ",", "IOException", ",", "TagLibException", ",", "FunctionLibException", ",", ...
reloads the Config Object @param configServer @throws SAXException @throws ClassNotFoundException @throws PageException @throws IOException @throws TagLibException @throws FunctionLibException @throws BundleException
[ "reloads", "the", "Config", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigServerFactory.java#L135-L147
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/util/InternetPrintWriter.java
InternetPrintWriter.createForEncoding
public static InternetPrintWriter createForEncoding(OutputStream outputStream, boolean autoFlush, Charset charset) { return new InternetPrintWriter(new OutputStreamWriter(outputStream, charset), autoFlush); }
java
public static InternetPrintWriter createForEncoding(OutputStream outputStream, boolean autoFlush, Charset charset) { return new InternetPrintWriter(new OutputStreamWriter(outputStream, charset), autoFlush); }
[ "public", "static", "InternetPrintWriter", "createForEncoding", "(", "OutputStream", "outputStream", ",", "boolean", "autoFlush", ",", "Charset", "charset", ")", "{", "return", "new", "InternetPrintWriter", "(", "new", "OutputStreamWriter", "(", "outputStream", ",", "...
Creates a new InternetPrintWriter for given charset encoding. @param outputStream the wrapped output stream. @param charset the charset. @return a new InternetPrintWriter.
[ "Creates", "a", "new", "InternetPrintWriter", "for", "given", "charset", "encoding", "." ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/InternetPrintWriter.java#L79-L81
alkacon/opencms-core
src/org/opencms/i18n/CmsMessages.java
CmsMessages.getDate
public String getDate(Date date, int format) { return CmsDateUtil.getDate(date, format, m_locale); }
java
public String getDate(Date date, int format) { return CmsDateUtil.getDate(date, format, m_locale); }
[ "public", "String", "getDate", "(", "Date", "date", ",", "int", "format", ")", "{", "return", "CmsDateUtil", ".", "getDate", "(", "date", ",", "format", ",", "m_locale", ")", ";", "}" ]
Returns a formated date String from a Date value, the formatting based on the provided option and the locale based on this instance.<p> @param date the Date object to format as String @param format the format to use, see {@link CmsMessages} for possible values @return the formatted date
[ "Returns", "a", "formated", "date", "String", "from", "a", "Date", "value", "the", "formatting", "based", "on", "the", "provided", "option", "and", "the", "locale", "based", "on", "this", "instance", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsMessages.java#L232-L235
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageManager.java
ImageManager.createImage
public BufferedImage createImage (int width, int height, int transparency) { return _icreator.createImage(width, height, transparency); }
java
public BufferedImage createImage (int width, int height, int transparency) { return _icreator.createImage(width, height, transparency); }
[ "public", "BufferedImage", "createImage", "(", "int", "width", ",", "int", "height", ",", "int", "transparency", ")", "{", "return", "_icreator", ".", "createImage", "(", "width", ",", "height", ",", "transparency", ")", ";", "}" ]
Creates a buffered image, optimized for display on our graphics device.
[ "Creates", "a", "buffered", "image", "optimized", "for", "display", "on", "our", "graphics", "device", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L164-L167
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.notNull
public static void notNull(Object obj, String message, Object... arguments) { notNull(obj, new IllegalArgumentException(format(message, arguments))); }
java
public static void notNull(Object obj, String message, Object... arguments) { notNull(obj, new IllegalArgumentException(format(message, arguments))); }
[ "public", "static", "void", "notNull", "(", "Object", "obj", ",", "String", "message", ",", "Object", "...", "arguments", ")", "{", "notNull", "(", "obj", ",", "new", "IllegalArgumentException", "(", "format", "(", "message", ",", "arguments", ")", ")", ")...
Asserts that the {@link Object} reference is not {@literal null}. The assertion holds if and only if the {@link Object} reference is not {@literal null}. @param obj {@link Object} reference to evaluate. @param message {@link String} containing the message using in the {@link NullPointerException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalArgumentException if the {@link Object} reference is {@literal null}. @see #notNull(Object, RuntimeException) @see java.lang.Object
[ "Asserts", "that", "the", "{", "@link", "Object", "}", "reference", "is", "not", "{", "@literal", "null", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L1192-L1194
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.unprotectedRenameTo
boolean unprotectedRenameTo(String src, String dst, long timestamp) throws QuotaExceededException { return unprotectedRenameTo(src, null, null, null, dst, null, null, timestamp); }
java
boolean unprotectedRenameTo(String src, String dst, long timestamp) throws QuotaExceededException { return unprotectedRenameTo(src, null, null, null, dst, null, null, timestamp); }
[ "boolean", "unprotectedRenameTo", "(", "String", "src", ",", "String", "dst", ",", "long", "timestamp", ")", "throws", "QuotaExceededException", "{", "return", "unprotectedRenameTo", "(", "src", ",", "null", ",", "null", ",", "null", ",", "dst", ",", "null", ...
Change a path name @param src source path @param dst destination path @return true if rename succeeds; false otherwise @throws QuotaExceededException if the operation violates any quota limit
[ "Change", "a", "path", "name" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L849-L852
alkacon/opencms-core
src/org/opencms/ui/apps/CmsSitemapEditorConfiguration.java
CmsSitemapEditorConfiguration.getPath
private String getPath(CmsObject cms, HttpSession session) { CmsQuickLaunchLocationCache locationCache = CmsQuickLaunchLocationCache.getLocationCache(session); String page = locationCache.getFileExplorerLocation(cms.getRequestContext().getSiteRoot()); if (page != null) { CmsADEConfigData conf = OpenCms.getADEManager().lookupConfiguration( cms, cms.getRequestContext().addSiteRoot(page)); if ((conf == null) || (conf.getBasePath() == null)) { page = null; } else { page = cms.getRequestContext().removeSiteRoot(conf.getBasePath()); } } if (page == null) { page = locationCache.getSitemapEditorLocation(cms.getRequestContext().getSiteRoot()); } return page; }
java
private String getPath(CmsObject cms, HttpSession session) { CmsQuickLaunchLocationCache locationCache = CmsQuickLaunchLocationCache.getLocationCache(session); String page = locationCache.getFileExplorerLocation(cms.getRequestContext().getSiteRoot()); if (page != null) { CmsADEConfigData conf = OpenCms.getADEManager().lookupConfiguration( cms, cms.getRequestContext().addSiteRoot(page)); if ((conf == null) || (conf.getBasePath() == null)) { page = null; } else { page = cms.getRequestContext().removeSiteRoot(conf.getBasePath()); } } if (page == null) { page = locationCache.getSitemapEditorLocation(cms.getRequestContext().getSiteRoot()); } return page; }
[ "private", "String", "getPath", "(", "CmsObject", "cms", ",", "HttpSession", "session", ")", "{", "CmsQuickLaunchLocationCache", "locationCache", "=", "CmsQuickLaunchLocationCache", ".", "getLocationCache", "(", "session", ")", ";", "String", "page", "=", "locationCac...
Returns the page editor path to open.<p> @param cms the cms context @param session the user session @return the path or <code>null</code>
[ "Returns", "the", "page", "editor", "path", "to", "open", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsSitemapEditorConfiguration.java#L228-L246
icode/ameba-utils
src/main/java/ameba/util/Assert.java
Assert.isEmpty
public static void isEmpty(String text, String message) { if (StringUtils.isEmpty(text)) { throw new IllegalArgumentException(message); } }
java
public static void isEmpty(String text, String message) { if (StringUtils.isEmpty(text)) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "isEmpty", "(", "String", "text", ",", "String", "message", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "text", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that the given String has valid text content; that is, it must not be {@code null} and must contain at least one non-whitespace character. <pre class="code">Assert.hasText(name, "'name' must not be empty");</pre> @param text the String to check @param message the exception message to use if the assertion fails @see org.apache.commons.lang3.StringUtils#isEmpty
[ "Assert", "that", "the", "given", "String", "has", "valid", "text", "content", ";", "that", "is", "it", "must", "not", "be", "{", "@code", "null", "}", "and", "must", "contain", "at", "least", "one", "non", "-", "whitespace", "character", ".", "<pre", ...
train
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/Assert.java#L156-L160
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java
ApplicationUrl.getAppVersionsUrl
public static MozuUrl getAppVersionsUrl(String nsAndAppId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/developer/applications/versions/{nsAndAppId}?responseFields={responseFields}"); formatter.formatUrl("nsAndAppId", nsAndAppId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
java
public static MozuUrl getAppVersionsUrl(String nsAndAppId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/developer/applications/versions/{nsAndAppId}?responseFields={responseFields}"); formatter.formatUrl("nsAndAppId", nsAndAppId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
[ "public", "static", "MozuUrl", "getAppVersionsUrl", "(", "String", "nsAndAppId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/developer/applications/versions/{nsAndAppId}?responseFields={responseFields}\...
Get Resource Url for GetAppVersions @param nsAndAppId The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetAppVersions" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java#L36-L42
baratine/baratine
core/src/main/java/com/caucho/v5/util/LruCache.java
LruCache.compareAndPut
public boolean compareAndPut(V testValue, K key, V value) { V result = compareAndPut(testValue, key, value, true); return testValue == result; }
java
public boolean compareAndPut(V testValue, K key, V value) { V result = compareAndPut(testValue, key, value, true); return testValue == result; }
[ "public", "boolean", "compareAndPut", "(", "V", "testValue", ",", "K", "key", ",", "V", "value", ")", "{", "V", "result", "=", "compareAndPut", "(", "testValue", ",", "key", ",", "value", ",", "true", ")", ";", "return", "testValue", "==", "result", ";...
Puts a new item in the cache if the current value matches oldValue. @param key the key @param value the new value @param testValue the value to test against the current @return true if the put succeeds
[ "Puts", "a", "new", "item", "in", "the", "cache", "if", "the", "current", "value", "matches", "oldValue", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/LruCache.java#L302-L307
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/JMStats.java
JMStats.calPercent
public static String calPercent(Number target, Number total, int digit) { return JMString.roundedNumberFormat(calPercentPrecisely(target, total), digit); }
java
public static String calPercent(Number target, Number total, int digit) { return JMString.roundedNumberFormat(calPercentPrecisely(target, total), digit); }
[ "public", "static", "String", "calPercent", "(", "Number", "target", ",", "Number", "total", ",", "int", "digit", ")", "{", "return", "JMString", ".", "roundedNumberFormat", "(", "calPercentPrecisely", "(", "target", ",", "total", ")", ",", "digit", ")", ";"...
Cal percent string. @param target the target @param total the total @param digit the digit @return the string
[ "Cal", "percent", "string", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/JMStats.java#L244-L247
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.deserializeWriterFilePermissions
public static FsPermission deserializeWriterFilePermissions(State state, int numBranches, int branchId) { return new FsPermission(state.getPropAsShortWithRadix( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_FILE_PERMISSIONS, numBranches, branchId), FsPermission.getDefault().toShort(), ConfigurationKeys.PERMISSION_PARSING_RADIX)); }
java
public static FsPermission deserializeWriterFilePermissions(State state, int numBranches, int branchId) { return new FsPermission(state.getPropAsShortWithRadix( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_FILE_PERMISSIONS, numBranches, branchId), FsPermission.getDefault().toShort(), ConfigurationKeys.PERMISSION_PARSING_RADIX)); }
[ "public", "static", "FsPermission", "deserializeWriterFilePermissions", "(", "State", "state", ",", "int", "numBranches", ",", "int", "branchId", ")", "{", "return", "new", "FsPermission", "(", "state", ".", "getPropAsShortWithRadix", "(", "ForkOperatorUtils", ".", ...
Deserializes a {@link FsPermission}s object that should be used when a {@link DataWriter} is writing a file.
[ "Deserializes", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L885-L889
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/Drawer.java
Drawer.setToolbar
public void setToolbar(@NonNull Activity activity, @NonNull Toolbar toolbar) { setToolbar(activity, toolbar, false); }
java
public void setToolbar(@NonNull Activity activity, @NonNull Toolbar toolbar) { setToolbar(activity, toolbar, false); }
[ "public", "void", "setToolbar", "(", "@", "NonNull", "Activity", "activity", ",", "@", "NonNull", "Toolbar", "toolbar", ")", "{", "setToolbar", "(", "activity", ",", "toolbar", ",", "false", ")", ";", "}" ]
Sets the toolbar which should be used in combination with the drawer This will handle the ActionBarDrawerToggle for you. Do not set this if you are in a sub activity and want to handle the back arrow on your own @param activity @param toolbar the toolbar which is used in combination with the drawer
[ "Sets", "the", "toolbar", "which", "should", "be", "used", "in", "combination", "with", "the", "drawer", "This", "will", "handle", "the", "ActionBarDrawerToggle", "for", "you", ".", "Do", "not", "set", "this", "if", "you", "are", "in", "a", "sub", "activit...
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L100-L102
googleads/googleads-java-lib
examples/adwords_axis/src/main/java/adwords/axis/v201809/basicoperations/UpdateKeyword.java
UpdateKeyword.runExample
public static void runExample( AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId, Long keywordId) throws RemoteException { // Get the AdGroupCriterionService. AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices.get(session, AdGroupCriterionServiceInterface.class); // Create ad group criterion with updated bid. Criterion criterion = new Criterion(); criterion.setId(keywordId); BiddableAdGroupCriterion biddableAdGroupCriterion = new BiddableAdGroupCriterion(); biddableAdGroupCriterion.setAdGroupId(adGroupId); biddableAdGroupCriterion.setCriterion(criterion); // Create bids. BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration(); CpcBid bid = new CpcBid(); bid.setBid(new Money(null, 10000000L)); biddingStrategyConfiguration.setBids(new Bids[] {bid}); biddableAdGroupCriterion.setBiddingStrategyConfiguration(biddingStrategyConfiguration); // Create operations. AdGroupCriterionOperation operation = new AdGroupCriterionOperation(); operation.setOperand(biddableAdGroupCriterion); operation.setOperator(Operator.SET); AdGroupCriterionOperation[] operations = new AdGroupCriterionOperation[] {operation}; // Update ad group criteria. AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(operations); // Display ad group criteria. for (AdGroupCriterion adGroupCriterionResult : result.getValue()) { if (adGroupCriterionResult instanceof BiddableAdGroupCriterion) { biddableAdGroupCriterion = (BiddableAdGroupCriterion) adGroupCriterionResult; CpcBid criterionCpcBid = null; // Find the criterion-level CpcBid among the keyword's bids. for (Bids bids : biddableAdGroupCriterion.getBiddingStrategyConfiguration().getBids()) { if (bids instanceof CpcBid) { CpcBid cpcBid = (CpcBid) bids; if (BidSource.CRITERION.equals(cpcBid.getCpcBidSource())) { criterionCpcBid = cpcBid; } } } System.out.printf( "Ad group criterion with ad group ID %d, criterion ID %d, type " + "'%s', and bid %d was updated.%n", biddableAdGroupCriterion.getAdGroupId(), biddableAdGroupCriterion.getCriterion().getId(), biddableAdGroupCriterion.getCriterion().getCriterionType(), criterionCpcBid.getBid().getMicroAmount()); } } }
java
public static void runExample( AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId, Long keywordId) throws RemoteException { // Get the AdGroupCriterionService. AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices.get(session, AdGroupCriterionServiceInterface.class); // Create ad group criterion with updated bid. Criterion criterion = new Criterion(); criterion.setId(keywordId); BiddableAdGroupCriterion biddableAdGroupCriterion = new BiddableAdGroupCriterion(); biddableAdGroupCriterion.setAdGroupId(adGroupId); biddableAdGroupCriterion.setCriterion(criterion); // Create bids. BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration(); CpcBid bid = new CpcBid(); bid.setBid(new Money(null, 10000000L)); biddingStrategyConfiguration.setBids(new Bids[] {bid}); biddableAdGroupCriterion.setBiddingStrategyConfiguration(biddingStrategyConfiguration); // Create operations. AdGroupCriterionOperation operation = new AdGroupCriterionOperation(); operation.setOperand(biddableAdGroupCriterion); operation.setOperator(Operator.SET); AdGroupCriterionOperation[] operations = new AdGroupCriterionOperation[] {operation}; // Update ad group criteria. AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(operations); // Display ad group criteria. for (AdGroupCriterion adGroupCriterionResult : result.getValue()) { if (adGroupCriterionResult instanceof BiddableAdGroupCriterion) { biddableAdGroupCriterion = (BiddableAdGroupCriterion) adGroupCriterionResult; CpcBid criterionCpcBid = null; // Find the criterion-level CpcBid among the keyword's bids. for (Bids bids : biddableAdGroupCriterion.getBiddingStrategyConfiguration().getBids()) { if (bids instanceof CpcBid) { CpcBid cpcBid = (CpcBid) bids; if (BidSource.CRITERION.equals(cpcBid.getCpcBidSource())) { criterionCpcBid = cpcBid; } } } System.out.printf( "Ad group criterion with ad group ID %d, criterion ID %d, type " + "'%s', and bid %d was updated.%n", biddableAdGroupCriterion.getAdGroupId(), biddableAdGroupCriterion.getCriterion().getId(), biddableAdGroupCriterion.getCriterion().getCriterionType(), criterionCpcBid.getBid().getMicroAmount()); } } }
[ "public", "static", "void", "runExample", "(", "AdWordsServicesInterface", "adWordsServices", ",", "AdWordsSession", "session", ",", "Long", "adGroupId", ",", "Long", "keywordId", ")", "throws", "RemoteException", "{", "// Get the AdGroupCriterionService.", "AdGroupCriterio...
Runs the example. @param adWordsServices the services factory. @param session the session. @param adGroupId the ID of the ad group for the criterion. @param keywordId the ID of the criterion to update. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/basicoperations/UpdateKeyword.java#L139-L198
SeleniumJT/seleniumjt-core
src/main/java/com/jt/selenium/SeleniumJT.java
SeleniumJT.verifyImageSource
@LogExecTime public void verifyImageSource(String locator, String src) { jtImage.verifyImageSource(locator, src); }
java
@LogExecTime public void verifyImageSource(String locator, String src) { jtImage.verifyImageSource(locator, src); }
[ "@", "LogExecTime", "public", "void", "verifyImageSource", "(", "String", "locator", ",", "String", "src", ")", "{", "jtImage", ".", "verifyImageSource", "(", "locator", ",", "src", ")", ";", "}" ]
Verify that the src of the image [identified by it's id] is correct @param locator @param src
[ "Verify", "that", "the", "src", "of", "the", "image", "[", "identified", "by", "it", "s", "id", "]", "is", "correct" ]
train
https://github.com/SeleniumJT/seleniumjt-core/blob/8e972f69adc4846a3f1d7b8ca9c3f8d953a2d0f3/src/main/java/com/jt/selenium/SeleniumJT.java#L171-L175
soi-toolkit/soi-toolkit-mule
commons/components/studio-components/src/main/java/org/soitoolkit/commons/studio/components/logger/LoggerModule.java
LoggerModule.logTrace
@Processor public Object logTrace( @Optional @FriendlyName("Log Message") String message, @Optional String integrationScenario, @Optional String messageType, @Optional String contractId, @Optional String correlationId, @Optional @FriendlyName("Extra Info") Map<String, String> extraInfo) { return doLog(LogLevelType.TRACE, message, integrationScenario, contractId, correlationId, extraInfo); }
java
@Processor public Object logTrace( @Optional @FriendlyName("Log Message") String message, @Optional String integrationScenario, @Optional String messageType, @Optional String contractId, @Optional String correlationId, @Optional @FriendlyName("Extra Info") Map<String, String> extraInfo) { return doLog(LogLevelType.TRACE, message, integrationScenario, contractId, correlationId, extraInfo); }
[ "@", "Processor", "public", "Object", "logTrace", "(", "@", "Optional", "@", "FriendlyName", "(", "\"Log Message\"", ")", "String", "message", ",", "@", "Optional", "String", "integrationScenario", ",", "@", "Optional", "String", "messageType", ",", "@", "Option...
Log processor for level TRACE {@sample.xml ../../../doc/soitoolkit-connector.xml.sample soitoolkit:log-trace} @param message Log-message to be processed @param integrationScenario Optional name of the integration scenario or business process @param messageType Optional name of the message type, e.g. a XML Schema namespace for a XML payload @param contractId Optional name of the contract in use @param correlationId Optional correlation identity of the message @param extraInfo Optional extra info @return The incoming payload
[ "Log", "processor", "for", "level", "TRACE" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/studio-components/src/main/java/org/soitoolkit/commons/studio/components/logger/LoggerModule.java#L302-L312
jfoenixadmin/JFoenix
jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java
JFXTreeTableView.buildGroupedRoot
private void buildGroupedRoot(Map<?,?> groupedItems, RecursiveTreeItem parent, int groupIndex) { boolean setRoot = false; if (parent == null) { parent = new RecursiveTreeItem<>(new RecursiveTreeObject(), RecursiveTreeObject::getChildren); setRoot = true; } for (Map.Entry<?, ?> entry : groupedItems.entrySet()) { Object key = entry.getKey(); RecursiveTreeObject groupItem = new RecursiveTreeObject<>(); groupItem.setGroupedValue(key); groupItem.setGroupedColumn(groupOrder.get(groupIndex)); RecursiveTreeItem node = new RecursiveTreeItem<>(groupItem, RecursiveTreeObject::getChildren); // TODO: need to be removed once the selection issue is fixed node.expandedProperty().addListener((o, oldVal, newVal) -> { getSelectionModel().clearSelection(); }); parent.originalItems.add(node); parent.getChildren().add(node); Object children = entry.getValue(); if (children instanceof List) { node.originalItems.addAll((List) children); node.getChildren().addAll((List) children); } else if (children instanceof Map) { buildGroupedRoot((Map) children, node, groupIndex + 1); } } // update ui if (setRoot) { final RecursiveTreeItem<S> newParent = parent; JFXUtilities.runInFX(() -> { ArrayList<TreeTableColumn<S, ?>> sortOrder = new ArrayList<>(); sortOrder.addAll(getSortOrder()); internalSetRoot = true; setRoot(newParent); internalSetRoot = false; getSortOrder().addAll(sortOrder); getSelectionModel().select(0); }); } }
java
private void buildGroupedRoot(Map<?,?> groupedItems, RecursiveTreeItem parent, int groupIndex) { boolean setRoot = false; if (parent == null) { parent = new RecursiveTreeItem<>(new RecursiveTreeObject(), RecursiveTreeObject::getChildren); setRoot = true; } for (Map.Entry<?, ?> entry : groupedItems.entrySet()) { Object key = entry.getKey(); RecursiveTreeObject groupItem = new RecursiveTreeObject<>(); groupItem.setGroupedValue(key); groupItem.setGroupedColumn(groupOrder.get(groupIndex)); RecursiveTreeItem node = new RecursiveTreeItem<>(groupItem, RecursiveTreeObject::getChildren); // TODO: need to be removed once the selection issue is fixed node.expandedProperty().addListener((o, oldVal, newVal) -> { getSelectionModel().clearSelection(); }); parent.originalItems.add(node); parent.getChildren().add(node); Object children = entry.getValue(); if (children instanceof List) { node.originalItems.addAll((List) children); node.getChildren().addAll((List) children); } else if (children instanceof Map) { buildGroupedRoot((Map) children, node, groupIndex + 1); } } // update ui if (setRoot) { final RecursiveTreeItem<S> newParent = parent; JFXUtilities.runInFX(() -> { ArrayList<TreeTableColumn<S, ?>> sortOrder = new ArrayList<>(); sortOrder.addAll(getSortOrder()); internalSetRoot = true; setRoot(newParent); internalSetRoot = false; getSortOrder().addAll(sortOrder); getSelectionModel().select(0); }); } }
[ "private", "void", "buildGroupedRoot", "(", "Map", "<", "?", ",", "?", ">", "groupedItems", ",", "RecursiveTreeItem", "parent", ",", "int", "groupIndex", ")", "{", "boolean", "setRoot", "=", "false", ";", "if", "(", "parent", "==", "null", ")", "{", "par...
/* this method is used to update tree items and set the new root after grouping the data model
[ "/", "*", "this", "method", "is", "used", "to", "update", "tree", "items", "and", "set", "the", "new", "root", "after", "grouping", "the", "data", "model" ]
train
https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXTreeTableView.java#L316-L360
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/TokenizerBase.java
TokenizerBase.createTokenList
protected <T extends TokenBase> List<T> createTokenList(String text) { if (!split) { return createTokenList(0, text); } List<Integer> splitPositions = getSplitPositions(text); if (splitPositions.isEmpty()) { return createTokenList(0, text); } ArrayList<T> result = new ArrayList<>(); int offset = 0; for (int position : splitPositions) { result.addAll(this.<T>createTokenList(offset, text.substring(offset, position + 1))); offset = position + 1; } if (offset < text.length()) { result.addAll(this.<T>createTokenList(offset, text.substring(offset))); } return result; }
java
protected <T extends TokenBase> List<T> createTokenList(String text) { if (!split) { return createTokenList(0, text); } List<Integer> splitPositions = getSplitPositions(text); if (splitPositions.isEmpty()) { return createTokenList(0, text); } ArrayList<T> result = new ArrayList<>(); int offset = 0; for (int position : splitPositions) { result.addAll(this.<T>createTokenList(offset, text.substring(offset, position + 1))); offset = position + 1; } if (offset < text.length()) { result.addAll(this.<T>createTokenList(offset, text.substring(offset))); } return result; }
[ "protected", "<", "T", "extends", "TokenBase", ">", "List", "<", "T", ">", "createTokenList", "(", "String", "text", ")", "{", "if", "(", "!", "split", ")", "{", "return", "createTokenList", "(", "0", ",", "text", ")", ";", "}", "List", "<", "Integer...
Tokenizes the provided text and returns a list of tokens with various feature information <p> This method is thread safe @param text text to tokenize @param <T> token type @return list of Token, not null
[ "Tokenizes", "the", "provided", "text", "and", "returns", "a", "list", "of", "tokens", "with", "various", "feature", "information", "<p", ">", "This", "method", "is", "thread", "safe" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/TokenizerBase.java#L104-L130
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java
PoolablePreparedStatement.setClob
@Override public void setClob(int parameterIndex, Reader reader) throws SQLException { internalStmt.setClob(parameterIndex, reader); }
java
@Override public void setClob(int parameterIndex, Reader reader) throws SQLException { internalStmt.setClob(parameterIndex, reader); }
[ "@", "Override", "public", "void", "setClob", "(", "int", "parameterIndex", ",", "Reader", "reader", ")", "throws", "SQLException", "{", "internalStmt", ".", "setClob", "(", "parameterIndex", ",", "reader", ")", ";", "}" ]
Method setClob. @param parameterIndex @param reader @throws SQLException @see java.sql.PreparedStatement#setClob(int, Reader)
[ "Method", "setClob", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L684-L687
grails/grails-core
grails-core/src/main/groovy/grails/util/CacheEntry.java
CacheEntry.getValue
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K, V> V getValue(ConcurrentMap<K, CacheEntry<V>> map, K key, long timeoutMillis, Callable<V> updater, Callable<? extends CacheEntry> cacheEntryFactory, boolean returnExpiredWhileUpdating, Object cacheRequestObject) { CacheEntry<V> cacheEntry = map.get(key); if(cacheEntry==null) { try { cacheEntry = cacheEntryFactory.call(); } catch (Exception e) { throw new UpdateException(e); } CacheEntry<V> previousEntry = map.putIfAbsent(key, cacheEntry); if(previousEntry != null) { cacheEntry = previousEntry; } } try { return cacheEntry.getValue(timeoutMillis, updater, returnExpiredWhileUpdating, cacheRequestObject); } catch (UpdateException e) { e.rethrowRuntimeException(); // make compiler happy return null; } }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <K, V> V getValue(ConcurrentMap<K, CacheEntry<V>> map, K key, long timeoutMillis, Callable<V> updater, Callable<? extends CacheEntry> cacheEntryFactory, boolean returnExpiredWhileUpdating, Object cacheRequestObject) { CacheEntry<V> cacheEntry = map.get(key); if(cacheEntry==null) { try { cacheEntry = cacheEntryFactory.call(); } catch (Exception e) { throw new UpdateException(e); } CacheEntry<V> previousEntry = map.putIfAbsent(key, cacheEntry); if(previousEntry != null) { cacheEntry = previousEntry; } } try { return cacheEntry.getValue(timeoutMillis, updater, returnExpiredWhileUpdating, cacheRequestObject); } catch (UpdateException e) { e.rethrowRuntimeException(); // make compiler happy return null; } }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "static", "<", "K", ",", "V", ">", "V", "getValue", "(", "ConcurrentMap", "<", "K", ",", "CacheEntry", "<", "V", ">", ">", "map", ",", "K", "key", ",", "long...
Gets a value from cache. If the key doesn't exist, it will create the value using the updater callback Prevents cache storms with a lock The key is always added to the cache. Null return values will also be cached. You can use this together with ConcurrentLinkedHashMap to create a bounded LRU cache @param map the cache map @param key the key to look up @param timeoutMillis cache entry timeout @param updater callback to create/update value @param cacheEntryClass CacheEntry implementation class to use @param returnExpiredWhileUpdating when true, return expired value while updating new value @param cacheRequestObject context object that gets passed to hasExpired, shouldUpdate and updateValue methods, not used in default implementation @return
[ "Gets", "a", "value", "from", "cache", ".", "If", "the", "key", "doesn", "t", "exist", "it", "will", "create", "the", "value", "using", "the", "updater", "callback", "Prevents", "cache", "storms", "with", "a", "lock" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/CacheEntry.java#L72-L95
quattor/pan
panc/src/main/java/org/quattor/pan/CompilerOptions.java
CompilerOptions.checkDirectory
private void checkDirectory(File d, String dtype) { if (!d.isAbsolute()) { throw new IllegalArgumentException(dtype + " directory must be an absolute path (" + d.getPath() + ")"); } if (!d.exists()) { throw new IllegalArgumentException(dtype + " directory does not exist (" + d.getPath() + ")"); } if (!d.isDirectory()) { throw new IllegalArgumentException(dtype + " directory value is not a directory (" + d.getPath() + ")"); } }
java
private void checkDirectory(File d, String dtype) { if (!d.isAbsolute()) { throw new IllegalArgumentException(dtype + " directory must be an absolute path (" + d.getPath() + ")"); } if (!d.exists()) { throw new IllegalArgumentException(dtype + " directory does not exist (" + d.getPath() + ")"); } if (!d.isDirectory()) { throw new IllegalArgumentException(dtype + " directory value is not a directory (" + d.getPath() + ")"); } }
[ "private", "void", "checkDirectory", "(", "File", "d", ",", "String", "dtype", ")", "{", "if", "(", "!", "d", ".", "isAbsolute", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "dtype", "+", "\" directory must be an absolute path (\"", "+"...
A private utility function to verify that the directory is really a directory, exists, and absolute. @param dirs directory to check @param dtype name to use in case of errors
[ "A", "private", "utility", "function", "to", "verify", "that", "the", "directory", "is", "really", "a", "directory", "exists", "and", "absolute", "." ]
train
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/CompilerOptions.java#L378-L393
pierre/serialization
hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/SmileStorage.java
SmileStorage.getSchema
@Override public ResourceSchema getSchema(final String location, final Job job) throws IOException { final List<Schema.FieldSchema> schemaList = new ArrayList<Schema.FieldSchema>(); for (final GoodwillSchemaField field : schema.getSchema()) { schemaList.add(new Schema.FieldSchema(field.getName(), getPigType(field.getType()))); } return new ResourceSchema(new Schema(schemaList)); }
java
@Override public ResourceSchema getSchema(final String location, final Job job) throws IOException { final List<Schema.FieldSchema> schemaList = new ArrayList<Schema.FieldSchema>(); for (final GoodwillSchemaField field : schema.getSchema()) { schemaList.add(new Schema.FieldSchema(field.getName(), getPigType(field.getType()))); } return new ResourceSchema(new Schema(schemaList)); }
[ "@", "Override", "public", "ResourceSchema", "getSchema", "(", "final", "String", "location", ",", "final", "Job", "job", ")", "throws", "IOException", "{", "final", "List", "<", "Schema", ".", "FieldSchema", ">", "schemaList", "=", "new", "ArrayList", "<", ...
Get a schema for the data to be loaded. @param location Location as returned by {@link org.apache.pig.LoadFunc#relativeToAbsolutePath(String, org.apache.hadoop.fs.Path)} @param job The {@link org.apache.hadoop.mapreduce.Job} object - this should be used only to obtain cluster properties through {@link org.apache.hadoop.mapreduce.Job#getConfiguration()} and not to set/query any runtime job information. @return schema for the data to be loaded. This schema should represent all tuples of the returned data. If the schema is unknown or it is not possible to return a schema that represents all returned data, then null should be returned. The schema should not be affected by pushProjection, ie. getSchema should always return the original schema even after pushProjection @throws java.io.IOException if an exception occurs while determining the schema
[ "Get", "a", "schema", "for", "the", "data", "to", "be", "loaded", "." ]
train
https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/SmileStorage.java#L264-L273
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/requests/RestAction.java
RestAction.queueAfter
public ScheduledFuture<?> queueAfter(long delay, TimeUnit unit, ScheduledExecutorService executor) { return queueAfter(delay, unit, null, executor); }
java
public ScheduledFuture<?> queueAfter(long delay, TimeUnit unit, ScheduledExecutorService executor) { return queueAfter(delay, unit, null, executor); }
[ "public", "ScheduledFuture", "<", "?", ">", "queueAfter", "(", "long", "delay", ",", "TimeUnit", "unit", ",", "ScheduledExecutorService", "executor", ")", "{", "return", "queueAfter", "(", "delay", ",", "unit", ",", "null", ",", "executor", ")", ";", "}" ]
Schedules a call to {@link #queue()} to be executed after the specified {@code delay}. <br>This is an <b>asynchronous</b> operation that will return a {@link java.util.concurrent.ScheduledFuture ScheduledFuture} representing the task. <p>This operation gives no access to the response value. <br>Use {@link #queueAfter(long, java.util.concurrent.TimeUnit, java.util.function.Consumer)} to access the success consumer for {@link #queue(java.util.function.Consumer)}! <p>The specified {@link java.util.concurrent.ScheduledExecutorService ScheduledExecutorService} is used for this operation. @param delay The delay after which this computation should be executed, negative to execute immediately @param unit The {@link java.util.concurrent.TimeUnit TimeUnit} to convert the specified {@code delay} @param executor The Non-null {@link java.util.concurrent.ScheduledExecutorService ScheduledExecutorService} that should be used to schedule this operation @throws java.lang.IllegalArgumentException If the provided TimeUnit or ScheduledExecutorService is {@code null} @return {@link java.util.concurrent.ScheduledFuture ScheduledFuture} representing the delayed operation
[ "Schedules", "a", "call", "to", "{", "@link", "#queue", "()", "}", "to", "be", "executed", "after", "the", "specified", "{", "@code", "delay", "}", ".", "<br", ">", "This", "is", "an", "<b", ">", "asynchronous<", "/", "b", ">", "operation", "that", "...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/RestAction.java#L661-L664
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java
ComputeNodesImpl.listAsync
public ServiceFuture<List<ComputeNode>> listAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions, final ListOperationCallback<ComputeNode> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listSinglePageAsync(poolId, computeNodeListOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>> call(String nextPageLink) { ComputeNodeListNextOptions computeNodeListNextOptions = null; if (computeNodeListOptions != null) { computeNodeListNextOptions = new ComputeNodeListNextOptions(); computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId()); computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId()); computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate()); } return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<ComputeNode>> listAsync(final String poolId, final ComputeNodeListOptions computeNodeListOptions, final ListOperationCallback<ComputeNode> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listSinglePageAsync(poolId, computeNodeListOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<ComputeNode>, ComputeNodeListHeaders>> call(String nextPageLink) { ComputeNodeListNextOptions computeNodeListNextOptions = null; if (computeNodeListOptions != null) { computeNodeListNextOptions = new ComputeNodeListNextOptions(); computeNodeListNextOptions.withClientRequestId(computeNodeListOptions.clientRequestId()); computeNodeListNextOptions.withReturnClientRequestId(computeNodeListOptions.returnClientRequestId()); computeNodeListNextOptions.withOcpDate(computeNodeListOptions.ocpDate()); } return listNextSinglePageAsync(nextPageLink, computeNodeListNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "ComputeNode", ">", ">", "listAsync", "(", "final", "String", "poolId", ",", "final", "ComputeNodeListOptions", "computeNodeListOptions", ",", "final", "ListOperationCallback", "<", "ComputeNode", ">", "serviceCallback", ")...
Lists the compute nodes in the specified pool. @param poolId The ID of the pool from which you want to list nodes. @param computeNodeListOptions Additional parameters for the operation @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Lists", "the", "compute", "nodes", "in", "the", "specified", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L2752-L2769
alkacon/opencms-core
src/org/opencms/xml/CmsXmlEntityResolver.java
CmsXmlEntityResolver.createInputSource
InputSource createInputSource(byte[] data, String systemId) { InputSource result = new InputSource(new ByteArrayInputStream(data)); result.setSystemId(systemId); return result; }
java
InputSource createInputSource(byte[] data, String systemId) { InputSource result = new InputSource(new ByteArrayInputStream(data)); result.setSystemId(systemId); return result; }
[ "InputSource", "createInputSource", "(", "byte", "[", "]", "data", ",", "String", "systemId", ")", "{", "InputSource", "result", "=", "new", "InputSource", "(", "new", "ByteArrayInputStream", "(", "data", ")", ")", ";", "result", ".", "setSystemId", "(", "sy...
Creates an input source for the given byte data and system id.<p> @param data the data which the input source should return @param systemId the system id for the input source @return the input source
[ "Creates", "an", "input", "source", "for", "the", "given", "byte", "data", "and", "system", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlEntityResolver.java#L493-L498
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java
CustomDictionary.add
public static boolean add(String word, String natureWithFrequency) { if (contains(word)) return false; return insert(word, natureWithFrequency); }
java
public static boolean add(String word, String natureWithFrequency) { if (contains(word)) return false; return insert(word, natureWithFrequency); }
[ "public", "static", "boolean", "add", "(", "String", "word", ",", "String", "natureWithFrequency", ")", "{", "if", "(", "contains", "(", "word", ")", ")", "return", "false", ";", "return", "insert", "(", "word", ",", "natureWithFrequency", ")", ";", "}" ]
往自定义词典中插入一个新词(非覆盖模式)<br> 动态增删不会持久化到词典文件 @param word 新词 如“裸婚” @param natureWithFrequency 词性和其对应的频次,比如“nz 1 v 2”,null时表示“nz 1” @return 是否插入成功(失败的原因可能是不覆盖、natureWithFrequency有问题等,后者可以通过调试模式了解原因)
[ "往自定义词典中插入一个新词(非覆盖模式)<br", ">", "动态增删不会持久化到词典文件" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/CustomDictionary.java#L265-L269
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java
ComponentFinder.findOrCreateNewAjaxRequestTarget
public static AjaxRequestTarget findOrCreateNewAjaxRequestTarget( final WebApplication application, final Page page) { final AjaxRequestTarget target = findAjaxRequestTarget(); if (target != null) { return target; } return newAjaxRequestTarget(application, page); }
java
public static AjaxRequestTarget findOrCreateNewAjaxRequestTarget( final WebApplication application, final Page page) { final AjaxRequestTarget target = findAjaxRequestTarget(); if (target != null) { return target; } return newAjaxRequestTarget(application, page); }
[ "public", "static", "AjaxRequestTarget", "findOrCreateNewAjaxRequestTarget", "(", "final", "WebApplication", "application", ",", "final", "Page", "page", ")", "{", "final", "AjaxRequestTarget", "target", "=", "findAjaxRequestTarget", "(", ")", ";", "if", "(", "target"...
Finds the current {@link AjaxRequestTarget} or creates a new ajax request target from the given application and page if the current {@link AjaxRequestTarget} is null. @param application the web application @param page page on which ajax response is made @return an AjaxRequestTarget instance @see WebApplication#newAjaxRequestTarget(Page)
[ "Finds", "the", "current", "{", "@link", "AjaxRequestTarget", "}", "or", "creates", "a", "new", "ajax", "request", "target", "from", "the", "given", "application", "and", "page", "if", "the", "current", "{", "@link", "AjaxRequestTarget", "}", "is", "null", "...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L72-L81
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/utils/Utils.java
Utils.nonNull
public static <T> T nonNull(final T object, final String message) { if (object == null) { throw new IllegalArgumentException(message); } return object; }
java
public static <T> T nonNull(final T object, final String message) { if (object == null) { throw new IllegalArgumentException(message); } return object; }
[ "public", "static", "<", "T", ">", "T", "nonNull", "(", "final", "T", "object", ",", "final", "String", "message", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "return...
Checks that an {@link Object} is not {@code null} and returns the same object or throws an {@link IllegalArgumentException} @param object any Object @param message the text message that would be passed to the exception thrown when {@code o == null}. @return the same object @throws IllegalArgumentException if a {@code o == null}
[ "Checks", "that", "an", "{" ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/utils/Utils.java#L42-L47
jbundle/jbundle
thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java
Application.registerUniqueApplication
public int registerUniqueApplication(String strQueueName, String strQueueType) { // HACK - This works if you are careful about starting the server... DONT TRUST THIS CODE! // todo(don) - THIS DOES NOT WORK CORRECTLY (need to register this app with jini or write an entry in a table or use the lock server or something) Map<String,Object> properties = new HashMap<String,Object>(); properties.put("removeListener", Boolean.TRUE); BaseMessage message = new MapMessage(new BaseMessageHeader(strQueueName, strQueueType, this, properties), properties); this.getMessageManager().sendMessage(message); // Make sure there is no listener that will start this server up. return Constants.NORMAL_RETURN; }
java
public int registerUniqueApplication(String strQueueName, String strQueueType) { // HACK - This works if you are careful about starting the server... DONT TRUST THIS CODE! // todo(don) - THIS DOES NOT WORK CORRECTLY (need to register this app with jini or write an entry in a table or use the lock server or something) Map<String,Object> properties = new HashMap<String,Object>(); properties.put("removeListener", Boolean.TRUE); BaseMessage message = new MapMessage(new BaseMessageHeader(strQueueName, strQueueType, this, properties), properties); this.getMessageManager().sendMessage(message); // Make sure there is no listener that will start this server up. return Constants.NORMAL_RETURN; }
[ "public", "int", "registerUniqueApplication", "(", "String", "strQueueName", ",", "String", "strQueueType", ")", "{", "// HACK - This works if you are careful about starting the server... DONT TRUST THIS CODE!", "// todo(don) - THIS DOES NOT WORK CORRECTLY (need to register this app with jin...
Register this unique application so there will be only one running. @param strQueueName The (optional) Queue that this app services. @param strQueueType The (optional) QueueType for this queue. @return NORMAL_RETURN If I registered the app okay, ERROR_RETURN if not (The app is already running)
[ "Register", "this", "unique", "application", "so", "there", "will", "be", "only", "one", "running", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java#L1233-L1242
graphql-java/graphql-java
src/main/java/graphql/execution/ExecutionStrategy.java
ExecutionStrategy.completeValueForList
protected FieldValueInfo completeValueForList(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Iterable<Object> iterableValues) { Collection<Object> values = FpKit.toCollection(iterableValues); ExecutionStepInfo executionStepInfo = parameters.getExecutionStepInfo(); GraphQLFieldDefinition fieldDef = parameters.getExecutionStepInfo().getFieldDefinition(); GraphQLObjectType fieldContainer = parameters.getExecutionStepInfo().getFieldContainer(); InstrumentationFieldCompleteParameters instrumentationParams = new InstrumentationFieldCompleteParameters(executionContext, parameters, fieldDef, createExecutionStepInfo(executionContext, parameters, fieldDef, fieldContainer), values); Instrumentation instrumentation = executionContext.getInstrumentation(); InstrumentationContext<ExecutionResult> completeListCtx = instrumentation.beginFieldListComplete( instrumentationParams ); List<FieldValueInfo> fieldValueInfos = new ArrayList<>(); int index = 0; for (Object item : values) { ExecutionPath indexedPath = parameters.getPath().segment(index); ExecutionStepInfo stepInfoForListElement = executionStepInfoFactory.newExecutionStepInfoForListElement(executionStepInfo, index); NonNullableFieldValidator nonNullableFieldValidator = new NonNullableFieldValidator(executionContext, stepInfoForListElement); int finalIndex = index; ExecutionStrategyParameters newParameters = parameters.transform(builder -> builder.executionStepInfo(stepInfoForListElement) .nonNullFieldValidator(nonNullableFieldValidator) .listSize(values.size()) .currentListIndex(finalIndex) .path(indexedPath) .source(item) ); fieldValueInfos.add(completeValue(executionContext, newParameters)); index++; } CompletableFuture<List<ExecutionResult>> resultsFuture = Async.each(fieldValueInfos, (item, i) -> item.getFieldValue()); CompletableFuture<ExecutionResult> overallResult = new CompletableFuture<>(); completeListCtx.onDispatched(overallResult); resultsFuture.whenComplete((results, exception) -> { if (exception != null) { ExecutionResult executionResult = handleNonNullException(executionContext, overallResult, exception); completeListCtx.onCompleted(executionResult, exception); return; } List<Object> completedResults = new ArrayList<>(); for (ExecutionResult completedValue : results) { completedResults.add(completedValue.getData()); } ExecutionResultImpl executionResult = new ExecutionResultImpl(completedResults, null); overallResult.complete(executionResult); }); overallResult.whenComplete(completeListCtx::onCompleted); return FieldValueInfo.newFieldValueInfo(LIST) .fieldValue(overallResult) .fieldValueInfos(fieldValueInfos) .build(); }
java
protected FieldValueInfo completeValueForList(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Iterable<Object> iterableValues) { Collection<Object> values = FpKit.toCollection(iterableValues); ExecutionStepInfo executionStepInfo = parameters.getExecutionStepInfo(); GraphQLFieldDefinition fieldDef = parameters.getExecutionStepInfo().getFieldDefinition(); GraphQLObjectType fieldContainer = parameters.getExecutionStepInfo().getFieldContainer(); InstrumentationFieldCompleteParameters instrumentationParams = new InstrumentationFieldCompleteParameters(executionContext, parameters, fieldDef, createExecutionStepInfo(executionContext, parameters, fieldDef, fieldContainer), values); Instrumentation instrumentation = executionContext.getInstrumentation(); InstrumentationContext<ExecutionResult> completeListCtx = instrumentation.beginFieldListComplete( instrumentationParams ); List<FieldValueInfo> fieldValueInfos = new ArrayList<>(); int index = 0; for (Object item : values) { ExecutionPath indexedPath = parameters.getPath().segment(index); ExecutionStepInfo stepInfoForListElement = executionStepInfoFactory.newExecutionStepInfoForListElement(executionStepInfo, index); NonNullableFieldValidator nonNullableFieldValidator = new NonNullableFieldValidator(executionContext, stepInfoForListElement); int finalIndex = index; ExecutionStrategyParameters newParameters = parameters.transform(builder -> builder.executionStepInfo(stepInfoForListElement) .nonNullFieldValidator(nonNullableFieldValidator) .listSize(values.size()) .currentListIndex(finalIndex) .path(indexedPath) .source(item) ); fieldValueInfos.add(completeValue(executionContext, newParameters)); index++; } CompletableFuture<List<ExecutionResult>> resultsFuture = Async.each(fieldValueInfos, (item, i) -> item.getFieldValue()); CompletableFuture<ExecutionResult> overallResult = new CompletableFuture<>(); completeListCtx.onDispatched(overallResult); resultsFuture.whenComplete((results, exception) -> { if (exception != null) { ExecutionResult executionResult = handleNonNullException(executionContext, overallResult, exception); completeListCtx.onCompleted(executionResult, exception); return; } List<Object> completedResults = new ArrayList<>(); for (ExecutionResult completedValue : results) { completedResults.add(completedValue.getData()); } ExecutionResultImpl executionResult = new ExecutionResultImpl(completedResults, null); overallResult.complete(executionResult); }); overallResult.whenComplete(completeListCtx::onCompleted); return FieldValueInfo.newFieldValueInfo(LIST) .fieldValue(overallResult) .fieldValueInfos(fieldValueInfos) .build(); }
[ "protected", "FieldValueInfo", "completeValueForList", "(", "ExecutionContext", "executionContext", ",", "ExecutionStrategyParameters", "parameters", ",", "Iterable", "<", "Object", ">", "iterableValues", ")", "{", "Collection", "<", "Object", ">", "values", "=", "FpKit...
Called to complete a list of value for a field based on a list type. This iterates the values and calls {@link #completeValue(ExecutionContext, ExecutionStrategyParameters)} for each value. @param executionContext contains the top level execution parameters @param parameters contains the parameters holding the fields to be executed and source object @param iterableValues the values to complete, can't be null @return a {@link FieldValueInfo}
[ "Called", "to", "complete", "a", "list", "of", "value", "for", "a", "field", "based", "on", "a", "list", "type", ".", "This", "iterates", "the", "values", "and", "calls", "{", "@link", "#completeValue", "(", "ExecutionContext", "ExecutionStrategyParameters", "...
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStrategy.java#L485-L545
52North/matlab-connector
common/src/main/java/org/n52/matlab/connector/MatlabResult.java
MatlabResult.addResult
public MatlabResult addResult(String name, MatlabValue result) { checkNotNull(name); checkNotNull(result); this.results.put(name, result); return this; }
java
public MatlabResult addResult(String name, MatlabValue result) { checkNotNull(name); checkNotNull(result); this.results.put(name, result); return this; }
[ "public", "MatlabResult", "addResult", "(", "String", "name", ",", "MatlabValue", "result", ")", "{", "checkNotNull", "(", "name", ")", ";", "checkNotNull", "(", "result", ")", ";", "this", ".", "results", ".", "put", "(", "name", ",", "result", ")", ";"...
Adds a result {@link MatlabValue}. @param name the name of the result @param result the result <code>MatlabValue</code> @return this
[ "Adds", "a", "result", "{", "@link", "MatlabValue", "}", "." ]
train
https://github.com/52North/matlab-connector/blob/f00089cb535776c8cf973fcfaa0c5c3e1045afbf/common/src/main/java/org/n52/matlab/connector/MatlabResult.java#L68-L73
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java
ClassPath.newInstance
@SuppressWarnings("unchecked") public static <T> T newInstance(Class<?> aClass, Class<?>[] parameterTypes,Object[] initargs) throws SetupException { try { //Get constructor Constructor<?> constructor = aClass.getConstructor(parameterTypes); return (T)constructor.newInstance(initargs); } catch (Exception e) { throw new SetupException(e); } }
java
@SuppressWarnings("unchecked") public static <T> T newInstance(Class<?> aClass, Class<?>[] parameterTypes,Object[] initargs) throws SetupException { try { //Get constructor Constructor<?> constructor = aClass.getConstructor(parameterTypes); return (T)constructor.newInstance(initargs); } catch (Exception e) { throw new SetupException(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "newInstance", "(", "Class", "<", "?", ">", "aClass", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ",", "Object", "[", "]", "initargs", ")", "throws...
Use a constructor of the a class to create an instance @param aClass the class the create @param parameterTypes the constructor parameter types @param initargs the constructor initial arguments @param <T> the class type @return the initiate object @throws SetupException when internal error occurs
[ "Use", "a", "constructor", "of", "the", "a", "class", "to", "create", "an", "instance" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java#L223-L238
dkmfbk/knowledgestore
ks-core/src/main/java/eu/fbk/knowledgestore/data/Stream.java
Stream.getProperty
public final <V> V getProperty(final String name, final Class<V> type) { Preconditions.checkNotNull(name); try { Object value = null; synchronized (this.state) { if (this.state.properties != null) { value = this.state.properties.get(name); } } return Data.convert(value, type); } catch (final Throwable ex) { throw Throwables.propagate(ex); } }
java
public final <V> V getProperty(final String name, final Class<V> type) { Preconditions.checkNotNull(name); try { Object value = null; synchronized (this.state) { if (this.state.properties != null) { value = this.state.properties.get(name); } } return Data.convert(value, type); } catch (final Throwable ex) { throw Throwables.propagate(ex); } }
[ "public", "final", "<", "V", ">", "V", "getProperty", "(", "final", "String", "name", ",", "final", "Class", "<", "V", ">", "type", ")", "{", "Preconditions", ".", "checkNotNull", "(", "name", ")", ";", "try", "{", "Object", "value", "=", "null", ";"...
Returns a metadata property about the stream. Note that {@code Stream} wrappers obtained through intermediate operations don't have their own properties, but instead access the metadata properties of the source {@code Stream}. @param name the name of the property @param type the type of the property value (conversion will be attempted if available value has a different type) @param <V> the type of value @return the value of the property, or null if the property is undefined
[ "Returns", "a", "metadata", "property", "about", "the", "stream", ".", "Note", "that", "{", "@code", "Stream", "}", "wrappers", "obtained", "through", "intermediate", "operations", "don", "t", "have", "their", "own", "properties", "but", "instead", "access", "...
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-core/src/main/java/eu/fbk/knowledgestore/data/Stream.java#L873-L886
openbase/jul
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/animation/Animations.java
Animations.createFadeTransition
public static FadeTransition createFadeTransition(final Node node, final double fromValue, final double toValue, final int cycleCount, final double duration) { assert node != null; final FadeTransition fadeTransition = new FadeTransition(Duration.millis(duration), node); fadeTransition.setFromValue(fromValue); fadeTransition.setToValue(toValue); fadeTransition.setCycleCount(cycleCount); fadeTransition.setAutoReverse(true); return fadeTransition; }
java
public static FadeTransition createFadeTransition(final Node node, final double fromValue, final double toValue, final int cycleCount, final double duration) { assert node != null; final FadeTransition fadeTransition = new FadeTransition(Duration.millis(duration), node); fadeTransition.setFromValue(fromValue); fadeTransition.setToValue(toValue); fadeTransition.setCycleCount(cycleCount); fadeTransition.setAutoReverse(true); return fadeTransition; }
[ "public", "static", "FadeTransition", "createFadeTransition", "(", "final", "Node", "node", ",", "final", "double", "fromValue", ",", "final", "double", "toValue", ",", "final", "int", "cycleCount", ",", "final", "double", "duration", ")", "{", "assert", "node",...
Method to create a FadeTransition with several parameters. @param node the node to which the transition should be applied @param fromValue the opacity value from which the transition should start @param toValue the opacity value where the transition should end @param cycleCount the number of times the animation should be played (use Animation.INDEFINITE for endless) @param duration the duration which one animation cycle should take @return an instance of the created FadeTransition
[ "Method", "to", "create", "a", "FadeTransition", "with", "several", "parameters", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/animation/Animations.java#L65-L74
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/cdn/CdnClient.java
CdnClient.setDomainOrigin
public void setDomainOrigin(String domain, String peer) { List<OriginPeer> origin = new ArrayList<OriginPeer>(); origin.add(new OriginPeer().withPeer(peer)); SetDomainOriginRequest request = new SetDomainOriginRequest() .withDomain(domain) .withOrigin(origin); setDomainOrigin(request); }
java
public void setDomainOrigin(String domain, String peer) { List<OriginPeer> origin = new ArrayList<OriginPeer>(); origin.add(new OriginPeer().withPeer(peer)); SetDomainOriginRequest request = new SetDomainOriginRequest() .withDomain(domain) .withOrigin(origin); setDomainOrigin(request); }
[ "public", "void", "setDomainOrigin", "(", "String", "domain", ",", "String", "peer", ")", "{", "List", "<", "OriginPeer", ">", "origin", "=", "new", "ArrayList", "<", "OriginPeer", ">", "(", ")", ";", "origin", ".", "add", "(", "new", "OriginPeer", "(", ...
Update origin of specified domain acceleration. @param domain Name of the domain. @param peer The peer address of new origin.
[ "Update", "origin", "of", "specified", "domain", "acceleration", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L303-L310
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.toLineString
public LineString toLineString(List<LatLng> latLngs, boolean hasZ, boolean hasM) { LineString lineString = new LineString(hasZ, hasM); populateLineString(lineString, latLngs); return lineString; }
java
public LineString toLineString(List<LatLng> latLngs, boolean hasZ, boolean hasM) { LineString lineString = new LineString(hasZ, hasM); populateLineString(lineString, latLngs); return lineString; }
[ "public", "LineString", "toLineString", "(", "List", "<", "LatLng", ">", "latLngs", ",", "boolean", "hasZ", ",", "boolean", "hasM", ")", "{", "LineString", "lineString", "=", "new", "LineString", "(", "hasZ", ",", "hasM", ")", ";", "populateLineString", "(",...
Convert a list of {@link LatLng} to a {@link LineString} @param latLngs lat lngs @param hasZ has z flag @param hasM has m flag @return line string
[ "Convert", "a", "list", "of", "{", "@link", "LatLng", "}", "to", "a", "{", "@link", "LineString", "}" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L347-L355
samskivert/samskivert
src/main/java/com/samskivert/util/IntIntMap.java
IntIntMap.getOrElse
public int getOrElse (int key, int defval) { Record rec = locateRecord(key); return (rec == null) ? defval : rec.value; }
java
public int getOrElse (int key, int defval) { Record rec = locateRecord(key); return (rec == null) ? defval : rec.value; }
[ "public", "int", "getOrElse", "(", "int", "key", ",", "int", "defval", ")", "{", "Record", "rec", "=", "locateRecord", "(", "key", ")", ";", "return", "(", "rec", "==", "null", ")", "?", "defval", ":", "rec", ".", "value", ";", "}" ]
Returns the value mapped to the specified key or the supplied default value if there is no mapping.
[ "Returns", "the", "value", "mapped", "to", "the", "specified", "key", "or", "the", "supplied", "default", "value", "if", "there", "is", "no", "mapping", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/IntIntMap.java#L120-L124
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.generateProtobufDefinedForField
private static void generateProtobufDefinedForField(StringBuilder code, Field field, Set<String> enumNames) { code.append("@").append(Protobuf.class.getSimpleName()).append("("); String fieldType = fieldTypeMapping.get(field.getType()); if (fieldType == null) { if (enumNames.contains(field.getType())) { fieldType = "FieldType.ENUM"; } else { fieldType = "FieldType.OBJECT"; } } code.append("fieldType=").append(fieldType); code.append(", order=").append(field.getTag()); if (Label.OPTIONAL == field.getLabel()) { code.append(", required=false"); } else if (Label.REQUIRED == field.getLabel()) { code.append(", required=true"); } code.append(")\n"); }
java
private static void generateProtobufDefinedForField(StringBuilder code, Field field, Set<String> enumNames) { code.append("@").append(Protobuf.class.getSimpleName()).append("("); String fieldType = fieldTypeMapping.get(field.getType()); if (fieldType == null) { if (enumNames.contains(field.getType())) { fieldType = "FieldType.ENUM"; } else { fieldType = "FieldType.OBJECT"; } } code.append("fieldType=").append(fieldType); code.append(", order=").append(field.getTag()); if (Label.OPTIONAL == field.getLabel()) { code.append(", required=false"); } else if (Label.REQUIRED == field.getLabel()) { code.append(", required=true"); } code.append(")\n"); }
[ "private", "static", "void", "generateProtobufDefinedForField", "(", "StringBuilder", "code", ",", "Field", "field", ",", "Set", "<", "String", ">", "enumNames", ")", "{", "code", ".", "append", "(", "\"@\"", ")", ".", "append", "(", "Protobuf", ".", "class"...
to generate @Protobuf defined code for target field. @param code the code @param field the field @param enumNames the enum names
[ "to", "generate", "@Protobuf", "defined", "code", "for", "target", "field", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L1372-L1393
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java
ConsumerUtil.checkForReusedJwt
void checkForReusedJwt(JwtTokenConsumerImpl jwt, JwtConsumerConfig config) throws InvalidTokenException { // Only throw an error if tokens are not allowed to be reused if (!config.getTokenReuse()) { throwExceptionIfJwtReused(jwt); } }
java
void checkForReusedJwt(JwtTokenConsumerImpl jwt, JwtConsumerConfig config) throws InvalidTokenException { // Only throw an error if tokens are not allowed to be reused if (!config.getTokenReuse()) { throwExceptionIfJwtReused(jwt); } }
[ "void", "checkForReusedJwt", "(", "JwtTokenConsumerImpl", "jwt", ",", "JwtConsumerConfig", "config", ")", "throws", "InvalidTokenException", "{", "// Only throw an error if tokens are not allowed to be reused", "if", "(", "!", "config", ".", "getTokenReuse", "(", ")", ")", ...
Throws an exception if JWTs are not allowed to be reused (as configured by the provided config option) AND a token with a matching "jti" and "issuer" claim already exists in the cache.
[ "Throws", "an", "exception", "if", "JWTs", "are", "not", "allowed", "to", "be", "reused", "(", "as", "configured", "by", "the", "provided", "config", "option", ")", "AND", "a", "token", "with", "a", "matching", "jti", "and", "issuer", "claim", "already", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L99-L104
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/web/PortalWebUtils.java
PortalWebUtils.getMapRequestAttribute
public static <K, V> ConcurrentMap<K, V> getMapRequestAttribute( ServletRequest servletRequest, String name) { return getMapRequestAttribute(servletRequest, name, true); }
java
public static <K, V> ConcurrentMap<K, V> getMapRequestAttribute( ServletRequest servletRequest, String name) { return getMapRequestAttribute(servletRequest, name, true); }
[ "public", "static", "<", "K", ",", "V", ">", "ConcurrentMap", "<", "K", ",", "V", ">", "getMapRequestAttribute", "(", "ServletRequest", "servletRequest", ",", "String", "name", ")", "{", "return", "getMapRequestAttribute", "(", "servletRequest", ",", "name", "...
Get a {@link ConcurrentMap} for the specified name from the {@link ServletRequest} attributes. If it doesn't exist create it and store it in the attributes. This is done in a thread-safe matter that ensures only one Map per name & request will be created @See {@link #getRequestAttributeMutex(ServletRequest)}
[ "Get", "a", "{" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/web/PortalWebUtils.java#L69-L72
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Main.java
Main.execute
public static int execute(String[] args, PrintWriter writer) { Start jdoc = new Start(writer, writer); return jdoc.begin(args).exitCode; }
java
public static int execute(String[] args, PrintWriter writer) { Start jdoc = new Start(writer, writer); return jdoc.begin(args).exitCode; }
[ "public", "static", "int", "execute", "(", "String", "[", "]", "args", ",", "PrintWriter", "writer", ")", "{", "Start", "jdoc", "=", "new", "Start", "(", "writer", ",", "writer", ")", ";", "return", "jdoc", ".", "begin", "(", "args", ")", ".", "exitC...
Programmatic interface. @param writer a stream for all output @param args The command line parameters. @return The return code.
[ "Programmatic", "interface", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Main.java#L73-L76
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/CSVAppender.java
CSVAppender.valueString
private static String valueString(Object value, Schema schema) { if (value == null || schema.getType() == Schema.Type.NULL) { return null; } switch (schema.getType()) { case BOOLEAN: case FLOAT: case DOUBLE: case INT: case LONG: case STRING: return value.toString(); case ENUM: // serialize as the ordinal from the schema return String.valueOf(schema.getEnumOrdinal(value.toString())); case UNION: int index = ReflectData.get().resolveUnion(schema, value); return valueString(value, schema.getTypes().get(index)); default: // FIXED, BYTES, MAP, ARRAY, RECORD are not supported throw new DatasetOperationException( "Unsupported field type:" + schema.getType()); } }
java
private static String valueString(Object value, Schema schema) { if (value == null || schema.getType() == Schema.Type.NULL) { return null; } switch (schema.getType()) { case BOOLEAN: case FLOAT: case DOUBLE: case INT: case LONG: case STRING: return value.toString(); case ENUM: // serialize as the ordinal from the schema return String.valueOf(schema.getEnumOrdinal(value.toString())); case UNION: int index = ReflectData.get().resolveUnion(schema, value); return valueString(value, schema.getTypes().get(index)); default: // FIXED, BYTES, MAP, ARRAY, RECORD are not supported throw new DatasetOperationException( "Unsupported field type:" + schema.getType()); } }
[ "private", "static", "String", "valueString", "(", "Object", "value", ",", "Schema", "schema", ")", "{", "if", "(", "value", "==", "null", "||", "schema", ".", "getType", "(", ")", "==", "Schema", ".", "Type", ".", "NULL", ")", "{", "return", "null", ...
Returns a the value as the first matching schema type or null. Note that if the value may be null even if the schema does not allow the value to be null. @param value a value @param schema a Schema @return a String representation of the value according to the Schema type
[ "Returns", "a", "the", "value", "as", "the", "first", "matching", "schema", "type", "or", "null", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/CSVAppender.java#L131-L155
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.createImage
public CreateImageResponse createImage(CreateImageRequest request) { checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } checkStringNotEmpty(request.getImageName(), "request imageName should not be empty."); if (Strings.isNullOrEmpty(request.getInstanceId()) && Strings.isNullOrEmpty(request.getSnapshotId())) { throw new IllegalArgumentException("request instanceId or snapshotId should not be empty ."); } InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, IMAGE_PREFIX); internalRequest.addParameter("clientToken", request.getClientToken()); fillPayload(internalRequest, request); return invokeHttpClient(internalRequest, CreateImageResponse.class); }
java
public CreateImageResponse createImage(CreateImageRequest request) { checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } checkStringNotEmpty(request.getImageName(), "request imageName should not be empty."); if (Strings.isNullOrEmpty(request.getInstanceId()) && Strings.isNullOrEmpty(request.getSnapshotId())) { throw new IllegalArgumentException("request instanceId or snapshotId should not be empty ."); } InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, IMAGE_PREFIX); internalRequest.addParameter("clientToken", request.getClientToken()); fillPayload(internalRequest, request); return invokeHttpClient(internalRequest, CreateImageResponse.class); }
[ "public", "CreateImageResponse", "createImage", "(", "CreateImageRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "request", ".", "getClientToken", "(", ...
Creating a customized image which can be used for creating instance in the future. <p> You can create an image from an instance or you can create from an snapshot. The parameters of instanceId and snapshotId can no be null simultaneously. when both instanceId and snapshotId are assigned,only instanceId will be used. <p> While creating an image from an instance,the instance must be Running or Stopped, otherwise,it's will get <code>409</code> errorCode. <p> You can create the image only from system snapshot. While creating an image from a system snapshot,the snapshot must be Available, otherwise,it's will get <code>409</code> errorCode. This is an asynchronous interface, you can get the latest status by invoke {@link #getImage(GetImageRequest)} @param request The request containing all options for creating a new image. @return The response with id of image newly created.
[ "Creating", "a", "customized", "image", "which", "can", "be", "used", "for", "creating", "instance", "in", "the", "future", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1251-L1264
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java
StyleUtil.setColor
public static CellStyle setColor(CellStyle cellStyle, IndexedColors color, FillPatternType fillPattern) { return setColor(cellStyle, color.index, fillPattern); }
java
public static CellStyle setColor(CellStyle cellStyle, IndexedColors color, FillPatternType fillPattern) { return setColor(cellStyle, color.index, fillPattern); }
[ "public", "static", "CellStyle", "setColor", "(", "CellStyle", "cellStyle", ",", "IndexedColors", "color", ",", "FillPatternType", "fillPattern", ")", "{", "return", "setColor", "(", "cellStyle", ",", "color", ".", "index", ",", "fillPattern", ")", ";", "}" ]
给cell设置颜色 @param cellStyle {@link CellStyle} @param color 背景颜色 @param fillPattern 填充方式 {@link FillPatternType}枚举 @return {@link CellStyle}
[ "给cell设置颜色" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L93-L95
ag-gipp/MathMLTools
mathml-core/src/main/java/com/formulasearchengine/mathmltools/helper/XMLHelper.java
XMLHelper.string2Doc
public static Document string2Doc(String inputXMLString, boolean namespaceAwareness) { try { return XmlDocumentReader.parse(inputXMLString, false); } catch (IOException | SAXException e) { log.error("Cannot parse XML string.", e); return null; } // try { // DocumentBuilder builder = getDocumentBuilder(namespaceAwareness); // InputSource is = new InputSource(new StringReader(inputXMLString)); // is.setEncoding("UTF-8"); // return builder.parse(is); // } catch (SAXException | ParserConfigurationException | IOException e) { // log.error("cannot parse following content\n\n" + inputXMLString); // e.printStackTrace(); // return null; // } }
java
public static Document string2Doc(String inputXMLString, boolean namespaceAwareness) { try { return XmlDocumentReader.parse(inputXMLString, false); } catch (IOException | SAXException e) { log.error("Cannot parse XML string.", e); return null; } // try { // DocumentBuilder builder = getDocumentBuilder(namespaceAwareness); // InputSource is = new InputSource(new StringReader(inputXMLString)); // is.setEncoding("UTF-8"); // return builder.parse(is); // } catch (SAXException | ParserConfigurationException | IOException e) { // log.error("cannot parse following content\n\n" + inputXMLString); // e.printStackTrace(); // return null; // } }
[ "public", "static", "Document", "string2Doc", "(", "String", "inputXMLString", ",", "boolean", "namespaceAwareness", ")", "{", "try", "{", "return", "XmlDocumentReader", ".", "parse", "(", "inputXMLString", ",", "false", ")", ";", "}", "catch", "(", "IOException...
Helper program: Transforms a String to a XML Document. @param inputXMLString the input xml string @param namespaceAwareness the namespace awareness @return parsed document
[ "Helper", "program", ":", "Transforms", "a", "String", "to", "a", "XML", "Document", "." ]
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-core/src/main/java/com/formulasearchengine/mathmltools/helper/XMLHelper.java#L193-L210
jcuda/jcuda
JCudaJava/src/main/java/jcuda/cuComplex.java
cuComplex.cuCadd
public static cuComplex cuCadd (cuComplex x, cuComplex y) { return cuCmplx (cuCreal(x) + cuCreal(y), cuCimag(x) + cuCimag(y)); }
java
public static cuComplex cuCadd (cuComplex x, cuComplex y) { return cuCmplx (cuCreal(x) + cuCreal(y), cuCimag(x) + cuCimag(y)); }
[ "public", "static", "cuComplex", "cuCadd", "(", "cuComplex", "x", ",", "cuComplex", "y", ")", "{", "return", "cuCmplx", "(", "cuCreal", "(", "x", ")", "+", "cuCreal", "(", "y", ")", ",", "cuCimag", "(", "x", ")", "+", "cuCimag", "(", "y", ")", ")",...
Returns a new complex number that is the sum of the given complex numbers. @param x The first addend @param y The second addend @return The sum of the given addends
[ "Returns", "a", "new", "complex", "number", "that", "is", "the", "sum", "of", "the", "given", "complex", "numbers", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/cuComplex.java#L103-L106
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java
Bean.addCallback
private void addCallback(BeanMessageID type, Callback<?> callback) { List<Callback<?>> callbacks = beanCallbacks.get(type); if (callbacks == null) { callbacks = new ArrayList<>(16); beanCallbacks.put(type, callbacks); } callbacks.add(callback); }
java
private void addCallback(BeanMessageID type, Callback<?> callback) { List<Callback<?>> callbacks = beanCallbacks.get(type); if (callbacks == null) { callbacks = new ArrayList<>(16); beanCallbacks.put(type, callbacks); } callbacks.add(callback); }
[ "private", "void", "addCallback", "(", "BeanMessageID", "type", ",", "Callback", "<", "?", ">", "callback", ")", "{", "List", "<", "Callback", "<", "?", ">", ">", "callbacks", "=", "beanCallbacks", ".", "get", "(", "type", ")", ";", "if", "(", "callbac...
Add a callback for a Bean message type. @param type The {@link com.punchthrough.bean.sdk.internal.BeanMessageID} the callback will answer to @param callback The callback to store
[ "Add", "a", "callback", "for", "a", "Bean", "message", "type", "." ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/Bean.java#L684-L691
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java
AnnotationUtils.getAnnotationAttributes
public static AnnotationAttributes getAnnotationAttributes(Annotation annotation, boolean classValuesAsString, boolean nestedAnnotationsAsMap) { AnnotationAttributes attrs = new AnnotationAttributes(); Method[] methods = annotation.annotationType().getDeclaredMethods(); for (Method method : methods) { if (method.getParameterTypes().length == 0 && method.getReturnType() != void.class) { try { Object value = method.invoke(annotation); attrs.put(method.getName(), adaptValue(value, classValuesAsString, nestedAnnotationsAsMap)); } catch (Exception ex) { throw new IllegalStateException("Could not obtain annotation attribute values", ex); } } } return attrs; }
java
public static AnnotationAttributes getAnnotationAttributes(Annotation annotation, boolean classValuesAsString, boolean nestedAnnotationsAsMap) { AnnotationAttributes attrs = new AnnotationAttributes(); Method[] methods = annotation.annotationType().getDeclaredMethods(); for (Method method : methods) { if (method.getParameterTypes().length == 0 && method.getReturnType() != void.class) { try { Object value = method.invoke(annotation); attrs.put(method.getName(), adaptValue(value, classValuesAsString, nestedAnnotationsAsMap)); } catch (Exception ex) { throw new IllegalStateException("Could not obtain annotation attribute values", ex); } } } return attrs; }
[ "public", "static", "AnnotationAttributes", "getAnnotationAttributes", "(", "Annotation", "annotation", ",", "boolean", "classValuesAsString", ",", "boolean", "nestedAnnotationsAsMap", ")", "{", "AnnotationAttributes", "attrs", "=", "new", "AnnotationAttributes", "(", ")", ...
Retrieve the given annotation's attributes as an {@link AnnotationAttributes} map structure. @return the annotation attributes (a specialized Map) with attribute names as keys and corresponding attribute values as values @since 3.1.1
[ "Retrieve", "the", "given", "annotation", "s", "attributes", "as", "an", "{" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L557-L574
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToTextStream.java
ToTextStream.endElement
public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException { if (m_tracer != null) super.fireEndElem(name); }
java
public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException { if (m_tracer != null) super.fireEndElem(name); }
[ "public", "void", "endElement", "(", "String", "namespaceURI", ",", "String", "localName", ",", "String", "name", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "if", "(", "m_tracer", "!=", "null", ")", "super", ".", "fireEndElem",...
Receive notification of the end of an element. <p>The SAX parser will invoke this method at the end of every element in the XML document; there will be a corresponding startElement() event for every endElement() event (even when the element is empty).</p> <p>If the element name has a namespace prefix, the prefix will still be attached to the name.</p> @param namespaceURI The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed. @param localName The local name (without prefix), or the empty string if Namespace processing is not being performed. @param name The qualified name (with prefix), or the empty string if qualified names are not available. @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception. @throws org.xml.sax.SAXException
[ "Receive", "notification", "of", "the", "end", "of", "an", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToTextStream.java#L163-L168
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java
AjaxHelper.registerComponents
public static AjaxOperation registerComponents(final List<String> targetIds, final String triggerId) { AjaxOperation operation = new AjaxOperation(triggerId, targetIds); registerAjaxOperation(operation); return operation; }
java
public static AjaxOperation registerComponents(final List<String> targetIds, final String triggerId) { AjaxOperation operation = new AjaxOperation(triggerId, targetIds); registerAjaxOperation(operation); return operation; }
[ "public", "static", "AjaxOperation", "registerComponents", "(", "final", "List", "<", "String", ">", "targetIds", ",", "final", "String", "triggerId", ")", "{", "AjaxOperation", "operation", "=", "new", "AjaxOperation", "(", "triggerId", ",", "targetIds", ")", "...
Registers one or more components as being AJAX capable. @param targetIds the components to register. Each component will be re-painted when the trigger occurs. @param triggerId the id of the trigger that will cause the components to be painted. @return the AjaxOperation control configuration object.
[ "Registers", "one", "or", "more", "components", "as", "being", "AJAX", "capable", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AjaxHelper.java#L100-L104
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/EventHelper.java
EventHelper.onCloseDocument
@Override public void onCloseDocument(PdfWriter writer, Document document) { super.onCloseDocument(writer, document); if (getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER)) { try { printTotalPages(template, document.right(), footerBottom); } catch (VectorPrintException | InstantiationException | IllegalAccessException ex) { throw new VectorPrintRuntimeException(ex); } } if (failuresHereAfter) { printFailureHeader(template, 10, document.top() - 10); } }
java
@Override public void onCloseDocument(PdfWriter writer, Document document) { super.onCloseDocument(writer, document); if (getSettings().getBooleanProperty(Boolean.FALSE, ReportConstants.PRINTFOOTER)) { try { printTotalPages(template, document.right(), footerBottom); } catch (VectorPrintException | InstantiationException | IllegalAccessException ex) { throw new VectorPrintRuntimeException(ex); } } if (failuresHereAfter) { printFailureHeader(template, 10, document.top() - 10); } }
[ "@", "Override", "public", "void", "onCloseDocument", "(", "PdfWriter", "writer", ",", "Document", "document", ")", "{", "super", ".", "onCloseDocument", "(", "writer", ",", "document", ")", ";", "if", "(", "getSettings", "(", ")", ".", "getBooleanProperty", ...
calls {@link #printTotalPages(com.itextpdf.text.pdf.PdfTemplate, float, float) } with {@link #PAGEFOOTERSTYLE a font from setup}, document.right() and the calculated bottom of the footertable. Clears the layermanager. When applicable calls {@link #printFailureHeader(com.itextpdf.text.pdf.PdfTemplate, float, float) } @param writer @param document
[ "calls", "{", "@link", "#printTotalPages", "(", "com", ".", "itextpdf", ".", "text", ".", "pdf", ".", "PdfTemplate", "float", "float", ")", "}", "with", "{", "@link", "#PAGEFOOTERSTYLE", "a", "font", "from", "setup", "}", "document", ".", "right", "()", ...
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/EventHelper.java#L310-L323
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java
AvroUtils.serializeAsPath
public static Path serializeAsPath(GenericRecord record, boolean includeFieldNames, boolean replacePathSeparators) { if (record == null) { return new Path(""); } List<String> tokens = Lists.newArrayList(); for (Schema.Field field : record.getSchema().getFields()) { String sanitizedName = HadoopUtils.sanitizePath(field.name(), "_"); String sanitizedValue = HadoopUtils.sanitizePath(record.get(field.name()).toString(), "_"); if (replacePathSeparators) { sanitizedName = sanitizedName.replaceAll(Path.SEPARATOR, "_"); sanitizedValue = sanitizedValue.replaceAll(Path.SEPARATOR, "_"); } if (includeFieldNames) { tokens.add(String.format("%s=%s", sanitizedName, sanitizedValue)); } else if (!Strings.isNullOrEmpty(sanitizedValue)) { tokens.add(sanitizedValue); } } return new Path(Joiner.on(Path.SEPARATOR).join(tokens)); }
java
public static Path serializeAsPath(GenericRecord record, boolean includeFieldNames, boolean replacePathSeparators) { if (record == null) { return new Path(""); } List<String> tokens = Lists.newArrayList(); for (Schema.Field field : record.getSchema().getFields()) { String sanitizedName = HadoopUtils.sanitizePath(field.name(), "_"); String sanitizedValue = HadoopUtils.sanitizePath(record.get(field.name()).toString(), "_"); if (replacePathSeparators) { sanitizedName = sanitizedName.replaceAll(Path.SEPARATOR, "_"); sanitizedValue = sanitizedValue.replaceAll(Path.SEPARATOR, "_"); } if (includeFieldNames) { tokens.add(String.format("%s=%s", sanitizedName, sanitizedValue)); } else if (!Strings.isNullOrEmpty(sanitizedValue)) { tokens.add(sanitizedValue); } } return new Path(Joiner.on(Path.SEPARATOR).join(tokens)); }
[ "public", "static", "Path", "serializeAsPath", "(", "GenericRecord", "record", ",", "boolean", "includeFieldNames", ",", "boolean", "replacePathSeparators", ")", "{", "if", "(", "record", "==", "null", ")", "{", "return", "new", "Path", "(", "\"\"", ")", ";", ...
Serialize a generic record as a relative {@link Path}. Useful for converting {@link GenericRecord} type keys into file system locations. For example {field1=v1, field2=v2} returns field1=v1/field2=v2 if includeFieldNames is true, or v1/v2 if it is false. Illegal HDFS tokens such as ':' and '\\' will be replaced with '_'. Additionally, parameter replacePathSeparators controls whether to replace path separators ('/') with '_'. @param record {@link GenericRecord} to serialize. @param includeFieldNames If true, each token in the path will be of the form key=value, otherwise, only the value will be included. @param replacePathSeparators If true, path separators ('/') in each token will be replaced with '_'. @return A relative path where each level is a field in the input record.
[ "Serialize", "a", "generic", "record", "as", "a", "relative", "{", "@link", "Path", "}", ".", "Useful", "for", "converting", "{", "@link", "GenericRecord", "}", "type", "keys", "into", "file", "system", "locations", ".", "For", "example", "{", "field1", "=...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L816-L835
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/quasinewton/SearchInterpolate.java
SearchInterpolate.quadratic2
public static double quadratic2( double g0 , double x0 , double g1 , double x1 ) { return x0 + (g0/(g0-g1))*(x1-x0); }
java
public static double quadratic2( double g0 , double x0 , double g1 , double x1 ) { return x0 + (g0/(g0-g1))*(x1-x0); }
[ "public", "static", "double", "quadratic2", "(", "double", "g0", ",", "double", "x0", ",", "double", "g1", ",", "double", "x1", ")", "{", "return", "x0", "+", "(", "g0", "/", "(", "g0", "-", "g1", ")", ")", "*", "(", "x1", "-", "x0", ")", ";", ...
<p> Quadratic interpolation using two derivatives. </p> @param g0 Derivative f'(x0) @param x0 First sample point @param g1 Derivative f'(x1) @param x1 Second sample point @return Interpolated point
[ "<p", ">", "Quadratic", "interpolation", "using", "two", "derivatives", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/quasinewton/SearchInterpolate.java#L69-L72
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WApplication.java
WApplication.addCssFile
public ApplicationResource addCssFile(final String fileName) { if (Util.empty(fileName)) { throw new IllegalArgumentException("A file name must be provided."); } InternalResource resource = new InternalResource(fileName, fileName); ApplicationResource res = new ApplicationResource(resource); addCssResource(res); return res; }
java
public ApplicationResource addCssFile(final String fileName) { if (Util.empty(fileName)) { throw new IllegalArgumentException("A file name must be provided."); } InternalResource resource = new InternalResource(fileName, fileName); ApplicationResource res = new ApplicationResource(resource); addCssResource(res); return res; }
[ "public", "ApplicationResource", "addCssFile", "(", "final", "String", "fileName", ")", "{", "if", "(", "Util", ".", "empty", "(", "fileName", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A file name must be provided.\"", ")", ";", "}", "In...
Add custom CSS held as an internal resource to be used by the Application. @param fileName the CSS file name @return the application resource in which the resource details are held
[ "Add", "custom", "CSS", "held", "as", "an", "internal", "resource", "to", "be", "used", "by", "the", "Application", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WApplication.java#L260-L268
davidcarboni/restolino
src/main/java/com/github/davidcarboni/restolino/helpers/QueryString.java
QueryString.toQueryString
public String toQueryString() { String result = null; List<String> parameters = new ArrayList<>(); for (Map.Entry<String, String> entry : entrySet()) { // We don't encode the key because it could legitimately contain // things like underscores, e.g. "_escaped_fragment_" would become: // "%5Fescaped%5Ffragment%5F" String key = entry.getKey(); String value; try { value = URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Error encoding URL", e); } // Jetty class *appears* to need Java 8 //String value = UrlEncoded.encodeString(entry.getValue()); parameters.add(key + "=" + value); } if (parameters.size() > 0) { result = StringUtils.join(parameters, '&'); } return result; }
java
public String toQueryString() { String result = null; List<String> parameters = new ArrayList<>(); for (Map.Entry<String, String> entry : entrySet()) { // We don't encode the key because it could legitimately contain // things like underscores, e.g. "_escaped_fragment_" would become: // "%5Fescaped%5Ffragment%5F" String key = entry.getKey(); String value; try { value = URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Error encoding URL", e); } // Jetty class *appears* to need Java 8 //String value = UrlEncoded.encodeString(entry.getValue()); parameters.add(key + "=" + value); } if (parameters.size() > 0) { result = StringUtils.join(parameters, '&'); } return result; }
[ "public", "String", "toQueryString", "(", ")", "{", "String", "result", "=", "null", ";", "List", "<", "String", ">", "parameters", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "ent...
A value suitable for constructinng URIs with. This means that if there are no parameters, null will be returned. @return If the map is empty, null, otherwise an escaped query string.
[ "A", "value", "suitable", "for", "constructinng", "URIs", "with", ".", "This", "means", "that", "if", "there", "are", "no", "parameters", "null", "will", "be", "returned", "." ]
train
https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/helpers/QueryString.java#L72-L97