repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-druid | extensions-core/hdfs-storage/src/main/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusher.java | HdfsDataSegmentPusher.getStorageDir | @Override
public String getStorageDir(DataSegment segment, boolean useUniquePath)
{
// This is only called by HdfsDataSegmentPusher.push(), which will always set useUniquePath to false since any
// 'uniqueness' will be applied not to the directory but to the filename along with the shard number. This is done
// to avoid performance issues due to excessive HDFS directories. Hence useUniquePath is ignored here and we
// expect it to be false.
Preconditions.checkArgument(
!useUniquePath,
"useUniquePath must be false for HdfsDataSegmentPusher.getStorageDir()"
);
return JOINER.join(
segment.getDataSource(),
StringUtils.format(
"%s_%s",
segment.getInterval().getStart().toString(ISODateTimeFormat.basicDateTime()),
segment.getInterval().getEnd().toString(ISODateTimeFormat.basicDateTime())
),
segment.getVersion().replace(':', '_')
);
} | java | @Override
public String getStorageDir(DataSegment segment, boolean useUniquePath)
{
// This is only called by HdfsDataSegmentPusher.push(), which will always set useUniquePath to false since any
// 'uniqueness' will be applied not to the directory but to the filename along with the shard number. This is done
// to avoid performance issues due to excessive HDFS directories. Hence useUniquePath is ignored here and we
// expect it to be false.
Preconditions.checkArgument(
!useUniquePath,
"useUniquePath must be false for HdfsDataSegmentPusher.getStorageDir()"
);
return JOINER.join(
segment.getDataSource(),
StringUtils.format(
"%s_%s",
segment.getInterval().getStart().toString(ISODateTimeFormat.basicDateTime()),
segment.getInterval().getEnd().toString(ISODateTimeFormat.basicDateTime())
),
segment.getVersion().replace(':', '_')
);
} | [
"@",
"Override",
"public",
"String",
"getStorageDir",
"(",
"DataSegment",
"segment",
",",
"boolean",
"useUniquePath",
")",
"{",
"// This is only called by HdfsDataSegmentPusher.push(), which will always set useUniquePath to false since any",
"// 'uniqueness' will be applied not to the di... | Due to https://issues.apache.org/jira/browse/HDFS-13 ":" are not allowed in
path names. So we format paths differently for HDFS. | [
"Due",
"to",
"https",
":",
"//",
"issues",
".",
"apache",
".",
"org",
"/",
"jira",
"/",
"browse",
"/",
"HDFS",
"-",
"13",
":",
"are",
"not",
"allowed",
"in",
"path",
"names",
".",
"So",
"we",
"format",
"paths",
"differently",
"for",
"HDFS",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/hdfs-storage/src/main/java/org/apache/druid/storage/hdfs/HdfsDataSegmentPusher.java#L187-L208 |
javalite/activejdbc | javalite-common/src/main/java/org/javalite/http/Http.java | Http.map2URLEncoded | public static String map2URLEncoded(Map params){
StringBuilder stringBuilder = new StringBuilder();
try{
Set keySet = params.keySet();
Object[] keys = keySet.toArray();
for (int i = 0; i < keys.length; i++) {
stringBuilder.append(encode(keys[i].toString(), "UTF-8")).append("=").append(encode(params.get(keys[i]).toString(), "UTF-8"));
if(i < (keys.length - 1)){
stringBuilder.append("&");
}
}
}catch(Exception e){
throw new HttpException("failed to generate content from map", e);
}
return stringBuilder.toString();
} | java | public static String map2URLEncoded(Map params){
StringBuilder stringBuilder = new StringBuilder();
try{
Set keySet = params.keySet();
Object[] keys = keySet.toArray();
for (int i = 0; i < keys.length; i++) {
stringBuilder.append(encode(keys[i].toString(), "UTF-8")).append("=").append(encode(params.get(keys[i]).toString(), "UTF-8"));
if(i < (keys.length - 1)){
stringBuilder.append("&");
}
}
}catch(Exception e){
throw new HttpException("failed to generate content from map", e);
}
return stringBuilder.toString();
} | [
"public",
"static",
"String",
"map2URLEncoded",
"(",
"Map",
"params",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"Set",
"keySet",
"=",
"params",
".",
"keySet",
"(",
")",
";",
"Object",
"[",
"]",
"k... | Converts a map to URL- encoded string. This is a convenience method which can be used in combination
with {@link #post(String, byte[])}, {@link #put(String, String)} and others. It makes it easy
to convert parameters to submit a string:
<pre>
key=value&key1=value1;
</pre>
@param params map with keys and values to be posted. This map is used to build
a URL-encoded string, such that keys are names of parameters, and values are values of those
parameters. This method will also URL-encode keys and content using UTF-8 encoding.
<p>
String representations of both keys and values are used.
</p>
@return URL-encided string like: <code>key=value&key1=value1;</code> | [
"Converts",
"a",
"map",
"to",
"URL",
"-",
"encoded",
"string",
".",
"This",
"is",
"a",
"convenience",
"method",
"which",
"can",
"be",
"used",
"in",
"combination",
"with",
"{",
"@link",
"#post",
"(",
"String",
"byte",
"[]",
")",
"}",
"{",
"@link",
"#put... | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Http.java#L303-L318 |
ronmamo/reflections | src/main/java/org/reflections/vfs/Vfs.java | Vfs.fromURL | public static Dir fromURL(final URL url, final UrlType... urlTypes) {
return fromURL(url, Lists.<UrlType>newArrayList(urlTypes));
} | java | public static Dir fromURL(final URL url, final UrlType... urlTypes) {
return fromURL(url, Lists.<UrlType>newArrayList(urlTypes));
} | [
"public",
"static",
"Dir",
"fromURL",
"(",
"final",
"URL",
"url",
",",
"final",
"UrlType",
"...",
"urlTypes",
")",
"{",
"return",
"fromURL",
"(",
"url",
",",
"Lists",
".",
"<",
"UrlType",
">",
"newArrayList",
"(",
"urlTypes",
")",
")",
";",
"}"
] | tries to create a Dir from the given url, using the given urlTypes | [
"tries",
"to",
"create",
"a",
"Dir",
"from",
"the",
"given",
"url",
"using",
"the",
"given",
"urlTypes"
] | train | https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/vfs/Vfs.java#L118-L120 |
innoq/LiQID | ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java | LdapHelper.getUser | @Override
public Node getUser(final String uid) {
try {
String query = "(&(objectClass=" + userObjectClass + ")(" + userIdentifyer + "=" + uid + "))";
SearchResult searchResult;
Attributes attributes;
SearchControls controls = new SearchControls();
controls.setReturningAttributes(new String[]{LdapKeys.ASTERISK, LdapKeys.MODIFY_TIMESTAMP, LdapKeys.MODIFIERS_NAME, LdapKeys.ENTRY_UUID});
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<SearchResult> results = ctx.search("", query, controls);
queryCount++;
if (results.hasMore()) {
searchResult = results.next();
attributes = searchResult.getAttributes();
LdapUser user = new LdapUser(uid, this);
user.setDn(searchResult.getNameInNamespace());
user = fillAttributesInUser((LdapUser) user, attributes);
return user;
}
} catch (NamingException ex) {
handleNamingException(instanceName + ":" + uid, ex);
}
return new LdapUser();
} | java | @Override
public Node getUser(final String uid) {
try {
String query = "(&(objectClass=" + userObjectClass + ")(" + userIdentifyer + "=" + uid + "))";
SearchResult searchResult;
Attributes attributes;
SearchControls controls = new SearchControls();
controls.setReturningAttributes(new String[]{LdapKeys.ASTERISK, LdapKeys.MODIFY_TIMESTAMP, LdapKeys.MODIFIERS_NAME, LdapKeys.ENTRY_UUID});
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<SearchResult> results = ctx.search("", query, controls);
queryCount++;
if (results.hasMore()) {
searchResult = results.next();
attributes = searchResult.getAttributes();
LdapUser user = new LdapUser(uid, this);
user.setDn(searchResult.getNameInNamespace());
user = fillAttributesInUser((LdapUser) user, attributes);
return user;
}
} catch (NamingException ex) {
handleNamingException(instanceName + ":" + uid, ex);
}
return new LdapUser();
} | [
"@",
"Override",
"public",
"Node",
"getUser",
"(",
"final",
"String",
"uid",
")",
"{",
"try",
"{",
"String",
"query",
"=",
"\"(&(objectClass=\"",
"+",
"userObjectClass",
"+",
"\")(\"",
"+",
"userIdentifyer",
"+",
"\"=\"",
"+",
"uid",
"+",
"\"))\"",
";",
"S... | Returns an LDAP-User.
@param uid the uid of the User.
@see com.innoq.liqid.model.Node#getName
@return the Node of that User, either filled (if User was found), or empty. | [
"Returns",
"an",
"LDAP",
"-",
"User",
"."
] | train | https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L288-L312 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/Strings.java | Strings.unCamel | public static String unCamel(String str, char seperator, boolean lowercase) {
char[] ca = str.toCharArray();
if (3 > ca.length) { return lowercase ? str.toLowerCase() : str; }
// about five seperator
StringBuilder build = new StringBuilder(ca.length + 5);
build.append(lowercase ? toLowerCase(ca[0]) : ca[0]);
boolean lower1 = isLowerCase(ca[0]);
int i = 1;
while (i < ca.length - 1) {
char cur = ca[i];
char next = ca[i + 1];
boolean upper2 = isUpperCase(cur);
boolean lower3 = isLowerCase(next);
if (lower1 && upper2 && lower3) {
build.append(seperator);
build.append(lowercase ? toLowerCase(cur) : cur);
build.append(next);
i += 2;
} else {
if (lowercase && upper2) {
build.append(toLowerCase(cur));
} else {
build.append(cur);
}
lower1 = !upper2;
i++;
}
}
if (i == ca.length - 1) {
build.append(lowercase ? toLowerCase(ca[i]) : ca[i]);
}
return build.toString();
} | java | public static String unCamel(String str, char seperator, boolean lowercase) {
char[] ca = str.toCharArray();
if (3 > ca.length) { return lowercase ? str.toLowerCase() : str; }
// about five seperator
StringBuilder build = new StringBuilder(ca.length + 5);
build.append(lowercase ? toLowerCase(ca[0]) : ca[0]);
boolean lower1 = isLowerCase(ca[0]);
int i = 1;
while (i < ca.length - 1) {
char cur = ca[i];
char next = ca[i + 1];
boolean upper2 = isUpperCase(cur);
boolean lower3 = isLowerCase(next);
if (lower1 && upper2 && lower3) {
build.append(seperator);
build.append(lowercase ? toLowerCase(cur) : cur);
build.append(next);
i += 2;
} else {
if (lowercase && upper2) {
build.append(toLowerCase(cur));
} else {
build.append(cur);
}
lower1 = !upper2;
i++;
}
}
if (i == ca.length - 1) {
build.append(lowercase ? toLowerCase(ca[i]) : ca[i]);
}
return build.toString();
} | [
"public",
"static",
"String",
"unCamel",
"(",
"String",
"str",
",",
"char",
"seperator",
",",
"boolean",
"lowercase",
")",
"{",
"char",
"[",
"]",
"ca",
"=",
"str",
".",
"toCharArray",
"(",
")",
";",
"if",
"(",
"3",
">",
"ca",
".",
"length",
")",
"{... | 将驼峰表示法转换为下划线小写表示
@param str
a {@link java.lang.String} object.
@param seperator
a char.
@param lowercase
a boolean.
@return a {@link java.lang.String} object. | [
"将驼峰表示法转换为下划线小写表示"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L1142-L1175 |
adamfisk/littleshoot-util | src/main/java/org/littleshoot/util/BeanUtils.java | BeanUtils.mapBean | public static Map<String, String> mapBean(final Object bean,
final String exclude)
{
final Set<String> excludes = new HashSet<String>();
if (!StringUtils.isBlank(exclude))
{
excludes.add(exclude);
}
return mapBean(bean, excludes);
} | java | public static Map<String, String> mapBean(final Object bean,
final String exclude)
{
final Set<String> excludes = new HashSet<String>();
if (!StringUtils.isBlank(exclude))
{
excludes.add(exclude);
}
return mapBean(bean, excludes);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"mapBean",
"(",
"final",
"Object",
"bean",
",",
"final",
"String",
"exclude",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"excludes",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
... | Creates a {@link Map} from all bean data get methods except the one
specified to exclude. Note that "getClass" is always excluded.
@param bean The bean with data to extract.
@param exclude A method name to exclude.
@return The map of bean data. | [
"Creates",
"a",
"{",
"@link",
"Map",
"}",
"from",
"all",
"bean",
"data",
"get",
"methods",
"except",
"the",
"one",
"specified",
"to",
"exclude",
".",
"Note",
"that",
"getClass",
"is",
"always",
"excluded",
"."
] | train | https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/BeanUtils.java#L50-L59 |
rhuss/jolokia | agent/jvm/src/main/java/org/jolokia/jvmagent/client/command/AbstractBaseCommand.java | AbstractBaseCommand.checkAgentUrl | protected String checkAgentUrl(Object pVm, int delayInMs) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
if (delayInMs != 0) {
try {
Thread.sleep(delayInMs);
} catch (InterruptedException e) {
// just continue
}
}
Properties systemProperties = getAgentSystemProperties(pVm);
return systemProperties.getProperty(JvmAgent.JOLOKIA_AGENT_URL);
} | java | protected String checkAgentUrl(Object pVm, int delayInMs) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
if (delayInMs != 0) {
try {
Thread.sleep(delayInMs);
} catch (InterruptedException e) {
// just continue
}
}
Properties systemProperties = getAgentSystemProperties(pVm);
return systemProperties.getProperty(JvmAgent.JOLOKIA_AGENT_URL);
} | [
"protected",
"String",
"checkAgentUrl",
"(",
"Object",
"pVm",
",",
"int",
"delayInMs",
")",
"throws",
"NoSuchMethodException",
",",
"InvocationTargetException",
",",
"IllegalAccessException",
"{",
"if",
"(",
"delayInMs",
"!=",
"0",
")",
"{",
"try",
"{",
"Thread",
... | Check whether an agent is registered by checking the existance of the system property
{@link JvmAgent#JOLOKIA_AGENT_URL}. This can be used to check, whether a Jolokia agent
has been already attached and started. ("start" will set this property, "stop" will remove it).
@param pVm the {@link com.sun.tools.attach.VirtualMachine}, but typeless
@param delayInMs wait that many ms before fetching the properties
* @return the agent URL if it is was set by a previous 'start' command. | [
"Check",
"whether",
"an",
"agent",
"is",
"registered",
"by",
"checking",
"the",
"existance",
"of",
"the",
"system",
"property",
"{",
"@link",
"JvmAgent#JOLOKIA_AGENT_URL",
"}",
".",
"This",
"can",
"be",
"used",
"to",
"check",
"whether",
"a",
"Jolokia",
"agent"... | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/command/AbstractBaseCommand.java#L96-L106 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.metrics_fat/fat/src/com/ibm/ws/microprofile/metrics/fat/utils/MetricsConnection.java | MetricsConnection.connection_administratorRole | public static MetricsConnection connection_administratorRole(LibertyServer server) {
return new MetricsConnection(server, METRICS_ENDPOINT).secure(true)
.header("Authorization",
"Basic " + Base64Coder.base64Encode(ADMINISTRATOR_USERNAME + ":" + ADMINISTRATOR_PASSWORD));
} | java | public static MetricsConnection connection_administratorRole(LibertyServer server) {
return new MetricsConnection(server, METRICS_ENDPOINT).secure(true)
.header("Authorization",
"Basic " + Base64Coder.base64Encode(ADMINISTRATOR_USERNAME + ":" + ADMINISTRATOR_PASSWORD));
} | [
"public",
"static",
"MetricsConnection",
"connection_administratorRole",
"(",
"LibertyServer",
"server",
")",
"{",
"return",
"new",
"MetricsConnection",
"(",
"server",
",",
"METRICS_ENDPOINT",
")",
".",
"secure",
"(",
"true",
")",
".",
"header",
"(",
"\"Authorizatio... | Creates a connection for private (authorized) docs endpoint using HTTPS
and the Administrator role
@param server - server to connect to
@return | [
"Creates",
"a",
"connection",
"for",
"private",
"(",
"authorized",
")",
"docs",
"endpoint",
"using",
"HTTPS",
"and",
"the",
"Administrator",
"role"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.metrics_fat/fat/src/com/ibm/ws/microprofile/metrics/fat/utils/MetricsConnection.java#L201-L205 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java | ICUBinary.readHeader | public static int readHeader(ByteBuffer bytes, int dataFormat, Authenticate authenticate)
throws IOException {
assert bytes != null && bytes.position() == 0;
byte magic1 = bytes.get(2);
byte magic2 = bytes.get(3);
if (magic1 != MAGIC1 || magic2 != MAGIC2) {
throw new IOException(MAGIC_NUMBER_AUTHENTICATION_FAILED_);
}
byte isBigEndian = bytes.get(8);
byte charsetFamily = bytes.get(9);
byte sizeofUChar = bytes.get(10);
if (isBigEndian < 0 || 1 < isBigEndian ||
charsetFamily != CHAR_SET_ || sizeofUChar != CHAR_SIZE_) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_);
}
bytes.order(isBigEndian != 0 ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
int headerSize = bytes.getChar(0);
int sizeofUDataInfo = bytes.getChar(4);
if (sizeofUDataInfo < 20 || headerSize < (sizeofUDataInfo + 4)) {
throw new IOException("Internal Error: Header size error");
}
// TODO: Change Authenticate to take int major, int minor, int milli, int micro
// to avoid array allocation.
byte[] formatVersion = new byte[] {
bytes.get(16), bytes.get(17), bytes.get(18), bytes.get(19)
};
if (bytes.get(12) != (byte)(dataFormat >> 24) ||
bytes.get(13) != (byte)(dataFormat >> 16) ||
bytes.get(14) != (byte)(dataFormat >> 8) ||
bytes.get(15) != (byte)dataFormat ||
(authenticate != null && !authenticate.isDataVersionAcceptable(formatVersion))) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_ +
String.format("; data format %02x%02x%02x%02x, format version %d.%d.%d.%d",
bytes.get(12), bytes.get(13), bytes.get(14), bytes.get(15),
formatVersion[0] & 0xff, formatVersion[1] & 0xff,
formatVersion[2] & 0xff, formatVersion[3] & 0xff));
}
bytes.position(headerSize);
return // dataVersion
(bytes.get(20) << 24) |
((bytes.get(21) & 0xff) << 16) |
((bytes.get(22) & 0xff) << 8) |
(bytes.get(23) & 0xff);
} | java | public static int readHeader(ByteBuffer bytes, int dataFormat, Authenticate authenticate)
throws IOException {
assert bytes != null && bytes.position() == 0;
byte magic1 = bytes.get(2);
byte magic2 = bytes.get(3);
if (magic1 != MAGIC1 || magic2 != MAGIC2) {
throw new IOException(MAGIC_NUMBER_AUTHENTICATION_FAILED_);
}
byte isBigEndian = bytes.get(8);
byte charsetFamily = bytes.get(9);
byte sizeofUChar = bytes.get(10);
if (isBigEndian < 0 || 1 < isBigEndian ||
charsetFamily != CHAR_SET_ || sizeofUChar != CHAR_SIZE_) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_);
}
bytes.order(isBigEndian != 0 ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
int headerSize = bytes.getChar(0);
int sizeofUDataInfo = bytes.getChar(4);
if (sizeofUDataInfo < 20 || headerSize < (sizeofUDataInfo + 4)) {
throw new IOException("Internal Error: Header size error");
}
// TODO: Change Authenticate to take int major, int minor, int milli, int micro
// to avoid array allocation.
byte[] formatVersion = new byte[] {
bytes.get(16), bytes.get(17), bytes.get(18), bytes.get(19)
};
if (bytes.get(12) != (byte)(dataFormat >> 24) ||
bytes.get(13) != (byte)(dataFormat >> 16) ||
bytes.get(14) != (byte)(dataFormat >> 8) ||
bytes.get(15) != (byte)dataFormat ||
(authenticate != null && !authenticate.isDataVersionAcceptable(formatVersion))) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_ +
String.format("; data format %02x%02x%02x%02x, format version %d.%d.%d.%d",
bytes.get(12), bytes.get(13), bytes.get(14), bytes.get(15),
formatVersion[0] & 0xff, formatVersion[1] & 0xff,
formatVersion[2] & 0xff, formatVersion[3] & 0xff));
}
bytes.position(headerSize);
return // dataVersion
(bytes.get(20) << 24) |
((bytes.get(21) & 0xff) << 16) |
((bytes.get(22) & 0xff) << 8) |
(bytes.get(23) & 0xff);
} | [
"public",
"static",
"int",
"readHeader",
"(",
"ByteBuffer",
"bytes",
",",
"int",
"dataFormat",
",",
"Authenticate",
"authenticate",
")",
"throws",
"IOException",
"{",
"assert",
"bytes",
"!=",
"null",
"&&",
"bytes",
".",
"position",
"(",
")",
"==",
"0",
";",
... | Reads an ICU data header, checks the data format, and returns the data version.
<p>Assumes that the ByteBuffer position is 0 on input.
The buffer byte order is set according to the data.
The buffer position is advanced past the header (including UDataInfo and comment).
<p>See C++ ucmndata.h and unicode/udata.h.
@return dataVersion
@throws IOException if this is not a valid ICU data item of the expected dataFormat | [
"Reads",
"an",
"ICU",
"data",
"header",
"checks",
"the",
"data",
"format",
"and",
"returns",
"the",
"data",
"version",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java#L575-L621 |
beanshell/beanshell | src/main/java/bsh/org/objectweb/asm/ByteVector.java | ByteVector.putUTF8 | public ByteVector putUTF8(final String stringValue) {
int charLength = stringValue.length();
if (charLength > 65535) {
throw new IllegalArgumentException();
}
int currentLength = length;
if (currentLength + 2 + charLength > data.length) {
enlarge(2 + charLength);
}
byte[] currentData = data;
// Optimistic algorithm: instead of computing the byte length and then serializing the string
// (which requires two loops), we assume the byte length is equal to char length (which is the
// most frequent case), and we start serializing the string right away. During the
// serialization, if we find that this assumption is wrong, we continue with the general method.
currentData[currentLength++] = (byte) (charLength >>> 8);
currentData[currentLength++] = (byte) charLength;
for (int i = 0; i < charLength; ++i) {
char charValue = stringValue.charAt(i);
if (charValue >= '\u0001' && charValue <= '\u007F') {
currentData[currentLength++] = (byte) charValue;
} else {
length = currentLength;
return encodeUTF8(stringValue, i, 65535);
}
}
length = currentLength;
return this;
} | java | public ByteVector putUTF8(final String stringValue) {
int charLength = stringValue.length();
if (charLength > 65535) {
throw new IllegalArgumentException();
}
int currentLength = length;
if (currentLength + 2 + charLength > data.length) {
enlarge(2 + charLength);
}
byte[] currentData = data;
// Optimistic algorithm: instead of computing the byte length and then serializing the string
// (which requires two loops), we assume the byte length is equal to char length (which is the
// most frequent case), and we start serializing the string right away. During the
// serialization, if we find that this assumption is wrong, we continue with the general method.
currentData[currentLength++] = (byte) (charLength >>> 8);
currentData[currentLength++] = (byte) charLength;
for (int i = 0; i < charLength; ++i) {
char charValue = stringValue.charAt(i);
if (charValue >= '\u0001' && charValue <= '\u007F') {
currentData[currentLength++] = (byte) charValue;
} else {
length = currentLength;
return encodeUTF8(stringValue, i, 65535);
}
}
length = currentLength;
return this;
} | [
"public",
"ByteVector",
"putUTF8",
"(",
"final",
"String",
"stringValue",
")",
"{",
"int",
"charLength",
"=",
"stringValue",
".",
"length",
"(",
")",
";",
"if",
"(",
"charLength",
">",
"65535",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
... | Puts an UTF8 string into this byte vector. The byte vector is automatically enlarged if
necessary.
@param stringValue a String whose UTF8 encoded length must be less than 65536.
@return this byte vector. | [
"Puts",
"an",
"UTF8",
"string",
"into",
"this",
"byte",
"vector",
".",
"The",
"byte",
"vector",
"is",
"automatically",
"enlarged",
"if",
"necessary",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/ByteVector.java#L242-L269 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/ObjectUtils.java | ObjectUtils.deepCopy | public static final Object deepCopy(Object source, final KunderaMetadata kunderaMetadata)
{
Map<Object, Object> copiedObjectMap = new HashMap<Object, Object>();
Object target = deepCopyUsingMetadata(source, copiedObjectMap, kunderaMetadata);
copiedObjectMap.clear();
copiedObjectMap = null;
return target;
} | java | public static final Object deepCopy(Object source, final KunderaMetadata kunderaMetadata)
{
Map<Object, Object> copiedObjectMap = new HashMap<Object, Object>();
Object target = deepCopyUsingMetadata(source, copiedObjectMap, kunderaMetadata);
copiedObjectMap.clear();
copiedObjectMap = null;
return target;
} | [
"public",
"static",
"final",
"Object",
"deepCopy",
"(",
"Object",
"source",
",",
"final",
"KunderaMetadata",
"kunderaMetadata",
")",
"{",
"Map",
"<",
"Object",
",",
"Object",
">",
"copiedObjectMap",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"... | Deep copy.
@param source
the source
@param kunderaMetadata
the kundera metadata
@return the object | [
"Deep",
"copy",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/ObjectUtils.java#L70-L80 |
appium/java-client | src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java | AppiumServiceBuilder.withArgument | public AppiumServiceBuilder withArgument(ServerArgument argument, String value) {
String argName = argument.getArgument().trim().toLowerCase();
if ("--port".equals(argName) || "-p".equals(argName)) {
usingPort(Integer.valueOf(value));
} else if ("--address".equals(argName) || "-a".equals(argName)) {
withIPAddress(value);
} else if ("--log".equals(argName) || "-g".equals(argName)) {
withLogFile(new File(value));
} else {
serverArguments.put(argName, value);
}
return this;
} | java | public AppiumServiceBuilder withArgument(ServerArgument argument, String value) {
String argName = argument.getArgument().trim().toLowerCase();
if ("--port".equals(argName) || "-p".equals(argName)) {
usingPort(Integer.valueOf(value));
} else if ("--address".equals(argName) || "-a".equals(argName)) {
withIPAddress(value);
} else if ("--log".equals(argName) || "-g".equals(argName)) {
withLogFile(new File(value));
} else {
serverArguments.put(argName, value);
}
return this;
} | [
"public",
"AppiumServiceBuilder",
"withArgument",
"(",
"ServerArgument",
"argument",
",",
"String",
"value",
")",
"{",
"String",
"argName",
"=",
"argument",
".",
"getArgument",
"(",
")",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
... | Adds a server argument.
@param argument is an instance which contains the argument name.
@param value A non null string value. (Warn!!!) Boolean arguments have a special moment:
the presence of an arguments means "true". At this case an empty string
should be defined.
@return the self-reference. | [
"Adds",
"a",
"server",
"argument",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java#L265-L277 |
lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.loadInstance | public static Object loadInstance(Class clazz, Object[] args, Object defaultValue) {
if (args == null || args.length == 0) return loadInstance(clazz, defaultValue);
try {
Class[] cArgs = new Class[args.length];
for (int i = 0; i < args.length; i++) {
if (args[i] == null) cArgs[i] = Object.class;
else cArgs[i] = args[i].getClass();
}
Constructor c = clazz.getConstructor(cArgs);
return c.newInstance(args);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return defaultValue;
}
} | java | public static Object loadInstance(Class clazz, Object[] args, Object defaultValue) {
if (args == null || args.length == 0) return loadInstance(clazz, defaultValue);
try {
Class[] cArgs = new Class[args.length];
for (int i = 0; i < args.length; i++) {
if (args[i] == null) cArgs[i] = Object.class;
else cArgs[i] = args[i].getClass();
}
Constructor c = clazz.getConstructor(cArgs);
return c.newInstance(args);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return defaultValue;
}
} | [
"public",
"static",
"Object",
"loadInstance",
"(",
"Class",
"clazz",
",",
"Object",
"[",
"]",
"args",
",",
"Object",
"defaultValue",
")",
"{",
"if",
"(",
"args",
"==",
"null",
"||",
"args",
".",
"length",
"==",
"0",
")",
"return",
"loadInstance",
"(",
... | loads a class from a String classname
@param clazz class to load
@param args
@return matching Class | [
"loads",
"a",
"class",
"from",
"a",
"String",
"classname"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L485-L502 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/dbextractor/MithraObjectGraphExtractor.java | MithraObjectGraphExtractor.addRelationshipFilter | public void addRelationshipFilter(RelatedFinder relatedFinder, Operation filter)
{
Operation existing = this.filters.get(relatedFinder);
this.filters.put(relatedFinder, existing == null ? filter : existing.or(filter));
} | java | public void addRelationshipFilter(RelatedFinder relatedFinder, Operation filter)
{
Operation existing = this.filters.get(relatedFinder);
this.filters.put(relatedFinder, existing == null ? filter : existing.or(filter));
} | [
"public",
"void",
"addRelationshipFilter",
"(",
"RelatedFinder",
"relatedFinder",
",",
"Operation",
"filter",
")",
"{",
"Operation",
"existing",
"=",
"this",
".",
"filters",
".",
"get",
"(",
"relatedFinder",
")",
";",
"this",
".",
"filters",
".",
"put",
"(",
... | Add a filter to be applied to the result of a traversed relationship.
@param relatedFinder - the relationship to apply the filter to
@param filter - the filter to apply | [
"Add",
"a",
"filter",
"to",
"be",
"applied",
"to",
"the",
"result",
"of",
"a",
"traversed",
"relationship",
"."
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/dbextractor/MithraObjectGraphExtractor.java#L117-L121 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_firewall_duration_POST | public OvhOrder dedicated_server_serviceName_firewall_duration_POST(String serviceName, String duration, OvhFirewallModelEnum firewallModel) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/firewall/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "firewallModel", firewallModel);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_firewall_duration_POST(String serviceName, String duration, OvhFirewallModelEnum firewallModel) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/firewall/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "firewallModel", firewallModel);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_firewall_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhFirewallModelEnum",
"firewallModel",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName... | Create order
REST: POST /order/dedicated/server/{serviceName}/firewall/{duration}
@param firewallModel [required] Firewall type
@param serviceName [required] The internal name of your dedicated server
@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#L2802-L2809 |
peterbencze/serritor | src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java | BaseCrawler.start | private void start(final WebDriver webDriver, final boolean isResuming) {
try {
Validate.validState(isStopped, "The crawler is already running.");
this.webDriver = Validate.notNull(webDriver, "The webdriver cannot be null.");
// If the crawl delay strategy is set to adaptive, we check if the browser supports the
// Navigation Timing API or not. However HtmlUnit requires a page to be loaded first
// before executing JavaScript, so we load a blank page.
if (webDriver instanceof HtmlUnitDriver
&& config.getCrawlDelayStrategy().equals(CrawlDelayStrategy.ADAPTIVE)) {
webDriver.get(WebClient.ABOUT_BLANK);
}
if (!isResuming) {
crawlFrontier = new CrawlFrontier(config);
}
cookieStore = new BasicCookieStore();
httpClient = HttpClientBuilder.create()
.setDefaultCookieStore(cookieStore)
.useSystemProperties()
.build();
crawlDelayMechanism = createCrawlDelayMechanism();
isStopped = false;
run();
} finally {
HttpClientUtils.closeQuietly(httpClient);
if (this.webDriver != null) {
this.webDriver.quit();
}
isStopping = false;
isStopped = true;
}
} | java | private void start(final WebDriver webDriver, final boolean isResuming) {
try {
Validate.validState(isStopped, "The crawler is already running.");
this.webDriver = Validate.notNull(webDriver, "The webdriver cannot be null.");
// If the crawl delay strategy is set to adaptive, we check if the browser supports the
// Navigation Timing API or not. However HtmlUnit requires a page to be loaded first
// before executing JavaScript, so we load a blank page.
if (webDriver instanceof HtmlUnitDriver
&& config.getCrawlDelayStrategy().equals(CrawlDelayStrategy.ADAPTIVE)) {
webDriver.get(WebClient.ABOUT_BLANK);
}
if (!isResuming) {
crawlFrontier = new CrawlFrontier(config);
}
cookieStore = new BasicCookieStore();
httpClient = HttpClientBuilder.create()
.setDefaultCookieStore(cookieStore)
.useSystemProperties()
.build();
crawlDelayMechanism = createCrawlDelayMechanism();
isStopped = false;
run();
} finally {
HttpClientUtils.closeQuietly(httpClient);
if (this.webDriver != null) {
this.webDriver.quit();
}
isStopping = false;
isStopped = true;
}
} | [
"private",
"void",
"start",
"(",
"final",
"WebDriver",
"webDriver",
",",
"final",
"boolean",
"isResuming",
")",
"{",
"try",
"{",
"Validate",
".",
"validState",
"(",
"isStopped",
",",
"\"The crawler is already running.\"",
")",
";",
"this",
".",
"webDriver",
"=",... | Performs initialization and runs the crawler.
@param isResuming indicates if a previously saved state is to be resumed | [
"Performs",
"initialization",
"and",
"runs",
"the",
"crawler",
"."
] | train | https://github.com/peterbencze/serritor/blob/10ed6f82c90fa1dccd684382b68b5d77a37652c0/src/main/java/com/github/peterbencze/serritor/api/BaseCrawler.java#L151-L187 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/StreamSegmentContainerRegistry.java | StreamSegmentContainerRegistry.startContainerInternal | private CompletableFuture<ContainerHandle> startContainerInternal(int containerId) {
ContainerWithHandle newContainer = new ContainerWithHandle(this.factory.createStreamSegmentContainer(containerId),
new SegmentContainerHandle(containerId));
ContainerWithHandle existingContainer = this.containers.putIfAbsent(containerId, newContainer);
if (existingContainer != null) {
// We had multiple concurrent calls to start this Container and some other request beat us to it.
newContainer.container.close();
throw new IllegalArgumentException(String.format("Container %d is already registered.", containerId));
}
log.info("Registered SegmentContainer {}.", containerId);
// Attempt to Start the container, but first, attach a shutdown listener so we know to unregister it when it's stopped.
Services.onStop(
newContainer.container,
() -> unregisterContainer(newContainer),
ex -> handleContainerFailure(newContainer, ex),
this.executor);
return Services.startAsync(newContainer.container, this.executor)
.thenApply(v -> newContainer.handle);
} | java | private CompletableFuture<ContainerHandle> startContainerInternal(int containerId) {
ContainerWithHandle newContainer = new ContainerWithHandle(this.factory.createStreamSegmentContainer(containerId),
new SegmentContainerHandle(containerId));
ContainerWithHandle existingContainer = this.containers.putIfAbsent(containerId, newContainer);
if (existingContainer != null) {
// We had multiple concurrent calls to start this Container and some other request beat us to it.
newContainer.container.close();
throw new IllegalArgumentException(String.format("Container %d is already registered.", containerId));
}
log.info("Registered SegmentContainer {}.", containerId);
// Attempt to Start the container, but first, attach a shutdown listener so we know to unregister it when it's stopped.
Services.onStop(
newContainer.container,
() -> unregisterContainer(newContainer),
ex -> handleContainerFailure(newContainer, ex),
this.executor);
return Services.startAsync(newContainer.container, this.executor)
.thenApply(v -> newContainer.handle);
} | [
"private",
"CompletableFuture",
"<",
"ContainerHandle",
">",
"startContainerInternal",
"(",
"int",
"containerId",
")",
"{",
"ContainerWithHandle",
"newContainer",
"=",
"new",
"ContainerWithHandle",
"(",
"this",
".",
"factory",
".",
"createStreamSegmentContainer",
"(",
"... | Creates a new Container and attempts to register it. This method works in an optimistic manner: it creates the
Container first and then attempts to register it, which should prevent us from having to lock on this entire method.
Creating new containers is cheap (we don't start them yet), so this operation should not take any extra resources.
@param containerId The Id of the Container to start.
@return A CompletableFuture which will be completed with a ContainerHandle once the container has been started. | [
"Creates",
"a",
"new",
"Container",
"and",
"attempts",
"to",
"register",
"it",
".",
"This",
"method",
"works",
"in",
"an",
"optimistic",
"manner",
":",
"it",
"creates",
"the",
"Container",
"first",
"and",
"then",
"attempts",
"to",
"register",
"it",
"which",
... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/StreamSegmentContainerRegistry.java#L147-L167 |
sinetja/sinetja | src/main/java/sinetja/Response.java | Response.respondEventSource | public ChannelFuture respondEventSource(Object data, String event) throws Exception {
if (!nonChunkedResponseOrFirstChunkSent) {
HttpUtil.setTransferEncodingChunked(response, true);
response.headers().set(CONTENT_TYPE, "text/event-stream; charset=UTF-8");
return respondText("\r\n"); // Send a new line prelude, due to a bug in Opera
}
return respondText(renderEventSource(data, event));
} | java | public ChannelFuture respondEventSource(Object data, String event) throws Exception {
if (!nonChunkedResponseOrFirstChunkSent) {
HttpUtil.setTransferEncodingChunked(response, true);
response.headers().set(CONTENT_TYPE, "text/event-stream; charset=UTF-8");
return respondText("\r\n"); // Send a new line prelude, due to a bug in Opera
}
return respondText(renderEventSource(data, event));
} | [
"public",
"ChannelFuture",
"respondEventSource",
"(",
"Object",
"data",
",",
"String",
"event",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"nonChunkedResponseOrFirstChunkSent",
")",
"{",
"HttpUtil",
".",
"setTransferEncodingChunked",
"(",
"response",
",",
"tru... | To respond event source, call this method as many time as you want.
<p>Event Source response is a special kind of chunked response, data must be UTF-8.
See:
- http://sockjs.github.com/sockjs-protocol/sockjs-protocol-0.3.3.html#section-94
- http://dev.w3.org/html5/eventsource/
<p>No need to call setChunked() before calling this method. | [
"To",
"respond",
"event",
"source",
"call",
"this",
"method",
"as",
"many",
"time",
"as",
"you",
"want",
"."
] | train | https://github.com/sinetja/sinetja/blob/eec94dba55ec28263e3503fcdb33532282134775/src/main/java/sinetja/Response.java#L336-L343 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuTexRefSetMipmappedArray | public static int cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, int Flags)
{
return checkResult(cuTexRefSetMipmappedArrayNative(hTexRef, hMipmappedArray, Flags));
} | java | public static int cuTexRefSetMipmappedArray(CUtexref hTexRef, CUmipmappedArray hMipmappedArray, int Flags)
{
return checkResult(cuTexRefSetMipmappedArrayNative(hTexRef, hMipmappedArray, Flags));
} | [
"public",
"static",
"int",
"cuTexRefSetMipmappedArray",
"(",
"CUtexref",
"hTexRef",
",",
"CUmipmappedArray",
"hMipmappedArray",
",",
"int",
"Flags",
")",
"{",
"return",
"checkResult",
"(",
"cuTexRefSetMipmappedArrayNative",
"(",
"hTexRef",
",",
"hMipmappedArray",
",",
... | Binds a mipmapped array to a texture reference.
<pre>
CUresult cuTexRefSetMipmappedArray (
CUtexref hTexRef,
CUmipmappedArray hMipmappedArray,
unsigned int Flags )
</pre>
<div>
<p>Binds a mipmapped array to a texture
reference. Binds the CUDA mipmapped array <tt>hMipmappedArray</tt>
to the texture reference <tt>hTexRef</tt>. Any previous address or
CUDA array state associated with the texture reference is superseded
by this function. <tt>Flags</tt> must be set to CU_TRSA_OVERRIDE_FORMAT.
Any CUDA array previously bound to <tt>hTexRef</tt> is unbound.
</p>
</div>
@param hTexRef Texture reference to bind
@param hMipmappedArray Mipmapped array to bind
@param Flags Options (must be CU_TRSA_OVERRIDE_FORMAT)
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
@see JCudaDriver#cuTexRefSetAddress
@see JCudaDriver#cuTexRefSetAddress2D
@see JCudaDriver#cuTexRefSetAddressMode
@see JCudaDriver#cuTexRefSetFilterMode
@see JCudaDriver#cuTexRefSetFlags
@see JCudaDriver#cuTexRefSetFormat
@see JCudaDriver#cuTexRefGetAddress
@see JCudaDriver#cuTexRefGetAddressMode
@see JCudaDriver#cuTexRefGetArray
@see JCudaDriver#cuTexRefGetFilterMode
@see JCudaDriver#cuTexRefGetFlags
@see JCudaDriver#cuTexRefGetFormat | [
"Binds",
"a",
"mipmapped",
"array",
"to",
"a",
"texture",
"reference",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L9764-L9767 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SpoofChecker.java | SpoofChecker.areConfusable | public int areConfusable(String s1, String s2) {
//
// See section 4 of UAX 39 for the algorithm for checking whether two strings are confusable,
// and for definitions of the types (single, whole, mixed-script) of confusables.
// We only care about a few of the check flags. Ignore the others.
// If no tests relevant to this function have been specified, signal an error.
// TODO: is this really the right thing to do? It's probably an error on
// the caller's part, but logically we would just return 0 (no error).
if ((this.fChecks & CONFUSABLE) == 0) {
throw new IllegalArgumentException("No confusable checks are enabled.");
}
// Compute the skeletons and check for confusability.
String s1Skeleton = getSkeleton(s1);
String s2Skeleton = getSkeleton(s2);
if (!s1Skeleton.equals(s2Skeleton)) {
return 0;
}
// If we get here, the strings are confusable. Now we just need to set the flags for the appropriate classes
// of confusables according to UTS 39 section 4.
// Start by computing the resolved script sets of s1 and s2.
ScriptSet s1RSS = new ScriptSet();
getResolvedScriptSet(s1, s1RSS);
ScriptSet s2RSS = new ScriptSet();
getResolvedScriptSet(s2, s2RSS);
// Turn on all applicable flags
int result = 0;
if (s1RSS.intersects(s2RSS)) {
result |= SINGLE_SCRIPT_CONFUSABLE;
} else {
result |= MIXED_SCRIPT_CONFUSABLE;
if (!s1RSS.isEmpty() && !s2RSS.isEmpty()) {
result |= WHOLE_SCRIPT_CONFUSABLE;
}
}
// Turn off flags that the user doesn't want
result &= fChecks;
return result;
} | java | public int areConfusable(String s1, String s2) {
//
// See section 4 of UAX 39 for the algorithm for checking whether two strings are confusable,
// and for definitions of the types (single, whole, mixed-script) of confusables.
// We only care about a few of the check flags. Ignore the others.
// If no tests relevant to this function have been specified, signal an error.
// TODO: is this really the right thing to do? It's probably an error on
// the caller's part, but logically we would just return 0 (no error).
if ((this.fChecks & CONFUSABLE) == 0) {
throw new IllegalArgumentException("No confusable checks are enabled.");
}
// Compute the skeletons and check for confusability.
String s1Skeleton = getSkeleton(s1);
String s2Skeleton = getSkeleton(s2);
if (!s1Skeleton.equals(s2Skeleton)) {
return 0;
}
// If we get here, the strings are confusable. Now we just need to set the flags for the appropriate classes
// of confusables according to UTS 39 section 4.
// Start by computing the resolved script sets of s1 and s2.
ScriptSet s1RSS = new ScriptSet();
getResolvedScriptSet(s1, s1RSS);
ScriptSet s2RSS = new ScriptSet();
getResolvedScriptSet(s2, s2RSS);
// Turn on all applicable flags
int result = 0;
if (s1RSS.intersects(s2RSS)) {
result |= SINGLE_SCRIPT_CONFUSABLE;
} else {
result |= MIXED_SCRIPT_CONFUSABLE;
if (!s1RSS.isEmpty() && !s2RSS.isEmpty()) {
result |= WHOLE_SCRIPT_CONFUSABLE;
}
}
// Turn off flags that the user doesn't want
result &= fChecks;
return result;
} | [
"public",
"int",
"areConfusable",
"(",
"String",
"s1",
",",
"String",
"s2",
")",
"{",
"//",
"// See section 4 of UAX 39 for the algorithm for checking whether two strings are confusable,",
"// and for definitions of the types (single, whole, mixed-script) of confusables.",
"// We only ca... | Check the whether two specified strings are visually confusable. The types of confusability to be tested - single
script, mixed script, or whole script - are determined by the check options set for the SpoofChecker.
The tests to be performed are controlled by the flags SINGLE_SCRIPT_CONFUSABLE MIXED_SCRIPT_CONFUSABLE
WHOLE_SCRIPT_CONFUSABLE At least one of these tests must be selected.
ANY_CASE is a modifier for the tests. Select it if the identifiers may be of mixed case. If identifiers are case
folded for comparison and display to the user, do not select the ANY_CASE option.
@param s1
The first of the two strings to be compared for confusability.
@param s2
The second of the two strings to be compared for confusability.
@return Non-zero if s1 and s1 are confusable. If not 0, the value will indicate the type(s) of confusability
found, as defined by spoof check test constants. | [
"Check",
"the",
"whether",
"two",
"specified",
"strings",
"are",
"visually",
"confusable",
".",
"The",
"types",
"of",
"confusability",
"to",
"be",
"tested",
"-",
"single",
"script",
"mixed",
"script",
"or",
"whole",
"script",
"-",
"are",
"determined",
"by",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SpoofChecker.java#L1344-L1387 |
grails/grails-core | grails-core/src/main/groovy/grails/util/GrailsClassUtils.java | GrailsClassUtils.isAssignableOrConvertibleFrom | public static boolean isAssignableOrConvertibleFrom(Class<?> clazz, Class<?> type) {
if (type == null || clazz == null) {
return false;
}
if (type.isPrimitive()) {
// convert primitive type to compatible class
Class<?> primitiveClass = GrailsClassUtils.PRIMITIVE_TYPE_COMPATIBLE_CLASSES.get(type);
if (primitiveClass == null) {
// no compatible class found for primitive type
return false;
}
return clazz.isAssignableFrom(primitiveClass);
}
return clazz.isAssignableFrom(type);
} | java | public static boolean isAssignableOrConvertibleFrom(Class<?> clazz, Class<?> type) {
if (type == null || clazz == null) {
return false;
}
if (type.isPrimitive()) {
// convert primitive type to compatible class
Class<?> primitiveClass = GrailsClassUtils.PRIMITIVE_TYPE_COMPATIBLE_CLASSES.get(type);
if (primitiveClass == null) {
// no compatible class found for primitive type
return false;
}
return clazz.isAssignableFrom(primitiveClass);
}
return clazz.isAssignableFrom(type);
} | [
"public",
"static",
"boolean",
"isAssignableOrConvertibleFrom",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"clazz",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
... | Returns true if the specified clazz parameter is either the same as, or is a superclass or superinterface
of, the specified type parameter. Converts primitive types to compatible class automatically.
@param clazz
@param type
@return true if the class is a taglib
@see java.lang.Class#isAssignableFrom(Class) | [
"Returns",
"true",
"if",
"the",
"specified",
"clazz",
"parameter",
"is",
"either",
"the",
"same",
"as",
"or",
"is",
"a",
"superclass",
"or",
"superinterface",
"of",
"the",
"specified",
"type",
"parameter",
".",
"Converts",
"primitive",
"types",
"to",
"compatib... | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L789-L803 |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEventBuilder.java | AbstractEventBuilder.camundaOutputParameter | public B camundaOutputParameter(String name, String value) {
CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class);
CamundaOutputParameter camundaOutputParameter = createChild(camundaInputOutput, CamundaOutputParameter.class);
camundaOutputParameter.setCamundaName(name);
camundaOutputParameter.setTextContent(value);
return myself;
} | java | public B camundaOutputParameter(String name, String value) {
CamundaInputOutput camundaInputOutput = getCreateSingleExtensionElement(CamundaInputOutput.class);
CamundaOutputParameter camundaOutputParameter = createChild(camundaInputOutput, CamundaOutputParameter.class);
camundaOutputParameter.setCamundaName(name);
camundaOutputParameter.setTextContent(value);
return myself;
} | [
"public",
"B",
"camundaOutputParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"CamundaInputOutput",
"camundaInputOutput",
"=",
"getCreateSingleExtensionElement",
"(",
"CamundaInputOutput",
".",
"class",
")",
";",
"CamundaOutputParameter",
"camundaOutpu... | Creates a new camunda output parameter extension element with the
given name and value.
@param name the name of the output parameter
@param value the value of the output parameter
@return the builder object | [
"Creates",
"a",
"new",
"camunda",
"output",
"parameter",
"extension",
"element",
"with",
"the",
"given",
"name",
"and",
"value",
"."
] | train | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractEventBuilder.java#L60-L68 |
republicofgavin/PauseResumeAudioRecorder | library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java | PauseResumeAudioRecorder.startRecording | public void startRecording(){
if (currentAudioState.get() == PREPARED_STATE) {
currentAudioRecordingThread = new AudioRecorderThread(audioFile.replace(".wav",".temp"), MediaRecorder.AudioSource.MIC, sampleRateInHertz,channelConfig,audioEncoding,maxFileSizeInBytes);
currentAudioState.set(RECORDING_STATE);
currentAudioRecordingThread.start();
onTimeCompletedTimer=new Timer(true);
onTimeCompletionTimerTask=new MaxTimeTimerTask();
onTimeCompletedTimer.schedule(onTimeCompletionTimerTask,maxTimeInMillis);
remainingMaxTimeInMillis=maxTimeInMillis;
recordingStartTimeMillis=System.currentTimeMillis();
}
else{
Log.w(TAG,"Audio recorder is not in prepared state. Ignoring call.");
}
} | java | public void startRecording(){
if (currentAudioState.get() == PREPARED_STATE) {
currentAudioRecordingThread = new AudioRecorderThread(audioFile.replace(".wav",".temp"), MediaRecorder.AudioSource.MIC, sampleRateInHertz,channelConfig,audioEncoding,maxFileSizeInBytes);
currentAudioState.set(RECORDING_STATE);
currentAudioRecordingThread.start();
onTimeCompletedTimer=new Timer(true);
onTimeCompletionTimerTask=new MaxTimeTimerTask();
onTimeCompletedTimer.schedule(onTimeCompletionTimerTask,maxTimeInMillis);
remainingMaxTimeInMillis=maxTimeInMillis;
recordingStartTimeMillis=System.currentTimeMillis();
}
else{
Log.w(TAG,"Audio recorder is not in prepared state. Ignoring call.");
}
} | [
"public",
"void",
"startRecording",
"(",
")",
"{",
"if",
"(",
"currentAudioState",
".",
"get",
"(",
")",
"==",
"PREPARED_STATE",
")",
"{",
"currentAudioRecordingThread",
"=",
"new",
"AudioRecorderThread",
"(",
"audioFile",
".",
"replace",
"(",
"\".wav\"",
",",
... | Starts the recording if the recorder is in a prepared state. At this time, the complete file path should not have .temp file(as that is where the writing is taking place) and the specified .wav file should not exist as well(as that is where the .temp file will be converted to).
Does nothing if it is recorder is not in a prepared state.
@throws IllegalArgumentException If the parameters passed into it are invalid according to {@link AudioRecord}.getMinBufferSize API. | [
"Starts",
"the",
"recording",
"if",
"the",
"recorder",
"is",
"in",
"a",
"prepared",
"state",
".",
"At",
"this",
"time",
"the",
"complete",
"file",
"path",
"should",
"not",
"have",
".",
"temp",
"file",
"(",
"as",
"that",
"is",
"where",
"the",
"writing",
... | train | https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L223-L237 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java | OLAPService.addBatch | public BatchResult addBatch(ApplicationDefinition appDef, String shardName, OlapBatch batch) {
return addBatch(appDef, shardName, batch, null);
} | java | public BatchResult addBatch(ApplicationDefinition appDef, String shardName, OlapBatch batch) {
return addBatch(appDef, shardName, batch, null);
} | [
"public",
"BatchResult",
"addBatch",
"(",
"ApplicationDefinition",
"appDef",
",",
"String",
"shardName",
",",
"OlapBatch",
"batch",
")",
"{",
"return",
"addBatch",
"(",
"appDef",
",",
"shardName",
",",
"batch",
",",
"null",
")",
";",
"}"
] | Add a batch of updates for the given application to the given shard. Objects can
new, updated, or deleted.
@param appDef {@link ApplicationDefinition} of application to update.
@param shardName Shard to add batch to.
@param batch {@link OlapBatch} containing object updates.
@return {@link BatchResult} indicating results of update. | [
"Add",
"a",
"batch",
"of",
"updates",
"for",
"the",
"given",
"application",
"to",
"the",
"given",
"shard",
".",
"Objects",
"can",
"new",
"updated",
"or",
"deleted",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L198-L200 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/lang/SystemUtil.java | SystemUtil.isClassAvailable | public static boolean isClassAvailable(String pClassName, Class pFromClass) {
ClassLoader loader = pFromClass != null ? pFromClass.getClassLoader() : null;
return isClassAvailable(pClassName, loader);
} | java | public static boolean isClassAvailable(String pClassName, Class pFromClass) {
ClassLoader loader = pFromClass != null ? pFromClass.getClassLoader() : null;
return isClassAvailable(pClassName, loader);
} | [
"public",
"static",
"boolean",
"isClassAvailable",
"(",
"String",
"pClassName",
",",
"Class",
"pFromClass",
")",
"{",
"ClassLoader",
"loader",
"=",
"pFromClass",
"!=",
"null",
"?",
"pFromClass",
".",
"getClassLoader",
"(",
")",
":",
"null",
";",
"return",
"isC... | Tests if a named class is available from another class.
If a class is considered available, a call to
{@code Class.forName(pClassName, true, pFromClass.getClassLoader())}
will not result in an exception.
@param pClassName the class name to test
@param pFromClass the class to test from
@return {@code true} if available | [
"Tests",
"if",
"a",
"named",
"class",
"is",
"available",
"from",
"another",
"class",
".",
"If",
"a",
"class",
"is",
"considered",
"available",
"a",
"call",
"to",
"{",
"@code",
"Class",
".",
"forName",
"(",
"pClassName",
"true",
"pFromClass",
".",
"getClass... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/SystemUtil.java#L590-L593 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java | CertificateOperations.deleteCertificate | public void deleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateDeleteOptions options = new CertificateDeleteOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().certificates().delete(thumbprintAlgorithm, thumbprint, options);
} | java | public void deleteCertificate(String thumbprintAlgorithm, String thumbprint, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateDeleteOptions options = new CertificateDeleteOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().certificates().delete(thumbprintAlgorithm, thumbprint, options);
} | [
"public",
"void",
"deleteCertificate",
"(",
"String",
"thumbprintAlgorithm",
",",
"String",
"thumbprint",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"CertificateDeleteOptions",
"o... | Deletes the certificate from the Batch account.
<p>The delete operation requests that the certificate be deleted. The request puts the certificate in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETING Deleting} state.
The Batch service will perform the actual certificate deletion without any further client action.</p>
<p>You cannot delete a certificate if a resource (pool or compute node) is using it. Before you can delete a certificate, you must therefore make sure that:</p>
<ul>
<li>The certificate is not associated with any pools.</li>
<li>The certificate is not installed on any compute nodes. (Even if you remove a certificate from a pool, it is not removed from existing compute nodes in that pool until they restart.)</li>
</ul>
<p>If you try to delete a certificate that is in use, the deletion fails. The certificate state changes to {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed}.
You can use {@link #cancelDeleteCertificate(String, String)} to set the status back to Active if you decide that you want to continue using the certificate.</p>
@param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
@param thumbprint The thumbprint of the certificate to delete.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Deletes",
"the",
"certificate",
"from",
"the",
"Batch",
"account",
".",
"<p",
">",
"The",
"delete",
"operation",
"requests",
"that",
"the",
"certificate",
"be",
"deleted",
".",
"The",
"request",
"puts",
"the",
"certificate",
"in",
"the",
"{",
"@link",
"com"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L227-L233 |
jeremylong/DependencyCheck | maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java | BaseDependencyCheckMojo.showSummary | protected void showSummary(MavenProject mp, Dependency[] dependencies) {
if (showSummary) {
DependencyCheckScanAgent.showSummary(mp.getName(), dependencies);
}
} | java | protected void showSummary(MavenProject mp, Dependency[] dependencies) {
if (showSummary) {
DependencyCheckScanAgent.showSummary(mp.getName(), dependencies);
}
} | [
"protected",
"void",
"showSummary",
"(",
"MavenProject",
"mp",
",",
"Dependency",
"[",
"]",
"dependencies",
")",
"{",
"if",
"(",
"showSummary",
")",
"{",
"DependencyCheckScanAgent",
".",
"showSummary",
"(",
"mp",
".",
"getName",
"(",
")",
",",
"dependencies",
... | Generates a warning message listing a summary of dependencies and their
associated CPE and CVE entries.
@param mp the Maven project for which the summary is shown
@param dependencies a list of dependency objects | [
"Generates",
"a",
"warning",
"message",
"listing",
"a",
"summary",
"of",
"dependencies",
"and",
"their",
"associated",
"CPE",
"and",
"CVE",
"entries",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java#L1865-L1869 |
jirutka/spring-rest-exception-handler | src/main/java/cz/jirutka/spring/exhandler/RestHandlerExceptionResolverBuilder.java | RestHandlerExceptionResolverBuilder.addErrorMessageHandler | public RestHandlerExceptionResolverBuilder addErrorMessageHandler(
Class<? extends Exception> exceptionClass, HttpStatus status) {
return addHandler(new ErrorMessageRestExceptionHandler<>(exceptionClass, status));
} | java | public RestHandlerExceptionResolverBuilder addErrorMessageHandler(
Class<? extends Exception> exceptionClass, HttpStatus status) {
return addHandler(new ErrorMessageRestExceptionHandler<>(exceptionClass, status));
} | [
"public",
"RestHandlerExceptionResolverBuilder",
"addErrorMessageHandler",
"(",
"Class",
"<",
"?",
"extends",
"Exception",
">",
"exceptionClass",
",",
"HttpStatus",
"status",
")",
"{",
"return",
"addHandler",
"(",
"new",
"ErrorMessageRestExceptionHandler",
"<>",
"(",
"e... | Registers {@link ErrorMessageRestExceptionHandler} for the specified exception type.
This handler will be also used for all the exception subtypes, when no more specific mapping
is found.
@param exceptionClass The exception type to handle.
@param status The HTTP status to map the specified exception to. | [
"Registers",
"{",
"@link",
"ErrorMessageRestExceptionHandler",
"}",
"for",
"the",
"specified",
"exception",
"type",
".",
"This",
"handler",
"will",
"be",
"also",
"used",
"for",
"all",
"the",
"exception",
"subtypes",
"when",
"no",
"more",
"specific",
"mapping",
"... | train | https://github.com/jirutka/spring-rest-exception-handler/blob/f171956e59fe866f1a853c7d38444f136acc7a3b/src/main/java/cz/jirutka/spring/exhandler/RestHandlerExceptionResolverBuilder.java#L212-L216 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java | EqualsBuilder.reflectionEquals | @GwtIncompatible("incompatible method")
public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class<?> reflectUpToClass,
final String... excludeFields) {
return reflectionEquals(lhs, rhs, testTransients, reflectUpToClass, false, excludeFields);
} | java | @GwtIncompatible("incompatible method")
public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class<?> reflectUpToClass,
final String... excludeFields) {
return reflectionEquals(lhs, rhs, testTransients, reflectUpToClass, false, excludeFields);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"boolean",
"reflectionEquals",
"(",
"final",
"Object",
"lhs",
",",
"final",
"Object",
"rhs",
",",
"final",
"boolean",
"testTransients",
",",
"final",
"Class",
"<",
"?",
">",
"reflec... | <p>This method uses reflection to determine if the two <code>Object</code>s
are equal.</p>
<p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
fields. This means that it will throw a security exception if run under
a security manager, if the permissions are not set up correctly. It is also
not as efficient as testing explicitly. Non-primitive fields are compared using
<code>equals()</code>.</p>
<p>If the testTransients parameter is set to <code>true</code>, transient
members will be tested, otherwise they are ignored, as they are likely
derived fields, and not part of the value of the <code>Object</code>.</p>
<p>Static fields will not be included. Superclass fields will be appended
up to and including the specified superclass. A null superclass is treated
as java.lang.Object.</p>
@param lhs <code>this</code> object
@param rhs the other object
@param testTransients whether to include transient fields
@param reflectUpToClass the superclass to reflect up to (inclusive),
may be <code>null</code>
@param excludeFields array of field names to exclude from testing
@return <code>true</code> if the two Objects have tested equals.
@see EqualsExclude
@since 2.0 | [
"<p",
">",
"This",
"method",
"uses",
"reflection",
"to",
"determine",
"if",
"the",
"two",
"<code",
">",
"Object<",
"/",
"code",
">",
"s",
"are",
"equal",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java#L394-L398 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.inclusiveBetween | @SuppressWarnings("boxing")
public static void inclusiveBetween(final double start, final double end, final double value) {
// TODO when breaking BC, consider returning value
if (value < start || value > end) {
throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
}
} | java | @SuppressWarnings("boxing")
public static void inclusiveBetween(final double start, final double end, final double value) {
// TODO when breaking BC, consider returning value
if (value < start || value > end) {
throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_INCLUSIVE_BETWEEN_EX_MESSAGE, value, start, end));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"boxing\"",
")",
"public",
"static",
"void",
"inclusiveBetween",
"(",
"final",
"double",
"start",
",",
"final",
"double",
"end",
",",
"final",
"double",
"value",
")",
"{",
"// TODO when breaking BC, consider returning value",
"if",
"(... | Validate that the specified primitive value falls between the two
inclusive values specified; otherwise, throws an exception.
<pre>Validate.inclusiveBetween(0.1, 2.1, 1.1);</pre>
@param start the inclusive start value
@param end the inclusive end value
@param value the value to validate
@throws IllegalArgumentException if the value falls outside the boundaries (inclusive)
@since 3.3 | [
"Validate",
"that",
"the",
"specified",
"primitive",
"value",
"falls",
"between",
"the",
"two",
"inclusive",
"values",
"specified",
";",
"otherwise",
"throws",
"an",
"exception",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L1078-L1084 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/MilestonesApi.java | MilestonesApi.activateMilestone | public Milestone activateMilestone(Object projectIdOrPath, Integer milestoneId) throws GitLabApiException {
if (milestoneId == null) {
throw new RuntimeException("milestoneId cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("state_event", MilestoneState.ACTIVATE);
Response response = put(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
} | java | public Milestone activateMilestone(Object projectIdOrPath, Integer milestoneId) throws GitLabApiException {
if (milestoneId == null) {
throw new RuntimeException("milestoneId cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("state_event", MilestoneState.ACTIVATE);
Response response = put(Response.Status.OK, formData.asMap(),
"projects", getProjectIdOrPath(projectIdOrPath), "milestones", milestoneId);
return (response.readEntity(Milestone.class));
} | [
"public",
"Milestone",
"activateMilestone",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"milestoneId",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"milestoneId",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"milestoneId cannot be n... | Activate a milestone.
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param milestoneId the milestone ID to activate
@return the activated Milestone instance
@throws GitLabApiException if any exception occurs | [
"Activate",
"a",
"milestone",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MilestonesApi.java#L449-L459 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java | RingPlacer.completePartiallyPlacedRing | boolean completePartiallyPlacedRing(IRingSet rset, IRing ring, double bondLength) {
if (ring.getFlag(CDKConstants.ISPLACED))
return true;
IRing partiallyPlacedRing = molecule.getBuilder().newInstance(IRing.class);
for (IAtom atom : ring.atoms())
if (atom.getPoint2d() != null)
atom.setFlag(CDKConstants.ISPLACED, true);
AtomPlacer.copyPlaced(partiallyPlacedRing, ring);
if (partiallyPlacedRing.getAtomCount() > 1 &&
partiallyPlacedRing.getAtomCount() < ring.getAtomCount()) {
placeConnectedRings(rset, partiallyPlacedRing, RingPlacer.FUSED, bondLength);
placeConnectedRings(rset, partiallyPlacedRing, RingPlacer.BRIDGED, bondLength);
placeConnectedRings(rset, partiallyPlacedRing, RingPlacer.SPIRO, bondLength);
ring.setFlag(CDKConstants.ISPLACED, true);
return true;
} else {
return false;
}
} | java | boolean completePartiallyPlacedRing(IRingSet rset, IRing ring, double bondLength) {
if (ring.getFlag(CDKConstants.ISPLACED))
return true;
IRing partiallyPlacedRing = molecule.getBuilder().newInstance(IRing.class);
for (IAtom atom : ring.atoms())
if (atom.getPoint2d() != null)
atom.setFlag(CDKConstants.ISPLACED, true);
AtomPlacer.copyPlaced(partiallyPlacedRing, ring);
if (partiallyPlacedRing.getAtomCount() > 1 &&
partiallyPlacedRing.getAtomCount() < ring.getAtomCount()) {
placeConnectedRings(rset, partiallyPlacedRing, RingPlacer.FUSED, bondLength);
placeConnectedRings(rset, partiallyPlacedRing, RingPlacer.BRIDGED, bondLength);
placeConnectedRings(rset, partiallyPlacedRing, RingPlacer.SPIRO, bondLength);
ring.setFlag(CDKConstants.ISPLACED, true);
return true;
} else {
return false;
}
} | [
"boolean",
"completePartiallyPlacedRing",
"(",
"IRingSet",
"rset",
",",
"IRing",
"ring",
",",
"double",
"bondLength",
")",
"{",
"if",
"(",
"ring",
".",
"getFlag",
"(",
"CDKConstants",
".",
"ISPLACED",
")",
")",
"return",
"true",
";",
"IRing",
"partiallyPlacedR... | Completes the layout of a partially laid out ring.
@param rset ring set
@param ring the ring to complete
@param bondLength the bond length | [
"Completes",
"the",
"layout",
"of",
"a",
"partially",
"laid",
"out",
"ring",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java#L543-L562 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.setLong | @PublicEvolving
public void setLong(ConfigOption<Long> key, long value) {
setValueInternal(key.key(), value);
} | java | @PublicEvolving
public void setLong(ConfigOption<Long> key, long value) {
setValueInternal(key.key(), value);
} | [
"@",
"PublicEvolving",
"public",
"void",
"setLong",
"(",
"ConfigOption",
"<",
"Long",
">",
"key",
",",
"long",
"value",
")",
"{",
"setValueInternal",
"(",
"key",
".",
"key",
"(",
")",
",",
"value",
")",
";",
"}"
] | Adds the given value to the configuration object.
The main key of the config option will be used to map the value.
@param key
the option specifying the key to be added
@param value
the value of the key/value pair to be added | [
"Adds",
"the",
"given",
"value",
"to",
"the",
"configuration",
"object",
".",
"The",
"main",
"key",
"of",
"the",
"config",
"option",
"will",
"be",
"used",
"to",
"map",
"the",
"value",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L338-L341 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.findConstructor | public static ConstructorNode findConstructor(ClassNode classNode,Parameter[] constructorParams) {
List<ConstructorNode> declaredConstructors = classNode.getDeclaredConstructors();
for (ConstructorNode declaredConstructor : declaredConstructors) {
if (parametersEqual(constructorParams, declaredConstructor.getParameters())) {
return declaredConstructor;
}
}
return null;
} | java | public static ConstructorNode findConstructor(ClassNode classNode,Parameter[] constructorParams) {
List<ConstructorNode> declaredConstructors = classNode.getDeclaredConstructors();
for (ConstructorNode declaredConstructor : declaredConstructors) {
if (parametersEqual(constructorParams, declaredConstructor.getParameters())) {
return declaredConstructor;
}
}
return null;
} | [
"public",
"static",
"ConstructorNode",
"findConstructor",
"(",
"ClassNode",
"classNode",
",",
"Parameter",
"[",
"]",
"constructorParams",
")",
"{",
"List",
"<",
"ConstructorNode",
">",
"declaredConstructors",
"=",
"classNode",
".",
"getDeclaredConstructors",
"(",
")",... | Finds a constructor for the given class node and parameter types
@param classNode The class node
@param constructorParams The parameter types
@return The located constructor or null | [
"Finds",
"a",
"constructor",
"for",
"the",
"given",
"class",
"node",
"and",
"parameter",
"types"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L511-L519 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.executeConnectionAndWait | public static List<Response> executeConnectionAndWait(HttpURLConnection connection, Collection<Request> requests) {
return executeConnectionAndWait(connection, new RequestBatch(requests));
} | java | public static List<Response> executeConnectionAndWait(HttpURLConnection connection, Collection<Request> requests) {
return executeConnectionAndWait(connection, new RequestBatch(requests));
} | [
"public",
"static",
"List",
"<",
"Response",
">",
"executeConnectionAndWait",
"(",
"HttpURLConnection",
"connection",
",",
"Collection",
"<",
"Request",
">",
"requests",
")",
"{",
"return",
"executeConnectionAndWait",
"(",
"connection",
",",
"new",
"RequestBatch",
"... | Executes requests that have already been serialized into an HttpURLConnection. No validation is done that the
contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to
ensure that it will correctly generate the desired responses.
<p/>
This should only be called if you have transitioned off the UI thread.
@param connection
the HttpURLConnection that the requests were serialized into
@param requests
the requests represented by the HttpURLConnection
@return a list of Responses corresponding to the requests
@throws FacebookException
If there was an error in the protocol used to communicate with the service | [
"Executes",
"requests",
"that",
"have",
"already",
"been",
"serialized",
"into",
"an",
"HttpURLConnection",
".",
"No",
"validation",
"is",
"done",
"that",
"the",
"contents",
"of",
"the",
"connection",
"actually",
"reflect",
"the",
"serialized",
"requests",
"so",
... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1532-L1534 |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/action/EntityActionSupport.java | EntityActionSupport.getId | protected final <T> T getId(String name, Class<T> clazz) {
Object[] entityIds = getAll(name + ".id");
if (Arrays.isEmpty(entityIds)) entityIds = getAll(name + "Id");
if (Arrays.isEmpty(entityIds)) entityIds = getAll("id");
if (Arrays.isEmpty(entityIds)) return null;
else {
String entityId = entityIds[0].toString();
int commaIndex = entityId.indexOf(',');
if (commaIndex != -1) entityId = entityId.substring(0, commaIndex);
return Params.converter.convert(entityId, clazz);
}
} | java | protected final <T> T getId(String name, Class<T> clazz) {
Object[] entityIds = getAll(name + ".id");
if (Arrays.isEmpty(entityIds)) entityIds = getAll(name + "Id");
if (Arrays.isEmpty(entityIds)) entityIds = getAll("id");
if (Arrays.isEmpty(entityIds)) return null;
else {
String entityId = entityIds[0].toString();
int commaIndex = entityId.indexOf(',');
if (commaIndex != -1) entityId = entityId.substring(0, commaIndex);
return Params.converter.convert(entityId, clazz);
}
} | [
"protected",
"final",
"<",
"T",
">",
"T",
"getId",
"(",
"String",
"name",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Object",
"[",
"]",
"entityIds",
"=",
"getAll",
"(",
"name",
"+",
"\".id\"",
")",
";",
"if",
"(",
"Arrays",
".",
"isEmpty",
... | Get entity's id from shortname.id,shortnameId,id
@param name
@param clazz | [
"Get",
"entity",
"s",
"id",
"from",
"shortname",
".",
"id",
"shortnameId",
"id"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/action/EntityActionSupport.java#L47-L58 |
forge/furnace | proxy/src/main/java/org/jboss/forge/furnace/proxy/Proxies.java | Proxies.areEquivalent | public static boolean areEquivalent(Object proxiedObj, Object anotherProxiedObj)
{
if (proxiedObj == null && anotherProxiedObj == null)
{
return true;
}
else if (proxiedObj == null || anotherProxiedObj == null)
{
return false;
}
else
{
Object unproxiedObj = unwrap(proxiedObj);
Object anotherUnproxiedObj = unwrap(anotherProxiedObj);
boolean sameClassName = unwrapProxyClassName(unproxiedObj.getClass()).equals(
unwrapProxyClassName(anotherUnproxiedObj.getClass()));
if (sameClassName)
{
if (unproxiedObj.getClass().isEnum())
{
// Enum hashCode is different if loaded from different classloaders and cannot be overriden.
Enum<?> enumLeft = Enum.class.cast(unproxiedObj);
Enum<?> enumRight = Enum.class.cast(anotherUnproxiedObj);
return (enumLeft.name().equals(enumRight.name())) && (enumLeft.ordinal() == enumRight.ordinal());
}
else
{
return (unproxiedObj.hashCode() == anotherUnproxiedObj.hashCode());
}
}
else
{
return false;
}
}
} | java | public static boolean areEquivalent(Object proxiedObj, Object anotherProxiedObj)
{
if (proxiedObj == null && anotherProxiedObj == null)
{
return true;
}
else if (proxiedObj == null || anotherProxiedObj == null)
{
return false;
}
else
{
Object unproxiedObj = unwrap(proxiedObj);
Object anotherUnproxiedObj = unwrap(anotherProxiedObj);
boolean sameClassName = unwrapProxyClassName(unproxiedObj.getClass()).equals(
unwrapProxyClassName(anotherUnproxiedObj.getClass()));
if (sameClassName)
{
if (unproxiedObj.getClass().isEnum())
{
// Enum hashCode is different if loaded from different classloaders and cannot be overriden.
Enum<?> enumLeft = Enum.class.cast(unproxiedObj);
Enum<?> enumRight = Enum.class.cast(anotherUnproxiedObj);
return (enumLeft.name().equals(enumRight.name())) && (enumLeft.ordinal() == enumRight.ordinal());
}
else
{
return (unproxiedObj.hashCode() == anotherUnproxiedObj.hashCode());
}
}
else
{
return false;
}
}
} | [
"public",
"static",
"boolean",
"areEquivalent",
"(",
"Object",
"proxiedObj",
",",
"Object",
"anotherProxiedObj",
")",
"{",
"if",
"(",
"proxiedObj",
"==",
"null",
"&&",
"anotherProxiedObj",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"("... | This method tests if two proxied objects are equivalent.
It does so by comparing the class names and the hashCode, since they may be loaded from different classloaders. | [
"This",
"method",
"tests",
"if",
"two",
"proxied",
"objects",
"are",
"equivalent",
"."
] | train | https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/proxy/src/main/java/org/jboss/forge/furnace/proxy/Proxies.java#L398-L434 |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTableHeaders | private List<SynchroTable> readTableHeaders(InputStream is) throws IOException
{
// Read the headers
List<SynchroTable> tables = new ArrayList<SynchroTable>();
byte[] header = new byte[48];
while (true)
{
is.read(header);
m_offset += 48;
SynchroTable table = readTableHeader(header);
if (table == null)
{
break;
}
tables.add(table);
}
// Ensure sorted by offset
Collections.sort(tables, new Comparator<SynchroTable>()
{
@Override public int compare(SynchroTable o1, SynchroTable o2)
{
return o1.getOffset() - o2.getOffset();
}
});
// Calculate lengths
SynchroTable previousTable = null;
for (SynchroTable table : tables)
{
if (previousTable != null)
{
previousTable.setLength(table.getOffset() - previousTable.getOffset());
}
previousTable = table;
}
for (SynchroTable table : tables)
{
SynchroLogger.log("TABLE", table);
}
return tables;
} | java | private List<SynchroTable> readTableHeaders(InputStream is) throws IOException
{
// Read the headers
List<SynchroTable> tables = new ArrayList<SynchroTable>();
byte[] header = new byte[48];
while (true)
{
is.read(header);
m_offset += 48;
SynchroTable table = readTableHeader(header);
if (table == null)
{
break;
}
tables.add(table);
}
// Ensure sorted by offset
Collections.sort(tables, new Comparator<SynchroTable>()
{
@Override public int compare(SynchroTable o1, SynchroTable o2)
{
return o1.getOffset() - o2.getOffset();
}
});
// Calculate lengths
SynchroTable previousTable = null;
for (SynchroTable table : tables)
{
if (previousTable != null)
{
previousTable.setLength(table.getOffset() - previousTable.getOffset());
}
previousTable = table;
}
for (SynchroTable table : tables)
{
SynchroLogger.log("TABLE", table);
}
return tables;
} | [
"private",
"List",
"<",
"SynchroTable",
">",
"readTableHeaders",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"// Read the headers",
"List",
"<",
"SynchroTable",
">",
"tables",
"=",
"new",
"ArrayList",
"<",
"SynchroTable",
">",
"(",
")",
";",
"... | Read the table headers. This allows us to break the file into chunks
representing the individual tables.
@param is input stream
@return list of tables in the file | [
"Read",
"the",
"table",
"headers",
".",
"This",
"allows",
"us",
"to",
"break",
"the",
"file",
"into",
"chunks",
"representing",
"the",
"individual",
"tables",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L88-L132 |
EdwardRaff/JSAT | JSAT/src/jsat/io/CSV.java | CSV.readC | public static ClassificationDataSet readC(int classification_target, Reader reader, int lines_to_skip, Set<Integer> cat_cols) throws IOException
{
return readC(classification_target, reader, DEFAULT_DELIMITER, lines_to_skip, DEFAULT_COMMENT, cat_cols);
} | java | public static ClassificationDataSet readC(int classification_target, Reader reader, int lines_to_skip, Set<Integer> cat_cols) throws IOException
{
return readC(classification_target, reader, DEFAULT_DELIMITER, lines_to_skip, DEFAULT_COMMENT, cat_cols);
} | [
"public",
"static",
"ClassificationDataSet",
"readC",
"(",
"int",
"classification_target",
",",
"Reader",
"reader",
",",
"int",
"lines_to_skip",
",",
"Set",
"<",
"Integer",
">",
"cat_cols",
")",
"throws",
"IOException",
"{",
"return",
"readC",
"(",
"classification... | Reads in a CSV dataset as a classification dataset. Comments assumed to
start with the "#" symbol.
@param classification_target the column index (starting from zero) of the
feature that will be the categorical target value
@param reader the reader for the CSV content
@param lines_to_skip the number of lines to skip when reading in the CSV
(used to skip header information)
@param cat_cols a set of the indices to treat as categorical features.
@return the classification dataset from the given CSV file
@throws IOException | [
"Reads",
"in",
"a",
"CSV",
"dataset",
"as",
"a",
"classification",
"dataset",
".",
"Comments",
"assumed",
"to",
"start",
"with",
"the",
"#",
"symbol",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/CSV.java#L172-L175 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java | KeyVaultClientCustomImpl.listSecretVersions | public PagedList<SecretItem> listSecretVersions(final String vaultBaseUrl, final String secretName,
final Integer maxresults) {
return getSecretVersions(vaultBaseUrl, secretName, maxresults);
} | java | public PagedList<SecretItem> listSecretVersions(final String vaultBaseUrl, final String secretName,
final Integer maxresults) {
return getSecretVersions(vaultBaseUrl, secretName, maxresults);
} | [
"public",
"PagedList",
"<",
"SecretItem",
">",
"listSecretVersions",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"String",
"secretName",
",",
"final",
"Integer",
"maxresults",
")",
"{",
"return",
"getSecretVersions",
"(",
"vaultBaseUrl",
",",
"secretName",... | List the versions of the specified secret.
@param vaultBaseUrl
The vault name, e.g. https://myvault.vault.azure.net
@param secretName
The name of the secret in the given vault
@param maxresults
Maximum number of results to return in a page. If not specified
the service will return up to 25 results.
@return the PagedList<SecretItem> if successful. | [
"List",
"the",
"versions",
"of",
"the",
"specified",
"secret",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L1262-L1265 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java | GVRGenericConstraint.setAngularLowerLimits | public void setAngularLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ);
} | java | public void setAngularLowerLimits(float limitX, float limitY, float limitZ) {
Native3DGenericConstraint.setAngularLowerLimits(getNative(), limitX, limitY, limitZ);
} | [
"public",
"void",
"setAngularLowerLimits",
"(",
"float",
"limitX",
",",
"float",
"limitY",
",",
"float",
"limitZ",
")",
"{",
"Native3DGenericConstraint",
".",
"setAngularLowerLimits",
"(",
"getNative",
"(",
")",
",",
"limitX",
",",
"limitY",
",",
"limitZ",
")",
... | Sets the lower limits for the "moving" body rotation relative to joint point.
@param limitX the X axis lower rotation limit (in radians)
@param limitY the Y axis lower rotation limit (in radians)
@param limitZ the Z axis lower rotation limit (in radians) | [
"Sets",
"the",
"lower",
"limits",
"for",
"the",
"moving",
"body",
"rotation",
"relative",
"to",
"joint",
"point",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRGenericConstraint.java#L105-L107 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.getPropertyValueEnumNoThrow | @Deprecated
public static int getPropertyValueEnumNoThrow(int property, CharSequence valueAlias) {
return UPropertyAliases.INSTANCE.getPropertyValueEnumNoThrow(property, valueAlias);
} | java | @Deprecated
public static int getPropertyValueEnumNoThrow(int property, CharSequence valueAlias) {
return UPropertyAliases.INSTANCE.getPropertyValueEnumNoThrow(property, valueAlias);
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"getPropertyValueEnumNoThrow",
"(",
"int",
"property",
",",
"CharSequence",
"valueAlias",
")",
"{",
"return",
"UPropertyAliases",
".",
"INSTANCE",
".",
"getPropertyValueEnumNoThrow",
"(",
"property",
",",
"valueAlias",
")"... | Same as {@link #getPropertyValueEnum(int, CharSequence)}, except doesn't throw exception. Instead, returns UProperty.UNDEFINED.
@param property Same as {@link #getPropertyValueEnum(int, CharSequence)}
@param valueAlias Same as {@link #getPropertyValueEnum(int, CharSequence)}
@return returns UProperty.UNDEFINED if the value is not valid, otherwise the value.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Same",
"as",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4232-L4235 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/SessionApi.java | SessionApi.initializeWorkspaceAsync | public com.squareup.okhttp.Call initializeWorkspaceAsync(String code, String redirectUri, String state, String authorization, final ApiCallback<ApiSuccessResponse> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = initializeWorkspaceValidateBeforeCall(code, redirectUri, state, authorization, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call initializeWorkspaceAsync(String code, String redirectUri, String state, String authorization, final ApiCallback<ApiSuccessResponse> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = initializeWorkspaceValidateBeforeCall(code, redirectUri, state, authorization, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<ApiSuccessResponse>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"initializeWorkspaceAsync",
"(",
"String",
"code",
",",
"String",
"redirectUri",
",",
"String",
"state",
",",
"String",
"authorization",
",",
"final",
"ApiCallback",
"<",
"ApiSuccessResponse",
">",
"c... | Get and register an auth token (asynchronously)
Retrieve the authorization token using the authorization code. Workspace then registers the token and prepares the user's environment.
@param code The authorization code. You must include this parameter for the [Authorization Code Grant flow](/reference/authentication/). (optional)
@param redirectUri The same redirect URI you used in the initial login step. You must include this parameter for the [Authorization Code Grant flow](/reference/authentication/). (optional)
@param state The state parameter provide by the auth service on redirect that should be used to validate. This parameter must be provided if the include_state parameter is sent with the /login request. (optional)
@param authorization Bearer authorization. For example, \"Authorization&colon; Bearer access_token\". (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Get",
"and",
"register",
"an",
"auth",
"token",
"(",
"asynchronously",
")",
"Retrieve",
"the",
"authorization",
"token",
"using",
"the",
"authorization",
"code",
".",
"Workspace",
"then",
"registers",
"the",
"token",
"and",
"prepares",
"the",
"user'",
";",
... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/SessionApi.java#L1129-L1154 |
google/closure-compiler | src/com/google/javascript/jscomp/Es6TemplateLiterals.java | Es6TemplateLiterals.visitTaggedTemplateLiteral | static void visitTaggedTemplateLiteral(NodeTraversal t, Node n, boolean addTypes) {
AstFactory astFactory = t.getCompiler().createAstFactory();
JSTypeRegistry registry = t.getCompiler().getTypeRegistry();
JSType stringType = createType(addTypes, registry, JSTypeNative.STRING_TYPE);
JSType arrayType = createGenericType(addTypes, registry, JSTypeNative.ARRAY_TYPE, stringType);
JSType templateArrayType =
createType(addTypes, registry, JSTypeNative.I_TEMPLATE_ARRAY_TYPE);
JSType voidType = createType(addTypes, registry, JSTypeNative.VOID_TYPE);
JSType numberType = createType(addTypes, registry, JSTypeNative.NUMBER_TYPE);
Node templateLit = n.getLastChild();
Node cooked =
createCookedStringArray(templateLit, templateArrayType, stringType, voidType, numberType);
// Specify the type of the first argument to be ITemplateArray.
JSTypeExpression nonNullSiteObject = new JSTypeExpression(
JsDocInfoParser.parseTypeString("!ITemplateArray"), "<Es6TemplateLiterals.java>");
JSDocInfoBuilder info = new JSDocInfoBuilder(false);
info.recordType(nonNullSiteObject);
Node siteObject = withType(IR.cast(cooked, info.build()), templateArrayType);
// Create a variable representing the template literal.
Node callsiteId =
withType(
IR.name(TEMPLATELIT_VAR + t.getCompiler().getUniqueNameIdSupplier().get()),
templateArrayType);
Node var = IR.var(callsiteId, siteObject).useSourceInfoIfMissingFromForTree(n);
Node script = NodeUtil.getEnclosingScript(n);
script.addChildToFront(var);
t.reportCodeChange(var);
// Define the "raw" property on the introduced variable.
Node defineRaw;
if (cookedAndRawStringsSame(templateLit)) {
// The cooked and raw versions of the array are the same, so just call slice() on the
// cooked array at runtime to make the raw array a copy of the cooked array.
defineRaw =
IR.exprResult(
astFactory.createAssign(
astFactory.createGetProp(callsiteId.cloneNode(), "raw"),
astFactory.createCall(
astFactory.createGetProp(callsiteId.cloneNode(), "slice"))))
.useSourceInfoIfMissingFromForTree(n);
} else {
// The raw string array is different, so we need to construct it.
Node raw = createRawStringArray(templateLit, arrayType, stringType);
defineRaw =
IR.exprResult(
astFactory.createAssign(
astFactory.createGetProp(callsiteId.cloneNode(), "raw"), raw))
.useSourceInfoIfMissingFromForTree(n);
}
script.addChildAfter(defineRaw, var);
// Generate the call expression.
Node call = withType(IR.call(n.removeFirstChild(), callsiteId.cloneNode()), n.getJSType());
for (Node child = templateLit.getFirstChild(); child != null; child = child.getNext()) {
if (!child.isTemplateLitString()) {
call.addChildToBack(child.removeFirstChild());
}
}
call.useSourceInfoIfMissingFromForTree(templateLit);
call.putBooleanProp(Node.FREE_CALL, !call.getFirstChild().isGetProp());
n.replaceWith(call);
t.reportCodeChange();
} | java | static void visitTaggedTemplateLiteral(NodeTraversal t, Node n, boolean addTypes) {
AstFactory astFactory = t.getCompiler().createAstFactory();
JSTypeRegistry registry = t.getCompiler().getTypeRegistry();
JSType stringType = createType(addTypes, registry, JSTypeNative.STRING_TYPE);
JSType arrayType = createGenericType(addTypes, registry, JSTypeNative.ARRAY_TYPE, stringType);
JSType templateArrayType =
createType(addTypes, registry, JSTypeNative.I_TEMPLATE_ARRAY_TYPE);
JSType voidType = createType(addTypes, registry, JSTypeNative.VOID_TYPE);
JSType numberType = createType(addTypes, registry, JSTypeNative.NUMBER_TYPE);
Node templateLit = n.getLastChild();
Node cooked =
createCookedStringArray(templateLit, templateArrayType, stringType, voidType, numberType);
// Specify the type of the first argument to be ITemplateArray.
JSTypeExpression nonNullSiteObject = new JSTypeExpression(
JsDocInfoParser.parseTypeString("!ITemplateArray"), "<Es6TemplateLiterals.java>");
JSDocInfoBuilder info = new JSDocInfoBuilder(false);
info.recordType(nonNullSiteObject);
Node siteObject = withType(IR.cast(cooked, info.build()), templateArrayType);
// Create a variable representing the template literal.
Node callsiteId =
withType(
IR.name(TEMPLATELIT_VAR + t.getCompiler().getUniqueNameIdSupplier().get()),
templateArrayType);
Node var = IR.var(callsiteId, siteObject).useSourceInfoIfMissingFromForTree(n);
Node script = NodeUtil.getEnclosingScript(n);
script.addChildToFront(var);
t.reportCodeChange(var);
// Define the "raw" property on the introduced variable.
Node defineRaw;
if (cookedAndRawStringsSame(templateLit)) {
// The cooked and raw versions of the array are the same, so just call slice() on the
// cooked array at runtime to make the raw array a copy of the cooked array.
defineRaw =
IR.exprResult(
astFactory.createAssign(
astFactory.createGetProp(callsiteId.cloneNode(), "raw"),
astFactory.createCall(
astFactory.createGetProp(callsiteId.cloneNode(), "slice"))))
.useSourceInfoIfMissingFromForTree(n);
} else {
// The raw string array is different, so we need to construct it.
Node raw = createRawStringArray(templateLit, arrayType, stringType);
defineRaw =
IR.exprResult(
astFactory.createAssign(
astFactory.createGetProp(callsiteId.cloneNode(), "raw"), raw))
.useSourceInfoIfMissingFromForTree(n);
}
script.addChildAfter(defineRaw, var);
// Generate the call expression.
Node call = withType(IR.call(n.removeFirstChild(), callsiteId.cloneNode()), n.getJSType());
for (Node child = templateLit.getFirstChild(); child != null; child = child.getNext()) {
if (!child.isTemplateLitString()) {
call.addChildToBack(child.removeFirstChild());
}
}
call.useSourceInfoIfMissingFromForTree(templateLit);
call.putBooleanProp(Node.FREE_CALL, !call.getFirstChild().isGetProp());
n.replaceWith(call);
t.reportCodeChange();
} | [
"static",
"void",
"visitTaggedTemplateLiteral",
"(",
"NodeTraversal",
"t",
",",
"Node",
"n",
",",
"boolean",
"addTypes",
")",
"{",
"AstFactory",
"astFactory",
"=",
"t",
".",
"getCompiler",
"(",
")",
".",
"createAstFactory",
"(",
")",
";",
"JSTypeRegistry",
"re... | Converts tag`a\tb${bar}` to:
// A global (module) scoped variable
var $jscomp$templatelit$0 = ["a\tb"]; // cooked string array
$jscomp$templatelit$0.raw = ["a\\tb"]; // raw string array
...
// A call to the tagging function
tag($jscomp$templatelit$0, bar);
See template_literal_test.js for more examples.
@param n A TAGGED_TEMPLATELIT node | [
"Converts",
"tag",
"a",
"\\",
"tb$",
"{",
"bar",
"}",
"to",
":",
"//",
"A",
"global",
"(",
"module",
")",
"scoped",
"variable",
"var",
"$jscomp$templatelit$0",
"=",
"[",
"a",
"\\",
"tb",
"]",
";",
"//",
"cooked",
"string",
"array",
"$jscomp$templatelit$0... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6TemplateLiterals.java#L102-L168 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsAliasBulkEditHelper.java | CmsAliasBulkEditHelper.validateSingleAliasRow | private void validateSingleAliasRow(CmsObject cms, CmsAliasTableRow row) {
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
if (row.getStructureId() == null) {
String path = row.getResourcePath();
try {
CmsResource resource = cms.readResource(path, CmsResourceFilter.ALL);
row.setStructureId(resource.getStructureId());
if (row.getOriginalStructureId() == null) {
row.setOriginalStructureId(resource.getStructureId());
}
} catch (CmsException e) {
row.setPathError(messageResourceNotFound(locale));
m_hasErrors = true;
}
}
if (!CmsAlias.ALIAS_PATTERN.matcher(row.getAliasPath()).matches()) {
row.setAliasError(messageInvalidAliasPath(locale));
m_hasErrors = true;
}
} | java | private void validateSingleAliasRow(CmsObject cms, CmsAliasTableRow row) {
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
if (row.getStructureId() == null) {
String path = row.getResourcePath();
try {
CmsResource resource = cms.readResource(path, CmsResourceFilter.ALL);
row.setStructureId(resource.getStructureId());
if (row.getOriginalStructureId() == null) {
row.setOriginalStructureId(resource.getStructureId());
}
} catch (CmsException e) {
row.setPathError(messageResourceNotFound(locale));
m_hasErrors = true;
}
}
if (!CmsAlias.ALIAS_PATTERN.matcher(row.getAliasPath()).matches()) {
row.setAliasError(messageInvalidAliasPath(locale));
m_hasErrors = true;
}
} | [
"private",
"void",
"validateSingleAliasRow",
"(",
"CmsObject",
"cms",
",",
"CmsAliasTableRow",
"row",
")",
"{",
"Locale",
"locale",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getWorkplaceLocale",
"(",
"cms",
")",
";",
"if",
"(",
"row",
".",
... | Validates a single alias row.<p>
@param cms the current CMS context
@param row the row to validate | [
"Validates",
"a",
"single",
"alias",
"row",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsAliasBulkEditHelper.java#L312-L332 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java | MemberSummaryBuilder.buildMethodsSummary | public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.METHODS);
VisibleMemberMap visibleMemberMap =
getVisibleMemberMap(VisibleMemberMap.Kind.METHODS);
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
} | java | public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.METHODS);
VisibleMemberMap visibleMemberMap =
getVisibleMemberMap(VisibleMemberMap.Kind.METHODS);
addSummary(writer, visibleMemberMap, true, memberSummaryTree);
} | [
"public",
"void",
"buildMethodsSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"memberSummaryTree",
")",
"{",
"MemberSummaryWriter",
"writer",
"=",
"memberSummaryWriters",
".",
"get",
"(",
"VisibleMemberMap",
".",
"Kind",
".",
"METHODS",
")",
";",
"VisibleMemberMa... | Build the method summary.
@param node the XML element that specifies which components to document
@param memberSummaryTree the content tree to which the documentation will be added | [
"Build",
"the",
"method",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L304-L310 |
jxnet/Jxnet | jxnet-core/src/main/java/com/ardikars/jxnet/PcapPktHdr.java | PcapPktHdr.newInstance | public static PcapPktHdr newInstance(final int caplen, final int len, final int tvSec, final long tvUsec) {
return new PcapPktHdr(caplen, len, tvSec, tvUsec);
} | java | public static PcapPktHdr newInstance(final int caplen, final int len, final int tvSec, final long tvUsec) {
return new PcapPktHdr(caplen, len, tvSec, tvUsec);
} | [
"public",
"static",
"PcapPktHdr",
"newInstance",
"(",
"final",
"int",
"caplen",
",",
"final",
"int",
"len",
",",
"final",
"int",
"tvSec",
",",
"final",
"long",
"tvUsec",
")",
"{",
"return",
"new",
"PcapPktHdr",
"(",
"caplen",
",",
"len",
",",
"tvSec",
",... | Create new PcapPktHdr instance.
@param caplen capture length.
@param len length.
@param tvSec tv_sec.
@param tvUsec tv_usec.
@return returns PcapPktHdr. | [
"Create",
"new",
"PcapPktHdr",
"instance",
"."
] | train | https://github.com/jxnet/Jxnet/blob/3ef28eb83c149ff134df1841d12bcbea3d8fe163/jxnet-core/src/main/java/com/ardikars/jxnet/PcapPktHdr.java#L67-L69 |
alkacon/opencms-core | src/org/opencms/importexport/CmsExport.java | CmsExport.exportOrgUnit | protected void exportOrgUnit(Element parent, CmsOrganizationalUnit orgunit) throws SAXException, CmsException {
Element orgunitElement = parent.addElement(CmsImportVersion10.N_ORGUNIT);
getSaxWriter().writeOpen(orgunitElement);
Element name = orgunitElement.addElement(CmsImportVersion10.N_NAME).addText(orgunit.getName());
digestElement(orgunitElement, name);
Element description = orgunitElement.addElement(CmsImportVersion10.N_DESCRIPTION).addCDATA(
orgunit.getDescription());
digestElement(orgunitElement, description);
Element flags = orgunitElement.addElement(CmsImportVersion10.N_FLAGS).addText(
Integer.toString(orgunit.getFlags()));
digestElement(orgunitElement, flags);
Element resources = orgunitElement.addElement(CmsImportVersion10.N_RESOURCES);
Iterator<CmsResource> it = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit(
getCms(),
orgunit.getName()).iterator();
while (it.hasNext()) {
CmsResource resource = it.next();
resources.addElement(CmsImportVersion10.N_RESOURCE).addText(resource.getRootPath());
}
digestElement(orgunitElement, resources);
getReport().println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
Element groupsElement = parent.addElement(CmsImportVersion10.N_GROUPS);
getSaxWriter().writeOpen(groupsElement);
exportGroups(groupsElement, orgunit);
getSaxWriter().writeClose(groupsElement);
Element usersElement = parent.addElement(CmsImportVersion10.N_USERS);
getSaxWriter().writeOpen(usersElement);
exportUsers(usersElement, orgunit);
getSaxWriter().writeClose(usersElement);
getSaxWriter().writeClose(orgunitElement);
} | java | protected void exportOrgUnit(Element parent, CmsOrganizationalUnit orgunit) throws SAXException, CmsException {
Element orgunitElement = parent.addElement(CmsImportVersion10.N_ORGUNIT);
getSaxWriter().writeOpen(orgunitElement);
Element name = orgunitElement.addElement(CmsImportVersion10.N_NAME).addText(orgunit.getName());
digestElement(orgunitElement, name);
Element description = orgunitElement.addElement(CmsImportVersion10.N_DESCRIPTION).addCDATA(
orgunit.getDescription());
digestElement(orgunitElement, description);
Element flags = orgunitElement.addElement(CmsImportVersion10.N_FLAGS).addText(
Integer.toString(orgunit.getFlags()));
digestElement(orgunitElement, flags);
Element resources = orgunitElement.addElement(CmsImportVersion10.N_RESOURCES);
Iterator<CmsResource> it = OpenCms.getOrgUnitManager().getResourcesForOrganizationalUnit(
getCms(),
orgunit.getName()).iterator();
while (it.hasNext()) {
CmsResource resource = it.next();
resources.addElement(CmsImportVersion10.N_RESOURCE).addText(resource.getRootPath());
}
digestElement(orgunitElement, resources);
getReport().println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
Element groupsElement = parent.addElement(CmsImportVersion10.N_GROUPS);
getSaxWriter().writeOpen(groupsElement);
exportGroups(groupsElement, orgunit);
getSaxWriter().writeClose(groupsElement);
Element usersElement = parent.addElement(CmsImportVersion10.N_USERS);
getSaxWriter().writeOpen(usersElement);
exportUsers(usersElement, orgunit);
getSaxWriter().writeClose(usersElement);
getSaxWriter().writeClose(orgunitElement);
} | [
"protected",
"void",
"exportOrgUnit",
"(",
"Element",
"parent",
",",
"CmsOrganizationalUnit",
"orgunit",
")",
"throws",
"SAXException",
",",
"CmsException",
"{",
"Element",
"orgunitElement",
"=",
"parent",
".",
"addElement",
"(",
"CmsImportVersion10",
".",
"N_ORGUNIT"... | Exports one single organizational unit with all it's data.<p>
@param parent the parent node to add the groups to
@param orgunit the group to be exported
@throws SAXException if something goes wrong processing the manifest.xml
@throws CmsException if something goes wrong reading the data to export | [
"Exports",
"one",
"single",
"organizational",
"unit",
"with",
"all",
"it",
"s",
"data",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsExport.java#L1021-L1061 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java | OpenShiftManagedClustersInner.getByResourceGroupAsync | public Observable<OpenShiftManagedClusterInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() {
@Override
public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) {
return response.body();
}
});
} | java | public Observable<OpenShiftManagedClusterInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<OpenShiftManagedClusterInner>, OpenShiftManagedClusterInner>() {
@Override
public OpenShiftManagedClusterInner call(ServiceResponse<OpenShiftManagedClusterInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OpenShiftManagedClusterInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")"... | Gets a OpenShift managed cluster.
Gets the details of the managed OpenShift cluster with a specified resource group and name.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the OpenShift managed cluster resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OpenShiftManagedClusterInner object | [
"Gets",
"a",
"OpenShift",
"managed",
"cluster",
".",
"Gets",
"the",
"details",
"of",
"the",
"managed",
"OpenShift",
"cluster",
"with",
"a",
"specified",
"resource",
"group",
"and",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/OpenShiftManagedClustersInner.java#L382-L389 |
bugsnag/bugsnag-java | bugsnag/src/main/java/com/bugsnag/Report.java | Report.getExceptions | @Expose
protected List<Exception> getExceptions() {
List<Exception> exceptions = new ArrayList<Exception>();
exceptions.add(exception);
Throwable currentThrowable = exception.getThrowable().getCause();
while (currentThrowable != null) {
exceptions.add(new Exception(config, currentThrowable));
currentThrowable = currentThrowable.getCause();
}
return exceptions;
} | java | @Expose
protected List<Exception> getExceptions() {
List<Exception> exceptions = new ArrayList<Exception>();
exceptions.add(exception);
Throwable currentThrowable = exception.getThrowable().getCause();
while (currentThrowable != null) {
exceptions.add(new Exception(config, currentThrowable));
currentThrowable = currentThrowable.getCause();
}
return exceptions;
} | [
"@",
"Expose",
"protected",
"List",
"<",
"Exception",
">",
"getExceptions",
"(",
")",
"{",
"List",
"<",
"Exception",
">",
"exceptions",
"=",
"new",
"ArrayList",
"<",
"Exception",
">",
"(",
")",
";",
"exceptions",
".",
"add",
"(",
"exception",
")",
";",
... | Get the exceptions for the report.
@return the exceptions that make up the error. | [
"Get",
"the",
"exceptions",
"for",
"the",
"report",
"."
] | train | https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/Report.java#L67-L79 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addExplicitListItem | public int addExplicitListItem(UUID appId, String versionId, UUID entityId, AddExplicitListItemOptionalParameter addExplicitListItemOptionalParameter) {
return addExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, addExplicitListItemOptionalParameter).toBlocking().single().body();
} | java | public int addExplicitListItem(UUID appId, String versionId, UUID entityId, AddExplicitListItemOptionalParameter addExplicitListItemOptionalParameter) {
return addExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, addExplicitListItemOptionalParameter).toBlocking().single().body();
} | [
"public",
"int",
"addExplicitListItem",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"AddExplicitListItemOptionalParameter",
"addExplicitListItemOptionalParameter",
")",
"{",
"return",
"addExplicitListItemWithServiceResponseAsync",
"(",
"app... | Add a new item to the explicit list for the Pattern.Any entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The Pattern.Any entity extractor ID.
@param addExplicitListItemOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the int object if successful. | [
"Add",
"a",
"new",
"item",
"to",
"the",
"explicit",
"list",
"for",
"the",
"Pattern",
".",
"Any",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9992-L9994 |
BrunoEberhard/minimal-j | src/main/java/org/minimalj/util/DateUtils.java | DateUtils.parseCH | public static String parseCH(String inputText, boolean partialAllowed) {
if (StringUtils.isEmpty(inputText)) return null;
String text = cutNonDigitsAtBegin(inputText);
if (StringUtils.isEmpty(text)) return "";
text = cutNonDigitsAtEnd(text);
if (StringUtils.isEmpty(text)) return "";
// Nun hat der String sicher keinen Punkt mehr am Anfang oder Ende
if (inputText.indexOf(".") > -1) {
return parseCHWithDot(inputText, partialAllowed);
} else {
return parseCHWithoutDot(inputText, partialAllowed);
}
} | java | public static String parseCH(String inputText, boolean partialAllowed) {
if (StringUtils.isEmpty(inputText)) return null;
String text = cutNonDigitsAtBegin(inputText);
if (StringUtils.isEmpty(text)) return "";
text = cutNonDigitsAtEnd(text);
if (StringUtils.isEmpty(text)) return "";
// Nun hat der String sicher keinen Punkt mehr am Anfang oder Ende
if (inputText.indexOf(".") > -1) {
return parseCHWithDot(inputText, partialAllowed);
} else {
return parseCHWithoutDot(inputText, partialAllowed);
}
} | [
"public",
"static",
"String",
"parseCH",
"(",
"String",
"inputText",
",",
"boolean",
"partialAllowed",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"inputText",
")",
")",
"return",
"null",
";",
"String",
"text",
"=",
"cutNonDigitsAtBegin",
"(",
"... | Converts a CH - Date String in a yyyy-mm-dd String. The conversion
is very lenient and tries to convert as long as its somehow clear
what the user may have wanted.
@param inputText The input text. Maybe empty or <code>null</code>.
@param partialAllowed false if the inputText has to be a complete date with month and day
@return null if the input text is empty (<code>null</code> or length 0). An empty String
if the input text doesn't fit a date or a String in format yyyy-mm-dd (or yyyy-mm or even
yyyy if partial allowed) | [
"Converts",
"a",
"CH",
"-",
"Date",
"String",
"in",
"a",
"yyyy",
"-",
"mm",
"-",
"dd",
"String",
".",
"The",
"conversion",
"is",
"very",
"lenient",
"and",
"tries",
"to",
"convert",
"as",
"long",
"as",
"its",
"somehow",
"clear",
"what",
"the",
"user",
... | train | https://github.com/BrunoEberhard/minimal-j/blob/f7c5461b2b47a10b383aee1e2f1f150f6773703b/src/main/java/org/minimalj/util/DateUtils.java#L80-L94 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/file/tfile/Utils.java | Utils.writeVLong | @SuppressWarnings("fallthrough")
public static void writeVLong(DataOutput out, long n) throws IOException {
if ((n < 128) && (n >= -32)) {
out.writeByte((int) n);
return;
}
long un = (n < 0) ? ~n : n;
// how many bytes do we need to represent the number with sign bit?
int len = (Long.SIZE - Long.numberOfLeadingZeros(un)) / 8 + 1;
int firstByte = (int) (n >> ((len - 1) * 8));
switch (len) {
case 1:
// fall it through to firstByte==-1, len=2.
firstByte >>= 8;
case 2:
if ((firstByte < 20) && (firstByte >= -20)) {
out.writeByte(firstByte - 52);
out.writeByte((int) n);
return;
}
// fall it through to firstByte==0/-1, len=3.
firstByte >>= 8;
case 3:
if ((firstByte < 16) && (firstByte >= -16)) {
out.writeByte(firstByte - 88);
out.writeShort((int) n);
return;
}
// fall it through to firstByte==0/-1, len=4.
firstByte >>= 8;
case 4:
if ((firstByte < 8) && (firstByte >= -8)) {
out.writeByte(firstByte - 112);
out.writeShort(((int) n) >>> 8);
out.writeByte((int) n);
return;
}
out.writeByte(len - 129);
out.writeInt((int) n);
return;
case 5:
out.writeByte(len - 129);
out.writeInt((int) (n >>> 8));
out.writeByte((int) n);
return;
case 6:
out.writeByte(len - 129);
out.writeInt((int) (n >>> 16));
out.writeShort((int) n);
return;
case 7:
out.writeByte(len - 129);
out.writeInt((int) (n >>> 24));
out.writeShort((int) (n >>> 8));
out.writeByte((int) n);
return;
case 8:
out.writeByte(len - 129);
out.writeLong(n);
return;
default:
throw new RuntimeException("Internel error");
}
} | java | @SuppressWarnings("fallthrough")
public static void writeVLong(DataOutput out, long n) throws IOException {
if ((n < 128) && (n >= -32)) {
out.writeByte((int) n);
return;
}
long un = (n < 0) ? ~n : n;
// how many bytes do we need to represent the number with sign bit?
int len = (Long.SIZE - Long.numberOfLeadingZeros(un)) / 8 + 1;
int firstByte = (int) (n >> ((len - 1) * 8));
switch (len) {
case 1:
// fall it through to firstByte==-1, len=2.
firstByte >>= 8;
case 2:
if ((firstByte < 20) && (firstByte >= -20)) {
out.writeByte(firstByte - 52);
out.writeByte((int) n);
return;
}
// fall it through to firstByte==0/-1, len=3.
firstByte >>= 8;
case 3:
if ((firstByte < 16) && (firstByte >= -16)) {
out.writeByte(firstByte - 88);
out.writeShort((int) n);
return;
}
// fall it through to firstByte==0/-1, len=4.
firstByte >>= 8;
case 4:
if ((firstByte < 8) && (firstByte >= -8)) {
out.writeByte(firstByte - 112);
out.writeShort(((int) n) >>> 8);
out.writeByte((int) n);
return;
}
out.writeByte(len - 129);
out.writeInt((int) n);
return;
case 5:
out.writeByte(len - 129);
out.writeInt((int) (n >>> 8));
out.writeByte((int) n);
return;
case 6:
out.writeByte(len - 129);
out.writeInt((int) (n >>> 16));
out.writeShort((int) n);
return;
case 7:
out.writeByte(len - 129);
out.writeInt((int) (n >>> 24));
out.writeShort((int) (n >>> 8));
out.writeByte((int) n);
return;
case 8:
out.writeByte(len - 129);
out.writeLong(n);
return;
default:
throw new RuntimeException("Internel error");
}
} | [
"@",
"SuppressWarnings",
"(",
"\"fallthrough\"",
")",
"public",
"static",
"void",
"writeVLong",
"(",
"DataOutput",
"out",
",",
"long",
"n",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"n",
"<",
"128",
")",
"&&",
"(",
"n",
">=",
"-",
"32",
")",
... | Encoding a Long integer into a variable-length encoding format.
<ul>
<li>if n in [-32, 127): encode in one byte with the actual value.
Otherwise,
<li>if n in [-20*2^8, 20*2^8): encode in two bytes: byte[0] = n/256 - 52;
byte[1]=n&0xff. Otherwise,
<li>if n IN [-16*2^16, 16*2^16): encode in three bytes: byte[0]=n/2^16 -
88; byte[1]=(n>>8)&0xff; byte[2]=n&0xff. Otherwise,
<li>if n in [-8*2^24, 8*2^24): encode in four bytes: byte[0]=n/2^24 - 112;
byte[1] = (n>>16)&0xff; byte[2] = (n>>8)&0xff; byte[3]=n&0xff. Otherwise:
<li>if n in [-2^31, 2^31): encode in five bytes: byte[0]=-125; byte[1] =
(n>>24)&0xff; byte[2]=(n>>16)&0xff; byte[3]=(n>>8)&0xff; byte[4]=n&0xff;
<li>if n in [-2^39, 2^39): encode in six bytes: byte[0]=-124; byte[1] =
(n>>32)&0xff; byte[2]=(n>>24)&0xff; byte[3]=(n>>16)&0xff;
byte[4]=(n>>8)&0xff; byte[5]=n&0xff
<li>if n in [-2^47, 2^47): encode in seven bytes: byte[0]=-123; byte[1] =
(n>>40)&0xff; byte[2]=(n>>32)&0xff; byte[3]=(n>>24)&0xff;
byte[4]=(n>>16)&0xff; byte[5]=(n>>8)&0xff; byte[6]=n&0xff;
<li>if n in [-2^55, 2^55): encode in eight bytes: byte[0]=-122; byte[1] =
(n>>48)&0xff; byte[2] = (n>>40)&0xff; byte[3]=(n>>32)&0xff;
byte[4]=(n>>24)&0xff; byte[5]=(n>>16)&0xff; byte[6]=(n>>8)&0xff;
byte[7]=n&0xff;
<li>if n in [-2^63, 2^63): encode in nine bytes: byte[0]=-121; byte[1] =
(n>>54)&0xff; byte[2] = (n>>48)&0xff; byte[3] = (n>>40)&0xff;
byte[4]=(n>>32)&0xff; byte[5]=(n>>24)&0xff; byte[6]=(n>>16)&0xff;
byte[7]=(n>>8)&0xff; byte[8]=n&0xff;
</ul>
@param out
output stream
@param n
the integer number
@throws IOException | [
"Encoding",
"a",
"Long",
"integer",
"into",
"a",
"variable",
"-",
"length",
"encoding",
"format",
".",
"<ul",
">",
"<li",
">",
"if",
"n",
"in",
"[",
"-",
"32",
"127",
")",
":",
"encode",
"in",
"one",
"byte",
"with",
"the",
"actual",
"value",
".",
"... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/file/tfile/Utils.java#L90-L154 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java | EntityManagerFactoryImpl.createEntityManager | @Override
public final EntityManager createEntityManager(Map map)
{
// For Application managed persistence context, type is always EXTENDED
if (isOpen())
{
return new EntityManagerImpl(this, map, transactionType, PersistenceContextType.EXTENDED);
}
throw new IllegalStateException("Entity manager factory has been closed.");
} | java | @Override
public final EntityManager createEntityManager(Map map)
{
// For Application managed persistence context, type is always EXTENDED
if (isOpen())
{
return new EntityManagerImpl(this, map, transactionType, PersistenceContextType.EXTENDED);
}
throw new IllegalStateException("Entity manager factory has been closed.");
} | [
"@",
"Override",
"public",
"final",
"EntityManager",
"createEntityManager",
"(",
"Map",
"map",
")",
"{",
"// For Application managed persistence context, type is always EXTENDED\r",
"if",
"(",
"isOpen",
"(",
")",
")",
"{",
"return",
"new",
"EntityManagerImpl",
"(",
"thi... | Create a new application-managed EntityManager with the specified Map of
properties. This method returns a new EntityManager instance each time it
is invoked. The isOpen method will return true on the returned instance.
@param map
properties for entity manager
@return entity manager instance
@throws IllegalStateException
if the entity manager factory has been closed | [
"Create",
"a",
"new",
"application",
"-",
"managed",
"EntityManager",
"with",
"the",
"specified",
"Map",
"of",
"properties",
".",
"This",
"method",
"returns",
"a",
"new",
"EntityManager",
"instance",
"each",
"time",
"it",
"is",
"invoked",
".",
"The",
"isOpen",... | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java#L266-L275 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/servlet/MockHttpServletRequest.java | MockHttpServletRequest.setCookie | public void setCookie(final String name, final String value) {
if (name != null) {
Cookie cookie = new Cookie(name, value);
cookies.put(name, cookie);
}
} | java | public void setCookie(final String name, final String value) {
if (name != null) {
Cookie cookie = new Cookie(name, value);
cookies.put(name, cookie);
}
} | [
"public",
"void",
"setCookie",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"name",
",",
"value",
")",
";",
"cookies",
".",
"put",... | Sets a cookie on this request instance.
@param name The cookie name.
@param value The value of the cookie to set. | [
"Sets",
"a",
"cookie",
"on",
"this",
"request",
"instance",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/servlet/MockHttpServletRequest.java#L94-L99 |
primefaces/primefaces | src/main/java/org/primefaces/util/LocaleUtils.java | LocaleUtils.resolveLocale | public static Locale resolveLocale(Object locale, String clientId) {
Locale result = null;
if (locale != null) {
if (locale instanceof String) {
result = toLocale((String) locale);
}
else if (locale instanceof java.util.Locale) {
result = (java.util.Locale) locale;
}
else {
throw new IllegalArgumentException("Type:" + locale.getClass() + " is not a valid locale type for: " + clientId);
}
}
else {
// default to the view local
result = FacesContext.getCurrentInstance().getViewRoot().getLocale();
}
return result;
} | java | public static Locale resolveLocale(Object locale, String clientId) {
Locale result = null;
if (locale != null) {
if (locale instanceof String) {
result = toLocale((String) locale);
}
else if (locale instanceof java.util.Locale) {
result = (java.util.Locale) locale;
}
else {
throw new IllegalArgumentException("Type:" + locale.getClass() + " is not a valid locale type for: " + clientId);
}
}
else {
// default to the view local
result = FacesContext.getCurrentInstance().getViewRoot().getLocale();
}
return result;
} | [
"public",
"static",
"Locale",
"resolveLocale",
"(",
"Object",
"locale",
",",
"String",
"clientId",
")",
"{",
"Locale",
"result",
"=",
"null",
";",
"if",
"(",
"locale",
"!=",
"null",
")",
"{",
"if",
"(",
"locale",
"instanceof",
"String",
")",
"{",
"result... | Gets a {@link Locale} instance by the value of the component attribute "locale" which can be String or {@link Locale} or null.
<p>
If NULL is passed the view root default locale is used.
@param locale given locale
@return resolved Locale | [
"Gets",
"a",
"{",
"@link",
"Locale",
"}",
"instance",
"by",
"the",
"value",
"of",
"the",
"component",
"attribute",
"locale",
"which",
"can",
"be",
"String",
"or",
"{",
"@link",
"Locale",
"}",
"or",
"null",
".",
"<p",
">",
"If",
"NULL",
"is",
"passed",
... | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/LocaleUtils.java#L86-L106 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/cluster/Cluster.java | Cluster.get_topology_id | public static String get_topology_id(StormClusterState zkCluster, String storm_name) throws Exception {
List<String> active_storms = zkCluster.active_storms();
String rtn = null;
if (active_storms != null) {
for (String topology_id : active_storms) {
if (!topology_id.contains(storm_name)) {
continue;
}
StormBase base = zkCluster.storm_base(topology_id, null);
if (base != null && storm_name.equals(Common.getTopologyNameById(topology_id))) {
rtn = topology_id;
break;
}
}
}
return rtn;
} | java | public static String get_topology_id(StormClusterState zkCluster, String storm_name) throws Exception {
List<String> active_storms = zkCluster.active_storms();
String rtn = null;
if (active_storms != null) {
for (String topology_id : active_storms) {
if (!topology_id.contains(storm_name)) {
continue;
}
StormBase base = zkCluster.storm_base(topology_id, null);
if (base != null && storm_name.equals(Common.getTopologyNameById(topology_id))) {
rtn = topology_id;
break;
}
}
}
return rtn;
} | [
"public",
"static",
"String",
"get_topology_id",
"(",
"StormClusterState",
"zkCluster",
",",
"String",
"storm_name",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"active_storms",
"=",
"zkCluster",
".",
"active_storms",
"(",
")",
";",
"String",
"r... | if a topology's name is equal to the input storm_name, then return the topology id, otherwise return null | [
"if",
"a",
"topology",
"s",
"name",
"is",
"equal",
"to",
"the",
"input",
"storm_name",
"then",
"return",
"the",
"topology",
"id",
"otherwise",
"return",
"null"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/cluster/Cluster.java#L224-L241 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java | CodeBuilderUtil.blankValue | public static void blankValue(CodeBuilder b, TypeDesc type) {
switch (type.getTypeCode()) {
default:
b.loadNull();
break;
case TypeDesc.BYTE_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
case TypeDesc.INT_CODE:
b.loadConstant(0);
break;
case TypeDesc.BOOLEAN_CODE:
b.loadConstant(false);
break;
case TypeDesc.LONG_CODE:
b.loadConstant(0L);
break;
case TypeDesc.FLOAT_CODE:
b.loadConstant(0.0f);
break;
case TypeDesc.DOUBLE_CODE:
b.loadConstant(0.0);
break;
}
} | java | public static void blankValue(CodeBuilder b, TypeDesc type) {
switch (type.getTypeCode()) {
default:
b.loadNull();
break;
case TypeDesc.BYTE_CODE:
case TypeDesc.CHAR_CODE:
case TypeDesc.SHORT_CODE:
case TypeDesc.INT_CODE:
b.loadConstant(0);
break;
case TypeDesc.BOOLEAN_CODE:
b.loadConstant(false);
break;
case TypeDesc.LONG_CODE:
b.loadConstant(0L);
break;
case TypeDesc.FLOAT_CODE:
b.loadConstant(0.0f);
break;
case TypeDesc.DOUBLE_CODE:
b.loadConstant(0.0);
break;
}
} | [
"public",
"static",
"void",
"blankValue",
"(",
"CodeBuilder",
"b",
",",
"TypeDesc",
"type",
")",
"{",
"switch",
"(",
"type",
".",
"getTypeCode",
"(",
")",
")",
"{",
"default",
":",
"b",
".",
"loadNull",
"(",
")",
";",
"break",
";",
"case",
"TypeDesc",
... | Generates code to push a blank value to the stack. For objects, it is
null, and for primitive types it is zero or false. | [
"Generates",
"code",
"to",
"push",
"a",
"blank",
"value",
"to",
"the",
"stack",
".",
"For",
"objects",
"it",
"is",
"null",
"and",
"for",
"primitive",
"types",
"it",
"is",
"zero",
"or",
"false",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java#L756-L786 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/DelaunayData.java | DelaunayData.addGeometry | private void addGeometry(Geometry geom) throws IllegalArgumentException {
if(!geom.isValid()) {
throw new IllegalArgumentException("Provided geometry is not valid !");
}
if(geom instanceof GeometryCollection) {
Map<TriangulationPoint, Integer> pts = new HashMap<TriangulationPoint, Integer>(geom.getNumPoints());
List<Integer> segments = new ArrayList<Integer>(pts.size());
AtomicInteger pointsCount = new AtomicInteger(0);
PointHandler pointHandler = new PointHandler(this, pts, pointsCount);
LineStringHandler lineStringHandler = new LineStringHandler(this, pts, pointsCount, segments);
for(int geomId = 0; geomId < geom.getNumGeometries(); geomId++) {
addSimpleGeometry(geom.getGeometryN(geomId), pointHandler, lineStringHandler);
}
int[] index = new int[segments.size()];
for(int i = 0; i < index.length; i++) {
index[i] = segments.get(i);
}
// Construct final points array by reversing key,value of hash map
TriangulationPoint[] ptsArray = new TriangulationPoint[pointsCount.get()];
for(Map.Entry<TriangulationPoint, Integer> entry : pts.entrySet()) {
ptsArray[entry.getValue()] = entry.getKey();
}
pts.clear();
convertedInput = new ConstrainedPointSet(Arrays.asList(ptsArray), index);
} else {
addGeometry(geom.getFactory().createGeometryCollection(new Geometry[]{geom}));
}
} | java | private void addGeometry(Geometry geom) throws IllegalArgumentException {
if(!geom.isValid()) {
throw new IllegalArgumentException("Provided geometry is not valid !");
}
if(geom instanceof GeometryCollection) {
Map<TriangulationPoint, Integer> pts = new HashMap<TriangulationPoint, Integer>(geom.getNumPoints());
List<Integer> segments = new ArrayList<Integer>(pts.size());
AtomicInteger pointsCount = new AtomicInteger(0);
PointHandler pointHandler = new PointHandler(this, pts, pointsCount);
LineStringHandler lineStringHandler = new LineStringHandler(this, pts, pointsCount, segments);
for(int geomId = 0; geomId < geom.getNumGeometries(); geomId++) {
addSimpleGeometry(geom.getGeometryN(geomId), pointHandler, lineStringHandler);
}
int[] index = new int[segments.size()];
for(int i = 0; i < index.length; i++) {
index[i] = segments.get(i);
}
// Construct final points array by reversing key,value of hash map
TriangulationPoint[] ptsArray = new TriangulationPoint[pointsCount.get()];
for(Map.Entry<TriangulationPoint, Integer> entry : pts.entrySet()) {
ptsArray[entry.getValue()] = entry.getKey();
}
pts.clear();
convertedInput = new ConstrainedPointSet(Arrays.asList(ptsArray), index);
} else {
addGeometry(geom.getFactory().createGeometryCollection(new Geometry[]{geom}));
}
} | [
"private",
"void",
"addGeometry",
"(",
"Geometry",
"geom",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"!",
"geom",
".",
"isValid",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Provided geometry is not valid !\"",
")",
";"... | Add a geometry to the list of points and edges used by the triangulation.
@param geom Any geometry
@throws IllegalArgumentException | [
"Add",
"a",
"geometry",
"to",
"the",
"list",
"of",
"points",
"and",
"edges",
"used",
"by",
"the",
"triangulation",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/mesh/DelaunayData.java#L288-L315 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/servlet/WeixinControllerSupport.java | WeixinControllerSupport.process | @RequestMapping(method = RequestMethod.POST)
protected final void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (isLegal(request)) {
String result = processRequest(request);
//设置正确的 content-type 以防止中文乱码
response.setContentType("text/xml;charset=UTF-8");
PrintWriter writer = response.getWriter();
writer.write(result);
writer.close();
}
} | java | @RequestMapping(method = RequestMethod.POST)
protected final void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (isLegal(request)) {
String result = processRequest(request);
//设置正确的 content-type 以防止中文乱码
response.setContentType("text/xml;charset=UTF-8");
PrintWriter writer = response.getWriter();
writer.write(result);
writer.close();
}
} | [
"@",
"RequestMapping",
"(",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"protected",
"final",
"void",
"process",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"if",
"... | 微信消息交互处理
@param request http 请求对象
@param response http 响应对象
@throws ServletException 异常
@throws IOException IO异常 | [
"微信消息交互处理"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/servlet/WeixinControllerSupport.java#L49-L59 |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.lighten | public static Expression lighten(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int increase = input.getExpectedIntParam(1);
return changeLighteness(color, increase);
} | java | public static Expression lighten(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int increase = input.getExpectedIntParam(1);
return changeLighteness(color, increase);
} | [
"public",
"static",
"Expression",
"lighten",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"int",
"increase",
"=",
"input",
".",
"getExpectedIntParam",
"... | Increases the lightness of the given color by N percent.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Increases",
"the",
"lightness",
"of",
"the",
"given",
"color",
"by",
"N",
"percent",
"."
] | train | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L93-L97 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/Transform.java | Transform.setParameter | public void setParameter(String name, Object value) {
parameters.put(name, value);
transformation.addParameter(name, value);
} | java | public void setParameter(String name, Object value) {
parameters.put(name, value);
transformation.addParameter(name, value);
} | [
"public",
"void",
"setParameter",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"parameters",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"transformation",
".",
"addParameter",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Add a parameter for the transformation
@param name
@param value
@see Transformer#setParameter(java.lang.String, java.lang.Object) | [
"Add",
"a",
"parameter",
"for",
"the",
"transformation"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/Transform.java#L257-L260 |
jboss/jboss-servlet-api_spec | src/main/java/javax/servlet/http/HttpServletResponseWrapper.java | HttpServletResponseWrapper.setStatus | @Deprecated
@Override
public void setStatus(int sc, String sm) {
this._getHttpServletResponse().setStatus(sc, sm);
} | java | @Deprecated
@Override
public void setStatus(int sc, String sm) {
this._getHttpServletResponse().setStatus(sc, sm);
} | [
"@",
"Deprecated",
"@",
"Override",
"public",
"void",
"setStatus",
"(",
"int",
"sc",
",",
"String",
"sm",
")",
"{",
"this",
".",
"_getHttpServletResponse",
"(",
")",
".",
"setStatus",
"(",
"sc",
",",
"sm",
")",
";",
"}"
] | The default behavior of this method is to call
setStatus(int sc, String sm) on the wrapped response object.
@deprecated As of version 2.1, due to ambiguous meaning of the
message parameter. To set a status code
use {@link #setStatus(int)}, to send an error with a description
use {@link #sendError(int, String)} | [
"The",
"default",
"behavior",
"of",
"this",
"method",
"is",
"to",
"call",
"setStatus",
"(",
"int",
"sc",
"String",
"sm",
")",
"on",
"the",
"wrapped",
"response",
"object",
"."
] | train | https://github.com/jboss/jboss-servlet-api_spec/blob/5bc96f2b833c072baff6eb8ae49bc7b5e503e9b2/src/main/java/javax/servlet/http/HttpServletResponseWrapper.java#L257-L261 |
motown-io/motown | ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/OcppJsonService.java | OcppJsonService.changeConfiguration | public void changeConfiguration(ChargingStationId chargingStationId, ConfigurationItem configurationItem, CorrelationToken correlationToken) {
Changeconfiguration changeConfigurationRequest = new Changeconfiguration();
changeConfigurationRequest.setKey(configurationItem.getKey());
changeConfigurationRequest.setValue(configurationItem.getValue());
responseHandlers.put(correlationToken.getToken(), new ChangeConfigurationResponseHandler(configurationItem, correlationToken));
WampMessage wampMessage = new WampMessage(WampMessage.CALL, correlationToken.getToken(), MessageProcUri.CHANGE_CONFIGURATION, changeConfigurationRequest);
sendWampMessage(wampMessage, chargingStationId);
} | java | public void changeConfiguration(ChargingStationId chargingStationId, ConfigurationItem configurationItem, CorrelationToken correlationToken) {
Changeconfiguration changeConfigurationRequest = new Changeconfiguration();
changeConfigurationRequest.setKey(configurationItem.getKey());
changeConfigurationRequest.setValue(configurationItem.getValue());
responseHandlers.put(correlationToken.getToken(), new ChangeConfigurationResponseHandler(configurationItem, correlationToken));
WampMessage wampMessage = new WampMessage(WampMessage.CALL, correlationToken.getToken(), MessageProcUri.CHANGE_CONFIGURATION, changeConfigurationRequest);
sendWampMessage(wampMessage, chargingStationId);
} | [
"public",
"void",
"changeConfiguration",
"(",
"ChargingStationId",
"chargingStationId",
",",
"ConfigurationItem",
"configurationItem",
",",
"CorrelationToken",
"correlationToken",
")",
"{",
"Changeconfiguration",
"changeConfigurationRequest",
"=",
"new",
"Changeconfiguration",
... | Send a request to a charging station to change a configuration item.
@param chargingStationId the charging station's id.
@param configurationItem the configuration item to change.
@param correlationToken the token to correlate commands and events that belong together. | [
"Send",
"a",
"request",
"to",
"a",
"charging",
"station",
"to",
"change",
"a",
"configuration",
"item",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/websocket-json/src/main/java/io/motown/ocpp/websocketjson/OcppJsonService.java#L111-L120 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java | ParseUtils.unexpectedAttribute | public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index) {
final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation());
return new XMLStreamValidationException(ex.getMessage(),
ValidationError.from(ex, ErrorType.UNEXPECTED_ATTRIBUTE)
.element(reader.getName())
.attribute(reader.getAttributeName(index)),
ex);
} | java | public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index) {
final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), reader.getLocation());
return new XMLStreamValidationException(ex.getMessage(),
ValidationError.from(ex, ErrorType.UNEXPECTED_ATTRIBUTE)
.element(reader.getName())
.attribute(reader.getAttributeName(index)),
ex);
} | [
"public",
"static",
"XMLStreamException",
"unexpectedAttribute",
"(",
"final",
"XMLExtendedStreamReader",
"reader",
",",
"final",
"int",
"index",
")",
"{",
"final",
"XMLStreamException",
"ex",
"=",
"ControllerLogger",
".",
"ROOT_LOGGER",
".",
"unexpectedAttribute",
"(",... | Get an exception reporting an unexpected XML attribute.
@param reader the stream reader
@param index the attribute index
@return the exception | [
"Get",
"an",
"exception",
"reporting",
"an",
"unexpected",
"XML",
"attribute",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L134-L142 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java | DatabaseRepresentation.deleteResource | public void deleteResource(final String resourceName) throws WebApplicationException {
synchronized (resourceName) {
try {
mDatabase.truncateResource(new SessionConfiguration(resourceName, null));
} catch (TTException e) {
throw new WebApplicationException(e);
}
}
} | java | public void deleteResource(final String resourceName) throws WebApplicationException {
synchronized (resourceName) {
try {
mDatabase.truncateResource(new SessionConfiguration(resourceName, null));
} catch (TTException e) {
throw new WebApplicationException(e);
}
}
} | [
"public",
"void",
"deleteResource",
"(",
"final",
"String",
"resourceName",
")",
"throws",
"WebApplicationException",
"{",
"synchronized",
"(",
"resourceName",
")",
"{",
"try",
"{",
"mDatabase",
".",
"truncateResource",
"(",
"new",
"SessionConfiguration",
"(",
"reso... | This method is responsible to delete an existing database.
@param resourceName
The name of the database.
@throws WebApplicationException
The exception occurred. | [
"This",
"method",
"is",
"responsible",
"to",
"delete",
"an",
"existing",
"database",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java#L276-L284 |
Netflix/Hystrix | hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/AopUtils.java | AopUtils.getDeclaredMethod | public static Method getDeclaredMethod(Class<?> type, String methodName, Class<?>... parameterTypes) {
Method method = null;
try {
method = type.getDeclaredMethod(methodName, parameterTypes);
if(method.isBridge()){
method = MethodProvider.getInstance().unbride(method, type);
}
} catch (NoSuchMethodException e) {
Class<?> superclass = type.getSuperclass();
if (superclass != null) {
method = getDeclaredMethod(superclass, methodName, parameterTypes);
}
} catch (ClassNotFoundException e) {
Throwables.propagate(e);
} catch (IOException e) {
Throwables.propagate(e);
}
return method;
} | java | public static Method getDeclaredMethod(Class<?> type, String methodName, Class<?>... parameterTypes) {
Method method = null;
try {
method = type.getDeclaredMethod(methodName, parameterTypes);
if(method.isBridge()){
method = MethodProvider.getInstance().unbride(method, type);
}
} catch (NoSuchMethodException e) {
Class<?> superclass = type.getSuperclass();
if (superclass != null) {
method = getDeclaredMethod(superclass, methodName, parameterTypes);
}
} catch (ClassNotFoundException e) {
Throwables.propagate(e);
} catch (IOException e) {
Throwables.propagate(e);
}
return method;
} | [
"public",
"static",
"Method",
"getDeclaredMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"Method",
"method",
"=",
"null",
";",
"try",
"{",
"method",
"=",
"type",
... | Gets declared method from specified type by mame and parameters types.
@param type the type
@param methodName the name of the method
@param parameterTypes the parameter array
@return a {@link Method} object or null if method doesn't exist | [
"Gets",
"declared",
"method",
"from",
"specified",
"type",
"by",
"mame",
"and",
"parameters",
"types",
"."
] | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/AopUtils.java#L89-L107 |
haraldk/TwelveMonkeys | imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/ImageReaderBase.java | ImageReaderBase.fakeSubsampling | protected static Image fakeSubsampling(Image pImage, ImageReadParam pParam) {
return IIOUtil.fakeSubsampling(pImage, pParam);
} | java | protected static Image fakeSubsampling(Image pImage, ImageReadParam pParam) {
return IIOUtil.fakeSubsampling(pImage, pParam);
} | [
"protected",
"static",
"Image",
"fakeSubsampling",
"(",
"Image",
"pImage",
",",
"ImageReadParam",
"pParam",
")",
"{",
"return",
"IIOUtil",
".",
"fakeSubsampling",
"(",
"pImage",
",",
"pParam",
")",
";",
"}"
] | Utility method for getting the subsampled image.
The subsampling is defined by the
{@link javax.imageio.IIOParam#setSourceSubsampling(int, int, int, int)}
method.
<p/>
NOTE: This method does not take the subsampling offsets into
consideration.
<p/>
Note: If it is possible for the reader to subsample directly, such a
method should be used instead, for efficiency.
@param pImage the image to subsample
@param pParam the param optionally specifying subsampling
@return an {@code Image} containing the subsampled image, or the
original image, if no subsampling was specified, or
{@code pParam} was {@code null} | [
"Utility",
"method",
"for",
"getting",
"the",
"subsampled",
"image",
".",
"The",
"subsampling",
"is",
"defined",
"by",
"the",
"{",
"@link",
"javax",
".",
"imageio",
".",
"IIOParam#setSourceSubsampling",
"(",
"int",
"int",
"int",
"int",
")",
"}",
"method",
".... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-core/src/main/java/com/twelvemonkeys/imageio/ImageReaderBase.java#L359-L361 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/util/TimeIntervalFormatUtil.java | TimeIntervalFormatUtil.checkValidInterval | public static boolean checkValidInterval(int interval, TimeUnit unit)
{
if (0 >= interval || INTERVAL_MAX < interval)
{
return false;
}
switch (unit)
{
case HOURS:
break;
case MINUTES:
break;
case SECONDS:
break;
case MILLISECONDS:
break;
default:
return false;
}
return true;
} | java | public static boolean checkValidInterval(int interval, TimeUnit unit)
{
if (0 >= interval || INTERVAL_MAX < interval)
{
return false;
}
switch (unit)
{
case HOURS:
break;
case MINUTES:
break;
case SECONDS:
break;
case MILLISECONDS:
break;
default:
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"checkValidInterval",
"(",
"int",
"interval",
",",
"TimeUnit",
"unit",
")",
"{",
"if",
"(",
"0",
">=",
"interval",
"||",
"INTERVAL_MAX",
"<",
"interval",
")",
"{",
"return",
"false",
";",
"}",
"switch",
"(",
"unit",
")",
"{... | 切替インターバルの値が閾値内に収まっているかの確認を行う。<br>
<br>
切替インターバル {@literal 1<= interval <= 100} <br>
切替単位 MillSecond、Second、Minute、Hourのいずれか<br>
@param interval 切替インターバル
@param unit 切替単位
@return 切替インターバルの値が閾値内に収まっているか | [
"切替インターバルの値が閾値内に収まっているかの確認を行う。<br",
">",
"<br",
">",
"切替インターバル",
"{",
"@literal",
"1<",
"=",
"interval",
"<",
"=",
"100",
"}",
"<br",
">",
"切替単位",
"MillSecond、Second、Minute、Hourのいずれか<br",
">"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/util/TimeIntervalFormatUtil.java#L47-L69 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java | EnumHelper.getFromIDCaseInsensitiveOrNull | @Nullable
public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasID <String>> ENUMTYPE getFromIDCaseInsensitiveOrNull (@Nonnull final Class <ENUMTYPE> aClass,
@Nullable final String sID)
{
return getFromIDCaseInsensitiveOrDefault (aClass, sID, null);
} | java | @Nullable
public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasID <String>> ENUMTYPE getFromIDCaseInsensitiveOrNull (@Nonnull final Class <ENUMTYPE> aClass,
@Nullable final String sID)
{
return getFromIDCaseInsensitiveOrDefault (aClass, sID, null);
} | [
"@",
"Nullable",
"public",
"static",
"<",
"ENUMTYPE",
"extends",
"Enum",
"<",
"ENUMTYPE",
">",
"&",
"IHasID",
"<",
"String",
">",
">",
"ENUMTYPE",
"getFromIDCaseInsensitiveOrNull",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"ENUMTYPE",
">",
"aClass",
",",
"... | Get the enum value with the passed string ID case insensitive
@param <ENUMTYPE>
The enum type
@param aClass
The enum class
@param sID
The ID to search
@return <code>null</code> if no enum item with the given ID is present. | [
"Get",
"the",
"enum",
"value",
"with",
"the",
"passed",
"string",
"ID",
"case",
"insensitive"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L172-L177 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java | CPOptionValuePersistenceImpl.fetchByC_K | @Override
public CPOptionValue fetchByC_K(long CPOptionId, String key) {
return fetchByC_K(CPOptionId, key, true);
} | java | @Override
public CPOptionValue fetchByC_K(long CPOptionId, String key) {
return fetchByC_K(CPOptionId, key, true);
} | [
"@",
"Override",
"public",
"CPOptionValue",
"fetchByC_K",
"(",
"long",
"CPOptionId",
",",
"String",
"key",
")",
"{",
"return",
"fetchByC_K",
"(",
"CPOptionId",
",",
"key",
",",
"true",
")",
";",
"}"
] | Returns the cp option value where CPOptionId = ? and key = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param CPOptionId the cp option ID
@param key the key
@return the matching cp option value, or <code>null</code> if a matching cp option value could not be found | [
"Returns",
"the",
"cp",
"option",
"value",
"where",
"CPOptionId",
"=",
"?",
";",
"and",
"key",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"ca... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java#L3060-L3063 |
datoin/http-requests | src/main/java/org/datoin/net/http/Request.java | Request.setContent | public Request setContent(String text, ContentType contentType) {
entity = new StringEntity(text, contentType);
return this;
} | java | public Request setContent(String text, ContentType contentType) {
entity = new StringEntity(text, contentType);
return this;
} | [
"public",
"Request",
"setContent",
"(",
"String",
"text",
",",
"ContentType",
"contentType",
")",
"{",
"entity",
"=",
"new",
"StringEntity",
"(",
"text",
",",
"contentType",
")",
";",
"return",
"this",
";",
"}"
] | set request content from input text string with given content type
@param text : text to be sent as http content
@param contentType : type of content set in header
@return : Request Object with content type header and conetnt entity value set | [
"set",
"request",
"content",
"from",
"input",
"text",
"string",
"with",
"given",
"content",
"type"
] | train | https://github.com/datoin/http-requests/blob/660a4bc516c594f321019df94451fead4dea19b6/src/main/java/org/datoin/net/http/Request.java#L400-L403 |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/adapter/ViewPagerAdapter.java | ViewPagerAdapter.addItem | public final void addItem(@Nullable final CharSequence title,
@NonNull final Class<? extends Fragment> fragmentClass,
@Nullable final Bundle arguments) {
Condition.INSTANCE.ensureNotNull(fragmentClass, "The fragment class may not be null");
items.add(new ViewPagerItem(title, fragmentClass, arguments));
notifyDataSetChanged();
} | java | public final void addItem(@Nullable final CharSequence title,
@NonNull final Class<? extends Fragment> fragmentClass,
@Nullable final Bundle arguments) {
Condition.INSTANCE.ensureNotNull(fragmentClass, "The fragment class may not be null");
items.add(new ViewPagerItem(title, fragmentClass, arguments));
notifyDataSetChanged();
} | [
"public",
"final",
"void",
"addItem",
"(",
"@",
"Nullable",
"final",
"CharSequence",
"title",
",",
"@",
"NonNull",
"final",
"Class",
"<",
"?",
"extends",
"Fragment",
">",
"fragmentClass",
",",
"@",
"Nullable",
"final",
"Bundle",
"arguments",
")",
"{",
"Condi... | Adds a new fragment to the adapter.
@param title
The title of the fragment, which should be added, as an instance of the type {@link
CharSequence} or null, if no title should be set
@param fragmentClass
The class of the fragment, which should be added, as an instance of the class {@link
Class}. The class may not be null
@param arguments
A bundle, which should be passed to the fragment, when it is shown, as an instance of
the class {@link Bundle} or null, if no arguments should be passed to the fragment | [
"Adds",
"a",
"new",
"fragment",
"to",
"the",
"adapter",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/adapter/ViewPagerAdapter.java#L84-L90 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/categories/math.java | math.getRandomDouble | public static double getRandomDouble(double min, double max) {
Random r = new Random();
return min + (max - min) * r.nextDouble();
} | java | public static double getRandomDouble(double min, double max) {
Random r = new Random();
return min + (max - min) * r.nextDouble();
} | [
"public",
"static",
"double",
"getRandomDouble",
"(",
"double",
"min",
",",
"double",
"max",
")",
"{",
"Random",
"r",
"=",
"new",
"Random",
"(",
")",
";",
"return",
"min",
"+",
"(",
"max",
"-",
"min",
")",
"*",
"r",
".",
"nextDouble",
"(",
")",
";"... | Returns a random double between MIN inclusive and MAX inclusive.
@param min
value inclusive
@param max
value inclusive
@return an int between 0 inclusive and MAX exclusive. | [
"Returns",
"a",
"random",
"double",
"between",
"MIN",
"inclusive",
"and",
"MAX",
"inclusive",
"."
] | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/math.java#L125-L128 |
grails/grails-core | grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java | GroovyPagesUriSupport.getDeployedViewURI | public String getDeployedViewURI(String controllerName, String viewName) {
FastStringWriter buf = new FastStringWriter(PATH_TO_VIEWS);
return getViewURIInternal(controllerName, viewName, buf, true);
} | java | public String getDeployedViewURI(String controllerName, String viewName) {
FastStringWriter buf = new FastStringWriter(PATH_TO_VIEWS);
return getViewURIInternal(controllerName, viewName, buf, true);
} | [
"public",
"String",
"getDeployedViewURI",
"(",
"String",
"controllerName",
",",
"String",
"viewName",
")",
"{",
"FastStringWriter",
"buf",
"=",
"new",
"FastStringWriter",
"(",
"PATH_TO_VIEWS",
")",
";",
"return",
"getViewURIInternal",
"(",
"controllerName",
",",
"vi... | Obtains a view URI when deployed within the /WEB-INF/grails-app/views context
@param controllerName The name of the controller
@param viewName The name of the view
@return The view URI | [
"Obtains",
"a",
"view",
"URI",
"when",
"deployed",
"within",
"the",
"/",
"WEB",
"-",
"INF",
"/",
"grails",
"-",
"app",
"/",
"views",
"context"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java#L221-L224 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/convert/BitConverter.java | BitConverter.setState | public int setState(boolean bState, boolean bDisplayOption, int iMoveMode)
{
int iFieldValue = (int)this.getValue();
if (!m_bTrueIfMatch)
bState = !bState; // Do opposite operation
if (bState)
iFieldValue |= (1 << m_iBitNumber); // Set the bit
else
iFieldValue &= ~(1 << m_iBitNumber); // Clear the bit
return this.setValue(iFieldValue, bDisplayOption, iMoveMode);
} | java | public int setState(boolean bState, boolean bDisplayOption, int iMoveMode)
{
int iFieldValue = (int)this.getValue();
if (!m_bTrueIfMatch)
bState = !bState; // Do opposite operation
if (bState)
iFieldValue |= (1 << m_iBitNumber); // Set the bit
else
iFieldValue &= ~(1 << m_iBitNumber); // Clear the bit
return this.setValue(iFieldValue, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setState",
"(",
"boolean",
"bState",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iFieldValue",
"=",
"(",
"int",
")",
"this",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"!",
"m_bTrueIfMatch",
")",
"bState... | For binary fields, set the current state.
Sets the target bit to the state.
@param state The state to set this field.
@param bDisplayOption Display changed fields if true.
@param iMoveMode The move mode.
@return The error code (or NORMAL_RETURN). | [
"For",
"binary",
"fields",
"set",
"the",
"current",
"state",
".",
"Sets",
"the",
"target",
"bit",
"to",
"the",
"state",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/BitConverter.java#L122-L132 |
ixa-ehu/ixa-pipe-ml | src/main/java/eus/ixa/ixa/pipe/ml/parse/Parse.java | Parse.setChild | public void setChild(final int index, final String label) {
final Parse newChild = (Parse) this.parts.get(index).clone();
newChild.setLabel(label);
this.parts.set(index, newChild);
} | java | public void setChild(final int index, final String label) {
final Parse newChild = (Parse) this.parts.get(index).clone();
newChild.setLabel(label);
this.parts.set(index, newChild);
} | [
"public",
"void",
"setChild",
"(",
"final",
"int",
"index",
",",
"final",
"String",
"label",
")",
"{",
"final",
"Parse",
"newChild",
"=",
"(",
"Parse",
")",
"this",
".",
"parts",
".",
"get",
"(",
"index",
")",
".",
"clone",
"(",
")",
";",
"newChild",... | Replaces the child at the specified index with a new child with the
specified label.
@param index
The index of the child to be replaced.
@param label
The label to be assigned to the new child. | [
"Replaces",
"the",
"child",
"at",
"the",
"specified",
"index",
"with",
"a",
"new",
"child",
"with",
"the",
"specified",
"label",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/Parse.java#L542-L546 |
Impetus/Kundera | src/kundera-rethinkdb/src/main/java/com/impetus/client/rethink/RethinkDBClient.java | RethinkDBClient.iterateAndPopulateRmap | private MapObject iterateAndPopulateRmap(Object entity, MetamodelImpl metaModel, Iterator<Attribute> iterator)
{
MapObject map = r.hashMap();
while (iterator.hasNext())
{
Attribute attribute = iterator.next();
Field field = (Field) attribute.getJavaMember();
Object value = PropertyAccessorHelper.getObject(entity, field);
if (field.isAnnotationPresent(Id.class))
{
map.with(ID, value);
}
else
{
map.with(((AbstractAttribute) attribute).getJPAColumnName(), value);
}
}
return map;
} | java | private MapObject iterateAndPopulateRmap(Object entity, MetamodelImpl metaModel, Iterator<Attribute> iterator)
{
MapObject map = r.hashMap();
while (iterator.hasNext())
{
Attribute attribute = iterator.next();
Field field = (Field) attribute.getJavaMember();
Object value = PropertyAccessorHelper.getObject(entity, field);
if (field.isAnnotationPresent(Id.class))
{
map.with(ID, value);
}
else
{
map.with(((AbstractAttribute) attribute).getJPAColumnName(), value);
}
}
return map;
} | [
"private",
"MapObject",
"iterateAndPopulateRmap",
"(",
"Object",
"entity",
",",
"MetamodelImpl",
"metaModel",
",",
"Iterator",
"<",
"Attribute",
">",
"iterator",
")",
"{",
"MapObject",
"map",
"=",
"r",
".",
"hashMap",
"(",
")",
";",
"while",
"(",
"iterator",
... | Iterate and populate rmap.
@param entity
the entity
@param metaModel
the meta model
@param iterator
the iterator
@return the map object | [
"Iterate",
"and",
"populate",
"rmap",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rethinkdb/src/main/java/com/impetus/client/rethink/RethinkDBClient.java#L347-L365 |
census-instrumentation/opencensus-java | impl_core/src/main/java/io/opencensus/implcore/internal/VarInt.java | VarInt.putVarLong | public static void putVarLong(long v, ByteBuffer sink) {
while (true) {
int bits = ((int) v) & 0x7f;
v >>>= 7;
if (v == 0) {
sink.put((byte) bits);
return;
}
sink.put((byte) (bits | 0x80));
}
} | java | public static void putVarLong(long v, ByteBuffer sink) {
while (true) {
int bits = ((int) v) & 0x7f;
v >>>= 7;
if (v == 0) {
sink.put((byte) bits);
return;
}
sink.put((byte) (bits | 0x80));
}
} | [
"public",
"static",
"void",
"putVarLong",
"(",
"long",
"v",
",",
"ByteBuffer",
"sink",
")",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"bits",
"=",
"(",
"(",
"int",
")",
"v",
")",
"&",
"0x7f",
";",
"v",
">>>=",
"7",
";",
"if",
"(",
"v",
"==",
... | Encodes a long integer in a variable-length encoding, 7 bits per byte, to a ByteBuffer sink.
@param v the value to encode
@param sink the ByteBuffer to add the encoded value | [
"Encodes",
"a",
"long",
"integer",
"in",
"a",
"variable",
"-",
"length",
"encoding",
"7",
"bits",
"per",
"byte",
"to",
"a",
"ByteBuffer",
"sink",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/impl_core/src/main/java/io/opencensus/implcore/internal/VarInt.java#L272-L282 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/parser/apdu/impl/AbstractByteBean.java | AbstractByteBean.setField | protected void setField(final Field field, final IFile pData, final Object pValue) {
if (field != null) {
try {
field.set(pData, pValue);
} catch (IllegalArgumentException e) {
LOGGER.error("Parameters of fied.set are not valid", e);
} catch (IllegalAccessException e) {
LOGGER.error("Impossible to set the Field :" + field.getName(), e);
}
}
} | java | protected void setField(final Field field, final IFile pData, final Object pValue) {
if (field != null) {
try {
field.set(pData, pValue);
} catch (IllegalArgumentException e) {
LOGGER.error("Parameters of fied.set are not valid", e);
} catch (IllegalAccessException e) {
LOGGER.error("Impossible to set the Field :" + field.getName(), e);
}
}
} | [
"protected",
"void",
"setField",
"(",
"final",
"Field",
"field",
",",
"final",
"IFile",
"pData",
",",
"final",
"Object",
"pValue",
")",
"{",
"if",
"(",
"field",
"!=",
"null",
")",
"{",
"try",
"{",
"field",
".",
"set",
"(",
"pData",
",",
"pValue",
")"... | Method used to set the value of a field
@param field
the field to set
@param pData
Object containing the field
@param pValue
the value of the field | [
"Method",
"used",
"to",
"set",
"the",
"value",
"of",
"a",
"field"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/apdu/impl/AbstractByteBean.java#L113-L123 |
nakamura5akihito/six-util | src/main/java/jp/go/aist/six/util/search/RelationalBinding.java | RelationalBinding.equalBinding | public static RelationalBinding equalBinding(
final String property,
final Object value
)
{
return (new RelationalBinding( property, Relation.EQUAL, value ));
} | java | public static RelationalBinding equalBinding(
final String property,
final Object value
)
{
return (new RelationalBinding( property, Relation.EQUAL, value ));
} | [
"public",
"static",
"RelationalBinding",
"equalBinding",
"(",
"final",
"String",
"property",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"(",
"new",
"RelationalBinding",
"(",
"property",
",",
"Relation",
".",
"EQUAL",
",",
"value",
")",
")",
";",
"}... | Creates an 'EQUAL' binding.
@param property
the property.
@param value
the value to which the property should be related.
@return
an 'EQUAL' binding. | [
"Creates",
"an",
"EQUAL",
"binding",
"."
] | train | https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/search/RelationalBinding.java#L50-L56 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java | PubSubManager.getNode | public Node getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotAPubSubNodeException {
Node node = nodeMap.get(id);
if (node == null) {
DiscoverInfo info = new DiscoverInfo();
info.setTo(pubSubService);
info.setNode(id);
DiscoverInfo infoReply = connection().createStanzaCollectorAndSend(info).nextResultOrThrow();
if (infoReply.hasIdentity(PubSub.ELEMENT, "leaf")) {
node = new LeafNode(this, id);
}
else if (infoReply.hasIdentity(PubSub.ELEMENT, "collection")) {
node = new CollectionNode(this, id);
}
else {
throw new PubSubException.NotAPubSubNodeException(id, infoReply);
}
nodeMap.put(id, node);
}
return node;
} | java | public Node getNode(String id) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotAPubSubNodeException {
Node node = nodeMap.get(id);
if (node == null) {
DiscoverInfo info = new DiscoverInfo();
info.setTo(pubSubService);
info.setNode(id);
DiscoverInfo infoReply = connection().createStanzaCollectorAndSend(info).nextResultOrThrow();
if (infoReply.hasIdentity(PubSub.ELEMENT, "leaf")) {
node = new LeafNode(this, id);
}
else if (infoReply.hasIdentity(PubSub.ELEMENT, "collection")) {
node = new CollectionNode(this, id);
}
else {
throw new PubSubException.NotAPubSubNodeException(id, infoReply);
}
nodeMap.put(id, node);
}
return node;
} | [
"public",
"Node",
"getNode",
"(",
"String",
"id",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
",",
"NotAPubSubNodeException",
"{",
"Node",
"node",
"=",
"nodeMap",
".",
"get",
"(",
"id",
... | Retrieves the requested node, if it exists. It will throw an
exception if it does not.
@param id - The unique id of the node
@return the node
@throws XMPPErrorException The node does not exist
@throws NoResponseException if there was no response from the server.
@throws NotConnectedException
@throws InterruptedException
@throws NotAPubSubNodeException | [
"Retrieves",
"the",
"requested",
"node",
"if",
"it",
"exists",
".",
"It",
"will",
"throw",
"an",
"exception",
"if",
"it",
"does",
"not",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java#L270-L292 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/lexinduct/vote/VotingLexiconInduction.java | VotingLexiconInduction.createParser | private static ParserInfo createParser(LexiconInductionCcgParserFactory factory,
SufficientStatistics currentParameters, Collection<LexiconEntry> currentLexicon) {
ParametricCcgParser family = factory.getParametricCcgParser(currentLexicon);
SufficientStatistics newParameters = family.getNewSufficientStatistics();
if (currentParameters != null) {
newParameters.transferParameters(currentParameters);
}
return new ParserInfo(currentLexicon, family, newParameters, family.getModelFromParameters(newParameters));
} | java | private static ParserInfo createParser(LexiconInductionCcgParserFactory factory,
SufficientStatistics currentParameters, Collection<LexiconEntry> currentLexicon) {
ParametricCcgParser family = factory.getParametricCcgParser(currentLexicon);
SufficientStatistics newParameters = family.getNewSufficientStatistics();
if (currentParameters != null) {
newParameters.transferParameters(currentParameters);
}
return new ParserInfo(currentLexicon, family, newParameters, family.getModelFromParameters(newParameters));
} | [
"private",
"static",
"ParserInfo",
"createParser",
"(",
"LexiconInductionCcgParserFactory",
"factory",
",",
"SufficientStatistics",
"currentParameters",
",",
"Collection",
"<",
"LexiconEntry",
">",
"currentLexicon",
")",
"{",
"ParametricCcgParser",
"family",
"=",
"factory",... | Creates a CCG parser given parameters and a lexicon.
@param factory
@param currentParameters
@param currentLexicon
@return | [
"Creates",
"a",
"CCG",
"parser",
"given",
"parameters",
"and",
"a",
"lexicon",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lexinduct/vote/VotingLexiconInduction.java#L179-L189 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.setSharedKey | public ConnectionSharedKeyInner setSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKeyInner parameters) {
return setSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).toBlocking().last().body();
} | java | public ConnectionSharedKeyInner setSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKeyInner parameters) {
return setSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).toBlocking().last().body();
} | [
"public",
"ConnectionSharedKeyInner",
"setSharedKey",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"ConnectionSharedKeyInner",
"parameters",
")",
"{",
"return",
"setSharedKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
","... | The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The virtual network gateway connection name.
@param parameters Parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation throughNetwork resource provider.
@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 ConnectionSharedKeyInner object if successful. | [
"The",
"Put",
"VirtualNetworkGatewayConnectionSharedKey",
"operation",
"sets",
"the",
"virtual",
"network",
"gateway",
"connection",
"shared",
"key",
"for",
"passed",
"virtual",
"network",
"gateway",
"connection",
"in",
"the",
"specified",
"resource",
"group",
"through"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L856-L858 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java | ElementPlugin.unregisterListener | public void unregisterListener(IPluginEventListener listener) {
if (pluginEventListeners2 != null && pluginEventListeners2.contains(listener)) {
pluginEventListeners2.remove(listener);
listener.onPluginEvent(new PluginEvent(this, PluginAction.UNSUBSCRIBE));
}
} | java | public void unregisterListener(IPluginEventListener listener) {
if (pluginEventListeners2 != null && pluginEventListeners2.contains(listener)) {
pluginEventListeners2.remove(listener);
listener.onPluginEvent(new PluginEvent(this, PluginAction.UNSUBSCRIBE));
}
} | [
"public",
"void",
"unregisterListener",
"(",
"IPluginEventListener",
"listener",
")",
"{",
"if",
"(",
"pluginEventListeners2",
"!=",
"null",
"&&",
"pluginEventListeners2",
".",
"contains",
"(",
"listener",
")",
")",
"{",
"pluginEventListeners2",
".",
"remove",
"(",
... | Unregisters a listener for the IPluginEvent callback event.
@param listener Listener to be unregistered. | [
"Unregisters",
"a",
"listener",
"for",
"the",
"IPluginEvent",
"callback",
"event",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java#L690-L695 |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/api/Configuration.java | Configuration.getList | public List<String> getList(String key) {
if (!containsKey(key)) {
throw new IllegalArgumentException("Missing key " + key + ".");
}
return getList(key, null);
} | java | public List<String> getList(String key) {
if (!containsKey(key)) {
throw new IllegalArgumentException("Missing key " + key + ".");
}
return getList(key, null);
} | [
"public",
"List",
"<",
"String",
">",
"getList",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"!",
"containsKey",
"(",
"key",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Missing key \"",
"+",
"key",
"+",
"\".\"",
")",
";",
"}",
"re... | Gets the string list value <code>key</code>.
@param key key to get value for
@throws java.lang.IllegalArgumentException if the key is not found
@return value | [
"Gets",
"the",
"string",
"list",
"value",
"<code",
">",
"key<",
"/",
"code",
">",
"."
] | train | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/api/Configuration.java#L365-L370 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/FeatureResolverImpl.java | FeatureResolverImpl.resolveFeatures | @Override
public Result resolveFeatures(Repository repository, Collection<ProvisioningFeatureDefinition> kernelFeatures, Collection<String> rootFeatures, Set<String> preResolved,
boolean allowMultipleVersions,
EnumSet<ProcessType> supportedProcessTypes) {
SelectionContext selectionContext = new SelectionContext(repository, allowMultipleVersions, supportedProcessTypes);
// this checks if the pre-resolved exists in the repo;
// if one does not exist then we start over with an empty set of pre-resolved
preResolved = checkPreResolvedExistAndSetFullName(preResolved, selectionContext);
// check that the root features exist and are public; remove them if not; also get the full name
rootFeatures = checkRootsAreAccessibleAndSetFullName(new ArrayList<String>(rootFeatures), selectionContext, preResolved);
// Always prime the selected with the pre-resolved and the root features.
// This will ensure that the root and pre-resolved features do not conflict
selectionContext.primeSelected(preResolved);
selectionContext.primeSelected(rootFeatures);
// Even if the feature set hasn't changed, we still need to process the auto features and add any features that need to be
// installed/uninstalled to the list. This recursively iterates over the auto Features, as previously installed features
// may satisfy other auto features.
Set<String> autoFeaturesToInstall = Collections.<String> emptySet();
Set<String> seenAutoFeatures = new HashSet<String>();
Set<String> resolved = Collections.emptySet();
do {
if (!!!autoFeaturesToInstall.isEmpty()) {
// this is after the first pass; use the autoFeaturesToInstall as the roots
rootFeatures = autoFeaturesToInstall;
// Need to prime the auto features as selected
selectionContext.primeSelected(autoFeaturesToInstall);
// and use the resolved as the preResolved
preResolved = resolved;
// A new resolution process will happen now along with the auto-features that match;
// need to save off the current conflicts to be the pre resolved conflicts
// otherwise they would get lost
selectionContext.saveCurrentPreResolvedConflicts();
}
resolved = doResolveFeatures(rootFeatures, preResolved, selectionContext);
} while (!!!(autoFeaturesToInstall = processAutoFeatures(kernelFeatures, resolved, seenAutoFeatures, selectionContext)).isEmpty());
// Finally return the selected result
return selectionContext.getResult();
} | java | @Override
public Result resolveFeatures(Repository repository, Collection<ProvisioningFeatureDefinition> kernelFeatures, Collection<String> rootFeatures, Set<String> preResolved,
boolean allowMultipleVersions,
EnumSet<ProcessType> supportedProcessTypes) {
SelectionContext selectionContext = new SelectionContext(repository, allowMultipleVersions, supportedProcessTypes);
// this checks if the pre-resolved exists in the repo;
// if one does not exist then we start over with an empty set of pre-resolved
preResolved = checkPreResolvedExistAndSetFullName(preResolved, selectionContext);
// check that the root features exist and are public; remove them if not; also get the full name
rootFeatures = checkRootsAreAccessibleAndSetFullName(new ArrayList<String>(rootFeatures), selectionContext, preResolved);
// Always prime the selected with the pre-resolved and the root features.
// This will ensure that the root and pre-resolved features do not conflict
selectionContext.primeSelected(preResolved);
selectionContext.primeSelected(rootFeatures);
// Even if the feature set hasn't changed, we still need to process the auto features and add any features that need to be
// installed/uninstalled to the list. This recursively iterates over the auto Features, as previously installed features
// may satisfy other auto features.
Set<String> autoFeaturesToInstall = Collections.<String> emptySet();
Set<String> seenAutoFeatures = new HashSet<String>();
Set<String> resolved = Collections.emptySet();
do {
if (!!!autoFeaturesToInstall.isEmpty()) {
// this is after the first pass; use the autoFeaturesToInstall as the roots
rootFeatures = autoFeaturesToInstall;
// Need to prime the auto features as selected
selectionContext.primeSelected(autoFeaturesToInstall);
// and use the resolved as the preResolved
preResolved = resolved;
// A new resolution process will happen now along with the auto-features that match;
// need to save off the current conflicts to be the pre resolved conflicts
// otherwise they would get lost
selectionContext.saveCurrentPreResolvedConflicts();
}
resolved = doResolveFeatures(rootFeatures, preResolved, selectionContext);
} while (!!!(autoFeaturesToInstall = processAutoFeatures(kernelFeatures, resolved, seenAutoFeatures, selectionContext)).isEmpty());
// Finally return the selected result
return selectionContext.getResult();
} | [
"@",
"Override",
"public",
"Result",
"resolveFeatures",
"(",
"Repository",
"repository",
",",
"Collection",
"<",
"ProvisioningFeatureDefinition",
">",
"kernelFeatures",
",",
"Collection",
"<",
"String",
">",
"rootFeatures",
",",
"Set",
"<",
"String",
">",
"preResolv... | /*
(non-Javadoc)
@see com.ibm.ws.kernel.feature.resolver.FeatureResolver#resolveFeatures(com.ibm.ws.kernel.feature.resolver.FeatureResolver.Repository, java.util.Collection,
java.util.Collection, java.util.Set,
boolean, java.util.EnumSet)
Here are the steps this uses to resolve:
1) Primes the selected features with the pre-resolved and the root features (conflicts are reported, but no permutations for backtracking)
2) Resolve the root features
3) Check if there are any auto features to resolve; if so return to step 2 and resolve the auto-features as root features | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/FeatureResolverImpl.java#L124-L166 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateIntegrationResult.java | UpdateIntegrationResult.withRequestParameters | public UpdateIntegrationResult withRequestParameters(java.util.Map<String, String> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | java | public UpdateIntegrationResult withRequestParameters(java.util.Map<String, String> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | [
"public",
"UpdateIntegrationResult",
"withRequestParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestParameters",
")",
"{",
"setRequestParameters",
"(",
"requestParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A key-value map specifying request parameters that are passed from the method request to the backend. The key is
an integration request parameter name and the associated value is a method request parameter value or static
value that must be enclosed within single quotes and pre-encoded as required by the backend. The method request
parameter value must match the pattern of method.request.{location}.{name} , where {location} is querystring,
path, or header; and {name} must be a valid and unique method request parameter name.
</p>
@param requestParameters
A key-value map specifying request parameters that are passed from the method request to the backend. The
key is an integration request parameter name and the associated value is a method request parameter value
or static value that must be enclosed within single quotes and pre-encoded as required by the backend. The
method request parameter value must match the pattern of method.request.{location}.{name} , where
{location} is querystring, path, or header; and {name} must be a valid and unique method request parameter
name.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"key",
"-",
"value",
"map",
"specifying",
"request",
"parameters",
"that",
"are",
"passed",
"from",
"the",
"method",
"request",
"to",
"the",
"backend",
".",
"The",
"key",
"is",
"an",
"integration",
"request",
"parameter",
"name",
"and",
"th... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateIntegrationResult.java#L1146-L1149 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailArchiver.java | MailArchiver.archiveMessage | public File archiveMessage(final MailMessage message) {
try {
String subject = message.getSubject();
String fileName = subject == null
? "no_subject"
: INVALID_FILE_NAME_CHARS.matcher(subject).replaceAll("_");
MutableInt counter = counterProvider.get();
File dir = new File("e-mails", "unread");
File file = new File(dir, String.format(FILE_NAME_FORMAT, counter.intValue(), fileName));
file = new File(moduleArchiveDirProvider.get(), file.getPath());
createParentDirs(file);
log.debug("Archiving e-mail: {}", file);
StrBuilder sb = new StrBuilder(500);
for (Entry<String, String> header : message.getHeaders().entries()) {
sb.append(header.getKey()).append('=').appendln(header.getValue());
}
sb.appendln("");
sb.append(message.getText());
write(sb.toString(), file, Charsets.UTF_8);
counter.increment();
return file;
} catch (IOException ex) {
throw new MailException("Error archiving mail.", ex);
}
} | java | public File archiveMessage(final MailMessage message) {
try {
String subject = message.getSubject();
String fileName = subject == null
? "no_subject"
: INVALID_FILE_NAME_CHARS.matcher(subject).replaceAll("_");
MutableInt counter = counterProvider.get();
File dir = new File("e-mails", "unread");
File file = new File(dir, String.format(FILE_NAME_FORMAT, counter.intValue(), fileName));
file = new File(moduleArchiveDirProvider.get(), file.getPath());
createParentDirs(file);
log.debug("Archiving e-mail: {}", file);
StrBuilder sb = new StrBuilder(500);
for (Entry<String, String> header : message.getHeaders().entries()) {
sb.append(header.getKey()).append('=').appendln(header.getValue());
}
sb.appendln("");
sb.append(message.getText());
write(sb.toString(), file, Charsets.UTF_8);
counter.increment();
return file;
} catch (IOException ex) {
throw new MailException("Error archiving mail.", ex);
}
} | [
"public",
"File",
"archiveMessage",
"(",
"final",
"MailMessage",
"message",
")",
"{",
"try",
"{",
"String",
"subject",
"=",
"message",
".",
"getSubject",
"(",
")",
";",
"String",
"fileName",
"=",
"subject",
"==",
"null",
"?",
"\"no_subject\"",
":",
"INVALID_... | Saves a message's test content (including headers) in the current module archive in the specified sub-directory relative to
the archive root. File names are prefixed with a left-padded four-digit integer counter (format: {@code %04d_%s.txt}).
@param message
the message
@return the file the e-mail was written to | [
"Saves",
"a",
"message",
"s",
"test",
"content",
"(",
"including",
"headers",
")",
"in",
"the",
"current",
"module",
"archive",
"in",
"the",
"specified",
"sub",
"-",
"directory",
"relative",
"to",
"the",
"archive",
"root",
".",
"File",
"names",
"are",
"pre... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailArchiver.java#L69-L97 |
Coveros/selenified | src/main/java/com/coveros/selenified/application/WaitFor.java | WaitFor.promptEquals | public void promptEquals(double seconds, String expectedPromptText) {
try {
double timeTook = popup(seconds);
timeTook = popupEquals(seconds - timeTook, expectedPromptText);
checkPromptEquals(expectedPromptText, seconds, timeTook);
} catch (TimeoutException e) {
checkPromptEquals(expectedPromptText, seconds, seconds);
}
} | java | public void promptEquals(double seconds, String expectedPromptText) {
try {
double timeTook = popup(seconds);
timeTook = popupEquals(seconds - timeTook, expectedPromptText);
checkPromptEquals(expectedPromptText, seconds, timeTook);
} catch (TimeoutException e) {
checkPromptEquals(expectedPromptText, seconds, seconds);
}
} | [
"public",
"void",
"promptEquals",
"(",
"double",
"seconds",
",",
"String",
"expectedPromptText",
")",
"{",
"try",
"{",
"double",
"timeTook",
"=",
"popup",
"(",
"seconds",
")",
";",
"timeTook",
"=",
"popupEquals",
"(",
"seconds",
"-",
"timeTook",
",",
"expect... | Waits up to the provided wait time for a prompt present on the page has content equal to the
expected text. This information will be logged and recorded, with a
screenshot for traceability and added debugging support.
@param expectedPromptText the expected text of the prompt
@param seconds the number of seconds to wait | [
"Waits",
"up",
"to",
"the",
"provided",
"wait",
"time",
"for",
"a",
"prompt",
"present",
"on",
"the",
"page",
"has",
"content",
"equal",
"to",
"the",
"expected",
"text",
".",
"This",
"information",
"will",
"be",
"logged",
"and",
"recorded",
"with",
"a",
... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L628-L636 |
javalite/activeweb | activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java | HttpSupport.sendFile | protected HttpBuilder sendFile(File file, boolean delete) throws FileNotFoundException {
try{
FileResponse resp = new FileResponse(file, delete);
RequestContext.setControllerResponse(resp);
HttpBuilder builder = new HttpBuilder(resp);
builder.header("Content-Disposition", "attachment; filename=" + file.getName());
return builder;
}catch(Exception e){
throw new ControllerException(e);
}
} | java | protected HttpBuilder sendFile(File file, boolean delete) throws FileNotFoundException {
try{
FileResponse resp = new FileResponse(file, delete);
RequestContext.setControllerResponse(resp);
HttpBuilder builder = new HttpBuilder(resp);
builder.header("Content-Disposition", "attachment; filename=" + file.getName());
return builder;
}catch(Exception e){
throw new ControllerException(e);
}
} | [
"protected",
"HttpBuilder",
"sendFile",
"(",
"File",
"file",
",",
"boolean",
"delete",
")",
"throws",
"FileNotFoundException",
"{",
"try",
"{",
"FileResponse",
"resp",
"=",
"new",
"FileResponse",
"(",
"file",
",",
"delete",
")",
";",
"RequestContext",
".",
"se... | Convenience method for downloading files. This method will force the browser to find a handler(external program)
for this file (content type) and will provide a name of file to the browser. This method sets an HTTP header
"Content-Disposition" based on a file name.
@param file file to download.
@param delete true to delete the file after processing
@return builder instance.
@throws FileNotFoundException thrown if file not found. | [
"Convenience",
"method",
"for",
"downloading",
"files",
".",
"This",
"method",
"will",
"force",
"the",
"browser",
"to",
"find",
"a",
"handler",
"(",
"external",
"program",
")",
"for",
"this",
"file",
"(",
"content",
"type",
")",
"and",
"will",
"provide",
"... | train | https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L520-L530 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/QueryBuilder.java | QueryBuilder.getCachedQuery | public CachedInstanceQuery getCachedQuery(final String _key)
{
if (this.query == null) {
try {
this.query = new CachedInstanceQuery(_key, this.typeUUID)
.setIncludeChildTypes(isIncludeChildTypes())
.setCompanyDependent(isCompanyDependent());
prepareQuery();
} catch (final EFapsException e) {
QueryBuilder.LOG.error("Could not open InstanceQuery for uuid: {}", this.typeUUID);
}
}
return (CachedInstanceQuery) this.query;
} | java | public CachedInstanceQuery getCachedQuery(final String _key)
{
if (this.query == null) {
try {
this.query = new CachedInstanceQuery(_key, this.typeUUID)
.setIncludeChildTypes(isIncludeChildTypes())
.setCompanyDependent(isCompanyDependent());
prepareQuery();
} catch (final EFapsException e) {
QueryBuilder.LOG.error("Could not open InstanceQuery for uuid: {}", this.typeUUID);
}
}
return (CachedInstanceQuery) this.query;
} | [
"public",
"CachedInstanceQuery",
"getCachedQuery",
"(",
"final",
"String",
"_key",
")",
"{",
"if",
"(",
"this",
".",
"query",
"==",
"null",
")",
"{",
"try",
"{",
"this",
".",
"query",
"=",
"new",
"CachedInstanceQuery",
"(",
"_key",
",",
"this",
".",
"typ... | Get the constructed query.
@param _key key to the Query Cache
@return the query | [
"Get",
"the",
"constructed",
"query",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/QueryBuilder.java#L989-L1002 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java | WriteFileExtensions.readSourceFileAndWriteDestFile | public static void readSourceFileAndWriteDestFile(final String srcfile, final String destFile)
throws IOException
{
try (FileInputStream fis = new FileInputStream(srcfile);
FileOutputStream fos = new FileOutputStream(destFile);
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos);)
{
final int availableLength = bis.available();
final byte[] totalBytes = new byte[availableLength];
bis.read(totalBytes, 0, availableLength);
bos.write(totalBytes, 0, availableLength);
}
} | java | public static void readSourceFileAndWriteDestFile(final String srcfile, final String destFile)
throws IOException
{
try (FileInputStream fis = new FileInputStream(srcfile);
FileOutputStream fos = new FileOutputStream(destFile);
BufferedInputStream bis = new BufferedInputStream(fis);
BufferedOutputStream bos = new BufferedOutputStream(fos);)
{
final int availableLength = bis.available();
final byte[] totalBytes = new byte[availableLength];
bis.read(totalBytes, 0, availableLength);
bos.write(totalBytes, 0, availableLength);
}
} | [
"public",
"static",
"void",
"readSourceFileAndWriteDestFile",
"(",
"final",
"String",
"srcfile",
",",
"final",
"String",
"destFile",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"srcfile",
")",
";",
... | Writes the source file with the best performance to the destination file.
@param srcfile
The source file.
@param destFile
The destination file.
@throws IOException
Signals that an I/O exception has occurred. | [
"Writes",
"the",
"source",
"file",
"with",
"the",
"best",
"performance",
"to",
"the",
"destination",
"file",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L389-L402 |
apache/groovy | subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java | TemplateServlet.getTemplate | protected Template getTemplate(File file) throws ServletException {
String key = file.getAbsolutePath();
Template template = findCachedTemplate(key, file);
//
// Template not cached or the source file changed - compile new template!
//
if (template == null) {
try {
template = createAndStoreTemplate(key, new FileInputStream(file), file);
} catch (Exception e) {
throw new ServletException("Creation of template failed: " + e, e);
}
}
return template;
} | java | protected Template getTemplate(File file) throws ServletException {
String key = file.getAbsolutePath();
Template template = findCachedTemplate(key, file);
//
// Template not cached or the source file changed - compile new template!
//
if (template == null) {
try {
template = createAndStoreTemplate(key, new FileInputStream(file), file);
} catch (Exception e) {
throw new ServletException("Creation of template failed: " + e, e);
}
}
return template;
} | [
"protected",
"Template",
"getTemplate",
"(",
"File",
"file",
")",
"throws",
"ServletException",
"{",
"String",
"key",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"Template",
"template",
"=",
"findCachedTemplate",
"(",
"key",
",",
"file",
")",
";",
"/... | Gets the template created by the underlying engine parsing the request.
<p>
This method looks up a simple (weak) hash map for an existing template
object that matches the source file. If the source file didn't change in
length and its last modified stamp hasn't changed compared to a precompiled
template object, this template is used. Otherwise, there is no or an
invalid template object cache entry, a new one is created by the underlying
template engine. This new instance is put to the cache for consecutive
calls.
@return The template that will produce the response text.
@param file The file containing the template source.
@throws ServletException If the request specified an invalid template source file | [
"Gets",
"the",
"template",
"created",
"by",
"the",
"underlying",
"engine",
"parsing",
"the",
"request",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java#L294-L310 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java | OAuthActivity.createOAuthActivityIntent | public static Intent createOAuthActivityIntent(final Context context, final String clientId, final String clientSecret, String redirectUrl, boolean loginViaBoxApp) {
Intent intent = new Intent(context, OAuthActivity.class);
intent.putExtra(BoxConstants.KEY_CLIENT_ID, clientId);
intent.putExtra(BoxConstants.KEY_CLIENT_SECRET, clientSecret);
if (!SdkUtils.isEmptyString(redirectUrl)) {
intent.putExtra(BoxConstants.KEY_REDIRECT_URL, redirectUrl);
}
intent.putExtra(LOGIN_VIA_BOX_APP, loginViaBoxApp);
return intent;
} | java | public static Intent createOAuthActivityIntent(final Context context, final String clientId, final String clientSecret, String redirectUrl, boolean loginViaBoxApp) {
Intent intent = new Intent(context, OAuthActivity.class);
intent.putExtra(BoxConstants.KEY_CLIENT_ID, clientId);
intent.putExtra(BoxConstants.KEY_CLIENT_SECRET, clientSecret);
if (!SdkUtils.isEmptyString(redirectUrl)) {
intent.putExtra(BoxConstants.KEY_REDIRECT_URL, redirectUrl);
}
intent.putExtra(LOGIN_VIA_BOX_APP, loginViaBoxApp);
return intent;
} | [
"public",
"static",
"Intent",
"createOAuthActivityIntent",
"(",
"final",
"Context",
"context",
",",
"final",
"String",
"clientId",
",",
"final",
"String",
"clientSecret",
",",
"String",
"redirectUrl",
",",
"boolean",
"loginViaBoxApp",
")",
"{",
"Intent",
"intent",
... | Create intent to launch OAuthActivity. Notes about redirect url parameter: If you already set redirect url in <a
href="https://cloud.app.box.com/developers/services">box dev console</a>, you should pass in the same redirect url or use null for redirect url. If you
didn't set it in box dev console, you should pass in a url. In case you don't have a redirect server you can simply use "http://localhost".
@param context
context
@param clientId
your box client id
@param clientSecret
your box client secret
@param redirectUrl
redirect url, if you already set redirect url in <a href="https://cloud.app.box.com/developers/services">box dev console</a>, leave this null
or use the same url, otherwise this field is required. You can use "http://localhost" if you don't have a redirect server.
@param loginViaBoxApp Whether login should be handled by the installed box android app. Set this to true only when you are sure or want
to make sure user installed box android app and want to use box android app to login.
@return intent to launch OAuthActivity. | [
"Create",
"intent",
"to",
"launch",
"OAuthActivity",
".",
"Notes",
"about",
"redirect",
"url",
"parameter",
":",
"If",
"you",
"already",
"set",
"redirect",
"url",
"in",
"<a",
"href",
"=",
"https",
":",
"//",
"cloud",
".",
"app",
".",
"box",
".",
"com",
... | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L519-L528 |
xqbase/util | util/src/main/java/com/xqbase/util/Bytes.java | Bytes.setInt | public static void setInt(int n, byte[] b, int off, boolean littleEndian) {
if (littleEndian) {
b[off] = (byte) n;
b[off + 1] = (byte) (n >>> 8);
b[off + 2] = (byte) (n >>> 16);
b[off + 3] = (byte) (n >>> 24);
} else {
b[off] = (byte) (n >>> 24);
b[off + 1] = (byte) (n >>> 16);
b[off + 2] = (byte) (n >>> 8);
b[off + 3] = (byte) n;
}
} | java | public static void setInt(int n, byte[] b, int off, boolean littleEndian) {
if (littleEndian) {
b[off] = (byte) n;
b[off + 1] = (byte) (n >>> 8);
b[off + 2] = (byte) (n >>> 16);
b[off + 3] = (byte) (n >>> 24);
} else {
b[off] = (byte) (n >>> 24);
b[off + 1] = (byte) (n >>> 16);
b[off + 2] = (byte) (n >>> 8);
b[off + 3] = (byte) n;
}
} | [
"public",
"static",
"void",
"setInt",
"(",
"int",
"n",
",",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"boolean",
"littleEndian",
")",
"{",
"if",
"(",
"littleEndian",
")",
"{",
"b",
"[",
"off",
"]",
"=",
"(",
"byte",
")",
"n",
";",
"b",
"["... | Store an <b>int</b> number into a byte array in a given byte order | [
"Store",
"an",
"<b",
">",
"int<",
"/",
"b",
">",
"number",
"into",
"a",
"byte",
"array",
"in",
"a",
"given",
"byte",
"order"
] | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Bytes.java#L136-L148 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.isGeneral | public static boolean isGeneral(CharSequence value, int min, int max) {
String reg = "^\\w{" + min + "," + max + "}$";
if (min < 0) {
min = 0;
}
if (max <= 0) {
reg = "^\\w{" + min + ",}$";
}
return isMactchRegex(reg, value);
} | java | public static boolean isGeneral(CharSequence value, int min, int max) {
String reg = "^\\w{" + min + "," + max + "}$";
if (min < 0) {
min = 0;
}
if (max <= 0) {
reg = "^\\w{" + min + ",}$";
}
return isMactchRegex(reg, value);
} | [
"public",
"static",
"boolean",
"isGeneral",
"(",
"CharSequence",
"value",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"String",
"reg",
"=",
"\"^\\\\w{\"",
"+",
"min",
"+",
"\",\"",
"+",
"max",
"+",
"\"}$\"",
";",
"if",
"(",
"min",
"<",
"0",
")",
... | 验证是否为给定长度范围的英文字母 、数字和下划线
@param value 值
@param min 最小长度,负数自动识别为0
@param max 最大长度,0或负数表示不限制最大长度
@return 是否为给定长度范围的英文字母 、数字和下划线 | [
"验证是否为给定长度范围的英文字母",
"、数字和下划线"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L373-L382 |
SeaCloudsEU/SeaCloudsPlatform | discoverer/src/main/java/eu/seaclouds/platform/discoverer/core/OfferingManager.java | OfferingManager.removeOffering | public boolean removeOffering(String offeringName) {
if(offeringName == null)
throw new NullPointerException("The parameter \"cloudOfferingId\" cannot be null.");
BasicDBObject query = new BasicDBObject("offering_name", offeringName);
Document removedOffering = this.offeringsCollection.findOneAndDelete(query);
return removedOffering != null;
} | java | public boolean removeOffering(String offeringName) {
if(offeringName == null)
throw new NullPointerException("The parameter \"cloudOfferingId\" cannot be null.");
BasicDBObject query = new BasicDBObject("offering_name", offeringName);
Document removedOffering = this.offeringsCollection.findOneAndDelete(query);
return removedOffering != null;
} | [
"public",
"boolean",
"removeOffering",
"(",
"String",
"offeringName",
")",
"{",
"if",
"(",
"offeringName",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"The parameter \\\"cloudOfferingId\\\" cannot be null.\"",
")",
";",
"BasicDBObject",
"query",
"=... | Remove an offering
@param offeringName the name of the offering to remove
@return | [
"Remove",
"an",
"offering"
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/discoverer/src/main/java/eu/seaclouds/platform/discoverer/core/OfferingManager.java#L78-L86 |
brettonw/Bag | src/main/java/com/brettonw/bag/Serializer.java | Serializer.fromBagAsType | public static <WorkingType> WorkingType fromBagAsType (Bag bag, Class type) {
return (bag != null) ? (WorkingType) deserialize (type.getName (), bag) : null;
} | java | public static <WorkingType> WorkingType fromBagAsType (Bag bag, Class type) {
return (bag != null) ? (WorkingType) deserialize (type.getName (), bag) : null;
} | [
"public",
"static",
"<",
"WorkingType",
">",
"WorkingType",
"fromBagAsType",
"(",
"Bag",
"bag",
",",
"Class",
"type",
")",
"{",
"return",
"(",
"bag",
"!=",
"null",
")",
"?",
"(",
"WorkingType",
")",
"deserialize",
"(",
"type",
".",
"getName",
"(",
")",
... | Reconstitute the given BagObject representation back to the object it represents, using a
"best-effort" approach to matching the fields of the BagObject to the class being initialized.
@param bag The input data to reconstruct from, either a BagObject or BagArray
@param type the Class representing the type to reconstruct
@return the reconstituted object, or null if the reconstitution failed. | [
"Reconstitute",
"the",
"given",
"BagObject",
"representation",
"back",
"to",
"the",
"object",
"it",
"represents",
"using",
"a",
"best",
"-",
"effort",
"approach",
"to",
"matching",
"the",
"fields",
"of",
"the",
"BagObject",
"to",
"the",
"class",
"being",
"init... | train | https://github.com/brettonw/Bag/blob/25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56/src/main/java/com/brettonw/bag/Serializer.java#L500-L502 |
Hygieia/Hygieia | collectors/misc/score/src/main/java/com/capitalone/dashboard/widget/WidgetScoreAbstract.java | WidgetScoreAbstract.processWidgetScore | @Override
public ScoreWeight processWidgetScore(Widget widget, ScoreComponentSettings paramSettings) {
if (!Utils.isScoreEnabled(paramSettings)) {
return null;
}
//1. Init scores
ScoreWeight scoreWidget = initWidgetScore(paramSettings);
if (null == widget) {
scoreWidget.setScore(paramSettings.getCriteria().getNoWidgetFound());
scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed);
scoreWidget.setMessage(Constants.SCORE_ERROR_NO_WIDGET_FOUND);
processWidgetScoreChildren(scoreWidget);
return scoreWidget;
}
//Set Reference Id as Widget Id
scoreWidget.setRefId(widget.getId());
//2. Calculate scores for each child category
try {
calculateCategoryScores(widget, paramSettings, scoreWidget.getChildren());
} catch (DataNotFoundException ex) {
scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed);
scoreWidget.setScore(paramSettings.getCriteria().getNoDataFound());
scoreWidget.setMessage(ex.getMessage());
processWidgetScoreChildren(scoreWidget);
return scoreWidget;
} catch (ThresholdException ex) {
setThresholdFailureWeight(ex, scoreWidget);
processWidgetScoreChildren(scoreWidget);
return scoreWidget;
}
LOGGER.debug("scoreWidget {}", scoreWidget);
LOGGER.debug("scoreWidget.getChildren {}", scoreWidget.getChildren());
//3. Calculate widget score
calculateWidgetScore(scoreWidget);
return scoreWidget;
} | java | @Override
public ScoreWeight processWidgetScore(Widget widget, ScoreComponentSettings paramSettings) {
if (!Utils.isScoreEnabled(paramSettings)) {
return null;
}
//1. Init scores
ScoreWeight scoreWidget = initWidgetScore(paramSettings);
if (null == widget) {
scoreWidget.setScore(paramSettings.getCriteria().getNoWidgetFound());
scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed);
scoreWidget.setMessage(Constants.SCORE_ERROR_NO_WIDGET_FOUND);
processWidgetScoreChildren(scoreWidget);
return scoreWidget;
}
//Set Reference Id as Widget Id
scoreWidget.setRefId(widget.getId());
//2. Calculate scores for each child category
try {
calculateCategoryScores(widget, paramSettings, scoreWidget.getChildren());
} catch (DataNotFoundException ex) {
scoreWidget.setState(ScoreWeight.ProcessingState.criteria_failed);
scoreWidget.setScore(paramSettings.getCriteria().getNoDataFound());
scoreWidget.setMessage(ex.getMessage());
processWidgetScoreChildren(scoreWidget);
return scoreWidget;
} catch (ThresholdException ex) {
setThresholdFailureWeight(ex, scoreWidget);
processWidgetScoreChildren(scoreWidget);
return scoreWidget;
}
LOGGER.debug("scoreWidget {}", scoreWidget);
LOGGER.debug("scoreWidget.getChildren {}", scoreWidget.getChildren());
//3. Calculate widget score
calculateWidgetScore(scoreWidget);
return scoreWidget;
} | [
"@",
"Override",
"public",
"ScoreWeight",
"processWidgetScore",
"(",
"Widget",
"widget",
",",
"ScoreComponentSettings",
"paramSettings",
")",
"{",
"if",
"(",
"!",
"Utils",
".",
"isScoreEnabled",
"(",
"paramSettings",
")",
")",
"{",
"return",
"null",
";",
"}",
... | Process widget score
@param widget widget configuration from dashboard
@param paramSettings Score Settings for the widget
@return | [
"Process",
"widget",
"score"
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/misc/score/src/main/java/com/capitalone/dashboard/widget/WidgetScoreAbstract.java#L39-L80 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.