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
airomem/airomem
airomem-chatsample/airomem-chatsample-web/src/main/java/pl/setblack/chatsample/servlet/ChatServlet.java
ChatServlet.processRequest
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); if (!request.getServletPath().endsWith("insecure")) { response.addHeader("Content-Security-Policy", buildCSPHeader()); } request.getRequestDispatcher("WEB-INF/chatq.jspx").forward(request, response); }
java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); if (!request.getServletPath().endsWith("insecure")) { response.addHeader("Content-Security-Policy", buildCSPHeader()); } request.getRequestDispatcher("WEB-INF/chatq.jspx").forward(request, response); }
[ "protected", "void", "processRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "response", ".", "setContentType", "(", "\"text/html;charset=UTF-8\"", ")", ";", "if", "(", ...
Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. @param request servlet request @param response servlet response @throws ServletException if a servlet-specific error occurs @throws IOException if an I/O error occurs
[ "Processes", "requests", "for", "both", "HTTP", "<code", ">", "GET<", "/", "code", ">", "and", "<code", ">", "POST<", "/", "code", ">", "methods", "." ]
train
https://github.com/airomem/airomem/blob/281ce18ff64836fccfb0edab18b8d677f1101a32/airomem-chatsample/airomem-chatsample-web/src/main/java/pl/setblack/chatsample/servlet/ChatServlet.java#L30-L37
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java
CacheSetUtil.values
public static <T> Single<Set<T>> values(String key, Class<T> vClazz) { return values(CacheService.CACHE_CONFIG_BEAN, key, vClazz); }
java
public static <T> Single<Set<T>> values(String key, Class<T> vClazz) { return values(CacheService.CACHE_CONFIG_BEAN, key, vClazz); }
[ "public", "static", "<", "T", ">", "Single", "<", "Set", "<", "T", ">", ">", "values", "(", "String", "key", ",", "Class", "<", "T", ">", "vClazz", ")", "{", "return", "values", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "key", ",", "vClazz"...
retrial the cached set @param key key @param vClazz value class @param <T> generic type @return the value set
[ "retrial", "the", "cached", "set" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java#L144-L146
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/servicelocator/ejb/ServiceLocator.java
ServiceLocator.getRemoteHome
public EJBHome getRemoteHome(String jndiHomeName, Class className) throws ServiceLocatorException { EJBHome home = null; try { Object objref = ic.lookup(jndiHomeName); Object obj = PortableRemoteObject.narrow(objref, className); home = (EJBHome) obj; } catch (NamingException ne) { throw new ServiceLocatorException(ne); } catch (Exception e) { throw new ServiceLocatorException(e); } return home; }
java
public EJBHome getRemoteHome(String jndiHomeName, Class className) throws ServiceLocatorException { EJBHome home = null; try { Object objref = ic.lookup(jndiHomeName); Object obj = PortableRemoteObject.narrow(objref, className); home = (EJBHome) obj; } catch (NamingException ne) { throw new ServiceLocatorException(ne); } catch (Exception e) { throw new ServiceLocatorException(e); } return home; }
[ "public", "EJBHome", "getRemoteHome", "(", "String", "jndiHomeName", ",", "Class", "className", ")", "throws", "ServiceLocatorException", "{", "EJBHome", "home", "=", "null", ";", "try", "{", "Object", "objref", "=", "ic", ".", "lookup", "(", "jndiHomeName", "...
will get the ejb Remote home factory. clients need to cast to the type of EJBHome they desire @return the EJB Home corresponding to the homeName
[ "will", "get", "the", "ejb", "Remote", "home", "factory", ".", "clients", "need", "to", "cast", "to", "the", "type", "of", "EJBHome", "they", "desire" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/servicelocator/ejb/ServiceLocator.java#L63-L75
alkacon/opencms-core
src/org/opencms/synchronize/CmsSynchronize.java
CmsSynchronize.writeSyncList
private void writeSyncList() throws CmsException { // the sync list file in the server file system File syncListFile; syncListFile = new File(m_destinationPathInRfs, SYNCLIST_FILENAME); // prepare the streams to write the data FileOutputStream fOut = null; PrintWriter pOut = null; try { fOut = new FileOutputStream(syncListFile); pOut = new PrintWriter(fOut); pOut.println(CmsSynchronizeList.getFormatDescription()); // get all keys from the hash map and make an iterator on it Iterator<CmsSynchronizeList> values = m_newSyncList.values().iterator(); // loop through all values and write them to the sync list file in // a human readable format while (values.hasNext()) { CmsSynchronizeList sync = values.next(); //fOut.write(sync.toString().getBytes()); pOut.println(sync.toString()); } } catch (IOException e) { throw new CmsDbIoException(Messages.get().container(Messages.ERR_IO_WRITE_SYNCLIST_0), e); } finally { // close all streams that were used try { if (pOut != null) { pOut.flush(); pOut.close(); } if (fOut != null) { fOut.flush(); fOut.close(); } } catch (IOException e) { // ignore } } }
java
private void writeSyncList() throws CmsException { // the sync list file in the server file system File syncListFile; syncListFile = new File(m_destinationPathInRfs, SYNCLIST_FILENAME); // prepare the streams to write the data FileOutputStream fOut = null; PrintWriter pOut = null; try { fOut = new FileOutputStream(syncListFile); pOut = new PrintWriter(fOut); pOut.println(CmsSynchronizeList.getFormatDescription()); // get all keys from the hash map and make an iterator on it Iterator<CmsSynchronizeList> values = m_newSyncList.values().iterator(); // loop through all values and write them to the sync list file in // a human readable format while (values.hasNext()) { CmsSynchronizeList sync = values.next(); //fOut.write(sync.toString().getBytes()); pOut.println(sync.toString()); } } catch (IOException e) { throw new CmsDbIoException(Messages.get().container(Messages.ERR_IO_WRITE_SYNCLIST_0), e); } finally { // close all streams that were used try { if (pOut != null) { pOut.flush(); pOut.close(); } if (fOut != null) { fOut.flush(); fOut.close(); } } catch (IOException e) { // ignore } } }
[ "private", "void", "writeSyncList", "(", ")", "throws", "CmsException", "{", "// the sync list file in the server file system", "File", "syncListFile", ";", "syncListFile", "=", "new", "File", "(", "m_destinationPathInRfs", ",", "SYNCLIST_FILENAME", ")", ";", "// prepare ...
Writes the synchronization list of the current sync process to the server file system. <p> The file can be found in the synchronization folder @throws CmsException if something goes wrong
[ "Writes", "the", "synchronization", "list", "of", "the", "current", "sync", "process", "to", "the", "server", "file", "system", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/synchronize/CmsSynchronize.java#L1054-L1094
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.xdsl_setting_POST
public void xdsl_setting_POST(Boolean resellerFastModemShipping, Boolean resellerModemBasicConfig) throws IOException { String qPath = "/me/xdsl/setting"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "resellerFastModemShipping", resellerFastModemShipping); addBody(o, "resellerModemBasicConfig", resellerModemBasicConfig); exec(qPath, "POST", sb.toString(), o); }
java
public void xdsl_setting_POST(Boolean resellerFastModemShipping, Boolean resellerModemBasicConfig) throws IOException { String qPath = "/me/xdsl/setting"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "resellerFastModemShipping", resellerFastModemShipping); addBody(o, "resellerModemBasicConfig", resellerModemBasicConfig); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "xdsl_setting_POST", "(", "Boolean", "resellerFastModemShipping", ",", "Boolean", "resellerModemBasicConfig", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/xdsl/setting\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")...
Change xdsl settings linked to the nichandle REST: POST /me/xdsl/setting @param resellerModemBasicConfig [required] Let the modem with vendor configuration. It prevent to apply the config managed by ovh manager @param resellerFastModemShipping [required] Send the modem as soon as possible, do not wait the xdsl line to be active
[ "Change", "xdsl", "settings", "linked", "to", "the", "nichandle" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2181-L2188
alkacon/opencms-core
src/org/opencms/util/CmsHtml2TextConverter.java
CmsHtml2TextConverter.html2text
public static String html2text(String html, String encoding) throws Exception { // create the converter instance CmsHtml2TextConverter visitor = new CmsHtml2TextConverter(); return visitor.process(html, encoding); }
java
public static String html2text(String html, String encoding) throws Exception { // create the converter instance CmsHtml2TextConverter visitor = new CmsHtml2TextConverter(); return visitor.process(html, encoding); }
[ "public", "static", "String", "html2text", "(", "String", "html", ",", "String", "encoding", ")", "throws", "Exception", "{", "// create the converter instance", "CmsHtml2TextConverter", "visitor", "=", "new", "CmsHtml2TextConverter", "(", ")", ";", "return", "visitor...
Extracts the text from the given html content, assuming the given html encoding.<p> @param html the content to extract the plain text from @param encoding the encoding to use @return the text extracted from the given html content @throws Exception if something goes wrong
[ "Extracts", "the", "text", "from", "the", "given", "html", "content", "assuming", "the", "given", "html", "encoding", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsHtml2TextConverter.java#L62-L67
ixa-ehu/ixa-pipe-ml
src/main/java/eus/ixa/ixa/pipe/ml/features/TokenClassFeatureGenerator.java
TokenClassFeatureGenerator.processRangeOptions
private void processRangeOptions(final Map<String, String> properties) { final String featuresRange = properties.get("range"); final String[] rangeArray = Flags .processTokenClassFeaturesRange(featuresRange); if (rangeArray[0].equalsIgnoreCase("lower")) { this.isLower = true; } if (rangeArray[1].equalsIgnoreCase("wac")) { this.isWordAndClassFeature = true; } }
java
private void processRangeOptions(final Map<String, String> properties) { final String featuresRange = properties.get("range"); final String[] rangeArray = Flags .processTokenClassFeaturesRange(featuresRange); if (rangeArray[0].equalsIgnoreCase("lower")) { this.isLower = true; } if (rangeArray[1].equalsIgnoreCase("wac")) { this.isWordAndClassFeature = true; } }
[ "private", "void", "processRangeOptions", "(", "final", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "final", "String", "featuresRange", "=", "properties", ".", "get", "(", "\"range\"", ")", ";", "final", "String", "[", "]", "rangeArray"...
Process the options of which type of features are to be generated. @param properties the properties map
[ "Process", "the", "options", "of", "which", "type", "of", "features", "are", "to", "be", "generated", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/features/TokenClassFeatureGenerator.java#L139-L149
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/ClientService.java
ClientService.updateActive
public void updateActive(int profileId, String clientUUID, Boolean active) throws Exception { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_CLIENT + " SET " + Constants.CLIENT_IS_ACTIVE + "= ?" + " WHERE " + Constants.GENERIC_CLIENT_UUID + "= ? " + " AND " + Constants.GENERIC_PROFILE_ID + "= ?" ); statement.setBoolean(1, active); statement.setString(2, clientUUID); statement.setInt(3, profileId); statement.executeUpdate(); } catch (Exception e) { // ok to swallow this.. just means there wasn't any } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void updateActive(int profileId, String clientUUID, Boolean active) throws Exception { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_CLIENT + " SET " + Constants.CLIENT_IS_ACTIVE + "= ?" + " WHERE " + Constants.GENERIC_CLIENT_UUID + "= ? " + " AND " + Constants.GENERIC_PROFILE_ID + "= ?" ); statement.setBoolean(1, active); statement.setString(2, clientUUID); statement.setInt(3, profileId); statement.executeUpdate(); } catch (Exception e) { // ok to swallow this.. just means there wasn't any } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "updateActive", "(", "int", "profileId", ",", "String", "clientUUID", ",", "Boolean", "active", ")", "throws", "Exception", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", "...
disables the current active id, enables the new one selected @param profileId profile ID of the client @param clientUUID UUID of the client @param active true to make client active, false to make client inactive @throws Exception exception
[ "disables", "the", "current", "active", "id", "enables", "the", "new", "one", "selected" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/ClientService.java#L580-L603
apache/reef
lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java
YarnSubmissionHelper.addLocalResource
public YarnSubmissionHelper addLocalResource(final String resourceName, final LocalResource resource) { resources.put(resourceName, resource); return this; }
java
public YarnSubmissionHelper addLocalResource(final String resourceName, final LocalResource resource) { resources.put(resourceName, resource); return this; }
[ "public", "YarnSubmissionHelper", "addLocalResource", "(", "final", "String", "resourceName", ",", "final", "LocalResource", "resource", ")", "{", "resources", ".", "put", "(", "resourceName", ",", "resource", ")", ";", "return", "this", ";", "}" ]
Add a file to be localized on the driver. @param resourceName @param resource @return
[ "Add", "a", "file", "to", "be", "localized", "on", "the", "driver", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java#L161-L164
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsProvider.java
LocalMapStatsProvider.waitForReplicaAddress
private Address waitForReplicaAddress(int replica, IPartition partition, int backupCount) { int tryCount = RETRY_COUNT; Address replicaAddress = null; while (replicaAddress == null && partitionService.getMaxAllowedBackupCount() >= backupCount && tryCount-- > 0) { sleep(); replicaAddress = partition.getReplicaAddress(replica); } return replicaAddress; }
java
private Address waitForReplicaAddress(int replica, IPartition partition, int backupCount) { int tryCount = RETRY_COUNT; Address replicaAddress = null; while (replicaAddress == null && partitionService.getMaxAllowedBackupCount() >= backupCount && tryCount-- > 0) { sleep(); replicaAddress = partition.getReplicaAddress(replica); } return replicaAddress; }
[ "private", "Address", "waitForReplicaAddress", "(", "int", "replica", ",", "IPartition", "partition", ",", "int", "backupCount", ")", "{", "int", "tryCount", "=", "RETRY_COUNT", ";", "Address", "replicaAddress", "=", "null", ";", "while", "(", "replicaAddress", ...
Waits partition table update to get replica address if current replica address is null.
[ "Waits", "partition", "table", "update", "to", "get", "replica", "address", "if", "current", "replica", "address", "is", "null", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsProvider.java#L287-L295
petergeneric/stdlib
guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/resteasy/ResteasyDispatcher.java
ResteasyDispatcher.startInitialise
private void startInitialise() { final Runnable worker = new GuiceInitThreadWorker(this.dispatcher); final Thread thread = new Thread(worker, "GuiceInit-" + dispatcher.getWebappPath()); thread.setDaemon(true); thread.start(); }
java
private void startInitialise() { final Runnable worker = new GuiceInitThreadWorker(this.dispatcher); final Thread thread = new Thread(worker, "GuiceInit-" + dispatcher.getWebappPath()); thread.setDaemon(true); thread.start(); }
[ "private", "void", "startInitialise", "(", ")", "{", "final", "Runnable", "worker", "=", "new", "GuiceInitThreadWorker", "(", "this", ".", "dispatcher", ")", ";", "final", "Thread", "thread", "=", "new", "Thread", "(", "worker", ",", "\"GuiceInit-\"", "+", "...
<p> Start a background process to initialise Guice </p> <p> This means that our servlet/filter does not block the startup of other Tomcat webapps. If we block startup we can cause a deadlock (we're waiting for them to come up but Tomcat will only let them start once we've returned from <code>init</code>) </p> <p> Circular startup dependencies are still a problem but that is unavoidable. </p>
[ "<p", ">", "Start", "a", "background", "process", "to", "initialise", "Guice", "<", "/", "p", ">", "<p", ">", "This", "means", "that", "our", "servlet", "/", "filter", "does", "not", "block", "the", "startup", "of", "other", "Tomcat", "webapps", ".", "...
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/webapp/src/main/java/com/peterphi/std/guice/web/rest/resteasy/ResteasyDispatcher.java#L75-L82
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java
Aggregations.bigDecimalMax
public static <Key, Value> Aggregation<Key, BigDecimal, BigDecimal> bigDecimalMax() { return new AggregationAdapter(new BigDecimalMaxAggregation<Key, Value>()); }
java
public static <Key, Value> Aggregation<Key, BigDecimal, BigDecimal> bigDecimalMax() { return new AggregationAdapter(new BigDecimalMaxAggregation<Key, Value>()); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Aggregation", "<", "Key", ",", "BigDecimal", ",", "BigDecimal", ">", "bigDecimalMax", "(", ")", "{", "return", "new", "AggregationAdapter", "(", "new", "BigDecimalMaxAggregation", "<", "Key", ",", "Value", ...
Returns an aggregation to find the {@link java.math.BigDecimal} maximum of all supplied values.<br/> This aggregation is similar to: <pre>SELECT MAX(value) FROM x</pre> @param <Key> the input key type @param <Value> the supplied value type @return the maximum value over all supplied values
[ "Returns", "an", "aggregation", "to", "find", "the", "{", "@link", "java", ".", "math", ".", "BigDecimal", "}", "maximum", "of", "all", "supplied", "values", ".", "<br", "/", ">", "This", "aggregation", "is", "similar", "to", ":", "<pre", ">", "SELECT", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L286-L288
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java
CommercePriceListPersistenceImpl.fetchByUUID_G
@Override public CommercePriceList fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
java
@Override public CommercePriceList fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
[ "@", "Override", "public", "CommercePriceList", "fetchByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "return", "fetchByUUID_G", "(", "uuid", ",", "groupId", ",", "true", ")", ";", "}" ]
Returns the commerce price list where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param uuid the uuid @param groupId the group ID @return the matching commerce price list, or <code>null</code> if a matching commerce price list could not be found
[ "Returns", "the", "commerce", "price", "list", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L707-L710
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
MemberEnter.initEnv
Env<AttrContext> initEnv(JCVariableDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dupto(new AttrContextEnv(tree, env.info.dup())); if (tree.sym.owner.kind == TYP) { localEnv.info.scope = env.info.scope.dupUnshared(tree.sym); } if ((tree.mods.flags & STATIC) != 0 || ((env.enclClass.sym.flags() & INTERFACE) != 0 && env.enclMethod == null)) localEnv.info.staticLevel++; return localEnv; }
java
Env<AttrContext> initEnv(JCVariableDecl tree, Env<AttrContext> env) { Env<AttrContext> localEnv = env.dupto(new AttrContextEnv(tree, env.info.dup())); if (tree.sym.owner.kind == TYP) { localEnv.info.scope = env.info.scope.dupUnshared(tree.sym); } if ((tree.mods.flags & STATIC) != 0 || ((env.enclClass.sym.flags() & INTERFACE) != 0 && env.enclMethod == null)) localEnv.info.staticLevel++; return localEnv; }
[ "Env", "<", "AttrContext", ">", "initEnv", "(", "JCVariableDecl", "tree", ",", "Env", "<", "AttrContext", ">", "env", ")", "{", "Env", "<", "AttrContext", ">", "localEnv", "=", "env", ".", "dupto", "(", "new", "AttrContextEnv", "(", "tree", ",", "env", ...
Create a fresh environment for a variable's initializer. If the variable is a field, the owner of the environment's scope is be the variable itself, otherwise the owner is the method enclosing the variable definition. @param tree The variable definition. @param env The environment current outside of the variable definition.
[ "Create", "a", "fresh", "environment", "for", "a", "variable", "s", "initializer", ".", "If", "the", "variable", "is", "a", "field", "the", "owner", "of", "the", "environment", "s", "scope", "is", "be", "the", "variable", "itself", "otherwise", "the", "own...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java#L411-L420
jamesagnew/hapi-fhir
hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java
IniFile.getStringProperty
public String getStringProperty(String pstrSection, String pstrProp) { String strRet = null; INIProperty objProp = null; INISection objSec = null; objSec = (INISection) this.mhmapSections.get(pstrSection); if (objSec != null) { objProp = objSec.getProperty(pstrProp); if (objProp != null) { strRet = objProp.getPropValue(); objProp = null; } objSec = null; } return strRet; }
java
public String getStringProperty(String pstrSection, String pstrProp) { String strRet = null; INIProperty objProp = null; INISection objSec = null; objSec = (INISection) this.mhmapSections.get(pstrSection); if (objSec != null) { objProp = objSec.getProperty(pstrProp); if (objProp != null) { strRet = objProp.getPropValue(); objProp = null; } objSec = null; } return strRet; }
[ "public", "String", "getStringProperty", "(", "String", "pstrSection", ",", "String", "pstrProp", ")", "{", "String", "strRet", "=", "null", ";", "INIProperty", "objProp", "=", "null", ";", "INISection", "objSec", "=", "null", ";", "objSec", "=", "(", "INISe...
Returns the specified string property from the specified section. @param pstrSection the INI section name. @param pstrProp the property to be retrieved. @return the string property value.
[ "Returns", "the", "specified", "string", "property", "from", "the", "specified", "section", "." ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L113-L131
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/DBManagerService.java
DBManagerService.sameTenantDefs
private static boolean sameTenantDefs(TenantDefinition tenantDef1, TenantDefinition tenantDef2) { return isEqual(tenantDef1.getProperty(TenantService.CREATED_ON_PROP), tenantDef2.getProperty(TenantService.CREATED_ON_PROP)) && isEqual(tenantDef1.getProperty(TenantService.CREATED_ON_PROP), tenantDef2.getProperty(TenantService.CREATED_ON_PROP)); }
java
private static boolean sameTenantDefs(TenantDefinition tenantDef1, TenantDefinition tenantDef2) { return isEqual(tenantDef1.getProperty(TenantService.CREATED_ON_PROP), tenantDef2.getProperty(TenantService.CREATED_ON_PROP)) && isEqual(tenantDef1.getProperty(TenantService.CREATED_ON_PROP), tenantDef2.getProperty(TenantService.CREATED_ON_PROP)); }
[ "private", "static", "boolean", "sameTenantDefs", "(", "TenantDefinition", "tenantDef1", ",", "TenantDefinition", "tenantDef2", ")", "{", "return", "isEqual", "(", "tenantDef1", ".", "getProperty", "(", "TenantService", ".", "CREATED_ON_PROP", ")", ",", "tenantDef2", ...
stamps, allowing for either property to be null for older definitions.
[ "stamps", "allowing", "for", "either", "property", "to", "be", "null", "for", "older", "definitions", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBManagerService.java#L260-L265
yan74/afplib
org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java
BaseValidator.validateModcaString4_MinLength
public boolean validateModcaString4_MinLength(String modcaString4, DiagnosticChain diagnostics, Map<Object, Object> context) { int length = modcaString4.length(); boolean result = length >= 4; if (!result && diagnostics != null) reportMinLengthViolation(BasePackage.Literals.MODCA_STRING4, modcaString4, length, 4, diagnostics, context); return result; }
java
public boolean validateModcaString4_MinLength(String modcaString4, DiagnosticChain diagnostics, Map<Object, Object> context) { int length = modcaString4.length(); boolean result = length >= 4; if (!result && diagnostics != null) reportMinLengthViolation(BasePackage.Literals.MODCA_STRING4, modcaString4, length, 4, diagnostics, context); return result; }
[ "public", "boolean", "validateModcaString4_MinLength", "(", "String", "modcaString4", ",", "DiagnosticChain", "diagnostics", ",", "Map", "<", "Object", ",", "Object", ">", "context", ")", "{", "int", "length", "=", "modcaString4", ".", "length", "(", ")", ";", ...
Validates the MinLength constraint of '<em>Modca String4</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "Validates", "the", "MinLength", "constraint", "of", "<em", ">", "Modca", "String4<", "/", "em", ">", ".", "<!", "--", "begin", "-", "user", "-", "doc", "--", ">", "<!", "--", "end", "-", "user", "-", "doc", "--", ">" ]
train
https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/base/util/BaseValidator.java#L186-L192
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/ArrayUtil.java
ArrayUtil.countSameElements
public static int countSameElements(byte[] arra, int start, byte[] arrb) { int k = 0; int limit = arra.length - start; if (limit > arrb.length) { limit = arrb.length; } for (int i = 0; i < limit; i++) { if (arra[i + start] == arrb[i]) { k++; } else { break; } } return k; }
java
public static int countSameElements(byte[] arra, int start, byte[] arrb) { int k = 0; int limit = arra.length - start; if (limit > arrb.length) { limit = arrb.length; } for (int i = 0; i < limit; i++) { if (arra[i + start] == arrb[i]) { k++; } else { break; } } return k; }
[ "public", "static", "int", "countSameElements", "(", "byte", "[", "]", "arra", ",", "int", "start", ",", "byte", "[", "]", "arrb", ")", "{", "int", "k", "=", "0", ";", "int", "limit", "=", "arra", ".", "length", "-", "start", ";", "if", "(", "lim...
Returns the count of elements in arra from position start that are sequentially equal to the elements of arrb.
[ "Returns", "the", "count", "of", "elements", "in", "arra", "from", "position", "start", "that", "are", "sequentially", "equal", "to", "the", "elements", "of", "arrb", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/ArrayUtil.java#L518-L536
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/GuavaSerIteratorFactory.java
GuavaSerIteratorFactory.listMultimap
public static final SerIterable listMultimap(final Class<?> keyType, final Class<?> valueType, final List<Class<?>> valueTypeTypes) { final ListMultimap<Object, Object> map = ArrayListMultimap.create(); return new SerIterable() { @Override public SerIterator iterator() { return multimap(map, Object.class, keyType, valueType, valueTypeTypes); } @Override public void add(Object key, Object column, Object value, int count) { if (key == null) { throw new IllegalArgumentException("Missing key"); } if (count != 1) { throw new IllegalArgumentException("Unexpected count"); } map.put(key, value); } @Override public Object build() { return map; } @Override public SerCategory category() { return SerCategory.MAP; } @Override public Class<?> keyType() { return keyType; } @Override public Class<?> valueType() { return valueType; } @Override public List<Class<?>> valueTypeTypes() { return valueTypeTypes; } }; }
java
public static final SerIterable listMultimap(final Class<?> keyType, final Class<?> valueType, final List<Class<?>> valueTypeTypes) { final ListMultimap<Object, Object> map = ArrayListMultimap.create(); return new SerIterable() { @Override public SerIterator iterator() { return multimap(map, Object.class, keyType, valueType, valueTypeTypes); } @Override public void add(Object key, Object column, Object value, int count) { if (key == null) { throw new IllegalArgumentException("Missing key"); } if (count != 1) { throw new IllegalArgumentException("Unexpected count"); } map.put(key, value); } @Override public Object build() { return map; } @Override public SerCategory category() { return SerCategory.MAP; } @Override public Class<?> keyType() { return keyType; } @Override public Class<?> valueType() { return valueType; } @Override public List<Class<?>> valueTypeTypes() { return valueTypeTypes; } }; }
[ "public", "static", "final", "SerIterable", "listMultimap", "(", "final", "Class", "<", "?", ">", "keyType", ",", "final", "Class", "<", "?", ">", "valueType", ",", "final", "List", "<", "Class", "<", "?", ">", ">", "valueTypeTypes", ")", "{", "final", ...
Gets an iterable wrapper for {@code ListMultimap}. @param keyType the key type, not null @param valueType the value type, not null @param valueTypeTypes the generic parameters of the value type @return the iterable, not null
[ "Gets", "an", "iterable", "wrapper", "for", "{", "@code", "ListMultimap", "}", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/GuavaSerIteratorFactory.java#L387-L425
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java
CertificatesImpl.addAsync
public Observable<Void> addAsync(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions) { return addWithServiceResponseAsync(certificate, certificateAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, CertificateAddHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, CertificateAddHeaders> response) { return response.body(); } }); }
java
public Observable<Void> addAsync(CertificateAddParameter certificate, CertificateAddOptions certificateAddOptions) { return addWithServiceResponseAsync(certificate, certificateAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, CertificateAddHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, CertificateAddHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "addAsync", "(", "CertificateAddParameter", "certificate", ",", "CertificateAddOptions", "certificateAddOptions", ")", "{", "return", "addWithServiceResponseAsync", "(", "certificate", ",", "certificateAddOptions", ")", ".", "map"...
Adds a certificate to the specified account. @param certificate The certificate to be added. @param certificateAddOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Adds", "a", "certificate", "to", "the", "specified", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java#L221-L228
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Interval.java
Interval.withStartTime
public Interval withStartTime(LocalTime time) { requireNonNull(time); return new Interval(startDate, time, endDate, endTime, zoneId); }
java
public Interval withStartTime(LocalTime time) { requireNonNull(time); return new Interval(startDate, time, endDate, endTime, zoneId); }
[ "public", "Interval", "withStartTime", "(", "LocalTime", "time", ")", "{", "requireNonNull", "(", "time", ")", ";", "return", "new", "Interval", "(", "startDate", ",", "time", ",", "endDate", ",", "endTime", ",", "zoneId", ")", ";", "}" ]
Returns a new interval based on this interval but with a different start time. @param time the new start time @return a new interval
[ "Returns", "a", "new", "interval", "based", "on", "this", "interval", "but", "with", "a", "different", "start", "time", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Interval.java#L343-L346
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java
DiscountCurveInterpolation.createDiscountCurveFromZeroRates
public static DiscountCurveInterpolation createDiscountCurveFromZeroRates( String name, Date referenceDate, double[] times, double[] givenZeroRates, boolean[] isParameter, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) { return createDiscountCurveFromZeroRates(name, referenceDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), times, givenZeroRates, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity); }
java
public static DiscountCurveInterpolation createDiscountCurveFromZeroRates( String name, Date referenceDate, double[] times, double[] givenZeroRates, boolean[] isParameter, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) { return createDiscountCurveFromZeroRates(name, referenceDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), times, givenZeroRates, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity); }
[ "public", "static", "DiscountCurveInterpolation", "createDiscountCurveFromZeroRates", "(", "String", "name", ",", "Date", "referenceDate", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenZeroRates", ",", "boolean", "[", "]", "isParameter", ",", "I...
Create a discount curve from given times and given zero rates using given interpolation and extrapolation methods. The discount factor is determined by <code> givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]); </code> @param name The name of this discount curve. @param referenceDate The reference date for this curve, i.e., the date which defined t=0. @param times Array of times as doubles. @param givenZeroRates Array of corresponding zero rates. @param isParameter Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves). @param interpolationMethod The interpolation method used for the curve. @param extrapolationMethod The extrapolation method used for the curve. @param interpolationEntity The entity interpolated/extrapolated. @return A new discount factor object.
[ "Create", "a", "discount", "curve", "from", "given", "times", "and", "given", "zero", "rates", "using", "given", "interpolation", "and", "extrapolation", "methods", ".", "The", "discount", "factor", "is", "determined", "by", "<code", ">", "givenDiscountFactors", ...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java#L214-L220
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/broker/DefaultBrokerCache.java
DefaultBrokerCache.getAutoScoped
@SuppressWarnings(value = "unchecked") <T, K extends SharedResourceKey> T getAutoScoped(final SharedResourceFactory<T, K, S> factory, final K key, final SharedResourcesBrokerImpl<S> broker) throws ExecutionException { // figure out auto scope RawJobBrokerKey autoscopeCacheKey = new RawJobBrokerKey(broker.getWrappedSelfScope(), factory.getName(), key); ScopeWrapper<S> selectedScope = this.autoScopeCache.get(autoscopeCacheKey, new Callable<ScopeWrapper<S>>() { @Override public ScopeWrapper<S> call() throws Exception { return broker.getWrappedScope(factory.getAutoScope(broker, broker.getConfigView(null, key, factory.getName()))); } }); // get actual object return getScoped(factory, key, selectedScope, broker); }
java
@SuppressWarnings(value = "unchecked") <T, K extends SharedResourceKey> T getAutoScoped(final SharedResourceFactory<T, K, S> factory, final K key, final SharedResourcesBrokerImpl<S> broker) throws ExecutionException { // figure out auto scope RawJobBrokerKey autoscopeCacheKey = new RawJobBrokerKey(broker.getWrappedSelfScope(), factory.getName(), key); ScopeWrapper<S> selectedScope = this.autoScopeCache.get(autoscopeCacheKey, new Callable<ScopeWrapper<S>>() { @Override public ScopeWrapper<S> call() throws Exception { return broker.getWrappedScope(factory.getAutoScope(broker, broker.getConfigView(null, key, factory.getName()))); } }); // get actual object return getScoped(factory, key, selectedScope, broker); }
[ "@", "SuppressWarnings", "(", "value", "=", "\"unchecked\"", ")", "<", "T", ",", "K", "extends", "SharedResourceKey", ">", "T", "getAutoScoped", "(", "final", "SharedResourceFactory", "<", "T", ",", "K", ",", "S", ">", "factory", ",", "final", "K", "key", ...
Get an object for the specified factory, key, and broker at the scope selected by the factory. {@link DefaultBrokerCache} guarantees that calling this method from brokers with the same leaf scope will return the same object.
[ "Get", "an", "object", "for", "the", "specified", "factory", "key", "and", "broker", "at", "the", "scope", "selected", "by", "the", "factory", ".", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/broker/DefaultBrokerCache.java#L87-L103
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java
ExpressRouteCrossConnectionsInner.listRoutesTableAsync
public Observable<ExpressRouteCircuitsRoutesTableListResultInner> listRoutesTableAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) { return listRoutesTableWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCircuitsRoutesTableListResultInner>, ExpressRouteCircuitsRoutesTableListResultInner>() { @Override public ExpressRouteCircuitsRoutesTableListResultInner call(ServiceResponse<ExpressRouteCircuitsRoutesTableListResultInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCircuitsRoutesTableListResultInner> listRoutesTableAsync(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) { return listRoutesTableWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCircuitsRoutesTableListResultInner>, ExpressRouteCircuitsRoutesTableListResultInner>() { @Override public ExpressRouteCircuitsRoutesTableListResultInner call(ServiceResponse<ExpressRouteCircuitsRoutesTableListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCircuitsRoutesTableListResultInner", ">", "listRoutesTableAsync", "(", "String", "resourceGroupName", ",", "String", "crossConnectionName", ",", "String", "peeringName", ",", "String", "devicePath", ")", "{", "return", "listRoutesTa...
Gets the currently advertised routes table associated with the express route cross connection in a resource group. @param resourceGroupName The name of the resource group. @param crossConnectionName The name of the ExpressRouteCrossConnection. @param peeringName The name of the peering. @param devicePath The path of the device. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Gets", "the", "currently", "advertised", "routes", "table", "associated", "with", "the", "express", "route", "cross", "connection", "in", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L1315-L1322
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/background/Parallax.java
Parallax.renderLine
private void renderLine(Graphic g, int numLine, int lineY) { final int lineWidth = surface.getLineWidth(numLine); for (int j = -amplitude; j < amplitude; j++) { final int lx = (int) (-offsetX + offsetX * j - x[numLine] - x2[numLine] + numLine * (2.56 * factH) * j); if (lx + lineWidth + decX >= 0 && lx <= screenWidth) { surface.render(g, numLine, lx + decX, lineY); } } }
java
private void renderLine(Graphic g, int numLine, int lineY) { final int lineWidth = surface.getLineWidth(numLine); for (int j = -amplitude; j < amplitude; j++) { final int lx = (int) (-offsetX + offsetX * j - x[numLine] - x2[numLine] + numLine * (2.56 * factH) * j); if (lx + lineWidth + decX >= 0 && lx <= screenWidth) { surface.render(g, numLine, lx + decX, lineY); } } }
[ "private", "void", "renderLine", "(", "Graphic", "g", ",", "int", "numLine", ",", "int", "lineY", ")", "{", "final", "int", "lineWidth", "=", "surface", ".", "getLineWidth", "(", "numLine", ")", ";", "for", "(", "int", "j", "=", "-", "amplitude", ";", ...
Render parallax line. @param g The graphic output. @param numLine The current line number. @param lineY The line y position.
[ "Render", "parallax", "line", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/background/Parallax.java#L125-L136
craterdog/java-general-utilities
src/main/java/craterdog/utils/ByteUtils.java
ByteUtils.bytesToBigInteger
static public BigInteger bytesToBigInteger(byte[] buffer, int index) { int length = bytesToInt(buffer, index); // pull out the length of the big integer index += 4; byte[] bytes = new byte[length]; System.arraycopy(buffer, index, bytes, 0, length); // pull out the bytes for the big integer return new BigInteger(bytes); }
java
static public BigInteger bytesToBigInteger(byte[] buffer, int index) { int length = bytesToInt(buffer, index); // pull out the length of the big integer index += 4; byte[] bytes = new byte[length]; System.arraycopy(buffer, index, bytes, 0, length); // pull out the bytes for the big integer return new BigInteger(bytes); }
[ "static", "public", "BigInteger", "bytesToBigInteger", "(", "byte", "[", "]", "buffer", ",", "int", "index", ")", "{", "int", "length", "=", "bytesToInt", "(", "buffer", ",", "index", ")", ";", "// pull out the length of the big integer", "index", "+=", "4", "...
This function converts the bytes in a byte array at the specified index to its corresponding big integer value. @param buffer The byte array containing the big integer. @param index The index for the first byte in the byte array. @return The corresponding big integer value.
[ "This", "function", "converts", "the", "bytes", "in", "a", "byte", "array", "at", "the", "specified", "index", "to", "its", "corresponding", "big", "integer", "value", "." ]
train
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L383-L389
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java
KeyVaultClientCustomImpl.listCertificateIssuers
public PagedList<CertificateIssuerItem> listCertificateIssuers(final String vaultBaseUrl, final Integer maxresults) { return getCertificateIssuers(vaultBaseUrl, maxresults); }
java
public PagedList<CertificateIssuerItem> listCertificateIssuers(final String vaultBaseUrl, final Integer maxresults) { return getCertificateIssuers(vaultBaseUrl, maxresults); }
[ "public", "PagedList", "<", "CertificateIssuerItem", ">", "listCertificateIssuers", "(", "final", "String", "vaultBaseUrl", ",", "final", "Integer", "maxresults", ")", "{", "return", "getCertificateIssuers", "(", "vaultBaseUrl", ",", "maxresults", ")", ";", "}" ]
List certificate issuers for the specified vault. @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @return the PagedList&lt;CertificateIssuerItem&gt; if successful.
[ "List", "certificate", "issuers", "for", "the", "specified", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L1381-L1384
googleapis/google-cloud-java
google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Subscriber.java
Subscriber.newBuilder
public static Builder newBuilder(ProjectSubscriptionName subscription, MessageReceiver receiver) { return newBuilder(subscription.toString(), receiver); }
java
public static Builder newBuilder(ProjectSubscriptionName subscription, MessageReceiver receiver) { return newBuilder(subscription.toString(), receiver); }
[ "public", "static", "Builder", "newBuilder", "(", "ProjectSubscriptionName", "subscription", ",", "MessageReceiver", "receiver", ")", "{", "return", "newBuilder", "(", "subscription", ".", "toString", "(", ")", ",", "receiver", ")", ";", "}" ]
Constructs a new {@link Builder}. @param subscription Cloud Pub/Sub subscription to bind the subscriber to @param receiver an implementation of {@link MessageReceiver} used to process the received messages
[ "Constructs", "a", "new", "{", "@link", "Builder", "}", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Subscriber.java#L199-L201
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java
FileHelper.isParentDirectory
@SuppressFBWarnings ("IL_INFINITE_LOOP") public static boolean isParentDirectory (@Nonnull final File aSearchDirectory, @Nonnull final File aStartDirectory) { ValueEnforcer.notNull (aSearchDirectory, "SearchDirectory"); ValueEnforcer.notNull (aStartDirectory, "StartDirectory"); File aRealSearchDirectory = aSearchDirectory.getAbsoluteFile (); File aRealStartDirectory = aStartDirectory.getAbsoluteFile (); try { aRealSearchDirectory = getCanonicalFile (aRealSearchDirectory); aRealStartDirectory = getCanonicalFile (aRealStartDirectory); } catch (final IOException ex) { // ignore } if (!aRealSearchDirectory.isDirectory ()) return false; File aParent = aRealStartDirectory; while (aParent != null) { if (aParent.equals (aRealSearchDirectory)) return true; aParent = aParent.getParentFile (); } return false; }
java
@SuppressFBWarnings ("IL_INFINITE_LOOP") public static boolean isParentDirectory (@Nonnull final File aSearchDirectory, @Nonnull final File aStartDirectory) { ValueEnforcer.notNull (aSearchDirectory, "SearchDirectory"); ValueEnforcer.notNull (aStartDirectory, "StartDirectory"); File aRealSearchDirectory = aSearchDirectory.getAbsoluteFile (); File aRealStartDirectory = aStartDirectory.getAbsoluteFile (); try { aRealSearchDirectory = getCanonicalFile (aRealSearchDirectory); aRealStartDirectory = getCanonicalFile (aRealStartDirectory); } catch (final IOException ex) { // ignore } if (!aRealSearchDirectory.isDirectory ()) return false; File aParent = aRealStartDirectory; while (aParent != null) { if (aParent.equals (aRealSearchDirectory)) return true; aParent = aParent.getParentFile (); } return false; }
[ "@", "SuppressFBWarnings", "(", "\"IL_INFINITE_LOOP\"", ")", "public", "static", "boolean", "isParentDirectory", "(", "@", "Nonnull", "final", "File", "aSearchDirectory", ",", "@", "Nonnull", "final", "File", "aStartDirectory", ")", "{", "ValueEnforcer", ".", "notNu...
Check if the searched directory is a parent object of the start directory @param aSearchDirectory The directory to be searched. May not be <code>null</code>. @param aStartDirectory The directory where the search starts. May not be <code>null</code>. @return <code>true</code> if the search directory is a parent of the start directory, <code>false</code> otherwise. @see #getCanonicalFile(File)
[ "Check", "if", "the", "searched", "directory", "is", "a", "parent", "object", "of", "the", "start", "directory" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java#L264-L292
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/text/CharTrieIndex.java
CharTrieIndex.indexWords
public static CharTrie indexWords(Collection<String> documents, int maxLevels, int minWeight) { return create(documents, maxLevels, minWeight, true); }
java
public static CharTrie indexWords(Collection<String> documents, int maxLevels, int minWeight) { return create(documents, maxLevels, minWeight, true); }
[ "public", "static", "CharTrie", "indexWords", "(", "Collection", "<", "String", ">", "documents", ",", "int", "maxLevels", ",", "int", "minWeight", ")", "{", "return", "create", "(", "documents", ",", "maxLevels", ",", "minWeight", ",", "true", ")", ";", "...
Index words char trie. @param documents the documents @param maxLevels the max levels @param minWeight the min weight @return the char trie
[ "Index", "words", "char", "trie", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/text/CharTrieIndex.java#L77-L79
PrashamTrivedi/SharedPreferenceInspector
sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/SharedPrefsBrowser.java
SharedPrefsBrowser.startFragment
public void startFragment(Fragment fragment, String tag, boolean canAddToBackstack) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer, fragment); if (canAddToBackstack) { transaction.addToBackStack(tag); } transaction.commit(); }
java
public void startFragment(Fragment fragment, String tag, boolean canAddToBackstack) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction().replace(R.id.fragmentContainer, fragment); if (canAddToBackstack) { transaction.addToBackStack(tag); } transaction.commit(); }
[ "public", "void", "startFragment", "(", "Fragment", "fragment", ",", "String", "tag", ",", "boolean", "canAddToBackstack", ")", "{", "FragmentTransaction", "transaction", "=", "getSupportFragmentManager", "(", ")", ".", "beginTransaction", "(", ")", ".", "replace", ...
Start given Fragment @param fragment : Fragment Instance to start. @param tag : Tag to be notified when adding to backstack @param canAddToBackstack : pass <code>true</code> if you want to add this item in backstack. pass <code>false</code> otherwise
[ "Start", "given", "Fragment" ]
train
https://github.com/PrashamTrivedi/SharedPreferenceInspector/blob/c04d567c4d0fc5e0f8cda308ca85df19c6b3b838/sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/SharedPrefsBrowser.java#L36-L43
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/LegacySpy.java
LegacySpy.expectBetween
@Deprecated public C expectBetween(int minAllowedStatements, int maxAllowedStatements, Threads threadMatcher) { return expect(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements).threads(threadMatcher)); }
java
@Deprecated public C expectBetween(int minAllowedStatements, int maxAllowedStatements, Threads threadMatcher) { return expect(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements).threads(threadMatcher)); }
[ "@", "Deprecated", "public", "C", "expectBetween", "(", "int", "minAllowedStatements", ",", "int", "maxAllowedStatements", ",", "Threads", "threadMatcher", ")", "{", "return", "expect", "(", "SqlQueries", ".", "queriesBetween", "(", "minAllowedStatements", ",", "max...
Adds an expectation to the current instance that at least {@code minAllowedStatements} and at most {@code maxAllowedStatements} were called between the creation of the current instance and a call to {@link #verify()} method @since 2.0
[ "Adds", "an", "expectation", "to", "the", "current", "instance", "that", "at", "least", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L597-L600
meltmedia/cadmium
cli/src/main/java/com/meltmedia/cadmium/cli/DeployCommand.java
DeployCommand.canCheckWar
public boolean canCheckWar(String warName, String url, HttpClient client) { HttpOptions opt = new HttpOptions(url + "/" + warName); try { HttpResponse response = client.execute(opt); if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { Header allowHeader[] = response.getHeaders("Allow"); for(Header allow : allowHeader) { List<String> values = Arrays.asList(allow.getValue().toUpperCase().split(",")); if(values.contains("GET")) { return true; } } } EntityUtils.consumeQuietly(response.getEntity()); } catch (Exception e) { log.warn("Failed to check if endpoint exists.", e); } finally { opt.releaseConnection(); } return false; }
java
public boolean canCheckWar(String warName, String url, HttpClient client) { HttpOptions opt = new HttpOptions(url + "/" + warName); try { HttpResponse response = client.execute(opt); if(response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { Header allowHeader[] = response.getHeaders("Allow"); for(Header allow : allowHeader) { List<String> values = Arrays.asList(allow.getValue().toUpperCase().split(",")); if(values.contains("GET")) { return true; } } } EntityUtils.consumeQuietly(response.getEntity()); } catch (Exception e) { log.warn("Failed to check if endpoint exists.", e); } finally { opt.releaseConnection(); } return false; }
[ "public", "boolean", "canCheckWar", "(", "String", "warName", ",", "String", "url", ",", "HttpClient", "client", ")", "{", "HttpOptions", "opt", "=", "new", "HttpOptions", "(", "url", "+", "\"/\"", "+", "warName", ")", ";", "try", "{", "HttpResponse", "res...
Checks via an http options request that the endpoint exists to check for deployment state. @param warName @param url @param client @return
[ "Checks", "via", "an", "http", "options", "request", "that", "the", "endpoint", "exists", "to", "check", "for", "deployment", "state", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/DeployCommand.java#L200-L220
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/files/FileServiceRootImpl.java
FileServiceRootImpl.bind
public void bind(String address, @Service FileServiceBind service) { _bindMap.put(address, service); }
java
public void bind(String address, @Service FileServiceBind service) { _bindMap.put(address, service); }
[ "public", "void", "bind", "(", "String", "address", ",", "@", "Service", "FileServiceBind", "service", ")", "{", "_bindMap", ".", "put", "(", "address", ",", "service", ")", ";", "}" ]
/* public void addFile(String dir, String tail) { boolean isEphemeral = false; if (isEphemeral) { String metaKey = getMetaKey(dir + "/" + tail); _metaStore.put(metaKey, _selfServer); } BfsFileImpl dirService = lookupImpl(dir); dirService.addFile(tail, Result.ignore()); }
[ "/", "*", "public", "void", "addFile", "(", "String", "dir", "String", "tail", ")", "{", "boolean", "isEphemeral", "=", "false", ";" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/files/FileServiceRootImpl.java#L889-L892
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optString
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static String optString(@Nullable Bundle bundle, @Nullable String key, @Nullable String fallback) { if (bundle == null) { return fallback; } return bundle.getString(key, fallback); }
java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static String optString(@Nullable Bundle bundle, @Nullable String key, @Nullable String fallback) { if (bundle == null) { return fallback; } return bundle.getString(key, fallback); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "public", "static", "String", "optString", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ",", "@", "Nullable", "String", "fallback", ")", "{", "i...
Returns a optional {@link java.lang.String} value. In other words, returns the value mapped by key if it exists and is a {@link java.lang.String}. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @param fallback fallback value. @return a {@link java.lang.String} value if exists, fallback value otherwise. @see android.os.Bundle#getString(String, String)
[ "Returns", "a", "optional", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L979-L985
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.appendString
public static File appendString(String content, String path, String charset) throws IORuntimeException { return appendString(content, touch(path), charset); }
java
public static File appendString(String content, String path, String charset) throws IORuntimeException { return appendString(content, touch(path), charset); }
[ "public", "static", "File", "appendString", "(", "String", "content", ",", "String", "path", ",", "String", "charset", ")", "throws", "IORuntimeException", "{", "return", "appendString", "(", "content", ",", "touch", "(", "path", ")", ",", "charset", ")", ";...
将String写入文件,追加模式 @param content 写入的内容 @param path 文件路径 @param charset 字符集 @return 写入的文件 @throws IORuntimeException IO异常
[ "将String写入文件,追加模式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2787-L2789
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseShortObj
@Nullable public static Short parseShortObj (@Nullable final String sStr, @Nullable final Short aDefault) { return parseShortObj (sStr, DEFAULT_RADIX, aDefault); }
java
@Nullable public static Short parseShortObj (@Nullable final String sStr, @Nullable final Short aDefault) { return parseShortObj (sStr, DEFAULT_RADIX, aDefault); }
[ "@", "Nullable", "public", "static", "Short", "parseShortObj", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nullable", "final", "Short", "aDefault", ")", "{", "return", "parseShortObj", "(", "sStr", ",", "DEFAULT_RADIX", ",", "aDefault", ")", ...
Parse the given {@link String} as {@link Short} with radix {@link #DEFAULT_RADIX}. @param sStr The string to parse. May be <code>null</code>. @param aDefault The default value to be returned if the passed string could not be converted to a valid value. May be <code>null</code>. @return <code>aDefault</code> if the string does not represent a valid value.
[ "Parse", "the", "given", "{", "@link", "String", "}", "as", "{", "@link", "Short", "}", "with", "radix", "{", "@link", "#DEFAULT_RADIX", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1335-L1339
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitCluster.java
SubunitCluster.mergeSequence
public boolean mergeSequence(SubunitCluster other, SubunitClustererParameters params) throws CompoundNotFoundException { PairwiseSequenceAlignerType alignerType = PairwiseSequenceAlignerType.LOCAL; if (params.isUseGlobalMetrics()) { alignerType = PairwiseSequenceAlignerType.GLOBAL; } return mergeSequence(other, params,alignerType , new SimpleGapPenalty(), SubstitutionMatrixHelper.getBlosum62()); }
java
public boolean mergeSequence(SubunitCluster other, SubunitClustererParameters params) throws CompoundNotFoundException { PairwiseSequenceAlignerType alignerType = PairwiseSequenceAlignerType.LOCAL; if (params.isUseGlobalMetrics()) { alignerType = PairwiseSequenceAlignerType.GLOBAL; } return mergeSequence(other, params,alignerType , new SimpleGapPenalty(), SubstitutionMatrixHelper.getBlosum62()); }
[ "public", "boolean", "mergeSequence", "(", "SubunitCluster", "other", ",", "SubunitClustererParameters", "params", ")", "throws", "CompoundNotFoundException", "{", "PairwiseSequenceAlignerType", "alignerType", "=", "PairwiseSequenceAlignerType", ".", "LOCAL", ";", "if", "("...
Merges the other SubunitCluster into this one if their representatives sequences are similar (according to the criteria in params). <p> The sequence alignment is performed using linear {@link SimpleGapPenalty} and BLOSUM62 as scoring matrix. @param other SubunitCluster @param params SubunitClustererParameters, with information whether to use local or global alignment, sequence identity and coverage thresholds. Threshold values lower than 0.7 are not recommended. Use {@link #mergeStructure} for lower values. @return true if the SubunitClusters were merged, false otherwise @throws CompoundNotFoundException
[ "Merges", "the", "other", "SubunitCluster", "into", "this", "one", "if", "their", "representatives", "sequences", "are", "similar", "(", "according", "to", "the", "criteria", "in", "params", ")", ".", "<p", ">", "The", "sequence", "alignment", "is", "performed...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitCluster.java#L221-L229
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/MoneyUtils.java
MoneyUtils.getMathContext
public static MathContext getMathContext(MonetaryContext monetaryContext, RoundingMode defaultMode) { MathContext ctx = monetaryContext.get(MathContext.class); if (ctx!=null) { return ctx; } RoundingMode roundingMode = monetaryContext.get(RoundingMode.class); if (roundingMode == null) { roundingMode = defaultMode; } if (roundingMode == null) { roundingMode = RoundingMode.HALF_EVEN; } return new MathContext(monetaryContext.getPrecision(), roundingMode); }
java
public static MathContext getMathContext(MonetaryContext monetaryContext, RoundingMode defaultMode) { MathContext ctx = monetaryContext.get(MathContext.class); if (ctx!=null) { return ctx; } RoundingMode roundingMode = monetaryContext.get(RoundingMode.class); if (roundingMode == null) { roundingMode = defaultMode; } if (roundingMode == null) { roundingMode = RoundingMode.HALF_EVEN; } return new MathContext(monetaryContext.getPrecision(), roundingMode); }
[ "public", "static", "MathContext", "getMathContext", "(", "MonetaryContext", "monetaryContext", ",", "RoundingMode", "defaultMode", ")", "{", "MathContext", "ctx", "=", "monetaryContext", ".", "get", "(", "MathContext", ".", "class", ")", ";", "if", "(", "ctx", ...
Evaluates the {@link MathContext} from the given {@link MonetaryContext}. @param monetaryContext the {@link MonetaryContext} @param defaultMode the default {@link RoundingMode}, to be used if no one is set in {@link MonetaryContext}. @return the corresponding {@link MathContext}
[ "Evaluates", "the", "{", "@link", "MathContext", "}", "from", "the", "given", "{", "@link", "MonetaryContext", "}", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/MoneyUtils.java#L117-L130
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.location_pccZone_stock_pcc_GET
public ArrayList<OvhPccStockProfile> location_pccZone_stock_pcc_GET(String pccZone) throws IOException { String qPath = "/dedicatedCloud/location/{pccZone}/stock/pcc"; StringBuilder sb = path(qPath, pccZone); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t9); }
java
public ArrayList<OvhPccStockProfile> location_pccZone_stock_pcc_GET(String pccZone) throws IOException { String qPath = "/dedicatedCloud/location/{pccZone}/stock/pcc"; StringBuilder sb = path(qPath, pccZone); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t9); }
[ "public", "ArrayList", "<", "OvhPccStockProfile", ">", "location_pccZone_stock_pcc_GET", "(", "String", "pccZone", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/location/{pccZone}/stock/pcc\"", ";", "StringBuilder", "sb", "=", "path", "(", ...
Available PCC stock REST: GET /dedicatedCloud/location/{pccZone}/stock/pcc @param pccZone [required] Name of pccZone
[ "Available", "PCC", "stock" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L3053-L3058
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/commands/CommandInvoker.java
CommandInvoker.invoke
public ReturnValue invoke(final String commandName, final String[] argsAry) { if ("_NRPE_CHECK".equals(commandName)) { return new ReturnValue(Status.OK, JNRPELIB.VERSION); } CommandDefinition cd = commandRepository.getCommand(commandName); if (cd == null) { return new ReturnValue(Status.UNKNOWN, "Bad command"); } return invoke(cd, argsAry); }
java
public ReturnValue invoke(final String commandName, final String[] argsAry) { if ("_NRPE_CHECK".equals(commandName)) { return new ReturnValue(Status.OK, JNRPELIB.VERSION); } CommandDefinition cd = commandRepository.getCommand(commandName); if (cd == null) { return new ReturnValue(Status.UNKNOWN, "Bad command"); } return invoke(cd, argsAry); }
[ "public", "ReturnValue", "invoke", "(", "final", "String", "commandName", ",", "final", "String", "[", "]", "argsAry", ")", "{", "if", "(", "\"_NRPE_CHECK\"", ".", "equals", "(", "commandName", ")", ")", "{", "return", "new", "ReturnValue", "(", "Status", ...
This method executes built in commands or builds a CommandDefinition to. execute external commands (plugins). The methods also expands the $ARG?$ macros. @param commandName The name of the command, as configured in the server configuration XML @param argsAry The arguments to pass to the command as configured in the server configuration XML (with the $ARG?$ macros) @return The result of the command
[ "This", "method", "executes", "built", "in", "commands", "or", "builds", "a", "CommandDefinition", "to", ".", "execute", "external", "commands", "(", "plugins", ")", ".", "The", "methods", "also", "expands", "the", "$ARG?$", "macros", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/commands/CommandInvoker.java#L98-L110
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/ProcessStore.java
ProcessStore.setProcess
public static synchronized void setProcess(String applicationName, String scopedInstancePath, Process process) { PROCESS_MAP.put(toAgentId(applicationName, scopedInstancePath), process); }
java
public static synchronized void setProcess(String applicationName, String scopedInstancePath, Process process) { PROCESS_MAP.put(toAgentId(applicationName, scopedInstancePath), process); }
[ "public", "static", "synchronized", "void", "setProcess", "(", "String", "applicationName", ",", "String", "scopedInstancePath", ",", "Process", "process", ")", "{", "PROCESS_MAP", ".", "put", "(", "toAgentId", "(", "applicationName", ",", "scopedInstancePath", ")",...
Stores a process (eg. a running script), so that the process can be reached later (eg. to cancel it when blocked). @param process The process to be stored
[ "Stores", "a", "process", "(", "eg", ".", "a", "running", "script", ")", "so", "that", "the", "process", "can", "be", "reached", "later", "(", "eg", ".", "to", "cancel", "it", "when", "blocked", ")", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/ProcessStore.java#L45-L47
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/Resources.java
Resources.addMethod
public void addMethod(final String resource, final ResourceMethod method) { resources.putIfAbsent(resource, new HashSet<>()); resources.get(resource).add(method); }
java
public void addMethod(final String resource, final ResourceMethod method) { resources.putIfAbsent(resource, new HashSet<>()); resources.get(resource).add(method); }
[ "public", "void", "addMethod", "(", "final", "String", "resource", ",", "final", "ResourceMethod", "method", ")", "{", "resources", ".", "putIfAbsent", "(", "resource", ",", "new", "HashSet", "<>", "(", ")", ")", ";", "resources", ".", "get", "(", "resourc...
Adds the method to the resource's methods. @param resource The resource path where to add @param method The method to add
[ "Adds", "the", "method", "to", "the", "resource", "s", "methods", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/rest/Resources.java#L39-L42
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.getChars
public void getChars(final int startIndex, final int endIndex, final char destination[], final int destinationIndex) { if (startIndex < 0) { throw new StringIndexOutOfBoundsException(startIndex); } if (endIndex < 0 || endIndex > length()) { throw new StringIndexOutOfBoundsException(endIndex); } if (startIndex > endIndex) { throw new StringIndexOutOfBoundsException("end < start"); } System.arraycopy(buffer, startIndex, destination, destinationIndex, endIndex - startIndex); }
java
public void getChars(final int startIndex, final int endIndex, final char destination[], final int destinationIndex) { if (startIndex < 0) { throw new StringIndexOutOfBoundsException(startIndex); } if (endIndex < 0 || endIndex > length()) { throw new StringIndexOutOfBoundsException(endIndex); } if (startIndex > endIndex) { throw new StringIndexOutOfBoundsException("end < start"); } System.arraycopy(buffer, startIndex, destination, destinationIndex, endIndex - startIndex); }
[ "public", "void", "getChars", "(", "final", "int", "startIndex", ",", "final", "int", "endIndex", ",", "final", "char", "destination", "[", "]", ",", "final", "int", "destinationIndex", ")", "{", "if", "(", "startIndex", "<", "0", ")", "{", "throw", "new...
Copies the character array into the specified array. @param startIndex first index to copy, inclusive, must be valid @param endIndex last index, exclusive, must be valid @param destination the destination array, must not be null or too small @param destinationIndex the index to start copying in destination @throws NullPointerException if the array is null @throws IndexOutOfBoundsException if any index is invalid
[ "Copies", "the", "character", "array", "into", "the", "specified", "array", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L419-L430
googleapis/google-cloud-java
google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java
CloudStorageFileSystemProvider.newFileSystem
@Override public CloudStorageFileSystem newFileSystem(URI uri, Map<String, ?> env) { checkArgument( uri.getScheme().equalsIgnoreCase(CloudStorageFileSystem.URI_SCHEME), "Cloud Storage URIs must have '%s' scheme: %s", CloudStorageFileSystem.URI_SCHEME, uri); checkArgument( !isNullOrEmpty(uri.getHost()), "%s:// URIs must have a host: %s", CloudStorageFileSystem.URI_SCHEME, uri); checkArgument( uri.getPort() == -1 && isNullOrEmpty(uri.getQuery()) && isNullOrEmpty(uri.getFragment()) && isNullOrEmpty(uri.getUserInfo()), "GCS FileSystem URIs mustn't have: port, userinfo, query, or fragment: %s", uri); CloudStorageUtil.checkBucket(uri.getHost()); initStorage(); return new CloudStorageFileSystem( this, uri.getHost(), CloudStorageConfiguration.fromMap( CloudStorageFileSystem.getDefaultCloudStorageConfiguration(), env)); }
java
@Override public CloudStorageFileSystem newFileSystem(URI uri, Map<String, ?> env) { checkArgument( uri.getScheme().equalsIgnoreCase(CloudStorageFileSystem.URI_SCHEME), "Cloud Storage URIs must have '%s' scheme: %s", CloudStorageFileSystem.URI_SCHEME, uri); checkArgument( !isNullOrEmpty(uri.getHost()), "%s:// URIs must have a host: %s", CloudStorageFileSystem.URI_SCHEME, uri); checkArgument( uri.getPort() == -1 && isNullOrEmpty(uri.getQuery()) && isNullOrEmpty(uri.getFragment()) && isNullOrEmpty(uri.getUserInfo()), "GCS FileSystem URIs mustn't have: port, userinfo, query, or fragment: %s", uri); CloudStorageUtil.checkBucket(uri.getHost()); initStorage(); return new CloudStorageFileSystem( this, uri.getHost(), CloudStorageConfiguration.fromMap( CloudStorageFileSystem.getDefaultCloudStorageConfiguration(), env)); }
[ "@", "Override", "public", "CloudStorageFileSystem", "newFileSystem", "(", "URI", "uri", ",", "Map", "<", "String", ",", "?", ">", "env", ")", "{", "checkArgument", "(", "uri", ".", "getScheme", "(", ")", ".", "equalsIgnoreCase", "(", "CloudStorageFileSystem",...
Returns Cloud Storage file system, provided a URI, e.g. {@code gs://bucket}. The URI can include a path component (that will be ignored). @param uri bucket and current working directory, e.g. {@code gs://bucket} @param env map of configuration options, whose keys correspond to the method names of {@link CloudStorageConfiguration.Builder}. However you are not allowed to set the working directory, as that should be provided in the {@code uri} @throws IllegalArgumentException if {@code uri} specifies a port, user, query, or fragment, or if scheme is not {@value CloudStorageFileSystem#URI_SCHEME}
[ "Returns", "Cloud", "Storage", "file", "system", "provided", "a", "URI", "e", ".", "g", ".", "{", "@code", "gs", ":", "//", "bucket", "}", ".", "The", "URI", "can", "include", "a", "path", "component", "(", "that", "will", "be", "ignored", ")", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java#L243-L269
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/application/Application.java
Application.getResourceBundle
public ResourceBundle getResourceBundle(FacesContext ctx, String name) { if (defaultApplication != null) { return defaultApplication.getResourceBundle(ctx, name); } throw new UnsupportedOperationException(); }
java
public ResourceBundle getResourceBundle(FacesContext ctx, String name) { if (defaultApplication != null) { return defaultApplication.getResourceBundle(ctx, name); } throw new UnsupportedOperationException(); }
[ "public", "ResourceBundle", "getResourceBundle", "(", "FacesContext", "ctx", ",", "String", "name", ")", "{", "if", "(", "defaultApplication", "!=", "null", ")", "{", "return", "defaultApplication", ".", "getResourceBundle", "(", "ctx", ",", "name", ")", ";", ...
<p>Find a <code>ResourceBundle</code> as defined in the application configuration resources under the specified name. If a <code>ResourceBundle</code> was defined for the name, return an instance that uses the locale of the current {@link javax.faces.component.UIViewRoot}.</p> <p>The default implementation throws <code>UnsupportedOperationException</code> and is provided for the sole purpose of not breaking existing applications that extend this class.</p> @throws FacesException if a bundle was defined, but not resolvable @throws NullPointerException if ctx == null || name == null @since 1.2
[ "<p", ">", "Find", "a", "<code", ">", "ResourceBundle<", "/", "code", ">", "as", "defined", "in", "the", "application", "configuration", "resources", "under", "the", "specified", "name", ".", "If", "a", "<code", ">", "ResourceBundle<", "/", "code", ">", "w...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/application/Application.java#L354-L362
gfk-ba/senbot
SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java
ElementService.dragElementTo
public void dragElementTo(String draggable, String droppable, int waitForMillies) throws InterruptedException { WebElement draggableEl = translateLocatorToWebElement(draggable); WebElement dragReceiver = translateLocatorToWebElement(droppable); Actions clickAndDrag = new Actions(getWebDriver()); clickAndDrag.dragAndDrop(draggableEl, dragReceiver); clickAndDrag.perform(); // ToDO: clarify what to do with the parameter waitForMillies }
java
public void dragElementTo(String draggable, String droppable, int waitForMillies) throws InterruptedException { WebElement draggableEl = translateLocatorToWebElement(draggable); WebElement dragReceiver = translateLocatorToWebElement(droppable); Actions clickAndDrag = new Actions(getWebDriver()); clickAndDrag.dragAndDrop(draggableEl, dragReceiver); clickAndDrag.perform(); // ToDO: clarify what to do with the parameter waitForMillies }
[ "public", "void", "dragElementTo", "(", "String", "draggable", ",", "String", "droppable", ",", "int", "waitForMillies", ")", "throws", "InterruptedException", "{", "WebElement", "draggableEl", "=", "translateLocatorToWebElement", "(", "draggable", ")", ";", "WebEleme...
Drags an element some place else @param draggable The element to drag @param droppable The drop aim @param waitForMillies ??? @throws InterruptedException
[ "Drags", "an", "element", "some", "place", "else" ]
train
https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java#L312-L321
vkostyukov/la4j
src/main/java/org/la4j/Matrix.java
Matrix.fromCSV
public static Matrix fromCSV(String csv) { StringTokenizer lines = new StringTokenizer(csv, "\n"); Matrix result = DenseMatrix.zero(10, 10); int rows = 0; int columns = 0; while (lines.hasMoreTokens()) { if (result.rows() == rows) { result = result.copyOfRows((rows * 3) / 2 + 1); } StringTokenizer elements = new StringTokenizer(lines.nextToken(), ", "); int j = 0; while (elements.hasMoreElements()) { if (j == result.columns()) { result = result.copyOfColumns((j * 3) / 2 + 1); } double x = Double.parseDouble(elements.nextToken()); result.set(rows, j++, x); } rows++; columns = j > columns ? j : columns; } return result.copyOfShape(rows, columns); }
java
public static Matrix fromCSV(String csv) { StringTokenizer lines = new StringTokenizer(csv, "\n"); Matrix result = DenseMatrix.zero(10, 10); int rows = 0; int columns = 0; while (lines.hasMoreTokens()) { if (result.rows() == rows) { result = result.copyOfRows((rows * 3) / 2 + 1); } StringTokenizer elements = new StringTokenizer(lines.nextToken(), ", "); int j = 0; while (elements.hasMoreElements()) { if (j == result.columns()) { result = result.copyOfColumns((j * 3) / 2 + 1); } double x = Double.parseDouble(elements.nextToken()); result.set(rows, j++, x); } rows++; columns = j > columns ? j : columns; } return result.copyOfShape(rows, columns); }
[ "public", "static", "Matrix", "fromCSV", "(", "String", "csv", ")", "{", "StringTokenizer", "lines", "=", "new", "StringTokenizer", "(", "csv", ",", "\"\\n\"", ")", ";", "Matrix", "result", "=", "DenseMatrix", ".", "zero", "(", "10", ",", "10", ")", ";",...
Parses {@link Matrix} from the given CSV string. @param csv the string in CSV format @return a parsed matrix
[ "Parses", "{", "@link", "Matrix", "}", "from", "the", "given", "CSV", "string", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L194-L221
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java
PlacesApi.getPlacesForBoundingBox
public Places getPlacesForBoundingBox(String boundingBox, JinxConstants.PlaceTypeId placeTypeId) throws JinxException { JinxUtils.validateParams(boundingBox, placeTypeId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.places.placesForBoundingBox"); params.put("bbox", boundingBox); params.put("place_type_id", placeTypeId.getTypeId().toString()); return jinx.flickrGet(params, Places.class, false); }
java
public Places getPlacesForBoundingBox(String boundingBox, JinxConstants.PlaceTypeId placeTypeId) throws JinxException { JinxUtils.validateParams(boundingBox, placeTypeId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.places.placesForBoundingBox"); params.put("bbox", boundingBox); params.put("place_type_id", placeTypeId.getTypeId().toString()); return jinx.flickrGet(params, Places.class, false); }
[ "public", "Places", "getPlacesForBoundingBox", "(", "String", "boundingBox", ",", "JinxConstants", ".", "PlaceTypeId", "placeTypeId", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "boundingBox", ",", "placeTypeId", ")", ";", "Map", "<...
Return all the locations of a matching place type for a bounding box. <p>The maximum allowable size of a bounding box (the distance between the SW and NE corners) is governed by the place type you are requesting. Allowable sizes are as follows:</p> <ul> <li>neighbourhood: 3km (1.8mi)</li> <li>locality: 7km (4.3mi)</li> <li>county: 50km (31mi)</li> <li>region: 200km (124mi)</li> <li>country: 500km (310mi)</li> <li>continent: 1500km (932mi)</li> </ul> Authentication This method does not require authentication. @param boundingBox a comma-delimited list of 4 values defining the Bounding Box of the area that will be searched. The 4 values represent the bottom-left corner of the box and the top-right corner, minimum_longitude, minimum_latitude, maximum_longitude, maximum_latitude. Required. @param placeTypeId id for a specific place to cluster photos by. Required. @return places matching the bounding box. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.places.placesForBoundingBox.html">flickr.places.placesForBoundingBox</a>
[ "Return", "all", "the", "locations", "of", "a", "matching", "place", "type", "for", "a", "bounding", "box", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java#L294-L301
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/ThemeUtil.java
ThemeUtil.getTextArray
public static CharSequence[] getTextArray(@NonNull final Context context, @AttrRes final int resourceId) { return getTextArray(context, -1, resourceId); }
java
public static CharSequence[] getTextArray(@NonNull final Context context, @AttrRes final int resourceId) { return getTextArray(context, -1, resourceId); }
[ "public", "static", "CharSequence", "[", "]", "getTextArray", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "AttrRes", "final", "int", "resourceId", ")", "{", "return", "getTextArray", "(", "context", ",", "-", "1", ",", "resourceId", ")", ...
Obtains the text array, which corresponds to a specific resource id, from a context's theme. If the given resource id is invalid, a {@link NotFoundException} will be thrown. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the attribute, which should be obtained, as an {@link Integer} value. The resource id must corresponds to a valid theme attribute @return The text array, which has been obtained, as an instance of the type {@link CharSequence}
[ "Obtains", "the", "text", "array", "which", "corresponds", "to", "a", "specific", "resource", "id", "from", "a", "context", "s", "theme", ".", "If", "the", "given", "resource", "id", "is", "invalid", "a", "{", "@link", "NotFoundException", "}", "will", "be...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ThemeUtil.java#L313-L316
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nspbr6_stats.java
nspbr6_stats.get
public static nspbr6_stats get(nitro_service service, String name) throws Exception{ nspbr6_stats obj = new nspbr6_stats(); obj.set_name(name); nspbr6_stats response = (nspbr6_stats) obj.stat_resource(service); return response; }
java
public static nspbr6_stats get(nitro_service service, String name) throws Exception{ nspbr6_stats obj = new nspbr6_stats(); obj.set_name(name); nspbr6_stats response = (nspbr6_stats) obj.stat_resource(service); return response; }
[ "public", "static", "nspbr6_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "nspbr6_stats", "obj", "=", "new", "nspbr6_stats", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "nspbr6_stats...
Use this API to fetch statistics of nspbr6_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "nspbr6_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nspbr6_stats.java#L229-L234
mp911de/visualizr
visualizr-metrics/src/main/java/biz/paluch/visualizr/metrics/VisualizrReporter.java
VisualizrReporter.reportTimer
private void reportTimer(String name, Timer timer) { final Snapshot snapshot = timer.getSnapshot(); String prefixedName = prefix(name); if (!snapshots.hasDescriptor(prefixedName)) { MetricItem.Builder builder = MetricItem.Builder.create(); builder.duration("max", durationUnit); builder.duration("mean", durationUnit); builder.duration("min", durationUnit); builder.duration("stddev", durationUnit); builder.duration("p50", durationUnit); builder.duration("p75", durationUnit); builder.duration("p95", durationUnit); builder.duration("p98", durationUnit); builder.duration("p99", durationUnit); builder.duration("p95", durationUnit); builder.duration("p999", durationUnit); builder.calls("calls"); builder.calls("m1_rate", 1, rateUnit); builder.calls("m5_rate", 1, rateUnit); builder.calls("m15_rate", 1, rateUnit); builder.calls("mean_rate", rateUnit); snapshots.setDescriptor(prefixedName, builder.build()); } Map<String, Number> values = new HashMap<>(); values.put("max", convertDuration(snapshot.getMax())); values.put("mean", convertDuration(snapshot.getMean())); values.put("min", convertDuration(snapshot.getMin())); values.put("stddev", convertDuration(snapshot.getStdDev())); values.put("p50", convertDuration(snapshot.getMedian())); values.put("p75", convertDuration(snapshot.get75thPercentile())); values.put("p95", convertDuration(snapshot.get95thPercentile())); values.put("p98", convertDuration(snapshot.get98thPercentile())); values.put("p99", convertDuration(snapshot.get99thPercentile())); values.put("p999", convertDuration(snapshot.get999thPercentile())); addMetered(timer, values, "calls"); snapshots.addSnapshot(prefixedName, getTimestamp(), values); }
java
private void reportTimer(String name, Timer timer) { final Snapshot snapshot = timer.getSnapshot(); String prefixedName = prefix(name); if (!snapshots.hasDescriptor(prefixedName)) { MetricItem.Builder builder = MetricItem.Builder.create(); builder.duration("max", durationUnit); builder.duration("mean", durationUnit); builder.duration("min", durationUnit); builder.duration("stddev", durationUnit); builder.duration("p50", durationUnit); builder.duration("p75", durationUnit); builder.duration("p95", durationUnit); builder.duration("p98", durationUnit); builder.duration("p99", durationUnit); builder.duration("p95", durationUnit); builder.duration("p999", durationUnit); builder.calls("calls"); builder.calls("m1_rate", 1, rateUnit); builder.calls("m5_rate", 1, rateUnit); builder.calls("m15_rate", 1, rateUnit); builder.calls("mean_rate", rateUnit); snapshots.setDescriptor(prefixedName, builder.build()); } Map<String, Number> values = new HashMap<>(); values.put("max", convertDuration(snapshot.getMax())); values.put("mean", convertDuration(snapshot.getMean())); values.put("min", convertDuration(snapshot.getMin())); values.put("stddev", convertDuration(snapshot.getStdDev())); values.put("p50", convertDuration(snapshot.getMedian())); values.put("p75", convertDuration(snapshot.get75thPercentile())); values.put("p95", convertDuration(snapshot.get95thPercentile())); values.put("p98", convertDuration(snapshot.get98thPercentile())); values.put("p99", convertDuration(snapshot.get99thPercentile())); values.put("p999", convertDuration(snapshot.get999thPercentile())); addMetered(timer, values, "calls"); snapshots.addSnapshot(prefixedName, getTimestamp(), values); }
[ "private", "void", "reportTimer", "(", "String", "name", ",", "Timer", "timer", ")", "{", "final", "Snapshot", "snapshot", "=", "timer", ".", "getSnapshot", "(", ")", ";", "String", "prefixedName", "=", "prefix", "(", "name", ")", ";", "if", "(", "!", ...
Report a timer using fields max/mean/min/stddev,p50/p75/p95/p98/p99/p999/calls/m1_rate/m5_rate/m15_rate/mean_rate @param name @param timer
[ "Report", "a", "timer", "using", "fields", "max", "/", "mean", "/", "min", "/", "stddev", "p50", "/", "p75", "/", "p95", "/", "p98", "/", "p99", "/", "p999", "/", "calls", "/", "m1_rate", "/", "m5_rate", "/", "m15_rate", "/", "mean_rate" ]
train
https://github.com/mp911de/visualizr/blob/57206391692e88b2c59d52d4f18faa4cdfd32a98/visualizr-metrics/src/main/java/biz/paluch/visualizr/metrics/VisualizrReporter.java#L86-L134
MenoData/Time4J
base/src/main/java/net/time4j/tz/ZonalOffset.java
ZonalOffset.atLongitude
public static ZonalOffset atLongitude(BigDecimal longitude) { if ( (longitude.compareTo(DECIMAL_POS_180) > 0) || (longitude.compareTo(DECIMAL_NEG_180) < 0) ) { throw new IllegalArgumentException("Out of range: " + longitude); } BigDecimal offset = longitude.multiply(DECIMAL_240); BigDecimal integral = offset.setScale(0, RoundingMode.DOWN); BigDecimal delta = offset.subtract(integral); BigDecimal decimal = delta.setScale(9, RoundingMode.HALF_UP).multiply(MRD); int total = integral.intValueExact(); int fraction = decimal.intValueExact(); if (fraction == 0) { return ZonalOffset.ofTotalSeconds(total); } else if (fraction == 1_000_000_000) { return ZonalOffset.ofTotalSeconds(total + 1); } else if (fraction == -1_000_000_000) { return ZonalOffset.ofTotalSeconds(total - 1); } else { return new ZonalOffset(total, fraction); } }
java
public static ZonalOffset atLongitude(BigDecimal longitude) { if ( (longitude.compareTo(DECIMAL_POS_180) > 0) || (longitude.compareTo(DECIMAL_NEG_180) < 0) ) { throw new IllegalArgumentException("Out of range: " + longitude); } BigDecimal offset = longitude.multiply(DECIMAL_240); BigDecimal integral = offset.setScale(0, RoundingMode.DOWN); BigDecimal delta = offset.subtract(integral); BigDecimal decimal = delta.setScale(9, RoundingMode.HALF_UP).multiply(MRD); int total = integral.intValueExact(); int fraction = decimal.intValueExact(); if (fraction == 0) { return ZonalOffset.ofTotalSeconds(total); } else if (fraction == 1_000_000_000) { return ZonalOffset.ofTotalSeconds(total + 1); } else if (fraction == -1_000_000_000) { return ZonalOffset.ofTotalSeconds(total - 1); } else { return new ZonalOffset(total, fraction); } }
[ "public", "static", "ZonalOffset", "atLongitude", "(", "BigDecimal", "longitude", ")", "{", "if", "(", "(", "longitude", ".", "compareTo", "(", "DECIMAL_POS_180", ")", ">", "0", ")", "||", "(", "longitude", ".", "compareTo", "(", "DECIMAL_NEG_180", ")", "<",...
/*[deutsch] <p>Konstruiert eine neue Verschiebung auf Basis einer geographischen L&auml;ngenangabe. </p> <p>Hinweis: Fraktionale Verschiebungen werden im Zeitzonenkontext nicht verwendet, sondern nur dann, wenn ein {@code PlainTimestamp} zu einem {@code Moment} oder zur&uuml;ck konvertiert wird. </p> @param longitude geographical longitude in degrees defined in range {@code -180.0 <= longitude <= 180.0} @return zonal offset in decimal precision @throws IllegalArgumentException if range check fails
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Konstruiert", "eine", "neue", "Verschiebung", "auf", "Basis", "einer", "geographischen", "L&auml", ";", "ngenangabe", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/tz/ZonalOffset.java#L204-L231
apache/groovy
src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java
GeneralUtils.convertASTToSource
public static String convertASTToSource(ReaderSource readerSource, ASTNode expression) throws Exception { if (expression == null) throw new IllegalArgumentException("Null: expression"); StringBuilder result = new StringBuilder(); for (int x = expression.getLineNumber(); x <= expression.getLastLineNumber(); x++) { String line = readerSource.getLine(x, null); if (line == null) { throw new Exception( "Error calculating source code for expression. Trying to read line " + x + " from " + readerSource.getClass() ); } if (x == expression.getLastLineNumber()) { line = line.substring(0, expression.getLastColumnNumber() - 1); } if (x == expression.getLineNumber()) { line = line.substring(expression.getColumnNumber() - 1); } //restoring line breaks is important b/c of lack of semicolons result.append(line).append('\n'); } String source = result.toString().trim(); return source; }
java
public static String convertASTToSource(ReaderSource readerSource, ASTNode expression) throws Exception { if (expression == null) throw new IllegalArgumentException("Null: expression"); StringBuilder result = new StringBuilder(); for (int x = expression.getLineNumber(); x <= expression.getLastLineNumber(); x++) { String line = readerSource.getLine(x, null); if (line == null) { throw new Exception( "Error calculating source code for expression. Trying to read line " + x + " from " + readerSource.getClass() ); } if (x == expression.getLastLineNumber()) { line = line.substring(0, expression.getLastColumnNumber() - 1); } if (x == expression.getLineNumber()) { line = line.substring(expression.getColumnNumber() - 1); } //restoring line breaks is important b/c of lack of semicolons result.append(line).append('\n'); } String source = result.toString().trim(); return source; }
[ "public", "static", "String", "convertASTToSource", "(", "ReaderSource", "readerSource", ",", "ASTNode", "expression", ")", "throws", "Exception", "{", "if", "(", "expression", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Null: expression\"",...
Converts an expression into the String source. Only some specific expressions like closure expression support this. @param readerSource a source @param expression an expression. Can't be null @return the source the closure was created from @throws java.lang.IllegalArgumentException when expression is null @throws java.lang.Exception when closure can't be read from source
[ "Converts", "an", "expression", "into", "the", "String", "source", ".", "Only", "some", "specific", "expressions", "like", "closure", "expression", "support", "this", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/GeneralUtils.java#L834-L859
dbracewell/mango
src/main/java/com/davidbracewell/logging/LogManager.java
LogManager.setLevel
public void setLevel(String logger, Level level) { Logger log = getLogger(logger); log.setLevel(level); for (String loggerName : getLoggerNames()) { if (loggerName.startsWith(logger) && !loggerName.equals(logger)) { getLogger(loggerName).setLevel(level); } } }
java
public void setLevel(String logger, Level level) { Logger log = getLogger(logger); log.setLevel(level); for (String loggerName : getLoggerNames()) { if (loggerName.startsWith(logger) && !loggerName.equals(logger)) { getLogger(loggerName).setLevel(level); } } }
[ "public", "void", "setLevel", "(", "String", "logger", ",", "Level", "level", ")", "{", "Logger", "log", "=", "getLogger", "(", "logger", ")", ";", "log", ".", "setLevel", "(", "level", ")", ";", "for", "(", "String", "loggerName", ":", "getLoggerNames",...
Sets the level of a logger @param logger The name of the logger to set the level for. @param level The level to set the logger at
[ "Sets", "the", "level", "of", "a", "logger" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/logging/LogManager.java#L165-L173
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Transaction.java
Transaction.isFinal
public boolean isFinal(int height, long blockTimeSeconds) { long time = getLockTime(); return time < (time < LOCKTIME_THRESHOLD ? height : blockTimeSeconds) || !isTimeLocked(); }
java
public boolean isFinal(int height, long blockTimeSeconds) { long time = getLockTime(); return time < (time < LOCKTIME_THRESHOLD ? height : blockTimeSeconds) || !isTimeLocked(); }
[ "public", "boolean", "isFinal", "(", "int", "height", ",", "long", "blockTimeSeconds", ")", "{", "long", "time", "=", "getLockTime", "(", ")", ";", "return", "time", "<", "(", "time", "<", "LOCKTIME_THRESHOLD", "?", "height", ":", "blockTimeSeconds", ")", ...
<p>Returns true if this transaction is considered finalized and can be placed in a block. Non-finalized transactions won't be included by miners and can be replaced with newer versions using sequence numbers. This is useful in certain types of <a href="http://en.bitcoin.it/wiki/Contracts">contracts</a>, such as micropayment channels.</p> <p>Note that currently the replacement feature is disabled in Bitcoin Core and will need to be re-activated before this functionality is useful.</p>
[ "<p", ">", "Returns", "true", "if", "this", "transaction", "is", "considered", "finalized", "and", "can", "be", "placed", "in", "a", "block", ".", "Non", "-", "finalized", "transactions", "won", "t", "be", "included", "by", "miners", "and", "can", "be", ...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1740-L1743
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/IntentUtils.java
IntentUtils.isIntentAvailable
public static boolean isIntentAvailable(Context context, String action, String mimeType) { final Intent intent = new Intent(action); if (mimeType != null) { intent.setType(mimeType); } List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return !list.isEmpty(); }
java
public static boolean isIntentAvailable(Context context, String action, String mimeType) { final Intent intent = new Intent(action); if (mimeType != null) { intent.setType(mimeType); } List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return !list.isEmpty(); }
[ "public", "static", "boolean", "isIntentAvailable", "(", "Context", "context", ",", "String", "action", ",", "String", "mimeType", ")", "{", "final", "Intent", "intent", "=", "new", "Intent", "(", "action", ")", ";", "if", "(", "mimeType", "!=", "null", ")...
Checks whether there are applications installed which are able to handle the given action/type. @param context the current context @param action the action to check @param mimeType the MIME type of the content (may be null) @return true if there are apps which will respond to this action/type
[ "Checks", "whether", "there", "are", "applications", "installed", "which", "are", "able", "to", "handle", "the", "given", "action", "/", "type", "." ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/IntentUtils.java#L61-L69
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.setFontAndSize
public void setFontAndSize(BaseFont bf, float size) { checkWriter(); if (size < 0.0001f && size > -0.0001f) throw new IllegalArgumentException("Font size too small: " + size); state.size = size; state.fontDetails = writer.addSimple(bf); PageResources prs = getPageResources(); PdfName name = state.fontDetails.getFontName(); name = prs.addFont(name, state.fontDetails.getIndirectReference()); content.append(name.getBytes()).append(' ').append(size).append(" Tf").append_i(separator); }
java
public void setFontAndSize(BaseFont bf, float size) { checkWriter(); if (size < 0.0001f && size > -0.0001f) throw new IllegalArgumentException("Font size too small: " + size); state.size = size; state.fontDetails = writer.addSimple(bf); PageResources prs = getPageResources(); PdfName name = state.fontDetails.getFontName(); name = prs.addFont(name, state.fontDetails.getIndirectReference()); content.append(name.getBytes()).append(' ').append(size).append(" Tf").append_i(separator); }
[ "public", "void", "setFontAndSize", "(", "BaseFont", "bf", ",", "float", "size", ")", "{", "checkWriter", "(", ")", ";", "if", "(", "size", "<", "0.0001f", "&&", "size", ">", "-", "0.0001f", ")", "throw", "new", "IllegalArgumentException", "(", "\"Font siz...
Set the font and the size for the subsequent text writing. @param bf the font @param size the font size in points
[ "Set", "the", "font", "and", "the", "size", "for", "the", "subsequent", "text", "writing", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1384-L1394
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/StandardModelFactories.java
StandardModelFactories.rulesOf
private static final <T> RuleFactory<T> rulesOf(DynamoDBMapperConfig config, S3Link.Factory s3Links, DynamoDBMapperModelFactory models) { final boolean ver1 = (config.getConversionSchema() == ConversionSchemas.V1); final boolean ver2 = (config.getConversionSchema() == ConversionSchemas.V2); final boolean v2Compatible = (config.getConversionSchema() == ConversionSchemas.V2_COMPATIBLE); final DynamoDBTypeConverterFactory.Builder scalars = config.getTypeConverterFactory().override(); scalars.with(String.class, S3Link.class, s3Links); final Rules<T> factory = new Rules<T>(scalars.build()); factory.add(factory.new NativeType(!ver1)); factory.add(factory.new V2CompatibleBool(v2Compatible)); factory.add(factory.new NativeBool(ver2)); factory.add(factory.new StringScalar(true)); factory.add(factory.new DateToEpochRule(true)); factory.add(factory.new NumberScalar(true)); factory.add(factory.new BinaryScalar(true)); factory.add(factory.new NativeBoolSet(ver2)); factory.add(factory.new StringScalarSet(true)); factory.add(factory.new NumberScalarSet(true)); factory.add(factory.new BinaryScalarSet(true)); factory.add(factory.new ObjectSet(ver2)); factory.add(factory.new ObjectStringSet(!ver2)); factory.add(factory.new ObjectList(!ver1)); factory.add(factory.new ObjectMap(!ver1)); factory.add(factory.new ObjectDocumentMap(!ver1, models, config)); return factory; }
java
private static final <T> RuleFactory<T> rulesOf(DynamoDBMapperConfig config, S3Link.Factory s3Links, DynamoDBMapperModelFactory models) { final boolean ver1 = (config.getConversionSchema() == ConversionSchemas.V1); final boolean ver2 = (config.getConversionSchema() == ConversionSchemas.V2); final boolean v2Compatible = (config.getConversionSchema() == ConversionSchemas.V2_COMPATIBLE); final DynamoDBTypeConverterFactory.Builder scalars = config.getTypeConverterFactory().override(); scalars.with(String.class, S3Link.class, s3Links); final Rules<T> factory = new Rules<T>(scalars.build()); factory.add(factory.new NativeType(!ver1)); factory.add(factory.new V2CompatibleBool(v2Compatible)); factory.add(factory.new NativeBool(ver2)); factory.add(factory.new StringScalar(true)); factory.add(factory.new DateToEpochRule(true)); factory.add(factory.new NumberScalar(true)); factory.add(factory.new BinaryScalar(true)); factory.add(factory.new NativeBoolSet(ver2)); factory.add(factory.new StringScalarSet(true)); factory.add(factory.new NumberScalarSet(true)); factory.add(factory.new BinaryScalarSet(true)); factory.add(factory.new ObjectSet(ver2)); factory.add(factory.new ObjectStringSet(!ver2)); factory.add(factory.new ObjectList(!ver1)); factory.add(factory.new ObjectMap(!ver1)); factory.add(factory.new ObjectDocumentMap(!ver1, models, config)); return factory; }
[ "private", "static", "final", "<", "T", ">", "RuleFactory", "<", "T", ">", "rulesOf", "(", "DynamoDBMapperConfig", "config", ",", "S3Link", ".", "Factory", "s3Links", ",", "DynamoDBMapperModelFactory", "models", ")", "{", "final", "boolean", "ver1", "=", "(", ...
Creates a new set of conversion rules based on the configuration.
[ "Creates", "a", "new", "set", "of", "conversion", "rules", "based", "on", "the", "configuration", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/StandardModelFactories.java#L155-L181
mbeiter/util
db/src/main/java/org/beiter/michael/db/propsbuilder/MapBasedConnPropsBuilder.java
MapBasedConnPropsBuilder.logValue
private static void logValue(final String key, final String value) { // Fortify will report a violation here because of disclosure of potentially confidential information. // However, the configuration keys are not confidential, which makes this a non-issue / false positive. if (LOG.isInfoEnabled()) { final StringBuilder msg = new StringBuilder("Key found in configuration ('") .append(key) .append("'), using configured value (not disclosed here for security reasons)"); LOG.info(msg.toString()); } // Fortify will report a violation here because of disclosure of potentially confidential information. // The configuration VALUES are confidential. DO NOT activate DEBUG logging in production. if (LOG.isDebugEnabled()) { final StringBuilder msg = new StringBuilder("Key found in configuration ('") .append(key) .append("'), using configured value ('"); if (value == null) { msg.append("null')"); } else { msg.append(value).append("')"); } LOG.debug(msg.toString()); } }
java
private static void logValue(final String key, final String value) { // Fortify will report a violation here because of disclosure of potentially confidential information. // However, the configuration keys are not confidential, which makes this a non-issue / false positive. if (LOG.isInfoEnabled()) { final StringBuilder msg = new StringBuilder("Key found in configuration ('") .append(key) .append("'), using configured value (not disclosed here for security reasons)"); LOG.info(msg.toString()); } // Fortify will report a violation here because of disclosure of potentially confidential information. // The configuration VALUES are confidential. DO NOT activate DEBUG logging in production. if (LOG.isDebugEnabled()) { final StringBuilder msg = new StringBuilder("Key found in configuration ('") .append(key) .append("'), using configured value ('"); if (value == null) { msg.append("null')"); } else { msg.append(value).append("')"); } LOG.debug(msg.toString()); } }
[ "private", "static", "void", "logValue", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "// Fortify will report a violation here because of disclosure of potentially confidential information.", "// However, the configuration keys are not confidential, which m...
Create a log entry when a value has been successfully configured. @param key The configuration key @param value The value that is being used
[ "Create", "a", "log", "entry", "when", "a", "value", "has", "been", "successfully", "configured", "." ]
train
https://github.com/mbeiter/util/blob/490fcebecb936e00c2f2ce2096b679b2fd10865e/db/src/main/java/org/beiter/michael/db/propsbuilder/MapBasedConnPropsBuilder.java#L630-L654
cdk/cdk
misc/extra/src/main/java/org/openscience/cdk/tools/GridGenerator.java
GridGenerator.setDimension
public void setDimension(double min, double max) { this.minx = min; this.maxx = max; this.miny = min; this.maxy = max; this.minz = min; this.maxz = max; }
java
public void setDimension(double min, double max) { this.minx = min; this.maxx = max; this.miny = min; this.maxy = max; this.minz = min; this.maxz = max; }
[ "public", "void", "setDimension", "(", "double", "min", ",", "double", "max", ")", "{", "this", ".", "minx", "=", "min", ";", "this", ".", "maxx", "=", "max", ";", "this", ".", "miny", "=", "min", ";", "this", ".", "maxy", "=", "max", ";", "this"...
Method sets the maximal 3d dimensions to given min and max values.
[ "Method", "sets", "the", "maximal", "3d", "dimensions", "to", "given", "min", "and", "max", "values", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/misc/extra/src/main/java/org/openscience/cdk/tools/GridGenerator.java#L74-L81
facebookarchive/swift
swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java
ThriftCodecByteCodeGenerator.defineReadBridgeMethod
private void defineReadBridgeMethod() { classDefinition.addMethod( new MethodDefinition(a(PUBLIC, BRIDGE, SYNTHETIC), "read", type(Object.class), arg("protocol", TProtocol.class)) .addException(Exception.class) .loadThis() .loadVariable("protocol") .invokeVirtual(codecType, "read", structType, type(TProtocol.class)) .retObject() ); }
java
private void defineReadBridgeMethod() { classDefinition.addMethod( new MethodDefinition(a(PUBLIC, BRIDGE, SYNTHETIC), "read", type(Object.class), arg("protocol", TProtocol.class)) .addException(Exception.class) .loadThis() .loadVariable("protocol") .invokeVirtual(codecType, "read", structType, type(TProtocol.class)) .retObject() ); }
[ "private", "void", "defineReadBridgeMethod", "(", ")", "{", "classDefinition", ".", "addMethod", "(", "new", "MethodDefinition", "(", "a", "(", "PUBLIC", ",", "BRIDGE", ",", "SYNTHETIC", ")", ",", "\"read\"", ",", "type", "(", "Object", ".", "class", ")", ...
Defines the generics bridge method with untyped args to the type specific read method.
[ "Defines", "the", "generics", "bridge", "method", "with", "untyped", "args", "to", "the", "type", "specific", "read", "method", "." ]
train
https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java#L1005-L1015
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakePoint.java
ST_MakePoint.createPoint
public static Point createPoint(double x, double y) throws SQLException { return createPoint(x, y, Coordinate.NULL_ORDINATE); }
java
public static Point createPoint(double x, double y) throws SQLException { return createPoint(x, y, Coordinate.NULL_ORDINATE); }
[ "public", "static", "Point", "createPoint", "(", "double", "x", ",", "double", "y", ")", "throws", "SQLException", "{", "return", "createPoint", "(", "x", ",", "y", ",", "Coordinate", ".", "NULL_ORDINATE", ")", ";", "}" ]
Constructs POINT from two doubles. @param x X-coordinate @param y Y-coordinate @return The POINT constructed from the given coordinatesk @throws java.sql.SQLException
[ "Constructs", "POINT", "from", "two", "doubles", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakePoint.java#L56-L58
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromTaskWithServiceResponseAsync
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> listFromTaskWithServiceResponseAsync(final String jobId, final String taskId) { return listFromTaskSinglePageAsync(jobId, taskId) .concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, null)); } }); }
java
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> listFromTaskWithServiceResponseAsync(final String jobId, final String taskId) { return listFromTaskSinglePageAsync(jobId, taskId) .concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromTaskHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listFromTaskNextWithServiceResponseAsync(nextPageLink, null)); } }); }
[ "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromTaskHeaders", ">", ">", "listFromTaskWithServiceResponseAsync", "(", "final", "String", "jobId", ",", "final", "String", "taskId", ")", "{", "return", "li...
Lists the files in a task's directory on its compute node. @param jobId The ID of the job that contains the task. @param taskId The ID of the task whose files you want to list. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NodeFile&gt; object
[ "Lists", "the", "files", "in", "a", "task", "s", "directory", "on", "its", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L1662-L1674
micronaut-projects/micronaut-core
runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java
JacksonConfiguration.setGenerator
public void setGenerator(Map<JsonGenerator.Feature, Boolean> generator) { if (CollectionUtils.isNotEmpty(generator)) { this.generator = generator; } }
java
public void setGenerator(Map<JsonGenerator.Feature, Boolean> generator) { if (CollectionUtils.isNotEmpty(generator)) { this.generator = generator; } }
[ "public", "void", "setGenerator", "(", "Map", "<", "JsonGenerator", ".", "Feature", ",", "Boolean", ">", "generator", ")", "{", "if", "(", "CollectionUtils", ".", "isNotEmpty", "(", "generator", ")", ")", "{", "this", ".", "generator", "=", "generator", ";...
Sets the generator features to use. @param generator The generator features
[ "Sets", "the", "generator", "features", "to", "use", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/runtime/src/main/java/io/micronaut/jackson/JacksonConfiguration.java#L275-L279
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/LiteCoreException.java
LiteCoreException.throwException
public static void throwException(int domain, int code, String msg) throws LiteCoreException { throw new LiteCoreException(domain, code, msg); }
java
public static void throwException(int domain, int code, String msg) throws LiteCoreException { throw new LiteCoreException(domain, code, msg); }
[ "public", "static", "void", "throwException", "(", "int", "domain", ",", "int", "code", ",", "String", "msg", ")", "throws", "LiteCoreException", "{", "throw", "new", "LiteCoreException", "(", "domain", ",", "code", ",", "msg", ")", ";", "}" ]
NOTE called to throw LiteCoreException from native code to Java
[ "NOTE", "called", "to", "throw", "LiteCoreException", "from", "native", "code", "to", "Java" ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/LiteCoreException.java#L25-L27
tvesalainen/util
util/src/main/java/org/vesalainen/util/concurrent/PredicateSynchronizer.java
PredicateSynchronizer.waitUntil
public boolean waitUntil(BooleanSupplier predicate, long timeout, TimeUnit unit) throws InterruptedException { if (predicate.getAsBoolean()) { return true; } long deadline = timeout > 0 ? System.currentTimeMillis() + unit.toMillis(timeout) : Long.MAX_VALUE; waiters.add(Thread.currentThread()); try { while (true) { LockSupport.parkUntil(blocker, deadline); if (Thread.interrupted()) { throw new InterruptedException(); } if (predicate.getAsBoolean()) { return true; } if (deadline <= System.currentTimeMillis()) { return false; } } } finally { boolean removed = waiters.remove(Thread.currentThread()); assert removed; } }
java
public boolean waitUntil(BooleanSupplier predicate, long timeout, TimeUnit unit) throws InterruptedException { if (predicate.getAsBoolean()) { return true; } long deadline = timeout > 0 ? System.currentTimeMillis() + unit.toMillis(timeout) : Long.MAX_VALUE; waiters.add(Thread.currentThread()); try { while (true) { LockSupport.parkUntil(blocker, deadline); if (Thread.interrupted()) { throw new InterruptedException(); } if (predicate.getAsBoolean()) { return true; } if (deadline <= System.currentTimeMillis()) { return false; } } } finally { boolean removed = waiters.remove(Thread.currentThread()); assert removed; } }
[ "public", "boolean", "waitUntil", "(", "BooleanSupplier", "predicate", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "if", "(", "predicate", ".", "getAsBoolean", "(", ")", ")", "{", "return", "true", ";", "}", "...
Waits until predicate is true or after timeout. <p> If predicate is true returns immediately true. <p> If timeout passed returns false <p> If thread is interrupted throws InterruptedException @param predicate @param timeout @param unit @return @throws InterruptedException
[ "Waits", "until", "predicate", "is", "true", "or", "after", "timeout", ".", "<p", ">", "If", "predicate", "is", "true", "returns", "immediately", "true", ".", "<p", ">", "If", "timeout", "passed", "returns", "false", "<p", ">", "If", "thread", "is", "int...
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/PredicateSynchronizer.java#L67-L99
eurekaclinical/eurekaclinical-common
src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java
EurekaClinicalClient.doPost
protected <T> T doPost(String path, MultivaluedMap<String, String> formParams, Class<T> cls) throws ClientException { return doPost(path, formParams, cls, null); }
java
protected <T> T doPost(String path, MultivaluedMap<String, String> formParams, Class<T> cls) throws ClientException { return doPost(path, formParams, cls, null); }
[ "protected", "<", "T", ">", "T", "doPost", "(", "String", "path", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "formParams", ",", "Class", "<", "T", ">", "cls", ")", "throws", "ClientException", "{", "return", "doPost", "(", "path", ",", "...
Submits a form and gets back a JSON object. Adds appropriate Accepts and Content Type headers. @param <T> the type of object that is expected in the response. @param path the API to call. @param formParams the form parameters to send. @param cls the type of object that is expected in the response. @return the object in the response. @throws ClientException if a status code other than 200 (OK) is returned.
[ "Submits", "a", "form", "and", "gets", "back", "a", "JSON", "object", ".", "Adds", "appropriate", "Accepts", "and", "Content", "Type", "headers", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L442-L444
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java
JsonService.getChild
public static JSONObject getChild(JSONObject jsonObject, String key) throws JSONException { checkArguments(jsonObject, key); JSONValue value = jsonObject.get(key); if (value != null) { if (value.isObject() != null) { return value.isObject(); } else if (value.isNull() != null) { return null; } throw new JSONException("Child is not a JSONObject, but a: " + value.getClass()); } return null; }
java
public static JSONObject getChild(JSONObject jsonObject, String key) throws JSONException { checkArguments(jsonObject, key); JSONValue value = jsonObject.get(key); if (value != null) { if (value.isObject() != null) { return value.isObject(); } else if (value.isNull() != null) { return null; } throw new JSONException("Child is not a JSONObject, but a: " + value.getClass()); } return null; }
[ "public", "static", "JSONObject", "getChild", "(", "JSONObject", "jsonObject", ",", "String", "key", ")", "throws", "JSONException", "{", "checkArguments", "(", "jsonObject", ",", "key", ")", ";", "JSONValue", "value", "=", "jsonObject", ".", "get", "(", "key"...
Get a child JSON object from a parent JSON object. @param jsonObject The parent JSON object. @param key The name of the child object. @return Returns the child JSON object if it could be found, or null if the value was null. @throws JSONException In case something went wrong while searching for the child.
[ "Get", "a", "child", "JSON", "object", "from", "a", "parent", "JSON", "object", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/service/JsonService.java#L94-L106
Alluxio/alluxio
core/common/src/main/java/alluxio/grpc/GrpcManagedChannelPool.java
GrpcManagedChannelPool.shutdownManagedChannel
private void shutdownManagedChannel(ChannelKey channelKey, long shutdownTimeoutMs) { ManagedChannel managedChannel = mChannels.get(channelKey).get(); managedChannel.shutdown(); try { managedChannel.awaitTermination(shutdownTimeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Allow thread to exit. } finally { managedChannel.shutdownNow(); } Verify.verify(managedChannel.isShutdown()); LOG.debug("Shut down managed channel. ChannelKey: {}", channelKey); }
java
private void shutdownManagedChannel(ChannelKey channelKey, long shutdownTimeoutMs) { ManagedChannel managedChannel = mChannels.get(channelKey).get(); managedChannel.shutdown(); try { managedChannel.awaitTermination(shutdownTimeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Allow thread to exit. } finally { managedChannel.shutdownNow(); } Verify.verify(managedChannel.isShutdown()); LOG.debug("Shut down managed channel. ChannelKey: {}", channelKey); }
[ "private", "void", "shutdownManagedChannel", "(", "ChannelKey", "channelKey", ",", "long", "shutdownTimeoutMs", ")", "{", "ManagedChannel", "managedChannel", "=", "mChannels", ".", "get", "(", "channelKey", ")", ".", "get", "(", ")", ";", "managedChannel", ".", ...
Shuts down the managed channel for given key. (Should be called with {@code mLock} acquired.) @param channelKey channel key @param shutdownTimeoutMs shutdown timeout in miliseconds
[ "Shuts", "down", "the", "managed", "channel", "for", "given", "key", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcManagedChannelPool.java#L96-L109
alexa/alexa-skills-kit-sdk-for-java
ask-sdk-core/src/com/amazon/ask/attributes/AttributesManager.java
AttributesManager.setSessionAttributes
public void setSessionAttributes(Map<String, Object> sessionAttributes) { if (requestEnvelope.getSession() == null) { throw new IllegalStateException("Attempting to set session attributes for out of session request"); } this.sessionAttributes = sessionAttributes; }
java
public void setSessionAttributes(Map<String, Object> sessionAttributes) { if (requestEnvelope.getSession() == null) { throw new IllegalStateException("Attempting to set session attributes for out of session request"); } this.sessionAttributes = sessionAttributes; }
[ "public", "void", "setSessionAttributes", "(", "Map", "<", "String", ",", "Object", ">", "sessionAttributes", ")", "{", "if", "(", "requestEnvelope", ".", "getSession", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Attempti...
Sets session attributes, replacing any existing attributes already present in the session. An exception is thrown if this method is called while processing an out of session request. Use this method when bulk replacing attributes is desired. @param sessionAttributes session attributes to set @throws IllegalStateException if attempting to retrieve session attributes from an out of session request
[ "Sets", "session", "attributes", "replacing", "any", "existing", "attributes", "already", "present", "in", "the", "session", ".", "An", "exception", "is", "thrown", "if", "this", "method", "is", "called", "while", "processing", "an", "out", "of", "session", "r...
train
https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/attributes/AttributesManager.java#L105-L110
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.reimageAsync
public Observable<OperationStatusResponseInner> reimageAsync(String resourceGroupName, String vmScaleSetName) { return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> reimageAsync(String resourceGroupName, String vmScaleSetName) { return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "reimageAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "reimageWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "map", ...
Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Reimages", "(", "upgrade", "the", "operating", "system", ")", "one", "or", "more", "virtual", "machines", "in", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L2914-L2921
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/time/APSPSolver.java
APSPSolver.getConstraint
public SimpleDistanceConstraint getConstraint(TimePoint tpFrom, TimePoint tpTo) { if (this.distance[tpFrom.getID()][tpTo.getID()] != INF) return tPoints[tpFrom.getID()].getOut(tpTo.getID()); return null; }
java
public SimpleDistanceConstraint getConstraint(TimePoint tpFrom, TimePoint tpTo) { if (this.distance[tpFrom.getID()][tpTo.getID()] != INF) return tPoints[tpFrom.getID()].getOut(tpTo.getID()); return null; }
[ "public", "SimpleDistanceConstraint", "getConstraint", "(", "TimePoint", "tpFrom", ",", "TimePoint", "tpTo", ")", "{", "if", "(", "this", ".", "distance", "[", "tpFrom", ".", "getID", "(", ")", "]", "[", "tpTo", ".", "getID", "(", ")", "]", "!=", "INF", ...
Get active constraint between two {@link TimePoint}s. @param tpFrom The source {@link TimePoint}. @param tpTo The destination {@link TimePoint}. @return The active {@link SimpleDistanceConstraint} between the two {@link TimePoint}s (<code>null</code> if none exists).
[ "Get", "active", "constraint", "between", "two", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/time/APSPSolver.java#L1023-L1027
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/range/ByteRangeRandomizer.java
ByteRangeRandomizer.aNewByteRangeRandomizer
public static ByteRangeRandomizer aNewByteRangeRandomizer(final Byte min, final Byte max, final long seed) { return new ByteRangeRandomizer(min, max, seed); }
java
public static ByteRangeRandomizer aNewByteRangeRandomizer(final Byte min, final Byte max, final long seed) { return new ByteRangeRandomizer(min, max, seed); }
[ "public", "static", "ByteRangeRandomizer", "aNewByteRangeRandomizer", "(", "final", "Byte", "min", ",", "final", "Byte", "max", ",", "final", "long", "seed", ")", "{", "return", "new", "ByteRangeRandomizer", "(", "min", ",", "max", ",", "seed", ")", ";", "}"...
Create a new {@link ByteRangeRandomizer}. @param min min value @param max max value @param seed initial seed @return a new {@link ByteRangeRandomizer}.
[ "Create", "a", "new", "{", "@link", "ByteRangeRandomizer", "}", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/ByteRangeRandomizer.java#L73-L75
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/index/service/PartitionKeyMapper.java
PartitionKeyMapper.addFields
public void addFields(Document document, DecoratedKey partitionKey) { String serializedKey = ByteBufferUtils.toString(partitionKey.getKey()); Field field = new StringField(FIELD_NAME, serializedKey, Store.YES); document.add(field); }
java
public void addFields(Document document, DecoratedKey partitionKey) { String serializedKey = ByteBufferUtils.toString(partitionKey.getKey()); Field field = new StringField(FIELD_NAME, serializedKey, Store.YES); document.add(field); }
[ "public", "void", "addFields", "(", "Document", "document", ",", "DecoratedKey", "partitionKey", ")", "{", "String", "serializedKey", "=", "ByteBufferUtils", ".", "toString", "(", "partitionKey", ".", "getKey", "(", ")", ")", ";", "Field", "field", "=", "new",...
Adds to the specified {@link Document} the {@link Field}s associated to the specified raw partition key. @param document The document in which the fields are going to be added. @param partitionKey The raw partition key to be converted.
[ "Adds", "to", "the", "specified", "{", "@link", "Document", "}", "the", "{", "@link", "Field", "}", "s", "associated", "to", "the", "specified", "raw", "partition", "key", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/PartitionKeyMapper.java#L84-L88
google/closure-templates
java/src/com/google/template/soy/jssrc/internal/JsRuntime.java
JsRuntime.symbolWithNamespace
private static Expression symbolWithNamespace(String requireSymbol, String fullyQualifiedSymbol) { GoogRequire require = GoogRequire.create(requireSymbol); if (fullyQualifiedSymbol.equals(require.symbol())) { return require.reference(); } String ident = fullyQualifiedSymbol.substring(require.symbol().length() + 1); return require.dotAccess(ident); }
java
private static Expression symbolWithNamespace(String requireSymbol, String fullyQualifiedSymbol) { GoogRequire require = GoogRequire.create(requireSymbol); if (fullyQualifiedSymbol.equals(require.symbol())) { return require.reference(); } String ident = fullyQualifiedSymbol.substring(require.symbol().length() + 1); return require.dotAccess(ident); }
[ "private", "static", "Expression", "symbolWithNamespace", "(", "String", "requireSymbol", ",", "String", "fullyQualifiedSymbol", ")", "{", "GoogRequire", "require", "=", "GoogRequire", ".", "create", "(", "requireSymbol", ")", ";", "if", "(", "fullyQualifiedSymbol", ...
Returns a code chunk that accesses the given symbol. @param requireSymbol The symbol to {@code goog.require} @param fullyQualifiedSymbol The symbol we want to access.
[ "Returns", "a", "code", "chunk", "that", "accesses", "the", "given", "symbol", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsRuntime.java#L229-L236
phax/ph-oton
ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResource.java
WebSiteResource._readAndParseCSS
@Nonnull private String _readAndParseCSS (@Nonnull final IHasInputStream aISP, @Nonnull @Nonempty final String sBasePath, final boolean bRegular) { final CascadingStyleSheet aCSS = CSSReader.readFromStream (aISP, m_aCharset, ECSSVersion.CSS30); if (aCSS == null) { LOGGER.error ("Failed to parse CSS. Returning 'as-is'"); return StreamHelper.getAllBytesAsString (aISP, m_aCharset); } CSSVisitor.visitCSSUrl (aCSS, new AbstractModifyingCSSUrlVisitor () { @Override protected String getModifiedURI (@Nonnull final String sURI) { if (LinkHelper.hasKnownProtocol (sURI)) { // If e.g. an external resource is includes. // Example: https://fonts.googleapis.com/css return sURI; } return FilenameHelper.getCleanConcatenatedUrlPath (sBasePath, sURI); } }); // Write again after modification return new CSSWriter (ECSSVersion.CSS30, !bRegular).setWriteHeaderText (false) .setWriteFooterText (false) .getCSSAsString (aCSS); }
java
@Nonnull private String _readAndParseCSS (@Nonnull final IHasInputStream aISP, @Nonnull @Nonempty final String sBasePath, final boolean bRegular) { final CascadingStyleSheet aCSS = CSSReader.readFromStream (aISP, m_aCharset, ECSSVersion.CSS30); if (aCSS == null) { LOGGER.error ("Failed to parse CSS. Returning 'as-is'"); return StreamHelper.getAllBytesAsString (aISP, m_aCharset); } CSSVisitor.visitCSSUrl (aCSS, new AbstractModifyingCSSUrlVisitor () { @Override protected String getModifiedURI (@Nonnull final String sURI) { if (LinkHelper.hasKnownProtocol (sURI)) { // If e.g. an external resource is includes. // Example: https://fonts.googleapis.com/css return sURI; } return FilenameHelper.getCleanConcatenatedUrlPath (sBasePath, sURI); } }); // Write again after modification return new CSSWriter (ECSSVersion.CSS30, !bRegular).setWriteHeaderText (false) .setWriteFooterText (false) .getCSSAsString (aCSS); }
[ "@", "Nonnull", "private", "String", "_readAndParseCSS", "(", "@", "Nonnull", "final", "IHasInputStream", "aISP", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sBasePath", ",", "final", "boolean", "bRegular", ")", "{", "final", "CascadingStyleSheet", ...
Unify all paths in a CSS relative to the passed base path. @param aISP Input stream provider. @param sBasePath The base path, where the source CSS is read from. @param bRegular <code>true</code> for normal output, <code>false</code> for minified output. @return The modified String.
[ "Unify", "all", "paths", "in", "a", "CSS", "relative", "to", "the", "passed", "base", "path", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/resource/WebSiteResource.java#L160-L190
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/JCacheMetrics.java
JCacheMetrics.monitor
public static <K, V, C extends Cache<K, V>> C monitor(MeterRegistry registry, C cache, Iterable<Tag> tags) { new JCacheMetrics(cache, tags).bindTo(registry); return cache; }
java
public static <K, V, C extends Cache<K, V>> C monitor(MeterRegistry registry, C cache, Iterable<Tag> tags) { new JCacheMetrics(cache, tags).bindTo(registry); return cache; }
[ "public", "static", "<", "K", ",", "V", ",", "C", "extends", "Cache", "<", "K", ",", "V", ">", ">", "C", "monitor", "(", "MeterRegistry", "registry", ",", "C", "cache", ",", "Iterable", "<", "Tag", ">", "tags", ")", "{", "new", "JCacheMetrics", "("...
Record metrics on a JCache cache. @param registry The registry to bind metrics to. @param cache The cache to instrument. @param tags Tags to apply to all recorded metrics. @param <C> The cache type. @param <K> The cache key type. @param <V> The cache value type. @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
[ "Record", "metrics", "on", "a", "JCache", "cache", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/JCacheMetrics.java#L73-L76
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java
ObjectEnvelopeOrdering.buildPotentialMNEdge
protected Edge buildPotentialMNEdge(Vertex vertex1, Vertex vertex2) { ModificationState state1 = vertex1.getEnvelope().getModificationState(); ModificationState state2 = vertex2.getEnvelope().getModificationState(); if (state1.needsUpdate() || state1.needsDelete()) { if (state2.needsDelete()) { // old version of (1) might comprise a link to (2) return new Edge(vertex1, vertex2, POTENTIAL_EDGE_WEIGHT); } } return null; }
java
protected Edge buildPotentialMNEdge(Vertex vertex1, Vertex vertex2) { ModificationState state1 = vertex1.getEnvelope().getModificationState(); ModificationState state2 = vertex2.getEnvelope().getModificationState(); if (state1.needsUpdate() || state1.needsDelete()) { if (state2.needsDelete()) { // old version of (1) might comprise a link to (2) return new Edge(vertex1, vertex2, POTENTIAL_EDGE_WEIGHT); } } return null; }
[ "protected", "Edge", "buildPotentialMNEdge", "(", "Vertex", "vertex1", ",", "Vertex", "vertex2", ")", "{", "ModificationState", "state1", "=", "vertex1", ".", "getEnvelope", "(", ")", ".", "getModificationState", "(", ")", ";", "ModificationState", "state2", "=", ...
Checks if the database operations associated with two object envelopes that might have been related via an m:n collection reference before the current transaction needs to be performed in a particular order and if so builds and returns a corresponding directed edge weighted with <code>POTENTIAL_EDGE_WEIGHT</code>. The following cases are considered (* means object needs update, + means object needs insert, - means object needs to be deleted): <table> <tr><td>(1)* -(m:n)-&gt; (2)*</td><td>no edge</td></tr> <tr><td>(1)* -(m:n)-&gt; (2)+</td><td>no edge</td></tr> <tr><td>(1)* -(m:n)-&gt; (2)-</td><td>(1)-&gt;(2) edge</td></tr> <tr><td>(1)+ -(m:n)-&gt; (2)*</td><td>no edge</td></tr> <tr><td>(1)+ -(m:n)-&gt; (2)+</td><td>no edge</td></tr> <tr><td>(1)+ -(m:n)-&gt; (2)-</td><td>no edge</td></tr> <tr><td>(1)- -(m:n)-&gt; (2)*</td><td>no edge</td></tr> <tr><td>(1)- -(m:n)-&gt; (2)+</td><td>no edge</td></tr> <tr><td>(1)- -(m:n)-&gt; (2)-</td><td>(1)-&gt;(2) edge</td></tr> <table> @param vertex1 object envelope vertex of the object holding the collection @param vertex2 object envelope vertex of the object that might have been contained in the collection @return an Edge object or null if the two database operations can be performed in any order
[ "Checks", "if", "the", "database", "operations", "associated", "with", "two", "object", "envelopes", "that", "might", "have", "been", "related", "via", "an", "m", ":", "n", "collection", "reference", "before", "the", "current", "transaction", "needs", "to", "b...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java#L653-L666
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/JavacState.java
JavacState.setVisibleSources
public void setVisibleSources(Map<String,Source> vs) { visibleSrcs = new HashSet<URI>(); for (String s : vs.keySet()) { Source src = vs.get(s); visibleSrcs.add(src.file().toURI()); } }
java
public void setVisibleSources(Map<String,Source> vs) { visibleSrcs = new HashSet<URI>(); for (String s : vs.keySet()) { Source src = vs.get(s); visibleSrcs.add(src.file().toURI()); } }
[ "public", "void", "setVisibleSources", "(", "Map", "<", "String", ",", "Source", ">", "vs", ")", "{", "visibleSrcs", "=", "new", "HashSet", "<", "URI", ">", "(", ")", ";", "for", "(", "String", "s", ":", "vs", ".", "keySet", "(", ")", ")", "{", "...
Specify which sources are visible to the compiler through -sourcepath.
[ "Specify", "which", "sources", "are", "visible", "to", "the", "compiler", "through", "-", "sourcepath", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/JavacState.java#L199-L205
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nsacl_stats.java
nsacl_stats.get
public static nsacl_stats get(nitro_service service, String aclname) throws Exception{ nsacl_stats obj = new nsacl_stats(); obj.set_aclname(aclname); nsacl_stats response = (nsacl_stats) obj.stat_resource(service); return response; }
java
public static nsacl_stats get(nitro_service service, String aclname) throws Exception{ nsacl_stats obj = new nsacl_stats(); obj.set_aclname(aclname); nsacl_stats response = (nsacl_stats) obj.stat_resource(service); return response; }
[ "public", "static", "nsacl_stats", "get", "(", "nitro_service", "service", ",", "String", "aclname", ")", "throws", "Exception", "{", "nsacl_stats", "obj", "=", "new", "nsacl_stats", "(", ")", ";", "obj", ".", "set_aclname", "(", "aclname", ")", ";", "nsacl_...
Use this API to fetch statistics of nsacl_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "nsacl_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nsacl_stats.java#L279-L284
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java
DateFormat.getTimeInstance
public final static DateFormat getTimeInstance(int style) { return get(style, 0, 1, Locale.getDefault(Locale.Category.FORMAT)); }
java
public final static DateFormat getTimeInstance(int style) { return get(style, 0, 1, Locale.getDefault(Locale.Category.FORMAT)); }
[ "public", "final", "static", "DateFormat", "getTimeInstance", "(", "int", "style", ")", "{", "return", "get", "(", "style", ",", "0", ",", "1", ",", "Locale", ".", "getDefault", "(", "Locale", ".", "Category", ".", "FORMAT", ")", ")", ";", "}" ]
Gets the time formatter with the given formatting style for the default locale. @param style the given formatting style. For example, SHORT for "h:mm a" in the US locale. @return a time formatter.
[ "Gets", "the", "time", "formatter", "with", "the", "given", "formatting", "style", "for", "the", "default", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java#L458-L461
apache/flink
flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java
KvStateSerializer.deserializeMap
public static <UK, UV> Map<UK, UV> deserializeMap(byte[] serializedValue, TypeSerializer<UK> keySerializer, TypeSerializer<UV> valueSerializer) throws IOException { if (serializedValue != null) { DataInputDeserializer in = new DataInputDeserializer(serializedValue, 0, serializedValue.length); Map<UK, UV> result = new HashMap<>(); while (in.available() > 0) { UK key = keySerializer.deserialize(in); boolean isNull = in.readBoolean(); UV value = isNull ? null : valueSerializer.deserialize(in); result.put(key, value); } return result; } else { return null; } }
java
public static <UK, UV> Map<UK, UV> deserializeMap(byte[] serializedValue, TypeSerializer<UK> keySerializer, TypeSerializer<UV> valueSerializer) throws IOException { if (serializedValue != null) { DataInputDeserializer in = new DataInputDeserializer(serializedValue, 0, serializedValue.length); Map<UK, UV> result = new HashMap<>(); while (in.available() > 0) { UK key = keySerializer.deserialize(in); boolean isNull = in.readBoolean(); UV value = isNull ? null : valueSerializer.deserialize(in); result.put(key, value); } return result; } else { return null; } }
[ "public", "static", "<", "UK", ",", "UV", ">", "Map", "<", "UK", ",", "UV", ">", "deserializeMap", "(", "byte", "[", "]", "serializedValue", ",", "TypeSerializer", "<", "UK", ">", "keySerializer", ",", "TypeSerializer", "<", "UV", ">", "valueSerializer", ...
Deserializes all kv pairs with the given serializer. @param serializedValue Serialized value of type Map&lt;UK, UV&gt; @param keySerializer Serializer for UK @param valueSerializer Serializer for UV @param <UK> Type of the key @param <UV> Type of the value. @return Deserialized map or <code>null</code> if the serialized value is <code>null</code> @throws IOException On failure during deserialization
[ "Deserializes", "all", "kv", "pairs", "with", "the", "given", "serializer", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/client/state/serialization/KvStateSerializer.java#L250-L268
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/AutomationExecution.java
AutomationExecution.withTargetMaps
public AutomationExecution withTargetMaps(java.util.Map<String, java.util.List<String>>... targetMaps) { if (this.targetMaps == null) { setTargetMaps(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, java.util.List<String>>>(targetMaps.length)); } for (java.util.Map<String, java.util.List<String>> ele : targetMaps) { this.targetMaps.add(ele); } return this; }
java
public AutomationExecution withTargetMaps(java.util.Map<String, java.util.List<String>>... targetMaps) { if (this.targetMaps == null) { setTargetMaps(new com.amazonaws.internal.SdkInternalList<java.util.Map<String, java.util.List<String>>>(targetMaps.length)); } for (java.util.Map<String, java.util.List<String>> ele : targetMaps) { this.targetMaps.add(ele); } return this; }
[ "public", "AutomationExecution", "withTargetMaps", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "...", "targetMaps", ")", "{", "if", "(", "this", ".", "targetMaps", "==", "null", "...
<p> The specified key-value mapping of document parameters to target resources. </p> <p> <b>NOTE:</b> This method appends the values to the existing list (if any). Use {@link #setTargetMaps(java.util.Collection)} or {@link #withTargetMaps(java.util.Collection)} if you want to override the existing values. </p> @param targetMaps The specified key-value mapping of document parameters to target resources. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "specified", "key", "-", "value", "mapping", "of", "document", "parameters", "to", "target", "resources", ".", "<", "/", "p", ">", "<p", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "This", "method", "appends", "the", "values", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/AutomationExecution.java#L1155-L1163
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java
AuthorizationRequestManager.processResponseWrapper
private void processResponseWrapper(Response response, boolean isFailure) { try { ResponseImpl responseImpl = (ResponseImpl)response; if (isFailure || !responseImpl.isRedirect()) { processResponse(response); } else { processRedirectResponse(response); } } catch (Throwable t) { logger.error("processResponseWrapper caught exception: " + t.getLocalizedMessage()); listener.onFailure(response, t, null); } }
java
private void processResponseWrapper(Response response, boolean isFailure) { try { ResponseImpl responseImpl = (ResponseImpl)response; if (isFailure || !responseImpl.isRedirect()) { processResponse(response); } else { processRedirectResponse(response); } } catch (Throwable t) { logger.error("processResponseWrapper caught exception: " + t.getLocalizedMessage()); listener.onFailure(response, t, null); } }
[ "private", "void", "processResponseWrapper", "(", "Response", "response", ",", "boolean", "isFailure", ")", "{", "try", "{", "ResponseImpl", "responseImpl", "=", "(", "ResponseImpl", ")", "response", ";", "if", "(", "isFailure", "||", "!", "responseImpl", ".", ...
Called from onSuccess and onFailure. Handles all possible exceptions and notifies the listener if an exception occurs. @param response server response @param isFailure specifies whether this method is called from onSuccess (false) or onFailure (true).
[ "Called", "from", "onSuccess", "and", "onFailure", ".", "Handles", "all", "possible", "exceptions", "and", "notifies", "the", "listener", "if", "an", "exception", "occurs", "." ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java#L557-L569
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaTypeAdapter.java
SchemaTypeAdapter.readRecord
private Schema readRecord(JsonReader reader, Set<String> knownRecords) throws IOException { if (!"name".equals(reader.nextName())) { throw new IOException("Property \"name\" missing for record."); } String recordName = reader.nextString(); // Read in fields schemas if (!"fields".equals(reader.nextName())) { throw new IOException("Property \"fields\" missing for record."); } knownRecords.add(recordName); ImmutableList.Builder<Schema.Field> fieldBuilder = ImmutableList.builder(); reader.beginArray(); while (reader.peek() != JsonToken.END_ARRAY) { reader.beginObject(); if (!"name".equals(reader.nextName())) { throw new IOException("Property \"name\" missing for record field."); } String fieldName = reader.nextString(); fieldBuilder.add(Schema.Field.of(fieldName, readInnerSchema(reader, "type", knownRecords))); reader.endObject(); } reader.endArray(); return Schema.recordOf(recordName, fieldBuilder.build()); }
java
private Schema readRecord(JsonReader reader, Set<String> knownRecords) throws IOException { if (!"name".equals(reader.nextName())) { throw new IOException("Property \"name\" missing for record."); } String recordName = reader.nextString(); // Read in fields schemas if (!"fields".equals(reader.nextName())) { throw new IOException("Property \"fields\" missing for record."); } knownRecords.add(recordName); ImmutableList.Builder<Schema.Field> fieldBuilder = ImmutableList.builder(); reader.beginArray(); while (reader.peek() != JsonToken.END_ARRAY) { reader.beginObject(); if (!"name".equals(reader.nextName())) { throw new IOException("Property \"name\" missing for record field."); } String fieldName = reader.nextString(); fieldBuilder.add(Schema.Field.of(fieldName, readInnerSchema(reader, "type", knownRecords))); reader.endObject(); } reader.endArray(); return Schema.recordOf(recordName, fieldBuilder.build()); }
[ "private", "Schema", "readRecord", "(", "JsonReader", "reader", ",", "Set", "<", "String", ">", "knownRecords", ")", "throws", "IOException", "{", "if", "(", "!", "\"name\"", ".", "equals", "(", "reader", ".", "nextName", "(", ")", ")", ")", "{", "throw"...
Constructs {@link Schema.Type#RECORD RECORD} type schema from the json input. @param reader The {@link JsonReader} for streaming json input tokens. @param knownRecords Set of record name already encountered during the reading. @return A {@link Schema} of type {@link Schema.Type#RECORD RECORD}. @throws java.io.IOException When fails to construct a valid schema from the input.
[ "Constructs", "{", "@link", "Schema", ".", "Type#RECORD", "RECORD", "}", "type", "schema", "from", "the", "json", "input", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaTypeAdapter.java#L190-L217
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/ConversationState.java
ConversationState.putChunkedMessageWrapper
public void putChunkedMessageWrapper(long wrapperId, ChunkedMessageWrapper wrapper) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putChunkedMessageWrapper", new Object[] { Long.valueOf(wrapperId), wrapper }); inProgressMessages.put(Long.valueOf(wrapperId), wrapper); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putChunkedMessageWrapper"); }
java
public void putChunkedMessageWrapper(long wrapperId, ChunkedMessageWrapper wrapper) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putChunkedMessageWrapper", new Object[] { Long.valueOf(wrapperId), wrapper }); inProgressMessages.put(Long.valueOf(wrapperId), wrapper); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putChunkedMessageWrapper"); }
[ "public", "void", "putChunkedMessageWrapper", "(", "long", "wrapperId", ",", "ChunkedMessageWrapper", "wrapper", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry",...
Puts a chunked message wrapper into our map. @param wrapperId @param wrapper
[ "Puts", "a", "chunked", "message", "wrapper", "into", "our", "map", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/ConversationState.java#L672-L679
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.groupAnswer
protected static <K, T> void groupAnswer(final Map<K, List<T>> answer, T element, K value) { if (answer.containsKey(value)) { answer.get(value).add(element); } else { List<T> groupedElements = new ArrayList<T>(); groupedElements.add(element); answer.put(value, groupedElements); } }
java
protected static <K, T> void groupAnswer(final Map<K, List<T>> answer, T element, K value) { if (answer.containsKey(value)) { answer.get(value).add(element); } else { List<T> groupedElements = new ArrayList<T>(); groupedElements.add(element); answer.put(value, groupedElements); } }
[ "protected", "static", "<", "K", ",", "T", ">", "void", "groupAnswer", "(", "final", "Map", "<", "K", ",", "List", "<", "T", ">", ">", "answer", ",", "T", "element", ",", "K", "value", ")", "{", "if", "(", "answer", ".", "containsKey", "(", "valu...
Groups the current element according to the value @param answer the map containing the results @param element the element to be placed @param value the value according to which the element will be placed @since 1.5.0
[ "Groups", "the", "current", "element", "according", "to", "the", "value" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L5205-L5213
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/TableBodyBox.java
TableBodyBox.organizeContent
private void organizeContent() { TableRowBox anonrow = null; for (Iterator<Box> it = nested.iterator(); it.hasNext(); ) { Box box = it.next(); if (box instanceof ElementBox && ((ElementBox) box).getDisplay() == ElementBox.DISPLAY_TABLE_ROW) { addRow((TableRowBox) box); //finish and add possible previous anonymous row if (anonrow != null) { anonrow.endChild = anonrow.nested.size(); addSubBox(anonrow); } anonrow = null; } else { if (anonrow == null) { Element anonelem = viewport.getFactory().createAnonymousElement(getParent().getParent().getElement().getOwnerDocument(), "tr", "table-row"); anonrow = new TableRowBox(anonelem, g, ctx); anonrow.adoptParent(this); anonrow.setStyle(viewport.getFactory().createAnonymousStyle("table-row")); addRow(anonrow); } anonrow.addSubBox(box); anonrow.isempty = false; box.setContainingBlockBox(anonrow); box.setParent(anonrow); it.remove(); endChild--; } } if (anonrow != null) { anonrow.endChild = anonrow.nested.size(); addSubBox(anonrow); } }
java
private void organizeContent() { TableRowBox anonrow = null; for (Iterator<Box> it = nested.iterator(); it.hasNext(); ) { Box box = it.next(); if (box instanceof ElementBox && ((ElementBox) box).getDisplay() == ElementBox.DISPLAY_TABLE_ROW) { addRow((TableRowBox) box); //finish and add possible previous anonymous row if (anonrow != null) { anonrow.endChild = anonrow.nested.size(); addSubBox(anonrow); } anonrow = null; } else { if (anonrow == null) { Element anonelem = viewport.getFactory().createAnonymousElement(getParent().getParent().getElement().getOwnerDocument(), "tr", "table-row"); anonrow = new TableRowBox(anonelem, g, ctx); anonrow.adoptParent(this); anonrow.setStyle(viewport.getFactory().createAnonymousStyle("table-row")); addRow(anonrow); } anonrow.addSubBox(box); anonrow.isempty = false; box.setContainingBlockBox(anonrow); box.setParent(anonrow); it.remove(); endChild--; } } if (anonrow != null) { anonrow.endChild = anonrow.nested.size(); addSubBox(anonrow); } }
[ "private", "void", "organizeContent", "(", ")", "{", "TableRowBox", "anonrow", "=", "null", ";", "for", "(", "Iterator", "<", "Box", ">", "it", "=", "nested", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Box", "bo...
Goes through the list of child boxes and creates the anonymous rows if necessary.
[ "Goes", "through", "the", "list", "of", "child", "boxes", "and", "creates", "the", "anonymous", "rows", "if", "necessary", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/TableBodyBox.java#L413-L454
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java
CmsContainerpageController.isInlineEditable
public boolean isInlineEditable(CmsContainerPageElementPanel element, I_CmsDropContainer dragParent) { CmsUUID elemView = element.getElementView(); return !getData().isUseClassicEditor() && CmsStringUtil.isEmptyOrWhitespaceOnly(element.getNoEditReason()) && hasActiveSelection() && matchRootView(elemView) && isContainerEditable(dragParent) && matchesCurrentEditLevel(dragParent) && (getData().isModelGroup() || !element.hasModelGroupParent()) && (!(dragParent instanceof CmsGroupContainerElementPanel) || isGroupcontainerEditing()); }
java
public boolean isInlineEditable(CmsContainerPageElementPanel element, I_CmsDropContainer dragParent) { CmsUUID elemView = element.getElementView(); return !getData().isUseClassicEditor() && CmsStringUtil.isEmptyOrWhitespaceOnly(element.getNoEditReason()) && hasActiveSelection() && matchRootView(elemView) && isContainerEditable(dragParent) && matchesCurrentEditLevel(dragParent) && (getData().isModelGroup() || !element.hasModelGroupParent()) && (!(dragParent instanceof CmsGroupContainerElementPanel) || isGroupcontainerEditing()); }
[ "public", "boolean", "isInlineEditable", "(", "CmsContainerPageElementPanel", "element", ",", "I_CmsDropContainer", "dragParent", ")", "{", "CmsUUID", "elemView", "=", "element", ".", "getElementView", "(", ")", ";", "return", "!", "getData", "(", ")", ".", "isUse...
Checks whether the given element should be inline editable.<p> @param element the element @param dragParent the element parent @return <code>true</code> if the element should be inline editable
[ "Checks", "whether", "the", "given", "element", "should", "be", "inline", "editable", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L2206-L2217
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java
KeyValueHandler.handleObserveRequest
private static BinaryMemcacheRequest handleObserveRequest(final ChannelHandlerContext ctx, final ObserveRequest msg) { String key = msg.key(); short keyLength = (short) msg.keyBytes().length; ByteBuf content = ctx.alloc().buffer(); content.writeShort(msg.partition()); content.writeShort(keyLength); content.writeBytes(key.getBytes(CHARSET)); BinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(EMPTY_BYTES, Unpooled.EMPTY_BUFFER, content); request.setOpcode(OP_OBSERVE); request.setTotalBodyLength(content.readableBytes()); return request; }
java
private static BinaryMemcacheRequest handleObserveRequest(final ChannelHandlerContext ctx, final ObserveRequest msg) { String key = msg.key(); short keyLength = (short) msg.keyBytes().length; ByteBuf content = ctx.alloc().buffer(); content.writeShort(msg.partition()); content.writeShort(keyLength); content.writeBytes(key.getBytes(CHARSET)); BinaryMemcacheRequest request = new DefaultFullBinaryMemcacheRequest(EMPTY_BYTES, Unpooled.EMPTY_BUFFER, content); request.setOpcode(OP_OBSERVE); request.setTotalBodyLength(content.readableBytes()); return request; }
[ "private", "static", "BinaryMemcacheRequest", "handleObserveRequest", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "ObserveRequest", "msg", ")", "{", "String", "key", "=", "msg", ".", "key", "(", ")", ";", "short", "keyLength", "=", "(", "short", ...
Encodes a {@link ObserveRequest} into its lower level representation. @return a ready {@link BinaryMemcacheRequest}.
[ "Encodes", "a", "{", "@link", "ObserveRequest", "}", "into", "its", "lower", "level", "representation", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L668-L681
trellis-ldp/trellis
components/rdfa/src/main/java/org/trellisldp/rdfa/HtmlSerializer.java
HtmlSerializer.write
@Override public void write(final Stream<Triple> triples, final OutputStream out, final String subject) { final Writer writer = new OutputStreamWriter(out, UTF_8); try { template .execute(writer, new HtmlData(namespaceService, subject, triples.collect(toList()), css, js, icon)) .flush(); } catch (final IOException ex) { throw new UncheckedIOException(ex); } }
java
@Override public void write(final Stream<Triple> triples, final OutputStream out, final String subject) { final Writer writer = new OutputStreamWriter(out, UTF_8); try { template .execute(writer, new HtmlData(namespaceService, subject, triples.collect(toList()), css, js, icon)) .flush(); } catch (final IOException ex) { throw new UncheckedIOException(ex); } }
[ "@", "Override", "public", "void", "write", "(", "final", "Stream", "<", "Triple", ">", "triples", ",", "final", "OutputStream", "out", ",", "final", "String", "subject", ")", "{", "final", "Writer", "writer", "=", "new", "OutputStreamWriter", "(", "out", ...
Send the content to an output stream. @param triples the triples @param out the output stream @param subject the subject
[ "Send", "the", "content", "to", "an", "output", "stream", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/rdfa/src/main/java/org/trellisldp/rdfa/HtmlSerializer.java#L150-L160
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
public static <T> T getAt(Iterator<T> self, int idx) { if (idx < 0) { // calculate whole list in this case // recommend avoiding -ve's as this is not as efficient List<T> list = toList(self); int adjustedIndex = idx + list.size(); if (adjustedIndex < 0 || adjustedIndex >= list.size()) return null; return list.get(adjustedIndex); } int count = 0; while (self.hasNext()) { if (count == idx) { return self.next(); } else { count++; self.next(); } } return null; }
java
public static <T> T getAt(Iterator<T> self, int idx) { if (idx < 0) { // calculate whole list in this case // recommend avoiding -ve's as this is not as efficient List<T> list = toList(self); int adjustedIndex = idx + list.size(); if (adjustedIndex < 0 || adjustedIndex >= list.size()) return null; return list.get(adjustedIndex); } int count = 0; while (self.hasNext()) { if (count == idx) { return self.next(); } else { count++; self.next(); } } return null; }
[ "public", "static", "<", "T", ">", "T", "getAt", "(", "Iterator", "<", "T", ">", "self", ",", "int", "idx", ")", "{", "if", "(", "idx", "<", "0", ")", "{", "// calculate whole list in this case", "// recommend avoiding -ve's as this is not as efficient", "List",...
Support the subscript operator for an Iterator. The iterator will be partially exhausted up until the idx entry after returning if a +ve or 0 idx is used, or fully exhausted if a -ve idx is used or no corresponding entry was found. Typical usage: <pre class="groovyTestCase"> def iter = [2, "a", 5.3].iterator() assert iter[1] == "a" </pre> A more elaborate example: <pre class="groovyTestCase"> def items = [2, "a", 5.3] def iter = items.iterator() assert iter[-1] == 5.3 // iter exhausted, so reset iter = items.iterator() assert iter[1] == "a" // iter partially exhausted so now idx starts after "a" assert iter[0] == 5.3 </pre> @param self an Iterator @param idx an index value (-self.size() &lt;= idx &lt; self.size()) @return the value at the given index (after normalisation) or null if no corresponding value was found @since 1.7.2
[ "Support", "the", "subscript", "operator", "for", "an", "Iterator", ".", "The", "iterator", "will", "be", "partially", "exhausted", "up", "until", "the", "idx", "entry", "after", "returning", "if", "a", "+", "ve", "or", "0", "idx", "is", "used", "or", "f...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7894-L7915
beanshell/beanshell
src/main/java/bsh/Invocable.java
Invocable.invokeTarget
private synchronized Object invokeTarget(Object base, Object[] pars) throws Throwable { Reflect.logInvokeMethod("Invoking method (entry): ", this, pars); List<Object> params = collectParamaters(base, pars); Reflect.logInvokeMethod("Invoking method (after): ", this, params); if (getParameterCount() > 0) return getMethodHandle().invokeWithArguments(params); if (isStatic() || this instanceof ConstructorInvocable) return getMethodHandle().invoke(); return getMethodHandle().invoke(params.get(0)); }
java
private synchronized Object invokeTarget(Object base, Object[] pars) throws Throwable { Reflect.logInvokeMethod("Invoking method (entry): ", this, pars); List<Object> params = collectParamaters(base, pars); Reflect.logInvokeMethod("Invoking method (after): ", this, params); if (getParameterCount() > 0) return getMethodHandle().invokeWithArguments(params); if (isStatic() || this instanceof ConstructorInvocable) return getMethodHandle().invoke(); return getMethodHandle().invoke(params.get(0)); }
[ "private", "synchronized", "Object", "invokeTarget", "(", "Object", "base", ",", "Object", "[", "]", "pars", ")", "throws", "Throwable", "{", "Reflect", ".", "logInvokeMethod", "(", "\"Invoking method (entry): \"", ",", "this", ",", "pars", ")", ";", "List", "...
All purpose MethodHandle invoke implementation, with or without args. @param base represents the base object instance. @param pars parameter arguments @return invocation result @throws Throwable combined exceptions
[ "All", "purpose", "MethodHandle", "invoke", "implementation", "with", "or", "without", "args", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Invocable.java#L189-L199
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigDecimalExtensions.java
BigDecimalExtensions.operator_power
@Pure @Inline(value="$1.pow($2)") public static BigDecimal operator_power(BigDecimal a, int exponent) { return a.pow(exponent); }
java
@Pure @Inline(value="$1.pow($2)") public static BigDecimal operator_power(BigDecimal a, int exponent) { return a.pow(exponent); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"$1.pow($2)\"", ")", "public", "static", "BigDecimal", "operator_power", "(", "BigDecimal", "a", ",", "int", "exponent", ")", "{", "return", "a", ".", "pow", "(", "exponent", ")", ";", "}" ]
The <code>power</code> operator. @param a a BigDecimal. May not be <code>null</code>. @param exponent the exponent. @return <code>a.pow(b)</code> @throws NullPointerException if {@code a} is <code>null</code>.
[ "The", "<code", ">", "power<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigDecimalExtensions.java#L83-L87
jcuda/jcusolver
JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java
JCusolverSp.cusolverSpXcsrsymmdqHost
public static int cusolverSpXcsrsymmdqHost( cusolverSpHandle handle, int n, int nnzA, cusparseMatDescr descrA, Pointer csrRowPtrA, Pointer csrColIndA, Pointer p) { return checkResult(cusolverSpXcsrsymmdqHostNative(handle, n, nnzA, descrA, csrRowPtrA, csrColIndA, p)); }
java
public static int cusolverSpXcsrsymmdqHost( cusolverSpHandle handle, int n, int nnzA, cusparseMatDescr descrA, Pointer csrRowPtrA, Pointer csrColIndA, Pointer p) { return checkResult(cusolverSpXcsrsymmdqHostNative(handle, n, nnzA, descrA, csrRowPtrA, csrColIndA, p)); }
[ "public", "static", "int", "cusolverSpXcsrsymmdqHost", "(", "cusolverSpHandle", "handle", ",", "int", "n", ",", "int", "nnzA", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "csrRowPtrA", ",", "Pointer", "csrColIndA", ",", "Pointer", "p", ")", "{", "return",...
<pre> --------- CPU symmdq Symmetric minimum degree algorithm by quotient graph </pre>
[ "<pre", ">", "---------", "CPU", "symmdq", "Symmetric", "minimum", "degree", "algorithm", "by", "quotient", "graph" ]
train
https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java#L1382-L1392
icode/ameba
src/main/java/ameba/db/ebean/migration/PlatformDdlWriter.java
PlatformDdlWriter.processMigration
public void processMigration(Migration dbMigration, DdlWrite write) throws IOException { DdlHandler handler = handler(); handler.generateProlog(write); List<ChangeSet> changeSets = dbMigration.getChangeSet(); for (ChangeSet changeSet : changeSets) { if (isApply(changeSet)) { handler.generate(write, changeSet); } } handler.generateEpilog(write); writePlatformDdl(write); }
java
public void processMigration(Migration dbMigration, DdlWrite write) throws IOException { DdlHandler handler = handler(); handler.generateProlog(write); List<ChangeSet> changeSets = dbMigration.getChangeSet(); for (ChangeSet changeSet : changeSets) { if (isApply(changeSet)) { handler.generate(write, changeSet); } } handler.generateEpilog(write); writePlatformDdl(write); }
[ "public", "void", "processMigration", "(", "Migration", "dbMigration", ",", "DdlWrite", "write", ")", "throws", "IOException", "{", "DdlHandler", "handler", "=", "handler", "(", ")", ";", "handler", ".", "generateProlog", "(", "write", ")", ";", "List", "<", ...
<p>processMigration.</p> @param dbMigration a {@link io.ebeaninternal.dbmigration.migration.Migration} object. @param write a {@link io.ebeaninternal.dbmigration.ddlgeneration.DdlWrite} object. @throws java.io.IOException if any.
[ "<p", ">", "processMigration", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/migration/PlatformDdlWriter.java#L46-L58
alkacon/opencms-core
src/org/opencms/importexport/A_CmsImport.java
A_CmsImport.getLocale
protected Locale getLocale(String destination, List<CmsProperty> properties) { String localeName = CmsProperty.get(CmsPropertyDefinition.PROPERTY_LOCALE, properties).getValue(); if (localeName != null) { // locale was already set on the files properties return OpenCms.getLocaleManager().getAvailableLocales(localeName).get(0); } // locale not set in properties, read default locales return OpenCms.getLocaleManager().getDefaultLocales(m_cms, CmsResource.getParentFolder(destination)).get(0); }
java
protected Locale getLocale(String destination, List<CmsProperty> properties) { String localeName = CmsProperty.get(CmsPropertyDefinition.PROPERTY_LOCALE, properties).getValue(); if (localeName != null) { // locale was already set on the files properties return OpenCms.getLocaleManager().getAvailableLocales(localeName).get(0); } // locale not set in properties, read default locales return OpenCms.getLocaleManager().getDefaultLocales(m_cms, CmsResource.getParentFolder(destination)).get(0); }
[ "protected", "Locale", "getLocale", "(", "String", "destination", ",", "List", "<", "CmsProperty", ">", "properties", ")", "{", "String", "localeName", "=", "CmsProperty", ".", "get", "(", "CmsPropertyDefinition", ".", "PROPERTY_LOCALE", ",", "properties", ")", ...
Returns the appropriate locale for the given destination.<p> @param destination the destination path (parent must exist) @param properties the properties to check at first @return the locale
[ "Returns", "the", "appropriate", "locale", "for", "the", "given", "destination", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/A_CmsImport.java#L629-L639
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java
SeleniumDriverSetup.startDriver
public boolean startDriver(String driverClassName, final Map<String, Object> profile) throws Exception { if (OVERRIDE_ACTIVE) { return true; } DriverFactory driverFactory = new LocalDriverFactory(driverClassName, profile); WebDriver driver = setAndUseDriverFactory(driverFactory); return driver != null; }
java
public boolean startDriver(String driverClassName, final Map<String, Object> profile) throws Exception { if (OVERRIDE_ACTIVE) { return true; } DriverFactory driverFactory = new LocalDriverFactory(driverClassName, profile); WebDriver driver = setAndUseDriverFactory(driverFactory); return driver != null; }
[ "public", "boolean", "startDriver", "(", "String", "driverClassName", ",", "final", "Map", "<", "String", ",", "Object", ">", "profile", ")", "throws", "Exception", "{", "if", "(", "OVERRIDE_ACTIVE", ")", "{", "return", "true", ";", "}", "DriverFactory", "dr...
Creates an instance of the specified class an injects it into SeleniumHelper, so other fixtures can use it. @param driverClassName name of Java class of WebDriver to use. @param profile profile to use (for firefox, chrome mobile and IE only for now) @return true if instance was created and injected into SeleniumHelper. @throws Exception if no instance could be created.
[ "Creates", "an", "instance", "of", "the", "specified", "class", "an", "injects", "it", "into", "SeleniumHelper", "so", "other", "fixtures", "can", "use", "it", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java#L61-L69
virgo47/javasimon
core/src/main/java/org/javasimon/callback/quantiles/QuantilesCallback.java
QuantilesCallback.onStopwatchAdd
@Override public void onStopwatchAdd(Stopwatch stopwatch, Split split, StopwatchSample sample) { onStopwatchSplit(split.getStopwatch(), split); }
java
@Override public void onStopwatchAdd(Stopwatch stopwatch, Split split, StopwatchSample sample) { onStopwatchSplit(split.getStopwatch(), split); }
[ "@", "Override", "public", "void", "onStopwatchAdd", "(", "Stopwatch", "stopwatch", ",", "Split", "split", ",", "StopwatchSample", "sample", ")", "{", "onStopwatchSplit", "(", "split", ".", "getStopwatch", "(", ")", ",", "split", ")", ";", "}" ]
When a split is added, if buckets have been initialized, the value is added to appropriate bucket.
[ "When", "a", "split", "is", "added", "if", "buckets", "have", "been", "initialized", "the", "value", "is", "added", "to", "appropriate", "bucket", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/quantiles/QuantilesCallback.java#L163-L166