repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java | SubversionManager.createTag | public void createTag(final String tagUrl, final String commitMessage)
throws IOException, InterruptedException {
build.getWorkspace()
.act(new SVNCreateTagCallable(tagUrl, commitMessage, getLocation(), getSvnAuthenticationProvider(build),
buildListener));
} | java | public void createTag(final String tagUrl, final String commitMessage)
throws IOException, InterruptedException {
build.getWorkspace()
.act(new SVNCreateTagCallable(tagUrl, commitMessage, getLocation(), getSvnAuthenticationProvider(build),
buildListener));
} | [
"public",
"void",
"createTag",
"(",
"final",
"String",
"tagUrl",
",",
"final",
"String",
"commitMessage",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"build",
".",
"getWorkspace",
"(",
")",
".",
"act",
"(",
"new",
"SVNCreateTagCallable",
"(",... | Creates a tag directly from the working copy.
@param tagUrl The URL of the tag to create.
@param commitMessage Commit message
@return The commit info upon successful operation.
@throws IOException On IO of SVN failure | [
"Creates",
"a",
"tag",
"directly",
"from",
"the",
"working",
"copy",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/scm/svn/SubversionManager.java#L71-L76 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java | Contents.getContent | public Content getContent(String key, Object o0, Object o1) {
return getContent(key, o0, o1, null);
} | java | public Content getContent(String key, Object o0, Object o1) {
return getContent(key, o0, o1, null);
} | [
"public",
"Content",
"getContent",
"(",
"String",
"key",
",",
"Object",
"o0",
",",
"Object",
"o1",
")",
"{",
"return",
"getContent",
"(",
"key",
",",
"o0",
",",
"o1",
",",
"null",
")",
";",
"}"
] | Gets a {@code Content} object, containing the string for
a given key in the doclet's resources, formatted with
given arguments.
@param key the key for the desired string
@param o0 string or content argument to be formatted into the result
@param o1 string or content argument to be formatted into the result
@return a content tree for the text | [
"Gets",
"a",
"{",
"@code",
"Content",
"}",
"object",
"containing",
"the",
"string",
"for",
"a",
"given",
"key",
"in",
"the",
"doclet",
"s",
"resources",
"formatted",
"with",
"given",
"arguments",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Contents.java#L308-L310 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/admin_ns_config.java | admin_ns_config.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
admin_ns_config_responses result = (admin_ns_config_responses) service.get_payload_formatter().string_to_resource(admin_ns_config_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.admin_ns_config_response_array);
}
admin_ns_config[] result_admin_ns_config = new admin_ns_config[result.admin_ns_config_response_array.length];
for(int i = 0; i < result.admin_ns_config_response_array.length; i++)
{
result_admin_ns_config[i] = result.admin_ns_config_response_array[i].admin_ns_config[0];
}
return result_admin_ns_config;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
admin_ns_config_responses result = (admin_ns_config_responses) service.get_payload_formatter().string_to_resource(admin_ns_config_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.admin_ns_config_response_array);
}
admin_ns_config[] result_admin_ns_config = new admin_ns_config[result.admin_ns_config_response_array.length];
for(int i = 0; i < result.admin_ns_config_response_array.length; i++)
{
result_admin_ns_config[i] = result.admin_ns_config_response_array[i].admin_ns_config[0];
}
return result_admin_ns_config;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"admin_ns_config_responses",
"result",
"=",
"(",
"admin_ns_config_responses",
")",
"service",
".",
"get_payloa... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/admin_ns_config.java#L142-L159 |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/TileFactory.java | TileFactory.pixelToGeo | public GeoPosition pixelToGeo(Point2D pixelCoordinate, int zoom)
{
return GeoUtil.getPosition(pixelCoordinate, zoom, getInfo());
} | java | public GeoPosition pixelToGeo(Point2D pixelCoordinate, int zoom)
{
return GeoUtil.getPosition(pixelCoordinate, zoom, getInfo());
} | [
"public",
"GeoPosition",
"pixelToGeo",
"(",
"Point2D",
"pixelCoordinate",
",",
"int",
"zoom",
")",
"{",
"return",
"GeoUtil",
".",
"getPosition",
"(",
"pixelCoordinate",
",",
"zoom",
",",
"getInfo",
"(",
")",
")",
";",
"}"
] | Convert a pixel in the world bitmap at the specified zoom level into a GeoPosition
@param pixelCoordinate a Point2D representing a pixel in the world bitmap
@param zoom the zoom level of the world bitmap
@return the converted GeoPosition | [
"Convert",
"a",
"pixel",
"in",
"the",
"world",
"bitmap",
"at",
"the",
"specified",
"zoom",
"level",
"into",
"a",
"GeoPosition"
] | train | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/TileFactory.java#L79-L82 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java | SimpleDocTreeVisitor.visitLink | @Override
public R visitLink(LinkTree node, P p) {
return defaultAction(node, p);
} | java | @Override
public R visitLink(LinkTree node, P p) {
return defaultAction(node, p);
} | [
"@",
"Override",
"public",
"R",
"visitLink",
"(",
"LinkTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"node",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"calls",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L261-L264 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java | MavenModelScannerPlugin.addProperties | private void addProperties(BaseProfileDescriptor pomDescriptor, Properties properties, Store store) {
Set<Entry<Object, Object>> entrySet = properties.entrySet();
for (Entry<Object, Object> entry : entrySet) {
PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
propertyDescriptor.setName(entry.getKey().toString());
propertyDescriptor.setValue(entry.getValue().toString());
pomDescriptor.getProperties().add(propertyDescriptor);
}
} | java | private void addProperties(BaseProfileDescriptor pomDescriptor, Properties properties, Store store) {
Set<Entry<Object, Object>> entrySet = properties.entrySet();
for (Entry<Object, Object> entry : entrySet) {
PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
propertyDescriptor.setName(entry.getKey().toString());
propertyDescriptor.setValue(entry.getValue().toString());
pomDescriptor.getProperties().add(propertyDescriptor);
}
} | [
"private",
"void",
"addProperties",
"(",
"BaseProfileDescriptor",
"pomDescriptor",
",",
"Properties",
"properties",
",",
"Store",
"store",
")",
"{",
"Set",
"<",
"Entry",
"<",
"Object",
",",
"Object",
">",
">",
"entrySet",
"=",
"properties",
".",
"entrySet",
"(... | Adds information about defined properties.
@param pomDescriptor
The descriptor for the current POM.
@param properties
The properties information.
@param store
The database. | [
"Adds",
"information",
"about",
"defined",
"properties",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L614-L623 |
m-m-m/util | contenttype/src/main/java/net/sf/mmm/util/contenttype/base/format/SegmentConstant.java | SegmentConstant.initBytes | protected void initBytes(StringBuilder source) {
if (this.bytes == null) {
if (this.string != null) {
String encodingValue = getEncoding();
try {
this.bytes = this.string.getBytes(encodingValue);
} catch (UnsupportedEncodingException e) {
source.append(".encoding");
throw new NlsIllegalArgumentException(encodingValue, source.toString(), e);
}
} else if (this.hex != null) {
this.bytes = parseBytes(this.hex, "hex");
} else {
throw new XmlInvalidException(
new NlsParseException(XML_TAG, XML_ATTRIBUTE_HEX + "|" + XML_ATTRIBUTE_STRING, source.toString()));
}
}
} | java | protected void initBytes(StringBuilder source) {
if (this.bytes == null) {
if (this.string != null) {
String encodingValue = getEncoding();
try {
this.bytes = this.string.getBytes(encodingValue);
} catch (UnsupportedEncodingException e) {
source.append(".encoding");
throw new NlsIllegalArgumentException(encodingValue, source.toString(), e);
}
} else if (this.hex != null) {
this.bytes = parseBytes(this.hex, "hex");
} else {
throw new XmlInvalidException(
new NlsParseException(XML_TAG, XML_ATTRIBUTE_HEX + "|" + XML_ATTRIBUTE_STRING, source.toString()));
}
}
} | [
"protected",
"void",
"initBytes",
"(",
"StringBuilder",
"source",
")",
"{",
"if",
"(",
"this",
".",
"bytes",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"string",
"!=",
"null",
")",
"{",
"String",
"encodingValue",
"=",
"getEncoding",
"(",
")",
";",... | This method initializes the internal byte array.
@param source describes the source. | [
"This",
"method",
"initializes",
"the",
"internal",
"byte",
"array",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/contenttype/src/main/java/net/sf/mmm/util/contenttype/base/format/SegmentConstant.java#L116-L134 |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.getPercentFormatProcessor | private static Format getPercentFormatProcessor(ColumnFormat columnFormat, Locale locale) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale);
if (columnFormat.getPrecision() == 0) {
return new DecimalFormat("0%", dfs);
}
String pattern = "0%." + new String(new char[columnFormat.getPrecision()]).replace("\0", "0");
return new DecimalFormat(pattern, dfs);
} | java | private static Format getPercentFormatProcessor(ColumnFormat columnFormat, Locale locale) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale);
if (columnFormat.getPrecision() == 0) {
return new DecimalFormat("0%", dfs);
}
String pattern = "0%." + new String(new char[columnFormat.getPrecision()]).replace("\0", "0");
return new DecimalFormat(pattern, dfs);
} | [
"private",
"static",
"Format",
"getPercentFormatProcessor",
"(",
"ColumnFormat",
"columnFormat",
",",
"Locale",
"locale",
")",
"{",
"DecimalFormatSymbols",
"dfs",
"=",
"new",
"DecimalFormatSymbols",
"(",
"locale",
")",
";",
"if",
"(",
"columnFormat",
".",
"getPrecis... | The function to get a formatter to convert percentage elements into a string.
@param columnFormat the (@link ColumnFormat) class variable that stores the precision of rounding
the converted value.
@param locale locale for parsing date elements.
@return a formatter to convert percentage elements into a string. | [
"The",
"function",
"to",
"get",
"a",
"formatter",
"to",
"convert",
"percentage",
"elements",
"into",
"a",
"string",
"."
] | train | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L393-L400 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/util/xml/DomUtils.java | DomUtils.getChildElementsByName | public static List getChildElementsByName(Element parent, String name)
{
List elements = new ArrayList();
NodeList children = parent.getChildNodes();
for(int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
if(element.getTagName().equals(name)) {
elements.add(element);
}
}
}
return elements;
} | java | public static List getChildElementsByName(Element parent, String name)
{
List elements = new ArrayList();
NodeList children = parent.getChildNodes();
for(int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
Element element = (Element) node;
if(element.getTagName().equals(name)) {
elements.add(element);
}
}
}
return elements;
} | [
"public",
"static",
"List",
"getChildElementsByName",
"(",
"Element",
"parent",
",",
"String",
"name",
")",
"{",
"List",
"elements",
"=",
"new",
"ArrayList",
"(",
")",
";",
"NodeList",
"children",
"=",
"parent",
".",
"getChildNodes",
"(",
")",
";",
"for",
... | <p>Returns a list of child elements with the given
name. Returns an empty list if there are no such child
elements.</p>
@param parent parent element
@param name name of the child element
@return child elements | [
"<p",
">",
"Returns",
"a",
"list",
"of",
"child",
"elements",
"with",
"the",
"given",
"name",
".",
"Returns",
"an",
"empty",
"list",
"if",
"there",
"are",
"no",
"such",
"child",
"elements",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/xml/DomUtils.java#L72-L89 |
strator-dev/greenpepper | samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java | AccountManager.associateUserWithGroup | public boolean associateUserWithGroup(String user, String group)
{
if (!isUserExist(user))
{
throw new SystemException(String.format("User '%s' does not exist.", user));
}
if (!isGroupExist(group))
{
throw new SystemException(String.format("Group '%s' does not exist.", group));
}
List<String> userGroups = allAssociations.get(user);
if (userGroups == null)
{
userGroups = new ArrayList<String>();
}
else if (userGroups.contains(group))
{
return false;
}
userGroups.add(group);
allAssociations.put(user, userGroups);
return true;
} | java | public boolean associateUserWithGroup(String user, String group)
{
if (!isUserExist(user))
{
throw new SystemException(String.format("User '%s' does not exist.", user));
}
if (!isGroupExist(group))
{
throw new SystemException(String.format("Group '%s' does not exist.", group));
}
List<String> userGroups = allAssociations.get(user);
if (userGroups == null)
{
userGroups = new ArrayList<String>();
}
else if (userGroups.contains(group))
{
return false;
}
userGroups.add(group);
allAssociations.put(user, userGroups);
return true;
} | [
"public",
"boolean",
"associateUserWithGroup",
"(",
"String",
"user",
",",
"String",
"group",
")",
"{",
"if",
"(",
"!",
"isUserExist",
"(",
"user",
")",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"String",
".",
"format",
"(",
"\"User '%s' does not exist... | <p>associateUserWithGroup.</p>
@param user a {@link java.lang.String} object.
@param group a {@link java.lang.String} object.
@return a boolean. | [
"<p",
">",
"associateUserWithGroup",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java#L174-L202 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsUserTable.java | CmsUserTable.getStatusHelp | String getStatusHelp(CmsUser user, boolean disabled, boolean newUser) {
if (disabled) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_HELP_0);
}
if (newUser) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_HELP_0);
}
if (isUserPasswordReset(user)) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_HELP_0);
}
long lastLogin = user.getLastlogin();
return CmsVaadinUtils.getMessageText(
Messages.GUI_USERMANAGEMENT_USER_ACTIVE_HELP_1,
CmsDateUtil.getDateTime(new Date(lastLogin), DateFormat.SHORT, A_CmsUI.get().getLocale()));
} | java | String getStatusHelp(CmsUser user, boolean disabled, boolean newUser) {
if (disabled) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_DISABLED_HELP_0);
}
if (newUser) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_INACTIVE_HELP_0);
}
if (isUserPasswordReset(user)) {
return CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_PASSWORT_RESET_HELP_0);
}
long lastLogin = user.getLastlogin();
return CmsVaadinUtils.getMessageText(
Messages.GUI_USERMANAGEMENT_USER_ACTIVE_HELP_1,
CmsDateUtil.getDateTime(new Date(lastLogin), DateFormat.SHORT, A_CmsUI.get().getLocale()));
} | [
"String",
"getStatusHelp",
"(",
"CmsUser",
"user",
",",
"boolean",
"disabled",
",",
"boolean",
"newUser",
")",
"{",
"if",
"(",
"disabled",
")",
"{",
"return",
"CmsVaadinUtils",
".",
"getMessageText",
"(",
"Messages",
".",
"GUI_USERMANAGEMENT_USER_DISABLED_HELP_0",
... | Returns status help message.
@param user CmsUser
@param disabled boolean
@param newUser boolean
@return String | [
"Returns",
"status",
"help",
"message",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsUserTable.java#L1376-L1391 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/crypto/KeyCrypterScrypt.java | KeyCrypterScrypt.deriveKey | @Override
public KeyParameter deriveKey(CharSequence password) throws KeyCrypterException {
byte[] passwordBytes = null;
try {
passwordBytes = convertToByteArray(password);
byte[] salt = new byte[0];
if ( scryptParameters.getSalt() != null) {
salt = scryptParameters.getSalt().toByteArray();
} else {
// Warn the user that they are not using a salt.
// (Some early MultiBit wallets had a blank salt).
log.warn("You are using a ScryptParameters with no salt. Your encryption may be vulnerable to a dictionary attack.");
}
final Stopwatch watch = Stopwatch.createStarted();
byte[] keyBytes = SCrypt.scrypt(passwordBytes, salt, (int) scryptParameters.getN(), scryptParameters.getR(), scryptParameters.getP(), KEY_LENGTH);
watch.stop();
log.info("Deriving key took {} for {} scrypt iterations.", watch, scryptParameters.getN());
return new KeyParameter(keyBytes);
} catch (Exception e) {
throw new KeyCrypterException("Could not generate key from password and salt.", e);
} finally {
// Zero the password bytes.
if (passwordBytes != null) {
java.util.Arrays.fill(passwordBytes, (byte) 0);
}
}
} | java | @Override
public KeyParameter deriveKey(CharSequence password) throws KeyCrypterException {
byte[] passwordBytes = null;
try {
passwordBytes = convertToByteArray(password);
byte[] salt = new byte[0];
if ( scryptParameters.getSalt() != null) {
salt = scryptParameters.getSalt().toByteArray();
} else {
// Warn the user that they are not using a salt.
// (Some early MultiBit wallets had a blank salt).
log.warn("You are using a ScryptParameters with no salt. Your encryption may be vulnerable to a dictionary attack.");
}
final Stopwatch watch = Stopwatch.createStarted();
byte[] keyBytes = SCrypt.scrypt(passwordBytes, salt, (int) scryptParameters.getN(), scryptParameters.getR(), scryptParameters.getP(), KEY_LENGTH);
watch.stop();
log.info("Deriving key took {} for {} scrypt iterations.", watch, scryptParameters.getN());
return new KeyParameter(keyBytes);
} catch (Exception e) {
throw new KeyCrypterException("Could not generate key from password and salt.", e);
} finally {
// Zero the password bytes.
if (passwordBytes != null) {
java.util.Arrays.fill(passwordBytes, (byte) 0);
}
}
} | [
"@",
"Override",
"public",
"KeyParameter",
"deriveKey",
"(",
"CharSequence",
"password",
")",
"throws",
"KeyCrypterException",
"{",
"byte",
"[",
"]",
"passwordBytes",
"=",
"null",
";",
"try",
"{",
"passwordBytes",
"=",
"convertToByteArray",
"(",
"password",
")",
... | Generate AES key.
This is a very slow operation compared to encrypt/ decrypt so it is normally worth caching the result.
@param password The password to use in key generation
@return The KeyParameter containing the created AES key
@throws KeyCrypterException | [
"Generate",
"AES",
"key",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/crypto/KeyCrypterScrypt.java#L145-L172 |
wcm-io/wcm-io-tooling | maven/skins/reflow-velocity-tools/src/main/java/io/wcm/maven/skins/reflow/velocity/HtmlTool.java | HtmlTool.headingIndex | private static int headingIndex(Element element) {
String tagName = element.tagName();
if (tagName.startsWith("h")) {
try {
return Integer.parseInt(tagName.substring(1));
}
catch (Throwable ex) {
throw new IllegalArgumentException("Must be a header tag: " + tagName, ex);
}
}
else {
throw new IllegalArgumentException("Must be a header tag: " + tagName);
}
} | java | private static int headingIndex(Element element) {
String tagName = element.tagName();
if (tagName.startsWith("h")) {
try {
return Integer.parseInt(tagName.substring(1));
}
catch (Throwable ex) {
throw new IllegalArgumentException("Must be a header tag: " + tagName, ex);
}
}
else {
throw new IllegalArgumentException("Must be a header tag: " + tagName);
}
} | [
"private",
"static",
"int",
"headingIndex",
"(",
"Element",
"element",
")",
"{",
"String",
"tagName",
"=",
"element",
".",
"tagName",
"(",
")",
";",
"if",
"(",
"tagName",
".",
"startsWith",
"(",
"\"h\"",
")",
")",
"{",
"try",
"{",
"return",
"Integer",
... | Retrieves numeric index of a heading.
@param element
@return Index | [
"Retrieves",
"numeric",
"index",
"of",
"a",
"heading",
"."
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/maven/skins/reflow-velocity-tools/src/main/java/io/wcm/maven/skins/reflow/velocity/HtmlTool.java#L1225-L1238 |
seedstack/i18n-addon | rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java | AbstractI18nRestIT.httpDelete | protected Response httpDelete(String path, int status) {
return httpRequest(status, null).delete(baseURL + PATH_PREFIX + path);
} | java | protected Response httpDelete(String path, int status) {
return httpRequest(status, null).delete(baseURL + PATH_PREFIX + path);
} | [
"protected",
"Response",
"httpDelete",
"(",
"String",
"path",
",",
"int",
"status",
")",
"{",
"return",
"httpRequest",
"(",
"status",
",",
"null",
")",
".",
"delete",
"(",
"baseURL",
"+",
"PATH_PREFIX",
"+",
"path",
")",
";",
"}"
] | Deletes the resource at the given path.
@param path the resource URI
@return the http response | [
"Deletes",
"the",
"resource",
"at",
"the",
"given",
"path",
"."
] | train | https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java#L119-L121 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java | HexUtil.appendHexString | static public void appendHexString(StringBuilder buffer, long value) {
appendHexString(buffer, (int)((value & 0xFFFFFFFF00000000L) >>> 32));
appendHexString(buffer, (int)(value & 0x00000000FFFFFFFFL));
} | java | static public void appendHexString(StringBuilder buffer, long value) {
appendHexString(buffer, (int)((value & 0xFFFFFFFF00000000L) >>> 32));
appendHexString(buffer, (int)(value & 0x00000000FFFFFFFFL));
} | [
"static",
"public",
"void",
"appendHexString",
"(",
"StringBuilder",
"buffer",
",",
"long",
"value",
")",
"{",
"appendHexString",
"(",
"buffer",
",",
"(",
"int",
")",
"(",
"(",
"value",
"&",
"0xFFFFFFFF00000000",
"L",
")",
">>>",
"32",
")",
")",
";",
"ap... | Appends 16 characters to a StringBuilder with the long in a "Big Endian"
hexidecimal format. For example, a long 0xAABBCCDDEE123456 will be appended as a
String in format "AABBCCDDEE123456". A long of value 0 will be appended as "0000000000000000".
@param buffer The StringBuilder the long value in hexidecimal format
will be appended to. If the buffer is null, this method will throw
a NullPointerException.
@param value The long value that will be converted to a hexidecimal String. | [
"Appends",
"16",
"characters",
"to",
"a",
"StringBuilder",
"with",
"the",
"long",
"in",
"a",
"Big",
"Endian",
"hexidecimal",
"format",
".",
"For",
"example",
"a",
"long",
"0xAABBCCDDEE123456",
"will",
"be",
"appended",
"as",
"a",
"String",
"in",
"format",
"A... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L247-L250 |
lucee/Lucee | core/src/main/java/lucee/runtime/functions/cache/CacheClear.java | CacheClear.call | public static double call(PageContext pc, String filter, String cacheName) throws PageException {
return _call(pc, filter, cacheName);
} | java | public static double call(PageContext pc, String filter, String cacheName) throws PageException {
return _call(pc, filter, cacheName);
} | [
"public",
"static",
"double",
"call",
"(",
"PageContext",
"pc",
",",
"String",
"filter",
",",
"String",
"cacheName",
")",
"throws",
"PageException",
"{",
"return",
"_call",
"(",
"pc",
",",
"filter",
",",
"cacheName",
")",
";",
"}"
] | FUTURE remove, only exist for code in Lucee archives using that function | [
"FUTURE",
"remove",
"only",
"exist",
"for",
"code",
"in",
"Lucee",
"archives",
"using",
"that",
"function"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/functions/cache/CacheClear.java#L64-L66 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static void readLines(File file, Charset charset, LineHandler lineHandler) throws IORuntimeException {
FileReader.create(file, charset).readLines(lineHandler);
} | java | public static void readLines(File file, Charset charset, LineHandler lineHandler) throws IORuntimeException {
FileReader.create(file, charset).readLines(lineHandler);
} | [
"public",
"static",
"void",
"readLines",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"LineHandler",
"lineHandler",
")",
"throws",
"IORuntimeException",
"{",
"FileReader",
".",
"create",
"(",
"file",
",",
"charset",
")",
".",
"readLines",
"(",
"lineHan... | 按行处理文件内容
@param file 文件
@param charset 编码
@param lineHandler {@link LineHandler}行处理器
@throws IORuntimeException IO异常 | [
"按行处理文件内容"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2415-L2417 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildContents | public void buildContents(XMLNode node, Content contentTree) {
Content contentListTree = writer.getContentsHeader();
printedPackageHeaders.clear();
for (PackageElement pkg : configuration.packages) {
if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg)) {
writer.addLinkToPackageContent(pkg, printedPackageHeaders, contentListTree);
}
}
writer.addContentsList(contentTree, contentListTree);
} | java | public void buildContents(XMLNode node, Content contentTree) {
Content contentListTree = writer.getContentsHeader();
printedPackageHeaders.clear();
for (PackageElement pkg : configuration.packages) {
if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg)) {
writer.addLinkToPackageContent(pkg, printedPackageHeaders, contentListTree);
}
}
writer.addContentsList(contentTree, contentListTree);
} | [
"public",
"void",
"buildContents",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"{",
"Content",
"contentListTree",
"=",
"writer",
".",
"getContentsHeader",
"(",
")",
";",
"printedPackageHeaders",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Package... | Build the list of packages.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the content list will be added | [
"Build",
"the",
"list",
"of",
"packages",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java#L167-L176 |
meertensinstituut/mtas | src/main/java/mtas/analysis/parser/MtasBasicParser.java | MtasBasicParser.checkForVariables | private boolean checkForVariables(List<Map<String, String>> values) {
if (values == null || values.isEmpty()) {
return false;
} else {
for (Map<String, String> list : values) {
if (list.containsKey("type") && list.get("type")
.equals(MtasParserMapping.PARSER_TYPE_VARIABLE)) {
return true;
}
}
}
return false;
} | java | private boolean checkForVariables(List<Map<String, String>> values) {
if (values == null || values.isEmpty()) {
return false;
} else {
for (Map<String, String> list : values) {
if (list.containsKey("type") && list.get("type")
.equals(MtasParserMapping.PARSER_TYPE_VARIABLE)) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"checkForVariables",
"(",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"values",
")",
"{",
"if",
"(",
"values",
"==",
"null",
"||",
"values",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"else"... | Check for variables.
@param values the values
@return true, if successful | [
"Check",
"for",
"variables",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/analysis/parser/MtasBasicParser.java#L655-L667 |
spotify/ssh-agent-proxy | src/main/java/com/spotify/sshagentproxy/AgentOutput.java | AgentOutput.writeField | private static void writeField(final OutputStream out, final int num) throws IOException {
final byte[] bytes = BigInteger.valueOf(num).toByteArray();
writeField(out, bytes);
} | java | private static void writeField(final OutputStream out, final int num) throws IOException {
final byte[] bytes = BigInteger.valueOf(num).toByteArray();
writeField(out, bytes);
} | [
"private",
"static",
"void",
"writeField",
"(",
"final",
"OutputStream",
"out",
",",
"final",
"int",
"num",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"bytes",
"=",
"BigInteger",
".",
"valueOf",
"(",
"num",
")",
".",
"toByteArray",
"(",
... | Convert int to a big-endian byte array containing the minimum number of bytes required to
represent it. Write those bytes to an {@link OutputStream}.
@param out {@link OutputStream}
@param num int | [
"Convert",
"int",
"to",
"a",
"big",
"-",
"endian",
"byte",
"array",
"containing",
"the",
"minimum",
"number",
"of",
"bytes",
"required",
"to",
"represent",
"it",
".",
"Write",
"those",
"bytes",
"to",
"an",
"{"
] | train | https://github.com/spotify/ssh-agent-proxy/blob/b678792750c0157bd5ed3fb6a18895ff95effbc4/src/main/java/com/spotify/sshagentproxy/AgentOutput.java#L86-L89 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.notationDecl | public void notationDecl(String name, String pubID, String sysID) throws SAXException {
// TODO Auto-generated method stub
try {
DTDprolog();
m_writer.write("<!NOTATION ");
m_writer.write(name);
if (pubID != null) {
m_writer.write(" PUBLIC \"");
m_writer.write(pubID);
}
else {
m_writer.write(" SYSTEM \"");
m_writer.write(sysID);
}
m_writer.write("\" >");
m_writer.write(m_lineSep, 0, m_lineSepLen);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | java | public void notationDecl(String name, String pubID, String sysID) throws SAXException {
// TODO Auto-generated method stub
try {
DTDprolog();
m_writer.write("<!NOTATION ");
m_writer.write(name);
if (pubID != null) {
m_writer.write(" PUBLIC \"");
m_writer.write(pubID);
}
else {
m_writer.write(" SYSTEM \"");
m_writer.write(sysID);
}
m_writer.write("\" >");
m_writer.write(m_lineSep, 0, m_lineSepLen);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | [
"public",
"void",
"notationDecl",
"(",
"String",
"name",
",",
"String",
"pubID",
",",
"String",
"sysID",
")",
"throws",
"SAXException",
"{",
"// TODO Auto-generated method stub",
"try",
"{",
"DTDprolog",
"(",
")",
";",
"m_writer",
".",
"write",
"(",
"\"<!NOTATIO... | If this method is called, the serializer is used as a
DTDHandler, which changes behavior how the serializer
handles document entities.
@see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String) | [
"If",
"this",
"method",
"is",
"called",
"the",
"serializer",
"is",
"used",
"as",
"a",
"DTDHandler",
"which",
"changes",
"behavior",
"how",
"the",
"serializer",
"handles",
"document",
"entities",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L3489-L3511 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.replaceFirst | public static String replaceFirst(CharSequence self, Pattern pattern, CharSequence replacement) {
return pattern.matcher(self).replaceFirst(replacement.toString());
} | java | public static String replaceFirst(CharSequence self, Pattern pattern, CharSequence replacement) {
return pattern.matcher(self).replaceFirst(replacement.toString());
} | [
"public",
"static",
"String",
"replaceFirst",
"(",
"CharSequence",
"self",
",",
"Pattern",
"pattern",
",",
"CharSequence",
"replacement",
")",
"{",
"return",
"pattern",
".",
"matcher",
"(",
"self",
")",
".",
"replaceFirst",
"(",
"replacement",
".",
"toString",
... | Replaces the first substring of a CharSequence that matches the given
compiled regular expression with the given replacement.
<p>
Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in the
replacement string may cause the results to be different than if it were
being treated as a literal replacement string; see
{@link java.util.regex.Matcher#replaceFirst}.
Use {@link java.util.regex.Matcher#quoteReplacement} to suppress the special
meaning of these characters, if desired.
<p>
<pre class="groovyTestCase">
assert "foo".replaceFirst('o', 'X') == 'fXo'
</pre>
@param self the CharSequence that is to be matched
@param pattern the regex Pattern to which the CharSequence of interest is to be matched
@param replacement the CharSequence to be substituted for the first match
@return The resulting <tt>String</tt>
@see #replaceFirst(String, java.util.regex.Pattern, String)
@since 1.8.2 | [
"Replaces",
"the",
"first",
"substring",
"of",
"a",
"CharSequence",
"that",
"matches",
"the",
"given",
"compiled",
"regular",
"expression",
"with",
"the",
"given",
"replacement",
".",
"<p",
">",
"Note",
"that",
"backslashes",
"(",
"<tt",
">",
"\\",
"<",
"/",... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2679-L2681 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/util/FileUtils.java | FileUtils.getResourceNames | public static Set<String> getResourceNames(File dir) {
Set<String> resourceNames = new HashSet<String>();
// If the path is not valid throw an exception
String[] resArray = dir.list();
if (resArray != null) {
// Make the returned dirs end with '/', to match a servletcontext
// behavior.
for (int i = 0; i < resArray.length; i++) {
if (new File(dir, resArray[i]).isDirectory())
resArray[i] += '/';
}
resourceNames.addAll(Arrays.asList(resArray));
}
return resourceNames;
} | java | public static Set<String> getResourceNames(File dir) {
Set<String> resourceNames = new HashSet<String>();
// If the path is not valid throw an exception
String[] resArray = dir.list();
if (resArray != null) {
// Make the returned dirs end with '/', to match a servletcontext
// behavior.
for (int i = 0; i < resArray.length; i++) {
if (new File(dir, resArray[i]).isDirectory())
resArray[i] += '/';
}
resourceNames.addAll(Arrays.asList(resArray));
}
return resourceNames;
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"getResourceNames",
"(",
"File",
"dir",
")",
"{",
"Set",
"<",
"String",
">",
"resourceNames",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"// If the path is not valid throw an exception",
"String",
"... | Returns the resource names contained in a directory, and for directory
resource, a trailing '/' is added
@param dir
the directory
@return the resource names | [
"Returns",
"the",
"resource",
"names",
"contained",
"in",
"a",
"directory",
"and",
"for",
"directory",
"resource",
"a",
"trailing",
"/",
"is",
"added"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/util/FileUtils.java#L498-L515 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java | BlobContainersInner.deleteImmutabilityPolicy | public ImmutabilityPolicyInner deleteImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch) {
return deleteImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).toBlocking().single().body();
} | java | public ImmutabilityPolicyInner deleteImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch) {
return deleteImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch).toBlocking().single().body();
} | [
"public",
"ImmutabilityPolicyInner",
"deleteImmutabilityPolicy",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"containerName",
",",
"String",
"ifMatch",
")",
"{",
"return",
"deleteImmutabilityPolicyWithServiceResponseAsync",
"(",
"resourceG... | Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, only way is to delete the container after deleting all blobs inside the container.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
@param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ImmutabilityPolicyInner object if successful. | [
"Aborts",
"an",
"unlocked",
"immutability",
"policy",
".",
"The",
"response",
"of",
"delete",
"has",
"immutabilityPeriodSinceCreationInDays",
"set",
"to",
"0",
".",
"ETag",
"in",
"If",
"-",
"Match",
"is",
"required",
"for",
"this",
"operation",
".",
"Deleting",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L1385-L1387 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableCompactor.java | TableCompactor.parseEntries | @SneakyThrows(IOException.class)
private CompactionArgs parseEntries(InputStream input, long startOffset, int maxLength) {
val entries = new HashMap<UUID, CandidateSet>();
int count = 0;
long nextOffset = startOffset;
final long maxOffset = startOffset + maxLength;
try {
while (nextOffset < maxOffset) {
// TODO: Handle error when compaction offset is not on Entry boundary (https://github.com/pravega/pravega/issues/3560).
val e = AsyncTableEntryReader.readEntryComponents(input, nextOffset, this.connector.getSerializer());
// We only care about updates, and not removals.
if (!e.getHeader().isDeletion()) {
// Group by KeyHash, and deduplicate (based on key).
val hash = this.connector.getKeyHasher().hash(e.getKey());
CandidateSet candidates = entries.computeIfAbsent(hash, h -> new CandidateSet());
candidates.add(new Candidate(nextOffset,
TableEntry.versioned(new ByteArraySegment(e.getKey()), new ByteArraySegment(e.getValue()), e.getVersion())));
}
// Every entry, even if deleted or duplicated, must be counted, as we will need to adjust the Segment's
// TOTAL_ENTRY_COUNT attribute at the end.
count++;
// Update the offset to the beginning of the next entry.
nextOffset += e.getHeader().getTotalLength();
}
} catch (EOFException ex) {
// We chose an arbitrary compact length, so it is quite possible we stopped reading in the middle of an entry.
// As such, EOFException is the only way to know when to stop. When this happens, we will have collected the
// total compact length in segmentOffset.
input.close();
}
return new CompactionArgs(startOffset, nextOffset, count, entries);
} | java | @SneakyThrows(IOException.class)
private CompactionArgs parseEntries(InputStream input, long startOffset, int maxLength) {
val entries = new HashMap<UUID, CandidateSet>();
int count = 0;
long nextOffset = startOffset;
final long maxOffset = startOffset + maxLength;
try {
while (nextOffset < maxOffset) {
// TODO: Handle error when compaction offset is not on Entry boundary (https://github.com/pravega/pravega/issues/3560).
val e = AsyncTableEntryReader.readEntryComponents(input, nextOffset, this.connector.getSerializer());
// We only care about updates, and not removals.
if (!e.getHeader().isDeletion()) {
// Group by KeyHash, and deduplicate (based on key).
val hash = this.connector.getKeyHasher().hash(e.getKey());
CandidateSet candidates = entries.computeIfAbsent(hash, h -> new CandidateSet());
candidates.add(new Candidate(nextOffset,
TableEntry.versioned(new ByteArraySegment(e.getKey()), new ByteArraySegment(e.getValue()), e.getVersion())));
}
// Every entry, even if deleted or duplicated, must be counted, as we will need to adjust the Segment's
// TOTAL_ENTRY_COUNT attribute at the end.
count++;
// Update the offset to the beginning of the next entry.
nextOffset += e.getHeader().getTotalLength();
}
} catch (EOFException ex) {
// We chose an arbitrary compact length, so it is quite possible we stopped reading in the middle of an entry.
// As such, EOFException is the only way to know when to stop. When this happens, we will have collected the
// total compact length in segmentOffset.
input.close();
}
return new CompactionArgs(startOffset, nextOffset, count, entries);
} | [
"@",
"SneakyThrows",
"(",
"IOException",
".",
"class",
")",
"private",
"CompactionArgs",
"parseEntries",
"(",
"InputStream",
"input",
",",
"long",
"startOffset",
",",
"int",
"maxLength",
")",
"{",
"val",
"entries",
"=",
"new",
"HashMap",
"<",
"UUID",
",",
"C... | Parses out a {@link CompactionArgs} object containing Compaction {@link Candidate}s from the given InputStream
representing Segment data.
@param input An InputStream representing a continuous range of bytes in the Segment.
@param startOffset The offset at which the InputStream begins. This should be the Compaction Offset.
@param maxLength The maximum number of bytes read. The given InputStream should have at most this number of
bytes in it.
@return A {@link CompactionArgs} object containing the result. | [
"Parses",
"out",
"a",
"{",
"@link",
"CompactionArgs",
"}",
"object",
"containing",
"Compaction",
"{",
"@link",
"Candidate",
"}",
"s",
"from",
"the",
"given",
"InputStream",
"representing",
"Segment",
"data",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableCompactor.java#L209-L244 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/file/PathHelper.java | PathHelper.getDirectoryContent | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <Path> getDirectoryContent (@Nonnull final Path aDirectory)
{
ValueEnforcer.notNull (aDirectory, "Directory");
return _getDirectoryContent (aDirectory, null);
} | java | @Nonnull
@ReturnsMutableCopy
public static ICommonsList <Path> getDirectoryContent (@Nonnull final Path aDirectory)
{
ValueEnforcer.notNull (aDirectory, "Directory");
return _getDirectoryContent (aDirectory, null);
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"ICommonsList",
"<",
"Path",
">",
"getDirectoryContent",
"(",
"@",
"Nonnull",
"final",
"Path",
"aDirectory",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aDirectory",
",",
"\"Directory\"",
")",
"... | This is a replacement for <code>Path.listFiles()</code> doing some
additional checks on permissions. The order of the returned files is
undefined. "." and ".." are not contained.
@param aDirectory
The directory to be listed. May not be <code>null</code>.
@return Never <code>null</code>. | [
"This",
"is",
"a",
"replacement",
"for",
"<code",
">",
"Path",
".",
"listFiles",
"()",
"<",
"/",
"code",
">",
"doing",
"some",
"additional",
"checks",
"on",
"permissions",
".",
"The",
"order",
"of",
"the",
"returned",
"files",
"is",
"undefined",
".",
"."... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/PathHelper.java#L655-L662 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | public static void pack(ZipEntrySource[] entries, OutputStream os) {
if (log.isDebugEnabled()) {
log.debug("Creating stream from {}.", Arrays.asList(entries));
}
pack(entries, os, false);
} | java | public static void pack(ZipEntrySource[] entries, OutputStream os) {
if (log.isDebugEnabled()) {
log.debug("Creating stream from {}.", Arrays.asList(entries));
}
pack(entries, os, false);
} | [
"public",
"static",
"void",
"pack",
"(",
"ZipEntrySource",
"[",
"]",
"entries",
",",
"OutputStream",
"os",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Creating stream from {}.\"",
",",
"Arrays",
".",
... | Compresses the given entries into an output stream.
@param entries
ZIP entries added.
@param os
output stream for the new ZIP (does not have to be buffered)
@since 1.9 | [
"Compresses",
"the",
"given",
"entries",
"into",
"an",
"output",
"stream",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1964-L1969 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/SOS.java | SOS.computePi | public static double computePi(DBIDRef ignore, DoubleDBIDListIter it, double[] p, double perplexity, double logPerp) {
// Relation to paper: beta == 1. / (2*sigma*sigma)
double beta = estimateInitialBeta(ignore, it, perplexity);
double diff = computeH(ignore, it, p, -beta) - logPerp;
double betaMin = 0.;
double betaMax = Double.POSITIVE_INFINITY;
for(int tries = 0; tries < PERPLEXITY_MAXITER && Math.abs(diff) > PERPLEXITY_ERROR; ++tries) {
if(diff > 0) {
betaMin = beta;
beta += (betaMax == Double.POSITIVE_INFINITY) ? beta : ((betaMax - beta) * .5);
}
else {
betaMax = beta;
beta -= (beta - betaMin) * .5;
}
diff = computeH(ignore, it, p, -beta) - logPerp;
}
return beta;
} | java | public static double computePi(DBIDRef ignore, DoubleDBIDListIter it, double[] p, double perplexity, double logPerp) {
// Relation to paper: beta == 1. / (2*sigma*sigma)
double beta = estimateInitialBeta(ignore, it, perplexity);
double diff = computeH(ignore, it, p, -beta) - logPerp;
double betaMin = 0.;
double betaMax = Double.POSITIVE_INFINITY;
for(int tries = 0; tries < PERPLEXITY_MAXITER && Math.abs(diff) > PERPLEXITY_ERROR; ++tries) {
if(diff > 0) {
betaMin = beta;
beta += (betaMax == Double.POSITIVE_INFINITY) ? beta : ((betaMax - beta) * .5);
}
else {
betaMax = beta;
beta -= (beta - betaMin) * .5;
}
diff = computeH(ignore, it, p, -beta) - logPerp;
}
return beta;
} | [
"public",
"static",
"double",
"computePi",
"(",
"DBIDRef",
"ignore",
",",
"DoubleDBIDListIter",
"it",
",",
"double",
"[",
"]",
"p",
",",
"double",
"perplexity",
",",
"double",
"logPerp",
")",
"{",
"// Relation to paper: beta == 1. / (2*sigma*sigma)",
"double",
"beta... | Compute row p[i], using binary search on the kernel bandwidth sigma to
obtain the desired perplexity.
@param ignore Object to skip
@param it Distances iterator
@param p Output row
@param perplexity Desired perplexity
@param logPerp Log of desired perplexity
@return Beta | [
"Compute",
"row",
"p",
"[",
"i",
"]",
"using",
"binary",
"search",
"on",
"the",
"kernel",
"bandwidth",
"sigma",
"to",
"obtain",
"the",
"desired",
"perplexity",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/SOS.java#L212-L230 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/RegularFile.java | RegularFile.transferBlocksTo | void transferBlocksTo(RegularFile target, int count) {
copyBlocksTo(target, count);
truncateBlocks(blockCount - count);
} | java | void transferBlocksTo(RegularFile target, int count) {
copyBlocksTo(target, count);
truncateBlocks(blockCount - count);
} | [
"void",
"transferBlocksTo",
"(",
"RegularFile",
"target",
",",
"int",
"count",
")",
"{",
"copyBlocksTo",
"(",
"target",
",",
"count",
")",
";",
"truncateBlocks",
"(",
"blockCount",
"-",
"count",
")",
";",
"}"
] | Transfers the last {@code count} blocks from this file to the end of the given target file. | [
"Transfers",
"the",
"last",
"{"
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/RegularFile.java#L107-L110 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/Jenkins.java | Jenkins.doResources | public void doResources(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
String path = req.getRestOfPath();
// cut off the "..." portion of /resources/.../path/to/file
// as this is only used to make path unique (which in turn
// allows us to set a long expiration date
path = path.substring(path.indexOf('/',1)+1);
int idx = path.lastIndexOf('.');
String extension = path.substring(idx+1);
if(ALLOWED_RESOURCE_EXTENSIONS.contains(extension)) {
URL url = pluginManager.uberClassLoader.getResource(path);
if(url!=null) {
long expires = MetaClass.NO_CACHE ? 0 : TimeUnit.DAYS.toMillis(365);
rsp.serveFile(req,url,expires);
return;
}
}
rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
} | java | public void doResources(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
String path = req.getRestOfPath();
// cut off the "..." portion of /resources/.../path/to/file
// as this is only used to make path unique (which in turn
// allows us to set a long expiration date
path = path.substring(path.indexOf('/',1)+1);
int idx = path.lastIndexOf('.');
String extension = path.substring(idx+1);
if(ALLOWED_RESOURCE_EXTENSIONS.contains(extension)) {
URL url = pluginManager.uberClassLoader.getResource(path);
if(url!=null) {
long expires = MetaClass.NO_CACHE ? 0 : TimeUnit.DAYS.toMillis(365);
rsp.serveFile(req,url,expires);
return;
}
}
rsp.sendError(HttpServletResponse.SC_NOT_FOUND);
} | [
"public",
"void",
"doResources",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"String",
"path",
"=",
"req",
".",
"getRestOfPath",
"(",
")",
";",
"// cut off the \"...\" portion of /resources/.... | Serves static resources placed along with Jelly view files.
<p>
This method can serve a lot of files, so care needs to be taken
to make this method secure. It's not clear to me what's the best
strategy here, though the current implementation is based on
file extensions. | [
"Serves",
"static",
"resources",
"placed",
"along",
"with",
"Jelly",
"view",
"files",
".",
"<p",
">",
"This",
"method",
"can",
"serve",
"a",
"lot",
"of",
"files",
"so",
"care",
"needs",
"to",
"be",
"taken",
"to",
"make",
"this",
"method",
"secure",
".",
... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L4575-L4593 |
weld/core | environments/common/src/main/java/org/jboss/weld/environment/deployment/WeldDeployment.java | WeldDeployment.createAdditionalBeanDeploymentArchive | protected WeldBeanDeploymentArchive createAdditionalBeanDeploymentArchive() {
WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(ADDITIONAL_BDA_ID, Collections.synchronizedSet(new HashSet<String>()), null);
additionalBda.getServices().addAll(getServices().entrySet());
beanDeploymentArchives.add(additionalBda);
setBeanDeploymentArchivesAccessibility();
return additionalBda;
} | java | protected WeldBeanDeploymentArchive createAdditionalBeanDeploymentArchive() {
WeldBeanDeploymentArchive additionalBda = new WeldBeanDeploymentArchive(ADDITIONAL_BDA_ID, Collections.synchronizedSet(new HashSet<String>()), null);
additionalBda.getServices().addAll(getServices().entrySet());
beanDeploymentArchives.add(additionalBda);
setBeanDeploymentArchivesAccessibility();
return additionalBda;
} | [
"protected",
"WeldBeanDeploymentArchive",
"createAdditionalBeanDeploymentArchive",
"(",
")",
"{",
"WeldBeanDeploymentArchive",
"additionalBda",
"=",
"new",
"WeldBeanDeploymentArchive",
"(",
"ADDITIONAL_BDA_ID",
",",
"Collections",
".",
"synchronizedSet",
"(",
"new",
"HashSet",
... | Additional bean deployment archives are used for extentions, synthetic annotated types and beans which do not come from a bean archive.
@param beanClass
@return the additional bean deployment archive | [
"Additional",
"bean",
"deployment",
"archives",
"are",
"used",
"for",
"extentions",
"synthetic",
"annotated",
"types",
"and",
"beans",
"which",
"do",
"not",
"come",
"from",
"a",
"bean",
"archive",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/common/src/main/java/org/jboss/weld/environment/deployment/WeldDeployment.java#L104-L110 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java | ConvertBufferedImage.convertFrom | public static <T extends ImageBase<T>> T convertFrom(BufferedImage src , boolean orderRgb , ImageType<T> imageType) {
T out = imageType.createImage(src.getWidth(),src.getHeight());
switch( imageType.getFamily() ) {
case GRAY:
convertFromSingle(src, (ImageGray)out, imageType.getImageClass());
break;
case PLANAR:
convertFromPlanar(src, (Planar) out, orderRgb, imageType.getImageClass());
break;
case INTERLEAVED:
convertFromInterleaved(src, (ImageInterleaved) out, orderRgb);
break;
default:
throw new RuntimeException("Not supported yet");
}
return out;
} | java | public static <T extends ImageBase<T>> T convertFrom(BufferedImage src , boolean orderRgb , ImageType<T> imageType) {
T out = imageType.createImage(src.getWidth(),src.getHeight());
switch( imageType.getFamily() ) {
case GRAY:
convertFromSingle(src, (ImageGray)out, imageType.getImageClass());
break;
case PLANAR:
convertFromPlanar(src, (Planar) out, orderRgb, imageType.getImageClass());
break;
case INTERLEAVED:
convertFromInterleaved(src, (ImageInterleaved) out, orderRgb);
break;
default:
throw new RuntimeException("Not supported yet");
}
return out;
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageBase",
"<",
"T",
">",
">",
"T",
"convertFrom",
"(",
"BufferedImage",
"src",
",",
"boolean",
"orderRgb",
",",
"ImageType",
"<",
"T",
">",
"imageType",
")",
"{",
"T",
"out",
"=",
"imageType",
".",
"createImage... | Converts a buffered image into an image of the specified type.
@param src Input BufferedImage which is to be converted
@param orderRgb If applicable, should it adjust the ordering of each color band to maintain color consistency
@param imageType Type of image it is to be converted into
@return The image | [
"Converts",
"a",
"buffered",
"image",
"into",
"an",
"image",
"of",
"the",
"specified",
"type",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L291-L313 |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/contract/Checks.java | Checks.checkUri | public static String checkUri(String uri,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
checkArgument(uri != null, "Expected non-null uri");
checkArgument(uri.length() > 0 && uri.length() < 2000,
"Expected a email in range 1 to 2000 characters, got %s", uri.length());
return check(uri, isValidURI(), errorMessageTemplate, errorMessageArgs);
} | java | public static String checkUri(String uri,
@Nullable String errorMessageTemplate,
@Nullable Object... errorMessageArgs) {
checkArgument(uri != null, "Expected non-null uri");
checkArgument(uri.length() > 0 && uri.length() < 2000,
"Expected a email in range 1 to 2000 characters, got %s", uri.length());
return check(uri, isValidURI(), errorMessageTemplate, errorMessageArgs);
} | [
"public",
"static",
"String",
"checkUri",
"(",
"String",
"uri",
",",
"@",
"Nullable",
"String",
"errorMessageTemplate",
",",
"@",
"Nullable",
"Object",
"...",
"errorMessageArgs",
")",
"{",
"checkArgument",
"(",
"uri",
"!=",
"null",
",",
"\"Expected non-null uri\""... | Performs URI check against RFC 2396 specification
@param uri the URI to check
@return the checked uri
@throws IllegalArgumentException if the {@code uri} is invalid
@throws NullPointerException if the {@code uri} is null
@see java.net.URI | [
"Performs",
"URI",
"check",
"against",
"RFC",
"2396",
"specification"
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/contract/Checks.java#L430-L437 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.writeUTF16Surrogate | protected int writeUTF16Surrogate(char c, char ch[], int i, int end)
throws IOException
{
int codePoint = 0;
if (i + 1 >= end)
{
throw new IOException(
Utils.messages.createMessage(
MsgKey.ER_INVALID_UTF16_SURROGATE,
new Object[] { Integer.toHexString((int) c)}));
}
final char high = c;
final char low = ch[i+1];
if (!Encodings.isLowUTF16Surrogate(low)) {
throw new IOException(
Utils.messages.createMessage(
MsgKey.ER_INVALID_UTF16_SURROGATE,
new Object[] {
Integer.toHexString((int) c)
+ " "
+ Integer.toHexString(low)}));
}
final java.io.Writer writer = m_writer;
// If we make it to here we have a valid high, low surrogate pair
if (m_encodingInfo.isInEncoding(c,low)) {
// If the character formed by the surrogate pair
// is in the encoding, so just write it out
writer.write(ch,i,2);
}
else {
// Don't know what to do with this char, it is
// not in the encoding and not a high char in
// a surrogate pair, so write out as an entity ref
final String encoding = getEncoding();
if (encoding != null) {
/* The output encoding is known,
* so somthing is wrong.
*/
codePoint = Encodings.toCodePoint(high, low);
// not in the encoding, so write out a character reference
writer.write('&');
writer.write('#');
writer.write(Integer.toString(codePoint));
writer.write(';');
} else {
/* The output encoding is not known,
* so just write it out as-is.
*/
writer.write(ch, i, 2);
}
}
// non-zero only if character reference was written out.
return codePoint;
} | java | protected int writeUTF16Surrogate(char c, char ch[], int i, int end)
throws IOException
{
int codePoint = 0;
if (i + 1 >= end)
{
throw new IOException(
Utils.messages.createMessage(
MsgKey.ER_INVALID_UTF16_SURROGATE,
new Object[] { Integer.toHexString((int) c)}));
}
final char high = c;
final char low = ch[i+1];
if (!Encodings.isLowUTF16Surrogate(low)) {
throw new IOException(
Utils.messages.createMessage(
MsgKey.ER_INVALID_UTF16_SURROGATE,
new Object[] {
Integer.toHexString((int) c)
+ " "
+ Integer.toHexString(low)}));
}
final java.io.Writer writer = m_writer;
// If we make it to here we have a valid high, low surrogate pair
if (m_encodingInfo.isInEncoding(c,low)) {
// If the character formed by the surrogate pair
// is in the encoding, so just write it out
writer.write(ch,i,2);
}
else {
// Don't know what to do with this char, it is
// not in the encoding and not a high char in
// a surrogate pair, so write out as an entity ref
final String encoding = getEncoding();
if (encoding != null) {
/* The output encoding is known,
* so somthing is wrong.
*/
codePoint = Encodings.toCodePoint(high, low);
// not in the encoding, so write out a character reference
writer.write('&');
writer.write('#');
writer.write(Integer.toString(codePoint));
writer.write(';');
} else {
/* The output encoding is not known,
* so just write it out as-is.
*/
writer.write(ch, i, 2);
}
}
// non-zero only if character reference was written out.
return codePoint;
} | [
"protected",
"int",
"writeUTF16Surrogate",
"(",
"char",
"c",
",",
"char",
"ch",
"[",
"]",
",",
"int",
"i",
",",
"int",
"end",
")",
"throws",
"IOException",
"{",
"int",
"codePoint",
"=",
"0",
";",
"if",
"(",
"i",
"+",
"1",
">=",
"end",
")",
"{",
"... | Once a surrogate has been detected, write out the pair of
characters if it is in the encoding, or if there is no
encoding, otherwise write out an entity reference
of the value of the unicode code point of the character
represented by the high/low surrogate pair.
<p>
An exception is thrown if there is no low surrogate in the pair,
because the array ends unexpectely, or if the low char is there
but its value is such that it is not a low surrogate.
@param c the first (high) part of the surrogate, which
must be confirmed before calling this method.
@param ch Character array.
@param i position Where the surrogate was detected.
@param end The end index of the significant characters.
@return 0 if the pair of characters was written out as-is,
the unicode code point of the character represented by
the surrogate pair if an entity reference with that value
was written out.
@throws IOException
@throws org.xml.sax.SAXException if invalid UTF-16 surrogate detected. | [
"Once",
"a",
"surrogate",
"has",
"been",
"detected",
"write",
"out",
"the",
"pair",
"of",
"characters",
"if",
"it",
"is",
"in",
"the",
"encoding",
"or",
"if",
"there",
"is",
"no",
"encoding",
"otherwise",
"write",
"out",
"an",
"entity",
"reference",
"of",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L983-L1039 |
VoltDB/voltdb | src/frontend/org/voltdb/NonVoltDBBackend.java | NonVoltDBBackend.isGeoColumn | private boolean isGeoColumn(String columnName, List<String> tableNames, boolean debugPrint) {
List<String> geoColumnTypes = Arrays.asList("GEOGRAPHY", "GEOGRAPHY_POINT");
return isColumnType(geoColumnTypes, columnName, tableNames, debugPrint);
} | java | private boolean isGeoColumn(String columnName, List<String> tableNames, boolean debugPrint) {
List<String> geoColumnTypes = Arrays.asList("GEOGRAPHY", "GEOGRAPHY_POINT");
return isColumnType(geoColumnTypes, columnName, tableNames, debugPrint);
} | [
"private",
"boolean",
"isGeoColumn",
"(",
"String",
"columnName",
",",
"List",
"<",
"String",
">",
"tableNames",
",",
"boolean",
"debugPrint",
")",
"{",
"List",
"<",
"String",
">",
"geoColumnTypes",
"=",
"Arrays",
".",
"asList",
"(",
"\"GEOGRAPHY\"",
",",
"\... | Returns true if the <i>columnName</i> is a Geospatial column type, i.e.,
a GEOGRAPHY_POINT (point) or GEOGRAPHY (polygon) column, or equivalents
in a comparison, non-VoltDB database; false otherwise. | [
"Returns",
"true",
"if",
"the",
"<i",
">",
"columnName<",
"/",
"i",
">",
"is",
"a",
"Geospatial",
"column",
"type",
"i",
".",
"e",
".",
"a",
"GEOGRAPHY_POINT",
"(",
"point",
")",
"or",
"GEOGRAPHY",
"(",
"polygon",
")",
"column",
"or",
"equivalents",
"i... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/NonVoltDBBackend.java#L556-L559 |
bignerdranch/expandable-recycler-view | sampleapp/src/main/java/com/bignerdranch/expandablerecyclerviewsample/linear/horizontal/HorizontalExpandableAdapter.java | HorizontalExpandableAdapter.onCreateChildViewHolder | @UiThread
@NonNull
@Override
public HorizontalChildViewHolder onCreateChildViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mInflater.inflate(R.layout.list_item_child_horizontal, parent, false);
return new HorizontalChildViewHolder(view);
} | java | @UiThread
@NonNull
@Override
public HorizontalChildViewHolder onCreateChildViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mInflater.inflate(R.layout.list_item_child_horizontal, parent, false);
return new HorizontalChildViewHolder(view);
} | [
"@",
"UiThread",
"@",
"NonNull",
"@",
"Override",
"public",
"HorizontalChildViewHolder",
"onCreateChildViewHolder",
"(",
"@",
"NonNull",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"View",
"view",
"=",
"mInflater",
".",
"inflate",
"(",
"R",
".",
"... | OnCreateViewHolder implementation for child items. The desired ChildViewHolder should
be inflated here
@param parent for inflating the View
@return the user's custom parent ViewHolder that must extend ParentViewHolder | [
"OnCreateViewHolder",
"implementation",
"for",
"child",
"items",
".",
"The",
"desired",
"ChildViewHolder",
"should",
"be",
"inflated",
"here"
] | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/sampleapp/src/main/java/com/bignerdranch/expandablerecyclerviewsample/linear/horizontal/HorizontalExpandableAdapter.java#L56-L62 |
davidcarboni/cryptolite-java | src/main/java/com/github/davidcarboni/cryptolite/KeyExchange.java | KeyExchange.getCipher | private Cipher getCipher(int mode, Key key) {
if (cipher == null) {
try {
// Get a Cipher instance:
cipher = Cipher.getInstance(cipherName);
} catch (NoSuchAlgorithmException e) {
if (SecurityProvider.addProvider()) {
cipher = getCipher(mode, key);
} else {
throw new IllegalStateException("Algorithm unavailable: " + cipherName, e);
}
} catch (NoSuchPaddingException e) {
throw new IllegalStateException("Padding method unavailable: " + cipherName, e);
}
}
// Initialise the Cipher
try {
cipher.init(mode, key);
} catch (InvalidKeyException e) {
throw new IllegalArgumentException("Invalid key used to initialise cipher.", e);
}
return cipher;
} | java | private Cipher getCipher(int mode, Key key) {
if (cipher == null) {
try {
// Get a Cipher instance:
cipher = Cipher.getInstance(cipherName);
} catch (NoSuchAlgorithmException e) {
if (SecurityProvider.addProvider()) {
cipher = getCipher(mode, key);
} else {
throw new IllegalStateException("Algorithm unavailable: " + cipherName, e);
}
} catch (NoSuchPaddingException e) {
throw new IllegalStateException("Padding method unavailable: " + cipherName, e);
}
}
// Initialise the Cipher
try {
cipher.init(mode, key);
} catch (InvalidKeyException e) {
throw new IllegalArgumentException("Invalid key used to initialise cipher.", e);
}
return cipher;
} | [
"private",
"Cipher",
"getCipher",
"(",
"int",
"mode",
",",
"Key",
"key",
")",
"{",
"if",
"(",
"cipher",
"==",
"null",
")",
"{",
"try",
"{",
"// Get a Cipher instance:\r",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"cipherName",
")",
";",
"}",
"cat... | This method returns a {@link Cipher} instance, for {@value #CIPHER_ALGORITHM} in mode
{@value #CIPHER_MODE}, with padding {@value #CIPHER_PADDING}.
<p>
It then initialises the {@link Cipher} in either {@link Cipher#ENCRYPT_MODE} or
{@link Cipher#DECRYPT_MODE}), as specified by the mode parameter, with the given
{@link SecretKey}.
@param mode One of {@link Cipher#ENCRYPT_MODE} or {@link Cipher#DECRYPT_MODE}).
@param key Either a {@link PublicKey} or a {@link PrivateKey} to be used with the
{@link Cipher}.
@return A lazily-instantiated, cached {@link Cipher} instance. | [
"This",
"method",
"returns",
"a",
"{",
"@link",
"Cipher",
"}",
"instance",
"for",
"{",
"@value",
"#CIPHER_ALGORITHM",
"}",
"in",
"mode",
"{",
"@value",
"#CIPHER_MODE",
"}",
"with",
"padding",
"{",
"@value",
"#CIPHER_PADDING",
"}",
".",
"<p",
">",
"It",
"th... | train | https://github.com/davidcarboni/cryptolite-java/blob/e67954181a04ffc9beb1d9abca1421195fcf9764/src/main/java/com/github/davidcarboni/cryptolite/KeyExchange.java#L193-L221 |
Blazebit/blaze-utils | blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java | ReflectionUtils.getTypeVariablePosition | public static int getTypeVariablePosition(GenericDeclaration genericDeclartion, TypeVariable<?> typeVariable) {
int position = -1;
TypeVariable<?>[] typeVariableDeclarationParameters = genericDeclartion
.getTypeParameters();
// Try to find the position of the type variable in the class
for (int i = 0; i < typeVariableDeclarationParameters.length; i++) {
if (typeVariableDeclarationParameters[i].equals(typeVariable)) {
position = i;
break;
}
}
return position;
} | java | public static int getTypeVariablePosition(GenericDeclaration genericDeclartion, TypeVariable<?> typeVariable) {
int position = -1;
TypeVariable<?>[] typeVariableDeclarationParameters = genericDeclartion
.getTypeParameters();
// Try to find the position of the type variable in the class
for (int i = 0; i < typeVariableDeclarationParameters.length; i++) {
if (typeVariableDeclarationParameters[i].equals(typeVariable)) {
position = i;
break;
}
}
return position;
} | [
"public",
"static",
"int",
"getTypeVariablePosition",
"(",
"GenericDeclaration",
"genericDeclartion",
",",
"TypeVariable",
"<",
"?",
">",
"typeVariable",
")",
"{",
"int",
"position",
"=",
"-",
"1",
";",
"TypeVariable",
"<",
"?",
">",
"[",
"]",
"typeVariableDecla... | Tries to find the position of the given type variable in the type
parameters of the given class. This method iterates through the type
parameters of the given class and tries to find the given type variable
within the type parameters. When the type variable is found, the position
is returned, otherwise -1.
@param genericDeclartion The generic declartion type in which to look for the type
variable
@param typeVariable The type variable to look for in the given class type
parameters
@return The position of the given type variable within the type
parameters of the given class if found, otherwise -1 | [
"Tries",
"to",
"find",
"the",
"position",
"of",
"the",
"given",
"type",
"variable",
"in",
"the",
"type",
"parameters",
"of",
"the",
"given",
"class",
".",
"This",
"method",
"iterates",
"through",
"the",
"type",
"parameters",
"of",
"the",
"given",
"class",
... | train | https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L494-L508 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java | PackageSummaryBuilder.buildExceptionSummary | public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
String exceptionTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Exception_Summary"),
configuration.getText("doclet.exceptions"));
String[] exceptionTableHeader = new String[] {
configuration.getText("doclet.Exception"),
configuration.getText("doclet.Description")
};
ClassDoc[] exceptions =
packageDoc.isIncluded()
? packageDoc.exceptions()
: configuration.classDocCatalog.exceptions(
utils.getPackageName(packageDoc));
exceptions = utils.filterOutPrivateClasses(exceptions, configuration.javafx);
if (exceptions.length > 0) {
packageWriter.addClassesSummary(
exceptions,
configuration.getText("doclet.Exception_Summary"),
exceptionTableSummary, exceptionTableHeader, summaryContentTree);
}
} | java | public void buildExceptionSummary(XMLNode node, Content summaryContentTree) {
String exceptionTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Exception_Summary"),
configuration.getText("doclet.exceptions"));
String[] exceptionTableHeader = new String[] {
configuration.getText("doclet.Exception"),
configuration.getText("doclet.Description")
};
ClassDoc[] exceptions =
packageDoc.isIncluded()
? packageDoc.exceptions()
: configuration.classDocCatalog.exceptions(
utils.getPackageName(packageDoc));
exceptions = utils.filterOutPrivateClasses(exceptions, configuration.javafx);
if (exceptions.length > 0) {
packageWriter.addClassesSummary(
exceptions,
configuration.getText("doclet.Exception_Summary"),
exceptionTableSummary, exceptionTableHeader, summaryContentTree);
}
} | [
"public",
"void",
"buildExceptionSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"summaryContentTree",
")",
"{",
"String",
"exceptionTableSummary",
"=",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"",
",",
"configuration",
".",
"getText",
"(",... | Build the summary for the exceptions in this package.
@param node the XML element that specifies which components to document
@param summaryContentTree the summary tree to which the exception summary will
be added | [
"Build",
"the",
"summary",
"for",
"the",
"exceptions",
"in",
"this",
"package",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java#L254-L275 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverRf.java | JCusolverRf.cusolverRfResetValues | public static int cusolverRfResetValues(
int n,
int nnzA,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer csrValA,
Pointer P,
Pointer Q,
/** Output */
cusolverRfHandle handle)
{
return checkResult(cusolverRfResetValuesNative(n, nnzA, csrRowPtrA, csrColIndA, csrValA, P, Q, handle));
} | java | public static int cusolverRfResetValues(
int n,
int nnzA,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer csrValA,
Pointer P,
Pointer Q,
/** Output */
cusolverRfHandle handle)
{
return checkResult(cusolverRfResetValuesNative(n, nnzA, csrRowPtrA, csrColIndA, csrValA, P, Q, handle));
} | [
"public",
"static",
"int",
"cusolverRfResetValues",
"(",
"int",
"n",
",",
"int",
"nnzA",
",",
"Pointer",
"csrRowPtrA",
",",
"Pointer",
"csrColIndA",
",",
"Pointer",
"csrValA",
",",
"Pointer",
"P",
",",
"Pointer",
"Q",
",",
"/** Output */",
"cusolverRfHandle",
... | CUSOLVERRF update the matrix values (assuming the reordering, pivoting
and consequently the sparsity pattern of L and U did not change),
and zero out the remaining values. | [
"CUSOLVERRF",
"update",
"the",
"matrix",
"values",
"(",
"assuming",
"the",
"reordering",
"pivoting",
"and",
"consequently",
"the",
"sparsity",
"pattern",
"of",
"L",
"and",
"U",
"did",
"not",
"change",
")",
"and",
"zero",
"out",
"the",
"remaining",
"values",
... | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverRf.java#L288-L300 |
Doctoror/Geocoder | library/src/main/java/com/doctoror/geocoder/Parser.java | Parser.parseJson | @NonNull
static List<Address> parseJson(final byte[] jsonData,
final int maxResults,
final boolean parseAddressComponents)
throws GeocoderException {
try {
final String jsonString = new String(jsonData, Charset.forName("UTF-8"));
final JSONObject jsonObject = new JSONObject(jsonString);
if (!jsonObject.has(STATUS)) {
throw new GeocoderException(new JSONException("No \"status\" field"));
}
final Status status = Status.fromString(jsonObject.getString(STATUS));
switch (status) {
case OK:
if (jsonObject.has(RESULTS)) {
return parseResults(maxResults, parseAddressComponents, jsonObject);
}
return new ArrayList<>();
case ZERO_RESULTS:
return new ArrayList<>();
default:
final GeocoderException e = GeocoderException.forStatus(status);
try {
if (jsonObject.has(ERROR_MESSAGE)) {
e.setErrorMessage(jsonObject.getString(ERROR_MESSAGE));
}
} catch (JSONException ignored) {
}
throw e;
}
} catch (JSONException e) {
throw new GeocoderException(e);
}
} | java | @NonNull
static List<Address> parseJson(final byte[] jsonData,
final int maxResults,
final boolean parseAddressComponents)
throws GeocoderException {
try {
final String jsonString = new String(jsonData, Charset.forName("UTF-8"));
final JSONObject jsonObject = new JSONObject(jsonString);
if (!jsonObject.has(STATUS)) {
throw new GeocoderException(new JSONException("No \"status\" field"));
}
final Status status = Status.fromString(jsonObject.getString(STATUS));
switch (status) {
case OK:
if (jsonObject.has(RESULTS)) {
return parseResults(maxResults, parseAddressComponents, jsonObject);
}
return new ArrayList<>();
case ZERO_RESULTS:
return new ArrayList<>();
default:
final GeocoderException e = GeocoderException.forStatus(status);
try {
if (jsonObject.has(ERROR_MESSAGE)) {
e.setErrorMessage(jsonObject.getString(ERROR_MESSAGE));
}
} catch (JSONException ignored) {
}
throw e;
}
} catch (JSONException e) {
throw new GeocoderException(e);
}
} | [
"@",
"NonNull",
"static",
"List",
"<",
"Address",
">",
"parseJson",
"(",
"final",
"byte",
"[",
"]",
"jsonData",
",",
"final",
"int",
"maxResults",
",",
"final",
"boolean",
"parseAddressComponents",
")",
"throws",
"GeocoderException",
"{",
"try",
"{",
"final",
... | Parses response into {@link List}
@param jsonData
@param maxResults
@param parseAddressComponents
@return {@link Address} {@link List}
@throws GeocoderException if error occurs | [
"Parses",
"response",
"into",
"{",
"@link",
"List",
"}"
] | train | https://github.com/Doctoror/Geocoder/blob/c55463266584c7ad79880ffc7869c25e5f9eb006/library/src/main/java/com/doctoror/geocoder/Parser.java#L85-L122 |
JakeWharton/NineOldAndroids | library/src/com/nineoldandroids/view/ViewPropertyAnimatorPreHC.java | ViewPropertyAnimatorPreHC.animateProperty | private void animateProperty(int constantName, float toValue) {
float fromValue = getValue(constantName);
float deltaValue = toValue - fromValue;
animatePropertyBy(constantName, fromValue, deltaValue);
} | java | private void animateProperty(int constantName, float toValue) {
float fromValue = getValue(constantName);
float deltaValue = toValue - fromValue;
animatePropertyBy(constantName, fromValue, deltaValue);
} | [
"private",
"void",
"animateProperty",
"(",
"int",
"constantName",
",",
"float",
"toValue",
")",
"{",
"float",
"fromValue",
"=",
"getValue",
"(",
"constantName",
")",
";",
"float",
"deltaValue",
"=",
"toValue",
"-",
"fromValue",
";",
"animatePropertyBy",
"(",
"... | Utility function, called by the various x(), y(), etc. methods. This stores the
constant name for the property along with the from/delta values that will be used to
calculate and set the property during the animation. This structure is added to the
pending animations, awaiting the eventual start() of the underlying animator. A
Runnable is posted to start the animation, and any pending such Runnable is canceled
(which enables us to end up starting just one animator for all of the properties
specified at one time).
@param constantName The specifier for the property being animated
@param toValue The value to which the property will animate | [
"Utility",
"function",
"called",
"by",
"the",
"various",
"x",
"()",
"y",
"()",
"etc",
".",
"methods",
".",
"This",
"stores",
"the",
"constant",
"name",
"for",
"the",
"property",
"along",
"with",
"the",
"from",
"/",
"delta",
"values",
"that",
"will",
"be"... | train | https://github.com/JakeWharton/NineOldAndroids/blob/d582f0ec8e79013e9fa96c07986160b52e662e63/library/src/com/nineoldandroids/view/ViewPropertyAnimatorPreHC.java#L473-L477 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/DatabaseManager.java | DatabaseManager.getSession | public static Session getSession(int dbId, long sessionId) {
Database db = (Database) databaseIDMap.get(dbId);
return db == null ? null
: db.sessionManager.getSession(sessionId);
} | java | public static Session getSession(int dbId, long sessionId) {
Database db = (Database) databaseIDMap.get(dbId);
return db == null ? null
: db.sessionManager.getSession(sessionId);
} | [
"public",
"static",
"Session",
"getSession",
"(",
"int",
"dbId",
",",
"long",
"sessionId",
")",
"{",
"Database",
"db",
"=",
"(",
"Database",
")",
"databaseIDMap",
".",
"get",
"(",
"dbId",
")",
";",
"return",
"db",
"==",
"null",
"?",
"null",
":",
"db",
... | Returns an existing session. Used with repeat HTTP connections
belonging to the same JDBC Conenction / HSQL Session pair. | [
"Returns",
"an",
"existing",
"session",
".",
"Used",
"with",
"repeat",
"HTTP",
"connections",
"belonging",
"to",
"the",
"same",
"JDBC",
"Conenction",
"/",
"HSQL",
"Session",
"pair",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/DatabaseManager.java#L183-L189 |
alkacon/opencms-core | src/org/opencms/importexport/A_CmsImport.java | A_CmsImport.checkImmutable | protected boolean checkImmutable(String translatedName, List<String> immutableResources) {
boolean resourceNotImmutable = true;
if (immutableResources.contains(translatedName)) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_RESOURCENAME_IMMUTABLE_1, translatedName));
}
// this resource must not be modified by an import if it already exists
String storedSiteRoot = m_cms.getRequestContext().getSiteRoot();
try {
m_cms.getRequestContext().setSiteRoot("/");
m_cms.readResource(translatedName);
resourceNotImmutable = false;
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_IMMUTABLE_FLAG_SET_1, translatedName));
}
} catch (CmsException e) {
// resourceNotImmutable will be true
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ERROR_ON_TEST_IMMUTABLE_1,
translatedName),
e);
}
} finally {
m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
}
}
return resourceNotImmutable;
} | java | protected boolean checkImmutable(String translatedName, List<String> immutableResources) {
boolean resourceNotImmutable = true;
if (immutableResources.contains(translatedName)) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_RESOURCENAME_IMMUTABLE_1, translatedName));
}
// this resource must not be modified by an import if it already exists
String storedSiteRoot = m_cms.getRequestContext().getSiteRoot();
try {
m_cms.getRequestContext().setSiteRoot("/");
m_cms.readResource(translatedName);
resourceNotImmutable = false;
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_IMMUTABLE_FLAG_SET_1, translatedName));
}
} catch (CmsException e) {
// resourceNotImmutable will be true
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ERROR_ON_TEST_IMMUTABLE_1,
translatedName),
e);
}
} finally {
m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
}
}
return resourceNotImmutable;
} | [
"protected",
"boolean",
"checkImmutable",
"(",
"String",
"translatedName",
",",
"List",
"<",
"String",
">",
"immutableResources",
")",
"{",
"boolean",
"resourceNotImmutable",
"=",
"true",
";",
"if",
"(",
"immutableResources",
".",
"contains",
"(",
"translatedName",
... | Checks if the resources is in the list of immutalbe resources. <p>
@param translatedName the name of the resource
@param immutableResources the list of the immutable resources
@return true or false | [
"Checks",
"if",
"the",
"resources",
"is",
"in",
"the",
"list",
"of",
"immutalbe",
"resources",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/A_CmsImport.java#L380-L412 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java | ComponentsInner.getPurgeStatus | public ComponentPurgeStatusResponseInner getPurgeStatus(String resourceGroupName, String resourceName, String purgeId) {
return getPurgeStatusWithServiceResponseAsync(resourceGroupName, resourceName, purgeId).toBlocking().single().body();
} | java | public ComponentPurgeStatusResponseInner getPurgeStatus(String resourceGroupName, String resourceName, String purgeId) {
return getPurgeStatusWithServiceResponseAsync(resourceGroupName, resourceName, purgeId).toBlocking().single().body();
} | [
"public",
"ComponentPurgeStatusResponseInner",
"getPurgeStatus",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"purgeId",
")",
"{",
"return",
"getPurgeStatusWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"p... | Get status for an ongoing purge operation.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param purgeId In a purge status request, this is the Id of the operation the status of which is returned.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ComponentPurgeStatusResponseInner object if successful. | [
"Get",
"status",
"for",
"an",
"ongoing",
"purge",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java#L882-L884 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/ClassLoaders.java | ClassLoaders.getResource | public static URL getResource(String resourceName, Class<?> callingClass) {
URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
if (url != null) return url;
url = ClassLoaders.class.getClassLoader().getResource(resourceName);
if (url != null) return url;
ClassLoader cl = callingClass.getClassLoader();
if (cl != null) url = cl.getResource(resourceName);
return url;
} | java | public static URL getResource(String resourceName, Class<?> callingClass) {
URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
if (url != null) return url;
url = ClassLoaders.class.getClassLoader().getResource(resourceName);
if (url != null) return url;
ClassLoader cl = callingClass.getClassLoader();
if (cl != null) url = cl.getResource(resourceName);
return url;
} | [
"public",
"static",
"URL",
"getResource",
"(",
"String",
"resourceName",
",",
"Class",
"<",
"?",
">",
"callingClass",
")",
"{",
"URL",
"url",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
".",
"getResource",
"(",
"r... | Load a given resource(Cannot start with slash /).
<p/>
This method will try to load the resource using the following methods (in order):
<ul>
<li>From {@link Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()}
<li>From {@link Class#getClassLoader() ClassLoaders.class.getClassLoader()}
<li>From the {@link Class#getClassLoader() callingClass.getClassLoader() }
</ul>
@param resourceName The name of the resource to load
@param callingClass The Class object of the calling object | [
"Load",
"a",
"given",
"resource",
"(",
"Cannot",
"start",
"with",
"slash",
"/",
")",
".",
"<p",
"/",
">",
"This",
"method",
"will",
"try",
"to",
"load",
"the",
"resource",
"using",
"the",
"following",
"methods",
"(",
"in",
"order",
")",
":",
"<ul",
"... | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/ClassLoaders.java#L75-L85 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/operations/Shell.java | Shell.executeProcess | private ProcessInfo executeProcess(boolean background,ProcessBuilder pb)
{
try
{
pb.directory(workingDirectory);
pb.redirectErrorStream(false);
if(log != null)
pb.redirectOutput(Redirect.appendTo(log));
pb.environment().putAll(envMap);
Process p = pb.start();
String out = null;
String error = null;
if(background)
{
out = IO.readText(p.getInputStream(),true,defaultBackgroundReadSize);
error = IO.readText(p.getErrorStream(),true,20);
}
else
{
out = IO.readText(p.getInputStream(),true);
error = IO.readText(p.getErrorStream(),true);
}
if(background)
return new ProcessInfo(0, out, error);
return new ProcessInfo(p.waitFor(),out,error);
}
catch (Exception e)
{
return new ProcessInfo(-1, null, Debugger.stackTrace(e));
}
} | java | private ProcessInfo executeProcess(boolean background,ProcessBuilder pb)
{
try
{
pb.directory(workingDirectory);
pb.redirectErrorStream(false);
if(log != null)
pb.redirectOutput(Redirect.appendTo(log));
pb.environment().putAll(envMap);
Process p = pb.start();
String out = null;
String error = null;
if(background)
{
out = IO.readText(p.getInputStream(),true,defaultBackgroundReadSize);
error = IO.readText(p.getErrorStream(),true,20);
}
else
{
out = IO.readText(p.getInputStream(),true);
error = IO.readText(p.getErrorStream(),true);
}
if(background)
return new ProcessInfo(0, out, error);
return new ProcessInfo(p.waitFor(),out,error);
}
catch (Exception e)
{
return new ProcessInfo(-1, null, Debugger.stackTrace(e));
}
} | [
"private",
"ProcessInfo",
"executeProcess",
"(",
"boolean",
"background",
",",
"ProcessBuilder",
"pb",
")",
"{",
"try",
"{",
"pb",
".",
"directory",
"(",
"workingDirectory",
")",
";",
"pb",
".",
"redirectErrorStream",
"(",
"false",
")",
";",
"if",
"(",
"log"... | Executes a process
@param background if starting as background process
@param pb the process builder
@return the process information
@throws IOException | [
"Executes",
"a",
"process"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/operations/Shell.java#L116-L157 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/BoxImageTransform.java | BoxImageTransform.doTransform | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
Mat mat = converter.convert(image.getFrame());
Mat box = new Mat(height, width, mat.type());
box.put(borderValue);
x = (mat.cols() - width) / 2;
y = (mat.rows() - height) / 2;
int w = Math.min(mat.cols(), width);
int h = Math.min(mat.rows(), height);
Rect matRect = new Rect(x, y, w, h);
Rect boxRect = new Rect(x, y, w, h);
if (x <= 0) {
matRect.x(0);
boxRect.x(-x);
} else {
matRect.x(x);
boxRect.x(0);
}
if (y <= 0) {
matRect.y(0);
boxRect.y(-y);
} else {
matRect.y(y);
boxRect.y(0);
}
mat.apply(matRect).copyTo(box.apply(boxRect));
return new ImageWritable(converter.convert(box));
} | java | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
Mat mat = converter.convert(image.getFrame());
Mat box = new Mat(height, width, mat.type());
box.put(borderValue);
x = (mat.cols() - width) / 2;
y = (mat.rows() - height) / 2;
int w = Math.min(mat.cols(), width);
int h = Math.min(mat.rows(), height);
Rect matRect = new Rect(x, y, w, h);
Rect boxRect = new Rect(x, y, w, h);
if (x <= 0) {
matRect.x(0);
boxRect.x(-x);
} else {
matRect.x(x);
boxRect.x(0);
}
if (y <= 0) {
matRect.y(0);
boxRect.y(-y);
} else {
matRect.y(y);
boxRect.y(0);
}
mat.apply(matRect).copyTo(box.apply(boxRect));
return new ImageWritable(converter.convert(box));
} | [
"@",
"Override",
"protected",
"ImageWritable",
"doTransform",
"(",
"ImageWritable",
"image",
",",
"Random",
"random",
")",
"{",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Mat",
"mat",
"=",
"converter",
".",
"convert",
"(",
"... | Takes an image and returns a boxed version of the image.
@param image to transform, null == end of stream
@param random object to use (or null for deterministic)
@return transformed image | [
"Takes",
"an",
"image",
"and",
"returns",
"a",
"boxed",
"version",
"of",
"the",
"image",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/BoxImageTransform.java#L84-L117 |
aoindustries/aoweb-framework | src/main/java/com/aoindustries/website/framework/WebSiteRequest.java | WebSiteRequest.getURL | public String getURL(String classname, String params) throws IOException, SQLException {
try {
Class<? extends WebPage> clazz=Class.forName(classname).asSubclass(WebPage.class);
return getURL(clazz, params);
} catch(ClassNotFoundException err) {
throw new IOException("Unable to load class: "+classname, err);
}
} | java | public String getURL(String classname, String params) throws IOException, SQLException {
try {
Class<? extends WebPage> clazz=Class.forName(classname).asSubclass(WebPage.class);
return getURL(clazz, params);
} catch(ClassNotFoundException err) {
throw new IOException("Unable to load class: "+classname, err);
}
} | [
"public",
"String",
"getURL",
"(",
"String",
"classname",
",",
"String",
"params",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"try",
"{",
"Class",
"<",
"?",
"extends",
"WebPage",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"classname",
")... | Gets a relative URL given its classname and optional parameters.
Parameters should already be URL encoded but not XML encoded. | [
"Gets",
"a",
"relative",
"URL",
"given",
"its",
"classname",
"and",
"optional",
"parameters",
".",
"Parameters",
"should",
"already",
"be",
"URL",
"encoded",
"but",
"not",
"XML",
"encoded",
"."
] | train | https://github.com/aoindustries/aoweb-framework/blob/8e58af4f5dd898cd2fdb855ffa810a1ca6973ae0/src/main/java/com/aoindustries/website/framework/WebSiteRequest.java#L368-L375 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeParserBucket.java | DateTimeParserBucket.saveField | public void saveField(DateTimeFieldType fieldType, int value) {
obtainSaveField().init(fieldType.getField(iChrono), value);
} | java | public void saveField(DateTimeFieldType fieldType, int value) {
obtainSaveField().init(fieldType.getField(iChrono), value);
} | [
"public",
"void",
"saveField",
"(",
"DateTimeFieldType",
"fieldType",
",",
"int",
"value",
")",
"{",
"obtainSaveField",
"(",
")",
".",
"init",
"(",
"fieldType",
".",
"getField",
"(",
"iChrono",
")",
",",
"value",
")",
";",
"}"
] | Saves a datetime field value.
@param fieldType the field type
@param value the value | [
"Saves",
"a",
"datetime",
"field",
"value",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeParserBucket.java#L308-L310 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getGuildStashInfo | public void getGuildStashInfo(String id, String api, Callback<List<GuildStash>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api));
gw2API.getGuildStashInfo(id, api).enqueue(callback);
} | java | public void getGuildStashInfo(String id, String api, Callback<List<GuildStash>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api));
gw2API.getGuildStashInfo(id, api).enqueue(callback);
} | [
"public",
"void",
"getGuildStashInfo",
"(",
"String",
"id",
",",
"String",
"api",
",",
"Callback",
"<",
"List",
"<",
"GuildStash",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChe... | For more info on guild stash API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/:id/stash">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions<br/>
@param id guild id
@param api Guild leader's Guild Wars 2 API key
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see GuildStash guild stash info | [
"For",
"more",
"info",
"on",
"guild",
"stash",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"guild",
"/",
":",
"id",
"/",
"stash",
">",
"here<",
"/",
"a",
">"... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1535-L1538 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/ConversionSchemas.java | ConversionSchemas.v1Builder | public static Builder v1Builder(String name) {
return new Builder(name, V1MarshallerSet.marshallers(), V1MarshallerSet.setMarshallers(),
StandardUnmarshallerSet.unmarshallers(),
StandardUnmarshallerSet.setUnmarshallers());
} | java | public static Builder v1Builder(String name) {
return new Builder(name, V1MarshallerSet.marshallers(), V1MarshallerSet.setMarshallers(),
StandardUnmarshallerSet.unmarshallers(),
StandardUnmarshallerSet.setUnmarshallers());
} | [
"public",
"static",
"Builder",
"v1Builder",
"(",
"String",
"name",
")",
"{",
"return",
"new",
"Builder",
"(",
"name",
",",
"V1MarshallerSet",
".",
"marshallers",
"(",
")",
",",
"V1MarshallerSet",
".",
"setMarshallers",
"(",
")",
",",
"StandardUnmarshallerSet",
... | A ConversionSchema builder that defaults to building {@link #V1}. | [
"A",
"ConversionSchema",
"builder",
"that",
"defaults",
"to",
"building",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/ConversionSchemas.java#L156-L160 |
pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java | CSTransformer.transformInfoTopic | protected static InfoTopic transformInfoTopic(final CSNodeWrapper parentNode, final CSInfoNodeWrapper node) {
final InfoTopic infoTopic = new InfoTopic(node.getTopicId(), null);
// Basic data
infoTopic.setRevision(node.getTopicRevision());
infoTopic.setConditionStatement(node.getCondition());
infoTopic.setUniqueId(parentNode.getId() == null ? null : parentNode.getId().toString());
return infoTopic;
} | java | protected static InfoTopic transformInfoTopic(final CSNodeWrapper parentNode, final CSInfoNodeWrapper node) {
final InfoTopic infoTopic = new InfoTopic(node.getTopicId(), null);
// Basic data
infoTopic.setRevision(node.getTopicRevision());
infoTopic.setConditionStatement(node.getCondition());
infoTopic.setUniqueId(parentNode.getId() == null ? null : parentNode.getId().toString());
return infoTopic;
} | [
"protected",
"static",
"InfoTopic",
"transformInfoTopic",
"(",
"final",
"CSNodeWrapper",
"parentNode",
",",
"final",
"CSInfoNodeWrapper",
"node",
")",
"{",
"final",
"InfoTopic",
"infoTopic",
"=",
"new",
"InfoTopic",
"(",
"node",
".",
"getTopicId",
"(",
")",
",",
... | Transform a Topic CSNode entity object into an InfoTopic Object that can be added to a Content Specification.
@param node The CSNode entity object to be transformed.
@return The transformed InfoTopic entity. | [
"Transform",
"a",
"Topic",
"CSNode",
"entity",
"object",
"into",
"an",
"InfoTopic",
"Object",
"that",
"can",
"be",
"added",
"to",
"a",
"Content",
"Specification",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L518-L527 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java | CudaDataBufferFactory.createHalf | @Override
public DataBuffer createHalf(long offset, double[] data, boolean copy) {
return new CudaHalfDataBuffer(data, copy, offset);
} | java | @Override
public DataBuffer createHalf(long offset, double[] data, boolean copy) {
return new CudaHalfDataBuffer(data, copy, offset);
} | [
"@",
"Override",
"public",
"DataBuffer",
"createHalf",
"(",
"long",
"offset",
",",
"double",
"[",
"]",
"data",
",",
"boolean",
"copy",
")",
"{",
"return",
"new",
"CudaHalfDataBuffer",
"(",
"data",
",",
"copy",
",",
"offset",
")",
";",
"}"
] | Creates a half-precision data buffer
@param offset
@param data the data to create the buffer from
@param copy
@return the new buffer | [
"Creates",
"a",
"half",
"-",
"precision",
"data",
"buffer"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java#L637-L640 |
netplex/json-smart-v2 | json-smart/src/main/java/net/minidev/json/parser/JSONParser.java | JSONParser.parse | public <T> T parse(byte[] in, Class<T> mapTo) throws ParseException {
return getPBytes().parse(in, JSONValue.defaultReader.getMapper(mapTo));
} | java | public <T> T parse(byte[] in, Class<T> mapTo) throws ParseException {
return getPBytes().parse(in, JSONValue.defaultReader.getMapper(mapTo));
} | [
"public",
"<",
"T",
">",
"T",
"parse",
"(",
"byte",
"[",
"]",
"in",
",",
"Class",
"<",
"T",
">",
"mapTo",
")",
"throws",
"ParseException",
"{",
"return",
"getPBytes",
"(",
")",
".",
"parse",
"(",
"in",
",",
"JSONValue",
".",
"defaultReader",
".",
"... | use to return Primitive Type, or String, Or JsonObject or JsonArray
generated by a ContainerFactory | [
"use",
"to",
"return",
"Primitive",
"Type",
"or",
"String",
"Or",
"JsonObject",
"or",
"JsonArray",
"generated",
"by",
"a",
"ContainerFactory"
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParser.java#L205-L207 |
arakelian/more-commons | src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java | XmlStreamReaderUtils.optionalByteAttribute | public static byte optionalByteAttribute(
final XMLStreamReader reader,
final String localName,
final byte defaultValue) {
return optionalByteAttribute(reader, null, localName, defaultValue);
} | java | public static byte optionalByteAttribute(
final XMLStreamReader reader,
final String localName,
final byte defaultValue) {
return optionalByteAttribute(reader, null, localName, defaultValue);
} | [
"public",
"static",
"byte",
"optionalByteAttribute",
"(",
"final",
"XMLStreamReader",
"reader",
",",
"final",
"String",
"localName",
",",
"final",
"byte",
"defaultValue",
")",
"{",
"return",
"optionalByteAttribute",
"(",
"reader",
",",
"null",
",",
"localName",
",... | Returns the value of an attribute as a byte. If the attribute is empty, this method returns
the default value provided.
@param reader
<code>XMLStreamReader</code> that contains attribute values.
@param localName
local name of attribute (the namespace is ignored).
@param defaultValue
default value
@return value of attribute, or the default value if the attribute is empty. | [
"Returns",
"the",
"value",
"of",
"an",
"attribute",
"as",
"a",
"byte",
".",
"If",
"the",
"attribute",
"is",
"empty",
"this",
"method",
"returns",
"the",
"default",
"value",
"provided",
"."
] | train | https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L606-L611 |
Scalified/viewmover | viewmover/src/main/java/com/scalified/viewmover/movers/ViewMover.java | ViewMover.createAnimation | private Animation createAnimation(MovingParams params) {
Animation animation = new TranslateAnimation(0, params.getXAxisDelta(), 0, params.getYAxisDelta());
animation.setFillEnabled(true);
animation.setFillBefore(false);
animation.setDuration(params.getAnimationDuration());
Interpolator interpolator = params.getAnimationInterpolator();
if (interpolator != null) {
animation.setInterpolator(interpolator);
}
animation.setAnimationListener(new MoveAnimationListener(params));
return animation;
} | java | private Animation createAnimation(MovingParams params) {
Animation animation = new TranslateAnimation(0, params.getXAxisDelta(), 0, params.getYAxisDelta());
animation.setFillEnabled(true);
animation.setFillBefore(false);
animation.setDuration(params.getAnimationDuration());
Interpolator interpolator = params.getAnimationInterpolator();
if (interpolator != null) {
animation.setInterpolator(interpolator);
}
animation.setAnimationListener(new MoveAnimationListener(params));
return animation;
} | [
"private",
"Animation",
"createAnimation",
"(",
"MovingParams",
"params",
")",
"{",
"Animation",
"animation",
"=",
"new",
"TranslateAnimation",
"(",
"0",
",",
"params",
".",
"getXAxisDelta",
"(",
")",
",",
"0",
",",
"params",
".",
"getYAxisDelta",
"(",
")",
... | Creates the moving animation
<p>
Configures the moving animation based on moving params
@param params params, which is used to configure the moving animation
@return moving animation | [
"Creates",
"the",
"moving",
"animation",
"<p",
">",
"Configures",
"the",
"moving",
"animation",
"based",
"on",
"moving",
"params"
] | train | https://github.com/Scalified/viewmover/blob/e2b35f7d8517a5533afe8b68a4c1ee352d9aec34/viewmover/src/main/java/com/scalified/viewmover/movers/ViewMover.java#L265-L276 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java | AbstractBigtableAdmin.deleteRowRangeByPrefix | public void deleteRowRangeByPrefix(TableName tableName, byte[] prefix) throws IOException {
try {
tableAdminClientWrapper.dropRowRange(tableName.getNameAsString(), Bytes.toString(prefix));
} catch (Throwable throwable) {
throw new IOException(
String.format("Failed to truncate table '%s'", tableName.getNameAsString()), throwable);
}
} | java | public void deleteRowRangeByPrefix(TableName tableName, byte[] prefix) throws IOException {
try {
tableAdminClientWrapper.dropRowRange(tableName.getNameAsString(), Bytes.toString(prefix));
} catch (Throwable throwable) {
throw new IOException(
String.format("Failed to truncate table '%s'", tableName.getNameAsString()), throwable);
}
} | [
"public",
"void",
"deleteRowRangeByPrefix",
"(",
"TableName",
"tableName",
",",
"byte",
"[",
"]",
"prefix",
")",
"throws",
"IOException",
"{",
"try",
"{",
"tableAdminClientWrapper",
".",
"dropRowRange",
"(",
"tableName",
".",
"getNameAsString",
"(",
")",
",",
"B... | <p>deleteRowRangeByPrefix.</p>
@param tableName a {@link org.apache.hadoop.hbase.TableName} object.
@param prefix an array of byte.
@throws java.io.IOException if any. | [
"<p",
">",
"deleteRowRangeByPrefix",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java#L765-L772 |
cdapio/tigon | tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java | DatumWriterGenerator.doCast | private void doCast(GeneratorAdapter mg, TypeToken<?> outputType, Schema schema) {
TypeToken<?> callTypeToken = getCallTypeToken(outputType, schema);
if (!Object.class.equals(callTypeToken.getRawType()) && !outputType.getRawType().isPrimitive()) {
mg.checkCast(Type.getType(callTypeToken.getRawType()));
}
} | java | private void doCast(GeneratorAdapter mg, TypeToken<?> outputType, Schema schema) {
TypeToken<?> callTypeToken = getCallTypeToken(outputType, schema);
if (!Object.class.equals(callTypeToken.getRawType()) && !outputType.getRawType().isPrimitive()) {
mg.checkCast(Type.getType(callTypeToken.getRawType()));
}
} | [
"private",
"void",
"doCast",
"(",
"GeneratorAdapter",
"mg",
",",
"TypeToken",
"<",
"?",
">",
"outputType",
",",
"Schema",
"schema",
")",
"{",
"TypeToken",
"<",
"?",
">",
"callTypeToken",
"=",
"getCallTypeToken",
"(",
"outputType",
",",
"schema",
")",
";",
... | Optionally generates a type cast instruction based on the result of
{@link #getCallTypeToken(com.google.common.reflect.TypeToken, Schema)}.
@param mg A {@link org.objectweb.asm.commons.GeneratorAdapter} for generating instructions
@param outputType
@param schema | [
"Optionally",
"generates",
"a",
"type",
"cast",
"instruction",
"based",
"on",
"the",
"result",
"of",
"{"
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/internal/io/DatumWriterGenerator.java#L923-L928 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/os/CommandLine.java | CommandLine.setEnvironmentVariables | public void setEnvironmentVariables(Map<String, String> environment) {
for (Map.Entry<String, String> entry : environment.entrySet()) {
setEnvironmentVariable(entry.getKey(), entry.getValue());
}
} | java | public void setEnvironmentVariables(Map<String, String> environment) {
for (Map.Entry<String, String> entry : environment.entrySet()) {
setEnvironmentVariable(entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"setEnvironmentVariables",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"environment",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"environment",
".",
"entrySet",
"(",
")",
")",
"{",
"... | Adds the specified environment variables.
@param environment the variables to add
@throws IllegalArgumentException if any value given is null (unsupported) | [
"Adds",
"the",
"specified",
"environment",
"variables",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/os/CommandLine.java#L61-L65 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java | ReadSecondaryHandler.addFieldPair | public MoveOnValidHandler addFieldPair(BaseField fldDest, BaseField fldSource, boolean bMoveToDependent, boolean bMoveBackOnChange, Converter convCheckMark, Converter convBackconvCheckMark)
{ // BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es
MoveOnValidHandler moveBehavior = null;
if (convCheckMark != null) if (convCheckMark.getField() != null)
{
CheckMoveHandler listener = new CheckMoveHandler(fldDest, fldSource);
((BaseField)convCheckMark.getField()).addListener(listener); // Whenever changed, this.FieldChanged is called
}
if (bMoveToDependent)
{
m_bMoveBehavior = true;
moveBehavior = new MoveOnValidHandler(fldDest, fldSource, convCheckMark, true, true);
m_record.addListener(moveBehavior);
}
if (bMoveBackOnChange)
{
CopyFieldHandler listener = new CopyFieldHandler(fldSource, convBackconvCheckMark);
fldDest.addListener(listener); // Add this listener to the field
}
return moveBehavior;
} | java | public MoveOnValidHandler addFieldPair(BaseField fldDest, BaseField fldSource, boolean bMoveToDependent, boolean bMoveBackOnChange, Converter convCheckMark, Converter convBackconvCheckMark)
{ // BaseField will return iSourceFieldSeq if m_OwnerField is 'Y'es
MoveOnValidHandler moveBehavior = null;
if (convCheckMark != null) if (convCheckMark.getField() != null)
{
CheckMoveHandler listener = new CheckMoveHandler(fldDest, fldSource);
((BaseField)convCheckMark.getField()).addListener(listener); // Whenever changed, this.FieldChanged is called
}
if (bMoveToDependent)
{
m_bMoveBehavior = true;
moveBehavior = new MoveOnValidHandler(fldDest, fldSource, convCheckMark, true, true);
m_record.addListener(moveBehavior);
}
if (bMoveBackOnChange)
{
CopyFieldHandler listener = new CopyFieldHandler(fldSource, convBackconvCheckMark);
fldDest.addListener(listener); // Add this listener to the field
}
return moveBehavior;
} | [
"public",
"MoveOnValidHandler",
"addFieldPair",
"(",
"BaseField",
"fldDest",
",",
"BaseField",
"fldSource",
",",
"boolean",
"bMoveToDependent",
",",
"boolean",
"bMoveBackOnChange",
",",
"Converter",
"convCheckMark",
",",
"Converter",
"convBackconvCheckMark",
")",
"{",
"... | Add a field source and dest.
@param fldDest The destination field.
@param fldSource The source field.
@param bMoveToDependent If true adds a MoveOnValidHandler to the secondary record.
@param bMoveBackOnChange If true, adds a CopyFieldHandler to the destination field (moves to the source).
@param convCheckMark Check mark to check before moving.
@param convBackconvCheckMark Check mark to check before moving back. | [
"Add",
"a",
"field",
"source",
"and",
"dest",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReadSecondaryHandler.java#L211-L231 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.getTrailCCFromCompYesAndZeroCC | int getTrailCCFromCompYesAndZeroCC(CharSequence s, int cpStart, int cpLimit) {
int c;
if(cpStart==(cpLimit-1)) {
c=s.charAt(cpStart);
} else {
c=Character.codePointAt(s, cpStart);
}
int prevNorm16=getNorm16(c);
if(prevNorm16<=minYesNo) {
return 0; // yesYes and Hangul LV/LVT have ccc=tccc=0
} else {
return extraData.charAt(prevNorm16)>>8; // tccc from yesNo
}
} | java | int getTrailCCFromCompYesAndZeroCC(CharSequence s, int cpStart, int cpLimit) {
int c;
if(cpStart==(cpLimit-1)) {
c=s.charAt(cpStart);
} else {
c=Character.codePointAt(s, cpStart);
}
int prevNorm16=getNorm16(c);
if(prevNorm16<=minYesNo) {
return 0; // yesYes and Hangul LV/LVT have ccc=tccc=0
} else {
return extraData.charAt(prevNorm16)>>8; // tccc from yesNo
}
} | [
"int",
"getTrailCCFromCompYesAndZeroCC",
"(",
"CharSequence",
"s",
",",
"int",
"cpStart",
",",
"int",
"cpLimit",
")",
"{",
"int",
"c",
";",
"if",
"(",
"cpStart",
"==",
"(",
"cpLimit",
"-",
"1",
")",
")",
"{",
"c",
"=",
"s",
".",
"charAt",
"(",
"cpSta... | requires that the [cpStart..cpLimit[ character passes isCompYesAndZeroCC() | [
"requires",
"that",
"the",
"[",
"cpStart",
"..",
"cpLimit",
"[",
"character",
"passes",
"isCompYesAndZeroCC",
"()"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L1701-L1714 |
DJCordhose/jmte | src/com/floreysoft/jmte/Engine.java | Engine.variablesAvailable | public boolean variablesAvailable(Map<String, Object> model, String... vars) {
final TemplateContext context = new TemplateContext(null, null, null, new ScopedMap(model), modelAdaptor, this,
new SilentErrorHandler(), null);
for (String var : vars) {
final IfToken token = new IfToken(var, false);
if (!(Boolean) token.evaluate(context)) {
return false;
}
}
return true;
} | java | public boolean variablesAvailable(Map<String, Object> model, String... vars) {
final TemplateContext context = new TemplateContext(null, null, null, new ScopedMap(model), modelAdaptor, this,
new SilentErrorHandler(), null);
for (String var : vars) {
final IfToken token = new IfToken(var, false);
if (!(Boolean) token.evaluate(context)) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"variablesAvailable",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
",",
"String",
"...",
"vars",
")",
"{",
"final",
"TemplateContext",
"context",
"=",
"new",
"TemplateContext",
"(",
"null",
",",
"null",
",",
"null",
",",
"ne... | Checks if all given variables are there and if so, that they evaluate to true inside an if. | [
"Checks",
"if",
"all",
"given",
"variables",
"are",
"there",
"and",
"if",
"so",
"that",
"they",
"evaluate",
"to",
"true",
"inside",
"an",
"if",
"."
] | train | https://github.com/DJCordhose/jmte/blob/7334e6d111cc2198c5cf69ee336584ab9e192fe5/src/com/floreysoft/jmte/Engine.java#L120-L130 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java | LoggingInterceptorSupport.logSoapMessage | protected void logSoapMessage(String logMessage, SoapMessage soapMessage, boolean incoming) throws TransformerException {
Transformer transformer = createIndentingTransformer();
StringWriter writer = new StringWriter();
transformer.transform(soapMessage.getEnvelope().getSource(), new StreamResult(writer));
logMessage(logMessage, XMLUtils.prettyPrint(writer.toString()), incoming);
} | java | protected void logSoapMessage(String logMessage, SoapMessage soapMessage, boolean incoming) throws TransformerException {
Transformer transformer = createIndentingTransformer();
StringWriter writer = new StringWriter();
transformer.transform(soapMessage.getEnvelope().getSource(), new StreamResult(writer));
logMessage(logMessage, XMLUtils.prettyPrint(writer.toString()), incoming);
} | [
"protected",
"void",
"logSoapMessage",
"(",
"String",
"logMessage",
",",
"SoapMessage",
"soapMessage",
",",
"boolean",
"incoming",
")",
"throws",
"TransformerException",
"{",
"Transformer",
"transformer",
"=",
"createIndentingTransformer",
"(",
")",
";",
"StringWriter",... | Log SOAP message with transformer instance.
@param logMessage the customized log message.
@param soapMessage the message content as SOAP envelope source.
@param incoming
@throws TransformerException | [
"Log",
"SOAP",
"message",
"with",
"transformer",
"instance",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L97-L103 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.getEnvironmentAsync | public Observable<GetEnvironmentResponseInner> getEnvironmentAsync(String userName, String environmentId) {
return getEnvironmentWithServiceResponseAsync(userName, environmentId).map(new Func1<ServiceResponse<GetEnvironmentResponseInner>, GetEnvironmentResponseInner>() {
@Override
public GetEnvironmentResponseInner call(ServiceResponse<GetEnvironmentResponseInner> response) {
return response.body();
}
});
} | java | public Observable<GetEnvironmentResponseInner> getEnvironmentAsync(String userName, String environmentId) {
return getEnvironmentWithServiceResponseAsync(userName, environmentId).map(new Func1<ServiceResponse<GetEnvironmentResponseInner>, GetEnvironmentResponseInner>() {
@Override
public GetEnvironmentResponseInner call(ServiceResponse<GetEnvironmentResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"GetEnvironmentResponseInner",
">",
"getEnvironmentAsync",
"(",
"String",
"userName",
",",
"String",
"environmentId",
")",
"{",
"return",
"getEnvironmentWithServiceResponseAsync",
"(",
"userName",
",",
"environmentId",
")",
".",
"map",
"(",
... | Gets the virtual machine details.
@param userName The name of the user.
@param environmentId The resourceId of the environment
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the GetEnvironmentResponseInner object | [
"Gets",
"the",
"virtual",
"machine",
"details",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L153-L160 |
jtrfp/javamod | src/main/java/de/quippy/javamod/mixer/dsp/iir/filter/IIRFilter.java | IIRFilter.doFilter | public int doFilter(final float[] ringBuffer, final int start, final int length, final int useBands)
{
final float internalPreAmp = 1f/useBands;
final float rest = 1.0f - internalPreAmp;
final int end = start + length;
int index = start;
while (index < end)
{
for (int c=0; c<channels; c++)
{
final int sampleIndex = (index++) % sampleBufferSize;
float sample = 0;
// Run the difference equation
final float preAmpedSample = ringBuffer[sampleIndex] * preAmp * internalPreAmp;
for (int f=0; f<useBands; f++)
{
IIRFilterBase filter = filters[f];
sample += filter.performFilterCalculation(preAmpedSample, c, iIndex, jIndex, kIndex) * filter.amplitudeAdj;
}
sample += (ringBuffer[sampleIndex] * rest);
ringBuffer[sampleIndex] = (sample>1.0f)?1.0f:((sample<-1.0f)?-1.0f:sample);
}
// Do indices maintenance
iIndex = (iIndex + 1) % IIRFilterBase.HISTORYSIZE;
jIndex = (jIndex + 1) % IIRFilterBase.HISTORYSIZE;
kIndex = (kIndex + 1) % IIRFilterBase.HISTORYSIZE;
}
return length;
} | java | public int doFilter(final float[] ringBuffer, final int start, final int length, final int useBands)
{
final float internalPreAmp = 1f/useBands;
final float rest = 1.0f - internalPreAmp;
final int end = start + length;
int index = start;
while (index < end)
{
for (int c=0; c<channels; c++)
{
final int sampleIndex = (index++) % sampleBufferSize;
float sample = 0;
// Run the difference equation
final float preAmpedSample = ringBuffer[sampleIndex] * preAmp * internalPreAmp;
for (int f=0; f<useBands; f++)
{
IIRFilterBase filter = filters[f];
sample += filter.performFilterCalculation(preAmpedSample, c, iIndex, jIndex, kIndex) * filter.amplitudeAdj;
}
sample += (ringBuffer[sampleIndex] * rest);
ringBuffer[sampleIndex] = (sample>1.0f)?1.0f:((sample<-1.0f)?-1.0f:sample);
}
// Do indices maintenance
iIndex = (iIndex + 1) % IIRFilterBase.HISTORYSIZE;
jIndex = (jIndex + 1) % IIRFilterBase.HISTORYSIZE;
kIndex = (kIndex + 1) % IIRFilterBase.HISTORYSIZE;
}
return length;
} | [
"public",
"int",
"doFilter",
"(",
"final",
"float",
"[",
"]",
"ringBuffer",
",",
"final",
"int",
"start",
",",
"final",
"int",
"length",
",",
"final",
"int",
"useBands",
")",
"{",
"final",
"float",
"internalPreAmp",
"=",
"1f",
"/",
"useBands",
";",
"fina... | This will perform the filter on the samples
@param ringBuffer
@param preAmpedResultBuffer
@param start
@param length
@since 12.01.2012 | [
"This",
"will",
"perform",
"the",
"filter",
"on",
"the",
"samples"
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/mixer/dsp/iir/filter/IIRFilter.java#L110-L139 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/searchindex/CmsDeleteFieldConfigurationDialog.java | CmsDeleteFieldConfigurationDialog.createDialogHtml | @Override
protected String createDialogHtml(String dialog) {
StringBuffer result = new StringBuffer(512);
result.append(createWidgetTableStart());
// show error header once if there were validation errors
result.append(createWidgetErrorHeader());
if (dialog.equals(PAGES[0])) {
// create the widgets for the first dialog page
result.append(dialogBlockStart(key(Messages.GUI_LIST_FIELDCONFIGURATION_ACTION_DELETE_NAME_0)));
result.append(createWidgetTableStart());
result.append(key(
Messages.GUI_LIST_FIELDCONFIGURATION_ACTION_DELETE_CONF_1,
new Object[] {m_fieldconfiguration.getName()}));
result.append(createWidgetTableEnd());
result.append(dialogBlockEnd());
}
result.append(createWidgetTableEnd());
// See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets,
// no dialog buttons (Ok, Cancel) will be visible....
result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2]));
return result.toString();
} | java | @Override
protected String createDialogHtml(String dialog) {
StringBuffer result = new StringBuffer(512);
result.append(createWidgetTableStart());
// show error header once if there were validation errors
result.append(createWidgetErrorHeader());
if (dialog.equals(PAGES[0])) {
// create the widgets for the first dialog page
result.append(dialogBlockStart(key(Messages.GUI_LIST_FIELDCONFIGURATION_ACTION_DELETE_NAME_0)));
result.append(createWidgetTableStart());
result.append(key(
Messages.GUI_LIST_FIELDCONFIGURATION_ACTION_DELETE_CONF_1,
new Object[] {m_fieldconfiguration.getName()}));
result.append(createWidgetTableEnd());
result.append(dialogBlockEnd());
}
result.append(createWidgetTableEnd());
// See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets,
// no dialog buttons (Ok, Cancel) will be visible....
result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2]));
return result.toString();
} | [
"@",
"Override",
"protected",
"String",
"createDialogHtml",
"(",
"String",
"dialog",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"result",
".",
"append",
"(",
"createWidgetTableStart",
"(",
")",
")",
";",
"// show erro... | Creates the dialog HTML for all defined widgets of the named dialog (page).<p>
This overwrites the method from the super class to create a layout variation for the widgets.<p>
@param dialog the dialog (page) to get the HTML for
@return the dialog HTML for all defined widgets of the named dialog (page) | [
"Creates",
"the",
"dialog",
"HTML",
"for",
"all",
"defined",
"widgets",
"of",
"the",
"named",
"dialog",
"(",
"page",
")",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsDeleteFieldConfigurationDialog.java#L110-L136 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.signIn | @SuppressWarnings("unchecked")
public User signIn(String provider, String providerToken, boolean rememberJWT) {
if (!StringUtils.isBlank(provider) && !StringUtils.isBlank(providerToken)) {
Map<String, String> credentials = new HashMap<>();
credentials.put(Config._APPID, accessKey);
credentials.put("provider", provider);
credentials.put("token", providerToken);
Map<String, Object> result = getEntity(invokePost(JWT_PATH, Entity.json(credentials)), Map.class);
if (result != null && result.containsKey("user") && result.containsKey("jwt")) {
Map<?, ?> jwtData = (Map<?, ?>) result.get("jwt");
if (rememberJWT) {
tokenKey = (String) jwtData.get("access_token");
tokenKeyExpires = (Long) jwtData.get("expires");
tokenKeyNextRefresh = (Long) jwtData.get("refresh");
}
User signedInUser = ParaObjectUtils.setAnnotatedFields((Map<String, Object>) result.get("user"));
signedInUser.setPassword((String) jwtData.get("access_token"));
return signedInUser;
} else {
clearAccessToken();
}
}
return null;
} | java | @SuppressWarnings("unchecked")
public User signIn(String provider, String providerToken, boolean rememberJWT) {
if (!StringUtils.isBlank(provider) && !StringUtils.isBlank(providerToken)) {
Map<String, String> credentials = new HashMap<>();
credentials.put(Config._APPID, accessKey);
credentials.put("provider", provider);
credentials.put("token", providerToken);
Map<String, Object> result = getEntity(invokePost(JWT_PATH, Entity.json(credentials)), Map.class);
if (result != null && result.containsKey("user") && result.containsKey("jwt")) {
Map<?, ?> jwtData = (Map<?, ?>) result.get("jwt");
if (rememberJWT) {
tokenKey = (String) jwtData.get("access_token");
tokenKeyExpires = (Long) jwtData.get("expires");
tokenKeyNextRefresh = (Long) jwtData.get("refresh");
}
User signedInUser = ParaObjectUtils.setAnnotatedFields((Map<String, Object>) result.get("user"));
signedInUser.setPassword((String) jwtData.get("access_token"));
return signedInUser;
} else {
clearAccessToken();
}
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"User",
"signIn",
"(",
"String",
"provider",
",",
"String",
"providerToken",
",",
"boolean",
"rememberJWT",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"provider",
")",
"&&",
"!"... | Takes an identity provider access token and fetches the user data from that provider.
A new {@link User} object is created if that user doesn't exist.
Access tokens are returned upon successful authentication using one of the SDKs from
Facebook, Google, Twitter, etc.
<b>Note:</b> Twitter uses OAuth 1 and gives you a token and a token secret.
<b>You must concatenate them like this: <code>{oauth_token}:{oauth_token_secret}</code> and
use that as the provider access token.</b>
@param provider identity provider, e.g. 'facebook', 'google'...
@param providerToken access token from a provider like Facebook, Google, Twitter
@param rememberJWT it true the access token returned by Para will be stored locally and
available through {@link #getAccessToken()}
@return a {@link User} object or null if something failed. The JWT is available
on the returned User object via {@link User#getPassword()}. | [
"Takes",
"an",
"identity",
"provider",
"access",
"token",
"and",
"fetches",
"the",
"user",
"data",
"from",
"that",
"provider",
".",
"A",
"new",
"{"
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1575-L1598 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/TransactionInput.java | TransactionInput.getConnectedOutput | @Nullable
TransactionOutput getConnectedOutput(Map<Sha256Hash, Transaction> transactions) {
Transaction tx = transactions.get(outpoint.getHash());
if (tx == null)
return null;
return tx.getOutputs().get((int) outpoint.getIndex());
} | java | @Nullable
TransactionOutput getConnectedOutput(Map<Sha256Hash, Transaction> transactions) {
Transaction tx = transactions.get(outpoint.getHash());
if (tx == null)
return null;
return tx.getOutputs().get((int) outpoint.getIndex());
} | [
"@",
"Nullable",
"TransactionOutput",
"getConnectedOutput",
"(",
"Map",
"<",
"Sha256Hash",
",",
"Transaction",
">",
"transactions",
")",
"{",
"Transaction",
"tx",
"=",
"transactions",
".",
"get",
"(",
"outpoint",
".",
"getHash",
"(",
")",
")",
";",
"if",
"("... | Locates the referenced output from the given pool of transactions.
@return The TransactionOutput or null if the transactions map doesn't contain the referenced tx. | [
"Locates",
"the",
"referenced",
"output",
"from",
"the",
"given",
"pool",
"of",
"transactions",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/TransactionInput.java#L319-L325 |
SeaCloudsEU/SeaCloudsPlatform | planner/aamwriter/src/main/java/eu/seaclouds/platform/planner/aamwriter/modelaam/NodeTemplate.java | NodeTemplate.addConnectionRequirement | public String addConnectionRequirement(NodeTemplate target, String type, String varName) {
Map<String, Object> requirement = new LinkedHashMap();
String requirementName = "endpoint";
Map requirementMap = new LinkedHashMap<String, Object>();
requirement.put(requirementName, requirementMap);
requirementMap.put("node", target.getName());
requirementMap.put("type", type);
if (!varName.isEmpty()) {
Map<String, String> properties = new LinkedHashMap();
properties.put("prop.name", varName);
requirementMap.put("properties", properties);
}
requirements().add(requirement);
return requirementName;
} | java | public String addConnectionRequirement(NodeTemplate target, String type, String varName) {
Map<String, Object> requirement = new LinkedHashMap();
String requirementName = "endpoint";
Map requirementMap = new LinkedHashMap<String, Object>();
requirement.put(requirementName, requirementMap);
requirementMap.put("node", target.getName());
requirementMap.put("type", type);
if (!varName.isEmpty()) {
Map<String, String> properties = new LinkedHashMap();
properties.put("prop.name", varName);
requirementMap.put("properties", properties);
}
requirements().add(requirement);
return requirementName;
} | [
"public",
"String",
"addConnectionRequirement",
"(",
"NodeTemplate",
"target",
",",
"String",
"type",
",",
"String",
"varName",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"requirement",
"=",
"new",
"LinkedHashMap",
"(",
")",
";",
"String",
"requiremen... | Add an endpoint requirement to a NodeTemplate
@return name given to the requirement | [
"Add",
"an",
"endpoint",
"requirement",
"to",
"a",
"NodeTemplate"
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/planner/aamwriter/src/main/java/eu/seaclouds/platform/planner/aamwriter/modelaam/NodeTemplate.java#L98-L114 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/model/Entry.java | Entry.changeStartTime | public final void changeStartTime(LocalTime time, boolean keepDuration) {
requireNonNull(time);
Interval interval = getInterval();
LocalDateTime newStartDateTime = getStartAsLocalDateTime().with(time);
LocalDateTime endDateTime = getEndAsLocalDateTime();
if (keepDuration) {
endDateTime = newStartDateTime.plus(getDuration());
setInterval(newStartDateTime, endDateTime);
} else {
/*
* We might have a problem if the new start time is AFTER the current end time.
*/
if (newStartDateTime.isAfter(endDateTime.minus(getMinimumDuration()))) {
interval = interval.withEndDateTime(newStartDateTime.plus(getMinimumDuration()));
}
setInterval(interval.withStartTime(time));
}
} | java | public final void changeStartTime(LocalTime time, boolean keepDuration) {
requireNonNull(time);
Interval interval = getInterval();
LocalDateTime newStartDateTime = getStartAsLocalDateTime().with(time);
LocalDateTime endDateTime = getEndAsLocalDateTime();
if (keepDuration) {
endDateTime = newStartDateTime.plus(getDuration());
setInterval(newStartDateTime, endDateTime);
} else {
/*
* We might have a problem if the new start time is AFTER the current end time.
*/
if (newStartDateTime.isAfter(endDateTime.minus(getMinimumDuration()))) {
interval = interval.withEndDateTime(newStartDateTime.plus(getMinimumDuration()));
}
setInterval(interval.withStartTime(time));
}
} | [
"public",
"final",
"void",
"changeStartTime",
"(",
"LocalTime",
"time",
",",
"boolean",
"keepDuration",
")",
"{",
"requireNonNull",
"(",
"time",
")",
";",
"Interval",
"interval",
"=",
"getInterval",
"(",
")",
";",
"LocalDateTime",
"newStartDateTime",
"=",
"getSt... | Changes the start time of the entry interval.
@param time the new start time
@param keepDuration if true then this method will also change the end time in such a way that the total duration
of the entry will not change. If false then this method will ensure that the entry's interval
stays valid, which means that the start time will be before the end time and that the
duration of the entry will be at least the duration defined by the {@link #minimumDurationProperty()}. | [
"Changes",
"the",
"start",
"time",
"of",
"the",
"entry",
"interval",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Entry.java#L441-L462 |
structr/structr | structr-ui/src/main/java/org/structr/web/common/FileHelper.java | FileHelper.writeToFile | public static void writeToFile(final File fileNode, final InputStream data) throws FrameworkException, IOException {
setFileProperties(fileNode);
try (final FileOutputStream out = new FileOutputStream(fileNode.getFileOnDisk())) {
IOUtils.copy(data, out);
}
} | java | public static void writeToFile(final File fileNode, final InputStream data) throws FrameworkException, IOException {
setFileProperties(fileNode);
try (final FileOutputStream out = new FileOutputStream(fileNode.getFileOnDisk())) {
IOUtils.copy(data, out);
}
} | [
"public",
"static",
"void",
"writeToFile",
"(",
"final",
"File",
"fileNode",
",",
"final",
"InputStream",
"data",
")",
"throws",
"FrameworkException",
",",
"IOException",
"{",
"setFileProperties",
"(",
"fileNode",
")",
";",
"try",
"(",
"final",
"FileOutputStream",... | Write binary data from FileInputStream to a file and reference the file on disk at the given file node
@param fileNode
@param data The input stream from which to read the file data (Stream is not closed automatically - has to be handled by caller)
@throws FrameworkException
@throws IOException | [
"Write",
"binary",
"data",
"from",
"FileInputStream",
"to",
"a",
"file",
"and",
"reference",
"the",
"file",
"on",
"disk",
"at",
"the",
"given",
"file",
"node"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L565-L573 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java | SDVariable.storeAndAllocateNewArray | public INDArray storeAndAllocateNewArray() {
Preconditions.checkState(variableType == VariableType.VARIABLE, "Unable to allocate and store array for variable of type %s: only" +
" VARIABLE type variables can be initialized using this method", variableType);
if(!sameDiff.arrayAlreadyExistsForVarName(varName)){
long[] shape = getShape();
INDArray arr = getWeightInitScheme().create(dataType(), shape);
sameDiff.associateArrayWithVariable(arr, this);
if(log.isTraceEnabled()){
log.trace("Generated and stored new array for variable \"{}\": shape {}", getVarName(), Arrays.toString(arr.shape()));
}
return arr;
}
//Variable type SDVariables: shape should never change (i.e., these are params in the net!)
INDArray ret = getArr();
return ret;
} | java | public INDArray storeAndAllocateNewArray() {
Preconditions.checkState(variableType == VariableType.VARIABLE, "Unable to allocate and store array for variable of type %s: only" +
" VARIABLE type variables can be initialized using this method", variableType);
if(!sameDiff.arrayAlreadyExistsForVarName(varName)){
long[] shape = getShape();
INDArray arr = getWeightInitScheme().create(dataType(), shape);
sameDiff.associateArrayWithVariable(arr, this);
if(log.isTraceEnabled()){
log.trace("Generated and stored new array for variable \"{}\": shape {}", getVarName(), Arrays.toString(arr.shape()));
}
return arr;
}
//Variable type SDVariables: shape should never change (i.e., these are params in the net!)
INDArray ret = getArr();
return ret;
} | [
"public",
"INDArray",
"storeAndAllocateNewArray",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"variableType",
"==",
"VariableType",
".",
"VARIABLE",
",",
"\"Unable to allocate and store array for variable of type %s: only\"",
"+",
"\" VARIABLE type variables can be in... | Allocate and return a new array
based on the vertex id and weight initialization.
@return the allocated array | [
"Allocate",
"and",
"return",
"a",
"new",
"array",
"based",
"on",
"the",
"vertex",
"id",
"and",
"weight",
"initialization",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L158-L175 |
ben-manes/caffeine | caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java | LocalAsyncLoadingCache.canBulkLoad | private static boolean canBulkLoad(AsyncCacheLoader<?, ?> loader) {
try {
Class<?> defaultLoaderClass = AsyncCacheLoader.class;
if (loader instanceof CacheLoader<?, ?>) {
defaultLoaderClass = CacheLoader.class;
Method classLoadAll = loader.getClass().getMethod("loadAll", Iterable.class);
Method defaultLoadAll = CacheLoader.class.getMethod("loadAll", Iterable.class);
if (!classLoadAll.equals(defaultLoadAll)) {
return true;
}
}
Method classAsyncLoadAll = loader.getClass().getMethod(
"asyncLoadAll", Iterable.class, Executor.class);
Method defaultAsyncLoadAll = defaultLoaderClass.getMethod(
"asyncLoadAll", Iterable.class, Executor.class);
return !classAsyncLoadAll.equals(defaultAsyncLoadAll);
} catch (NoSuchMethodException | SecurityException e) {
logger.log(Level.WARNING, "Cannot determine if CacheLoader can bulk load", e);
return false;
}
} | java | private static boolean canBulkLoad(AsyncCacheLoader<?, ?> loader) {
try {
Class<?> defaultLoaderClass = AsyncCacheLoader.class;
if (loader instanceof CacheLoader<?, ?>) {
defaultLoaderClass = CacheLoader.class;
Method classLoadAll = loader.getClass().getMethod("loadAll", Iterable.class);
Method defaultLoadAll = CacheLoader.class.getMethod("loadAll", Iterable.class);
if (!classLoadAll.equals(defaultLoadAll)) {
return true;
}
}
Method classAsyncLoadAll = loader.getClass().getMethod(
"asyncLoadAll", Iterable.class, Executor.class);
Method defaultAsyncLoadAll = defaultLoaderClass.getMethod(
"asyncLoadAll", Iterable.class, Executor.class);
return !classAsyncLoadAll.equals(defaultAsyncLoadAll);
} catch (NoSuchMethodException | SecurityException e) {
logger.log(Level.WARNING, "Cannot determine if CacheLoader can bulk load", e);
return false;
}
} | [
"private",
"static",
"boolean",
"canBulkLoad",
"(",
"AsyncCacheLoader",
"<",
"?",
",",
"?",
">",
"loader",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"defaultLoaderClass",
"=",
"AsyncCacheLoader",
".",
"class",
";",
"if",
"(",
"loader",
"instanceof",
"C... | Returns whether the supplied cache loader has bulk load functionality. | [
"Returns",
"whether",
"the",
"supplied",
"cache",
"loader",
"has",
"bulk",
"load",
"functionality",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java#L55-L77 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java | EntityListenersIntrospector.validateExternalCallback | private void validateExternalCallback(Method method, CallbackType callbackType) {
Class<?>[] parameters = method.getParameterTypes();
if (!parameters[0].isAssignableFrom(entityClass)) {
String message = String.format("Method %s in class %s is not valid for entity %s",
method.getName(), method.getDeclaringClass().getName(), entityClass.getName());
throw new EntityManagerException(message);
}
CallbackMetadata callbackMetadata = new CallbackMetadata(EntityListenerType.EXTERNAL,
callbackType, method);
metadata.put(callbackType, callbackMetadata);
} | java | private void validateExternalCallback(Method method, CallbackType callbackType) {
Class<?>[] parameters = method.getParameterTypes();
if (!parameters[0].isAssignableFrom(entityClass)) {
String message = String.format("Method %s in class %s is not valid for entity %s",
method.getName(), method.getDeclaringClass().getName(), entityClass.getName());
throw new EntityManagerException(message);
}
CallbackMetadata callbackMetadata = new CallbackMetadata(EntityListenerType.EXTERNAL,
callbackType, method);
metadata.put(callbackType, callbackMetadata);
} | [
"private",
"void",
"validateExternalCallback",
"(",
"Method",
"method",
",",
"CallbackType",
"callbackType",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameters",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"if",
"(",
"!",
"parameters",
"[",
... | Validates and registers the given callback method.
@param method
the callback method
@param callbackType
the callback type | [
"Validates",
"and",
"registers",
"the",
"given",
"callback",
"method",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/EntityListenersIntrospector.java#L162-L172 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailmxplan/src/main/java/net/minidev/ovh/api/ApiOvhEmailmxplan.java | ApiOvhEmailmxplan.service_account_email_PUT | public void service_account_email_PUT(String service, String email, OvhAccount body) throws IOException {
String qPath = "/email/mxplan/{service}/account/{email}";
StringBuilder sb = path(qPath, service, email);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void service_account_email_PUT(String service, String email, OvhAccount body) throws IOException {
String qPath = "/email/mxplan/{service}/account/{email}";
StringBuilder sb = path(qPath, service, email);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"service_account_email_PUT",
"(",
"String",
"service",
",",
"String",
"email",
",",
"OvhAccount",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/mxplan/{service}/account/{email}\"",
";",
"StringBuilder",
"sb",
"=",
"path... | Alter this object properties
REST: PUT /email/mxplan/{service}/account/{email}
@param body [required] New object properties
@param service [required] The internal name of your mxplan organization
@param email [required] Default email for this mailbox
API beta | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailmxplan/src/main/java/net/minidev/ovh/api/ApiOvhEmailmxplan.java#L174-L178 |
graknlabs/grakn | server/src/server/kb/concept/RelationImpl.java | RelationImpl.assign | @Override
public Relation assign(Role role, Thing player) {
reify().addRolePlayer(role, player);
return this;
} | java | @Override
public Relation assign(Role role, Thing player) {
reify().addRolePlayer(role, player);
return this;
} | [
"@",
"Override",
"public",
"Relation",
"assign",
"(",
"Role",
"role",
",",
"Thing",
"player",
")",
"{",
"reify",
"(",
")",
".",
"addRolePlayer",
"(",
"role",
",",
"player",
")",
";",
"return",
"this",
";",
"}"
] | Expands this Relation to include a new role player which is playing a specific Role.
@param role The role of the new role player.
@param player The new role player.
@return The Relation itself | [
"Expands",
"this",
"Relation",
"to",
"include",
"a",
"new",
"role",
"player",
"which",
"is",
"playing",
"a",
"specific",
"Role",
"."
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/RelationImpl.java#L163-L167 |
nemerosa/ontrack | ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/BranchController.java | BranchController.setTemplateDefinition | @RequestMapping(value = "branches/{branchId}/template/definition", method = RequestMethod.PUT)
public Branch setTemplateDefinition(@PathVariable ID branchId, @RequestBody @Valid TemplateDefinition templateDefinition) {
return branchTemplateService.setTemplateDefinition(branchId, templateDefinition);
} | java | @RequestMapping(value = "branches/{branchId}/template/definition", method = RequestMethod.PUT)
public Branch setTemplateDefinition(@PathVariable ID branchId, @RequestBody @Valid TemplateDefinition templateDefinition) {
return branchTemplateService.setTemplateDefinition(branchId, templateDefinition);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"branches/{branchId}/template/definition\"",
",",
"method",
"=",
"RequestMethod",
".",
"PUT",
")",
"public",
"Branch",
"setTemplateDefinition",
"(",
"@",
"PathVariable",
"ID",
"branchId",
",",
"@",
"RequestBody",
"@",
"Val... | Sets this branch as a template definition, or updates the definition. | [
"Sets",
"this",
"branch",
"as",
"a",
"template",
"definition",
"or",
"updates",
"the",
"definition",
"."
] | train | https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/BranchController.java#L347-L350 |
unbescape/unbescape | src/main/java/org/unbescape/xml/XmlEscape.java | XmlEscape.escapeXml11Minimal | public static void escapeXml11Minimal(final String text, final Writer writer)
throws IOException {
escapeXml(text, writer, XmlEscapeSymbols.XML11_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | java | public static void escapeXml11Minimal(final String text, final Writer writer)
throws IOException {
escapeXml(text, writer, XmlEscapeSymbols.XML11_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | [
"public",
"static",
"void",
"escapeXml11Minimal",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeXml",
"(",
"text",
",",
"writer",
",",
"XmlEscapeSymbols",
".",
"XML11_SYMBOLS",
",",
"XmlEscapeType",
"... | <p>
Perform an XML 1.1 level 1 (only markup-significant chars) <strong>escape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 1</em> means this method will only escape the five markup-significant characters which
are <em>predefined</em> as Character Entity References in XML:
<tt><</tt>, <tt>></tt>, <tt>&</tt>, <tt>"</tt> and <tt>'</tt>.
</p>
<p>
This method calls {@link #escapeXml11(String, Writer, XmlEscapeType, XmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li>
<li><tt>level</tt>:
{@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"an",
"XML",
"1",
".",
"1",
"level",
"1",
"(",
"only",
"markup",
"-",
"significant",
"chars",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L734-L739 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspNavBuilder.java | CmsJspNavBuilder.getNavigationForResource | @Deprecated
public static CmsJspNavElement getNavigationForResource(CmsObject cms, String resource) {
return new CmsJspNavBuilder(cms).getNavigationForResource(resource);
} | java | @Deprecated
public static CmsJspNavElement getNavigationForResource(CmsObject cms, String resource) {
return new CmsJspNavBuilder(cms).getNavigationForResource(resource);
} | [
"@",
"Deprecated",
"public",
"static",
"CmsJspNavElement",
"getNavigationForResource",
"(",
"CmsObject",
"cms",
",",
"String",
"resource",
")",
"{",
"return",
"new",
"CmsJspNavBuilder",
"(",
"cms",
")",
".",
"getNavigationForResource",
"(",
"resource",
")",
";",
"... | Returns a navigation element for the named resource.<p>
@param cms context provider for the current request
@param resource the resource name to get the navigation information for,
must be a full path name, e.g. "/docs/index.html"
@return a navigation element for the given resource
@deprecated use {@link #getNavigationForResource(String)} instead | [
"Returns",
"a",
"navigation",
"element",
"for",
"the",
"named",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspNavBuilder.java#L269-L273 |
ziccardi/jnrpe | jnrpe-plugins/src/main/java/it/jnrpe/plugin/mysql/CheckMysql.java | CheckMysql.gatherMetrics | @Override
public final Collection<Metric> gatherMetrics(final ICommandLine cl) throws MetricGatheringException {
List<Metric> metrics = new ArrayList<Metric>();
Mysql mysql = new Mysql(cl);
long start = System.currentTimeMillis();
long elapsed = 0L;
Connection conn = null;
try {
conn = mysql.getConnection();
elapsed = (System.currentTimeMillis() - start) / 1000L;
} catch (ClassNotFoundException e) {
LOG.error(getContext(), "Mysql driver library not found into the classpath: " + "download and put it in the same directory " + "of this plugin");
throw new MetricGatheringException("Error accessing the MySQL server " + "- JDBC driver not installed", Status.CRITICAL, e);
} catch (Exception e) {
LOG.error(getContext(), "Error accessing the MySQL server", e);
throw new MetricGatheringException("Error accessing the MySQL server - " + e.getMessage(), Status.CRITICAL, e);
}
if (cl.hasOption("check-slave")) {
metrics.add(checkSlave(cl, mysql, conn));
} else {
metrics.add(new Metric("time", "Connection took " + elapsed + " secs. ", new BigDecimal(elapsed), new BigDecimal(0), null));
}
mysql.closeConnection(conn);
return metrics;
} | java | @Override
public final Collection<Metric> gatherMetrics(final ICommandLine cl) throws MetricGatheringException {
List<Metric> metrics = new ArrayList<Metric>();
Mysql mysql = new Mysql(cl);
long start = System.currentTimeMillis();
long elapsed = 0L;
Connection conn = null;
try {
conn = mysql.getConnection();
elapsed = (System.currentTimeMillis() - start) / 1000L;
} catch (ClassNotFoundException e) {
LOG.error(getContext(), "Mysql driver library not found into the classpath: " + "download and put it in the same directory " + "of this plugin");
throw new MetricGatheringException("Error accessing the MySQL server " + "- JDBC driver not installed", Status.CRITICAL, e);
} catch (Exception e) {
LOG.error(getContext(), "Error accessing the MySQL server", e);
throw new MetricGatheringException("Error accessing the MySQL server - " + e.getMessage(), Status.CRITICAL, e);
}
if (cl.hasOption("check-slave")) {
metrics.add(checkSlave(cl, mysql, conn));
} else {
metrics.add(new Metric("time", "Connection took " + elapsed + " secs. ", new BigDecimal(elapsed), new BigDecimal(0), null));
}
mysql.closeConnection(conn);
return metrics;
} | [
"@",
"Override",
"public",
"final",
"Collection",
"<",
"Metric",
">",
"gatherMetrics",
"(",
"final",
"ICommandLine",
"cl",
")",
"throws",
"MetricGatheringException",
"{",
"List",
"<",
"Metric",
">",
"metrics",
"=",
"new",
"ArrayList",
"<",
"Metric",
">",
"(",
... | Execute and gather metrics.
@param cl
- The command line parameters
@throws MetricGatheringException
- If any error occurs during metric gathering process
@return the gathered metrics | [
"Execute",
"and",
"gather",
"metrics",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/mysql/CheckMysql.java#L77-L102 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.onlineRegion | public void onlineRegion(String resourceGroupName, String accountName, String region) {
onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().last().body();
} | java | public void onlineRegion(String resourceGroupName, String accountName, String region) {
onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().last().body();
} | [
"public",
"void",
"onlineRegion",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"region",
")",
"{",
"onlineRegionWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"region",
")",
".",
"toBlocking",
"(",
"... | Online the specified region for the specified Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param region Cosmos DB region, with spaces between words and each word capitalized.
@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 | [
"Online",
"the",
"specified",
"region",
"for",
"the",
"specified",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1456-L1458 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java | ImageSet.validate | private void validate(File root, Collection<URI> dirs) throws IOException {
if (dirs == null)
return;
for (URI dir : dirs) {
if (new File(dir.getPath()).getAbsolutePath().equals(
root.getAbsolutePath())) {
// we found the corresponding entry
return;
}
}
throwIOException("Error. Storage directory: " + root
+ " is not in the configured list of storage directories: " + dirs);
} | java | private void validate(File root, Collection<URI> dirs) throws IOException {
if (dirs == null)
return;
for (URI dir : dirs) {
if (new File(dir.getPath()).getAbsolutePath().equals(
root.getAbsolutePath())) {
// we found the corresponding entry
return;
}
}
throwIOException("Error. Storage directory: " + root
+ " is not in the configured list of storage directories: " + dirs);
} | [
"private",
"void",
"validate",
"(",
"File",
"root",
",",
"Collection",
"<",
"URI",
">",
"dirs",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dirs",
"==",
"null",
")",
"return",
";",
"for",
"(",
"URI",
"dir",
":",
"dirs",
")",
"{",
"if",
"(",
"new... | For sanity checking that the given storage directory was configured. | [
"For",
"sanity",
"checking",
"that",
"the",
"given",
"storage",
"directory",
"was",
"configured",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ImageSet.java#L90-L102 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.toSortedMap | public <K, V> SortedMap<K, V> toSortedMap(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends V> valMapper, BinaryOperator<V> mergeFunction) {
return rawCollect(Collectors.toMap(keyMapper, valMapper, mergeFunction, TreeMap::new));
} | java | public <K, V> SortedMap<K, V> toSortedMap(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends V> valMapper, BinaryOperator<V> mergeFunction) {
return rawCollect(Collectors.toMap(keyMapper, valMapper, mergeFunction, TreeMap::new));
} | [
"public",
"<",
"K",
",",
"V",
">",
"SortedMap",
"<",
"K",
",",
"V",
">",
"toSortedMap",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"keyMapper",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"V",
">",
... | Returns a {@link SortedMap} whose keys and values are the result of
applying the provided mapping functions to the input elements.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
<p>
If the mapped keys contains duplicates (according to
{@link Object#equals(Object)}), the value mapping function is applied to
each equal element, and the results are merged using the provided merging
function.
<p>
Returned {@code SortedMap} is guaranteed to be modifiable.
@param <K> the output type of the key mapping function
@param <V> the output type of the value mapping function
@param keyMapper a mapping function to produce keys
@param valMapper a mapping function to produce values
@param mergeFunction a merge function, used to resolve collisions between
values associated with the same key, as supplied to
{@link Map#merge(Object, Object, BiFunction)}
@return a {@code SortedMap} whose keys are the result of applying a key
mapping function to the input elements, and whose values are the
result of applying a value mapping function to all input elements
equal to the key and combining them using the merge function
@see Collectors#toMap(Function, Function, BinaryOperator)
@see #toSortedMap(Function, Function)
@see #toNavigableMap(Function, Function, BinaryOperator)
@since 0.1.0 | [
"Returns",
"a",
"{",
"@link",
"SortedMap",
"}",
"whose",
"keys",
"and",
"values",
"are",
"the",
"result",
"of",
"applying",
"the",
"provided",
"mapping",
"functions",
"to",
"the",
"input",
"elements",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1147-L1150 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/user/UserTable.java | UserTable.missingCheck | protected void missingCheck(Integer index, String column) {
if (index == null) {
throw new GeoPackageException("No " + column
+ " column was found for table '" + tableName + "'");
}
} | java | protected void missingCheck(Integer index, String column) {
if (index == null) {
throw new GeoPackageException("No " + column
+ " column was found for table '" + tableName + "'");
}
} | [
"protected",
"void",
"missingCheck",
"(",
"Integer",
"index",
",",
"String",
"column",
")",
"{",
"if",
"(",
"index",
"==",
"null",
")",
"{",
"throw",
"new",
"GeoPackageException",
"(",
"\"No \"",
"+",
"column",
"+",
"\" column was found for table '\"",
"+",
"t... | Check for missing columns
@param index
column index
@param column
user column | [
"Check",
"for",
"missing",
"columns"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserTable.java#L194-L199 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/WebSocketFactory.java | WebSocketFactory.createSocket | public WebSocket createSocket(URI uri, int timeout) throws IOException
{
if (uri == null)
{
throw new IllegalArgumentException("The given URI is null.");
}
if (timeout < 0)
{
throw new IllegalArgumentException("The given timeout value is negative.");
}
// Split the URI.
String scheme = uri.getScheme();
String userInfo = uri.getUserInfo();
String host = Misc.extractHost(uri);
int port = uri.getPort();
String path = uri.getRawPath();
String query = uri.getRawQuery();
return createSocket(scheme, userInfo, host, port, path, query, timeout);
} | java | public WebSocket createSocket(URI uri, int timeout) throws IOException
{
if (uri == null)
{
throw new IllegalArgumentException("The given URI is null.");
}
if (timeout < 0)
{
throw new IllegalArgumentException("The given timeout value is negative.");
}
// Split the URI.
String scheme = uri.getScheme();
String userInfo = uri.getUserInfo();
String host = Misc.extractHost(uri);
int port = uri.getPort();
String path = uri.getRawPath();
String query = uri.getRawQuery();
return createSocket(scheme, userInfo, host, port, path, query, timeout);
} | [
"public",
"WebSocket",
"createSocket",
"(",
"URI",
"uri",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"if",
"(",
"uri",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The given URI is null.\"",
")",
";",
"}",
"if",
... | Create a WebSocket.
<p>
A socket factory (= a {@link SocketFactory} instance) to create a raw
socket (= a {@link Socket} instance) is determined as described below.
</p>
<ol>
<li>
If the scheme of the URI is either {@code wss} or {@code https},
<ol type="i">
<li>
If an {@link SSLContext} instance has been set by {@link
#setSSLContext(SSLContext)}, the value returned from {@link
SSLContext#getSocketFactory()} method of the instance is used.
<li>
Otherwise, if an {@link SSLSocketFactory} instance has been
set by {@link #setSSLSocketFactory(SSLSocketFactory)}, the
instance is used.
<li>
Otherwise, the value returned from {@link SSLSocketFactory#getDefault()}
is used.
</ol>
<li>
Otherwise (= the scheme of the URI is either {@code ws} or {@code http}),
<ol type="i">
<li>
If a {@link SocketFactory} instance has been set by {@link
#setSocketFactory(SocketFactory)}, the instance is used.
<li>
Otherwise, the value returned from {@link SocketFactory#getDefault()}
is used.
</ol>
</ol>
@param uri
The URI of the WebSocket endpoint on the server side.
The scheme part of the URI must be one of {@code ws},
{@code wss}, {@code http} and {@code https}
(case-insensitive).
@param timeout
The timeout value in milliseconds for socket connection.
@return
A WebSocket.
@throws IllegalArgumentException
The given URI is {@code null} or violates RFC 2396, or
the given timeout value is negative.
@throws IOException
Failed to create a socket.
@since 1.10 | [
"Create",
"a",
"WebSocket",
"."
] | train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/WebSocketFactory.java#L583-L604 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java | SDValidation.validateInteger | protected static void validateInteger(String opName, SDVariable v) {
if (v == null)
return;
if (!v.dataType().isIntType())
throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-integer data type " + v.dataType());
} | java | protected static void validateInteger(String opName, SDVariable v) {
if (v == null)
return;
if (!v.dataType().isIntType())
throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-integer data type " + v.dataType());
} | [
"protected",
"static",
"void",
"validateInteger",
"(",
"String",
"opName",
",",
"SDVariable",
"v",
")",
"{",
"if",
"(",
"v",
"==",
"null",
")",
"return",
";",
"if",
"(",
"!",
"v",
".",
"dataType",
"(",
")",
".",
"isIntType",
"(",
")",
")",
"throw",
... | Validate that the operation is being applied on an integer type SDVariable
@param opName Operation name to print in the exception
@param v Variable to validate datatype for (input to operation) | [
"Validate",
"that",
"the",
"operation",
"is",
"being",
"applied",
"on",
"an",
"integer",
"type",
"SDVariable"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java#L62-L67 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.createPubkeyElement | private PubkeyElement createPubkeyElement(BareJid owner,
OpenPgpV4Fingerprint fingerprint,
Date date)
throws MissingOpenPgpKeyException, IOException, PGPException {
PGPPublicKeyRing ring = provider.getStore().getPublicKeyRing(owner, fingerprint);
if (ring != null) {
byte[] keyBytes = ring.getEncoded(true);
return createPubkeyElement(keyBytes, date);
}
throw new MissingOpenPgpKeyException(owner, fingerprint);
} | java | private PubkeyElement createPubkeyElement(BareJid owner,
OpenPgpV4Fingerprint fingerprint,
Date date)
throws MissingOpenPgpKeyException, IOException, PGPException {
PGPPublicKeyRing ring = provider.getStore().getPublicKeyRing(owner, fingerprint);
if (ring != null) {
byte[] keyBytes = ring.getEncoded(true);
return createPubkeyElement(keyBytes, date);
}
throw new MissingOpenPgpKeyException(owner, fingerprint);
} | [
"private",
"PubkeyElement",
"createPubkeyElement",
"(",
"BareJid",
"owner",
",",
"OpenPgpV4Fingerprint",
"fingerprint",
",",
"Date",
"date",
")",
"throws",
"MissingOpenPgpKeyException",
",",
"IOException",
",",
"PGPException",
"{",
"PGPPublicKeyRing",
"ring",
"=",
"prov... | Create a {@link PubkeyElement} which contains the OpenPGP public key of {@code owner} which belongs to
the {@link OpenPgpV4Fingerprint} {@code fingerprint}.
@param owner owner of the public key
@param fingerprint fingerprint of the key
@param date date of creation of the element
@return {@link PubkeyElement} containing the key
@throws MissingOpenPgpKeyException if the public key notated by the fingerprint cannot be found | [
"Create",
"a",
"{",
"@link",
"PubkeyElement",
"}",
"which",
"contains",
"the",
"OpenPGP",
"public",
"key",
"of",
"{",
"@code",
"owner",
"}",
"which",
"belongs",
"to",
"the",
"{",
"@link",
"OpenPgpV4Fingerprint",
"}",
"{",
"@code",
"fingerprint",
"}",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L618-L628 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/MessagesApi.java | MessagesApi.getMessageSnapshots | public SnapshotResponses getMessageSnapshots(String sdids, Boolean includeTimestamp) throws ApiException {
ApiResponse<SnapshotResponses> resp = getMessageSnapshotsWithHttpInfo(sdids, includeTimestamp);
return resp.getData();
} | java | public SnapshotResponses getMessageSnapshots(String sdids, Boolean includeTimestamp) throws ApiException {
ApiResponse<SnapshotResponses> resp = getMessageSnapshotsWithHttpInfo(sdids, includeTimestamp);
return resp.getData();
} | [
"public",
"SnapshotResponses",
"getMessageSnapshots",
"(",
"String",
"sdids",
",",
"Boolean",
"includeTimestamp",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"SnapshotResponses",
">",
"resp",
"=",
"getMessageSnapshotsWithHttpInfo",
"(",
"sdids",
",",
"includ... | Get Message Snapshots
Get message snapshots.
@param sdids Device IDs for which the snapshots are requested. Max 100 device ids per call. (required)
@param includeTimestamp Indicates whether to return timestamps of the last update for each field. (optional)
@return SnapshotResponses
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"Message",
"Snapshots",
"Get",
"message",
"snapshots",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MessagesApi.java#L706-L709 |
m9aertner/PBKDF2 | src/jboss/java/de/rtner/security/auth/spi/SaltedDatabaseServerLoginModule.java | SaltedDatabaseServerLoginModule.newInstance | @SuppressWarnings("unchecked")
protected <T> T newInstance(final String name, final Class<T> clazz) {
T r = null;
try {
Class<?> loadedClass = getClass().getClassLoader().loadClass(name);
r = (T) loadedClass.newInstance();
} catch(Exception e) {
LoginException le = new LoginException(PicketBoxMessages.MESSAGES.failedToInstantiateClassMessage(clazz));
le.initCause(e);
setValidateError(le);
}
return r;
} | java | @SuppressWarnings("unchecked")
protected <T> T newInstance(final String name, final Class<T> clazz) {
T r = null;
try {
Class<?> loadedClass = getClass().getClassLoader().loadClass(name);
r = (T) loadedClass.newInstance();
} catch(Exception e) {
LoginException le = new LoginException(PicketBoxMessages.MESSAGES.failedToInstantiateClassMessage(clazz));
le.initCause(e);
setValidateError(le);
}
return r;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"T",
">",
"T",
"newInstance",
"(",
"final",
"String",
"name",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"T",
"r",
"=",
"null",
";",
"try",
"{",
"Class",
"<",
"?",
... | Generic helper: Use JBoss SecurityActions to load a class, then create a new instance.
@param <T> generic return type
@param name FQCN of the class to instantiate.
@param clazz Expected type, used for PicketBox logging.
@return Insance. On error/exception, this method registers the
exception via {{@link #setValidateError(Throwable)} and returns
<code>null</code>. | [
"Generic",
"helper",
":",
"Use",
"JBoss",
"SecurityActions",
"to",
"load",
"a",
"class",
"then",
"create",
"a",
"new",
"instance",
"."
] | train | https://github.com/m9aertner/PBKDF2/blob/b84511bb78848106c0f778136d9f01870c957722/src/jboss/java/de/rtner/security/auth/spi/SaltedDatabaseServerLoginModule.java#L253-L265 |
jbundle/jbundle | model/base/src/main/java/org/jbundle/model/util/Util.java | Util.transferStream | public static void transferStream(InputStream in, OutputStream out)
{
try {
byte[] cbuf = new byte[1000];
int iLen = 0;
while ((iLen = in.read(cbuf, 0, cbuf.length)) > 0)
{ // Write the entire file to the output buffer
out.write(cbuf, 0, iLen);
}
in.close();
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
} | java | public static void transferStream(InputStream in, OutputStream out)
{
try {
byte[] cbuf = new byte[1000];
int iLen = 0;
while ((iLen = in.read(cbuf, 0, cbuf.length)) > 0)
{ // Write the entire file to the output buffer
out.write(cbuf, 0, iLen);
}
in.close();
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
} | [
"public",
"static",
"void",
"transferStream",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"cbuf",
"=",
"new",
"byte",
"[",
"1000",
"]",
";",
"int",
"iLen",
"=",
"0",
";",
"while",
"(",
"(",
"iLen",
... | Transfer the data stream from in stream to out stream.
Note: This does not close the out stream.
@param in Stream in
@param out Stream out | [
"Transfer",
"the",
"data",
"stream",
"from",
"in",
"stream",
"to",
"out",
"stream",
".",
"Note",
":",
"This",
"does",
"not",
"close",
"the",
"out",
"stream",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L412-L427 |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getConfigurableMessages | public ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, Locale locale) {
return new ConfigurableMessages(defaultMessages, locale, m_configuredBundle);
} | java | public ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, Locale locale) {
return new ConfigurableMessages(defaultMessages, locale, m_configuredBundle);
} | [
"public",
"ConfigurableMessages",
"getConfigurableMessages",
"(",
"CmsMessages",
"defaultMessages",
",",
"Locale",
"locale",
")",
"{",
"return",
"new",
"ConfigurableMessages",
"(",
"defaultMessages",
",",
"locale",
",",
"m_configuredBundle",
")",
";",
"}"
] | Returns the configured bundle, or the provided default bundle.
@param defaultMessages the default bundle
@param locale the preferred locale
@return the configured bundle or, if not found, the default bundle. | [
"Returns",
"the",
"configured",
"bundle",
"or",
"the",
"provided",
"default",
"bundle",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L642-L646 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java | XmlRepositoryFactory.createBeanOutputHandler | private static OutputHandler createBeanOutputHandler(AbstractXmlInputOutputHandler inputHandler, String className) {
OutputHandler result = null;
Constructor constructor = null;
try {
Class clazz = Class.forName(className);
Class outputClass = inputHandler.getOutputType();
AssertUtils.assertNotNull(outputClass,
"Since output handler was used which handles Beans - Bean.class should be set via constructor of XmlInputOutputHandler");
constructor = clazz.getConstructor(Class.class);
result = (OutputHandler) constructor.newInstance(outputClass);
} catch (Exception ex) {
throw new MjdbcRuntimeException("Cannot initialize bean output handler: " + className +
"\nIf you are trying to use non-standard output handler - please add it to allowed map " +
"\nvia getDefaultOutputHandlers of MjdbcConfig class", ex);
}
return result;
} | java | private static OutputHandler createBeanOutputHandler(AbstractXmlInputOutputHandler inputHandler, String className) {
OutputHandler result = null;
Constructor constructor = null;
try {
Class clazz = Class.forName(className);
Class outputClass = inputHandler.getOutputType();
AssertUtils.assertNotNull(outputClass,
"Since output handler was used which handles Beans - Bean.class should be set via constructor of XmlInputOutputHandler");
constructor = clazz.getConstructor(Class.class);
result = (OutputHandler) constructor.newInstance(outputClass);
} catch (Exception ex) {
throw new MjdbcRuntimeException("Cannot initialize bean output handler: " + className +
"\nIf you are trying to use non-standard output handler - please add it to allowed map " +
"\nvia getDefaultOutputHandlers of MjdbcConfig class", ex);
}
return result;
} | [
"private",
"static",
"OutputHandler",
"createBeanOutputHandler",
"(",
"AbstractXmlInputOutputHandler",
"inputHandler",
",",
"String",
"className",
")",
"{",
"OutputHandler",
"result",
"=",
"null",
";",
"Constructor",
"constructor",
"=",
"null",
";",
"try",
"{",
"Class... | Unlike standard output handlers - beans output handlers require bean type via constructor, hence cannot be prototyped.
This function is invoked to create new instance of Bean output handler
@param inputHandler XML input/output handler for which {@link OutputHandler} is constructed
@param className Bean output handler class name
@return Bean output handler instance | [
"Unlike",
"standard",
"output",
"handlers",
"-",
"beans",
"output",
"handlers",
"require",
"bean",
"type",
"via",
"constructor",
"hence",
"cannot",
"be",
"prototyped",
".",
"This",
"function",
"is",
"invoked",
"to",
"create",
"new",
"instance",
"of",
"Bean",
"... | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/xml/XmlRepositoryFactory.java#L449-L469 |
dickschoeller/gedbrowser | gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/GetStringComparator.java | GetStringComparator.compareChunks | private int compareChunks(final String thisChunk, final String thatChunk) {
final int thisChunkLength = thisChunk.length();
for (int i = 0; i < thisChunkLength; i++) {
final int result = thisChunk.charAt(i) - thatChunk.charAt(i);
if (result != 0) {
return result;
}
}
return 0;
} | java | private int compareChunks(final String thisChunk, final String thatChunk) {
final int thisChunkLength = thisChunk.length();
for (int i = 0; i < thisChunkLength; i++) {
final int result = thisChunk.charAt(i) - thatChunk.charAt(i);
if (result != 0) {
return result;
}
}
return 0;
} | [
"private",
"int",
"compareChunks",
"(",
"final",
"String",
"thisChunk",
",",
"final",
"String",
"thatChunk",
")",
"{",
"final",
"int",
"thisChunkLength",
"=",
"thisChunk",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"... | Compare two chunks based on assumed same length. 0 if the same.
@param thisChunk the first chunk to be compared
@param thatChunk the second chunk to be compared
@return the difference in length (l1 - l2) | [
"Compare",
"two",
"chunks",
"based",
"on",
"assumed",
"same",
"length",
".",
"0",
"if",
"the",
"same",
"."
] | train | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/GetStringComparator.java#L117-L126 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java | XPathUtils.replaceDynamicNamespaces | public static String replaceDynamicNamespaces(String expression, Map<String, String> namespaces) {
String expressionResult = expression;
for (Entry<String, String> namespaceEntry : namespaces.entrySet()) {
if (expressionResult.contains(DYNAMIC_NS_START + namespaceEntry.getValue() + DYNAMIC_NS_END)) {
expressionResult = expressionResult.replaceAll("\\" + DYNAMIC_NS_START + namespaceEntry.getValue().replace(".", "\\.") + "\\" + DYNAMIC_NS_END,
namespaceEntry.getKey() + ":");
}
}
return expressionResult;
} | java | public static String replaceDynamicNamespaces(String expression, Map<String, String> namespaces) {
String expressionResult = expression;
for (Entry<String, String> namespaceEntry : namespaces.entrySet()) {
if (expressionResult.contains(DYNAMIC_NS_START + namespaceEntry.getValue() + DYNAMIC_NS_END)) {
expressionResult = expressionResult.replaceAll("\\" + DYNAMIC_NS_START + namespaceEntry.getValue().replace(".", "\\.") + "\\" + DYNAMIC_NS_END,
namespaceEntry.getKey() + ":");
}
}
return expressionResult;
} | [
"public",
"static",
"String",
"replaceDynamicNamespaces",
"(",
"String",
"expression",
",",
"Map",
"<",
"String",
",",
"String",
">",
"namespaces",
")",
"{",
"String",
"expressionResult",
"=",
"expression",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String... | Replaces all dynamic namespaces in a XPath expression with respective prefixes
in namespace map.
XPath: <code>/{http://sample.org/foo}foo/{http://sample.org/bar}bar</code>
results in <code>/ns1:foo/ns2:bar</code> where the namespace map contains ns1 and ns2.
@param expression
@param namespaces
@return | [
"Replaces",
"all",
"dynamic",
"namespaces",
"in",
"a",
"XPath",
"expression",
"with",
"respective",
"prefixes",
"in",
"namespace",
"map",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java#L93-L104 |
derari/cthul | objects/src/main/java/org/cthul/objects/reflection/Signatures.java | Signatures.newInstance | public static <T> T newInstance(Constructor<T> constructor, Object... args) throws IllegalAccessException, InvocationTargetException, InstantiationException {
if (constructor.isVarArgs()) {
args = fixVarArgs(constructor.getParameterTypes(), args);
}
return constructor.newInstance(args);
} | java | public static <T> T newInstance(Constructor<T> constructor, Object... args) throws IllegalAccessException, InvocationTargetException, InstantiationException {
if (constructor.isVarArgs()) {
args = fixVarArgs(constructor.getParameterTypes(), args);
}
return constructor.newInstance(args);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Constructor",
"<",
"T",
">",
"constructor",
",",
"Object",
"...",
"args",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"InstantiationException",
"{",
"if",
"(",
"cons... | Invokes {@code constructor}, automatically tries to fix varargs arguments.
@param <T>
@param constructor
@param args
@return new instance
@throws IllegalAccessException
@throws InvocationTargetException
@throws InstantiationException | [
"Invokes",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L586-L591 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java | ParserPropertyHelper.isAssociation | public boolean isAssociation(String targetTypeName, List<String> pathWithoutAlias) {
OgmEntityPersister persister = getPersister( targetTypeName );
Type propertyType = persister.getPropertyType( pathWithoutAlias.get( 0 ) );
return propertyType.isAssociationType();
} | java | public boolean isAssociation(String targetTypeName, List<String> pathWithoutAlias) {
OgmEntityPersister persister = getPersister( targetTypeName );
Type propertyType = persister.getPropertyType( pathWithoutAlias.get( 0 ) );
return propertyType.isAssociationType();
} | [
"public",
"boolean",
"isAssociation",
"(",
"String",
"targetTypeName",
",",
"List",
"<",
"String",
">",
"pathWithoutAlias",
")",
"{",
"OgmEntityPersister",
"persister",
"=",
"getPersister",
"(",
"targetTypeName",
")",
";",
"Type",
"propertyType",
"=",
"persister",
... | Check if the path to the property correspond to an association.
@param targetTypeName the name of the entity containing the property
@param pathWithoutAlias the path to the property WITHOUT aliases
@return {@code true} if the property is an association or {@code false} otherwise | [
"Check",
"if",
"the",
"path",
"to",
"the",
"property",
"correspond",
"to",
"an",
"association",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java#L182-L186 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_nasha_new_duration_POST | public OvhOrder dedicated_nasha_new_duration_POST(String duration, OvhNasHAZoneEnum datacenter, OvhNasHAOfferEnum model) throws IOException {
String qPath = "/order/dedicated/nasha/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "datacenter", datacenter);
addBody(o, "model", model);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_nasha_new_duration_POST(String duration, OvhNasHAZoneEnum datacenter, OvhNasHAOfferEnum model) throws IOException {
String qPath = "/order/dedicated/nasha/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "datacenter", datacenter);
addBody(o, "model", model);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_nasha_new_duration_POST",
"(",
"String",
"duration",
",",
"OvhNasHAZoneEnum",
"datacenter",
",",
"OvhNasHAOfferEnum",
"model",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/nasha/new/{duration}\"",
";",
"Stri... | Create order
REST: POST /order/dedicated/nasha/new/{duration}
@param datacenter [required] Nas HA localization
@param model [required] Capacity of Nas HA offer
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2106-L2114 |
apereo/cas | support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/Saml10ObjectBuilder.java | Saml10ObjectBuilder.newConditions | public Conditions newConditions(final ZonedDateTime issuedAt, final String audienceUri, final long issueLength) {
val conditions = newSamlObject(Conditions.class);
conditions.setNotBefore(DateTimeUtils.dateTimeOf(issuedAt));
conditions.setNotOnOrAfter(DateTimeUtils.dateTimeOf(issuedAt.plus(issueLength, ChronoUnit.SECONDS)));
val audienceRestriction = newSamlObject(AudienceRestrictionCondition.class);
val audience = newSamlObject(Audience.class);
audience.setUri(audienceUri);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictionConditions().add(audienceRestriction);
return conditions;
} | java | public Conditions newConditions(final ZonedDateTime issuedAt, final String audienceUri, final long issueLength) {
val conditions = newSamlObject(Conditions.class);
conditions.setNotBefore(DateTimeUtils.dateTimeOf(issuedAt));
conditions.setNotOnOrAfter(DateTimeUtils.dateTimeOf(issuedAt.plus(issueLength, ChronoUnit.SECONDS)));
val audienceRestriction = newSamlObject(AudienceRestrictionCondition.class);
val audience = newSamlObject(Audience.class);
audience.setUri(audienceUri);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictionConditions().add(audienceRestriction);
return conditions;
} | [
"public",
"Conditions",
"newConditions",
"(",
"final",
"ZonedDateTime",
"issuedAt",
",",
"final",
"String",
"audienceUri",
",",
"final",
"long",
"issueLength",
")",
"{",
"val",
"conditions",
"=",
"newSamlObject",
"(",
"Conditions",
".",
"class",
")",
";",
"condi... | New conditions element.
@param issuedAt the issued at
@param audienceUri the service id
@param issueLength the issue length
@return the conditions | [
"New",
"conditions",
"element",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/Saml10ObjectBuilder.java#L126-L136 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java | AttributeDefinition.addCapabilityRequirements | @Deprecated
public void addCapabilityRequirements(OperationContext context, ModelNode attributeValue) {
addCapabilityRequirements(context, null, attributeValue);
} | java | @Deprecated
public void addCapabilityRequirements(OperationContext context, ModelNode attributeValue) {
addCapabilityRequirements(context, null, attributeValue);
} | [
"@",
"Deprecated",
"public",
"void",
"addCapabilityRequirements",
"(",
"OperationContext",
"context",
",",
"ModelNode",
"attributeValue",
")",
"{",
"addCapabilityRequirements",
"(",
"context",
",",
"null",
",",
"attributeValue",
")",
";",
"}"
] | Based on the given attribute value, add capability requirements. If this definition
is for an attribute whose value is or contains a reference to the name of some capability,
this method should record the addition of a requirement for the capability.
<p>
This is a no-op in this base class. Subclasses that support attribute types that can represent
capability references should override this method.
@param context the operation context
@param attributeValue the value of the attribute described by this object
@deprecated use @{link {@link #addCapabilityRequirements(OperationContext, Resource, ModelNode)}} variant | [
"Based",
"on",
"the",
"given",
"attribute",
"value",
"add",
"capability",
"requirements",
".",
"If",
"this",
"definition",
"is",
"for",
"an",
"attribute",
"whose",
"value",
"is",
"or",
"contains",
"a",
"reference",
"to",
"the",
"name",
"of",
"some",
"capabil... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L1044-L1047 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.