repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
box/box-java-sdk
src/main/java/com/box/sdk/BoxDeveloperEditionAPIConnection.java
BoxDeveloperEditionAPIConnection.getAppUserConnection
public static BoxDeveloperEditionAPIConnection getAppUserConnection(String userId, BoxConfig boxConfig) { return getAppUserConnection(userId, boxConfig.getClientId(), boxConfig.getClientSecret(), boxConfig.getJWTEncryptionPreferences()); }
java
public static BoxDeveloperEditionAPIConnection getAppUserConnection(String userId, BoxConfig boxConfig) { return getAppUserConnection(userId, boxConfig.getClientId(), boxConfig.getClientSecret(), boxConfig.getJWTEncryptionPreferences()); }
[ "public", "static", "BoxDeveloperEditionAPIConnection", "getAppUserConnection", "(", "String", "userId", ",", "BoxConfig", "boxConfig", ")", "{", "return", "getAppUserConnection", "(", "userId", ",", "boxConfig", ".", "getClientId", "(", ")", ",", "boxConfig", ".", ...
Creates a new Box Developer Edition connection with App User token levaraging BoxConfig. @param userId the user ID to use for an App User. @param boxConfig box configuration settings object @return a new instance of BoxAPIConnection.
[ "Creates", "a", "new", "Box", "Developer", "Edition", "connection", "with", "App", "User", "token", "levaraging", "BoxConfig", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxDeveloperEditionAPIConnection.java#L282-L285
alkacon/opencms-core
src/org/opencms/importexport/CmsImportVersion7.java
CmsImportVersion7.addProjectRules
protected void addProjectRules(Digester digester, String xpath) { digester.addCallMethod(xpath + N_NAME, "setProjectName", 0); digester.addCallMethod(xpath + N_DESCRIPTION, "setProjectDescription", 0); digester.addCallMethod(xpath + N_MANAGERSGROUP, "setProjectManagers", 0); digester.addCallMethod(xpath + N_USERSGROUP, "setProjectUsers", 0); digester.addCallMethod(xpath + N_RESOURCES + "/" + N_RESOURCE, "addProjectResource", 0); digester.addCallMethod(xpath + N_RESOURCES, "importProject"); }
java
protected void addProjectRules(Digester digester, String xpath) { digester.addCallMethod(xpath + N_NAME, "setProjectName", 0); digester.addCallMethod(xpath + N_DESCRIPTION, "setProjectDescription", 0); digester.addCallMethod(xpath + N_MANAGERSGROUP, "setProjectManagers", 0); digester.addCallMethod(xpath + N_USERSGROUP, "setProjectUsers", 0); digester.addCallMethod(xpath + N_RESOURCES + "/" + N_RESOURCE, "addProjectResource", 0); digester.addCallMethod(xpath + N_RESOURCES, "importProject"); }
[ "protected", "void", "addProjectRules", "(", "Digester", "digester", ",", "String", "xpath", ")", "{", "digester", ".", "addCallMethod", "(", "xpath", "+", "N_NAME", ",", "\"setProjectName\"", ",", "0", ")", ";", "digester", ".", "addCallMethod", "(", "xpath",...
Adds the XML digester rules for projects.<p> @param digester the digester to add the rules to @param xpath the base xpath for the rules
[ "Adds", "the", "XML", "digester", "rules", "for", "projects", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion7.java#L3036-L3044
alkacon/opencms-core
src/org/opencms/search/solr/CmsSolrQuery.java
CmsSolrQuery.setDateRanges
public void setDateRanges(Map<String, CmsPair<Date, Date>> dateRanges) { if ((dateRanges != null) && !dateRanges.isEmpty()) { // remove the date ranges for (Map.Entry<String, CmsPair<Date, Date>> entry : dateRanges.entrySet()) { removeFacetField(entry.getKey()); } // add the date ranges for (Map.Entry<String, CmsPair<Date, Date>> entry : dateRanges.entrySet()) { addDateRangeFacet( entry.getKey(), entry.getValue().getFirst(), entry.getValue().getSecond(), m_facetDateGap); } } }
java
public void setDateRanges(Map<String, CmsPair<Date, Date>> dateRanges) { if ((dateRanges != null) && !dateRanges.isEmpty()) { // remove the date ranges for (Map.Entry<String, CmsPair<Date, Date>> entry : dateRanges.entrySet()) { removeFacetField(entry.getKey()); } // add the date ranges for (Map.Entry<String, CmsPair<Date, Date>> entry : dateRanges.entrySet()) { addDateRangeFacet( entry.getKey(), entry.getValue().getFirst(), entry.getValue().getSecond(), m_facetDateGap); } } }
[ "public", "void", "setDateRanges", "(", "Map", "<", "String", ",", "CmsPair", "<", "Date", ",", "Date", ">", ">", "dateRanges", ")", "{", "if", "(", "(", "dateRanges", "!=", "null", ")", "&&", "!", "dateRanges", ".", "isEmpty", "(", ")", ")", "{", ...
Sets date ranges.<p> This call will overwrite all existing date ranges for the given keys (name of the date facet field).<p> The parameter Map uses as:<p> <ul> <li><code>keys: </code>Solr field name {@link org.opencms.search.fields.CmsSearchField} and <li><code>values: </code> pairs with min date as first and max date as second {@link org.opencms.util.CmsPair} </ul> Alternatively you can use Solr standard query syntax like:<p> <ul> <li><code>+created:[* TO NOW]</code> <li><code>+lastmodified:[' + date + ' TO NOW]</code> </ul> whereby date is Solr formatted: {@link org.opencms.search.CmsSearchUtil#getDateAsIso8601(Date)} <p> @param dateRanges the ranges map with field name as key and a CmsPair with min date as first and max date as second
[ "Sets", "date", "ranges", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrQuery.java#L328-L344
fuinorg/utils4j
src/main/java/org/fuin/utils4j/PropertiesUtils.java
PropertiesUtils.loadProperties
public static Properties loadProperties(final ClassLoader loader, final String resource) { checkNotNull("loader", loader); checkNotNull("resource", resource); final Properties props = new Properties(); try (final InputStream inStream = loader.getResourceAsStream(resource)) { if (inStream == null) { throw new IllegalArgumentException("Resource '" + resource + "' not found!"); } props.load(inStream); } catch (final IOException ex) { throw new RuntimeException(ex); } return props; }
java
public static Properties loadProperties(final ClassLoader loader, final String resource) { checkNotNull("loader", loader); checkNotNull("resource", resource); final Properties props = new Properties(); try (final InputStream inStream = loader.getResourceAsStream(resource)) { if (inStream == null) { throw new IllegalArgumentException("Resource '" + resource + "' not found!"); } props.load(inStream); } catch (final IOException ex) { throw new RuntimeException(ex); } return props; }
[ "public", "static", "Properties", "loadProperties", "(", "final", "ClassLoader", "loader", ",", "final", "String", "resource", ")", "{", "checkNotNull", "(", "\"loader\"", ",", "loader", ")", ";", "checkNotNull", "(", "\"resource\"", ",", "resource", ")", ";", ...
Loads a resource from the classpath as properties. @param loader Class loader to use. @param resource Resource to load. @return Properties.
[ "Loads", "a", "resource", "from", "the", "classpath", "as", "properties", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/PropertiesUtils.java#L77-L91
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_POST
public OvhOvhPabxDialplanExtensionConditionTime billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_POST(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Date timeFrom, Date timeTo, OvhOvhPabxDialplanExtensionConditionTimeWeekDayEnum weekDay) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "timeFrom", timeFrom); addBody(o, "timeTo", timeTo); addBody(o, "weekDay", weekDay); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxDialplanExtensionConditionTime.class); }
java
public OvhOvhPabxDialplanExtensionConditionTime billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_POST(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Date timeFrom, Date timeTo, OvhOvhPabxDialplanExtensionConditionTimeWeekDayEnum weekDay) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "timeFrom", timeFrom); addBody(o, "timeTo", timeTo); addBody(o, "weekDay", weekDay); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxDialplanExtensionConditionTime.class); }
[ "public", "OvhOvhPabxDialplanExtensionConditionTime", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ",", "Date", ...
Create a new time condition for an extension REST: POST /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime @param timeTo [required] The time of the day when the extension will stop to be executed @param timeFrom [required] The time of the day when the extension will start to be executed @param weekDay [required] The day of the week when the extension will be executed @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required]
[ "Create", "a", "new", "time", "condition", "for", "an", "extension" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7100-L7109
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/TrainsImpl.java
TrainsImpl.getStatus
public List<ModelTrainingInfo> getStatus(UUID appId, String versionId) { return getStatusWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
java
public List<ModelTrainingInfo> getStatus(UUID appId, String versionId) { return getStatusWithServiceResponseAsync(appId, versionId).toBlocking().single().body(); }
[ "public", "List", "<", "ModelTrainingInfo", ">", "getStatus", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "getStatusWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ...
Gets the training status of all models (intents and entities) for the specified LUIS app. You must call the train API to train the LUIS app before you call this API to get training status. "appID" specifies the LUIS app ID. "versionId" specifies the version number of the LUIS app. For example, "0.1". @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;ModelTrainingInfo&gt; object if successful.
[ "Gets", "the", "training", "status", "of", "all", "models", "(", "intents", "and", "entities", ")", "for", "the", "specified", "LUIS", "app", ".", "You", "must", "call", "the", "train", "API", "to", "train", "the", "LUIS", "app", "before", "you", "call",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/TrainsImpl.java#L164-L166
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/Check.java
Check.superiorOrEqual
public static void superiorOrEqual(double a, double b) { if (a < b) { throw new LionEngineException(ERROR_ARGUMENT + String.valueOf(a) + ERROR_SUPERIOR + String.valueOf(b)); } }
java
public static void superiorOrEqual(double a, double b) { if (a < b) { throw new LionEngineException(ERROR_ARGUMENT + String.valueOf(a) + ERROR_SUPERIOR + String.valueOf(b)); } }
[ "public", "static", "void", "superiorOrEqual", "(", "double", "a", ",", "double", "b", ")", "{", "if", "(", "a", "<", "b", ")", "{", "throw", "new", "LionEngineException", "(", "ERROR_ARGUMENT", "+", "String", ".", "valueOf", "(", "a", ")", "+", "ERROR...
Check if <code>a</code> is superior to <code>b</code>. @param a The parameter to test. @param b The parameter to compare to. @throws LionEngineException If check failed.
[ "Check", "if", "<code", ">", "a<", "/", "code", ">", "is", "superior", "to", "<code", ">", "b<", "/", "code", ">", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/Check.java#L67-L73
lestard/advanced-bindings
src/main/java/eu/lestard/advanced_bindings/api/StringBindings.java
StringBindings.toUpperCase
public static StringBinding toUpperCase(ObservableValue<String> text, ObservableValue<Locale> locale) { return Bindings.createStringBinding(() -> { final Locale localeValue = locale.getValue() == null ? Locale.getDefault() : locale.getValue(); return text.getValue() == null ? "" : text.getValue().toUpperCase(localeValue); }, text, locale); }
java
public static StringBinding toUpperCase(ObservableValue<String> text, ObservableValue<Locale> locale) { return Bindings.createStringBinding(() -> { final Locale localeValue = locale.getValue() == null ? Locale.getDefault() : locale.getValue(); return text.getValue() == null ? "" : text.getValue().toUpperCase(localeValue); }, text, locale); }
[ "public", "static", "StringBinding", "toUpperCase", "(", "ObservableValue", "<", "String", ">", "text", ",", "ObservableValue", "<", "Locale", ">", "locale", ")", "{", "return", "Bindings", ".", "createStringBinding", "(", "(", ")", "->", "{", "final", "Locale...
Creates a string binding that contains the value of the given observable string converted to uppercase with the given locale. See {@link String#toUpperCase(Locale)}. If the given observable string has a value of `null` the created binding will contain an empty string. If the given observable locale has a value of `null` {@link Locale#getDefault()} will be used instead. @param text the source string that will used for the conversion. @param locale an observable containing the locale that will be used for conversion. @return a binding containing the uppercase string.
[ "Creates", "a", "string", "binding", "that", "contains", "the", "value", "of", "the", "given", "observable", "string", "converted", "to", "uppercase", "with", "the", "given", "locale", ".", "See", "{", "@link", "String#toUpperCase", "(", "Locale", ")", "}", ...
train
https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/StringBindings.java#L198-L204
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.addAllIterable
public static <T> boolean addAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection) { if (iterable == null) { throw new NullPointerException(); } if (iterable instanceof Collection<?>) { return targetCollection.addAll((Collection<T>) iterable); } int oldSize = targetCollection.size(); Iterate.forEachWith(iterable, Procedures2.<T>addToCollection(), targetCollection); return targetCollection.size() != oldSize; }
java
public static <T> boolean addAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection) { if (iterable == null) { throw new NullPointerException(); } if (iterable instanceof Collection<?>) { return targetCollection.addAll((Collection<T>) iterable); } int oldSize = targetCollection.size(); Iterate.forEachWith(iterable, Procedures2.<T>addToCollection(), targetCollection); return targetCollection.size() != oldSize; }
[ "public", "static", "<", "T", ">", "boolean", "addAllIterable", "(", "Iterable", "<", "?", "extends", "T", ">", "iterable", ",", "Collection", "<", "T", ">", "targetCollection", ")", "{", "if", "(", "iterable", "==", "null", ")", "{", "throw", "new", "...
Add all elements from the source Iterable to the target collection, returns true if any element was added.
[ "Add", "all", "elements", "from", "the", "source", "Iterable", "to", "the", "target", "collection", "returns", "true", "if", "any", "element", "was", "added", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L1124-L1137
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_exchangeLite_services_POST
public OvhTask packName_exchangeLite_services_POST(String packName, Boolean antispam, String displayName, String email, String firstName, String initials, String lastName, String password) throws IOException { String qPath = "/pack/xdsl/{packName}/exchangeLite/services"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "antispam", antispam); addBody(o, "displayName", displayName); addBody(o, "email", email); addBody(o, "firstName", firstName); addBody(o, "initials", initials); addBody(o, "lastName", lastName); addBody(o, "password", password); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask packName_exchangeLite_services_POST(String packName, Boolean antispam, String displayName, String email, String firstName, String initials, String lastName, String password) throws IOException { String qPath = "/pack/xdsl/{packName}/exchangeLite/services"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "antispam", antispam); addBody(o, "displayName", displayName); addBody(o, "email", email); addBody(o, "firstName", firstName); addBody(o, "initials", initials); addBody(o, "lastName", lastName); addBody(o, "password", password); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "packName_exchangeLite_services_POST", "(", "String", "packName", ",", "Boolean", "antispam", ",", "String", "displayName", ",", "String", "email", ",", "String", "firstName", ",", "String", "initials", ",", "String", "lastName", ",", "String", ...
Activate a exchange lite service REST: POST /pack/xdsl/{packName}/exchangeLite/services @param initials [required] Initials @param antispam [required] [default=true] Antispam protection @param firstName [required] First name @param lastName [required] Last name @param email [required] Email address @param password [required] Password @param displayName [required] Display name @param packName [required] The internal name of your pack @deprecated
[ "Activate", "a", "exchange", "lite", "service" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L653-L666
gitblit/fathom
fathom-rest/src/main/java/fathom/rest/controller/ControllerHandler.java
ControllerHandler.validateDeclaredReturns
protected void validateDeclaredReturns() { boolean returnsObject = void.class != method.getReturnType(); if (returnsObject) { for (Return declaredReturn : declaredReturns) { if (declaredReturn.code() >= 200 && declaredReturn.code() < 300) { return; } } throw new FatalException("{} returns an object but does not declare a successful @{}(code=200, onResult={}.class)", Util.toString(method), Return.class.getSimpleName(), method.getReturnType().getSimpleName()); } }
java
protected void validateDeclaredReturns() { boolean returnsObject = void.class != method.getReturnType(); if (returnsObject) { for (Return declaredReturn : declaredReturns) { if (declaredReturn.code() >= 200 && declaredReturn.code() < 300) { return; } } throw new FatalException("{} returns an object but does not declare a successful @{}(code=200, onResult={}.class)", Util.toString(method), Return.class.getSimpleName(), method.getReturnType().getSimpleName()); } }
[ "protected", "void", "validateDeclaredReturns", "(", ")", "{", "boolean", "returnsObject", "=", "void", ".", "class", "!=", "method", ".", "getReturnType", "(", ")", ";", "if", "(", "returnsObject", ")", "{", "for", "(", "Return", "declaredReturn", ":", "dec...
Validates the declared Returns of the controller method. If the controller method returns an object then it must also declare a successful @Return with a status code in the 200 range.
[ "Validates", "the", "declared", "Returns", "of", "the", "controller", "method", ".", "If", "the", "controller", "method", "returns", "an", "object", "then", "it", "must", "also", "declare", "a", "successful" ]
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-rest/src/main/java/fathom/rest/controller/ControllerHandler.java#L512-L523
rhuss/jolokia
agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java
AbstractServerDetector.getSingleStringAttribute
protected String getSingleStringAttribute(MBeanServerExecutor pMBeanServerExecutor, String pMBeanName, String pAttribute) { Set<ObjectName> serverMBeanNames = searchMBeans(pMBeanServerExecutor, pMBeanName); if (serverMBeanNames.size() == 0) { return null; } Set<String> attributeValues = new HashSet<String>(); for (ObjectName oName : serverMBeanNames) { String val = getAttributeValue(pMBeanServerExecutor, oName, pAttribute); if (val != null) { attributeValues.add(val); } } if (attributeValues.size() == 0 || attributeValues.size() > 1) { return null; } return attributeValues.iterator().next(); }
java
protected String getSingleStringAttribute(MBeanServerExecutor pMBeanServerExecutor, String pMBeanName, String pAttribute) { Set<ObjectName> serverMBeanNames = searchMBeans(pMBeanServerExecutor, pMBeanName); if (serverMBeanNames.size() == 0) { return null; } Set<String> attributeValues = new HashSet<String>(); for (ObjectName oName : serverMBeanNames) { String val = getAttributeValue(pMBeanServerExecutor, oName, pAttribute); if (val != null) { attributeValues.add(val); } } if (attributeValues.size() == 0 || attributeValues.size() > 1) { return null; } return attributeValues.iterator().next(); }
[ "protected", "String", "getSingleStringAttribute", "(", "MBeanServerExecutor", "pMBeanServerExecutor", ",", "String", "pMBeanName", ",", "String", "pAttribute", ")", "{", "Set", "<", "ObjectName", ">", "serverMBeanNames", "=", "searchMBeans", "(", "pMBeanServerExecutor", ...
Get a single attribute for a given MBeanName pattern. @param pMBeanServerExecutor MBeanServer manager to query @param pMBeanName a MBean name or pattern. If multiple MBeans are found, each is queried for the attribute @param pAttribute the attribute to lookup @return the string value of the attribute or null if either no MBeans could be found, or 0 or more than 1 attribute are found on those mbeans
[ "Get", "a", "single", "attribute", "for", "a", "given", "MBeanName", "pattern", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java#L123-L139
jbundle/jbundle
thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedInfo.java
CachedInfo.setCacheData
public synchronized void setCacheData(Date startTime, Date endTime, String description, String [] rgstrMeals) { if (startTime != null) m_startTime = startTime; if (endTime != null) m_endTime = endTime; if (description != null) m_description = description; if (rgstrMeals != null) m_rgstrMeals = rgstrMeals; }
java
public synchronized void setCacheData(Date startTime, Date endTime, String description, String [] rgstrMeals) { if (startTime != null) m_startTime = startTime; if (endTime != null) m_endTime = endTime; if (description != null) m_description = description; if (rgstrMeals != null) m_rgstrMeals = rgstrMeals; }
[ "public", "synchronized", "void", "setCacheData", "(", "Date", "startTime", ",", "Date", "endTime", ",", "String", "description", ",", "String", "[", "]", "rgstrMeals", ")", "{", "if", "(", "startTime", "!=", "null", ")", "m_startTime", "=", "startTime", ";"...
Change the cache data without calling the methods to change the underlying model. This method is used by the lineItem to change the screen model without calling a change to the model.
[ "Change", "the", "cache", "data", "without", "calling", "the", "methods", "to", "change", "the", "underlying", "model", ".", "This", "method", "is", "used", "by", "the", "lineItem", "to", "change", "the", "screen", "model", "without", "calling", "a", "change...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedInfo.java#L229-L239
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/utils/EObjects.java
EObjects.setOrAdd
public static void setOrAdd(EObject owner, EReference reference, Object value) { if (value != null) { if (reference.isMany()) { @SuppressWarnings("unchecked") Collection<EObject> values = (Collection<EObject>) owner.eGet(reference, false); if (values != null && value instanceof EObject) { values.add((EObject) value); } } else { owner.eSet(reference, value); } } }
java
public static void setOrAdd(EObject owner, EReference reference, Object value) { if (value != null) { if (reference.isMany()) { @SuppressWarnings("unchecked") Collection<EObject> values = (Collection<EObject>) owner.eGet(reference, false); if (values != null && value instanceof EObject) { values.add((EObject) value); } } else { owner.eSet(reference, value); } } }
[ "public", "static", "void", "setOrAdd", "(", "EObject", "owner", ",", "EReference", "reference", ",", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "reference", ".", "isMany", "(", ")", ")", "{", "@", "SuppressWarn...
Set or add a value to an object reference. The value must be an EObject. @param owner @param reference @param value
[ "Set", "or", "add", "a", "value", "to", "an", "object", "reference", ".", "The", "value", "must", "be", "an", "EObject", "." ]
train
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/utils/EObjects.java#L36-L48
LearnLib/learnlib
commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java
GlobalSuffixFinders.findRivestSchapire
public static <I, O> List<Word<I>> findRivestSchapire(Query<I, O> ceQuery, AccessSequenceTransformer<I> asTransformer, SuffixOutput<I, O> hypOutput, MembershipOracle<I, O> oracle, boolean allSuffixes) { int idx = LocalSuffixFinders.findRivestSchapire(ceQuery, asTransformer, hypOutput, oracle); return suffixesForLocalOutput(ceQuery, idx, allSuffixes); }
java
public static <I, O> List<Word<I>> findRivestSchapire(Query<I, O> ceQuery, AccessSequenceTransformer<I> asTransformer, SuffixOutput<I, O> hypOutput, MembershipOracle<I, O> oracle, boolean allSuffixes) { int idx = LocalSuffixFinders.findRivestSchapire(ceQuery, asTransformer, hypOutput, oracle); return suffixesForLocalOutput(ceQuery, idx, allSuffixes); }
[ "public", "static", "<", "I", ",", "O", ">", "List", "<", "Word", "<", "I", ">", ">", "findRivestSchapire", "(", "Query", "<", "I", ",", "O", ">", "ceQuery", ",", "AccessSequenceTransformer", "<", "I", ">", "asTransformer", ",", "SuffixOutput", "<", "I...
Returns the suffix (plus all of its suffixes, if {@code allSuffixes} is true) found by the binary search access sequence transformation. @param ceQuery the counterexample query @param asTransformer the access sequence transformer @param hypOutput interface to the hypothesis output @param oracle interface to the SUL output @param allSuffixes whether or not to include all suffixes of the found suffix @return the distinguishing suffixes @see LocalSuffixFinders#findRivestSchapire(Query, AccessSequenceTransformer, SuffixOutput, MembershipOracle)
[ "Returns", "the", "suffix", "(", "plus", "all", "of", "its", "suffixes", "if", "{", "@code", "allSuffixes", "}", "is", "true", ")", "found", "by", "the", "binary", "search", "access", "sequence", "transformation", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java#L332-L339
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java
AtomContainerManipulator.getBondOrderSum
public static double getBondOrderSum(IAtomContainer container, IAtom atom) { double count = 0; for (IBond bond : container.getConnectedBondsList(atom)) { IBond.Order order = bond.getOrder(); if (order != null) { count += order.numeric(); } } return count; }
java
public static double getBondOrderSum(IAtomContainer container, IAtom atom) { double count = 0; for (IBond bond : container.getConnectedBondsList(atom)) { IBond.Order order = bond.getOrder(); if (order != null) { count += order.numeric(); } } return count; }
[ "public", "static", "double", "getBondOrderSum", "(", "IAtomContainer", "container", ",", "IAtom", "atom", ")", "{", "double", "count", "=", "0", ";", "for", "(", "IBond", "bond", ":", "container", ".", "getConnectedBondsList", "(", "atom", ")", ")", "{", ...
Returns the sum of the bond order equivalents for a given IAtom. It considers single bonds as 1.0, double bonds as 2.0, triple bonds as 3.0, and quadruple bonds as 4.0. @param atom The atom for which to calculate the bond order sum @return The number of bond order equivalents for this atom
[ "Returns", "the", "sum", "of", "the", "bond", "order", "equivalents", "for", "a", "given", "IAtom", ".", "It", "considers", "single", "bonds", "as", "1", ".", "0", "double", "bonds", "as", "2", ".", "0", "triple", "bonds", "as", "3", ".", "0", "and",...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/AtomContainerManipulator.java#L1708-L1717
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withFields
public Period withFields(ReadablePeriod period) { if (period == null) { return this; } int[] newValues = getValues(); // cloned newValues = super.mergePeriodInto(newValues, period); return new Period(newValues, getPeriodType()); }
java
public Period withFields(ReadablePeriod period) { if (period == null) { return this; } int[] newValues = getValues(); // cloned newValues = super.mergePeriodInto(newValues, period); return new Period(newValues, getPeriodType()); }
[ "public", "Period", "withFields", "(", "ReadablePeriod", "period", ")", "{", "if", "(", "period", "==", "null", ")", "{", "return", "this", ";", "}", "int", "[", "]", "newValues", "=", "getValues", "(", ")", ";", "// cloned", "newValues", "=", "super", ...
Creates a new Period instance with the fields from the specified period copied on top of those from this period. <p> This period instance is immutable and unaffected by this method call. @param period the period to copy from, null ignored @return the new period instance @throws IllegalArgumentException if a field type is unsupported
[ "Creates", "a", "new", "Period", "instance", "with", "the", "fields", "from", "the", "specified", "period", "copied", "on", "top", "of", "those", "from", "this", "period", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L853-L860
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/TransactionImpl.java
TransactionImpl.tryLock
public boolean tryLock(Object obj, int lockMode) { if (log.isDebugEnabled()) log.debug("Try to lock object was called on tx " + this); checkOpen(); try { lock(obj, lockMode); return true; } catch (LockNotGrantedException ex) { return false; } }
java
public boolean tryLock(Object obj, int lockMode) { if (log.isDebugEnabled()) log.debug("Try to lock object was called on tx " + this); checkOpen(); try { lock(obj, lockMode); return true; } catch (LockNotGrantedException ex) { return false; } }
[ "public", "boolean", "tryLock", "(", "Object", "obj", ",", "int", "lockMode", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "log", ".", "debug", "(", "\"Try to lock object was called on tx \"", "+", "this", ")", ";", "checkOpen", "(", "...
Upgrade the lock on the given object to the given lock mode. Method <code> tryLock</code> is the same as <code>lock</code> except it returns a boolean indicating whether the lock was granted instead of generating an exception. @param obj Description of Parameter @param lockMode Description of Parameter @return Description of the Returned Value </code>, <code>UPGRADE</code> , and <code>WRITE</code> . @return true if the lock has been acquired, otherwise false.
[ "Upgrade", "the", "lock", "on", "the", "given", "object", "to", "the", "given", "lock", "mode", ".", "Method", "<code", ">", "tryLock<", "/", "code", ">", "is", "the", "same", "as", "<code", ">", "lock<", "/", "code", ">", "except", "it", "returns", ...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/TransactionImpl.java#L659-L672
fabiomaffioletti/jsondoc
jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/AbstractSpringJSONDocScanner.java
AbstractSpringJSONDocScanner.mergeApiDoc
@Override public ApiDoc mergeApiDoc(Class<?> controller, ApiDoc apiDoc) { ApiDoc jsondocApiDoc = JSONDocApiDocBuilder.build(controller); BeanUtils.copyProperties(jsondocApiDoc, apiDoc, new String[] { "methods", "supportedversions", "auth" }); return apiDoc; }
java
@Override public ApiDoc mergeApiDoc(Class<?> controller, ApiDoc apiDoc) { ApiDoc jsondocApiDoc = JSONDocApiDocBuilder.build(controller); BeanUtils.copyProperties(jsondocApiDoc, apiDoc, new String[] { "methods", "supportedversions", "auth" }); return apiDoc; }
[ "@", "Override", "public", "ApiDoc", "mergeApiDoc", "(", "Class", "<", "?", ">", "controller", ",", "ApiDoc", "apiDoc", ")", "{", "ApiDoc", "jsondocApiDoc", "=", "JSONDocApiDocBuilder", ".", "build", "(", "controller", ")", ";", "BeanUtils", ".", "copyProperti...
Once the ApiDoc has been initialized and filled with other data (version, auth, etc) it's time to merge the documentation with JSONDoc annotation, if existing.
[ "Once", "the", "ApiDoc", "has", "been", "initialized", "and", "filled", "with", "other", "data", "(", "version", "auth", "etc", ")", "it", "s", "time", "to", "merge", "the", "documentation", "with", "JSONDoc", "annotation", "if", "existing", "." ]
train
https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/AbstractSpringJSONDocScanner.java#L219-L224
datasalt/pangool
core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/output/PangoolMultipleOutputs.java
PangoolMultipleOutputs.setSpecificNamedOutputContext
public static void setSpecificNamedOutputContext(Configuration conf, Job job, String namedOutput) { for(Map.Entry<String, String> entries : conf) { String confKey = entries.getKey(); String confValue = entries.getValue(); if(confKey.startsWith(MO_PREFIX + namedOutput + CONF)) { // Specific context key, value found String contextKey = confKey.substring((MO_PREFIX + namedOutput + CONF + ".").length(), confKey.length()); job.getConfiguration().set(contextKey, confValue); } if(confKey.startsWith(DEFAULT_MO_PREFIX + CONF)) { // Default context applied to all named outputs String contextKey = confKey.substring((DEFAULT_MO_PREFIX + CONF + ".").length(), confKey.length()); job.getConfiguration().set(contextKey, confValue); } } }
java
public static void setSpecificNamedOutputContext(Configuration conf, Job job, String namedOutput) { for(Map.Entry<String, String> entries : conf) { String confKey = entries.getKey(); String confValue = entries.getValue(); if(confKey.startsWith(MO_PREFIX + namedOutput + CONF)) { // Specific context key, value found String contextKey = confKey.substring((MO_PREFIX + namedOutput + CONF + ".").length(), confKey.length()); job.getConfiguration().set(contextKey, confValue); } if(confKey.startsWith(DEFAULT_MO_PREFIX + CONF)) { // Default context applied to all named outputs String contextKey = confKey.substring((DEFAULT_MO_PREFIX + CONF + ".").length(), confKey.length()); job.getConfiguration().set(contextKey, confValue); } } }
[ "public", "static", "void", "setSpecificNamedOutputContext", "(", "Configuration", "conf", ",", "Job", "job", ",", "String", "namedOutput", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entries", ":", "conf", ")", "{", "Str...
Iterates over the Configuration and sets the specific context found for the namedOutput in the Job instance. Package-access so it can be unit tested. The specific context is configured in method this. {@link #addNamedOutputContext(Job, String, String, String)}. @param conf The configuration that may contain specific context for the named output @param job The Job where we will set the specific context @param namedOutput The named output
[ "Iterates", "over", "the", "Configuration", "and", "sets", "the", "specific", "context", "found", "for", "the", "namedOutput", "in", "the", "Job", "instance", ".", "Package", "-", "access", "so", "it", "can", "be", "unit", "tested", ".", "The", "specific", ...
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/output/PangoolMultipleOutputs.java#L255-L273
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.createAccountAcquisition
public AccountAcquisition createAccountAcquisition(final String accountCode, final AccountAcquisition acquisition) { final String path = Account.ACCOUNT_RESOURCE + "/" + accountCode + AccountAcquisition.ACCOUNT_ACQUISITION_RESOURCE; return doPOST(path, acquisition, AccountAcquisition.class); }
java
public AccountAcquisition createAccountAcquisition(final String accountCode, final AccountAcquisition acquisition) { final String path = Account.ACCOUNT_RESOURCE + "/" + accountCode + AccountAcquisition.ACCOUNT_ACQUISITION_RESOURCE; return doPOST(path, acquisition, AccountAcquisition.class); }
[ "public", "AccountAcquisition", "createAccountAcquisition", "(", "final", "String", "accountCode", ",", "final", "AccountAcquisition", "acquisition", ")", "{", "final", "String", "path", "=", "Account", ".", "ACCOUNT_RESOURCE", "+", "\"/\"", "+", "accountCode", "+", ...
Sets the acquisition details for an account <p> https://dev.recurly.com/docs/create-account-acquisition @param accountCode The account's account code @param acquisition The AccountAcquisition data @return The created AccountAcquisition object
[ "Sets", "the", "acquisition", "details", "for", "an", "account", "<p", ">", "https", ":", "//", "dev", ".", "recurly", ".", "com", "/", "docs", "/", "create", "-", "account", "-", "acquisition" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1961-L1964
jfinal/jfinal
src/main/java/com/jfinal/template/stat/Lexer.java
Lexer.addIdParaToken
boolean addIdParaToken(Token idToken, Token paraToken) { tokens.add(idToken); tokens.add(paraToken); // if (lookForwardLineFeed() && (deletePreviousTextTokenBlankTails() || lexemeBegin == 0)) { if (lookForwardLineFeedAndEof() && deletePreviousTextTokenBlankTails()) { prepareNextScan(peek() != EOF ? 1 : 0); } else { prepareNextScan(0); } previousTextToken = null; return true; }
java
boolean addIdParaToken(Token idToken, Token paraToken) { tokens.add(idToken); tokens.add(paraToken); // if (lookForwardLineFeed() && (deletePreviousTextTokenBlankTails() || lexemeBegin == 0)) { if (lookForwardLineFeedAndEof() && deletePreviousTextTokenBlankTails()) { prepareNextScan(peek() != EOF ? 1 : 0); } else { prepareNextScan(0); } previousTextToken = null; return true; }
[ "boolean", "addIdParaToken", "(", "Token", "idToken", ",", "Token", "paraToken", ")", "{", "tokens", ".", "add", "(", "idToken", ")", ";", "tokens", ".", "add", "(", "paraToken", ")", ";", "// if (lookForwardLineFeed() && (deletePreviousTextTokenBlankTails() || lexeme...
带参指令处于独立行时删除前后空白字符,并且再删除一个后续的换行符 处于独立行是指:向前看无有用内容,在前面情况成立的基础之上 再向后看如果也无可用内容,前一个条件成立才开执行后续动作 向前看时 forward 在移动,意味着正在删除空白字符(通过 lookForwardLineFeed()方法) 向后看时也会在碰到空白 + '\n' 时删空白字符 (通过 deletePreviousTextTokenBlankTails()方法)
[ "带参指令处于独立行时删除前后空白字符,并且再删除一个后续的换行符", "处于独立行是指:向前看无有用内容,在前面情况成立的基础之上", "再向后看如果也无可用内容,前一个条件成立才开执行后续动作" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/template/stat/Lexer.java#L508-L520
Stratio/deep-spark
deep-cassandra/src/main/java/com/stratio/deep/cassandra/thrift/ThriftClient.java
ThriftClient.build
public static ThriftClient build(String host, int port) throws TException { return build(host, port, null); }
java
public static ThriftClient build(String host, int port) throws TException { return build(host, port, null); }
[ "public", "static", "ThriftClient", "build", "(", "String", "host", ",", "int", "port", ")", "throws", "TException", "{", "return", "build", "(", "host", ",", "port", ",", "null", ")", ";", "}" ]
Returns a new client for the specified host. @param host the Cassandra host address. @param port the Cassandra host RPC port. @return a new client for the specified host. @throws TException if there is any problem with the {@code set_keyspace} call.
[ "Returns", "a", "new", "client", "for", "the", "specified", "host", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/thrift/ThriftClient.java#L72-L74
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java
DwgUtil.getRawLong
public static Vector getRawLong(int[] data, int offset) { Vector v = new Vector(); // TODO: Incorrecto. Repasar ... // _val = struct.unpack('<l', _long)[0] int val = 0; v.add(new Integer(offset+32)); v.add(new Integer(val)); return v; }
java
public static Vector getRawLong(int[] data, int offset) { Vector v = new Vector(); // TODO: Incorrecto. Repasar ... // _val = struct.unpack('<l', _long)[0] int val = 0; v.add(new Integer(offset+32)); v.add(new Integer(val)); return v; }
[ "public", "static", "Vector", "getRawLong", "(", "int", "[", "]", "data", ",", "int", "offset", ")", "{", "Vector", "v", "=", "new", "Vector", "(", ")", ";", "// TODO: Incorrecto. Repasar ...", "// _val = struct.unpack('<l', _long)[0]", "int", "val", "=", "0", ...
Read a long value from a group of unsigned bytes @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines. @return Vector This vector has two parts. First is an int value that represents the new offset, and second is the long value
[ "Read", "a", "long", "value", "from", "a", "group", "of", "unsigned", "bytes" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgUtil.java#L388-L396
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SendUsersMessageRequest.java
SendUsersMessageRequest.withUsers
public SendUsersMessageRequest withUsers(java.util.Map<String, EndpointSendConfiguration> users) { setUsers(users); return this; }
java
public SendUsersMessageRequest withUsers(java.util.Map<String, EndpointSendConfiguration> users) { setUsers(users); return this; }
[ "public", "SendUsersMessageRequest", "withUsers", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "EndpointSendConfiguration", ">", "users", ")", "{", "setUsers", "(", "users", ")", ";", "return", "this", ";", "}" ]
A map that associates user IDs with EndpointSendConfiguration objects. Within an EndpointSendConfiguration object, you can tailor the message for a user by specifying message overrides or substitutions. @param users A map that associates user IDs with EndpointSendConfiguration objects. Within an EndpointSendConfiguration object, you can tailor the message for a user by specifying message overrides or substitutions. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "map", "that", "associates", "user", "IDs", "with", "EndpointSendConfiguration", "objects", ".", "Within", "an", "EndpointSendConfiguration", "object", "you", "can", "tailor", "the", "message", "for", "a", "user", "by", "specifying", "message", "overrides", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SendUsersMessageRequest.java#L216-L219
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java
SynchronousRequest.getAllContinentFloorID
public List<Integer> getAllContinentFloorID(int continentID) throws GuildWars2Exception { try { Response<List<Integer>> response = gw2API.getAllContinentFloorIDs(Integer.toString(continentID)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
java
public List<Integer> getAllContinentFloorID(int continentID) throws GuildWars2Exception { try { Response<List<Integer>> response = gw2API.getAllContinentFloorIDs(Integer.toString(continentID)).execute(); if (!response.isSuccessful()) throwError(response.code(), response.errorBody()); return response.body(); } catch (IOException e) { throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage()); } }
[ "public", "List", "<", "Integer", ">", "getAllContinentFloorID", "(", "int", "continentID", ")", "throws", "GuildWars2Exception", "{", "try", "{", "Response", "<", "List", "<", "Integer", ">>", "response", "=", "gw2API", ".", "getAllContinentFloorIDs", "(", "Int...
For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> Get all continent floor ids @param continentID {@link Continent#id} @return list of continent floor ids @throws GuildWars2Exception see {@link ErrorCode} for detail @see ContinentFloor continent floor info
[ "For", "more", "info", "on", "continents", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "continents", ">", "here<", "/", "a", ">", "<br", "/", ">", "Get", "all"...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L1392-L1400
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/SQLMergeClause.java
SQLMergeClause.addFlag
public SQLMergeClause addFlag(Position position, String flag) { metadata.addFlag(new QueryFlag(position, flag)); return this; }
java
public SQLMergeClause addFlag(Position position, String flag) { metadata.addFlag(new QueryFlag(position, flag)); return this; }
[ "public", "SQLMergeClause", "addFlag", "(", "Position", "position", ",", "String", "flag", ")", "{", "metadata", ".", "addFlag", "(", "new", "QueryFlag", "(", "position", ",", "flag", ")", ")", ";", "return", "this", ";", "}" ]
Add the given String literal at the given position as a query flag @param position position @param flag query flag @return the current object
[ "Add", "the", "given", "String", "literal", "at", "the", "given", "position", "as", "a", "query", "flag" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/SQLMergeClause.java#L88-L91
Sefford/fraggle
fraggle/src/main/java/com/sefford/fraggle/FraggleManager.java
FraggleManager.performTransaction
protected void performTransaction(Fragment frag, int flags, FragmentTransaction ft, int containerId) { configureAdditionMode(frag, flags, ft, containerId); ft.commitAllowingStateLoss(); }
java
protected void performTransaction(Fragment frag, int flags, FragmentTransaction ft, int containerId) { configureAdditionMode(frag, flags, ft, containerId); ft.commitAllowingStateLoss(); }
[ "protected", "void", "performTransaction", "(", "Fragment", "frag", ",", "int", "flags", ",", "FragmentTransaction", "ft", ",", "int", "containerId", ")", "{", "configureAdditionMode", "(", "frag", ",", "flags", ",", "ft", ",", "containerId", ")", ";", "ft", ...
Commits the transaction to the Fragment Manager. @param frag Fragment to add @param flags Added flags to the Fragment configuration @param ft Transaction to add the fragment @param containerId Target containerID
[ "Commits", "the", "transaction", "to", "the", "Fragment", "Manager", "." ]
train
https://github.com/Sefford/fraggle/blob/d1b65a99ecc3c3faeef8f288ca6225bbf475c3a3/fraggle/src/main/java/com/sefford/fraggle/FraggleManager.java#L270-L273
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressClient.java
AddressClient.insertAddress
@BetaApi public final Operation insertAddress(ProjectRegionName region, Address addressResource) { InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder() .setRegion(region == null ? null : region.toString()) .setAddressResource(addressResource) .build(); return insertAddress(request); }
java
@BetaApi public final Operation insertAddress(ProjectRegionName region, Address addressResource) { InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder() .setRegion(region == null ? null : region.toString()) .setAddressResource(addressResource) .build(); return insertAddress(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertAddress", "(", "ProjectRegionName", "region", ",", "Address", "addressResource", ")", "{", "InsertAddressHttpRequest", "request", "=", "InsertAddressHttpRequest", ".", "newBuilder", "(", ")", ".", "setRegion", "("...
Creates an address resource in the specified project using the data included in the request. <p>Sample code: <pre><code> try (AddressClient addressClient = AddressClient.create()) { ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); Address addressResource = Address.newBuilder().build(); Operation response = addressClient.insertAddress(region, addressResource); } </code></pre> @param region Name of the region for this request. @param addressResource A reserved address resource. (== resource_for beta.addresses ==) (== resource_for v1.addresses ==) (== resource_for beta.globalAddresses ==) (== resource_for v1.globalAddresses ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "an", "address", "resource", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/AddressClient.java#L506-L515
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java
RTreeIndexCoreExtension.createRTreeIndex
public void createRTreeIndex(String tableName, String geometryColumnName) { String sqlName = GeoPackageProperties.getProperty(SQL_PROPERTY, CREATE_PROPERTY); executeSQL(sqlName, tableName, geometryColumnName); }
java
public void createRTreeIndex(String tableName, String geometryColumnName) { String sqlName = GeoPackageProperties.getProperty(SQL_PROPERTY, CREATE_PROPERTY); executeSQL(sqlName, tableName, geometryColumnName); }
[ "public", "void", "createRTreeIndex", "(", "String", "tableName", ",", "String", "geometryColumnName", ")", "{", "String", "sqlName", "=", "GeoPackageProperties", ".", "getProperty", "(", "SQL_PROPERTY", ",", "CREATE_PROPERTY", ")", ";", "executeSQL", "(", "sqlName"...
Create the RTree Index Virtual Table @param tableName table name @param geometryColumnName geometry column name
[ "Create", "the", "RTree", "Index", "Virtual", "Table" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java#L421-L426
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_redirection_id_GET
public OvhRedirection zone_zoneName_redirection_id_GET(String zoneName, Long id) throws IOException { String qPath = "/domain/zone/{zoneName}/redirection/{id}"; StringBuilder sb = path(qPath, zoneName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRedirection.class); }
java
public OvhRedirection zone_zoneName_redirection_id_GET(String zoneName, Long id) throws IOException { String qPath = "/domain/zone/{zoneName}/redirection/{id}"; StringBuilder sb = path(qPath, zoneName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRedirection.class); }
[ "public", "OvhRedirection", "zone_zoneName_redirection_id_GET", "(", "String", "zoneName", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/redirection/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath"...
Get this object properties REST: GET /domain/zone/{zoneName}/redirection/{id} @param zoneName [required] The internal name of your zone @param id [required] Id of the object
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L847-L852
vtatai/srec
core/src/main/java/com/github/srec/command/base/BaseCommand.java
BaseCommand.coerceToString
protected static String coerceToString(Value value, ExecutionContext context) { if (value == null) return null; if (!(value instanceof StringValue)) throw new CommandExecutionException("Value " + value + ", class " + value.getClass().getCanonicalName() + " is not a string"); String str = value.toString(); if (str.indexOf("$") == -1 || context == null) return str; return (String) Utils.groovyEvaluate(context, "\"" + str + "\""); }
java
protected static String coerceToString(Value value, ExecutionContext context) { if (value == null) return null; if (!(value instanceof StringValue)) throw new CommandExecutionException("Value " + value + ", class " + value.getClass().getCanonicalName() + " is not a string"); String str = value.toString(); if (str.indexOf("$") == -1 || context == null) return str; return (String) Utils.groovyEvaluate(context, "\"" + str + "\""); }
[ "protected", "static", "String", "coerceToString", "(", "Value", "value", ",", "ExecutionContext", "context", ")", "{", "if", "(", "value", "==", "null", ")", "return", "null", ";", "if", "(", "!", "(", "value", "instanceof", "StringValue", ")", ")", "thro...
Coerces a value to String. Throws a {@link com.github.srec.command.exception.CommandExecutionException} if value is not of the expected type. @param value The value @param context The context used to evaluate the text, required if there is string interpolation @return The converted value
[ "Coerces", "a", "value", "to", "String", ".", "Throws", "a", "{", "@link", "com", ".", "github", ".", "srec", ".", "command", ".", "exception", ".", "CommandExecutionException", "}", "if", "value", "is", "not", "of", "the", "expected", "type", "." ]
train
https://github.com/vtatai/srec/blob/87fa6754a6a5f8569ef628db4d149eea04062568/core/src/main/java/com/github/srec/command/base/BaseCommand.java#L56-L66
m-m-m/util
validation/src/main/java/net/sf/mmm/util/validation/base/collection/AbstractMapValidatorBuilder.java
AbstractMapValidatorBuilder.withKeys
public <SUB extends ObjectValidatorBuilder<K, ? extends SELF, ?>> SUB withKeys(BiFunction<ObjectValidatorBuilderFactory<SELF>, K, SUB> factory) { if (this.keySubBuilder != null) { throw new IllegalStateException("keySubBuilder already exists!"); } SUB sub = factory.apply(getSubFactory(), null); this.keySubBuilder = sub; return sub; }
java
public <SUB extends ObjectValidatorBuilder<K, ? extends SELF, ?>> SUB withKeys(BiFunction<ObjectValidatorBuilderFactory<SELF>, K, SUB> factory) { if (this.keySubBuilder != null) { throw new IllegalStateException("keySubBuilder already exists!"); } SUB sub = factory.apply(getSubFactory(), null); this.keySubBuilder = sub; return sub; }
[ "public", "<", "SUB", "extends", "ObjectValidatorBuilder", "<", "K", ",", "?", "extends", "SELF", ",", "?", ">", ">", "SUB", "withKeys", "(", "BiFunction", "<", "ObjectValidatorBuilderFactory", "<", "SELF", ">", ",", "K", ",", "SUB", ">", "factory", ")", ...
Creates a new {@link ObjectValidatorBuilder builder} for the {@link AbstractValidator validators} to invoke for each {@link Map#keySet() key} in the {@link Map}.<br/> Use {@link #and()} to return to this builder after the sub-builder is complete.<br/> A typical usage looks like this: <pre> [...].withKeys((f, v) -> f.create(v)).[...].and().[...].build() </pre> @param <SUB> the generic type of the returned sub-builder. @param factory lambda function used to create the returned sub-builder by calling the according {@code create} method on the supplied {@link ObjectValidatorBuilderFactory} with the given dummy element. @return the new sub-builder.
[ "Creates", "a", "new", "{", "@link", "ObjectValidatorBuilder", "builder", "}", "for", "the", "{", "@link", "AbstractValidator", "validators", "}", "to", "invoke", "for", "each", "{", "@link", "Map#keySet", "()", "key", "}", "in", "the", "{", "@link", "Map", ...
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/validation/src/main/java/net/sf/mmm/util/validation/base/collection/AbstractMapValidatorBuilder.java#L91-L99
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.hosting_web_serviceName_bandwidth_duration_GET
public OvhOrder hosting_web_serviceName_bandwidth_duration_GET(String serviceName, String duration, OvhBandwidthOfferEnum traffic) throws IOException { String qPath = "/order/hosting/web/{serviceName}/bandwidth/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "traffic", traffic); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder hosting_web_serviceName_bandwidth_duration_GET(String serviceName, String duration, OvhBandwidthOfferEnum traffic) throws IOException { String qPath = "/order/hosting/web/{serviceName}/bandwidth/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "traffic", traffic); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "hosting_web_serviceName_bandwidth_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhBandwidthOfferEnum", "traffic", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/hosting/web/{serviceName}/bandwidth/{du...
Get prices and contracts information REST: GET /order/hosting/web/{serviceName}/bandwidth/{duration} @param traffic [required] Available offers to increase bandwidth quota (unit: GB) @param serviceName [required] The internal name of your hosting @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4800-L4806
ralscha/wampspring
src/main/java/ch/rasc/wampspring/user/UserEventMessenger.java
UserEventMessenger.sendToUsers
public void sendToUsers(String topicURI, Object event, Set<String> eligibleUsers) { Set<String> eligibleSessionIds = null; if (eligibleUsers != null && !eligibleUsers.isEmpty()) { eligibleSessionIds = new HashSet<>(eligibleUsers.size()); for (String user : eligibleUsers) { for (SimpSession session : this.simpUserRegistry.getUser(user) .getSessions()) { eligibleSessionIds.add(session.getId()); } } } this.eventMessenger.sendTo(topicURI, event, eligibleSessionIds); }
java
public void sendToUsers(String topicURI, Object event, Set<String> eligibleUsers) { Set<String> eligibleSessionIds = null; if (eligibleUsers != null && !eligibleUsers.isEmpty()) { eligibleSessionIds = new HashSet<>(eligibleUsers.size()); for (String user : eligibleUsers) { for (SimpSession session : this.simpUserRegistry.getUser(user) .getSessions()) { eligibleSessionIds.add(session.getId()); } } } this.eventMessenger.sendTo(topicURI, event, eligibleSessionIds); }
[ "public", "void", "sendToUsers", "(", "String", "topicURI", ",", "Object", "event", ",", "Set", "<", "String", ">", "eligibleUsers", ")", "{", "Set", "<", "String", ">", "eligibleSessionIds", "=", "null", ";", "if", "(", "eligibleUsers", "!=", "null", "&&"...
Send an {@link EventMessage} to every client that is currently subscribed to the given topicURI and are listed in the eligibleUsers set. If no user of the provided set is subscribed to the topicURI nothing happens. @param topicURI the name of the topic @param event the payload of the {@link EventMessage} @param eligibleUsers only the users listed here will receive the EVENT message. If null or empty nobody receives the message.
[ "Send", "an", "{", "@link", "EventMessage", "}", "to", "every", "client", "that", "is", "currently", "subscribed", "to", "the", "given", "topicURI", "and", "are", "listed", "in", "the", "eligibleUsers", "set", ".", "If", "no", "user", "of", "the", "provide...
train
https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/user/UserEventMessenger.java#L145-L160
biezhi/anima
src/main/java/io/github/biezhi/anima/core/AnimaQuery.java
AnimaQuery.queryOne
public <S> S queryOne(Class<S> type, String sql, List<Object> params) { if (Anima.of().isUseSQLLimit()) { sql += " LIMIT 1"; } List<S> list = queryList(type, sql, params); return AnimaUtils.isNotEmpty(list) ? list.get(0) : null; }
java
public <S> S queryOne(Class<S> type, String sql, List<Object> params) { if (Anima.of().isUseSQLLimit()) { sql += " LIMIT 1"; } List<S> list = queryList(type, sql, params); return AnimaUtils.isNotEmpty(list) ? list.get(0) : null; }
[ "public", "<", "S", ">", "S", "queryOne", "(", "Class", "<", "S", ">", "type", ",", "String", "sql", ",", "List", "<", "Object", ">", "params", ")", "{", "if", "(", "Anima", ".", "of", "(", ")", ".", "isUseSQLLimit", "(", ")", ")", "{", "sql", ...
Querying a model @param type model type @param sql sql statement @param params params @param <S> @return S
[ "Querying", "a", "model" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/core/AnimaQuery.java#L1098-L1104
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.consent_campaignName_decision_GET
public OvhConsent consent_campaignName_decision_GET(String campaignName) throws IOException { String qPath = "/me/consent/{campaignName}/decision"; StringBuilder sb = path(qPath, campaignName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhConsent.class); }
java
public OvhConsent consent_campaignName_decision_GET(String campaignName) throws IOException { String qPath = "/me/consent/{campaignName}/decision"; StringBuilder sb = path(qPath, campaignName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhConsent.class); }
[ "public", "OvhConsent", "consent_campaignName_decision_GET", "(", "String", "campaignName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/consent/{campaignName}/decision\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "campaignName", ...
Get decision value for a consent campaign REST: GET /me/consent/{campaignName}/decision @param campaignName [required] Consent campaign name
[ "Get", "decision", "value", "for", "a", "consent", "campaign" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1562-L1567
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java
CountingLruMap.put
@Nullable public synchronized V put(K key, V value) { // We do remove and insert instead of just replace, in order to cause a structural change // to the map, as we always want the latest inserted element to be last in the queue. V oldValue = mMap.remove(key); mSizeInBytes -= getValueSizeInBytes(oldValue); mMap.put(key, value); mSizeInBytes += getValueSizeInBytes(value); return oldValue; }
java
@Nullable public synchronized V put(K key, V value) { // We do remove and insert instead of just replace, in order to cause a structural change // to the map, as we always want the latest inserted element to be last in the queue. V oldValue = mMap.remove(key); mSizeInBytes -= getValueSizeInBytes(oldValue); mMap.put(key, value); mSizeInBytes += getValueSizeInBytes(value); return oldValue; }
[ "@", "Nullable", "public", "synchronized", "V", "put", "(", "K", "key", ",", "V", "value", ")", "{", "// We do remove and insert instead of just replace, in order to cause a structural change", "// to the map, as we always want the latest inserted element to be last in the queue.", "...
Adds the element to the map, and removes the old element with the same key if any.
[ "Adds", "the", "element", "to", "the", "map", "and", "removes", "the", "old", "element", "with", "the", "same", "key", "if", "any", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingLruMap.java#L85-L94
tumblr/jumblr
src/main/java/com/tumblr/jumblr/JumblrClient.java
JumblrClient.postCreate
public Long postCreate(String blogName, Map<String, ?> detail) throws IOException { return requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post"), detail).getId(); }
java
public Long postCreate(String blogName, Map<String, ?> detail) throws IOException { return requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post"), detail).getId(); }
[ "public", "Long", "postCreate", "(", "String", "blogName", ",", "Map", "<", "String", ",", "?", ">", "detail", ")", "throws", "IOException", "{", "return", "requestBuilder", ".", "postMultipart", "(", "JumblrClient", ".", "blogPath", "(", "blogName", ",", "\...
Create a post @param blogName The blog name for the post @param detail the detail to save @return Long the created post's id @throws IOException if any file specified in detail cannot be read
[ "Create", "a", "post" ]
train
https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L384-L386
msgpack/msgpack-java
msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java
MessageBuffer.newMessageBuffer
private static MessageBuffer newMessageBuffer(byte[] arr, int off, int len) { checkNotNull(arr); if (mbArrConstructor != null) { return newInstance(mbArrConstructor, arr, off, len); } return new MessageBuffer(arr, off, len); }
java
private static MessageBuffer newMessageBuffer(byte[] arr, int off, int len) { checkNotNull(arr); if (mbArrConstructor != null) { return newInstance(mbArrConstructor, arr, off, len); } return new MessageBuffer(arr, off, len); }
[ "private", "static", "MessageBuffer", "newMessageBuffer", "(", "byte", "[", "]", "arr", ",", "int", "off", ",", "int", "len", ")", "{", "checkNotNull", "(", "arr", ")", ";", "if", "(", "mbArrConstructor", "!=", "null", ")", "{", "return", "newInstance", ...
Creates a new MessageBuffer instance backed by a java heap array @param arr @return
[ "Creates", "a", "new", "MessageBuffer", "instance", "backed", "by", "a", "java", "heap", "array" ]
train
https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L273-L280
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java
RedisStorage.removeCalendar
@Override public boolean removeCalendar(String calendarName, Jedis jedis) throws JobPersistenceException { final String calendarTriggersSetKey = redisSchema.calendarTriggersSetKey(calendarName); if(jedis.scard(calendarTriggersSetKey) > 0){ throw new JobPersistenceException(String.format("There are triggers pointing to calendar %s, so it cannot be removed.", calendarName)); } final String calendarHashKey = redisSchema.calendarHashKey(calendarName); Pipeline pipe = jedis.pipelined(); Response<Long> deleteResponse = pipe.del(calendarHashKey); pipe.srem(redisSchema.calendarsSet(), calendarHashKey); pipe.sync(); return deleteResponse.get() == 1; }
java
@Override public boolean removeCalendar(String calendarName, Jedis jedis) throws JobPersistenceException { final String calendarTriggersSetKey = redisSchema.calendarTriggersSetKey(calendarName); if(jedis.scard(calendarTriggersSetKey) > 0){ throw new JobPersistenceException(String.format("There are triggers pointing to calendar %s, so it cannot be removed.", calendarName)); } final String calendarHashKey = redisSchema.calendarHashKey(calendarName); Pipeline pipe = jedis.pipelined(); Response<Long> deleteResponse = pipe.del(calendarHashKey); pipe.srem(redisSchema.calendarsSet(), calendarHashKey); pipe.sync(); return deleteResponse.get() == 1; }
[ "@", "Override", "public", "boolean", "removeCalendar", "(", "String", "calendarName", ",", "Jedis", "jedis", ")", "throws", "JobPersistenceException", "{", "final", "String", "calendarTriggersSetKey", "=", "redisSchema", ".", "calendarTriggersSetKey", "(", "calendarNam...
Remove (delete) the <code>{@link org.quartz.Calendar}</code> with the given name. @param calendarName the name of the calendar to be removed @param jedis a thread-safe Redis connection @return true if a calendar with the given name was found and removed
[ "Remove", "(", "delete", ")", "the", "<code", ">", "{" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java#L323-L337
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/Treebank.java
Treebank.loadPath
public void loadPath(String pathName, String suffix, boolean recursively) { loadPath(new File(pathName), new ExtensionFileFilter(suffix, recursively)); }
java
public void loadPath(String pathName, String suffix, boolean recursively) { loadPath(new File(pathName), new ExtensionFileFilter(suffix, recursively)); }
[ "public", "void", "loadPath", "(", "String", "pathName", ",", "String", "suffix", ",", "boolean", "recursively", ")", "{", "loadPath", "(", "new", "File", "(", "pathName", ")", ",", "new", "ExtensionFileFilter", "(", "suffix", ",", "recursively", ")", ")", ...
Load trees from given directory. @param pathName File or directory name @param suffix Extension of files to load: If <code>pathName</code> is a directory, then, if this is non-<code>null</code>, all and only files ending in "." followed by this extension will be loaded; if it is <code>null</code>, all files in directories will be loaded. If <code>pathName</code> is not a directory, this parameter is ignored. @param recursively descend into subdirectories as well
[ "Load", "trees", "from", "given", "directory", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/Treebank.java#L166-L168
banq/jdonframework
JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/model/query/block/BlockStrategy.java
BlockStrategy.getBlock
public Block getBlock(String sqlquery, Collection queryParams, int startIndex, int count) { Debug.logVerbose("[JdonFramework]enter getBlock .. ", module); if ((count > this.blockLength) || (count <= 0)) { // every query max // length must be // little than // blockLength count = this.blockLength; } QueryConditonDatakey qcdk = new QueryConditonDatakey(sqlquery, queryParams, startIndex, count, this.blockLength); Block block = getBlock(qcdk); if (block.getCount() > 0) { Debug.logVerbose("[JdonFramework]got a Block" + block.getCount(), module); return block; } else { Debug.logVerbose("[JdonFramework]not found the block!", module); return null; } }
java
public Block getBlock(String sqlquery, Collection queryParams, int startIndex, int count) { Debug.logVerbose("[JdonFramework]enter getBlock .. ", module); if ((count > this.blockLength) || (count <= 0)) { // every query max // length must be // little than // blockLength count = this.blockLength; } QueryConditonDatakey qcdk = new QueryConditonDatakey(sqlquery, queryParams, startIndex, count, this.blockLength); Block block = getBlock(qcdk); if (block.getCount() > 0) { Debug.logVerbose("[JdonFramework]got a Block" + block.getCount(), module); return block; } else { Debug.logVerbose("[JdonFramework]not found the block!", module); return null; } }
[ "public", "Block", "getBlock", "(", "String", "sqlquery", ",", "Collection", "queryParams", ",", "int", "startIndex", ",", "int", "count", ")", "{", "Debug", ".", "logVerbose", "(", "\"[JdonFramework]enter getBlock .. \"", ",", "module", ")", ";", "if", "(", "...
get a data block by the sql sentence. @param sqlqueryAllCount @param sqlquery @return if not found, return null;
[ "get", "a", "data", "block", "by", "the", "sql", "sentence", "." ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-hibernate3x/src/main/java/com/jdon/model/query/block/BlockStrategy.java#L142-L159
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelListAction.java
ModelListAction.setModellistByModel
private void setModellistByModel(ModelListForm listForm, PageIterator pageIterator, HttpServletRequest request) { Collection c = null; try { listForm.setAllCount(pageIterator.getAllCount()); if (pageIterator.getCount() != 0) listForm.setCount(pageIterator.getCount()); c = new ArrayList(pageIterator.getSize()); while (pageIterator.hasNext()) { Object o = pageIterator.next(); if (o != null) c.add(o); } Debug.logVerbose("[JdonFramework] listForm 's property: getList size is " + c.size(), module); pageIterator.reset(); } catch (Exception e) { Debug.logError(" setModellistByModel error " + e, module); c = new ArrayList(); } listForm.setList(c); }
java
private void setModellistByModel(ModelListForm listForm, PageIterator pageIterator, HttpServletRequest request) { Collection c = null; try { listForm.setAllCount(pageIterator.getAllCount()); if (pageIterator.getCount() != 0) listForm.setCount(pageIterator.getCount()); c = new ArrayList(pageIterator.getSize()); while (pageIterator.hasNext()) { Object o = pageIterator.next(); if (o != null) c.add(o); } Debug.logVerbose("[JdonFramework] listForm 's property: getList size is " + c.size(), module); pageIterator.reset(); } catch (Exception e) { Debug.logError(" setModellistByModel error " + e, module); c = new ArrayList(); } listForm.setList(c); }
[ "private", "void", "setModellistByModel", "(", "ModelListForm", "listForm", ",", "PageIterator", "pageIterator", ",", "HttpServletRequest", "request", ")", "{", "Collection", "c", "=", "null", ";", "try", "{", "listForm", ".", "setAllCount", "(", "pageIterator", "...
/* the elements in pageIterator is Model type we directly add them in result
[ "/", "*", "the", "elements", "in", "pageIterator", "is", "Model", "type", "we", "directly", "add", "them", "in", "result" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelListAction.java#L100-L119
xetorthio/jedis
src/main/java/redis/clients/jedis/BinaryJedis.java
BinaryJedis.setex
@Override public String setex(final byte[] key, final int seconds, final byte[] value) { checkIsInMultiOrPipeline(); client.setex(key, seconds, value); return client.getStatusCodeReply(); }
java
@Override public String setex(final byte[] key, final int seconds, final byte[] value) { checkIsInMultiOrPipeline(); client.setex(key, seconds, value); return client.getStatusCodeReply(); }
[ "@", "Override", "public", "String", "setex", "(", "final", "byte", "[", "]", "key", ",", "final", "int", "seconds", ",", "final", "byte", "[", "]", "value", ")", "{", "checkIsInMultiOrPipeline", "(", ")", ";", "client", ".", "setex", "(", "key", ",", ...
The command is exactly equivalent to the following group of commands: {@link #set(byte[], byte[]) SET} + {@link #expire(byte[], int) EXPIRE}. The operation is atomic. <p> Time complexity: O(1) @param key @param seconds @param value @return Status code reply
[ "The", "command", "is", "exactly", "equivalent", "to", "the", "following", "group", "of", "commands", ":", "{" ]
train
https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L660-L665
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.getChildren
public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException { // isDirectory does the read security check if (!isDirectory()) { return Collections.emptyList(); } if (filter == null) { filter = MatchAllVirtualFileFilter.INSTANCE; } FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, null); visit(visitor); return visitor.getMatched(); }
java
public List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException { // isDirectory does the read security check if (!isDirectory()) { return Collections.emptyList(); } if (filter == null) { filter = MatchAllVirtualFileFilter.INSTANCE; } FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(filter, null); visit(visitor); return visitor.getMatched(); }
[ "public", "List", "<", "VirtualFile", ">", "getChildren", "(", "VirtualFileFilter", "filter", ")", "throws", "IOException", "{", "// isDirectory does the read security check", "if", "(", "!", "isDirectory", "(", ")", ")", "{", "return", "Collections", ".", "emptyLis...
Get the children @param filter to filter the children @return the children @throws IOException for any problem accessing the virtual file system @throws IllegalStateException if the file is closed or it is a leaf node
[ "Get", "the", "children" ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L422-L429
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java
AbstractRouter.getReverseRouteFor
@Override public String getReverseRouteFor(Controller controller, String method, String var1, Object val1) { return getReverseRouteFor(controller, method, ImmutableMap.of(var1, val1)); }
java
@Override public String getReverseRouteFor(Controller controller, String method, String var1, Object val1) { return getReverseRouteFor(controller, method, ImmutableMap.of(var1, val1)); }
[ "@", "Override", "public", "String", "getReverseRouteFor", "(", "Controller", "controller", ",", "String", "method", ",", "String", "var1", ",", "Object", "val1", ")", "{", "return", "getReverseRouteFor", "(", "controller", ",", "method", ",", "ImmutableMap", "....
Gets the url of the route handled by the specified action method. @param controller the controller object @param method the controller method @param var1 the first parameter name @param val1 the first parameter value @return the url, {@literal null} if the action method is not found.
[ "Gets", "the", "url", "of", "the", "route", "handled", "by", "the", "specified", "action", "method", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/AbstractRouter.java#L154-L157
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/FileSteps.java
FileSteps.uploadFile
@Conditioned @Lorsque("J'utilise l'élément '(.*)-(.*)' pour uploader le fichier '(.*)'[\\.|\\?]") @Then("I use '(.*)-(.*)' element to upload '(.*)' file[\\.|\\?]") public void uploadFile(String page, String element, String filename, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { uploadFile(Page.getInstance(page).getPageElementByKey('-' + element), filename); }
java
@Conditioned @Lorsque("J'utilise l'élément '(.*)-(.*)' pour uploader le fichier '(.*)'[\\.|\\?]") @Then("I use '(.*)-(.*)' element to upload '(.*)' file[\\.|\\?]") public void uploadFile(String page, String element, String filename, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { uploadFile(Page.getInstance(page).getPageElementByKey('-' + element), filename); }
[ "@", "Conditioned", "@", "Lorsque", "(", "\"J'utilise l'élément '(.*)-(.*)' pour uploader le fichier '(.*)'[\\\\.|\\\\?]\")", "", "@", "Then", "(", "\"I use '(.*)-(.*)' element to upload '(.*)' file[\\\\.|\\\\?]\"", ")", "public", "void", "uploadFile", "(", "String", "page", ",",...
Waits the full download of a file with a maximum timeout in seconds. @param page The page to upload the file from @param element The file input field @param filename The name of the file to upload (from the default downloaded files directory) @param conditions List of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws TechnicalException @throws FailureException
[ "Waits", "the", "full", "download", "of", "a", "file", "with", "a", "maximum", "timeout", "in", "seconds", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/FileSteps.java#L155-L160
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeVariableDeclaration
private Status executeVariableDeclaration(Decl.Variable stmt, CallStack frame) { // We only need to do something if this has an initialiser if(stmt.hasInitialiser()) { RValue value = executeExpression(ANY_T, stmt.getInitialiser(), frame); frame.putLocal(stmt.getName(),value); } return Status.NEXT; }
java
private Status executeVariableDeclaration(Decl.Variable stmt, CallStack frame) { // We only need to do something if this has an initialiser if(stmt.hasInitialiser()) { RValue value = executeExpression(ANY_T, stmt.getInitialiser(), frame); frame.putLocal(stmt.getName(),value); } return Status.NEXT; }
[ "private", "Status", "executeVariableDeclaration", "(", "Decl", ".", "Variable", "stmt", ",", "CallStack", "frame", ")", "{", "// We only need to do something if this has an initialiser", "if", "(", "stmt", ".", "hasInitialiser", "(", ")", ")", "{", "RValue", "value",...
Execute a variable declaration statement at a given point in the function or method body @param stmt --- The statement to execute @param frame --- The current stack frame @return
[ "Execute", "a", "variable", "declaration", "statement", "at", "a", "given", "point", "in", "the", "function", "or", "method", "body" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L517-L524
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerClient.java
InstanceGroupManagerClient.resizeInstanceGroupManager
@BetaApi public final Operation resizeInstanceGroupManager(Integer size, String instanceGroupManager) { ResizeInstanceGroupManagerHttpRequest request = ResizeInstanceGroupManagerHttpRequest.newBuilder() .setSize(size) .setInstanceGroupManager(instanceGroupManager) .build(); return resizeInstanceGroupManager(request); }
java
@BetaApi public final Operation resizeInstanceGroupManager(Integer size, String instanceGroupManager) { ResizeInstanceGroupManagerHttpRequest request = ResizeInstanceGroupManagerHttpRequest.newBuilder() .setSize(size) .setInstanceGroupManager(instanceGroupManager) .build(); return resizeInstanceGroupManager(request); }
[ "@", "BetaApi", "public", "final", "Operation", "resizeInstanceGroupManager", "(", "Integer", "size", ",", "String", "instanceGroupManager", ")", "{", "ResizeInstanceGroupManagerHttpRequest", "request", "=", "ResizeInstanceGroupManagerHttpRequest", ".", "newBuilder", "(", "...
Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. <p>When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: <p>+ The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. <p>This list is subject to change. <p>If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. <p>Sample code: <pre><code> try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) { Integer size = 0; ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]"); Operation response = instanceGroupManagerClient.resizeInstanceGroupManager(size, instanceGroupManager.toString()); } </code></pre> @param size The number of running instances that the managed instance group should maintain at any given time. The group automatically adds or removes instances to maintain the number of instances specified by this parameter. @param instanceGroupManager The name of the managed instance group. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Resizes", "the", "managed", "instance", "group", ".", "If", "you", "increase", "the", "size", "the", "group", "creates", "new", "instances", "using", "the", "current", "instance", "template", ".", "If", "you", "decrease", "the", "size", "the", "group", "del...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceGroupManagerClient.java#L1663-L1672
IBM/ibm-cos-sdk-java
ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/model/BucketReplicationConfiguration.java
BucketReplicationConfiguration.setRules
public void setRules(Map<String, ReplicationRule> rules) { if (rules == null) { throw new IllegalArgumentException( "Replication rules cannot be null"); } this.rules = new HashMap<String, ReplicationRule>(rules); }
java
public void setRules(Map<String, ReplicationRule> rules) { if (rules == null) { throw new IllegalArgumentException( "Replication rules cannot be null"); } this.rules = new HashMap<String, ReplicationRule>(rules); }
[ "public", "void", "setRules", "(", "Map", "<", "String", ",", "ReplicationRule", ">", "rules", ")", "{", "if", "(", "rules", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Replication rules cannot be null\"", ")", ";", "}", "this",...
Sets the replication rules for the Amazon S3 bucket. @param rules the replication rules for the Amazon S3 bucket. @throws IllegalArgumentException if the rules are null.
[ "Sets", "the", "replication", "rules", "for", "the", "Amazon", "S3", "bucket", "." ]
train
https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/model/BucketReplicationConfiguration.java#L93-L99
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiView.java
FactoryMultiView.computePnPwithEPnP
public static Estimate1ofPnP computePnPwithEPnP(int numIterations, double magicNumber) { PnPLepetitEPnP alg = new PnPLepetitEPnP(magicNumber); alg.setNumIterations(numIterations); return new WrapPnPLepetitEPnP(alg); }
java
public static Estimate1ofPnP computePnPwithEPnP(int numIterations, double magicNumber) { PnPLepetitEPnP alg = new PnPLepetitEPnP(magicNumber); alg.setNumIterations(numIterations); return new WrapPnPLepetitEPnP(alg); }
[ "public", "static", "Estimate1ofPnP", "computePnPwithEPnP", "(", "int", "numIterations", ",", "double", "magicNumber", ")", "{", "PnPLepetitEPnP", "alg", "=", "new", "PnPLepetitEPnP", "(", "magicNumber", ")", ";", "alg", ".", "setNumIterations", "(", "numIterations"...
Returns a solution to the PnP problem for 4 or more points using EPnP. Fast and fairly accurate algorithm. Can handle general and planar scenario automatically. <p>NOTE: Observations are in normalized image coordinates NOT pixels.</p> @see PnPLepetitEPnP @param numIterations If more then zero then non-linear optimization is done. More is not always better. Try 10 @param magicNumber Affects how the problem is linearized. See comments in {@link PnPLepetitEPnP}. Try 0.1 @return Estimate1ofPnP
[ "Returns", "a", "solution", "to", "the", "PnP", "problem", "for", "4", "or", "more", "points", "using", "EPnP", ".", "Fast", "and", "fairly", "accurate", "algorithm", ".", "Can", "handle", "general", "and", "planar", "scenario", "automatically", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiView.java#L511-L515
google/truth
extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java
IterableOfProtosSubject.withPartialScope
public IterableOfProtosFluentAssertion<M> withPartialScope(FieldScope fieldScope) { return usingConfig(config.withPartialScope(checkNotNull(fieldScope, "fieldScope"))); }
java
public IterableOfProtosFluentAssertion<M> withPartialScope(FieldScope fieldScope) { return usingConfig(config.withPartialScope(checkNotNull(fieldScope, "fieldScope"))); }
[ "public", "IterableOfProtosFluentAssertion", "<", "M", ">", "withPartialScope", "(", "FieldScope", "fieldScope", ")", "{", "return", "usingConfig", "(", "config", ".", "withPartialScope", "(", "checkNotNull", "(", "fieldScope", ",", "\"fieldScope\"", ")", ")", ")", ...
Limits the comparison of Protocol buffers to the defined {@link FieldScope}. <p>This method is additive and has well-defined ordering semantics. If the invoking {@link ProtoFluentAssertion} is already scoped to a {@link FieldScope} {@code X}, and this method is invoked with {@link FieldScope} {@code Y}, the resultant {@link ProtoFluentAssertion} is constrained to the intersection of {@link FieldScope}s {@code X} and {@code Y}. <p>By default, {@link ProtoFluentAssertion} is constrained to {@link FieldScopes#all()}, that is, no fields are excluded from comparison.
[ "Limits", "the", "comparison", "of", "Protocol", "buffers", "to", "the", "defined", "{", "@link", "FieldScope", "}", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/IterableOfProtosSubject.java#L878-L880
samskivert/pythagoras
src/main/java/pythagoras/f/Matrix3.java
Matrix3.setToReflection
public Matrix3 setToReflection (float x, float y, float z) { float x2 = -2f*x, y2 = -2f*y, z2 = -2f*z; float xy2 = x2*y, xz2 = x2*z, yz2 = y2*z; return set(1f + x2*x, xy2, xz2, xy2, 1f + y2*y, yz2, xz2, yz2, 1f + z2*z); }
java
public Matrix3 setToReflection (float x, float y, float z) { float x2 = -2f*x, y2 = -2f*y, z2 = -2f*z; float xy2 = x2*y, xz2 = x2*z, yz2 = y2*z; return set(1f + x2*x, xy2, xz2, xy2, 1f + y2*y, yz2, xz2, yz2, 1f + z2*z); }
[ "public", "Matrix3", "setToReflection", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "float", "x2", "=", "-", "2f", "*", "x", ",", "y2", "=", "-", "2f", "*", "y", ",", "z2", "=", "-", "2f", "*", "z", ";", "float", "xy2",...
Sets this to a reflection across a plane intersecting the origin with the supplied normal. @return a reference to this matrix, for chaining.
[ "Sets", "this", "to", "a", "reflection", "across", "a", "plane", "intersecting", "the", "origin", "with", "the", "supplied", "normal", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Matrix3.java#L243-L249
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.execute
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception { // // Don't actually run the action (and perform the associated synchronization) if there are too many // concurrent requests to this instance. // if ( incrementRequestCount( request, response, getServletContext() ) ) { try { // netui:sync-point synchronized ( this ) { ActionForward ret = null; // establish the control context for running the beginAction, Action, afterAction code PageFlowControlContainer pfcc = null; try { pfcc = PageFlowControlContainerFactory.getControlContainer(request,getServletContext()); pfcc.beginContextOnPageFlow(this,request,response, getServletContext()); } catch (Exception e) { return handleException(e, mapping, form, request, response); } try { // execute the beginAction, Action, afterAction code ret = internalExecute( mapping, form, request, response ); } finally { try { pfcc.endContextOnPageFlow(this); } catch (Exception e) { // if already handling an exception during execute, then just log PageFlowRequestWrapper rw = PageFlowRequestWrapper.get(request); Throwable alreadyBeingHandled = rw.getExceptionBeingHandled(); if (alreadyBeingHandled != null) { _log.error( "Exception thrown while ending context on page flow in execute()", e ); } else { return handleException(e, mapping, form, request, response); } } } return ret; } } finally { decrementRequestCount( request ); } } else { return null; // error was written to the response by incrementRequestCount() } }
java
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception { // // Don't actually run the action (and perform the associated synchronization) if there are too many // concurrent requests to this instance. // if ( incrementRequestCount( request, response, getServletContext() ) ) { try { // netui:sync-point synchronized ( this ) { ActionForward ret = null; // establish the control context for running the beginAction, Action, afterAction code PageFlowControlContainer pfcc = null; try { pfcc = PageFlowControlContainerFactory.getControlContainer(request,getServletContext()); pfcc.beginContextOnPageFlow(this,request,response, getServletContext()); } catch (Exception e) { return handleException(e, mapping, form, request, response); } try { // execute the beginAction, Action, afterAction code ret = internalExecute( mapping, form, request, response ); } finally { try { pfcc.endContextOnPageFlow(this); } catch (Exception e) { // if already handling an exception during execute, then just log PageFlowRequestWrapper rw = PageFlowRequestWrapper.get(request); Throwable alreadyBeingHandled = rw.getExceptionBeingHandled(); if (alreadyBeingHandled != null) { _log.error( "Exception thrown while ending context on page flow in execute()", e ); } else { return handleException(e, mapping, form, request, response); } } } return ret; } } finally { decrementRequestCount( request ); } } else { return null; // error was written to the response by incrementRequestCount() } }
[ "public", "ActionForward", "execute", "(", "ActionMapping", "mapping", ",", "ActionForm", "form", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "Exception", "{", "//", "// Don't actually run the action (and perform the associated...
Perform decision logic to determine the next URI to be displayed. @param mapping the Struts ActionMapping for the current action being processed. @param form the form-bean (if any) associated with the Struts action being processed. May be null. @param request the current HttpServletRequest. @param response the current HttpServletResponse. @return a Struts ActionForward object that specifies the next URI to be displayed. @throws Exception if an Exception was thrown during user action-handling code.
[ "Perform", "decision", "logic", "to", "determine", "the", "next", "URI", "to", "be", "displayed", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L307-L366
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/SocialButton.java
SocialButton.setStyle
public void setStyle(AuthConfig config, @AuthMode int mode) { final Drawable logo = config.getLogo(getContext()); final int backgroundColor = config.getBackgroundColor(getContext()); Drawable touchBackground = getTouchFeedbackBackground(backgroundColor, smallSize ? ViewUtils.Corners.ALL : ViewUtils.Corners.ONLY_RIGHT); /* * Branding guidelines command we remove the padding for Google logo. * Since it's the only exception to the rule, handle it this way. * * Source: https://developers.google.com/identity/branding-guidelines */ if (STRATEGY_GOOGLE_OAUTH2.equalsIgnoreCase(config.getConnection().getStrategy())) { icon.setPadding(0, 0, 0, 0); } icon.setImageDrawable(logo); if (smallSize) { ViewUtils.setBackground(icon, touchBackground); } else { final String name = config.getName(getContext()); ShapeDrawable leftBackground = ViewUtils.getRoundedBackground(this, backgroundColor, ViewUtils.Corners.ONLY_LEFT); final String prefixFormat = getResources().getString(mode == AuthMode.LOG_IN ? R.string.com_auth0_lock_social_log_in : R.string.com_auth0_lock_social_sign_up); title.setText(String.format(prefixFormat, name)); ViewUtils.setBackground(icon, leftBackground); ViewUtils.setBackground(title, touchBackground); } }
java
public void setStyle(AuthConfig config, @AuthMode int mode) { final Drawable logo = config.getLogo(getContext()); final int backgroundColor = config.getBackgroundColor(getContext()); Drawable touchBackground = getTouchFeedbackBackground(backgroundColor, smallSize ? ViewUtils.Corners.ALL : ViewUtils.Corners.ONLY_RIGHT); /* * Branding guidelines command we remove the padding for Google logo. * Since it's the only exception to the rule, handle it this way. * * Source: https://developers.google.com/identity/branding-guidelines */ if (STRATEGY_GOOGLE_OAUTH2.equalsIgnoreCase(config.getConnection().getStrategy())) { icon.setPadding(0, 0, 0, 0); } icon.setImageDrawable(logo); if (smallSize) { ViewUtils.setBackground(icon, touchBackground); } else { final String name = config.getName(getContext()); ShapeDrawable leftBackground = ViewUtils.getRoundedBackground(this, backgroundColor, ViewUtils.Corners.ONLY_LEFT); final String prefixFormat = getResources().getString(mode == AuthMode.LOG_IN ? R.string.com_auth0_lock_social_log_in : R.string.com_auth0_lock_social_sign_up); title.setText(String.format(prefixFormat, name)); ViewUtils.setBackground(icon, leftBackground); ViewUtils.setBackground(title, touchBackground); } }
[ "public", "void", "setStyle", "(", "AuthConfig", "config", ",", "@", "AuthMode", "int", "mode", ")", "{", "final", "Drawable", "logo", "=", "config", ".", "getLogo", "(", "getContext", "(", ")", ")", ";", "final", "int", "backgroundColor", "=", "config", ...
Configures the button with the given connection information. @param config contains the connection information. @param mode the current button mode. Used to prefix the title with "Log In" or "Sign Up".
[ "Configures", "the", "button", "with", "the", "given", "connection", "information", "." ]
train
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/SocialButton.java#L71-L96
apache/groovy
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java
StaticTypeCheckingSupport.allParametersAndArgumentsMatchWithDefaultParams
static int allParametersAndArgumentsMatchWithDefaultParams(Parameter[] params, ClassNode[] args) { int dist = 0; ClassNode ptype = null; // we already know the lengths are equal for (int i = 0, j = 0; i < params.length; i++) { Parameter param = params[i]; ClassNode paramType = param.getType(); ClassNode arg = j >= args.length ? null : args[j]; if (arg == null || !isAssignableTo(arg, paramType)) { if (!param.hasInitialExpression() && (ptype == null || !ptype.equals(paramType))) { return -1; // no default value } // a default value exists, we can skip this param ptype = null; } else { j++; if (!paramType.equals(arg)) dist += getDistance(arg, paramType); if (param.hasInitialExpression()) { ptype = arg; } else { ptype = null; } } } return dist; }
java
static int allParametersAndArgumentsMatchWithDefaultParams(Parameter[] params, ClassNode[] args) { int dist = 0; ClassNode ptype = null; // we already know the lengths are equal for (int i = 0, j = 0; i < params.length; i++) { Parameter param = params[i]; ClassNode paramType = param.getType(); ClassNode arg = j >= args.length ? null : args[j]; if (arg == null || !isAssignableTo(arg, paramType)) { if (!param.hasInitialExpression() && (ptype == null || !ptype.equals(paramType))) { return -1; // no default value } // a default value exists, we can skip this param ptype = null; } else { j++; if (!paramType.equals(arg)) dist += getDistance(arg, paramType); if (param.hasInitialExpression()) { ptype = arg; } else { ptype = null; } } } return dist; }
[ "static", "int", "allParametersAndArgumentsMatchWithDefaultParams", "(", "Parameter", "[", "]", "params", ",", "ClassNode", "[", "]", "args", ")", "{", "int", "dist", "=", "0", ";", "ClassNode", "ptype", "=", "null", ";", "// we already know the lengths are equal", ...
Checks that arguments and parameter types match, expecting that the number of parameters is strictly greater than the number of arguments, allowing possible inclusion of default parameters. @param params method parameters @param args type arguments @return -1 if arguments do not match, 0 if arguments are of the exact type and >0 when one or more argument is not of the exact type but still match
[ "Checks", "that", "arguments", "and", "parameter", "types", "match", "expecting", "that", "the", "number", "of", "parameters", "is", "strictly", "greater", "than", "the", "number", "of", "arguments", "allowing", "possible", "inclusion", "of", "default", "parameter...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L384-L409
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/MediaApi.java
MediaApi.removeMedia
public ApiSuccessResponse removeMedia(String mediatype, LogoutMediaData logoutMediaData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = removeMediaWithHttpInfo(mediatype, logoutMediaData); return resp.getData(); }
java
public ApiSuccessResponse removeMedia(String mediatype, LogoutMediaData logoutMediaData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = removeMediaWithHttpInfo(mediatype, logoutMediaData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "removeMedia", "(", "String", "mediatype", ",", "LogoutMediaData", "logoutMediaData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "removeMediaWithHttpInfo", "(", "mediatype", ",", "logou...
Log out of a media channel Log out the current agent on the specified media channels. You can make a [/media/{mediatype}/ready](/reference/workspace/Media/index.html#readyAgentState) or [/media/{mediatype}/not-ready](/reference/workspace/Media/index.html#notReadyAgentState) request to log in to the media channel again. @param mediatype The media channel. (required) @param logoutMediaData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Log", "out", "of", "a", "media", "channel", "Log", "out", "the", "current", "agent", "on", "the", "specified", "media", "channels", ".", "You", "can", "make", "a", "[", "/", "media", "/", "{", "mediatype", "}", "/", "ready", "]", "(", "/", "referenc...
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L3917-L3920
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/lock/LockManager.java
LockManager.lockerWaitingOn
public boolean lockerWaitingOn(Locker locker, Locker target) { //------------------------------------------------------------- // Locker can be waiting on at most one lock. If that lock // is held by target or if any of the holders of that lock // is waiting on the target then locker is waiting on target. //------------------------------------------------------------- Lock waitingOn = (Lock) waitTable.get(locker); if (waitingOn == null) { return false; } Enumeration holders = waitingOn.getHolders(); while (holders.hasMoreElements()) { Locker next = (Locker) holders.nextElement(); if (next == target) { return true; } if (lockerWaitingOn(next, target)) { return true; } } return false; }
java
public boolean lockerWaitingOn(Locker locker, Locker target) { //------------------------------------------------------------- // Locker can be waiting on at most one lock. If that lock // is held by target or if any of the holders of that lock // is waiting on the target then locker is waiting on target. //------------------------------------------------------------- Lock waitingOn = (Lock) waitTable.get(locker); if (waitingOn == null) { return false; } Enumeration holders = waitingOn.getHolders(); while (holders.hasMoreElements()) { Locker next = (Locker) holders.nextElement(); if (next == target) { return true; } if (lockerWaitingOn(next, target)) { return true; } } return false; }
[ "public", "boolean", "lockerWaitingOn", "(", "Locker", "locker", ",", "Locker", "target", ")", "{", "//-------------------------------------------------------------", "// Locker can be waiting on at most one lock. If that lock", "// is held by target or if any of the holders of that lock",...
/* Return true iff the given locker is waiting on the given target; recurse as necessary.
[ "/", "*", "Return", "true", "iff", "the", "given", "locker", "is", "waiting", "on", "the", "given", "target", ";", "recurse", "as", "necessary", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/lock/LockManager.java#L412-L437
spring-projects/spring-mobile
spring-mobile-device/src/main/java/org/springframework/mobile/device/util/ResolverUtils.java
ResolverUtils.isTablet
public static boolean isTablet(Device device, SitePreference sitePreference) { return sitePreference == SitePreference.TABLET || device != null && device.isTablet() && sitePreference == null; }
java
public static boolean isTablet(Device device, SitePreference sitePreference) { return sitePreference == SitePreference.TABLET || device != null && device.isTablet() && sitePreference == null; }
[ "public", "static", "boolean", "isTablet", "(", "Device", "device", ",", "SitePreference", "sitePreference", ")", "{", "return", "sitePreference", "==", "SitePreference", ".", "TABLET", "||", "device", "!=", "null", "&&", "device", ".", "isTablet", "(", ")", "...
Should the combination of {@link Device} and {@link SitePreference} be handled as a tablet device @param device the resolved device @param sitePreference the specified site preference @return true if tablet
[ "Should", "the", "combination", "of", "{" ]
train
https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/util/ResolverUtils.java#L59-L61
TrueNight/Utils
utils/src/main/java/xyz/truenight/utils/Cache.java
Cache.that
@SuppressWarnings("unchecked") public static <T> T that(Object key, Supplier<T> what) { if (CACHE.get(key) != null) { try { return (T) CACHE.get(key); } catch (ClassCastException e) { System.out.print("E/Cache: Can't use cached object: wrong type"); } } T value = what.get(); CACHE.put(key, value); return value; }
java
@SuppressWarnings("unchecked") public static <T> T that(Object key, Supplier<T> what) { if (CACHE.get(key) != null) { try { return (T) CACHE.get(key); } catch (ClassCastException e) { System.out.print("E/Cache: Can't use cached object: wrong type"); } } T value = what.get(); CACHE.put(key, value); return value; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "that", "(", "Object", "key", ",", "Supplier", "<", "T", ">", "what", ")", "{", "if", "(", "CACHE", ".", "get", "(", "key", ")", "!=", "null", ")", "{", "...
Registers creator of item and returns item from cache or creator
[ "Registers", "creator", "of", "item", "and", "returns", "item", "from", "cache", "or", "creator" ]
train
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/utils/src/main/java/xyz/truenight/utils/Cache.java#L33-L46
powermock/powermock
powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/HotSpotVirtualMachine.java
HotSpotVirtualMachine.loadAgentLibrary
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
java
private void loadAgentLibrary(String agentLibrary, boolean isAbsolute, String options) throws AgentLoadException, AgentInitializationException, IOException { InputStream in = execute("load", agentLibrary, isAbsolute ? "true" : "false", options); try { int result = readInt(in); if (result != 0) { throw new AgentInitializationException("Agent_OnAttach failed", result); } } finally { in.close(); } }
[ "private", "void", "loadAgentLibrary", "(", "String", "agentLibrary", ",", "boolean", "isAbsolute", ",", "String", "options", ")", "throws", "AgentLoadException", ",", "AgentInitializationException", ",", "IOException", "{", "InputStream", "in", "=", "execute", "(", ...
/* Load agent library If isAbsolute is true then the agent library is the absolute path to the library and thus will not be expanded in the target VM. if isAbsolute is false then the agent library is just a library name and it will be expended in the target VM.
[ "/", "*", "Load", "agent", "library", "If", "isAbsolute", "is", "true", "then", "the", "agent", "library", "is", "the", "absolute", "path", "to", "the", "library", "and", "thus", "will", "not", "be", "expanded", "in", "the", "target", "VM", ".", "if", ...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-modules/powermock-module-javaagent/src/main/java/sun/tools/attach/HotSpotVirtualMachine.java#L54-L70
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java
NetworkInterfacesInner.listVirtualMachineScaleSetIpConfigurationsWithServiceResponseAsync
public Observable<ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>>> listVirtualMachineScaleSetIpConfigurationsWithServiceResponseAsync(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex, final String networkInterfaceName) { return listVirtualMachineScaleSetIpConfigurationsSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName) .concatMap(new Func1<ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>>, Observable<ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>>>>() { @Override public Observable<ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>>> call(ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listVirtualMachineScaleSetIpConfigurationsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>>> listVirtualMachineScaleSetIpConfigurationsWithServiceResponseAsync(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex, final String networkInterfaceName) { return listVirtualMachineScaleSetIpConfigurationsSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName) .concatMap(new Func1<ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>>, Observable<ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>>>>() { @Override public Observable<ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>>> call(ServiceResponse<Page<NetworkInterfaceIPConfigurationInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listVirtualMachineScaleSetIpConfigurationsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "NetworkInterfaceIPConfigurationInner", ">", ">", ">", "listVirtualMachineScaleSetIpConfigurationsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "virtualMachineSca...
Get the specified network interface ip configuration in a virtual machine scale set. @param resourceGroupName The name of the resource group. @param virtualMachineScaleSetName The name of the virtual machine scale set. @param virtualmachineIndex The virtual machine index. @param networkInterfaceName The name of the network interface. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;NetworkInterfaceIPConfigurationInner&gt; object
[ "Get", "the", "specified", "network", "interface", "ip", "configuration", "in", "a", "virtual", "machine", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L2005-L2017
alkacon/opencms-core
src/org/opencms/ade/contenteditor/CmsContentEditorActionElement.java
CmsContentEditorActionElement.addExternalResourceTags
private void addExternalResourceTags(StringBuffer sb, CmsContentDefinition definition) { Set<String> includedScripts = new HashSet<String>(); Set<String> includedStyles = new HashSet<String>(); for (CmsExternalWidgetConfiguration configuration : definition.getExternalWidgetConfigurations()) { for (String css : configuration.getCssResourceLinks()) { // avoid including the same resource twice if (!includedStyles.contains(css)) { sb.append("<link type=\"text/css\" rel=\"stylesheet\" href=\"").append(css).append("\"></link>"); includedStyles.add(css); } } for (String script : configuration.getJavaScriptResourceLinks()) { // avoid including the same resource twice if (!includedScripts.contains(script)) { sb.append("<script type=\"text/javascript\" src=\"").append(script).append("\"></script>"); includedScripts.add(script); } } } }
java
private void addExternalResourceTags(StringBuffer sb, CmsContentDefinition definition) { Set<String> includedScripts = new HashSet<String>(); Set<String> includedStyles = new HashSet<String>(); for (CmsExternalWidgetConfiguration configuration : definition.getExternalWidgetConfigurations()) { for (String css : configuration.getCssResourceLinks()) { // avoid including the same resource twice if (!includedStyles.contains(css)) { sb.append("<link type=\"text/css\" rel=\"stylesheet\" href=\"").append(css).append("\"></link>"); includedStyles.add(css); } } for (String script : configuration.getJavaScriptResourceLinks()) { // avoid including the same resource twice if (!includedScripts.contains(script)) { sb.append("<script type=\"text/javascript\" src=\"").append(script).append("\"></script>"); includedScripts.add(script); } } } }
[ "private", "void", "addExternalResourceTags", "(", "StringBuffer", "sb", ",", "CmsContentDefinition", "definition", ")", "{", "Set", "<", "String", ">", "includedScripts", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "Set", "<", "String", ">", "...
Adds link and script tags to the buffer if required for external widgets.<p> @param sb the string buffer to append the tags to @param definition the content definition
[ "Adds", "link", "and", "script", "tags", "to", "the", "buffer", "if", "required", "for", "external", "widgets", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentEditorActionElement.java#L97-L117
fommil/matrix-toolkits-java
src/main/java/no/uib/cipr/matrix/DenseLU.java
DenseLU.rcond
public double rcond(Matrix A, Norm norm) { if (norm != Norm.One && norm != Norm.Infinity) throw new IllegalArgumentException( "Only the 1 or the Infinity norms are supported"); double anorm = A.norm(norm); int n = A.numRows(); intW info = new intW(0); doubleW rcond = new doubleW(0); LAPACK.getInstance().dgecon(norm.netlib(), n, LU.getData(), Matrices.ld(n), anorm, rcond, new double[4 * n], new int[n], info); if (info.val < 0) throw new IllegalArgumentException(); return rcond.val; }
java
public double rcond(Matrix A, Norm norm) { if (norm != Norm.One && norm != Norm.Infinity) throw new IllegalArgumentException( "Only the 1 or the Infinity norms are supported"); double anorm = A.norm(norm); int n = A.numRows(); intW info = new intW(0); doubleW rcond = new doubleW(0); LAPACK.getInstance().dgecon(norm.netlib(), n, LU.getData(), Matrices.ld(n), anorm, rcond, new double[4 * n], new int[n], info); if (info.val < 0) throw new IllegalArgumentException(); return rcond.val; }
[ "public", "double", "rcond", "(", "Matrix", "A", ",", "Norm", "norm", ")", "{", "if", "(", "norm", "!=", "Norm", ".", "One", "&&", "norm", "!=", "Norm", ".", "Infinity", ")", "throw", "new", "IllegalArgumentException", "(", "\"Only the 1 or the Infinity norm...
Computes the reciprocal condition number, using either the infinity norm of the 1 norm. @param A The matrix this is a decomposition of @param norm Either <code>Norm.One</code> or <code>Norm.Infinity</code> @return The reciprocal condition number. Values close to unity indicate a well-conditioned system, while numbers close to zero do not.
[ "Computes", "the", "reciprocal", "condition", "number", "using", "either", "the", "infinity", "norm", "of", "the", "1", "norm", "." ]
train
https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/DenseLU.java#L138-L157
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/LongStream.java
LongStream.flatMap
@NotNull public LongStream flatMap(@NotNull final LongFunction<? extends LongStream> mapper) { return new LongStream(params, new LongFlatMap(iterator, mapper)); }
java
@NotNull public LongStream flatMap(@NotNull final LongFunction<? extends LongStream> mapper) { return new LongStream(params, new LongFlatMap(iterator, mapper)); }
[ "@", "NotNull", "public", "LongStream", "flatMap", "(", "@", "NotNull", "final", "LongFunction", "<", "?", "extends", "LongStream", ">", "mapper", ")", "{", "return", "new", "LongStream", "(", "params", ",", "new", "LongFlatMap", "(", "iterator", ",", "mappe...
Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element. <p>This is an intermediate operation. <p>Example: <pre> mapper: (a) -&gt; [a, a + 5] stream: [1, 2, 3, 4] result: [1, 6, 2, 7, 3, 8, 4, 9] </pre> @param mapper the mapper function used to apply to each element @return the new stream @see Stream#flatMap(com.annimon.stream.function.Function)
[ "Returns", "a", "stream", "consisting", "of", "the", "results", "of", "replacing", "each", "element", "of", "this", "stream", "with", "the", "contents", "of", "a", "mapped", "stream", "produced", "by", "applying", "the", "provided", "mapping", "function", "to"...
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L563-L566
alkacon/opencms-core
src/org/opencms/acacia/shared/CmsEntity.java
CmsEntity.addAttributeValue
public void addAttributeValue(String attributeName, String value) { if (m_entityAttributes.containsKey(attributeName)) { throw new RuntimeException("Attribute already exists with a entity type value."); } if (m_simpleAttributes.containsKey(attributeName)) { m_simpleAttributes.get(attributeName).add(value); } else { List<String> values = new ArrayList<String>(); values.add(value); m_simpleAttributes.put(attributeName, values); } fireChange(); }
java
public void addAttributeValue(String attributeName, String value) { if (m_entityAttributes.containsKey(attributeName)) { throw new RuntimeException("Attribute already exists with a entity type value."); } if (m_simpleAttributes.containsKey(attributeName)) { m_simpleAttributes.get(attributeName).add(value); } else { List<String> values = new ArrayList<String>(); values.add(value); m_simpleAttributes.put(attributeName, values); } fireChange(); }
[ "public", "void", "addAttributeValue", "(", "String", "attributeName", ",", "String", "value", ")", "{", "if", "(", "m_entityAttributes", ".", "containsKey", "(", "attributeName", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Attribute already exists wi...
Adds the given attribute value.<p> @param attributeName the attribute name @param value the attribute value
[ "Adds", "the", "given", "attribute", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsEntity.java#L248-L261
vnesek/nmote-iim4j
src/main/java/com/nmote/iim4j/IIMFile.java
IIMFile.addDateTimeHelper
public void addDateTimeHelper(int ds, Date date) throws SerializationException, InvalidDataSetException { if (date == null) { return; } DataSetInfo dsi = dsiFactory.create(ds); SimpleDateFormat df = new SimpleDateFormat(dsi.getSerializer().toString()); String value = df.format(date); byte[] data = dsi.getSerializer().serialize(value, activeSerializationContext); DataSet dataSet = new DefaultDataSet(dsi, data); add(dataSet); }
java
public void addDateTimeHelper(int ds, Date date) throws SerializationException, InvalidDataSetException { if (date == null) { return; } DataSetInfo dsi = dsiFactory.create(ds); SimpleDateFormat df = new SimpleDateFormat(dsi.getSerializer().toString()); String value = df.format(date); byte[] data = dsi.getSerializer().serialize(value, activeSerializationContext); DataSet dataSet = new DefaultDataSet(dsi, data); add(dataSet); }
[ "public", "void", "addDateTimeHelper", "(", "int", "ds", ",", "Date", "date", ")", "throws", "SerializationException", ",", "InvalidDataSetException", "{", "if", "(", "date", "==", "null", ")", "{", "return", ";", "}", "DataSetInfo", "dsi", "=", "dsiFactory", ...
Adds a data set with date-time value to IIM file. @param ds data set id (see constants in IIM class) @param date date to set. Null values are silently ignored. @throws SerializationException if value can't be serialized by data set's serializer @throws InvalidDataSetException if data set isn't defined
[ "Adds", "a", "data", "set", "with", "date", "-", "time", "value", "to", "IIM", "file", "." ]
train
https://github.com/vnesek/nmote-iim4j/blob/ec55b02fc644cd722e93051ac0bdb96b00cb42a8/src/main/java/com/nmote/iim4j/IIMFile.java#L102-L114
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherConfiguration.java
ScatterGatherConfiguration.addBroadcastSetForGatherFunction
public void addBroadcastSetForGatherFunction(String name, DataSet<?> data) { this.bcVarsGather.add(new Tuple2<>(name, data)); }
java
public void addBroadcastSetForGatherFunction(String name, DataSet<?> data) { this.bcVarsGather.add(new Tuple2<>(name, data)); }
[ "public", "void", "addBroadcastSetForGatherFunction", "(", "String", "name", ",", "DataSet", "<", "?", ">", "data", ")", "{", "this", ".", "bcVarsGather", ".", "add", "(", "new", "Tuple2", "<>", "(", "name", ",", "data", ")", ")", ";", "}" ]
Adds a data set as a broadcast set to the gather function. @param name The name under which the broadcast data is available in the gather function. @param data The data set to be broadcast.
[ "Adds", "a", "data", "set", "as", "a", "broadcast", "set", "to", "the", "gather", "function", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/spargel/ScatterGatherConfiguration.java#L71-L73
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/StackTraceFilter.java
StackTraceFilter.getFilteredStackTrace
public static String getFilteredStackTrace(Throwable t, int ref) { StringWriter sw = new StringWriter(); FilterWriter filterWriter = new StackTraceFilterWriter(sw); printStackTrace(t, filterWriter, ref); return sw.getBuffer().toString(); }
java
public static String getFilteredStackTrace(Throwable t, int ref) { StringWriter sw = new StringWriter(); FilterWriter filterWriter = new StackTraceFilterWriter(sw); printStackTrace(t, filterWriter, ref); return sw.getBuffer().toString(); }
[ "public", "static", "String", "getFilteredStackTrace", "(", "Throwable", "t", ",", "int", "ref", ")", "{", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "FilterWriter", "filterWriter", "=", "new", "StackTraceFilterWriter", "(", "sw", ")", ";...
Filter stack trace by selecting the {@link Throwable} using a reference position. Intermediate throwables will be printed with just their header. @param t the throwable @param ref throwable reference position, see {@link #getThrowable(List, int)}. @return String containing the stack trace. @since 1.11.1
[ "Filter", "stack", "trace", "by", "selecting", "the", "{", "@link", "Throwable", "}", "using", "a", "reference", "position", ".", "Intermediate", "throwables", "will", "be", "printed", "with", "just", "their", "header", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/StackTraceFilter.java#L247-L255
glyptodon/guacamole-client
guacamole/src/main/java/org/apache/guacamole/tunnel/InterceptedStream.java
InterceptedStream.setStreamError
public void setStreamError(int code, String message) { // Map status code to GuacamoleStatus, assuming SERVER_ERROR by default GuacamoleStatus status = GuacamoleStatus.fromGuacamoleStatusCode(code); if (status == null) status = GuacamoleStatus.SERVER_ERROR; // Associate stream with corresponding GuacamoleStreamException setStreamError(new GuacamoleStreamException(status, message)); }
java
public void setStreamError(int code, String message) { // Map status code to GuacamoleStatus, assuming SERVER_ERROR by default GuacamoleStatus status = GuacamoleStatus.fromGuacamoleStatusCode(code); if (status == null) status = GuacamoleStatus.SERVER_ERROR; // Associate stream with corresponding GuacamoleStreamException setStreamError(new GuacamoleStreamException(status, message)); }
[ "public", "void", "setStreamError", "(", "int", "code", ",", "String", "message", ")", "{", "// Map status code to GuacamoleStatus, assuming SERVER_ERROR by default", "GuacamoleStatus", "status", "=", "GuacamoleStatus", ".", "fromGuacamoleStatusCode", "(", "code", ")", ";",...
Reports that this InterceptedStream did not complete successfully due to an error described by the given status code and human-readable message. The error reported by this call can later be retrieved as a GuacamoleStreamException by calling getStreamError(). @param code The Guacamole protocol status code which described the error that occurred. This should be taken directly from the "ack" instruction that reported the error witin the intercepted stream. @param message A human-readable message describing the error that occurred. This should be taken directly from the "ack" instruction that reported the error witin the intercepted stream.
[ "Reports", "that", "this", "InterceptedStream", "did", "not", "complete", "successfully", "due", "to", "an", "error", "described", "by", "the", "given", "status", "code", "and", "human", "-", "readable", "message", ".", "The", "error", "reported", "by", "this"...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/tunnel/InterceptedStream.java#L123-L133
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java
BinTrie.load
public boolean load(String path, V[] value) { byte[] bytes = IOUtil.readBytes(path); if (bytes == null) return false; _ValueArray valueArray = new _ValueArray(value); ByteArray byteArray = new ByteArray(bytes); for (int i = 0; i < child.length; ++i) { int flag = byteArray.nextInt(); if (flag == 1) { child[i] = new Node<V>(); child[i].walkToLoad(byteArray, valueArray); } } size = value.length; return true; }
java
public boolean load(String path, V[] value) { byte[] bytes = IOUtil.readBytes(path); if (bytes == null) return false; _ValueArray valueArray = new _ValueArray(value); ByteArray byteArray = new ByteArray(bytes); for (int i = 0; i < child.length; ++i) { int flag = byteArray.nextInt(); if (flag == 1) { child[i] = new Node<V>(); child[i].walkToLoad(byteArray, valueArray); } } size = value.length; return true; }
[ "public", "boolean", "load", "(", "String", "path", ",", "V", "[", "]", "value", ")", "{", "byte", "[", "]", "bytes", "=", "IOUtil", ".", "readBytes", "(", "path", ")", ";", "if", "(", "bytes", "==", "null", ")", "return", "false", ";", "_ValueArra...
从磁盘加载二分数组树 @param path 路径 @param value 额外提供的值数组,按照值的字典序。(之所以要求提供它,是因为泛型的保存不归树管理) @return 是否成功
[ "从磁盘加载二分数组树" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/trie/bintrie/BinTrie.java#L412-L430
jronrun/benayn
benayn-berkeley/src/main/java/com/benayn/berkeley/Berkeley.java
Berkeley.of
public static BerkeleyStore of(String envHomePath, String storeName) { return env(envHomePath).connection(storeName, null); }
java
public static BerkeleyStore of(String envHomePath, String storeName) { return env(envHomePath).connection(storeName, null); }
[ "public", "static", "BerkeleyStore", "of", "(", "String", "envHomePath", ",", "String", "storeName", ")", "{", "return", "env", "(", "envHomePath", ")", ".", "connection", "(", "storeName", ",", "null", ")", ";", "}" ]
Returns a new {@link BerkeleyStore} instance, {@link Environment} with {@link Berkeley#defaultEnvironmentConfig() and {@link EntityStore} with {@link Berkeley#defaultStoreConfig()}
[ "Returns", "a", "new", "{" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-berkeley/src/main/java/com/benayn/berkeley/Berkeley.java#L123-L125
joelittlejohn/jsonschema2pojo
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java
NameHelper.getSetterName
public String getSetterName(String propertyName, JsonNode node) { propertyName = getPropertyNameForAccessor(propertyName, node); String prefix = "set"; String setterName; if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { setterName = prefix + propertyName; } else { setterName = prefix + capitalize(propertyName); } if (setterName.equals("setClass")) { setterName = "setClass_"; } return setterName; }
java
public String getSetterName(String propertyName, JsonNode node) { propertyName = getPropertyNameForAccessor(propertyName, node); String prefix = "set"; String setterName; if (propertyName.length() > 1 && Character.isUpperCase(propertyName.charAt(1))) { setterName = prefix + propertyName; } else { setterName = prefix + capitalize(propertyName); } if (setterName.equals("setClass")) { setterName = "setClass_"; } return setterName; }
[ "public", "String", "getSetterName", "(", "String", "propertyName", ",", "JsonNode", "node", ")", "{", "propertyName", "=", "getPropertyNameForAccessor", "(", "propertyName", ",", "node", ")", ";", "String", "prefix", "=", "\"set\"", ";", "String", "setterName", ...
Generate setter method name for property. @param propertyName @param node @return
[ "Generate", "setter", "method", "name", "for", "property", "." ]
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/util/NameHelper.java#L128-L145
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.getFloat
@PublicEvolving public float getFloat(ConfigOption<Float> configOption, float overrideDefault) { Object o = getRawValueFromOption(configOption); if (o == null) { return overrideDefault; } return convertToFloat(o, configOption.defaultValue()); }
java
@PublicEvolving public float getFloat(ConfigOption<Float> configOption, float overrideDefault) { Object o = getRawValueFromOption(configOption); if (o == null) { return overrideDefault; } return convertToFloat(o, configOption.defaultValue()); }
[ "@", "PublicEvolving", "public", "float", "getFloat", "(", "ConfigOption", "<", "Float", ">", "configOption", ",", "float", "overrideDefault", ")", "{", "Object", "o", "=", "getRawValueFromOption", "(", "configOption", ")", ";", "if", "(", "o", "==", "null", ...
Returns the value associated with the given config option as a float. If no value is mapped under any key of the option, it returns the specified default instead of the option's default value. @param configOption The configuration option @param overrideDefault The value to return if no value was mapper for any key of the option @return the configured value associated with the given config option, or the overrideDefault
[ "Returns", "the", "value", "associated", "with", "the", "given", "config", "option", "as", "a", "float", ".", "If", "no", "value", "is", "mapped", "under", "any", "key", "of", "the", "option", "it", "returns", "the", "specified", "default", "instead", "of"...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L456-L463
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java
QueryImpl.setRelationEntities
protected List<Object> setRelationEntities(List enhanceEntities, Client client, EntityMetadata m) { // Enhance entities can contain or may not contain relation. // if it contain a relation means it is a child // if it does not then it means it is a parent. List<Object> result = new ArrayList<Object>(); // Stack of objects. To be used for referring any similar object found // later. // This prevents infinite recursive loop and hence prevents stack // overflow. Map<Object, Object> relationStack = new HashMap<Object, Object>(); if (enhanceEntities != null) { for (Object e : enhanceEntities) { addToRelationStack(relationStack, e, m); } } if (enhanceEntities != null) { for (Object e : enhanceEntities) { if (!(e instanceof EnhanceEntity)) { e = new EnhanceEntity(e, PropertyAccessorHelper.getId(e, m), null); } EnhanceEntity ee = (EnhanceEntity) e; result.add(getReader().recursivelyFindEntities(ee.getEntity(), ee.getRelations(), m, persistenceDelegeator, false, relationStack)); } } return result; }
java
protected List<Object> setRelationEntities(List enhanceEntities, Client client, EntityMetadata m) { // Enhance entities can contain or may not contain relation. // if it contain a relation means it is a child // if it does not then it means it is a parent. List<Object> result = new ArrayList<Object>(); // Stack of objects. To be used for referring any similar object found // later. // This prevents infinite recursive loop and hence prevents stack // overflow. Map<Object, Object> relationStack = new HashMap<Object, Object>(); if (enhanceEntities != null) { for (Object e : enhanceEntities) { addToRelationStack(relationStack, e, m); } } if (enhanceEntities != null) { for (Object e : enhanceEntities) { if (!(e instanceof EnhanceEntity)) { e = new EnhanceEntity(e, PropertyAccessorHelper.getId(e, m), null); } EnhanceEntity ee = (EnhanceEntity) e; result.add(getReader().recursivelyFindEntities(ee.getEntity(), ee.getRelations(), m, persistenceDelegeator, false, relationStack)); } } return result; }
[ "protected", "List", "<", "Object", ">", "setRelationEntities", "(", "List", "enhanceEntities", ",", "Client", "client", ",", "EntityMetadata", "m", ")", "{", "// Enhance entities can contain or may not contain relation.", "// if it contain a relation means it is a child", "// ...
Sets the relation entities. @param enhanceEntities the enhance entities @param client the client @param m the m @return the list
[ "Sets", "the", "relation", "entities", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/QueryImpl.java#L218-L254
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/Table.java
Table.addRow
protected void addRow(int uniqueID, Map<String, Object> map) { m_rows.put(Integer.valueOf(uniqueID), new MapRow(map)); }
java
protected void addRow(int uniqueID, Map<String, Object> map) { m_rows.put(Integer.valueOf(uniqueID), new MapRow(map)); }
[ "protected", "void", "addRow", "(", "int", "uniqueID", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "m_rows", ".", "put", "(", "Integer", ".", "valueOf", "(", "uniqueID", ")", ",", "new", "MapRow", "(", "map", ")", ")", ";", "}" ...
Adds a row to the internal storage, indexed by primary key. @param uniqueID unique ID of the row @param map row data as a simpe map
[ "Adds", "a", "row", "to", "the", "internal", "storage", "indexed", "by", "primary", "key", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/Table.java#L106-L109
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java
X509Key.parse
public static PublicKey parse(DerValue in) throws IOException { AlgorithmId algorithm; PublicKey subjectKey; if (in.tag != DerValue.tag_Sequence) throw new IOException("corrupt subject key"); algorithm = AlgorithmId.parse(in.data.getDerValue()); try { subjectKey = buildX509Key(algorithm, in.data.getUnalignedBitString()); } catch (InvalidKeyException e) { throw new IOException("subject key, " + e.getMessage(), e); } if (in.data.available() != 0) throw new IOException("excess subject key"); return subjectKey; }
java
public static PublicKey parse(DerValue in) throws IOException { AlgorithmId algorithm; PublicKey subjectKey; if (in.tag != DerValue.tag_Sequence) throw new IOException("corrupt subject key"); algorithm = AlgorithmId.parse(in.data.getDerValue()); try { subjectKey = buildX509Key(algorithm, in.data.getUnalignedBitString()); } catch (InvalidKeyException e) { throw new IOException("subject key, " + e.getMessage(), e); } if (in.data.available() != 0) throw new IOException("excess subject key"); return subjectKey; }
[ "public", "static", "PublicKey", "parse", "(", "DerValue", "in", ")", "throws", "IOException", "{", "AlgorithmId", "algorithm", ";", "PublicKey", "subjectKey", ";", "if", "(", "in", ".", "tag", "!=", "DerValue", ".", "tag_Sequence", ")", "throw", "new", "IOE...
Construct X.509 subject public key from a DER value. If the runtime environment is configured with a specific class for this kind of key, a subclass is returned. Otherwise, a generic X509Key object is returned. <P>This mechanism gurantees that keys (and algorithms) may be freely manipulated and transferred, without risk of losing information. Also, when a key (or algorithm) needs some special handling, that specific need can be accomodated. @param in the DER-encoded SubjectPublicKeyInfo value @exception IOException on data format errors
[ "Construct", "X", ".", "509", "subject", "public", "key", "from", "a", "DER", "value", ".", "If", "the", "runtime", "environment", "is", "configured", "with", "a", "specific", "class", "for", "this", "kind", "of", "key", "a", "subclass", "is", "returned", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java#L160-L180
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java
KickflipApiClient.startStreamWithUser
private void startStreamWithUser(User user, Stream stream, final KickflipCallback cb) { checkNotNull(user); checkNotNull(stream); GenericData data = new GenericData(); data.put("uuid", user.getUUID()); data.put("private", stream.isPrivate()); if (stream.getTitle() != null) { data.put("title", stream.getTitle()); } if (stream.getDescription() != null) { data.put("description", stream.getDescription()); } if (stream.getExtraInfo() != null) { data.put("extra_info", new Gson().toJson(stream.getExtraInfo())); } post(START_STREAM, new UrlEncodedContent(data), HlsStream.class, cb); }
java
private void startStreamWithUser(User user, Stream stream, final KickflipCallback cb) { checkNotNull(user); checkNotNull(stream); GenericData data = new GenericData(); data.put("uuid", user.getUUID()); data.put("private", stream.isPrivate()); if (stream.getTitle() != null) { data.put("title", stream.getTitle()); } if (stream.getDescription() != null) { data.put("description", stream.getDescription()); } if (stream.getExtraInfo() != null) { data.put("extra_info", new Gson().toJson(stream.getExtraInfo())); } post(START_STREAM, new UrlEncodedContent(data), HlsStream.class, cb); }
[ "private", "void", "startStreamWithUser", "(", "User", "user", ",", "Stream", "stream", ",", "final", "KickflipCallback", "cb", ")", "{", "checkNotNull", "(", "user", ")", ";", "checkNotNull", "(", "stream", ")", ";", "GenericData", "data", "=", "new", "Gene...
Start a new Stream owned by the given User. Must be called after {@link io.kickflip.sdk.api.KickflipApiClient#createNewUser(KickflipCallback)} Delivers stream endpoint destination data via a {@link io.kickflip.sdk.api.KickflipCallback}. @param user The Kickflip User on whose behalf this request is performed. @param cb This callback will receive a Stream subclass in {@link io.kickflip.sdk.api.KickflipCallback#onSuccess(io.kickflip.sdk.api.json.Response)} depending on the Kickflip account type. Implementors should check if the response is instanceof HlsStream, StartRtmpStreamResponse, etc.
[ "Start", "a", "new", "Stream", "owned", "by", "the", "given", "User", ".", "Must", "be", "called", "after", "{", "@link", "io", ".", "kickflip", ".", "sdk", ".", "api", ".", "KickflipApiClient#createNewUser", "(", "KickflipCallback", ")", "}", "Delivers", ...
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/api/KickflipApiClient.java#L331-L347
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java
ServerCommunicationLinksInner.getAsync
public Observable<ServerCommunicationLinkInner> getAsync(String resourceGroupName, String serverName, String communicationLinkName) { return getWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).map(new Func1<ServiceResponse<ServerCommunicationLinkInner>, ServerCommunicationLinkInner>() { @Override public ServerCommunicationLinkInner call(ServiceResponse<ServerCommunicationLinkInner> response) { return response.body(); } }); }
java
public Observable<ServerCommunicationLinkInner> getAsync(String resourceGroupName, String serverName, String communicationLinkName) { return getWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName).map(new Func1<ServiceResponse<ServerCommunicationLinkInner>, ServerCommunicationLinkInner>() { @Override public ServerCommunicationLinkInner call(ServiceResponse<ServerCommunicationLinkInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerCommunicationLinkInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "communicationLinkName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "server...
Returns a server communication link. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param communicationLinkName The name of the server communication link. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerCommunicationLinkInner object
[ "Returns", "a", "server", "communication", "link", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java#L210-L217
spring-cloud/spring-cloud-netflix
spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/InstanceRegistry.java
InstanceRegistry.openForTraffic
@Override public void openForTraffic(ApplicationInfoManager applicationInfoManager, int count) { super.openForTraffic(applicationInfoManager, count == 0 ? this.defaultOpenForTrafficCount : count); }
java
@Override public void openForTraffic(ApplicationInfoManager applicationInfoManager, int count) { super.openForTraffic(applicationInfoManager, count == 0 ? this.defaultOpenForTrafficCount : count); }
[ "@", "Override", "public", "void", "openForTraffic", "(", "ApplicationInfoManager", "applicationInfoManager", ",", "int", "count", ")", "{", "super", ".", "openForTraffic", "(", "applicationInfoManager", ",", "count", "==", "0", "?", "this", ".", "defaultOpenForTraf...
If {@link PeerAwareInstanceRegistryImpl#openForTraffic(ApplicationInfoManager, int)} is called with a zero argument, it means that leases are not automatically cancelled if the instance hasn't sent any renewals recently. This happens for a standalone server. It seems like a bad default, so we set it to the smallest non-zero value we can, so that any instances that subsequently register can bump up the threshold.
[ "If", "{" ]
train
https://github.com/spring-cloud/spring-cloud-netflix/blob/03b1e326ce5971c41239890dc71cae616366cff8/spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/InstanceRegistry.java#L77-L81
EdwardRaff/JSAT
JSAT/src/jsat/linear/Matrix.java
Matrix.multiplyTranspose
public Matrix multiplyTranspose(final Matrix B, ExecutorService threadPool) { Matrix C = new DenseMatrix(this.rows(), B.rows()); multiplyTranspose(B, C, threadPool); return C; }
java
public Matrix multiplyTranspose(final Matrix B, ExecutorService threadPool) { Matrix C = new DenseMatrix(this.rows(), B.rows()); multiplyTranspose(B, C, threadPool); return C; }
[ "public", "Matrix", "multiplyTranspose", "(", "final", "Matrix", "B", ",", "ExecutorService", "threadPool", ")", "{", "Matrix", "C", "=", "new", "DenseMatrix", "(", "this", ".", "rows", "(", ")", ",", "B", ".", "rows", "(", ")", ")", ";", "multiplyTransp...
Returns the new matrix <i>C</i> that is <i>C = A*B<sup>T</sup></i> @param B the matrix to multiply by the transpose of @param threadPool the source of threads to do computation in parallel @return the result C
[ "Returns", "the", "new", "matrix", "<i", ">", "C<", "/", "i", ">", "that", "is", "<i", ">", "C", "=", "A", "*", "B<sup", ">", "T<", "/", "sup", ">", "<", "/", "i", ">" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L366-L371
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java
AOStream.startOrIncludeInWriteRange
private final TickRange startOrIncludeInWriteRange( TickRange writeRange, long lowerBound, long upperBound, TickRange r) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "startOrIncludeInWriteRange"); if (writeRange == null) { writeRange = new TickRange(TickRange.Completed, 0L, 0L); writeRange.startstamp = max(r.startstamp, lowerBound); writeRange.endstamp = min(r.endstamp, upperBound); } else { writeRange.endstamp = min(r.endstamp, upperBound); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "startOrIncludeInWriteRange", writeRange); return writeRange; }
java
private final TickRange startOrIncludeInWriteRange( TickRange writeRange, long lowerBound, long upperBound, TickRange r) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "startOrIncludeInWriteRange"); if (writeRange == null) { writeRange = new TickRange(TickRange.Completed, 0L, 0L); writeRange.startstamp = max(r.startstamp, lowerBound); writeRange.endstamp = min(r.endstamp, upperBound); } else { writeRange.endstamp = min(r.endstamp, upperBound); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "startOrIncludeInWriteRange", writeRange); return writeRange; }
[ "private", "final", "TickRange", "startOrIncludeInWriteRange", "(", "TickRange", "writeRange", ",", "long", "lowerBound", ",", "long", "upperBound", ",", "TickRange", "r", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", "...
Helper method. We are given a range, writeRange, which may be null. We are also given a range r (which is not null), that needs to be included in writeRange. The constraint on the inclusion is the resulting writeRange should be in the interval [lowerBound, upperBound]. @param writeRange @param lowerBound @param upperBound @param r @return The resulting writeRange
[ "Helper", "method", ".", "We", "are", "given", "a", "range", "writeRange", "which", "may", "be", "null", ".", "We", "are", "also", "given", "a", "range", "r", "(", "which", "is", "not", "null", ")", "that", "needs", "to", "be", "included", "in", "wri...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AOStream.java#L2683-L2707
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/EntityUtils.java
EntityUtils.getRenderViewOffset
public static Point getRenderViewOffset(float partialTick) { Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); if (partialTick == 0) return new Point(entity.posX, entity.posY, entity.posZ); double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTick; double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTick; double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTick; return new Point(x, y, z); }
java
public static Point getRenderViewOffset(float partialTick) { Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); if (partialTick == 0) return new Point(entity.posX, entity.posY, entity.posZ); double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTick; double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTick; double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTick; return new Point(x, y, z); }
[ "public", "static", "Point", "getRenderViewOffset", "(", "float", "partialTick", ")", "{", "Entity", "entity", "=", "Minecraft", ".", "getMinecraft", "(", ")", ".", "getRenderViewEntity", "(", ")", ";", "if", "(", "partialTick", "==", "0", ")", "return", "ne...
Gets the render view offset for the current view entity. @param partialTick the partial tick @return the render view offset
[ "Gets", "the", "render", "view", "offset", "for", "the", "current", "view", "entity", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/EntityUtils.java#L263-L273
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java
CleverTapAPI.instanceWithConfig
@SuppressWarnings({"unused", "WeakerAccess"}) public static CleverTapAPI instanceWithConfig(Context context, @NonNull CleverTapInstanceConfig config){ //noinspection ConstantConditions if (config == null) { Logger.v("CleverTapInstanceConfig cannot be null"); return null; } if (instances == null) { instances = new HashMap<>(); } CleverTapAPI instance = instances.get(config.getAccountId()); if (instance == null){ instance = new CleverTapAPI(context, config); instances.put(config.getAccountId(), instance); } return instance; }
java
@SuppressWarnings({"unused", "WeakerAccess"}) public static CleverTapAPI instanceWithConfig(Context context, @NonNull CleverTapInstanceConfig config){ //noinspection ConstantConditions if (config == null) { Logger.v("CleverTapInstanceConfig cannot be null"); return null; } if (instances == null) { instances = new HashMap<>(); } CleverTapAPI instance = instances.get(config.getAccountId()); if (instance == null){ instance = new CleverTapAPI(context, config); instances.put(config.getAccountId(), instance); } return instance; }
[ "@", "SuppressWarnings", "(", "{", "\"unused\"", ",", "\"WeakerAccess\"", "}", ")", "public", "static", "CleverTapAPI", "instanceWithConfig", "(", "Context", "context", ",", "@", "NonNull", "CleverTapInstanceConfig", "config", ")", "{", "//noinspection ConstantCondition...
Returns an instance of the CleverTap SDK using CleverTapInstanceConfig. @param context The Android context @param config The {@link CleverTapInstanceConfig} object @return The {@link CleverTapAPI} object
[ "Returns", "an", "instance", "of", "the", "CleverTap", "SDK", "using", "CleverTapInstanceConfig", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java#L514-L530
darcy-framework/darcy-web
src/main/java/com/redhat/darcy/web/HtmlTable.java
HtmlTable.byRowColumn
protected Locator byRowColumn(int rowIndex, int colIndex) { if (rowIndex < 1) { throw new IllegalArgumentException("Row index must be greater than 0."); } if (colIndex < 1) { throw new IllegalArgumentException("Column index must be greater than 0."); } String xpath = bodyTag.isPresent() ? "./tbody/tr[" + rowIndex + "]/td[" + colIndex + "]" : "./tr[" + rowIndex + "]/td[" + colIndex + "]"; return byInner(By.xpath(xpath)); }
java
protected Locator byRowColumn(int rowIndex, int colIndex) { if (rowIndex < 1) { throw new IllegalArgumentException("Row index must be greater than 0."); } if (colIndex < 1) { throw new IllegalArgumentException("Column index must be greater than 0."); } String xpath = bodyTag.isPresent() ? "./tbody/tr[" + rowIndex + "]/td[" + colIndex + "]" : "./tr[" + rowIndex + "]/td[" + colIndex + "]"; return byInner(By.xpath(xpath)); }
[ "protected", "Locator", "byRowColumn", "(", "int", "rowIndex", ",", "int", "colIndex", ")", "{", "if", "(", "rowIndex", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Row index must be greater than 0.\"", ")", ";", "}", "if", "(", "col...
Conveniently allows column implementations to lookup cells inside a column without duplicating the effort to come up with xpath for each column's cells. Simply use this method with that column's index. @return A locator that finds a cell based on a row and column index. It does this by constructing an xpath. If a {@code<tbody>} tag is present, this will use, "./tbody/tr[rowIndex]/td[colIndex]". If no {@code<tbody>} tag is present, "./tr[rowIndex]/td[colIndex]" will be used. <p>If your modelling an unconventionally structured html table, you're encouraged to override this method. @param rowIndex Starting from the top, at 1. @param colIndex Starting from the left, at 1.
[ "Conveniently", "allows", "column", "implementations", "to", "lookup", "cells", "inside", "a", "column", "without", "duplicating", "the", "effort", "to", "come", "up", "with", "xpath", "for", "each", "column", "s", "cells", ".", "Simply", "use", "this", "metho...
train
https://github.com/darcy-framework/darcy-web/blob/4e9b67c9f39d53fec5bf5ad40ddfdc828d9df472/src/main/java/com/redhat/darcy/web/HtmlTable.java#L193-L207
Mthwate/DatLib
src/main/java/com/mthwate/datlib/HashUtils.java
HashUtils.sha1Hex
public static String sha1Hex(String data, Charset charset) throws NoSuchAlgorithmException { return sha1Hex(data.getBytes(charset)); }
java
public static String sha1Hex(String data, Charset charset) throws NoSuchAlgorithmException { return sha1Hex(data.getBytes(charset)); }
[ "public", "static", "String", "sha1Hex", "(", "String", "data", ",", "Charset", "charset", ")", "throws", "NoSuchAlgorithmException", "{", "return", "sha1Hex", "(", "data", ".", "getBytes", "(", "charset", ")", ")", ";", "}" ]
Hashes a string using the SHA-1 algorithm. Returns a hexadecimal result. @since 1.1 @param data the string to hash @param charset the charset of the string @return the hexadecimal SHA-1 hash of the string @throws NoSuchAlgorithmException the algorithm is not supported by existing providers
[ "Hashes", "a", "string", "using", "the", "SHA", "-", "1", "algorithm", ".", "Returns", "a", "hexadecimal", "result", "." ]
train
https://github.com/Mthwate/DatLib/blob/f0b3a9f9cf6fdc773d4f86234ebd95986c9b6077/src/main/java/com/mthwate/datlib/HashUtils.java#L286-L288
igniterealtime/Smack
smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java
RosterEntry.toRosterItem
private static RosterPacket.Item toRosterItem(RosterEntry entry, String name, boolean includeAskAttribute) { RosterPacket.Item item = new RosterPacket.Item(entry.getJid(), name); item.setItemType(entry.getType()); if (includeAskAttribute) { item.setSubscriptionPending(entry.isSubscriptionPending()); } item.setApproved(entry.isApproved()); // Set the correct group names for the item. for (RosterGroup group : entry.getGroups()) { item.addGroupName(group.getName()); } return item; }
java
private static RosterPacket.Item toRosterItem(RosterEntry entry, String name, boolean includeAskAttribute) { RosterPacket.Item item = new RosterPacket.Item(entry.getJid(), name); item.setItemType(entry.getType()); if (includeAskAttribute) { item.setSubscriptionPending(entry.isSubscriptionPending()); } item.setApproved(entry.isApproved()); // Set the correct group names for the item. for (RosterGroup group : entry.getGroups()) { item.addGroupName(group.getName()); } return item; }
[ "private", "static", "RosterPacket", ".", "Item", "toRosterItem", "(", "RosterEntry", "entry", ",", "String", "name", ",", "boolean", "includeAskAttribute", ")", "{", "RosterPacket", ".", "Item", "item", "=", "new", "RosterPacket", ".", "Item", "(", "entry", "...
Convert a roster entry with the given name to a roster item. As per RFC 6121 § 2.1.2.2., clients MUST NOT include the 'ask' attribute, thus set {@code includeAskAttribute} to {@code false}. @param entry the roster entry. @param name the name of the roster item. @param includeAskAttribute whether or not to include the 'ask' attribute. @return the roster item.
[ "Convert", "a", "roster", "entry", "with", "the", "given", "name", "to", "a", "roster", "item", ".", "As", "per", "RFC", "6121", "§", "2", ".", "1", ".", "2", ".", "2", ".", "clients", "MUST", "NOT", "include", "the", "ask", "attribute", "thus", "s...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java#L319-L331
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAExEntityManager.java
JPAExEntityManager.toStringPuIds
private static final String toStringPuIds(String desc, JPAPuId[] puids) { StringBuilder sbuf = new StringBuilder(desc); sbuf.append('\n'); for (JPAPuId puid : puids) { sbuf.append(" ") .append(puid) .append('\n'); } return sbuf.toString(); }
java
private static final String toStringPuIds(String desc, JPAPuId[] puids) { StringBuilder sbuf = new StringBuilder(desc); sbuf.append('\n'); for (JPAPuId puid : puids) { sbuf.append(" ") .append(puid) .append('\n'); } return sbuf.toString(); }
[ "private", "static", "final", "String", "toStringPuIds", "(", "String", "desc", ",", "JPAPuId", "[", "]", "puids", ")", "{", "StringBuilder", "sbuf", "=", "new", "StringBuilder", "(", "desc", ")", ";", "sbuf", ".", "append", "(", "'", "'", ")", ";", "f...
Helper method to convert the input puids to a String for tr.debug().
[ "Helper", "method", "to", "convert", "the", "input", "puids", "to", "a", "String", "for", "tr", ".", "debug", "()", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAExEntityManager.java#L777-L788
pravega/pravega
common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java
BTreeIndex.processSplitPage
private void processSplitPage(List<BTreePage> splitResult, PageModificationContext context) { PageWrapper originalPage = context.getPageWrapper(); for (int i = 0; i < splitResult.size(); i++) { val page = splitResult.get(i); ByteArraySegment newPageKey; long newOffset; long minOffset; PageWrapper processedPage; if (i == 0) { // The original page will be replaced by the first split. Nothing changes about its pointer key. originalPage.setPage(page); newPageKey = originalPage.getPageKey(); context.getPageCollection().complete(originalPage); processedPage = originalPage; } else { // Insert the new pages and assign them new virtual offsets. Each page will use its first // Key as a Page Key. newPageKey = page.getKeyAt(0); processedPage = PageWrapper.wrapNew(page, originalPage.getParent(), new PagePointer(newPageKey, PagePointer.NO_OFFSET, page.getLength())); context.getPageCollection().insert(processedPage); context.getPageCollection().complete(processedPage); } // Fetch new offset, and update minimum offsets. newOffset = processedPage.getOffset(); minOffset = calculateMinOffset(processedPage); processedPage.setMinOffset(minOffset); // Record changes. context.updatePagePointer(new PagePointer(newPageKey, newOffset, page.getLength(), minOffset)); } }
java
private void processSplitPage(List<BTreePage> splitResult, PageModificationContext context) { PageWrapper originalPage = context.getPageWrapper(); for (int i = 0; i < splitResult.size(); i++) { val page = splitResult.get(i); ByteArraySegment newPageKey; long newOffset; long minOffset; PageWrapper processedPage; if (i == 0) { // The original page will be replaced by the first split. Nothing changes about its pointer key. originalPage.setPage(page); newPageKey = originalPage.getPageKey(); context.getPageCollection().complete(originalPage); processedPage = originalPage; } else { // Insert the new pages and assign them new virtual offsets. Each page will use its first // Key as a Page Key. newPageKey = page.getKeyAt(0); processedPage = PageWrapper.wrapNew(page, originalPage.getParent(), new PagePointer(newPageKey, PagePointer.NO_OFFSET, page.getLength())); context.getPageCollection().insert(processedPage); context.getPageCollection().complete(processedPage); } // Fetch new offset, and update minimum offsets. newOffset = processedPage.getOffset(); minOffset = calculateMinOffset(processedPage); processedPage.setMinOffset(minOffset); // Record changes. context.updatePagePointer(new PagePointer(newPageKey, newOffset, page.getLength(), minOffset)); } }
[ "private", "void", "processSplitPage", "(", "List", "<", "BTreePage", ">", "splitResult", ",", "PageModificationContext", "context", ")", "{", "PageWrapper", "originalPage", "=", "context", ".", "getPageWrapper", "(", ")", ";", "for", "(", "int", "i", "=", "0"...
Processes a Page Split result. The first split page will replace the existing page, while the remaining pages will need to be inserted as children into the parent. @param splitResult The result of the original BTreePage's splitIfNecessary() call. @param context Processing context.
[ "Processes", "a", "Page", "Split", "result", ".", "The", "first", "split", "page", "will", "replace", "the", "existing", "page", "while", "the", "remaining", "pages", "will", "need", "to", "be", "inserted", "as", "children", "into", "the", "parent", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L469-L500
Microsoft/malmo
Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MazeDecoratorImplementation.java
MazeDecoratorImplementation.distBetweenPoints
private int distBetweenPoints(int x1, int z1, int x2, int z2, boolean bAllowDiags) { // Total cells is the sum of the distances we need to travel along the x and the z axes, plus one for the end cell. int w = Math.abs(x2 - x1); int h = Math.abs(z2 - z1); if (bAllowDiags) { // Diagonal movement allows us ignore the shorter of w and h: if (w < h) w = 0; else h = 0; } return w + h + 1; }
java
private int distBetweenPoints(int x1, int z1, int x2, int z2, boolean bAllowDiags) { // Total cells is the sum of the distances we need to travel along the x and the z axes, plus one for the end cell. int w = Math.abs(x2 - x1); int h = Math.abs(z2 - z1); if (bAllowDiags) { // Diagonal movement allows us ignore the shorter of w and h: if (w < h) w = 0; else h = 0; } return w + h + 1; }
[ "private", "int", "distBetweenPoints", "(", "int", "x1", ",", "int", "z1", ",", "int", "x2", ",", "int", "z2", ",", "boolean", "bAllowDiags", ")", "{", "// Total cells is the sum of the distances we need to travel along the x and the z axes, plus one for the end cell.", "in...
Calculate the number of cells on the shortest path between (x1,z1) and (x2,z2) @param x1 @param z1 @param x2 @param z2 @param bAllowDiags Whether the cells are 8-connected or 4-connected. @return The number of cells on the shortest path, including start and end cells.
[ "Calculate", "the", "number", "of", "cells", "on", "the", "shortest", "path", "between", "(", "x1", "z1", ")", "and", "(", "x2", "z2", ")" ]
train
https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/MazeDecoratorImplementation.java#L754-L768
Jasig/uPortal
uPortal-web/src/main/java/org/apereo/portal/portlet/container/services/PortletCookieServiceImpl.java
PortletCookieServiceImpl.convertToCookie
protected Cookie convertToCookie(IPortalCookie portalCookie, boolean secure) { final Cookie cookie = new Cookie(this.cookieName, portalCookie.getValue()); // Set the cookie's fields cookie.setComment(this.comment); cookie.setMaxAge(this.maxAge); cookie.setSecure(secure); cookie.setHttpOnly(true); if (this.domain != null) { cookie.setDomain(this.domain); } cookie.setPath(this.path); return cookie; }
java
protected Cookie convertToCookie(IPortalCookie portalCookie, boolean secure) { final Cookie cookie = new Cookie(this.cookieName, portalCookie.getValue()); // Set the cookie's fields cookie.setComment(this.comment); cookie.setMaxAge(this.maxAge); cookie.setSecure(secure); cookie.setHttpOnly(true); if (this.domain != null) { cookie.setDomain(this.domain); } cookie.setPath(this.path); return cookie; }
[ "protected", "Cookie", "convertToCookie", "(", "IPortalCookie", "portalCookie", ",", "boolean", "secure", ")", "{", "final", "Cookie", "cookie", "=", "new", "Cookie", "(", "this", ".", "cookieName", ",", "portalCookie", ".", "getValue", "(", ")", ")", ";", "...
Convert the {@link IPortalCookie} into a servlet {@link Cookie}. @param portalCookie @return
[ "Convert", "the", "{", "@link", "IPortalCookie", "}", "into", "a", "servlet", "{", "@link", "Cookie", "}", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-web/src/main/java/org/apereo/portal/portlet/container/services/PortletCookieServiceImpl.java#L359-L374
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularDistortBase_F64.java
EquirectangularDistortBase_F64.compute
@Override public void compute(int x, int y, Point2D_F64 out ) { // grab precomputed normalized image coordinate at canonical location Point3D_F64 v = vectors[y*outWidth+x]; // move to requested orientation GeometryMath_F64.mult(R,v,n); // TODO make faster by not using an array based matrix // compute pixel coordinate tools.normToEquiFV(n.x,n.y,n.z,out); }
java
@Override public void compute(int x, int y, Point2D_F64 out ) { // grab precomputed normalized image coordinate at canonical location Point3D_F64 v = vectors[y*outWidth+x]; // move to requested orientation GeometryMath_F64.mult(R,v,n); // TODO make faster by not using an array based matrix // compute pixel coordinate tools.normToEquiFV(n.x,n.y,n.z,out); }
[ "@", "Override", "public", "void", "compute", "(", "int", "x", ",", "int", "y", ",", "Point2D_F64", "out", ")", "{", "// grab precomputed normalized image coordinate at canonical location", "Point3D_F64", "v", "=", "vectors", "[", "y", "*", "outWidth", "+", "x", ...
Input is in pinhole camera pixel coordinates. Output is in equirectangular coordinates @param x Pixel x-coordinate in rendered pinhole camera @param y Pixel y-coordinate in rendered pinhole camera
[ "Input", "is", "in", "pinhole", "camera", "pixel", "coordinates", ".", "Output", "is", "in", "equirectangular", "coordinates" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularDistortBase_F64.java#L107-L116
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.removeNodes
public void removeNodes(String poolId, NodeRemoveParameter nodeRemoveParameter) { removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter).toBlocking().single().body(); }
java
public void removeNodes(String poolId, NodeRemoveParameter nodeRemoveParameter) { removeNodesWithServiceResponseAsync(poolId, nodeRemoveParameter).toBlocking().single().body(); }
[ "public", "void", "removeNodes", "(", "String", "poolId", ",", "NodeRemoveParameter", "nodeRemoveParameter", ")", "{", "removeNodesWithServiceResponseAsync", "(", "poolId", ",", "nodeRemoveParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", ...
Removes compute nodes from the specified pool. This operation can only run when the allocation state of the pool is steady. When this operation runs, the allocation state changes from steady to resizing. @param poolId The ID of the pool from which you want to remove nodes. @param nodeRemoveParameter The parameters for the request. @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Removes", "compute", "nodes", "from", "the", "specified", "pool", ".", "This", "operation", "can", "only", "run", "when", "the", "allocation", "state", "of", "the", "pool", "is", "steady", ".", "When", "this", "operation", "runs", "the", "allocation", "stat...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L3404-L3406
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.endsWithAny
public static boolean endsWithAny(final CharSequence sequence, final CharSequence... searchStrings) { if (isEmpty(sequence) || ArrayUtils.isEmpty(searchStrings)) { return false; } for (final CharSequence searchString : searchStrings) { if (endsWith(sequence, searchString)) { return true; } } return false; }
java
public static boolean endsWithAny(final CharSequence sequence, final CharSequence... searchStrings) { if (isEmpty(sequence) || ArrayUtils.isEmpty(searchStrings)) { return false; } for (final CharSequence searchString : searchStrings) { if (endsWith(sequence, searchString)) { return true; } } return false; }
[ "public", "static", "boolean", "endsWithAny", "(", "final", "CharSequence", "sequence", ",", "final", "CharSequence", "...", "searchStrings", ")", "{", "if", "(", "isEmpty", "(", "sequence", ")", "||", "ArrayUtils", ".", "isEmpty", "(", "searchStrings", ")", "...
<p>Check if a CharSequence ends with any of the provided case-sensitive suffixes.</p> <pre> StringUtils.endsWithAny(null, null) = false StringUtils.endsWithAny(null, new String[] {"abc"}) = false StringUtils.endsWithAny("abcxyz", null) = false StringUtils.endsWithAny("abcxyz", new String[] {""}) = true StringUtils.endsWithAny("abcxyz", new String[] {"xyz"}) = true StringUtils.endsWithAny("abcxyz", new String[] {null, "xyz", "abc"}) = true StringUtils.endsWithAny("abcXYZ", "def", "XYZ") = true StringUtils.endsWithAny("abcXYZ", "def", "xyz") = false </pre> @param sequence the CharSequence to check, may be null @param searchStrings the case-sensitive CharSequences to find, may be empty or contain {@code null} @see StringUtils#endsWith(CharSequence, CharSequence) @return {@code true} if the input {@code sequence} is {@code null} AND no {@code searchStrings} are provided, or the input {@code sequence} ends in any of the provided case-sensitive {@code searchStrings}. @since 3.0
[ "<p", ">", "Check", "if", "a", "CharSequence", "ends", "with", "any", "of", "the", "provided", "case", "-", "sensitive", "suffixes", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8743-L8753
ical4j/ical4j
src/main/java/net/fortuna/ical4j/validate/PropertyValidator.java
PropertyValidator.assertOne
public void assertOne(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {propertyName}); } }
java
public void assertOne(final String propertyName, final PropertyList properties) throws ValidationException { if (properties.getProperties(propertyName).size() != 1) { throw new ValidationException(ASSERT_ONE_MESSAGE, new Object[] {propertyName}); } }
[ "public", "void", "assertOne", "(", "final", "String", "propertyName", ",", "final", "PropertyList", "properties", ")", "throws", "ValidationException", "{", "if", "(", "properties", ".", "getProperties", "(", "propertyName", ")", ".", "size", "(", ")", "!=", ...
Ensure a property occurs once. @param propertyName the property name @param properties a list of properties to query @throws ValidationException when the specified property does not occur once
[ "Ensure", "a", "property", "occurs", "once", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/validate/PropertyValidator.java#L107-L113
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.eachLine
public static <T> T eachLine(Reader self, int firstLine, @ClosureParams(value=FromString.class,options={"String","String,Integer"}) Closure<T> closure) throws IOException { BufferedReader br; int count = firstLine; T result = null; if (self instanceof BufferedReader) br = (BufferedReader) self; else br = new BufferedReader(self); try { while (true) { String line = br.readLine(); if (line == null) { break; } else { result = callClosureForLine(closure, line, count); count++; } } Reader temp = self; self = null; temp.close(); return result; } finally { closeWithWarning(self); closeWithWarning(br); } }
java
public static <T> T eachLine(Reader self, int firstLine, @ClosureParams(value=FromString.class,options={"String","String,Integer"}) Closure<T> closure) throws IOException { BufferedReader br; int count = firstLine; T result = null; if (self instanceof BufferedReader) br = (BufferedReader) self; else br = new BufferedReader(self); try { while (true) { String line = br.readLine(); if (line == null) { break; } else { result = callClosureForLine(closure, line, count); count++; } } Reader temp = self; self = null; temp.close(); return result; } finally { closeWithWarning(self); closeWithWarning(br); } }
[ "public", "static", "<", "T", ">", "T", "eachLine", "(", "Reader", "self", ",", "int", "firstLine", ",", "@", "ClosureParams", "(", "value", "=", "FromString", ".", "class", ",", "options", "=", "{", "\"String\"", ",", "\"String,Integer\"", "}", ")", "Cl...
Iterates through the given reader line by line. Each line is passed to the given 1 or 2 arg closure. If the closure has two arguments, the line count is passed as the second argument. The Reader is closed before this method returns. @param self a Reader, closed after the method returns @param firstLine the line number value used for the first line (default is 1, set to 0 to start counting from 0) @param closure a closure which will be passed each line (or for 2 arg closures the line and line count) @return the last value returned by the closure @throws IOException if an IOException occurs. @since 1.5.7
[ "Iterates", "through", "the", "given", "reader", "line", "by", "line", ".", "Each", "line", "is", "passed", "to", "the", "given", "1", "or", "2", "arg", "closure", ".", "If", "the", "closure", "has", "two", "arguments", "the", "line", "count", "is", "p...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L441-L469
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validation/AbstractWFieldIndicator.java
AbstractWFieldIndicator.showIndicatorsForComponent
protected void showIndicatorsForComponent(final List<Diagnostic> diags, final int severity) { FieldIndicatorModel model = getComponentModel(); if (model != null && !model.diagnostics.isEmpty()) { model = getOrCreateComponentModel(); model.diagnostics.clear(); } if (diags != null && !diags.isEmpty()) { model = getOrCreateComponentModel(); UIContext uic = UIContextHolder.getCurrent(); for (int i = 0; i < diags.size(); i++) { Diagnostic diagnostic = diags.get(i); if (diagnostic.getSeverity() == severity && uic == diagnostic.getContext() // To support repeated components. && relatedField == diagnostic.getComponent()) { model.diagnostics.add(diagnostic); } } } }
java
protected void showIndicatorsForComponent(final List<Diagnostic> diags, final int severity) { FieldIndicatorModel model = getComponentModel(); if (model != null && !model.diagnostics.isEmpty()) { model = getOrCreateComponentModel(); model.diagnostics.clear(); } if (diags != null && !diags.isEmpty()) { model = getOrCreateComponentModel(); UIContext uic = UIContextHolder.getCurrent(); for (int i = 0; i < diags.size(); i++) { Diagnostic diagnostic = diags.get(i); if (diagnostic.getSeverity() == severity && uic == diagnostic.getContext() // To support repeated components. && relatedField == diagnostic.getComponent()) { model.diagnostics.add(diagnostic); } } } }
[ "protected", "void", "showIndicatorsForComponent", "(", "final", "List", "<", "Diagnostic", ">", "diags", ",", "final", "int", "severity", ")", "{", "FieldIndicatorModel", "model", "=", "getComponentModel", "(", ")", ";", "if", "(", "model", "!=", "null", "&&"...
Iterates over the {@link Diagnostic}s and finds the diagnostics that related to {@link #relatedField}. @param diags A List of Diagnostic objects. @param severity A Diagnostic severity code. e.g. {@link Diagnostic#ERROR}
[ "Iterates", "over", "the", "{", "@link", "Diagnostic", "}", "s", "and", "finds", "the", "diagnostics", "that", "related", "to", "{", "@link", "#relatedField", "}", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/validation/AbstractWFieldIndicator.java#L54-L76
sworisbreathing/sfmf4j
sfmf4j-nio2/src/main/java/com/github/sworisbreathing/sfmf4j/nio2/WatchServiceFileMonitorServiceImpl.java
WatchServiceFileMonitorServiceImpl.resolveEventWithCorrectPath
private synchronized WatchEvent<Path> resolveEventWithCorrectPath(final WatchKey key, final WatchEvent<Path> event) { Path correctPath = Paths.get(pathsByWatchKey.get(key)); return new ResolvedPathWatchEvent(event, correctPath); }
java
private synchronized WatchEvent<Path> resolveEventWithCorrectPath(final WatchKey key, final WatchEvent<Path> event) { Path correctPath = Paths.get(pathsByWatchKey.get(key)); return new ResolvedPathWatchEvent(event, correctPath); }
[ "private", "synchronized", "WatchEvent", "<", "Path", ">", "resolveEventWithCorrectPath", "(", "final", "WatchKey", "key", ",", "final", "WatchEvent", "<", "Path", ">", "event", ")", "{", "Path", "correctPath", "=", "Paths", ".", "get", "(", "pathsByWatchKey", ...
Resolves a watch event with its absolute path. @param key the watch key (used to look up the parent path) @param event the event to resolve @return a copy of the event, with a resolved path
[ "Resolves", "a", "watch", "event", "with", "its", "absolute", "path", "." ]
train
https://github.com/sworisbreathing/sfmf4j/blob/826c2c02af69d55f98e64fbcfae23d0c7bac3f19/sfmf4j-nio2/src/main/java/com/github/sworisbreathing/sfmf4j/nio2/WatchServiceFileMonitorServiceImpl.java#L201-L204
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/Sketches.java
Sketches.getUpperBound
public static double getUpperBound(final int numStdDev, final Memory srcMem) { return Sketch.upperBound(getRetainedEntries(srcMem), getThetaLong(srcMem), numStdDev, getEmpty(srcMem)); }
java
public static double getUpperBound(final int numStdDev, final Memory srcMem) { return Sketch.upperBound(getRetainedEntries(srcMem), getThetaLong(srcMem), numStdDev, getEmpty(srcMem)); }
[ "public", "static", "double", "getUpperBound", "(", "final", "int", "numStdDev", ",", "final", "Memory", "srcMem", ")", "{", "return", "Sketch", ".", "upperBound", "(", "getRetainedEntries", "(", "srcMem", ")", ",", "getThetaLong", "(", "srcMem", ")", ",", "...
Gets the approximate upper error bound from a valid memory image of a Sketch given the specified number of Standard Deviations. This will return getEstimate() if isEmpty() is true. @param numStdDev <a href="{@docRoot}/resources/dictionary.html#numStdDev">See Number of Standard Deviations</a> @param srcMem <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @return the upper bound.
[ "Gets", "the", "approximate", "upper", "error", "bound", "from", "a", "valid", "memory", "image", "of", "a", "Sketch", "given", "the", "specified", "number", "of", "Standard", "Deviations", ".", "This", "will", "return", "getEstimate", "()", "if", "isEmpty", ...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/Sketches.java#L296-L298