repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/util/FileUtils.java
FileUtils.getVideoThumbnail
public static void getVideoThumbnail(String videoPath, final VideoThumbnailCallback cb){ new AsyncTask<String, Void, Bitmap>(){ @Override protected Bitmap doInBackground(String... params) { if(params.length > 0) { String path = params[0]; if(!TextUtils.isEmpty(path)){ return getVideoThumbnail(path); } } return null; } @Override protected void onPostExecute(Bitmap bitmap) { cb.onThumbnail(bitmap); } }.execute(videoPath); }
java
public static void getVideoThumbnail(String videoPath, final VideoThumbnailCallback cb){ new AsyncTask<String, Void, Bitmap>(){ @Override protected Bitmap doInBackground(String... params) { if(params.length > 0) { String path = params[0]; if(!TextUtils.isEmpty(path)){ return getVideoThumbnail(path); } } return null; } @Override protected void onPostExecute(Bitmap bitmap) { cb.onThumbnail(bitmap); } }.execute(videoPath); }
[ "public", "static", "void", "getVideoThumbnail", "(", "String", "videoPath", ",", "final", "VideoThumbnailCallback", "cb", ")", "{", "new", "AsyncTask", "<", "String", ",", "Void", ",", "Bitmap", ">", "(", ")", "{", "@", "Override", "protected", "Bitmap", "d...
Get the thumbnail of a video asynchronously @param videoPath the path to the video @param cb the callback
[ "Get", "the", "thumbnail", "of", "a", "video", "asynchronously" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/FileUtils.java#L314-L332
webmetrics/browsermob-proxy
src/main/java/cz/mallat/uasparser/UASparser.java
UASparser.processRobot
private boolean processRobot(String useragent, UserAgentInfo retObj) { try { lock.lock(); if (robotsMap.containsKey(useragent)) { retObj.setTyp("Robot"); RobotEntry robotEntry = robotsMap.get(useragent); robotEntry.copyTo(retObj); if (robotEntry.getOsId() != null) { OsEntry os = osMap.get(robotEntry.getOsId()); if (os != null) { os.copyTo(retObj); } } return true; } } finally { lock.unlock(); } return false; }
java
private boolean processRobot(String useragent, UserAgentInfo retObj) { try { lock.lock(); if (robotsMap.containsKey(useragent)) { retObj.setTyp("Robot"); RobotEntry robotEntry = robotsMap.get(useragent); robotEntry.copyTo(retObj); if (robotEntry.getOsId() != null) { OsEntry os = osMap.get(robotEntry.getOsId()); if (os != null) { os.copyTo(retObj); } } return true; } } finally { lock.unlock(); } return false; }
[ "private", "boolean", "processRobot", "(", "String", "useragent", ",", "UserAgentInfo", "retObj", ")", "{", "try", "{", "lock", ".", "lock", "(", ")", ";", "if", "(", "robotsMap", ".", "containsKey", "(", "useragent", ")", ")", "{", "retObj", ".", "setTy...
Checks if the useragent comes from a robot. if yes copies all the data to the result object @param useragent @param retObj @return true if the useragent belongs to a robot, else false
[ "Checks", "if", "the", "useragent", "comes", "from", "a", "robot", ".", "if", "yes", "copies", "all", "the", "data", "to", "the", "result", "object" ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/cz/mallat/uasparser/UASparser.java#L208-L228
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java
DataModelSerializer.serializeAsJson
public static JsonValue serializeAsJson(Object o) throws IOException { try { return findFieldsToSerialize(o).mainObject; } catch (IllegalStateException ise) { // the reflective attempt to build the object failed. throw new IOException("Unable to build JSON for Object", ise); } catch (JsonException e) { throw new IOException("Unable to build JSON for Object", e); } }
java
public static JsonValue serializeAsJson(Object o) throws IOException { try { return findFieldsToSerialize(o).mainObject; } catch (IllegalStateException ise) { // the reflective attempt to build the object failed. throw new IOException("Unable to build JSON for Object", ise); } catch (JsonException e) { throw new IOException("Unable to build JSON for Object", e); } }
[ "public", "static", "JsonValue", "serializeAsJson", "(", "Object", "o", ")", "throws", "IOException", "{", "try", "{", "return", "findFieldsToSerialize", "(", "o", ")", ".", "mainObject", ";", "}", "catch", "(", "IllegalStateException", "ise", ")", "{", "// th...
Convert a POJO into a serialized JsonValue object @param o the POJO to serialize @return
[ "Convert", "a", "POJO", "into", "a", "serialized", "JsonValue", "object" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java#L349-L358
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.setNumericName
public boolean setNumericName(String name, int i) { if(i < getNumNumericalVars() && i >= 0) numericalVariableNames.put(i, name); else return false; return true; }
java
public boolean setNumericName(String name, int i) { if(i < getNumNumericalVars() && i >= 0) numericalVariableNames.put(i, name); else return false; return true; }
[ "public", "boolean", "setNumericName", "(", "String", "name", ",", "int", "i", ")", "{", "if", "(", "i", "<", "getNumNumericalVars", "(", ")", "&&", "i", ">=", "0", ")", "numericalVariableNames", ".", "put", "(", "i", ",", "name", ")", ";", "else", "...
Sets the unique name associated with the <tt>i</tt>'th numeric attribute. All strings will be converted to lower case first. @param name the name to use @param i the <tt>i</tt>th attribute. @return <tt>true</tt> if the value was set, <tt>false</tt> if it was not set because an invalid index was given .
[ "Sets", "the", "unique", "name", "associated", "with", "the", "<tt", ">", "i<", "/", "tt", ">", "th", "numeric", "attribute", ".", "All", "strings", "will", "be", "converted", "to", "lower", "case", "first", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L133-L141
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java
TokenUtils.generateTokenString
public static String generateTokenString(String jsonResName, Set<InvalidClaims> invalidClaims) throws Exception { return generateTokenString(jsonResName, invalidClaims, null); }
java
public static String generateTokenString(String jsonResName, Set<InvalidClaims> invalidClaims) throws Exception { return generateTokenString(jsonResName, invalidClaims, null); }
[ "public", "static", "String", "generateTokenString", "(", "String", "jsonResName", ",", "Set", "<", "InvalidClaims", ">", "invalidClaims", ")", "throws", "Exception", "{", "return", "generateTokenString", "(", "jsonResName", ",", "invalidClaims", ",", "null", ")", ...
Utility method to generate a JWT string from a JSON resource file that is signed by the privateKey.pem test resource key, possibly with invalid fields. @param jsonResName - name of test resources file @param invalidClaims - the set of claims that should be added with invalid values to test failure modes @return the JWT string @throws Exception on parse failure
[ "Utility", "method", "to", "generate", "a", "JWT", "string", "from", "a", "JSON", "resource", "file", "that", "is", "signed", "by", "the", "privateKey", ".", "pem", "test", "resource", "key", "possibly", "with", "invalid", "fields", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat_tck/fat/src/org/eclipse/microprofile/jwt/tck/util/TokenUtils.java#L81-L83
Wikidata/Wikidata-Toolkit
wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java
Datamodel.makePropertyIdValue
public static PropertyIdValue makePropertyIdValue(String id, String siteIri) { return factory.getPropertyIdValue(id, siteIri); }
java
public static PropertyIdValue makePropertyIdValue(String id, String siteIri) { return factory.getPropertyIdValue(id, siteIri); }
[ "public", "static", "PropertyIdValue", "makePropertyIdValue", "(", "String", "id", ",", "String", "siteIri", ")", "{", "return", "factory", ".", "getPropertyIdValue", "(", "id", ",", "siteIri", ")", ";", "}" ]
Creates a {@link PropertyIdValue}. @param id a string of the form Pn... where n... is the string representation of a positive integer number @param siteIri IRI to identify the site, usually the first part of the entity IRI of the site this belongs to, e.g., "http://www.wikidata.org/entity/" @return a {@link PropertyIdValue} corresponding to the input
[ "Creates", "a", "{", "@link", "PropertyIdValue", "}", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java#L86-L88
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.refund_GET
public ArrayList<String> refund_GET(Date date_from, Date date_to, Long orderId) throws IOException { String qPath = "/me/refund"; StringBuilder sb = path(qPath); query(sb, "date.from", date_from); query(sb, "date.to", date_to); query(sb, "orderId", orderId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> refund_GET(Date date_from, Date date_to, Long orderId) throws IOException { String qPath = "/me/refund"; StringBuilder sb = path(qPath); query(sb, "date.from", date_from); query(sb, "date.to", date_to); query(sb, "orderId", orderId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "refund_GET", "(", "Date", "date_from", ",", "Date", "date_to", ",", "Long", "orderId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/refund\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPa...
List of all the refunds the logged account has REST: GET /me/refund @param date_from [required] Filter the value of date property (>=) @param date_to [required] Filter the value of date property (<=) @param orderId [required] Filter the value of orderId property (=)
[ "List", "of", "all", "the", "refunds", "the", "logged", "account", "has" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1451-L1459
alexruiz/fest-reflect
src/main/java/org/fest/reflect/util/Types.java
Types.castSafely
public static <T> T castSafely(@Nullable Object o, @NotNull Class<T> type) { checkNotNull(type); if (type.isPrimitive()) { return getWrapperType(type).cast(o); } return type.cast(o); }
java
public static <T> T castSafely(@Nullable Object o, @NotNull Class<T> type) { checkNotNull(type); if (type.isPrimitive()) { return getWrapperType(type).cast(o); } return type.cast(o); }
[ "public", "static", "<", "T", ">", "T", "castSafely", "(", "@", "Nullable", "Object", "o", ",", "@", "NotNull", "Class", "<", "T", ">", "type", ")", "{", "checkNotNull", "(", "type", ")", ";", "if", "(", "type", ".", "isPrimitive", "(", ")", ")", ...
Casts the given object to the given type. This method handles primitive types properly. @param o the object to cast. @param type the type to cast the given object to. @return the given object casted to the given type.
[ "Casts", "the", "given", "object", "to", "the", "given", "type", ".", "This", "method", "handles", "primitive", "types", "properly", "." ]
train
https://github.com/alexruiz/fest-reflect/blob/6db30716808633ef880e439b3dc6602ecb3f1b08/src/main/java/org/fest/reflect/util/Types.java#L54-L60
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java
GerritJsonEventFactory.getString
public static String getString(JSONObject json, String key) { return getString(json, key, null); }
java
public static String getString(JSONObject json, String key) { return getString(json, key, null); }
[ "public", "static", "String", "getString", "(", "JSONObject", "json", ",", "String", "key", ")", "{", "return", "getString", "(", "json", ",", "key", ",", "null", ")", ";", "}" ]
Returns the value of a JSON property as a String if it exists otherwise returns null. Same as calling {@link #getString(net.sf.json.JSONObject, java.lang.String, java.lang.String) } with null as defaultValue. @param json the JSONObject to check. @param key the key. @return the value for the key as a string.
[ "Returns", "the", "value", "of", "a", "JSON", "property", "as", "a", "String", "if", "it", "exists", "otherwise", "returns", "null", ".", "Same", "as", "calling", "{" ]
train
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java#L221-L223
srikalyc/Sql4D
Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Util.java
Util.applyKVToBean
public static void applyKVToBean(Object bean, String key, Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Method getterMethod = bean.getClass().getMethod(Util.getterMethodName(key)); Method setterMethod = bean.getClass().getMethod(Util.setterMethodName(key), getterMethod.getReturnType()); setterMethod.invoke(bean, value); }
java
public static void applyKVToBean(Object bean, String key, Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Method getterMethod = bean.getClass().getMethod(Util.getterMethodName(key)); Method setterMethod = bean.getClass().getMethod(Util.setterMethodName(key), getterMethod.getReturnType()); setterMethod.invoke(bean, value); }
[ "public", "static", "void", "applyKVToBean", "(", "Object", "bean", ",", "String", "key", ",", "Object", "value", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", "{", "Method", "...
More granular(sets the property of a bean based on a key value). @param bean @param key @param value @throws NoSuchMethodException @throws IllegalAccessException @throws IllegalArgumentException @throws InvocationTargetException
[ "More", "granular", "(", "sets", "the", "property", "of", "a", "bean", "based", "on", "a", "key", "value", ")", "." ]
train
https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/Util.java#L252-L256
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/WebUtils.java
WebUtils.getWebElements
public ArrayList<WebElement> getWebElements(final By by, boolean onlySufficientlyVisbile){ boolean javaScriptWasExecuted = executeJavaScript(by, false); if(config.useJavaScriptToClickWebElements){ if(!javaScriptWasExecuted){ return new ArrayList<WebElement>(); } return webElementCreator.getWebElementsFromWebViews(); } return getWebElements(javaScriptWasExecuted, onlySufficientlyVisbile); }
java
public ArrayList<WebElement> getWebElements(final By by, boolean onlySufficientlyVisbile){ boolean javaScriptWasExecuted = executeJavaScript(by, false); if(config.useJavaScriptToClickWebElements){ if(!javaScriptWasExecuted){ return new ArrayList<WebElement>(); } return webElementCreator.getWebElementsFromWebViews(); } return getWebElements(javaScriptWasExecuted, onlySufficientlyVisbile); }
[ "public", "ArrayList", "<", "WebElement", ">", "getWebElements", "(", "final", "By", "by", ",", "boolean", "onlySufficientlyVisbile", ")", "{", "boolean", "javaScriptWasExecuted", "=", "executeJavaScript", "(", "by", ",", "false", ")", ";", "if", "(", "config", ...
Returns an ArrayList of WebElements of the specified By object currently shown in the active WebView. @param by the By object. Examples are By.id("id") and By.name("name") @param onlySufficientlyVisible true if only sufficiently visible {@link WebElement} objects should be returned @return an {@code ArrayList} of the {@link WebElement} objects currently shown in the active WebView
[ "Returns", "an", "ArrayList", "of", "WebElements", "of", "the", "specified", "By", "object", "currently", "shown", "in", "the", "active", "WebView", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/WebUtils.java#L106-L117
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java
AbstractManagedConnectionPool.removeConnectionListener
protected ConnectionListener removeConnectionListener(boolean free, Collection<ConnectionListener> listeners) { if (free) { for (ConnectionListener cl : listeners) { if (cl.changeState(FREE, IN_USE)) return cl; } } else { for (ConnectionListener cl : listeners) { if (cl.getState() == IN_USE) return cl; } } return null; }
java
protected ConnectionListener removeConnectionListener(boolean free, Collection<ConnectionListener> listeners) { if (free) { for (ConnectionListener cl : listeners) { if (cl.changeState(FREE, IN_USE)) return cl; } } else { for (ConnectionListener cl : listeners) { if (cl.getState() == IN_USE) return cl; } } return null; }
[ "protected", "ConnectionListener", "removeConnectionListener", "(", "boolean", "free", ",", "Collection", "<", "ConnectionListener", ">", "listeners", ")", "{", "if", "(", "free", ")", "{", "for", "(", "ConnectionListener", "cl", ":", "listeners", ")", "{", "if"...
Remove a free ConnectionListener instance @param free True if FREE, false if IN_USE @param listeners The listeners @return The ConnectionListener, or <code>null</code>
[ "Remove", "a", "free", "ConnectionListener", "instance" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/connectionmanager/pool/AbstractManagedConnectionPool.java#L207-L227
Hygieia/Hygieia
collectors/build/jenkins/src/main/java/com/capitalone/dashboard/collector/DefaultHudsonClient.java
DefaultHudsonClient.addChangeSet
private void addChangeSet(Build build, JSONObject changeSet, Set<String> commitIds, Set<String> revisions) { String scmType = getString(changeSet, "kind"); Map<String, RepoBranch> revisionToUrl = new HashMap<>(); // Build a map of revision to module (scm url). This is not always // provided by the Hudson API, but we can use it if available. // For git, this map is empty. for (Object revision : getJsonArray(changeSet, "revisions")) { JSONObject json = (JSONObject) revision; String revisionId = json.get("revision").toString(); if (StringUtils.isNotEmpty(revisionId) && !revisions.contains(revisionId)) { RepoBranch rb = new RepoBranch(); rb.setUrl(getString(json, "module")); rb.setType(RepoBranch.RepoType.fromString(scmType)); revisionToUrl.put(revisionId, rb); build.getCodeRepos().add(rb); } } for (Object item : getJsonArray(changeSet, "items")) { JSONObject jsonItem = (JSONObject) item; String commitId = getRevision(jsonItem); if (StringUtils.isNotEmpty(commitId) && !commitIds.contains(commitId)) { SCM scm = new SCM(); scm.setScmAuthor(getCommitAuthor(jsonItem)); scm.setScmCommitLog(getString(jsonItem, "msg")); scm.setScmCommitTimestamp(getCommitTimestamp(jsonItem)); scm.setScmRevisionNumber(commitId); RepoBranch repoBranch = revisionToUrl.get(scm.getScmRevisionNumber()); if (repoBranch != null) { scm.setScmUrl(repoBranch.getUrl()); scm.setScmBranch(repoBranch.getBranch()); } scm.setNumberOfChanges(getJsonArray(jsonItem, "paths").size()); build.getSourceChangeSet().add(scm); commitIds.add(commitId); } } }
java
private void addChangeSet(Build build, JSONObject changeSet, Set<String> commitIds, Set<String> revisions) { String scmType = getString(changeSet, "kind"); Map<String, RepoBranch> revisionToUrl = new HashMap<>(); // Build a map of revision to module (scm url). This is not always // provided by the Hudson API, but we can use it if available. // For git, this map is empty. for (Object revision : getJsonArray(changeSet, "revisions")) { JSONObject json = (JSONObject) revision; String revisionId = json.get("revision").toString(); if (StringUtils.isNotEmpty(revisionId) && !revisions.contains(revisionId)) { RepoBranch rb = new RepoBranch(); rb.setUrl(getString(json, "module")); rb.setType(RepoBranch.RepoType.fromString(scmType)); revisionToUrl.put(revisionId, rb); build.getCodeRepos().add(rb); } } for (Object item : getJsonArray(changeSet, "items")) { JSONObject jsonItem = (JSONObject) item; String commitId = getRevision(jsonItem); if (StringUtils.isNotEmpty(commitId) && !commitIds.contains(commitId)) { SCM scm = new SCM(); scm.setScmAuthor(getCommitAuthor(jsonItem)); scm.setScmCommitLog(getString(jsonItem, "msg")); scm.setScmCommitTimestamp(getCommitTimestamp(jsonItem)); scm.setScmRevisionNumber(commitId); RepoBranch repoBranch = revisionToUrl.get(scm.getScmRevisionNumber()); if (repoBranch != null) { scm.setScmUrl(repoBranch.getUrl()); scm.setScmBranch(repoBranch.getBranch()); } scm.setNumberOfChanges(getJsonArray(jsonItem, "paths").size()); build.getSourceChangeSet().add(scm); commitIds.add(commitId); } } }
[ "private", "void", "addChangeSet", "(", "Build", "build", ",", "JSONObject", "changeSet", ",", "Set", "<", "String", ">", "commitIds", ",", "Set", "<", "String", ">", "revisions", ")", "{", "String", "scmType", "=", "getString", "(", "changeSet", ",", "\"k...
Grabs changeset information for the given build. @param build a Build @param changeSet the build JSON object @param commitIds the commitIds @param revisions the revisions
[ "Grabs", "changeset", "information", "for", "the", "given", "build", "." ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/build/jenkins/src/main/java/com/capitalone/dashboard/collector/DefaultHudsonClient.java#L405-L444
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_abbreviatedNumber_abbreviatedNumber_GET
public OvhAbbreviatedNumber billingAccount_line_serviceName_abbreviatedNumber_abbreviatedNumber_GET(String billingAccount, String serviceName, Long abbreviatedNumber) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/abbreviatedNumber/{abbreviatedNumber}"; StringBuilder sb = path(qPath, billingAccount, serviceName, abbreviatedNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAbbreviatedNumber.class); }
java
public OvhAbbreviatedNumber billingAccount_line_serviceName_abbreviatedNumber_abbreviatedNumber_GET(String billingAccount, String serviceName, Long abbreviatedNumber) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/abbreviatedNumber/{abbreviatedNumber}"; StringBuilder sb = path(qPath, billingAccount, serviceName, abbreviatedNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAbbreviatedNumber.class); }
[ "public", "OvhAbbreviatedNumber", "billingAccount_line_serviceName_abbreviatedNumber_abbreviatedNumber_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "abbreviatedNumber", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony...
Get this object properties REST: GET /telephony/{billingAccount}/line/{serviceName}/abbreviatedNumber/{abbreviatedNumber} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param abbreviatedNumber [required] The abbreviated number which must start with "2" and must have a length of 3 or 4 digits
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1592-L1597
Backendless/Android-SDK
src/com/backendless/utils/MapEntityUtil.java
MapEntityUtil.removeNullsAndRelations
public static void removeNullsAndRelations( Map<String, Object> entityMap ) { Iterator<Map.Entry<String, Object>> entryIterator = entityMap.entrySet().iterator(); while( entryIterator.hasNext() ) { Map.Entry<String, Object> entry = entryIterator.next(); if( !isSystemField( entry ) ) { if( isNullField( entry ) || isRelationField( entry ) ) { entryIterator.remove(); } } } }
java
public static void removeNullsAndRelations( Map<String, Object> entityMap ) { Iterator<Map.Entry<String, Object>> entryIterator = entityMap.entrySet().iterator(); while( entryIterator.hasNext() ) { Map.Entry<String, Object> entry = entryIterator.next(); if( !isSystemField( entry ) ) { if( isNullField( entry ) || isRelationField( entry ) ) { entryIterator.remove(); } } } }
[ "public", "static", "void", "removeNullsAndRelations", "(", "Map", "<", "String", ",", "Object", ">", "entityMap", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "Object", ">", ">", "entryIterator", "=", "entityMap", ".", "entrySet", "...
Removes relations and {@code null} fields (except system ones) from {@code entityMap}. System fields like "created", "updated", "__meta" etc. are not removed if {@code null}. @param entityMap entity object to clean up
[ "Removes", "relations", "and", "{", "@code", "null", "}", "fields", "(", "except", "system", "ones", ")", "from", "{", "@code", "entityMap", "}", ".", "System", "fields", "like", "created", "updated", "__meta", "etc", ".", "are", "not", "removed", "if", ...
train
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/utils/MapEntityUtil.java#L22-L36
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java
CmsSetupXmlHelper.setAttribute
public boolean setAttribute(String xmlFilename, String xPath, String attribute, String value) throws CmsXmlException { return setAttribute(getDocument(xmlFilename), xPath, attribute, value); }
java
public boolean setAttribute(String xmlFilename, String xPath, String attribute, String value) throws CmsXmlException { return setAttribute(getDocument(xmlFilename), xPath, attribute, value); }
[ "public", "boolean", "setAttribute", "(", "String", "xmlFilename", ",", "String", "xPath", ",", "String", "attribute", ",", "String", "value", ")", "throws", "CmsXmlException", "{", "return", "setAttribute", "(", "getDocument", "(", "xmlFilename", ")", ",", "xPa...
Replaces a attibute's value in the given node addressed by the xPath.<p> @param xmlFilename the xml file name to get the document from @param xPath the xPath to the node @param attribute the attribute to replace the value of @param value the new value to set @return <code>true</code> if successful <code>false</code> otherwise @throws CmsXmlException if the xml document coudn't be read
[ "Replaces", "a", "attibute", "s", "value", "in", "the", "given", "node", "addressed", "by", "the", "xPath", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java#L442-L446
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/appdev/AppPackageUrl.java
AppPackageUrl.updatePackageUrl
public static MozuUrl updatePackageUrl(String applicationKey, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/apppackages/{applicationKey}/?responseFields={responseFields}"); formatter.formatUrl("applicationKey", applicationKey); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updatePackageUrl(String applicationKey, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/apppackages/{applicationKey}/?responseFields={responseFields}"); formatter.formatUrl("applicationKey", applicationKey); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updatePackageUrl", "(", "String", "applicationKey", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/appdev/apppackages/{applicationKey}/?responseFields={responseFields}\"", ...
Get Resource Url for UpdatePackage @param applicationKey The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdatePackage" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/appdev/AppPackageUrl.java#L156-L162
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/EchoActionRule.java
EchoActionRule.newInstance
public static EchoActionRule newInstance(String id, Boolean hidden) { EchoActionRule echoActionRule = new EchoActionRule(); echoActionRule.setActionId(id); echoActionRule.setHidden(hidden); return echoActionRule; }
java
public static EchoActionRule newInstance(String id, Boolean hidden) { EchoActionRule echoActionRule = new EchoActionRule(); echoActionRule.setActionId(id); echoActionRule.setHidden(hidden); return echoActionRule; }
[ "public", "static", "EchoActionRule", "newInstance", "(", "String", "id", ",", "Boolean", "hidden", ")", "{", "EchoActionRule", "echoActionRule", "=", "new", "EchoActionRule", "(", ")", ";", "echoActionRule", ".", "setActionId", "(", "id", ")", ";", "echoActionR...
Returns a new derived instance of EchoActionRule. @param id the action id @param hidden whether to hide result of the action @return the echo action rule
[ "Returns", "a", "new", "derived", "instance", "of", "EchoActionRule", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/EchoActionRule.java#L140-L145
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.getString
public String getString(String name, String defaultValue) { String value = getProperties().getProperty(name, defaultValue); value = overrides.getProperty(name, value); return value; }
java
public String getString(String name, String defaultValue) { String value = getProperties().getProperty(name, defaultValue); value = overrides.getProperty(name, value); return value; }
[ "public", "String", "getString", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "getProperties", "(", ")", ".", "getProperty", "(", "name", ",", "defaultValue", ")", ";", "value", "=", "overrides", ".", "getProperty",...
Returns the string value for the specified name. If the name does not exist or the value for the name can not be interpreted as a string, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue
[ "Returns", "the", "string", "value", "for", "the", "specified", "name", ".", "If", "the", "name", "does", "not", "exist", "or", "the", "value", "for", "the", "name", "can", "not", "be", "interpreted", "as", "a", "string", "the", "defaultValue", "is", "re...
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L448-L453
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/GreenPepperServerConfigurationActivator.java
GreenPepperServerConfigurationActivator.initCustomInstallConfiguration
public void initCustomInstallConfiguration(String hibernateDialect, String jndiUrl) throws GreenPepperServerException { GreenPepperServerConfiguration configuration = getConfiguration(); Properties properties = new DefaultServerProperties(); properties.put("hibernate.connection.datasource", jndiUrl); properties.put("config$hibernate.connection.datasource", jndiUrl); properties.put("hibernate.dialect", hibernateDialect); properties.put("config$hibernate.dialect", hibernateDialect); // properties.put("hibernate.show_sql", "true"); if (hibernateDialect.indexOf("Oracle") != -1) { // The Oracle JDBC driver doesn't like prepared statement caching very much. properties.put("hibernate.statement_cache.size", "0"); // or baching with BLOBs very much. properties.put("hibernate.jdbc.batch_size", "0"); // http://www.jroller.com/dashorst/entry/hibernate_3_1_something_performance1 properties.put("hibernate.jdbc.wrap_result_sets", "true"); } configuration.setProperties(properties); startup(true); }
java
public void initCustomInstallConfiguration(String hibernateDialect, String jndiUrl) throws GreenPepperServerException { GreenPepperServerConfiguration configuration = getConfiguration(); Properties properties = new DefaultServerProperties(); properties.put("hibernate.connection.datasource", jndiUrl); properties.put("config$hibernate.connection.datasource", jndiUrl); properties.put("hibernate.dialect", hibernateDialect); properties.put("config$hibernate.dialect", hibernateDialect); // properties.put("hibernate.show_sql", "true"); if (hibernateDialect.indexOf("Oracle") != -1) { // The Oracle JDBC driver doesn't like prepared statement caching very much. properties.put("hibernate.statement_cache.size", "0"); // or baching with BLOBs very much. properties.put("hibernate.jdbc.batch_size", "0"); // http://www.jroller.com/dashorst/entry/hibernate_3_1_something_performance1 properties.put("hibernate.jdbc.wrap_result_sets", "true"); } configuration.setProperties(properties); startup(true); }
[ "public", "void", "initCustomInstallConfiguration", "(", "String", "hibernateDialect", ",", "String", "jndiUrl", ")", "throws", "GreenPepperServerException", "{", "GreenPepperServerConfiguration", "configuration", "=", "getConfiguration", "(", ")", ";", "Properties", "prope...
<p>initCustomInstallConfiguration.</p> @param hibernateDialect a {@link java.lang.String} object. @param jndiUrl a {@link java.lang.String} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "initCustomInstallConfiguration", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/GreenPepperServerConfigurationActivator.java#L322-L345
hamnis/json-collection
src/main/java/net/hamnaberg/json/parser/CollectionParser.java
CollectionParser.parseTemplate
public Template parseTemplate(InputStream stream) throws IOException { return parseTemplate(new BufferedReader(new InputStreamReader(stream, Charsets.UTF_8))); }
java
public Template parseTemplate(InputStream stream) throws IOException { return parseTemplate(new BufferedReader(new InputStreamReader(stream, Charsets.UTF_8))); }
[ "public", "Template", "parseTemplate", "(", "InputStream", "stream", ")", "throws", "IOException", "{", "return", "parseTemplate", "(", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "stream", ",", "Charsets", ".", "UTF_8", ")", ")", ")", ";", ...
Parses a JsonCollection from the given stream. The stream is wrapped in a BufferedReader. <p> The stream is expected to be UTF-8 encoded. @param stream the stream @return a jsonCollection @throws IOException
[ "Parses", "a", "JsonCollection", "from", "the", "given", "stream", ".", "The", "stream", "is", "wrapped", "in", "a", "BufferedReader", ".", "<p", ">", "The", "stream", "is", "expected", "to", "be", "UTF", "-", "8", "encoded", "." ]
train
https://github.com/hamnis/json-collection/blob/fbd4a1c6ab75b70b3b4cb981b608b395e9c8c180/src/main/java/net/hamnaberg/json/parser/CollectionParser.java#L89-L91
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/PrivateKeyWriter.java
PrivateKeyWriter.writeInPemFormat
public static void writeInPemFormat(final PrivateKey privateKey, final @NonNull File file) throws IOException { KeyWriter.writeInPemFormat(privateKey, file); }
java
public static void writeInPemFormat(final PrivateKey privateKey, final @NonNull File file) throws IOException { KeyWriter.writeInPemFormat(privateKey, file); }
[ "public", "static", "void", "writeInPemFormat", "(", "final", "PrivateKey", "privateKey", ",", "final", "@", "NonNull", "File", "file", ")", "throws", "IOException", "{", "KeyWriter", ".", "writeInPemFormat", "(", "privateKey", ",", "file", ")", ";", "}" ]
Write the given {@link PrivateKey} into the given {@link File}. @param privateKey the private key @param file the file to write in @throws IOException Signals that an I/O exception has occurred.
[ "Write", "the", "given", "{", "@link", "PrivateKey", "}", "into", "the", "given", "{", "@link", "File", "}", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/PrivateKeyWriter.java#L93-L97
json-path/JsonPath
json-path/src/main/java/com/jayway/jsonpath/internal/function/PathFunctionFactory.java
PathFunctionFactory.newFunction
public static PathFunction newFunction(String name) throws InvalidPathException { Class functionClazz = FUNCTIONS.get(name); if(functionClazz == null){ throw new InvalidPathException("Function with name: " + name + " does not exist."); } else { try { return (PathFunction)functionClazz.newInstance(); } catch (Exception e) { throw new InvalidPathException("Function of name: " + name + " cannot be created", e); } } }
java
public static PathFunction newFunction(String name) throws InvalidPathException { Class functionClazz = FUNCTIONS.get(name); if(functionClazz == null){ throw new InvalidPathException("Function with name: " + name + " does not exist."); } else { try { return (PathFunction)functionClazz.newInstance(); } catch (Exception e) { throw new InvalidPathException("Function of name: " + name + " cannot be created", e); } } }
[ "public", "static", "PathFunction", "newFunction", "(", "String", "name", ")", "throws", "InvalidPathException", "{", "Class", "functionClazz", "=", "FUNCTIONS", ".", "get", "(", "name", ")", ";", "if", "(", "functionClazz", "==", "null", ")", "{", "throw", ...
Returns the function by name or throws InvalidPathException if function not found. @see #FUNCTIONS @see PathFunction @param name The name of the function @return The implementation of a function @throws InvalidPathException
[ "Returns", "the", "function", "by", "name", "or", "throws", "InvalidPathException", "if", "function", "not", "found", "." ]
train
https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/internal/function/PathFunctionFactory.java#L66-L77
auth0/auth0-java
src/main/java/com/auth0/client/auth/AuthAPI.java
AuthAPI.requestToken
public AuthRequest requestToken(String audience) { Asserts.assertNotNull(audience, "audience"); String url = baseUrl .newBuilder() .addPathSegment(PATH_OAUTH) .addPathSegment(PATH_TOKEN) .build() .toString(); TokenRequest request = new TokenRequest(client, url); request.addParameter(KEY_CLIENT_ID, clientId); request.addParameter(KEY_CLIENT_SECRET, clientSecret); request.addParameter(KEY_GRANT_TYPE, "client_credentials"); request.addParameter(KEY_AUDIENCE, audience); return request; }
java
public AuthRequest requestToken(String audience) { Asserts.assertNotNull(audience, "audience"); String url = baseUrl .newBuilder() .addPathSegment(PATH_OAUTH) .addPathSegment(PATH_TOKEN) .build() .toString(); TokenRequest request = new TokenRequest(client, url); request.addParameter(KEY_CLIENT_ID, clientId); request.addParameter(KEY_CLIENT_SECRET, clientSecret); request.addParameter(KEY_GRANT_TYPE, "client_credentials"); request.addParameter(KEY_AUDIENCE, audience); return request; }
[ "public", "AuthRequest", "requestToken", "(", "String", "audience", ")", "{", "Asserts", ".", "assertNotNull", "(", "audience", ",", "\"audience\"", ")", ";", "String", "url", "=", "baseUrl", ".", "newBuilder", "(", ")", ".", "addPathSegment", "(", "PATH_OAUTH...
Creates a request to get a Token for the given audience using the 'Client Credentials' grant. Default used realm is defined in the "API Authorization Settings" in the account's advanced settings in the Auth0 Dashboard. <pre> {@code AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne"); try { TokenHolder result = auth.requestToken("https://myapi.me.auth0.com/users") .setRealm("my-realm") .execute(); } catch (Auth0Exception e) { //Something happened } } </pre> @param audience the audience of the API to request access to. @return a Request to configure and execute.
[ "Creates", "a", "request", "to", "get", "a", "Token", "for", "the", "given", "audience", "using", "the", "Client", "Credentials", "grant", ".", "Default", "used", "realm", "is", "defined", "in", "the", "API", "Authorization", "Settings", "in", "the", "accoun...
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthAPI.java#L404-L419
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.writeResourceProjectLastModified
public void writeResourceProjectLastModified(CmsRequestContext context, CmsResource resource, CmsProject project) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL); m_driverManager.writeProjectLastModified(dbc, resource, project.getUuid()); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_RESOURCE_1, context.getSitePath(resource)), e); } finally { dbc.clear(); } }
java
public void writeResourceProjectLastModified(CmsRequestContext context, CmsResource resource, CmsProject project) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL); m_driverManager.writeProjectLastModified(dbc, resource, project.getUuid()); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_RESOURCE_1, context.getSitePath(resource)), e); } finally { dbc.clear(); } }
[ "public", "void", "writeResourceProjectLastModified", "(", "CmsRequestContext", "context", ",", "CmsResource", "resource", ",", "CmsProject", "project", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "cont...
Writes the 'projectlastmodified' field of a resource record.<p> @param context the current database context @param resource the resource which should be modified @param project the project whose project id should be written into the resource record @throws CmsException if something goes wrong
[ "Writes", "the", "projectlastmodified", "field", "of", "a", "resource", "record", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6886-L6899
CloudBees-community/syslog-java-client
src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java
LogManagerHelper.getStringProperty
public static String getStringProperty(@Nonnull LogManager manager, @Nullable String name, String defaultValue) { if (name == null) { return defaultValue; } String val = manager.getProperty(name); if (val == null) { return defaultValue; } return val.trim(); }
java
public static String getStringProperty(@Nonnull LogManager manager, @Nullable String name, String defaultValue) { if (name == null) { return defaultValue; } String val = manager.getProperty(name); if (val == null) { return defaultValue; } return val.trim(); }
[ "public", "static", "String", "getStringProperty", "(", "@", "Nonnull", "LogManager", "manager", ",", "@", "Nullable", "String", "name", ",", "String", "defaultValue", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "defaultValue", ";", "}", ...
Visible version of {@link java.util.logging.LogManager#getStringProperty(String, String)}. If the property is not defined we return the given default value.
[ "Visible", "version", "of", "{", "@link", "java", ".", "util", ".", "logging", ".", "LogManager#getStringProperty", "(", "String", "String", ")", "}", "." ]
train
https://github.com/CloudBees-community/syslog-java-client/blob/41e01206e4ce17c6d225ffb443bf19792a3f3c3a/src/main/java/com/cloudbees/syslog/integration/jul/util/LogManagerHelper.java#L117-L126
bwkimmel/java-util
src/main/java/ca/eandb/util/sql/DbUtil.java
DbUtil.queryString
public static String queryString(Connection con, String def, String query, Object... param) throws SQLException { PreparedStatement stmt = null; try { stmt = con.prepareStatement(query); stmt.setMaxRows(1); for (int i = 0; i < param.length; i++) { stmt.setObject(i + 1, param[i]); } return queryString(stmt, def); } finally { close(stmt); } }
java
public static String queryString(Connection con, String def, String query, Object... param) throws SQLException { PreparedStatement stmt = null; try { stmt = con.prepareStatement(query); stmt.setMaxRows(1); for (int i = 0; i < param.length; i++) { stmt.setObject(i + 1, param[i]); } return queryString(stmt, def); } finally { close(stmt); } }
[ "public", "static", "String", "queryString", "(", "Connection", "con", ",", "String", "def", ",", "String", "query", ",", "Object", "...", "param", ")", "throws", "SQLException", "{", "PreparedStatement", "stmt", "=", "null", ";", "try", "{", "stmt", "=", ...
Runs a SQL query that returns a single <code>String</code> value. @param con The <code>Connection</code> against which to run the query. @param def The default value to return if the query returns no results. @param query The SQL query to run. @param param The parameters to the SQL query. @return The value returned by the query, or <code>def</code> if the query returns no results. It is assumed that the query returns a result set consisting of a single row and column, and that this value is a <code>String</code>. Any additional rows or columns returned will be ignored. @throws SQLException If an error occurs while attempting to communicate with the database.
[ "Runs", "a", "SQL", "query", "that", "returns", "a", "single", "<code", ">", "String<", "/", "code", ">", "value", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/sql/DbUtil.java#L163-L175
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/prefs/PreferencesHelper.java
PreferencesHelper.getStringArray
@Nullable public static String[] getStringArray(@NonNull SharedPreferences prefs, @NonNull String key, @NonNull String delimiter) { return split(prefs.getString(key, null), delimiter); }
java
@Nullable public static String[] getStringArray(@NonNull SharedPreferences prefs, @NonNull String key, @NonNull String delimiter) { return split(prefs.getString(key, null), delimiter); }
[ "@", "Nullable", "public", "static", "String", "[", "]", "getStringArray", "(", "@", "NonNull", "SharedPreferences", "prefs", ",", "@", "NonNull", "String", "key", ",", "@", "NonNull", "String", "delimiter", ")", "{", "return", "split", "(", "prefs", ".", ...
Retrieves strings array stored as single string. @param delimiter Delimiter used to split the string.
[ "Retrieves", "strings", "array", "stored", "as", "single", "string", "." ]
train
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/prefs/PreferencesHelper.java#L91-L95
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/JMSServices.java
JMSServices.broadcastTextMessage
public void broadcastTextMessage(String topicName, String textMessage, int delaySeconds) throws NamingException, JMSException, ServiceLocatorException { if (mdwMessageProducer != null) { mdwMessageProducer.broadcastMessageToTopic(topicName, textMessage); } else { TopicConnectionFactory tFactory = null; TopicConnection tConnection = null; TopicSession tSession = null; TopicPublisher tPublisher = null; try { // if (logger.isDebugEnabled()) logger.debug("broadcast JMS // message: " + // textMessage); // cannot log above - causing recursive broadcasting tFactory = getTopicConnectionFactory(null); tConnection = tFactory.createTopicConnection(); tSession = tConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = getTopic(topicName); tPublisher = tSession.createPublisher(topic); // TODO: platform-independent delay // WLMessageProducer wlMessageProducer = // (WLMessageProducer)tPublisher; // long delayInMilliSec = 0; // if(pMinDelay > 0){ // delayInMilliSec = delaySeconds*1000; // } // wlMessageProducer.setTimeToDeliver(delayInMilliSec); TextMessage message = tSession.createTextMessage(); tConnection.start(); message.setText(textMessage); tPublisher.publish(message, DeliveryMode.PERSISTENT, TextMessage.DEFAULT_DELIVERY_MODE, TextMessage.DEFAULT_TIME_TO_LIVE); // }catch(ServiceLocatorException ex){ // ex.printStackTrace(); // never log exception here!!! infinite loop when publishing log // messages // throw new JMSException(ex.getMessage()); } finally { closeResources(tConnection, tSession, tPublisher); } } }
java
public void broadcastTextMessage(String topicName, String textMessage, int delaySeconds) throws NamingException, JMSException, ServiceLocatorException { if (mdwMessageProducer != null) { mdwMessageProducer.broadcastMessageToTopic(topicName, textMessage); } else { TopicConnectionFactory tFactory = null; TopicConnection tConnection = null; TopicSession tSession = null; TopicPublisher tPublisher = null; try { // if (logger.isDebugEnabled()) logger.debug("broadcast JMS // message: " + // textMessage); // cannot log above - causing recursive broadcasting tFactory = getTopicConnectionFactory(null); tConnection = tFactory.createTopicConnection(); tSession = tConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = getTopic(topicName); tPublisher = tSession.createPublisher(topic); // TODO: platform-independent delay // WLMessageProducer wlMessageProducer = // (WLMessageProducer)tPublisher; // long delayInMilliSec = 0; // if(pMinDelay > 0){ // delayInMilliSec = delaySeconds*1000; // } // wlMessageProducer.setTimeToDeliver(delayInMilliSec); TextMessage message = tSession.createTextMessage(); tConnection.start(); message.setText(textMessage); tPublisher.publish(message, DeliveryMode.PERSISTENT, TextMessage.DEFAULT_DELIVERY_MODE, TextMessage.DEFAULT_TIME_TO_LIVE); // }catch(ServiceLocatorException ex){ // ex.printStackTrace(); // never log exception here!!! infinite loop when publishing log // messages // throw new JMSException(ex.getMessage()); } finally { closeResources(tConnection, tSession, tPublisher); } } }
[ "public", "void", "broadcastTextMessage", "(", "String", "topicName", ",", "String", "textMessage", ",", "int", "delaySeconds", ")", "throws", "NamingException", ",", "JMSException", ",", "ServiceLocatorException", "{", "if", "(", "mdwMessageProducer", "!=", "null", ...
Sends the passed in text message to a local topic @param topicName @param pMessage @param delaySeconds @throws ServiceLocatorException
[ "Sends", "the", "passed", "in", "text", "message", "to", "a", "local", "topic" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/JMSServices.java#L299-L345
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java
AbstractEventSerializer.parseSessionIssuer
private SessionIssuer parseSessionIssuer(SessionContext sessionContext) throws IOException { if (jsonParser.nextToken() != JsonToken.START_OBJECT) { throw new JsonParseException("Not a SessionIssuer object", jsonParser.getCurrentLocation()); } SessionIssuer sessionIssuer = new SessionIssuer(); while (jsonParser.nextToken() != JsonToken.END_OBJECT) { String key = jsonParser.getCurrentName(); switch (key) { case "type": sessionIssuer.add(CloudTrailEventField.type.name(), this.jsonParser.nextTextValue()); break; case "principalId": sessionIssuer.add(CloudTrailEventField.principalId.name(), this.jsonParser.nextTextValue()); break; case "arn": sessionIssuer.add(CloudTrailEventField.arn.name(), this.jsonParser.nextTextValue()); break; case "accountId": sessionIssuer.add(CloudTrailEventField.accountId.name(), this.jsonParser.nextTextValue()); break; case "userName": sessionIssuer.add(CloudTrailEventField.userName.name(), this.jsonParser.nextTextValue()); break; default: sessionIssuer.add(key, this.parseDefaultValue(key)); break; } } return sessionIssuer; }
java
private SessionIssuer parseSessionIssuer(SessionContext sessionContext) throws IOException { if (jsonParser.nextToken() != JsonToken.START_OBJECT) { throw new JsonParseException("Not a SessionIssuer object", jsonParser.getCurrentLocation()); } SessionIssuer sessionIssuer = new SessionIssuer(); while (jsonParser.nextToken() != JsonToken.END_OBJECT) { String key = jsonParser.getCurrentName(); switch (key) { case "type": sessionIssuer.add(CloudTrailEventField.type.name(), this.jsonParser.nextTextValue()); break; case "principalId": sessionIssuer.add(CloudTrailEventField.principalId.name(), this.jsonParser.nextTextValue()); break; case "arn": sessionIssuer.add(CloudTrailEventField.arn.name(), this.jsonParser.nextTextValue()); break; case "accountId": sessionIssuer.add(CloudTrailEventField.accountId.name(), this.jsonParser.nextTextValue()); break; case "userName": sessionIssuer.add(CloudTrailEventField.userName.name(), this.jsonParser.nextTextValue()); break; default: sessionIssuer.add(key, this.parseDefaultValue(key)); break; } } return sessionIssuer; }
[ "private", "SessionIssuer", "parseSessionIssuer", "(", "SessionContext", "sessionContext", ")", "throws", "IOException", "{", "if", "(", "jsonParser", ".", "nextToken", "(", ")", "!=", "JsonToken", ".", "START_OBJECT", ")", "{", "throw", "new", "JsonParseException",...
Parses the {@link SessionContext} object. This runs only if the session is running with role-based or federated access permissions (in other words, temporary credentials in IAM). @param sessionContext @return the session issuer object. @throws IOException
[ "Parses", "the", "{", "@link", "SessionContext", "}", "object", ".", "This", "runs", "only", "if", "the", "session", "is", "running", "with", "role", "-", "based", "or", "federated", "access", "permissions", "(", "in", "other", "words", "temporary", "credent...
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/serializer/AbstractEventSerializer.java#L347-L380
op4j/op4j
src/main/java/org/op4j/functions/FnCalendar.java
FnCalendar.toStr
public static final Function<Calendar,String> toStr(final DateStyle dateStyle, final TimeStyle timeStyle) { return new ToString(dateStyle, timeStyle); }
java
public static final Function<Calendar,String> toStr(final DateStyle dateStyle, final TimeStyle timeStyle) { return new ToString(dateStyle, timeStyle); }
[ "public", "static", "final", "Function", "<", "Calendar", ",", "String", ">", "toStr", "(", "final", "DateStyle", "dateStyle", ",", "final", "TimeStyle", "timeStyle", ")", "{", "return", "new", "ToString", "(", "dateStyle", ",", "timeStyle", ")", ";", "}" ]
<p> Converts the target Calendar into a String using the specified date ({@link DateStyle}) and time ({@link TimeStyle}) styles. </p> @param dateStyle the date style to be used @param timeStyle the time style to be used @return the String representation of the Calendar.
[ "<p", ">", "Converts", "the", "target", "Calendar", "into", "a", "String", "using", "the", "specified", "date", "(", "{", "@link", "DateStyle", "}", ")", "and", "time", "(", "{", "@link", "TimeStyle", "}", ")", "styles", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnCalendar.java#L422-L424
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.replaceMap
public static String replaceMap(String input, Map map, boolean ignoreCase) throws PageException { return replaceMap(input, map, ignoreCase, true); }
java
public static String replaceMap(String input, Map map, boolean ignoreCase) throws PageException { return replaceMap(input, map, ignoreCase, true); }
[ "public", "static", "String", "replaceMap", "(", "String", "input", ",", "Map", "map", ",", "boolean", "ignoreCase", ")", "throws", "PageException", "{", "return", "replaceMap", "(", "input", ",", "map", ",", "ignoreCase", ",", "true", ")", ";", "}" ]
this is the public entry point for the replaceMap() method @param input - the string on which the replacements should be performed. @param map - a java.util.Map with key/value pairs where the key is the substring to find and the value is the substring with which to replace the matched key @param ignoreCase - if true then matches will not be case sensitive @return @throws PageException
[ "this", "is", "the", "public", "entry", "point", "for", "the", "replaceMap", "()", "method" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L1324-L1327
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java
JsonUtil.getInt
public static int getInt(JsonObject object, String field, int defaultValue) { final JsonValue value = object.get(field); if (value == null || value.isNull()) { return defaultValue; } else { return value.asInt(); } }
java
public static int getInt(JsonObject object, String field, int defaultValue) { final JsonValue value = object.get(field); if (value == null || value.isNull()) { return defaultValue; } else { return value.asInt(); } }
[ "public", "static", "int", "getInt", "(", "JsonObject", "object", ",", "String", "field", ",", "int", "defaultValue", ")", "{", "final", "JsonValue", "value", "=", "object", ".", "get", "(", "field", ")", ";", "if", "(", "value", "==", "null", "||", "v...
Returns a field in a Json object as an int. @param object the Json Object @param field the field in the Json object to return @param defaultValue a default value for the field if the field value is null @return the Json field value as an int
[ "Returns", "a", "field", "in", "a", "Json", "object", "as", "an", "int", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L59-L66
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.isLinked
public boolean isLinked(ParaObject obj, String type2, String id2) { if (obj == null || obj.getId() == null || type2 == null || id2 == null) { return false; } String url = Utils.formatMessage("{0}/links/{1}/{2}", obj.getObjectURI(), type2, id2); Boolean result = getEntity(invokeGet(url, null), Boolean.class); return result != null && result; }
java
public boolean isLinked(ParaObject obj, String type2, String id2) { if (obj == null || obj.getId() == null || type2 == null || id2 == null) { return false; } String url = Utils.formatMessage("{0}/links/{1}/{2}", obj.getObjectURI(), type2, id2); Boolean result = getEntity(invokeGet(url, null), Boolean.class); return result != null && result; }
[ "public", "boolean", "isLinked", "(", "ParaObject", "obj", ",", "String", "type2", ",", "String", "id2", ")", "{", "if", "(", "obj", "==", "null", "||", "obj", ".", "getId", "(", ")", "==", "null", "||", "type2", "==", "null", "||", "id2", "==", "n...
Checks if this object is linked to another. @param type2 the other type @param id2 the other id @param obj the object to execute this method on @return true if the two are linked
[ "Checks", "if", "this", "object", "is", "linked", "to", "another", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L998-L1005
paypal/SeLion
client/src/main/java/com/paypal/selion/platform/asserts/SeLionAsserts.java
SeLionAsserts.assertEquals
public static void assertEquals(Object actual, Object expected, String message) { hardAssert.assertEquals(actual, expected, message); }
java
public static void assertEquals(Object actual, Object expected, String message) { hardAssert.assertEquals(actual, expected, message); }
[ "public", "static", "void", "assertEquals", "(", "Object", "actual", ",", "Object", "expected", ",", "String", "message", ")", "{", "hardAssert", ".", "assertEquals", "(", "actual", ",", "expected", ",", "message", ")", ";", "}" ]
assertEquals method is used to assert based on actual and expected values and provide a Pass result for a same match.assertEquals will yield a Fail result for a mismatch and abort the test case. @param actual - Actual value obtained from executing a test @param expected - Expected value for the test to pass. @param message - A descriptive text narrating a validation being done. <br> Sample Usage<br> <code> SeLionAsserts.assertEquals("OK","OK", "Some Message"); </code>
[ "assertEquals", "method", "is", "used", "to", "assert", "based", "on", "actual", "and", "expected", "values", "and", "provide", "a", "Pass", "result", "for", "a", "same", "match", ".", "assertEquals", "will", "yield", "a", "Fail", "result", "for", "a", "mi...
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/platform/asserts/SeLionAsserts.java#L455-L457
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfCell.java
PdfCell.addImage
private float addImage(Image i, float left, float right, float extraHeight, int alignment) { Image image = Image.getInstance(i); if (image.getScaledWidth() > right - left) { image.scaleToFit(right - left, Float.MAX_VALUE); } flushCurrentLine(); if (line == null) { line = new PdfLine(left, right, alignment, leading); } PdfLine imageLine = line; // left and right in chunk is relative to the start of the line right = right - left; left = 0f; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) { left = right - image.getScaledWidth(); } else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) { left = left + ((right - left - image.getScaledWidth()) / 2f); } Chunk imageChunk = new Chunk(image, left, 0); imageLine.add(new PdfChunk(imageChunk, null)); addLine(imageLine); return imageLine.height(); }
java
private float addImage(Image i, float left, float right, float extraHeight, int alignment) { Image image = Image.getInstance(i); if (image.getScaledWidth() > right - left) { image.scaleToFit(right - left, Float.MAX_VALUE); } flushCurrentLine(); if (line == null) { line = new PdfLine(left, right, alignment, leading); } PdfLine imageLine = line; // left and right in chunk is relative to the start of the line right = right - left; left = 0f; if ((image.getAlignment() & Image.RIGHT) == Image.RIGHT) { left = right - image.getScaledWidth(); } else if ((image.getAlignment() & Image.MIDDLE) == Image.MIDDLE) { left = left + ((right - left - image.getScaledWidth()) / 2f); } Chunk imageChunk = new Chunk(image, left, 0); imageLine.add(new PdfChunk(imageChunk, null)); addLine(imageLine); return imageLine.height(); }
[ "private", "float", "addImage", "(", "Image", "i", ",", "float", "left", ",", "float", "right", ",", "float", "extraHeight", ",", "int", "alignment", ")", "{", "Image", "image", "=", "Image", ".", "getInstance", "(", "i", ")", ";", "if", "(", "image", ...
Adds an image to this Cell. @param i the image to add @param left the left border @param right the right border @param extraHeight extra height to add above image @param alignment horizontal alignment (constant from Element class) @return the height of the image
[ "Adds", "an", "image", "to", "this", "Cell", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCell.java#L529-L553
infinispan/infinispan
client/hotrod-client/src/main/java/org/infinispan/client/hotrod/event/ClientEvents.java
ClientEvents.addClientQueryListener
public static void addClientQueryListener(RemoteCache<?, ?> remoteCache, Object listener, Query query) { ClientListener l = ReflectionUtil.getAnnotation(listener.getClass(), ClientListener.class); if (l == null) { throw log.missingClientListenerAnnotation(listener.getClass().getName()); } if (!l.useRawData()) { throw log.clientListenerMustUseRawData(listener.getClass().getName()); } if (!l.filterFactoryName().equals(Filters.QUERY_DSL_FILTER_FACTORY_NAME)) { throw log.clientListenerMustUseDesignatedFilterConverterFactory(Filters.QUERY_DSL_FILTER_FACTORY_NAME); } if (!l.converterFactoryName().equals(Filters.QUERY_DSL_FILTER_FACTORY_NAME)) { throw log.clientListenerMustUseDesignatedFilterConverterFactory(Filters.QUERY_DSL_FILTER_FACTORY_NAME); } Object[] factoryParams = makeFactoryParams(query); remoteCache.addClientListener(listener, factoryParams, null); }
java
public static void addClientQueryListener(RemoteCache<?, ?> remoteCache, Object listener, Query query) { ClientListener l = ReflectionUtil.getAnnotation(listener.getClass(), ClientListener.class); if (l == null) { throw log.missingClientListenerAnnotation(listener.getClass().getName()); } if (!l.useRawData()) { throw log.clientListenerMustUseRawData(listener.getClass().getName()); } if (!l.filterFactoryName().equals(Filters.QUERY_DSL_FILTER_FACTORY_NAME)) { throw log.clientListenerMustUseDesignatedFilterConverterFactory(Filters.QUERY_DSL_FILTER_FACTORY_NAME); } if (!l.converterFactoryName().equals(Filters.QUERY_DSL_FILTER_FACTORY_NAME)) { throw log.clientListenerMustUseDesignatedFilterConverterFactory(Filters.QUERY_DSL_FILTER_FACTORY_NAME); } Object[] factoryParams = makeFactoryParams(query); remoteCache.addClientListener(listener, factoryParams, null); }
[ "public", "static", "void", "addClientQueryListener", "(", "RemoteCache", "<", "?", ",", "?", ">", "remoteCache", ",", "Object", "listener", ",", "Query", "query", ")", "{", "ClientListener", "l", "=", "ReflectionUtil", ".", "getAnnotation", "(", "listener", "...
Register a client listener that uses a query DSL based filter. The listener is expected to be annotated such that {@link org.infinispan.client.hotrod.annotation.ClientListener#useRawData} = true and {@link org.infinispan.client.hotrod.annotation.ClientListener#filterFactoryName} and {@link org.infinispan.client.hotrod.annotation.ClientListener#converterFactoryName} are equal to {@link Filters#QUERY_DSL_FILTER_FACTORY_NAME} @param remoteCache the remote cache to attach the listener @param listener the listener instance @param query the query to be used for filtering and conversion (if projections are used)
[ "Register", "a", "client", "listener", "that", "uses", "a", "query", "DSL", "based", "filter", ".", "The", "listener", "is", "expected", "to", "be", "annotated", "such", "that", "{", "@link", "org", ".", "infinispan", ".", "client", ".", "hotrod", ".", "...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/event/ClientEvents.java#L43-L59
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/ThemeUtil.java
ThemeUtil.getDrawable
public static Drawable getDrawable(@NonNull final Context context, @AttrRes final int resourceId) { return getDrawable(context, -1, resourceId); }
java
public static Drawable getDrawable(@NonNull final Context context, @AttrRes final int resourceId) { return getDrawable(context, -1, resourceId); }
[ "public", "static", "Drawable", "getDrawable", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "AttrRes", "final", "int", "resourceId", ")", "{", "return", "getDrawable", "(", "context", ",", "-", "1", ",", "resourceId", ")", ";", "}" ]
Obtains the drawable, which corresponds to a specific resource id, from a context's theme. If the given resource id is invalid, a {@link NotFoundException} will be thrown. @param context The context, which should be used, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource id of the attribute, which should be obtained, as an {@link Integer} value. The resource id must corresponds to a valid theme attribute @return The drawable, which has been obtained, as an instance of the class {@link Drawable}
[ "Obtains", "the", "drawable", "which", "corresponds", "to", "a", "specific", "resource", "id", "from", "a", "context", "s", "theme", ".", "If", "the", "given", "resource", "id", "is", "invalid", "a", "{", "@link", "NotFoundException", "}", "will", "be", "t...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ThemeUtil.java#L537-L540
h2oai/h2o-2
src/main/java/water/fvec/CBSChunk.java
CBSChunk.clen
public static int clen(int values, int bpv) { int len = (values*bpv) >> 3; return values*bpv % 8 == 0 ? len : len + 1; }
java
public static int clen(int values, int bpv) { int len = (values*bpv) >> 3; return values*bpv % 8 == 0 ? len : len + 1; }
[ "public", "static", "int", "clen", "(", "int", "values", ",", "int", "bpv", ")", "{", "int", "len", "=", "(", "values", "*", "bpv", ")", ">>", "3", ";", "return", "values", "*", "bpv", "%", "8", "==", "0", "?", "len", ":", "len", "+", "1", ";...
Returns compressed len of the given array length if the value if represented by bpv-bits.
[ "Returns", "compressed", "len", "of", "the", "given", "array", "length", "if", "the", "value", "if", "represented", "by", "bpv", "-", "bits", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/CBSChunk.java#L84-L87
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/UnionImpl.java
UnionImpl.heapifyInstance
static UnionImpl heapifyInstance(final Memory srcMem, final long seed) { Family.UNION.checkFamilyID(extractFamilyID(srcMem)); final UpdateSketch gadget = HeapQuickSelectSketch.heapifyInstance(srcMem, seed); final UnionImpl unionImpl = new UnionImpl(gadget, seed); unionImpl.unionThetaLong_ = extractUnionThetaLong(srcMem); unionImpl.unionEmpty_ = PreambleUtil.isEmpty(srcMem); return unionImpl; }
java
static UnionImpl heapifyInstance(final Memory srcMem, final long seed) { Family.UNION.checkFamilyID(extractFamilyID(srcMem)); final UpdateSketch gadget = HeapQuickSelectSketch.heapifyInstance(srcMem, seed); final UnionImpl unionImpl = new UnionImpl(gadget, seed); unionImpl.unionThetaLong_ = extractUnionThetaLong(srcMem); unionImpl.unionEmpty_ = PreambleUtil.isEmpty(srcMem); return unionImpl; }
[ "static", "UnionImpl", "heapifyInstance", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "Family", ".", "UNION", ".", "checkFamilyID", "(", "extractFamilyID", "(", "srcMem", ")", ")", ";", "final", "UpdateSketch", "gadget", "=", "H...
Heapify a Union from a Memory Union object containing data. Called by SetOperation. @param srcMem The source Memory Union object. <a href="{@docRoot}/resources/dictionary.html#mem">See Memory</a> @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See seed</a> @return this class
[ "Heapify", "a", "Union", "from", "a", "Memory", "Union", "object", "containing", "data", ".", "Called", "by", "SetOperation", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/UnionImpl.java#L119-L126
VoltDB/voltdb
src/frontend/org/voltdb/CatalogContext.java
CatalogContext.writeCatalogJarToFile
public Runnable writeCatalogJarToFile(String path, String name, CatalogJarWriteMode mode) throws IOException { File catalogFile = new VoltFile(path, name); File catalogTmpFile = new VoltFile(path, name + ".tmp"); if (mode == CatalogJarWriteMode.CATALOG_UPDATE) { // This means a @UpdateCore case, the asynchronous writing of // jar file has finished, rename the jar file catalogFile.delete(); catalogTmpFile.renameTo(catalogFile); return null; } if (mode == CatalogJarWriteMode.START_OR_RESTART) { // This happens in the beginning of , // when the catalog jar does not yet exist. Though the contents // written might be a default one and could be overwritten later // by @UAC, @UpdateClasses, etc. return m_catalogInfo.m_jarfile.writeToFile(catalogFile); } if (mode == CatalogJarWriteMode.RECOVER) { // we must overwrite the file (the file may have been changed) catalogFile.delete(); if (catalogTmpFile.exists()) { // If somehow the catalog temp jar is not cleaned up, then delete it catalogTmpFile.delete(); } return m_catalogInfo.m_jarfile.writeToFile(catalogFile); } VoltDB.crashLocalVoltDB("Unsupported mode to write catalog jar", true, null); return null; }
java
public Runnable writeCatalogJarToFile(String path, String name, CatalogJarWriteMode mode) throws IOException { File catalogFile = new VoltFile(path, name); File catalogTmpFile = new VoltFile(path, name + ".tmp"); if (mode == CatalogJarWriteMode.CATALOG_UPDATE) { // This means a @UpdateCore case, the asynchronous writing of // jar file has finished, rename the jar file catalogFile.delete(); catalogTmpFile.renameTo(catalogFile); return null; } if (mode == CatalogJarWriteMode.START_OR_RESTART) { // This happens in the beginning of , // when the catalog jar does not yet exist. Though the contents // written might be a default one and could be overwritten later // by @UAC, @UpdateClasses, etc. return m_catalogInfo.m_jarfile.writeToFile(catalogFile); } if (mode == CatalogJarWriteMode.RECOVER) { // we must overwrite the file (the file may have been changed) catalogFile.delete(); if (catalogTmpFile.exists()) { // If somehow the catalog temp jar is not cleaned up, then delete it catalogTmpFile.delete(); } return m_catalogInfo.m_jarfile.writeToFile(catalogFile); } VoltDB.crashLocalVoltDB("Unsupported mode to write catalog jar", true, null); return null; }
[ "public", "Runnable", "writeCatalogJarToFile", "(", "String", "path", ",", "String", "name", ",", "CatalogJarWriteMode", "mode", ")", "throws", "IOException", "{", "File", "catalogFile", "=", "new", "VoltFile", "(", "path", ",", "name", ")", ";", "File", "cata...
Write, replace or update the catalog jar based on different cases. This function assumes any IOException should lead to fatal crash. @param path @param name @throws IOException
[ "Write", "replace", "or", "update", "the", "catalog", "jar", "based", "on", "different", "cases", ".", "This", "function", "assumes", "any", "IOException", "should", "lead", "to", "fatal", "crash", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/CatalogContext.java#L340-L374
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.setInternalState
public static void setInternalState(Object object, String fieldName, Object value, Class<?> where) { if (object == null || fieldName == null || fieldName.equals("") || fieldName.startsWith(" ")) { throw new IllegalArgumentException("object, field name, and \"where\" must not be empty or null."); } final Field field = getField(fieldName, where); try { field.set(object, value); } catch (Exception e) { throw new RuntimeException("Internal Error: Failed to set field in method setInternalState.", e); } }
java
public static void setInternalState(Object object, String fieldName, Object value, Class<?> where) { if (object == null || fieldName == null || fieldName.equals("") || fieldName.startsWith(" ")) { throw new IllegalArgumentException("object, field name, and \"where\" must not be empty or null."); } final Field field = getField(fieldName, where); try { field.set(object, value); } catch (Exception e) { throw new RuntimeException("Internal Error: Failed to set field in method setInternalState.", e); } }
[ "public", "static", "void", "setInternalState", "(", "Object", "object", ",", "String", "fieldName", ",", "Object", "value", ",", "Class", "<", "?", ">", "where", ")", "{", "if", "(", "object", "==", "null", "||", "fieldName", "==", "null", "||", "fieldN...
Set the value of a field using reflection. Use this method when you need to specify in which class the field is declared. This is useful if you have two fields in a class hierarchy that has the same name but you like to modify the latter. @param object the object to modify @param fieldName the name of the field @param value the new value of the field @param where which class the field is defined
[ "Set", "the", "value", "of", "a", "field", "using", "reflection", ".", "Use", "this", "method", "when", "you", "need", "to", "specify", "in", "which", "class", "the", "field", "is", "declared", ".", "This", "is", "useful", "if", "you", "have", "two", "...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L399-L410
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/api/ThreadSettingsApi.java
ThreadSettingsApi.setGetStartedButton
public static void setGetStartedButton(String payload) { if (payload == null || "".equals(payload)) { logger.error("FbBotMill validation error: Get Started Button payload can't be null or empty!"); return; } Button button = new PostbackButton(null, ButtonType.POSTBACK, payload); List<Button> buttonList = new ArrayList<Button>(); buttonList.add(button); CallToActionsRequest request = new CallToActionsRequest( ThreadState.NEW_THREAD, buttonList); FbBotMillNetworkController.postThreadSetting(request); }
java
public static void setGetStartedButton(String payload) { if (payload == null || "".equals(payload)) { logger.error("FbBotMill validation error: Get Started Button payload can't be null or empty!"); return; } Button button = new PostbackButton(null, ButtonType.POSTBACK, payload); List<Button> buttonList = new ArrayList<Button>(); buttonList.add(button); CallToActionsRequest request = new CallToActionsRequest( ThreadState.NEW_THREAD, buttonList); FbBotMillNetworkController.postThreadSetting(request); }
[ "public", "static", "void", "setGetStartedButton", "(", "String", "payload", ")", "{", "if", "(", "payload", "==", "null", "||", "\"\"", ".", "equals", "(", "payload", ")", ")", "{", "logger", ".", "error", "(", "\"FbBotMill validation error: Get Started Button ...
Sets the Get Started Button for the bot. The Get Started button is only rendered the first time the user interacts with a the Page on Messenger. When this button is tapped, the defined payload will be sent back with a postback received callback. @param payload the payload to return when the button is tapped. @see <a href= "https://developers.facebook.com/docs/messenger-platform/thread-settings/get-started-button" >Facebook's Get Started Button Documentation</a>
[ "Sets", "the", "Get", "Started", "Button", "for", "the", "bot", ".", "The", "Get", "Started", "button", "is", "only", "rendered", "the", "first", "time", "the", "user", "interacts", "with", "a", "the", "Page", "on", "Messenger", ".", "When", "this", "but...
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/api/ThreadSettingsApi.java#L127-L138
baratine/baratine
kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java
WatchServiceImpl.notifyLocalWatch
public void notifyLocalWatch(TableKraken table, byte []key) { WatchTable watchTable = _tableMap.get(table); if (watchTable != null) { watchTable.onPut(key, TableListener.TypePut.LOCAL); } }
java
public void notifyLocalWatch(TableKraken table, byte []key) { WatchTable watchTable = _tableMap.get(table); if (watchTable != null) { watchTable.onPut(key, TableListener.TypePut.LOCAL); } }
[ "public", "void", "notifyLocalWatch", "(", "TableKraken", "table", ",", "byte", "[", "]", "key", ")", "{", "WatchTable", "watchTable", "=", "_tableMap", ".", "get", "(", "table", ")", ";", "if", "(", "watchTable", "!=", "null", ")", "{", "watchTable", "....
Notify local watches for the given table and key @param table the table with the updated row @param key the key for the updated row
[ "Notify", "local", "watches", "for", "the", "given", "table", "and", "key" ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java#L228-L235
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.putAt
public static void putAt(List self, EmptyRange range, Object value) { RangeInfo info = subListBorders(self.size(), range); List sublist = self.subList(info.from, info.to); sublist.clear(); if (value instanceof Collection) { Collection col = (Collection) value; if (col.isEmpty()) return; sublist.addAll(col); } else { sublist.add(value); } }
java
public static void putAt(List self, EmptyRange range, Object value) { RangeInfo info = subListBorders(self.size(), range); List sublist = self.subList(info.from, info.to); sublist.clear(); if (value instanceof Collection) { Collection col = (Collection) value; if (col.isEmpty()) return; sublist.addAll(col); } else { sublist.add(value); } }
[ "public", "static", "void", "putAt", "(", "List", "self", ",", "EmptyRange", "range", ",", "Object", "value", ")", "{", "RangeInfo", "info", "=", "subListBorders", "(", "self", ".", "size", "(", ")", ",", "range", ")", ";", "List", "sublist", "=", "sel...
A helper method to allow lists to work with subscript operators. <pre class="groovyTestCase"> def list = ["a", true] {@code list[1..<1] = 5} assert list == ["a", 5, true] </pre> @param self a List @param range the (in this case empty) subset of the list to set @param value the values to put at the given sublist or a Collection of values @since 1.0
[ "A", "helper", "method", "to", "allow", "lists", "to", "work", "with", "subscript", "operators", ".", "<pre", "class", "=", "groovyTestCase", ">", "def", "list", "=", "[", "a", "true", "]", "{", "@code", "list", "[", "1", "..", "<1", "]", "=", "5", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7985-L7996
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateChinese
public static <T extends CharSequence> T validateChinese(T value, String errorMsg) throws ValidateException { if (false == isChinese(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateChinese(T value, String errorMsg) throws ValidateException { if (false == isChinese(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateChinese", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isChinese", "(", "value", ")", ")", "{", "throw", "new",...
验证是否为汉字 @param <T> 字符串类型 @param value 表单值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为汉字" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L948-L953
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java
LockFreeIndexedStack.pushWithLimit
public boolean pushWithLimit(E d, int maxSize) { StackNode<E> oldTop, newTop; newTop = new StackNode<E>(d); while (true) { oldTop = top.get(); newTop.next = oldTop; if (oldTop != null) { newTop.index = oldTop.index + 1; if (newTop.index >= maxSize) return false; } else { if (maxSize == 0) return false; newTop.index = 0; } if (top.compareAndSet(oldTop, newTop)) return true; } }
java
public boolean pushWithLimit(E d, int maxSize) { StackNode<E> oldTop, newTop; newTop = new StackNode<E>(d); while (true) { oldTop = top.get(); newTop.next = oldTop; if (oldTop != null) { newTop.index = oldTop.index + 1; if (newTop.index >= maxSize) return false; } else { if (maxSize == 0) return false; newTop.index = 0; } if (top.compareAndSet(oldTop, newTop)) return true; } }
[ "public", "boolean", "pushWithLimit", "(", "E", "d", ",", "int", "maxSize", ")", "{", "StackNode", "<", "E", ">", "oldTop", ",", "newTop", ";", "newTop", "=", "new", "StackNode", "<", "E", ">", "(", "d", ")", ";", "while", "(", "true", ")", "{", ...
Push data onto Stack while keeping size of the stack under <code>maxSize</code> @param d data to be pushed onto the stack. @param maxSize Maximal size of the stack. @return <code>True</code> if succeed. False if the size limitation has been reached
[ "Push", "data", "onto", "Stack", "while", "keeping", "size", "of", "the", "stack", "under", "<code", ">", "maxSize<", "/", "code", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/LockFreeIndexedStack.java#L154-L176
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.listInstances
public ListInstancesResponse listInstances(ListInstancesRequest request) { checkNotNull(request, "request should not be null."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, INSTANCE_PREFIX); if (request.getMarker() != null) { internalRequest.addParameter("marker", request.getMarker()); } if (request.getMaxKeys() > 0) { internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys())); } if (!Strings.isNullOrEmpty(request.getInternalIp())) { internalRequest.addParameter("internalIp", request.getInternalIp()); } if (!Strings.isNullOrEmpty(request.getDedicatedHostId())) { internalRequest.addParameter("dedicatedHostId", request.getDedicatedHostId()); } if (!Strings.isNullOrEmpty(request.getZoneName())) { internalRequest.addParameter("zoneName", request.getZoneName()); } return invokeHttpClient(internalRequest, ListInstancesResponse.class); }
java
public ListInstancesResponse listInstances(ListInstancesRequest request) { checkNotNull(request, "request should not be null."); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, INSTANCE_PREFIX); if (request.getMarker() != null) { internalRequest.addParameter("marker", request.getMarker()); } if (request.getMaxKeys() > 0) { internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys())); } if (!Strings.isNullOrEmpty(request.getInternalIp())) { internalRequest.addParameter("internalIp", request.getInternalIp()); } if (!Strings.isNullOrEmpty(request.getDedicatedHostId())) { internalRequest.addParameter("dedicatedHostId", request.getDedicatedHostId()); } if (!Strings.isNullOrEmpty(request.getZoneName())) { internalRequest.addParameter("zoneName", request.getZoneName()); } return invokeHttpClient(internalRequest, ListInstancesResponse.class); }
[ "public", "ListInstancesResponse", "listInstances", "(", "ListInstancesRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "this", ".", "createRequest", "(", "request",...
Return a list of instances owned by the authenticated user. @param request The request containing all options for listing own's bcc Instance. @return The response containing a list of instances owned by the authenticated user.
[ "Return", "a", "list", "of", "instances", "owned", "by", "the", "authenticated", "user", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L314-L333
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/mnist/MnistManager.java
MnistManager.writeImageToPpm
public static void writeImageToPpm(int[][] image, String ppmFileName) throws IOException { try (BufferedWriter ppmOut = new BufferedWriter(new FileWriter(ppmFileName))) { int rows = image.length; int cols = image[0].length; ppmOut.write("P3\n"); ppmOut.write("" + rows + " " + cols + " 255\n"); for (int[] anImage : image) { StringBuilder s = new StringBuilder(); for (int j = 0; j < cols; j++) { s.append(anImage[j] + " " + anImage[j] + " " + anImage[j] + " "); } ppmOut.write(s.toString()); } } }
java
public static void writeImageToPpm(int[][] image, String ppmFileName) throws IOException { try (BufferedWriter ppmOut = new BufferedWriter(new FileWriter(ppmFileName))) { int rows = image.length; int cols = image[0].length; ppmOut.write("P3\n"); ppmOut.write("" + rows + " " + cols + " 255\n"); for (int[] anImage : image) { StringBuilder s = new StringBuilder(); for (int j = 0; j < cols; j++) { s.append(anImage[j] + " " + anImage[j] + " " + anImage[j] + " "); } ppmOut.write(s.toString()); } } }
[ "public", "static", "void", "writeImageToPpm", "(", "int", "[", "]", "[", "]", "image", ",", "String", "ppmFileName", ")", "throws", "IOException", "{", "try", "(", "BufferedWriter", "ppmOut", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "ppm...
Writes the given image in the given file using the PPM data format. @param image @param ppmFileName @throws java.io.IOException
[ "Writes", "the", "given", "image", "in", "the", "given", "file", "using", "the", "PPM", "data", "format", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/mnist/MnistManager.java#L54-L69
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/BatchGetItemResult.java
BatchGetItemResult.withResponses
public BatchGetItemResult withResponses(java.util.Map<String, java.util.List<java.util.Map<String, AttributeValue>>> responses) { setResponses(responses); return this; }
java
public BatchGetItemResult withResponses(java.util.Map<String, java.util.List<java.util.Map<String, AttributeValue>>> responses) { setResponses(responses); return this; }
[ "public", "BatchGetItemResult", "withResponses", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", ">", ">", "responses", ")", "{...
<p> A map of table name to a list of items. Each object in <code>Responses</code> consists of a table name, along with a map of attribute data consisting of the data type and attribute value. </p> @param responses A map of table name to a list of items. Each object in <code>Responses</code> consists of a table name, along with a map of attribute data consisting of the data type and attribute value. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "of", "table", "name", "to", "a", "list", "of", "items", ".", "Each", "object", "in", "<code", ">", "Responses<", "/", "code", ">", "consists", "of", "a", "table", "name", "along", "with", "a", "map", "of", "attribute", "data",...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/BatchGetItemResult.java#L133-L136
elki-project/elki
elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/LogPanel.java
LogPanel.publishTextRecord
private void publishTextRecord(final LogRecord record) { try { logpane.publish(record); } catch(Exception e) { throw new RuntimeException("Error writing a log-like message.", e); } }
java
private void publishTextRecord(final LogRecord record) { try { logpane.publish(record); } catch(Exception e) { throw new RuntimeException("Error writing a log-like message.", e); } }
[ "private", "void", "publishTextRecord", "(", "final", "LogRecord", "record", ")", "{", "try", "{", "logpane", ".", "publish", "(", "record", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error writing a ...
Publish a text record to the pane @param record Record to publish
[ "Publish", "a", "text", "record", "to", "the", "pane" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/LogPanel.java#L117-L124
strator-dev/greenpepper
samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java
AccountManager.deleteGroup
public boolean deleteGroup(String name) { if (ADMINISTRATOR_GROUP_ID.equals(name)) { throw new SystemException(String.format("Cannot delete '%s' group.", ADMINISTRATOR_GROUP_ID)); } if (USER_GROUP_ID.equals(name)) { throw new SystemException(String.format("Cannot delete '%s' group.", USER_GROUP_ID)); } if (!isGroupExist(name)) { throw new SystemException(String.format("Group '%s' does not exist.", name)); } if (getGroupUserCount(name) > 0) { throw new SystemException("Cannot delete a group containing users."); } return allGroups.remove(name); }
java
public boolean deleteGroup(String name) { if (ADMINISTRATOR_GROUP_ID.equals(name)) { throw new SystemException(String.format("Cannot delete '%s' group.", ADMINISTRATOR_GROUP_ID)); } if (USER_GROUP_ID.equals(name)) { throw new SystemException(String.format("Cannot delete '%s' group.", USER_GROUP_ID)); } if (!isGroupExist(name)) { throw new SystemException(String.format("Group '%s' does not exist.", name)); } if (getGroupUserCount(name) > 0) { throw new SystemException("Cannot delete a group containing users."); } return allGroups.remove(name); }
[ "public", "boolean", "deleteGroup", "(", "String", "name", ")", "{", "if", "(", "ADMINISTRATOR_GROUP_ID", ".", "equals", "(", "name", ")", ")", "{", "throw", "new", "SystemException", "(", "String", ".", "format", "(", "\"Cannot delete '%s' group.\"", ",", "AD...
<p>deleteGroup.</p> @param name a {@link java.lang.String} object. @return a boolean.
[ "<p", ">", "deleteGroup", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java#L79-L102
threerings/narya
core/src/main/java/com/threerings/presents/server/ShutdownManager.java
ShutdownManager.addConstraint
public void addConstraint (Shutdowner lhs, Constraint constraint, Shutdowner rhs) { switch (constraint) { case RUNS_BEFORE: _cycle.addShutdownConstraint(lhs, Lifecycle.Constraint.RUNS_BEFORE, rhs); break; case RUNS_AFTER: _cycle.addShutdownConstraint(lhs, Lifecycle.Constraint.RUNS_AFTER, rhs); break; } }
java
public void addConstraint (Shutdowner lhs, Constraint constraint, Shutdowner rhs) { switch (constraint) { case RUNS_BEFORE: _cycle.addShutdownConstraint(lhs, Lifecycle.Constraint.RUNS_BEFORE, rhs); break; case RUNS_AFTER: _cycle.addShutdownConstraint(lhs, Lifecycle.Constraint.RUNS_AFTER, rhs); break; } }
[ "public", "void", "addConstraint", "(", "Shutdowner", "lhs", ",", "Constraint", "constraint", ",", "Shutdowner", "rhs", ")", "{", "switch", "(", "constraint", ")", "{", "case", "RUNS_BEFORE", ":", "_cycle", ".", "addShutdownConstraint", "(", "lhs", ",", "Lifec...
Adds a constraint that a certain shutdowner must be run before another.
[ "Adds", "a", "constraint", "that", "a", "certain", "shutdowner", "must", "be", "run", "before", "another", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ShutdownManager.java#L64-L74
aaberg/sql2o
core/src/main/java/org/sql2o/Sql2o.java
Sql2o.runInTransaction
public void runInTransaction(StatementRunnable runnable, Object argument){ runInTransaction(runnable, argument, java.sql.Connection.TRANSACTION_READ_COMMITTED); }
java
public void runInTransaction(StatementRunnable runnable, Object argument){ runInTransaction(runnable, argument, java.sql.Connection.TRANSACTION_READ_COMMITTED); }
[ "public", "void", "runInTransaction", "(", "StatementRunnable", "runnable", ",", "Object", "argument", ")", "{", "runInTransaction", "(", "runnable", ",", "argument", ",", "java", ".", "sql", ".", "Connection", ".", "TRANSACTION_READ_COMMITTED", ")", ";", "}" ]
Calls the {@link StatementRunnable#run(Connection, Object)} method on the {@link StatementRunnable} parameter. All statements run on the {@link Connection} instance in the {@link StatementRunnable#run(Connection, Object) run} method will be executed in a transaction. The transaction will automatically be committed if the {@link StatementRunnable#run(Connection, Object) run} method finishes without throwing an exception. If an exception is thrown within the {@link StatementRunnable#run(Connection, Object) run} method, the transaction will automatically be rolled back. The isolation level of the transaction will be set to {@link java.sql.Connection#TRANSACTION_READ_COMMITTED} @param runnable The {@link StatementRunnable} instance. @param argument An argument which will be forwarded to the {@link StatementRunnable#run(Connection, Object) run} method
[ "Calls", "the", "{", "@link", "StatementRunnable#run", "(", "Connection", "Object", ")", "}", "method", "on", "the", "{", "@link", "StatementRunnable", "}", "parameter", ".", "All", "statements", "run", "on", "the", "{", "@link", "Connection", "}", "instance",...
train
https://github.com/aaberg/sql2o/blob/01d3490a6d2440cf60f973d23508ac4ed57a8e20/core/src/main/java/org/sql2o/Sql2o.java#L360-L362
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/converter/AbstractTypeConverter.java
AbstractTypeConverter.parse
public Object parse(String value, Class type) { if (StringUtil.isBlank(value)) { return null; } return doConvert(value.trim(), type); }
java
public Object parse(String value, Class type) { if (StringUtil.isBlank(value)) { return null; } return doConvert(value.trim(), type); }
[ "public", "Object", "parse", "(", "String", "value", ",", "Class", "type", ")", "{", "if", "(", "StringUtil", ".", "isBlank", "(", "value", ")", ")", "{", "return", "null", ";", "}", "return", "doConvert", "(", "value", ".", "trim", "(", ")", ",", ...
{@inheritDoc} Template implementation of the <code>convert()</code> method. Takes care of handling null and empty string values. Once these basic operations are handled, will delegate to the <code>doConvert()</code> method of subclasses.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/converter/AbstractTypeConverter.java#L43-L51
belaban/JGroups
src/org/jgroups/protocols/pbcast/FLUSH.java
FLUSH.maxSeqnos
protected static Digest maxSeqnos(final View view, List<Digest> digests) { if(view == null || digests == null) return null; MutableDigest digest=new MutableDigest(view.getMembersRaw()); digests.forEach(digest::merge); return digest; }
java
protected static Digest maxSeqnos(final View view, List<Digest> digests) { if(view == null || digests == null) return null; MutableDigest digest=new MutableDigest(view.getMembersRaw()); digests.forEach(digest::merge); return digest; }
[ "protected", "static", "Digest", "maxSeqnos", "(", "final", "View", "view", ",", "List", "<", "Digest", ">", "digests", ")", "{", "if", "(", "view", "==", "null", "||", "digests", "==", "null", ")", "return", "null", ";", "MutableDigest", "digest", "=", ...
Returns a digest which contains, for all members of view, the highest delivered and received seqno of all digests
[ "Returns", "a", "digest", "which", "contains", "for", "all", "members", "of", "view", "the", "highest", "delivered", "and", "received", "seqno", "of", "all", "digests" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/FLUSH.java#L872-L879
square/okhttp
mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.java
MockWebServer.takeRequest
public RecordedRequest takeRequest(long timeout, TimeUnit unit) throws InterruptedException { return requestQueue.poll(timeout, unit); }
java
public RecordedRequest takeRequest(long timeout, TimeUnit unit) throws InterruptedException { return requestQueue.poll(timeout, unit); }
[ "public", "RecordedRequest", "takeRequest", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "return", "requestQueue", ".", "poll", "(", "timeout", ",", "unit", ")", ";", "}" ]
Awaits the next HTTP request (waiting up to the specified wait time if necessary), removes it, and returns it. Callers should use this to verify the request was sent as intended within the given time. @param timeout how long to wait before giving up, in units of {@code unit} @param unit a {@code TimeUnit} determining how to interpret the {@code timeout} parameter @return the head of the request queue
[ "Awaits", "the", "next", "HTTP", "request", "(", "waiting", "up", "to", "the", "specified", "wait", "time", "if", "necessary", ")", "removes", "it", "and", "returns", "it", ".", "Callers", "should", "use", "this", "to", "verify", "the", "request", "was", ...
train
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.java#L309-L311
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java
MeshGenerator.generateNormals
public static void generateNormals(TFloatList positions, TIntList indices, TFloatList normals) { // Initialize normals to (0, 0, 0) normals.fill(0, positions.size(), 0); // Iterate over the entire mesh for (int i = 0; i < indices.size(); i += 3) { // Triangle position indices final int pos0 = indices.get(i) * 3; final int pos1 = indices.get(i + 1) * 3; final int pos2 = indices.get(i + 2) * 3; // First triangle vertex position final float x0 = positions.get(pos0); final float y0 = positions.get(pos0 + 1); final float z0 = positions.get(pos0 + 2); // Second triangle vertex position final float x1 = positions.get(pos1); final float y1 = positions.get(pos1 + 1); final float z1 = positions.get(pos1 + 2); // Third triangle vertex position final float x2 = positions.get(pos2); final float y2 = positions.get(pos2 + 1); final float z2 = positions.get(pos2 + 2); // First edge position difference final float x10 = x1 - x0; final float y10 = y1 - y0; final float z10 = z1 - z0; // Second edge position difference final float x20 = x2 - x0; final float y20 = y2 - y0; final float z20 = z2 - z0; // Cross both edges to obtain the normal final float nx = y10 * z20 - z10 * y20; final float ny = z10 * x20 - x10 * z20; final float nz = x10 * y20 - y10 * x20; // Add the normal to the first vertex normals.set(pos0, normals.get(pos0) + nx); normals.set(pos0 + 1, normals.get(pos0 + 1) + ny); normals.set(pos0 + 2, normals.get(pos0 + 2) + nz); // Add the normal to the second vertex normals.set(pos1, normals.get(pos1) + nx); normals.set(pos1 + 1, normals.get(pos1 + 1) + ny); normals.set(pos1 + 2, normals.get(pos1 + 2) + nz); // Add the normal to the third vertex normals.set(pos2, normals.get(pos2) + nx); normals.set(pos2 + 1, normals.get(pos2 + 1) + ny); normals.set(pos2 + 2, normals.get(pos2 + 2) + nz); } // Iterate over all the normals for (int i = 0; i < indices.size(); i++) { // Index for the normal final int nor = indices.get(i) * 3; // Get the normal float nx = normals.get(nor); float ny = normals.get(nor + 1); float nz = normals.get(nor + 2); // Length of the normal final float l = (float) Math.sqrt(nx * nx + ny * ny + nz * nz); // Normalize the normal nx /= l; ny /= l; nz /= l; // Update the normal normals.set(nor, nx); normals.set(nor + 1, ny); normals.set(nor + 2, nz); } }
java
public static void generateNormals(TFloatList positions, TIntList indices, TFloatList normals) { // Initialize normals to (0, 0, 0) normals.fill(0, positions.size(), 0); // Iterate over the entire mesh for (int i = 0; i < indices.size(); i += 3) { // Triangle position indices final int pos0 = indices.get(i) * 3; final int pos1 = indices.get(i + 1) * 3; final int pos2 = indices.get(i + 2) * 3; // First triangle vertex position final float x0 = positions.get(pos0); final float y0 = positions.get(pos0 + 1); final float z0 = positions.get(pos0 + 2); // Second triangle vertex position final float x1 = positions.get(pos1); final float y1 = positions.get(pos1 + 1); final float z1 = positions.get(pos1 + 2); // Third triangle vertex position final float x2 = positions.get(pos2); final float y2 = positions.get(pos2 + 1); final float z2 = positions.get(pos2 + 2); // First edge position difference final float x10 = x1 - x0; final float y10 = y1 - y0; final float z10 = z1 - z0; // Second edge position difference final float x20 = x2 - x0; final float y20 = y2 - y0; final float z20 = z2 - z0; // Cross both edges to obtain the normal final float nx = y10 * z20 - z10 * y20; final float ny = z10 * x20 - x10 * z20; final float nz = x10 * y20 - y10 * x20; // Add the normal to the first vertex normals.set(pos0, normals.get(pos0) + nx); normals.set(pos0 + 1, normals.get(pos0 + 1) + ny); normals.set(pos0 + 2, normals.get(pos0 + 2) + nz); // Add the normal to the second vertex normals.set(pos1, normals.get(pos1) + nx); normals.set(pos1 + 1, normals.get(pos1 + 1) + ny); normals.set(pos1 + 2, normals.get(pos1 + 2) + nz); // Add the normal to the third vertex normals.set(pos2, normals.get(pos2) + nx); normals.set(pos2 + 1, normals.get(pos2 + 1) + ny); normals.set(pos2 + 2, normals.get(pos2 + 2) + nz); } // Iterate over all the normals for (int i = 0; i < indices.size(); i++) { // Index for the normal final int nor = indices.get(i) * 3; // Get the normal float nx = normals.get(nor); float ny = normals.get(nor + 1); float nz = normals.get(nor + 2); // Length of the normal final float l = (float) Math.sqrt(nx * nx + ny * ny + nz * nz); // Normalize the normal nx /= l; ny /= l; nz /= l; // Update the normal normals.set(nor, nx); normals.set(nor + 1, ny); normals.set(nor + 2, nz); } }
[ "public", "static", "void", "generateNormals", "(", "TFloatList", "positions", ",", "TIntList", "indices", ",", "TFloatList", "normals", ")", "{", "// Initialize normals to (0, 0, 0)", "normals", ".", "fill", "(", "0", ",", "positions", ".", "size", "(", ")", ",...
Generate the normals for the positions, according to the indices. This assumes that the positions have 3 components, in the x, y, z order. The normals are stored as a 3 component vector, in the x, y, z order. @param positions The position components @param indices The indices @param normals The list in which to store the normals
[ "Generate", "the", "normals", "for", "the", "positions", "according", "to", "the", "indices", ".", "This", "assumes", "that", "the", "positions", "have", "3", "components", "in", "the", "x", "y", "z", "order", ".", "The", "normals", "are", "stored", "as", ...
train
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/MeshGenerator.java#L156-L221
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/netty/InboundEnvelopeDecoder.java
InboundEnvelopeDecoder.copy
private void copy(ByteBuf src, ByteBuffer dst) { // This branch is necessary, because an Exception is thrown if the // destination buffer has more remaining (writable) bytes than // currently readable from the Netty ByteBuf source. if (src.isReadable()) { if (src.readableBytes() < dst.remaining()) { int oldLimit = dst.limit(); dst.limit(dst.position() + src.readableBytes()); src.readBytes(dst); dst.limit(oldLimit); } else { src.readBytes(dst); } } }
java
private void copy(ByteBuf src, ByteBuffer dst) { // This branch is necessary, because an Exception is thrown if the // destination buffer has more remaining (writable) bytes than // currently readable from the Netty ByteBuf source. if (src.isReadable()) { if (src.readableBytes() < dst.remaining()) { int oldLimit = dst.limit(); dst.limit(dst.position() + src.readableBytes()); src.readBytes(dst); dst.limit(oldLimit); } else { src.readBytes(dst); } } }
[ "private", "void", "copy", "(", "ByteBuf", "src", ",", "ByteBuffer", "dst", ")", "{", "// This branch is necessary, because an Exception is thrown if the", "// destination buffer has more remaining (writable) bytes than", "// currently readable from the Netty ByteBuf source.", "if", "(...
Copies min(from.readableBytes(), to.remaining() bytes from Nettys ByteBuf to the Java NIO ByteBuffer.
[ "Copies", "min", "(", "from", ".", "readableBytes", "()", "to", ".", "remaining", "()", "bytes", "from", "Nettys", "ByteBuf", "to", "the", "Java", "NIO", "ByteBuffer", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/runtime/io/network/netty/InboundEnvelopeDecoder.java#L320-L336
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java
NorwegianDateUtil.getDate
private static Date getDate(int day, int month, int year) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DATE, day); return cal.getTime(); }
java
private static Date getDate(int day, int month, int year) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DATE, day); return cal.getTime(); }
[ "private", "static", "Date", "getDate", "(", "int", "day", ",", "int", "month", ",", "int", "year", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "YEAR", ",", "year", ")", ...
Get the date for the given values. @param day The day. @param month The month. @param year The year. @return The date represented by the given values.
[ "Get", "the", "date", "for", "the", "given", "values", "." ]
train
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java#L274-L280
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/internal/random.java
random.nextBigInteger
public static BigInteger nextBigInteger( final BigInteger min, final BigInteger max, final Random random ) { if (min.compareTo(max) >= 0) { throw new IllegalArgumentException(format( "min >= max: %d >= %d.", min, max )); } final BigInteger n = max.subtract(min).add(BigInteger.ONE); return nextBigInteger(n, random).add(min); }
java
public static BigInteger nextBigInteger( final BigInteger min, final BigInteger max, final Random random ) { if (min.compareTo(max) >= 0) { throw new IllegalArgumentException(format( "min >= max: %d >= %d.", min, max )); } final BigInteger n = max.subtract(min).add(BigInteger.ONE); return nextBigInteger(n, random).add(min); }
[ "public", "static", "BigInteger", "nextBigInteger", "(", "final", "BigInteger", "min", ",", "final", "BigInteger", "max", ",", "final", "Random", "random", ")", "{", "if", "(", "min", ".", "compareTo", "(", "max", ")", ">=", "0", ")", "{", "throw", "new"...
Returns a pseudo-random, uniformly distributed int value between min and max (min and max included). @param min lower bound for generated long integer (inclusively) @param max upper bound for generated long integer (inclusively) @param random the random engine to use for calculating the random long value @return a random long integer greater than or equal to {@code min} and less than or equal to {@code max} @throws IllegalArgumentException if {@code min >= max} @throws NullPointerException if one of the given parameters are {@code null}.
[ "Returns", "a", "pseudo", "-", "random", "uniformly", "distributed", "int", "value", "between", "min", "and", "max", "(", "min", "and", "max", "included", ")", "." ]
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/internal/random.java#L120-L133
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Theme.java
Theme.createChildTheme
public Theme createChildTheme(String name, Map<String, Object> attributes) { Theme theme = getInstance().create().theme(name, getProject(), attributes); theme.setParentTheme(this); theme.save(); return theme; }
java
public Theme createChildTheme(String name, Map<String, Object> attributes) { Theme theme = getInstance().create().theme(name, getProject(), attributes); theme.setParentTheme(this); theme.save(); return theme; }
[ "public", "Theme", "createChildTheme", "(", "String", "name", ",", "Map", "<", "String", ",", "Object", ">", "attributes", ")", "{", "Theme", "theme", "=", "getInstance", "(", ")", ".", "create", "(", ")", ".", "theme", "(", "name", ",", "getProject", ...
Create a theme that is a child of this theme. @param name Name of the new theme. @param attributes additional attributes for new theme. @return The new theme.
[ "Create", "a", "theme", "that", "is", "a", "child", "of", "this", "theme", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Theme.java#L240-L246
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java
FineUploader5Session.addParam
@Nonnull public FineUploader5Session addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) { ValueEnforcer.notEmpty (sKey, "Key"); ValueEnforcer.notNull (sValue, "Value"); m_aSessionParams.put (sKey, sValue); return this; }
java
@Nonnull public FineUploader5Session addParam (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) { ValueEnforcer.notEmpty (sKey, "Key"); ValueEnforcer.notNull (sValue, "Value"); m_aSessionParams.put (sKey, sValue); return this; }
[ "@", "Nonnull", "public", "FineUploader5Session", "addParam", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sKey", ",", "@", "Nonnull", "final", "String", "sValue", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "sKey", ",", "\"Key\"", ")", ";"...
Any parameters you would like passed with the associated GET request to your server. @param sKey Parameter name @param sValue Parameter value @return this
[ "Any", "parameters", "you", "would", "like", "passed", "with", "the", "associated", "GET", "request", "to", "your", "server", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java#L176-L184
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/PasswordNullifier.java
PasswordNullifier.nullify
public static String nullify(String value, byte delimiter) { // check to see if we need to null out passwords if (null == value) { return null; } String source = value.toLowerCase(); StringBuilder b = new StringBuilder(value); boolean modified = optionallyMaskChars(b, source, delimiter, PASSWORD_PATTERN); modified = optionallyMaskChars(b, source, delimiter, CLIENT_SECRET_PATTERN) || modified; if (modified) { return b.toString(); } return value; }
java
public static String nullify(String value, byte delimiter) { // check to see if we need to null out passwords if (null == value) { return null; } String source = value.toLowerCase(); StringBuilder b = new StringBuilder(value); boolean modified = optionallyMaskChars(b, source, delimiter, PASSWORD_PATTERN); modified = optionallyMaskChars(b, source, delimiter, CLIENT_SECRET_PATTERN) || modified; if (modified) { return b.toString(); } return value; }
[ "public", "static", "String", "nullify", "(", "String", "value", ",", "byte", "delimiter", ")", "{", "// check to see if we need to null out passwords", "if", "(", "null", "==", "value", ")", "{", "return", "null", ";", "}", "String", "source", "=", "value", "...
Scan the input value for the "password=" and "client_secret=" key markers and convert the password value to a series of *s. The delimiter value can be used if the search string is a sequence like "key=value<delim>key2=value2". @param value @param delimiter @return String
[ "Scan", "the", "input", "value", "for", "the", "password", "=", "and", "client_secret", "=", "key", "markers", "and", "convert", "the", "password", "value", "to", "a", "series", "of", "*", "s", ".", "The", "delimiter", "value", "can", "be", "used", "if",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/PasswordNullifier.java#L45-L60
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java
JsHdrsImpl.setFlagValue
private final void setFlagValue(byte flagBit, boolean value) { if (value) { flags = (byte) (getFlags() | flagBit); } else { flags = (byte) (getFlags() & (~flagBit)); } }
java
private final void setFlagValue(byte flagBit, boolean value) { if (value) { flags = (byte) (getFlags() | flagBit); } else { flags = (byte) (getFlags() & (~flagBit)); } }
[ "private", "final", "void", "setFlagValue", "(", "byte", "flagBit", ",", "boolean", "value", ")", "{", "if", "(", "value", ")", "{", "flags", "=", "(", "byte", ")", "(", "getFlags", "(", ")", "|", "flagBit", ")", ";", "}", "else", "{", "flags", "="...
Set the boolean 'value' of one of the flags in the FLAGS field of th message. @param flagBit A byte with a single bit set on, marking the position of the required flag. @param value true if the required flag is to be set on, otherwise false
[ "Set", "the", "boolean", "value", "of", "one", "of", "the", "flags", "in", "the", "FLAGS", "field", "of", "th", "message", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java#L2572-L2579
citrusframework/citrus
modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java
MailMessageConverter.handleImageBinaryPart
protected BodyPart handleImageBinaryPart(MimePart image, String contentType) throws IOException, MessagingException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); FileCopyUtils.copy(image.getInputStream(), bos); String base64 = Base64.encodeBase64String(bos.toByteArray()); return new BodyPart(base64, contentType); }
java
protected BodyPart handleImageBinaryPart(MimePart image, String contentType) throws IOException, MessagingException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); FileCopyUtils.copy(image.getInputStream(), bos); String base64 = Base64.encodeBase64String(bos.toByteArray()); return new BodyPart(base64, contentType); }
[ "protected", "BodyPart", "handleImageBinaryPart", "(", "MimePart", "image", ",", "String", "contentType", ")", "throws", "IOException", ",", "MessagingException", "{", "ByteArrayOutputStream", "bos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "FileCopyUtils", ...
Construct base64 body part from image data. @param image @param contentType @return @throws IOException
[ "Construct", "base64", "body", "part", "from", "image", "data", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java#L236-L241
jcuda/jcuda
JCudaJava/src/main/java/jcuda/cuDoubleComplex.java
cuDoubleComplex.cuCadd
public static cuDoubleComplex cuCadd (cuDoubleComplex x, cuDoubleComplex y) { return cuCmplx (cuCreal(x) + cuCreal(y), cuCimag(x) + cuCimag(y)); }
java
public static cuDoubleComplex cuCadd (cuDoubleComplex x, cuDoubleComplex y) { return cuCmplx (cuCreal(x) + cuCreal(y), cuCimag(x) + cuCimag(y)); }
[ "public", "static", "cuDoubleComplex", "cuCadd", "(", "cuDoubleComplex", "x", ",", "cuDoubleComplex", "y", ")", "{", "return", "cuCmplx", "(", "cuCreal", "(", "x", ")", "+", "cuCreal", "(", "y", ")", ",", "cuCimag", "(", "x", ")", "+", "cuCimag", "(", ...
Returns a new complex number that is the sum of the given complex numbers. @param x The first addend @param y The second addend @return The sum of the given addends
[ "Returns", "a", "new", "complex", "number", "that", "is", "the", "sum", "of", "the", "given", "complex", "numbers", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/cuDoubleComplex.java#L104-L107
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/OAuthApi.java
OAuthApi.loadLegacyTokenProperties
private Properties loadLegacyTokenProperties(InputStream inputStream) throws JinxException { Properties p = new Properties(); try { p.loadFromXML(inputStream); } catch (Exception e) { throw new JinxException("Unable to load data from input stream.", e); } return p; }
java
private Properties loadLegacyTokenProperties(InputStream inputStream) throws JinxException { Properties p = new Properties(); try { p.loadFromXML(inputStream); } catch (Exception e) { throw new JinxException("Unable to load data from input stream.", e); } return p; }
[ "private", "Properties", "loadLegacyTokenProperties", "(", "InputStream", "inputStream", ")", "throws", "JinxException", "{", "Properties", "p", "=", "new", "Properties", "(", ")", ";", "try", "{", "p", ".", "loadFromXML", "(", "inputStream", ")", ";", "}", "c...
/* Load legacy properties. The legacy token object stored its data as an XML properties file. Given the input stream to that file, we load a Properties object and return it.
[ "/", "*", "Load", "legacy", "properties", ".", "The", "legacy", "token", "object", "stored", "its", "data", "as", "an", "XML", "properties", "file", ".", "Given", "the", "input", "stream", "to", "that", "file", "we", "load", "a", "Properties", "object", ...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/OAuthApi.java#L188-L196
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/FTPClient.java
FTPClient.getChecksum
public String getChecksum(String algorithm, String path) throws ClientException, ServerException, IOException { return getChecksum(algorithm,0,-1,path); }
java
public String getChecksum(String algorithm, String path) throws ClientException, ServerException, IOException { return getChecksum(algorithm,0,-1,path); }
[ "public", "String", "getChecksum", "(", "String", "algorithm", ",", "String", "path", ")", "throws", "ClientException", ",", "ServerException", ",", "IOException", "{", "return", "getChecksum", "(", "algorithm", ",", "0", ",", "-", "1", ",", "path", ")", ";"...
GridFTP v2 CKSM command for the whole file @param algorithm ckeckum alorithm @param path @return ckecksum value returned by the server @throws org.globus.ftp.exception.ClientException @throws org.globus.ftp.exception.ServerException @throws java.io.IOException
[ "GridFTP", "v2", "CKSM", "command", "for", "the", "whole", "file" ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L2186-L2190
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java
MarshallUtil.marshallMap
public static <K, V, T extends Map<K, V>> void marshallMap(T map, ObjectOutput out) throws IOException { final int mapSize = map == null ? NULL_VALUE : map.size(); marshallSize(out, mapSize); if (mapSize <= 0) return; for (Map.Entry<K, V> me : map.entrySet()) { out.writeObject(me.getKey()); out.writeObject(me.getValue()); } }
java
public static <K, V, T extends Map<K, V>> void marshallMap(T map, ObjectOutput out) throws IOException { final int mapSize = map == null ? NULL_VALUE : map.size(); marshallSize(out, mapSize); if (mapSize <= 0) return; for (Map.Entry<K, V> me : map.entrySet()) { out.writeObject(me.getKey()); out.writeObject(me.getValue()); } }
[ "public", "static", "<", "K", ",", "V", ",", "T", "extends", "Map", "<", "K", ",", "V", ">", ">", "void", "marshallMap", "(", "T", "map", ",", "ObjectOutput", "out", ")", "throws", "IOException", "{", "final", "int", "mapSize", "=", "map", "==", "n...
Marshall the {@code map} to the {@code ObjectOutput}. <p> {@code null} maps are supported. @param map {@link Map} to marshall. @param out {@link ObjectOutput} to write. It must be non-null. @param <K> Key type of the map. @param <V> Value type of the map. @param <T> Type of the {@link Map}. @throws IOException If any of the usual Input/Output related exceptions occur.
[ "Marshall", "the", "{", "@code", "map", "}", "to", "the", "{", "@code", "ObjectOutput", "}", ".", "<p", ">", "{", "@code", "null", "}", "maps", "are", "supported", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L56-L65
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java
CommonHelper.asURI
public static URI asURI(final String s) { try { return new URI(s); } catch (final URISyntaxException e) { throw new TechnicalException("Cannot make an URI from: " + s, e); } }
java
public static URI asURI(final String s) { try { return new URI(s); } catch (final URISyntaxException e) { throw new TechnicalException("Cannot make an URI from: " + s, e); } }
[ "public", "static", "URI", "asURI", "(", "final", "String", "s", ")", "{", "try", "{", "return", "new", "URI", "(", "s", ")", ";", "}", "catch", "(", "final", "URISyntaxException", "e", ")", "{", "throw", "new", "TechnicalException", "(", "\"Cannot make ...
Convert a string into an URI. @param s the string @return the URI
[ "Convert", "a", "string", "into", "an", "URI", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/util/CommonHelper.java#L260-L266
visallo/vertexium
accumulo-iterators/src/main/java/org/vertexium/accumulo/iterator/model/EdgeInfo.java
EdgeInfo.getVertexId
public static String getVertexId(Value value) { byte[] buffer = value.get(); int offset = 0; // skip label int strLen = readInt(buffer, offset); offset += 4; if (strLen > 0) { offset += strLen; } strLen = readInt(buffer, offset); return readString(buffer, offset, strLen); }
java
public static String getVertexId(Value value) { byte[] buffer = value.get(); int offset = 0; // skip label int strLen = readInt(buffer, offset); offset += 4; if (strLen > 0) { offset += strLen; } strLen = readInt(buffer, offset); return readString(buffer, offset, strLen); }
[ "public", "static", "String", "getVertexId", "(", "Value", "value", ")", "{", "byte", "[", "]", "buffer", "=", "value", ".", "get", "(", ")", ";", "int", "offset", "=", "0", ";", "// skip label", "int", "strLen", "=", "readInt", "(", "buffer", ",", "...
fast access method to avoid creating a new instance of an EdgeInfo
[ "fast", "access", "method", "to", "avoid", "creating", "a", "new", "instance", "of", "an", "EdgeInfo" ]
train
https://github.com/visallo/vertexium/blob/bb132b5425ac168957667164e1409b78adbea769/accumulo-iterators/src/main/java/org/vertexium/accumulo/iterator/model/EdgeInfo.java#L56-L69
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.isCurrencyAvailable
public static boolean isCurrencyAvailable(String code, String... providers) { return Objects.nonNull(MONETARY_CURRENCIES_SINGLETON_SPI()) && MONETARY_CURRENCIES_SINGLETON_SPI().isCurrencyAvailable(code, providers); }
java
public static boolean isCurrencyAvailable(String code, String... providers) { return Objects.nonNull(MONETARY_CURRENCIES_SINGLETON_SPI()) && MONETARY_CURRENCIES_SINGLETON_SPI().isCurrencyAvailable(code, providers); }
[ "public", "static", "boolean", "isCurrencyAvailable", "(", "String", "code", ",", "String", "...", "providers", ")", "{", "return", "Objects", ".", "nonNull", "(", "MONETARY_CURRENCIES_SINGLETON_SPI", "(", ")", ")", "&&", "MONETARY_CURRENCIES_SINGLETON_SPI", "(", ")...
Allows to check if a {@link CurrencyUnit} instance is defined, i.e. accessible from {@link Monetary#getCurrency(String, String...)}. @param code the currency code, not {@code null}. @param providers the (optional) specification of providers to consider. @return {@code true} if {@link Monetary#getCurrency(String, java.lang.String...)} would return a result for the given code.
[ "Allows", "to", "check", "if", "a", "{", "@link", "CurrencyUnit", "}", "instance", "is", "defined", "i", ".", "e", ".", "accessible", "from", "{", "@link", "Monetary#getCurrency", "(", "String", "String", "...", ")", "}", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L435-L437
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.scale
public static Image scale(Image srcImg, int width, int height) { return Img.from(srcImg).scale(width, height).getImg(); }
java
public static Image scale(Image srcImg, int width, int height) { return Img.from(srcImg).scale(width, height).getImg(); }
[ "public", "static", "Image", "scale", "(", "Image", "srcImg", ",", "int", "width", ",", "int", "height", ")", "{", "return", "Img", ".", "from", "(", "srcImg", ")", ".", "scale", "(", "width", ",", "height", ")", ".", "getImg", "(", ")", ";", "}" ]
缩放图像(按长宽缩放)<br> 注意:目标长宽与原图不成比例会变形 @param srcImg 源图像来源流 @param width 目标宽度 @param height 目标高度 @return {@link Image} @since 3.1.0
[ "缩放图像(按长宽缩放)<br", ">", "注意:目标长宽与原图不成比例会变形" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L169-L171
bwkimmel/java-util
src/main/java/ca/eandb/util/io/FileUtil.java
FileUtil.setFileContents
public static void setFileContents(File file, ByteBuffer contents, boolean createDirectory) throws IOException { if (createDirectory) { File directory = file.getParentFile(); if (!directory.exists()) { directory.mkdirs(); } } FileOutputStream stream = new FileOutputStream(file); StreamUtil.writeBytes(contents, stream); stream.close(); }
java
public static void setFileContents(File file, ByteBuffer contents, boolean createDirectory) throws IOException { if (createDirectory) { File directory = file.getParentFile(); if (!directory.exists()) { directory.mkdirs(); } } FileOutputStream stream = new FileOutputStream(file); StreamUtil.writeBytes(contents, stream); stream.close(); }
[ "public", "static", "void", "setFileContents", "(", "File", "file", ",", "ByteBuffer", "contents", ",", "boolean", "createDirectory", ")", "throws", "IOException", "{", "if", "(", "createDirectory", ")", "{", "File", "directory", "=", "file", ".", "getParentFile...
Writes the specified byte array to a file. @param file The <code>File</code> to write. @param contents The byte array to write to the file. @param createDirectory A value indicating whether the directory containing the file to be written should be created if it does not exist. @throws IOException If the file could not be written.
[ "Writes", "the", "specified", "byte", "array", "to", "a", "file", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L142-L153
westnordost/osmapi
src/main/java/de/westnordost/osmapi/changesets/ChangesetsDao.java
ChangesetsDao.find
public void find(Handler<ChangesetInfo> handler, QueryChangesetsFilters filters) { String query = filters != null ? "?" + filters.toParamString() : ""; try { osm.makeAuthenticatedRequest(CHANGESET + "s" + query, null, new ChangesetParser(handler)); } catch(OsmNotFoundException e) { // ok, we are done (ignore the exception) } }
java
public void find(Handler<ChangesetInfo> handler, QueryChangesetsFilters filters) { String query = filters != null ? "?" + filters.toParamString() : ""; try { osm.makeAuthenticatedRequest(CHANGESET + "s" + query, null, new ChangesetParser(handler)); } catch(OsmNotFoundException e) { // ok, we are done (ignore the exception) } }
[ "public", "void", "find", "(", "Handler", "<", "ChangesetInfo", ">", "handler", ",", "QueryChangesetsFilters", "filters", ")", "{", "String", "query", "=", "filters", "!=", "null", "?", "\"?\"", "+", "filters", ".", "toParamString", "(", ")", ":", "\"\"", ...
Get a number of changesets that match the given filters. @param handler The handler which is fed the incoming changeset infos @param filters what to search for. I.e. new QueryChangesetsFilters().byUser(123).onlyClosed() @throws OsmAuthorizationException if not logged in
[ "Get", "a", "number", "of", "changesets", "that", "match", "the", "given", "filters", "." ]
train
https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/changesets/ChangesetsDao.java#L57-L68
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.afterCompletionRRS
@Override public void afterCompletionRRS() { stateMgr.setStateNoValidate(WSStateManager.NO_TRANSACTION_ACTIVE); // now reset the RRA internal flag as its the only place we can set it in the cases of unsharable connections. // in the cases of shareable conections, the flag will be set to false twice (one here and another in cleanup, but that is ok) setRrsGlobalTransactionReallyActive(false); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Setting transaction state to NO_TRANSACTION_ACTIVE"); }
java
@Override public void afterCompletionRRS() { stateMgr.setStateNoValidate(WSStateManager.NO_TRANSACTION_ACTIVE); // now reset the RRA internal flag as its the only place we can set it in the cases of unsharable connections. // in the cases of shareable conections, the flag will be set to false twice (one here and another in cleanup, but that is ok) setRrsGlobalTransactionReallyActive(false); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Setting transaction state to NO_TRANSACTION_ACTIVE"); }
[ "@", "Override", "public", "void", "afterCompletionRRS", "(", ")", "{", "stateMgr", ".", "setStateNoValidate", "(", "WSStateManager", ".", "NO_TRANSACTION_ACTIVE", ")", ";", "// now reset the RRA internal flag as its the only place we can set it in the cases of unsharable connectio...
Invoked after completion of a z/OS RRS (Resource Recovery Services) global transaction.
[ "Invoked", "after", "completion", "of", "a", "z", "/", "OS", "RRS", "(", "Resource", "Recovery", "Services", ")", "global", "transaction", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L562-L570
netty/netty
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java
SpdySessionHandler.issueStreamError
private void issueStreamError(ChannelHandlerContext ctx, int streamId, SpdyStreamStatus status) { boolean fireChannelRead = !spdySession.isRemoteSideClosed(streamId); ChannelPromise promise = ctx.newPromise(); removeStream(streamId, promise); SpdyRstStreamFrame spdyRstStreamFrame = new DefaultSpdyRstStreamFrame(streamId, status); ctx.writeAndFlush(spdyRstStreamFrame, promise); if (fireChannelRead) { ctx.fireChannelRead(spdyRstStreamFrame); } }
java
private void issueStreamError(ChannelHandlerContext ctx, int streamId, SpdyStreamStatus status) { boolean fireChannelRead = !spdySession.isRemoteSideClosed(streamId); ChannelPromise promise = ctx.newPromise(); removeStream(streamId, promise); SpdyRstStreamFrame spdyRstStreamFrame = new DefaultSpdyRstStreamFrame(streamId, status); ctx.writeAndFlush(spdyRstStreamFrame, promise); if (fireChannelRead) { ctx.fireChannelRead(spdyRstStreamFrame); } }
[ "private", "void", "issueStreamError", "(", "ChannelHandlerContext", "ctx", ",", "int", "streamId", ",", "SpdyStreamStatus", "status", ")", "{", "boolean", "fireChannelRead", "=", "!", "spdySession", ".", "isRemoteSideClosed", "(", "streamId", ")", ";", "ChannelProm...
/* SPDY Stream Error Handling: Upon a stream error, the endpoint must send a RST_STREAM frame which contains the Stream-ID for the stream where the error occurred and the error getStatus which caused the error. After sending the RST_STREAM, the stream is closed to the sending endpoint. Note: this is only called by the worker thread
[ "/", "*", "SPDY", "Stream", "Error", "Handling", ":" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySessionHandler.java#L677-L687
nightcode/yaranga
core/src/org/nightcode/common/base/Splitter.java
Splitter.trim
public Splitter trim(char c) { Matcher matcher = new CharMatcher(c); return new Splitter(pairSeparator, keyValueSeparator, matcher, matcher); }
java
public Splitter trim(char c) { Matcher matcher = new CharMatcher(c); return new Splitter(pairSeparator, keyValueSeparator, matcher, matcher); }
[ "public", "Splitter", "trim", "(", "char", "c", ")", "{", "Matcher", "matcher", "=", "new", "CharMatcher", "(", "c", ")", ";", "return", "new", "Splitter", "(", "pairSeparator", ",", "keyValueSeparator", ",", "matcher", ",", "matcher", ")", ";", "}" ]
Returns a splitter that removes all leading or trailing characters matching the given character from each returned key and value. @param c character @return a splitter with the desired configuration
[ "Returns", "a", "splitter", "that", "removes", "all", "leading", "or", "trailing", "characters", "matching", "the", "given", "character", "from", "each", "returned", "key", "and", "value", "." ]
train
https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/base/Splitter.java#L140-L143
greese/dasein-util
src/main/java/org/dasein/attributes/DataTypeFactory.java
DataTypeFactory.getDisplayValue
public String getDisplayValue(Locale loc, Object ob) { if( ob == null ) { return ""; } if( ob instanceof Translator ) { @SuppressWarnings("rawtypes") Translation trans = ((Translator)ob).get(loc); if( trans == null ) { return null; } return getDisplayValue(trans.getData()); } else { return getDisplayValue(ob); } }
java
public String getDisplayValue(Locale loc, Object ob) { if( ob == null ) { return ""; } if( ob instanceof Translator ) { @SuppressWarnings("rawtypes") Translation trans = ((Translator)ob).get(loc); if( trans == null ) { return null; } return getDisplayValue(trans.getData()); } else { return getDisplayValue(ob); } }
[ "public", "String", "getDisplayValue", "(", "Locale", "loc", ",", "Object", "ob", ")", "{", "if", "(", "ob", "==", "null", ")", "{", "return", "\"\"", ";", "}", "if", "(", "ob", "instanceof", "Translator", ")", "{", "@", "SuppressWarnings", "(", "\"raw...
Provides a display version of the specified value translated for the target locale. @param loc the locale for which the display should be translated @param ob the target value @return a display version of the specified value
[ "Provides", "a", "display", "version", "of", "the", "specified", "value", "translated", "for", "the", "target", "locale", "." ]
train
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/attributes/DataTypeFactory.java#L362-L377
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/file/FileHelper.java
FileHelper.writeToFile
public static void writeToFile(String pFileName, String pContents, boolean pAppend) throws IOException{ FileWriter writer = null; writer = new FileWriter(pFileName, pAppend); writer.write(pContents); writer.flush(); writer.close(); }
java
public static void writeToFile(String pFileName, String pContents, boolean pAppend) throws IOException{ FileWriter writer = null; writer = new FileWriter(pFileName, pAppend); writer.write(pContents); writer.flush(); writer.close(); }
[ "public", "static", "void", "writeToFile", "(", "String", "pFileName", ",", "String", "pContents", ",", "boolean", "pAppend", ")", "throws", "IOException", "{", "FileWriter", "writer", "=", "null", ";", "writer", "=", "new", "FileWriter", "(", "pFileName", ","...
Method that writes the file contents @param pFileName @param pContents @param pAppend
[ "Method", "that", "writes", "the", "file", "contents" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/file/FileHelper.java#L206-L214
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java
JBossASClient.readResource
public ModelNode readResource(Address addr, boolean recursive) throws Exception { final ModelNode request = createRequest(READ_RESOURCE, addr); request.get("recursive").set(recursive); final ModelNode results = getModelControllerClient().execute(request, OperationMessageHandler.logging); if (isSuccess(results)) { final ModelNode resource = getResults(results); return resource; } else { return null; } }
java
public ModelNode readResource(Address addr, boolean recursive) throws Exception { final ModelNode request = createRequest(READ_RESOURCE, addr); request.get("recursive").set(recursive); final ModelNode results = getModelControllerClient().execute(request, OperationMessageHandler.logging); if (isSuccess(results)) { final ModelNode resource = getResults(results); return resource; } else { return null; } }
[ "public", "ModelNode", "readResource", "(", "Address", "addr", ",", "boolean", "recursive", ")", "throws", "Exception", "{", "final", "ModelNode", "request", "=", "createRequest", "(", "READ_RESOURCE", ",", "addr", ")", ";", "request", ".", "get", "(", "\"recu...
This returns information on the resource at the given address, recursively returning child nodes with the result if recursive argument is set to <code>true</code>. This will not return an exception if the address points to a non-existent resource, rather, it will just return null. You can use this as a test for resource existence. @param addr the address of the resource @param recursive if true, return all child data within the resource node @return the found item or null if not found @throws Exception if some error prevented the lookup from even happening
[ "This", "returns", "information", "on", "the", "resource", "at", "the", "given", "address", "recursively", "returning", "child", "nodes", "with", "the", "result", "if", "recursive", "argument", "is", "set", "to", "<code", ">", "true<", "/", "code", ">", ".",...
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L311-L321
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/common/Checksums.java
Checksums.calculateMod11CheckSum
public static int calculateMod11CheckSum(int[] weights, StringNumber number) { int c = calculateChecksum(weights, number, false) % 11; if (c == 1) { throw new IllegalArgumentException(ERROR_INVALID_CHECKSUM + number); } return c == 0 ? 0 : 11 - c; }
java
public static int calculateMod11CheckSum(int[] weights, StringNumber number) { int c = calculateChecksum(weights, number, false) % 11; if (c == 1) { throw new IllegalArgumentException(ERROR_INVALID_CHECKSUM + number); } return c == 0 ? 0 : 11 - c; }
[ "public", "static", "int", "calculateMod11CheckSum", "(", "int", "[", "]", "weights", ",", "StringNumber", "number", ")", "{", "int", "c", "=", "calculateChecksum", "(", "weights", ",", "number", ",", "false", ")", "%", "11", ";", "if", "(", "c", "==", ...
Calculate the check sum for the given weights and number. @param weights The weights @param number The number @return The checksum
[ "Calculate", "the", "check", "sum", "for", "the", "given", "weights", "and", "number", "." ]
train
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/common/Checksums.java#L14-L20
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.createImage
public static void createImage(String str, Font font, Color backgroundColor, Color fontColor, ImageOutputStream out) throws IORuntimeException { // 获取font的样式应用在str上的整个矩形 Rectangle2D r = font.getStringBounds(str, new FontRenderContext(AffineTransform.getScaleInstance(1, 1), false, false)); int unitHeight = (int) Math.floor(r.getHeight());// 获取单个字符的高度 // 获取整个str用了font样式的宽度这里用四舍五入后+1保证宽度绝对能容纳这个字符串作为图片的宽度 int width = (int) Math.round(r.getWidth()) + 1; int height = unitHeight + 3;// 把单个字符的高度+3保证高度绝对能容纳字符串作为图片的高度 // 创建图片 BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); Graphics g = image.getGraphics(); g.setColor(backgroundColor); g.fillRect(0, 0, width, height);// 先用背景色填充整张图片,也就是背景 g.setColor(fontColor); g.setFont(font);// 设置画笔字体 g.drawString(str, 0, font.getSize());// 画出字符串 g.dispose(); writePng(image, out); }
java
public static void createImage(String str, Font font, Color backgroundColor, Color fontColor, ImageOutputStream out) throws IORuntimeException { // 获取font的样式应用在str上的整个矩形 Rectangle2D r = font.getStringBounds(str, new FontRenderContext(AffineTransform.getScaleInstance(1, 1), false, false)); int unitHeight = (int) Math.floor(r.getHeight());// 获取单个字符的高度 // 获取整个str用了font样式的宽度这里用四舍五入后+1保证宽度绝对能容纳这个字符串作为图片的宽度 int width = (int) Math.round(r.getWidth()) + 1; int height = unitHeight + 3;// 把单个字符的高度+3保证高度绝对能容纳字符串作为图片的高度 // 创建图片 BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); Graphics g = image.getGraphics(); g.setColor(backgroundColor); g.fillRect(0, 0, width, height);// 先用背景色填充整张图片,也就是背景 g.setColor(fontColor); g.setFont(font);// 设置画笔字体 g.drawString(str, 0, font.getSize());// 画出字符串 g.dispose(); writePng(image, out); }
[ "public", "static", "void", "createImage", "(", "String", "str", ",", "Font", "font", ",", "Color", "backgroundColor", ",", "Color", "fontColor", ",", "ImageOutputStream", "out", ")", "throws", "IORuntimeException", "{", "// 获取font的样式应用在str上的整个矩形\r", "Rectangle2D", ...
根据文字创建PNG图片 @param str 文字 @param font 字体{@link Font} @param backgroundColor 背景颜色 @param fontColor 字体颜色 @param out 图片输出地 @throws IORuntimeException IO异常
[ "根据文字创建PNG图片" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1269-L1286
Samsung/GearVRf
GVRf/Extensions/3DCursor/IODevices/io_template/src/main/java/com/sample/template/TemplateDevice.java
TemplateDevice.dispatchKeyEvent
public void dispatchKeyEvent(int code, int action) { int keyCode = 0; int keyAction = 0; if (code == BUTTON_1) { keyCode = KeyEvent.KEYCODE_BUTTON_1; } else if (code == BUTTON_2) { keyCode = KeyEvent.KEYCODE_BUTTON_2; } if (action == ACTION_DOWN) { keyAction = KeyEvent.ACTION_DOWN; } else if (action == ACTION_UP) { keyAction = KeyEvent.ACTION_UP; } KeyEvent keyEvent = new KeyEvent(keyAction, keyCode); setKeyEvent(keyEvent); }
java
public void dispatchKeyEvent(int code, int action) { int keyCode = 0; int keyAction = 0; if (code == BUTTON_1) { keyCode = KeyEvent.KEYCODE_BUTTON_1; } else if (code == BUTTON_2) { keyCode = KeyEvent.KEYCODE_BUTTON_2; } if (action == ACTION_DOWN) { keyAction = KeyEvent.ACTION_DOWN; } else if (action == ACTION_UP) { keyAction = KeyEvent.ACTION_UP; } KeyEvent keyEvent = new KeyEvent(keyAction, keyCode); setKeyEvent(keyEvent); }
[ "public", "void", "dispatchKeyEvent", "(", "int", "code", ",", "int", "action", ")", "{", "int", "keyCode", "=", "0", ";", "int", "keyAction", "=", "0", ";", "if", "(", "code", "==", "BUTTON_1", ")", "{", "keyCode", "=", "KeyEvent", ".", "KEYCODE_BUTTO...
Synthesize and forward a KeyEvent to the library. This call is made from the native layer. @param code id of the button @param action integer representing the action taken on the button
[ "Synthesize", "and", "forward", "a", "KeyEvent", "to", "the", "library", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/io_template/src/main/java/com/sample/template/TemplateDevice.java#L147-L164
gosu-lang/gosu-lang
gosu-lab/src/main/java/editor/plugin/typeloader/java/JavaDocument.java
JavaDocument.insertString
@Override public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException { switch( str ) { case "(": str = addParenthesis(); break; case "\n": str = addWhiteSpace( offset ); break; case "\"": str = addMatchingQuotationMark(); break; case "{": str = addMatchingBrace( offset ); break; } super.insertString( offset, str, a ); processChangedLines( offset, str.length() ); }
java
@Override public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException { switch( str ) { case "(": str = addParenthesis(); break; case "\n": str = addWhiteSpace( offset ); break; case "\"": str = addMatchingQuotationMark(); break; case "{": str = addMatchingBrace( offset ); break; } super.insertString( offset, str, a ); processChangedLines( offset, str.length() ); }
[ "@", "Override", "public", "void", "insertString", "(", "int", "offset", ",", "String", "str", ",", "AttributeSet", "a", ")", "throws", "BadLocationException", "{", "switch", "(", "str", ")", "{", "case", "\"(\"", ":", "str", "=", "addParenthesis", "(", ")...
Override to apply syntax highlighting after the document has been updated
[ "Override", "to", "apply", "syntax", "highlighting", "after", "the", "document", "has", "been", "updated" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/plugin/typeloader/java/JavaDocument.java#L114-L134
mike10004/common-helper
imnetio-helper/src/main/java/com/github/mike10004/common/image/ImageInfos.java
ImageInfos.readImageSize
public static Dimension readImageSize(byte[] bytes) { ByteArrayInputStream in = new ByteArrayInputStream(bytes); ImageInfo ii = new ImageInfo(); ii.setInput(in); if (ii.check()) { return new Dimension(ii.getWidth(), ii.getHeight()); } else { in.reset(); BufferedImage image; try { image = ImageIO.read(in); if (image == null) { throw new IOException("failed to read image; format is probably not supported"); } return new Dimension(image.getWidth(), image.getHeight()); } catch (IOException ex) { Integer m1 = bytes.length > 0 ? Integer.valueOf(bytes[0]) : null; Integer m2 = bytes.length > 1 ? Integer.valueOf(bytes[1]) : null; Logger.getLogger(ImageInfos.class.getName()) .log(Level.FINER, "reading image failed on array of " + "length {0} with magic number {1} {2}: {3}", new Object[]{bytes.length, m1, m2, ex}); return new Dimension(0, 0); } } }
java
public static Dimension readImageSize(byte[] bytes) { ByteArrayInputStream in = new ByteArrayInputStream(bytes); ImageInfo ii = new ImageInfo(); ii.setInput(in); if (ii.check()) { return new Dimension(ii.getWidth(), ii.getHeight()); } else { in.reset(); BufferedImage image; try { image = ImageIO.read(in); if (image == null) { throw new IOException("failed to read image; format is probably not supported"); } return new Dimension(image.getWidth(), image.getHeight()); } catch (IOException ex) { Integer m1 = bytes.length > 0 ? Integer.valueOf(bytes[0]) : null; Integer m2 = bytes.length > 1 ? Integer.valueOf(bytes[1]) : null; Logger.getLogger(ImageInfos.class.getName()) .log(Level.FINER, "reading image failed on array of " + "length {0} with magic number {1} {2}: {3}", new Object[]{bytes.length, m1, m2, ex}); return new Dimension(0, 0); } } }
[ "public", "static", "Dimension", "readImageSize", "(", "byte", "[", "]", "bytes", ")", "{", "ByteArrayInputStream", "in", "=", "new", "ByteArrayInputStream", "(", "bytes", ")", ";", "ImageInfo", "ii", "=", "new", "ImageInfo", "(", ")", ";", "ii", ".", "set...
Reads the image size from a byte array containing image data. This first attempts to use {@link ImageInfo} to read just the header data, but if that fails the whole image is buffered into memory with {@link ImageIO#read(java.io.InputStream) }. In any case, this method never throws an exception; instead, if the image data is unreadable, it returns a dimension object with zero width and height. <p>In common deployments, the fallback of loading the image into memory probably never works, because {@code ImageInfo}'s support is a superset of JDK image format support. But some installations may have extra codecs installed, and it's nice to make use of those if they're there. @param bytes the image data bytes @return the image dimensions
[ "Reads", "the", "image", "size", "from", "a", "byte", "array", "containing", "image", "data", ".", "This", "first", "attempts", "to", "use", "{", "@link", "ImageInfo", "}", "to", "read", "just", "the", "header", "data", "but", "if", "that", "fails", "the...
train
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/imnetio-helper/src/main/java/com/github/mike10004/common/image/ImageInfos.java#L38-L63
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcServiceUtils.java
AkkaRpcServiceUtils.createRpcService
public static RpcService createRpcService( String hostname, String portRangeDefinition, Configuration configuration) throws Exception { final ActorSystem actorSystem = BootstrapTools.startActorSystem(configuration, hostname, portRangeDefinition, LOG); return instantiateAkkaRpcService(configuration, actorSystem); }
java
public static RpcService createRpcService( String hostname, String portRangeDefinition, Configuration configuration) throws Exception { final ActorSystem actorSystem = BootstrapTools.startActorSystem(configuration, hostname, portRangeDefinition, LOG); return instantiateAkkaRpcService(configuration, actorSystem); }
[ "public", "static", "RpcService", "createRpcService", "(", "String", "hostname", ",", "String", "portRangeDefinition", ",", "Configuration", "configuration", ")", "throws", "Exception", "{", "final", "ActorSystem", "actorSystem", "=", "BootstrapTools", ".", "startActorS...
Utility method to create RPC service from configuration and hostname, port. @param hostname The hostname/address that describes the TaskManager's data location. @param portRangeDefinition The port range to start TaskManager on. @param configuration The configuration for the TaskManager. @return The rpc service which is used to start and connect to the TaskManager RpcEndpoint . @throws IOException Thrown, if the actor system can not bind to the address @throws Exception Thrown is some other error occurs while creating akka actor system
[ "Utility", "method", "to", "create", "RPC", "service", "from", "configuration", "and", "hostname", "port", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcServiceUtils.java#L80-L86
mabe02/lanterna
src/main/java/com/googlecode/lanterna/TerminalSize.java
TerminalSize.withRows
public TerminalSize withRows(int rows) { if(this.rows == rows) { return this; } if(rows == 0 && this.columns == 0) { return ZERO; } return new TerminalSize(this.columns, rows); }
java
public TerminalSize withRows(int rows) { if(this.rows == rows) { return this; } if(rows == 0 && this.columns == 0) { return ZERO; } return new TerminalSize(this.columns, rows); }
[ "public", "TerminalSize", "withRows", "(", "int", "rows", ")", "{", "if", "(", "this", ".", "rows", "==", "rows", ")", "{", "return", "this", ";", "}", "if", "(", "rows", "==", "0", "&&", "this", ".", "columns", "==", "0", ")", "{", "return", "ZE...
Creates a new size based on this size, but with a different height @param rows Height of the new size, in rows @return New size based on this one, but with a new height
[ "Creates", "a", "new", "size", "based", "on", "this", "size", "but", "with", "a", "different", "height" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TerminalSize.java#L85-L93
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CollectScoresIterationListener.java
CollectScoresIterationListener.exportScores
public void exportScores(OutputStream outputStream, String delimiter) throws IOException { StringBuilder sb = new StringBuilder(); sb.append("Iteration").append(delimiter).append("Score"); for (Pair<Integer, Double> p : scoreVsIter) { sb.append("\n").append(p.getFirst()).append(delimiter).append(p.getSecond()); } outputStream.write(sb.toString().getBytes("UTF-8")); }
java
public void exportScores(OutputStream outputStream, String delimiter) throws IOException { StringBuilder sb = new StringBuilder(); sb.append("Iteration").append(delimiter).append("Score"); for (Pair<Integer, Double> p : scoreVsIter) { sb.append("\n").append(p.getFirst()).append(delimiter).append(p.getSecond()); } outputStream.write(sb.toString().getBytes("UTF-8")); }
[ "public", "void", "exportScores", "(", "OutputStream", "outputStream", ",", "String", "delimiter", ")", "throws", "IOException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"Iteration\"", ")", ".", "appen...
Export the scores in delimited (one per line) UTF-8 format with the specified delimiter @param outputStream Stream to write to @param delimiter Delimiter to use
[ "Export", "the", "scores", "in", "delimited", "(", "one", "per", "line", ")", "UTF", "-", "8", "format", "with", "the", "specified", "delimiter" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CollectScoresIterationListener.java#L84-L91
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.setCompoundDrawables
public void setCompoundDrawables (Drawable left, Drawable top, Drawable right, Drawable bottom){ mInputView.setCompoundDrawables(left, top, right, bottom); if(mDividerCompoundPadding) { mDivider.setPadding(mInputView.getTotalPaddingLeft(), mInputView.getTotalPaddingRight()); if(mLabelEnable) mLabelView.setPadding(mDivider.getPaddingLeft(), mLabelView.getPaddingTop(), mDivider.getPaddingRight(), mLabelView.getPaddingBottom()); if(mSupportMode != SUPPORT_MODE_NONE) mSupportView.setPadding(mDivider.getPaddingLeft(), mSupportView.getPaddingTop(), mDivider.getPaddingRight(), mSupportView.getPaddingBottom()); } }
java
public void setCompoundDrawables (Drawable left, Drawable top, Drawable right, Drawable bottom){ mInputView.setCompoundDrawables(left, top, right, bottom); if(mDividerCompoundPadding) { mDivider.setPadding(mInputView.getTotalPaddingLeft(), mInputView.getTotalPaddingRight()); if(mLabelEnable) mLabelView.setPadding(mDivider.getPaddingLeft(), mLabelView.getPaddingTop(), mDivider.getPaddingRight(), mLabelView.getPaddingBottom()); if(mSupportMode != SUPPORT_MODE_NONE) mSupportView.setPadding(mDivider.getPaddingLeft(), mSupportView.getPaddingTop(), mDivider.getPaddingRight(), mSupportView.getPaddingBottom()); } }
[ "public", "void", "setCompoundDrawables", "(", "Drawable", "left", ",", "Drawable", "top", ",", "Drawable", "right", ",", "Drawable", "bottom", ")", "{", "mInputView", ".", "setCompoundDrawables", "(", "left", ",", "top", ",", "right", ",", "bottom", ")", ";...
Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use {@code null} if you do not want a Drawable there. The Drawables must already have had {@link Drawable#setBounds} called. <p> Calling this method will overwrite any Drawables previously set using {@link #setCompoundDrawablesRelative} or related methods. @attr ref android.R.styleable#TextView_drawableLeft @attr ref android.R.styleable#TextView_drawableTop @attr ref android.R.styleable#TextView_drawableRight @attr ref android.R.styleable#TextView_drawableBottom
[ "Sets", "the", "Drawables", "(", "if", "any", ")", "to", "appear", "to", "the", "left", "of", "above", "to", "the", "right", "of", "and", "below", "the", "text", ".", "Use", "{", "@code", "null", "}", "if", "you", "do", "not", "want", "a", "Drawabl...
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L2693-L2702
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java
XpathUtils.asInteger
public static Integer asInteger(String expression, Node node) throws XPathExpressionException { return asInteger(expression, node, xpath()); }
java
public static Integer asInteger(String expression, Node node) throws XPathExpressionException { return asInteger(expression, node, xpath()); }
[ "public", "static", "Integer", "asInteger", "(", "String", "expression", ",", "Node", "node", ")", "throws", "XPathExpressionException", "{", "return", "asInteger", "(", "expression", ",", "node", ",", "xpath", "(", ")", ")", ";", "}" ]
Evaluates the specified XPath expression and returns the result as an Integer. <p> This method can be expensive as a new xpath is instantiated per invocation. Consider passing in the xpath explicitly via { {@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is not thread-safe and not reentrant. @param expression The XPath expression to evaluate. @param node The node to run the expression on. @return The Integer result. @throws XPathExpressionException If there was a problem processing the specified XPath expression.
[ "Evaluates", "the", "specified", "XPath", "expression", "and", "returns", "the", "result", "as", "an", "Integer", ".", "<p", ">", "This", "method", "can", "be", "expensive", "as", "a", "new", "xpath", "is", "instantiated", "per", "invocation", ".", "Consider...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L277-L280
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getCompositeEntityRoles
public List<EntityRole> getCompositeEntityRoles(UUID appId, String versionId, UUID cEntityId) { return getCompositeEntityRolesWithServiceResponseAsync(appId, versionId, cEntityId).toBlocking().single().body(); }
java
public List<EntityRole> getCompositeEntityRoles(UUID appId, String versionId, UUID cEntityId) { return getCompositeEntityRolesWithServiceResponseAsync(appId, versionId, cEntityId).toBlocking().single().body(); }
[ "public", "List", "<", "EntityRole", ">", "getCompositeEntityRoles", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ")", "{", "return", "getCompositeEntityRolesWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cEntityId", ...
Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor 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;EntityRole&gt; object if successful.
[ "Get", "All", "Entity", "Roles", "for", "a", "given", "entity", "." ]
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/ModelsImpl.java#L8779-L8781
advantageous/boon
reflekt/src/main/java/io/advantageous/boon/core/Str.java
Str.slcEnd
public static String slcEnd( String str, int end ) { return FastStringUtils.noCopyStringFromChars( Chr.slcEnd( FastStringUtils.toCharArray(str), end ) ); }
java
public static String slcEnd( String str, int end ) { return FastStringUtils.noCopyStringFromChars( Chr.slcEnd( FastStringUtils.toCharArray(str), end ) ); }
[ "public", "static", "String", "slcEnd", "(", "String", "str", ",", "int", "end", ")", "{", "return", "FastStringUtils", ".", "noCopyStringFromChars", "(", "Chr", ".", "slcEnd", "(", "FastStringUtils", ".", "toCharArray", "(", "str", ")", ",", "end", ")", "...
Gets end slice of a string. @param str string @param end end index of slice @return new string
[ "Gets", "end", "slice", "of", "a", "string", "." ]
train
https://github.com/advantageous/boon/blob/12712d376761aa3b33223a9f1716720ddb67cb5e/reflekt/src/main/java/io/advantageous/boon/core/Str.java#L172-L174
liferay/com-liferay-commerce
commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java
CommerceUserSegmentEntryPersistenceImpl.fetchByG_K
@Override public CommerceUserSegmentEntry fetchByG_K(long groupId, String key) { return fetchByG_K(groupId, key, true); }
java
@Override public CommerceUserSegmentEntry fetchByG_K(long groupId, String key) { return fetchByG_K(groupId, key, true); }
[ "@", "Override", "public", "CommerceUserSegmentEntry", "fetchByG_K", "(", "long", "groupId", ",", "String", "key", ")", "{", "return", "fetchByG_K", "(", "groupId", ",", "key", ",", "true", ")", ";", "}" ]
Returns the commerce user segment entry where groupId = &#63; and key = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param groupId the group ID @param key the key @return the matching commerce user segment entry, or <code>null</code> if a matching commerce user segment entry could not be found
[ "Returns", "the", "commerce", "user", "segment", "entry", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java#L1031-L1034
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogSizing.java
CatalogSizing.getCatalogSizes
public static DatabaseSizes getCatalogSizes(Database dbCatalog, boolean isXDCR) { DatabaseSizes dbSizes = new DatabaseSizes(); for (Table table: dbCatalog.getTables()) { dbSizes.addTable(getTableSize(table, isXDCR)); } return dbSizes; }
java
public static DatabaseSizes getCatalogSizes(Database dbCatalog, boolean isXDCR) { DatabaseSizes dbSizes = new DatabaseSizes(); for (Table table: dbCatalog.getTables()) { dbSizes.addTable(getTableSize(table, isXDCR)); } return dbSizes; }
[ "public", "static", "DatabaseSizes", "getCatalogSizes", "(", "Database", "dbCatalog", ",", "boolean", "isXDCR", ")", "{", "DatabaseSizes", "dbSizes", "=", "new", "DatabaseSizes", "(", ")", ";", "for", "(", "Table", "table", ":", "dbCatalog", ".", "getTables", ...
Produce a sizing of all significant database objects. @param dbCatalog database catalog @param isXDCR Is XDCR enabled @return database size result object tree
[ "Produce", "a", "sizing", "of", "all", "significant", "database", "objects", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogSizing.java#L394-L400
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.print_bytes
public static String print_bytes( byte[] data, int offset, int length ) { int size = 2 * length; size += ((size / 8) + (size / 64)); char[] buf = new char[size]; int low_mask = 0x0f; int high_mask = 0xf0; int buf_pos = 0; byte b; int j = 0; for( int i = offset; i < (offset + length); ++i ) { b = data[i]; buf[buf_pos++] = digits[(high_mask & b) >> 4]; buf[buf_pos++] = digits[(low_mask & b)]; if ((j % 4) == 3) { buf[buf_pos++] = ' '; } if ((j % 32) == 31) { buf[buf_pos++] = '\n'; } ++j; } return new String(buf); }
java
public static String print_bytes( byte[] data, int offset, int length ) { int size = 2 * length; size += ((size / 8) + (size / 64)); char[] buf = new char[size]; int low_mask = 0x0f; int high_mask = 0xf0; int buf_pos = 0; byte b; int j = 0; for( int i = offset; i < (offset + length); ++i ) { b = data[i]; buf[buf_pos++] = digits[(high_mask & b) >> 4]; buf[buf_pos++] = digits[(low_mask & b)]; if ((j % 4) == 3) { buf[buf_pos++] = ' '; } if ((j % 32) == 31) { buf[buf_pos++] = '\n'; } ++j; } return new String(buf); }
[ "public", "static", "String", "print_bytes", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "length", ")", "{", "int", "size", "=", "2", "*", "length", ";", "size", "+=", "(", "(", "size", "/", "8", ")", "+", "(", "size", "/", ...
Produce a <code>String</code> representation for the specified array of <code>byte</code>s. Print each <code>byte</code> as two hexadecimal digits. @param data The array to print @param offset the start offset in <code>data</code> @param length the number of <code>byte</code>s to print @return DOCUMENT ME!
[ "Produce", "a", "<code", ">", "String<", "/", "code", ">", "representation", "for", "the", "specified", "array", "of", "<code", ">", "byte<", "/", "code", ">", "s", ".", "Print", "each", "<code", ">", "byte<", "/", "code", ">", "as", "two", "hexadecima...
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L621-L650
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.findChildTaskByUUID
private Task findChildTaskByUUID(ChildTaskContainer parent, UUID uuid) { Task result = null; for (Task task : parent.getChildTasks()) { if (uuid.equals(task.getGUID())) { result = task; break; } } return result; }
java
private Task findChildTaskByUUID(ChildTaskContainer parent, UUID uuid) { Task result = null; for (Task task : parent.getChildTasks()) { if (uuid.equals(task.getGUID())) { result = task; break; } } return result; }
[ "private", "Task", "findChildTaskByUUID", "(", "ChildTaskContainer", "parent", ",", "UUID", "uuid", ")", "{", "Task", "result", "=", "null", ";", "for", "(", "Task", "task", ":", "parent", ".", "getChildTasks", "(", ")", ")", "{", "if", "(", "uuid", ".",...
Locates a task within a child task container which matches the supplied UUID. @param parent child task container @param uuid required UUID @return Task instance or null if the task is not found
[ "Locates", "a", "task", "within", "a", "child", "task", "container", "which", "matches", "the", "supplied", "UUID", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L609-L623
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.withDataInputStream
public static <T> T withDataInputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.DataInputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newDataInputStream(self), closure); }
java
public static <T> T withDataInputStream(Path self, @ClosureParams(value = SimpleType.class, options = "java.io.DataInputStream") Closure<T> closure) throws IOException { return IOGroovyMethods.withStream(newDataInputStream(self), closure); }
[ "public", "static", "<", "T", ">", "T", "withDataInputStream", "(", "Path", "self", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.DataInputStream\"", ")", "Closure", "<", "T", ">", "closure", ")", ...
Create a new DataInputStream for this file and passes it into the closure. This method ensures the stream is closed after the closure returns. @param self a Path @param closure a closure @return the value returned by the closure @throws java.io.IOException if an IOException occurs. @see org.codehaus.groovy.runtime.IOGroovyMethods#withStream(java.io.InputStream, groovy.lang.Closure) @since 2.3.0
[ "Create", "a", "new", "DataInputStream", "for", "this", "file", "and", "passes", "it", "into", "the", "closure", ".", "This", "method", "ensures", "the", "stream", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1530-L1532
akberc/ceylon-maven-plugin
src/main/java/com/dgwave/car/common/ModuleXmlReader.java
ModuleXmlReader.getChildElement
protected static Element getChildElement(final Element parent, final String tagName) { List<Element> elements = getElements(parent, tagName); if (elements.size() > 0) { return elements.get(0); } else { return null; } }
java
protected static Element getChildElement(final Element parent, final String tagName) { List<Element> elements = getElements(parent, tagName); if (elements.size() > 0) { return elements.get(0); } else { return null; } }
[ "protected", "static", "Element", "getChildElement", "(", "final", "Element", "parent", ",", "final", "String", "tagName", ")", "{", "List", "<", "Element", ">", "elements", "=", "getElements", "(", "parent", ",", "tagName", ")", ";", "if", "(", "elements", ...
Get a single child element. @param parent The parent element @param tagName The child element name @return Element The first child element by that name
[ "Get", "a", "single", "child", "element", "." ]
train
https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/common/ModuleXmlReader.java#L108-L115