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 |
|---|---|---|---|---|---|---|---|---|---|---|
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java | BigRational.valueOf | public static BigRational valueOf(BigDecimal value) {
if (value.compareTo(BigDecimal.ZERO) == 0) {
return ZERO;
}
if (value.compareTo(BigDecimal.ONE) == 0) {
return ONE;
}
int scale = value.scale();
if (scale == 0) {
return new BigRational(value, BigDecimal.ONE);
} else if (scale < 0) {
BigDecimal n = new BigDecimal(value.unscaledValue()).multiply(BigDecimal.ONE.movePointLeft(value.scale()));
return new BigRational(n, BigDecimal.ONE);
}
else {
BigDecimal n = new BigDecimal(value.unscaledValue());
BigDecimal d = BigDecimal.ONE.movePointRight(value.scale());
return new BigRational(n, d);
}
} | java | public static BigRational valueOf(BigDecimal value) {
if (value.compareTo(BigDecimal.ZERO) == 0) {
return ZERO;
}
if (value.compareTo(BigDecimal.ONE) == 0) {
return ONE;
}
int scale = value.scale();
if (scale == 0) {
return new BigRational(value, BigDecimal.ONE);
} else if (scale < 0) {
BigDecimal n = new BigDecimal(value.unscaledValue()).multiply(BigDecimal.ONE.movePointLeft(value.scale()));
return new BigRational(n, BigDecimal.ONE);
}
else {
BigDecimal n = new BigDecimal(value.unscaledValue());
BigDecimal d = BigDecimal.ONE.movePointRight(value.scale());
return new BigRational(n, d);
}
} | [
"public",
"static",
"BigRational",
"valueOf",
"(",
"BigDecimal",
"value",
")",
"{",
"if",
"(",
"value",
".",
"compareTo",
"(",
"BigDecimal",
".",
"ZERO",
")",
"==",
"0",
")",
"{",
"return",
"ZERO",
";",
"}",
"if",
"(",
"value",
".",
"compareTo",
"(",
... | Creates a rational number of the specified {@link BigDecimal} value.
@param value the double value
@return the rational number | [
"Creates",
"a",
"rational",
"number",
"of",
"the",
"specified",
"{",
"@link",
"BigDecimal",
"}",
"value",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java#L911-L931 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendBinary | public static void sendBinary(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendInternal(pooledData, WebSocketFrameType.BINARY, wsChannel, callback, null, -1);
} | java | public static void sendBinary(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendInternal(pooledData, WebSocketFrameType.BINARY, wsChannel, callback, null, -1);
} | [
"public",
"static",
"void",
"sendBinary",
"(",
"final",
"PooledByteBuffer",
"pooledData",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"Void",
">",
"callback",
")",
"{",
"sendInternal",
"(",
"pooledData",
",",
"WebSocketFram... | Sends a complete binary message, invoking the callback when complete
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel
@param callback The callback to invoke on completion | [
"Sends",
"a",
"complete",
"binary",
"message",
"invoking",
"the",
"callback",
"when",
"complete",
"Automatically",
"frees",
"the",
"pooled",
"byte",
"buffer",
"when",
"done",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L686-L688 |
irmen/Pyrolite | java/src/main/java/net/razorvine/pickle/PickleUtils.java | PickleUtils.str2bytes | public static byte[] str2bytes(String str) throws IOException {
byte[] b=new byte[str.length()];
for(int i=0; i<str.length(); ++i) {
char c=str.charAt(i);
if(c>255) throw new UnsupportedEncodingException("string contained a char > 255, cannot convert to bytes");
b[i]=(byte)c;
}
return b;
} | java | public static byte[] str2bytes(String str) throws IOException {
byte[] b=new byte[str.length()];
for(int i=0; i<str.length(); ++i) {
char c=str.charAt(i);
if(c>255) throw new UnsupportedEncodingException("string contained a char > 255, cannot convert to bytes");
b[i]=(byte)c;
}
return b;
} | [
"public",
"static",
"byte",
"[",
"]",
"str2bytes",
"(",
"String",
"str",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"str",
".",
"length",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<... | Convert a string to a byte array, no encoding is used. String must only contain characters <256. | [
"Convert",
"a",
"string",
"to",
"a",
"byte",
"array",
"no",
"encoding",
"is",
"used",
".",
"String",
"must",
"only",
"contain",
"characters",
"<256",
"."
] | train | https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pickle/PickleUtils.java#L300-L308 |
google/closure-compiler | src/com/google/javascript/jscomp/SymbolTable.java | SymbolTable.isAnySymbolDeclared | private Symbol isAnySymbolDeclared(String name, Node declNode, SymbolScope scope) {
Symbol sym = symbols.get(declNode, name);
if (sym == null) {
// Sometimes, our symbol tables will disagree on where the
// declaration node should be. In the rare case where this happens,
// trust the existing symbol.
// See SymbolTableTest#testDeclarationDisagreement.
return scope.ownSymbols.get(name);
}
return sym;
} | java | private Symbol isAnySymbolDeclared(String name, Node declNode, SymbolScope scope) {
Symbol sym = symbols.get(declNode, name);
if (sym == null) {
// Sometimes, our symbol tables will disagree on where the
// declaration node should be. In the rare case where this happens,
// trust the existing symbol.
// See SymbolTableTest#testDeclarationDisagreement.
return scope.ownSymbols.get(name);
}
return sym;
} | [
"private",
"Symbol",
"isAnySymbolDeclared",
"(",
"String",
"name",
",",
"Node",
"declNode",
",",
"SymbolScope",
"scope",
")",
"{",
"Symbol",
"sym",
"=",
"symbols",
".",
"get",
"(",
"declNode",
",",
"name",
")",
";",
"if",
"(",
"sym",
"==",
"null",
")",
... | Checks if any symbol is already declared at the given node and scope for the given name. If so,
returns it. | [
"Checks",
"if",
"any",
"symbol",
"is",
"already",
"declared",
"at",
"the",
"given",
"node",
"and",
"scope",
"for",
"the",
"given",
"name",
".",
"If",
"so",
"returns",
"it",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SymbolTable.java#L562-L572 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceMessages.java | CmsWorkplaceMessages.getResourceTypeName | public static String getResourceTypeName(Locale locale, String name) {
// try to find the localized key
CmsExplorerTypeSettings typeSettings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(name);
if (typeSettings == null) {
return name;
}
String key = typeSettings.getKey();
return OpenCms.getWorkplaceManager().getMessages(locale).keyDefault(key, name);
} | java | public static String getResourceTypeName(Locale locale, String name) {
// try to find the localized key
CmsExplorerTypeSettings typeSettings = OpenCms.getWorkplaceManager().getExplorerTypeSetting(name);
if (typeSettings == null) {
return name;
}
String key = typeSettings.getKey();
return OpenCms.getWorkplaceManager().getMessages(locale).keyDefault(key, name);
} | [
"public",
"static",
"String",
"getResourceTypeName",
"(",
"Locale",
"locale",
",",
"String",
"name",
")",
"{",
"// try to find the localized key",
"CmsExplorerTypeSettings",
"typeSettings",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getExplorerTypeSetting... | Returns the localized name of the given resource type name.<p>
If this key is not found, the value of the name input will be returned.<p>
@param locale the right locale to use
@param name the resource type name to generate the nice name for
@return the localized name of the given resource type name | [
"Returns",
"the",
"localized",
"name",
"of",
"the",
"given",
"resource",
"type",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceMessages.java#L193-L202 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/TypedStreamReader.java | TypedStreamReader.createStreamReader | public static TypedStreamReader createStreamReader
(BranchingReaderSource input, ReaderCreator owner, ReaderConfig cfg,
InputBootstrapper bs, boolean forER)
throws XMLStreamException
{
TypedStreamReader sr = new TypedStreamReader
(bs, input, owner, cfg, createElementStack(cfg), forER);
return sr;
} | java | public static TypedStreamReader createStreamReader
(BranchingReaderSource input, ReaderCreator owner, ReaderConfig cfg,
InputBootstrapper bs, boolean forER)
throws XMLStreamException
{
TypedStreamReader sr = new TypedStreamReader
(bs, input, owner, cfg, createElementStack(cfg), forER);
return sr;
} | [
"public",
"static",
"TypedStreamReader",
"createStreamReader",
"(",
"BranchingReaderSource",
"input",
",",
"ReaderCreator",
"owner",
",",
"ReaderConfig",
"cfg",
",",
"InputBootstrapper",
"bs",
",",
"boolean",
"forER",
")",
"throws",
"XMLStreamException",
"{",
"TypedStre... | Factory method for constructing readers.
@param owner "Owner" of this reader, factory that created the reader;
needed for returning updated symbol table information after parsing.
@param input Input source used to read the XML document.
@param cfg Object that contains reader configuration info. | [
"Factory",
"method",
"for",
"constructing",
"readers",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/TypedStreamReader.java#L105-L114 |
banq/jdonframework | JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/FormBeanUtil.java | FormBeanUtil.createEvent | public static EventModel createEvent(ModelForm form, Object model) throws Exception {
EventModel em = new EventModel();
try {
PropertyUtils.copyProperties(model, form);
em.setModelIF(model);
String action = form.getAction();
em.setActionName(action);
em.setActionType(FormBeanUtil.actionTransfer(action));
} catch (Exception ex) {
Debug.logError("[JdonFramework]create Event error:" + ex, module);
throw new Exception(ex);
}
return em;
} | java | public static EventModel createEvent(ModelForm form, Object model) throws Exception {
EventModel em = new EventModel();
try {
PropertyUtils.copyProperties(model, form);
em.setModelIF(model);
String action = form.getAction();
em.setActionName(action);
em.setActionType(FormBeanUtil.actionTransfer(action));
} catch (Exception ex) {
Debug.logError("[JdonFramework]create Event error:" + ex, module);
throw new Exception(ex);
}
return em;
} | [
"public",
"static",
"EventModel",
"createEvent",
"(",
"ModelForm",
"form",
",",
"Object",
"model",
")",
"throws",
"Exception",
"{",
"EventModel",
"em",
"=",
"new",
"EventModel",
"(",
")",
";",
"try",
"{",
"PropertyUtils",
".",
"copyProperties",
"(",
"model",
... | create a EventModel from a existed ModelForm. it is only for
create/edit/delete of ModelSaveAction | [
"create",
"a",
"EventModel",
"from",
"a",
"existed",
"ModelForm",
".",
"it",
"is",
"only",
"for",
"create",
"/",
"edit",
"/",
"delete",
"of",
"ModelSaveAction"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/FormBeanUtil.java#L235-L248 |
before/uadetector | modules/uadetector-resources/src/main/java/net/sf/uadetector/service/UADetectorServiceFactory.java | UADetectorServiceFactory.getOnlineUpdatingParser | public static UserAgentStringParser getOnlineUpdatingParser(final URL dataUrl, final URL versionUrl) {
return OnlineUpdatingParserHolder.getParser(dataUrl, versionUrl, RESOURCE_MODULE);
} | java | public static UserAgentStringParser getOnlineUpdatingParser(final URL dataUrl, final URL versionUrl) {
return OnlineUpdatingParserHolder.getParser(dataUrl, versionUrl, RESOURCE_MODULE);
} | [
"public",
"static",
"UserAgentStringParser",
"getOnlineUpdatingParser",
"(",
"final",
"URL",
"dataUrl",
",",
"final",
"URL",
"versionUrl",
")",
"{",
"return",
"OnlineUpdatingParserHolder",
".",
"getParser",
"(",
"dataUrl",
",",
"versionUrl",
",",
"RESOURCE_MODULE",
")... | Returns an implementation of {@link UserAgentStringParser} which checks at regular intervals for new versions of
<em>UAS data</em> (also known as database). When newer data available, it automatically loads and updates it.
<p>
At initialization time the returned parser will be loaded with the <em>UAS data</em> of this module (the shipped
one within the <em>uadetector-resources</em> JAR) and tries to update it. The initialization is started only when
this method is called the first time.
<p>
The update of the data store runs as background task. With this feature we try to reduce the initialization time
of this <code>UserAgentStringParser</code>, because a network connection is involved and the remote system can be
not available or slow.
<p>
The static class definition {@code OnlineUpdatingParserHolder} within this factory class is <em>not</em>
initialized until the JVM determines that {@code OnlineUpdatingParserHolder} must be executed. The static class
{@code OnlineUpdatingParserHolder} is only executed when the static method {@code getOnlineUserAgentStringParser}
is invoked on the class {@code UADetectorServiceFactory}, and the first time this happens the JVM will load and
initialize the {@code OnlineUpdatingParserHolder} class.
<p>
If during the operation the Internet connection gets lost, then this instance continues to work properly (and
under correct log level settings you will get an corresponding log messages).
@param dataUrl
@param versionUrl
@return an user agent string parser with updating service | [
"Returns",
"an",
"implementation",
"of",
"{",
"@link",
"UserAgentStringParser",
"}",
"which",
"checks",
"at",
"regular",
"intervals",
"for",
"new",
"versions",
"of",
"<em",
">",
"UAS",
"data<",
"/",
"em",
">",
"(",
"also",
"known",
"as",
"database",
")",
"... | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-resources/src/main/java/net/sf/uadetector/service/UADetectorServiceFactory.java#L253-L255 |
emilsjolander/sprinkles | library/src/main/java/se/emilsjolander/sprinkles/Query.java | Query.one | public static <T extends QueryResult> OneQuery<T> one(Class<T> clazz, int sqlResId,
Object... sqlArgs) {
String sql = Utils.readRawText(sqlResId);
return one(clazz, sql, sqlArgs);
} | java | public static <T extends QueryResult> OneQuery<T> one(Class<T> clazz, int sqlResId,
Object... sqlArgs) {
String sql = Utils.readRawText(sqlResId);
return one(clazz, sql, sqlArgs);
} | [
"public",
"static",
"<",
"T",
"extends",
"QueryResult",
">",
"OneQuery",
"<",
"T",
">",
"one",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"int",
"sqlResId",
",",
"Object",
"...",
"sqlArgs",
")",
"{",
"String",
"sql",
"=",
"Utils",
".",
"readRawText",
... | Start a query for a single instance of type T
@param clazz
The class representing the type of the model you want returned
@param sqlResId
The raw sql resource id that should be executed.
@param sqlArgs
The array of arguments to insert instead of ? in the placeholderQuery statement.
Strings are automatically placeholderQuery escaped.
@param <T>
The type of the model you want returned
@return the query to execute | [
"Start",
"a",
"query",
"for",
"a",
"single",
"instance",
"of",
"type",
"T"
] | train | https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Query.java#L56-L60 |
berkesa/datatree | src/main/java/io/datatree/Tree.java | Tree.getPath | protected StringBuilder getPath(StringBuilder path, int startIndex, boolean addPoint) {
boolean simple = true;
if (key != null) {
if (addPoint && path.length() > 0) {
path.insert(0, '.');
}
if (key instanceof Integer) {
path.insert(0, ']');
if (startIndex == 0) {
path.insert(0, key);
} else {
path.insert(0, startIndex + (int) key);
}
path.insert(0, '[');
simple = false;
} else {
path.insert(0, key);
}
}
if (parent != null) {
parent.getPath(path, startIndex, simple);
}
return path;
} | java | protected StringBuilder getPath(StringBuilder path, int startIndex, boolean addPoint) {
boolean simple = true;
if (key != null) {
if (addPoint && path.length() > 0) {
path.insert(0, '.');
}
if (key instanceof Integer) {
path.insert(0, ']');
if (startIndex == 0) {
path.insert(0, key);
} else {
path.insert(0, startIndex + (int) key);
}
path.insert(0, '[');
simple = false;
} else {
path.insert(0, key);
}
}
if (parent != null) {
parent.getPath(path, startIndex, simple);
}
return path;
} | [
"protected",
"StringBuilder",
"getPath",
"(",
"StringBuilder",
"path",
",",
"int",
"startIndex",
",",
"boolean",
"addPoint",
")",
"{",
"boolean",
"simple",
"=",
"true",
";",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"if",
"(",
"addPoint",
"&&",
"path",
"... | Recursive path-builder method.
@param path
path builder
@param startIndex
first index within array (startIndex = 0 -> zero based
array-indexing)
@param addPoint
a point is insertable into the path
@return path of this node | [
"Recursive",
"path",
"-",
"builder",
"method",
"."
] | train | https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/Tree.java#L402-L425 |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleBase.java | SimpleBase.plus | public T plus( double beta , T B ) {
convertType.specify(this,B);
T A = convertType.convert(this);
B = convertType.convert(B);
T ret = A.createLike();
A.ops.plus(A.mat,beta,B.mat,ret.mat);
return ret;
} | java | public T plus( double beta , T B ) {
convertType.specify(this,B);
T A = convertType.convert(this);
B = convertType.convert(B);
T ret = A.createLike();
A.ops.plus(A.mat,beta,B.mat,ret.mat);
return ret;
} | [
"public",
"T",
"plus",
"(",
"double",
"beta",
",",
"T",
"B",
")",
"{",
"convertType",
".",
"specify",
"(",
"this",
",",
"B",
")",
";",
"T",
"A",
"=",
"convertType",
".",
"convert",
"(",
"this",
")",
";",
"B",
"=",
"convertType",
".",
"convert",
"... | <p>
Performs a matrix addition and scale operation.<br>
<br>
c = a + β*b <br>
<br>
where c is the returned matrix, a is this matrix, and b is the passed in matrix.
</p>
@see CommonOps_DDRM#add( DMatrixD1, double , DMatrixD1, DMatrixD1)
@param B m by n matrix. Not modified.
@return A matrix that contains the results. | [
"<p",
">",
"Performs",
"a",
"matrix",
"addition",
"and",
"scale",
"operation",
".",
"<br",
">",
"<br",
">",
"c",
"=",
"a",
"+",
"&beta",
";",
"*",
"b",
"<br",
">",
"<br",
">",
"where",
"c",
"is",
"the",
"returned",
"matrix",
"a",
"is",
"this",
"m... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleBase.java#L318-L326 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java | ExtendedMessageFormat.parseFormatDescription | private String parseFormatDescription(final String pattern, final ParsePosition pos) {
final int start = pos.getIndex();
seekNonWs(pattern, pos);
final int text = pos.getIndex();
int depth = 1;
for (; pos.getIndex() < pattern.length(); next(pos)) {
switch (pattern.charAt(pos.getIndex())) {
case START_FE:
depth++;
break;
case END_FE:
depth--;
if (depth == 0) {
return pattern.substring(text, pos.getIndex());
}
break;
case QUOTE:
getQuotedString(pattern, pos);
break;
default:
break;
}
}
throw new IllegalArgumentException(
"Unterminated format element at position " + start);
} | java | private String parseFormatDescription(final String pattern, final ParsePosition pos) {
final int start = pos.getIndex();
seekNonWs(pattern, pos);
final int text = pos.getIndex();
int depth = 1;
for (; pos.getIndex() < pattern.length(); next(pos)) {
switch (pattern.charAt(pos.getIndex())) {
case START_FE:
depth++;
break;
case END_FE:
depth--;
if (depth == 0) {
return pattern.substring(text, pos.getIndex());
}
break;
case QUOTE:
getQuotedString(pattern, pos);
break;
default:
break;
}
}
throw new IllegalArgumentException(
"Unterminated format element at position " + start);
} | [
"private",
"String",
"parseFormatDescription",
"(",
"final",
"String",
"pattern",
",",
"final",
"ParsePosition",
"pos",
")",
"{",
"final",
"int",
"start",
"=",
"pos",
".",
"getIndex",
"(",
")",
";",
"seekNonWs",
"(",
"pattern",
",",
"pos",
")",
";",
"final... | Parse the format component of a format element.
@param pattern string to parse
@param pos current parse position
@return Format description String | [
"Parse",
"the",
"format",
"component",
"of",
"a",
"format",
"element",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java#L372-L397 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java | ApiOvhEmailpro.service_account_email_sendAs_allowedAccountId_GET | public OvhAccountSendAs service_account_email_sendAs_allowedAccountId_GET(String service, String email, Long allowedAccountId) throws IOException {
String qPath = "/email/pro/{service}/account/{email}/sendAs/{allowedAccountId}";
StringBuilder sb = path(qPath, service, email, allowedAccountId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAccountSendAs.class);
} | java | public OvhAccountSendAs service_account_email_sendAs_allowedAccountId_GET(String service, String email, Long allowedAccountId) throws IOException {
String qPath = "/email/pro/{service}/account/{email}/sendAs/{allowedAccountId}";
StringBuilder sb = path(qPath, service, email, allowedAccountId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAccountSendAs.class);
} | [
"public",
"OvhAccountSendAs",
"service_account_email_sendAs_allowedAccountId_GET",
"(",
"String",
"service",
",",
"String",
"email",
",",
"Long",
"allowedAccountId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/pro/{service}/account/{email}/sendAs/{allow... | Get this object properties
REST: GET /email/pro/{service}/account/{email}/sendAs/{allowedAccountId}
@param service [required] The internal name of your pro organization
@param email [required] Default email for this mailbox
@param allowedAccountId [required] Account id to give send as
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L679-L684 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/spout/AmBaseSpout.java | AmBaseSpout.open | @SuppressWarnings("rawtypes")
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector)
{
super.open(conf, context, collector);
this.taskId = context.getThisComponentId() + "_" + context.getThisTaskId();
if (this.reloadConfig)
{
if (conf.containsKey(StormConfigGenerator.INIT_CONFIG_KEY))
{
String watchPath = conf.get(StormConfigGenerator.INIT_CONFIG_KEY).toString();
String logFormat = "Config reload watch start. : WatchPath={0}, Interval(Sec)={1}";
logger.info(MessageFormat.format(logFormat, watchPath, this.reloadConfigIntervalSec));
this.watcher = new ConfigFileWatcher(watchPath, this.reloadConfigIntervalSec);
this.watcher.init();
}
}
onOpen(conf, context);
} | java | @SuppressWarnings("rawtypes")
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector)
{
super.open(conf, context, collector);
this.taskId = context.getThisComponentId() + "_" + context.getThisTaskId();
if (this.reloadConfig)
{
if (conf.containsKey(StormConfigGenerator.INIT_CONFIG_KEY))
{
String watchPath = conf.get(StormConfigGenerator.INIT_CONFIG_KEY).toString();
String logFormat = "Config reload watch start. : WatchPath={0}, Interval(Sec)={1}";
logger.info(MessageFormat.format(logFormat, watchPath, this.reloadConfigIntervalSec));
this.watcher = new ConfigFileWatcher(watchPath, this.reloadConfigIntervalSec);
this.watcher.init();
}
}
onOpen(conf, context);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"public",
"void",
"open",
"(",
"Map",
"conf",
",",
"TopologyContext",
"context",
",",
"SpoutOutputCollector",
"collector",
")",
"{",
"super",
".",
"open",
"(",
"conf",
",",
"context",
",",
"... | Initialize method called after extracted for worker processes.<br>
<br>
Initialize task id.
@param conf Storm configuration
@param context Topology context
@param collector SpoutOutputCollector | [
"Initialize",
"method",
"called",
"after",
"extracted",
"for",
"worker",
"processes",
".",
"<br",
">",
"<br",
">",
"Initialize",
"task",
"id",
"."
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/spout/AmBaseSpout.java#L90-L112 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/html/Page.java | Page.addSection | public void addSection(String section, Composite composite)
{
sections.put(section,composite);
add(composite);
} | java | public void addSection(String section, Composite composite)
{
sections.put(section,composite);
add(composite);
} | [
"public",
"void",
"addSection",
"(",
"String",
"section",
",",
"Composite",
"composite",
")",
"{",
"sections",
".",
"put",
"(",
"section",
",",
"composite",
")",
";",
"add",
"(",
"composite",
")",
";",
"}"
] | Set a composite as a named section and add it to the.
contents of the page | [
"Set",
"a",
"composite",
"as",
"a",
"named",
"section",
"and",
"add",
"it",
"to",
"the",
".",
"contents",
"of",
"the",
"page"
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/Page.java#L331-L335 |
davidmoten/grumpy | grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java | Position.getBearingDifferenceDegrees | public static double getBearingDifferenceDegrees(double bearing1, double bearing2) {
if (bearing1 < 0)
bearing1 += 360;
if (bearing2 > 180)
bearing2 -= 360;
double result = bearing1 - bearing2;
if (result > 180)
result -= 360;
return result;
} | java | public static double getBearingDifferenceDegrees(double bearing1, double bearing2) {
if (bearing1 < 0)
bearing1 += 360;
if (bearing2 > 180)
bearing2 -= 360;
double result = bearing1 - bearing2;
if (result > 180)
result -= 360;
return result;
} | [
"public",
"static",
"double",
"getBearingDifferenceDegrees",
"(",
"double",
"bearing1",
",",
"double",
"bearing2",
")",
"{",
"if",
"(",
"bearing1",
"<",
"0",
")",
"bearing1",
"+=",
"360",
";",
"if",
"(",
"bearing2",
">",
"180",
")",
"bearing2",
"-=",
"360"... | returns difference in degrees in the range -180 to 180
@param bearing1
degrees between -360 and 360
@param bearing2
degrees between -360 and 360
@return | [
"returns",
"difference",
"in",
"degrees",
"in",
"the",
"range",
"-",
"180",
"to",
"180"
] | train | https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java#L315-L324 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getDHOffset1 | protected int getDHOffset1(byte[] handshake, int bufferOffset) {
bufferOffset += 1532;
int offset = handshake[bufferOffset] & 0xff; // & 0x0ff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
int res = (offset % 632) + 772;
if (res + KEY_LENGTH > 1531) {
log.error("Invalid DH offset");
}
return res;
} | java | protected int getDHOffset1(byte[] handshake, int bufferOffset) {
bufferOffset += 1532;
int offset = handshake[bufferOffset] & 0xff; // & 0x0ff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
int res = (offset % 632) + 772;
if (res + KEY_LENGTH > 1531) {
log.error("Invalid DH offset");
}
return res;
} | [
"protected",
"int",
"getDHOffset1",
"(",
"byte",
"[",
"]",
"handshake",
",",
"int",
"bufferOffset",
")",
"{",
"bufferOffset",
"+=",
"1532",
";",
"int",
"offset",
"=",
"handshake",
"[",
"bufferOffset",
"]",
"&",
"0xff",
";",
"// & 0x0ff;\r",
"bufferOffset",
"... | Returns the DH byte offset.
@param handshake handshake sequence
@param bufferOffset buffer offset
@return dh offset | [
"Returns",
"the",
"DH",
"byte",
"offset",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L444-L458 |
UrielCh/ovh-java-sdk | ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java | ApiOvhMsServices.serviceName_exchange_PUT | public void serviceName_exchange_PUT(String serviceName, OvhExchangeService body) throws IOException {
String qPath = "/msServices/{serviceName}/exchange";
StringBuilder sb = path(qPath, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_exchange_PUT(String serviceName, OvhExchangeService body) throws IOException {
String qPath = "/msServices/{serviceName}/exchange";
StringBuilder sb = path(qPath, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_exchange_PUT",
"(",
"String",
"serviceName",
",",
"OvhExchangeService",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/msServices/{serviceName}/exchange\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
"... | Alter this object properties
REST: PUT /msServices/{serviceName}/exchange
@param body [required] New object properties
@param serviceName [required] The internal name of your Active Directory organization
API beta | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-msServices/src/main/java/net/minidev/ovh/api/ApiOvhMsServices.java#L543-L547 |
square/pollexor | src/main/java/com/squareup/pollexor/Utilities.java | Utilities.normalizeString | static String normalizeString(String string, int desiredLength) {
if (string == null || string.length() == 0) {
throw new IllegalArgumentException("Must supply a non-null, non-empty string.");
}
if (desiredLength <= 0) {
throw new IllegalArgumentException("Desired length must be greater than zero.");
}
if (string.length() >= desiredLength) {
return string.substring(0, desiredLength);
} else {
StringBuilder builder = new StringBuilder(string);
while (builder.length() < desiredLength) {
builder.append(string);
}
return builder.substring(0, desiredLength);
}
} | java | static String normalizeString(String string, int desiredLength) {
if (string == null || string.length() == 0) {
throw new IllegalArgumentException("Must supply a non-null, non-empty string.");
}
if (desiredLength <= 0) {
throw new IllegalArgumentException("Desired length must be greater than zero.");
}
if (string.length() >= desiredLength) {
return string.substring(0, desiredLength);
} else {
StringBuilder builder = new StringBuilder(string);
while (builder.length() < desiredLength) {
builder.append(string);
}
return builder.substring(0, desiredLength);
}
} | [
"static",
"String",
"normalizeString",
"(",
"String",
"string",
",",
"int",
"desiredLength",
")",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"string",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must... | Normalize a string to a desired length by repeatedly appending itself and/or truncating.
@param string Input string.
@param desiredLength Desired length of string.
@return Output string which is guaranteed to have a length equal to the desired length
argument.
@throws IllegalArgumentException if {@code string} is blank or {@code desiredLength} is not
greater than 0. | [
"Normalize",
"a",
"string",
"to",
"a",
"desired",
"length",
"by",
"repeatedly",
"appending",
"itself",
"and",
"/",
"or",
"truncating",
"."
] | train | https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Utilities.java#L109-L125 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java | LabsInner.listAsync | public Observable<Page<LabInner>> listAsync(final String resourceGroupName, final String labAccountName) {
return listWithServiceResponseAsync(resourceGroupName, labAccountName)
.map(new Func1<ServiceResponse<Page<LabInner>>, Page<LabInner>>() {
@Override
public Page<LabInner> call(ServiceResponse<Page<LabInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<LabInner>> listAsync(final String resourceGroupName, final String labAccountName) {
return listWithServiceResponseAsync(resourceGroupName, labAccountName)
.map(new Func1<ServiceResponse<Page<LabInner>>, Page<LabInner>>() {
@Override
public Page<LabInner> call(ServiceResponse<Page<LabInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"LabInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"labAccountName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
"... | List labs in a given lab account.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<LabInner> object | [
"List",
"labs",
"in",
"a",
"given",
"lab",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L155-L163 |
census-instrumentation/opencensus-java | contrib/http_util/src/main/java/io/opencensus/contrib/http/AbstractHttpHandler.java | AbstractHttpHandler.handleMessageReceived | public final void handleMessageReceived(HttpRequestContext context, long bytes) {
checkNotNull(context, "context");
context.receiveMessageSize.addAndGet(bytes);
if (context.span.getOptions().contains(Options.RECORD_EVENTS)) {
// record compressed size
recordMessageEvent(
context.span, context.receviedSeqId.addAndGet(1L), Type.RECEIVED, bytes, 0L);
}
} | java | public final void handleMessageReceived(HttpRequestContext context, long bytes) {
checkNotNull(context, "context");
context.receiveMessageSize.addAndGet(bytes);
if (context.span.getOptions().contains(Options.RECORD_EVENTS)) {
// record compressed size
recordMessageEvent(
context.span, context.receviedSeqId.addAndGet(1L), Type.RECEIVED, bytes, 0L);
}
} | [
"public",
"final",
"void",
"handleMessageReceived",
"(",
"HttpRequestContext",
"context",
",",
"long",
"bytes",
")",
"{",
"checkNotNull",
"(",
"context",
",",
"\"context\"",
")",
";",
"context",
".",
"receiveMessageSize",
".",
"addAndGet",
"(",
"bytes",
")",
";"... | Instrument an HTTP span after a message is received. Typically called for every chunk of
request or response is received.
@param context request specific {@link HttpRequestContext}
@param bytes bytes received.
@since 0.19 | [
"Instrument",
"an",
"HTTP",
"span",
"after",
"a",
"message",
"is",
"received",
".",
"Typically",
"called",
"for",
"every",
"chunk",
"of",
"request",
"or",
"response",
"is",
"received",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/http_util/src/main/java/io/opencensus/contrib/http/AbstractHttpHandler.java#L94-L102 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/ProxySettings.java | ProxySettings.addHeader | public ProxySettings addHeader(String name, String value)
{
if (name == null || name.length() == 0)
{
return this;
}
List<String> list = mHeaders.get(name);
if (list == null)
{
list = new ArrayList<String>();
mHeaders.put(name, list);
}
list.add(value);
return this;
} | java | public ProxySettings addHeader(String name, String value)
{
if (name == null || name.length() == 0)
{
return this;
}
List<String> list = mHeaders.get(name);
if (list == null)
{
list = new ArrayList<String>();
mHeaders.put(name, list);
}
list.add(value);
return this;
} | [
"public",
"ProxySettings",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"List",
"<",
"String",
">",
"l... | Add an additional HTTP header passed to the proxy server.
@param name
The name of an HTTP header (case-insensitive).
If {@code null} or an empty string is given,
nothing is added.
@param value
The value of the HTTP header.
@return
{@code this} object. | [
"Add",
"an",
"additional",
"HTTP",
"header",
"passed",
"to",
"the",
"proxy",
"server",
"."
] | train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/ProxySettings.java#L591-L609 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/data/AbstractDirtyMarker.java | AbstractDirtyMarker.setDirty | public static void setDirty(DirtyMarker aDirtyMarker, int aId1, int aId2)
{
if(aDirtyMarker == null)
return;
if(aId1 != aId2)
aDirtyMarker.setDirty(true);
} | java | public static void setDirty(DirtyMarker aDirtyMarker, int aId1, int aId2)
{
if(aDirtyMarker == null)
return;
if(aId1 != aId2)
aDirtyMarker.setDirty(true);
} | [
"public",
"static",
"void",
"setDirty",
"(",
"DirtyMarker",
"aDirtyMarker",
",",
"int",
"aId1",
",",
"int",
"aId2",
")",
"{",
"if",
"(",
"aDirtyMarker",
"==",
"null",
")",
"return",
";",
"if",
"(",
"aId1",
"!=",
"aId2",
")",
"aDirtyMarker",
".",
"setDirt... | if(aId1 != aId2)
aDirtyMarker.setDirty(true);
@param aDirtyMarker
@param aId1 the ID 2
@param aId2 the ID 2 | [
"if",
"(",
"aId1",
"!",
"=",
"aId2",
")",
"aDirtyMarker",
".",
"setDirty",
"(",
"true",
")",
";"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/data/AbstractDirtyMarker.java#L36-L43 |
Azure/azure-sdk-for-java | signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java | SignalRsInner.listKeys | public SignalRKeysInner listKeys(String resourceGroupName, String resourceName) {
return listKeysWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | java | public SignalRKeysInner listKeys(String resourceGroupName, String resourceName) {
return listKeysWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | [
"public",
"SignalRKeysInner",
"listKeys",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listKeysWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
... | Get the access keys of the SignalR resource.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param resourceName The name of the SignalR resource.
@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 SignalRKeysInner object if successful. | [
"Get",
"the",
"access",
"keys",
"of",
"the",
"SignalR",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L513-L515 |
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.getClosedList | public ClosedListEntityExtractor getClosedList(UUID appId, String versionId, UUID clEntityId) {
return getClosedListWithServiceResponseAsync(appId, versionId, clEntityId).toBlocking().single().body();
} | java | public ClosedListEntityExtractor getClosedList(UUID appId, String versionId, UUID clEntityId) {
return getClosedListWithServiceResponseAsync(appId, versionId, clEntityId).toBlocking().single().body();
} | [
"public",
"ClosedListEntityExtractor",
"getClosedList",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"clEntityId",
")",
"{",
"return",
"getClosedListWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"clEntityId",
")",
".",
"toBlocking",... | Gets information of a closed list model.
@param appId The application ID.
@param versionId The version ID.
@param clEntityId The closed list model ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ClosedListEntityExtractor object if successful. | [
"Gets",
"information",
"of",
"a",
"closed",
"list",
"model",
"."
] | 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#L4218-L4220 |
b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.optEnum | public <E extends Enum<E>> E optEnum(Class<E> clazz, String key) {
return this.optEnum(clazz, key, null);
} | java | public <E extends Enum<E>> E optEnum(Class<E> clazz, String key) {
return this.optEnum(clazz, key, null);
} | [
"public",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"E",
"optEnum",
"(",
"Class",
"<",
"E",
">",
"clazz",
",",
"String",
"key",
")",
"{",
"return",
"this",
".",
"optEnum",
"(",
"clazz",
",",
"key",
",",
"null",
")",
";",
"}"
] | Get the enum value associated with a key.
@param <E>
Enum Type
@param clazz
The type of enum to retrieve.
@param key
A key string.
@return The enum value associated with the key or null if not found | [
"Get",
"the",
"enum",
"value",
"associated",
"with",
"a",
"key",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1018-L1020 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java | ByteUtils.longToBytes | public static final void longToBytes( long l, byte[] data, int[] offset ) {
/**
* TODO: We use network-order within OceanStore, but temporarily
* supporting intel-order to work with some JNI code until JNI code is
* set to interoperate with network-order.
*/
if (data != null) {
for( int j = (offset[0] + SIZE_LONG) - 1; j >= offset[0]; --j ) {
data[j] = (byte) l;
l >>= 8;
}
}
offset[0] += SIZE_LONG;
} | java | public static final void longToBytes( long l, byte[] data, int[] offset ) {
/**
* TODO: We use network-order within OceanStore, but temporarily
* supporting intel-order to work with some JNI code until JNI code is
* set to interoperate with network-order.
*/
if (data != null) {
for( int j = (offset[0] + SIZE_LONG) - 1; j >= offset[0]; --j ) {
data[j] = (byte) l;
l >>= 8;
}
}
offset[0] += SIZE_LONG;
} | [
"public",
"static",
"final",
"void",
"longToBytes",
"(",
"long",
"l",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"[",
"]",
"offset",
")",
"{",
"/**\n * TODO: We use network-order within OceanStore, but temporarily\n * supporting intel-order to work with some J... | Write the bytes representing <code>l</code> into the byte array
<code>data</code>, starting at index <code>offset [0]</code>, and
increment <code>offset [0]</code> by the number of bytes written; if
<code>data == null</code>, increment <code>offset [0]</code> by the
number of bytes that would have been written otherwise.
@param l the <code>long</code> to encode
@param data The byte array to store into, or <code>null</code>.
@param offset A single element array whose first element is the index in
data to begin writing at on function entry, and which on
function exit has been incremented by the number of bytes
written. | [
"Write",
"the",
"bytes",
"representing",
"<code",
">",
"l<",
"/",
"code",
">",
"into",
"the",
"byte",
"array",
"<code",
">",
"data<",
"/",
"code",
">",
"starting",
"at",
"index",
"<code",
">",
"offset",
"[",
"0",
"]",
"<",
"/",
"code",
">",
"and",
... | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L189-L203 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeFromStream | public static File writeFromStream(InputStream in, File dest) throws IORuntimeException {
return FileWriter.create(dest).writeFromStream(in);
} | java | public static File writeFromStream(InputStream in, File dest) throws IORuntimeException {
return FileWriter.create(dest).writeFromStream(in);
} | [
"public",
"static",
"File",
"writeFromStream",
"(",
"InputStream",
"in",
",",
"File",
"dest",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileWriter",
".",
"create",
"(",
"dest",
")",
".",
"writeFromStream",
"(",
"in",
")",
";",
"}"
] | 将流的内容写入文件<br>
@param dest 目标文件
@param in 输入流
@return dest
@throws IORuntimeException IO异常 | [
"将流的内容写入文件<br",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3153-L3155 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Streams.java | Streams.readAll | public static String readAll(final InputStream inputStream, Charset charset) throws IOException {
return new ByteSource() {
@Override
public InputStream openStream() {
return inputStream;
}
}.asCharSource(charset).read();
} | java | public static String readAll(final InputStream inputStream, Charset charset) throws IOException {
return new ByteSource() {
@Override
public InputStream openStream() {
return inputStream;
}
}.asCharSource(charset).read();
} | [
"public",
"static",
"String",
"readAll",
"(",
"final",
"InputStream",
"inputStream",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"new",
"ByteSource",
"(",
")",
"{",
"@",
"Override",
"public",
"InputStream",
"openStream",
"(",
")",
"... | Reads all input into memory, close the steam, and return as a String. Reads
the input
@param inputStream InputStream to read from.
@param charset the charset to interpret the input as.
@return String contents of the stream.
@throws IOException if there is an problem reading from the stream. | [
"Reads",
"all",
"input",
"into",
"memory",
"close",
"the",
"steam",
"and",
"return",
"as",
"a",
"String",
".",
"Reads",
"the",
"input"
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Streams.java#L85-L92 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/VsanUpgradeSystem.java | VsanUpgradeSystem.performVsanUpgradePreflightCheck | public VsanUpgradeSystemPreflightCheckResult performVsanUpgradePreflightCheck(ClusterComputeResource cluster) throws RuntimeFault, VsanFault, RemoteException {
return performVsanUpgradePreflightCheck(cluster, null);
} | java | public VsanUpgradeSystemPreflightCheckResult performVsanUpgradePreflightCheck(ClusterComputeResource cluster) throws RuntimeFault, VsanFault, RemoteException {
return performVsanUpgradePreflightCheck(cluster, null);
} | [
"public",
"VsanUpgradeSystemPreflightCheckResult",
"performVsanUpgradePreflightCheck",
"(",
"ClusterComputeResource",
"cluster",
")",
"throws",
"RuntimeFault",
",",
"VsanFault",
",",
"RemoteException",
"{",
"return",
"performVsanUpgradePreflightCheck",
"(",
"cluster",
",",
"nul... | Perform an upgrade pre-flight check on a cluster.
@param cluster The cluster for which to perform the check.
@return Pre-flight check result.
@throws RuntimeFault
@throws VsanFault
@throws RemoteException | [
"Perform",
"an",
"upgrade",
"pre",
"-",
"flight",
"check",
"on",
"a",
"cluster",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/VsanUpgradeSystem.java#L207-L209 |
ltsopensource/light-task-scheduler | lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java | WebUtils.doGet | public static String doGet(String url, Map<String, String> params, String charset) throws IOException {
HttpURLConnection conn = null;
String rsp = null;
try {
String ctype = "application/x-www-form-urlencoded;charset=" + charset;
String query = buildQuery(params, charset);
conn = getConnection(buildGetUrl(url, query), METHOD_GET, ctype, null);
rsp = getResponseAsString(conn);
} finally {
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | java | public static String doGet(String url, Map<String, String> params, String charset) throws IOException {
HttpURLConnection conn = null;
String rsp = null;
try {
String ctype = "application/x-www-form-urlencoded;charset=" + charset;
String query = buildQuery(params, charset);
conn = getConnection(buildGetUrl(url, query), METHOD_GET, ctype, null);
rsp = getResponseAsString(conn);
} finally {
if (conn != null) {
conn.disconnect();
}
}
return rsp;
} | [
"public",
"static",
"String",
"doGet",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"conn",
"=",
"null",
";",
"String",
"rsp",
"=",
"null",
... | 执行HTTP GET请求。
@param url 请求地址
@param params 请求参数
@param charset 字符集,如UTF-8, GBK, GB2312
@return 响应字符串 | [
"执行HTTP",
"GET请求。"
] | train | https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java#L132-L149 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.setBaseNameForFunctionInstanceId | public void setBaseNameForFunctionInstanceId(String baseName, DifferentialFunction function) {
baseNameForFunctionInstanceId.put(function.getOwnName(), baseName);
} | java | public void setBaseNameForFunctionInstanceId(String baseName, DifferentialFunction function) {
baseNameForFunctionInstanceId.put(function.getOwnName(), baseName);
} | [
"public",
"void",
"setBaseNameForFunctionInstanceId",
"(",
"String",
"baseName",
",",
"DifferentialFunction",
"function",
")",
"{",
"baseNameForFunctionInstanceId",
".",
"put",
"(",
"function",
".",
"getOwnName",
"(",
")",
",",
"baseName",
")",
";",
"}"
] | Sets a base name for the function id.
This is used for when calling {@link #generateOutputVariableForOp(DifferentialFunction, String)}
for ensuring original names for model import map to current samediff names
when names are generated.
@param baseName the base name to add
@param function the function to declare a base name for. | [
"Sets",
"a",
"base",
"name",
"for",
"the",
"function",
"id",
".",
"This",
"is",
"used",
"for",
"when",
"calling",
"{",
"@link",
"#generateOutputVariableForOp",
"(",
"DifferentialFunction",
"String",
")",
"}",
"for",
"ensuring",
"original",
"names",
"for",
"mod... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1060-L1062 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java | PrimaveraPMFileWriter.setUserFieldValue | private void setUserFieldValue(UDFAssignmentType udf, DataType dataType, Object value)
{
switch (dataType)
{
case DURATION:
{
udf.setTextValue(((Duration) value).toString());
break;
}
case CURRENCY:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setCostValue((Double) value);
break;
}
case BINARY:
{
udf.setTextValue("");
break;
}
case STRING:
{
udf.setTextValue((String) value);
break;
}
case DATE:
{
udf.setStartDateValue((Date) value);
break;
}
case NUMERIC:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setDoubleValue((Double) value);
break;
}
case BOOLEAN:
{
udf.setIntegerValue(BooleanHelper.getBoolean((Boolean) value) ? Integer.valueOf(1) : Integer.valueOf(0));
break;
}
case INTEGER:
case SHORT:
{
udf.setIntegerValue(NumberHelper.getInteger((Number) value));
break;
}
default:
{
throw new RuntimeException("Unconvertible data type: " + dataType);
}
}
} | java | private void setUserFieldValue(UDFAssignmentType udf, DataType dataType, Object value)
{
switch (dataType)
{
case DURATION:
{
udf.setTextValue(((Duration) value).toString());
break;
}
case CURRENCY:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setCostValue((Double) value);
break;
}
case BINARY:
{
udf.setTextValue("");
break;
}
case STRING:
{
udf.setTextValue((String) value);
break;
}
case DATE:
{
udf.setStartDateValue((Date) value);
break;
}
case NUMERIC:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setDoubleValue((Double) value);
break;
}
case BOOLEAN:
{
udf.setIntegerValue(BooleanHelper.getBoolean((Boolean) value) ? Integer.valueOf(1) : Integer.valueOf(0));
break;
}
case INTEGER:
case SHORT:
{
udf.setIntegerValue(NumberHelper.getInteger((Number) value));
break;
}
default:
{
throw new RuntimeException("Unconvertible data type: " + dataType);
}
}
} | [
"private",
"void",
"setUserFieldValue",
"(",
"UDFAssignmentType",
"udf",
",",
"DataType",
"dataType",
",",
"Object",
"value",
")",
"{",
"switch",
"(",
"dataType",
")",
"{",
"case",
"DURATION",
":",
"{",
"udf",
".",
"setTextValue",
"(",
"(",
"(",
"Duration",
... | Sets the value of a UDF.
@param udf user defined field
@param dataType MPXJ data type
@param value field value | [
"Sets",
"the",
"value",
"of",
"a",
"UDF",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L821-L887 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java | OrdersInner.getAsync | public Observable<OrderInner> getAsync(String deviceName, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | java | public Observable<OrderInner> getAsync(String deviceName, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<OrderInner>, OrderInner>() {
@Override
public OrderInner call(ServiceResponse<OrderInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OrderInner",
">",
"getAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
... | Gets a specific order by name.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OrderInner object | [
"Gets",
"a",
"specific",
"order",
"by",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/OrdersInner.java#L253-L260 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java | CleaneLingSolver.pushExtension | private void pushExtension(final CLClause c, final int blit) {
pushExtension(0);
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit != blit) { pushExtension(lit); }
}
pushExtension(blit);
} | java | private void pushExtension(final CLClause c, final int blit) {
pushExtension(0);
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit != blit) { pushExtension(lit); }
}
pushExtension(blit);
} | [
"private",
"void",
"pushExtension",
"(",
"final",
"CLClause",
"c",
",",
"final",
"int",
"blit",
")",
"{",
"pushExtension",
"(",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"c",
".",
"lits",
"(",
")",
".",
"size",
"(",
")",
"... | Pushes and logs a clause and its blocking literal to the extension.
@param c the clause
@param blit the blocking literal | [
"Pushes",
"and",
"logs",
"a",
"clause",
"and",
"its",
"blocking",
"literal",
"to",
"the",
"extension",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1044-L1051 |
pressgang-ccms/PressGangCCMSZanataInterface | src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java | ZanataInterface.runCopyTrans | public boolean runCopyTrans(final String zanataId, boolean waitForFinish) {
log.debug("Running Zanata CopyTrans for " + zanataId);
try {
final CopyTransResource copyTransResource = proxyFactory.getCopyTransResource();
copyTransResource.startCopyTrans(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
if (waitForFinish) {
while (!isCopyTransCompleteForSourceDocument(copyTransResource, zanataId)) {
// Sleep for 3/4 of a second
Thread.sleep(750);
}
}
return true;
} catch (Exception e) {
log.error("Failed to run copyTrans for " + zanataId, e);
} finally {
performZanataRESTCallWaiting();
}
return false;
} | java | public boolean runCopyTrans(final String zanataId, boolean waitForFinish) {
log.debug("Running Zanata CopyTrans for " + zanataId);
try {
final CopyTransResource copyTransResource = proxyFactory.getCopyTransResource();
copyTransResource.startCopyTrans(details.getProject(), details.getVersion(), zanataId);
performZanataRESTCallWaiting();
if (waitForFinish) {
while (!isCopyTransCompleteForSourceDocument(copyTransResource, zanataId)) {
// Sleep for 3/4 of a second
Thread.sleep(750);
}
}
return true;
} catch (Exception e) {
log.error("Failed to run copyTrans for " + zanataId, e);
} finally {
performZanataRESTCallWaiting();
}
return false;
} | [
"public",
"boolean",
"runCopyTrans",
"(",
"final",
"String",
"zanataId",
",",
"boolean",
"waitForFinish",
")",
"{",
"log",
".",
"debug",
"(",
"\"Running Zanata CopyTrans for \"",
"+",
"zanataId",
")",
";",
"try",
"{",
"final",
"CopyTransResource",
"copyTransResource... | Run copy trans against a Source Document in zanata and then wait for it to complete
@param zanataId The id of the document to run copytrans for.
@param waitForFinish Wait for copytrans to finish running.
@return True if copytrans was run successfully, otherwise false. | [
"Run",
"copy",
"trans",
"against",
"a",
"Source",
"Document",
"in",
"zanata",
"and",
"then",
"wait",
"for",
"it",
"to",
"complete"
] | train | https://github.com/pressgang-ccms/PressGangCCMSZanataInterface/blob/0fed2480fec2cca2c578d08724288ae8268ee4d9/src/main/java/org/jboss/pressgang/ccms/zanata/ZanataInterface.java#L512-L535 |
sagiegurari/fax4j | src/main/java/org/fax4j/common/ServiceFactory.java | ServiceFactory.createService | public static Service createService(Enum<?> classNameKey,String defaultClassName,ConfigurationHolder configurationHolder,String propertyPart)
{
//validate input
if(classNameKey==null)
{
throw new FaxException("Service class name key not provided.");
}
//convert to string
String classNameKeyString=classNameKey.toString();
//create service
Service service=ServiceFactory.createService(classNameKeyString,defaultClassName,configurationHolder,propertyPart);
return service;
} | java | public static Service createService(Enum<?> classNameKey,String defaultClassName,ConfigurationHolder configurationHolder,String propertyPart)
{
//validate input
if(classNameKey==null)
{
throw new FaxException("Service class name key not provided.");
}
//convert to string
String classNameKeyString=classNameKey.toString();
//create service
Service service=ServiceFactory.createService(classNameKeyString,defaultClassName,configurationHolder,propertyPart);
return service;
} | [
"public",
"static",
"Service",
"createService",
"(",
"Enum",
"<",
"?",
">",
"classNameKey",
",",
"String",
"defaultClassName",
",",
"ConfigurationHolder",
"configurationHolder",
",",
"String",
"propertyPart",
")",
"{",
"//validate input",
"if",
"(",
"classNameKey",
... | This function creates, initializes and returns new service objects.
@param classNameKey
The configuration key holding the service object class name
@param defaultClassName
The default service object class name if the value was not found in the configuration
@param configurationHolder
The configuration holder used to provide the configuration to the service
@param propertyPart
The service property part
@return The initialized service object | [
"This",
"function",
"creates",
"initializes",
"and",
"returns",
"new",
"service",
"objects",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/common/ServiceFactory.java#L37-L52 |
haifengl/smile | graph/src/main/java/smile/graph/AdjacencyList.java | AdjacencyList.dfs | private void dfs(int v, int[] cc, int id) {
cc[v] = id;
for (Edge edge : graph[v]) {
int t = edge.v2;
if (!digraph && t == v) {
t = edge.v1;
}
if (cc[t] == -1) {
dfs(t, cc, id);
}
}
} | java | private void dfs(int v, int[] cc, int id) {
cc[v] = id;
for (Edge edge : graph[v]) {
int t = edge.v2;
if (!digraph && t == v) {
t = edge.v1;
}
if (cc[t] == -1) {
dfs(t, cc, id);
}
}
} | [
"private",
"void",
"dfs",
"(",
"int",
"v",
",",
"int",
"[",
"]",
"cc",
",",
"int",
"id",
")",
"{",
"cc",
"[",
"v",
"]",
"=",
"id",
";",
"for",
"(",
"Edge",
"edge",
":",
"graph",
"[",
"v",
"]",
")",
"{",
"int",
"t",
"=",
"edge",
".",
"v2",... | Depth-first search connected components of graph.
@param v the start vertex.
@param cc the array to store the connected component id of vertices.
@param id the current component id. | [
"Depth",
"-",
"first",
"search",
"connected",
"components",
"of",
"graph",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyList.java#L353-L365 |
threerings/nenya | core/src/main/java/com/threerings/media/sprite/FadableImageSprite.java | FadableImageSprite.moveAndFadeInAndOut | public void moveAndFadeInAndOut (Path path, long pathDuration, float fadePortion)
{
move(path);
setAlpha(0.0f);
_pathDuration = pathDuration;
_fadeInDuration = _fadeOutDuration = (long)(pathDuration * fadePortion);
} | java | public void moveAndFadeInAndOut (Path path, long pathDuration, float fadePortion)
{
move(path);
setAlpha(0.0f);
_pathDuration = pathDuration;
_fadeInDuration = _fadeOutDuration = (long)(pathDuration * fadePortion);
} | [
"public",
"void",
"moveAndFadeInAndOut",
"(",
"Path",
"path",
",",
"long",
"pathDuration",
",",
"float",
"fadePortion",
")",
"{",
"move",
"(",
"path",
")",
";",
"setAlpha",
"(",
"0.0f",
")",
";",
"_pathDuration",
"=",
"pathDuration",
";",
"_fadeInDuration",
... | Puts this sprite on the specified path, fading it in over the specified duration at the
beginning and fading it out at the end.
@param path the path to move along
@param pathDuration the duration of the path
@param fadePortion the portion of time to spend fading in/out, from 0.0f (no time) to 1.0f
(the entire time) | [
"Puts",
"this",
"sprite",
"on",
"the",
"specified",
"path",
"fading",
"it",
"in",
"over",
"the",
"specified",
"duration",
"at",
"the",
"beginning",
"and",
"fading",
"it",
"out",
"at",
"the",
"end",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/sprite/FadableImageSprite.java#L127-L135 |
samskivert/pythagoras | src/main/java/pythagoras/d/Plane.java | Plane.fromPoints | public Plane fromPoints (IVector3 p1, IVector3 p2, IVector3 p3) {
// compute the normal by taking the cross product of the two vectors formed
p2.subtract(p1, _v1);
p3.subtract(p1, _v2);
_v1.cross(_v2, _normal).normalizeLocal();
// use the first point to determine the constant
constant = -_normal.dot(p1);
return this;
} | java | public Plane fromPoints (IVector3 p1, IVector3 p2, IVector3 p3) {
// compute the normal by taking the cross product of the two vectors formed
p2.subtract(p1, _v1);
p3.subtract(p1, _v2);
_v1.cross(_v2, _normal).normalizeLocal();
// use the first point to determine the constant
constant = -_normal.dot(p1);
return this;
} | [
"public",
"Plane",
"fromPoints",
"(",
"IVector3",
"p1",
",",
"IVector3",
"p2",
",",
"IVector3",
"p3",
")",
"{",
"// compute the normal by taking the cross product of the two vectors formed",
"p2",
".",
"subtract",
"(",
"p1",
",",
"_v1",
")",
";",
"p3",
".",
"subtr... | Sets this plane based on the three points provided.
@return a reference to the plane (for chaining). | [
"Sets",
"this",
"plane",
"based",
"on",
"the",
"three",
"points",
"provided",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Plane.java#L109-L118 |
livetribe/livetribe-slp | osgi/bundle/src/main/java/org/livetribe/slp/osgi/UserAgentManagedServiceFactory.java | UserAgentManagedServiceFactory.updated | public void updated(String pid, Dictionary dictionary) throws ConfigurationException
{
LOGGER.entering(CLASS_NAME, "updated", new Object[]{pid, dictionary});
deleted(pid);
UserAgent userAgent = SLP.newUserAgent(dictionary == null ? null : DictionarySettings.from(dictionary));
if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("User Agent " + pid + " starting...");
userAgent.start();
if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("User Agent " + pid + " started successfully");
ServiceRegistration serviceRegistration = bundleContext.registerService(IServiceAgent.class.getName(), userAgent, dictionary);
userAgents.put(pid, serviceRegistration);
LOGGER.exiting(CLASS_NAME, "updated");
} | java | public void updated(String pid, Dictionary dictionary) throws ConfigurationException
{
LOGGER.entering(CLASS_NAME, "updated", new Object[]{pid, dictionary});
deleted(pid);
UserAgent userAgent = SLP.newUserAgent(dictionary == null ? null : DictionarySettings.from(dictionary));
if (LOGGER.isLoggable(Level.FINER)) LOGGER.finer("User Agent " + pid + " starting...");
userAgent.start();
if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("User Agent " + pid + " started successfully");
ServiceRegistration serviceRegistration = bundleContext.registerService(IServiceAgent.class.getName(), userAgent, dictionary);
userAgents.put(pid, serviceRegistration);
LOGGER.exiting(CLASS_NAME, "updated");
} | [
"public",
"void",
"updated",
"(",
"String",
"pid",
",",
"Dictionary",
"dictionary",
")",
"throws",
"ConfigurationException",
"{",
"LOGGER",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"updated\"",
",",
"new",
"Object",
"[",
"]",
"{",
"pid",
",",
"dictionary",
... | Update the SLP user agent's configuration, unregistering from the
OSGi service registry and stopping it if it had already started. The
new SLP user agent will be started with the new configuration and
registered in the OSGi service registry using the configuration
parameters as service properties.
@param pid The PID for this configuration.
@param dictionary The dictionary used to configure the SLP user agent.
@throws ConfigurationException Thrown if an error occurs during the SLP user agent's configuration. | [
"Update",
"the",
"SLP",
"user",
"agent",
"s",
"configuration",
"unregistering",
"from",
"the",
"OSGi",
"service",
"registry",
"and",
"stopping",
"it",
"if",
"it",
"had",
"already",
"started",
".",
"The",
"new",
"SLP",
"user",
"agent",
"will",
"be",
"started"... | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/osgi/bundle/src/main/java/org/livetribe/slp/osgi/UserAgentManagedServiceFactory.java#L95-L113 |
mapcode-foundation/mapcode-java | src/main/java/com/mapcode/Point.java | Point.fromLatLonFractions | @SuppressWarnings("NumericCastThatLosesPrecision")
@Nonnull
static Point fromLatLonFractions(final double latFraction, final double lonFraction) {
final Point p = new Point();
p.latMicroDeg = (int) Math.floor(latFraction / LAT_MICRODEG_TO_FRACTIONS_FACTOR);
p.latFractionOnlyDeg = (int) (latFraction - (LAT_MICRODEG_TO_FRACTIONS_FACTOR * p.latMicroDeg));
p.lonMicroDeg = (int) Math.floor(lonFraction / LON_MICRODEG_TO_FRACTIONS_FACTOR);
p.lonFractionOnlyDeg = (int) (lonFraction - (LON_MICRODEG_TO_FRACTIONS_FACTOR * p.lonMicroDeg));
p.defined = true;
return p.wrap();
} | java | @SuppressWarnings("NumericCastThatLosesPrecision")
@Nonnull
static Point fromLatLonFractions(final double latFraction, final double lonFraction) {
final Point p = new Point();
p.latMicroDeg = (int) Math.floor(latFraction / LAT_MICRODEG_TO_FRACTIONS_FACTOR);
p.latFractionOnlyDeg = (int) (latFraction - (LAT_MICRODEG_TO_FRACTIONS_FACTOR * p.latMicroDeg));
p.lonMicroDeg = (int) Math.floor(lonFraction / LON_MICRODEG_TO_FRACTIONS_FACTOR);
p.lonFractionOnlyDeg = (int) (lonFraction - (LON_MICRODEG_TO_FRACTIONS_FACTOR * p.lonMicroDeg));
p.defined = true;
return p.wrap();
} | [
"@",
"SuppressWarnings",
"(",
"\"NumericCastThatLosesPrecision\"",
")",
"@",
"Nonnull",
"static",
"Point",
"fromLatLonFractions",
"(",
"final",
"double",
"latFraction",
",",
"final",
"double",
"lonFraction",
")",
"{",
"final",
"Point",
"p",
"=",
"new",
"Point",
"(... | Package private construction, from integer fractions (no loss of precision). | [
"Package",
"private",
"construction",
"from",
"integer",
"fractions",
"(",
"no",
"loss",
"of",
"precision",
")",
"."
] | train | https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Point.java#L341-L351 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java | CallableUtils.getStoredProcedureShortNameFromSql | public static String getStoredProcedureShortNameFromSql(String decodedSql) {
String spName = null;
Pattern regexPattern = null;
Matcher regexMatcher = null;
String procedureFullName = getStoredProcedureFullName(decodedSql);
String[] procedurePath = procedureFullName.split("[.]");
if (procedurePath.length > 0) {
spName = procedurePath[procedurePath.length - 1];
} else {
throw new IllegalArgumentException(String.format(ERROR_SHORT_PROCEDURE_NAME_NOT_FOUND, procedureFullName));
}
return spName;
} | java | public static String getStoredProcedureShortNameFromSql(String decodedSql) {
String spName = null;
Pattern regexPattern = null;
Matcher regexMatcher = null;
String procedureFullName = getStoredProcedureFullName(decodedSql);
String[] procedurePath = procedureFullName.split("[.]");
if (procedurePath.length > 0) {
spName = procedurePath[procedurePath.length - 1];
} else {
throw new IllegalArgumentException(String.format(ERROR_SHORT_PROCEDURE_NAME_NOT_FOUND, procedureFullName));
}
return spName;
} | [
"public",
"static",
"String",
"getStoredProcedureShortNameFromSql",
"(",
"String",
"decodedSql",
")",
"{",
"String",
"spName",
"=",
"null",
";",
"Pattern",
"regexPattern",
"=",
"null",
";",
"Matcher",
"regexMatcher",
"=",
"null",
";",
"String",
"procedureFullName",
... | Returns short function name. Example:
schema.package.name - "name" would be returned
@param decodedSql SQL String which would be processed
@return procedure name | [
"Returns",
"short",
"function",
"name",
".",
"Example",
":",
"schema",
".",
"package",
".",
"name",
"-",
"name",
"would",
"be",
"returned"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java#L59-L76 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java | AsyncMutateInBuilder.arrayPrepend | public <T> AsyncMutateInBuilder arrayPrepend(String path, T value) {
this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_FIRST, path, value));
return this;
} | java | public <T> AsyncMutateInBuilder arrayPrepend(String path, T value) {
this.mutationSpecs.add(new MutationSpec(Mutation.ARRAY_PUSH_FIRST, path, value));
return this;
} | [
"public",
"<",
"T",
">",
"AsyncMutateInBuilder",
"arrayPrepend",
"(",
"String",
"path",
",",
"T",
"value",
")",
"{",
"this",
".",
"mutationSpecs",
".",
"add",
"(",
"new",
"MutationSpec",
"(",
"Mutation",
".",
"ARRAY_PUSH_FIRST",
",",
"path",
",",
"value",
... | Prepend to an existing array, pushing the value to the front/first position in
the array.
@param path the path of the array.
@param value the value to insert at the front of the array. | [
"Prepend",
"to",
"an",
"existing",
"array",
"pushing",
"the",
"value",
"to",
"the",
"front",
"/",
"first",
"position",
"in",
"the",
"array",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/AsyncMutateInBuilder.java#L871-L874 |
citrusframework/citrus | modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/FtpClient.java | FtpClient.listFiles | protected FtpMessage listFiles(ListCommand list, TestContext context) {
String remoteFilePath = Optional.ofNullable(list.getTarget())
.map(ListCommand.Target::getPath)
.map(context::replaceDynamicContentInString)
.orElse("");
try {
List<String> fileNames = new ArrayList<>();
FTPFile[] ftpFiles;
if (StringUtils.hasText(remoteFilePath)) {
ftpFiles = ftpClient.listFiles(remoteFilePath);
} else {
ftpFiles = ftpClient.listFiles(remoteFilePath);
}
for (FTPFile ftpFile : ftpFiles) {
fileNames.add(ftpFile.getName());
}
return FtpMessage.result(ftpClient.getReplyCode(), ftpClient.getReplyString(), fileNames);
} catch (IOException e) {
throw new CitrusRuntimeException(String.format("Failed to list files in path '%s'", remoteFilePath), e);
}
} | java | protected FtpMessage listFiles(ListCommand list, TestContext context) {
String remoteFilePath = Optional.ofNullable(list.getTarget())
.map(ListCommand.Target::getPath)
.map(context::replaceDynamicContentInString)
.orElse("");
try {
List<String> fileNames = new ArrayList<>();
FTPFile[] ftpFiles;
if (StringUtils.hasText(remoteFilePath)) {
ftpFiles = ftpClient.listFiles(remoteFilePath);
} else {
ftpFiles = ftpClient.listFiles(remoteFilePath);
}
for (FTPFile ftpFile : ftpFiles) {
fileNames.add(ftpFile.getName());
}
return FtpMessage.result(ftpClient.getReplyCode(), ftpClient.getReplyString(), fileNames);
} catch (IOException e) {
throw new CitrusRuntimeException(String.format("Failed to list files in path '%s'", remoteFilePath), e);
}
} | [
"protected",
"FtpMessage",
"listFiles",
"(",
"ListCommand",
"list",
",",
"TestContext",
"context",
")",
"{",
"String",
"remoteFilePath",
"=",
"Optional",
".",
"ofNullable",
"(",
"list",
".",
"getTarget",
"(",
")",
")",
".",
"map",
"(",
"ListCommand",
".",
"T... | Perform list files operation and provide file information as response.
@param list
@param context
@return | [
"Perform",
"list",
"files",
"operation",
"and",
"provide",
"file",
"information",
"as",
"response",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/FtpClient.java#L156-L179 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java | ProjectableSQLQuery.addFlag | @Override
public Q addFlag(Position position, String flag) {
return queryMixin.addFlag(new QueryFlag(position, flag));
} | java | @Override
public Q addFlag(Position position, String flag) {
return queryMixin.addFlag(new QueryFlag(position, flag));
} | [
"@",
"Override",
"public",
"Q",
"addFlag",
"(",
"Position",
"position",
",",
"String",
"flag",
")",
"{",
"return",
"queryMixin",
".",
"addFlag",
"(",
"new",
"QueryFlag",
"(",
"position",
",",
"flag",
")",
")",
";",
"}"
] | Add the given String literal as query flag
@param position position
@param flag query flag
@return the current object | [
"Add",
"the",
"given",
"String",
"literal",
"as",
"query",
"flag"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java#L133-L136 |
actframework/actframework | src/main/java/act/ws/WebSocketContext.java | WebSocketContext.sendJsonToTagged | public WebSocketContext sendJsonToTagged(Object data, String tag) {
return sendToTagged(JSON.toJSONString(data), tag);
} | java | public WebSocketContext sendJsonToTagged(Object data, String tag) {
return sendToTagged(JSON.toJSONString(data), tag);
} | [
"public",
"WebSocketContext",
"sendJsonToTagged",
"(",
"Object",
"data",
",",
"String",
"tag",
")",
"{",
"return",
"sendToTagged",
"(",
"JSON",
".",
"toJSONString",
"(",
"data",
")",
",",
"tag",
")",
";",
"}"
] | Send JSON representation of a data object to all connections connected to
the same URL of this context with the connection of this context excluded
@param data the data to be sent
@param tag the tag label
@return this context | [
"Send",
"JSON",
"representation",
"of",
"a",
"data",
"object",
"to",
"all",
"connections",
"connected",
"to",
"the",
"same",
"URL",
"of",
"this",
"context",
"with",
"the",
"connection",
"of",
"this",
"context",
"excluded"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketContext.java#L244-L246 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaLibraryLoader.java | AsperaLibraryLoader.extractFile | public static void extractFile(JarFile jar, JarEntry entry, File destPath) throws IOException {
InputStream in = null;
OutputStream out = null;
try {
in = jar.getInputStream(entry);
out = new FileOutputStream(destPath);
byte[] buf = new byte[1024];
for (int i = in.read(buf); i != -1; i = in.read(buf))
{
out.write(buf, 0, i);
}
} finally {
if(in != null) {
in.close();
}
if(out != null) {
out.close();
}
}
//Ensure persmissions are set correct on ascp, has to be done after the File has been created
if (entry.getName().equals("ascp")) {
destPath.setExecutable(true);
destPath.setWritable(true);
}
} | java | public static void extractFile(JarFile jar, JarEntry entry, File destPath) throws IOException {
InputStream in = null;
OutputStream out = null;
try {
in = jar.getInputStream(entry);
out = new FileOutputStream(destPath);
byte[] buf = new byte[1024];
for (int i = in.read(buf); i != -1; i = in.read(buf))
{
out.write(buf, 0, i);
}
} finally {
if(in != null) {
in.close();
}
if(out != null) {
out.close();
}
}
//Ensure persmissions are set correct on ascp, has to be done after the File has been created
if (entry.getName().equals("ascp")) {
destPath.setExecutable(true);
destPath.setWritable(true);
}
} | [
"public",
"static",
"void",
"extractFile",
"(",
"JarFile",
"jar",
",",
"JarEntry",
"entry",
",",
"File",
"destPath",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
"=",
"null",
";",
"OutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"in",
"=",
... | Extracts a jar entry from a jar file to a target location on the local file system
@param jar The jar in which the desired file resides
@param entry The desired entry (file) to extract from the jar
@param destPath The target location to extract the jar entry to
@throws IOException if any IO failure occurs during file extraction | [
"Extracts",
"a",
"jar",
"entry",
"from",
"a",
"jar",
"file",
"to",
"a",
"target",
"location",
"on",
"the",
"local",
"file",
"system"
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaLibraryLoader.java#L149-L175 |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java | GlUtil.createProgram | public static int createProgram(String vertexSource, String fragmentSource) {
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
if (vertexShader == 0) {
return 0;
}
int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
if (pixelShader == 0) {
return 0;
}
int program = GLES20.glCreateProgram();
checkGlError("glCreateProgram");
if (program == 0) {
Log.e(TAG, "Could not create program");
}
GLES20.glAttachShader(program, vertexShader);
checkGlError("glAttachShader");
GLES20.glAttachShader(program, pixelShader);
checkGlError("glAttachShader");
GLES20.glLinkProgram(program);
int[] linkStatus = new int[1];
GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
if (linkStatus[0] != GLES20.GL_TRUE) {
Log.e(TAG, "Could not link program: ");
Log.e(TAG, GLES20.glGetProgramInfoLog(program));
GLES20.glDeleteProgram(program);
program = 0;
}
return program;
} | java | public static int createProgram(String vertexSource, String fragmentSource) {
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
if (vertexShader == 0) {
return 0;
}
int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
if (pixelShader == 0) {
return 0;
}
int program = GLES20.glCreateProgram();
checkGlError("glCreateProgram");
if (program == 0) {
Log.e(TAG, "Could not create program");
}
GLES20.glAttachShader(program, vertexShader);
checkGlError("glAttachShader");
GLES20.glAttachShader(program, pixelShader);
checkGlError("glAttachShader");
GLES20.glLinkProgram(program);
int[] linkStatus = new int[1];
GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
if (linkStatus[0] != GLES20.GL_TRUE) {
Log.e(TAG, "Could not link program: ");
Log.e(TAG, GLES20.glGetProgramInfoLog(program));
GLES20.glDeleteProgram(program);
program = 0;
}
return program;
} | [
"public",
"static",
"int",
"createProgram",
"(",
"String",
"vertexSource",
",",
"String",
"fragmentSource",
")",
"{",
"int",
"vertexShader",
"=",
"loadShader",
"(",
"GLES20",
".",
"GL_VERTEX_SHADER",
",",
"vertexSource",
")",
";",
"if",
"(",
"vertexShader",
"=="... | Creates a new program from the supplied vertex and fragment shaders.
@return A handle to the program, or 0 on failure. | [
"Creates",
"a",
"new",
"program",
"from",
"the",
"supplied",
"vertex",
"and",
"fragment",
"shaders",
"."
] | train | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java#L50-L79 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.getbit | @Override
public Boolean getbit(final byte[] key, final long offset) {
checkIsInMultiOrPipeline();
client.getbit(key, offset);
return client.getIntegerReply() == 1;
} | java | @Override
public Boolean getbit(final byte[] key, final long offset) {
checkIsInMultiOrPipeline();
client.getbit(key, offset);
return client.getIntegerReply() == 1;
} | [
"@",
"Override",
"public",
"Boolean",
"getbit",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"long",
"offset",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"getbit",
"(",
"key",
",",
"offset",
")",
";",
"return",
"client",
... | Returns the bit value at offset in the string value stored at key
@param key
@param offset
@return | [
"Returns",
"the",
"bit",
"value",
"at",
"offset",
"in",
"the",
"string",
"value",
"stored",
"at",
"key"
] | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L3222-L3227 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/metadata/RepositoryTags.java | RepositoryTags.getOpeningTagById | public String getOpeningTagById(int elementId, String attributes)
{
return "<" + table.getKeyByValue(new Integer(elementId)) + " " + attributes + ">";
} | java | public String getOpeningTagById(int elementId, String attributes)
{
return "<" + table.getKeyByValue(new Integer(elementId)) + " " + attributes + ">";
} | [
"public",
"String",
"getOpeningTagById",
"(",
"int",
"elementId",
",",
"String",
"attributes",
")",
"{",
"return",
"\"<\"",
"+",
"table",
".",
"getKeyByValue",
"(",
"new",
"Integer",
"(",
"elementId",
")",
")",
"+",
"\" \"",
"+",
"attributes",
"+",
"\">\"",
... | returns the opening xml-tag associated with the repository element with
id <code>elementId</code>.
@return the resulting tag | [
"returns",
"the",
"opening",
"xml",
"-",
"tag",
"associated",
"with",
"the",
"repository",
"element",
"with",
"id",
"<code",
">",
"elementId<",
"/",
"code",
">",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/RepositoryTags.java#L231-L234 |
apiman/apiman | manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java | ExceptionFactory.apiVersionNotFoundException | public static final ApiVersionNotFoundException apiVersionNotFoundException(String apiId, String version) {
return new ApiVersionNotFoundException(Messages.i18n.format("ApiVersionDoesNotExist", apiId, version)); //$NON-NLS-1$
} | java | public static final ApiVersionNotFoundException apiVersionNotFoundException(String apiId, String version) {
return new ApiVersionNotFoundException(Messages.i18n.format("ApiVersionDoesNotExist", apiId, version)); //$NON-NLS-1$
} | [
"public",
"static",
"final",
"ApiVersionNotFoundException",
"apiVersionNotFoundException",
"(",
"String",
"apiId",
",",
"String",
"version",
")",
"{",
"return",
"new",
"ApiVersionNotFoundException",
"(",
"Messages",
".",
"i18n",
".",
"format",
"(",
"\"ApiVersionDoesNotE... | Creates an exception from an API id and version.
@param apiId the API id
@param version the API version
@return the exception | [
"Creates",
"an",
"exception",
"from",
"an",
"API",
"id",
"and",
"version",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java#L229-L231 |
mp911de/visualizr | visualizr-metrics/src/main/java/biz/paluch/visualizr/metrics/VisualizrReporter.java | VisualizrReporter.reportGauge | private void reportGauge(String name, Gauge gauge) {
String prefixedName = prefix(name);
Object value = gauge.getValue();
if (value instanceof Number) {
if (!snapshots.hasDescriptor(prefixedName)) {
snapshots.setDescriptor(prefixedName, MetricItem.Builder.create().count("gauge").build());
}
long timestamp = getTimestamp();
snapshots.addSnapshot(prefixedName, timestamp, (Map) map("gauge", value));
}
} | java | private void reportGauge(String name, Gauge gauge) {
String prefixedName = prefix(name);
Object value = gauge.getValue();
if (value instanceof Number) {
if (!snapshots.hasDescriptor(prefixedName)) {
snapshots.setDescriptor(prefixedName, MetricItem.Builder.create().count("gauge").build());
}
long timestamp = getTimestamp();
snapshots.addSnapshot(prefixedName, timestamp, (Map) map("gauge", value));
}
} | [
"private",
"void",
"reportGauge",
"(",
"String",
"name",
",",
"Gauge",
"gauge",
")",
"{",
"String",
"prefixedName",
"=",
"prefix",
"(",
"name",
")",
";",
"Object",
"value",
"=",
"gauge",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"instanceof",
... | Report a gauge using the field gauge. Only numeric values are used.
@param name
@param gauge | [
"Report",
"a",
"gauge",
"using",
"the",
"field",
"gauge",
".",
"Only",
"numeric",
"values",
"are",
"used",
"."
] | train | https://github.com/mp911de/visualizr/blob/57206391692e88b2c59d52d4f18faa4cdfd32a98/visualizr-metrics/src/main/java/biz/paluch/visualizr/metrics/VisualizrReporter.java#L231-L244 |
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.examplesMethod | public List<LabelTextObject> examplesMethod(UUID appId, String versionId, String modelId, ExamplesMethodOptionalParameter examplesMethodOptionalParameter) {
return examplesMethodWithServiceResponseAsync(appId, versionId, modelId, examplesMethodOptionalParameter).toBlocking().single().body();
} | java | public List<LabelTextObject> examplesMethod(UUID appId, String versionId, String modelId, ExamplesMethodOptionalParameter examplesMethodOptionalParameter) {
return examplesMethodWithServiceResponseAsync(appId, versionId, modelId, examplesMethodOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"LabelTextObject",
">",
"examplesMethod",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"String",
"modelId",
",",
"ExamplesMethodOptionalParameter",
"examplesMethodOptionalParameter",
")",
"{",
"return",
"examplesMethodWithServiceResponseAsyn... | Gets the utterances for the given model in the given app version.
@param appId The application ID.
@param versionId The version ID.
@param modelId The ID (GUID) of the model.
@param examplesMethodOptionalParameter 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 List<LabelTextObject> object if successful. | [
"Gets",
"the",
"utterances",
"for",
"the",
"given",
"model",
"in",
"the",
"given",
"app",
"version",
"."
] | 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#L2624-L2626 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java | BigtableSession.createManagedPool | protected ManagedChannel createManagedPool(String host, int channelCount) throws IOException {
ManagedChannel channelPool = createChannelPool(host, channelCount);
managedChannels.add(channelPool);
return channelPool;
} | java | protected ManagedChannel createManagedPool(String host, int channelCount) throws IOException {
ManagedChannel channelPool = createChannelPool(host, channelCount);
managedChannels.add(channelPool);
return channelPool;
} | [
"protected",
"ManagedChannel",
"createManagedPool",
"(",
"String",
"host",
",",
"int",
"channelCount",
")",
"throws",
"IOException",
"{",
"ManagedChannel",
"channelPool",
"=",
"createChannelPool",
"(",
"host",
",",
"channelCount",
")",
";",
"managedChannels",
".",
"... | Create a new {@link com.google.cloud.bigtable.grpc.io.ChannelPool}, with auth headers, that
will be cleaned up when the connection closes.
@param host a {@link java.lang.String} object.
@return a {@link com.google.cloud.bigtable.grpc.io.ChannelPool} object.
@throws java.io.IOException if any. | [
"Create",
"a",
"new",
"{",
"@link",
"com",
".",
"google",
".",
"cloud",
".",
"bigtable",
".",
"grpc",
".",
"io",
".",
"ChannelPool",
"}",
"with",
"auth",
"headers",
"that",
"will",
"be",
"cleaned",
"up",
"when",
"the",
"connection",
"closes",
"."
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/BigtableSession.java#L533-L537 |
j256/simplejmx | src/main/java/com/j256/simplejmx/client/JmxClient.java | JmxClient.getOperationsInfo | public MBeanOperationInfo[] getOperationsInfo(ObjectName name) throws JMException {
checkClientConnected();
try {
return mbeanConn.getMBeanInfo(name).getOperations();
} catch (Exception e) {
throw createJmException("Problems getting bean information from " + name, e);
}
} | java | public MBeanOperationInfo[] getOperationsInfo(ObjectName name) throws JMException {
checkClientConnected();
try {
return mbeanConn.getMBeanInfo(name).getOperations();
} catch (Exception e) {
throw createJmException("Problems getting bean information from " + name, e);
}
} | [
"public",
"MBeanOperationInfo",
"[",
"]",
"getOperationsInfo",
"(",
"ObjectName",
"name",
")",
"throws",
"JMException",
"{",
"checkClientConnected",
"(",
")",
";",
"try",
"{",
"return",
"mbeanConn",
".",
"getMBeanInfo",
"(",
"name",
")",
".",
"getOperations",
"(... | Return an array of the operations associated with the bean name. | [
"Return",
"an",
"array",
"of",
"the",
"operations",
"associated",
"with",
"the",
"bean",
"name",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L274-L281 |
finmath/finmath-lib | src/main/java/net/finmath/modelling/descriptor/xmlparser/FPMLParser.java | FPMLParser.getSwapLegProductDescriptor | private InterestRateSwapLegProductDescriptor getSwapLegProductDescriptor(Element leg) {
//is this a fixed rate leg?
boolean isFixed = leg.getElementsByTagName("calculationPeriodDates").item(0).getAttributes().getNamedItem("id").getTextContent().equalsIgnoreCase("fixedCalcPeriodDates");
//get start and end dates of contract
LocalDate startDate = LocalDate.parse(((Element) leg.getElementsByTagName("effectiveDate").item(0)).getElementsByTagName("unadjustedDate").item(0).getTextContent());
LocalDate maturityDate = LocalDate.parse(((Element) leg.getElementsByTagName("terminationDate").item(0)).getElementsByTagName("unadjustedDate").item(0).getTextContent());
//determine fixing/payment offset if available
int fixingOffsetDays = 0;
if(leg.getElementsByTagName("fixingDates").getLength() > 0) {
fixingOffsetDays = Integer.parseInt(((Element) leg.getElementsByTagName("fixingDates").item(0)).getElementsByTagName("periodMultiplier").item(0).getTextContent());
}
int paymentOffsetDays = 0;
if(leg.getElementsByTagName("paymentDaysOffset").getLength() > 0) {
paymentOffsetDays = Integer.parseInt(((Element) leg.getElementsByTagName("paymentDaysOffset").item(0)).getElementsByTagName("periodMultiplier").item(0).getTextContent());
}
//Crop xml date roll convention to match internal format
String xmlInput = ((Element) leg.getElementsByTagName("calculationPeriodDatesAdjustments").item(0)).getElementsByTagName("businessDayConvention").item(0).getTextContent();
xmlInput = xmlInput.replaceAll("ING", "");
DateRollConvention dateRollConvention = DateRollConvention.getEnum(xmlInput);
//get daycount convention
DaycountConvention daycountConvention = DaycountConvention.getEnum(leg.getElementsByTagName("dayCountFraction").item(0).getTextContent());
//get trade frequency
Frequency frequency = null;
Element calcNode = (Element) leg.getElementsByTagName("calculationPeriodFrequency").item(0);
int multiplier = Integer.parseInt(calcNode.getElementsByTagName("periodMultiplier").item(0).getTextContent());
switch(calcNode.getElementsByTagName("period").item(0).getTextContent().toUpperCase()) {
case "D" : if(multiplier == 1) {frequency = Frequency.DAILY;} break;
case "Y" : if(multiplier == 1) {frequency = Frequency.ANNUAL;} break;
case "M" : switch(multiplier) {
case 1 : frequency = Frequency.MONTHLY;
case 3 : frequency = Frequency.QUARTERLY;
case 6 : frequency = Frequency.SEMIANNUAL;
}
}
//build schedule
ScheduleDescriptor schedule = new ScheduleDescriptor(startDate, maturityDate, frequency, daycountConvention, shortPeriodConvention,
dateRollConvention, abstractBusinessdayCalendar, fixingOffsetDays, paymentOffsetDays);
// get notional
double notional = Double.parseDouble(((Element) leg.getElementsByTagName("notionalSchedule").item(0)).getElementsByTagName("initialValue").item(0).getTextContent());
// get fixed rate and forward curve if applicable
double spread = 0;
String forwardCurveName = "";
if(isFixed) {
spread = Double.parseDouble(((Element) leg.getElementsByTagName("fixedRateSchedule").item(0)).getElementsByTagName("initialValue").item(0).getTextContent());
} else {
forwardCurveName = leg.getElementsByTagName("floatingRateIndex").item(0).getTextContent();
}
return new InterestRateSwapLegProductDescriptor(forwardCurveName, discountCurveName, schedule, notional, spread, false);
} | java | private InterestRateSwapLegProductDescriptor getSwapLegProductDescriptor(Element leg) {
//is this a fixed rate leg?
boolean isFixed = leg.getElementsByTagName("calculationPeriodDates").item(0).getAttributes().getNamedItem("id").getTextContent().equalsIgnoreCase("fixedCalcPeriodDates");
//get start and end dates of contract
LocalDate startDate = LocalDate.parse(((Element) leg.getElementsByTagName("effectiveDate").item(0)).getElementsByTagName("unadjustedDate").item(0).getTextContent());
LocalDate maturityDate = LocalDate.parse(((Element) leg.getElementsByTagName("terminationDate").item(0)).getElementsByTagName("unadjustedDate").item(0).getTextContent());
//determine fixing/payment offset if available
int fixingOffsetDays = 0;
if(leg.getElementsByTagName("fixingDates").getLength() > 0) {
fixingOffsetDays = Integer.parseInt(((Element) leg.getElementsByTagName("fixingDates").item(0)).getElementsByTagName("periodMultiplier").item(0).getTextContent());
}
int paymentOffsetDays = 0;
if(leg.getElementsByTagName("paymentDaysOffset").getLength() > 0) {
paymentOffsetDays = Integer.parseInt(((Element) leg.getElementsByTagName("paymentDaysOffset").item(0)).getElementsByTagName("periodMultiplier").item(0).getTextContent());
}
//Crop xml date roll convention to match internal format
String xmlInput = ((Element) leg.getElementsByTagName("calculationPeriodDatesAdjustments").item(0)).getElementsByTagName("businessDayConvention").item(0).getTextContent();
xmlInput = xmlInput.replaceAll("ING", "");
DateRollConvention dateRollConvention = DateRollConvention.getEnum(xmlInput);
//get daycount convention
DaycountConvention daycountConvention = DaycountConvention.getEnum(leg.getElementsByTagName("dayCountFraction").item(0).getTextContent());
//get trade frequency
Frequency frequency = null;
Element calcNode = (Element) leg.getElementsByTagName("calculationPeriodFrequency").item(0);
int multiplier = Integer.parseInt(calcNode.getElementsByTagName("periodMultiplier").item(0).getTextContent());
switch(calcNode.getElementsByTagName("period").item(0).getTextContent().toUpperCase()) {
case "D" : if(multiplier == 1) {frequency = Frequency.DAILY;} break;
case "Y" : if(multiplier == 1) {frequency = Frequency.ANNUAL;} break;
case "M" : switch(multiplier) {
case 1 : frequency = Frequency.MONTHLY;
case 3 : frequency = Frequency.QUARTERLY;
case 6 : frequency = Frequency.SEMIANNUAL;
}
}
//build schedule
ScheduleDescriptor schedule = new ScheduleDescriptor(startDate, maturityDate, frequency, daycountConvention, shortPeriodConvention,
dateRollConvention, abstractBusinessdayCalendar, fixingOffsetDays, paymentOffsetDays);
// get notional
double notional = Double.parseDouble(((Element) leg.getElementsByTagName("notionalSchedule").item(0)).getElementsByTagName("initialValue").item(0).getTextContent());
// get fixed rate and forward curve if applicable
double spread = 0;
String forwardCurveName = "";
if(isFixed) {
spread = Double.parseDouble(((Element) leg.getElementsByTagName("fixedRateSchedule").item(0)).getElementsByTagName("initialValue").item(0).getTextContent());
} else {
forwardCurveName = leg.getElementsByTagName("floatingRateIndex").item(0).getTextContent();
}
return new InterestRateSwapLegProductDescriptor(forwardCurveName, discountCurveName, schedule, notional, spread, false);
} | [
"private",
"InterestRateSwapLegProductDescriptor",
"getSwapLegProductDescriptor",
"(",
"Element",
"leg",
")",
"{",
"//is this a fixed rate leg?\r",
"boolean",
"isFixed",
"=",
"leg",
".",
"getElementsByTagName",
"(",
"\"calculationPeriodDates\"",
")",
".",
"item",
"(",
"0",
... | Construct an InterestRateSwapLegProductDescriptor from a node in a FpML file.
@param leg The node containing the leg.
@return Descriptor of the swap leg. | [
"Construct",
"an",
"InterestRateSwapLegProductDescriptor",
"from",
"a",
"node",
"in",
"a",
"FpML",
"file",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/modelling/descriptor/xmlparser/FPMLParser.java#L128-L186 |
joniles/mpxj | src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java | ConceptDrawProjectReader.readExceptionDay | private void readExceptionDay(ProjectCalendar mpxjCalendar, ExceptedDay day)
{
ProjectCalendarException mpxjException = mpxjCalendar.addCalendarException(day.getDate(), day.getDate());
if (day.isIsDayWorking())
{
for (Document.Calendars.Calendar.ExceptedDays.ExceptedDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod())
{
mpxjException.addRange(new DateRange(period.getFrom(), period.getTo()));
}
}
} | java | private void readExceptionDay(ProjectCalendar mpxjCalendar, ExceptedDay day)
{
ProjectCalendarException mpxjException = mpxjCalendar.addCalendarException(day.getDate(), day.getDate());
if (day.isIsDayWorking())
{
for (Document.Calendars.Calendar.ExceptedDays.ExceptedDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod())
{
mpxjException.addRange(new DateRange(period.getFrom(), period.getTo()));
}
}
} | [
"private",
"void",
"readExceptionDay",
"(",
"ProjectCalendar",
"mpxjCalendar",
",",
"ExceptedDay",
"day",
")",
"{",
"ProjectCalendarException",
"mpxjException",
"=",
"mpxjCalendar",
".",
"addCalendarException",
"(",
"day",
".",
"getDate",
"(",
")",
",",
"day",
".",
... | Read an exception day for a calendar.
@param mpxjCalendar ProjectCalendar instance
@param day ConceptDraw PROJECT exception day | [
"Read",
"an",
"exception",
"day",
"for",
"a",
"calendar",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L271-L281 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readUtf8Lines | public static List<String> readUtf8Lines(File file) throws IORuntimeException {
return readLines(file, CharsetUtil.CHARSET_UTF_8);
} | java | public static List<String> readUtf8Lines(File file) throws IORuntimeException {
return readLines(file, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readUtf8Lines",
"(",
"File",
"file",
")",
"throws",
"IORuntimeException",
"{",
"return",
"readLines",
"(",
"file",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 从文件中读取每一行数据
@param file 文件
@return 文件中的每行内容的集合List
@throws IORuntimeException IO异常
@since 3.1.1 | [
"从文件中读取每一行数据"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2368-L2370 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/fdt/PostProcessor.java | PostProcessor.getGroupList | public List<Group> getGroupList(final int[] priKeyIndices, final int numStdDev,
final int limit) {
//allows subsequent queries with different priKeyIndices without rebuilding the map
if (!mapValid) { populateMap(priKeyIndices); }
return populateList(numStdDev, limit);
} | java | public List<Group> getGroupList(final int[] priKeyIndices, final int numStdDev,
final int limit) {
//allows subsequent queries with different priKeyIndices without rebuilding the map
if (!mapValid) { populateMap(priKeyIndices); }
return populateList(numStdDev, limit);
} | [
"public",
"List",
"<",
"Group",
">",
"getGroupList",
"(",
"final",
"int",
"[",
"]",
"priKeyIndices",
",",
"final",
"int",
"numStdDev",
",",
"final",
"int",
"limit",
")",
"{",
"//allows subsequent queries with different priKeyIndices without rebuilding the map",
"if",
... | Return the most frequent Groups associated with Primary Keys based on the size of the groups.
@param priKeyIndices the indices of the primary dimensions
@param numStdDev the number of standard deviations for the error bounds, this value is an
integer and must be one of 1, 2, or 3.
<a href="{@docRoot}/resources/dictionary.html#numStdDev">See Number of Standard Deviations</a>
@param limit the maximum number of rows to return. If ≤ 0, all rows will be returned.
@return the most frequent Groups associated with Primary Keys based on the size of the groups. | [
"Return",
"the",
"most",
"frequent",
"Groups",
"associated",
"with",
"Primary",
"Keys",
"based",
"on",
"the",
"size",
"of",
"the",
"groups",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/PostProcessor.java#L73-L78 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java | base_resource.perform_operation | public base_response perform_operation(nitro_service service, options option) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
base_response response = post_request(service, option);
return response;
} | java | public base_response perform_operation(nitro_service service, options option) throws Exception
{
if (!service.isLogin() && !get_object_type().equals("login"))
service.login();
base_response response = post_request(service, option);
return response;
} | [
"public",
"base_response",
"perform_operation",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
"&&",
"!",
"get_object_type",
"(",
")",
".",
"equals",
"(",
"\"lo... | Use this method to perform a clear/sync/link/unlink/save ...etc
operation on netscaler resource.
@param service nitro_service object.
@param option options object with action that is to be performed set.
@return status of the operation performed.
@throws Exception Nitro exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"clear",
"/",
"sync",
"/",
"link",
"/",
"unlink",
"/",
"save",
"...",
"etc",
"operation",
"on",
"netscaler",
"resource",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L407-L414 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.FRAME | public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
if (scrolling != null)
htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
return htmltree;
} | java | public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
if (scrolling != null)
htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"FRAME",
"(",
"String",
"src",
",",
"String",
"name",
",",
"String",
"title",
",",
"String",
"scrolling",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"FRAME",
")",
";",
"htmltree",
".",
"... | Generates a FRAME tag.
@param src the url of the document to be shown in the frame
@param name specifies the name of the frame
@param title the title for the frame
@param scrolling specifies whether to display scrollbars in the frame
@return an HtmlTree object for the FRAME tag | [
"Generates",
"a",
"FRAME",
"tag",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L339-L347 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.getOffsetForPattern | public int getOffsetForPattern(IXtextDocument document, int startOffset, String pattern) {
final Pattern compiledPattern = Pattern.compile(pattern);
final Matcher matcher = compiledPattern.matcher(document.get());
if (matcher.find(startOffset)) {
final int end = matcher.end();
return end;
}
return -1;
} | java | public int getOffsetForPattern(IXtextDocument document, int startOffset, String pattern) {
final Pattern compiledPattern = Pattern.compile(pattern);
final Matcher matcher = compiledPattern.matcher(document.get());
if (matcher.find(startOffset)) {
final int end = matcher.end();
return end;
}
return -1;
} | [
"public",
"int",
"getOffsetForPattern",
"(",
"IXtextDocument",
"document",
",",
"int",
"startOffset",
",",
"String",
"pattern",
")",
"{",
"final",
"Pattern",
"compiledPattern",
"=",
"Pattern",
".",
"compile",
"(",
"pattern",
")",
";",
"final",
"Matcher",
"matche... | Replies the offset that corresponds to the given regular expression pattern.
@param document the document to parse.
@param startOffset the offset in the text at which the pattern must be recognized.
@param pattern the regular expression pattern.
@return the offset (greater or equal to the startOffset), or <code>-1</code> if the pattern
cannot be recognized. | [
"Replies",
"the",
"offset",
"that",
"corresponds",
"to",
"the",
"given",
"regular",
"expression",
"pattern",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L558-L566 |
amzn/ion-java | src/com/amazon/ion/impl/lite/IonStructLite.java | IonStructLite._add | private void _add(String fieldName, IonValueLite child)
{
hasNullFieldName |= fieldName == null;
int size = get_child_count();
// add this to the Container child collection
add(size, child);
// if we have a hash map we need to update it now
if (_field_map != null) {
add_field(fieldName, child._elementid());
}
} | java | private void _add(String fieldName, IonValueLite child)
{
hasNullFieldName |= fieldName == null;
int size = get_child_count();
// add this to the Container child collection
add(size, child);
// if we have a hash map we need to update it now
if (_field_map != null) {
add_field(fieldName, child._elementid());
}
} | [
"private",
"void",
"_add",
"(",
"String",
"fieldName",
",",
"IonValueLite",
"child",
")",
"{",
"hasNullFieldName",
"|=",
"fieldName",
"==",
"null",
";",
"int",
"size",
"=",
"get_child_count",
"(",
")",
";",
"// add this to the Container child collection",
"add",
"... | Validates the child and checks locks.
@param fieldName may be null
@param child must be validated and have field name or id set | [
"Validates",
"the",
"child",
"and",
"checks",
"locks",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonStructLite.java#L480-L492 |
BreizhBeans/ThriftMongoBridge | src/main/java/org/breizhbeans/thrift/tools/thriftmongobridge/TBSONDeserializer.java | TBSONDeserializer.partialDeserialize | public void partialDeserialize(TBase<?,?> base, DBObject dbObject, TFieldIdEnum... fieldIds) throws TException {
try {
protocol_.setDBOject(dbObject);
protocol_.setBaseObject( base );
protocol_.setFieldIdsFilter(base, fieldIds);
base.read(protocol_);
} finally {
protocol_.reset();
}
} | java | public void partialDeserialize(TBase<?,?> base, DBObject dbObject, TFieldIdEnum... fieldIds) throws TException {
try {
protocol_.setDBOject(dbObject);
protocol_.setBaseObject( base );
protocol_.setFieldIdsFilter(base, fieldIds);
base.read(protocol_);
} finally {
protocol_.reset();
}
} | [
"public",
"void",
"partialDeserialize",
"(",
"TBase",
"<",
"?",
",",
"?",
">",
"base",
",",
"DBObject",
"dbObject",
",",
"TFieldIdEnum",
"...",
"fieldIds",
")",
"throws",
"TException",
"{",
"try",
"{",
"protocol_",
".",
"setDBOject",
"(",
"dbObject",
")",
... | Deserialize only a single Thrift object
from a byte record.
@param base The object to read into
@param dbObject The serialized object to read from
@param fieldIds The FieldId's to extract
@throws TException | [
"Deserialize",
"only",
"a",
"single",
"Thrift",
"object",
"from",
"a",
"byte",
"record",
"."
] | train | https://github.com/BreizhBeans/ThriftMongoBridge/blob/0b86606601a818b6c2489f6920c3780beda3e8c8/src/main/java/org/breizhbeans/thrift/tools/thriftmongobridge/TBSONDeserializer.java#L62-L72 |
apache/groovy | src/main/groovy/groovy/util/FactoryBuilderSupport.java | FactoryBuilderSupport.setNodeAttributes | protected void setNodeAttributes(Object node, Map attributes) {
// set the properties
//noinspection unchecked
for (Map.Entry entry : (Set<Map.Entry>) attributes.entrySet()) {
String property = entry.getKey().toString();
Object value = entry.getValue();
InvokerHelper.setProperty(node, property, value);
}
} | java | protected void setNodeAttributes(Object node, Map attributes) {
// set the properties
//noinspection unchecked
for (Map.Entry entry : (Set<Map.Entry>) attributes.entrySet()) {
String property = entry.getKey().toString();
Object value = entry.getValue();
InvokerHelper.setProperty(node, property, value);
}
} | [
"protected",
"void",
"setNodeAttributes",
"(",
"Object",
"node",
",",
"Map",
"attributes",
")",
"{",
"// set the properties",
"//noinspection unchecked",
"for",
"(",
"Map",
".",
"Entry",
"entry",
":",
"(",
"Set",
"<",
"Map",
".",
"Entry",
">",
")",
"attributes... | Maps attributes key/values to properties on node.
@param node the object from the node
@param attributes the attributes to be set | [
"Maps",
"attributes",
"key",
"/",
"values",
"to",
"properties",
"on",
"node",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L1098-L1106 |
cdapio/tigon | tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/ProgramRunnableResourceReporter.java | ProgramRunnableResourceReporter.getMetricContext | private String getMetricContext(Program program, TwillContext context) {
String metricContext = program.getName();
metricContext += "." + context.getSpecification().getName() + "." + context.getInstanceId();
return metricContext;
} | java | private String getMetricContext(Program program, TwillContext context) {
String metricContext = program.getName();
metricContext += "." + context.getSpecification().getName() + "." + context.getInstanceId();
return metricContext;
} | [
"private",
"String",
"getMetricContext",
"(",
"Program",
"program",
",",
"TwillContext",
"context",
")",
"{",
"String",
"metricContext",
"=",
"program",
".",
"getName",
"(",
")",
";",
"metricContext",
"+=",
"\".\"",
"+",
"context",
".",
"getSpecification",
"(",
... | Returns the metric context. A metric context is of the form {flowY}.{flowletZ}. | [
"Returns",
"the",
"metric",
"context",
".",
"A",
"metric",
"context",
"is",
"of",
"the",
"form",
"{",
"flowY",
"}",
".",
"{",
"flowletZ",
"}",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/ProgramRunnableResourceReporter.java#L49-L53 |
xcesco/kripton | kripton-core/src/main/java/com/abubusoft/kripton/common/DynamicByteBufferHelper.java | DynamicByteBufferHelper.addDouble | public static byte[] addDouble(byte[] array, double value) {
byte[] holder = new byte[4];
doubleTo(holder, 0, value);
return add(array, holder);
} | java | public static byte[] addDouble(byte[] array, double value) {
byte[] holder = new byte[4];
doubleTo(holder, 0, value);
return add(array, holder);
} | [
"public",
"static",
"byte",
"[",
"]",
"addDouble",
"(",
"byte",
"[",
"]",
"array",
",",
"double",
"value",
")",
"{",
"byte",
"[",
"]",
"holder",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"doubleTo",
"(",
"holder",
",",
"0",
",",
"value",
")",
";",
... | Adds the double.
@param array the array
@param value the value
@return the byte[] | [
"Adds",
"the",
"double",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/DynamicByteBufferHelper.java#L912-L917 |
Jasig/uPortal | uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java | AuthorizationImpl.canPrincipalManage | @Override
@RequestCache
public boolean canPrincipalManage(IAuthorizationPrincipal principal, String portletDefinitionId)
throws AuthorizationException {
final String owner = IPermission.PORTAL_PUBLISH;
final String target = IPermission.PORTLET_PREFIX + portletDefinitionId;
// Retrieve the indicated portlet from the portlet registry store and
// determine its current lifecycle state.
IPortletDefinition portlet =
this.portletDefinitionRegistry.getPortletDefinition(portletDefinitionId);
if (portlet == null) {
/*
* Is this what happens when a portlet is new? Shouldn't we
* be checking PORTLET_MANAGER_CREATED_ACTIVITY in that case?
*/
return doesPrincipalHavePermission(
principal, owner, IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY, target);
}
/*
* The following code assumes that later lifecycle states imply permission
* for earlier lifecycle states. For example, if a user has permission to
* manage an expired channel, we assume s/he also has permission to
* create, approve, and publish channels. The following code counts
* channels with auto-publish or auto-expiration dates set as requiring
* publish or expiration permissions for management, even though the channel
* may not yet be published or expired.
*/
final IPortletLifecycleEntry highestLifecycleEntryDefined =
portlet.getLifecycle().get(portlet.getLifecycle().size() - 1);
String activity;
switch (highestLifecycleEntryDefined.getLifecycleState()) {
case CREATED:
activity = IPermission.PORTLET_MANAGER_CREATED_ACTIVITY;
break;
case APPROVED:
activity = IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY;
break;
case PUBLISHED:
activity = IPermission.PORTLET_MANAGER_ACTIVITY;
break;
case EXPIRED:
activity = IPermission.PORTLET_MANAGER_EXPIRED_ACTIVITY;
break;
case MAINTENANCE:
activity = IPermission.PORTLET_MANAGER_MAINTENANCE_ACTIVITY;
break;
default:
final String msg =
"Unrecognized portlet lifecycle state: "
+ highestLifecycleEntryDefined.getLifecycleState();
throw new IllegalStateException(msg);
}
return doesPrincipalHavePermission(principal, owner, activity, target);
} | java | @Override
@RequestCache
public boolean canPrincipalManage(IAuthorizationPrincipal principal, String portletDefinitionId)
throws AuthorizationException {
final String owner = IPermission.PORTAL_PUBLISH;
final String target = IPermission.PORTLET_PREFIX + portletDefinitionId;
// Retrieve the indicated portlet from the portlet registry store and
// determine its current lifecycle state.
IPortletDefinition portlet =
this.portletDefinitionRegistry.getPortletDefinition(portletDefinitionId);
if (portlet == null) {
/*
* Is this what happens when a portlet is new? Shouldn't we
* be checking PORTLET_MANAGER_CREATED_ACTIVITY in that case?
*/
return doesPrincipalHavePermission(
principal, owner, IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY, target);
}
/*
* The following code assumes that later lifecycle states imply permission
* for earlier lifecycle states. For example, if a user has permission to
* manage an expired channel, we assume s/he also has permission to
* create, approve, and publish channels. The following code counts
* channels with auto-publish or auto-expiration dates set as requiring
* publish or expiration permissions for management, even though the channel
* may not yet be published or expired.
*/
final IPortletLifecycleEntry highestLifecycleEntryDefined =
portlet.getLifecycle().get(portlet.getLifecycle().size() - 1);
String activity;
switch (highestLifecycleEntryDefined.getLifecycleState()) {
case CREATED:
activity = IPermission.PORTLET_MANAGER_CREATED_ACTIVITY;
break;
case APPROVED:
activity = IPermission.PORTLET_MANAGER_APPROVED_ACTIVITY;
break;
case PUBLISHED:
activity = IPermission.PORTLET_MANAGER_ACTIVITY;
break;
case EXPIRED:
activity = IPermission.PORTLET_MANAGER_EXPIRED_ACTIVITY;
break;
case MAINTENANCE:
activity = IPermission.PORTLET_MANAGER_MAINTENANCE_ACTIVITY;
break;
default:
final String msg =
"Unrecognized portlet lifecycle state: "
+ highestLifecycleEntryDefined.getLifecycleState();
throw new IllegalStateException(msg);
}
return doesPrincipalHavePermission(principal, owner, activity, target);
} | [
"@",
"Override",
"@",
"RequestCache",
"public",
"boolean",
"canPrincipalManage",
"(",
"IAuthorizationPrincipal",
"principal",
",",
"String",
"portletDefinitionId",
")",
"throws",
"AuthorizationException",
"{",
"final",
"String",
"owner",
"=",
"IPermission",
".",
"PORTAL... | Answers if the principal has permission to MANAGE this Channel.
@param principal IAuthorizationPrincipal The user who wants to manage the portlet
@param portletDefinitionId The Id of the portlet being managed
@return True if the specified user is allowed to manage the specified portlet; otherwise
false
@exception AuthorizationException indicates authorization information could not be retrieved. | [
"Answers",
"if",
"the",
"principal",
"has",
"permission",
"to",
"MANAGE",
"this",
"Channel",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java#L273-L332 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.beginFailoverPriorityChangeAsync | public Observable<Void> beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) {
return beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, List<FailoverPolicy> failoverPolicies) {
return beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginFailoverPriorityChangeAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"List",
"<",
"FailoverPolicy",
">",
"failoverPolicies",
")",
"{",
"return",
"beginFailoverPriorityChangeWithServiceResponseAs... | Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param failoverPolicies List of failover policies.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Changes",
"the",
"failover",
"priority",
"for",
"the",
"Azure",
"Cosmos",
"DB",
"database",
"account",
".",
"A",
"failover",
"priority",
"of",
"0",
"indicates",
"a",
"write",
"region",
".",
"The",
"maximum",
"value",
"for",
"a",
"failover",
"priority",
"=",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L874-L881 |
xwiki/xwiki-rendering | xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/parser/xhtml/wikimodel/XHTMLXWikiGeneratorListener.java | XHTMLXWikiGeneratorListener.computeResourceReference | private ResourceReference computeResourceReference(String rawReference)
{
ResourceReference reference;
// Do we have a valid URL?
Matcher matcher = URL_SCHEME_PATTERN.matcher(rawReference);
if (matcher.lookingAt()) {
// We have UC1
reference = new ResourceReference(rawReference, ResourceType.URL);
} else {
// We have UC2
reference = new ResourceReference(rawReference, ResourceType.PATH);
}
return reference;
} | java | private ResourceReference computeResourceReference(String rawReference)
{
ResourceReference reference;
// Do we have a valid URL?
Matcher matcher = URL_SCHEME_PATTERN.matcher(rawReference);
if (matcher.lookingAt()) {
// We have UC1
reference = new ResourceReference(rawReference, ResourceType.URL);
} else {
// We have UC2
reference = new ResourceReference(rawReference, ResourceType.PATH);
}
return reference;
} | [
"private",
"ResourceReference",
"computeResourceReference",
"(",
"String",
"rawReference",
")",
"{",
"ResourceReference",
"reference",
";",
"// Do we have a valid URL?",
"Matcher",
"matcher",
"=",
"URL_SCHEME_PATTERN",
".",
"matcher",
"(",
"rawReference",
")",
";",
"if",
... | Recognize the passed reference and figure out what type of link it should be:
<ul>
<li>UC1: the reference points to a valid URL, we return a reference of type "url",
e.g. {@code http://server/path/reference#anchor}</li>
<li>UC2: the reference is not a valid URL, we return a reference of type "path",
e.g. {@code path/reference#anchor}</li>
</ul>
@param rawReference the full reference (e.g. "/some/path/something#other")
@return the properly typed {@link ResourceReference} matching the use cases | [
"Recognize",
"the",
"passed",
"reference",
"and",
"figure",
"out",
"what",
"type",
"of",
"link",
"it",
"should",
"be",
":",
"<ul",
">",
"<li",
">",
"UC1",
":",
"the",
"reference",
"points",
"to",
"a",
"valid",
"URL",
"we",
"return",
"a",
"reference",
"... | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/parser/xhtml/wikimodel/XHTMLXWikiGeneratorListener.java#L152-L167 |
liyiorg/weixin-popular | src/main/java/weixin/popular/util/SignatureUtil.java | SignatureUtil.validateSign | public static boolean validateSign(Map<String,String> map,String key){
return validateSign(map, null, key);
} | java | public static boolean validateSign(Map<String,String> map,String key){
return validateSign(map, null, key);
} | [
"public",
"static",
"boolean",
"validateSign",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"String",
"key",
")",
"{",
"return",
"validateSign",
"(",
"map",
",",
"null",
",",
"key",
")",
";",
"}"
] | mch 支付、代扣异步通知签名验证
@param map 参与签名的参数
@param key mch key
@return boolean | [
"mch",
"支付、代扣异步通知签名验证"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/SignatureUtil.java#L79-L81 |
JoeKerouac/utils | src/main/java/com/joe/utils/concurrent/ThreadUtil.java | ThreadUtil.createPool | public static ExecutorService createPool(PoolType type, String format) {
//检查是否符合格式
String.format(format, 0);
//线程工厂
ThreadFactory factory = new ThreadFactory() {
AtomicInteger counter = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
return new Thread(r, String.format(format, counter.getAndAdd(1)));
}
};
return build(type, factory);
} | java | public static ExecutorService createPool(PoolType type, String format) {
//检查是否符合格式
String.format(format, 0);
//线程工厂
ThreadFactory factory = new ThreadFactory() {
AtomicInteger counter = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
return new Thread(r, String.format(format, counter.getAndAdd(1)));
}
};
return build(type, factory);
} | [
"public",
"static",
"ExecutorService",
"createPool",
"(",
"PoolType",
"type",
",",
"String",
"format",
")",
"{",
"//检查是否符合格式",
"String",
".",
"format",
"(",
"format",
",",
"0",
")",
";",
"//线程工厂",
"ThreadFactory",
"factory",
"=",
"new",
"ThreadFactory",
"(",
... | 创建指定类型的线程池
@param type 线程池类型
@param format 线程名格式,格式为:format-%d,其中%d将被替换为从0开始的数字序列,不能为null
@return 返回指定类型的线程池 | [
"创建指定类型的线程池"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/concurrent/ThreadUtil.java#L102-L116 |
ReactiveX/RxAndroid | rxandroid/src/main/java/io/reactivex/android/schedulers/AndroidSchedulers.java | AndroidSchedulers.from | @SuppressLint("NewApi") // Checking for an @hide API.
public static Scheduler from(Looper looper, boolean async) {
if (looper == null) throw new NullPointerException("looper == null");
if (Build.VERSION.SDK_INT < 16) {
async = false;
} else if (async && Build.VERSION.SDK_INT < 22) {
// Confirm that the method is available on this API level despite being @hide.
Message message = Message.obtain();
try {
message.setAsynchronous(true);
} catch (NoSuchMethodError e) {
async = false;
}
message.recycle();
}
return new HandlerScheduler(new Handler(looper), async);
} | java | @SuppressLint("NewApi") // Checking for an @hide API.
public static Scheduler from(Looper looper, boolean async) {
if (looper == null) throw new NullPointerException("looper == null");
if (Build.VERSION.SDK_INT < 16) {
async = false;
} else if (async && Build.VERSION.SDK_INT < 22) {
// Confirm that the method is available on this API level despite being @hide.
Message message = Message.obtain();
try {
message.setAsynchronous(true);
} catch (NoSuchMethodError e) {
async = false;
}
message.recycle();
}
return new HandlerScheduler(new Handler(looper), async);
} | [
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"// Checking for an @hide API.",
"public",
"static",
"Scheduler",
"from",
"(",
"Looper",
"looper",
",",
"boolean",
"async",
")",
"{",
"if",
"(",
"looper",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"("... | A {@link Scheduler} which executes actions on {@code looper}.
@param async if true, the scheduler will use async messaging on API >= 16 to avoid VSYNC
locking. On API < 16 this value is ignored.
@see Message#setAsynchronous(boolean) | [
"A",
"{",
"@link",
"Scheduler",
"}",
"which",
"executes",
"actions",
"on",
"{",
"@code",
"looper",
"}",
"."
] | train | https://github.com/ReactiveX/RxAndroid/blob/e58f44d8842c082698c1b5e3d367f805b95d8509/rxandroid/src/main/java/io/reactivex/android/schedulers/AndroidSchedulers.java#L57-L73 |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java | DialogRootView.addAreas | public final void addAreas(@NonNull final Map<ViewType, View> areas) {
this.areas = new TreeMap<>(new AreaComparator());
this.dividers = new HashMap<>();
for (Map.Entry<ViewType, View> entry : areas.entrySet()) {
ViewType viewType = entry.getKey();
View view = entry.getValue();
if (viewType instanceof AreaViewType) {
this.areas.put(((AreaViewType) viewType).getArea(), view);
} else if (viewType instanceof DividerViewType && view instanceof Divider) {
this.dividers.put(((DividerViewType) viewType).getLocation(), (Divider) view);
}
}
addAreas();
addDividers();
registerScrollLayoutListener();
} | java | public final void addAreas(@NonNull final Map<ViewType, View> areas) {
this.areas = new TreeMap<>(new AreaComparator());
this.dividers = new HashMap<>();
for (Map.Entry<ViewType, View> entry : areas.entrySet()) {
ViewType viewType = entry.getKey();
View view = entry.getValue();
if (viewType instanceof AreaViewType) {
this.areas.put(((AreaViewType) viewType).getArea(), view);
} else if (viewType instanceof DividerViewType && view instanceof Divider) {
this.dividers.put(((DividerViewType) viewType).getLocation(), (Divider) view);
}
}
addAreas();
addDividers();
registerScrollLayoutListener();
} | [
"public",
"final",
"void",
"addAreas",
"(",
"@",
"NonNull",
"final",
"Map",
"<",
"ViewType",
",",
"View",
">",
"areas",
")",
"{",
"this",
".",
"areas",
"=",
"new",
"TreeMap",
"<>",
"(",
"new",
"AreaComparator",
"(",
")",
")",
";",
"this",
".",
"divid... | Adds the different areas of a dialog to the root view.
@param areas
A map, which contains the areas, which should be added, as keys and their
corresponding views as values, as an instance of the type {@link Map}. The map may
not be null | [
"Adds",
"the",
"different",
"areas",
"of",
"a",
"dialog",
"to",
"the",
"root",
"view",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java#L1189-L1207 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/Reader.java | Reader.readString | public String readString(final String charset) throws IOException {
byte ch;
int cnt = 0;
final byte [] byteArrBuff = new byte[byteBuffer.remaining()];
while (byteBuffer.remaining() > 0 && ((ch = byteBuffer.get()) != 0)) {
byteArrBuff[cnt++] = ch;
}
return new String(byteArrBuff,0,cnt);
} | java | public String readString(final String charset) throws IOException {
byte ch;
int cnt = 0;
final byte [] byteArrBuff = new byte[byteBuffer.remaining()];
while (byteBuffer.remaining() > 0 && ((ch = byteBuffer.get()) != 0)) {
byteArrBuff[cnt++] = ch;
}
return new String(byteArrBuff,0,cnt);
} | [
"public",
"String",
"readString",
"(",
"final",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"byte",
"ch",
";",
"int",
"cnt",
"=",
"0",
";",
"final",
"byte",
"[",
"]",
"byteArrBuff",
"=",
"new",
"byte",
"[",
"byteBuffer",
".",
"remaining",
"("... | Reads a string from the buffer, looks for a 0 to end the string
@param charset the charset to use, for example ASCII
@return the read string
@throws java.io.IOException if it is not possible to create the string from the buffer | [
"Reads",
"a",
"string",
"from",
"the",
"buffer",
"looks",
"for",
"a",
"0",
"to",
"end",
"the",
"string"
] | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/Reader.java#L53-L61 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_redirection_POST | public OvhRedirection zone_zoneName_redirection_POST(String zoneName, String description, String keywords, String subDomain, String target, String title, OvhRedirectionTypeEnum type) throws IOException {
String qPath = "/domain/zone/{zoneName}/redirection";
StringBuilder sb = path(qPath, zoneName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "keywords", keywords);
addBody(o, "subDomain", subDomain);
addBody(o, "target", target);
addBody(o, "title", title);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRedirection.class);
} | java | public OvhRedirection zone_zoneName_redirection_POST(String zoneName, String description, String keywords, String subDomain, String target, String title, OvhRedirectionTypeEnum type) throws IOException {
String qPath = "/domain/zone/{zoneName}/redirection";
StringBuilder sb = path(qPath, zoneName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "keywords", keywords);
addBody(o, "subDomain", subDomain);
addBody(o, "target", target);
addBody(o, "title", title);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRedirection.class);
} | [
"public",
"OvhRedirection",
"zone_zoneName_redirection_POST",
"(",
"String",
"zoneName",
",",
"String",
"description",
",",
"String",
"keywords",
",",
"String",
"subDomain",
",",
"String",
"target",
",",
"String",
"title",
",",
"OvhRedirectionTypeEnum",
"type",
")",
... | Create a new redirection (Don't forget to refresh the zone)
REST: POST /domain/zone/{zoneName}/redirection
@param keywords [required] Keywords for invisible redirection
@param title [required] Title for invisible redirection
@param type [required] Redirection type
@param target [required] Target of the redirection
@param description [required] Desciption for invisible redirection
@param subDomain [required] subdomain to redirect
@param zoneName [required] The internal name of your zone | [
"Create",
"a",
"new",
"redirection",
"(",
"Don",
"t",
"forget",
"to",
"refresh",
"the",
"zone",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L826-L838 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.summarizeForPolicyDefinition | public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) {
return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body();
} | java | public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) {
return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body();
} | [
"public",
"SummarizeResultsInner",
"summarizeForPolicyDefinition",
"(",
"String",
"subscriptionId",
",",
"String",
"policyDefinitionName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"summarizeForPolicyDefinitionWithServiceResponseAsync",
"(",
"subscriptionId",
",",
... | Summarizes policy states for the subscription level policy definition.
@param subscriptionId Microsoft Azure subscription ID.
@param policyDefinitionName Policy definition name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SummarizeResultsInner object if successful. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"subscription",
"level",
"policy",
"definition",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2368-L2370 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByTwitter | public Iterable<DContact> queryByTwitter(Object parent, java.lang.String twitter) {
return queryByField(parent, DContactMapper.Field.TWITTER.getFieldName(), twitter);
} | java | public Iterable<DContact> queryByTwitter(Object parent, java.lang.String twitter) {
return queryByField(parent, DContactMapper.Field.TWITTER.getFieldName(), twitter);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByTwitter",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"twitter",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"TWITTER",
".",
"getFieldN... | query-by method for field twitter
@param twitter the specified attribute
@return an Iterable of DContacts for the specified twitter | [
"query",
"-",
"by",
"method",
"for",
"field",
"twitter"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L277-L279 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/parser/TokenSequencePreservingPartialParsingHelper.java | TokenSequencePreservingPartialParsingHelper.isBrokenPreviousState | protected boolean isBrokenPreviousState(IParseResult previousParseResult, int offset) {
if (previousParseResult.hasSyntaxErrors()) {
BidiTreeIterator<AbstractNode> iterator = ((AbstractNode) previousParseResult.getRootNode()).basicIterator();
while(iterator.hasPrevious()) {
AbstractNode previous = iterator.previous();
if (previous.getGrammarElement() == null) {
return true;
}
if (previous instanceof ILeafNode && previous.getOffset() <= offset) {
break;
}
}
}
return false;
} | java | protected boolean isBrokenPreviousState(IParseResult previousParseResult, int offset) {
if (previousParseResult.hasSyntaxErrors()) {
BidiTreeIterator<AbstractNode> iterator = ((AbstractNode) previousParseResult.getRootNode()).basicIterator();
while(iterator.hasPrevious()) {
AbstractNode previous = iterator.previous();
if (previous.getGrammarElement() == null) {
return true;
}
if (previous instanceof ILeafNode && previous.getOffset() <= offset) {
break;
}
}
}
return false;
} | [
"protected",
"boolean",
"isBrokenPreviousState",
"(",
"IParseResult",
"previousParseResult",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"previousParseResult",
".",
"hasSyntaxErrors",
"(",
")",
")",
"{",
"BidiTreeIterator",
"<",
"AbstractNode",
">",
"iterator",
"=",
... | Returns true if the previous document state was completely broken, e.g. the parser did not recover at all.
This may happen e.g. in Xtend for documents like
<pre>import static class C {}</pre>
where the class keyword is consumed as an invalid token in the import declaration and everything thereafter
is unrecoverable. | [
"Returns",
"true",
"if",
"the",
"previous",
"document",
"state",
"was",
"completely",
"broken",
"e",
".",
"g",
".",
"the",
"parser",
"did",
"not",
"recover",
"at",
"all",
".",
"This",
"may",
"happen",
"e",
".",
"g",
".",
"in",
"Xtend",
"for",
"document... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/parser/TokenSequencePreservingPartialParsingHelper.java#L142-L156 |
rhuss/jolokia | agent/jmx/src/main/java/org/jolokia/jmx/JolokiaMBeanServer.java | JolokiaMBeanServer.toJson | String toJson(Object object, JsonConvertOptions pConvertOptions) {
try {
Object ret = converters.getToJsonConverter().convertToJson(object,null,pConvertOptions);
return ret.toString();
} catch (AttributeNotFoundException exp) {
// Cannot happen, since we dont use a path
return "";
}
} | java | String toJson(Object object, JsonConvertOptions pConvertOptions) {
try {
Object ret = converters.getToJsonConverter().convertToJson(object,null,pConvertOptions);
return ret.toString();
} catch (AttributeNotFoundException exp) {
// Cannot happen, since we dont use a path
return "";
}
} | [
"String",
"toJson",
"(",
"Object",
"object",
",",
"JsonConvertOptions",
"pConvertOptions",
")",
"{",
"try",
"{",
"Object",
"ret",
"=",
"converters",
".",
"getToJsonConverter",
"(",
")",
".",
"convertToJson",
"(",
"object",
",",
"null",
",",
"pConvertOptions",
... | Converter used by JsonMBean for converting from Object to JSON representation
@param object object to serialize
@param pConvertOptions options used for conversion
@return serialized object | [
"Converter",
"used",
"by",
"JsonMBean",
"for",
"converting",
"from",
"Object",
"to",
"JSON",
"representation"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jmx/src/main/java/org/jolokia/jmx/JolokiaMBeanServer.java#L149-L157 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/JTrees.java | JTrees.getParent | public static Object getParent(TreeModel treeModel, Object node)
{
return getParent(treeModel, node, treeModel.getRoot());
} | java | public static Object getParent(TreeModel treeModel, Object node)
{
return getParent(treeModel, node, treeModel.getRoot());
} | [
"public",
"static",
"Object",
"getParent",
"(",
"TreeModel",
"treeModel",
",",
"Object",
"node",
")",
"{",
"return",
"getParent",
"(",
"treeModel",
",",
"node",
",",
"treeModel",
".",
"getRoot",
"(",
")",
")",
";",
"}"
] | Returns the parent of the given node in the given tree model.
This parent may be <code>null</code>, if the given node is
the root node (or not contained in the tree model at all).
@param treeModel The tree model
@param node The node
@return The parent | [
"Returns",
"the",
"parent",
"of",
"the",
"given",
"node",
"in",
"the",
"given",
"tree",
"model",
".",
"This",
"parent",
"may",
"be",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"the",
"given",
"node",
"is",
"the",
"root",
"node",
"(",
"or",
"not",... | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTrees.java#L286-L289 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java | Pools.retrievePool | public static Pool retrievePool(UrlParser urlParser) {
if (!poolMap.containsKey(urlParser)) {
synchronized (poolMap) {
if (!poolMap.containsKey(urlParser)) {
if (poolExecutor == null) {
poolExecutor = new ScheduledThreadPoolExecutor(1,
new MariaDbThreadFactory("MariaDbPool-maxTimeoutIdle-checker"));
}
Pool pool = new Pool(urlParser, poolIndex.incrementAndGet(), poolExecutor);
poolMap.put(urlParser, pool);
return pool;
}
}
}
return poolMap.get(urlParser);
} | java | public static Pool retrievePool(UrlParser urlParser) {
if (!poolMap.containsKey(urlParser)) {
synchronized (poolMap) {
if (!poolMap.containsKey(urlParser)) {
if (poolExecutor == null) {
poolExecutor = new ScheduledThreadPoolExecutor(1,
new MariaDbThreadFactory("MariaDbPool-maxTimeoutIdle-checker"));
}
Pool pool = new Pool(urlParser, poolIndex.incrementAndGet(), poolExecutor);
poolMap.put(urlParser, pool);
return pool;
}
}
}
return poolMap.get(urlParser);
} | [
"public",
"static",
"Pool",
"retrievePool",
"(",
"UrlParser",
"urlParser",
")",
"{",
"if",
"(",
"!",
"poolMap",
".",
"containsKey",
"(",
"urlParser",
")",
")",
"{",
"synchronized",
"(",
"poolMap",
")",
"{",
"if",
"(",
"!",
"poolMap",
".",
"containsKey",
... | Get existing pool for a configuration. Create it if doesn't exists.
@param urlParser configuration parser
@return pool | [
"Get",
"existing",
"pool",
"for",
"a",
"configuration",
".",
"Create",
"it",
"if",
"doesn",
"t",
"exists",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pools.java#L45-L60 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getPvPHeroInfo | public void getPvPHeroInfo(String[] ids, Callback<List<PvPHero>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getPvPHeroInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getPvPHeroInfo(String[] ids, Callback<List<PvPHero>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getPvPHeroInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getPvPHeroInfo",
"(",
"String",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"PvPHero",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"id... | For more info on pvp heroes API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/heroes">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of pvp hero id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see PvPHero pvp hero info | [
"For",
"more",
"info",
"on",
"pvp",
"heroes",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"pvp",
"/",
"heroes",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2083-L2086 |
JodaOrg/joda-time | src/main/java/org/joda/time/chrono/BasicChronology.java | BasicChronology.getYearInfo | private YearInfo getYearInfo(int year) {
YearInfo info = iYearInfoCache[year & CACHE_MASK];
if (info == null || info.iYear != year) {
info = new YearInfo(year, calculateFirstDayOfYearMillis(year));
iYearInfoCache[year & CACHE_MASK] = info;
}
return info;
} | java | private YearInfo getYearInfo(int year) {
YearInfo info = iYearInfoCache[year & CACHE_MASK];
if (info == null || info.iYear != year) {
info = new YearInfo(year, calculateFirstDayOfYearMillis(year));
iYearInfoCache[year & CACHE_MASK] = info;
}
return info;
} | [
"private",
"YearInfo",
"getYearInfo",
"(",
"int",
"year",
")",
"{",
"YearInfo",
"info",
"=",
"iYearInfoCache",
"[",
"year",
"&",
"CACHE_MASK",
"]",
";",
"if",
"(",
"info",
"==",
"null",
"||",
"info",
".",
"iYear",
"!=",
"year",
")",
"{",
"info",
"=",
... | Although accessed by multiple threads, this method doesn't need to be synchronized. | [
"Although",
"accessed",
"by",
"multiple",
"threads",
"this",
"method",
"doesn",
"t",
"need",
"to",
"be",
"synchronized",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/BasicChronology.java#L781-L788 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java | WatchServiceImpl.addWatch | public void addWatch(DatabaseWatch watch,
TableKraken table,
byte[] key,
Result<Cancel> result)
{
WatchTable watchTable = getWatchTable(table);
watchTable.addWatchLocal(watch, key);
// bfs/112b
// XXX: table.isKeyLocalCopy vs table.isKeyLocalPrimary
// XXX: using copy because a copy server reads its own data directly
// XXX: and the timing between a remote watch and the put can result in
// XXX: the wrong version
// XXX: (old) notify requires isKeyLocalOwner, otherwise the notify isn't propagated
if (! table.isKeyLocalCopy(key)) {
HashKey hashKey = HashKey.create(key);
Set<HashKey> keys = _remoteKeys.get(table);
if (keys == null) {
keys = new HashSet<>();
_remoteKeys.put(table, keys);
}
if (! keys.contains(hashKey)) {
table.addRemoteWatch(key);
keys.add(hashKey);
}
// getWatchTable(table).addWatch(watch, key);
}
WatchHandle handle = new WatchHandle(table, key, watch);
result.ok(_serviceRef.pin(handle).as(Cancel.class));
} | java | public void addWatch(DatabaseWatch watch,
TableKraken table,
byte[] key,
Result<Cancel> result)
{
WatchTable watchTable = getWatchTable(table);
watchTable.addWatchLocal(watch, key);
// bfs/112b
// XXX: table.isKeyLocalCopy vs table.isKeyLocalPrimary
// XXX: using copy because a copy server reads its own data directly
// XXX: and the timing between a remote watch and the put can result in
// XXX: the wrong version
// XXX: (old) notify requires isKeyLocalOwner, otherwise the notify isn't propagated
if (! table.isKeyLocalCopy(key)) {
HashKey hashKey = HashKey.create(key);
Set<HashKey> keys = _remoteKeys.get(table);
if (keys == null) {
keys = new HashSet<>();
_remoteKeys.put(table, keys);
}
if (! keys.contains(hashKey)) {
table.addRemoteWatch(key);
keys.add(hashKey);
}
// getWatchTable(table).addWatch(watch, key);
}
WatchHandle handle = new WatchHandle(table, key, watch);
result.ok(_serviceRef.pin(handle).as(Cancel.class));
} | [
"public",
"void",
"addWatch",
"(",
"DatabaseWatch",
"watch",
",",
"TableKraken",
"table",
",",
"byte",
"[",
"]",
"key",
",",
"Result",
"<",
"Cancel",
">",
"result",
")",
"{",
"WatchTable",
"watchTable",
"=",
"getWatchTable",
"(",
"table",
")",
";",
"watchT... | /* XXX:
private void onPodUpdate(PodBartender pod)
{
for (Map.Entry<TableKraken,Set<HashKey>> remoteKeys : _remoteKeys.entrySet()) {
TableKraken table = remoteKeys.getKey();
if (! table.getTablePod().getPodName().equals(pod.name())) {
continue;
}
for (HashKey hashKey : remoteKeys.getValue()) {
table.addRemoteWatch(hashKey.getHash());
}
}
} | [
"/",
"*",
"XXX",
":",
"private",
"void",
"onPodUpdate",
"(",
"PodBartender",
"pod",
")",
"{",
"for",
"(",
"Map",
".",
"Entry<TableKraken",
"Set<HashKey",
">>",
"remoteKeys",
":",
"_remoteKeys",
".",
"entrySet",
"()",
")",
"{",
"TableKraken",
"table",
"=",
... | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kraken/table/WatchServiceImpl.java#L117-L155 |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/sns/SNSListener.java | SNSListener.startServer | public static HttpServer startServer(URI uri, AmazonSNSTransport t) throws IOException {
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.registerInstances(new SNSListenerResource(t));
resourceConfig.setApplicationName("Argo AmazonSNSTransport");
// ResourceConfig resourceConfig = new ResourceConfig().packages("ws.argo.responder.transport.sns");
LOGGER.debug("Starting Jersey-Grizzly2 JAX-RS listener...");
HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(uri, resourceConfig, false);
httpServer.getServerConfiguration().setName("SNS Listener");
httpServer.start();
LOGGER.info("Started Jersey-Grizzly2 JAX-RS listener.");
return httpServer;
} | java | public static HttpServer startServer(URI uri, AmazonSNSTransport t) throws IOException {
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.registerInstances(new SNSListenerResource(t));
resourceConfig.setApplicationName("Argo AmazonSNSTransport");
// ResourceConfig resourceConfig = new ResourceConfig().packages("ws.argo.responder.transport.sns");
LOGGER.debug("Starting Jersey-Grizzly2 JAX-RS listener...");
HttpServer httpServer = GrizzlyHttpServerFactory.createHttpServer(uri, resourceConfig, false);
httpServer.getServerConfiguration().setName("SNS Listener");
httpServer.start();
LOGGER.info("Started Jersey-Grizzly2 JAX-RS listener.");
return httpServer;
} | [
"public",
"static",
"HttpServer",
"startServer",
"(",
"URI",
"uri",
",",
"AmazonSNSTransport",
"t",
")",
"throws",
"IOException",
"{",
"ResourceConfig",
"resourceConfig",
"=",
"new",
"ResourceConfig",
"(",
")",
";",
"resourceConfig",
".",
"registerInstances",
"(",
... | Start the ResponseListener client. This largely includes starting at
Grizzly 2 server.
@param uri the uri of the service
@param t the link to the transport associated with this listener
@return a new HttpServer
@throws IOException if something goes wrong creating the http server | [
"Start",
"the",
"ResponseListener",
"client",
".",
"This",
"largely",
"includes",
"starting",
"at",
"Grizzly",
"2",
"server",
"."
] | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/sns/SNSListener.java#L74-L91 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslservicegroup_sslciphersuite_binding.java | sslservicegroup_sslciphersuite_binding.count_filtered | public static long count_filtered(nitro_service service, String servicegroupname, String filter) throws Exception{
sslservicegroup_sslciphersuite_binding obj = new sslservicegroup_sslciphersuite_binding();
obj.set_servicegroupname(servicegroupname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
sslservicegroup_sslciphersuite_binding[] response = (sslservicegroup_sslciphersuite_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String servicegroupname, String filter) throws Exception{
sslservicegroup_sslciphersuite_binding obj = new sslservicegroup_sslciphersuite_binding();
obj.set_servicegroupname(servicegroupname);
options option = new options();
option.set_count(true);
option.set_filter(filter);
sslservicegroup_sslciphersuite_binding[] response = (sslservicegroup_sslciphersuite_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"servicegroupname",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"sslservicegroup_sslciphersuite_binding",
"obj",
"=",
"new",
"sslservicegroup_sslciphersuite_binding",... | Use this API to count the filtered set of sslservicegroup_sslciphersuite_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"sslservicegroup_sslciphersuite_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslservicegroup_sslciphersuite_binding.java#L225-L236 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/MediaUtils.java | MediaUtils.createTempFile | private static File createTempFile(Context ctx, String fileName) throws IOException {
File storageDir = new File(ctx.getFilesDir(), "temp");
storageDir.mkdir();
return nonDuplicateFile(storageDir, fileName);
} | java | private static File createTempFile(Context ctx, String fileName) throws IOException {
File storageDir = new File(ctx.getFilesDir(), "temp");
storageDir.mkdir();
return nonDuplicateFile(storageDir, fileName);
} | [
"private",
"static",
"File",
"createTempFile",
"(",
"Context",
"ctx",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"File",
"storageDir",
"=",
"new",
"File",
"(",
"ctx",
".",
"getFilesDir",
"(",
")",
",",
"\"temp\"",
")",
";",
"storageDir",
... | Create a temporary file to use to handle selected images from the picker
@return the created temporary file
@throws IOException | [
"Create",
"a",
"temporary",
"file",
"to",
"use",
"to",
"handle",
"selected",
"images",
"from",
"the",
"picker"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/MediaUtils.java#L224-L228 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteRequest.java | CreateRouteRequest.withRequestModels | public CreateRouteRequest withRequestModels(java.util.Map<String, String> requestModels) {
setRequestModels(requestModels);
return this;
} | java | public CreateRouteRequest withRequestModels(java.util.Map<String, String> requestModels) {
setRequestModels(requestModels);
return this;
} | [
"public",
"CreateRouteRequest",
"withRequestModels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestModels",
")",
"{",
"setRequestModels",
"(",
"requestModels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The request models for the route.
</p>
@param requestModels
The request models for the route.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"request",
"models",
"for",
"the",
"route",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteRequest.java#L488-L491 |
elibom/jogger | src/main/java/com/elibom/jogger/middleware/router/loader/AbstractFileRoutesLoader.java | AbstractFileRoutesLoader.getMethod | private Method getMethod(Object controller, String methodName) throws RoutesException {
try {
// try to retrieve the method and check if an exception is thrown
return controller.getClass().getMethod(methodName, Request.class, Response.class);
} catch (Exception e) {
throw new RoutesException(e);
}
} | java | private Method getMethod(Object controller, String methodName) throws RoutesException {
try {
// try to retrieve the method and check if an exception is thrown
return controller.getClass().getMethod(methodName, Request.class, Response.class);
} catch (Exception e) {
throw new RoutesException(e);
}
} | [
"private",
"Method",
"getMethod",
"(",
"Object",
"controller",
",",
"String",
"methodName",
")",
"throws",
"RoutesException",
"{",
"try",
"{",
"// try to retrieve the method and check if an exception is thrown",
"return",
"controller",
".",
"getClass",
"(",
")",
".",
"g... | Helper method. Retrieves the method with the specified <code>methodName</code> and from the specified object.
Notice that the method must received two parameters of types {@link Request} and {@link Response} respectively.
@param controller the object from which we will retrieve the method.
@param methodName the name of the method to be retrieved.
@return a <code>java.lang.reflect.Method</code> object.
@throws RoutesException if the method doesn't exists or there is a problem accessing the method. | [
"Helper",
"method",
".",
"Retrieves",
"the",
"method",
"with",
"the",
"specified",
"<code",
">",
"methodName<",
"/",
"code",
">",
"and",
"from",
"the",
"specified",
"object",
".",
"Notice",
"that",
"the",
"method",
"must",
"received",
"two",
"parameters",
"o... | train | https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/middleware/router/loader/AbstractFileRoutesLoader.java#L267-L274 |
jingwei/krati | krati-main/src/main/java/krati/core/array/basic/ArrayFile.java | ArrayFile.setWaterMarks | public void setWaterMarks(long lwmScn, long hwmScn) throws IOException {
if(lwmScn <= hwmScn) {
writeHwmScn(hwmScn);
_writer.flush();
writeLwmScn(lwmScn);
_writer.flush();
} else {
throw new IOException("Invalid water marks: lwmScn=" + lwmScn + " hwmScn=" + hwmScn);
}
} | java | public void setWaterMarks(long lwmScn, long hwmScn) throws IOException {
if(lwmScn <= hwmScn) {
writeHwmScn(hwmScn);
_writer.flush();
writeLwmScn(lwmScn);
_writer.flush();
} else {
throw new IOException("Invalid water marks: lwmScn=" + lwmScn + " hwmScn=" + hwmScn);
}
} | [
"public",
"void",
"setWaterMarks",
"(",
"long",
"lwmScn",
",",
"long",
"hwmScn",
")",
"throws",
"IOException",
"{",
"if",
"(",
"lwmScn",
"<=",
"hwmScn",
")",
"{",
"writeHwmScn",
"(",
"hwmScn",
")",
";",
"_writer",
".",
"flush",
"(",
")",
";",
"writeLwmSc... | Sets the water marks of this ArrayFile.
@param lwmScn - the low water mark
@param hwmScn - the high water mark
@throws IOException if the <code>lwmScn</code> is greater than the <code>hwmScn</code>
or the changes to the underlying file cannot be flushed. | [
"Sets",
"the",
"water",
"marks",
"of",
"this",
"ArrayFile",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/array/basic/ArrayFile.java#L617-L626 |
augustd/burp-suite-utils | src/main/java/com/monikamorrow/burp/ToolsScopeComponent.java | ToolsScopeComponent.setEnabledToolConfig | public void setEnabledToolConfig(int tool, boolean enabled) {
switch (tool) {
case IBurpExtenderCallbacks.TOOL_PROXY:
jCheckBoxProxy.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_REPEATER:
jCheckBoxRepeater.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_SCANNER:
jCheckBoxScanner.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_INTRUDER:
jCheckBoxIntruder.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_SEQUENCER:
jCheckBoxSequencer.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_SPIDER:
jCheckBoxSpider.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_EXTENDER:
jCheckBoxExtender.setEnabled(enabled);
break;
default:
break;
}
} | java | public void setEnabledToolConfig(int tool, boolean enabled) {
switch (tool) {
case IBurpExtenderCallbacks.TOOL_PROXY:
jCheckBoxProxy.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_REPEATER:
jCheckBoxRepeater.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_SCANNER:
jCheckBoxScanner.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_INTRUDER:
jCheckBoxIntruder.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_SEQUENCER:
jCheckBoxSequencer.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_SPIDER:
jCheckBoxSpider.setEnabled(enabled);
break;
case IBurpExtenderCallbacks.TOOL_EXTENDER:
jCheckBoxExtender.setEnabled(enabled);
break;
default:
break;
}
} | [
"public",
"void",
"setEnabledToolConfig",
"(",
"int",
"tool",
",",
"boolean",
"enabled",
")",
"{",
"switch",
"(",
"tool",
")",
"{",
"case",
"IBurpExtenderCallbacks",
".",
"TOOL_PROXY",
":",
"jCheckBoxProxy",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"break"... | Allows the enabling/disabling of UI tool selection elements, not every
tool makes sense for every extension
@param tool The tool code, as defined in IBurpExtenderCallbacks
@param enabled True if the checkbox should be enabled. | [
"Allows",
"the",
"enabling",
"/",
"disabling",
"of",
"UI",
"tool",
"selection",
"elements",
"not",
"every",
"tool",
"makes",
"sense",
"for",
"every",
"extension"
] | train | https://github.com/augustd/burp-suite-utils/blob/5e34a6b9147f5705382f98049dd9e4f387b78629/src/main/java/com/monikamorrow/burp/ToolsScopeComponent.java#L49-L75 |
ops4j/org.ops4j.pax.exam2 | containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java | DependenciesDeployer.getDependenciesFeature | public KarafFeaturesOption getDependenciesFeature() {
if (subsystem == null) {
return null;
}
try {
File featuresXmlFile = new File(karafBase, "test-dependencies.xml");
Writer wr = new OutputStreamWriter(new FileOutputStream(featuresXmlFile), "UTF-8");
writeDependenciesFeature(wr, subsystem.getOptions(ProvisionOption.class));
wr.close();
String repoUrl = "file:"
+ featuresXmlFile.toString().replaceAll("\\\\", "/").replaceAll(" ", "%20");
return new KarafFeaturesOption(repoUrl, "test-dependencies");
}
catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
} | java | public KarafFeaturesOption getDependenciesFeature() {
if (subsystem == null) {
return null;
}
try {
File featuresXmlFile = new File(karafBase, "test-dependencies.xml");
Writer wr = new OutputStreamWriter(new FileOutputStream(featuresXmlFile), "UTF-8");
writeDependenciesFeature(wr, subsystem.getOptions(ProvisionOption.class));
wr.close();
String repoUrl = "file:"
+ featuresXmlFile.toString().replaceAll("\\\\", "/").replaceAll(" ", "%20");
return new KarafFeaturesOption(repoUrl, "test-dependencies");
}
catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
} | [
"public",
"KarafFeaturesOption",
"getDependenciesFeature",
"(",
")",
"{",
"if",
"(",
"subsystem",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"File",
"featuresXmlFile",
"=",
"new",
"File",
"(",
"karafBase",
",",
"\"test-dependencies.xml\"",
... | Create a feature for the test dependencies
specified as ProvisionOption in the system
@return feature option for dependencies | [
"Create",
"a",
"feature",
"for",
"the",
"test",
"dependencies",
"specified",
"as",
"ProvisionOption",
"in",
"the",
"system"
] | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/DependenciesDeployer.java#L116-L133 |
actframework/actframework | src/main/java/act/internal/util/AppDescriptor.java | AppDescriptor.of | public static AppDescriptor of(String appName, String packageName, Version appVersion) {
String[] packages = packageName.split(S.COMMON_SEP);
String effectPackageName = packageName;
if (packages.length > 0) {
effectPackageName = packages[0];
}
E.illegalArgumentIf(!JavaNames.isPackageOrClassName(effectPackageName),
"valid package name expected. found: " + effectPackageName);
return new AppDescriptor(ensureAppName(appName, effectPackageName, $.requireNotNull(appVersion)),
packageName,
appVersion);
} | java | public static AppDescriptor of(String appName, String packageName, Version appVersion) {
String[] packages = packageName.split(S.COMMON_SEP);
String effectPackageName = packageName;
if (packages.length > 0) {
effectPackageName = packages[0];
}
E.illegalArgumentIf(!JavaNames.isPackageOrClassName(effectPackageName),
"valid package name expected. found: " + effectPackageName);
return new AppDescriptor(ensureAppName(appName, effectPackageName, $.requireNotNull(appVersion)),
packageName,
appVersion);
} | [
"public",
"static",
"AppDescriptor",
"of",
"(",
"String",
"appName",
",",
"String",
"packageName",
",",
"Version",
"appVersion",
")",
"{",
"String",
"[",
"]",
"packages",
"=",
"packageName",
".",
"split",
"(",
"S",
".",
"COMMON_SEP",
")",
";",
"String",
"e... | Create an `AppDescriptor` with appName, package name and app version.
If `appName` is `null` or blank, it will try the following
approach to get app name:
1. check the {@link Version#getArtifactId() artifact id} and use it unless
2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
@param appName
the app name, optional
@param packageName
the package name
@param appVersion
the app version
@return
an `AppDescriptor` | [
"Create",
"an",
"AppDescriptor",
"with",
"appName",
"package",
"name",
"and",
"app",
"version",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/internal/util/AppDescriptor.java#L143-L154 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaGraphicsGLRegisterBuffer | public static int cudaGraphicsGLRegisterBuffer(cudaGraphicsResource resource, int buffer, int Flags)
{
return checkResult(cudaGraphicsGLRegisterBufferNative(resource, buffer, Flags));
} | java | public static int cudaGraphicsGLRegisterBuffer(cudaGraphicsResource resource, int buffer, int Flags)
{
return checkResult(cudaGraphicsGLRegisterBufferNative(resource, buffer, Flags));
} | [
"public",
"static",
"int",
"cudaGraphicsGLRegisterBuffer",
"(",
"cudaGraphicsResource",
"resource",
",",
"int",
"buffer",
",",
"int",
"Flags",
")",
"{",
"return",
"checkResult",
"(",
"cudaGraphicsGLRegisterBufferNative",
"(",
"resource",
",",
"buffer",
",",
"Flags",
... | Registers an OpenGL buffer object.
<pre>
cudaError_t cudaGraphicsGLRegisterBuffer (
cudaGraphicsResource** resource,
GLuint buffer,
unsigned int flags )
</pre>
<div>
<p>Registers an OpenGL buffer object.
Registers the buffer object specified by <tt>buffer</tt> for access
by CUDA. A handle to the registered object is returned as <tt>resource</tt>. The register flags <tt>flags</tt> specify the intended
usage, as follows:
</p>
<ul>
<li>
<p>cudaGraphicsRegisterFlagsNone:
Specifies no hints about how this resource will be used. It is therefore
assumed that this resource will be read from and
written to by CUDA. This is the
default value.
</p>
</li>
<li>
<p>cudaGraphicsRegisterFlagsReadOnly:
Specifies that CUDA will not write to this resource.
</p>
</li>
<li>
<p>cudaGraphicsRegisterFlagsWriteDiscard:
Specifies that CUDA will not read from this resource and will write
over the entire contents of the resource, so none of
the data previously stored in
the resource will be preserved.
</p>
</li>
</ul>
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param resource Pointer to the returned object handle
@param buffer name of buffer object to be registered
@param flags Register flags
@return cudaSuccess, cudaErrorInvalidDevice, cudaErrorInvalidValue,
cudaErrorInvalidResourceHandle, cudaErrorUnknown
@see JCuda#cudaGraphicsUnregisterResource
@see JCuda#cudaGraphicsMapResources
@see JCuda#cudaGraphicsResourceGetMappedPointer | [
"Registers",
"an",
"OpenGL",
"buffer",
"object",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L10668-L10671 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/model/ModelUtil.java | ModelUtil.getPrototype | public static NumberVector getPrototype(Model model, Relation<? extends NumberVector> relation) {
// Mean model contains a numeric Vector
if(model instanceof MeanModel) {
return DoubleVector.wrap(((MeanModel) model).getMean());
}
// Handle medoid models
if(model instanceof MedoidModel) {
return relation.get(((MedoidModel) model).getMedoid());
}
if(model instanceof PrototypeModel) {
Object p = ((PrototypeModel<?>) model).getPrototype();
if(p instanceof NumberVector) {
return (NumberVector) p;
}
return null; // Inconvertible
}
return null;
} | java | public static NumberVector getPrototype(Model model, Relation<? extends NumberVector> relation) {
// Mean model contains a numeric Vector
if(model instanceof MeanModel) {
return DoubleVector.wrap(((MeanModel) model).getMean());
}
// Handle medoid models
if(model instanceof MedoidModel) {
return relation.get(((MedoidModel) model).getMedoid());
}
if(model instanceof PrototypeModel) {
Object p = ((PrototypeModel<?>) model).getPrototype();
if(p instanceof NumberVector) {
return (NumberVector) p;
}
return null; // Inconvertible
}
return null;
} | [
"public",
"static",
"NumberVector",
"getPrototype",
"(",
"Model",
"model",
",",
"Relation",
"<",
"?",
"extends",
"NumberVector",
">",
"relation",
")",
"{",
"// Mean model contains a numeric Vector",
"if",
"(",
"model",
"instanceof",
"MeanModel",
")",
"{",
"return",
... | Get the representative vector for a cluster model.
<b>Only representative-based models are supported!</b>
{@code null} is returned when the model is not supported!
@param model Model
@param relation Data relation (for representatives specified per DBID)
@return Some {@link NumberVector}, {@code null} if not supported. | [
"Get",
"the",
"representative",
"vector",
"for",
"a",
"cluster",
"model",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/model/ModelUtil.java#L99-L116 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableIOSupport.java | CASableIOSupport.getFile | public File getFile(String hash)
{
// work with digest
return new File(channel.rootDir, channel.makeFilePath(hash, 0));
} | java | public File getFile(String hash)
{
// work with digest
return new File(channel.rootDir, channel.makeFilePath(hash, 0));
} | [
"public",
"File",
"getFile",
"(",
"String",
"hash",
")",
"{",
"// work with digest\r",
"return",
"new",
"File",
"(",
"channel",
".",
"rootDir",
",",
"channel",
".",
"makeFilePath",
"(",
"hash",
",",
"0",
")",
")",
";",
"}"
] | Construct file name of given hash.
@param hash String
- digester hash | [
"Construct",
"file",
"name",
"of",
"given",
"hash",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/CASableIOSupport.java#L88-L92 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/rasterlite/Rasterlite2Coverage.java | Rasterlite2Coverage.getRL2Image | public byte[] getRL2Image( Geometry geom, String geomEpsg, int width, int height ) throws Exception {
String sql;
String rasterName = getName();
if (geomEpsg != null) {
sql = "select GetMapImageFromRaster('" + rasterName + "', ST_Transform(ST_GeomFromText('" + geom.toText() + "', "
+ geomEpsg + "), " + srid + ") , " + width + " , " + height
+ ", 'default', 'image/png', '#ffffff', 0, 80, 1 )";
} else {
sql = "select GetMapImageFromRaster('" + rasterName + "', ST_GeomFromText('" + geom.toText() + "') , " + width + " , "
+ height + ", 'default', 'image/png', '#ffffff', 0, 80, 1 )";
}
return database.execOnConnection(mConn -> {
try (IHMStatement stmt = mConn.createStatement()) {
IHMResultSet resultSet = stmt.executeQuery(sql);
if (resultSet.next()) {
byte[] bytes = resultSet.getBytes(1);
return bytes;
}
}
return null;
});
} | java | public byte[] getRL2Image( Geometry geom, String geomEpsg, int width, int height ) throws Exception {
String sql;
String rasterName = getName();
if (geomEpsg != null) {
sql = "select GetMapImageFromRaster('" + rasterName + "', ST_Transform(ST_GeomFromText('" + geom.toText() + "', "
+ geomEpsg + "), " + srid + ") , " + width + " , " + height
+ ", 'default', 'image/png', '#ffffff', 0, 80, 1 )";
} else {
sql = "select GetMapImageFromRaster('" + rasterName + "', ST_GeomFromText('" + geom.toText() + "') , " + width + " , "
+ height + ", 'default', 'image/png', '#ffffff', 0, 80, 1 )";
}
return database.execOnConnection(mConn -> {
try (IHMStatement stmt = mConn.createStatement()) {
IHMResultSet resultSet = stmt.executeQuery(sql);
if (resultSet.next()) {
byte[] bytes = resultSet.getBytes(1);
return bytes;
}
}
return null;
});
} | [
"public",
"byte",
"[",
"]",
"getRL2Image",
"(",
"Geometry",
"geom",
",",
"String",
"geomEpsg",
",",
"int",
"width",
",",
"int",
"height",
")",
"throws",
"Exception",
"{",
"String",
"sql",
";",
"String",
"rasterName",
"=",
"getName",
"(",
")",
";",
"if",
... | Extract an image from the database.
@param geom the image bounding box geometry.
@param width the pixel width of the expected image.
@param height the pixel height of the expected image.
@return the image bytes.
@throws Exception | [
"Extract",
"an",
"image",
"from",
"the",
"database",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/rasterlite/Rasterlite2Coverage.java#L108-L130 |
kaazing/java.client | amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java | AmqpChannel.qosBasic | public AmqpChannel qosBasic(int prefetchSize, int prefetchCount, boolean global) {
Object[] args = {prefetchSize, prefetchCount, global};
WrappedByteBuffer bodyArg = null;
HashMap<String, Object> headersArg = null;
String methodName = "qosBasic";
String methodId = "60" + "10";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg};
asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null);
return this;
} | java | public AmqpChannel qosBasic(int prefetchSize, int prefetchCount, boolean global) {
Object[] args = {prefetchSize, prefetchCount, global};
WrappedByteBuffer bodyArg = null;
HashMap<String, Object> headersArg = null;
String methodName = "qosBasic";
String methodId = "60" + "10";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg};
asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null);
return this;
} | [
"public",
"AmqpChannel",
"qosBasic",
"(",
"int",
"prefetchSize",
",",
"int",
"prefetchCount",
",",
"boolean",
"global",
")",
"{",
"Object",
"[",
"]",
"args",
"=",
"{",
"prefetchSize",
",",
"prefetchCount",
",",
"global",
"}",
";",
"WrappedByteBuffer",
"bodyArg... | This method requests a specific quality of service. The QoS can be specified for the current channel or for all channels on the connection. The
particular properties and semantics of a qos method always depend on the content class semantics. Though the qos method could in principle apply to both
peers, it is currently meaningful only for the server.
@param prefetchSize
@param prefetchCount
@param global | [
"This",
"method",
"requests",
"a",
"specific",
"quality",
"of",
"service",
".",
"The",
"QoS",
"can",
"be",
"specified",
"for",
"the",
"current",
"channel",
"or",
"for",
"all",
"channels",
"on",
"the",
"connection",
".",
"The",
"particular",
"properties",
"an... | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L699-L710 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.