repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
eclipse/xtext-extras | org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java | SignatureUtil.scanTypeBoundSignature | private static int scanTypeBoundSignature(String string, int start) {
// need a minimum 1 char for wildcard
if (start >= string.length()) {
throw new IllegalArgumentException();
}
char c = string.charAt(start);
switch (c) {
case C_STAR :
return start;
case C_SUPER :
case C_EXTENDS :
// need a minimum 3 chars "+[I"
if (start >= string.length() - 2) {
throw new IllegalArgumentException();
}
break;
default :
// must start in "+/-"
throw new IllegalArgumentException();
}
c = string.charAt(++start);
switch (c) {
case C_CAPTURE :
return scanCaptureTypeSignature(string, start);
case C_SUPER :
case C_EXTENDS :
return scanTypeBoundSignature(string, start);
case C_RESOLVED :
case C_UNRESOLVED :
return scanClassTypeSignature(string, start);
case C_TYPE_VARIABLE :
return scanTypeVariableSignature(string, start);
case C_ARRAY :
return scanArrayTypeSignature(string, start);
case C_STAR:
return start;
default:
throw new IllegalArgumentException();
}
} | java | private static int scanTypeBoundSignature(String string, int start) {
// need a minimum 1 char for wildcard
if (start >= string.length()) {
throw new IllegalArgumentException();
}
char c = string.charAt(start);
switch (c) {
case C_STAR :
return start;
case C_SUPER :
case C_EXTENDS :
// need a minimum 3 chars "+[I"
if (start >= string.length() - 2) {
throw new IllegalArgumentException();
}
break;
default :
// must start in "+/-"
throw new IllegalArgumentException();
}
c = string.charAt(++start);
switch (c) {
case C_CAPTURE :
return scanCaptureTypeSignature(string, start);
case C_SUPER :
case C_EXTENDS :
return scanTypeBoundSignature(string, start);
case C_RESOLVED :
case C_UNRESOLVED :
return scanClassTypeSignature(string, start);
case C_TYPE_VARIABLE :
return scanTypeVariableSignature(string, start);
case C_ARRAY :
return scanArrayTypeSignature(string, start);
case C_STAR:
return start;
default:
throw new IllegalArgumentException();
}
} | [
"private",
"static",
"int",
"scanTypeBoundSignature",
"(",
"String",
"string",
",",
"int",
"start",
")",
"{",
"// need a minimum 1 char for wildcard",
"if",
"(",
"start",
">=",
"string",
".",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | Scans the given string for a type bound signature starting at the given
index and returns the index of the last character.
<pre>
TypeBoundSignature:
<b>[-+]</b> TypeSignature <b>;</b>
<b>*</b></b>
</pre>
@param string the signature string
@param start the 0-based character index of the first character
@return the 0-based character index of the last character
@exception IllegalArgumentException if this is not a type variable signature | [
"Scans",
"the",
"given",
"string",
"for",
"a",
"type",
"bound",
"signature",
"starting",
"at",
"the",
"given",
"index",
"and",
"returns",
"the",
"index",
"of",
"the",
"last",
"character",
".",
"<pre",
">",
"TypeBoundSignature",
":",
"<b",
">",
"[",
"-",
... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java#L416-L456 |
samskivert/samskivert | src/main/java/com/samskivert/swing/util/SwingUtil.java | SwingUtil.createPointComparator | public static <P extends Point2D> Comparator<P> createPointComparator (final P origin)
{
return new Comparator<P>() {
public int compare (P p1, P p2)
{
double dist1 = origin.distance(p1);
double dist2 = origin.distance(p2);
return (dist1 > dist2) ? 1 : ((dist1 < dist2) ? -1 : 0);
}
};
} | java | public static <P extends Point2D> Comparator<P> createPointComparator (final P origin)
{
return new Comparator<P>() {
public int compare (P p1, P p2)
{
double dist1 = origin.distance(p1);
double dist2 = origin.distance(p2);
return (dist1 > dist2) ? 1 : ((dist1 < dist2) ? -1 : 0);
}
};
} | [
"public",
"static",
"<",
"P",
"extends",
"Point2D",
">",
"Comparator",
"<",
"P",
">",
"createPointComparator",
"(",
"final",
"P",
"origin",
")",
"{",
"return",
"new",
"Comparator",
"<",
"P",
">",
"(",
")",
"{",
"public",
"int",
"compare",
"(",
"P",
"p1... | Create a comparator that compares against the distance from the specified point.
Note: The comparator will continue to sort by distance from the origin point, even if the
origin point's coordinates are modified after the comparator is created.
Used by positionRect(). | [
"Create",
"a",
"comparator",
"that",
"compares",
"against",
"the",
"distance",
"from",
"the",
"specified",
"point",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/SwingUtil.java#L232-L242 |
twitter/hraven | hraven-etl/src/main/java/com/twitter/hraven/etl/JobFileProcessor.java | JobFileProcessor.runJobs | private boolean runJobs(int threadCount, List<JobRunner> jobRunners)
throws InterruptedException, ExecutionException {
ExecutorService execSvc = Executors.newFixedThreadPool(threadCount);
if ((jobRunners == null) || (jobRunners.size() == 0)) {
return true;
}
boolean success = true;
try {
List<Future<Boolean>> jobFutures = new LinkedList<Future<Boolean>>();
for (JobRunner jobRunner : jobRunners) {
Future<Boolean> jobFuture = execSvc.submit(jobRunner);
jobFutures.add(jobFuture);
}
// Wait for all jobs to complete.
for (Future<Boolean> jobFuture : jobFutures) {
success = jobFuture.get();
if (!success) {
// Stop the presses as soon as we see an error. Note that several
// other jobs may have already been scheduled. Others will never be
// scheduled.
break;
}
}
} finally {
// Shut down the executor so that the JVM can exit.
List<Runnable> neverRan = execSvc.shutdownNow();
if (neverRan != null && neverRan.size() > 0) {
System.err.println(
"Interrupted run. Currently running Hadoop jobs will continue unless cancelled. "
+ neverRan + " jobs never scheduled.");
}
}
return success;
} | java | private boolean runJobs(int threadCount, List<JobRunner> jobRunners)
throws InterruptedException, ExecutionException {
ExecutorService execSvc = Executors.newFixedThreadPool(threadCount);
if ((jobRunners == null) || (jobRunners.size() == 0)) {
return true;
}
boolean success = true;
try {
List<Future<Boolean>> jobFutures = new LinkedList<Future<Boolean>>();
for (JobRunner jobRunner : jobRunners) {
Future<Boolean> jobFuture = execSvc.submit(jobRunner);
jobFutures.add(jobFuture);
}
// Wait for all jobs to complete.
for (Future<Boolean> jobFuture : jobFutures) {
success = jobFuture.get();
if (!success) {
// Stop the presses as soon as we see an error. Note that several
// other jobs may have already been scheduled. Others will never be
// scheduled.
break;
}
}
} finally {
// Shut down the executor so that the JVM can exit.
List<Runnable> neverRan = execSvc.shutdownNow();
if (neverRan != null && neverRan.size() > 0) {
System.err.println(
"Interrupted run. Currently running Hadoop jobs will continue unless cancelled. "
+ neverRan + " jobs never scheduled.");
}
}
return success;
} | [
"private",
"boolean",
"runJobs",
"(",
"int",
"threadCount",
",",
"List",
"<",
"JobRunner",
">",
"jobRunners",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"ExecutorService",
"execSvc",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"thre... | Run the jobs and wait for all of them to complete.
@param threadCount up to how many jobs to run in parallel
@param jobRunners the list of jobs to run.
@return whether all jobs completed successfully or not.
@throws InterruptedException when interrupted while running jobs.
@throws ExecutionException when at least one of the jobs could not be
scheduled. | [
"Run",
"the",
"jobs",
"and",
"wait",
"for",
"all",
"of",
"them",
"to",
"complete",
"."
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobFileProcessor.java#L450-L486 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/StringUtils.java | StringUtils.containsWord | public static boolean containsWord(final String text, final String word) {
if (text == null || word == null) {
return false;
}
if (text.contains(word)) {
Matcher matcher = matchText(text);
for (; matcher.find();) {
String matchedWord = matcher.group(0);
if (matchedWord.equals(word)) {
return true;
}
}
}
return false;
} | java | public static boolean containsWord(final String text, final String word) {
if (text == null || word == null) {
return false;
}
if (text.contains(word)) {
Matcher matcher = matchText(text);
for (; matcher.find();) {
String matchedWord = matcher.group(0);
if (matchedWord.equals(word)) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsWord",
"(",
"final",
"String",
"text",
",",
"final",
"String",
"word",
")",
"{",
"if",
"(",
"text",
"==",
"null",
"||",
"word",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"text",
".",
"cont... | Returns true if given text contains given word; false otherwise.
@param text string text to be tested.
@param word string word to be tested.
@return true if given text contains given word; false otherwise. | [
"Returns",
"true",
"if",
"given",
"text",
"contains",
"given",
"word",
";",
"false",
"otherwise",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/StringUtils.java#L254-L269 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/map/OpenLongObjectHashMap.java | OpenLongObjectHashMap.pairsMatching | public void pairsMatching(final LongObjectProcedure condition, final LongArrayList keyList, final ObjectArrayList valueList) {
keyList.clear();
valueList.clear();
for (int i = table.length ; i-- > 0 ;) {
if (state[i]==FULL && condition.apply(table[i],values[i])) {
keyList.add(table[i]);
valueList.add(values[i]);
}
}
} | java | public void pairsMatching(final LongObjectProcedure condition, final LongArrayList keyList, final ObjectArrayList valueList) {
keyList.clear();
valueList.clear();
for (int i = table.length ; i-- > 0 ;) {
if (state[i]==FULL && condition.apply(table[i],values[i])) {
keyList.add(table[i]);
valueList.add(values[i]);
}
}
} | [
"public",
"void",
"pairsMatching",
"(",
"final",
"LongObjectProcedure",
"condition",
",",
"final",
"LongArrayList",
"keyList",
",",
"final",
"ObjectArrayList",
"valueList",
")",
"{",
"keyList",
".",
"clear",
"(",
")",
";",
"valueList",
".",
"clear",
"(",
")",
... | Fills all pairs satisfying a given condition into the specified lists.
Fills into the lists, starting at index 0.
After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(LongProcedure)}.
<p>
<b>Example:</b>
<br>
<pre>
LongObjectProcedure condition = new LongObjectProcedure() { // match even keys only
public boolean apply(long key, Object value) { return key%2==0; }
}
keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt>
</pre>
@param condition the condition to be matched. Takes the current key as first and the current value as second argument.
@param keyList the list to be filled with keys, can have any size.
@param valueList the list to be filled with values, can have any size. | [
"Fills",
"all",
"pairs",
"satisfying",
"a",
"given",
"condition",
"into",
"the",
"specified",
"lists",
".",
"Fills",
"into",
"the",
"lists",
"starting",
"at",
"index",
"0",
".",
"After",
"this",
"call",
"returns",
"the",
"specified",
"lists",
"both",
"have",... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/OpenLongObjectHashMap.java#L326-L336 |
togglz/togglz | benchmarks/src/main/java/org/togglz/benchmark/TogglzOverheadBenchmark.java | TogglzOverheadBenchmark.toggleEnabledState | @Setup(Level.Iteration)
public void toggleEnabledState() {
enabled = !enabled;
manager.setFeatureState(new FeatureState(OverheadFeature.FEATURE, enabled));
} | java | @Setup(Level.Iteration)
public void toggleEnabledState() {
enabled = !enabled;
manager.setFeatureState(new FeatureState(OverheadFeature.FEATURE, enabled));
} | [
"@",
"Setup",
"(",
"Level",
".",
"Iteration",
")",
"public",
"void",
"toggleEnabledState",
"(",
")",
"{",
"enabled",
"=",
"!",
"enabled",
";",
"manager",
".",
"setFeatureState",
"(",
"new",
"FeatureState",
"(",
"OverheadFeature",
".",
"FEATURE",
",",
"enable... | toggle the state between iterations to keep the compiler honest | [
"toggle",
"the",
"state",
"between",
"iterations",
"to",
"keep",
"the",
"compiler",
"honest"
] | train | https://github.com/togglz/togglz/blob/76d3ffbc8e3fac5a6cb566cc4afbd8dd5f06c4e5/benchmarks/src/main/java/org/togglz/benchmark/TogglzOverheadBenchmark.java#L63-L67 |
JoeKerouac/utils | src/main/java/com/joe/utils/serialize/json/JsonParser.java | JsonParser.readAsObject | @SuppressWarnings("unchecked")
public <T> T readAsObject(byte[] content, Class<T> type) {
try {
if (content == null || content.length == 0 || type == null) {
log.debug("content为{},type为:{}", content, type);
return null;
} else if (type.equals(String.class)) {
return (T) new String(content);
}
return MAPPER.readValue(content, type);
} catch (Exception e) {
log.error("json解析失败,失败原因:", e);
return null;
}
} | java | @SuppressWarnings("unchecked")
public <T> T readAsObject(byte[] content, Class<T> type) {
try {
if (content == null || content.length == 0 || type == null) {
log.debug("content为{},type为:{}", content, type);
return null;
} else if (type.equals(String.class)) {
return (T) new String(content);
}
return MAPPER.readValue(content, type);
} catch (Exception e) {
log.error("json解析失败,失败原因:", e);
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"readAsObject",
"(",
"byte",
"[",
"]",
"content",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"try",
"{",
"if",
"(",
"content",
"==",
"null",
"||",
"content",
".",
... | 解析json
@param content json字符串
@param type json解析后对应的实体类型
@param <T> 实体类型的实际类型
@return 解析失败将返回null | [
"解析json"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/serialize/json/JsonParser.java#L139-L153 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java | AddressDivisionGrouping.increment | protected static <R extends AddressSection, S extends AddressSegment> R increment(
R section,
long increment,
AddressCreator<?, R, ?, S> addrCreator,
long count,
long lowerValue,
long upperValue,
Supplier<R> lowerProducer,
Supplier<R> upperProducer,
Integer prefixLength) {
if(!section.isMultiple()) {
return add(section, lowerValue, increment, addrCreator, prefixLength);
}
boolean isDecrement = increment <= 0;
if(isDecrement) {
//we know lowerValue + increment >= 0 because we already did an overflow check
return add(lowerProducer.get(), lowerValue, increment, addrCreator, prefixLength);
}
if(count > increment) {
if(count == increment + 1) {
return upperProducer.get();
}
return incrementRange(section, increment, addrCreator, lowerProducer, prefixLength);
}
if(increment <= Long.MAX_VALUE - upperValue) {
return add(upperProducer.get(), upperValue, increment - (count - 1), addrCreator, prefixLength);
}
return add(upperProducer.get(), BigInteger.valueOf(increment - (count - 1)), addrCreator, prefixLength);
} | java | protected static <R extends AddressSection, S extends AddressSegment> R increment(
R section,
long increment,
AddressCreator<?, R, ?, S> addrCreator,
long count,
long lowerValue,
long upperValue,
Supplier<R> lowerProducer,
Supplier<R> upperProducer,
Integer prefixLength) {
if(!section.isMultiple()) {
return add(section, lowerValue, increment, addrCreator, prefixLength);
}
boolean isDecrement = increment <= 0;
if(isDecrement) {
//we know lowerValue + increment >= 0 because we already did an overflow check
return add(lowerProducer.get(), lowerValue, increment, addrCreator, prefixLength);
}
if(count > increment) {
if(count == increment + 1) {
return upperProducer.get();
}
return incrementRange(section, increment, addrCreator, lowerProducer, prefixLength);
}
if(increment <= Long.MAX_VALUE - upperValue) {
return add(upperProducer.get(), upperValue, increment - (count - 1), addrCreator, prefixLength);
}
return add(upperProducer.get(), BigInteger.valueOf(increment - (count - 1)), addrCreator, prefixLength);
} | [
"protected",
"static",
"<",
"R",
"extends",
"AddressSection",
",",
"S",
"extends",
"AddressSegment",
">",
"R",
"increment",
"(",
"R",
"section",
",",
"long",
"increment",
",",
"AddressCreator",
"<",
"?",
",",
"R",
",",
"?",
",",
"S",
">",
"addrCreator",
... | this does not handle overflow, overflow should be checked before calling this | [
"this",
"does",
"not",
"handle",
"overflow",
"overflow",
"should",
"be",
"checked",
"before",
"calling",
"this"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/standard/AddressDivisionGrouping.java#L1132-L1160 |
strator-dev/greenpepper | greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java | ConfluenceGreenPepper.saveExecuteChildren | public void saveExecuteChildren(Page page, Boolean doExecuteChildren) {
ContentEntityObject entityObject = getContentEntityManager().getById(page.getId());
getContentPropertyManager().setStringProperty(entityObject, ConfluenceGreenPepper.EXECUTE_CHILDREN, doExecuteChildren != null ? String.valueOf(doExecuteChildren) : null);
} | java | public void saveExecuteChildren(Page page, Boolean doExecuteChildren) {
ContentEntityObject entityObject = getContentEntityManager().getById(page.getId());
getContentPropertyManager().setStringProperty(entityObject, ConfluenceGreenPepper.EXECUTE_CHILDREN, doExecuteChildren != null ? String.valueOf(doExecuteChildren) : null);
} | [
"public",
"void",
"saveExecuteChildren",
"(",
"Page",
"page",
",",
"Boolean",
"doExecuteChildren",
")",
"{",
"ContentEntityObject",
"entityObject",
"=",
"getContentEntityManager",
"(",
")",
".",
"getById",
"(",
"page",
".",
"getId",
"(",
")",
")",
";",
"getConte... | <p>saveExecuteChildren.</p>
@param page a {@link com.atlassian.confluence.pages.Page} object.
@param doExecuteChildren a {@link java.lang.Boolean} object. | [
"<p",
">",
"saveExecuteChildren",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L676-L679 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java | ApiOvhEmailpro.service_account_email_alias_alias_GET | public OvhAccountAlias service_account_email_alias_alias_GET(String service, String email, String alias) throws IOException {
String qPath = "/email/pro/{service}/account/{email}/alias/{alias}";
StringBuilder sb = path(qPath, service, email, alias);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAccountAlias.class);
} | java | public OvhAccountAlias service_account_email_alias_alias_GET(String service, String email, String alias) throws IOException {
String qPath = "/email/pro/{service}/account/{email}/alias/{alias}";
StringBuilder sb = path(qPath, service, email, alias);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAccountAlias.class);
} | [
"public",
"OvhAccountAlias",
"service_account_email_alias_alias_GET",
"(",
"String",
"service",
",",
"String",
"email",
",",
"String",
"alias",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/pro/{service}/account/{email}/alias/{alias}\"",
";",
"StringB... | Get this object properties
REST: GET /email/pro/{service}/account/{email}/alias/{alias}
@param service [required] The internal name of your pro organization
@param email [required] Default email for this mailbox
@param alias [required] Alias
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L487-L492 |
bladecoder/blade-ink | src/main/java/com/bladecoder/ink/runtime/Story.java | Story.observeVariable | public void observeVariable(String variableName, VariableObserver observer) throws StoryException, Exception {
ifAsyncWeCant("observe a new variable");
if (variableObservers == null)
variableObservers = new HashMap<String, List<VariableObserver>>();
if (!state.getVariablesState().globalVariableExistsWithName(variableName))
throw new StoryException(
"Cannot observe variable '" + variableName + "' because it wasn't declared in the ink story.");
if (variableObservers.containsKey(variableName)) {
variableObservers.get(variableName).add(observer);
} else {
List<VariableObserver> l = new ArrayList<VariableObserver>();
l.add(observer);
variableObservers.put(variableName, l);
}
} | java | public void observeVariable(String variableName, VariableObserver observer) throws StoryException, Exception {
ifAsyncWeCant("observe a new variable");
if (variableObservers == null)
variableObservers = new HashMap<String, List<VariableObserver>>();
if (!state.getVariablesState().globalVariableExistsWithName(variableName))
throw new StoryException(
"Cannot observe variable '" + variableName + "' because it wasn't declared in the ink story.");
if (variableObservers.containsKey(variableName)) {
variableObservers.get(variableName).add(observer);
} else {
List<VariableObserver> l = new ArrayList<VariableObserver>();
l.add(observer);
variableObservers.put(variableName, l);
}
} | [
"public",
"void",
"observeVariable",
"(",
"String",
"variableName",
",",
"VariableObserver",
"observer",
")",
"throws",
"StoryException",
",",
"Exception",
"{",
"ifAsyncWeCant",
"(",
"\"observe a new variable\"",
")",
";",
"if",
"(",
"variableObservers",
"==",
"null",... | When the named global variable changes it's value, the observer will be
called to notify it of the change. Note that if the value changes multiple
times within the ink, the observer will only be called once, at the end of
the ink's evaluation. If, during the evaluation, it changes and then changes
back again to its original value, it will still be called. Note that the
observer will also be fired if the value of the variable is changed
externally to the ink, by directly setting a value in story.variablesState.
@param variableName
The name of the global variable to observe.
@param observer
A delegate function to call when the variable changes.
@throws Exception
@throws StoryException | [
"When",
"the",
"named",
"global",
"variable",
"changes",
"it",
"s",
"value",
"the",
"observer",
"will",
"be",
"called",
"to",
"notify",
"it",
"of",
"the",
"change",
".",
"Note",
"that",
"if",
"the",
"value",
"changes",
"multiple",
"times",
"within",
"the",... | train | https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L1039-L1056 |
RestComm/media-core | network/src/main/java/org/restcomm/media/core/network/netty/NettyNetworkManager.java | NettyNetworkManager.openChannel | @Override
public Channel openChannel() throws IOException, IllegalStateException {
assertOpen();
try {
return this.bootstrap.clone().register().sync().channel();
} catch (Exception e) {
throw new IOException("Could not open channel.", e);
}
} | java | @Override
public Channel openChannel() throws IOException, IllegalStateException {
assertOpen();
try {
return this.bootstrap.clone().register().sync().channel();
} catch (Exception e) {
throw new IOException("Could not open channel.", e);
}
} | [
"@",
"Override",
"public",
"Channel",
"openChannel",
"(",
")",
"throws",
"IOException",
",",
"IllegalStateException",
"{",
"assertOpen",
"(",
")",
";",
"try",
"{",
"return",
"this",
".",
"bootstrap",
".",
"clone",
"(",
")",
".",
"register",
"(",
")",
".",
... | {@inheritDoc}
@throws IllegalStateException If manager is already closed. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/network/src/main/java/org/restcomm/media/core/network/netty/NettyNetworkManager.java#L79-L87 |
amaembo/streamex | src/main/java/one/util/streamex/LongStreamEx.java | LongStreamEx.maxByInt | public OptionalLong maxByInt(LongToIntFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, l) -> {
int key = keyExtractor.applyAsInt(l);
if (!box.b || box.i < key) {
box.b = true;
box.i = key;
box.l = l;
}
}, PrimitiveBox.MAX_INT).asLong();
} | java | public OptionalLong maxByInt(LongToIntFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, l) -> {
int key = keyExtractor.applyAsInt(l);
if (!box.b || box.i < key) {
box.b = true;
box.i = key;
box.l = l;
}
}, PrimitiveBox.MAX_INT).asLong();
} | [
"public",
"OptionalLong",
"maxByInt",
"(",
"LongToIntFunction",
"keyExtractor",
")",
"{",
"return",
"collect",
"(",
"PrimitiveBox",
"::",
"new",
",",
"(",
"box",
",",
"l",
")",
"->",
"{",
"int",
"key",
"=",
"keyExtractor",
".",
"applyAsInt",
"(",
"l",
")",... | Returns the maximum element of this stream according to the provided key
extractor function.
<p>
This is a terminal operation.
@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalLong} describing the first element of this
stream for which the highest value was returned by key extractor,
or an empty {@code OptionalLong} if the stream is empty
@since 0.1.2 | [
"Returns",
"the",
"maximum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"provided",
"key",
"extractor",
"function",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L1065-L1074 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/RandomUtils.java | RandomUtils.nextFloat | public static float nextFloat(final float startInclusive, final float endInclusive) {
Validate.isTrue(endInclusive >= startInclusive,
"Start value must be smaller or equal to end value.");
Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative.");
if (startInclusive == endInclusive) {
return startInclusive;
}
return startInclusive + ((endInclusive - startInclusive) * RANDOM.nextFloat());
} | java | public static float nextFloat(final float startInclusive, final float endInclusive) {
Validate.isTrue(endInclusive >= startInclusive,
"Start value must be smaller or equal to end value.");
Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative.");
if (startInclusive == endInclusive) {
return startInclusive;
}
return startInclusive + ((endInclusive - startInclusive) * RANDOM.nextFloat());
} | [
"public",
"static",
"float",
"nextFloat",
"(",
"final",
"float",
"startInclusive",
",",
"final",
"float",
"endInclusive",
")",
"{",
"Validate",
".",
"isTrue",
"(",
"endInclusive",
">=",
"startInclusive",
",",
"\"Start value must be smaller or equal to end value.\"",
")"... | <p>
Returns a random float within the specified range.
</p>
@param startInclusive
the smallest value that can be returned, must be non-negative
@param endInclusive
the upper bound (included)
@throws IllegalArgumentException
if {@code startInclusive > endInclusive} or if
{@code startInclusive} is negative
@return the random float | [
"<p",
">",
"Returns",
"a",
"random",
"float",
"within",
"the",
"specified",
"range",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/RandomUtils.java#L205-L215 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/source/extractor/watermark/DateWatermark.java | DateWatermark.adjustWatermark | public static long adjustWatermark(String baseWatermark, int diff) {
SimpleDateFormat parser = new SimpleDateFormat(INPUTFORMAT);
Date date = Utils.toDate(baseWatermark, INPUTFORMAT, OUTPUTFORMAT);
return Long.parseLong(parser.format(Utils.addDaysToDate(date, diff)));
} | java | public static long adjustWatermark(String baseWatermark, int diff) {
SimpleDateFormat parser = new SimpleDateFormat(INPUTFORMAT);
Date date = Utils.toDate(baseWatermark, INPUTFORMAT, OUTPUTFORMAT);
return Long.parseLong(parser.format(Utils.addDaysToDate(date, diff)));
} | [
"public",
"static",
"long",
"adjustWatermark",
"(",
"String",
"baseWatermark",
",",
"int",
"diff",
")",
"{",
"SimpleDateFormat",
"parser",
"=",
"new",
"SimpleDateFormat",
"(",
"INPUTFORMAT",
")",
";",
"Date",
"date",
"=",
"Utils",
".",
"toDate",
"(",
"baseWate... | Adjust the given watermark by diff
@param baseWatermark the original watermark
@param diff the amount to change
@return the adjusted watermark value | [
"Adjust",
"the",
"given",
"watermark",
"by",
"diff"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/watermark/DateWatermark.java#L162-L166 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | public static int importData(final DataSet dataset, final Connection conn, final String insertSQL,
final Try.BiConsumer<? super PreparedStatement, ? super Object[], SQLException> stmtSetter) throws UncheckedSQLException {
return importData(dataset, 0, dataset.size(), conn, insertSQL, stmtSetter);
} | java | public static int importData(final DataSet dataset, final Connection conn, final String insertSQL,
final Try.BiConsumer<? super PreparedStatement, ? super Object[], SQLException> stmtSetter) throws UncheckedSQLException {
return importData(dataset, 0, dataset.size(), conn, insertSQL, stmtSetter);
} | [
"public",
"static",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"Connection",
"conn",
",",
"final",
"String",
"insertSQL",
",",
"final",
"Try",
".",
"BiConsumer",
"<",
"?",
"super",
"PreparedStatement",
",",
"?",
"super",
"Object",
... | Imports the data from <code>DataSet</code> to database.
@param dataset
@param conn
@param insertSQL the column order in the sql must be consistent with the column order in the DataSet. Here is sample about how to create the sql:
<pre><code>
List<String> columnNameList = new ArrayList<>(dataset.columnNameList());
columnNameList.retainAll(yourSelectColumnNames);
String sql = RE.insert(columnNameList).into(tableName).sql();
</code></pre>
@param stmtSetter
@return
@throws UncheckedSQLException | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2081-L2084 |
netty/netty | transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueChannel.java | AbstractKQueueChannel.newDirectBuffer | protected final ByteBuf newDirectBuffer(Object holder, ByteBuf buf) {
final int readableBytes = buf.readableBytes();
if (readableBytes == 0) {
ReferenceCountUtil.release(holder);
return Unpooled.EMPTY_BUFFER;
}
final ByteBufAllocator alloc = alloc();
if (alloc.isDirectBufferPooled()) {
return newDirectBuffer0(holder, buf, alloc, readableBytes);
}
final ByteBuf directBuf = ByteBufUtil.threadLocalDirectBuffer();
if (directBuf == null) {
return newDirectBuffer0(holder, buf, alloc, readableBytes);
}
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(holder);
return directBuf;
} | java | protected final ByteBuf newDirectBuffer(Object holder, ByteBuf buf) {
final int readableBytes = buf.readableBytes();
if (readableBytes == 0) {
ReferenceCountUtil.release(holder);
return Unpooled.EMPTY_BUFFER;
}
final ByteBufAllocator alloc = alloc();
if (alloc.isDirectBufferPooled()) {
return newDirectBuffer0(holder, buf, alloc, readableBytes);
}
final ByteBuf directBuf = ByteBufUtil.threadLocalDirectBuffer();
if (directBuf == null) {
return newDirectBuffer0(holder, buf, alloc, readableBytes);
}
directBuf.writeBytes(buf, buf.readerIndex(), readableBytes);
ReferenceCountUtil.safeRelease(holder);
return directBuf;
} | [
"protected",
"final",
"ByteBuf",
"newDirectBuffer",
"(",
"Object",
"holder",
",",
"ByteBuf",
"buf",
")",
"{",
"final",
"int",
"readableBytes",
"=",
"buf",
".",
"readableBytes",
"(",
")",
";",
"if",
"(",
"readableBytes",
"==",
"0",
")",
"{",
"ReferenceCountUt... | Returns an off-heap copy of the specified {@link ByteBuf}, and releases the specified holder.
The caller must ensure that the holder releases the original {@link ByteBuf} when the holder is released by
this method. | [
"Returns",
"an",
"off",
"-",
"heap",
"copy",
"of",
"the",
"specified",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueChannel.java#L210-L230 |
Alluxio/alluxio | core/common/src/main/java/alluxio/grpc/GrpcServerBuilder.java | GrpcServerBuilder.forAddress | public static GrpcServerBuilder forAddress(String hostName, SocketAddress address,
AlluxioConfiguration conf) {
return new GrpcServerBuilder(hostName, address, null, conf);
} | java | public static GrpcServerBuilder forAddress(String hostName, SocketAddress address,
AlluxioConfiguration conf) {
return new GrpcServerBuilder(hostName, address, null, conf);
} | [
"public",
"static",
"GrpcServerBuilder",
"forAddress",
"(",
"String",
"hostName",
",",
"SocketAddress",
"address",
",",
"AlluxioConfiguration",
"conf",
")",
"{",
"return",
"new",
"GrpcServerBuilder",
"(",
"hostName",
",",
"address",
",",
"null",
",",
"conf",
")",
... | Create an new instance of {@link GrpcServerBuilder} with authentication support.
@param hostName the host name
@param address the address
@param conf Alluxio configuration
@return a new instance of {@link GrpcServerBuilder} | [
"Create",
"an",
"new",
"instance",
"of",
"{",
"@link",
"GrpcServerBuilder",
"}",
"with",
"authentication",
"support",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/grpc/GrpcServerBuilder.java#L74-L77 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRVertexBuffer.java | GVRVertexBuffer.setIntArray | public void setIntArray(String attributeName, int[] data)
{
if (!NativeVertexBuffer.setIntArray(getNative(), attributeName, data, 0, 0))
{
throw new IllegalArgumentException("Attribute name " + attributeName + " cannot be updated");
}
} | java | public void setIntArray(String attributeName, int[] data)
{
if (!NativeVertexBuffer.setIntArray(getNative(), attributeName, data, 0, 0))
{
throw new IllegalArgumentException("Attribute name " + attributeName + " cannot be updated");
}
} | [
"public",
"void",
"setIntArray",
"(",
"String",
"attributeName",
",",
"int",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"!",
"NativeVertexBuffer",
".",
"setIntArray",
"(",
"getNative",
"(",
")",
",",
"attributeName",
",",
"data",
",",
"0",
",",
"0",
")",
"... | Updates a vertex attribute from an integer array.
All of the entries of the input integer array are copied into
the storage for the named vertex attribute. Other vertex
attributes are not affected.
The attribute name must be one of the attributes named
in the descriptor passed to the constructor.
<p>
All vertex attributes have the same number of entries.
If this is the first attribute added to the vertex buffer,
the size of the input data array will determine the number of vertices.
Updating subsequent attributes will fail if the data array
size is not consistent. For example, if you create a vertex
buffer with descriptor "float3 a_position float2 a_texcoord"
and provide an array of 12 floats for "a_position" this will result in
a vertex count of 4. The corresponding data array for the
"a_texcoord" attribute should contain 8 floats.
@param attributeName name of the attribute to update
@param data integer array containing the new values
@throws IllegalArgumentException if attribute name not in descriptor or int array is wrong size | [
"Updates",
"a",
"vertex",
"attribute",
"from",
"an",
"integer",
"array",
".",
"All",
"of",
"the",
"entries",
"of",
"the",
"input",
"integer",
"array",
"are",
"copied",
"into",
"the",
"storage",
"for",
"the",
"named",
"vertex",
"attribute",
".",
"Other",
"v... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRVertexBuffer.java#L254-L260 |
undertow-io/undertow | core/src/main/java/io/undertow/server/HttpServerExchange.java | HttpServerExchange.getRequestChannel | public StreamSourceChannel getRequestChannel() {
if (requestChannel != null) {
if(anyAreSet(state, FLAG_REQUEST_RESET)) {
state &= ~FLAG_REQUEST_RESET;
return requestChannel;
}
return null;
}
if (anyAreSet(state, FLAG_REQUEST_TERMINATED)) {
return requestChannel = new ReadDispatchChannel(new ConduitStreamSourceChannel(Configurable.EMPTY, new EmptyStreamSourceConduit(getIoThread())));
}
final ConduitWrapper<StreamSourceConduit>[] wrappers = this.requestWrappers;
final ConduitStreamSourceChannel sourceChannel = connection.getSourceChannel();
if (wrappers != null) {
this.requestWrappers = null;
final WrapperConduitFactory<StreamSourceConduit> factory = new WrapperConduitFactory<>(wrappers, requestWrapperCount, sourceChannel.getConduit(), this);
sourceChannel.setConduit(factory.create());
}
return requestChannel = new ReadDispatchChannel(sourceChannel);
} | java | public StreamSourceChannel getRequestChannel() {
if (requestChannel != null) {
if(anyAreSet(state, FLAG_REQUEST_RESET)) {
state &= ~FLAG_REQUEST_RESET;
return requestChannel;
}
return null;
}
if (anyAreSet(state, FLAG_REQUEST_TERMINATED)) {
return requestChannel = new ReadDispatchChannel(new ConduitStreamSourceChannel(Configurable.EMPTY, new EmptyStreamSourceConduit(getIoThread())));
}
final ConduitWrapper<StreamSourceConduit>[] wrappers = this.requestWrappers;
final ConduitStreamSourceChannel sourceChannel = connection.getSourceChannel();
if (wrappers != null) {
this.requestWrappers = null;
final WrapperConduitFactory<StreamSourceConduit> factory = new WrapperConduitFactory<>(wrappers, requestWrapperCount, sourceChannel.getConduit(), this);
sourceChannel.setConduit(factory.create());
}
return requestChannel = new ReadDispatchChannel(sourceChannel);
} | [
"public",
"StreamSourceChannel",
"getRequestChannel",
"(",
")",
"{",
"if",
"(",
"requestChannel",
"!=",
"null",
")",
"{",
"if",
"(",
"anyAreSet",
"(",
"state",
",",
"FLAG_REQUEST_RESET",
")",
")",
"{",
"state",
"&=",
"~",
"FLAG_REQUEST_RESET",
";",
"return",
... | Get the inbound request. If there is no request body, calling this method
may cause the next request to immediately be processed. The {@link StreamSourceChannel#close()} or {@link StreamSourceChannel#shutdownReads()}
method must be called at some point after the request is processed to prevent resource leakage and to allow
the next request to proceed. Any unread content will be discarded.
@return the channel for the inbound request, or {@code null} if another party already acquired the channel | [
"Get",
"the",
"inbound",
"request",
".",
"If",
"there",
"is",
"no",
"request",
"body",
"calling",
"this",
"method",
"may",
"cause",
"the",
"next",
"request",
"to",
"immediately",
"be",
"processed",
".",
"The",
"{",
"@link",
"StreamSourceChannel#close",
"()",
... | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1194-L1213 |
SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java | MoreCollectors.uniqueIndex | public static <K, E> Collector<E, Map<K, E>, ImmutableMap<K, E>> uniqueIndex(Function<? super E, K> keyFunction) {
return uniqueIndex(keyFunction, Function.<E>identity());
} | java | public static <K, E> Collector<E, Map<K, E>, ImmutableMap<K, E>> uniqueIndex(Function<? super E, K> keyFunction) {
return uniqueIndex(keyFunction, Function.<E>identity());
} | [
"public",
"static",
"<",
"K",
",",
"E",
">",
"Collector",
"<",
"E",
",",
"Map",
"<",
"K",
",",
"E",
">",
",",
"ImmutableMap",
"<",
"K",
",",
"E",
">",
">",
"uniqueIndex",
"(",
"Function",
"<",
"?",
"super",
"E",
",",
"K",
">",
"keyFunction",
")... | Creates an {@link ImmutableMap} from the stream where the values are the values in the stream and the keys are the
result of the provided {@link Function keyFunction} applied to each value in the stream.
<p>
The {@link Function keyFunction} must return a unique (according to the key's type {@link Object#equals(Object)}
and/or {@link Comparable#compareTo(Object)} implementations) value for each of them, otherwise a
{@link IllegalArgumentException} will be thrown.
</p>
<p>
{@link Function keyFunction} can't return {@code null}, otherwise a {@link NullPointerException} will be thrown.
</p>
@throws NullPointerException if {@code keyFunction} is {@code null}.
@throws NullPointerException if result of {@code keyFunction} is {@code null}.
@throws IllegalArgumentException if {@code keyFunction} returns the same value for multiple entries in the stream. | [
"Creates",
"an",
"{",
"@link",
"ImmutableMap",
"}",
"from",
"the",
"stream",
"where",
"the",
"values",
"are",
"the",
"values",
"in",
"the",
"stream",
"and",
"the",
"keys",
"are",
"the",
"result",
"of",
"the",
"provided",
"{",
"@link",
"Function",
"keyFunct... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java#L186-L188 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java | JacksonDBCollection.getCount | public long getCount(T query, T fields, long limit, long skip) throws MongoException {
return dbCollection.getCount(convertToBasicDbObject(query), convertToBasicDbObject(fields), limit, skip);
} | java | public long getCount(T query, T fields, long limit, long skip) throws MongoException {
return dbCollection.getCount(convertToBasicDbObject(query), convertToBasicDbObject(fields), limit, skip);
} | [
"public",
"long",
"getCount",
"(",
"T",
"query",
",",
"T",
"fields",
",",
"long",
"limit",
",",
"long",
"skip",
")",
"throws",
"MongoException",
"{",
"return",
"dbCollection",
".",
"getCount",
"(",
"convertToBasicDbObject",
"(",
"query",
")",
",",
"convertTo... | Returns the number of documents in the collection
that match the specified query
@param query query to select documents to count
@param fields fields to return
@param limit limit the count to this value
@param skip number of entries to skip
@return number of documents that match query and fields
@throws MongoException If an error occurred | [
"Returns",
"the",
"number",
"of",
"documents",
"in",
"the",
"collection",
"that",
"match",
"the",
"specified",
"query"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L1150-L1152 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getCertificateAsync | public ServiceFuture<CertificateBundle> getCertificateAsync(String vaultBaseUrl, String certificateName, String certificateVersion, final ServiceCallback<CertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(getCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificateVersion), serviceCallback);
} | java | public ServiceFuture<CertificateBundle> getCertificateAsync(String vaultBaseUrl, String certificateName, String certificateVersion, final ServiceCallback<CertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(getCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificateVersion), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"CertificateBundle",
">",
"getCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"String",
"certificateVersion",
",",
"final",
"ServiceCallback",
"<",
"CertificateBundle",
">",
"serviceCallback",
")",
... | Gets information about a certificate.
Gets information about a specific certificate. This operation requires the certificates/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate in the given vault.
@param certificateVersion The version of the certificate.
@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",
"certificate",
".",
"Gets",
"information",
"about",
"a",
"specific",
"certificate",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"get",
"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#L7561-L7563 |
CleverTap/clevertap-android-sdk | clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DBAdapter.java | DBAdapter.deleteMessageForId | synchronized boolean deleteMessageForId(String messageId, String userId){
if(messageId == null || userId == null) return false;
final String tName = Table.INBOX_MESSAGES.getName();
try {
final SQLiteDatabase db = dbHelper.getWritableDatabase();
db.delete(tName, _ID + " = ? AND " + USER_ID + " = ?", new String[]{messageId,userId});
return true;
} catch (final SQLiteException e) {
getConfigLogger().verbose("Error removing stale records from " + tName, e);
return false;
} finally {
dbHelper.close();
}
} | java | synchronized boolean deleteMessageForId(String messageId, String userId){
if(messageId == null || userId == null) return false;
final String tName = Table.INBOX_MESSAGES.getName();
try {
final SQLiteDatabase db = dbHelper.getWritableDatabase();
db.delete(tName, _ID + " = ? AND " + USER_ID + " = ?", new String[]{messageId,userId});
return true;
} catch (final SQLiteException e) {
getConfigLogger().verbose("Error removing stale records from " + tName, e);
return false;
} finally {
dbHelper.close();
}
} | [
"synchronized",
"boolean",
"deleteMessageForId",
"(",
"String",
"messageId",
",",
"String",
"userId",
")",
"{",
"if",
"(",
"messageId",
"==",
"null",
"||",
"userId",
"==",
"null",
")",
"return",
"false",
";",
"final",
"String",
"tName",
"=",
"Table",
".",
... | Deletes the inbox message for given messageId
@param messageId String messageId
@return boolean value based on success of operation | [
"Deletes",
"the",
"inbox",
"message",
"for",
"given",
"messageId"
] | train | https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DBAdapter.java#L672-L687 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/SparseMatrix.java | SparseMatrix.eachNonZeroInRow | public void eachNonZeroInRow(int i, VectorProcedure procedure) {
VectorIterator it = nonZeroIteratorOfRow(i);
while (it.hasNext()) {
double x = it.next();
int j = it.index();
procedure.apply(j, x);
}
} | java | public void eachNonZeroInRow(int i, VectorProcedure procedure) {
VectorIterator it = nonZeroIteratorOfRow(i);
while (it.hasNext()) {
double x = it.next();
int j = it.index();
procedure.apply(j, x);
}
} | [
"public",
"void",
"eachNonZeroInRow",
"(",
"int",
"i",
",",
"VectorProcedure",
"procedure",
")",
"{",
"VectorIterator",
"it",
"=",
"nonZeroIteratorOfRow",
"(",
"i",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"double",
"x",
"=",
"it... | Applies the given {@code procedure} to each non-zero element of the specified row of this matrix.
@param i the row index.
@param procedure the {@link VectorProcedure}. | [
"Applies",
"the",
"given",
"{",
"@code",
"procedure",
"}",
"to",
"each",
"non",
"-",
"zero",
"element",
"of",
"the",
"specified",
"row",
"of",
"this",
"matrix",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L307-L315 |
dkpro/dkpro-argumentation | dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java | JCasUtil2.getPrecedingSentences | public static List<Sentence> getPrecedingSentences(JCas jCas, Sentence annotation)
{
List<Sentence> result = new ArrayList<Sentence>();
for (Sentence sentence : JCasUtil.select(getInitialView(jCas), Sentence.class)) {
if (sentence.getBegin() < annotation.getBegin()) {
result.add(sentence);
}
}
Collections.sort(result, new Comparator<Sentence>()
{
@Override public int compare(Sentence o1, Sentence o2)
{
return o2.getBegin() - o1.getBegin();
}
});
return result;
} | java | public static List<Sentence> getPrecedingSentences(JCas jCas, Sentence annotation)
{
List<Sentence> result = new ArrayList<Sentence>();
for (Sentence sentence : JCasUtil.select(getInitialView(jCas), Sentence.class)) {
if (sentence.getBegin() < annotation.getBegin()) {
result.add(sentence);
}
}
Collections.sort(result, new Comparator<Sentence>()
{
@Override public int compare(Sentence o1, Sentence o2)
{
return o2.getBegin() - o1.getBegin();
}
});
return result;
} | [
"public",
"static",
"List",
"<",
"Sentence",
">",
"getPrecedingSentences",
"(",
"JCas",
"jCas",
",",
"Sentence",
"annotation",
")",
"{",
"List",
"<",
"Sentence",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Sentence",
">",
"(",
")",
";",
"for",
"(",
"Se... | Returns a list of annotations of the same type preceding the given annotation
@param jCas jcas
@param annotation sentence
@return list of sentences sorted incrementally by position | [
"Returns",
"a",
"list",
"of",
"annotations",
"of",
"the",
"same",
"type",
"preceding",
"the",
"given",
"annotation"
] | train | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java#L408-L427 |
ops4j/org.ops4j.pax.logging | pax-logging-service/src/main/java/org/apache/log4j/rule/LikeRule.java | LikeRule.getRule | public static Rule getRule(final String field, final String pattern) {
try {
return new LikeRule(field, Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
} catch (PatternSyntaxException e) {
throw new IllegalArgumentException(
"Invalid LIKE rule - " + e.getMessage());
}
} | java | public static Rule getRule(final String field, final String pattern) {
try {
return new LikeRule(field, Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
} catch (PatternSyntaxException e) {
throw new IllegalArgumentException(
"Invalid LIKE rule - " + e.getMessage());
}
} | [
"public",
"static",
"Rule",
"getRule",
"(",
"final",
"String",
"field",
",",
"final",
"String",
"pattern",
")",
"{",
"try",
"{",
"return",
"new",
"LikeRule",
"(",
"field",
",",
"Pattern",
".",
"compile",
"(",
"pattern",
",",
"Pattern",
".",
"CASE_INSENSITI... | Create new instance.
@param field field
@param pattern pattern
@return new instance | [
"Create",
"new",
"instance",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rule/LikeRule.java#L100-L107 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/persist/HsqlProperties.java | HsqlProperties.addError | private void addError(int code, String key) {
errorCodes = (int[]) ArrayUtil.resizeArray(errorCodes,
errorCodes.length + 1);
errorKeys = (String[]) ArrayUtil.resizeArray(errorKeys,
errorKeys.length + 1);
errorCodes[errorCodes.length - 1] = code;
errorKeys[errorKeys.length - 1] = key;
} | java | private void addError(int code, String key) {
errorCodes = (int[]) ArrayUtil.resizeArray(errorCodes,
errorCodes.length + 1);
errorKeys = (String[]) ArrayUtil.resizeArray(errorKeys,
errorKeys.length + 1);
errorCodes[errorCodes.length - 1] = code;
errorKeys[errorKeys.length - 1] = key;
} | [
"private",
"void",
"addError",
"(",
"int",
"code",
",",
"String",
"key",
")",
"{",
"errorCodes",
"=",
"(",
"int",
"[",
"]",
")",
"ArrayUtil",
".",
"resizeArray",
"(",
"errorCodes",
",",
"errorCodes",
".",
"length",
"+",
"1",
")",
";",
"errorKeys",
"=",... | Adds the error code and the key to the list of errors. This list
is populated during construction or addition of elements and is used
outside this class to act upon the errors. | [
"Adds",
"the",
"error",
"code",
"and",
"the",
"key",
"to",
"the",
"list",
"of",
"errors",
".",
"This",
"list",
"is",
"populated",
"during",
"construction",
"or",
"addition",
"of",
"elements",
"and",
"is",
"used",
"outside",
"this",
"class",
"to",
"act",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/HsqlProperties.java#L315-L323 |
amplexus/java-flac-encoder | src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java | EncodedElement.addInt | public EncodedElement addInt(int input, int bitCount) {
if(next != null) {
EncodedElement end = EncodedElement.getEnd_S(next);
return end.addInt(input, bitCount);
}
else if(data.length*8 < usableBits+bitCount) {
//create child and attach to next.
//Set child's offset appropriately(i.e, manually set usable bits)
int tOff = usableBits %8;
//int size = data.length/2+1;
int size = 1000;
//guarantee that our new element can store our given value
//if(size <= bitCount+tOff) size = (size+tOff+bitCount)*10;
next = new EncodedElement(size, tOff);
System.err.println("creating next node of size:bitCount "+size+
":"+bitCount+":"+usableBits+":"+data.length);
System.err.println("value: "+input);
//+this.toString()+"::"+next.toString());
//add int to child
return next.addInt(input, bitCount);
}
else {
//At this point, we have the space, and we are the end of the chain.
int startPos = this.usableBits;
byte[] dest = this.data;
EncodedElement.addInt_new(input, bitCount, startPos, dest);
//EncodedElement.addInt_buf2(input, bitCount, startPos, dest);
/*if(startPos/8+8 > dest.length)
EncodedElement.addInt(input, bitCount, startPos, dest);
else
EncodedElement.addInt_new(input, bitCount, startPos, dest);*/
usableBits += bitCount;
return this;
}
} | java | public EncodedElement addInt(int input, int bitCount) {
if(next != null) {
EncodedElement end = EncodedElement.getEnd_S(next);
return end.addInt(input, bitCount);
}
else if(data.length*8 < usableBits+bitCount) {
//create child and attach to next.
//Set child's offset appropriately(i.e, manually set usable bits)
int tOff = usableBits %8;
//int size = data.length/2+1;
int size = 1000;
//guarantee that our new element can store our given value
//if(size <= bitCount+tOff) size = (size+tOff+bitCount)*10;
next = new EncodedElement(size, tOff);
System.err.println("creating next node of size:bitCount "+size+
":"+bitCount+":"+usableBits+":"+data.length);
System.err.println("value: "+input);
//+this.toString()+"::"+next.toString());
//add int to child
return next.addInt(input, bitCount);
}
else {
//At this point, we have the space, and we are the end of the chain.
int startPos = this.usableBits;
byte[] dest = this.data;
EncodedElement.addInt_new(input, bitCount, startPos, dest);
//EncodedElement.addInt_buf2(input, bitCount, startPos, dest);
/*if(startPos/8+8 > dest.length)
EncodedElement.addInt(input, bitCount, startPos, dest);
else
EncodedElement.addInt_new(input, bitCount, startPos, dest);*/
usableBits += bitCount;
return this;
}
} | [
"public",
"EncodedElement",
"addInt",
"(",
"int",
"input",
",",
"int",
"bitCount",
")",
"{",
"if",
"(",
"next",
"!=",
"null",
")",
"{",
"EncodedElement",
"end",
"=",
"EncodedElement",
".",
"getEnd_S",
"(",
"next",
")",
";",
"return",
"end",
".",
"addInt"... | Add a number of bits from an int to the end of this list's data. Will
add a new element if necessary. The bits stored are taken from the lower-
order of input.
@param input Int containing bits to append to end.
@param bitCount Number of bits to append.
@return EncodedElement which actually contains the appended value. | [
"Add",
"a",
"number",
"of",
"bits",
"from",
"an",
"int",
"to",
"the",
"end",
"of",
"this",
"list",
"s",
"data",
".",
"Will",
"add",
"a",
"new",
"element",
"if",
"necessary",
".",
"The",
"bits",
"stored",
"are",
"taken",
"from",
"the",
"lower",
"-",
... | train | https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/EncodedElement.java#L326-L360 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.replaceFirst | public StrBuilder replaceFirst(final StrMatcher matcher, final String replaceStr) {
return replace(matcher, replaceStr, 0, size, 1);
} | java | public StrBuilder replaceFirst(final StrMatcher matcher, final String replaceStr) {
return replace(matcher, replaceStr, 0, size, 1);
} | [
"public",
"StrBuilder",
"replaceFirst",
"(",
"final",
"StrMatcher",
"matcher",
",",
"final",
"String",
"replaceStr",
")",
"{",
"return",
"replace",
"(",
"matcher",
",",
"replaceStr",
",",
"0",
",",
"size",
",",
"1",
")",
";",
"}"
] | Replaces the first match within the builder with the replace string.
<p>
Matchers can be used to perform advanced replace behaviour.
For example you could write a matcher to replace
where the character 'a' is followed by a number.
@param matcher the matcher to use to find the deletion, null causes no action
@param replaceStr the replace string, null is equivalent to an empty string
@return this, to enable chaining | [
"Replaces",
"the",
"first",
"match",
"within",
"the",
"builder",
"with",
"the",
"replace",
"string",
".",
"<p",
">",
"Matchers",
"can",
"be",
"used",
"to",
"perform",
"advanced",
"replace",
"behaviour",
".",
"For",
"example",
"you",
"could",
"write",
"a",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2065-L2067 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.classesAbsent | public static void classesAbsent(String fieldName,Class<?> aClass){
throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorRelationalException2,fieldName, aClass.getSimpleName()));
} | java | public static void classesAbsent(String fieldName,Class<?> aClass){
throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorRelationalException2,fieldName, aClass.getSimpleName()));
} | [
"public",
"static",
"void",
"classesAbsent",
"(",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"throw",
"new",
"MappingErrorException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"mappingErrorRelationalException2",
",",
"fieldNa... | Thrown if the configured field hasn't classes parameter.
@param fieldName name of the field
@param aClass class's field | [
"Thrown",
"if",
"the",
"configured",
"field",
"hasn",
"t",
"classes",
"parameter",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L558-L560 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java | CollectionUtil.subArray | @SuppressWarnings({"SuspiciousSystemArraycopy"})
public static Object subArray(Object pArray, int pStart, int pLength) {
Validate.notNull(pArray, "array");
// Get component type
Class type;
// Sanity check start index
if (pStart < 0) {
throw new ArrayIndexOutOfBoundsException(pStart + " < 0");
}
// Check if argument is array
else if ((type = pArray.getClass().getComponentType()) == null) {
// NOTE: No need to test class.isArray(), really
throw new IllegalArgumentException("Not an array: " + pArray);
}
// Store original length
int originalLength = Array.getLength(pArray);
// Find new length, stay within bounds
int newLength = (pLength < 0)
? Math.max(0, originalLength - pStart)
: Math.min(pLength, Math.max(0, originalLength - pStart));
// Store result
Object result;
if (newLength < originalLength) {
// Create sub array & copy into
result = Array.newInstance(type, newLength);
System.arraycopy(pArray, pStart, result, 0, newLength);
}
else {
// Just return original array
// NOTE: This can ONLY happen if pStart == 0
result = pArray;
}
// Return
return result;
} | java | @SuppressWarnings({"SuspiciousSystemArraycopy"})
public static Object subArray(Object pArray, int pStart, int pLength) {
Validate.notNull(pArray, "array");
// Get component type
Class type;
// Sanity check start index
if (pStart < 0) {
throw new ArrayIndexOutOfBoundsException(pStart + " < 0");
}
// Check if argument is array
else if ((type = pArray.getClass().getComponentType()) == null) {
// NOTE: No need to test class.isArray(), really
throw new IllegalArgumentException("Not an array: " + pArray);
}
// Store original length
int originalLength = Array.getLength(pArray);
// Find new length, stay within bounds
int newLength = (pLength < 0)
? Math.max(0, originalLength - pStart)
: Math.min(pLength, Math.max(0, originalLength - pStart));
// Store result
Object result;
if (newLength < originalLength) {
// Create sub array & copy into
result = Array.newInstance(type, newLength);
System.arraycopy(pArray, pStart, result, 0, newLength);
}
else {
// Just return original array
// NOTE: This can ONLY happen if pStart == 0
result = pArray;
}
// Return
return result;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"SuspiciousSystemArraycopy\"",
"}",
")",
"public",
"static",
"Object",
"subArray",
"(",
"Object",
"pArray",
",",
"int",
"pStart",
",",
"int",
"pLength",
")",
"{",
"Validate",
".",
"notNull",
"(",
"pArray",
",",
"\"array\"",... | Creates an array containing a subset of the original array.
If the {@code pLength} parameter is negative, it will be ignored.
If there are not {@code pLength} elements in the original array
after {@code pStart}, the {@code pLength} parameter will be
ignored.
If the sub array is same length as the original, the original array will
be returned.
@param pArray the original array
@param pStart the start index of the original array
@param pLength the length of the new array
@return a subset of the original array, or the original array itself,
if {@code pStart} is 0 and {@code pLength} is either
negative, or greater or equal to {@code pArray.length}.
@throws IllegalArgumentException if {@code pArray} is {@code null} or
if {@code pArray} is not an array.
@throws ArrayIndexOutOfBoundsException if {@code pStart} < 0 | [
"Creates",
"an",
"array",
"containing",
"a",
"subset",
"of",
"the",
"original",
"array",
".",
"If",
"the",
"{",
"@code",
"pLength",
"}",
"parameter",
"is",
"negative",
"it",
"will",
"be",
"ignored",
".",
"If",
"there",
"are",
"not",
"{",
"@code",
"pLengt... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java#L314-L355 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java | GVRRigidBody.setAngularVelocity | public void setAngularVelocity(float x, float y, float z) {
Native3DRigidBody.setAngularVelocity(getNative(), x, y, z);
} | java | public void setAngularVelocity(float x, float y, float z) {
Native3DRigidBody.setAngularVelocity(getNative(), x, y, z);
} | [
"public",
"void",
"setAngularVelocity",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"Native3DRigidBody",
".",
"setAngularVelocity",
"(",
"getNative",
"(",
")",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"}"
] | Sets an angular velocity [X, Y, Z] on this {@linkplain GVRRigidBody rigid body}
@param x factor on the 'X' axis.
@param y factor on the 'Y' axis.
@param z factor on the 'Z' axis. | [
"Sets",
"an",
"angular",
"velocity",
"[",
"X",
"Y",
"Z",
"]",
"on",
"this",
"{",
"@linkplain",
"GVRRigidBody",
"rigid",
"body",
"}"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java#L319-L321 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java | AccountsInner.listAsync | public Observable<Page<DataLakeAnalyticsAccountBasicInner>> listAsync(final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) {
return listWithServiceResponseAsync(filter, top, skip, select, orderby, count)
.map(new Func1<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>, Page<DataLakeAnalyticsAccountBasicInner>>() {
@Override
public Page<DataLakeAnalyticsAccountBasicInner> call(ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DataLakeAnalyticsAccountBasicInner>> listAsync(final String filter, final Integer top, final Integer skip, final String select, final String orderby, final Boolean count) {
return listWithServiceResponseAsync(filter, top, skip, select, orderby, count)
.map(new Func1<ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>>, Page<DataLakeAnalyticsAccountBasicInner>>() {
@Override
public Page<DataLakeAnalyticsAccountBasicInner> call(ServiceResponse<Page<DataLakeAnalyticsAccountBasicInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DataLakeAnalyticsAccountBasicInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"filter",
",",
"final",
"Integer",
"top",
",",
"final",
"Integer",
"skip",
",",
"final",
"String",
"select",
",",
"final",
"String",
... | Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any.
@param filter OData filter. Optional.
@param top The number of items to return. Optional.
@param skip The number of items to skip over before returning elements. Optional.
@param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional.
@param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional.
@param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DataLakeAnalyticsAccountBasicInner> object | [
"Gets",
"the",
"first",
"page",
"of",
"Data",
"Lake",
"Analytics",
"accounts",
"if",
"any",
"within",
"the",
"current",
"subscription",
".",
"This",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java#L289-L297 |
adessoAG/wicked-charts | highcharts-wrapper/src/main/java/de/adesso/wickedcharts/highcharts/options/util/OptionsUtil.java | OptionsUtil.getSeriesIndex | public static int getSeriesIndex(final Options options, final int wickedChartsId) {
int index = 0;
if (options.getSeries() == null) {
throw new IllegalStateException("The given Options object does not contain any series!");
}
for (Series<?> series : options.getSeries()) {
if (series.getWickedChartsId() == wickedChartsId) {
return index;
}
index++;
}
return 0;
} | java | public static int getSeriesIndex(final Options options, final int wickedChartsId) {
int index = 0;
if (options.getSeries() == null) {
throw new IllegalStateException("The given Options object does not contain any series!");
}
for (Series<?> series : options.getSeries()) {
if (series.getWickedChartsId() == wickedChartsId) {
return index;
}
index++;
}
return 0;
} | [
"public",
"static",
"int",
"getSeriesIndex",
"(",
"final",
"Options",
"options",
",",
"final",
"int",
"wickedChartsId",
")",
"{",
"int",
"index",
"=",
"0",
";",
"if",
"(",
"options",
".",
"getSeries",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"... | Returns the (0-based) index of the series with the given wickedChartsId or
null.
@param options the options in which to search
@param wickedChartsId the wickedChartsId of the series
@return the index of the series with the given id. Returns 0 if no series
was found. | [
"Returns",
"the",
"(",
"0",
"-",
"based",
")",
"index",
"of",
"the",
"series",
"with",
"the",
"given",
"wickedChartsId",
"or",
"null",
"."
] | train | https://github.com/adessoAG/wicked-charts/blob/498aceff025f612e22ba5135b26531afeabac03c/highcharts-wrapper/src/main/java/de/adesso/wickedcharts/highcharts/options/util/OptionsUtil.java#L231-L243 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java | ArtFinder.deliverAlbumArtUpdate | private void deliverAlbumArtUpdate(int player, AlbumArt art) {
if (!getAlbumArtListeners().isEmpty()) {
final AlbumArtUpdate update = new AlbumArtUpdate(player, art);
for (final AlbumArtListener listener : getAlbumArtListeners()) {
try {
listener.albumArtChanged(update);
} catch (Throwable t) {
logger.warn("Problem delivering album art update to listener", t);
}
}
}
} | java | private void deliverAlbumArtUpdate(int player, AlbumArt art) {
if (!getAlbumArtListeners().isEmpty()) {
final AlbumArtUpdate update = new AlbumArtUpdate(player, art);
for (final AlbumArtListener listener : getAlbumArtListeners()) {
try {
listener.albumArtChanged(update);
} catch (Throwable t) {
logger.warn("Problem delivering album art update to listener", t);
}
}
}
} | [
"private",
"void",
"deliverAlbumArtUpdate",
"(",
"int",
"player",
",",
"AlbumArt",
"art",
")",
"{",
"if",
"(",
"!",
"getAlbumArtListeners",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"AlbumArtUpdate",
"update",
"=",
"new",
"AlbumArtUpdate",
"(",
... | Send an album art update announcement to all registered listeners. | [
"Send",
"an",
"album",
"art",
"update",
"announcement",
"to",
"all",
"registered",
"listeners",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java#L450-L462 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.line_offer_phones_GET | public ArrayList<OvhLinePhone> line_offer_phones_GET(OvhNumberCountryEnum country, String offer) throws IOException {
String qPath = "/telephony/line/offer/phones";
StringBuilder sb = path(qPath);
query(sb, "country", country);
query(sb, "offer", offer);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | java | public ArrayList<OvhLinePhone> line_offer_phones_GET(OvhNumberCountryEnum country, String offer) throws IOException {
String qPath = "/telephony/line/offer/phones";
StringBuilder sb = path(qPath);
query(sb, "country", country);
query(sb, "offer", offer);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | [
"public",
"ArrayList",
"<",
"OvhLinePhone",
">",
"line_offer_phones_GET",
"(",
"OvhNumberCountryEnum",
"country",
",",
"String",
"offer",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/line/offer/phones\"",
";",
"StringBuilder",
"sb",
"=",
"p... | Get all available phone brands compatible with lines
REST: GET /telephony/line/offer/phones
@param offer [required] The selected offer
@param country [required] The country | [
"Get",
"all",
"available",
"phone",
"brands",
"compatible",
"with",
"lines"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8866-L8873 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java | CheckpointCoordinator.failUnacknowledgedPendingCheckpointsFor | public void failUnacknowledgedPendingCheckpointsFor(ExecutionAttemptID executionAttemptId, Throwable cause) {
synchronized (lock) {
Iterator<PendingCheckpoint> pendingCheckpointIterator = pendingCheckpoints.values().iterator();
while (pendingCheckpointIterator.hasNext()) {
final PendingCheckpoint pendingCheckpoint = pendingCheckpointIterator.next();
if (!pendingCheckpoint.isAcknowledgedBy(executionAttemptId)) {
pendingCheckpointIterator.remove();
discardCheckpoint(pendingCheckpoint, cause);
}
}
}
} | java | public void failUnacknowledgedPendingCheckpointsFor(ExecutionAttemptID executionAttemptId, Throwable cause) {
synchronized (lock) {
Iterator<PendingCheckpoint> pendingCheckpointIterator = pendingCheckpoints.values().iterator();
while (pendingCheckpointIterator.hasNext()) {
final PendingCheckpoint pendingCheckpoint = pendingCheckpointIterator.next();
if (!pendingCheckpoint.isAcknowledgedBy(executionAttemptId)) {
pendingCheckpointIterator.remove();
discardCheckpoint(pendingCheckpoint, cause);
}
}
}
} | [
"public",
"void",
"failUnacknowledgedPendingCheckpointsFor",
"(",
"ExecutionAttemptID",
"executionAttemptId",
",",
"Throwable",
"cause",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"Iterator",
"<",
"PendingCheckpoint",
">",
"pendingCheckpointIterator",
"=",
"pendingC... | Fails all pending checkpoints which have not been acknowledged by the given execution
attempt id.
@param executionAttemptId for which to discard unacknowledged pending checkpoints
@param cause of the failure | [
"Fails",
"all",
"pending",
"checkpoints",
"which",
"have",
"not",
"been",
"acknowledged",
"by",
"the",
"given",
"execution",
"attempt",
"id",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L964-L977 |
VoltDB/voltdb | src/frontend/org/voltdb/plannodes/PlanNodeTree.java | PlanNodeTree.loadFromJSONPlan | public void loadFromJSONPlan(JSONObject jobj, Database db) throws JSONException {
if (jobj.has(Members.PLAN_NODES_LISTS)) {
JSONArray jplanNodesArray = jobj.getJSONArray(Members.PLAN_NODES_LISTS);
for (int i = 0; i < jplanNodesArray.length(); ++i) {
JSONObject jplanNodesObj = jplanNodesArray.getJSONObject(i);
JSONArray jplanNodes = jplanNodesObj.getJSONArray(Members.PLAN_NODES);
int stmtId = jplanNodesObj.getInt(Members.STATEMENT_ID);
loadPlanNodesFromJSONArrays(stmtId, jplanNodes, db);
}
}
else {
// There is only one statement in the plan. Its id is set to 0 by default
int stmtId = 0;
JSONArray jplanNodes = jobj.getJSONArray(Members.PLAN_NODES);
loadPlanNodesFromJSONArrays(stmtId, jplanNodes, db);
}
// Connect the parent and child statements
for (List<AbstractPlanNode> nextPlanNodes : m_planNodesListMap.values()) {
for (AbstractPlanNode node : nextPlanNodes) {
connectNodesIfNecessary(node);
}
}
} | java | public void loadFromJSONPlan(JSONObject jobj, Database db) throws JSONException {
if (jobj.has(Members.PLAN_NODES_LISTS)) {
JSONArray jplanNodesArray = jobj.getJSONArray(Members.PLAN_NODES_LISTS);
for (int i = 0; i < jplanNodesArray.length(); ++i) {
JSONObject jplanNodesObj = jplanNodesArray.getJSONObject(i);
JSONArray jplanNodes = jplanNodesObj.getJSONArray(Members.PLAN_NODES);
int stmtId = jplanNodesObj.getInt(Members.STATEMENT_ID);
loadPlanNodesFromJSONArrays(stmtId, jplanNodes, db);
}
}
else {
// There is only one statement in the plan. Its id is set to 0 by default
int stmtId = 0;
JSONArray jplanNodes = jobj.getJSONArray(Members.PLAN_NODES);
loadPlanNodesFromJSONArrays(stmtId, jplanNodes, db);
}
// Connect the parent and child statements
for (List<AbstractPlanNode> nextPlanNodes : m_planNodesListMap.values()) {
for (AbstractPlanNode node : nextPlanNodes) {
connectNodesIfNecessary(node);
}
}
} | [
"public",
"void",
"loadFromJSONPlan",
"(",
"JSONObject",
"jobj",
",",
"Database",
"db",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"jobj",
".",
"has",
"(",
"Members",
".",
"PLAN_NODES_LISTS",
")",
")",
"{",
"JSONArray",
"jplanNodesArray",
"=",
"jobj",
"... | Load json plan. The plan must have either "PLAN_NODE" array in case of a statement without
subqueries or "PLAN_NODES_LISTS" array of "PLAN_NODE" arrays for each sub statement.
@param jobj
@param db
@throws JSONException | [
"Load",
"json",
"plan",
".",
"The",
"plan",
"must",
"have",
"either",
"PLAN_NODE",
"array",
"in",
"case",
"of",
"a",
"statement",
"without",
"subqueries",
"or",
"PLAN_NODES_LISTS",
"array",
"of",
"PLAN_NODE",
"arrays",
"for",
"each",
"sub",
"statement",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/PlanNodeTree.java#L133-L156 |
radkovo/SwingBox | src/main/java/org/fit/cssbox/swingbox/util/DefaultHyperlinkHandler.java | DefaultHyperlinkHandler.loadPage | protected void loadPage(JEditorPane pane, HyperlinkEvent evt)
{
// if some security, or other interaction is needed, override this
// method
try
{
pane.setPage(evt.getURL());
} catch (IOException e)
{
System.err.println(e.getLocalizedMessage());
}
} | java | protected void loadPage(JEditorPane pane, HyperlinkEvent evt)
{
// if some security, or other interaction is needed, override this
// method
try
{
pane.setPage(evt.getURL());
} catch (IOException e)
{
System.err.println(e.getLocalizedMessage());
}
} | [
"protected",
"void",
"loadPage",
"(",
"JEditorPane",
"pane",
",",
"HyperlinkEvent",
"evt",
")",
"{",
"// if some security, or other interaction is needed, override this",
"// method",
"try",
"{",
"pane",
".",
"setPage",
"(",
"evt",
".",
"getURL",
"(",
")",
")",
";",... | Loads given page as HyperlinkEvent.
@param pane
the pane
@param evt
the event | [
"Loads",
"given",
"page",
"as",
"HyperlinkEvent",
"."
] | train | https://github.com/radkovo/SwingBox/blob/ff370f3dc54d248e4c8852c17513618c83c25984/src/main/java/org/fit/cssbox/swingbox/util/DefaultHyperlinkHandler.java#L67-L78 |
tobykurien/Xtendroid | Xtendroid/src/asia/sonix/android/orm/AbatisService.java | AbatisService.getInstance | protected static AbatisService getInstance(Context context, String dbName, int version) {
if (instance == null) {
instance = new AbatisService(context, dbName, version);
}
return instance;
} | java | protected static AbatisService getInstance(Context context, String dbName, int version) {
if (instance == null) {
instance = new AbatisService(context, dbName, version);
}
return instance;
} | [
"protected",
"static",
"AbatisService",
"getInstance",
"(",
"Context",
"context",
",",
"String",
"dbName",
",",
"int",
"version",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"instance",
"=",
"new",
"AbatisService",
"(",
"context",
",",
"dbName",... | 指定DB file nameを利用する外部Constructor
@param context
呼び出し元Contextオブジェクト
@param dbName
生成するDB file name | [
"指定DB",
"file",
"nameを利用する外部Constructor"
] | train | https://github.com/tobykurien/Xtendroid/blob/758bf1d06f4cf3b64f9c10632fe9c6fb30bcebd4/Xtendroid/src/asia/sonix/android/orm/AbatisService.java#L137-L142 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/internal/instantiation/InstantiatorProvider.java | InstantiatorProvider.implicitInstantiatorFrom | private @NotNull <T> Optional<Instantiator<T>> implicitInstantiatorFrom(@NotNull Constructor<T> constructor, @NotNull NamedTypeList types) {
if (!isPublic(constructor.getModifiers()))
return Optional.empty();
List<String> columnNames = types.getNames();
return findTargetTypes(constructor, columnNames)
.flatMap(targetTypes -> resolveConversions(types, targetTypes)
.map(conversions -> new ReflectionInstantiator<>(constructor, conversions, createPropertyAccessorsForValuesNotCoveredByConstructor(constructor, columnNames))));
} | java | private @NotNull <T> Optional<Instantiator<T>> implicitInstantiatorFrom(@NotNull Constructor<T> constructor, @NotNull NamedTypeList types) {
if (!isPublic(constructor.getModifiers()))
return Optional.empty();
List<String> columnNames = types.getNames();
return findTargetTypes(constructor, columnNames)
.flatMap(targetTypes -> resolveConversions(types, targetTypes)
.map(conversions -> new ReflectionInstantiator<>(constructor, conversions, createPropertyAccessorsForValuesNotCoveredByConstructor(constructor, columnNames))));
} | [
"private",
"@",
"NotNull",
"<",
"T",
">",
"Optional",
"<",
"Instantiator",
"<",
"T",
">",
">",
"implicitInstantiatorFrom",
"(",
"@",
"NotNull",
"Constructor",
"<",
"T",
">",
"constructor",
",",
"@",
"NotNull",
"NamedTypeList",
"types",
")",
"{",
"if",
"(",... | Returns an instantiator that uses given constructor and given types to create instances,
or empty if there are no conversions that can be made to instantiate the type. | [
"Returns",
"an",
"instantiator",
"that",
"uses",
"given",
"constructor",
"and",
"given",
"types",
"to",
"create",
"instances",
"or",
"empty",
"if",
"there",
"are",
"no",
"conversions",
"that",
"can",
"be",
"made",
"to",
"instantiate",
"the",
"type",
"."
] | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/internal/instantiation/InstantiatorProvider.java#L152-L160 |
craftercms/deployer | src/main/java/org/craftercms/deployer/utils/ConfigUtils.java | ConfigUtils.getStringArrayProperty | public static String[] getStringArrayProperty(Configuration config,
String key) throws DeployerConfigurationException {
try {
return config.getStringArray(key);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e);
}
} | java | public static String[] getStringArrayProperty(Configuration config,
String key) throws DeployerConfigurationException {
try {
return config.getStringArray(key);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e);
}
} | [
"public",
"static",
"String",
"[",
"]",
"getStringArrayProperty",
"(",
"Configuration",
"config",
",",
"String",
"key",
")",
"throws",
"DeployerConfigurationException",
"{",
"try",
"{",
"return",
"config",
".",
"getStringArray",
"(",
"key",
")",
";",
"}",
"catch... | Returns the specified String array property from the configuration. A String array property is normally
specified as
a String with values separated by commas in the configuration.
@param config the configuration
@param key the key of the property
@return the String array value of the property, or null if not found
@throws DeployerConfigurationException if an error occurred | [
"Returns",
"the",
"specified",
"String",
"array",
"property",
"from",
"the",
"configuration",
".",
"A",
"String",
"array",
"property",
"is",
"normally",
"specified",
"as",
"a",
"String",
"with",
"values",
"separated",
"by",
"commas",
"in",
"the",
"configuration"... | train | https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L232-L239 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java | CoverageDataCore.getUnsignedPixelValue | public int getUnsignedPixelValue(GriddedTile griddedTile, Double value) {
int unsignedPixelValue = 0;
if (value == null) {
if (griddedCoverage != null) {
unsignedPixelValue = griddedCoverage.getDataNull().intValue();
}
} else {
double pixelValue = valueToPixelValue(griddedTile, value);
unsignedPixelValue = (int) Math.round(pixelValue);
}
return unsignedPixelValue;
} | java | public int getUnsignedPixelValue(GriddedTile griddedTile, Double value) {
int unsignedPixelValue = 0;
if (value == null) {
if (griddedCoverage != null) {
unsignedPixelValue = griddedCoverage.getDataNull().intValue();
}
} else {
double pixelValue = valueToPixelValue(griddedTile, value);
unsignedPixelValue = (int) Math.round(pixelValue);
}
return unsignedPixelValue;
} | [
"public",
"int",
"getUnsignedPixelValue",
"(",
"GriddedTile",
"griddedTile",
",",
"Double",
"value",
")",
"{",
"int",
"unsignedPixelValue",
"=",
"0",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"if",
"(",
"griddedCoverage",
"!=",
"null",
")",
"{",
"un... | Get the unsigned 16 bit integer pixel value of the coverage data value
@param griddedTile
gridded tile
@param value
coverage data value
@return 16 bit integer pixel value | [
"Get",
"the",
"unsigned",
"16",
"bit",
"integer",
"pixel",
"value",
"of",
"the",
"coverage",
"data",
"value"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1544-L1558 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java | ByteArrayUtil.writeUnsignedVarint | public static void writeUnsignedVarint(ByteBuffer buffer, int val) {
// Extra bytes have the high bit set
while((val & 0x7F) != val) {
buffer.put((byte) ((val & 0x7F) | 0x80));
val >>>= 7;
}
// Last byte doesn't have high bit set
buffer.put((byte) (val & 0x7F));
} | java | public static void writeUnsignedVarint(ByteBuffer buffer, int val) {
// Extra bytes have the high bit set
while((val & 0x7F) != val) {
buffer.put((byte) ((val & 0x7F) | 0x80));
val >>>= 7;
}
// Last byte doesn't have high bit set
buffer.put((byte) (val & 0x7F));
} | [
"public",
"static",
"void",
"writeUnsignedVarint",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"val",
")",
"{",
"// Extra bytes have the high bit set",
"while",
"(",
"(",
"val",
"&",
"0x7F",
")",
"!=",
"val",
")",
"{",
"buffer",
".",
"put",
"(",
"(",
"byte",
... | Write an unsigned integer using a variable-length encoding.
Data is always written in 7-bit little-endian, where the 8th bit is the
continuation flag.
@param buffer Buffer to write to
@param val number to write | [
"Write",
"an",
"unsigned",
"integer",
"using",
"a",
"variable",
"-",
"length",
"encoding",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ByteArrayUtil.java#L647-L655 |
SteelBridgeLabs/neo4j-gremlin-bolt | src/main/java/com/steelbridgelabs/oss/neo4j/structure/providers/DatabaseSequenceElementIdProvider.java | DatabaseSequenceElementIdProvider.processIdentifier | @Override
public Long processIdentifier(Object id) {
Objects.requireNonNull(id, "Element identifier cannot be null");
// check for Long
if (id instanceof Long)
return (Long)id;
// check for numeric types
if (id instanceof Number)
return ((Number)id).longValue();
// check for string
if (id instanceof String)
return Long.valueOf((String)id);
// error
throw new IllegalArgumentException(String.format("Expected an id that is convertible to Long but received %s", id.getClass()));
} | java | @Override
public Long processIdentifier(Object id) {
Objects.requireNonNull(id, "Element identifier cannot be null");
// check for Long
if (id instanceof Long)
return (Long)id;
// check for numeric types
if (id instanceof Number)
return ((Number)id).longValue();
// check for string
if (id instanceof String)
return Long.valueOf((String)id);
// error
throw new IllegalArgumentException(String.format("Expected an id that is convertible to Long but received %s", id.getClass()));
} | [
"@",
"Override",
"public",
"Long",
"processIdentifier",
"(",
"Object",
"id",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"id",
",",
"\"Element identifier cannot be null\"",
")",
";",
"// check for Long",
"if",
"(",
"id",
"instanceof",
"Long",
")",
"return",
... | Process the given identifier converting it to the correct type if necessary.
@param id The {@link org.apache.tinkerpop.gremlin.structure.Element} identifier.
@return The {@link org.apache.tinkerpop.gremlin.structure.Element} identifier converted to the correct type if necessary. | [
"Process",
"the",
"given",
"identifier",
"converting",
"it",
"to",
"the",
"correct",
"type",
"if",
"necessary",
"."
] | train | https://github.com/SteelBridgeLabs/neo4j-gremlin-bolt/blob/df3ab429e0c83affae6cd43d41edd90de80c032e/src/main/java/com/steelbridgelabs/oss/neo4j/structure/providers/DatabaseSequenceElementIdProvider.java#L173-L187 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_PUT | public void serviceName_datacenter_datacenterId_PUT(String serviceName, Long datacenterId, OvhDatacenter body) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}";
StringBuilder sb = path(qPath, serviceName, datacenterId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_datacenter_datacenterId_PUT(String serviceName, Long datacenterId, OvhDatacenter body) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}";
StringBuilder sb = path(qPath, serviceName, datacenterId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_datacenter_datacenterId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
",",
"OvhDatacenter",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/datacenter/{datacenterId}\"",
";",... | Alter this object properties
REST: PUT /dedicatedCloud/{serviceName}/datacenter/{datacenterId}
@param body [required] New object properties
@param serviceName [required] Domain of the service
@param datacenterId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1944-L1948 |
Jasig/uPortal | uPortal-rendering/src/main/java/org/apereo/portal/url/UrlSyntaxProviderImpl.java | UrlSyntaxProviderImpl.determineUrlState | protected UrlState determineUrlState(
final IPortletWindow portletWindow,
final IPortletUrlBuilder targetedPortletUrlBuilder) {
final WindowState requestedWindowState;
if (targetedPortletUrlBuilder == null) {
requestedWindowState = null;
} else {
requestedWindowState = targetedPortletUrlBuilder.getWindowState();
}
return determineUrlState(portletWindow, requestedWindowState);
} | java | protected UrlState determineUrlState(
final IPortletWindow portletWindow,
final IPortletUrlBuilder targetedPortletUrlBuilder) {
final WindowState requestedWindowState;
if (targetedPortletUrlBuilder == null) {
requestedWindowState = null;
} else {
requestedWindowState = targetedPortletUrlBuilder.getWindowState();
}
return determineUrlState(portletWindow, requestedWindowState);
} | [
"protected",
"UrlState",
"determineUrlState",
"(",
"final",
"IPortletWindow",
"portletWindow",
",",
"final",
"IPortletUrlBuilder",
"targetedPortletUrlBuilder",
")",
"{",
"final",
"WindowState",
"requestedWindowState",
";",
"if",
"(",
"targetedPortletUrlBuilder",
"==",
"null... | Determine the {@link UrlState} to use for the targeted portlet window | [
"Determine",
"the",
"{"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-rendering/src/main/java/org/apereo/portal/url/UrlSyntaxProviderImpl.java#L1402-L1413 |
h2oai/h2o-3 | h2o-automl/src/main/java/ai/h2o/automl/AutoML.java | AutoML.startAutoML | public static void startAutoML(AutoML aml) {
// Currently AutoML can only run one job at a time
if (aml.job == null || !aml.job.isRunning()) {
H2OJob j = new H2OJob(aml, aml._key, aml.runCountdown.remainingTime());
aml.job = j._job;
j.start(aml.workAllocations.remainingWork());
DKV.put(aml);
}
} | java | public static void startAutoML(AutoML aml) {
// Currently AutoML can only run one job at a time
if (aml.job == null || !aml.job.isRunning()) {
H2OJob j = new H2OJob(aml, aml._key, aml.runCountdown.remainingTime());
aml.job = j._job;
j.start(aml.workAllocations.remainingWork());
DKV.put(aml);
}
} | [
"public",
"static",
"void",
"startAutoML",
"(",
"AutoML",
"aml",
")",
"{",
"// Currently AutoML can only run one job at a time",
"if",
"(",
"aml",
".",
"job",
"==",
"null",
"||",
"!",
"aml",
".",
"job",
".",
"isRunning",
"(",
")",
")",
"{",
"H2OJob",
"j",
... | Takes in an AutoML instance and starts running it. Progress can be tracked via its job().
@param aml
@return | [
"Takes",
"in",
"an",
"AutoML",
"instance",
"and",
"starts",
"running",
"it",
".",
"Progress",
"can",
"be",
"tracked",
"via",
"its",
"job",
"()",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-automl/src/main/java/ai/h2o/automl/AutoML.java#L166-L174 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java | Normalizer.isNormalized | @Deprecated
public static boolean isNormalized(int char32, Mode mode,int options) {
return isNormalized(UTF16.valueOf(char32), mode, options);
} | java | @Deprecated
public static boolean isNormalized(int char32, Mode mode,int options) {
return isNormalized(UTF16.valueOf(char32), mode, options);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"isNormalized",
"(",
"int",
"char32",
",",
"Mode",
"mode",
",",
"int",
"options",
")",
"{",
"return",
"isNormalized",
"(",
"UTF16",
".",
"valueOf",
"(",
"char32",
")",
",",
"mode",
",",
"options",
")",
";... | Convenience Method
@param char32 the input code point to be checked to see if it is
normalized
@param mode the normalization mode
@param options Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2
@see #isNormalized
@deprecated ICU 56 Use {@link Normalizer2} instead.
@hide original deprecated declaration | [
"Convenience",
"Method",
"@param",
"char32",
"the",
"input",
"code",
"point",
"to",
"be",
"checked",
"to",
"see",
"if",
"it",
"is",
"normalized",
"@param",
"mode",
"the",
"normalization",
"mode",
"@param",
"options",
"Options",
"for",
"use",
"with",
"exclusion... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java#L1127-L1130 |
auth0/jwks-rsa-java | src/main/java/com/auth0/jwk/JwkProviderBuilder.java | JwkProviderBuilder.rateLimited | public JwkProviderBuilder rateLimited(long bucketSize, long refillRate, TimeUnit unit) {
bucket = new BucketImpl(bucketSize, refillRate, unit);
return this;
} | java | public JwkProviderBuilder rateLimited(long bucketSize, long refillRate, TimeUnit unit) {
bucket = new BucketImpl(bucketSize, refillRate, unit);
return this;
} | [
"public",
"JwkProviderBuilder",
"rateLimited",
"(",
"long",
"bucketSize",
",",
"long",
"refillRate",
",",
"TimeUnit",
"unit",
")",
"{",
"bucket",
"=",
"new",
"BucketImpl",
"(",
"bucketSize",
",",
"refillRate",
",",
"unit",
")",
";",
"return",
"this",
";",
"}... | Enable the cache specifying size and expire time.
@param bucketSize max number of jwks to deliver in the given rate.
@param refillRate amount of time to wait before a jwk can the jwk will be cached
@param unit unit of time for the expire of jwk
@return the builder | [
"Enable",
"the",
"cache",
"specifying",
"size",
"and",
"expire",
"time",
"."
] | train | https://github.com/auth0/jwks-rsa-java/blob/9deba212be4278e50ae75a54b3bc6c96359b7e69/src/main/java/com/auth0/jwk/JwkProviderBuilder.java#L110-L113 |
overturetool/overture | core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java | SyntaxReader.throwMessage | protected void throwMessage(int number, String message, ILexToken token)
throws ParserException
{
throw new ParserException(number, message, token.getLocation(), reader.getTokensRead());
} | java | protected void throwMessage(int number, String message, ILexToken token)
throws ParserException
{
throw new ParserException(number, message, token.getLocation(), reader.getTokensRead());
} | [
"protected",
"void",
"throwMessage",
"(",
"int",
"number",
",",
"String",
"message",
",",
"ILexToken",
"token",
")",
"throws",
"ParserException",
"{",
"throw",
"new",
"ParserException",
"(",
"number",
",",
"message",
",",
"token",
".",
"getLocation",
"(",
")",... | Raise a {@link ParserException} at the location of the token passed in.
@param number
The error number.
@param message
The error message.
@param token
The location of the error.
@throws ParserException | [
"Raise",
"a",
"{",
"@link",
"ParserException",
"}",
"at",
"the",
"location",
"of",
"the",
"token",
"passed",
"in",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/parser/src/main/java/org/overture/parser/syntax/SyntaxReader.java#L507-L511 |
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.addCustomPrebuiltDomainWithServiceResponseAsync | public Observable<ServiceResponse<List<UUID>>> addCustomPrebuiltDomainWithServiceResponseAsync(UUID appId, String versionId, AddCustomPrebuiltDomainModelsOptionalParameter addCustomPrebuiltDomainOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final String domainName = addCustomPrebuiltDomainOptionalParameter != null ? addCustomPrebuiltDomainOptionalParameter.domainName() : null;
return addCustomPrebuiltDomainWithServiceResponseAsync(appId, versionId, domainName);
} | java | public Observable<ServiceResponse<List<UUID>>> addCustomPrebuiltDomainWithServiceResponseAsync(UUID appId, String versionId, AddCustomPrebuiltDomainModelsOptionalParameter addCustomPrebuiltDomainOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final String domainName = addCustomPrebuiltDomainOptionalParameter != null ? addCustomPrebuiltDomainOptionalParameter.domainName() : null;
return addCustomPrebuiltDomainWithServiceResponseAsync(appId, versionId, domainName);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"UUID",
">",
">",
">",
"addCustomPrebuiltDomainWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"AddCustomPrebuiltDomainModelsOptionalParameter",
"addCustomPrebuiltDomainOptiona... | Adds a customizable prebuilt domain along with all of its models to this application.
@param appId The application ID.
@param versionId The version ID.
@param addCustomPrebuiltDomainOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<UUID> object | [
"Adds",
"a",
"customizable",
"prebuilt",
"domain",
"along",
"with",
"all",
"of",
"its",
"models",
"to",
"this",
"application",
"."
] | 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#L5588-L5601 |
biojava/biojava | biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/WrapLayout.java | WrapLayout.addRow | private void addRow(Dimension dim, int rowWidth, int rowHeight)
{
dim.width = Math.max(dim.width, rowWidth);
if (dim.height > 0)
{
dim.height += getVgap();
}
dim.height += rowHeight;
} | java | private void addRow(Dimension dim, int rowWidth, int rowHeight)
{
dim.width = Math.max(dim.width, rowWidth);
if (dim.height > 0)
{
dim.height += getVgap();
}
dim.height += rowHeight;
} | [
"private",
"void",
"addRow",
"(",
"Dimension",
"dim",
",",
"int",
"rowWidth",
",",
"int",
"rowHeight",
")",
"{",
"dim",
".",
"width",
"=",
"Math",
".",
"max",
"(",
"dim",
".",
"width",
",",
"rowWidth",
")",
";",
"if",
"(",
"dim",
".",
"height",
">"... | /*
A new row has been completed. Use the dimensions of this row
to update the preferred size for the container.
@param dim update the width and height when appropriate
@param rowWidth the width of the row to add
@param rowHeight the height of the row to add | [
"/",
"*",
"A",
"new",
"row",
"has",
"been",
"completed",
".",
"Use",
"the",
"dimensions",
"of",
"this",
"row",
"to",
"update",
"the",
"preferred",
"size",
"for",
"the",
"container",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/WrapLayout.java#L204-L214 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/util/ByteBufJsonHelper.java | ByteBufJsonHelper.findNextCharNotPrefixedBy | public static final int findNextCharNotPrefixedBy(ByteBuf buf, char c, char prefix) {
int found = buf.bytesBefore((byte) c);
if (found < 1) {
return found;
} else {
int from;
while (found > -1 && (char) buf.getByte(
buf.readerIndex() + found - 1) == prefix) {
//advance from
from = buf.readerIndex() + found + 1;
//search again
int next = buf.bytesBefore(from, buf.readableBytes() - from + buf.readerIndex(), (byte) c);
if (next == -1) {
return -1;
} else {
found += next + 1;
}
}
return found;
}
} | java | public static final int findNextCharNotPrefixedBy(ByteBuf buf, char c, char prefix) {
int found = buf.bytesBefore((byte) c);
if (found < 1) {
return found;
} else {
int from;
while (found > -1 && (char) buf.getByte(
buf.readerIndex() + found - 1) == prefix) {
//advance from
from = buf.readerIndex() + found + 1;
//search again
int next = buf.bytesBefore(from, buf.readableBytes() - from + buf.readerIndex(), (byte) c);
if (next == -1) {
return -1;
} else {
found += next + 1;
}
}
return found;
}
} | [
"public",
"static",
"final",
"int",
"findNextCharNotPrefixedBy",
"(",
"ByteBuf",
"buf",
",",
"char",
"c",
",",
"char",
"prefix",
")",
"{",
"int",
"found",
"=",
"buf",
".",
"bytesBefore",
"(",
"(",
"byte",
")",
"c",
")",
";",
"if",
"(",
"found",
"<",
... | Find the number of bytes until next occurrence of the character c
from the current {@link ByteBuf#readerIndex() readerIndex} in buf,
with the twist that if this occurrence is prefixed by the prefix
character, we try to find another occurrence.
@param buf the {@link ByteBuf buffer} to look into.
@param c the character to search for.
@param prefix the character to trigger a retry.
@return the position of the first occurrence of c that is not prefixed by prefix
or -1 if none found. | [
"Find",
"the",
"number",
"of",
"bytes",
"until",
"next",
"occurrence",
"of",
"the",
"character",
"c",
"from",
"the",
"current",
"{",
"@link",
"ByteBuf#readerIndex",
"()",
"readerIndex",
"}",
"in",
"buf",
"with",
"the",
"twist",
"that",
"if",
"this",
"occurre... | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/util/ByteBufJsonHelper.java#L57-L77 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsXmlContainerPageFactory.java | CmsXmlContainerPageFactory.setCache | private static void setCache(CmsObject cms, CmsXmlContainerPage xmlCntPage, boolean keepEncoding) {
if (xmlCntPage.getFile() instanceof I_CmsHistoryResource) {
return;
}
boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject();
getCache().setCacheContainerPage(
getCache().getCacheKey(xmlCntPage.getFile().getStructureId(), keepEncoding),
xmlCntPage,
online);
} | java | private static void setCache(CmsObject cms, CmsXmlContainerPage xmlCntPage, boolean keepEncoding) {
if (xmlCntPage.getFile() instanceof I_CmsHistoryResource) {
return;
}
boolean online = cms.getRequestContext().getCurrentProject().isOnlineProject();
getCache().setCacheContainerPage(
getCache().getCacheKey(xmlCntPage.getFile().getStructureId(), keepEncoding),
xmlCntPage,
online);
} | [
"private",
"static",
"void",
"setCache",
"(",
"CmsObject",
"cms",
",",
"CmsXmlContainerPage",
"xmlCntPage",
",",
"boolean",
"keepEncoding",
")",
"{",
"if",
"(",
"xmlCntPage",
".",
"getFile",
"(",
")",
"instanceof",
"I_CmsHistoryResource",
")",
"{",
"return",
";"... | Stores the given container page in the cache.<p>
@param cms the cms context
@param xmlCntPage the container page to cache
@param keepEncoding if the encoding was kept while unmarshalling | [
"Stores",
"the",
"given",
"container",
"page",
"in",
"the",
"cache",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlContainerPageFactory.java#L453-L463 |
qiniu/java-sdk | src/main/java/com/qiniu/streaming/StreamingManager.java | StreamingManager.listStreams | public StreamListing listStreams(boolean live, String prefix, String marker) throws QiniuException {
StringMap map = new StringMap();
map.putWhen("liveonly", live, live);
map.putNotEmpty("prefix", prefix);
map.putNotEmpty("marker", marker);
String path = "";
if (map.size() != 0) {
path += "?" + map.formString();
}
return get(path, StreamListing.class);
} | java | public StreamListing listStreams(boolean live, String prefix, String marker) throws QiniuException {
StringMap map = new StringMap();
map.putWhen("liveonly", live, live);
map.putNotEmpty("prefix", prefix);
map.putNotEmpty("marker", marker);
String path = "";
if (map.size() != 0) {
path += "?" + map.formString();
}
return get(path, StreamListing.class);
} | [
"public",
"StreamListing",
"listStreams",
"(",
"boolean",
"live",
",",
"String",
"prefix",
",",
"String",
"marker",
")",
"throws",
"QiniuException",
"{",
"StringMap",
"map",
"=",
"new",
"StringMap",
"(",
")",
";",
"map",
".",
"putWhen",
"(",
"\"liveonly\"",
... | 获取直播流列表
@param live 是否直播中
@param prefix 流名称前缀
@param marker 下一次列举的位置 | [
"获取直播流列表"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/streaming/StreamingManager.java#L89-L102 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/Serializers.java | Serializers.getContainedGenericTypes | private static void getContainedGenericTypes(CompositeType<?> typeInfo, List<GenericTypeInfo<?>> target) {
for (int i = 0; i < typeInfo.getArity(); i++) {
TypeInformation<?> type = typeInfo.getTypeAt(i);
if (type instanceof CompositeType) {
getContainedGenericTypes((CompositeType<?>) type, target);
} else if (type instanceof GenericTypeInfo) {
if (!target.contains(type)) {
target.add((GenericTypeInfo<?>) type);
}
}
}
} | java | private static void getContainedGenericTypes(CompositeType<?> typeInfo, List<GenericTypeInfo<?>> target) {
for (int i = 0; i < typeInfo.getArity(); i++) {
TypeInformation<?> type = typeInfo.getTypeAt(i);
if (type instanceof CompositeType) {
getContainedGenericTypes((CompositeType<?>) type, target);
} else if (type instanceof GenericTypeInfo) {
if (!target.contains(type)) {
target.add((GenericTypeInfo<?>) type);
}
}
}
} | [
"private",
"static",
"void",
"getContainedGenericTypes",
"(",
"CompositeType",
"<",
"?",
">",
"typeInfo",
",",
"List",
"<",
"GenericTypeInfo",
"<",
"?",
">",
">",
"target",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"typeInfo",
".",
"ge... | Returns all GenericTypeInfos contained in a composite type.
@param typeInfo {@link CompositeType} | [
"Returns",
"all",
"GenericTypeInfos",
"contained",
"in",
"a",
"composite",
"type",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/kryo/Serializers.java#L135-L146 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.GET | public ArrayList<String> GET(String description, String ip, String routedTo_serviceName, OvhIpTypeEnum type) throws IOException {
String qPath = "/ip";
StringBuilder sb = path(qPath);
query(sb, "description", description);
query(sb, "ip", ip);
query(sb, "routedTo.serviceName", routedTo_serviceName);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<String> GET(String description, String ip, String routedTo_serviceName, OvhIpTypeEnum type) throws IOException {
String qPath = "/ip";
StringBuilder sb = path(qPath);
query(sb, "description", description);
query(sb, "ip", ip);
query(sb, "routedTo.serviceName", routedTo_serviceName);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"GET",
"(",
"String",
"description",
",",
"String",
"ip",
",",
"String",
"routedTo_serviceName",
",",
"OvhIpTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip\"",
";",
"StringBuilder",
... | Your OVH IPs
REST: GET /ip
@param description [required] Filter the value of description property (like)
@param ip [required] Filter the value of ip property (contains or equals)
@param routedTo_serviceName [required] Filter the value of routedTo.serviceName property (like)
@param type [required] Filter the value of type property (=) | [
"Your",
"OVH",
"IPs"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1244-L1253 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslservicegroup.java | sslservicegroup.get | public static sslservicegroup get(nitro_service service, String servicegroupname) throws Exception{
sslservicegroup obj = new sslservicegroup();
obj.set_servicegroupname(servicegroupname);
sslservicegroup response = (sslservicegroup) obj.get_resource(service);
return response;
} | java | public static sslservicegroup get(nitro_service service, String servicegroupname) throws Exception{
sslservicegroup obj = new sslservicegroup();
obj.set_servicegroupname(servicegroupname);
sslservicegroup response = (sslservicegroup) obj.get_resource(service);
return response;
} | [
"public",
"static",
"sslservicegroup",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"servicegroupname",
")",
"throws",
"Exception",
"{",
"sslservicegroup",
"obj",
"=",
"new",
"sslservicegroup",
"(",
")",
";",
"obj",
".",
"set_servicegroupname",
"(",
"ser... | Use this API to fetch sslservicegroup resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslservicegroup",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslservicegroup.java#L607-L612 |
rolfl/MicroBench | src/main/java/net/tuis/ubench/UUtils.java | UUtils.readResource | public static String readResource(String path) {
final long start = System.nanoTime();
try (InputStream is = UScale.class.getClassLoader().getResourceAsStream(path);) {
int len = 0;
byte[] buffer = new byte[2048];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((len = is.read(buffer)) >= 0) {
baos.write(buffer, 0, len);
}
return new String(baos.toByteArray(), StandardCharsets.UTF_8);
} catch (IOException e) {
LOGGER.log(Level.WARNING, e, () -> "IOException loading resource " + path);
throw new IllegalStateException("Unable to read class loaded stream " + path, e);
} catch (RuntimeException re) {
LOGGER.log(Level.WARNING, re, () -> "Unexpected exception loading resource " + path);
throw re;
} finally {
LOGGER.fine(() -> String.format("Loaded resource %s in %.3fms", path,
(System.nanoTime() - start) / 1000000.0));
}
} | java | public static String readResource(String path) {
final long start = System.nanoTime();
try (InputStream is = UScale.class.getClassLoader().getResourceAsStream(path);) {
int len = 0;
byte[] buffer = new byte[2048];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((len = is.read(buffer)) >= 0) {
baos.write(buffer, 0, len);
}
return new String(baos.toByteArray(), StandardCharsets.UTF_8);
} catch (IOException e) {
LOGGER.log(Level.WARNING, e, () -> "IOException loading resource " + path);
throw new IllegalStateException("Unable to read class loaded stream " + path, e);
} catch (RuntimeException re) {
LOGGER.log(Level.WARNING, re, () -> "Unexpected exception loading resource " + path);
throw re;
} finally {
LOGGER.fine(() -> String.format("Loaded resource %s in %.3fms", path,
(System.nanoTime() - start) / 1000000.0));
}
} | [
"public",
"static",
"String",
"readResource",
"(",
"String",
"path",
")",
"{",
"final",
"long",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"try",
"(",
"InputStream",
"is",
"=",
"UScale",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
... | Load a resource stored in the classpath, as a String.
@param path
the system resource to read
@return the resource as a String. | [
"Load",
"a",
"resource",
"stored",
"in",
"the",
"classpath",
"as",
"a",
"String",
"."
] | train | https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UUtils.java#L138-L158 |
pvanassen/ns-api | src/main/java/nl/pvanassen/ns/RequestBuilder.java | RequestBuilder.getPrijzen | public static ApiRequest<Prijzen> getPrijzen(String fromStation, String toStation, String viaStation,
Date dateTime) {
return new PrijzenRequest(fromStation, toStation, viaStation, dateTime);
} | java | public static ApiRequest<Prijzen> getPrijzen(String fromStation, String toStation, String viaStation,
Date dateTime) {
return new PrijzenRequest(fromStation, toStation, viaStation, dateTime);
} | [
"public",
"static",
"ApiRequest",
"<",
"Prijzen",
">",
"getPrijzen",
"(",
"String",
"fromStation",
",",
"String",
"toStation",
",",
"String",
"viaStation",
",",
"Date",
"dateTime",
")",
"{",
"return",
"new",
"PrijzenRequest",
"(",
"fromStation",
",",
"toStation"... | Builds a request to get all fares for a ride between station from, to station to. See <a
href="http://www.ns.nl/api/api#api-documentatie-prijzen">prijzen</a>
@param fromStation Starting point of the trip
@param toStation End point of the trip
@param viaStation Also go to this station
@param dateTime Date and time to use for getting the fares.
@return Request for getting the fares | [
"Builds",
"a",
"request",
"to",
"get",
"all",
"fares",
"for",
"a",
"ride",
"between",
"station",
"from",
"to",
"station",
"to",
".",
"See",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"ns",
".",
"nl",
"/",
"api",
"/",
"api#api",
"-",
"documen... | train | https://github.com/pvanassen/ns-api/blob/e90e01028a0eb24006e4fddd4c85e7a25c4fe0ae/src/main/java/nl/pvanassen/ns/RequestBuilder.java#L136-L139 |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java | BaseAmqpService.convertMessage | @SuppressWarnings("unchecked")
public <T> T convertMessage(@NotNull final Message message, final Class<T> clazz) {
checkMessageBody(message);
message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME,
clazz.getName());
return (T) rabbitTemplate.getMessageConverter().fromMessage(message);
} | java | @SuppressWarnings("unchecked")
public <T> T convertMessage(@NotNull final Message message, final Class<T> clazz) {
checkMessageBody(message);
message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME,
clazz.getName());
return (T) rabbitTemplate.getMessageConverter().fromMessage(message);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"convertMessage",
"(",
"@",
"NotNull",
"final",
"Message",
"message",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"checkMessageBody",
"(",
"message",
")",
";",
... | Is needed to convert a incoming message to is originally object type.
@param message
the message to convert.
@param clazz
the class of the originally object.
@return the converted object | [
"Is",
"needed",
"to",
"convert",
"a",
"incoming",
"message",
"to",
"is",
"originally",
"object",
"type",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/BaseAmqpService.java#L60-L66 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java | MatchState.convertCase | String convertCase(String s, String sample, Language lang) {
return CaseConversionHelper.convertCase(match.getCaseConversionType(), s, sample, lang);
} | java | String convertCase(String s, String sample, Language lang) {
return CaseConversionHelper.convertCase(match.getCaseConversionType(), s, sample, lang);
} | [
"String",
"convertCase",
"(",
"String",
"s",
",",
"String",
"sample",
",",
"Language",
"lang",
")",
"{",
"return",
"CaseConversionHelper",
".",
"convertCase",
"(",
"match",
".",
"getCaseConversionType",
"(",
")",
",",
"s",
",",
"sample",
",",
"lang",
")",
... | Converts case of the string token according to match element attributes.
@param s Token to be converted.
@param sample the sample string used to determine how the original string looks like (used only on case preservation)
@return Converted string. | [
"Converts",
"case",
"of",
"the",
"string",
"token",
"according",
"to",
"match",
"element",
"attributes",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/MatchState.java#L181-L183 |
FINRAOS/DataGenerator | dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/InLineTransformerExtension.java | InLineTransformerExtension.pipelinePossibleStates | public List<Map<String, String>> pipelinePossibleStates(TransformTag action,
List<Map<String, String>> possibleStateList) {
DataTransformer tr = transformers.get(action.getName());
DataPipe pipe = new DataPipe(0, null);
for (Map<String, String> possibleState : possibleStateList) {
pipe.getDataMap().putAll(possibleState);
tr.transform(pipe);
possibleState.putAll(pipe.getDataMap());
}
return possibleStateList;
} | java | public List<Map<String, String>> pipelinePossibleStates(TransformTag action,
List<Map<String, String>> possibleStateList) {
DataTransformer tr = transformers.get(action.getName());
DataPipe pipe = new DataPipe(0, null);
for (Map<String, String> possibleState : possibleStateList) {
pipe.getDataMap().putAll(possibleState);
tr.transform(pipe);
possibleState.putAll(pipe.getDataMap());
}
return possibleStateList;
} | [
"public",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"pipelinePossibleStates",
"(",
"TransformTag",
"action",
",",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"possibleStateList",
")",
"{",
"DataTransformer",
"tr",
"=",
"tr... | Applies a stated DataTransformer (given by name in a TransformTag Action) against every possible state
@param action a TransformTag Action
@param possibleStateList a current list of possible states produced so far from expanding a model state
@return the same list of possible states, each processed with the stated DataTransformer | [
"Applies",
"a",
"stated",
"DataTransformer",
"(",
"given",
"by",
"name",
"in",
"a",
"TransformTag",
"Action",
")",
"against",
"every",
"possible",
"state"
] | train | https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/InLineTransformerExtension.java#L69-L81 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/adwords/lib/utils/logging/ReportServiceLogger.java | ReportServiceLogger.logRequest | public void logRequest(
@Nullable HttpRequest request, int statusCode, @Nullable String statusMessage) {
boolean isSuccess = HttpStatusCodes.isSuccess(statusCode);
if (!loggerDelegate.isSummaryLoggable(isSuccess)
&& !loggerDelegate.isDetailsLoggable(isSuccess)) {
return;
}
// Populate the RequestInfo builder from the request.
RequestInfo requestInfo = buildRequestInfo(request);
// Populate the ResponseInfo builder from the response.
ResponseInfo responseInfo = buildResponseInfo(request, statusCode, statusMessage);
RemoteCallReturn.Builder remoteCallReturnBuilder =
new RemoteCallReturn.Builder().withRequestInfo(requestInfo).withResponseInfo(responseInfo);
if (!isSuccess) {
remoteCallReturnBuilder.withException(
new ReportException(String.format("%s: %s", statusCode, statusMessage)));
}
RemoteCallReturn remoteCallReturn = remoteCallReturnBuilder.build();
loggerDelegate.logRequestSummary(remoteCallReturn);
loggerDelegate.logRequestDetails(remoteCallReturn);
} | java | public void logRequest(
@Nullable HttpRequest request, int statusCode, @Nullable String statusMessage) {
boolean isSuccess = HttpStatusCodes.isSuccess(statusCode);
if (!loggerDelegate.isSummaryLoggable(isSuccess)
&& !loggerDelegate.isDetailsLoggable(isSuccess)) {
return;
}
// Populate the RequestInfo builder from the request.
RequestInfo requestInfo = buildRequestInfo(request);
// Populate the ResponseInfo builder from the response.
ResponseInfo responseInfo = buildResponseInfo(request, statusCode, statusMessage);
RemoteCallReturn.Builder remoteCallReturnBuilder =
new RemoteCallReturn.Builder().withRequestInfo(requestInfo).withResponseInfo(responseInfo);
if (!isSuccess) {
remoteCallReturnBuilder.withException(
new ReportException(String.format("%s: %s", statusCode, statusMessage)));
}
RemoteCallReturn remoteCallReturn = remoteCallReturnBuilder.build();
loggerDelegate.logRequestSummary(remoteCallReturn);
loggerDelegate.logRequestDetails(remoteCallReturn);
} | [
"public",
"void",
"logRequest",
"(",
"@",
"Nullable",
"HttpRequest",
"request",
",",
"int",
"statusCode",
",",
"@",
"Nullable",
"String",
"statusMessage",
")",
"{",
"boolean",
"isSuccess",
"=",
"HttpStatusCodes",
".",
"isSuccess",
"(",
"statusCode",
")",
";",
... | Logs the specified request and response information.
<p>Note that in order to avoid any temptation to consume the contents of the response, this
does <em>not</em> take an {@link com.google.api.client.http.HttpResponse} object, but instead
accepts the status code and message from the response. | [
"Logs",
"the",
"specified",
"request",
"and",
"response",
"information",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/adwords/lib/utils/logging/ReportServiceLogger.java#L90-L113 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.buttonBarLabel | public String buttonBarLabel(String label, String className) {
StringBuffer result = new StringBuffer(128);
result.append("<td><span class=\"");
result.append(className);
result.append("\"><span unselectable=\"on\" class=\"txtbutton\">");
result.append(key(label));
result.append("</span></span></td>\n");
return result.toString();
} | java | public String buttonBarLabel(String label, String className) {
StringBuffer result = new StringBuffer(128);
result.append("<td><span class=\"");
result.append(className);
result.append("\"><span unselectable=\"on\" class=\"txtbutton\">");
result.append(key(label));
result.append("</span></span></td>\n");
return result.toString();
} | [
"public",
"String",
"buttonBarLabel",
"(",
"String",
"label",
",",
"String",
"className",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"128",
")",
";",
"result",
".",
"append",
"(",
"\"<td><span class=\\\"\"",
")",
";",
"result",
".",
... | Generates a button bar label.<p>
@param label the label to show
@param className the css class name for the formatting
@return a button bar label | [
"Generates",
"a",
"button",
"bar",
"label",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L1330-L1339 |
huahang/crypto-utils | crypto-utils/src/main/java/im/chic/utils/crypto/DigestUtils.java | DigestUtils.dgstHex | public static String dgstHex(InputStream is, Digest digest) throws IOException {
checkNotNull(is);
byte[] dgstBytes = dgst(is, digest);
return BaseEncoding.base16().encode(dgstBytes);
} | java | public static String dgstHex(InputStream is, Digest digest) throws IOException {
checkNotNull(is);
byte[] dgstBytes = dgst(is, digest);
return BaseEncoding.base16().encode(dgstBytes);
} | [
"public",
"static",
"String",
"dgstHex",
"(",
"InputStream",
"is",
",",
"Digest",
"digest",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"is",
")",
";",
"byte",
"[",
"]",
"dgstBytes",
"=",
"dgst",
"(",
"is",
",",
"digest",
")",
";",
"return",
... | Calculates digest and returns the value as a hex string.
@param is input stream
@param digest digest algorithm
@return digest as a hex string
@throws IOException On error reading from the stream | [
"Calculates",
"digest",
"and",
"returns",
"the",
"value",
"as",
"a",
"hex",
"string",
"."
] | train | https://github.com/huahang/crypto-utils/blob/5f158478612698ecfd65fb0a0f9862a54ca17a8d/crypto-utils/src/main/java/im/chic/utils/crypto/DigestUtils.java#L97-L101 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java | ComputeNodesImpl.disableSchedulingAsync | public Observable<Void> disableSchedulingAsync(String poolId, String nodeId) {
return disableSchedulingWithServiceResponseAsync(poolId, nodeId).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeDisableSchedulingHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, ComputeNodeDisableSchedulingHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> disableSchedulingAsync(String poolId, String nodeId) {
return disableSchedulingWithServiceResponseAsync(poolId, nodeId).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeDisableSchedulingHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, ComputeNodeDisableSchedulingHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"disableSchedulingAsync",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
")",
"{",
"return",
"disableSchedulingWithServiceResponseAsync",
"(",
"poolId",
",",
"nodeId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"Servi... | Disables task scheduling on the specified compute node.
You can disable task scheduling on a node only if its current scheduling state is enabled.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node on which you want to disable task scheduling.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Disables",
"task",
"scheduling",
"on",
"the",
"specified",
"compute",
"node",
".",
"You",
"can",
"disable",
"task",
"scheduling",
"on",
"a",
"node",
"only",
"if",
"its",
"current",
"scheduling",
"state",
"is",
"enabled",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1529-L1536 |
hector-client/hector | core/src/main/java/me/prettyprint/cassandra/connection/security/KerberosHelper.java | KerberosHelper.loginService | public static Subject loginService(String serviceName) throws LoginException {
LoginContext loginCtx = new LoginContext(serviceName, new CallbackHandler() {
// as we use .keytab file there is no need to specify any options in callback
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
}
});
loginCtx.login();
return loginCtx.getSubject();
} | java | public static Subject loginService(String serviceName) throws LoginException {
LoginContext loginCtx = new LoginContext(serviceName, new CallbackHandler() {
// as we use .keytab file there is no need to specify any options in callback
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
}
});
loginCtx.login();
return loginCtx.getSubject();
} | [
"public",
"static",
"Subject",
"loginService",
"(",
"String",
"serviceName",
")",
"throws",
"LoginException",
"{",
"LoginContext",
"loginCtx",
"=",
"new",
"LoginContext",
"(",
"serviceName",
",",
"new",
"CallbackHandler",
"(",
")",
"{",
"// as we use .keytab file ther... | Log in using the service name for jaas.conf file and .keytab instead of specifying username and password
@param serviceName service name defined in jass.conf file
@return the authenticated Subject or <code>null</code> is the authentication failed
@throws LoginException if there is any error during the login | [
"Log",
"in",
"using",
"the",
"service",
"name",
"for",
"jaas",
".",
"conf",
"file",
"and",
".",
"keytab",
"instead",
"of",
"specifying",
"username",
"and",
"password"
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/connection/security/KerberosHelper.java#L34-L44 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java | MessageMap.getMultiChoice | private static BigInteger getMultiChoice(int[] choices, JSchema schema, JSVariant var) throws JMFUninitializedAccessException {
int choice = choices[var.getIndex()];
if (choice == -1)
throw new JMFUninitializedAccessException(schema.getPathName(var));
BigInteger ans = BigInteger.ZERO;
// First, add the contribution of the cases less than the present one.
for (int i = 0; i < choice; i++)
ans = ans.add(((JSType)var.getCase(i)).getMultiChoiceCount());
// Now compute the contribution of the actual case. Get the subvariants dominated by
// this variant's present case.
JSVariant[] subVars = var.getDominatedVariants(choice);
if (subVars == null)
// There are none: we already have the answer
return ans;
return ans.add(getMultiChoice(choices, schema, subVars));
} | java | private static BigInteger getMultiChoice(int[] choices, JSchema schema, JSVariant var) throws JMFUninitializedAccessException {
int choice = choices[var.getIndex()];
if (choice == -1)
throw new JMFUninitializedAccessException(schema.getPathName(var));
BigInteger ans = BigInteger.ZERO;
// First, add the contribution of the cases less than the present one.
for (int i = 0; i < choice; i++)
ans = ans.add(((JSType)var.getCase(i)).getMultiChoiceCount());
// Now compute the contribution of the actual case. Get the subvariants dominated by
// this variant's present case.
JSVariant[] subVars = var.getDominatedVariants(choice);
if (subVars == null)
// There are none: we already have the answer
return ans;
return ans.add(getMultiChoice(choices, schema, subVars));
} | [
"private",
"static",
"BigInteger",
"getMultiChoice",
"(",
"int",
"[",
"]",
"choices",
",",
"JSchema",
"schema",
",",
"JSVariant",
"var",
")",
"throws",
"JMFUninitializedAccessException",
"{",
"int",
"choice",
"=",
"choices",
"[",
"var",
".",
"getIndex",
"(",
"... | Compute the multiChoice code or contribution for an individual variant | [
"Compute",
"the",
"multiChoice",
"code",
"or",
"contribution",
"for",
"an",
"individual",
"variant"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/MessageMap.java#L194-L209 |
Samsung/GearVRf | GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOBaseComponent.java | IOBaseComponent.setRotation | public void setRotation(float w, float x, float y, float z) {
componentRotation.set(w, x, y, z);
if (sceneObject != null) {
sceneObject.getTransform().setRotation(w, x, y, z);
}
} | java | public void setRotation(float w, float x, float y, float z) {
componentRotation.set(w, x, y, z);
if (sceneObject != null) {
sceneObject.getTransform().setRotation(w, x, y, z);
}
} | [
"public",
"void",
"setRotation",
"(",
"float",
"w",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"componentRotation",
".",
"set",
"(",
"w",
",",
"x",
",",
"y",
",",
"z",
")",
";",
"if",
"(",
"sceneObject",
"!=",
"null",
")",... | Set the rotation for the {@link IOBaseComponent}
@param w the w value of the quaternion
@param x the x value of the quaternion
@param y the y value of the quaternion
@param z the z value of the quaternion | [
"Set",
"the",
"rotation",
"for",
"the",
"{",
"@link",
"IOBaseComponent",
"}"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOBaseComponent.java#L73-L78 |
landawn/AbacusUtil | src/com/landawn/abacus/util/stream/Collectors.java | Collectors.maxAll | @SuppressWarnings("rawtypes")
public static <T extends Comparable> Collector<T, ?, List<T>> maxAll(final boolean areAllLargestSame) {
return maxAll(Integer.MAX_VALUE, areAllLargestSame);
} | java | @SuppressWarnings("rawtypes")
public static <T extends Comparable> Collector<T, ?, List<T>> maxAll(final boolean areAllLargestSame) {
return maxAll(Integer.MAX_VALUE, areAllLargestSame);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Comparable",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"List",
"<",
"T",
">",
">",
"maxAll",
"(",
"final",
"boolean",
"areAllLargestSame",
")",
"{",
"return",
"... | Use occurrences to save the count of largest objects if {@code areAllLargestSame = true}(e.g. {@code Number/String/...}) and return a list by repeat the largest object {@code n} times.
@param areAllLargestSame
@return
@see Collectors#maxAll(Comparator, int, boolean) | [
"Use",
"occurrences",
"to",
"save",
"the",
"count",
"of",
"largest",
"objects",
"if",
"{",
"@code",
"areAllLargestSame",
"=",
"true",
"}",
"(",
"e",
".",
"g",
".",
"{",
"@code",
"Number",
"/",
"String",
"/",
"...",
"}",
")",
"and",
"return",
"a",
"li... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Collectors.java#L2173-L2176 |
c2nes/ircbot | brewtab-irc/src/main/java/com/brewtab/irc/impl/ChannelImpl.java | ChannelImpl.refreshNames | public void refreshNames() {
Message namesMessage = new Message(MessageType.NAMES, this.channelName);
List<Message> response;
try {
response = connection.request(
MessageFilters.message(MessageType.RPL_NAMREPLY, null, "=", channelName),
MessageFilters.message(MessageType.RPL_ENDOFNAMES, null, channelName),
namesMessage);
} catch (InterruptedException e) {
return;
}
List<String> names = new ArrayList<String>();
for (Message message : response) {
if (message.getType() == MessageType.RPL_NAMREPLY) {
String[] args = message.getArgs();
for (String name : args[args.length - 1].split(" ")) {
names.add(name.replaceFirst("^[@+]", ""));
}
}
}
this.names = names;
} | java | public void refreshNames() {
Message namesMessage = new Message(MessageType.NAMES, this.channelName);
List<Message> response;
try {
response = connection.request(
MessageFilters.message(MessageType.RPL_NAMREPLY, null, "=", channelName),
MessageFilters.message(MessageType.RPL_ENDOFNAMES, null, channelName),
namesMessage);
} catch (InterruptedException e) {
return;
}
List<String> names = new ArrayList<String>();
for (Message message : response) {
if (message.getType() == MessageType.RPL_NAMREPLY) {
String[] args = message.getArgs();
for (String name : args[args.length - 1].split(" ")) {
names.add(name.replaceFirst("^[@+]", ""));
}
}
}
this.names = names;
} | [
"public",
"void",
"refreshNames",
"(",
")",
"{",
"Message",
"namesMessage",
"=",
"new",
"Message",
"(",
"MessageType",
".",
"NAMES",
",",
"this",
".",
"channelName",
")",
";",
"List",
"<",
"Message",
">",
"response",
";",
"try",
"{",
"response",
"=",
"co... | Makes a NAMES request to the server for this channel. Store the result
replacing any existing names list. The list can be retrieved with
IRCChannel#getNames | [
"Makes",
"a",
"NAMES",
"request",
"to",
"the",
"server",
"for",
"this",
"channel",
".",
"Store",
"the",
"result",
"replacing",
"any",
"existing",
"names",
"list",
".",
"The",
"list",
"can",
"be",
"retrieved",
"with",
"IRCChannel#getNames"
] | train | https://github.com/c2nes/ircbot/blob/29cfc5b921ceee2a35e7d6077c5660e6db63ef35/brewtab-irc/src/main/java/com/brewtab/irc/impl/ChannelImpl.java#L203-L229 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/calendar/CronExpression.java | CronExpression.setCalendarHour | protected void setCalendarHour(Calendar cal, int hour) {
cal.set(Calendar.HOUR_OF_DAY, hour);
if (cal.get(Calendar.HOUR_OF_DAY) != hour && hour != 24) {
cal.set(Calendar.HOUR_OF_DAY, hour + 1);
}
} | java | protected void setCalendarHour(Calendar cal, int hour) {
cal.set(Calendar.HOUR_OF_DAY, hour);
if (cal.get(Calendar.HOUR_OF_DAY) != hour && hour != 24) {
cal.set(Calendar.HOUR_OF_DAY, hour + 1);
}
} | [
"protected",
"void",
"setCalendarHour",
"(",
"Calendar",
"cal",
",",
"int",
"hour",
")",
"{",
"cal",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"hour",
")",
";",
"if",
"(",
"cal",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
"!=",
... | Advance the calendar to the particular hour paying particular attention to daylight saving problems.
@param cal
@param hour | [
"Advance",
"the",
"calendar",
"to",
"the",
"particular",
"hour",
"paying",
"particular",
"attention",
"to",
"daylight",
"saving",
"problems",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/calendar/CronExpression.java#L1313-L1318 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.summarizeForResource | public SummarizeResultsInner summarizeForResource(String resourceId, QueryOptions queryOptions) {
return summarizeForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body();
} | java | public SummarizeResultsInner summarizeForResource(String resourceId, QueryOptions queryOptions) {
return summarizeForResourceWithServiceResponseAsync(resourceId, queryOptions).toBlocking().single().body();
} | [
"public",
"SummarizeResultsInner",
"summarizeForResource",
"(",
"String",
"resourceId",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"summarizeForResourceWithServiceResponseAsync",
"(",
"resourceId",
",",
"queryOptions",
")",
".",
"toBlocking",
"(",
")",
".",
... | Summarizes policy states for the resource.
@param resourceId Resource ID.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SummarizeResultsInner object if successful. | [
"Summarizes",
"policy",
"states",
"for",
"the",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L1565-L1567 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.execute | public static int execute(Connection conn, String sql, Object... params) throws SQLException {
PreparedStatement ps = null;
try {
ps = StatementUtil.prepareStatement(conn, sql, params);
return ps.executeUpdate();
} finally {
DbUtil.close(ps);
}
} | java | public static int execute(Connection conn, String sql, Object... params) throws SQLException {
PreparedStatement ps = null;
try {
ps = StatementUtil.prepareStatement(conn, sql, params);
return ps.executeUpdate();
} finally {
DbUtil.close(ps);
}
} | [
"public",
"static",
"int",
"execute",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"ps",
"=",
"null",
";",
"try",
"{",
"ps",
"=",
"StatementUtil",
".",
"prepareState... | 执行非查询语句<br>
语句包括 插入、更新、删除<br>
此方法不会关闭Connection
@param conn 数据库连接对象
@param sql SQL
@param params 参数
@return 影响的行数
@throws SQLException SQL执行异常 | [
"执行非查询语句<br",
">",
"语句包括",
"插入、更新、删除<br",
">",
"此方法不会关闭Connection"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L53-L61 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java | EventSubscriptionsInner.createOrUpdateAsync | public Observable<EventSubscriptionInner> createOrUpdateAsync(String scope, String eventSubscriptionName, EventSubscriptionInner eventSubscriptionInfo) {
return createOrUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionInfo).map(new Func1<ServiceResponse<EventSubscriptionInner>, EventSubscriptionInner>() {
@Override
public EventSubscriptionInner call(ServiceResponse<EventSubscriptionInner> response) {
return response.body();
}
});
} | java | public Observable<EventSubscriptionInner> createOrUpdateAsync(String scope, String eventSubscriptionName, EventSubscriptionInner eventSubscriptionInfo) {
return createOrUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionInfo).map(new Func1<ServiceResponse<EventSubscriptionInner>, EventSubscriptionInner>() {
@Override
public EventSubscriptionInner call(ServiceResponse<EventSubscriptionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EventSubscriptionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"scope",
",",
"String",
"eventSubscriptionName",
",",
"EventSubscriptionInner",
"eventSubscriptionInfo",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"scope... | Create or update an event subscription.
Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope.
@param scope The identifier of the resource to which the event subscription needs to be created or updated. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic.
@param eventSubscriptionName Name of the event subscription. Event subscription names must be between 3 and 64 characters in length and should use alphanumeric letters only.
@param eventSubscriptionInfo Event subscription properties containing the destination and filter information
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"or",
"update",
"an",
"event",
"subscription",
".",
"Asynchronously",
"creates",
"a",
"new",
"event",
"subscription",
"or",
"updates",
"an",
"existing",
"event",
"subscription",
"based",
"on",
"the",
"specified",
"scope",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L264-L271 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.setTableAliasForPath | private void setTableAliasForPath(String aPath, List hintClasses, TableAlias anAlias)
{
m_pathToAlias.put(buildAliasKey(aPath, hintClasses), anAlias);
} | java | private void setTableAliasForPath(String aPath, List hintClasses, TableAlias anAlias)
{
m_pathToAlias.put(buildAliasKey(aPath, hintClasses), anAlias);
} | [
"private",
"void",
"setTableAliasForPath",
"(",
"String",
"aPath",
",",
"List",
"hintClasses",
",",
"TableAlias",
"anAlias",
")",
"{",
"m_pathToAlias",
".",
"put",
"(",
"buildAliasKey",
"(",
"aPath",
",",
"hintClasses",
")",
",",
"anAlias",
")",
";",
"}"
] | Set the TableAlias for aPath
@param aPath
@param hintClasses
@param TableAlias | [
"Set",
"the",
"TableAlias",
"for",
"aPath"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L1370-L1373 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/utils/BtcFormat.java | BtcFormat.getMicroInstance | public static BtcFormat getMicroInstance(Locale locale, int scale, int... groups) {
return getInstance(MICROCOIN_SCALE, locale, scale, boxAsList(groups));
} | java | public static BtcFormat getMicroInstance(Locale locale, int scale, int... groups) {
return getInstance(MICROCOIN_SCALE, locale, scale, boxAsList(groups));
} | [
"public",
"static",
"BtcFormat",
"getMicroInstance",
"(",
"Locale",
"locale",
",",
"int",
"scale",
",",
"int",
"...",
"groups",
")",
"{",
"return",
"getInstance",
"(",
"MICROCOIN_SCALE",
",",
"locale",
",",
"scale",
",",
"boxAsList",
"(",
"groups",
")",
")",... | Return a new microcoin-denominated formatter for the given locale with the specified
fractional decimal placing. The returned object will format the fractional part of
numbers with the given minimum number of fractional decimal places. Optionally,
repeating integer arguments can be passed, each indicating the size of an additional
group of fractional decimal places to be used as necessary to avoid rounding, to a
limiting precision of satoshis. | [
"Return",
"a",
"new",
"microcoin",
"-",
"denominated",
"formatter",
"for",
"the",
"given",
"locale",
"with",
"the",
"specified",
"fractional",
"decimal",
"placing",
".",
"The",
"returned",
"object",
"will",
"format",
"the",
"fractional",
"part",
"of",
"numbers",... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/utils/BtcFormat.java#L1048-L1050 |
roboconf/roboconf-platform | core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/helpers/AllHelper.java | AllHelper.safeApply | private String safeApply( Collection<InstanceContextBean> instances, Options options, String componentPath )
throws IOException {
// Parse the filter.
String installerName = (String) options.hash.get( "installer" );
final InstanceFilter filter = InstanceFilter.createFilter( componentPath, installerName );
// Apply the filter.
final Collection<InstanceContextBean> selectedInstances = filter.apply( instances );
// Apply the content template of the helper to each selected instance.
final StringBuilder buffer = new StringBuilder();
final Context parent = options.context;
int index = 0;
final int last = selectedInstances.size() - 1;
for( final InstanceContextBean instance : selectedInstances ) {
final Context current = Context.newBuilder( parent, instance )
.combine( "@index", index )
.combine( "@first", index == 0 ? "first" : "" )
.combine( "@last", index == last ? "last" : "" )
.combine( "@odd", index % 2 == 0 ? "" : "odd" )
.combine( "@even", index % 2 == 0 ? "even" : "" )
.build();
index++;
buffer.append( options.fn( current ));
}
return buffer.toString();
} | java | private String safeApply( Collection<InstanceContextBean> instances, Options options, String componentPath )
throws IOException {
// Parse the filter.
String installerName = (String) options.hash.get( "installer" );
final InstanceFilter filter = InstanceFilter.createFilter( componentPath, installerName );
// Apply the filter.
final Collection<InstanceContextBean> selectedInstances = filter.apply( instances );
// Apply the content template of the helper to each selected instance.
final StringBuilder buffer = new StringBuilder();
final Context parent = options.context;
int index = 0;
final int last = selectedInstances.size() - 1;
for( final InstanceContextBean instance : selectedInstances ) {
final Context current = Context.newBuilder( parent, instance )
.combine( "@index", index )
.combine( "@first", index == 0 ? "first" : "" )
.combine( "@last", index == last ? "last" : "" )
.combine( "@odd", index % 2 == 0 ? "" : "odd" )
.combine( "@even", index % 2 == 0 ? "even" : "" )
.build();
index++;
buffer.append( options.fn( current ));
}
return buffer.toString();
} | [
"private",
"String",
"safeApply",
"(",
"Collection",
"<",
"InstanceContextBean",
">",
"instances",
",",
"Options",
"options",
",",
"String",
"componentPath",
")",
"throws",
"IOException",
"{",
"// Parse the filter.",
"String",
"installerName",
"=",
"(",
"String",
")... | Same as above, but with type-safe arguments.
@param instances the instances to which this helper is applied.
@param options the options of this helper invocation.
@return a string result.
@throws IOException if a template cannot be loaded. | [
"Same",
"as",
"above",
"but",
"with",
"type",
"-",
"safe",
"arguments",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-templating/src/main/java/net/roboconf/dm/templating/internal/helpers/AllHelper.java#L100-L130 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java | Telemetry.createTelemetry | public static Telemetry createTelemetry(Connection conn, int flushSize)
{
try
{
return createTelemetry(conn.unwrap(SnowflakeConnectionV1.class).getSfSession(), flushSize);
}
catch (SQLException ex)
{
logger.debug("input connection is not a SnowflakeConnection");
return null;
}
} | java | public static Telemetry createTelemetry(Connection conn, int flushSize)
{
try
{
return createTelemetry(conn.unwrap(SnowflakeConnectionV1.class).getSfSession(), flushSize);
}
catch (SQLException ex)
{
logger.debug("input connection is not a SnowflakeConnection");
return null;
}
} | [
"public",
"static",
"Telemetry",
"createTelemetry",
"(",
"Connection",
"conn",
",",
"int",
"flushSize",
")",
"{",
"try",
"{",
"return",
"createTelemetry",
"(",
"conn",
".",
"unwrap",
"(",
"SnowflakeConnectionV1",
".",
"class",
")",
".",
"getSfSession",
"(",
")... | Initialize the telemetry connector
@param conn connection with the session to use for the connector
@param flushSize maximum size of telemetry batch before flush
@return a telemetry connector | [
"Initialize",
"the",
"telemetry",
"connector"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/Telemetry.java#L105-L116 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ObjectExtensions.java | ObjectExtensions.operator_plus | @Pure /* not guaranteed pure , since toString() is invoked on the argument a*/
@Inline("($1 + $2)")
public static String operator_plus(Object a, String b) {
return a + b;
} | java | @Pure /* not guaranteed pure , since toString() is invoked on the argument a*/
@Inline("($1 + $2)")
public static String operator_plus(Object a, String b) {
return a + b;
} | [
"@",
"Pure",
"/* not guaranteed pure , since toString() is invoked on the argument a*/",
"@",
"Inline",
"(",
"\"($1 + $2)\"",
")",
"public",
"static",
"String",
"operator_plus",
"(",
"Object",
"a",
",",
"String",
"b",
")",
"{",
"return",
"a",
"+",
"b",
";",
"}"
] | The binary <code>+</code> operator that concatenates two strings.
@param a
an {@link Object}.
@param b
a {@link String}.
@return <code>a + b</code>
@since 2.3 | [
"The",
"binary",
"<code",
">",
"+",
"<",
"/",
"code",
">",
"operator",
"that",
"concatenates",
"two",
"strings",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ObjectExtensions.java#L153-L157 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseArrayInitialiserOrGeneratorExpression | private Expr parseArrayInitialiserOrGeneratorExpression(EnclosingScope scope, boolean terminated) {
int start = index;
match(LeftSquare);
if (tryAndMatch(true, RightSquare) != null) {
// this is an empty array initialiser
index = start;
return parseArrayInitialiserExpression(scope, terminated);
} else {
Expr expr = parseExpression(scope, true);
// Finally, disambiguate
if (tryAndMatch(true, SemiColon) != null) {
// this is an array generator
index = start;
return parseArrayGeneratorExpression(scope, terminated);
} else {
// this is an array initialiser
index = start;
return parseArrayInitialiserExpression(scope, terminated);
}
}
} | java | private Expr parseArrayInitialiserOrGeneratorExpression(EnclosingScope scope, boolean terminated) {
int start = index;
match(LeftSquare);
if (tryAndMatch(true, RightSquare) != null) {
// this is an empty array initialiser
index = start;
return parseArrayInitialiserExpression(scope, terminated);
} else {
Expr expr = parseExpression(scope, true);
// Finally, disambiguate
if (tryAndMatch(true, SemiColon) != null) {
// this is an array generator
index = start;
return parseArrayGeneratorExpression(scope, terminated);
} else {
// this is an array initialiser
index = start;
return parseArrayInitialiserExpression(scope, terminated);
}
}
} | [
"private",
"Expr",
"parseArrayInitialiserOrGeneratorExpression",
"(",
"EnclosingScope",
"scope",
",",
"boolean",
"terminated",
")",
"{",
"int",
"start",
"=",
"index",
";",
"match",
"(",
"LeftSquare",
")",
";",
"if",
"(",
"tryAndMatch",
"(",
"true",
",",
"RightSq... | Parse an array initialiser or generator expression, which is of the form:
<pre>
ArrayExpr ::= '[' [ Expr (',' Expr)+ ] ']'
| '[' Expr ';' Expr ']'
</pre>
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@param terminated
This indicates that the expression is known to be terminated
(or not). An expression that's known to be terminated is one
which is guaranteed to be followed by something. This is
important because it means that we can ignore any newline
characters encountered in parsing this expression, and that
we'll never overrun the end of the expression (i.e. because
there's guaranteed to be something which terminates this
expression). A classic situation where terminated is true is
when parsing an expression surrounded in braces. In such case,
we know the right-brace will always terminate this expression.
@return | [
"Parse",
"an",
"array",
"initialiser",
"or",
"generator",
"expression",
"which",
"is",
"of",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L2639-L2659 |
openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java | NetworkServiceDescriptorAgent.getVNFDependency | @Help(
help =
"get the VirtualNetworkFunctionDescriptor dependency with specific id of a NetworkServiceDescriptor with specific id"
)
public VNFDependency getVNFDependency(final String idNSD, final String idVnfd)
throws SDKException {
String url = idNSD + "/vnfdependencies" + "/" + idVnfd;
return (VNFDependency) requestGet(url, VNFDependency.class);
} | java | @Help(
help =
"get the VirtualNetworkFunctionDescriptor dependency with specific id of a NetworkServiceDescriptor with specific id"
)
public VNFDependency getVNFDependency(final String idNSD, final String idVnfd)
throws SDKException {
String url = idNSD + "/vnfdependencies" + "/" + idVnfd;
return (VNFDependency) requestGet(url, VNFDependency.class);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"get the VirtualNetworkFunctionDescriptor dependency with specific id of a NetworkServiceDescriptor with specific id\"",
")",
"public",
"VNFDependency",
"getVNFDependency",
"(",
"final",
"String",
"idNSD",
",",
"final",
"String",
"idVnfd",
")",
... | Return a specific VNFDependency that is contained in a particular NetworkServiceDescriptor.
@param idNSD the ID of the NetworkServiceDescriptor
@param idVnfd the VNFDependencies' ID
@return the VNFDependency
@throws SDKException if the request fails | [
"Return",
"a",
"specific",
"VNFDependency",
"that",
"is",
"contained",
"in",
"a",
"particular",
"NetworkServiceDescriptor",
"."
] | train | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L227-L235 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/ApiUtils.java | ApiUtils.getIntParam | public static int getIntParam(JSONObject params, String paramName) throws ApiException {
if (!params.containsKey(paramName)) {
throw new ApiException(ApiException.Type.MISSING_PARAMETER, paramName);
}
try {
return params.getInt(paramName);
} catch (JSONException e) {
throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, paramName, e);
}
} | java | public static int getIntParam(JSONObject params, String paramName) throws ApiException {
if (!params.containsKey(paramName)) {
throw new ApiException(ApiException.Type.MISSING_PARAMETER, paramName);
}
try {
return params.getInt(paramName);
} catch (JSONException e) {
throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, paramName, e);
}
} | [
"public",
"static",
"int",
"getIntParam",
"(",
"JSONObject",
"params",
",",
"String",
"paramName",
")",
"throws",
"ApiException",
"{",
"if",
"(",
"!",
"params",
".",
"containsKey",
"(",
"paramName",
")",
")",
"{",
"throw",
"new",
"ApiException",
"(",
"ApiExc... | Gets the int param with a given name and throws an exception accordingly if not found or
valid.
@param params the params
@param paramName the param name
@return the int param
@throws ApiException the api exception | [
"Gets",
"the",
"int",
"param",
"with",
"a",
"given",
"name",
"and",
"throws",
"an",
"exception",
"accordingly",
"if",
"not",
"found",
"or",
"valid",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/ApiUtils.java#L46-L56 |
alkacon/opencms-core | src/org/opencms/loader/CmsResourceManager.java | CmsResourceManager.getTemplateName | private String getTemplateName(CmsObject cms, CmsResource resource) throws CmsException {
String templateName = (String)(m_templateNameCache.getCachedObject(cms, resource.getRootPath()));
if (templateName == null) {
CmsProperty nameProperty = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
false);
String nameFromProperty = "";
if (!nameProperty.isNullProperty()) {
nameFromProperty = nameProperty.getValue();
}
m_templateNameCache.putCachedObject(cms, resource.getRootPath(), nameFromProperty);
return nameFromProperty;
} else {
return templateName;
}
} | java | private String getTemplateName(CmsObject cms, CmsResource resource) throws CmsException {
String templateName = (String)(m_templateNameCache.getCachedObject(cms, resource.getRootPath()));
if (templateName == null) {
CmsProperty nameProperty = cms.readPropertyObject(
resource,
CmsPropertyDefinition.PROPERTY_TEMPLATE_ELEMENTS,
false);
String nameFromProperty = "";
if (!nameProperty.isNullProperty()) {
nameFromProperty = nameProperty.getValue();
}
m_templateNameCache.putCachedObject(cms, resource.getRootPath(), nameFromProperty);
return nameFromProperty;
} else {
return templateName;
}
} | [
"private",
"String",
"getTemplateName",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsException",
"{",
"String",
"templateName",
"=",
"(",
"String",
")",
"(",
"m_templateNameCache",
".",
"getCachedObject",
"(",
"cms",
",",
"resource",... | Gets the template name for a template resource, using a cache for efficiency.<p>
@param cms the current CMS context
@param resource the template resource
@return the template name
@throws CmsException if something goes wrong | [
"Gets",
"the",
"template",
"name",
"for",
"a",
"template",
"resource",
"using",
"a",
"cache",
"for",
"efficiency",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsResourceManager.java#L1292-L1309 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_http_route_routeId_PUT | public void serviceName_http_route_routeId_PUT(String serviceName, Long routeId, OvhRouteHttp body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_http_route_routeId_PUT(String serviceName, Long routeId, OvhRouteHttp body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_http_route_routeId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"routeId",
",",
"OvhRouteHttp",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/http/route/{routeId}\"",
";",
"StringBuild... | Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/http/route/{routeId}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param routeId [required] Id of your route | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L240-L244 |
dadoonet/fscrawler | core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java | FsParserAbstract.updateFsJob | private void updateFsJob(String jobName, LocalDateTime scanDate) throws Exception {
// We need to round that latest date to the lower second and
// remove 2 seconds.
// See #82: https://github.com/dadoonet/fscrawler/issues/82
scanDate = scanDate.minus(2, ChronoUnit.SECONDS);
FsJob fsJob = FsJob.builder()
.setName(jobName)
.setLastrun(scanDate)
.setIndexed(stats.getNbDocScan())
.setDeleted(stats.getNbDocDeleted())
.build();
fsJobFileHandler.write(jobName, fsJob);
} | java | private void updateFsJob(String jobName, LocalDateTime scanDate) throws Exception {
// We need to round that latest date to the lower second and
// remove 2 seconds.
// See #82: https://github.com/dadoonet/fscrawler/issues/82
scanDate = scanDate.minus(2, ChronoUnit.SECONDS);
FsJob fsJob = FsJob.builder()
.setName(jobName)
.setLastrun(scanDate)
.setIndexed(stats.getNbDocScan())
.setDeleted(stats.getNbDocDeleted())
.build();
fsJobFileHandler.write(jobName, fsJob);
} | [
"private",
"void",
"updateFsJob",
"(",
"String",
"jobName",
",",
"LocalDateTime",
"scanDate",
")",
"throws",
"Exception",
"{",
"// We need to round that latest date to the lower second and",
"// remove 2 seconds.",
"// See #82: https://github.com/dadoonet/fscrawler/issues/82",
"scanD... | Update the job metadata
@param jobName job name
@param scanDate last date we scan the dirs
@throws Exception In case of error | [
"Update",
"the",
"job",
"metadata"
] | train | https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/core/src/main/java/fr/pilato/elasticsearch/crawler/fs/FsParserAbstract.java#L208-L220 |
kite-sdk/kite | kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemDatasets.java | FileSystemDatasets.viewForUri | public static <E> View<E> viewForUri(Dataset<E> dataset, String uri) {
return viewForUri(dataset, URI.create(uri));
} | java | public static <E> View<E> viewForUri(Dataset<E> dataset, String uri) {
return viewForUri(dataset, URI.create(uri));
} | [
"public",
"static",
"<",
"E",
">",
"View",
"<",
"E",
">",
"viewForUri",
"(",
"Dataset",
"<",
"E",
">",
"dataset",
",",
"String",
"uri",
")",
"{",
"return",
"viewForUri",
"(",
"dataset",
",",
"URI",
".",
"create",
"(",
"uri",
")",
")",
";",
"}"
] | Convert a URI for a partition directory in a filesystem dataset to a {@link View}
object representing that partition.
@param dataset the (partitioned) filesystem dataset
@param uri the path to the partition directory
@return a view of the partition | [
"Convert",
"a",
"URI",
"for",
"a",
"partition",
"directory",
"in",
"a",
"filesystem",
"dataset",
"to",
"a",
"{"
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemDatasets.java#L52-L54 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsPropertyCustom.java | CmsPropertyCustom.actionEdit | @Override
public void actionEdit(HttpServletRequest request) throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
try {
// save the changes only if resource is properly locked
if (isEditable()) {
performEditOperation(request);
}
} catch (Throwable e) {
// Cms error defining property, show error dialog
includeErrorpage(this, e);
}
} | java | @Override
public void actionEdit(HttpServletRequest request) throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
try {
// save the changes only if resource is properly locked
if (isEditable()) {
performEditOperation(request);
}
} catch (Throwable e) {
// Cms error defining property, show error dialog
includeErrorpage(this, e);
}
} | [
"@",
"Override",
"public",
"void",
"actionEdit",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"JspException",
"{",
"// save initialized instance of this class in request attribute for included sub-elements",
"getJsp",
"(",
")",
".",
"getRequest",
"(",
")",
".",
"set... | Performs the edit properties action, will be called by the JSP page.<p>
@param request the HttpServletRequest
@throws JspException if problems including sub-elements occur | [
"Performs",
"the",
"edit",
"properties",
"action",
"will",
"be",
"called",
"by",
"the",
"JSP",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPropertyCustom.java#L113-L127 |
kohsuke/com4j | runtime/src/main/java/com4j/COM4J.java | COM4J.getObject | public static <T extends Com4jObject> T getObject(Class<T> primaryInterface, String fileName, String progId ) {
return new GetObjectTask<T>(fileName,progId,primaryInterface).execute();
} | java | public static <T extends Com4jObject> T getObject(Class<T> primaryInterface, String fileName, String progId ) {
return new GetObjectTask<T>(fileName,progId,primaryInterface).execute();
} | [
"public",
"static",
"<",
"T",
"extends",
"Com4jObject",
">",
"T",
"getObject",
"(",
"Class",
"<",
"T",
">",
"primaryInterface",
",",
"String",
"fileName",
",",
"String",
"progId",
")",
"{",
"return",
"new",
"GetObjectTask",
"<",
"T",
">",
"(",
"fileName",
... | Returns a reference to a COM object primarily by loading a file.
<p>
This method implements the semantics of the {@code GetObject} Visual Basic
function. See <a href="http://msdn2.microsoft.com/en-us/library/e9waz863(VS.71).aspx">MSDN reference</a>
for its semantics.
<p>
This function really has three different mode of operation:
<ul>
<li>
If both {@code fileName} and {@code progId} are specified,
a COM object of the given progId is created and its state is loaded
from the given file name. This is normally used to activate a OLE server
by loading a file.
<li>
If just {@code fileName} is specified, it is treated as a moniker.
The moniker will be bound and the resulting COM object will be returned.
In a simple case a moniker is a file path, in which case the associated
application is activated and loads the data. But monikers in OLE are
extensible, so in more general case the semantics really depends on
the moniker provider.
<li>
If just {@code progId} is specified, this method would just work like
{@link #getActiveObject(Class, String)}.
</ul>
@param <T> the type of the return value and the type parameter of the class object of primaryInterface
@param primaryInterface The returned COM object is returned as this interface.
Must be non-null. Passing in {@link Com4jObject} allows
the caller to create a new instance without knowing
its primary interface.
@param fileName path to the file
@param progId the progID in string representation
@return non-null valid object.
@throws ComException if the retrieval fails. | [
"Returns",
"a",
"reference",
"to",
"a",
"COM",
"object",
"primarily",
"by",
"loading",
"a",
"file",
"."
] | train | https://github.com/kohsuke/com4j/blob/1e690b805fb0e4e9ef61560e20a56335aecb0b24/runtime/src/main/java/com4j/COM4J.java#L257-L259 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendClose | public static void sendClose(final CloseMessage closeMessage, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendClose(closeMessage, wsChannel, callback, null);
} | java | public static void sendClose(final CloseMessage closeMessage, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendClose(closeMessage, wsChannel, callback, null);
} | [
"public",
"static",
"void",
"sendClose",
"(",
"final",
"CloseMessage",
"closeMessage",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"Void",
">",
"callback",
")",
"{",
"sendClose",
"(",
"closeMessage",
",",
"wsChannel",
","... | Sends a complete close message, invoking the callback when complete
@param closeMessage The close message
@param wsChannel The web socket channel
@param callback The callback to invoke on completion | [
"Sends",
"a",
"complete",
"close",
"message",
"invoking",
"the",
"callback",
"when",
"complete"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L841-L843 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java | ImageIOHelper.createTiffFiles | public static List<File> createTiffFiles(File imageFile, int index) throws IOException {
return createTiffFiles(imageFile, index, false);
} | java | public static List<File> createTiffFiles(File imageFile, int index) throws IOException {
return createTiffFiles(imageFile, index, false);
} | [
"public",
"static",
"List",
"<",
"File",
">",
"createTiffFiles",
"(",
"File",
"imageFile",
",",
"int",
"index",
")",
"throws",
"IOException",
"{",
"return",
"createTiffFiles",
"(",
"imageFile",
",",
"index",
",",
"false",
")",
";",
"}"
] | Creates a list of TIFF image files from an image file. It basically
converts images of other formats to TIFF format, or a multi-page TIFF
image to multiple TIFF image files.
@param imageFile input image file
@param index an index of the page; -1 means all pages, as in a multi-page
TIFF image
@return a list of TIFF image files
@throws IOException | [
"Creates",
"a",
"list",
"of",
"TIFF",
"image",
"files",
"from",
"an",
"image",
"file",
".",
"It",
"basically",
"converts",
"images",
"of",
"other",
"formats",
"to",
"TIFF",
"format",
"or",
"a",
"multi",
"-",
"page",
"TIFF",
"image",
"to",
"multiple",
"TI... | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java#L79-L81 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatednasha/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednasha.java | ApiOvhDedicatednasha.serviceName_partition_partitionName_snapshot_snapshotType_GET | public OvhSnapshot serviceName_partition_partitionName_snapshot_snapshotType_GET(String serviceName, String partitionName, net.minidev.ovh.api.dedicated.storage.OvhSnapshotEnum snapshotType) throws IOException {
String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/snapshot/{snapshotType}";
StringBuilder sb = path(qPath, serviceName, partitionName, snapshotType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSnapshot.class);
} | java | public OvhSnapshot serviceName_partition_partitionName_snapshot_snapshotType_GET(String serviceName, String partitionName, net.minidev.ovh.api.dedicated.storage.OvhSnapshotEnum snapshotType) throws IOException {
String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/snapshot/{snapshotType}";
StringBuilder sb = path(qPath, serviceName, partitionName, snapshotType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSnapshot.class);
} | [
"public",
"OvhSnapshot",
"serviceName_partition_partitionName_snapshot_snapshotType_GET",
"(",
"String",
"serviceName",
",",
"String",
"partitionName",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"dedicated",
".",
"storage",
".",
"OvhSnapshotEnum",
"snapsho... | Get this object properties
REST: GET /dedicated/nasha/{serviceName}/partition/{partitionName}/snapshot/{snapshotType}
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition
@param snapshotType [required] the interval of snapshot | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednasha/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednasha.java#L296-L301 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java | BackupLongTermRetentionVaultsInner.beginCreateOrUpdate | public BackupLongTermRetentionVaultInner beginCreateOrUpdate(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).toBlocking().single().body();
} | java | public BackupLongTermRetentionVaultInner beginCreateOrUpdate(String resourceGroupName, String serverName, String recoveryServicesVaultResourceId) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, recoveryServicesVaultResourceId).toBlocking().single().body();
} | [
"public",
"BackupLongTermRetentionVaultInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recoveryServicesVaultResourceId",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",... | Updates a server backup long term retention vault.
@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 serverName The name of the server.
@param recoveryServicesVaultResourceId The azure recovery services vault resource id
@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 BackupLongTermRetentionVaultInner object if successful. | [
"Updates",
"a",
"server",
"backup",
"long",
"term",
"retention",
"vault",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java#L252-L254 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.removePolicy | public boolean removePolicy(String sec, String ptype, List<String> rule) {
for (int i = 0; i < model.get(sec).get(ptype).policy.size(); i ++) {
List<String> r = model.get(sec).get(ptype).policy.get(i);
if (Util.arrayEquals(rule, r)) {
model.get(sec).get(ptype).policy.remove(i);
return true;
}
}
return false;
} | java | public boolean removePolicy(String sec, String ptype, List<String> rule) {
for (int i = 0; i < model.get(sec).get(ptype).policy.size(); i ++) {
List<String> r = model.get(sec).get(ptype).policy.get(i);
if (Util.arrayEquals(rule, r)) {
model.get(sec).get(ptype).policy.remove(i);
return true;
}
}
return false;
} | [
"public",
"boolean",
"removePolicy",
"(",
"String",
"sec",
",",
"String",
"ptype",
",",
"List",
"<",
"String",
">",
"rule",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"model",
".",
"get",
"(",
"sec",
")",
".",
"get",
"(",
"ptype",... | removePolicy removes a policy rule from the model.
@param sec the section, "p" or "g".
@param ptype the policy type, "p", "p2", .. or "g", "g2", ..
@param rule the policy rule.
@return succeeds or not. | [
"removePolicy",
"removes",
"a",
"policy",
"rule",
"from",
"the",
"model",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L163-L173 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java | WebDriverTool.processField | public void processField(final By by, final String dataSetKey, final String dataKey) {
checkTopmostElement(by);
fih.by(by).dataSet(dataSets.get(dataSetKey)).dataKey(dataKey).perform();
} | java | public void processField(final By by, final String dataSetKey, final String dataKey) {
checkTopmostElement(by);
fih.by(by).dataSet(dataSets.get(dataSetKey)).dataKey(dataKey).perform();
} | [
"public",
"void",
"processField",
"(",
"final",
"By",
"by",
",",
"final",
"String",
"dataSetKey",
",",
"final",
"String",
"dataKey",
")",
"{",
"checkTopmostElement",
"(",
"by",
")",
";",
"fih",
".",
"by",
"(",
"by",
")",
".",
"dataSet",
"(",
"dataSets",
... | Uses the internal {@link FormInputHandler} to set a form field.
@param by
the {@link By} used to locate the element representing an HTML input or
textarea
@param dataSetKey
the data set key
@param dataKey
the key used to retrieve the value for the field from the data set with the
specifies data set key | [
"Uses",
"the",
"internal",
"{",
"@link",
"FormInputHandler",
"}",
"to",
"set",
"a",
"form",
"field",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L633-L636 |
icode/ameba | src/main/java/ameba/message/jackson/internal/JacksonUtils.java | JacksonUtils.configureMapper | public static void configureMapper(ObjectMapper mapper, Application.Mode mode) {
mapper.registerModule(new GuavaModule());
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
.enable(SerializationFeature.WRITE_ENUMS_USING_INDEX)
.enable(MapperFeature.PROPAGATE_TRANSIENT_MARKER)
.disable(
SerializationFeature.WRITE_NULL_MAP_VALUES,
SerializationFeature.FAIL_ON_EMPTY_BEANS
);
if (!mode.isDev()) {
mapper.disable(
DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
);
}
} | java | public static void configureMapper(ObjectMapper mapper, Application.Mode mode) {
mapper.registerModule(new GuavaModule());
mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
.enable(SerializationFeature.WRITE_ENUMS_USING_INDEX)
.enable(MapperFeature.PROPAGATE_TRANSIENT_MARKER)
.disable(
SerializationFeature.WRITE_NULL_MAP_VALUES,
SerializationFeature.FAIL_ON_EMPTY_BEANS
);
if (!mode.isDev()) {
mapper.disable(
DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
);
}
} | [
"public",
"static",
"void",
"configureMapper",
"(",
"ObjectMapper",
"mapper",
",",
"Application",
".",
"Mode",
"mode",
")",
"{",
"mapper",
".",
"registerModule",
"(",
"new",
"GuavaModule",
"(",
")",
")",
";",
"mapper",
".",
"setSerializationInclusion",
"(",
"J... | <p>configureMapper.</p>
@param mapper a {@link com.fasterxml.jackson.databind.ObjectMapper} object.
@param mode App mode | [
"<p",
">",
"configureMapper",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/message/jackson/internal/JacksonUtils.java#L93-L107 |
usman-h/Habanero | src/main/java/com/usmanhussain/habanero/configuration/LoadProperties.java | LoadProperties.loadProps | public static void loadProps(Properties props, File file) throws IOException {
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
props.load(fis);
} finally {
if (null != fis) {
fis.close();
}
}
} | java | public static void loadProps(Properties props, File file) throws IOException {
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
props.load(fis);
} finally {
if (null != fis) {
fis.close();
}
}
} | [
"public",
"static",
"void",
"loadProps",
"(",
"Properties",
"props",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"fis",
"=",
"null",
";",
"try",
"{",
"fis",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"props",
".",
... | Loads in the properties file
@param props Properties being loaded from the file
@param file File declartion that is being used
@throws java.io.IOException IOException is thrown | [
"Loads",
"in",
"the",
"properties",
"file"
] | train | https://github.com/usman-h/Habanero/blob/da962025ee8c2a9da7b28905359a6821b579b6d8/src/main/java/com/usmanhussain/habanero/configuration/LoadProperties.java#L52-L62 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.