repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
SonarSource/sonarqube | sonar-duplications/src/main/java/org/sonar/duplications/detector/original/Filter.java | Filter.add | public void add(CloneGroup current) {
"""
Running time - O(N*2*C), where N - number of clones, which was found earlier and C - time of {@link #containsIn(CloneGroup, CloneGroup)}.
"""
Iterator<CloneGroup> i = filtered.iterator();
while (i.hasNext()) {
CloneGroup earlier = i.next();
// Note that following two conditions cannot be true together - proof by contradiction:
// let C be the current clone and A and B were found earlier
// then since relation is transitive - (A in C) and (C in B) => (A in B)
// so A should be filtered earlier
if (Filter.containsIn(current, earlier)) {
// current clone fully covered by clone, which was found earlier
return;
}
if (Filter.containsIn(earlier, current)) {
// current clone fully covers clone, which was found earlier
i.remove();
}
}
filtered.add(current);
} | java | public void add(CloneGroup current) {
Iterator<CloneGroup> i = filtered.iterator();
while (i.hasNext()) {
CloneGroup earlier = i.next();
// Note that following two conditions cannot be true together - proof by contradiction:
// let C be the current clone and A and B were found earlier
// then since relation is transitive - (A in C) and (C in B) => (A in B)
// so A should be filtered earlier
if (Filter.containsIn(current, earlier)) {
// current clone fully covered by clone, which was found earlier
return;
}
if (Filter.containsIn(earlier, current)) {
// current clone fully covers clone, which was found earlier
i.remove();
}
}
filtered.add(current);
} | [
"public",
"void",
"add",
"(",
"CloneGroup",
"current",
")",
"{",
"Iterator",
"<",
"CloneGroup",
">",
"i",
"=",
"filtered",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"CloneGroup",
"earlier",
"=",
"i",
".",
"next",
"(",
")",
";",
"// Note that following two conditions cannot be true together - proof by contradiction:",
"// let C be the current clone and A and B were found earlier",
"// then since relation is transitive - (A in C) and (C in B) => (A in B)",
"// so A should be filtered earlier",
"if",
"(",
"Filter",
".",
"containsIn",
"(",
"current",
",",
"earlier",
")",
")",
"{",
"// current clone fully covered by clone, which was found earlier",
"return",
";",
"}",
"if",
"(",
"Filter",
".",
"containsIn",
"(",
"earlier",
",",
"current",
")",
")",
"{",
"// current clone fully covers clone, which was found earlier",
"i",
".",
"remove",
"(",
")",
";",
"}",
"}",
"filtered",
".",
"add",
"(",
"current",
")",
";",
"}"
] | Running time - O(N*2*C), where N - number of clones, which was found earlier and C - time of {@link #containsIn(CloneGroup, CloneGroup)}. | [
"Running",
"time",
"-",
"O",
"(",
"N",
"*",
"2",
"*",
"C",
")",
"where",
"N",
"-",
"number",
"of",
"clones",
"which",
"was",
"found",
"earlier",
"and",
"C",
"-",
"time",
"of",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/Filter.java#L61-L79 |
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) {
"""
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
"""
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",
")",
";",
"if",
"(",
"context",
".",
"span",
".",
"getOptions",
"(",
")",
".",
"contains",
"(",
"Options",
".",
"RECORD_EVENTS",
")",
")",
"{",
"// record compressed size",
"recordMessageEvent",
"(",
"context",
".",
"span",
",",
"context",
".",
"receviedSeqId",
".",
"addAndGet",
"(",
"1L",
")",
",",
"Type",
".",
"RECEIVED",
",",
"bytes",
",",
"0L",
")",
";",
"}",
"}"
] | 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 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/db/record/ODatabaseRecordAbstract.java | ODatabaseRecordAbstract.callbackHooks | public boolean callbackHooks(final TYPE iType, final OIdentifiable id) {
"""
Callback the registeted hooks if any.
@param iType
@param id
Record received in the callback
@return True if the input record is changed, otherwise false
"""
if (!OHookThreadLocal.INSTANCE.push(id))
return false;
try {
final ORecord<?> rec = id.getRecord();
if (rec == null)
return false;
boolean recordChanged = false;
for (ORecordHook hook : hooks)
if (hook.onTrigger(iType, rec))
recordChanged = true;
return recordChanged;
} finally {
OHookThreadLocal.INSTANCE.pop(id);
}
} | java | public boolean callbackHooks(final TYPE iType, final OIdentifiable id) {
if (!OHookThreadLocal.INSTANCE.push(id))
return false;
try {
final ORecord<?> rec = id.getRecord();
if (rec == null)
return false;
boolean recordChanged = false;
for (ORecordHook hook : hooks)
if (hook.onTrigger(iType, rec))
recordChanged = true;
return recordChanged;
} finally {
OHookThreadLocal.INSTANCE.pop(id);
}
} | [
"public",
"boolean",
"callbackHooks",
"(",
"final",
"TYPE",
"iType",
",",
"final",
"OIdentifiable",
"id",
")",
"{",
"if",
"(",
"!",
"OHookThreadLocal",
".",
"INSTANCE",
".",
"push",
"(",
"id",
")",
")",
"return",
"false",
";",
"try",
"{",
"final",
"ORecord",
"<",
"?",
">",
"rec",
"=",
"id",
".",
"getRecord",
"(",
")",
";",
"if",
"(",
"rec",
"==",
"null",
")",
"return",
"false",
";",
"boolean",
"recordChanged",
"=",
"false",
";",
"for",
"(",
"ORecordHook",
"hook",
":",
"hooks",
")",
"if",
"(",
"hook",
".",
"onTrigger",
"(",
"iType",
",",
"rec",
")",
")",
"recordChanged",
"=",
"true",
";",
"return",
"recordChanged",
";",
"}",
"finally",
"{",
"OHookThreadLocal",
".",
"INSTANCE",
".",
"pop",
"(",
"id",
")",
";",
"}",
"}"
] | Callback the registeted hooks if any.
@param iType
@param id
Record received in the callback
@return True if the input record is changed, otherwise false | [
"Callback",
"the",
"registeted",
"hooks",
"if",
"any",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/record/ODatabaseRecordAbstract.java#L869-L887 |
alkacon/opencms-core | src/org/opencms/db/CmsSelectQuery.java | CmsSelectQuery.addTable | public TableAlias addTable(String table, String aliasPrefix) {
"""
Adds a table the query's FROM clause.<p>
@param table the table to add
@param aliasPrefix the prefix used to generate the alias
@return an alias for the table
"""
String alias = makeAlias(aliasPrefix);
m_tables.add(table + " " + alias);
return new TableAlias(alias);
} | java | public TableAlias addTable(String table, String aliasPrefix) {
String alias = makeAlias(aliasPrefix);
m_tables.add(table + " " + alias);
return new TableAlias(alias);
} | [
"public",
"TableAlias",
"addTable",
"(",
"String",
"table",
",",
"String",
"aliasPrefix",
")",
"{",
"String",
"alias",
"=",
"makeAlias",
"(",
"aliasPrefix",
")",
";",
"m_tables",
".",
"add",
"(",
"table",
"+",
"\" \"",
"+",
"alias",
")",
";",
"return",
"new",
"TableAlias",
"(",
"alias",
")",
";",
"}"
] | Adds a table the query's FROM clause.<p>
@param table the table to add
@param aliasPrefix the prefix used to generate the alias
@return an alias for the table | [
"Adds",
"a",
"table",
"the",
"query",
"s",
"FROM",
"clause",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSelectQuery.java#L185-L191 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/topology/CommonMessagePrintTopology.java | CommonMessagePrintTopology.main | public static void main(String[] args) throws Exception {
"""
プログラムエントリポイント<br>
<ul>
<li>起動引数:arg[0] 設定値を記述したyamlファイルパス</li>
<li>起動引数:arg[1] Stormの起動モード(true:LocalMode、false:DistributeMode)</li>
</ul>
@param args 起動引数
@throws Exception 初期化例外発生時
"""
// プログラム引数の不足をチェック
if (args.length < 2)
{
System.out.println("Usage: java acromusashi.stream.topology.CommonMessagePrintTopology ConfigPath isExecuteLocal(true|false)");
return;
}
// 起動引数として使用したパスからStorm設定オブジェクトを生成
Config conf = StormConfigGenerator.loadStormConfig(args[0]);
// プログラム引数から設定値を取得(ローカル環境or分散環境)
boolean isLocal = Boolean.valueOf(args[1]);
// Topologyを起動する
BaseTopology topology = new CommonMessagePrintTopology("CommonMessagePrintTopology", conf);
topology.buildTopology();
topology.submitTopology(isLocal);
} | java | public static void main(String[] args) throws Exception
{
// プログラム引数の不足をチェック
if (args.length < 2)
{
System.out.println("Usage: java acromusashi.stream.topology.CommonMessagePrintTopology ConfigPath isExecuteLocal(true|false)");
return;
}
// 起動引数として使用したパスからStorm設定オブジェクトを生成
Config conf = StormConfigGenerator.loadStormConfig(args[0]);
// プログラム引数から設定値を取得(ローカル環境or分散環境)
boolean isLocal = Boolean.valueOf(args[1]);
// Topologyを起動する
BaseTopology topology = new CommonMessagePrintTopology("CommonMessagePrintTopology", conf);
topology.buildTopology();
topology.submitTopology(isLocal);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"// プログラム引数の不足をチェック",
"if",
"(",
"args",
".",
"length",
"<",
"2",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Usage: java acromusashi.stream.topology.CommonMessagePrintTopology ConfigPath isExecuteLocal(true|false)\"",
")",
";",
"return",
";",
"}",
"// 起動引数として使用したパスからStorm設定オブジェクトを生成",
"Config",
"conf",
"=",
"StormConfigGenerator",
".",
"loadStormConfig",
"(",
"args",
"[",
"0",
"]",
")",
";",
"// プログラム引数から設定値を取得(ローカル環境or分散環境)",
"boolean",
"isLocal",
"=",
"Boolean",
".",
"valueOf",
"(",
"args",
"[",
"1",
"]",
")",
";",
"// Topologyを起動する",
"BaseTopology",
"topology",
"=",
"new",
"CommonMessagePrintTopology",
"(",
"\"CommonMessagePrintTopology\"",
",",
"conf",
")",
";",
"topology",
".",
"buildTopology",
"(",
")",
";",
"topology",
".",
"submitTopology",
"(",
"isLocal",
")",
";",
"}"
] | プログラムエントリポイント<br>
<ul>
<li>起動引数:arg[0] 設定値を記述したyamlファイルパス</li>
<li>起動引数:arg[1] Stormの起動モード(true:LocalMode、false:DistributeMode)</li>
</ul>
@param args 起動引数
@throws Exception 初期化例外発生時 | [
"プログラムエントリポイント<br",
">",
"<ul",
">",
"<li",
">",
"起動引数",
":",
"arg",
"[",
"0",
"]",
"設定値を記述したyamlファイルパス<",
"/",
"li",
">",
"<li",
">",
"起動引数",
":",
"arg",
"[",
"1",
"]",
"Stormの起動モード",
"(",
"true",
":",
"LocalMode、false",
":",
"DistributeMode",
")",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/topology/CommonMessagePrintTopology.java#L69-L88 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TilesExtractor.java | TilesExtractor.updateProgress | private int updateProgress(int checkedTiles, int tilesNumber, int oldPercent, Collection<ImageBuffer> tiles) {
"""
Update progress and notify if needed.
@param checkedTiles The current number of checked tiles.
@param tilesNumber The total number of tile to extract.
@param oldPercent The old progress value.
@param tiles The extracted tiles image.
@return The last progress percent value.
"""
final int percent = getProgressPercent(checkedTiles, tilesNumber);
if (percent != oldPercent)
{
for (final ProgressListener listener : listeners)
{
listener.notifyProgress(percent, tiles);
}
}
return percent;
} | java | private int updateProgress(int checkedTiles, int tilesNumber, int oldPercent, Collection<ImageBuffer> tiles)
{
final int percent = getProgressPercent(checkedTiles, tilesNumber);
if (percent != oldPercent)
{
for (final ProgressListener listener : listeners)
{
listener.notifyProgress(percent, tiles);
}
}
return percent;
} | [
"private",
"int",
"updateProgress",
"(",
"int",
"checkedTiles",
",",
"int",
"tilesNumber",
",",
"int",
"oldPercent",
",",
"Collection",
"<",
"ImageBuffer",
">",
"tiles",
")",
"{",
"final",
"int",
"percent",
"=",
"getProgressPercent",
"(",
"checkedTiles",
",",
"tilesNumber",
")",
";",
"if",
"(",
"percent",
"!=",
"oldPercent",
")",
"{",
"for",
"(",
"final",
"ProgressListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"notifyProgress",
"(",
"percent",
",",
"tiles",
")",
";",
"}",
"}",
"return",
"percent",
";",
"}"
] | Update progress and notify if needed.
@param checkedTiles The current number of checked tiles.
@param tilesNumber The total number of tile to extract.
@param oldPercent The old progress value.
@param tiles The extracted tiles image.
@return The last progress percent value. | [
"Update",
"progress",
"and",
"notify",
"if",
"needed",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TilesExtractor.java#L281-L292 |
jenkinsci/jenkins | core/src/main/java/hudson/util/spring/BeanBuilder.java | BeanBuilder.manageMapIfNecessary | private Object manageMapIfNecessary(Map<Object, Object> value) {
"""
Checks whether there are any runtime refs inside a Map and converts
it to a ManagedMap if necessary
@param value The current map
@return A ManagedMap or a normal map
"""
boolean containsRuntimeRefs = false;
for (Entry<Object, Object> e : value.entrySet()) {
Object v = e.getValue();
if (v instanceof RuntimeBeanReference) {
containsRuntimeRefs = true;
}
if (v instanceof BeanConfiguration) {
BeanConfiguration c = (BeanConfiguration) v;
e.setValue(c.getBeanDefinition());
containsRuntimeRefs = true;
}
}
if(containsRuntimeRefs) {
// return new ManagedMap(map);
ManagedMap m = new ManagedMap();
m.putAll(value);
return m;
}
return value;
} | java | private Object manageMapIfNecessary(Map<Object, Object> value) {
boolean containsRuntimeRefs = false;
for (Entry<Object, Object> e : value.entrySet()) {
Object v = e.getValue();
if (v instanceof RuntimeBeanReference) {
containsRuntimeRefs = true;
}
if (v instanceof BeanConfiguration) {
BeanConfiguration c = (BeanConfiguration) v;
e.setValue(c.getBeanDefinition());
containsRuntimeRefs = true;
}
}
if(containsRuntimeRefs) {
// return new ManagedMap(map);
ManagedMap m = new ManagedMap();
m.putAll(value);
return m;
}
return value;
} | [
"private",
"Object",
"manageMapIfNecessary",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"value",
")",
"{",
"boolean",
"containsRuntimeRefs",
"=",
"false",
";",
"for",
"(",
"Entry",
"<",
"Object",
",",
"Object",
">",
"e",
":",
"value",
".",
"entrySet",
"(",
")",
")",
"{",
"Object",
"v",
"=",
"e",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"v",
"instanceof",
"RuntimeBeanReference",
")",
"{",
"containsRuntimeRefs",
"=",
"true",
";",
"}",
"if",
"(",
"v",
"instanceof",
"BeanConfiguration",
")",
"{",
"BeanConfiguration",
"c",
"=",
"(",
"BeanConfiguration",
")",
"v",
";",
"e",
".",
"setValue",
"(",
"c",
".",
"getBeanDefinition",
"(",
")",
")",
";",
"containsRuntimeRefs",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"containsRuntimeRefs",
")",
"{",
"//\t\t\treturn new ManagedMap(map);",
"ManagedMap",
"m",
"=",
"new",
"ManagedMap",
"(",
")",
";",
"m",
".",
"putAll",
"(",
"value",
")",
";",
"return",
"m",
";",
"}",
"return",
"value",
";",
"}"
] | Checks whether there are any runtime refs inside a Map and converts
it to a ManagedMap if necessary
@param value The current map
@return A ManagedMap or a normal map | [
"Checks",
"whether",
"there",
"are",
"any",
"runtime",
"refs",
"inside",
"a",
"Map",
"and",
"converts",
"it",
"to",
"a",
"ManagedMap",
"if",
"necessary"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/spring/BeanBuilder.java#L564-L584 |
Stratio/stratio-connector-commons | connector-commons/src/main/java/com/stratio/connector/commons/metadata/TableMetadataBuilder.java | TableMetadataBuilder.withOptions | @TimerJ
public TableMetadataBuilder withOptions(Map<Selector, Selector> opts) {
"""
Set the options. Any options previously created are removed.
@param opts the opts
@return the table metadata builder
"""
options = new HashMap<Selector, Selector>(opts);
return this;
} | java | @TimerJ
public TableMetadataBuilder withOptions(Map<Selector, Selector> opts) {
options = new HashMap<Selector, Selector>(opts);
return this;
} | [
"@",
"TimerJ",
"public",
"TableMetadataBuilder",
"withOptions",
"(",
"Map",
"<",
"Selector",
",",
"Selector",
">",
"opts",
")",
"{",
"options",
"=",
"new",
"HashMap",
"<",
"Selector",
",",
"Selector",
">",
"(",
"opts",
")",
";",
"return",
"this",
";",
"}"
] | Set the options. Any options previously created are removed.
@param opts the opts
@return the table metadata builder | [
"Set",
"the",
"options",
".",
"Any",
"options",
"previously",
"created",
"are",
"removed",
"."
] | train | https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/metadata/TableMetadataBuilder.java#L110-L114 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/Response.java | Response.renderToString | public String renderToString(String templateName, Map<String, Object> model) {
"""
Renders a template to a {@link String}.
@param templateName
@param model
"""
if (templateEngine == null) {
throw new PippoRuntimeException("You must set a template engine in your application");
}
// merge the model passed with the locals data
model.putAll(getLocals());
// add session (if exists) to model
Session session = Session.get();
if (session != null) {
model.put("session", session);
}
// render the template using the merged model
StringWriter stringWriter = new StringWriter();
templateEngine.renderResource(templateName, model, stringWriter);
return stringWriter.toString();
} | java | public String renderToString(String templateName, Map<String, Object> model) {
if (templateEngine == null) {
throw new PippoRuntimeException("You must set a template engine in your application");
}
// merge the model passed with the locals data
model.putAll(getLocals());
// add session (if exists) to model
Session session = Session.get();
if (session != null) {
model.put("session", session);
}
// render the template using the merged model
StringWriter stringWriter = new StringWriter();
templateEngine.renderResource(templateName, model, stringWriter);
return stringWriter.toString();
} | [
"public",
"String",
"renderToString",
"(",
"String",
"templateName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
")",
"{",
"if",
"(",
"templateEngine",
"==",
"null",
")",
"{",
"throw",
"new",
"PippoRuntimeException",
"(",
"\"You must set a template engine in your application\"",
")",
";",
"}",
"// merge the model passed with the locals data",
"model",
".",
"putAll",
"(",
"getLocals",
"(",
")",
")",
";",
"// add session (if exists) to model",
"Session",
"session",
"=",
"Session",
".",
"get",
"(",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"model",
".",
"put",
"(",
"\"session\"",
",",
"session",
")",
";",
"}",
"// render the template using the merged model",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"templateEngine",
".",
"renderResource",
"(",
"templateName",
",",
"model",
",",
"stringWriter",
")",
";",
"return",
"stringWriter",
".",
"toString",
"(",
")",
";",
"}"
] | Renders a template to a {@link String}.
@param templateName
@param model | [
"Renders",
"a",
"template",
"to",
"a",
"{",
"@link",
"String",
"}",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Response.java#L1042-L1061 |
menacher/java-game-server | jetclient/src/main/java/org/menacheri/jetclient/NettyUDPClient.java | NettyUDPClient.createDatagramChannel | public DatagramChannel createDatagramChannel(String localhostName)
throws UnknownHostException {
"""
Creates a new datagram channel instance using the {@link #udpBootstrap}
by binding to local host.
@param localhostName
The host machine (for e.g. 'localhost') to which it needs to
bind to. This is <b>Not</b> the remote jet-server hostname.
@return The newly created instance of the datagram channel.
@throws UnknownHostException
"""
DatagramChannel datagramChannel = (DatagramChannel) udpBootstrap
.bind(new InetSocketAddress(localhostName, 0));
return datagramChannel;
} | java | public DatagramChannel createDatagramChannel(String localhostName)
throws UnknownHostException
{
DatagramChannel datagramChannel = (DatagramChannel) udpBootstrap
.bind(new InetSocketAddress(localhostName, 0));
return datagramChannel;
} | [
"public",
"DatagramChannel",
"createDatagramChannel",
"(",
"String",
"localhostName",
")",
"throws",
"UnknownHostException",
"{",
"DatagramChannel",
"datagramChannel",
"=",
"(",
"DatagramChannel",
")",
"udpBootstrap",
".",
"bind",
"(",
"new",
"InetSocketAddress",
"(",
"localhostName",
",",
"0",
")",
")",
";",
"return",
"datagramChannel",
";",
"}"
] | Creates a new datagram channel instance using the {@link #udpBootstrap}
by binding to local host.
@param localhostName
The host machine (for e.g. 'localhost') to which it needs to
bind to. This is <b>Not</b> the remote jet-server hostname.
@return The newly created instance of the datagram channel.
@throws UnknownHostException | [
"Creates",
"a",
"new",
"datagram",
"channel",
"instance",
"using",
"the",
"{",
"@link",
"#udpBootstrap",
"}",
"by",
"binding",
"to",
"local",
"host",
"."
] | train | https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetclient/src/main/java/org/menacheri/jetclient/NettyUDPClient.java#L178-L184 |
geomajas/geomajas-project-client-gwt2 | impl/src/main/java/org/geomajas/gwt2/client/controller/TouchNavigationController.java | TouchNavigationController.calculatePosition | protected Coordinate calculatePosition(double scale, Coordinate rescalePoint) {
"""
Calculate the target position should there be a rescale point. The idea is that after zooming in or out, the
mouse cursor would still lie at the same position in world space.
"""
ViewPort viewPort = mapPresenter.getViewPort();
Coordinate position = viewPort.getPosition();
double dX = (rescalePoint.getX() - position.getX()) * (1 - 1 / scale);
double dY = (rescalePoint.getY() - position.getY()) * (1 - 1 / scale);
return new Coordinate(position.getX() + dX, position.getY() + dY);
} | java | protected Coordinate calculatePosition(double scale, Coordinate rescalePoint) {
ViewPort viewPort = mapPresenter.getViewPort();
Coordinate position = viewPort.getPosition();
double dX = (rescalePoint.getX() - position.getX()) * (1 - 1 / scale);
double dY = (rescalePoint.getY() - position.getY()) * (1 - 1 / scale);
return new Coordinate(position.getX() + dX, position.getY() + dY);
} | [
"protected",
"Coordinate",
"calculatePosition",
"(",
"double",
"scale",
",",
"Coordinate",
"rescalePoint",
")",
"{",
"ViewPort",
"viewPort",
"=",
"mapPresenter",
".",
"getViewPort",
"(",
")",
";",
"Coordinate",
"position",
"=",
"viewPort",
".",
"getPosition",
"(",
")",
";",
"double",
"dX",
"=",
"(",
"rescalePoint",
".",
"getX",
"(",
")",
"-",
"position",
".",
"getX",
"(",
")",
")",
"*",
"(",
"1",
"-",
"1",
"/",
"scale",
")",
";",
"double",
"dY",
"=",
"(",
"rescalePoint",
".",
"getY",
"(",
")",
"-",
"position",
".",
"getY",
"(",
")",
")",
"*",
"(",
"1",
"-",
"1",
"/",
"scale",
")",
";",
"return",
"new",
"Coordinate",
"(",
"position",
".",
"getX",
"(",
")",
"+",
"dX",
",",
"position",
".",
"getY",
"(",
")",
"+",
"dY",
")",
";",
"}"
] | Calculate the target position should there be a rescale point. The idea is that after zooming in or out, the
mouse cursor would still lie at the same position in world space. | [
"Calculate",
"the",
"target",
"position",
"should",
"there",
"be",
"a",
"rescale",
"point",
".",
"The",
"idea",
"is",
"that",
"after",
"zooming",
"in",
"or",
"out",
"the",
"mouse",
"cursor",
"would",
"still",
"lie",
"at",
"the",
"same",
"position",
"in",
"world",
"space",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/controller/TouchNavigationController.java#L108-L114 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/ProxySettings.java | ProxySettings.addHeader | public ProxySettings addHeader(String name, String value) {
"""
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.
"""
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",
">",
"list",
"=",
"mHeaders",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"mHeaders",
".",
"put",
"(",
"name",
",",
"list",
")",
";",
"}",
"list",
".",
"add",
"(",
"value",
")",
";",
"return",
"this",
";",
"}"
] | 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 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java | AbstractSearchStructure.getInternalId | public int getInternalId(String id) {
"""
Returns the internal id assigned to the vector with the given id or -1 if the id is not found. Accesses
the BDB store!
@param id
The id of the vector
@return The internal id assigned to this vector or -1 if the id is not found.
"""
DatabaseEntry key = new DatabaseEntry();
StringBinding.stringToEntry(id, key);
DatabaseEntry data = new DatabaseEntry();
// check if the id already exists in id to iid database
if ((idToIidDB.get(null, key, data, null) == OperationStatus.SUCCESS)) {
return IntegerBinding.entryToInt(data);
} else {
return -1;
}
} | java | public int getInternalId(String id) {
DatabaseEntry key = new DatabaseEntry();
StringBinding.stringToEntry(id, key);
DatabaseEntry data = new DatabaseEntry();
// check if the id already exists in id to iid database
if ((idToIidDB.get(null, key, data, null) == OperationStatus.SUCCESS)) {
return IntegerBinding.entryToInt(data);
} else {
return -1;
}
} | [
"public",
"int",
"getInternalId",
"(",
"String",
"id",
")",
"{",
"DatabaseEntry",
"key",
"=",
"new",
"DatabaseEntry",
"(",
")",
";",
"StringBinding",
".",
"stringToEntry",
"(",
"id",
",",
"key",
")",
";",
"DatabaseEntry",
"data",
"=",
"new",
"DatabaseEntry",
"(",
")",
";",
"// check if the id already exists in id to iid database\r",
"if",
"(",
"(",
"idToIidDB",
".",
"get",
"(",
"null",
",",
"key",
",",
"data",
",",
"null",
")",
"==",
"OperationStatus",
".",
"SUCCESS",
")",
")",
"{",
"return",
"IntegerBinding",
".",
"entryToInt",
"(",
"data",
")",
";",
"}",
"else",
"{",
"return",
"-",
"1",
";",
"}",
"}"
] | Returns the internal id assigned to the vector with the given id or -1 if the id is not found. Accesses
the BDB store!
@param id
The id of the vector
@return The internal id assigned to this vector or -1 if the id is not found. | [
"Returns",
"the",
"internal",
"id",
"assigned",
"to",
"the",
"vector",
"with",
"the",
"given",
"id",
"or",
"-",
"1",
"if",
"the",
"id",
"is",
"not",
"found",
".",
"Accesses",
"the",
"BDB",
"store!"
] | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java#L383-L393 |
elki-project/elki | elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/VALPNormDistance.java | VALPNormDistance.getPartialMinDist | public double getPartialMinDist(int dimension, int vp) {
"""
Get the minimum distance contribution of a single dimension.
@param dimension Dimension
@param vp Vector position
@return Increment
"""
final int qp = queryApprox.getApproximation(dimension);
if(vp < qp) {
return lookup[dimension][vp + 1];
}
else if(vp > qp) {
return lookup[dimension][vp];
}
else {
return 0.0;
}
} | java | public double getPartialMinDist(int dimension, int vp) {
final int qp = queryApprox.getApproximation(dimension);
if(vp < qp) {
return lookup[dimension][vp + 1];
}
else if(vp > qp) {
return lookup[dimension][vp];
}
else {
return 0.0;
}
} | [
"public",
"double",
"getPartialMinDist",
"(",
"int",
"dimension",
",",
"int",
"vp",
")",
"{",
"final",
"int",
"qp",
"=",
"queryApprox",
".",
"getApproximation",
"(",
"dimension",
")",
";",
"if",
"(",
"vp",
"<",
"qp",
")",
"{",
"return",
"lookup",
"[",
"dimension",
"]",
"[",
"vp",
"+",
"1",
"]",
";",
"}",
"else",
"if",
"(",
"vp",
">",
"qp",
")",
"{",
"return",
"lookup",
"[",
"dimension",
"]",
"[",
"vp",
"]",
";",
"}",
"else",
"{",
"return",
"0.0",
";",
"}",
"}"
] | Get the minimum distance contribution of a single dimension.
@param dimension Dimension
@param vp Vector position
@return Increment | [
"Get",
"the",
"minimum",
"distance",
"contribution",
"of",
"a",
"single",
"dimension",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/vafile/VALPNormDistance.java#L70-L81 |
azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java | HadoopJobUtils.addAdditionalNamenodesToPropsFromMRJob | public static void addAdditionalNamenodesToPropsFromMRJob(Props props, Logger log) {
"""
The same as {@link #addAdditionalNamenodesToProps}, but assumes that the
calling job is MapReduce-based and so uses the
{@link #MAPREDUCE_JOB_OTHER_NAMENODES} from a {@link Configuration} object
to get the list of additional namenodes.
@param props Props to add the new Namenode URIs to.
@see #addAdditionalNamenodesToProps(Props, String)
"""
String additionalNamenodes =
(new Configuration()).get(MAPREDUCE_JOB_OTHER_NAMENODES);
if (additionalNamenodes != null && additionalNamenodes.length() > 0) {
log.info("Found property " + MAPREDUCE_JOB_OTHER_NAMENODES +
" = " + additionalNamenodes + "; setting additional namenodes");
HadoopJobUtils.addAdditionalNamenodesToProps(props, additionalNamenodes);
}
} | java | public static void addAdditionalNamenodesToPropsFromMRJob(Props props, Logger log) {
String additionalNamenodes =
(new Configuration()).get(MAPREDUCE_JOB_OTHER_NAMENODES);
if (additionalNamenodes != null && additionalNamenodes.length() > 0) {
log.info("Found property " + MAPREDUCE_JOB_OTHER_NAMENODES +
" = " + additionalNamenodes + "; setting additional namenodes");
HadoopJobUtils.addAdditionalNamenodesToProps(props, additionalNamenodes);
}
} | [
"public",
"static",
"void",
"addAdditionalNamenodesToPropsFromMRJob",
"(",
"Props",
"props",
",",
"Logger",
"log",
")",
"{",
"String",
"additionalNamenodes",
"=",
"(",
"new",
"Configuration",
"(",
")",
")",
".",
"get",
"(",
"MAPREDUCE_JOB_OTHER_NAMENODES",
")",
";",
"if",
"(",
"additionalNamenodes",
"!=",
"null",
"&&",
"additionalNamenodes",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"log",
".",
"info",
"(",
"\"Found property \"",
"+",
"MAPREDUCE_JOB_OTHER_NAMENODES",
"+",
"\" = \"",
"+",
"additionalNamenodes",
"+",
"\"; setting additional namenodes\"",
")",
";",
"HadoopJobUtils",
".",
"addAdditionalNamenodesToProps",
"(",
"props",
",",
"additionalNamenodes",
")",
";",
"}",
"}"
] | The same as {@link #addAdditionalNamenodesToProps}, but assumes that the
calling job is MapReduce-based and so uses the
{@link #MAPREDUCE_JOB_OTHER_NAMENODES} from a {@link Configuration} object
to get the list of additional namenodes.
@param props Props to add the new Namenode URIs to.
@see #addAdditionalNamenodesToProps(Props, String) | [
"The",
"same",
"as",
"{",
"@link",
"#addAdditionalNamenodesToProps",
"}",
"but",
"assumes",
"that",
"the",
"calling",
"job",
"is",
"MapReduce",
"-",
"based",
"and",
"so",
"uses",
"the",
"{",
"@link",
"#MAPREDUCE_JOB_OTHER_NAMENODES",
"}",
"from",
"a",
"{",
"@link",
"Configuration",
"}",
"object",
"to",
"get",
"the",
"list",
"of",
"additional",
"namenodes",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java#L152-L160 |
jsilland/piezo | src/main/java/io/soliton/protobuf/json/Messages.java | Messages.fromJson | public static Message fromJson(Message.Builder builder, JsonObject input) throws Exception {
"""
Converts a JSON object to a protobuf message
@param builder the proto message type builder
@param input the JSON object to convert
"""
Descriptors.Descriptor descriptor = builder.getDescriptorForType();
for (Map.Entry<String, JsonElement> entry : input.entrySet()) {
String protoName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entry.getKey());
Descriptors.FieldDescriptor field = descriptor.findFieldByName(protoName);
if (field == null) {
throw new Exception("Can't find descriptor for field " + protoName);
}
if (field.isRepeated()) {
if (!entry.getValue().isJsonArray()) {
// fail
}
JsonArray array = entry.getValue().getAsJsonArray();
for (JsonElement item : array) {
builder.addRepeatedField(field, parseField(field, item, builder));
}
} else {
builder.setField(field, parseField(field, entry.getValue(), builder));
}
}
return builder.build();
} | java | public static Message fromJson(Message.Builder builder, JsonObject input) throws Exception {
Descriptors.Descriptor descriptor = builder.getDescriptorForType();
for (Map.Entry<String, JsonElement> entry : input.entrySet()) {
String protoName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entry.getKey());
Descriptors.FieldDescriptor field = descriptor.findFieldByName(protoName);
if (field == null) {
throw new Exception("Can't find descriptor for field " + protoName);
}
if (field.isRepeated()) {
if (!entry.getValue().isJsonArray()) {
// fail
}
JsonArray array = entry.getValue().getAsJsonArray();
for (JsonElement item : array) {
builder.addRepeatedField(field, parseField(field, item, builder));
}
} else {
builder.setField(field, parseField(field, entry.getValue(), builder));
}
}
return builder.build();
} | [
"public",
"static",
"Message",
"fromJson",
"(",
"Message",
".",
"Builder",
"builder",
",",
"JsonObject",
"input",
")",
"throws",
"Exception",
"{",
"Descriptors",
".",
"Descriptor",
"descriptor",
"=",
"builder",
".",
"getDescriptorForType",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"JsonElement",
">",
"entry",
":",
"input",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"protoName",
"=",
"CaseFormat",
".",
"LOWER_CAMEL",
".",
"to",
"(",
"CaseFormat",
".",
"LOWER_UNDERSCORE",
",",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"Descriptors",
".",
"FieldDescriptor",
"field",
"=",
"descriptor",
".",
"findFieldByName",
"(",
"protoName",
")",
";",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Can't find descriptor for field \"",
"+",
"protoName",
")",
";",
"}",
"if",
"(",
"field",
".",
"isRepeated",
"(",
")",
")",
"{",
"if",
"(",
"!",
"entry",
".",
"getValue",
"(",
")",
".",
"isJsonArray",
"(",
")",
")",
"{",
"// fail",
"}",
"JsonArray",
"array",
"=",
"entry",
".",
"getValue",
"(",
")",
".",
"getAsJsonArray",
"(",
")",
";",
"for",
"(",
"JsonElement",
"item",
":",
"array",
")",
"{",
"builder",
".",
"addRepeatedField",
"(",
"field",
",",
"parseField",
"(",
"field",
",",
"item",
",",
"builder",
")",
")",
";",
"}",
"}",
"else",
"{",
"builder",
".",
"setField",
"(",
"field",
",",
"parseField",
"(",
"field",
",",
"entry",
".",
"getValue",
"(",
")",
",",
"builder",
")",
")",
";",
"}",
"}",
"return",
"builder",
".",
"build",
"(",
")",
";",
"}"
] | Converts a JSON object to a protobuf message
@param builder the proto message type builder
@param input the JSON object to convert | [
"Converts",
"a",
"JSON",
"object",
"to",
"a",
"protobuf",
"message"
] | train | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/json/Messages.java#L110-L131 |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java | GraphicalModel.addFactor | public VectorFactor addFactor(ConcatVectorTable featureTable, int[] neighborIndices) {
"""
Creates an instantiated factor in this graph, with neighborIndices representing the neighbor variables by integer
index.
@param featureTable the feature table to use to drive the value of the factor
@param neighborIndices the indices of the neighboring variables, in order
@return a reference to the created factor. This can be safely ignored, as the factor is already saved in the model
"""
assert (featureTable.getDimensions().length == neighborIndices.length);
VectorFactor factor = new VectorFactor(featureTable, neighborIndices);
factors.add(factor);
return factor;
} | java | public VectorFactor addFactor(ConcatVectorTable featureTable, int[] neighborIndices) {
assert (featureTable.getDimensions().length == neighborIndices.length);
VectorFactor factor = new VectorFactor(featureTable, neighborIndices);
factors.add(factor);
return factor;
} | [
"public",
"VectorFactor",
"addFactor",
"(",
"ConcatVectorTable",
"featureTable",
",",
"int",
"[",
"]",
"neighborIndices",
")",
"{",
"assert",
"(",
"featureTable",
".",
"getDimensions",
"(",
")",
".",
"length",
"==",
"neighborIndices",
".",
"length",
")",
";",
"VectorFactor",
"factor",
"=",
"new",
"VectorFactor",
"(",
"featureTable",
",",
"neighborIndices",
")",
";",
"factors",
".",
"add",
"(",
"factor",
")",
";",
"return",
"factor",
";",
"}"
] | Creates an instantiated factor in this graph, with neighborIndices representing the neighbor variables by integer
index.
@param featureTable the feature table to use to drive the value of the factor
@param neighborIndices the indices of the neighboring variables, in order
@return a reference to the created factor. This can be safely ignored, as the factor is already saved in the model | [
"Creates",
"an",
"instantiated",
"factor",
"in",
"this",
"graph",
"with",
"neighborIndices",
"representing",
"the",
"neighbor",
"variables",
"by",
"integer",
"index",
"."
] | train | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java#L520-L525 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java | MapFixture.contentOfEquals | public boolean contentOfEquals(Map<String, Object> one, Object two) {
"""
Determines whether map one's content matches two.
@param one map the check content of.
@param two other map to check.
@return true if both maps are equal.
"""
return getMapHelper().contentOfEquals(one, two);
} | java | public boolean contentOfEquals(Map<String, Object> one, Object two) {
return getMapHelper().contentOfEquals(one, two);
} | [
"public",
"boolean",
"contentOfEquals",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"one",
",",
"Object",
"two",
")",
"{",
"return",
"getMapHelper",
"(",
")",
".",
"contentOfEquals",
"(",
"one",
",",
"two",
")",
";",
"}"
] | Determines whether map one's content matches two.
@param one map the check content of.
@param two other map to check.
@return true if both maps are equal. | [
"Determines",
"whether",
"map",
"one",
"s",
"content",
"matches",
"two",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java#L191-L193 |
threerings/nenya | core/src/main/java/com/threerings/media/image/ImageUtil.java | ImageUtil.recolorImage | public static BufferedImage recolorImage (BufferedImage image, Colorization cz) {
"""
Recolors the supplied image as in
{@link #recolorImage(BufferedImage,Color,float[],float[])} obtaining the recoloring
parameters from the supplied {@link Colorization} instance.
"""
return recolorImage(image, new Colorization[] { cz });
} | java | public static BufferedImage recolorImage (BufferedImage image, Colorization cz)
{
return recolorImage(image, new Colorization[] { cz });
} | [
"public",
"static",
"BufferedImage",
"recolorImage",
"(",
"BufferedImage",
"image",
",",
"Colorization",
"cz",
")",
"{",
"return",
"recolorImage",
"(",
"image",
",",
"new",
"Colorization",
"[",
"]",
"{",
"cz",
"}",
")",
";",
"}"
] | Recolors the supplied image as in
{@link #recolorImage(BufferedImage,Color,float[],float[])} obtaining the recoloring
parameters from the supplied {@link Colorization} instance. | [
"Recolors",
"the",
"supplied",
"image",
"as",
"in",
"{"
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageUtil.java#L106-L109 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/MathUtils.java | MathUtils.pythagoreanTheorem | public static double pythagoreanTheorem(final double a, final double b) {
"""
Calculates the Pythagorean Theorem (c2 = a2 + b2).
@param a double value operand.
@param b double value operand.
@return the value for c using the Pythagorean Theorem
@see java.lang.Math#pow(double, double)
@see java.lang.Math#sqrt(double)
"""
return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
} | java | public static double pythagoreanTheorem(final double a, final double b) {
return Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2));
} | [
"public",
"static",
"double",
"pythagoreanTheorem",
"(",
"final",
"double",
"a",
",",
"final",
"double",
"b",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"Math",
".",
"pow",
"(",
"a",
",",
"2",
")",
"+",
"Math",
".",
"pow",
"(",
"b",
",",
"2",
")",
")",
";",
"}"
] | Calculates the Pythagorean Theorem (c2 = a2 + b2).
@param a double value operand.
@param b double value operand.
@return the value for c using the Pythagorean Theorem
@see java.lang.Math#pow(double, double)
@see java.lang.Math#sqrt(double) | [
"Calculates",
"the",
"Pythagorean",
"Theorem",
"(",
"c2",
"=",
"a2",
"+",
"b2",
")",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/MathUtils.java#L341-L343 |
aws/aws-sdk-java | aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/Environment.java | Environment.withVariables | public Environment withVariables(java.util.Map<String, String> variables) {
"""
<p>
Environment variable key-value pairs.
</p>
@param variables
Environment variable key-value pairs.
@return Returns a reference to this object so that method calls can be chained together.
"""
setVariables(variables);
return this;
} | java | public Environment withVariables(java.util.Map<String, String> variables) {
setVariables(variables);
return this;
} | [
"public",
"Environment",
"withVariables",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"variables",
")",
"{",
"setVariables",
"(",
"variables",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Environment variable key-value pairs.
</p>
@param variables
Environment variable key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Environment",
"variable",
"key",
"-",
"value",
"pairs",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/Environment.java#L76-L79 |
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(aId1 != aId2)
aDirtyMarker.setDirty(true);
@param aDirtyMarker
@param aId1 the ID 2
@param aId2 the ID 2
"""
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",
".",
"setDirty",
"(",
"true",
")",
";",
"}"
] | 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 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/DefaultMemcachedBucketConfig.java | DefaultMemcachedBucketConfig.calculateKetamaHash | private static long calculateKetamaHash(final byte[] key) {
"""
Calculates the ketama hash for the given key.
@param key the key to calculate.
@return the calculated hash.
"""
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(key);
byte[] digest = md5.digest();
long rv = ((long) (digest[3] & 0xFF) << 24)
| ((long) (digest[2] & 0xFF) << 16)
| ((long) (digest[1] & 0xFF) << 8)
| (digest[0] & 0xFF);
return rv & 0xffffffffL;
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("Could not encode ketama hash.", e);
}
} | java | private static long calculateKetamaHash(final byte[] key) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(key);
byte[] digest = md5.digest();
long rv = ((long) (digest[3] & 0xFF) << 24)
| ((long) (digest[2] & 0xFF) << 16)
| ((long) (digest[1] & 0xFF) << 8)
| (digest[0] & 0xFF);
return rv & 0xffffffffL;
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("Could not encode ketama hash.", e);
}
} | [
"private",
"static",
"long",
"calculateKetamaHash",
"(",
"final",
"byte",
"[",
"]",
"key",
")",
"{",
"try",
"{",
"MessageDigest",
"md5",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"md5",
".",
"update",
"(",
"key",
")",
";",
"byte",
"[",
"]",
"digest",
"=",
"md5",
".",
"digest",
"(",
")",
";",
"long",
"rv",
"=",
"(",
"(",
"long",
")",
"(",
"digest",
"[",
"3",
"]",
"&",
"0xFF",
")",
"<<",
"24",
")",
"|",
"(",
"(",
"long",
")",
"(",
"digest",
"[",
"2",
"]",
"&",
"0xFF",
")",
"<<",
"16",
")",
"|",
"(",
"(",
"long",
")",
"(",
"digest",
"[",
"1",
"]",
"&",
"0xFF",
")",
"<<",
"8",
")",
"|",
"(",
"digest",
"[",
"0",
"]",
"&",
"0xFF",
")",
";",
"return",
"rv",
"&",
"0xffffffff",
"",
"L",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Could not encode ketama hash.\"",
",",
"e",
")",
";",
"}",
"}"
] | Calculates the ketama hash for the given key.
@param key the key to calculate.
@return the calculated hash. | [
"Calculates",
"the",
"ketama",
"hash",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/DefaultMemcachedBucketConfig.java#L144-L157 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java | AlignedBox3f.setFromCenter | @Override
public void setFromCenter(double centerX, double centerY, double centerZ, double cornerX, double cornerY, double cornerZ) {
"""
Sets the framing box of this <code>Shape</code>
based on the specified center point coordinates and corner point
coordinates. The framing box is used by the subclasses of
<code>BoxedShape</code> to define their geometry.
@param centerX the X coordinate of the specified center point
@param centerY the Y coordinate of the specified center point
@param centerZ the Z coordinate of the specified center point
@param cornerX the X coordinate of the specified corner point
@param cornerY the Y coordinate of the specified corner point
@param cornerZ the Z coordinate of the specified corner point
"""
double dx = centerX - cornerX;
double dy = centerY - cornerY;
double dz = centerZ - cornerZ;
setFromCorners(cornerX, cornerY, cornerZ, centerX + dx, centerY + dy, centerZ + dz);
} | java | @Override
public void setFromCenter(double centerX, double centerY, double centerZ, double cornerX, double cornerY, double cornerZ) {
double dx = centerX - cornerX;
double dy = centerY - cornerY;
double dz = centerZ - cornerZ;
setFromCorners(cornerX, cornerY, cornerZ, centerX + dx, centerY + dy, centerZ + dz);
} | [
"@",
"Override",
"public",
"void",
"setFromCenter",
"(",
"double",
"centerX",
",",
"double",
"centerY",
",",
"double",
"centerZ",
",",
"double",
"cornerX",
",",
"double",
"cornerY",
",",
"double",
"cornerZ",
")",
"{",
"double",
"dx",
"=",
"centerX",
"-",
"cornerX",
";",
"double",
"dy",
"=",
"centerY",
"-",
"cornerY",
";",
"double",
"dz",
"=",
"centerZ",
"-",
"cornerZ",
";",
"setFromCorners",
"(",
"cornerX",
",",
"cornerY",
",",
"cornerZ",
",",
"centerX",
"+",
"dx",
",",
"centerY",
"+",
"dy",
",",
"centerZ",
"+",
"dz",
")",
";",
"}"
] | Sets the framing box of this <code>Shape</code>
based on the specified center point coordinates and corner point
coordinates. The framing box is used by the subclasses of
<code>BoxedShape</code> to define their geometry.
@param centerX the X coordinate of the specified center point
@param centerY the Y coordinate of the specified center point
@param centerZ the Z coordinate of the specified center point
@param cornerX the X coordinate of the specified corner point
@param cornerY the Y coordinate of the specified corner point
@param cornerZ the Z coordinate of the specified corner point | [
"Sets",
"the",
"framing",
"box",
"of",
"this",
"<code",
">",
"Shape<",
"/",
"code",
">",
"based",
"on",
"the",
"specified",
"center",
"point",
"coordinates",
"and",
"corner",
"point",
"coordinates",
".",
"The",
"framing",
"box",
"is",
"used",
"by",
"the",
"subclasses",
"of",
"<code",
">",
"BoxedShape<",
"/",
"code",
">",
"to",
"define",
"their",
"geometry",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L341-L347 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/android/Facebook.java | Facebook.extendAccessTokenIfNeeded | @Deprecated
public boolean extendAccessTokenIfNeeded(Context context, ServiceListener serviceListener) {
"""
Calls extendAccessToken if shouldExtendAccessToken returns true.
<p/>
This method is deprecated. See {@link Facebook} and {@link Session} for more info.
@return the same value as extendAccessToken if the the token requires
refreshing, true otherwise
"""
checkUserSession("extendAccessTokenIfNeeded");
if (shouldExtendAccessToken()) {
return extendAccessToken(context, serviceListener);
}
return true;
} | java | @Deprecated
public boolean extendAccessTokenIfNeeded(Context context, ServiceListener serviceListener) {
checkUserSession("extendAccessTokenIfNeeded");
if (shouldExtendAccessToken()) {
return extendAccessToken(context, serviceListener);
}
return true;
} | [
"@",
"Deprecated",
"public",
"boolean",
"extendAccessTokenIfNeeded",
"(",
"Context",
"context",
",",
"ServiceListener",
"serviceListener",
")",
"{",
"checkUserSession",
"(",
"\"extendAccessTokenIfNeeded\"",
")",
";",
"if",
"(",
"shouldExtendAccessToken",
"(",
")",
")",
"{",
"return",
"extendAccessToken",
"(",
"context",
",",
"serviceListener",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Calls extendAccessToken if shouldExtendAccessToken returns true.
<p/>
This method is deprecated. See {@link Facebook} and {@link Session} for more info.
@return the same value as extendAccessToken if the the token requires
refreshing, true otherwise | [
"Calls",
"extendAccessToken",
"if",
"shouldExtendAccessToken",
"returns",
"true",
".",
"<p",
"/",
">",
"This",
"method",
"is",
"deprecated",
".",
"See",
"{",
"@link",
"Facebook",
"}",
"and",
"{",
"@link",
"Session",
"}",
"for",
"more",
"info",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/android/Facebook.java#L482-L489 |
h2oai/h2o-3 | h2o-persist-s3/src/main/java/water/persist/PersistS3.java | PersistS3.encodeKey | public static Key encodeKey(String bucket, String key) {
"""
Creates the key for given S3 bucket and key. Returns the H2O key, or null if the key cannot be
created.
@param bucket
Bucket name
@param key
Key name (S3)
@return H2O key pointing to the given bucket and key.
"""
Key res = encodeKeyImpl(bucket, key);
// assert checkBijection(res, bucket, key);
return res;
} | java | public static Key encodeKey(String bucket, String key) {
Key res = encodeKeyImpl(bucket, key);
// assert checkBijection(res, bucket, key);
return res;
} | [
"public",
"static",
"Key",
"encodeKey",
"(",
"String",
"bucket",
",",
"String",
"key",
")",
"{",
"Key",
"res",
"=",
"encodeKeyImpl",
"(",
"bucket",
",",
"key",
")",
";",
"// assert checkBijection(res, bucket, key);",
"return",
"res",
";",
"}"
] | Creates the key for given S3 bucket and key. Returns the H2O key, or null if the key cannot be
created.
@param bucket
Bucket name
@param key
Key name (S3)
@return H2O key pointing to the given bucket and key. | [
"Creates",
"the",
"key",
"for",
"given",
"S3",
"bucket",
"and",
"key",
".",
"Returns",
"the",
"H2O",
"key",
"or",
"null",
"if",
"the",
"key",
"cannot",
"be",
"created",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-persist-s3/src/main/java/water/persist/PersistS3.java#L279-L283 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java | AnnotationUtils.isAnnotationInherited | public static boolean isAnnotationInherited(Class<? extends Annotation> annotationType, Class<?> clazz) {
"""
Determine whether an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is {@linkplain java.lang.annotation.Inherited inherited}
(i.e., not declared locally for the class).
<p>If the supplied {@code clazz} is an interface, only the interface itself will be checked.
In accordance with standard meta-annotation semantics, the inheritance hierarchy for interfaces
will not be traversed. See the {@linkplain java.lang.annotation.Inherited Javadoc} for the
{@code @Inherited} meta-annotation for further details regarding annotation inheritance.
@param annotationType the Class object corresponding to the annotation type
@param clazz the Class object corresponding to the class on which to check for the annotation
@return {@code true} if an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is <em>inherited</em>
@see Class#isAnnotationPresent(Class)
@see #isAnnotationDeclaredLocally(Class, Class)
"""
Assert.notNull(annotationType, "Annotation type must not be null");
Assert.notNull(clazz, "Class must not be null");
return (clazz.isAnnotationPresent(annotationType) && !isAnnotationDeclaredLocally(annotationType, clazz));
} | java | public static boolean isAnnotationInherited(Class<? extends Annotation> annotationType, Class<?> clazz) {
Assert.notNull(annotationType, "Annotation type must not be null");
Assert.notNull(clazz, "Class must not be null");
return (clazz.isAnnotationPresent(annotationType) && !isAnnotationDeclaredLocally(annotationType, clazz));
} | [
"public",
"static",
"boolean",
"isAnnotationInherited",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"annotationType",
",",
"\"Annotation type must not be null\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"clazz",
",",
"\"Class must not be null\"",
")",
";",
"return",
"(",
"clazz",
".",
"isAnnotationPresent",
"(",
"annotationType",
")",
"&&",
"!",
"isAnnotationDeclaredLocally",
"(",
"annotationType",
",",
"clazz",
")",
")",
";",
"}"
] | Determine whether an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is {@linkplain java.lang.annotation.Inherited inherited}
(i.e., not declared locally for the class).
<p>If the supplied {@code clazz} is an interface, only the interface itself will be checked.
In accordance with standard meta-annotation semantics, the inheritance hierarchy for interfaces
will not be traversed. See the {@linkplain java.lang.annotation.Inherited Javadoc} for the
{@code @Inherited} meta-annotation for further details regarding annotation inheritance.
@param annotationType the Class object corresponding to the annotation type
@param clazz the Class object corresponding to the class on which to check for the annotation
@return {@code true} if an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is <em>inherited</em>
@see Class#isAnnotationPresent(Class)
@see #isAnnotationDeclaredLocally(Class, Class) | [
"Determine",
"whether",
"an",
"annotation",
"for",
"the",
"specified",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L505-L509 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/domainquery/AbstractDomainQuery.java | AbstractDomainQuery.TRAVERSE_FROM | public Traverse TRAVERSE_FROM(DomainObjectMatch<?> start) {
"""
Start traversing the graph of domain objects.
@param start a DomainObjectMatch form where to start the traversal.
@return
"""
DomainObjectMatch<?> delegate = APIAccess.getDelegate(start);
DomainObjectMatch<?> match = delegate != null ? delegate : start;
TraversalExpression te = new TraversalExpression(match, this.queryExecutor);
this.queryExecutor.addAstObject(te);
Traverse ret = APIAccess.createTraverse(te);
QueryRecorder.recordInvocation(this, "TRAVERSE_FROM", ret, QueryRecorder.placeHolder(match));
return ret;
} | java | public Traverse TRAVERSE_FROM(DomainObjectMatch<?> start) {
DomainObjectMatch<?> delegate = APIAccess.getDelegate(start);
DomainObjectMatch<?> match = delegate != null ? delegate : start;
TraversalExpression te = new TraversalExpression(match, this.queryExecutor);
this.queryExecutor.addAstObject(te);
Traverse ret = APIAccess.createTraverse(te);
QueryRecorder.recordInvocation(this, "TRAVERSE_FROM", ret, QueryRecorder.placeHolder(match));
return ret;
} | [
"public",
"Traverse",
"TRAVERSE_FROM",
"(",
"DomainObjectMatch",
"<",
"?",
">",
"start",
")",
"{",
"DomainObjectMatch",
"<",
"?",
">",
"delegate",
"=",
"APIAccess",
".",
"getDelegate",
"(",
"start",
")",
";",
"DomainObjectMatch",
"<",
"?",
">",
"match",
"=",
"delegate",
"!=",
"null",
"?",
"delegate",
":",
"start",
";",
"TraversalExpression",
"te",
"=",
"new",
"TraversalExpression",
"(",
"match",
",",
"this",
".",
"queryExecutor",
")",
";",
"this",
".",
"queryExecutor",
".",
"addAstObject",
"(",
"te",
")",
";",
"Traverse",
"ret",
"=",
"APIAccess",
".",
"createTraverse",
"(",
"te",
")",
";",
"QueryRecorder",
".",
"recordInvocation",
"(",
"this",
",",
"\"TRAVERSE_FROM\"",
",",
"ret",
",",
"QueryRecorder",
".",
"placeHolder",
"(",
"match",
")",
")",
";",
"return",
"ret",
";",
"}"
] | Start traversing the graph of domain objects.
@param start a DomainObjectMatch form where to start the traversal.
@return | [
"Start",
"traversing",
"the",
"graph",
"of",
"domain",
"objects",
"."
] | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/domainquery/AbstractDomainQuery.java#L284-L292 |
stanfy/goro | goro/src/main/java/com/stanfy/enroscar/goro/GoroService.java | GoroService.setup | public static void setup(final Context context, final Goro goro) {
"""
*
Initialize GoroService which will allow you to use {@code Goro.bindXXX} methods.
@param context context instance used to enable GoroService component
@param goro instance of Goro that should be used by the service
"""
if (goro == null) {
throw new IllegalArgumentException("Goro instance cannot be null");
}
if (!Util.checkMainThread()) {
throw new IllegalStateException("GoroService.setup must be called on the main thread");
}
GoroService.goro = goro;
context.getPackageManager().setComponentEnabledSetting(
new ComponentName(context, GoroService.class),
COMPONENT_ENABLED_STATE_ENABLED,
DONT_KILL_APP
);
} | java | public static void setup(final Context context, final Goro goro) {
if (goro == null) {
throw new IllegalArgumentException("Goro instance cannot be null");
}
if (!Util.checkMainThread()) {
throw new IllegalStateException("GoroService.setup must be called on the main thread");
}
GoroService.goro = goro;
context.getPackageManager().setComponentEnabledSetting(
new ComponentName(context, GoroService.class),
COMPONENT_ENABLED_STATE_ENABLED,
DONT_KILL_APP
);
} | [
"public",
"static",
"void",
"setup",
"(",
"final",
"Context",
"context",
",",
"final",
"Goro",
"goro",
")",
"{",
"if",
"(",
"goro",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Goro instance cannot be null\"",
")",
";",
"}",
"if",
"(",
"!",
"Util",
".",
"checkMainThread",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"GoroService.setup must be called on the main thread\"",
")",
";",
"}",
"GoroService",
".",
"goro",
"=",
"goro",
";",
"context",
".",
"getPackageManager",
"(",
")",
".",
"setComponentEnabledSetting",
"(",
"new",
"ComponentName",
"(",
"context",
",",
"GoroService",
".",
"class",
")",
",",
"COMPONENT_ENABLED_STATE_ENABLED",
",",
"DONT_KILL_APP",
")",
";",
"}"
] | *
Initialize GoroService which will allow you to use {@code Goro.bindXXX} methods.
@param context context instance used to enable GoroService component
@param goro instance of Goro that should be used by the service | [
"*",
"Initialize",
"GoroService",
"which",
"will",
"allow",
"you",
"to",
"use",
"{"
] | train | https://github.com/stanfy/goro/blob/6618e63a926833d61f492ec611ee77668d756820/goro/src/main/java/com/stanfy/enroscar/goro/GoroService.java#L97-L110 |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpUtils.java | HttpUtils.getRequestURI | public static URI getRequestURI(URI requestURI, String hostHeader, IoSession session) {
"""
constructs an http specific request uri with host, port (or explicit default port), and path
"""
boolean secure = SslUtils.isSecure(session);
String authority = HttpUtils.getHostAndPort(hostHeader, secure);
// Use getRawPath to get the un-decoded path; getPath returns the post-decode value.
// This is required to handle special characters like spaces in the URI (KG-831).
URI uri = URI.create("//" + authority + requestURI.getRawPath());
return uri;
} | java | public static URI getRequestURI(URI requestURI, String hostHeader, IoSession session) {
boolean secure = SslUtils.isSecure(session);
String authority = HttpUtils.getHostAndPort(hostHeader, secure);
// Use getRawPath to get the un-decoded path; getPath returns the post-decode value.
// This is required to handle special characters like spaces in the URI (KG-831).
URI uri = URI.create("//" + authority + requestURI.getRawPath());
return uri;
} | [
"public",
"static",
"URI",
"getRequestURI",
"(",
"URI",
"requestURI",
",",
"String",
"hostHeader",
",",
"IoSession",
"session",
")",
"{",
"boolean",
"secure",
"=",
"SslUtils",
".",
"isSecure",
"(",
"session",
")",
";",
"String",
"authority",
"=",
"HttpUtils",
".",
"getHostAndPort",
"(",
"hostHeader",
",",
"secure",
")",
";",
"// Use getRawPath to get the un-decoded path; getPath returns the post-decode value.",
"// This is required to handle special characters like spaces in the URI (KG-831).",
"URI",
"uri",
"=",
"URI",
".",
"create",
"(",
"\"//\"",
"+",
"authority",
"+",
"requestURI",
".",
"getRawPath",
"(",
")",
")",
";",
"return",
"uri",
";",
"}"
] | constructs an http specific request uri with host, port (or explicit default port), and path | [
"constructs",
"an",
"http",
"specific",
"request",
"uri",
"with",
"host",
"port",
"(",
"or",
"explicit",
"default",
"port",
")",
"and",
"path"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpUtils.java#L397-L404 |
maxirosson/jdroid-android | jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java | SQLiteRepository.replaceChildren | public static <T extends Entity> void replaceChildren(List<T> list, String parentId, Class<T> clazz) {
"""
This method allows to replace all entity children of a given parent, it will remove any children which are not in
the list, add the new ones and update which are in the list..
@param list of children to replace.
@param parentId id of parent entity.
@param clazz entity class.
"""
SQLiteRepository<T> repository = (SQLiteRepository<T>)AbstractApplication.get().getRepositoryInstance(clazz);
repository.replaceChildren(list, parentId);
} | java | public static <T extends Entity> void replaceChildren(List<T> list, String parentId, Class<T> clazz) {
SQLiteRepository<T> repository = (SQLiteRepository<T>)AbstractApplication.get().getRepositoryInstance(clazz);
repository.replaceChildren(list, parentId);
} | [
"public",
"static",
"<",
"T",
"extends",
"Entity",
">",
"void",
"replaceChildren",
"(",
"List",
"<",
"T",
">",
"list",
",",
"String",
"parentId",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"SQLiteRepository",
"<",
"T",
">",
"repository",
"=",
"(",
"SQLiteRepository",
"<",
"T",
">",
")",
"AbstractApplication",
".",
"get",
"(",
")",
".",
"getRepositoryInstance",
"(",
"clazz",
")",
";",
"repository",
".",
"replaceChildren",
"(",
"list",
",",
"parentId",
")",
";",
"}"
] | This method allows to replace all entity children of a given parent, it will remove any children which are not in
the list, add the new ones and update which are in the list..
@param list of children to replace.
@param parentId id of parent entity.
@param clazz entity class. | [
"This",
"method",
"allows",
"to",
"replace",
"all",
"entity",
"children",
"of",
"a",
"given",
"parent",
"it",
"will",
"remove",
"any",
"children",
"which",
"are",
"not",
"in",
"the",
"list",
"add",
"the",
"new",
"ones",
"and",
"update",
"which",
"are",
"in",
"the",
"list",
".."
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java#L443-L446 |
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) {
"""
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.
"""
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",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | 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 |
dihedron/dihedron-commons | src/main/java/org/dihedron/core/reflection/Types.java | Types.isOfClass | public static boolean isOfClass(Type type, Class<?> clazz) {
"""
Checks if the given type and the give class are the same; this check is
trivial for simple types (such as <code>java.lang.String</code>), less so
for generic types (say, <code>List<String></code>), whereby the
generic (<code>List</code> in the example) is extracted before testing
against the other class.
@param type
the type to be tested.
@param clazz
the other class.
"""
if(isSimple(type)) {
logger.trace("simple: {}", ((Class<?>)type));
return ((Class<?>)type) == clazz;
} else if(isGeneric(type)) {
logger.trace("generic: {}", (((ParameterizedType)type).getRawType()));
return (((ParameterizedType)type).getRawType()) == clazz;
}
return false;
} | java | public static boolean isOfClass(Type type, Class<?> clazz) {
if(isSimple(type)) {
logger.trace("simple: {}", ((Class<?>)type));
return ((Class<?>)type) == clazz;
} else if(isGeneric(type)) {
logger.trace("generic: {}", (((ParameterizedType)type).getRawType()));
return (((ParameterizedType)type).getRawType()) == clazz;
}
return false;
} | [
"public",
"static",
"boolean",
"isOfClass",
"(",
"Type",
"type",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"isSimple",
"(",
"type",
")",
")",
"{",
"logger",
".",
"trace",
"(",
"\"simple: {}\"",
",",
"(",
"(",
"Class",
"<",
"?",
">",
")",
"type",
")",
")",
";",
"return",
"(",
"(",
"Class",
"<",
"?",
">",
")",
"type",
")",
"==",
"clazz",
";",
"}",
"else",
"if",
"(",
"isGeneric",
"(",
"type",
")",
")",
"{",
"logger",
".",
"trace",
"(",
"\"generic: {}\"",
",",
"(",
"(",
"(",
"ParameterizedType",
")",
"type",
")",
".",
"getRawType",
"(",
")",
")",
")",
";",
"return",
"(",
"(",
"(",
"ParameterizedType",
")",
"type",
")",
".",
"getRawType",
"(",
")",
")",
"==",
"clazz",
";",
"}",
"return",
"false",
";",
"}"
] | Checks if the given type and the give class are the same; this check is
trivial for simple types (such as <code>java.lang.String</code>), less so
for generic types (say, <code>List<String></code>), whereby the
generic (<code>List</code> in the example) is extracted before testing
against the other class.
@param type
the type to be tested.
@param clazz
the other class. | [
"Checks",
"if",
"the",
"given",
"type",
"and",
"the",
"give",
"class",
"are",
"the",
"same",
";",
"this",
"check",
"is",
"trivial",
"for",
"simple",
"types",
"(",
"such",
"as",
"<code",
">",
"java",
".",
"lang",
".",
"String<",
"/",
"code",
">",
")",
"less",
"so",
"for",
"generic",
"types",
"(",
"say",
"<code",
">",
"List<",
";",
"String>",
";",
"<",
"/",
"code",
">",
")",
"whereby",
"the",
"generic",
"(",
"<code",
">",
"List<",
"/",
"code",
">",
"in",
"the",
"example",
")",
"is",
"extracted",
"before",
"testing",
"against",
"the",
"other",
"class",
"."
] | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/reflection/Types.java#L199-L208 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java | TimeZone.getDisplayName | public String getDisplayName(boolean daylight, int style, Locale locale) {
"""
Returns a name of this time zone suitable for presentation to the user
in the specified locale.
If the display name is not available for the locale,
then this method returns a string in the localized GMT offset format
such as <code>GMT[+-]HH:mm</code>.
@param daylight if true, return the daylight savings name.
@param style the output style of the display name. Valid styles are
<code>SHORT</code>, <code>LONG</code>, <code>SHORT_GENERIC</code>,
<code>LONG_GENERIC</code>, <code>SHORT_GMT</code>, <code>LONG_GMT</code>,
<code>SHORT_COMMONLY_USED</code> or <code>GENERIC_LOCATION</code>.
@param locale the locale in which to supply the display name.
@return the human-readable name of this time zone in the given locale
or in the default locale if the given locale is not recognized.
@exception IllegalArgumentException style is invalid.
"""
return getDisplayName(daylight, style, ULocale.forLocale(locale));
} | java | public String getDisplayName(boolean daylight, int style, Locale locale) {
return getDisplayName(daylight, style, ULocale.forLocale(locale));
} | [
"public",
"String",
"getDisplayName",
"(",
"boolean",
"daylight",
",",
"int",
"style",
",",
"Locale",
"locale",
")",
"{",
"return",
"getDisplayName",
"(",
"daylight",
",",
"style",
",",
"ULocale",
".",
"forLocale",
"(",
"locale",
")",
")",
";",
"}"
] | Returns a name of this time zone suitable for presentation to the user
in the specified locale.
If the display name is not available for the locale,
then this method returns a string in the localized GMT offset format
such as <code>GMT[+-]HH:mm</code>.
@param daylight if true, return the daylight savings name.
@param style the output style of the display name. Valid styles are
<code>SHORT</code>, <code>LONG</code>, <code>SHORT_GENERIC</code>,
<code>LONG_GENERIC</code>, <code>SHORT_GMT</code>, <code>LONG_GMT</code>,
<code>SHORT_COMMONLY_USED</code> or <code>GENERIC_LOCATION</code>.
@param locale the locale in which to supply the display name.
@return the human-readable name of this time zone in the given locale
or in the default locale if the given locale is not recognized.
@exception IllegalArgumentException style is invalid. | [
"Returns",
"a",
"name",
"of",
"this",
"time",
"zone",
"suitable",
"for",
"presentation",
"to",
"the",
"user",
"in",
"the",
"specified",
"locale",
".",
"If",
"the",
"display",
"name",
"is",
"not",
"available",
"for",
"the",
"locale",
"then",
"this",
"method",
"returns",
"a",
"string",
"in",
"the",
"localized",
"GMT",
"offset",
"format",
"such",
"as",
"<code",
">",
"GMT",
"[",
"+",
"-",
"]",
"HH",
":",
"mm<",
"/",
"code",
">",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L440-L442 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleUiExtensions.java | ModuleUiExtensions.fetchAll | public CMAArray<CMAUiExtension> fetchAll(Map<String, String> query) {
"""
Fetch all ui extensions from the configured space by a query.
@param query controls what to return.
@return specific ui extensions for a specific space.
@throws IllegalArgumentException if configured space id is null.
@throws IllegalArgumentException if configured environment id is null.
@see CMAClient.Builder#setSpaceId(String)
@see CMAClient.Builder#setEnvironmentId(String)
"""
return fetchAll(spaceId, environmentId, query);
} | java | public CMAArray<CMAUiExtension> fetchAll(Map<String, String> query) {
return fetchAll(spaceId, environmentId, query);
} | [
"public",
"CMAArray",
"<",
"CMAUiExtension",
">",
"fetchAll",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"query",
")",
"{",
"return",
"fetchAll",
"(",
"spaceId",
",",
"environmentId",
",",
"query",
")",
";",
"}"
] | Fetch all ui extensions from the configured space by a query.
@param query controls what to return.
@return specific ui extensions for a specific space.
@throws IllegalArgumentException if configured space id is null.
@throws IllegalArgumentException if configured environment id is null.
@see CMAClient.Builder#setSpaceId(String)
@see CMAClient.Builder#setEnvironmentId(String) | [
"Fetch",
"all",
"ui",
"extensions",
"from",
"the",
"configured",
"space",
"by",
"a",
"query",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleUiExtensions.java#L122-L124 |
fcrepo3/fcrepo | fcrepo-common/src/main/java/org/fcrepo/utilities/xml/DOM.java | DOM.selectNodeList | public static NodeList selectNodeList(Node node, String xpath) {
"""
<p>Select the {@link NodeList} with the given XPath.
</p><p>
Note: This is a convenience method that logs exceptions instead of
throwing them.
</p>
@param node the root document.
@param xpath the xpath for the Node list.
@return the NodeList requested or an empty NodeList if unattainable
"""
return selector.selectNodeList(node, xpath);
} | java | public static NodeList selectNodeList(Node node, String xpath) {
return selector.selectNodeList(node, xpath);
} | [
"public",
"static",
"NodeList",
"selectNodeList",
"(",
"Node",
"node",
",",
"String",
"xpath",
")",
"{",
"return",
"selector",
".",
"selectNodeList",
"(",
"node",
",",
"xpath",
")",
";",
"}"
] | <p>Select the {@link NodeList} with the given XPath.
</p><p>
Note: This is a convenience method that logs exceptions instead of
throwing them.
</p>
@param node the root document.
@param xpath the xpath for the Node list.
@return the NodeList requested or an empty NodeList if unattainable | [
"<p",
">",
"Select",
"the",
"{"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/xml/DOM.java#L336-L338 |
kiegroup/jbpmmigration | src/main/java/org/jbpm/migration/XmlUtils.java | XmlUtils.writeFile | public static void writeFile(final Document input, final File output) {
"""
Write an XML document (formatted) to a given <code>File</code>.
@param input
The input XML document.
@param output
The intended <code>File</code>.
"""
final StreamResult result = new StreamResult(new StringWriter());
format(new DOMSource(input), result);
try {
new FileWriter(output).write(result.getWriter().toString());
} catch (final IOException ioEx) {
LOGGER.error("Problem writing XML to file.", ioEx);
}
} | java | public static void writeFile(final Document input, final File output) {
final StreamResult result = new StreamResult(new StringWriter());
format(new DOMSource(input), result);
try {
new FileWriter(output).write(result.getWriter().toString());
} catch (final IOException ioEx) {
LOGGER.error("Problem writing XML to file.", ioEx);
}
} | [
"public",
"static",
"void",
"writeFile",
"(",
"final",
"Document",
"input",
",",
"final",
"File",
"output",
")",
"{",
"final",
"StreamResult",
"result",
"=",
"new",
"StreamResult",
"(",
"new",
"StringWriter",
"(",
")",
")",
";",
"format",
"(",
"new",
"DOMSource",
"(",
"input",
")",
",",
"result",
")",
";",
"try",
"{",
"new",
"FileWriter",
"(",
"output",
")",
".",
"write",
"(",
"result",
".",
"getWriter",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"ioEx",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Problem writing XML to file.\"",
",",
"ioEx",
")",
";",
"}",
"}"
] | Write an XML document (formatted) to a given <code>File</code>.
@param input
The input XML document.
@param output
The intended <code>File</code>. | [
"Write",
"an",
"XML",
"document",
"(",
"formatted",
")",
"to",
"a",
"given",
"<code",
">",
"File<",
"/",
"code",
">",
"."
] | train | https://github.com/kiegroup/jbpmmigration/blob/5e133e2824aa38f316a2eb061123313a7276aba0/src/main/java/org/jbpm/migration/XmlUtils.java#L144-L154 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MPrinter.java | MPrinter.getValueAt | protected Object getValueAt(final MBasicTable table, final int row, final int column) {
"""
Renvoie la valeur de la cellule de cette JTable à la ligne et la colonne spécifiée.
@return String
@param table
MBasicTable
@param row
int
@param column
int
"""
return table.getModel().getValueAt(row, column);
} | java | protected Object getValueAt(final MBasicTable table, final int row, final int column) {
return table.getModel().getValueAt(row, column);
} | [
"protected",
"Object",
"getValueAt",
"(",
"final",
"MBasicTable",
"table",
",",
"final",
"int",
"row",
",",
"final",
"int",
"column",
")",
"{",
"return",
"table",
".",
"getModel",
"(",
")",
".",
"getValueAt",
"(",
"row",
",",
"column",
")",
";",
"}"
] | Renvoie la valeur de la cellule de cette JTable à la ligne et la colonne spécifiée.
@return String
@param table
MBasicTable
@param row
int
@param column
int | [
"Renvoie",
"la",
"valeur",
"de",
"la",
"cellule",
"de",
"cette",
"JTable",
"à",
"la",
"ligne",
"et",
"la",
"colonne",
"spécifiée",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MPrinter.java#L124-L126 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java | PrimaveraPMFileReader.processProjectProperties | private void processProjectProperties(APIBusinessObjects apibo, ProjectType project) {
"""
Process project properties.
@param apibo top level object
@param project xml container
"""
ProjectProperties properties = m_projectFile.getProjectProperties();
properties.setCreationDate(project.getCreateDate());
properties.setFinishDate(project.getFinishDate());
properties.setName(project.getName());
properties.setStartDate(project.getPlannedStartDate());
properties.setStatusDate(project.getDataDate());
properties.setProjectTitle(project.getId());
properties.setUniqueID(project.getObjectId() == null ? null : project.getObjectId().toString());
List<GlobalPreferencesType> list = apibo.getGlobalPreferences();
if (!list.isEmpty())
{
GlobalPreferencesType prefs = list.get(0);
properties.setCreationDate(prefs.getCreateDate());
properties.setLastSaved(prefs.getLastUpdateDate());
properties.setMinutesPerDay(Integer.valueOf((int) (NumberHelper.getDouble(prefs.getHoursPerDay()) * 60)));
properties.setMinutesPerWeek(Integer.valueOf((int) (NumberHelper.getDouble(prefs.getHoursPerWeek()) * 60)));
properties.setWeekStartDay(Day.getInstance(NumberHelper.getInt(prefs.getStartDayOfWeek())));
List<CurrencyType> currencyList = apibo.getCurrency();
for (CurrencyType currency : currencyList)
{
if (currency.getObjectId().equals(prefs.getBaseCurrencyObjectId()))
{
properties.setCurrencySymbol(currency.getSymbol());
break;
}
}
}
} | java | private void processProjectProperties(APIBusinessObjects apibo, ProjectType project)
{
ProjectProperties properties = m_projectFile.getProjectProperties();
properties.setCreationDate(project.getCreateDate());
properties.setFinishDate(project.getFinishDate());
properties.setName(project.getName());
properties.setStartDate(project.getPlannedStartDate());
properties.setStatusDate(project.getDataDate());
properties.setProjectTitle(project.getId());
properties.setUniqueID(project.getObjectId() == null ? null : project.getObjectId().toString());
List<GlobalPreferencesType> list = apibo.getGlobalPreferences();
if (!list.isEmpty())
{
GlobalPreferencesType prefs = list.get(0);
properties.setCreationDate(prefs.getCreateDate());
properties.setLastSaved(prefs.getLastUpdateDate());
properties.setMinutesPerDay(Integer.valueOf((int) (NumberHelper.getDouble(prefs.getHoursPerDay()) * 60)));
properties.setMinutesPerWeek(Integer.valueOf((int) (NumberHelper.getDouble(prefs.getHoursPerWeek()) * 60)));
properties.setWeekStartDay(Day.getInstance(NumberHelper.getInt(prefs.getStartDayOfWeek())));
List<CurrencyType> currencyList = apibo.getCurrency();
for (CurrencyType currency : currencyList)
{
if (currency.getObjectId().equals(prefs.getBaseCurrencyObjectId()))
{
properties.setCurrencySymbol(currency.getSymbol());
break;
}
}
}
} | [
"private",
"void",
"processProjectProperties",
"(",
"APIBusinessObjects",
"apibo",
",",
"ProjectType",
"project",
")",
"{",
"ProjectProperties",
"properties",
"=",
"m_projectFile",
".",
"getProjectProperties",
"(",
")",
";",
"properties",
".",
"setCreationDate",
"(",
"project",
".",
"getCreateDate",
"(",
")",
")",
";",
"properties",
".",
"setFinishDate",
"(",
"project",
".",
"getFinishDate",
"(",
")",
")",
";",
"properties",
".",
"setName",
"(",
"project",
".",
"getName",
"(",
")",
")",
";",
"properties",
".",
"setStartDate",
"(",
"project",
".",
"getPlannedStartDate",
"(",
")",
")",
";",
"properties",
".",
"setStatusDate",
"(",
"project",
".",
"getDataDate",
"(",
")",
")",
";",
"properties",
".",
"setProjectTitle",
"(",
"project",
".",
"getId",
"(",
")",
")",
";",
"properties",
".",
"setUniqueID",
"(",
"project",
".",
"getObjectId",
"(",
")",
"==",
"null",
"?",
"null",
":",
"project",
".",
"getObjectId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"List",
"<",
"GlobalPreferencesType",
">",
"list",
"=",
"apibo",
".",
"getGlobalPreferences",
"(",
")",
";",
"if",
"(",
"!",
"list",
".",
"isEmpty",
"(",
")",
")",
"{",
"GlobalPreferencesType",
"prefs",
"=",
"list",
".",
"get",
"(",
"0",
")",
";",
"properties",
".",
"setCreationDate",
"(",
"prefs",
".",
"getCreateDate",
"(",
")",
")",
";",
"properties",
".",
"setLastSaved",
"(",
"prefs",
".",
"getLastUpdateDate",
"(",
")",
")",
";",
"properties",
".",
"setMinutesPerDay",
"(",
"Integer",
".",
"valueOf",
"(",
"(",
"int",
")",
"(",
"NumberHelper",
".",
"getDouble",
"(",
"prefs",
".",
"getHoursPerDay",
"(",
")",
")",
"*",
"60",
")",
")",
")",
";",
"properties",
".",
"setMinutesPerWeek",
"(",
"Integer",
".",
"valueOf",
"(",
"(",
"int",
")",
"(",
"NumberHelper",
".",
"getDouble",
"(",
"prefs",
".",
"getHoursPerWeek",
"(",
")",
")",
"*",
"60",
")",
")",
")",
";",
"properties",
".",
"setWeekStartDay",
"(",
"Day",
".",
"getInstance",
"(",
"NumberHelper",
".",
"getInt",
"(",
"prefs",
".",
"getStartDayOfWeek",
"(",
")",
")",
")",
")",
";",
"List",
"<",
"CurrencyType",
">",
"currencyList",
"=",
"apibo",
".",
"getCurrency",
"(",
")",
";",
"for",
"(",
"CurrencyType",
"currency",
":",
"currencyList",
")",
"{",
"if",
"(",
"currency",
".",
"getObjectId",
"(",
")",
".",
"equals",
"(",
"prefs",
".",
"getBaseCurrencyObjectId",
"(",
")",
")",
")",
"{",
"properties",
".",
"setCurrencySymbol",
"(",
"currency",
".",
"getSymbol",
"(",
")",
")",
";",
"break",
";",
"}",
"}",
"}",
"}"
] | Process project properties.
@param apibo top level object
@param project xml container | [
"Process",
"project",
"properties",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L337-L370 |
hazelcast/hazelcast | hazelcast-client/src/main/java/com/hazelcast/client/proxy/ClientPNCounterProxy.java | ClientPNCounterProxy.toVectorClock | private VectorClock toVectorClock(List<Entry<String, Long>> replicaLogicalTimestamps) {
"""
Transforms the list of replica logical timestamps to a vector clock instance.
@param replicaLogicalTimestamps the logical timestamps
@return a vector clock instance
"""
final VectorClock timestamps = new VectorClock();
for (Entry<String, Long> replicaTimestamp : replicaLogicalTimestamps) {
timestamps.setReplicaTimestamp(replicaTimestamp.getKey(), replicaTimestamp.getValue());
}
return timestamps;
} | java | private VectorClock toVectorClock(List<Entry<String, Long>> replicaLogicalTimestamps) {
final VectorClock timestamps = new VectorClock();
for (Entry<String, Long> replicaTimestamp : replicaLogicalTimestamps) {
timestamps.setReplicaTimestamp(replicaTimestamp.getKey(), replicaTimestamp.getValue());
}
return timestamps;
} | [
"private",
"VectorClock",
"toVectorClock",
"(",
"List",
"<",
"Entry",
"<",
"String",
",",
"Long",
">",
">",
"replicaLogicalTimestamps",
")",
"{",
"final",
"VectorClock",
"timestamps",
"=",
"new",
"VectorClock",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Long",
">",
"replicaTimestamp",
":",
"replicaLogicalTimestamps",
")",
"{",
"timestamps",
".",
"setReplicaTimestamp",
"(",
"replicaTimestamp",
".",
"getKey",
"(",
")",
",",
"replicaTimestamp",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"timestamps",
";",
"}"
] | Transforms the list of replica logical timestamps to a vector clock instance.
@param replicaLogicalTimestamps the logical timestamps
@return a vector clock instance | [
"Transforms",
"the",
"list",
"of",
"replica",
"logical",
"timestamps",
"to",
"a",
"vector",
"clock",
"instance",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/proxy/ClientPNCounterProxy.java#L213-L219 |
threerings/nenya | tools/src/main/java/com/threerings/media/tile/tools/xml/XMLTileSetParser.java | XMLTileSetParser.loadTileSets | public void loadTileSets (InputStream source, Map<String, TileSet> tilesets)
throws IOException {
"""
Loads all of the tilesets specified in the supplied XML tileset
description file and places them into the supplied map indexed
by tileset name. This method is not reentrant, so don't go calling
it from multiple threads.
@param source an input stream from which the tileset definition
file can be read.
@param tilesets the map into which the tilesets will be placed,
indexed by tileset name.
"""
// stick an array list on the top of the stack for collecting
// parsed tilesets
List<TileSet> setlist = Lists.newArrayList();
_digester.push(setlist);
// now fire up the digester to parse the stream
try {
_digester.parse(source);
} catch (SAXException saxe) {
log.warning("Exception parsing tile set descriptions.", saxe);
}
// stick the tilesets from the list into the hashtable
for (int ii = 0; ii < setlist.size(); ii++) {
TileSet set = setlist.get(ii);
if (set.getName() == null) {
log.warning("Tileset did not receive name during " +
"parsing process [set=" + set + "].");
} else {
tilesets.put(set.getName(), set);
}
}
// and clear out the list for next time
setlist.clear();
} | java | public void loadTileSets (InputStream source, Map<String, TileSet> tilesets)
throws IOException
{
// stick an array list on the top of the stack for collecting
// parsed tilesets
List<TileSet> setlist = Lists.newArrayList();
_digester.push(setlist);
// now fire up the digester to parse the stream
try {
_digester.parse(source);
} catch (SAXException saxe) {
log.warning("Exception parsing tile set descriptions.", saxe);
}
// stick the tilesets from the list into the hashtable
for (int ii = 0; ii < setlist.size(); ii++) {
TileSet set = setlist.get(ii);
if (set.getName() == null) {
log.warning("Tileset did not receive name during " +
"parsing process [set=" + set + "].");
} else {
tilesets.put(set.getName(), set);
}
}
// and clear out the list for next time
setlist.clear();
} | [
"public",
"void",
"loadTileSets",
"(",
"InputStream",
"source",
",",
"Map",
"<",
"String",
",",
"TileSet",
">",
"tilesets",
")",
"throws",
"IOException",
"{",
"// stick an array list on the top of the stack for collecting",
"// parsed tilesets",
"List",
"<",
"TileSet",
">",
"setlist",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"_digester",
".",
"push",
"(",
"setlist",
")",
";",
"// now fire up the digester to parse the stream",
"try",
"{",
"_digester",
".",
"parse",
"(",
"source",
")",
";",
"}",
"catch",
"(",
"SAXException",
"saxe",
")",
"{",
"log",
".",
"warning",
"(",
"\"Exception parsing tile set descriptions.\"",
",",
"saxe",
")",
";",
"}",
"// stick the tilesets from the list into the hashtable",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"setlist",
".",
"size",
"(",
")",
";",
"ii",
"++",
")",
"{",
"TileSet",
"set",
"=",
"setlist",
".",
"get",
"(",
"ii",
")",
";",
"if",
"(",
"set",
".",
"getName",
"(",
")",
"==",
"null",
")",
"{",
"log",
".",
"warning",
"(",
"\"Tileset did not receive name during \"",
"+",
"\"parsing process [set=\"",
"+",
"set",
"+",
"\"].\"",
")",
";",
"}",
"else",
"{",
"tilesets",
".",
"put",
"(",
"set",
".",
"getName",
"(",
")",
",",
"set",
")",
";",
"}",
"}",
"// and clear out the list for next time",
"setlist",
".",
"clear",
"(",
")",
";",
"}"
] | Loads all of the tilesets specified in the supplied XML tileset
description file and places them into the supplied map indexed
by tileset name. This method is not reentrant, so don't go calling
it from multiple threads.
@param source an input stream from which the tileset definition
file can be read.
@param tilesets the map into which the tilesets will be placed,
indexed by tileset name. | [
"Loads",
"all",
"of",
"the",
"tilesets",
"specified",
"in",
"the",
"supplied",
"XML",
"tileset",
"description",
"file",
"and",
"places",
"them",
"into",
"the",
"supplied",
"map",
"indexed",
"by",
"tileset",
"name",
".",
"This",
"method",
"is",
"not",
"reentrant",
"so",
"don",
"t",
"go",
"calling",
"it",
"from",
"multiple",
"threads",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/tools/xml/XMLTileSetParser.java#L141-L169 |
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) {
"""
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.
"""
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",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | 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 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java | XmlIO.load | public static AnnotationMappingInfo load(final File file, final String encoding) throws XmlOperateException {
"""
XMLファイルを読み込み、{@link AnnotationMappingInfo}として取得する。
@param file 読み込むファイル
@param encoding 読み込むファイルの文字コード
@return
@throws XmlOperateException XMLの読み込みに失敗した場合。
@throws IllegalArgumentException file is null or encoding is empty.
"""
ArgUtils.notNull(file, "file");
ArgUtils.notEmpty(encoding, "encoding");
final AnnotationMappingInfo xmlInfo;
try(Reader reader = new InputStreamReader(new FileInputStream(file), encoding)) {
xmlInfo = load(reader);
} catch (IOException e) {
throw new XmlOperateException(String.format("fail load xml file '%s'.", file.getPath()), e);
}
return xmlInfo;
} | java | public static AnnotationMappingInfo load(final File file, final String encoding) throws XmlOperateException {
ArgUtils.notNull(file, "file");
ArgUtils.notEmpty(encoding, "encoding");
final AnnotationMappingInfo xmlInfo;
try(Reader reader = new InputStreamReader(new FileInputStream(file), encoding)) {
xmlInfo = load(reader);
} catch (IOException e) {
throw new XmlOperateException(String.format("fail load xml file '%s'.", file.getPath()), e);
}
return xmlInfo;
} | [
"public",
"static",
"AnnotationMappingInfo",
"load",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"encoding",
")",
"throws",
"XmlOperateException",
"{",
"ArgUtils",
".",
"notNull",
"(",
"file",
",",
"\"file\"",
")",
";",
"ArgUtils",
".",
"notEmpty",
"(",
"encoding",
",",
"\"encoding\"",
")",
";",
"final",
"AnnotationMappingInfo",
"xmlInfo",
";",
"try",
"(",
"Reader",
"reader",
"=",
"new",
"InputStreamReader",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
",",
"encoding",
")",
")",
"{",
"xmlInfo",
"=",
"load",
"(",
"reader",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"XmlOperateException",
"(",
"String",
".",
"format",
"(",
"\"fail load xml file '%s'.\"",
",",
"file",
".",
"getPath",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"return",
"xmlInfo",
";",
"}"
] | XMLファイルを読み込み、{@link AnnotationMappingInfo}として取得する。
@param file 読み込むファイル
@param encoding 読み込むファイルの文字コード
@return
@throws XmlOperateException XMLの読み込みに失敗した場合。
@throws IllegalArgumentException file is null or encoding is empty. | [
"XMLファイルを読み込み、",
"{"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java#L84-L98 |
iipc/webarchive-commons | src/main/java/org/archive/io/WriterPoolMember.java | WriterPoolMember.createFile | protected String createFile() throws IOException {
"""
Create a new file.
Rotates off the current Writer and creates a new in its place
to take subsequent writes. Usually called from {@link #checkSize()}.
@return Name of file created.
@throws IOException
"""
generateNewBasename();
String name = currentBasename + '.' + this.extension +
((settings.getCompress())? DOT_COMPRESSED_FILE_EXTENSION: "") +
OCCUPIED_SUFFIX;
File dir = getNextDirectory(settings.calcOutputDirs());
return createFile(new File(dir, name));
} | java | protected String createFile() throws IOException {
generateNewBasename();
String name = currentBasename + '.' + this.extension +
((settings.getCompress())? DOT_COMPRESSED_FILE_EXTENSION: "") +
OCCUPIED_SUFFIX;
File dir = getNextDirectory(settings.calcOutputDirs());
return createFile(new File(dir, name));
} | [
"protected",
"String",
"createFile",
"(",
")",
"throws",
"IOException",
"{",
"generateNewBasename",
"(",
")",
";",
"String",
"name",
"=",
"currentBasename",
"+",
"'",
"'",
"+",
"this",
".",
"extension",
"+",
"(",
"(",
"settings",
".",
"getCompress",
"(",
")",
")",
"?",
"DOT_COMPRESSED_FILE_EXTENSION",
":",
"\"\"",
")",
"+",
"OCCUPIED_SUFFIX",
";",
"File",
"dir",
"=",
"getNextDirectory",
"(",
"settings",
".",
"calcOutputDirs",
"(",
")",
")",
";",
"return",
"createFile",
"(",
"new",
"File",
"(",
"dir",
",",
"name",
")",
")",
";",
"}"
] | Create a new file.
Rotates off the current Writer and creates a new in its place
to take subsequent writes. Usually called from {@link #checkSize()}.
@return Name of file created.
@throws IOException | [
"Create",
"a",
"new",
"file",
".",
"Rotates",
"off",
"the",
"current",
"Writer",
"and",
"creates",
"a",
"new",
"in",
"its",
"place",
"to",
"take",
"subsequent",
"writes",
".",
"Usually",
"called",
"from",
"{"
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/WriterPoolMember.java#L198-L205 |
sachin-handiekar/jMusixMatch | src/main/java/org/jmusixmatch/MusixMatch.java | MusixMatch.getTrackResponse | private Track getTrackResponse(String methodName, Map<String, Object> params)
throws MusixMatchException {
"""
Returns the track response which was returned through the query.
@param methodName
the name of the API method.
@param params
a map which contains the key-value pair
@return the track details.
@throws MusixMatchException
if any error occurs.
"""
Track track = new Track();
String response = null;
TrackGetMessage message = null;
response = MusixMatchRequest.sendRequest(Helper.getURLString(
methodName, params));
Gson gson = new Gson();
try {
message = gson.fromJson(response, TrackGetMessage.class);
} catch (JsonParseException jpe) {
handleErrorResponse(response);
}
TrackData data = message.getTrackMessage().getBody().getTrack();
track.setTrack(data);
return track;
} | java | private Track getTrackResponse(String methodName, Map<String, Object> params)
throws MusixMatchException {
Track track = new Track();
String response = null;
TrackGetMessage message = null;
response = MusixMatchRequest.sendRequest(Helper.getURLString(
methodName, params));
Gson gson = new Gson();
try {
message = gson.fromJson(response, TrackGetMessage.class);
} catch (JsonParseException jpe) {
handleErrorResponse(response);
}
TrackData data = message.getTrackMessage().getBody().getTrack();
track.setTrack(data);
return track;
} | [
"private",
"Track",
"getTrackResponse",
"(",
"String",
"methodName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"throws",
"MusixMatchException",
"{",
"Track",
"track",
"=",
"new",
"Track",
"(",
")",
";",
"String",
"response",
"=",
"null",
";",
"TrackGetMessage",
"message",
"=",
"null",
";",
"response",
"=",
"MusixMatchRequest",
".",
"sendRequest",
"(",
"Helper",
".",
"getURLString",
"(",
"methodName",
",",
"params",
")",
")",
";",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"try",
"{",
"message",
"=",
"gson",
".",
"fromJson",
"(",
"response",
",",
"TrackGetMessage",
".",
"class",
")",
";",
"}",
"catch",
"(",
"JsonParseException",
"jpe",
")",
"{",
"handleErrorResponse",
"(",
"response",
")",
";",
"}",
"TrackData",
"data",
"=",
"message",
".",
"getTrackMessage",
"(",
")",
".",
"getBody",
"(",
")",
".",
"getTrack",
"(",
")",
";",
"track",
".",
"setTrack",
"(",
"data",
")",
";",
"return",
"track",
";",
"}"
] | Returns the track response which was returned through the query.
@param methodName
the name of the API method.
@param params
a map which contains the key-value pair
@return the track details.
@throws MusixMatchException
if any error occurs. | [
"Returns",
"the",
"track",
"response",
"which",
"was",
"returned",
"through",
"the",
"query",
"."
] | train | https://github.com/sachin-handiekar/jMusixMatch/blob/da909f7732053a801ea7282fe9a8bce385fa3763/src/main/java/org/jmusixmatch/MusixMatch.java#L263-L285 |
seedstack/seed | security/core/src/main/java/org/seedstack/seed/security/internal/authorization/ConfigurationRoleMapping.java | ConfigurationRoleMapping.findScope | private String findScope(String wildcard, String wildcardAuth, String auth) {
"""
Finds the scope in a string that corresponds to a role with {wildcard}.<br>
For example, if wildcardAuth is toto.{SCOPE} and auth is toto.foo then
scope is foo.
@param wildcard the wildcard to search for
@param wildcardAuth auth with {wildcard}
@param auth auth that corresponds
@return the scope.
"""
String scope;
String before = StringUtils.substringBefore(wildcardAuth, wildcard);
String after = StringUtils.substringAfter(wildcardAuth, wildcard);
if (StringUtils.startsWith(wildcardAuth, wildcard)) {
scope = StringUtils.substringBefore(auth, after);
} else if (StringUtils.endsWith(wildcardAuth, wildcard)) {
scope = StringUtils.substringAfter(auth, before);
} else {
scope = StringUtils.substringBetween(auth, before, after);
}
return scope;
} | java | private String findScope(String wildcard, String wildcardAuth, String auth) {
String scope;
String before = StringUtils.substringBefore(wildcardAuth, wildcard);
String after = StringUtils.substringAfter(wildcardAuth, wildcard);
if (StringUtils.startsWith(wildcardAuth, wildcard)) {
scope = StringUtils.substringBefore(auth, after);
} else if (StringUtils.endsWith(wildcardAuth, wildcard)) {
scope = StringUtils.substringAfter(auth, before);
} else {
scope = StringUtils.substringBetween(auth, before, after);
}
return scope;
} | [
"private",
"String",
"findScope",
"(",
"String",
"wildcard",
",",
"String",
"wildcardAuth",
",",
"String",
"auth",
")",
"{",
"String",
"scope",
";",
"String",
"before",
"=",
"StringUtils",
".",
"substringBefore",
"(",
"wildcardAuth",
",",
"wildcard",
")",
";",
"String",
"after",
"=",
"StringUtils",
".",
"substringAfter",
"(",
"wildcardAuth",
",",
"wildcard",
")",
";",
"if",
"(",
"StringUtils",
".",
"startsWith",
"(",
"wildcardAuth",
",",
"wildcard",
")",
")",
"{",
"scope",
"=",
"StringUtils",
".",
"substringBefore",
"(",
"auth",
",",
"after",
")",
";",
"}",
"else",
"if",
"(",
"StringUtils",
".",
"endsWith",
"(",
"wildcardAuth",
",",
"wildcard",
")",
")",
"{",
"scope",
"=",
"StringUtils",
".",
"substringAfter",
"(",
"auth",
",",
"before",
")",
";",
"}",
"else",
"{",
"scope",
"=",
"StringUtils",
".",
"substringBetween",
"(",
"auth",
",",
"before",
",",
"after",
")",
";",
"}",
"return",
"scope",
";",
"}"
] | Finds the scope in a string that corresponds to a role with {wildcard}.<br>
For example, if wildcardAuth is toto.{SCOPE} and auth is toto.foo then
scope is foo.
@param wildcard the wildcard to search for
@param wildcardAuth auth with {wildcard}
@param auth auth that corresponds
@return the scope. | [
"Finds",
"the",
"scope",
"in",
"a",
"string",
"that",
"corresponds",
"to",
"a",
"role",
"with",
"{",
"wildcard",
"}",
".",
"<br",
">",
"For",
"example",
"if",
"wildcardAuth",
"is",
"toto",
".",
"{",
"SCOPE",
"}",
"and",
"auth",
"is",
"toto",
".",
"foo",
"then",
"scope",
"is",
"foo",
"."
] | train | https://github.com/seedstack/seed/blob/d9cf33bfb2fffcdbb0976f4726e943acda90e828/security/core/src/main/java/org/seedstack/seed/security/internal/authorization/ConfigurationRoleMapping.java#L162-L174 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java | HtmlTextareaRendererBase.renderTextAreaValue | protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException {
"""
Subclasses can override the writing of the "text" value of the textarea
"""
ResponseWriter writer = facesContext.getResponseWriter();
Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR);
if (addNewLineAtStart != null)
{
boolean addNewLineAtStartBoolean = false;
if (addNewLineAtStart instanceof String)
{
addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart);
}
else if (addNewLineAtStart instanceof Boolean)
{
addNewLineAtStartBoolean = (Boolean) addNewLineAtStart;
}
if (addNewLineAtStartBoolean)
{
writer.writeText("\n", null);
}
}
String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent);
if (strValue != null)
{
writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
}
} | java | protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException
{
ResponseWriter writer = facesContext.getResponseWriter();
Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR);
if (addNewLineAtStart != null)
{
boolean addNewLineAtStartBoolean = false;
if (addNewLineAtStart instanceof String)
{
addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart);
}
else if (addNewLineAtStart instanceof Boolean)
{
addNewLineAtStartBoolean = (Boolean) addNewLineAtStart;
}
if (addNewLineAtStartBoolean)
{
writer.writeText("\n", null);
}
}
String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent);
if (strValue != null)
{
writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
}
} | [
"protected",
"void",
"renderTextAreaValue",
"(",
"FacesContext",
"facesContext",
",",
"UIComponent",
"uiComponent",
")",
"throws",
"IOException",
"{",
"ResponseWriter",
"writer",
"=",
"facesContext",
".",
"getResponseWriter",
"(",
")",
";",
"Object",
"addNewLineAtStart",
"=",
"uiComponent",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"ADD_NEW_LINE_AT_START_ATTR",
")",
";",
"if",
"(",
"addNewLineAtStart",
"!=",
"null",
")",
"{",
"boolean",
"addNewLineAtStartBoolean",
"=",
"false",
";",
"if",
"(",
"addNewLineAtStart",
"instanceof",
"String",
")",
"{",
"addNewLineAtStartBoolean",
"=",
"Boolean",
".",
"valueOf",
"(",
"(",
"String",
")",
"addNewLineAtStart",
")",
";",
"}",
"else",
"if",
"(",
"addNewLineAtStart",
"instanceof",
"Boolean",
")",
"{",
"addNewLineAtStartBoolean",
"=",
"(",
"Boolean",
")",
"addNewLineAtStart",
";",
"}",
"if",
"(",
"addNewLineAtStartBoolean",
")",
"{",
"writer",
".",
"writeText",
"(",
"\"\\n\"",
",",
"null",
")",
";",
"}",
"}",
"String",
"strValue",
"=",
"org",
".",
"apache",
".",
"myfaces",
".",
"shared",
".",
"renderkit",
".",
"RendererUtils",
".",
"getStringValue",
"(",
"facesContext",
",",
"uiComponent",
")",
";",
"if",
"(",
"strValue",
"!=",
"null",
")",
"{",
"writer",
".",
"writeText",
"(",
"strValue",
",",
"org",
".",
"apache",
".",
"myfaces",
".",
"shared",
".",
"renderkit",
".",
"JSFAttr",
".",
"VALUE_ATTR",
")",
";",
"}",
"}"
] | Subclasses can override the writing of the "text" value of the textarea | [
"Subclasses",
"can",
"override",
"the",
"writing",
"of",
"the",
"text",
"value",
"of",
"the",
"textarea"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java#L162-L189 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceCreator.java | V1InstanceCreator.regressionSuite | public RegressionSuite regressionSuite(String name, RegressionPlan regressionPlan, Map<String, Object> attributes) {
"""
Creates a new Regression Suite with title assigned with this Regression Plan.
@param name Title of the suite.
@param regressionPlan Regression Plan to assign.
@param attributes additional attributes for the RegressionSuite.
@return A newly minted Regression Suite that exists in the VersionOne system.
"""
RegressionSuite regressionSuite = new RegressionSuite(instance);
regressionSuite.setName(name);
regressionSuite.setRegressionPlan(regressionPlan);
addAttributes(regressionSuite, attributes);
regressionSuite.save();
return regressionSuite;
} | java | public RegressionSuite regressionSuite(String name, RegressionPlan regressionPlan, Map<String, Object> attributes) {
RegressionSuite regressionSuite = new RegressionSuite(instance);
regressionSuite.setName(name);
regressionSuite.setRegressionPlan(regressionPlan);
addAttributes(regressionSuite, attributes);
regressionSuite.save();
return regressionSuite;
} | [
"public",
"RegressionSuite",
"regressionSuite",
"(",
"String",
"name",
",",
"RegressionPlan",
"regressionPlan",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"RegressionSuite",
"regressionSuite",
"=",
"new",
"RegressionSuite",
"(",
"instance",
")",
";",
"regressionSuite",
".",
"setName",
"(",
"name",
")",
";",
"regressionSuite",
".",
"setRegressionPlan",
"(",
"regressionPlan",
")",
";",
"addAttributes",
"(",
"regressionSuite",
",",
"attributes",
")",
";",
"regressionSuite",
".",
"save",
"(",
")",
";",
"return",
"regressionSuite",
";",
"}"
] | Creates a new Regression Suite with title assigned with this Regression Plan.
@param name Title of the suite.
@param regressionPlan Regression Plan to assign.
@param attributes additional attributes for the RegressionSuite.
@return A newly minted Regression Suite that exists in the VersionOne system. | [
"Creates",
"a",
"new",
"Regression",
"Suite",
"with",
"title",
"assigned",
"with",
"this",
"Regression",
"Plan",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceCreator.java#L1124-L1133 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/internal/crypto/ContentCryptoMaterial.java | ContentCryptoMaterial.create | static ContentCryptoMaterial create(SecretKey cek, byte[] iv,
EncryptionMaterials kekMaterials,
S3CryptoScheme scheme,
Provider provider, AWSKMS kms,
AmazonWebServiceRequest req) {
"""
Returns a new instance of <code>ContentCryptoMaterial</code>
for the input parameters using the specified s3 crypto scheme.
Note network calls are involved if the CEK is to be protected by KMS.
@param cek content encrypting key
@param iv initialization vector
@param kekMaterials kek encryption material used to secure the CEK;
can be KMS enabled.
@param scheme
s3 crypto scheme to be used for the content crypto material by
providing the content crypto scheme, key wrapping scheme and
mechanism for secure randomness
@param provider optional security provider
@param kms reference to the KMS client
@param req originating service request
"""
return doCreate(cek, iv, kekMaterials, scheme.getContentCryptoScheme(),
scheme, provider, kms, req);
} | java | static ContentCryptoMaterial create(SecretKey cek, byte[] iv,
EncryptionMaterials kekMaterials,
S3CryptoScheme scheme,
Provider provider, AWSKMS kms,
AmazonWebServiceRequest req) {
return doCreate(cek, iv, kekMaterials, scheme.getContentCryptoScheme(),
scheme, provider, kms, req);
} | [
"static",
"ContentCryptoMaterial",
"create",
"(",
"SecretKey",
"cek",
",",
"byte",
"[",
"]",
"iv",
",",
"EncryptionMaterials",
"kekMaterials",
",",
"S3CryptoScheme",
"scheme",
",",
"Provider",
"provider",
",",
"AWSKMS",
"kms",
",",
"AmazonWebServiceRequest",
"req",
")",
"{",
"return",
"doCreate",
"(",
"cek",
",",
"iv",
",",
"kekMaterials",
",",
"scheme",
".",
"getContentCryptoScheme",
"(",
")",
",",
"scheme",
",",
"provider",
",",
"kms",
",",
"req",
")",
";",
"}"
] | Returns a new instance of <code>ContentCryptoMaterial</code>
for the input parameters using the specified s3 crypto scheme.
Note network calls are involved if the CEK is to be protected by KMS.
@param cek content encrypting key
@param iv initialization vector
@param kekMaterials kek encryption material used to secure the CEK;
can be KMS enabled.
@param scheme
s3 crypto scheme to be used for the content crypto material by
providing the content crypto scheme, key wrapping scheme and
mechanism for secure randomness
@param provider optional security provider
@param kms reference to the KMS client
@param req originating service request | [
"Returns",
"a",
"new",
"instance",
"of",
"<code",
">",
"ContentCryptoMaterial<",
"/",
"code",
">",
"for",
"the",
"input",
"parameters",
"using",
"the",
"specified",
"s3",
"crypto",
"scheme",
".",
"Note",
"network",
"calls",
"are",
"involved",
"if",
"the",
"CEK",
"is",
"to",
"be",
"protected",
"by",
"KMS",
"."
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/internal/crypto/ContentCryptoMaterial.java#L762-L769 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cachepolicylabel_binding.java | cachepolicylabel_binding.get | public static cachepolicylabel_binding get(nitro_service service, String labelname) throws Exception {
"""
Use this API to fetch cachepolicylabel_binding resource of given name .
"""
cachepolicylabel_binding obj = new cachepolicylabel_binding();
obj.set_labelname(labelname);
cachepolicylabel_binding response = (cachepolicylabel_binding) obj.get_resource(service);
return response;
} | java | public static cachepolicylabel_binding get(nitro_service service, String labelname) throws Exception{
cachepolicylabel_binding obj = new cachepolicylabel_binding();
obj.set_labelname(labelname);
cachepolicylabel_binding response = (cachepolicylabel_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"cachepolicylabel_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"cachepolicylabel_binding",
"obj",
"=",
"new",
"cachepolicylabel_binding",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",
"labelname",
")",
";",
"cachepolicylabel_binding",
"response",
"=",
"(",
"cachepolicylabel_binding",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch cachepolicylabel_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"cachepolicylabel_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cachepolicylabel_binding.java#L114-L119 |
JodaOrg/joda-time | src/main/java/org/joda/time/tz/ZoneInfoProvider.java | ZoneInfoProvider.openResource | @SuppressWarnings("resource")
private InputStream openResource(String name) throws IOException {
"""
Opens a resource from file or classpath.
@param name the name to open
@return the input stream
@throws IOException if an error occurs
"""
InputStream in;
if (iFileDir != null) {
in = new FileInputStream(new File(iFileDir, name));
} else {
final String path = iResourcePath.concat(name);
in = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
public InputStream run() {
if (iLoader != null) {
return iLoader.getResourceAsStream(path);
} else {
return ClassLoader.getSystemResourceAsStream(path);
}
}
});
if (in == null) {
StringBuilder buf = new StringBuilder(40)
.append("Resource not found: \"")
.append(path)
.append("\" ClassLoader: ")
.append(iLoader != null ? iLoader.toString() : "system");
throw new IOException(buf.toString());
}
}
return in;
} | java | @SuppressWarnings("resource")
private InputStream openResource(String name) throws IOException {
InputStream in;
if (iFileDir != null) {
in = new FileInputStream(new File(iFileDir, name));
} else {
final String path = iResourcePath.concat(name);
in = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
public InputStream run() {
if (iLoader != null) {
return iLoader.getResourceAsStream(path);
} else {
return ClassLoader.getSystemResourceAsStream(path);
}
}
});
if (in == null) {
StringBuilder buf = new StringBuilder(40)
.append("Resource not found: \"")
.append(path)
.append("\" ClassLoader: ")
.append(iLoader != null ? iLoader.toString() : "system");
throw new IOException(buf.toString());
}
}
return in;
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"private",
"InputStream",
"openResource",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
";",
"if",
"(",
"iFileDir",
"!=",
"null",
")",
"{",
"in",
"=",
"new",
"FileInputStream",
"(",
"new",
"File",
"(",
"iFileDir",
",",
"name",
")",
")",
";",
"}",
"else",
"{",
"final",
"String",
"path",
"=",
"iResourcePath",
".",
"concat",
"(",
"name",
")",
";",
"in",
"=",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"InputStream",
">",
"(",
")",
"{",
"public",
"InputStream",
"run",
"(",
")",
"{",
"if",
"(",
"iLoader",
"!=",
"null",
")",
"{",
"return",
"iLoader",
".",
"getResourceAsStream",
"(",
"path",
")",
";",
"}",
"else",
"{",
"return",
"ClassLoader",
".",
"getSystemResourceAsStream",
"(",
"path",
")",
";",
"}",
"}",
"}",
")",
";",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"40",
")",
".",
"append",
"(",
"\"Resource not found: \\\"\"",
")",
".",
"append",
"(",
"path",
")",
".",
"append",
"(",
"\"\\\" ClassLoader: \"",
")",
".",
"append",
"(",
"iLoader",
"!=",
"null",
"?",
"iLoader",
".",
"toString",
"(",
")",
":",
"\"system\"",
")",
";",
"throw",
"new",
"IOException",
"(",
"buf",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"return",
"in",
";",
"}"
] | Opens a resource from file or classpath.
@param name the name to open
@return the input stream
@throws IOException if an error occurs | [
"Opens",
"a",
"resource",
"from",
"file",
"or",
"classpath",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/tz/ZoneInfoProvider.java#L203-L229 |
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) {
"""
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
"""
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 |
jcustenborder/connect-utils | connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java | ConfigUtils.getAbsoluteFile | public static File getAbsoluteFile(AbstractConfig config, String key) {
"""
Method is used to return a File checking to ensure that it is an absolute path.
@param config config to read the value from
@param key key for the value
@return File for the config value.
"""
Preconditions.checkNotNull(config, "config cannot be null");
String path = config.getString(key);
File file = new File(path);
if (!file.isAbsolute()) {
throw new ConfigException(
key,
path,
"Must be an absolute path."
);
}
return new File(path);
} | java | public static File getAbsoluteFile(AbstractConfig config, String key) {
Preconditions.checkNotNull(config, "config cannot be null");
String path = config.getString(key);
File file = new File(path);
if (!file.isAbsolute()) {
throw new ConfigException(
key,
path,
"Must be an absolute path."
);
}
return new File(path);
} | [
"public",
"static",
"File",
"getAbsoluteFile",
"(",
"AbstractConfig",
"config",
",",
"String",
"key",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"config",
",",
"\"config cannot be null\"",
")",
";",
"String",
"path",
"=",
"config",
".",
"getString",
"(",
"key",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"!",
"file",
".",
"isAbsolute",
"(",
")",
")",
"{",
"throw",
"new",
"ConfigException",
"(",
"key",
",",
"path",
",",
"\"Must be an absolute path.\"",
")",
";",
"}",
"return",
"new",
"File",
"(",
"path",
")",
";",
"}"
] | Method is used to return a File checking to ensure that it is an absolute path.
@param config config to read the value from
@param key key for the value
@return File for the config value. | [
"Method",
"is",
"used",
"to",
"return",
"a",
"File",
"checking",
"to",
"ensure",
"that",
"it",
"is",
"an",
"absolute",
"path",
"."
] | train | https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java#L86-L98 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLStatementCache.java | CQLStatementCache.getPreparedUpdate | public PreparedStatement getPreparedUpdate(String tableName, Update update) {
"""
Get the given prepared statement for the given table and update. Upon
first invocation for a given combo, the query is parsed and cached.
@param tableName Name of table to customize update for.
@param update Inquiry {@link Update}.
@return PreparedStatement for given combo.
"""
synchronized (m_prepUpdateMap) {
Map<Update, PreparedStatement> statementMap = m_prepUpdateMap.get(tableName);
if (statementMap == null) {
statementMap = new HashMap<>();
m_prepUpdateMap.put(tableName, statementMap);
}
PreparedStatement prepState = statementMap.get(update);
if (prepState == null) {
prepState = prepareUpdate(tableName, update);
statementMap.put(update, prepState);
}
return prepState;
}
} | java | public PreparedStatement getPreparedUpdate(String tableName, Update update) {
synchronized (m_prepUpdateMap) {
Map<Update, PreparedStatement> statementMap = m_prepUpdateMap.get(tableName);
if (statementMap == null) {
statementMap = new HashMap<>();
m_prepUpdateMap.put(tableName, statementMap);
}
PreparedStatement prepState = statementMap.get(update);
if (prepState == null) {
prepState = prepareUpdate(tableName, update);
statementMap.put(update, prepState);
}
return prepState;
}
} | [
"public",
"PreparedStatement",
"getPreparedUpdate",
"(",
"String",
"tableName",
",",
"Update",
"update",
")",
"{",
"synchronized",
"(",
"m_prepUpdateMap",
")",
"{",
"Map",
"<",
"Update",
",",
"PreparedStatement",
">",
"statementMap",
"=",
"m_prepUpdateMap",
".",
"get",
"(",
"tableName",
")",
";",
"if",
"(",
"statementMap",
"==",
"null",
")",
"{",
"statementMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"m_prepUpdateMap",
".",
"put",
"(",
"tableName",
",",
"statementMap",
")",
";",
"}",
"PreparedStatement",
"prepState",
"=",
"statementMap",
".",
"get",
"(",
"update",
")",
";",
"if",
"(",
"prepState",
"==",
"null",
")",
"{",
"prepState",
"=",
"prepareUpdate",
"(",
"tableName",
",",
"update",
")",
";",
"statementMap",
".",
"put",
"(",
"update",
",",
"prepState",
")",
";",
"}",
"return",
"prepState",
";",
"}",
"}"
] | Get the given prepared statement for the given table and update. Upon
first invocation for a given combo, the query is parsed and cached.
@param tableName Name of table to customize update for.
@param update Inquiry {@link Update}.
@return PreparedStatement for given combo. | [
"Get",
"the",
"given",
"prepared",
"statement",
"for",
"the",
"given",
"table",
"and",
"update",
".",
"Upon",
"first",
"invocation",
"for",
"a",
"given",
"combo",
"the",
"query",
"is",
"parsed",
"and",
"cached",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLStatementCache.java#L115-L129 |
qmx/jitescript | src/main/java/me/qmx/jitescript/CodeBlock.java | CodeBlock.frame_same | public CodeBlock frame_same(final Object... stackArguments) {
"""
adds a compressed frame to the stack
@param stackArguments the argument types on the stack, represented as
"class path names" e.g java/lang/RuntimeException
"""
final int type;
switch (stackArguments.length) {
case 0:
type = Opcodes.F_SAME;
break;
case 1:
type = Opcodes.F_SAME1;
break;
default:
throw new IllegalArgumentException("same frame should have 0" + " or 1 arguments on stack");
}
instructionList.add(new FrameNode(type, 0, null, stackArguments.length, stackArguments));
return this;
} | java | public CodeBlock frame_same(final Object... stackArguments) {
final int type;
switch (stackArguments.length) {
case 0:
type = Opcodes.F_SAME;
break;
case 1:
type = Opcodes.F_SAME1;
break;
default:
throw new IllegalArgumentException("same frame should have 0" + " or 1 arguments on stack");
}
instructionList.add(new FrameNode(type, 0, null, stackArguments.length, stackArguments));
return this;
} | [
"public",
"CodeBlock",
"frame_same",
"(",
"final",
"Object",
"...",
"stackArguments",
")",
"{",
"final",
"int",
"type",
";",
"switch",
"(",
"stackArguments",
".",
"length",
")",
"{",
"case",
"0",
":",
"type",
"=",
"Opcodes",
".",
"F_SAME",
";",
"break",
";",
"case",
"1",
":",
"type",
"=",
"Opcodes",
".",
"F_SAME1",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"same frame should have 0\"",
"+",
"\" or 1 arguments on stack\"",
")",
";",
"}",
"instructionList",
".",
"add",
"(",
"new",
"FrameNode",
"(",
"type",
",",
"0",
",",
"null",
",",
"stackArguments",
".",
"length",
",",
"stackArguments",
")",
")",
";",
"return",
"this",
";",
"}"
] | adds a compressed frame to the stack
@param stackArguments the argument types on the stack, represented as
"class path names" e.g java/lang/RuntimeException | [
"adds",
"a",
"compressed",
"frame",
"to",
"the",
"stack"
] | train | https://github.com/qmx/jitescript/blob/bda6d02f37a8083248d9a0c80ea76bb5a63151ae/src/main/java/me/qmx/jitescript/CodeBlock.java#L1112-L1128 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.getAuthInfo | public BoxAuthenticationInfo getAuthInfo(String userId, Context context) {
"""
Get the BoxAuthenticationInfo for a given user.
@param userId the user id to get auth info for.
@param context current context used for accessing resource.
@return the BoxAuthenticationInfo for a given user.
"""
return userId == null ? null : getAuthInfoMap(context).get(userId);
} | java | public BoxAuthenticationInfo getAuthInfo(String userId, Context context) {
return userId == null ? null : getAuthInfoMap(context).get(userId);
} | [
"public",
"BoxAuthenticationInfo",
"getAuthInfo",
"(",
"String",
"userId",
",",
"Context",
"context",
")",
"{",
"return",
"userId",
"==",
"null",
"?",
"null",
":",
"getAuthInfoMap",
"(",
"context",
")",
".",
"get",
"(",
"userId",
")",
";",
"}"
] | Get the BoxAuthenticationInfo for a given user.
@param userId the user id to get auth info for.
@param context current context used for accessing resource.
@return the BoxAuthenticationInfo for a given user. | [
"Get",
"the",
"BoxAuthenticationInfo",
"for",
"a",
"given",
"user",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L83-L85 |
LearnLib/automatalib | visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java | DOT.runDOT | public static void runDOT(File dotFile, String format, File out) throws IOException {
"""
Invokes the DOT utility on a file, producing an output file. Convenience method, see {@link #runDOT(Reader,
String, File)}.
"""
runDOT(IOUtil.asBufferedUTF8Reader(dotFile), format, out);
} | java | public static void runDOT(File dotFile, String format, File out) throws IOException {
runDOT(IOUtil.asBufferedUTF8Reader(dotFile), format, out);
} | [
"public",
"static",
"void",
"runDOT",
"(",
"File",
"dotFile",
",",
"String",
"format",
",",
"File",
"out",
")",
"throws",
"IOException",
"{",
"runDOT",
"(",
"IOUtil",
".",
"asBufferedUTF8Reader",
"(",
"dotFile",
")",
",",
"format",
",",
"out",
")",
";",
"}"
] | Invokes the DOT utility on a file, producing an output file. Convenience method, see {@link #runDOT(Reader,
String, File)}. | [
"Invokes",
"the",
"DOT",
"utility",
"on",
"a",
"file",
"producing",
"an",
"output",
"file",
".",
"Convenience",
"method",
"see",
"{"
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java#L188-L190 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.listVolumes | public ListVolumesResponse listVolumes(ListVolumesRequest request) {
"""
Listing volumes owned by the authenticated user.
@param request The request containing all options for listing volumes owned by the authenticated user.
@return The response containing a list of volume owned by the authenticated user.
"""
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VOLUME_PREFIX);
if (request.getMarker() != null) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (!Strings.isNullOrEmpty(request.getInstanceId())) {
internalRequest.addParameter("instanceId", request.getInstanceId());
}
if (!Strings.isNullOrEmpty(request.getZoneName())) {
internalRequest.addParameter("zoneName", request.getZoneName());
}
return invokeHttpClient(internalRequest, ListVolumesResponse.class);
} | java | public ListVolumesResponse listVolumes(ListVolumesRequest request) {
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VOLUME_PREFIX);
if (request.getMarker() != null) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (!Strings.isNullOrEmpty(request.getInstanceId())) {
internalRequest.addParameter("instanceId", request.getInstanceId());
}
if (!Strings.isNullOrEmpty(request.getZoneName())) {
internalRequest.addParameter("zoneName", request.getZoneName());
}
return invokeHttpClient(internalRequest, ListVolumesResponse.class);
} | [
"public",
"ListVolumesResponse",
"listVolumes",
"(",
"ListVolumesRequest",
"request",
")",
"{",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(",
"request",
",",
"HttpMethodName",
".",
"GET",
",",
"VOLUME_PREFIX",
")",
";",
"if",
"(",
"request",
".",
"getMarker",
"(",
")",
"!=",
"null",
")",
"{",
"internalRequest",
".",
"addParameter",
"(",
"\"marker\"",
",",
"request",
".",
"getMarker",
"(",
")",
")",
";",
"}",
"if",
"(",
"request",
".",
"getMaxKeys",
"(",
")",
">",
"0",
")",
"{",
"internalRequest",
".",
"addParameter",
"(",
"\"maxKeys\"",
",",
"String",
".",
"valueOf",
"(",
"request",
".",
"getMaxKeys",
"(",
")",
")",
")",
";",
"}",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"getInstanceId",
"(",
")",
")",
")",
"{",
"internalRequest",
".",
"addParameter",
"(",
"\"instanceId\"",
",",
"request",
".",
"getInstanceId",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"getZoneName",
"(",
")",
")",
")",
"{",
"internalRequest",
".",
"addParameter",
"(",
"\"zoneName\"",
",",
"request",
".",
"getZoneName",
"(",
")",
")",
";",
"}",
"return",
"invokeHttpClient",
"(",
"internalRequest",
",",
"ListVolumesResponse",
".",
"class",
")",
";",
"}"
] | Listing volumes owned by the authenticated user.
@param request The request containing all options for listing volumes owned by the authenticated user.
@return The response containing a list of volume owned by the authenticated user. | [
"Listing",
"volumes",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L911-L926 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java | SibTr.bytes | public static void bytes (Object o, TraceComponent tc, byte[] data, int start) {
"""
If debug level tracing is enabled then trace a byte array using formatted
output with offsets. Duplicate output lines are suppressed to save space.
Tracing of the byte array starts at the specified position and continues
to the end of the byte array.
<p>
@param o handle of the object making the trace call
@param tc the non-null <code>TraceComponent</code> the event is associated
with.
@param data the byte array to be traced
@param start position to start tracing the byte array
"""
int length = 0;
if (data != null) length = data.length;
bytes(o, tc, data, start, length, "");
} | java | public static void bytes (Object o, TraceComponent tc, byte[] data, int start) {
int length = 0;
if (data != null) length = data.length;
bytes(o, tc, data, start, length, "");
} | [
"public",
"static",
"void",
"bytes",
"(",
"Object",
"o",
",",
"TraceComponent",
"tc",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
")",
"{",
"int",
"length",
"=",
"0",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"length",
"=",
"data",
".",
"length",
";",
"bytes",
"(",
"o",
",",
"tc",
",",
"data",
",",
"start",
",",
"length",
",",
"\"\"",
")",
";",
"}"
] | If debug level tracing is enabled then trace a byte array using formatted
output with offsets. Duplicate output lines are suppressed to save space.
Tracing of the byte array starts at the specified position and continues
to the end of the byte array.
<p>
@param o handle of the object making the trace call
@param tc the non-null <code>TraceComponent</code> the event is associated
with.
@param data the byte array to be traced
@param start position to start tracing the byte array | [
"If",
"debug",
"level",
"tracing",
"is",
"enabled",
"then",
"trace",
"a",
"byte",
"array",
"using",
"formatted",
"output",
"with",
"offsets",
".",
"Duplicate",
"output",
"lines",
"are",
"suppressed",
"to",
"save",
"space",
".",
"Tracing",
"of",
"the",
"byte",
"array",
"starts",
"at",
"the",
"specified",
"position",
"and",
"continues",
"to",
"the",
"end",
"of",
"the",
"byte",
"array",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java#L1210-L1214 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/nlp/AipNlp.java | AipNlp.ecnet | public JSONObject ecnet(String text, HashMap<String, Object> options) {
"""
文本纠错接口
识别输入文本中有错误的片段,提示错误并给出正确的文本结果。支持短文本、长文本、语音等内容的错误识别,纠错是搜索引擎、语音识别、内容审查等功能更好运行的基础模块之一。
@param text - 待纠错文本,输入限制511字节
@param options - 可选参数对象,key: value都为string类型
options - options列表:
@return JSONObject
"""
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("text", text);
if (options != null) {
request.addBody(options);
}
request.setUri(NlpConsts.ECNET);
request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} | java | public JSONObject ecnet(String text, HashMap<String, Object> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("text", text);
if (options != null) {
request.addBody(options);
}
request.setUri(NlpConsts.ECNET);
request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK);
request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"ecnet",
"(",
"String",
"text",
",",
"HashMap",
"<",
"String",
",",
"Object",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",
".",
"addBody",
"(",
"\"text\"",
",",
"text",
")",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"request",
".",
"addBody",
"(",
"options",
")",
";",
"}",
"request",
".",
"setUri",
"(",
"NlpConsts",
".",
"ECNET",
")",
";",
"request",
".",
"addHeader",
"(",
"Headers",
".",
"CONTENT_ENCODING",
",",
"HttpCharacterEncoding",
".",
"ENCODE_GBK",
")",
";",
"request",
".",
"addHeader",
"(",
"Headers",
".",
"CONTENT_TYPE",
",",
"HttpContentType",
".",
"JSON_DATA",
")",
";",
"request",
".",
"setBodyFormat",
"(",
"EBodyFormat",
".",
"RAW_JSON",
")",
";",
"postOperation",
"(",
"request",
")",
";",
"return",
"requestServer",
"(",
"request",
")",
";",
"}"
] | 文本纠错接口
识别输入文本中有错误的片段,提示错误并给出正确的文本结果。支持短文本、长文本、语音等内容的错误识别,纠错是搜索引擎、语音识别、内容审查等功能更好运行的基础模块之一。
@param text - 待纠错文本,输入限制511字节
@param options - 可选参数对象,key: value都为string类型
options - options列表:
@return JSONObject | [
"文本纠错接口",
"识别输入文本中有错误的片段,提示错误并给出正确的文本结果。支持短文本、长文本、语音等内容的错误识别,纠错是搜索引擎、语音识别、内容审查等功能更好运行的基础模块之一。"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/nlp/AipNlp.java#L344-L359 |
sporniket/core | sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java | FunctorFactory.instanciateFunctorWithParameterAsAnInstanceMethodWrapper | public static FunctorWithParameter instanciateFunctorWithParameterAsAnInstanceMethodWrapper(final Object instance,
String methodName) throws Exception {
"""
Create a functor with parameter, wrapping a call to another method.
@param instance
instance to call the method upon. Should not be null.
@param methodName
Name of the method, it must exist.
@return a Functor with parameter that call the specified method on the specified instance.
@throws Exception if there is a problem to deal with.
"""
if (null == instance)
{
throw new NullPointerException("Instance is null");
}
Method _method = instance.getClass().getMethod(methodName, (Class<?>[]) null);
return instanciateFunctorWithParameterAsAMethodWrapper(instance, _method);
} | java | public static FunctorWithParameter instanciateFunctorWithParameterAsAnInstanceMethodWrapper(final Object instance,
String methodName) throws Exception
{
if (null == instance)
{
throw new NullPointerException("Instance is null");
}
Method _method = instance.getClass().getMethod(methodName, (Class<?>[]) null);
return instanciateFunctorWithParameterAsAMethodWrapper(instance, _method);
} | [
"public",
"static",
"FunctorWithParameter",
"instanciateFunctorWithParameterAsAnInstanceMethodWrapper",
"(",
"final",
"Object",
"instance",
",",
"String",
"methodName",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"instance",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Instance is null\"",
")",
";",
"}",
"Method",
"_method",
"=",
"instance",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"methodName",
",",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
")",
"null",
")",
";",
"return",
"instanciateFunctorWithParameterAsAMethodWrapper",
"(",
"instance",
",",
"_method",
")",
";",
"}"
] | Create a functor with parameter, wrapping a call to another method.
@param instance
instance to call the method upon. Should not be null.
@param methodName
Name of the method, it must exist.
@return a Functor with parameter that call the specified method on the specified instance.
@throws Exception if there is a problem to deal with. | [
"Create",
"a",
"functor",
"with",
"parameter",
"wrapping",
"a",
"call",
"to",
"another",
"method",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java#L175-L184 |
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 ) {
"""
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.
"""
/**
* 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 JNI code until JNI code is\n * set to interoperate with network-order.\n */",
"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",
";",
"}"
] | 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",
"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",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L189-L203 |
librato/metrics-librato | src/main/java/com/librato/metrics/reporter/DeltaTracker.java | DeltaTracker.getDelta | public Long getDelta(String name, long count) {
"""
Calculates the delta. If this is a new value that has not been seen before, zero will be assumed to be the
initial value. Updates the internal map with the supplied count.
@param name the name of the counter
@param count the counter value
@return the delta
"""
Long previous = lookup.put(name, count);
return calculateDelta(name, previous, count);
} | java | public Long getDelta(String name, long count) {
Long previous = lookup.put(name, count);
return calculateDelta(name, previous, count);
} | [
"public",
"Long",
"getDelta",
"(",
"String",
"name",
",",
"long",
"count",
")",
"{",
"Long",
"previous",
"=",
"lookup",
".",
"put",
"(",
"name",
",",
"count",
")",
";",
"return",
"calculateDelta",
"(",
"name",
",",
"previous",
",",
"count",
")",
";",
"}"
] | Calculates the delta. If this is a new value that has not been seen before, zero will be assumed to be the
initial value. Updates the internal map with the supplied count.
@param name the name of the counter
@param count the counter value
@return the delta | [
"Calculates",
"the",
"delta",
".",
"If",
"this",
"is",
"a",
"new",
"value",
"that",
"has",
"not",
"been",
"seen",
"before",
"zero",
"will",
"be",
"assumed",
"to",
"be",
"the",
"initial",
"value",
".",
"Updates",
"the",
"internal",
"map",
"with",
"the",
"supplied",
"count",
"."
] | train | https://github.com/librato/metrics-librato/blob/10713643cf7d80e0f9741a7e1e81d1f6d68dc3f6/src/main/java/com/librato/metrics/reporter/DeltaTracker.java#L62-L65 |
guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java | ContextAwarePolicyAdapter.createKeyPolicy | public static ContextAwarePolicy createKeyPolicy(PublicationsHandler handler) {
"""
Creates context aware policy using {@link KeyBasedVerificationPolicy} for verification.
@param handler
Publications handler.
@return Key based verification policy with suitable context.
"""
Util.notNull(handler, "Publications handler");
return new ContextAwarePolicyAdapter(new KeyBasedVerificationPolicy(), new PolicyContext(handler, null));
} | java | public static ContextAwarePolicy createKeyPolicy(PublicationsHandler handler) {
Util.notNull(handler, "Publications handler");
return new ContextAwarePolicyAdapter(new KeyBasedVerificationPolicy(), new PolicyContext(handler, null));
} | [
"public",
"static",
"ContextAwarePolicy",
"createKeyPolicy",
"(",
"PublicationsHandler",
"handler",
")",
"{",
"Util",
".",
"notNull",
"(",
"handler",
",",
"\"Publications handler\"",
")",
";",
"return",
"new",
"ContextAwarePolicyAdapter",
"(",
"new",
"KeyBasedVerificationPolicy",
"(",
")",
",",
"new",
"PolicyContext",
"(",
"handler",
",",
"null",
")",
")",
";",
"}"
] | Creates context aware policy using {@link KeyBasedVerificationPolicy} for verification.
@param handler
Publications handler.
@return Key based verification policy with suitable context. | [
"Creates",
"context",
"aware",
"policy",
"using",
"{",
"@link",
"KeyBasedVerificationPolicy",
"}",
"for",
"verification",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L60-L63 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Project.java | Project.createIteration | public Iteration createIteration(Map<String, Object> attributes) {
"""
Create a new Iteration in the Project where the schedule is defined. Use
the suggested system values for the new iteration.
@param attributes additional attributes for the Iteration.
@return A new Iteration.
"""
return getInstance().create().iteration(this, attributes);
} | java | public Iteration createIteration(Map<String, Object> attributes) {
return getInstance().create().iteration(this, attributes);
} | [
"public",
"Iteration",
"createIteration",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"return",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"iteration",
"(",
"this",
",",
"attributes",
")",
";",
"}"
] | Create a new Iteration in the Project where the schedule is defined. Use
the suggested system values for the new iteration.
@param attributes additional attributes for the Iteration.
@return A new Iteration. | [
"Create",
"a",
"new",
"Iteration",
"in",
"the",
"Project",
"where",
"the",
"schedule",
"is",
"defined",
".",
"Use",
"the",
"suggested",
"system",
"values",
"for",
"the",
"new",
"iteration",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L356-L358 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java | WikipediaTemplateInfo.revisionContainsTemplateFragment | public boolean revisionContainsTemplateFragment(int revId, String templateFragment) throws WikiApiException {
"""
Determines whether a given revision contains a template starting witht the given fragment
@param revId
@param templateFragment
@return
@throws WikiApiException
"""
List<String> tplList = getTemplateNamesFromRevision(revId);
for(String tpl:tplList){
if(tpl.toLowerCase().startsWith(templateFragment.toLowerCase())){
return true;
}
}
return false;
} | java | public boolean revisionContainsTemplateFragment(int revId, String templateFragment) throws WikiApiException{
List<String> tplList = getTemplateNamesFromRevision(revId);
for(String tpl:tplList){
if(tpl.toLowerCase().startsWith(templateFragment.toLowerCase())){
return true;
}
}
return false;
} | [
"public",
"boolean",
"revisionContainsTemplateFragment",
"(",
"int",
"revId",
",",
"String",
"templateFragment",
")",
"throws",
"WikiApiException",
"{",
"List",
"<",
"String",
">",
"tplList",
"=",
"getTemplateNamesFromRevision",
"(",
"revId",
")",
";",
"for",
"(",
"String",
"tpl",
":",
"tplList",
")",
"{",
"if",
"(",
"tpl",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"templateFragment",
".",
"toLowerCase",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Determines whether a given revision contains a template starting witht the given fragment
@param revId
@param templateFragment
@return
@throws WikiApiException | [
"Determines",
"whether",
"a",
"given",
"revision",
"contains",
"a",
"template",
"starting",
"witht",
"the",
"given",
"fragment"
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L1285-L1293 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withSizeOfMaxObjectGraph | public CacheConfigurationBuilder<K, V> withSizeOfMaxObjectGraph(long size) {
"""
Adds or updates the {@link DefaultSizeOfEngineConfiguration} with the specified object graph maximum size to the configured
builder.
<p>
{@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}.
@param size the maximum graph size
@return a new builder with the added / updated configuration
"""
return mapServiceConfiguration(DefaultSizeOfEngineConfiguration.class, existing -> ofNullable(existing)
.map(e -> new DefaultSizeOfEngineConfiguration(e.getMaxObjectSize(), e.getUnit(), size))
.orElse(new DefaultSizeOfEngineConfiguration(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_UNIT, size)));
} | java | public CacheConfigurationBuilder<K, V> withSizeOfMaxObjectGraph(long size) {
return mapServiceConfiguration(DefaultSizeOfEngineConfiguration.class, existing -> ofNullable(existing)
.map(e -> new DefaultSizeOfEngineConfiguration(e.getMaxObjectSize(), e.getUnit(), size))
.orElse(new DefaultSizeOfEngineConfiguration(DEFAULT_MAX_OBJECT_SIZE, DEFAULT_UNIT, size)));
} | [
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withSizeOfMaxObjectGraph",
"(",
"long",
"size",
")",
"{",
"return",
"mapServiceConfiguration",
"(",
"DefaultSizeOfEngineConfiguration",
".",
"class",
",",
"existing",
"->",
"ofNullable",
"(",
"existing",
")",
".",
"map",
"(",
"e",
"->",
"new",
"DefaultSizeOfEngineConfiguration",
"(",
"e",
".",
"getMaxObjectSize",
"(",
")",
",",
"e",
".",
"getUnit",
"(",
")",
",",
"size",
")",
")",
".",
"orElse",
"(",
"new",
"DefaultSizeOfEngineConfiguration",
"(",
"DEFAULT_MAX_OBJECT_SIZE",
",",
"DEFAULT_UNIT",
",",
"size",
")",
")",
")",
";",
"}"
] | Adds or updates the {@link DefaultSizeOfEngineConfiguration} with the specified object graph maximum size to the configured
builder.
<p>
{@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}.
@param size the maximum graph size
@return a new builder with the added / updated configuration | [
"Adds",
"or",
"updates",
"the",
"{",
"@link",
"DefaultSizeOfEngineConfiguration",
"}",
"with",
"the",
"specified",
"object",
"graph",
"maximum",
"size",
"to",
"the",
"configured",
"builder",
".",
"<p",
">",
"{",
"@link",
"SizeOfEngine",
"}",
"is",
"what",
"enables",
"the",
"heap",
"tier",
"to",
"be",
"sized",
"in",
"{",
"@link",
"MemoryUnit",
"}",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L539-L543 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.chooseRandom | public Node chooseRandom(String scope) {
"""
randomly choose one node from <i>scope</i>
if scope starts with ~, choose one from the all nodes except for the
ones in <i>scope</i>; otherwise, choose one from <i>scope</i>
@param scope range of nodes from which a node will be choosen
@return the choosen node
"""
netlock.readLock().lock();
try {
if (scope.startsWith("~")) {
return chooseRandom(NodeBase.ROOT, scope.substring(1));
} else {
return chooseRandom(scope, null);
}
} finally {
netlock.readLock().unlock();
}
} | java | public Node chooseRandom(String scope) {
netlock.readLock().lock();
try {
if (scope.startsWith("~")) {
return chooseRandom(NodeBase.ROOT, scope.substring(1));
} else {
return chooseRandom(scope, null);
}
} finally {
netlock.readLock().unlock();
}
} | [
"public",
"Node",
"chooseRandom",
"(",
"String",
"scope",
")",
"{",
"netlock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"scope",
".",
"startsWith",
"(",
"\"~\"",
")",
")",
"{",
"return",
"chooseRandom",
"(",
"NodeBase",
".",
"ROOT",
",",
"scope",
".",
"substring",
"(",
"1",
")",
")",
";",
"}",
"else",
"{",
"return",
"chooseRandom",
"(",
"scope",
",",
"null",
")",
";",
"}",
"}",
"finally",
"{",
"netlock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | randomly choose one node from <i>scope</i>
if scope starts with ~, choose one from the all nodes except for the
ones in <i>scope</i>; otherwise, choose one from <i>scope</i>
@param scope range of nodes from which a node will be choosen
@return the choosen node | [
"randomly",
"choose",
"one",
"node",
"from",
"<i",
">",
"scope<",
"/",
"i",
">",
"if",
"scope",
"starts",
"with",
"~",
"choose",
"one",
"from",
"the",
"all",
"nodes",
"except",
"for",
"the",
"ones",
"in",
"<i",
">",
"scope<",
"/",
"i",
">",
";",
"otherwise",
"choose",
"one",
"from",
"<i",
">",
"scope<",
"/",
"i",
">"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L571-L582 |
stephanrauh/AngularFaces | AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/components/puiSpan/PuiSpanRenderer.java | PuiSpanRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
"""
private static final Logger LOGGER = Logger.getLogger("de.beyondjava.angularFaces.components.puiSpan.PuiSpanRenderer");
"""
ResponseWriter writer = context.getResponseWriter();
writer.startElement("span", component);
String keys = (String) component.getAttributes().get("attributeNames");
if (null != keys) {
String[] keyArray = keys.split(",");
for (String key:keyArray) {
writer.writeAttribute(key, AttributeUtilities.getAttributeAsString(component, key), key);
}
}
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement("span", component);
String keys = (String) component.getAttributes().get("attributeNames");
if (null != keys) {
String[] keyArray = keys.split(",");
for (String key:keyArray) {
writer.writeAttribute(key, AttributeUtilities.getAttributeAsString(component, key), key);
}
}
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"ResponseWriter",
"writer",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
";",
"writer",
".",
"startElement",
"(",
"\"span\"",
",",
"component",
")",
";",
"String",
"keys",
"=",
"(",
"String",
")",
"component",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"\"attributeNames\"",
")",
";",
"if",
"(",
"null",
"!=",
"keys",
")",
"{",
"String",
"[",
"]",
"keyArray",
"=",
"keys",
".",
"split",
"(",
"\",\"",
")",
";",
"for",
"(",
"String",
"key",
":",
"keyArray",
")",
"{",
"writer",
".",
"writeAttribute",
"(",
"key",
",",
"AttributeUtilities",
".",
"getAttributeAsString",
"(",
"component",
",",
"key",
")",
",",
"key",
")",
";",
"}",
"}",
"}"
] | private static final Logger LOGGER = Logger.getLogger("de.beyondjava.angularFaces.components.puiSpan.PuiSpanRenderer"); | [
"private",
"static",
"final",
"Logger",
"LOGGER",
"=",
"Logger",
".",
"getLogger",
"(",
"de",
".",
"beyondjava",
".",
"angularFaces",
".",
"components",
".",
"puiSpan",
".",
"PuiSpanRenderer",
")",
";"
] | train | https://github.com/stephanrauh/AngularFaces/blob/43d915f004645b1bbbf2625214294dab0858ba01/AngularFaces_2.0/AngularFaces-core/src/main/java/de/beyondjava/angularFaces/components/puiSpan/PuiSpanRenderer.java#L35-L46 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ClassUtils.java | ClassUtils.locateClass | public static URL locateClass(String binaryName, ClassLoader classLoader) {
"""
Locates the class file resource given the binary name of the {@link Class}. The {@link ClassLoader} used
to search class file resource for the {@link Class} with the given binary name.
@param binaryName a String with the binary name of the {@link Class} that's class file resource will be located.
@param classLoader the {@link ClassLoader} used to locate the class file resource for the {@link Class}
with the given binary name.
@return a {@link URL} with the location of the class file resource containing the {@link Class} definition
for the given binary name.
@see java.net.URL
"""
try {
Class<?> type = loadClass(binaryName, false, classLoader);
return type.getClassLoader().getResource(getResourceName(type));
}
catch (TypeNotFoundException ignore) {
return null;
}
} | java | public static URL locateClass(String binaryName, ClassLoader classLoader) {
try {
Class<?> type = loadClass(binaryName, false, classLoader);
return type.getClassLoader().getResource(getResourceName(type));
}
catch (TypeNotFoundException ignore) {
return null;
}
} | [
"public",
"static",
"URL",
"locateClass",
"(",
"String",
"binaryName",
",",
"ClassLoader",
"classLoader",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"loadClass",
"(",
"binaryName",
",",
"false",
",",
"classLoader",
")",
";",
"return",
"type",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"getResourceName",
"(",
"type",
")",
")",
";",
"}",
"catch",
"(",
"TypeNotFoundException",
"ignore",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Locates the class file resource given the binary name of the {@link Class}. The {@link ClassLoader} used
to search class file resource for the {@link Class} with the given binary name.
@param binaryName a String with the binary name of the {@link Class} that's class file resource will be located.
@param classLoader the {@link ClassLoader} used to locate the class file resource for the {@link Class}
with the given binary name.
@return a {@link URL} with the location of the class file resource containing the {@link Class} definition
for the given binary name.
@see java.net.URL | [
"Locates",
"the",
"class",
"file",
"resource",
"given",
"the",
"binary",
"name",
"of",
"the",
"{",
"@link",
"Class",
"}",
".",
"The",
"{",
"@link",
"ClassLoader",
"}",
"used",
"to",
"search",
"class",
"file",
"resource",
"for",
"the",
"{",
"@link",
"Class",
"}",
"with",
"the",
"given",
"binary",
"name",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L792-L803 |
carewebframework/carewebframework-vista | org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameter.java | RPCParameter.put | public void put(Object[] subscript, Object value) {
"""
Adds a vector value at the specified subscript.
@param subscript Array of subscript values.
@param value Value.
"""
put(BrokerUtil.buildSubscript(subscript), value);
} | java | public void put(Object[] subscript, Object value) {
put(BrokerUtil.buildSubscript(subscript), value);
} | [
"public",
"void",
"put",
"(",
"Object",
"[",
"]",
"subscript",
",",
"Object",
"value",
")",
"{",
"put",
"(",
"BrokerUtil",
".",
"buildSubscript",
"(",
"subscript",
")",
",",
"value",
")",
";",
"}"
] | Adds a vector value at the specified subscript.
@param subscript Array of subscript values.
@param value Value. | [
"Adds",
"a",
"vector",
"value",
"at",
"the",
"specified",
"subscript",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameter.java#L186-L188 |
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 {
"""
将流的内容写入文件<br>
@param dest 目标文件
@param in 输入流
@return dest
@throws IORuntimeException IO异常
"""
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 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java | Dj2JrCrosstabBuilder.registerColumns | private void registerColumns() {
"""
Registers the Columngroup Buckets and creates the header cell for the columns
"""
for (int i = 0; i < cols.length; i++) {
DJCrosstabColumn crosstabColumn = cols[i];
JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup();
ctColGroup.setName(crosstabColumn.getProperty().getProperty());
ctColGroup.setHeight(crosstabColumn.getHeaderHeight());
JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket();
bucket.setValueClassName(crosstabColumn.getProperty().getValueClassName());
JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabColumn.getProperty().getProperty()+"}", crosstabColumn.getProperty().getValueClassName());
bucket.setExpression(bucketExp);
ctColGroup.setBucket(bucket);
JRDesignCellContents colHeaerContent = new JRDesignCellContents();
JRDesignTextField colTitle = new JRDesignTextField();
JRDesignExpression colTitleExp = new JRDesignExpression();
colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName());
colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}");
colTitle.setExpression(colTitleExp);
colTitle.setWidth(crosstabColumn.getWidth());
colTitle.setHeight(crosstabColumn.getHeaderHeight());
//The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one.
int auxWidth = calculateRowHeaderMaxWidth(crosstabColumn);
colTitle.setWidth(auxWidth);
Style headerstyle = crosstabColumn.getHeaderStyle() == null ? this.djcross.getColumnHeaderStyle(): crosstabColumn.getHeaderStyle();
if (headerstyle != null){
layoutManager.applyStyleToElement(headerstyle,colTitle);
colHeaerContent.setBackcolor(headerstyle.getBackgroundColor());
}
colHeaerContent.addElement(colTitle);
colHeaerContent.setMode( ModeEnum.OPAQUE );
boolean fullBorder = i <= 0; //Only outer most will have full border
applyCellBorder(colHeaerContent, fullBorder, false);
ctColGroup.setHeader(colHeaerContent);
if (crosstabColumn.isShowTotals())
createColumTotalHeader(ctColGroup,crosstabColumn,fullBorder);
try {
jrcross.addColumnGroup(ctColGroup);
} catch (JRException e) {
log.error(e.getMessage(),e);
}
}
} | java | private void registerColumns() {
for (int i = 0; i < cols.length; i++) {
DJCrosstabColumn crosstabColumn = cols[i];
JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup();
ctColGroup.setName(crosstabColumn.getProperty().getProperty());
ctColGroup.setHeight(crosstabColumn.getHeaderHeight());
JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket();
bucket.setValueClassName(crosstabColumn.getProperty().getValueClassName());
JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabColumn.getProperty().getProperty()+"}", crosstabColumn.getProperty().getValueClassName());
bucket.setExpression(bucketExp);
ctColGroup.setBucket(bucket);
JRDesignCellContents colHeaerContent = new JRDesignCellContents();
JRDesignTextField colTitle = new JRDesignTextField();
JRDesignExpression colTitleExp = new JRDesignExpression();
colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName());
colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}");
colTitle.setExpression(colTitleExp);
colTitle.setWidth(crosstabColumn.getWidth());
colTitle.setHeight(crosstabColumn.getHeaderHeight());
//The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one.
int auxWidth = calculateRowHeaderMaxWidth(crosstabColumn);
colTitle.setWidth(auxWidth);
Style headerstyle = crosstabColumn.getHeaderStyle() == null ? this.djcross.getColumnHeaderStyle(): crosstabColumn.getHeaderStyle();
if (headerstyle != null){
layoutManager.applyStyleToElement(headerstyle,colTitle);
colHeaerContent.setBackcolor(headerstyle.getBackgroundColor());
}
colHeaerContent.addElement(colTitle);
colHeaerContent.setMode( ModeEnum.OPAQUE );
boolean fullBorder = i <= 0; //Only outer most will have full border
applyCellBorder(colHeaerContent, fullBorder, false);
ctColGroup.setHeader(colHeaerContent);
if (crosstabColumn.isShowTotals())
createColumTotalHeader(ctColGroup,crosstabColumn,fullBorder);
try {
jrcross.addColumnGroup(ctColGroup);
} catch (JRException e) {
log.error(e.getMessage(),e);
}
}
} | [
"private",
"void",
"registerColumns",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cols",
".",
"length",
";",
"i",
"++",
")",
"{",
"DJCrosstabColumn",
"crosstabColumn",
"=",
"cols",
"[",
"i",
"]",
";",
"JRDesignCrosstabColumnGroup",
"ctColGroup",
"=",
"new",
"JRDesignCrosstabColumnGroup",
"(",
")",
";",
"ctColGroup",
".",
"setName",
"(",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
")",
";",
"ctColGroup",
".",
"setHeight",
"(",
"crosstabColumn",
".",
"getHeaderHeight",
"(",
")",
")",
";",
"JRDesignCrosstabBucket",
"bucket",
"=",
"new",
"JRDesignCrosstabBucket",
"(",
")",
";",
"bucket",
".",
"setValueClassName",
"(",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"JRDesignExpression",
"bucketExp",
"=",
"ExpressionUtils",
".",
"createExpression",
"(",
"\"$F{\"",
"+",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"}\"",
",",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"bucket",
".",
"setExpression",
"(",
"bucketExp",
")",
";",
"ctColGroup",
".",
"setBucket",
"(",
"bucket",
")",
";",
"JRDesignCellContents",
"colHeaerContent",
"=",
"new",
"JRDesignCellContents",
"(",
")",
";",
"JRDesignTextField",
"colTitle",
"=",
"new",
"JRDesignTextField",
"(",
")",
";",
"JRDesignExpression",
"colTitleExp",
"=",
"new",
"JRDesignExpression",
"(",
")",
";",
"colTitleExp",
".",
"setValueClassName",
"(",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getValueClassName",
"(",
")",
")",
";",
"colTitleExp",
".",
"setText",
"(",
"\"$V{\"",
"+",
"crosstabColumn",
".",
"getProperty",
"(",
")",
".",
"getProperty",
"(",
")",
"+",
"\"}\"",
")",
";",
"colTitle",
".",
"setExpression",
"(",
"colTitleExp",
")",
";",
"colTitle",
".",
"setWidth",
"(",
"crosstabColumn",
".",
"getWidth",
"(",
")",
")",
";",
"colTitle",
".",
"setHeight",
"(",
"crosstabColumn",
".",
"getHeaderHeight",
"(",
")",
")",
";",
"//The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one.",
"int",
"auxWidth",
"=",
"calculateRowHeaderMaxWidth",
"(",
"crosstabColumn",
")",
";",
"colTitle",
".",
"setWidth",
"(",
"auxWidth",
")",
";",
"Style",
"headerstyle",
"=",
"crosstabColumn",
".",
"getHeaderStyle",
"(",
")",
"==",
"null",
"?",
"this",
".",
"djcross",
".",
"getColumnHeaderStyle",
"(",
")",
":",
"crosstabColumn",
".",
"getHeaderStyle",
"(",
")",
";",
"if",
"(",
"headerstyle",
"!=",
"null",
")",
"{",
"layoutManager",
".",
"applyStyleToElement",
"(",
"headerstyle",
",",
"colTitle",
")",
";",
"colHeaerContent",
".",
"setBackcolor",
"(",
"headerstyle",
".",
"getBackgroundColor",
"(",
")",
")",
";",
"}",
"colHeaerContent",
".",
"addElement",
"(",
"colTitle",
")",
";",
"colHeaerContent",
".",
"setMode",
"(",
"ModeEnum",
".",
"OPAQUE",
")",
";",
"boolean",
"fullBorder",
"=",
"i",
"<=",
"0",
";",
"//Only outer most will have full border",
"applyCellBorder",
"(",
"colHeaerContent",
",",
"fullBorder",
",",
"false",
")",
";",
"ctColGroup",
".",
"setHeader",
"(",
"colHeaerContent",
")",
";",
"if",
"(",
"crosstabColumn",
".",
"isShowTotals",
"(",
")",
")",
"createColumTotalHeader",
"(",
"ctColGroup",
",",
"crosstabColumn",
",",
"fullBorder",
")",
";",
"try",
"{",
"jrcross",
".",
"addColumnGroup",
"(",
"ctColGroup",
")",
";",
"}",
"catch",
"(",
"JRException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Registers the Columngroup Buckets and creates the header cell for the columns | [
"Registers",
"the",
"Columngroup",
"Buckets",
"and",
"creates",
"the",
"header",
"cell",
"for",
"the",
"columns"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java#L864-L923 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.mailingList_subscribe_POST | public void mailingList_subscribe_POST(String email, String mailingList) throws IOException {
"""
Subscribe an email to a restricted mailing list
REST: POST /me/mailingList/subscribe
@param email [required] Email you want to subscribe to
@param mailingList [required] Mailing list
"""
String qPath = "/me/mailingList/subscribe";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "email", email);
addBody(o, "mailingList", mailingList);
exec(qPath, "POST", sb.toString(), o);
} | java | public void mailingList_subscribe_POST(String email, String mailingList) throws IOException {
String qPath = "/me/mailingList/subscribe";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "email", email);
addBody(o, "mailingList", mailingList);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"mailingList_subscribe_POST",
"(",
"String",
"email",
",",
"String",
"mailingList",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/mailingList/subscribe\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"email\"",
",",
"email",
")",
";",
"addBody",
"(",
"o",
",",
"\"mailingList\"",
",",
"mailingList",
")",
";",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"}"
] | Subscribe an email to a restricted mailing list
REST: POST /me/mailingList/subscribe
@param email [required] Email you want to subscribe to
@param mailingList [required] Mailing list | [
"Subscribe",
"an",
"email",
"to",
"a",
"restricted",
"mailing",
"list"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L142-L149 |
icode/ameba-utils | src/main/java/ameba/util/MimeType.java | MimeType.getByFilename | public static String getByFilename(String fileName, String defaultType) {
"""
<p>getByFilename.</p>
@param fileName the filename
@param defaultType default Type
@return the content type associated with <code>extension</code> of the
given filename or if no associate is found, returns
<code>defaultType</code>
"""
String extn = getExtension(fileName);
if (extn != null) {
return get(extn, defaultType);
} else {
// no extension, no content type
return null;
}
} | java | public static String getByFilename(String fileName, String defaultType) {
String extn = getExtension(fileName);
if (extn != null) {
return get(extn, defaultType);
} else {
// no extension, no content type
return null;
}
} | [
"public",
"static",
"String",
"getByFilename",
"(",
"String",
"fileName",
",",
"String",
"defaultType",
")",
"{",
"String",
"extn",
"=",
"getExtension",
"(",
"fileName",
")",
";",
"if",
"(",
"extn",
"!=",
"null",
")",
"{",
"return",
"get",
"(",
"extn",
",",
"defaultType",
")",
";",
"}",
"else",
"{",
"// no extension, no content type",
"return",
"null",
";",
"}",
"}"
] | <p>getByFilename.</p>
@param fileName the filename
@param defaultType default Type
@return the content type associated with <code>extension</code> of the
given filename or if no associate is found, returns
<code>defaultType</code> | [
"<p",
">",
"getByFilename",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/MimeType.java#L91-L99 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.getInheritedProperty | public String getInheritedProperty(CmsClientSitemapEntry entry, String name) {
"""
Gets the value for a property which a sitemap entry would inherit if it didn't have its own properties.<p>
@param entry the sitemap entry
@param name the property name
@return the inherited property value
"""
CmsClientProperty prop = getInheritedPropertyObject(entry, name);
if (prop == null) {
return null;
}
return prop.getEffectiveValue();
} | java | public String getInheritedProperty(CmsClientSitemapEntry entry, String name) {
CmsClientProperty prop = getInheritedPropertyObject(entry, name);
if (prop == null) {
return null;
}
return prop.getEffectiveValue();
} | [
"public",
"String",
"getInheritedProperty",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"String",
"name",
")",
"{",
"CmsClientProperty",
"prop",
"=",
"getInheritedPropertyObject",
"(",
"entry",
",",
"name",
")",
";",
"if",
"(",
"prop",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"prop",
".",
"getEffectiveValue",
"(",
")",
";",
"}"
] | Gets the value for a property which a sitemap entry would inherit if it didn't have its own properties.<p>
@param entry the sitemap entry
@param name the property name
@return the inherited property value | [
"Gets",
"the",
"value",
"for",
"a",
"property",
"which",
"a",
"sitemap",
"entry",
"would",
"inherit",
"if",
"it",
"didn",
"t",
"have",
"its",
"own",
"properties",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1176-L1183 |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/util/xml/QNameUtilities.java | QNameUtilities.getClassName | public static String getClassName(QName qname) {
"""
Returns the className for a given qname e.g.,
{http://www.w3.org/2001/XMLSchema}decimal →
org.w3.2001.XMLSchema.decimal
@param qname
qualified name
@return className or null if converting is not possible
"""
try {
StringBuilder className = new StringBuilder();
// e.g., {http://www.w3.org/2001/XMLSchema}decimal
StringTokenizer st1 = new StringTokenizer(qname.getNamespaceURI(),
"/");
// --> "http:" -> "www.w3.org" --> "2001" -> "XMLSchema"
st1.nextToken(); // protocol, e.g. "http:"
String domain = st1.nextToken(); // "www.w3.org"
StringTokenizer st2 = new StringTokenizer(domain, ".");
List<String> lDomain = new ArrayList<String>();
while (st2.hasMoreTokens()) {
lDomain.add(st2.nextToken());
}
assert (lDomain.size() >= 2);
className.append(lDomain.get(lDomain.size() - 1)); // "org"
className.append('.');
className.append(lDomain.get(lDomain.size() - 2)); // "w3"
while (st1.hasMoreTokens()) {
className.append('.');
className.append(st1.nextToken());
}
className.append('.');
className.append(qname.getLocalPart());
return className.toString();
} catch (Exception e) {
return null;
}
} | java | public static String getClassName(QName qname) {
try {
StringBuilder className = new StringBuilder();
// e.g., {http://www.w3.org/2001/XMLSchema}decimal
StringTokenizer st1 = new StringTokenizer(qname.getNamespaceURI(),
"/");
// --> "http:" -> "www.w3.org" --> "2001" -> "XMLSchema"
st1.nextToken(); // protocol, e.g. "http:"
String domain = st1.nextToken(); // "www.w3.org"
StringTokenizer st2 = new StringTokenizer(domain, ".");
List<String> lDomain = new ArrayList<String>();
while (st2.hasMoreTokens()) {
lDomain.add(st2.nextToken());
}
assert (lDomain.size() >= 2);
className.append(lDomain.get(lDomain.size() - 1)); // "org"
className.append('.');
className.append(lDomain.get(lDomain.size() - 2)); // "w3"
while (st1.hasMoreTokens()) {
className.append('.');
className.append(st1.nextToken());
}
className.append('.');
className.append(qname.getLocalPart());
return className.toString();
} catch (Exception e) {
return null;
}
} | [
"public",
"static",
"String",
"getClassName",
"(",
"QName",
"qname",
")",
"{",
"try",
"{",
"StringBuilder",
"className",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// e.g., {http://www.w3.org/2001/XMLSchema}decimal",
"StringTokenizer",
"st1",
"=",
"new",
"StringTokenizer",
"(",
"qname",
".",
"getNamespaceURI",
"(",
")",
",",
"\"/\"",
")",
";",
"// --> \"http:\" -> \"www.w3.org\" --> \"2001\" -> \"XMLSchema\"",
"st1",
".",
"nextToken",
"(",
")",
";",
"// protocol, e.g. \"http:\"",
"String",
"domain",
"=",
"st1",
".",
"nextToken",
"(",
")",
";",
"// \"www.w3.org\"",
"StringTokenizer",
"st2",
"=",
"new",
"StringTokenizer",
"(",
"domain",
",",
"\".\"",
")",
";",
"List",
"<",
"String",
">",
"lDomain",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"while",
"(",
"st2",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"lDomain",
".",
"add",
"(",
"st2",
".",
"nextToken",
"(",
")",
")",
";",
"}",
"assert",
"(",
"lDomain",
".",
"size",
"(",
")",
">=",
"2",
")",
";",
"className",
".",
"append",
"(",
"lDomain",
".",
"get",
"(",
"lDomain",
".",
"size",
"(",
")",
"-",
"1",
")",
")",
";",
"// \"org\"",
"className",
".",
"append",
"(",
"'",
"'",
")",
";",
"className",
".",
"append",
"(",
"lDomain",
".",
"get",
"(",
"lDomain",
".",
"size",
"(",
")",
"-",
"2",
")",
")",
";",
"// \"w3\"",
"while",
"(",
"st1",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"className",
".",
"append",
"(",
"'",
"'",
")",
";",
"className",
".",
"append",
"(",
"st1",
".",
"nextToken",
"(",
")",
")",
";",
"}",
"className",
".",
"append",
"(",
"'",
"'",
")",
";",
"className",
".",
"append",
"(",
"qname",
".",
"getLocalPart",
"(",
")",
")",
";",
"return",
"className",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Returns the className for a given qname e.g.,
{http://www.w3.org/2001/XMLSchema}decimal →
org.w3.2001.XMLSchema.decimal
@param qname
qualified name
@return className or null if converting is not possible | [
"Returns",
"the",
"className",
"for",
"a",
"given",
"qname",
"e",
".",
"g",
".",
"{",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"2001",
"/",
"XMLSchema",
"}",
"decimal",
"&rarr",
";",
"org",
".",
"w3",
".",
"2001",
".",
"XMLSchema",
".",
"decimal"
] | train | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/util/xml/QNameUtilities.java#L100-L133 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java | SheetResourcesImpl.createSheetInWorkspace | public Sheet createSheetInWorkspace(long workspaceId, Sheet sheet) throws SmartsheetException {
"""
Create a sheet in given workspace.
It mirrors to the following Smartsheet REST API method: POST /workspace/{workspaceId}/sheets
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param workspaceId the workspace id
@param sheet the sheet to create, limited to the following required attributes: * name (string) * columns
(array of Column objects, limited to the following attributes) - title - primary - type - symbol - options
@return the created sheet
@throws SmartsheetException the smartsheet exception
"""
return this.createResource("workspaces/" + workspaceId + "/sheets", Sheet.class, sheet);
} | java | public Sheet createSheetInWorkspace(long workspaceId, Sheet sheet) throws SmartsheetException {
return this.createResource("workspaces/" + workspaceId + "/sheets", Sheet.class, sheet);
} | [
"public",
"Sheet",
"createSheetInWorkspace",
"(",
"long",
"workspaceId",
",",
"Sheet",
"sheet",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"createResource",
"(",
"\"workspaces/\"",
"+",
"workspaceId",
"+",
"\"/sheets\"",
",",
"Sheet",
".",
"class",
",",
"sheet",
")",
";",
"}"
] | Create a sheet in given workspace.
It mirrors to the following Smartsheet REST API method: POST /workspace/{workspaceId}/sheets
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param workspaceId the workspace id
@param sheet the sheet to create, limited to the following required attributes: * name (string) * columns
(array of Column objects, limited to the following attributes) - title - primary - type - symbol - options
@return the created sheet
@throws SmartsheetException the smartsheet exception | [
"Create",
"a",
"sheet",
"in",
"given",
"workspace",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L581-L583 |
Hygieia/Hygieia | collectors/scm/github/src/main/java/com/capitalone/dashboard/collector/DefaultGitHubClient.java | DefaultGitHubClient.getRunDate | private Date getRunDate(GitHubRepo repo, boolean firstRun) {
"""
Get run date based off of firstRun boolean
@param repo
@param firstRun
@return
"""
if (firstRun) {
int firstRunDaysHistory = settings.getFirstRunHistoryDays();
if (firstRunDaysHistory > 0) {
return getDate(new Date(), -firstRunDaysHistory, 0);
} else {
return getDate(new Date(), -FIRST_RUN_HISTORY_DEFAULT, 0);
}
} else {
return getDate(new Date(repo.getLastUpdated()), 0, -10);
}
} | java | private Date getRunDate(GitHubRepo repo, boolean firstRun) {
if (firstRun) {
int firstRunDaysHistory = settings.getFirstRunHistoryDays();
if (firstRunDaysHistory > 0) {
return getDate(new Date(), -firstRunDaysHistory, 0);
} else {
return getDate(new Date(), -FIRST_RUN_HISTORY_DEFAULT, 0);
}
} else {
return getDate(new Date(repo.getLastUpdated()), 0, -10);
}
} | [
"private",
"Date",
"getRunDate",
"(",
"GitHubRepo",
"repo",
",",
"boolean",
"firstRun",
")",
"{",
"if",
"(",
"firstRun",
")",
"{",
"int",
"firstRunDaysHistory",
"=",
"settings",
".",
"getFirstRunHistoryDays",
"(",
")",
";",
"if",
"(",
"firstRunDaysHistory",
">",
"0",
")",
"{",
"return",
"getDate",
"(",
"new",
"Date",
"(",
")",
",",
"-",
"firstRunDaysHistory",
",",
"0",
")",
";",
"}",
"else",
"{",
"return",
"getDate",
"(",
"new",
"Date",
"(",
")",
",",
"-",
"FIRST_RUN_HISTORY_DEFAULT",
",",
"0",
")",
";",
"}",
"}",
"else",
"{",
"return",
"getDate",
"(",
"new",
"Date",
"(",
"repo",
".",
"getLastUpdated",
"(",
")",
")",
",",
"0",
",",
"-",
"10",
")",
";",
"}",
"}"
] | Get run date based off of firstRun boolean
@param repo
@param firstRun
@return | [
"Get",
"run",
"date",
"based",
"off",
"of",
"firstRun",
"boolean"
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/scm/github/src/main/java/com/capitalone/dashboard/collector/DefaultGitHubClient.java#L661-L672 |
sporniket/core | sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java | ComponentFactory.createPanelWithHorizontalLayout | public static JPanel createPanelWithHorizontalLayout() {
"""
Create a panel that lays out components horizontally.
@return a panel with an horizontal box layout.
@since 15.02.00
"""
JPanel _panel = new JPanel();
_panel.setLayout(new BoxLayout(_panel, BoxLayout.X_AXIS));
return _panel;
} | java | public static JPanel createPanelWithHorizontalLayout()
{
JPanel _panel = new JPanel();
_panel.setLayout(new BoxLayout(_panel, BoxLayout.X_AXIS));
return _panel;
} | [
"public",
"static",
"JPanel",
"createPanelWithHorizontalLayout",
"(",
")",
"{",
"JPanel",
"_panel",
"=",
"new",
"JPanel",
"(",
")",
";",
"_panel",
".",
"setLayout",
"(",
"new",
"BoxLayout",
"(",
"_panel",
",",
"BoxLayout",
".",
"X_AXIS",
")",
")",
";",
"return",
"_panel",
";",
"}"
] | Create a panel that lays out components horizontally.
@return a panel with an horizontal box layout.
@since 15.02.00 | [
"Create",
"a",
"panel",
"that",
"lays",
"out",
"components",
"horizontally",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ui/src/main/java/com/sporniket/libre/ui/swing/ComponentFactory.java#L74-L79 |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.sendMessageSynchronous | public <T extends Message> T sendMessageSynchronous(Class<T> responseType, TransmittableMessage message) {
"""
Send a Message over the serial port and block/wait for the message response.
In cases where you do not need ASync behavior, or just want to send a single message and
handle a single response, where the async design may be a bit too verbose, use this instead.
By sending a message and dictacting the type of response, you will get the response message as the return
value, or null if the message was not received within the timeout blocking period.
@param message TransmittableMessage to be sent over the serial port
@param <T> Message type that you are expecting as a reply to the message being transmitted.
@return T message object if the project board sends a reply. null if no reply was sent in time.
"""
T responseMessage = null;
SynchronousMessageListener<T> messageListener = new SynchronousMessageListener<>(responseType);
addMessageListener(messageListener);
if (sendMessage(message)) {
if (messageListener.waitForResponse()) {
responseMessage = messageListener.getResponseMessage();
}
}
removeMessageListener(messageListener);
return responseMessage;
} | java | public <T extends Message> T sendMessageSynchronous(Class<T> responseType, TransmittableMessage message) {
T responseMessage = null;
SynchronousMessageListener<T> messageListener = new SynchronousMessageListener<>(responseType);
addMessageListener(messageListener);
if (sendMessage(message)) {
if (messageListener.waitForResponse()) {
responseMessage = messageListener.getResponseMessage();
}
}
removeMessageListener(messageListener);
return responseMessage;
} | [
"public",
"<",
"T",
"extends",
"Message",
">",
"T",
"sendMessageSynchronous",
"(",
"Class",
"<",
"T",
">",
"responseType",
",",
"TransmittableMessage",
"message",
")",
"{",
"T",
"responseMessage",
"=",
"null",
";",
"SynchronousMessageListener",
"<",
"T",
">",
"messageListener",
"=",
"new",
"SynchronousMessageListener",
"<>",
"(",
"responseType",
")",
";",
"addMessageListener",
"(",
"messageListener",
")",
";",
"if",
"(",
"sendMessage",
"(",
"message",
")",
")",
"{",
"if",
"(",
"messageListener",
".",
"waitForResponse",
"(",
")",
")",
"{",
"responseMessage",
"=",
"messageListener",
".",
"getResponseMessage",
"(",
")",
";",
"}",
"}",
"removeMessageListener",
"(",
"messageListener",
")",
";",
"return",
"responseMessage",
";",
"}"
] | Send a Message over the serial port and block/wait for the message response.
In cases where you do not need ASync behavior, or just want to send a single message and
handle a single response, where the async design may be a bit too verbose, use this instead.
By sending a message and dictacting the type of response, you will get the response message as the return
value, or null if the message was not received within the timeout blocking period.
@param message TransmittableMessage to be sent over the serial port
@param <T> Message type that you are expecting as a reply to the message being transmitted.
@return T message object if the project board sends a reply. null if no reply was sent in time. | [
"Send",
"a",
"Message",
"over",
"the",
"serial",
"port",
"and",
"block",
"/",
"wait",
"for",
"the",
"message",
"response",
".",
"In",
"cases",
"where",
"you",
"do",
"not",
"need",
"ASync",
"behavior",
"or",
"just",
"want",
"to",
"send",
"a",
"single",
"message",
"and",
"handle",
"a",
"single",
"response",
"where",
"the",
"async",
"design",
"may",
"be",
"a",
"bit",
"too",
"verbose",
"use",
"this",
"instead",
".",
"By",
"sending",
"a",
"message",
"and",
"dictacting",
"the",
"type",
"of",
"response",
"you",
"will",
"get",
"the",
"response",
"message",
"as",
"the",
"return",
"value",
"or",
"null",
"if",
"the",
"message",
"was",
"not",
"received",
"within",
"the",
"timeout",
"blocking",
"period",
"."
] | train | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L346-L361 |
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 {
"""
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.
"""
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",
"(",
")",
"{",
"return",
"inputStream",
";",
"}",
"}",
".",
"asCharSource",
"(",
"charset",
")",
".",
"read",
"(",
")",
";",
"}"
] | 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 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/merge/VariantMerger.java | VariantMerger.mergeNew | public Variant mergeNew(Variant template, Collection<Variant> load) {
"""
Create and returns a new Variant using the target as a
position template ONLY and merges the provided variants
for this position. <b> The target is not present in the
merged output!!!</b>
@param template Template for position and study only
@param load Variants to merge for position
@return Variant new Variant object with merged information
"""
Variant current = createFromTemplate(template);
merge(current, load);
return current;
} | java | public Variant mergeNew(Variant template, Collection<Variant> load) {
Variant current = createFromTemplate(template);
merge(current, load);
return current;
} | [
"public",
"Variant",
"mergeNew",
"(",
"Variant",
"template",
",",
"Collection",
"<",
"Variant",
">",
"load",
")",
"{",
"Variant",
"current",
"=",
"createFromTemplate",
"(",
"template",
")",
";",
"merge",
"(",
"current",
",",
"load",
")",
";",
"return",
"current",
";",
"}"
] | Create and returns a new Variant using the target as a
position template ONLY and merges the provided variants
for this position. <b> The target is not present in the
merged output!!!</b>
@param template Template for position and study only
@param load Variants to merge for position
@return Variant new Variant object with merged information | [
"Create",
"and",
"returns",
"a",
"new",
"Variant",
"using",
"the",
"target",
"as",
"a",
"position",
"template",
"ONLY",
"and",
"merges",
"the",
"provided",
"variants",
"for",
"this",
"position",
".",
"<b",
">",
"The",
"target",
"is",
"not",
"present",
"in",
"the",
"merged",
"output!!!<",
"/",
"b",
">"
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/merge/VariantMerger.java#L253-L257 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java | FactoryFiducialCalibration.squareGrid | public static CalibrationDetectorSquareGrid squareGrid(@Nullable ConfigSquareGrid config, ConfigGridDimen configDimen) {
"""
Detector for a grid of square targets. All squares must be entirely visible inside the image.
@see boofcv.alg.fiducial.calib.grid.DetectSquareGridFiducial
@param config Configuration for chessboard detector
@return Square grid target detector.
"""
if( config == null )
config = new ConfigSquareGrid();
config.checkValidity();
return new CalibrationDetectorSquareGrid(config,configDimen);
} | java | public static CalibrationDetectorSquareGrid squareGrid(@Nullable ConfigSquareGrid config, ConfigGridDimen configDimen) {
if( config == null )
config = new ConfigSquareGrid();
config.checkValidity();
return new CalibrationDetectorSquareGrid(config,configDimen);
} | [
"public",
"static",
"CalibrationDetectorSquareGrid",
"squareGrid",
"(",
"@",
"Nullable",
"ConfigSquareGrid",
"config",
",",
"ConfigGridDimen",
"configDimen",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"config",
"=",
"new",
"ConfigSquareGrid",
"(",
")",
";",
"config",
".",
"checkValidity",
"(",
")",
";",
"return",
"new",
"CalibrationDetectorSquareGrid",
"(",
"config",
",",
"configDimen",
")",
";",
"}"
] | Detector for a grid of square targets. All squares must be entirely visible inside the image.
@see boofcv.alg.fiducial.calib.grid.DetectSquareGridFiducial
@param config Configuration for chessboard detector
@return Square grid target detector. | [
"Detector",
"for",
"a",
"grid",
"of",
"square",
"targets",
".",
"All",
"squares",
"must",
"be",
"entirely",
"visible",
"inside",
"the",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/factory/fiducial/FactoryFiducialCalibration.java#L42-L48 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java | MarkdownHelper.readUntil | public static int readUntil (final StringBuilder out, final String in, final int start, final char... end) {
"""
Reads characters until any 'end' character is encountered.
@param out
The StringBuilder to write to.
@param in
The Input String.
@param start
Starting position.
@param end
End characters.
@return The new position or -1 if no 'end' char was found.
"""
int pos = start;
while (pos < in.length ())
{
final char ch = in.charAt (pos);
if (ch == '\\' && pos + 1 < in.length ())
{
pos = _escape (out, in.charAt (pos + 1), pos);
}
else
{
boolean endReached = false;
for (final char element : end)
{
if (ch == element)
{
endReached = true;
break;
}
}
if (endReached)
break;
out.append (ch);
}
pos++;
}
return pos == in.length () ? -1 : pos;
} | java | public static int readUntil (final StringBuilder out, final String in, final int start, final char... end)
{
int pos = start;
while (pos < in.length ())
{
final char ch = in.charAt (pos);
if (ch == '\\' && pos + 1 < in.length ())
{
pos = _escape (out, in.charAt (pos + 1), pos);
}
else
{
boolean endReached = false;
for (final char element : end)
{
if (ch == element)
{
endReached = true;
break;
}
}
if (endReached)
break;
out.append (ch);
}
pos++;
}
return pos == in.length () ? -1 : pos;
} | [
"public",
"static",
"int",
"readUntil",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"String",
"in",
",",
"final",
"int",
"start",
",",
"final",
"char",
"...",
"end",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"while",
"(",
"pos",
"<",
"in",
".",
"length",
"(",
")",
")",
"{",
"final",
"char",
"ch",
"=",
"in",
".",
"charAt",
"(",
"pos",
")",
";",
"if",
"(",
"ch",
"==",
"'",
"'",
"&&",
"pos",
"+",
"1",
"<",
"in",
".",
"length",
"(",
")",
")",
"{",
"pos",
"=",
"_escape",
"(",
"out",
",",
"in",
".",
"charAt",
"(",
"pos",
"+",
"1",
")",
",",
"pos",
")",
";",
"}",
"else",
"{",
"boolean",
"endReached",
"=",
"false",
";",
"for",
"(",
"final",
"char",
"element",
":",
"end",
")",
"{",
"if",
"(",
"ch",
"==",
"element",
")",
"{",
"endReached",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"endReached",
")",
"break",
";",
"out",
".",
"append",
"(",
"ch",
")",
";",
"}",
"pos",
"++",
";",
"}",
"return",
"pos",
"==",
"in",
".",
"length",
"(",
")",
"?",
"-",
"1",
":",
"pos",
";",
"}"
] | Reads characters until any 'end' character is encountered.
@param out
The StringBuilder to write to.
@param in
The Input String.
@param start
Starting position.
@param end
End characters.
@return The new position or -1 if no 'end' char was found. | [
"Reads",
"characters",
"until",
"any",
"end",
"character",
"is",
"encountered",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/markdown/MarkdownHelper.java#L120-L149 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsEditorBase.java | CmsEditorBase.saveEntities | public void saveEntities(List<CmsEntity> entities, final boolean clearOnSuccess, final Command callback) {
"""
Saves the given entities.<p>
@param entities the entities to save
@param clearOnSuccess <code>true</code> to clear the entity back-end instance on success
@param callback the call back command
"""
AsyncCallback<CmsValidationResult> asyncCallback = new AsyncCallback<CmsValidationResult>() {
public void onFailure(Throwable caught) {
onRpcError(caught);
}
public void onSuccess(CmsValidationResult result) {
callback.execute();
if ((result != null) && result.hasErrors()) {
// CmsValidationHandler.getInstance().displayErrors(null, result)
}
if (clearOnSuccess) {
destroyForm(true);
}
}
};
getService().saveEntities(entities, asyncCallback);
} | java | public void saveEntities(List<CmsEntity> entities, final boolean clearOnSuccess, final Command callback) {
AsyncCallback<CmsValidationResult> asyncCallback = new AsyncCallback<CmsValidationResult>() {
public void onFailure(Throwable caught) {
onRpcError(caught);
}
public void onSuccess(CmsValidationResult result) {
callback.execute();
if ((result != null) && result.hasErrors()) {
// CmsValidationHandler.getInstance().displayErrors(null, result)
}
if (clearOnSuccess) {
destroyForm(true);
}
}
};
getService().saveEntities(entities, asyncCallback);
} | [
"public",
"void",
"saveEntities",
"(",
"List",
"<",
"CmsEntity",
">",
"entities",
",",
"final",
"boolean",
"clearOnSuccess",
",",
"final",
"Command",
"callback",
")",
"{",
"AsyncCallback",
"<",
"CmsValidationResult",
">",
"asyncCallback",
"=",
"new",
"AsyncCallback",
"<",
"CmsValidationResult",
">",
"(",
")",
"{",
"public",
"void",
"onFailure",
"(",
"Throwable",
"caught",
")",
"{",
"onRpcError",
"(",
"caught",
")",
";",
"}",
"public",
"void",
"onSuccess",
"(",
"CmsValidationResult",
"result",
")",
"{",
"callback",
".",
"execute",
"(",
")",
";",
"if",
"(",
"(",
"result",
"!=",
"null",
")",
"&&",
"result",
".",
"hasErrors",
"(",
")",
")",
"{",
"// CmsValidationHandler.getInstance().displayErrors(null, result)\r",
"}",
"if",
"(",
"clearOnSuccess",
")",
"{",
"destroyForm",
"(",
"true",
")",
";",
"}",
"}",
"}",
";",
"getService",
"(",
")",
".",
"saveEntities",
"(",
"entities",
",",
"asyncCallback",
")",
";",
"}"
] | Saves the given entities.<p>
@param entities the entities to save
@param clearOnSuccess <code>true</code> to clear the entity back-end instance on success
@param callback the call back command | [
"Saves",
"the",
"given",
"entities",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L507-L528 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java | WaveformPreviewComponent.setWaveformPreview | public void setWaveformPreview(WaveformPreview preview, TrackMetadata metadata) {
"""
Change the waveform preview being drawn. This will be quickly overruled if a player is being monitored, but
can be used in other contexts.
@param preview the waveform preview to display
@param metadata information about the track whose waveform we are drawing, so we can translate times into
positions and display hot cues and memory points
"""
updateWaveform(preview);
this.duration.set(metadata.getDuration());
this.cueList.set(metadata.getCueList());
clearPlaybackState();
repaint();
} | java | public void setWaveformPreview(WaveformPreview preview, TrackMetadata metadata) {
updateWaveform(preview);
this.duration.set(metadata.getDuration());
this.cueList.set(metadata.getCueList());
clearPlaybackState();
repaint();
} | [
"public",
"void",
"setWaveformPreview",
"(",
"WaveformPreview",
"preview",
",",
"TrackMetadata",
"metadata",
")",
"{",
"updateWaveform",
"(",
"preview",
")",
";",
"this",
".",
"duration",
".",
"set",
"(",
"metadata",
".",
"getDuration",
"(",
")",
")",
";",
"this",
".",
"cueList",
".",
"set",
"(",
"metadata",
".",
"getCueList",
"(",
")",
")",
";",
"clearPlaybackState",
"(",
")",
";",
"repaint",
"(",
")",
";",
"}"
] | Change the waveform preview being drawn. This will be quickly overruled if a player is being monitored, but
can be used in other contexts.
@param preview the waveform preview to display
@param metadata information about the track whose waveform we are drawing, so we can translate times into
positions and display hot cues and memory points | [
"Change",
"the",
"waveform",
"preview",
"being",
"drawn",
".",
"This",
"will",
"be",
"quickly",
"overruled",
"if",
"a",
"player",
"is",
"being",
"monitored",
"but",
"can",
"be",
"used",
"in",
"other",
"contexts",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreviewComponent.java#L449-L455 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ClassUtils.java | ClassUtils.getShortCanonicalName | public static String getShortCanonicalName(final Object object, final String valueIfNull) {
"""
<p>Gets the canonical name minus the package name for an {@code Object}.</p>
@param object the class to get the short name for, may be null
@param valueIfNull the value to return if null
@return the canonical name of the object without the package name, or the null value
@since 2.4
"""
if (object == null) {
return valueIfNull;
}
return getShortCanonicalName(object.getClass().getName());
} | java | public static String getShortCanonicalName(final Object object, final String valueIfNull) {
if (object == null) {
return valueIfNull;
}
return getShortCanonicalName(object.getClass().getName());
} | [
"public",
"static",
"String",
"getShortCanonicalName",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"valueIfNull",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"valueIfNull",
";",
"}",
"return",
"getShortCanonicalName",
"(",
"object",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}"
] | <p>Gets the canonical name minus the package name for an {@code Object}.</p>
@param object the class to get the short name for, may be null
@param valueIfNull the value to return if null
@return the canonical name of the object without the package name, or the null value
@since 2.4 | [
"<p",
">",
"Gets",
"the",
"canonical",
"name",
"minus",
"the",
"package",
"name",
"for",
"an",
"{",
"@code",
"Object",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L1192-L1197 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/platform/adminuser/AdminUserUrl.java | AdminUserUrl.getTenantScopesForUserUrl | public static MozuUrl getTenantScopesForUserUrl(String responseFields, String userId) {
"""
Get Resource Url for GetTenantScopesForUser
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/platform/adminuser/accounts/{userId}/tenants?responseFields={responseFields}");
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | java | public static MozuUrl getTenantScopesForUserUrl(String responseFields, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/adminuser/accounts/{userId}/tenants?responseFields={responseFields}");
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getTenantScopesForUserUrl",
"(",
"String",
"responseFields",
",",
"String",
"userId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/adminuser/accounts/{userId}/tenants?responseFields={responseFields}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"responseFields\"",
",",
"responseFields",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"userId\"",
",",
"userId",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"HOME_POD",
")",
";",
"}"
] | Get Resource Url for GetTenantScopesForUser
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetTenantScopesForUser"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/adminuser/AdminUserUrl.java#L22-L28 |
bazaarvoice/emodb | event/src/main/java/com/bazaarvoice/emodb/event/db/astyanax/ChannelAllocationState.java | ChannelAllocationState.attachAndAllocate | public synchronized SlabAllocation attachAndAllocate(SlabRef slab, PeekingIterator<Integer> eventSizes) {
"""
Attaches a slab and allocates from it in a single atomic operation.
"""
attach(slab);
return allocate(eventSizes);
} | java | public synchronized SlabAllocation attachAndAllocate(SlabRef slab, PeekingIterator<Integer> eventSizes) {
attach(slab);
return allocate(eventSizes);
} | [
"public",
"synchronized",
"SlabAllocation",
"attachAndAllocate",
"(",
"SlabRef",
"slab",
",",
"PeekingIterator",
"<",
"Integer",
">",
"eventSizes",
")",
"{",
"attach",
"(",
"slab",
")",
";",
"return",
"allocate",
"(",
"eventSizes",
")",
";",
"}"
] | Attaches a slab and allocates from it in a single atomic operation. | [
"Attaches",
"a",
"slab",
"and",
"allocates",
"from",
"it",
"in",
"a",
"single",
"atomic",
"operation",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/event/src/main/java/com/bazaarvoice/emodb/event/db/astyanax/ChannelAllocationState.java#L32-L35 |
paymill/paymill-java | src/main/java/com/paymill/services/TransactionService.java | TransactionService.createWithToken | public Transaction createWithToken( String token, Integer amount, String currency, String description ) {
"""
Executes a {@link Transaction} with token for the given amount in the given currency.
@param token
Token generated by PAYMILL Bridge, which represents a credit card or direct debit.
@param amount
Amount (in cents) which will be charged.
@param currency
ISO 4217 formatted currency code.
@param description
A short description for the transaction.
@return {@link Transaction} object indicating whether a the call was successful or not.
"""
return this.createWithTokenAndFee( token, amount, currency, description, null );
} | java | public Transaction createWithToken( String token, Integer amount, String currency, String description ) {
return this.createWithTokenAndFee( token, amount, currency, description, null );
} | [
"public",
"Transaction",
"createWithToken",
"(",
"String",
"token",
",",
"Integer",
"amount",
",",
"String",
"currency",
",",
"String",
"description",
")",
"{",
"return",
"this",
".",
"createWithTokenAndFee",
"(",
"token",
",",
"amount",
",",
"currency",
",",
"description",
",",
"null",
")",
";",
"}"
] | Executes a {@link Transaction} with token for the given amount in the given currency.
@param token
Token generated by PAYMILL Bridge, which represents a credit card or direct debit.
@param amount
Amount (in cents) which will be charged.
@param currency
ISO 4217 formatted currency code.
@param description
A short description for the transaction.
@return {@link Transaction} object indicating whether a the call was successful or not. | [
"Executes",
"a",
"{"
] | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L127-L129 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/VsanUpgradeSystem.java | VsanUpgradeSystem.performVsanUpgradePreflightCheck | public VsanUpgradeSystemPreflightCheckResult performVsanUpgradePreflightCheck(ClusterComputeResource cluster) throws RuntimeFault, VsanFault, RemoteException {
"""
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
"""
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",
",",
"null",
")",
";",
"}"
] | 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 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/handler/file/FileHandlerUtil.java | FileHandlerUtil.addDate | public static Date addDate(final Date date, final Integer different) {
"""
Add days.
@param date the date
@param different the different
@return the date
"""
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, different);
return cal.getTime();
} | java | public static Date addDate(final Date date, final Integer different) {
final Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, different);
return cal.getTime();
} | [
"public",
"static",
"Date",
"addDate",
"(",
"final",
"Date",
"date",
",",
"final",
"Integer",
"different",
")",
"{",
"final",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"DATE",
",",
"different",
")",
";",
"return",
"cal",
".",
"getTime",
"(",
")",
";",
"}"
] | Add days.
@param date the date
@param different the different
@return the date | [
"Add",
"days",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/handler/file/FileHandlerUtil.java#L196-L201 |
groovy/groovy-core | src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java | StaticTypeCheckingSupport.excessArgumentsMatchesVargsParameter | static int excessArgumentsMatchesVargsParameter(Parameter[] params, ClassNode[] args) {
"""
Checks that excess arguments match the vararg signature parameter.
@param params
@param args
@return -1 if no match, 0 if all arguments matches the vararg type and >0 if one or more vararg argument is
assignable to the vararg type, but still not an exact match
"""
// we already know parameter length is bigger zero and last is a vargs
// the excess arguments are all put in an array for the vargs call
// so check against the component type
int dist = 0;
ClassNode vargsBase = params[params.length - 1].getType().getComponentType();
for (int i = params.length; i < args.length; i++) {
if (!isAssignableTo(args[i],vargsBase)) return -1;
else if (!args[i].equals(vargsBase)) dist+=getDistance(args[i], vargsBase);
}
return dist;
} | java | static int excessArgumentsMatchesVargsParameter(Parameter[] params, ClassNode[] args) {
// we already know parameter length is bigger zero and last is a vargs
// the excess arguments are all put in an array for the vargs call
// so check against the component type
int dist = 0;
ClassNode vargsBase = params[params.length - 1].getType().getComponentType();
for (int i = params.length; i < args.length; i++) {
if (!isAssignableTo(args[i],vargsBase)) return -1;
else if (!args[i].equals(vargsBase)) dist+=getDistance(args[i], vargsBase);
}
return dist;
} | [
"static",
"int",
"excessArgumentsMatchesVargsParameter",
"(",
"Parameter",
"[",
"]",
"params",
",",
"ClassNode",
"[",
"]",
"args",
")",
"{",
"// we already know parameter length is bigger zero and last is a vargs",
"// the excess arguments are all put in an array for the vargs call",
"// so check against the component type",
"int",
"dist",
"=",
"0",
";",
"ClassNode",
"vargsBase",
"=",
"params",
"[",
"params",
".",
"length",
"-",
"1",
"]",
".",
"getType",
"(",
")",
".",
"getComponentType",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"params",
".",
"length",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"isAssignableTo",
"(",
"args",
"[",
"i",
"]",
",",
"vargsBase",
")",
")",
"return",
"-",
"1",
";",
"else",
"if",
"(",
"!",
"args",
"[",
"i",
"]",
".",
"equals",
"(",
"vargsBase",
")",
")",
"dist",
"+=",
"getDistance",
"(",
"args",
"[",
"i",
"]",
",",
"vargsBase",
")",
";",
"}",
"return",
"dist",
";",
"}"
] | Checks that excess arguments match the vararg signature parameter.
@param params
@param args
@return -1 if no match, 0 if all arguments matches the vararg type and >0 if one or more vararg argument is
assignable to the vararg type, but still not an exact match | [
"Checks",
"that",
"excess",
"arguments",
"match",
"the",
"vararg",
"signature",
"parameter",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java#L276-L287 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/AbstractBandMatrix.java | AbstractBandMatrix.getIndex | int getIndex(int row, int column) {
"""
Checks the row and column indices, and returns the linear data index
"""
check(row, column);
return ku + row - column + column * (kl + ku + 1);
} | java | int getIndex(int row, int column) {
check(row, column);
return ku + row - column + column * (kl + ku + 1);
} | [
"int",
"getIndex",
"(",
"int",
"row",
",",
"int",
"column",
")",
"{",
"check",
"(",
"row",
",",
"column",
")",
";",
"return",
"ku",
"+",
"row",
"-",
"column",
"+",
"column",
"*",
"(",
"kl",
"+",
"ku",
"+",
"1",
")",
";",
"}"
] | Checks the row and column indices, and returns the linear data index | [
"Checks",
"the",
"row",
"and",
"column",
"indices",
"and",
"returns",
"the",
"linear",
"data",
"index"
] | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/AbstractBandMatrix.java#L172-L175 |
kakawait/cas-security-spring-boot-starter | spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/client/ticket/AttributePrincipalProxyTicketProvider.java | AttributePrincipalProxyTicketProvider.getProxyTicket | @Override
public String getProxyTicket(String service) {
"""
{@inheritDoc}
@throws IllegalArgumentException if {@code service} is null or blank
@throws IllegalStateException if {@link Assertion} from {@link AssertionProvider#getAssertion()} is
{@code null} or {@link AttributePrincipal} from previous
{@link Assertion#getPrincipal()} is {@code null}.
"""
Assert.hasText(service, "service cannot not be null or blank");
Assertion assertion = assertionProvider.getAssertion();
AttributePrincipal principal = assertion.getPrincipal();
if (principal == null) {
throw new IllegalStateException(String.format(EXCEPTION_MESSAGE, AttributePrincipal.class.getSimpleName()));
}
return principal.getProxyTicketFor(service);
} | java | @Override
public String getProxyTicket(String service) {
Assert.hasText(service, "service cannot not be null or blank");
Assertion assertion = assertionProvider.getAssertion();
AttributePrincipal principal = assertion.getPrincipal();
if (principal == null) {
throw new IllegalStateException(String.format(EXCEPTION_MESSAGE, AttributePrincipal.class.getSimpleName()));
}
return principal.getProxyTicketFor(service);
} | [
"@",
"Override",
"public",
"String",
"getProxyTicket",
"(",
"String",
"service",
")",
"{",
"Assert",
".",
"hasText",
"(",
"service",
",",
"\"service cannot not be null or blank\"",
")",
";",
"Assertion",
"assertion",
"=",
"assertionProvider",
".",
"getAssertion",
"(",
")",
";",
"AttributePrincipal",
"principal",
"=",
"assertion",
".",
"getPrincipal",
"(",
")",
";",
"if",
"(",
"principal",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"EXCEPTION_MESSAGE",
",",
"AttributePrincipal",
".",
"class",
".",
"getSimpleName",
"(",
")",
")",
")",
";",
"}",
"return",
"principal",
".",
"getProxyTicketFor",
"(",
"service",
")",
";",
"}"
] | {@inheritDoc}
@throws IllegalArgumentException if {@code service} is null or blank
@throws IllegalStateException if {@link Assertion} from {@link AssertionProvider#getAssertion()} is
{@code null} or {@link AttributePrincipal} from previous
{@link Assertion#getPrincipal()} is {@code null}. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/kakawait/cas-security-spring-boot-starter/blob/f42e7829f6f3ff1f64803a09577bca3c6f60e347/spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/client/ticket/AttributePrincipalProxyTicketProvider.java#L34-L45 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/XMLConverter.java | XMLConverter._serializeQuery | private String _serializeQuery(Query query, Map<Object, String> done, String id) throws ConverterException {
"""
serialize a Query
@param query Query to serialize
@param done
@return serialized query
@throws ConverterException
"""
/*
* <QUERY ID="1"> <COLUMNNAMES> <COLUMN NAME="a"></COLUMN> <COLUMN NAME="b"></COLUMN> </COLUMNNAMES>
*
* <ROWS> <ROW> <COLUMN TYPE="STRING">a1</COLUMN> <COLUMN TYPE="STRING">b1</COLUMN> </ROW> <ROW>
* <COLUMN TYPE="STRING">a2</COLUMN> <COLUMN TYPE="STRING">b2</COLUMN> </ROW> </ROWS> </QUERY>
*/
Collection.Key[] keys = CollectionUtil.keys(query);
StringBuilder sb = new StringBuilder(goIn() + "<QUERY ID=\"" + id + "\">");
// columns
sb.append(goIn() + "<COLUMNNAMES>");
for (int i = 0; i < keys.length; i++) {
sb.append(goIn() + "<COLUMN NAME=\"" + keys[i].getString() + "\"></COLUMN>");
}
sb.append(goIn() + "</COLUMNNAMES>");
String value;
deep++;
sb.append(goIn() + "<ROWS>");
int len = query.getRecordcount();
for (int row = 1; row <= len; row++) {
sb.append(goIn() + "<ROW>");
for (int col = 0; col < keys.length; col++) {
try {
value = _serialize(query.getAt(keys[col], row), done);
}
catch (PageException e) {
value = _serialize(e.getMessage(), done);
}
sb.append("<COLUMN TYPE=\"" + type + "\">" + value + "</COLUMN>");
}
sb.append(goIn() + "</ROW>");
}
sb.append(goIn() + "</ROWS>");
deep--;
sb.append(goIn() + "</QUERY>");
type = "QUERY";
return sb.toString();
} | java | private String _serializeQuery(Query query, Map<Object, String> done, String id) throws ConverterException {
/*
* <QUERY ID="1"> <COLUMNNAMES> <COLUMN NAME="a"></COLUMN> <COLUMN NAME="b"></COLUMN> </COLUMNNAMES>
*
* <ROWS> <ROW> <COLUMN TYPE="STRING">a1</COLUMN> <COLUMN TYPE="STRING">b1</COLUMN> </ROW> <ROW>
* <COLUMN TYPE="STRING">a2</COLUMN> <COLUMN TYPE="STRING">b2</COLUMN> </ROW> </ROWS> </QUERY>
*/
Collection.Key[] keys = CollectionUtil.keys(query);
StringBuilder sb = new StringBuilder(goIn() + "<QUERY ID=\"" + id + "\">");
// columns
sb.append(goIn() + "<COLUMNNAMES>");
for (int i = 0; i < keys.length; i++) {
sb.append(goIn() + "<COLUMN NAME=\"" + keys[i].getString() + "\"></COLUMN>");
}
sb.append(goIn() + "</COLUMNNAMES>");
String value;
deep++;
sb.append(goIn() + "<ROWS>");
int len = query.getRecordcount();
for (int row = 1; row <= len; row++) {
sb.append(goIn() + "<ROW>");
for (int col = 0; col < keys.length; col++) {
try {
value = _serialize(query.getAt(keys[col], row), done);
}
catch (PageException e) {
value = _serialize(e.getMessage(), done);
}
sb.append("<COLUMN TYPE=\"" + type + "\">" + value + "</COLUMN>");
}
sb.append(goIn() + "</ROW>");
}
sb.append(goIn() + "</ROWS>");
deep--;
sb.append(goIn() + "</QUERY>");
type = "QUERY";
return sb.toString();
} | [
"private",
"String",
"_serializeQuery",
"(",
"Query",
"query",
",",
"Map",
"<",
"Object",
",",
"String",
">",
"done",
",",
"String",
"id",
")",
"throws",
"ConverterException",
"{",
"/*\n\t * <QUERY ID=\"1\"> <COLUMNNAMES> <COLUMN NAME=\"a\"></COLUMN> <COLUMN NAME=\"b\"></COLUMN> </COLUMNNAMES>\n\t * \n\t * <ROWS> <ROW> <COLUMN TYPE=\"STRING\">a1</COLUMN> <COLUMN TYPE=\"STRING\">b1</COLUMN> </ROW> <ROW>\n\t * <COLUMN TYPE=\"STRING\">a2</COLUMN> <COLUMN TYPE=\"STRING\">b2</COLUMN> </ROW> </ROWS> </QUERY>\n\t */",
"Collection",
".",
"Key",
"[",
"]",
"keys",
"=",
"CollectionUtil",
".",
"keys",
"(",
"query",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"goIn",
"(",
")",
"+",
"\"<QUERY ID=\\\"\"",
"+",
"id",
"+",
"\"\\\">\"",
")",
";",
"// columns",
"sb",
".",
"append",
"(",
"goIn",
"(",
")",
"+",
"\"<COLUMNNAMES>\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"goIn",
"(",
")",
"+",
"\"<COLUMN NAME=\\\"\"",
"+",
"keys",
"[",
"i",
"]",
".",
"getString",
"(",
")",
"+",
"\"\\\"></COLUMN>\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"goIn",
"(",
")",
"+",
"\"</COLUMNNAMES>\"",
")",
";",
"String",
"value",
";",
"deep",
"++",
";",
"sb",
".",
"append",
"(",
"goIn",
"(",
")",
"+",
"\"<ROWS>\"",
")",
";",
"int",
"len",
"=",
"query",
".",
"getRecordcount",
"(",
")",
";",
"for",
"(",
"int",
"row",
"=",
"1",
";",
"row",
"<=",
"len",
";",
"row",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"goIn",
"(",
")",
"+",
"\"<ROW>\"",
")",
";",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"keys",
".",
"length",
";",
"col",
"++",
")",
"{",
"try",
"{",
"value",
"=",
"_serialize",
"(",
"query",
".",
"getAt",
"(",
"keys",
"[",
"col",
"]",
",",
"row",
")",
",",
"done",
")",
";",
"}",
"catch",
"(",
"PageException",
"e",
")",
"{",
"value",
"=",
"_serialize",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"done",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\"<COLUMN TYPE=\\\"\"",
"+",
"type",
"+",
"\"\\\">\"",
"+",
"value",
"+",
"\"</COLUMN>\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"goIn",
"(",
")",
"+",
"\"</ROW>\"",
")",
";",
"}",
"sb",
".",
"append",
"(",
"goIn",
"(",
")",
"+",
"\"</ROWS>\"",
")",
";",
"deep",
"--",
";",
"sb",
".",
"append",
"(",
"goIn",
"(",
")",
"+",
"\"</QUERY>\"",
")",
";",
"type",
"=",
"\"QUERY\"",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | serialize a Query
@param query Query to serialize
@param done
@return serialized query
@throws ConverterException | [
"serialize",
"a",
"Query"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/XMLConverter.java#L292-L334 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getSasDefinitionAsync | public ServiceFuture<SasDefinitionBundle> getSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, final ServiceCallback<SasDefinitionBundle> serviceCallback) {
"""
Gets information about a SAS definition for the specified storage account. This operation requires the storage/getsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(getSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName), serviceCallback);
} | java | public ServiceFuture<SasDefinitionBundle> getSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, final ServiceCallback<SasDefinitionBundle> serviceCallback) {
return ServiceFuture.fromResponse(getSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"SasDefinitionBundle",
">",
"getSasDefinitionAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"sasDefinitionName",
",",
"final",
"ServiceCallback",
"<",
"SasDefinitionBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"getSasDefinitionWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAccountName",
",",
"sasDefinitionName",
")",
",",
"serviceCallback",
")",
";",
"}"
] | Gets information about a SAS definition for the specified storage account. This operation requires the storage/getsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Gets",
"information",
"about",
"a",
"SAS",
"definition",
"for",
"the",
"specified",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"getsas",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L11174-L11176 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsVfsDriver.java | CmsVfsDriver.internalUpdateVersions | protected void internalUpdateVersions(CmsDbContext dbc, CmsResource resource) throws CmsDataAccessException {
"""
Updates the offline version numbers.<p>
@param dbc the current database context
@param resource the resource to update the version number for
@throws CmsDataAccessException if something goes wrong
"""
if (dbc.getRequestContext() == null) {
// no needed during initialization
return;
}
if (dbc.currentProject().isOnlineProject()) {
// this method is supposed to be used only in the offline project
return;
}
// read the online version numbers
Map<String, Integer> onlineVersions = readVersions(
dbc,
CmsProject.ONLINE_PROJECT_ID,
resource.getResourceId(),
resource.getStructureId());
int onlineStructureVersion = onlineVersions.get("structure").intValue();
int onlineResourceVersion = onlineVersions.get("resource").intValue();
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
try {
conn = m_sqlManager.getConnection(dbc);
// update the resource version
stmt = m_sqlManager.getPreparedStatement(conn, dbc.currentProject(), "C_RESOURCES_UPDATE_RESOURCE_VERSION");
stmt.setInt(1, onlineResourceVersion);
stmt.setString(2, resource.getResourceId().toString());
stmt.executeUpdate();
m_sqlManager.closeAll(dbc, null, stmt, null);
// update the structure version
stmt = m_sqlManager.getPreparedStatement(
conn,
dbc.currentProject(),
"C_RESOURCES_UPDATE_STRUCTURE_VERSION");
stmt.setInt(1, onlineStructureVersion);
stmt.setString(2, resource.getStructureId().toString());
stmt.executeUpdate();
m_sqlManager.closeAll(dbc, null, stmt, null);
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
} | java | protected void internalUpdateVersions(CmsDbContext dbc, CmsResource resource) throws CmsDataAccessException {
if (dbc.getRequestContext() == null) {
// no needed during initialization
return;
}
if (dbc.currentProject().isOnlineProject()) {
// this method is supposed to be used only in the offline project
return;
}
// read the online version numbers
Map<String, Integer> onlineVersions = readVersions(
dbc,
CmsProject.ONLINE_PROJECT_ID,
resource.getResourceId(),
resource.getStructureId());
int onlineStructureVersion = onlineVersions.get("structure").intValue();
int onlineResourceVersion = onlineVersions.get("resource").intValue();
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
try {
conn = m_sqlManager.getConnection(dbc);
// update the resource version
stmt = m_sqlManager.getPreparedStatement(conn, dbc.currentProject(), "C_RESOURCES_UPDATE_RESOURCE_VERSION");
stmt.setInt(1, onlineResourceVersion);
stmt.setString(2, resource.getResourceId().toString());
stmt.executeUpdate();
m_sqlManager.closeAll(dbc, null, stmt, null);
// update the structure version
stmt = m_sqlManager.getPreparedStatement(
conn,
dbc.currentProject(),
"C_RESOURCES_UPDATE_STRUCTURE_VERSION");
stmt.setInt(1, onlineStructureVersion);
stmt.setString(2, resource.getStructureId().toString());
stmt.executeUpdate();
m_sqlManager.closeAll(dbc, null, stmt, null);
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
} | [
"protected",
"void",
"internalUpdateVersions",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsDataAccessException",
"{",
"if",
"(",
"dbc",
".",
"getRequestContext",
"(",
")",
"==",
"null",
")",
"{",
"// no needed during initialization",
"return",
";",
"}",
"if",
"(",
"dbc",
".",
"currentProject",
"(",
")",
".",
"isOnlineProject",
"(",
")",
")",
"{",
"// this method is supposed to be used only in the offline project",
"return",
";",
"}",
"// read the online version numbers",
"Map",
"<",
"String",
",",
"Integer",
">",
"onlineVersions",
"=",
"readVersions",
"(",
"dbc",
",",
"CmsProject",
".",
"ONLINE_PROJECT_ID",
",",
"resource",
".",
"getResourceId",
"(",
")",
",",
"resource",
".",
"getStructureId",
"(",
")",
")",
";",
"int",
"onlineStructureVersion",
"=",
"onlineVersions",
".",
"get",
"(",
"\"structure\"",
")",
".",
"intValue",
"(",
")",
";",
"int",
"onlineResourceVersion",
"=",
"onlineVersions",
".",
"get",
"(",
"\"resource\"",
")",
".",
"intValue",
"(",
")",
";",
"Connection",
"conn",
"=",
"null",
";",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"ResultSet",
"res",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"m_sqlManager",
".",
"getConnection",
"(",
"dbc",
")",
";",
"// update the resource version",
"stmt",
"=",
"m_sqlManager",
".",
"getPreparedStatement",
"(",
"conn",
",",
"dbc",
".",
"currentProject",
"(",
")",
",",
"\"C_RESOURCES_UPDATE_RESOURCE_VERSION\"",
")",
";",
"stmt",
".",
"setInt",
"(",
"1",
",",
"onlineResourceVersion",
")",
";",
"stmt",
".",
"setString",
"(",
"2",
",",
"resource",
".",
"getResourceId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"stmt",
".",
"executeUpdate",
"(",
")",
";",
"m_sqlManager",
".",
"closeAll",
"(",
"dbc",
",",
"null",
",",
"stmt",
",",
"null",
")",
";",
"// update the structure version",
"stmt",
"=",
"m_sqlManager",
".",
"getPreparedStatement",
"(",
"conn",
",",
"dbc",
".",
"currentProject",
"(",
")",
",",
"\"C_RESOURCES_UPDATE_STRUCTURE_VERSION\"",
")",
";",
"stmt",
".",
"setInt",
"(",
"1",
",",
"onlineStructureVersion",
")",
";",
"stmt",
".",
"setString",
"(",
"2",
",",
"resource",
".",
"getStructureId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"stmt",
".",
"executeUpdate",
"(",
")",
";",
"m_sqlManager",
".",
"closeAll",
"(",
"dbc",
",",
"null",
",",
"stmt",
",",
"null",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"CmsDbSqlException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_GENERIC_SQL_1",
",",
"CmsDbSqlException",
".",
"getErrorQuery",
"(",
"stmt",
")",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"m_sqlManager",
".",
"closeAll",
"(",
"dbc",
",",
"conn",
",",
"stmt",
",",
"res",
")",
";",
"}",
"}"
] | Updates the offline version numbers.<p>
@param dbc the current database context
@param resource the resource to update the version number for
@throws CmsDataAccessException if something goes wrong | [
"Updates",
"the",
"offline",
"version",
"numbers",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L4024-L4075 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_feature_duration_POST | public OvhOrder dedicated_server_serviceName_feature_duration_POST(String serviceName, String duration, OvhOrderableSysFeatureEnum feature) throws IOException {
"""
Create order
REST: POST /order/dedicated/server/{serviceName}/feature/{duration}
@param feature [required] the feature
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration
"""
String qPath = "/order/dedicated/server/{serviceName}/feature/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "feature", feature);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicated_server_serviceName_feature_duration_POST(String serviceName, String duration, OvhOrderableSysFeatureEnum feature) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/feature/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "feature", feature);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicated_server_serviceName_feature_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhOrderableSysFeatureEnum",
"feature",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName}/feature/{duration}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"duration",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"feature\"",
",",
"feature",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOrder",
".",
"class",
")",
";",
"}"
] | Create order
REST: POST /order/dedicated/server/{serviceName}/feature/{duration}
@param feature [required] the feature
@param serviceName [required] The internal name of your dedicated server
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2225-L2232 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.