repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getWvWMatchDetail | public void getWvWMatchDetail(int worldID, Callback<WvWMatchDetail> callback) throws NullPointerException {
gw2API.getWvWMatchInfoUsingWorld(Integer.toString(worldID)).enqueue(callback);
} | java | public void getWvWMatchDetail(int worldID, Callback<WvWMatchDetail> callback) throws NullPointerException {
gw2API.getWvWMatchInfoUsingWorld(Integer.toString(worldID)).enqueue(callback);
} | [
"public",
"void",
"getWvWMatchDetail",
"(",
"int",
"worldID",
",",
"Callback",
"<",
"WvWMatchDetail",
">",
"callback",
")",
"throws",
"NullPointerException",
"{",
"gw2API",
".",
"getWvWMatchInfoUsingWorld",
"(",
"Integer",
".",
"toString",
"(",
"worldID",
")",
")"... | For more info on WvW matches API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/matches">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param worldID {@link World#id}
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see WvWMatchDetail WvW match detailed info | [
"For",
"more",
"info",
"on",
"WvW",
"matches",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"wvw",
"/",
"matches",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2610-L2612 |
oaqa/uima-ecd | src/main/java/edu/cmu/lti/oaqa/ecd/BaseExperimentBuilder.java | BaseExperimentBuilder.loadFromClassOrInherit | @Deprecated
public static <C> Class<? extends C> loadFromClassOrInherit(String handle, Class<C> ifaceClass,
Map<String, Object> tuples) throws Exception {
String[] name = handle.split("!");
if (name[0].equals("class")) {
return Class.forName(name[1]).asSubclass(ifaceClass);
} else {
if (name[0].equals("inherit")) {
AnyObject yaml = ConfigurationLoader.load(name[1]);
return getFromClassOrInherit(yaml, ifaceClass, tuples);
} else {
throw new IllegalArgumentException(
"Illegal experiment descriptor, must contain one node of type <class> or <inherit>");
}
}
} | java | @Deprecated
public static <C> Class<? extends C> loadFromClassOrInherit(String handle, Class<C> ifaceClass,
Map<String, Object> tuples) throws Exception {
String[] name = handle.split("!");
if (name[0].equals("class")) {
return Class.forName(name[1]).asSubclass(ifaceClass);
} else {
if (name[0].equals("inherit")) {
AnyObject yaml = ConfigurationLoader.load(name[1]);
return getFromClassOrInherit(yaml, ifaceClass, tuples);
} else {
throw new IllegalArgumentException(
"Illegal experiment descriptor, must contain one node of type <class> or <inherit>");
}
}
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"C",
">",
"Class",
"<",
"?",
"extends",
"C",
">",
"loadFromClassOrInherit",
"(",
"String",
"handle",
",",
"Class",
"<",
"C",
">",
"ifaceClass",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"tuples",
")",
"t... | These methods are preserved for compatibility with the old version of PhaseImpl | [
"These",
"methods",
"are",
"preserved",
"for",
"compatibility",
"with",
"the",
"old",
"version",
"of",
"PhaseImpl"
] | train | https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/ecd/BaseExperimentBuilder.java#L519-L534 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java | WorkflowExecutor.validateWorkflow | private void validateWorkflow(WorkflowDef workflowDef, Map<String, Object> workflowInput, String externalStoragePath) {
try {
//Check if the input to the workflow is not null
if (workflowInput == null && StringUtils.isBlank(externalStoragePath)) {
LOGGER.error("The input for the workflow '{}' cannot be NULL", workflowDef.getName());
throw new ApplicationException(INVALID_INPUT, "NULL input passed when starting workflow");
}
} catch (Exception e) {
Monitors.recordWorkflowStartError(workflowDef.getName(), WorkflowContext.get().getClientApp());
throw e;
}
} | java | private void validateWorkflow(WorkflowDef workflowDef, Map<String, Object> workflowInput, String externalStoragePath) {
try {
//Check if the input to the workflow is not null
if (workflowInput == null && StringUtils.isBlank(externalStoragePath)) {
LOGGER.error("The input for the workflow '{}' cannot be NULL", workflowDef.getName());
throw new ApplicationException(INVALID_INPUT, "NULL input passed when starting workflow");
}
} catch (Exception e) {
Monitors.recordWorkflowStartError(workflowDef.getName(), WorkflowContext.get().getClientApp());
throw e;
}
} | [
"private",
"void",
"validateWorkflow",
"(",
"WorkflowDef",
"workflowDef",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"workflowInput",
",",
"String",
"externalStoragePath",
")",
"{",
"try",
"{",
"//Check if the input to the workflow is not null",
"if",
"(",
"workfl... | Performs validations for starting a workflow
@throws ApplicationException if the validation fails | [
"Performs",
"validations",
"for",
"starting",
"a",
"workflow"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java#L313-L324 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, Observable<R>> toAsync(Func4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> func) {
return toAsync(func, Schedulers.computation());
} | java | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, Observable<R>> toAsync(Func4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> func) {
return toAsync(func, Schedulers.computation());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"Func4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"Observable",
"<",
"R",
">",
">",
"toAsync",
"(",
"Func4",
"<",
"?",
"super",
"T1",
",",
"?",
"super",
... | Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <T4> the fourth parameter type
@param <R> the result type
@param func the function to convert
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229911.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L363-L365 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallUser | public static UserBean unmarshallUser(Map<String, Object> source) {
if (source == null) {
return null;
}
UserBean bean = new UserBean();
bean.setUsername(asString(source.get("username")));
bean.setEmail(asString(source.get("email")));
bean.setFullName(asString(source.get("fullName")));
bean.setJoinedOn(asDate(source.get("joinedOn")));
postMarshall(bean);
return bean;
} | java | public static UserBean unmarshallUser(Map<String, Object> source) {
if (source == null) {
return null;
}
UserBean bean = new UserBean();
bean.setUsername(asString(source.get("username")));
bean.setEmail(asString(source.get("email")));
bean.setFullName(asString(source.get("fullName")));
bean.setJoinedOn(asDate(source.get("joinedOn")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"UserBean",
"unmarshallUser",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"UserBean",
"bean",
"=",
"new",
"UserBean",
"(",
")",
";",
"... | Unmarshals the given map source into a bean.
@param source the source
@return the user | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L1134-L1145 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.addCdataSectionElement | private void addCdataSectionElement(String URI_and_localName, Vector v)
{
StringTokenizer tokenizer =
new StringTokenizer(URI_and_localName, "{}", false);
String s1 = tokenizer.nextToken();
String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
if (null == s2)
{
// add null URI and the local name
v.addElement(null);
v.addElement(s1);
}
else
{
// add URI, then local name
v.addElement(s1);
v.addElement(s2);
}
} | java | private void addCdataSectionElement(String URI_and_localName, Vector v)
{
StringTokenizer tokenizer =
new StringTokenizer(URI_and_localName, "{}", false);
String s1 = tokenizer.nextToken();
String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
if (null == s2)
{
// add null URI and the local name
v.addElement(null);
v.addElement(s1);
}
else
{
// add URI, then local name
v.addElement(s1);
v.addElement(s2);
}
} | [
"private",
"void",
"addCdataSectionElement",
"(",
"String",
"URI_and_localName",
",",
"Vector",
"v",
")",
"{",
"StringTokenizer",
"tokenizer",
"=",
"new",
"StringTokenizer",
"(",
"URI_and_localName",
",",
"\"{}\"",
",",
"false",
")",
";",
"String",
"s1",
"=",
"t... | Adds a URI/LocalName pair of strings to the list.
@param URI_and_localName String of the form "{uri}local" or "local"
@return a QName object | [
"Adds",
"a",
"URI",
"/",
"LocalName",
"pair",
"of",
"strings",
"to",
"the",
"list",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L2780-L2800 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java | GrailsHibernateUtil.cacheCriteriaByMapping | public static void cacheCriteriaByMapping(Class<?> targetClass, Criteria criteria) {
Mapping m = GrailsDomainBinder.getMapping(targetClass);
if (m != null && m.getCache() != null && m.getCache().getEnabled()) {
criteria.setCacheable(true);
}
} | java | public static void cacheCriteriaByMapping(Class<?> targetClass, Criteria criteria) {
Mapping m = GrailsDomainBinder.getMapping(targetClass);
if (m != null && m.getCache() != null && m.getCache().getEnabled()) {
criteria.setCacheable(true);
}
} | [
"public",
"static",
"void",
"cacheCriteriaByMapping",
"(",
"Class",
"<",
"?",
">",
"targetClass",
",",
"Criteria",
"criteria",
")",
"{",
"Mapping",
"m",
"=",
"GrailsDomainBinder",
".",
"getMapping",
"(",
"targetClass",
")",
";",
"if",
"(",
"m",
"!=",
"null",... | Configures the criteria instance to cache based on the configured mapping.
@param targetClass The target class
@param criteria The criteria | [
"Configures",
"the",
"criteria",
"instance",
"to",
"cache",
"based",
"on",
"the",
"configured",
"mapping",
"."
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java#L256-L261 |
Chorus-bdd/Chorus | extensions/chorus-spring/src/main/java/org/chorusbdd/chorus/spring/SpringContextInjector.java | SpringContextInjector.injectResourceFields | public static void injectResourceFields(ApplicationContext springContext, Object... handlers ) {
for (Object handler : handlers) {
Class handlerClass = handler.getClass();
injectResourceFields(springContext, handler, handlerClass);
}
} | java | public static void injectResourceFields(ApplicationContext springContext, Object... handlers ) {
for (Object handler : handlers) {
Class handlerClass = handler.getClass();
injectResourceFields(springContext, handler, handlerClass);
}
} | [
"public",
"static",
"void",
"injectResourceFields",
"(",
"ApplicationContext",
"springContext",
",",
"Object",
"...",
"handlers",
")",
"{",
"for",
"(",
"Object",
"handler",
":",
"handlers",
")",
"{",
"Class",
"handlerClass",
"=",
"handler",
".",
"getClass",
"(",... | Inject the fields annotated with @Resource annotation with beans from a SpringContext, using the field
name to match the bean name, or where a different annotation value is supplied use the annotation value
as the bean name
@param handlers handler instances to configure
@param springContext Spring context to supply beans | [
"Inject",
"the",
"fields",
"annotated",
"with",
"@Resource",
"annotation",
"with",
"beans",
"from",
"a",
"SpringContext",
"using",
"the",
"field",
"name",
"to",
"match",
"the",
"bean",
"name",
"or",
"where",
"a",
"different",
"annotation",
"value",
"is",
"supp... | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/extensions/chorus-spring/src/main/java/org/chorusbdd/chorus/spring/SpringContextInjector.java#L118-L124 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardSgroupGenerator.java | StandardSgroupGenerator.generateSgroups | IRenderingElement generateSgroups(IAtomContainer container, AtomSymbol[] symbols) {
ElementGroup result = new ElementGroup();
List<Sgroup> sgroups = container.getProperty(CDKConstants.CTAB_SGROUPS);
if (sgroups == null || sgroups.isEmpty())
return result;
Map<IAtom, AtomSymbol> symbolMap = new HashMap<>();
for (int i = 0; i < symbols.length; i++) {
if (symbols[i] != null)
symbolMap.put(container.getAtom(i), symbols[i]);
}
for (Sgroup sgroup : sgroups) {
switch (sgroup.getType()) {
case CtabAbbreviation:
result.add(generateAbbreviationSgroup(container, sgroup));
break;
case CtabMultipleGroup:
result.add(generateMultipleSgroup(sgroup, symbolMap));
break;
case CtabAnyPolymer:
case CtabMonomer:
case CtabCrossLink:
case CtabCopolymer:
case CtabStructureRepeatUnit:
case CtabMer:
case CtabGraft:
case CtabModified:
result.add(generatePolymerSgroup(sgroup, symbolMap));
break;
case CtabComponent:
case CtabMixture:
case CtabFormulation:
result.add(generateMixtureSgroup(sgroup));
break;
case CtabGeneric:
// not strictly a polymer but okay to draw as one
result.add(generatePolymerSgroup(sgroup, null));
break;
}
}
return result;
} | java | IRenderingElement generateSgroups(IAtomContainer container, AtomSymbol[] symbols) {
ElementGroup result = new ElementGroup();
List<Sgroup> sgroups = container.getProperty(CDKConstants.CTAB_SGROUPS);
if (sgroups == null || sgroups.isEmpty())
return result;
Map<IAtom, AtomSymbol> symbolMap = new HashMap<>();
for (int i = 0; i < symbols.length; i++) {
if (symbols[i] != null)
symbolMap.put(container.getAtom(i), symbols[i]);
}
for (Sgroup sgroup : sgroups) {
switch (sgroup.getType()) {
case CtabAbbreviation:
result.add(generateAbbreviationSgroup(container, sgroup));
break;
case CtabMultipleGroup:
result.add(generateMultipleSgroup(sgroup, symbolMap));
break;
case CtabAnyPolymer:
case CtabMonomer:
case CtabCrossLink:
case CtabCopolymer:
case CtabStructureRepeatUnit:
case CtabMer:
case CtabGraft:
case CtabModified:
result.add(generatePolymerSgroup(sgroup, symbolMap));
break;
case CtabComponent:
case CtabMixture:
case CtabFormulation:
result.add(generateMixtureSgroup(sgroup));
break;
case CtabGeneric:
// not strictly a polymer but okay to draw as one
result.add(generatePolymerSgroup(sgroup, null));
break;
}
}
return result;
} | [
"IRenderingElement",
"generateSgroups",
"(",
"IAtomContainer",
"container",
",",
"AtomSymbol",
"[",
"]",
"symbols",
")",
"{",
"ElementGroup",
"result",
"=",
"new",
"ElementGroup",
"(",
")",
";",
"List",
"<",
"Sgroup",
">",
"sgroups",
"=",
"container",
".",
"ge... | Generate the Sgroup elements for the provided atom contains.
@param container molecule
@return Sgroup rendering elements | [
"Generate",
"the",
"Sgroup",
"elements",
"for",
"the",
"provided",
"atom",
"contains",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/StandardSgroupGenerator.java#L282-L328 |
infinispan/infinispan | client/hotrod-client/src/main/java/org/infinispan/client/hotrod/configuration/ExecutorFactoryConfigurationBuilder.java | ExecutorFactoryConfigurationBuilder.addExecutorProperty | public ExecutorFactoryConfigurationBuilder addExecutorProperty(String key, String value) {
this.properties.put(key, value);
return this;
} | java | public ExecutorFactoryConfigurationBuilder addExecutorProperty(String key, String value) {
this.properties.put(key, value);
return this;
} | [
"public",
"ExecutorFactoryConfigurationBuilder",
"addExecutorProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"properties",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add key/value property pair to this executor factory configuration
@param key
property key
@param value
property value
@return previous value if exists, null otherwise | [
"Add",
"key",
"/",
"value",
"property",
"pair",
"to",
"this",
"executor",
"factory",
"configuration"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/configuration/ExecutorFactoryConfigurationBuilder.java#L68-L71 |
jenkinsci/jenkins | cli/src/main/java/hudson/cli/FullDuplexHttpStream.java | FullDuplexHttpStream.tryToResolveRedirects | private URL tryToResolveRedirects(URL base, String authorization) {
try {
HttpURLConnection con = (HttpURLConnection) base.openConnection();
if (authorization != null) {
con.addRequestProperty("Authorization", authorization);
}
con.getInputStream().close();
base = con.getURL();
} catch (Exception ex) {
// Do not obscure the problem propagating the exception. If the problem is real it will manifest during the
// actual exchange so will be reported properly there. If it is not real (no permission in UI but sufficient
// for CLI connection using one of its mechanisms), there is no reason to bother user about it.
LOGGER.log(Level.FINE, "Failed to resolve potential redirects", ex);
}
return base;
} | java | private URL tryToResolveRedirects(URL base, String authorization) {
try {
HttpURLConnection con = (HttpURLConnection) base.openConnection();
if (authorization != null) {
con.addRequestProperty("Authorization", authorization);
}
con.getInputStream().close();
base = con.getURL();
} catch (Exception ex) {
// Do not obscure the problem propagating the exception. If the problem is real it will manifest during the
// actual exchange so will be reported properly there. If it is not real (no permission in UI but sufficient
// for CLI connection using one of its mechanisms), there is no reason to bother user about it.
LOGGER.log(Level.FINE, "Failed to resolve potential redirects", ex);
}
return base;
} | [
"private",
"URL",
"tryToResolveRedirects",
"(",
"URL",
"base",
",",
"String",
"authorization",
")",
"{",
"try",
"{",
"HttpURLConnection",
"con",
"=",
"(",
"HttpURLConnection",
")",
"base",
".",
"openConnection",
"(",
")",
";",
"if",
"(",
"authorization",
"!=",... | As this transport mode is using POST, it is necessary to resolve possible redirections using GET first. | [
"As",
"this",
"transport",
"mode",
"is",
"using",
"POST",
"it",
"is",
"necessary",
"to",
"resolve",
"possible",
"redirections",
"using",
"GET",
"first",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/cli/src/main/java/hudson/cli/FullDuplexHttpStream.java#L96-L111 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiEvent.java | BoxApiEvent.getLongPollServerConnection | public RealTimeServerConnection getLongPollServerConnection(RealTimeServerConnection.OnChangeListener changeListener) {
BoxRequestsEvent.EventRealTimeServerRequest request = new BoxRequestsEvent.EventRealTimeServerRequest(getEventsUrl(), mSession);
return new RealTimeServerConnection(request,changeListener, mSession );
} | java | public RealTimeServerConnection getLongPollServerConnection(RealTimeServerConnection.OnChangeListener changeListener) {
BoxRequestsEvent.EventRealTimeServerRequest request = new BoxRequestsEvent.EventRealTimeServerRequest(getEventsUrl(), mSession);
return new RealTimeServerConnection(request,changeListener, mSession );
} | [
"public",
"RealTimeServerConnection",
"getLongPollServerConnection",
"(",
"RealTimeServerConnection",
".",
"OnChangeListener",
"changeListener",
")",
"{",
"BoxRequestsEvent",
".",
"EventRealTimeServerRequest",
"request",
"=",
"new",
"BoxRequestsEvent",
".",
"EventRealTimeServerRe... | Gets a request that retrieves a RealTimeServerConnection, which is used to create a long poll to check for some generic change
to the user's account. This can be combined with syncing logic using getUserEventsRequest or getEnterpriseEventsRequest to discover what has changed.
@param changeListener A listener that will get triggered when a change has been made to the user's account or an exception has occurred.
@return A RealTimeServerConnection that checks for a change to a user's account. | [
"Gets",
"a",
"request",
"that",
"retrieves",
"a",
"RealTimeServerConnection",
"which",
"is",
"used",
"to",
"create",
"a",
"long",
"poll",
"to",
"check",
"for",
"some",
"generic",
"change",
"to",
"the",
"user",
"s",
"account",
".",
"This",
"can",
"be",
"com... | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiEvent.java#L54-L57 |
casmi/casmi | src/main/java/casmi/graphics/element/Polygon.java | Polygon.vertex | public void vertex(double x, double y) {
MODE = LINES;
this.cornerX.add(x);
this.cornerY.add(y);
this.cornerZ.add(0d);
setNumberOfCorner(this.cornerX.size());
calcG();
} | java | public void vertex(double x, double y) {
MODE = LINES;
this.cornerX.add(x);
this.cornerY.add(y);
this.cornerZ.add(0d);
setNumberOfCorner(this.cornerX.size());
calcG();
} | [
"public",
"void",
"vertex",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"MODE",
"=",
"LINES",
";",
"this",
".",
"cornerX",
".",
"add",
"(",
"x",
")",
";",
"this",
".",
"cornerY",
".",
"add",
"(",
"y",
")",
";",
"this",
".",
"cornerZ",
"."... | Adds the corner of Polygon.
@param x The x-coordinate of a new added corner.
@param y The y-coordinate of a new added corner. | [
"Adds",
"the",
"corner",
"of",
"Polygon",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Polygon.java#L71-L78 |
mockito/mockito | src/main/java/org/mockito/ArgumentMatchers.java | ArgumentMatchers.anyMap | public static <K, V> Map<K, V> anyMap() {
reportMatcher(new InstanceOf(Map.class, "<any map>"));
return new HashMap<K, V>(0);
} | java | public static <K, V> Map<K, V> anyMap() {
reportMatcher(new InstanceOf(Map.class, "<any map>"));
return new HashMap<K, V>(0);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"anyMap",
"(",
")",
"{",
"reportMatcher",
"(",
"new",
"InstanceOf",
"(",
"Map",
".",
"class",
",",
"\"<any map>\"",
")",
")",
";",
"return",
"new",
"HashMap",
"<",
"K",
... | Any <strong>non-null</strong> <code>Map</code>.
<p>
Since Mockito 2.1.0, only allow non-null <code>Map</code>.
As this is a nullable reference, the suggested API to <strong>match</strong> <code>null</code> wrapper
would be {@link #isNull()}. We felt this change would make tests harness much safer that it was with Mockito
1.x.
</p>
<p>
See examples in javadoc for {@link ArgumentMatchers} class.
</p>
@return empty Map.
@see #anyMapOf(Class, Class)
@see #isNull()
@see #isNull(Class) | [
"Any",
"<strong",
">",
"non",
"-",
"null<",
"/",
"strong",
">",
"<code",
">",
"Map<",
"/",
"code",
">",
"."
] | train | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/ArgumentMatchers.java#L609-L612 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/fastzipfilereader/ZipFileSliceReader.java | ZipFileSliceReader.getString | static String getString(final byte[] arr, final long off, final int lenBytes) throws IOException {
final int ioff = (int) off;
if (ioff < 0 || ioff > arr.length - lenBytes) {
throw new IndexOutOfBoundsException();
}
return new String(arr, ioff, lenBytes, StandardCharsets.UTF_8);
} | java | static String getString(final byte[] arr, final long off, final int lenBytes) throws IOException {
final int ioff = (int) off;
if (ioff < 0 || ioff > arr.length - lenBytes) {
throw new IndexOutOfBoundsException();
}
return new String(arr, ioff, lenBytes, StandardCharsets.UTF_8);
} | [
"static",
"String",
"getString",
"(",
"final",
"byte",
"[",
"]",
"arr",
",",
"final",
"long",
"off",
",",
"final",
"int",
"lenBytes",
")",
"throws",
"IOException",
"{",
"final",
"int",
"ioff",
"=",
"(",
"int",
")",
"off",
";",
"if",
"(",
"ioff",
"<",... | Get a string from a byte array.
@param arr
the byte array
@param off
the offset to start reading from
@param lenBytes
the length of the string in bytes
@return the string
@throws IOException
if an I/O exception occurs. | [
"Get",
"a",
"string",
"from",
"a",
"byte",
"array",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/fastzipfilereader/ZipFileSliceReader.java#L296-L302 |
bazaarvoice/emodb | table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java | AstyanaxTableDAO.writEventToSystemTable | private void writEventToSystemTable(String key, Delta delta, Audit audit) {
_backingStore.update(_systemTableUnPublishedDatabusEvents, key, TimeUUIDs.newUUID(), delta, audit, WriteConsistency.GLOBAL);
} | java | private void writEventToSystemTable(String key, Delta delta, Audit audit) {
_backingStore.update(_systemTableUnPublishedDatabusEvents, key, TimeUUIDs.newUUID(), delta, audit, WriteConsistency.GLOBAL);
} | [
"private",
"void",
"writEventToSystemTable",
"(",
"String",
"key",
",",
"Delta",
"delta",
",",
"Audit",
"audit",
")",
"{",
"_backingStore",
".",
"update",
"(",
"_systemTableUnPublishedDatabusEvents",
",",
"key",
",",
"TimeUUIDs",
".",
"newUUID",
"(",
")",
",",
... | /* Write the delta to the unpublished databus events system table which stores all the drop, purge, attribute changes, placement moves etc information of the tables. | [
"/",
"*",
"Write",
"the",
"delta",
"to",
"the",
"unpublished",
"databus",
"events",
"system",
"table",
"which",
"stores",
"all",
"the",
"drop",
"purge",
"attribute",
"changes",
"placement",
"moves",
"etc",
"information",
"of",
"the",
"tables",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java#L557-L559 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java | DocumentationTemplate.addSection | public Section addSection(Container container, String title, File... files) throws IOException {
return add(container, title, files);
} | java | public Section addSection(Container container, String title, File... files) throws IOException {
return add(container, title, files);
} | [
"public",
"Section",
"addSection",
"(",
"Container",
"container",
",",
"String",
"title",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"add",
"(",
"container",
",",
"title",
",",
"files",
")",
";",
"}"
] | Adds a section relating to a {@link Container} from one or more files.
@param container the {@link Container} the documentation content relates to
@param title the section title
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files | [
"Adds",
"a",
"section",
"relating",
"to",
"a",
"{",
"@link",
"Container",
"}",
"from",
"one",
"or",
"more",
"files",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/DocumentationTemplate.java#L100-L102 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/actions/MarkerRulerAction.java | MarkerRulerAction.includesRulerLine | protected boolean includesRulerLine(Position position, IDocument document) {
if (position != null && ruler != null) {
try {
int markerLine = document.getLineOfOffset(position.getOffset());
int line = ruler.getLineOfLastMouseButtonActivity();
if (line == markerLine) {
return true;
}
} catch (BadLocationException x) {
FindbugsPlugin.getDefault().logException(x, "Error getting marker line");
}
}
return false;
} | java | protected boolean includesRulerLine(Position position, IDocument document) {
if (position != null && ruler != null) {
try {
int markerLine = document.getLineOfOffset(position.getOffset());
int line = ruler.getLineOfLastMouseButtonActivity();
if (line == markerLine) {
return true;
}
} catch (BadLocationException x) {
FindbugsPlugin.getDefault().logException(x, "Error getting marker line");
}
}
return false;
} | [
"protected",
"boolean",
"includesRulerLine",
"(",
"Position",
"position",
",",
"IDocument",
"document",
")",
"{",
"if",
"(",
"position",
"!=",
"null",
"&&",
"ruler",
"!=",
"null",
")",
"{",
"try",
"{",
"int",
"markerLine",
"=",
"document",
".",
"getLineOfOff... | Checks a Position in a document to see whether the line of last mouse
activity falls within this region.
@param position
Position of the marker
@param document
the Document the marker resides in
@return true if the last mouse click falls on the same line as the marker | [
"Checks",
"a",
"Position",
"in",
"a",
"document",
"to",
"see",
"whether",
"the",
"line",
"of",
"last",
"mouse",
"activity",
"falls",
"within",
"this",
"region",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/actions/MarkerRulerAction.java#L194-L207 |
jhalterman/lyra | src/main/java/net/jodah/lyra/ConnectionOptions.java | ConnectionOptions.getAddresses | public Address[] getAddresses() {
if (addresses != null)
return addresses;
if (hosts != null) {
addresses = new Address[hosts.length];
for (int i = 0; i < hosts.length; i++)
addresses[i] = new Address(hosts[i], factory.getPort());
return addresses;
}
Address address = factory == null ? new Address("localhost", -1) : new Address(
factory.getHost(), factory.getPort());
return new Address[] { address };
} | java | public Address[] getAddresses() {
if (addresses != null)
return addresses;
if (hosts != null) {
addresses = new Address[hosts.length];
for (int i = 0; i < hosts.length; i++)
addresses[i] = new Address(hosts[i], factory.getPort());
return addresses;
}
Address address = factory == null ? new Address("localhost", -1) : new Address(
factory.getHost(), factory.getPort());
return new Address[] { address };
} | [
"public",
"Address",
"[",
"]",
"getAddresses",
"(",
")",
"{",
"if",
"(",
"addresses",
"!=",
"null",
")",
"return",
"addresses",
";",
"if",
"(",
"hosts",
"!=",
"null",
")",
"{",
"addresses",
"=",
"new",
"Address",
"[",
"hosts",
".",
"length",
"]",
";"... | Returns the addresses to attempt connections to, in round-robin order.
@see #withAddresses(Address...)
@see #withAddresses(String)
@see #withHost(String)
@see #withHosts(String...) | [
"Returns",
"the",
"addresses",
"to",
"attempt",
"connections",
"to",
"in",
"round",
"-",
"robin",
"order",
"."
] | train | https://github.com/jhalterman/lyra/blob/ce347a69357fef1b34e92d92a4f9e68792d81255/src/main/java/net/jodah/lyra/ConnectionOptions.java#L110-L124 |
paypal/SeLion | server/src/main/java/com/paypal/selion/grid/FileDownloader.java | FileDownloader.downloadFile | static String downloadFile(String artifactUrl, String checksum) {
LOGGER.entering(new Object[] { artifactUrl, checksum });
Preconditions.checkArgument(StringUtils.isNotBlank(artifactUrl), "Invalid URL: Cannot be null or empty");
Preconditions.checkArgument(StringUtils.isNotBlank(checksum), "Invalid CheckSum: Cannot be null or empty");
// Making sure only the files supported go through the download and extraction.
isValidFileType(artifactUrl);
String algorithm = null;
if (isValidSHA1(checksum)) {
algorithm = "SHA1";
} else if (isValidMD5(checksum)) {
algorithm = "MD5";
}
String result = downloadFile(artifactUrl, checksum, algorithm);
LOGGER.exiting(result);
return result;
} | java | static String downloadFile(String artifactUrl, String checksum) {
LOGGER.entering(new Object[] { artifactUrl, checksum });
Preconditions.checkArgument(StringUtils.isNotBlank(artifactUrl), "Invalid URL: Cannot be null or empty");
Preconditions.checkArgument(StringUtils.isNotBlank(checksum), "Invalid CheckSum: Cannot be null or empty");
// Making sure only the files supported go through the download and extraction.
isValidFileType(artifactUrl);
String algorithm = null;
if (isValidSHA1(checksum)) {
algorithm = "SHA1";
} else if (isValidMD5(checksum)) {
algorithm = "MD5";
}
String result = downloadFile(artifactUrl, checksum, algorithm);
LOGGER.exiting(result);
return result;
} | [
"static",
"String",
"downloadFile",
"(",
"String",
"artifactUrl",
",",
"String",
"checksum",
")",
"{",
"LOGGER",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"artifactUrl",
",",
"checksum",
"}",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
... | Download a file from the specified url
@param artifactUrl
url of the file to be downloaded.
@param checksum
checksum to downloaded file.
@return the downloaded file path. | [
"Download",
"a",
"file",
"from",
"the",
"specified",
"url"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/grid/FileDownloader.java#L292-L307 |
Fleker/ChannelSurfer | library/src/main/java/com/felkertech/channelsurfer/model/Channel.java | Channel.setLogoDrawable | public Channel setLogoDrawable(String id, String yourPackageName) {
String endpoint = "android.resource://"+id+"/drawable/";
this.logoUrl = endpoint + id;
return this;
} | java | public Channel setLogoDrawable(String id, String yourPackageName) {
String endpoint = "android.resource://"+id+"/drawable/";
this.logoUrl = endpoint + id;
return this;
} | [
"public",
"Channel",
"setLogoDrawable",
"(",
"String",
"id",
",",
"String",
"yourPackageName",
")",
"{",
"String",
"endpoint",
"=",
"\"android.resource://\"",
"+",
"id",
"+",
"\"/drawable/\"",
";",
"this",
".",
"logoUrl",
"=",
"endpoint",
"+",
"id",
";",
"retu... | If the logo is local, you can provide a drawable instead of a URL
Provide the id from R.drawable.{id} as a String
@param id resource name of your logo
@param yourPackageName Package name of your app (should be a temporary thing)
@return Itself | [
"If",
"the",
"logo",
"is",
"local",
"you",
"can",
"provide",
"a",
"drawable",
"instead",
"of",
"a",
"URL",
"Provide",
"the",
"id",
"from",
"R",
".",
"drawable",
".",
"{",
"id",
"}",
"as",
"a",
"String"
] | train | https://github.com/Fleker/ChannelSurfer/blob/f677beae37112f463c0c4783967fdb8fa97eb633/library/src/main/java/com/felkertech/channelsurfer/model/Channel.java#L87-L91 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ling/WordLemmaTagFactory.java | WordLemmaTagFactory.newLabel | public Label newLabel(String labelStr, int options) {
if (options == TAG_LABEL) {
return new WordLemmaTag(null, null, labelStr);
} else if (options == LEMMA_LABEL) {
return new WordLemmaTag(null, labelStr, null);
} else {
return new WordLemmaTag(labelStr);
}
} | java | public Label newLabel(String labelStr, int options) {
if (options == TAG_LABEL) {
return new WordLemmaTag(null, null, labelStr);
} else if (options == LEMMA_LABEL) {
return new WordLemmaTag(null, labelStr, null);
} else {
return new WordLemmaTag(labelStr);
}
} | [
"public",
"Label",
"newLabel",
"(",
"String",
"labelStr",
",",
"int",
"options",
")",
"{",
"if",
"(",
"options",
"==",
"TAG_LABEL",
")",
"{",
"return",
"new",
"WordLemmaTag",
"(",
"null",
",",
"null",
",",
"labelStr",
")",
";",
"}",
"else",
"if",
"(",
... | Make a new label with this <code>String</code> as a value component.
Any other fields of the label would normally be null.
@param labelStr The String that will be used for value
@param options what to make (use labelStr as word, lemma or tag)
@return The new WordLemmaTag (word or lemma or tag will be <code>null</code>) | [
"Make",
"a",
"new",
"label",
"with",
"this",
"<code",
">",
"String<",
"/",
"code",
">",
"as",
"a",
"value",
"component",
".",
"Any",
"other",
"fields",
"of",
"the",
"label",
"would",
"normally",
"be",
"null",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ling/WordLemmaTagFactory.java#L61-L70 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/usage/SubscriptionUsageInArrear.java | SubscriptionUsageInArrear.computeMissingUsageInvoiceItems | public SubscriptionUsageInArrearItemsAndNextNotificationDate computeMissingUsageInvoiceItems(final List<InvoiceItem> existingUsage, final InvoiceItemGeneratorLogger invoiceItemGeneratorLogger) throws CatalogApiException, InvoiceApiException {
final SubscriptionUsageInArrearItemsAndNextNotificationDate result = new SubscriptionUsageInArrearItemsAndNextNotificationDate();
final List<ContiguousIntervalUsageInArrear> billingEventTransitionTimePeriods = computeInArrearUsageInterval();
for (final ContiguousIntervalUsageInArrear usageInterval : billingEventTransitionTimePeriods) {
final UsageInArrearItemsAndNextNotificationDate newItemsWithDetailsAndDate = usageInterval.computeMissingItemsAndNextNotificationDate(existingUsage);
// For debugging purposes
invoiceItemGeneratorLogger.append(usageInterval, newItemsWithDetailsAndDate.getInvoiceItems());
result.addUsageInArrearItemsAndNextNotificationDate(usageInterval.getUsage().getName(), newItemsWithDetailsAndDate);
result.addTrackingIds(newItemsWithDetailsAndDate.getTrackingIds());
}
return result;
} | java | public SubscriptionUsageInArrearItemsAndNextNotificationDate computeMissingUsageInvoiceItems(final List<InvoiceItem> existingUsage, final InvoiceItemGeneratorLogger invoiceItemGeneratorLogger) throws CatalogApiException, InvoiceApiException {
final SubscriptionUsageInArrearItemsAndNextNotificationDate result = new SubscriptionUsageInArrearItemsAndNextNotificationDate();
final List<ContiguousIntervalUsageInArrear> billingEventTransitionTimePeriods = computeInArrearUsageInterval();
for (final ContiguousIntervalUsageInArrear usageInterval : billingEventTransitionTimePeriods) {
final UsageInArrearItemsAndNextNotificationDate newItemsWithDetailsAndDate = usageInterval.computeMissingItemsAndNextNotificationDate(existingUsage);
// For debugging purposes
invoiceItemGeneratorLogger.append(usageInterval, newItemsWithDetailsAndDate.getInvoiceItems());
result.addUsageInArrearItemsAndNextNotificationDate(usageInterval.getUsage().getName(), newItemsWithDetailsAndDate);
result.addTrackingIds(newItemsWithDetailsAndDate.getTrackingIds());
}
return result;
} | [
"public",
"SubscriptionUsageInArrearItemsAndNextNotificationDate",
"computeMissingUsageInvoiceItems",
"(",
"final",
"List",
"<",
"InvoiceItem",
">",
"existingUsage",
",",
"final",
"InvoiceItemGeneratorLogger",
"invoiceItemGeneratorLogger",
")",
"throws",
"CatalogApiException",
",",... | Based on billing events, (@code existingUsage} and targetDate, figure out what remains to be billed.
@param existingUsage the existing on disk usage items.
@throws CatalogApiException | [
"Based",
"on",
"billing",
"events",
"(",
"@code",
"existingUsage",
"}",
"and",
"targetDate",
"figure",
"out",
"what",
"remains",
"to",
"be",
"billed",
"."
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/usage/SubscriptionUsageInArrear.java#L119-L132 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/ExpectBuilder.java | ExpectBuilder.withEchoInput | public final ExpectBuilder withEchoInput(Appendable firstInput, Appendable... otherInputs) {
this.echoInput = firstInput;
this.echoInputs = otherInputs;
return this;
} | java | public final ExpectBuilder withEchoInput(Appendable firstInput, Appendable... otherInputs) {
this.echoInput = firstInput;
this.echoInputs = otherInputs;
return this;
} | [
"public",
"final",
"ExpectBuilder",
"withEchoInput",
"(",
"Appendable",
"firstInput",
",",
"Appendable",
"...",
"otherInputs",
")",
"{",
"this",
".",
"echoInput",
"=",
"firstInput",
";",
"this",
".",
"echoInputs",
"=",
"otherInputs",
";",
"return",
"this",
";",
... | Enables printing of all the received data. Useful for debugging to monitor I/O activity.
Optional, by default is unset.
<p/>
If the only {@code firstInput} is specified then the data received from all the inputs is
echoed to it.
<p/>
The build method throws an {@link java.lang.IllegalArgumentException} if the number of the
{@code otherInputs}
parameters does not correspond to the number of the input streams. That is,
if {@code otherInputs}
is specified, the number of them must be equal to the number of inputs minus 1.
<p/>
The byte data received from the input streams is converted to strings using the
builder's charset. See {@link ExpectBuilder#withCharset(java.nio.charset.Charset)} for
more information.
@param firstInput where to echo the received data for the first input. If {@code
otherInputs} are empty, then
all the data will be echoed to it.
@param otherInputs where to echo the received data for other inputs.
@return this | [
"Enables",
"printing",
"of",
"all",
"the",
"received",
"data",
".",
"Useful",
"for",
"debugging",
"to",
"monitor",
"I",
"/",
"O",
"activity",
".",
"Optional",
"by",
"default",
"is",
"unset",
".",
"<p",
"/",
">",
"If",
"the",
"only",
"{",
"@code",
"firs... | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/ExpectBuilder.java#L177-L181 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java | TupleCombiner.getOnceTupleDefs | private Set<Tuple> getOnceTupleDefs( final List<VarDef> combinedVars)
{
try
{
return
new HashSet<Tuple>(
IteratorUtils.toList(
IteratorUtils.transformedIterator(
getOnceTuples(),
tupleRef -> toTuple( combinedVars, tupleRef))));
}
catch( Exception e)
{
throw new IllegalStateException( "Invalid once-only tuple definition", e);
}
} | java | private Set<Tuple> getOnceTupleDefs( final List<VarDef> combinedVars)
{
try
{
return
new HashSet<Tuple>(
IteratorUtils.toList(
IteratorUtils.transformedIterator(
getOnceTuples(),
tupleRef -> toTuple( combinedVars, tupleRef))));
}
catch( Exception e)
{
throw new IllegalStateException( "Invalid once-only tuple definition", e);
}
} | [
"private",
"Set",
"<",
"Tuple",
">",
"getOnceTupleDefs",
"(",
"final",
"List",
"<",
"VarDef",
">",
"combinedVars",
")",
"{",
"try",
"{",
"return",
"new",
"HashSet",
"<",
"Tuple",
">",
"(",
"IteratorUtils",
".",
"toList",
"(",
"IteratorUtils",
".",
"transfo... | Returns the set of once-only tuple definitions for this combiner. | [
"Returns",
"the",
"set",
"of",
"once",
"-",
"only",
"tuple",
"definitions",
"for",
"this",
"combiner",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java#L342-L357 |
Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourceCollectionImpl.java | ExternalChildResourceCollectionImpl.commitAndGetAllAsync | public Observable<List<FluentModelTImpl>> commitAndGetAllAsync() {
return commitAsync().collect(
new Func0<List<FluentModelTImpl>>() {
public List<FluentModelTImpl> call() {
return new ArrayList<>();
}
},
new Action2<List<FluentModelTImpl>, FluentModelTImpl>() {
public void call(List<FluentModelTImpl> state, FluentModelTImpl item) {
state.add(item);
}
});
} | java | public Observable<List<FluentModelTImpl>> commitAndGetAllAsync() {
return commitAsync().collect(
new Func0<List<FluentModelTImpl>>() {
public List<FluentModelTImpl> call() {
return new ArrayList<>();
}
},
new Action2<List<FluentModelTImpl>, FluentModelTImpl>() {
public void call(List<FluentModelTImpl> state, FluentModelTImpl item) {
state.add(item);
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"FluentModelTImpl",
">",
">",
"commitAndGetAllAsync",
"(",
")",
"{",
"return",
"commitAsync",
"(",
")",
".",
"collect",
"(",
"new",
"Func0",
"<",
"List",
"<",
"FluentModelTImpl",
">",
">",
"(",
")",
"{",
"public",
... | Commits the changes in the external child resource childCollection.
<p/>
This method returns a observable stream, either its observer's onError will be called with
{@link CompositeException} if some resources failed to commit or onNext will be called if all resources
committed successfully.
@return the observable stream | [
"Commits",
"the",
"changes",
"in",
"the",
"external",
"child",
"resource",
"childCollection",
".",
"<p",
"/",
">",
"This",
"method",
"returns",
"a",
"observable",
"stream",
"either",
"its",
"observer",
"s",
"onError",
"will",
"be",
"called",
"with",
"{",
"@l... | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/collection/implementation/ExternalChildResourceCollectionImpl.java#L273-L285 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/matrix/MatrixIO.java | MatrixIO.readMatrix | public static Matrix readMatrix(File matrix, Format format,
Type matrixType, boolean transposeOnRead)
throws IOException {
try {
switch(format) {
case DENSE_TEXT:
return readDenseTextMatrix(matrix, matrixType, transposeOnRead);
case MATLAB_SPARSE:
return readMatlabSparse(matrix, matrixType, transposeOnRead);
case CLUTO_SPARSE:
return readClutoSparse(matrix, matrixType, transposeOnRead);
case SVDLIBC_SPARSE_TEXT:
return readSparseSVDLIBCtext(matrix, matrixType, transposeOnRead);
// These two formats are equivalent
case CLUTO_DENSE:
case SVDLIBC_DENSE_TEXT:
return readDenseSVDLIBCtext(matrix, matrixType, transposeOnRead);
case SVDLIBC_SPARSE_BINARY:
return readSparseSVDLIBCbinary(matrix, matrixType, transposeOnRead);
case SVDLIBC_DENSE_BINARY:
return readDenseSVDLIBCbinary(matrix, matrixType, transposeOnRead);
}
} catch (EOFException eofe) {
// Rethrow with more specific type information
throw new MatrixIOException("Matrix file " + matrix + " appeared "
+ "truncated, or was missing expected values at the end of its "
+ "contents.");
}
throw new Error("Reading matrices of " + format + " format is not "+
"currently supported. Email " +
"s-space-research-dev@googlegroups.com to request its "+
"inclusion and it will be quickly added");
} | java | public static Matrix readMatrix(File matrix, Format format,
Type matrixType, boolean transposeOnRead)
throws IOException {
try {
switch(format) {
case DENSE_TEXT:
return readDenseTextMatrix(matrix, matrixType, transposeOnRead);
case MATLAB_SPARSE:
return readMatlabSparse(matrix, matrixType, transposeOnRead);
case CLUTO_SPARSE:
return readClutoSparse(matrix, matrixType, transposeOnRead);
case SVDLIBC_SPARSE_TEXT:
return readSparseSVDLIBCtext(matrix, matrixType, transposeOnRead);
// These two formats are equivalent
case CLUTO_DENSE:
case SVDLIBC_DENSE_TEXT:
return readDenseSVDLIBCtext(matrix, matrixType, transposeOnRead);
case SVDLIBC_SPARSE_BINARY:
return readSparseSVDLIBCbinary(matrix, matrixType, transposeOnRead);
case SVDLIBC_DENSE_BINARY:
return readDenseSVDLIBCbinary(matrix, matrixType, transposeOnRead);
}
} catch (EOFException eofe) {
// Rethrow with more specific type information
throw new MatrixIOException("Matrix file " + matrix + " appeared "
+ "truncated, or was missing expected values at the end of its "
+ "contents.");
}
throw new Error("Reading matrices of " + format + " format is not "+
"currently supported. Email " +
"s-space-research-dev@googlegroups.com to request its "+
"inclusion and it will be quickly added");
} | [
"public",
"static",
"Matrix",
"readMatrix",
"(",
"File",
"matrix",
",",
"Format",
"format",
",",
"Type",
"matrixType",
",",
"boolean",
"transposeOnRead",
")",
"throws",
"IOException",
"{",
"try",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"DENSE_TEXT",
... | Converts the contents of a matrix file as a {@link Matrix} object, using
the provided type description as a hint for what kind to create. The
type of {@code Matrix} object created will be based on an estimate of
whether the data will fit into the available memory. Note that the
returned {@link Matrix} instance is not backed by the data on file;
changes to the {@code Matrix} will <i>not</i> be reflected in the
original file's data.
@param matrix a file contain matrix data
@param format the format of the file
@param matrixType the expected type and behavior of the matrix in
relation to memory. This value will be used as a hint for what
kind of {@code Matrix} instance to create
@param transposeOnRead {@code true} if the matrix should be transposed as
its data is read in. For certain formats, this is more efficient
than reading the data in and then transposing it directly.
@return the {@code Matrix} instance that contains the data in the
provided file, optionally transposed from its original format
@throws IOException if any error occurs while reading in the matrix data | [
"Converts",
"the",
"contents",
"of",
"a",
"matrix",
"file",
"as",
"a",
"{",
"@link",
"Matrix",
"}",
"object",
"using",
"the",
"provided",
"type",
"description",
"as",
"a",
"hint",
"for",
"what",
"kind",
"to",
"create",
".",
"The",
"type",
"of",
"{",
"@... | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/MatrixIO.java#L789-L828 |
cogroo/cogroo4 | lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/MessageBox.java | MessageBox.showMessageBox | public short showMessageBox(XWindowPeer _xParentWindowPeer, String _sTitle, String _sMessage, String _aType, int _aButtons) {
short nResult = -1;
XComponent xComponent = null;
try {
Object oToolkit = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext);
XMessageBoxFactory xMessageBoxFactory = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, oToolkit);
// rectangle may be empty if position is in the center of the parent peer
Rectangle aRectangle = new Rectangle();
XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox(_xParentWindowPeer, aRectangle, _aType, _aButtons, _sTitle, _sMessage);
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xMessageBox);
if (xMessageBox != null) {
nResult = xMessageBox.execute();
}
} catch (com.sun.star.uno.Exception ex) {
ex.printStackTrace(System.out);
} finally {
//make sure always to dispose the component and free the memory!
if (xComponent != null) {
xComponent.dispose();
}
}
return nResult;
} | java | public short showMessageBox(XWindowPeer _xParentWindowPeer, String _sTitle, String _sMessage, String _aType, int _aButtons) {
short nResult = -1;
XComponent xComponent = null;
try {
Object oToolkit = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext);
XMessageBoxFactory xMessageBoxFactory = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, oToolkit);
// rectangle may be empty if position is in the center of the parent peer
Rectangle aRectangle = new Rectangle();
XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox(_xParentWindowPeer, aRectangle, _aType, _aButtons, _sTitle, _sMessage);
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xMessageBox);
if (xMessageBox != null) {
nResult = xMessageBox.execute();
}
} catch (com.sun.star.uno.Exception ex) {
ex.printStackTrace(System.out);
} finally {
//make sure always to dispose the component and free the memory!
if (xComponent != null) {
xComponent.dispose();
}
}
return nResult;
} | [
"public",
"short",
"showMessageBox",
"(",
"XWindowPeer",
"_xParentWindowPeer",
",",
"String",
"_sTitle",
",",
"String",
"_sMessage",
",",
"String",
"_aType",
",",
"int",
"_aButtons",
")",
"{",
"short",
"nResult",
"=",
"-",
"1",
";",
"XComponent",
"xComponent",
... | Shows an messagebox
@param _xParentWindowPeer the windowpeer of the parent window
@param _sTitle the title of the messagebox
@param _sMessage the message of the messagebox
@param _aType string which determines the message box type: (infobox|warningbox|errorbox|querybox|messbox)
@param _aButtons MessageBoxButtons which buttons should be available on the message box | [
"Shows",
"an",
"messagebox"
] | train | https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/MessageBox.java#L58-L80 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/PeriodFormatter.java | PeriodFormatter.withParseType | public PeriodFormatter withParseType(PeriodType type) {
if (type == iParseType) {
return this;
}
return new PeriodFormatter(iPrinter, iParser, iLocale, type);
} | java | public PeriodFormatter withParseType(PeriodType type) {
if (type == iParseType) {
return this;
}
return new PeriodFormatter(iPrinter, iParser, iLocale, type);
} | [
"public",
"PeriodFormatter",
"withParseType",
"(",
"PeriodType",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"iParseType",
")",
"{",
"return",
"this",
";",
"}",
"return",
"new",
"PeriodFormatter",
"(",
"iPrinter",
",",
"iParser",
",",
"iLocale",
",",
"type",
... | Returns a new formatter with a different PeriodType for parsing.
<p>
A PeriodFormatter is immutable, so a new instance is returned,
and the original is unaltered and still usable.
@param type the type to use in parsing
@return the new formatter | [
"Returns",
"a",
"new",
"formatter",
"with",
"a",
"different",
"PeriodType",
"for",
"parsing",
".",
"<p",
">",
"A",
"PeriodFormatter",
"is",
"immutable",
"so",
"a",
"new",
"instance",
"is",
"returned",
"and",
"the",
"original",
"is",
"unaltered",
"and",
"stil... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatter.java#L190-L195 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java | ObjectUpdater.mergeAllFieldValues | private void mergeAllFieldValues(DBObject srcDBObj, DBObject tgtDBObj) {
for (String fieldName : srcDBObj.getUpdatedFieldNames()) {
FieldDefinition fieldDef = m_tableDef.getFieldDef(fieldName);
if (fieldDef != null && (fieldDef.isCollection() || fieldDef.isLinkField())) {
Set<String> newValueSet =
ScalarFieldUpdater.mergeMVFieldValues(tgtDBObj.getFieldValues(fieldName),
srcDBObj.getRemoveValues(fieldName),
srcDBObj.getFieldValues(fieldName));
tgtDBObj.clearValues(fieldName);
tgtDBObj.addFieldValues(fieldName, newValueSet);
} else {
tgtDBObj.clearValues(fieldName);
tgtDBObj.addFieldValue(fieldName, srcDBObj.getFieldValue(fieldName));
}
}
} | java | private void mergeAllFieldValues(DBObject srcDBObj, DBObject tgtDBObj) {
for (String fieldName : srcDBObj.getUpdatedFieldNames()) {
FieldDefinition fieldDef = m_tableDef.getFieldDef(fieldName);
if (fieldDef != null && (fieldDef.isCollection() || fieldDef.isLinkField())) {
Set<String> newValueSet =
ScalarFieldUpdater.mergeMVFieldValues(tgtDBObj.getFieldValues(fieldName),
srcDBObj.getRemoveValues(fieldName),
srcDBObj.getFieldValues(fieldName));
tgtDBObj.clearValues(fieldName);
tgtDBObj.addFieldValues(fieldName, newValueSet);
} else {
tgtDBObj.clearValues(fieldName);
tgtDBObj.addFieldValue(fieldName, srcDBObj.getFieldValue(fieldName));
}
}
} | [
"private",
"void",
"mergeAllFieldValues",
"(",
"DBObject",
"srcDBObj",
",",
"DBObject",
"tgtDBObj",
")",
"{",
"for",
"(",
"String",
"fieldName",
":",
"srcDBObj",
".",
"getUpdatedFieldNames",
"(",
")",
")",
"{",
"FieldDefinition",
"fieldDef",
"=",
"m_tableDef",
"... | fields are replaced. MV fields acquire the results of add/remove processing. | [
"fields",
"are",
"replaced",
".",
"MV",
"fields",
"acquire",
"the",
"results",
"of",
"add",
"/",
"remove",
"processing",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java#L291-L306 |
moparisthebest/beehive | beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java | LocalFileEntityResolver.resolveEntity | public InputSource resolveEntity(String publicID, String systemID) throws SAXException, IOException {
InputSource localFileInput = resolveLocalEntity(systemID);
return localFileInput != null ? localFileInput : new InputSource(systemID);
} | java | public InputSource resolveEntity(String publicID, String systemID) throws SAXException, IOException {
InputSource localFileInput = resolveLocalEntity(systemID);
return localFileInput != null ? localFileInput : new InputSource(systemID);
} | [
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"publicID",
",",
"String",
"systemID",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"InputSource",
"localFileInput",
"=",
"resolveLocalEntity",
"(",
"systemID",
")",
";",
"return",
"localFileInput",
... | Resolve the entity. First try to find it locally, then fallback to the network. | [
"Resolve",
"the",
"entity",
".",
"First",
"try",
"to",
"find",
"it",
"locally",
"then",
"fallback",
"to",
"the",
"network",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java#L47-L50 |
CloudSlang/score | score-api/src/main/java/io/cloudslang/score/lang/ExecutionRuntimeServices.java | ExecutionRuntimeServices.addEvent | public void addEvent(String eventType, Serializable eventData) {
@SuppressWarnings("unchecked")
Queue<ScoreEvent> eventsQueue = getFromMap(SCORE_EVENTS_QUEUE);
if (eventsQueue == null) {
eventsQueue = new ArrayDeque<>();
contextMap.put(SCORE_EVENTS_QUEUE, (ArrayDeque) eventsQueue);
}
eventsQueue.add(new ScoreEvent(eventType, getLanguageName(), eventData, getMetaData()));
} | java | public void addEvent(String eventType, Serializable eventData) {
@SuppressWarnings("unchecked")
Queue<ScoreEvent> eventsQueue = getFromMap(SCORE_EVENTS_QUEUE);
if (eventsQueue == null) {
eventsQueue = new ArrayDeque<>();
contextMap.put(SCORE_EVENTS_QUEUE, (ArrayDeque) eventsQueue);
}
eventsQueue.add(new ScoreEvent(eventType, getLanguageName(), eventData, getMetaData()));
} | [
"public",
"void",
"addEvent",
"(",
"String",
"eventType",
",",
"Serializable",
"eventData",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Queue",
"<",
"ScoreEvent",
">",
"eventsQueue",
"=",
"getFromMap",
"(",
"SCORE_EVENTS_QUEUE",
")",
";",
"if"... | add event - for score to fire
@param eventType - string which is the key you can listen to
@param eventData - the event data | [
"add",
"event",
"-",
"for",
"score",
"to",
"fire"
] | train | https://github.com/CloudSlang/score/blob/796134e917843f4d95a90f7740d69dc5257a1a0e/score-api/src/main/java/io/cloudslang/score/lang/ExecutionRuntimeServices.java#L327-L335 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StringUtils.java | StringUtils.dequoteFull | public static String dequoteFull(String str, char quote)
{
if (str == null)
{
return null;
}
return dequoteFull(str, 0, str.length(), quote);
} | java | public static String dequoteFull(String str, char quote)
{
if (str == null)
{
return null;
}
return dequoteFull(str, 0, str.length(), quote);
} | [
"public",
"static",
"String",
"dequoteFull",
"(",
"String",
"str",
",",
"char",
"quote",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"dequoteFull",
"(",
"str",
",",
"0",
",",
"str",
".",
"length",
"(",
... | Removes the surrounding quote and any double quote inside the string <br>
Example:<br>
<pre>
"hello""world" becomes hello"world
</pre>
@param str input string to dequote
@param quote the quoting char
@return dequoted String | [
"Removes",
"the",
"surrounding",
"quote",
"and",
"any",
"double",
"quote",
"inside",
"the",
"string",
"<br",
">",
"Example",
":",
"<br",
">",
"<pre",
">",
"hello",
"world",
"becomes",
"hello",
"world",
"<",
"/",
"pre",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StringUtils.java#L306-L314 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VpnConnectionsInner.java | VpnConnectionsInner.listByVpnGatewayWithServiceResponseAsync | public Observable<ServiceResponse<Page<VpnConnectionInner>>> listByVpnGatewayWithServiceResponseAsync(final String resourceGroupName, final String gatewayName) {
return listByVpnGatewaySinglePageAsync(resourceGroupName, gatewayName)
.concatMap(new Func1<ServiceResponse<Page<VpnConnectionInner>>, Observable<ServiceResponse<Page<VpnConnectionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<VpnConnectionInner>>> call(ServiceResponse<Page<VpnConnectionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByVpnGatewayNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<VpnConnectionInner>>> listByVpnGatewayWithServiceResponseAsync(final String resourceGroupName, final String gatewayName) {
return listByVpnGatewaySinglePageAsync(resourceGroupName, gatewayName)
.concatMap(new Func1<ServiceResponse<Page<VpnConnectionInner>>, Observable<ServiceResponse<Page<VpnConnectionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<VpnConnectionInner>>> call(ServiceResponse<Page<VpnConnectionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByVpnGatewayNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"VpnConnectionInner",
">",
">",
">",
"listByVpnGatewayWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"gatewayName",
")",
"{",
"return",
"listByVpnGatewaySi... | Retrieves all vpn connections for a particular virtual wan vpn gateway.
@param resourceGroupName The resource group name of the VpnGateway.
@param gatewayName The name of the gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VpnConnectionInner> object | [
"Retrieves",
"all",
"vpn",
"connections",
"for",
"a",
"particular",
"virtual",
"wan",
"vpn",
"gateway",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VpnConnectionsInner.java#L599-L611 |
eclipse/xtext-core | org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java | GeneratorNodeExtensions.appendNewLine | public CompositeGeneratorNode appendNewLine(final CompositeGeneratorNode parent, final String lineSeparator) {
List<IGeneratorNode> _children = parent.getChildren();
NewLineNode _newLineNode = new NewLineNode(lineSeparator, false);
_children.add(_newLineNode);
return parent;
} | java | public CompositeGeneratorNode appendNewLine(final CompositeGeneratorNode parent, final String lineSeparator) {
List<IGeneratorNode> _children = parent.getChildren();
NewLineNode _newLineNode = new NewLineNode(lineSeparator, false);
_children.add(_newLineNode);
return parent;
} | [
"public",
"CompositeGeneratorNode",
"appendNewLine",
"(",
"final",
"CompositeGeneratorNode",
"parent",
",",
"final",
"String",
"lineSeparator",
")",
"{",
"List",
"<",
"IGeneratorNode",
">",
"_children",
"=",
"parent",
".",
"getChildren",
"(",
")",
";",
"NewLineNode"... | Appends a line separator node to the given parent.
@return the given parent node | [
"Appends",
"a",
"line",
"separator",
"node",
"to",
"the",
"given",
"parent",
"."
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java#L109-L114 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/style/ColorUtils.java | ColorUtils.toColorShorthand | public static String toColorShorthand(String red, String green, String blue) {
return shorthandHex(toColor(red, green, blue));
} | java | public static String toColorShorthand(String red, String green, String blue) {
return shorthandHex(toColor(red, green, blue));
} | [
"public",
"static",
"String",
"toColorShorthand",
"(",
"String",
"red",
",",
"String",
"green",
",",
"String",
"blue",
")",
"{",
"return",
"shorthandHex",
"(",
"toColor",
"(",
"red",
",",
"green",
",",
"blue",
")",
")",
";",
"}"
] | Convert the hex color values to a hex color, shorthanded when possible
@param red
red hex color in format RR or R
@param green
green hex color in format GG or G
@param blue
blue hex color in format BB or B
@return hex color in format #RGB or #RRGGBB | [
"Convert",
"the",
"hex",
"color",
"values",
"to",
"a",
"hex",
"color",
"shorthanded",
"when",
"possible"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/style/ColorUtils.java#L56-L58 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/widget/ToastUtils.java | ToastUtils.showOnUiThread | public static void showOnUiThread(final Context applicationContext, final String message, final int duration, Handler handler) {
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(applicationContext, message, duration).show();
}
});
} | java | public static void showOnUiThread(final Context applicationContext, final String message, final int duration, Handler handler) {
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(applicationContext, message, duration).show();
}
});
} | [
"public",
"static",
"void",
"showOnUiThread",
"(",
"final",
"Context",
"applicationContext",
",",
"final",
"String",
"message",
",",
"final",
"int",
"duration",
",",
"Handler",
"handler",
")",
"{",
"handler",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{... | Show toast on the UI thread.
@param applicationContext the application context.
@param message the message to show.
@param duration the display duration.
@param handler the main handler. | [
"Show",
"toast",
"on",
"the",
"UI",
"thread",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/widget/ToastUtils.java#L73-L80 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/slider2/Slider2.java | Slider2.compareValues | protected boolean compareValues(Object previous, Object value) {
if (previous instanceof String && value instanceof Double) {
previous = Double.valueOf((String) previous);
}
return super.compareValues(previous, value);
} | java | protected boolean compareValues(Object previous, Object value) {
if (previous instanceof String && value instanceof Double) {
previous = Double.valueOf((String) previous);
}
return super.compareValues(previous, value);
} | [
"protected",
"boolean",
"compareValues",
"(",
"Object",
"previous",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"previous",
"instanceof",
"String",
"&&",
"value",
"instanceof",
"Double",
")",
"{",
"previous",
"=",
"Double",
".",
"valueOf",
"(",
"(",
"String... | <p>
Return <code>true</code> if the new value is different from the previous
value. First compare the two values by passing <em>value</em> to the
<code>equals</code> method on argument <em>previous</em>. If that method
returns <code>true</code>, return <code>true</code>. If that method returns
<code>false</code>, and both arguments implement
<code>java.lang.Comparable</code>, compare the two values by passing
<em>value</em> to the <code>compareTo</code> method on argument
<em>previous</em>. Return <code>true</code> if this method returns
<code>0</code>, <code>false</code> otherwise.
</p>
@param previous
old value of this component (if any)
@param value
new value of this component (if any) | [
"<p",
">",
"Return",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"new",
"value",
"is",
"different",
"from",
"the",
"previous",
"value",
".",
"First",
"compare",
"the",
"two",
"values",
"by",
"passing",
"<em",
">",
"value<",
"/",
"em",
">",
... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/slider2/Slider2.java#L94-L99 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/MapDataStores.java | MapDataStores.createWriteThroughStore | public static <K, V> MapDataStore<K, V> createWriteThroughStore(MapStoreContext mapStoreContext) {
final MapStoreWrapper store = mapStoreContext.getMapStoreWrapper();
final MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext();
final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
final InternalSerializationService serializationService
= ((InternalSerializationService) nodeEngine.getSerializationService());
return (MapDataStore<K, V>) new WriteThroughStore(store, serializationService);
} | java | public static <K, V> MapDataStore<K, V> createWriteThroughStore(MapStoreContext mapStoreContext) {
final MapStoreWrapper store = mapStoreContext.getMapStoreWrapper();
final MapServiceContext mapServiceContext = mapStoreContext.getMapServiceContext();
final NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
final InternalSerializationService serializationService
= ((InternalSerializationService) nodeEngine.getSerializationService());
return (MapDataStore<K, V>) new WriteThroughStore(store, serializationService);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"MapDataStore",
"<",
"K",
",",
"V",
">",
"createWriteThroughStore",
"(",
"MapStoreContext",
"mapStoreContext",
")",
"{",
"final",
"MapStoreWrapper",
"store",
"=",
"mapStoreContext",
".",
"getMapStoreWrapper",
"(",
")"... | Creates a write through data store.
@param mapStoreContext context for map store operations
@param <K> type of key to store
@param <V> type of value to store
@return new write through store manager | [
"Creates",
"a",
"write",
"through",
"data",
"store",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/MapDataStores.java#L86-L95 |
Alluxio/alluxio | job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java | TaskExecutorManager.notifyTaskCompletion | public synchronized void notifyTaskCompletion(long jobId, int taskId, Object result) {
Pair<Long, Integer> id = new Pair<>(jobId, taskId);
TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
taskInfo.setStatus(Status.COMPLETED);
try {
taskInfo.setResult(ByteString.copyFrom(SerializationUtils.serialize(result)));
} catch (IOException e) {
// TODO(yupeng) better error handling
LOG.warn("Failed to serialize {} : {}", result, e.getMessage());
LOG.debug("Exception: ", e);
} finally {
finishTask(id);
LOG.info("Task {} for job {} completed.", taskId, jobId);
}
} | java | public synchronized void notifyTaskCompletion(long jobId, int taskId, Object result) {
Pair<Long, Integer> id = new Pair<>(jobId, taskId);
TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
taskInfo.setStatus(Status.COMPLETED);
try {
taskInfo.setResult(ByteString.copyFrom(SerializationUtils.serialize(result)));
} catch (IOException e) {
// TODO(yupeng) better error handling
LOG.warn("Failed to serialize {} : {}", result, e.getMessage());
LOG.debug("Exception: ", e);
} finally {
finishTask(id);
LOG.info("Task {} for job {} completed.", taskId, jobId);
}
} | [
"public",
"synchronized",
"void",
"notifyTaskCompletion",
"(",
"long",
"jobId",
",",
"int",
"taskId",
",",
"Object",
"result",
")",
"{",
"Pair",
"<",
"Long",
",",
"Integer",
">",
"id",
"=",
"new",
"Pair",
"<>",
"(",
"jobId",
",",
"taskId",
")",
";",
"T... | Notifies the completion of the task.
@param jobId the job id
@param taskId the task id
@param result the task execution result | [
"Notifies",
"the",
"completion",
"of",
"the",
"task",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/job/server/src/main/java/alluxio/worker/job/task/TaskExecutorManager.java#L73-L87 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java | MultiIndex.removeAllDocuments | synchronized int removeAllDocuments(String uuid) throws IOException
{
synchronized (updateMonitor)
{
//updateInProgress = true;
indexUpdateMonitor.setUpdateInProgress(true, false);
}
int num;
try
{
Term idTerm = new Term(FieldNames.UUID, uuid.toString());
executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
num = volatileIndex.removeDocument(idTerm);
if (num > 0)
{
redoLog.append(new DeleteNode(getTransactionId(), uuid));
}
for (int i = 0; i < indexes.size(); i++)
{
PersistentIndex index = indexes.get(i);
// only remove documents from registered indexes
if (indexNames.contains(index.getName()))
{
int removed = index.removeDocument(idTerm);
if (removed > 0)
{
redoLog.append(new DeleteNode(getTransactionId(), uuid));
}
num += removed;
}
}
executeAndLog(new Commit(getTransactionId()));
}
finally
{
synchronized (updateMonitor)
{
//updateInProgress = false;
indexUpdateMonitor.setUpdateInProgress(false, false);
updateMonitor.notifyAll();
releaseMultiReader();
}
}
return num;
} | java | synchronized int removeAllDocuments(String uuid) throws IOException
{
synchronized (updateMonitor)
{
//updateInProgress = true;
indexUpdateMonitor.setUpdateInProgress(true, false);
}
int num;
try
{
Term idTerm = new Term(FieldNames.UUID, uuid.toString());
executeAndLog(new Start(Action.INTERNAL_TRANSACTION));
num = volatileIndex.removeDocument(idTerm);
if (num > 0)
{
redoLog.append(new DeleteNode(getTransactionId(), uuid));
}
for (int i = 0; i < indexes.size(); i++)
{
PersistentIndex index = indexes.get(i);
// only remove documents from registered indexes
if (indexNames.contains(index.getName()))
{
int removed = index.removeDocument(idTerm);
if (removed > 0)
{
redoLog.append(new DeleteNode(getTransactionId(), uuid));
}
num += removed;
}
}
executeAndLog(new Commit(getTransactionId()));
}
finally
{
synchronized (updateMonitor)
{
//updateInProgress = false;
indexUpdateMonitor.setUpdateInProgress(false, false);
updateMonitor.notifyAll();
releaseMultiReader();
}
}
return num;
} | [
"synchronized",
"int",
"removeAllDocuments",
"(",
"String",
"uuid",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"updateMonitor",
")",
"{",
"//updateInProgress = true;",
"indexUpdateMonitor",
".",
"setUpdateInProgress",
"(",
"true",
",",
"false",
")",
";",
... | Deletes all documents that match the <code>uuid</code>.
@param uuid
documents that match this <code>uuid</code> will be deleted.
@return the number of deleted documents.
@throws IOException
if an error occurs while deleting documents. | [
"Deletes",
"all",
"documents",
"that",
"match",
"the",
"<code",
">",
"uuid<",
"/",
"code",
">",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java#L1082-L1126 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java | ConfigurationAbstractImpl.getInteger | public int getInteger(String key, int defaultValue)
{
int ret;
try
{
String tmp = properties.getProperty(key);
if (tmp == null)
{
properties.put(key, String.valueOf(defaultValue));
logger.debug("No value for key \"" + key + "\", using default "
+ defaultValue + ".");
return defaultValue;
}
ret = Integer.parseInt(tmp);
}
catch (NumberFormatException e)
{
Object wrongValue = properties.put(key, String.valueOf(defaultValue));
logger.warn(
"Value \""
+ wrongValue
+ "\" is illegal for key \""
+ key
+ "\" (should be an integer, using default value "
+ defaultValue
+ ")");
ret = defaultValue;
}
return ret;
} | java | public int getInteger(String key, int defaultValue)
{
int ret;
try
{
String tmp = properties.getProperty(key);
if (tmp == null)
{
properties.put(key, String.valueOf(defaultValue));
logger.debug("No value for key \"" + key + "\", using default "
+ defaultValue + ".");
return defaultValue;
}
ret = Integer.parseInt(tmp);
}
catch (NumberFormatException e)
{
Object wrongValue = properties.put(key, String.valueOf(defaultValue));
logger.warn(
"Value \""
+ wrongValue
+ "\" is illegal for key \""
+ key
+ "\" (should be an integer, using default value "
+ defaultValue
+ ")");
ret = defaultValue;
}
return ret;
} | [
"public",
"int",
"getInteger",
"(",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"int",
"ret",
";",
"try",
"{",
"String",
"tmp",
"=",
"properties",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"tmp",
"==",
"null",
")",
"{",
"propert... | Returns the integer value for the specified key. If no value for this key
is found in the configuration or the value is not an legal integer
<code>defaultValue</code> is returned.
@param key the key
@param defaultValue the default Value
@return the value for the key, or <code>defaultValue</code> | [
"Returns",
"the",
"integer",
"value",
"for",
"the",
"specified",
"key",
".",
"If",
"no",
"value",
"for",
"this",
"key",
"is",
"found",
"in",
"the",
"configuration",
"or",
"the",
"value",
"is",
"not",
"an",
"legal",
"integer",
"<code",
">",
"defaultValue<",... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java#L146-L175 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsTransparencyImpl.java | CmsTransparencyImpl.setTransparency | public static void setTransparency(Element elem, int alpha) {
float ieVersion = getIEVersion();
// only IE 8 requires special treatment, older IE versions are no longer supported
if (ieVersion < 9.0) {
elem.getStyle().setProperty(
"-ms-filter",
"\"progid:DXImageTransform.Microsoft.Alpha(opacity=" + alpha + ")\"");
} else {
// Everyone else
elem.getStyle().setOpacity((1.0 * alpha) / 100);
}
} | java | public static void setTransparency(Element elem, int alpha) {
float ieVersion = getIEVersion();
// only IE 8 requires special treatment, older IE versions are no longer supported
if (ieVersion < 9.0) {
elem.getStyle().setProperty(
"-ms-filter",
"\"progid:DXImageTransform.Microsoft.Alpha(opacity=" + alpha + ")\"");
} else {
// Everyone else
elem.getStyle().setOpacity((1.0 * alpha) / 100);
}
} | [
"public",
"static",
"void",
"setTransparency",
"(",
"Element",
"elem",
",",
"int",
"alpha",
")",
"{",
"float",
"ieVersion",
"=",
"getIEVersion",
"(",
")",
";",
"// only IE 8 requires special treatment, older IE versions are no longer supported\r",
"if",
"(",
"ieVersion",
... | Given a DOM element, set the transparency value, with 100 being fully opaque and 0 being fully transparent.<p>
@param elem A com.google.gwt.user.client.Element object
@param alpha An alpha value | [
"Given",
"a",
"DOM",
"element",
"set",
"the",
"transparency",
"value",
"with",
"100",
"being",
"fully",
"opaque",
"and",
"0",
"being",
"fully",
"transparent",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsTransparencyImpl.java#L74-L86 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java | ExtensionsInner.disableMonitoringAsync | public Observable<Void> disableMonitoringAsync(String resourceGroupName, String clusterName) {
return disableMonitoringWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> disableMonitoringAsync(String resourceGroupName, String clusterName) {
return disableMonitoringWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"disableMonitoringAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"return",
"disableMonitoringWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"map",
"(",
"... | Disables the Operations Management Suite (OMS) on the HDInsight cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Disables",
"the",
"Operations",
"Management",
"Suite",
"(",
"OMS",
")",
"on",
"the",
"HDInsight",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L391-L398 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java | PeriodFormatterData.appendPrefix | public boolean appendPrefix(int tl, int td, StringBuffer sb) {
if (dr.scopeData != null) {
int ix = tl * 3 + td;
ScopeData sd = dr.scopeData[ix];
if (sd != null) {
String prefix = sd.prefix;
if (prefix != null) {
sb.append(prefix);
return sd.requiresDigitPrefix;
}
}
}
return false;
} | java | public boolean appendPrefix(int tl, int td, StringBuffer sb) {
if (dr.scopeData != null) {
int ix = tl * 3 + td;
ScopeData sd = dr.scopeData[ix];
if (sd != null) {
String prefix = sd.prefix;
if (prefix != null) {
sb.append(prefix);
return sd.requiresDigitPrefix;
}
}
}
return false;
} | [
"public",
"boolean",
"appendPrefix",
"(",
"int",
"tl",
",",
"int",
"td",
",",
"StringBuffer",
"sb",
")",
"{",
"if",
"(",
"dr",
".",
"scopeData",
"!=",
"null",
")",
"{",
"int",
"ix",
"=",
"tl",
"*",
"3",
"+",
"td",
";",
"ScopeData",
"sd",
"=",
"dr... | Append the appropriate prefix to the string builder, depending on whether and
how a limit and direction are to be displayed.
@param tl how and whether to display the time limit
@param td how and whether to display the time direction
@param sb the string builder to which to append the text
@return true if a following digit will require a digit prefix | [
"Append",
"the",
"appropriate",
"prefix",
"to",
"the",
"string",
"builder",
"depending",
"on",
"whether",
"and",
"how",
"a",
"limit",
"and",
"direction",
"are",
"to",
"be",
"displayed",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java#L98-L111 |
vkostyukov/la4j | src/main/java/org/la4j/Vector.java | Vector.slice | public Vector slice(int from, int until) {
if (until - from < 0) {
fail("Wrong slice range: [" + from + ".." + until + "].");
}
Vector result = blankOfLength(until - from);
for (int i = from; i < until; i++) {
result.set(i - from, get(i));
}
return result;
} | java | public Vector slice(int from, int until) {
if (until - from < 0) {
fail("Wrong slice range: [" + from + ".." + until + "].");
}
Vector result = blankOfLength(until - from);
for (int i = from; i < until; i++) {
result.set(i - from, get(i));
}
return result;
} | [
"public",
"Vector",
"slice",
"(",
"int",
"from",
",",
"int",
"until",
")",
"{",
"if",
"(",
"until",
"-",
"from",
"<",
"0",
")",
"{",
"fail",
"(",
"\"Wrong slice range: [\"",
"+",
"from",
"+",
"\"..\"",
"+",
"until",
"+",
"\"].\"",
")",
";",
"}",
"V... | Retrieves the specified sub-vector of this vector. The sub-vector is specified by
interval of indices.
@param from the beginning of indices interval
@param until the ending of indices interval
@return the sub-vector of this vector | [
"Retrieves",
"the",
"specified",
"sub",
"-",
"vector",
"of",
"this",
"vector",
".",
"The",
"sub",
"-",
"vector",
"is",
"specified",
"by",
"interval",
"of",
"indices",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L616-L628 |
zeromq/jeromq | src/main/java/org/zeromq/ZAuth.java | ZAuth.configurePlain | public ZAuth configurePlain(String domain, String filename)
{
Objects.requireNonNull(domain, "Domain has to be supplied");
Objects.requireNonNull(filename, "File name has to be supplied");
return send(Mechanism.PLAIN.name(), domain, filename);
} | java | public ZAuth configurePlain(String domain, String filename)
{
Objects.requireNonNull(domain, "Domain has to be supplied");
Objects.requireNonNull(filename, "File name has to be supplied");
return send(Mechanism.PLAIN.name(), domain, filename);
} | [
"public",
"ZAuth",
"configurePlain",
"(",
"String",
"domain",
",",
"String",
"filename",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"domain",
",",
"\"Domain has to be supplied\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"filename",
",",
"\"File name... | Configure PLAIN authentication for a given domain. PLAIN authentication
uses a plain-text password file. To cover all domains, use "*". You can
modify the password file at any time; it is reloaded automatically.
@param domain
@param filename | [
"Configure",
"PLAIN",
"authentication",
"for",
"a",
"given",
"domain",
".",
"PLAIN",
"authentication",
"uses",
"a",
"plain",
"-",
"text",
"password",
"file",
".",
"To",
"cover",
"all",
"domains",
"use",
"*",
".",
"You",
"can",
"modify",
"the",
"password",
... | train | https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZAuth.java#L528-L533 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/VarianceGammaProcess.java | VarianceGammaProcess.doGenerateVarianceGammaIncrements | private void doGenerateVarianceGammaIncrements() {
if(varianceGammaIncrements != null) {
return;
}
myGammaProcess =
new GammaProcess(timeDiscretization,numberOfFactors,numberOfPaths,seed,1/nu,nu);
myBrownianMotion =
new BrownianMotionLazyInit(timeDiscretization,numberOfFactors,numberOfPaths,seed+1);
varianceGammaIncrements = new RandomVariable[timeDiscretization.getNumberOfTimeSteps()][numberOfFactors];
/*
* Generate variance gamma distributed independent increments.
*
* Since we already have a Brownian motion and a Gamma process at our disposal,
* we are simply combining them.
*/
for(int timeIndex = 0; timeIndex < timeDiscretization.getNumberOfTimeSteps(); timeIndex++) {
// Generate uncorrelated Gamma distributed increment
for(int factor=0; factor<numberOfFactors; factor++) {
varianceGammaIncrements[timeIndex][factor] =
(myGammaProcess.getIncrement(timeIndex, factor).mult(theta))
.add((myGammaProcess.getIncrement(timeIndex, factor)).sqrt()
.mult(myBrownianMotion.getBrownianIncrement(timeIndex,factor)
.mult(sigma/Math.sqrt(timeDiscretization.getTimeStep(timeIndex)))));
}
}
} | java | private void doGenerateVarianceGammaIncrements() {
if(varianceGammaIncrements != null) {
return;
}
myGammaProcess =
new GammaProcess(timeDiscretization,numberOfFactors,numberOfPaths,seed,1/nu,nu);
myBrownianMotion =
new BrownianMotionLazyInit(timeDiscretization,numberOfFactors,numberOfPaths,seed+1);
varianceGammaIncrements = new RandomVariable[timeDiscretization.getNumberOfTimeSteps()][numberOfFactors];
/*
* Generate variance gamma distributed independent increments.
*
* Since we already have a Brownian motion and a Gamma process at our disposal,
* we are simply combining them.
*/
for(int timeIndex = 0; timeIndex < timeDiscretization.getNumberOfTimeSteps(); timeIndex++) {
// Generate uncorrelated Gamma distributed increment
for(int factor=0; factor<numberOfFactors; factor++) {
varianceGammaIncrements[timeIndex][factor] =
(myGammaProcess.getIncrement(timeIndex, factor).mult(theta))
.add((myGammaProcess.getIncrement(timeIndex, factor)).sqrt()
.mult(myBrownianMotion.getBrownianIncrement(timeIndex,factor)
.mult(sigma/Math.sqrt(timeDiscretization.getTimeStep(timeIndex)))));
}
}
} | [
"private",
"void",
"doGenerateVarianceGammaIncrements",
"(",
")",
"{",
"if",
"(",
"varianceGammaIncrements",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"myGammaProcess",
"=",
"new",
"GammaProcess",
"(",
"timeDiscretization",
",",
"numberOfFactors",
",",
"numberOfPa... | Lazy initialization of gammaIncrement. Synchronized to ensure thread safety of lazy init. | [
"Lazy",
"initialization",
"of",
"gammaIncrement",
".",
"Synchronized",
"to",
"ensure",
"thread",
"safety",
"of",
"lazy",
"init",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/VarianceGammaProcess.java#L80-L111 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/ReflectionUtil.java | ReflectionUtil.matchesParameters | @Pure
public static boolean matchesParameters(Class<?>[] formalParameters, Object... parameterValues) {
if (formalParameters == null) {
return parameterValues == null;
}
if (parameterValues != null && formalParameters.length == parameterValues.length) {
for (int i = 0; i < formalParameters.length; ++i) {
if (!isInstance(formalParameters[i], parameterValues[i])) {
return false;
}
}
return true;
}
return false;
} | java | @Pure
public static boolean matchesParameters(Class<?>[] formalParameters, Object... parameterValues) {
if (formalParameters == null) {
return parameterValues == null;
}
if (parameterValues != null && formalParameters.length == parameterValues.length) {
for (int i = 0; i < formalParameters.length; ++i) {
if (!isInstance(formalParameters[i], parameterValues[i])) {
return false;
}
}
return true;
}
return false;
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"matchesParameters",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"formalParameters",
",",
"Object",
"...",
"parameterValues",
")",
"{",
"if",
"(",
"formalParameters",
"==",
"null",
")",
"{",
"return",
"parameterValues",
... | Replies if the formal parameters are matching the given values.
@param formalParameters the types of the formal parameters.
@param parameterValues the values associated to the paramters.
@return <code>true</code> if the values could be passed to the method.
@since 7.1 | [
"Replies",
"if",
"the",
"formal",
"parameters",
"are",
"matching",
"the",
"given",
"values",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/ReflectionUtil.java#L804-L818 |
aol/cyclops | cyclops-pure/src/main/java/cyclops/instances/control/MaybeInstances.java | MaybeInstances.fromOptional | public static <T> Maybe<T> fromOptional(Higher<DataWitness.optional,T> optional){
return Maybe.fromOptional(OptionalKind.narrowK(optional));
} | java | public static <T> Maybe<T> fromOptional(Higher<DataWitness.optional,T> optional){
return Maybe.fromOptional(OptionalKind.narrowK(optional));
} | [
"public",
"static",
"<",
"T",
">",
"Maybe",
"<",
"T",
">",
"fromOptional",
"(",
"Higher",
"<",
"DataWitness",
".",
"optional",
",",
"T",
">",
"optional",
")",
"{",
"return",
"Maybe",
".",
"fromOptional",
"(",
"OptionalKind",
".",
"narrowK",
"(",
"optiona... | Construct an equivalent Maybe from the Supplied Optional
<pre>
{@code
MaybeType<Integer> some = MaybeType.fromOptional(Optional.of(10));
//Maybe[10], Some[10]
MaybeType<Integer> none = MaybeType.fromOptional(Optional.zero());
//Maybe.zero, None[]
}
</pre>
@param optional Optional to construct Maybe from
@return Maybe created from Optional | [
"Construct",
"an",
"equivalent",
"Maybe",
"from",
"the",
"Supplied",
"Optional",
"<pre",
">",
"{",
"@code",
"MaybeType<Integer",
">",
"some",
"=",
"MaybeType",
".",
"fromOptional",
"(",
"Optional",
".",
"of",
"(",
"10",
"))",
";",
"//",
"Maybe",
"[",
"10",... | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-pure/src/main/java/cyclops/instances/control/MaybeInstances.java#L88-L91 |
apache/groovy | src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java | AntlrParserPlugin.buildName | protected ClassNode buildName(AST node) {
if (isType(TYPE, node)) {
node = node.getFirstChild();
}
ClassNode answer = null;
if (isType(DOT, node) || isType(OPTIONAL_DOT, node)) {
answer = ClassHelper.make(qualifiedName(node));
} else if (isPrimitiveTypeLiteral(node)) {
answer = ClassHelper.make(node.getText());
} else if (isType(INDEX_OP, node) || isType(ARRAY_DECLARATOR, node)) {
AST child = node.getFirstChild();
answer = buildName(child).makeArray();
configureAST(answer, node);
return answer;
} else {
String identifier = node.getText();
answer = ClassHelper.make(identifier);
}
AST nextSibling = node.getNextSibling();
if (isType(INDEX_OP, nextSibling) || isType(ARRAY_DECLARATOR, node)) {
answer = answer.makeArray();
configureAST(answer, node);
return answer;
} else {
configureAST(answer, node);
return answer;
}
} | java | protected ClassNode buildName(AST node) {
if (isType(TYPE, node)) {
node = node.getFirstChild();
}
ClassNode answer = null;
if (isType(DOT, node) || isType(OPTIONAL_DOT, node)) {
answer = ClassHelper.make(qualifiedName(node));
} else if (isPrimitiveTypeLiteral(node)) {
answer = ClassHelper.make(node.getText());
} else if (isType(INDEX_OP, node) || isType(ARRAY_DECLARATOR, node)) {
AST child = node.getFirstChild();
answer = buildName(child).makeArray();
configureAST(answer, node);
return answer;
} else {
String identifier = node.getText();
answer = ClassHelper.make(identifier);
}
AST nextSibling = node.getNextSibling();
if (isType(INDEX_OP, nextSibling) || isType(ARRAY_DECLARATOR, node)) {
answer = answer.makeArray();
configureAST(answer, node);
return answer;
} else {
configureAST(answer, node);
return answer;
}
} | [
"protected",
"ClassNode",
"buildName",
"(",
"AST",
"node",
")",
"{",
"if",
"(",
"isType",
"(",
"TYPE",
",",
"node",
")",
")",
"{",
"node",
"=",
"node",
".",
"getFirstChild",
"(",
")",
";",
"}",
"ClassNode",
"answer",
"=",
"null",
";",
"if",
"(",
"i... | Extracts an identifier from the Antlr AST and then performs a name resolution
to see if the given name is a type from imports, aliases or newly created classes | [
"Extracts",
"an",
"identifier",
"from",
"the",
"Antlr",
"AST",
"and",
"then",
"performs",
"a",
"name",
"resolution",
"to",
"see",
"if",
"the",
"given",
"name",
"is",
"a",
"type",
"from",
"imports",
"aliases",
"or",
"newly",
"created",
"classes"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/antlr/AntlrParserPlugin.java#L3125-L3152 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/N1qlParams.java | N1qlParams.withCredentials | public N1qlParams withCredentials(String login, String password) {
credentials.put(login, password);
return this;
} | java | public N1qlParams withCredentials(String login, String password) {
credentials.put(login, password);
return this;
} | [
"public",
"N1qlParams",
"withCredentials",
"(",
"String",
"login",
",",
"String",
"password",
")",
"{",
"credentials",
".",
"put",
"(",
"login",
",",
"password",
")",
";",
"return",
"this",
";",
"}"
] | Allows to add a credential username/password pair to this request. If a credential for that
username was previously set by a similar call, it is replaced.
@param login the username/bucketname to add a credential for.
@param password the associated password.
@return this {@link N1qlParams} for chaining. | [
"Allows",
"to",
"add",
"a",
"credential",
"username",
"/",
"password",
"pair",
"to",
"this",
"request",
".",
"If",
"a",
"credential",
"for",
"that",
"username",
"was",
"previously",
"set",
"by",
"a",
"similar",
"call",
"it",
"is",
"replaced",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/N1qlParams.java#L347-L350 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/LuisRuntimeManager.java | LuisRuntimeManager.authenticate | public static LuisRuntimeAPI authenticate(EndpointAPI endpointAPI, ServiceClientCredentials credentials) {
return authenticate(String.format("https://%s/luis/v2.0/", endpointAPI.toString()), credentials)
.withEndpoint(endpointAPI.toString());
} | java | public static LuisRuntimeAPI authenticate(EndpointAPI endpointAPI, ServiceClientCredentials credentials) {
return authenticate(String.format("https://%s/luis/v2.0/", endpointAPI.toString()), credentials)
.withEndpoint(endpointAPI.toString());
} | [
"public",
"static",
"LuisRuntimeAPI",
"authenticate",
"(",
"EndpointAPI",
"endpointAPI",
",",
"ServiceClientCredentials",
"credentials",
")",
"{",
"return",
"authenticate",
"(",
"String",
".",
"format",
"(",
"\"https://%s/luis/v2.0/\"",
",",
"endpointAPI",
".",
"toStrin... | Initializes an instance of Language Understanding (LUIS) Runtime API client.
@param endpointAPI the endpoint API
@param credentials the management credentials for Azure
@return the Language Understanding (LUIS) Runtime API client | [
"Initializes",
"an",
"instance",
"of",
"Language",
"Understanding",
"(",
"LUIS",
")",
"Runtime",
"API",
"client",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/LuisRuntimeManager.java#L80-L83 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java | DatabaseRepresentation.getResource | public StreamingOutput getResource(final String resourceName,
final Map<QueryParameter, String> queryParams) throws JaxRxException {
final StreamingOutput streamingOutput = new StreamingOutput() {
@Override
public void write(final OutputStream output) throws IOException, JaxRxException {
final String revision = queryParams.get(QueryParameter.REVISION);
final String wrap = queryParams.get(QueryParameter.WRAP);
final String nodeId = queryParams.get(QueryParameter.OUTPUT);
final boolean wrapResult = (wrap == null) ? false : wrap.equalsIgnoreCase(YESSTRING);
final boolean nodeid = (nodeId == null) ? false : nodeId.equalsIgnoreCase(YESSTRING);
try {
if (revision == null) {
serialize(resourceName, null, nodeid, output, wrapResult);
} else {
// pattern which have to match against the input
final Pattern pattern = Pattern.compile("[0-9]+[-]{1}[1-9]+");
final Matcher matcher = pattern.matcher(revision);
if (matcher.matches()) {
getModificHistory(resourceName, revision, nodeid, output, wrapResult);
} else {
serialize(resourceName, Long.valueOf(revision), nodeid, output, wrapResult);
}
}
} catch (final NumberFormatException exce) {
throw new JaxRxException(400, exce.getMessage());
} catch (final TTException exce) {
throw new JaxRxException(exce);
}
}
};
return streamingOutput;
} | java | public StreamingOutput getResource(final String resourceName,
final Map<QueryParameter, String> queryParams) throws JaxRxException {
final StreamingOutput streamingOutput = new StreamingOutput() {
@Override
public void write(final OutputStream output) throws IOException, JaxRxException {
final String revision = queryParams.get(QueryParameter.REVISION);
final String wrap = queryParams.get(QueryParameter.WRAP);
final String nodeId = queryParams.get(QueryParameter.OUTPUT);
final boolean wrapResult = (wrap == null) ? false : wrap.equalsIgnoreCase(YESSTRING);
final boolean nodeid = (nodeId == null) ? false : nodeId.equalsIgnoreCase(YESSTRING);
try {
if (revision == null) {
serialize(resourceName, null, nodeid, output, wrapResult);
} else {
// pattern which have to match against the input
final Pattern pattern = Pattern.compile("[0-9]+[-]{1}[1-9]+");
final Matcher matcher = pattern.matcher(revision);
if (matcher.matches()) {
getModificHistory(resourceName, revision, nodeid, output, wrapResult);
} else {
serialize(resourceName, Long.valueOf(revision), nodeid, output, wrapResult);
}
}
} catch (final NumberFormatException exce) {
throw new JaxRxException(400, exce.getMessage());
} catch (final TTException exce) {
throw new JaxRxException(exce);
}
}
};
return streamingOutput;
} | [
"public",
"StreamingOutput",
"getResource",
"(",
"final",
"String",
"resourceName",
",",
"final",
"Map",
"<",
"QueryParameter",
",",
"String",
">",
"queryParams",
")",
"throws",
"JaxRxException",
"{",
"final",
"StreamingOutput",
"streamingOutput",
"=",
"new",
"Strea... | This method is responsible to deliver the whole database. Additional
parameters can be set (wrap, revision, output) which change the response
view.
@param resourceName
The name of the requested database.
@param queryParams
The optional query parameters.
@return The XML database resource, depending on the query parameters.
@throws JaxRxException
The exception occurred. | [
"This",
"method",
"is",
"responsible",
"to",
"deliver",
"the",
"whole",
"database",
".",
"Additional",
"parameters",
"can",
"be",
"set",
"(",
"wrap",
"revision",
"output",
")",
"which",
"change",
"the",
"response",
"view",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java#L164-L197 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Triple.java | Triple.setRightIf | public <E extends Exception> boolean setRightIf(final R newRight, Try.BiPredicate<? super Triple<L, M, R>, ? super R, E> predicate) throws E {
if (predicate.test(this, newRight)) {
this.right = newRight;
return true;
}
return false;
} | java | public <E extends Exception> boolean setRightIf(final R newRight, Try.BiPredicate<? super Triple<L, M, R>, ? super R, E> predicate) throws E {
if (predicate.test(this, newRight)) {
this.right = newRight;
return true;
}
return false;
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"setRightIf",
"(",
"final",
"R",
"newRight",
",",
"Try",
".",
"BiPredicate",
"<",
"?",
"super",
"Triple",
"<",
"L",
",",
"M",
",",
"R",
">",
",",
"?",
"super",
"R",
",",
"E",
">",
"predica... | Set to the specified <code>newRight</code> and returns <code>true</code>
if <code>predicate</code> returns true. Otherwise returns
<code>false</code> without setting the value to new value.
@param newRight
@param predicate - the first parameter is current pair, the second
parameter is the <code>newRight</code>
@return | [
"Set",
"to",
"the",
"specified",
"<code",
">",
"newRight<",
"/",
"code",
">",
"and",
"returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"<code",
">",
"predicate<",
"/",
"code",
">",
"returns",
"true",
".",
"Otherwise",
"returns",
"<code",
">",
"... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Triple.java#L175-L182 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getWithLeading | @Nonnull
public static String getWithLeading (final int nValue, @Nonnegative final int nMinLen, final char cFront)
{
return _getWithLeadingOrTrailing (Integer.toString (nValue), nMinLen, cFront, true);
} | java | @Nonnull
public static String getWithLeading (final int nValue, @Nonnegative final int nMinLen, final char cFront)
{
return _getWithLeadingOrTrailing (Integer.toString (nValue), nMinLen, cFront, true);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getWithLeading",
"(",
"final",
"int",
"nValue",
",",
"@",
"Nonnegative",
"final",
"int",
"nMinLen",
",",
"final",
"char",
"cFront",
")",
"{",
"return",
"_getWithLeadingOrTrailing",
"(",
"Integer",
".",
"toString",
... | Get a string that is filled at the beginning with the passed character until
the minimum length is reached. If the input String is longer than the
provided length, it is returned unchanged.
@param nValue
Source string. May be <code>null</code>.
@param nMinLen
Minimum length. Should be > 0.
@param cFront
The character to be used at the beginning
@return A non-<code>null</code> string that has at least nLen chars
@see #getWithLeading(String, int, char) | [
"Get",
"a",
"string",
"that",
"is",
"filled",
"at",
"the",
"beginning",
"with",
"the",
"passed",
"character",
"until",
"the",
"minimum",
"length",
"is",
"reached",
".",
"If",
"the",
"input",
"String",
"is",
"longer",
"than",
"the",
"provided",
"length",
"i... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L520-L524 |
ops4j/org.ops4j.pax.web | pax-web-resources/pax-web-resources-jsf/src/main/java/org/ops4j/pax/web/resources/jsf/OsgiResourceHandler.java | OsgiResourceHandler.createResourceIdentifier | private String createResourceIdentifier(final String localePrefix, final String resourceName, final String resourceVersion, final String libraryName, final String libraryVersion) {
final StringBuilder sb = new StringBuilder();
if (StringUtils.isNotBlank(localePrefix)) {
sb.append(localePrefix).append(PATH_SEPARATOR);
}
if (StringUtils.isNotBlank(libraryName)) {
sb.append(libraryName).append(PATH_SEPARATOR);
}
if (StringUtils.isNotBlank(libraryVersion)) {
sb.append(libraryVersion).append(PATH_SEPARATOR);
}
sb.append(resourceName).append(PATH_SEPARATOR);
if (StringUtils.isNotBlank(resourceVersion)) {
sb.append(resourceVersion).append(PATH_SEPARATOR);
}
return sb.toString();
} | java | private String createResourceIdentifier(final String localePrefix, final String resourceName, final String resourceVersion, final String libraryName, final String libraryVersion) {
final StringBuilder sb = new StringBuilder();
if (StringUtils.isNotBlank(localePrefix)) {
sb.append(localePrefix).append(PATH_SEPARATOR);
}
if (StringUtils.isNotBlank(libraryName)) {
sb.append(libraryName).append(PATH_SEPARATOR);
}
if (StringUtils.isNotBlank(libraryVersion)) {
sb.append(libraryVersion).append(PATH_SEPARATOR);
}
sb.append(resourceName).append(PATH_SEPARATOR);
if (StringUtils.isNotBlank(resourceVersion)) {
sb.append(resourceVersion).append(PATH_SEPARATOR);
}
return sb.toString();
} | [
"private",
"String",
"createResourceIdentifier",
"(",
"final",
"String",
"localePrefix",
",",
"final",
"String",
"resourceName",
",",
"final",
"String",
"resourceVersion",
",",
"final",
"String",
"libraryName",
",",
"final",
"String",
"libraryVersion",
")",
"{",
"fi... | Creates an ResourceIdentifier according to chapter 2.6.1.3 from the JSF 2.2 specification
@param localePrefix locale to use for the resource, optional
@param resourceName name of the resource
@param resourceVersion resource-version, optional
@param libraryName library-name, optional
@param libraryVersion library-version, optional
@return String-representation of a resource-identifier | [
"Creates",
"an",
"ResourceIdentifier",
"according",
"to",
"chapter",
"2",
".",
"6",
".",
"1",
".",
"3",
"from",
"the",
"JSF",
"2",
".",
"2",
"specification"
] | train | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-resources/pax-web-resources-jsf/src/main/java/org/ops4j/pax/web/resources/jsf/OsgiResourceHandler.java#L421-L438 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java | FieldUtils.writeStaticField | public static void writeStaticField(final Field field, final Object value, final boolean forceAccess) throws IllegalAccessException {
Validate.isTrue(field != null, "The field must not be null");
Validate.isTrue(Modifier.isStatic(field.getModifiers()), "The field %s.%s is not static", field.getDeclaringClass().getName(),
field.getName());
writeField(field, (Object) null, value, forceAccess);
} | java | public static void writeStaticField(final Field field, final Object value, final boolean forceAccess) throws IllegalAccessException {
Validate.isTrue(field != null, "The field must not be null");
Validate.isTrue(Modifier.isStatic(field.getModifiers()), "The field %s.%s is not static", field.getDeclaringClass().getName(),
field.getName());
writeField(field, (Object) null, value, forceAccess);
} | [
"public",
"static",
"void",
"writeStaticField",
"(",
"final",
"Field",
"field",
",",
"final",
"Object",
"value",
",",
"final",
"boolean",
"forceAccess",
")",
"throws",
"IllegalAccessException",
"{",
"Validate",
".",
"isTrue",
"(",
"field",
"!=",
"null",
",",
"... | Writes a static {@link Field}.
@param field
to write
@param value
to set
@param forceAccess
whether to break scope restrictions using the
{@link java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code false} will only
match {@code public} fields.
@throws IllegalArgumentException
if the field is {@code null} or not {@code static}, or {@code value} is not assignable
@throws IllegalAccessException
if the field is not made accessible or is {@code final} | [
"Writes",
"a",
"static",
"{",
"@link",
"Field",
"}",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java#L550-L555 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java | WebUtils.getServiceUserInterfaceMetadata | public static <T> T getServiceUserInterfaceMetadata(final RequestContext requestContext, final Class<T> clz) {
if (requestContext.getFlowScope().contains(PARAMETER_SERVICE_UI_METADATA)) {
return requestContext.getFlowScope().get(PARAMETER_SERVICE_UI_METADATA, clz);
}
return null;
} | java | public static <T> T getServiceUserInterfaceMetadata(final RequestContext requestContext, final Class<T> clz) {
if (requestContext.getFlowScope().contains(PARAMETER_SERVICE_UI_METADATA)) {
return requestContext.getFlowScope().get(PARAMETER_SERVICE_UI_METADATA, clz);
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getServiceUserInterfaceMetadata",
"(",
"final",
"RequestContext",
"requestContext",
",",
"final",
"Class",
"<",
"T",
">",
"clz",
")",
"{",
"if",
"(",
"requestContext",
".",
"getFlowScope",
"(",
")",
".",
"contains",
"... | Gets service user interface metadata.
@param <T> the type parameter
@param requestContext the request context
@param clz the clz
@return the service user interface metadata | [
"Gets",
"service",
"user",
"interface",
"metadata",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L739-L744 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/util/ListUtil.java | ListUtil.listToArrayTrim | public static Array listToArrayTrim(String list, char delimiter) {
if (list.length() == 0) return new ArrayImpl();
// remove at start
while (list.indexOf(delimiter) == 0) {
list = list.substring(1);
}
int len = list.length();
if (len == 0) return new ArrayImpl();
while (list.lastIndexOf(delimiter) == len - 1) {
list = list.substring(0, len - 1 < 0 ? 0 : len - 1);
len = list.length();
}
return listToArray(list, delimiter);
} | java | public static Array listToArrayTrim(String list, char delimiter) {
if (list.length() == 0) return new ArrayImpl();
// remove at start
while (list.indexOf(delimiter) == 0) {
list = list.substring(1);
}
int len = list.length();
if (len == 0) return new ArrayImpl();
while (list.lastIndexOf(delimiter) == len - 1) {
list = list.substring(0, len - 1 < 0 ? 0 : len - 1);
len = list.length();
}
return listToArray(list, delimiter);
} | [
"public",
"static",
"Array",
"listToArrayTrim",
"(",
"String",
"list",
",",
"char",
"delimiter",
")",
"{",
"if",
"(",
"list",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"new",
"ArrayImpl",
"(",
")",
";",
"// remove at start",
"while",
"(",
"list"... | casts a list to Array object, remove all empty items at start and end of the list
@param list list to cast
@param delimiter delimter of the list
@return Array Object | [
"casts",
"a",
"list",
"to",
"Array",
"object",
"remove",
"all",
"empty",
"items",
"at",
"start",
"and",
"end",
"of",
"the",
"list"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L486-L499 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java | SystemViewImporter.getAttribute | protected String getAttribute(Map<String, String> attributes, InternalQName name) throws RepositoryException
{
JCRName jname = locationFactory.createJCRName(name);
return attributes.get(jname.getAsString());
} | java | protected String getAttribute(Map<String, String> attributes, InternalQName name) throws RepositoryException
{
JCRName jname = locationFactory.createJCRName(name);
return attributes.get(jname.getAsString());
} | [
"protected",
"String",
"getAttribute",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
",",
"InternalQName",
"name",
")",
"throws",
"RepositoryException",
"{",
"JCRName",
"jname",
"=",
"locationFactory",
".",
"createJCRName",
"(",
"name",
")",
";",
... | Returns the value of the named XML attribute.
@param attributes set of XML attributes
@param name attribute name
@return attribute value, or <code>null</code> if the named attribute is not
found
@throws RepositoryException | [
"Returns",
"the",
"value",
"of",
"the",
"named",
"XML",
"attribute",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java#L714-L718 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dimensionalityreduction/PCA.java | PCA.pca_factor | public static INDArray pca_factor(INDArray A, int nDims, boolean normalize) {
if (normalize) {
// Normalize to mean 0 for each feature ( each column has 0 mean )
INDArray mean = A.mean(0);
A.subiRowVector(mean);
}
long m = A.rows();
long n = A.columns();
// The prepare SVD results, we'll decomp A to UxSxV'
INDArray s = Nd4j.create(A.dataType(), m < n ? m : n);
INDArray VT = Nd4j.create(A.dataType(), new long[]{n, n}, 'f');
// Note - we don't care about U
Nd4j.getBlasWrapper().lapack().gesvd(A, s, null, VT);
// for comparison k & nDims are the equivalent values in both methods implementing PCA
// So now let's rip out the appropriate number of left singular vectors from
// the V output (note we pulls rows since VT is a transpose of V)
INDArray V = VT.transpose();
INDArray factor = Nd4j.create(A.dataType(),new long[]{n, nDims}, 'f');
for (int i = 0; i < nDims; i++) {
factor.putColumn(i, V.getColumn(i));
}
return factor;
} | java | public static INDArray pca_factor(INDArray A, int nDims, boolean normalize) {
if (normalize) {
// Normalize to mean 0 for each feature ( each column has 0 mean )
INDArray mean = A.mean(0);
A.subiRowVector(mean);
}
long m = A.rows();
long n = A.columns();
// The prepare SVD results, we'll decomp A to UxSxV'
INDArray s = Nd4j.create(A.dataType(), m < n ? m : n);
INDArray VT = Nd4j.create(A.dataType(), new long[]{n, n}, 'f');
// Note - we don't care about U
Nd4j.getBlasWrapper().lapack().gesvd(A, s, null, VT);
// for comparison k & nDims are the equivalent values in both methods implementing PCA
// So now let's rip out the appropriate number of left singular vectors from
// the V output (note we pulls rows since VT is a transpose of V)
INDArray V = VT.transpose();
INDArray factor = Nd4j.create(A.dataType(),new long[]{n, nDims}, 'f');
for (int i = 0; i < nDims; i++) {
factor.putColumn(i, V.getColumn(i));
}
return factor;
} | [
"public",
"static",
"INDArray",
"pca_factor",
"(",
"INDArray",
"A",
",",
"int",
"nDims",
",",
"boolean",
"normalize",
")",
"{",
"if",
"(",
"normalize",
")",
"{",
"// Normalize to mean 0 for each feature ( each column has 0 mean )",
"INDArray",
"mean",
"=",
"A",
".",... | Calculates pca factors of a matrix, for a flags number of reduced features
returns the factors to scale observations
The return is a factor matrix to reduce (normalized) feature sets
@see pca(INDArray, int, boolean)
@param A the array of features, rows are results, columns are features - will be changed
@param nDims the number of components on which to project the features
@param normalize whether to normalize (adjust each feature to have zero mean)
@return the reduced feature set | [
"Calculates",
"pca",
"factors",
"of",
"a",
"matrix",
"for",
"a",
"flags",
"number",
"of",
"reduced",
"features",
"returns",
"the",
"factors",
"to",
"scale",
"observations"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dimensionalityreduction/PCA.java#L173-L202 |
hazelcast/hazelcast | hazelcast-client/src/main/java/com/hazelcast/client/proxy/ClientPNCounterProxy.java | ClientPNCounterProxy.invokeGetInternal | private ClientMessage invokeGetInternal(List<Address> excludedAddresses,
HazelcastException lastException,
Address target) {
if (target == null) {
throw lastException != null
? lastException
: new NoDataMemberInClusterException(
"Cannot invoke operations on a CRDT because the cluster does not contain any data members");
}
try {
final ClientMessage request = PNCounterGetCodec.encodeRequest(name, observedClock.entrySet(), target);
return invokeOnAddress(request, target);
} catch (HazelcastException e) {
logger.fine("Exception occurred while invoking operation on target " + target + ", choosing different target", e);
if (excludedAddresses == EMPTY_ADDRESS_LIST) {
excludedAddresses = new ArrayList<Address>();
}
excludedAddresses.add(target);
final Address newTarget = getCRDTOperationTarget(excludedAddresses);
return invokeGetInternal(excludedAddresses, e, newTarget);
}
} | java | private ClientMessage invokeGetInternal(List<Address> excludedAddresses,
HazelcastException lastException,
Address target) {
if (target == null) {
throw lastException != null
? lastException
: new NoDataMemberInClusterException(
"Cannot invoke operations on a CRDT because the cluster does not contain any data members");
}
try {
final ClientMessage request = PNCounterGetCodec.encodeRequest(name, observedClock.entrySet(), target);
return invokeOnAddress(request, target);
} catch (HazelcastException e) {
logger.fine("Exception occurred while invoking operation on target " + target + ", choosing different target", e);
if (excludedAddresses == EMPTY_ADDRESS_LIST) {
excludedAddresses = new ArrayList<Address>();
}
excludedAddresses.add(target);
final Address newTarget = getCRDTOperationTarget(excludedAddresses);
return invokeGetInternal(excludedAddresses, e, newTarget);
}
} | [
"private",
"ClientMessage",
"invokeGetInternal",
"(",
"List",
"<",
"Address",
">",
"excludedAddresses",
",",
"HazelcastException",
"lastException",
",",
"Address",
"target",
")",
"{",
"if",
"(",
"target",
"==",
"null",
")",
"{",
"throw",
"lastException",
"!=",
"... | Returns the current value of the counter.
It will invoke client messages recursively on viable replica addresses
until successful or the list of viable replicas is exhausted.
Replicas with addresses contained in the {@code excludedAddresses} are
skipped. If there are no viable replicas, this method will throw the
{@code lastException} if not {@code null} or a
{@link NoDataMemberInClusterException} if the {@code lastException} is
{@code null}.
@param excludedAddresses the addresses to exclude when choosing a replica
address, must not be {@code null}
@param lastException the exception thrown from the last invocation of
the {@code request} on a replica, may be {@code null}
@return the result of the request invocation on a replica
@throws NoDataMemberInClusterException if there are no replicas and the
{@code lastException} is false | [
"Returns",
"the",
"current",
"value",
"of",
"the",
"counter",
".",
"It",
"will",
"invoke",
"client",
"messages",
"recursively",
"on",
"viable",
"replica",
"addresses",
"until",
"successful",
"or",
"the",
"list",
"of",
"viable",
"replicas",
"is",
"exhausted",
"... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/proxy/ClientPNCounterProxy.java#L289-L310 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java | XLogPDescriptor.getHydrogenCount | private int getHydrogenCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
int hcounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("H")) {
hcounter += 1;
}
}
return hcounter;
} | java | private int getHydrogenCount(IAtomContainer ac, IAtom atom) {
List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
int hcounter = 0;
for (IAtom neighbour : neighbours) {
if (neighbour.getSymbol().equals("H")) {
hcounter += 1;
}
}
return hcounter;
} | [
"private",
"int",
"getHydrogenCount",
"(",
"IAtomContainer",
"ac",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IAtom",
">",
"neighbours",
"=",
"ac",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"int",
"hcounter",
"=",
"0",
";",
"for",
"(",
"IAt... | Gets the hydrogenCount attribute of the XLogPDescriptor object.
@param ac Description of the Parameter
@param atom Description of the Parameter
@return The hydrogenCount value | [
"Gets",
"the",
"hydrogenCount",
"attribute",
"of",
"the",
"XLogPDescriptor",
"object",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1013-L1022 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java | DeprecatedAPIListBuilder.composeDeprecatedList | private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) {
for (MemberDoc member : members) {
if (utils.isDeprecated(member)) {
list.add(member);
}
}
} | java | private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) {
for (MemberDoc member : members) {
if (utils.isDeprecated(member)) {
list.add(member);
}
}
} | [
"private",
"void",
"composeDeprecatedList",
"(",
"List",
"<",
"Doc",
">",
"list",
",",
"MemberDoc",
"[",
"]",
"members",
")",
"{",
"for",
"(",
"MemberDoc",
"member",
":",
"members",
")",
"{",
"if",
"(",
"utils",
".",
"isDeprecated",
"(",
"member",
")",
... | Add the members into a single list of deprecated members.
@param list List of all the particular deprecated members, e.g. methods.
@param members members to be added in the list. | [
"Add",
"the",
"members",
"into",
"a",
"single",
"list",
"of",
"deprecated",
"members",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java#L133-L139 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/stats/StatsInterface.java | StatsInterface.getPhotosetDomains | public DomainList getPhotosetDomains(Date date, String photosetId, int perPage, int page) throws FlickrException {
return getDomains(METHOD_GET_PHOTOSET_DOMAINS, "photoset_id", photosetId, date, perPage, page);
} | java | public DomainList getPhotosetDomains(Date date, String photosetId, int perPage, int page) throws FlickrException {
return getDomains(METHOD_GET_PHOTOSET_DOMAINS, "photoset_id", photosetId, date, perPage, page);
} | [
"public",
"DomainList",
"getPhotosetDomains",
"(",
"Date",
"date",
",",
"String",
"photosetId",
",",
"int",
"perPage",
",",
"int",
"page",
")",
"throws",
"FlickrException",
"{",
"return",
"getDomains",
"(",
"METHOD_GET_PHOTOSET_DOMAINS",
",",
"\"photoset_id\"",
",",... | Get a list of referring domains for a photoset.
@param date
(Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will
automatically be rounded down to the start of the day.
@param photosetId
(Optional) The id of the photoset to get stats for. If not provided, stats for all photos will be returned.
@param perPage
(Optional) Number of domains to return per page. If this argument is omitted, it defaults to 25. The maximum allowed value is 100.
@param page
(Optional) The page of results to return. If this argument is omitted, it defaults to 1.
@see "http://www.flickr.com/services/api/flickr.stats.getPhotosetDomains.html" | [
"Get",
"a",
"list",
"of",
"referring",
"domains",
"for",
"a",
"photoset",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L220-L222 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/SsoApi.java | SsoApi.getCharacterInfo | public CharacterInfo getCharacterInfo() throws ApiException {
return new CharacterInfo(metaApi.getVerify(null, null, DATASOURCE, null, null));
} | java | public CharacterInfo getCharacterInfo() throws ApiException {
return new CharacterInfo(metaApi.getVerify(null, null, DATASOURCE, null, null));
} | [
"public",
"CharacterInfo",
"getCharacterInfo",
"(",
")",
"throws",
"ApiException",
"{",
"return",
"new",
"CharacterInfo",
"(",
"metaApi",
".",
"getVerify",
"(",
"null",
",",
"null",
",",
"DATASOURCE",
",",
"null",
",",
"null",
")",
")",
";",
"}"
] | Alias for net.troja.eve.esi.api.MetaApi.getVerify() Return CharacterInfo
that have helper methods: CharacterInfo.getScopes() : Set<String>
CharacterInfo.getExpireOn() : OffsetDateTime
@return
@throws ApiException | [
"Alias",
"for",
"net",
".",
"troja",
".",
"eve",
".",
"esi",
".",
"api",
".",
"MetaApi",
".",
"getVerify",
"()",
"Return",
"CharacterInfo",
"that",
"have",
"helper",
"methods",
":",
"CharacterInfo",
".",
"getScopes",
"()",
":",
"Set<String",
">",
"Characte... | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/SsoApi.java#L57-L59 |
kite-sdk/kite | kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/AvroEntitySerDe.java | AvroEntitySerDe.getColumnDecoder | private Decoder getColumnDecoder(Schema writtenFieldAvroSchema, InputStream in) {
// Use a special Avro decoder that has special handling for int, long,
// and String types. See ColumnDecoder for more information.
if (writtenFieldAvroSchema.getType() == Type.INT
|| writtenFieldAvroSchema.getType() == Type.LONG
|| writtenFieldAvroSchema.getType() == Type.STRING) {
return new ColumnDecoder(in);
} else {
return DecoderFactory.get().binaryDecoder(in, null);
}
} | java | private Decoder getColumnDecoder(Schema writtenFieldAvroSchema, InputStream in) {
// Use a special Avro decoder that has special handling for int, long,
// and String types. See ColumnDecoder for more information.
if (writtenFieldAvroSchema.getType() == Type.INT
|| writtenFieldAvroSchema.getType() == Type.LONG
|| writtenFieldAvroSchema.getType() == Type.STRING) {
return new ColumnDecoder(in);
} else {
return DecoderFactory.get().binaryDecoder(in, null);
}
} | [
"private",
"Decoder",
"getColumnDecoder",
"(",
"Schema",
"writtenFieldAvroSchema",
",",
"InputStream",
"in",
")",
"{",
"// Use a special Avro decoder that has special handling for int, long,",
"// and String types. See ColumnDecoder for more information.",
"if",
"(",
"writtenFieldAvroS... | Returns an Avro Decoder. The implementation it chooses will depend on the
schema of the field.
@param in
InputStream to decode bytes from
@return The avro decoder. | [
"Returns",
"an",
"Avro",
"Decoder",
".",
"The",
"implementation",
"it",
"chooses",
"will",
"depend",
"on",
"the",
"schema",
"of",
"the",
"field",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/AvroEntitySerDe.java#L359-L369 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_POST | public OvhCart cart_POST(String description, Date expire, OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException {
String qPath = "/order/cart";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "expire", expire);
addBody(o, "ovhSubsidiary", ovhSubsidiary);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhCart.class);
} | java | public OvhCart cart_POST(String description, Date expire, OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException {
String qPath = "/order/cart";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "expire", expire);
addBody(o, "ovhSubsidiary", ovhSubsidiary);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhCart.class);
} | [
"public",
"OvhCart",
"cart_POST",
"(",
"String",
"description",
",",
"Date",
"expire",
",",
"OvhOvhSubsidiaryEnum",
"ovhSubsidiary",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath"... | Create a new OVH order cart
REST: POST /order/cart
@param description [required] Description of your cart
@param expire [required] Time of expiration of the cart
@param ovhSubsidiary [required] OVH Subsidiary where you want to order | [
"Create",
"a",
"new",
"OVH",
"order",
"cart"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L7361-L7370 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java | JacksonUtils.getValue | public static <T> T getValue(JsonNode node, String dPath, Class<T> clazz) {
return DPathUtils.getValue(node, dPath, clazz);
} | java | public static <T> T getValue(JsonNode node, String dPath, Class<T> clazz) {
return DPathUtils.getValue(node, dPath, clazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getValue",
"(",
"JsonNode",
"node",
",",
"String",
"dPath",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"DPathUtils",
".",
"getValue",
"(",
"node",
",",
"dPath",
",",
"clazz",
")",
";",
"}"
] | Extract a value from the target {@link JsonNode} using DPath expression (generic
version).
@param node
@param dPath
@param clazz
@return
@see DPathUtils | [
"Extract",
"a",
"value",
"from",
"the",
"target",
"{",
"@link",
"JsonNode",
"}",
"using",
"DPath",
"expression",
"(",
"generic",
"version",
")",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L234-L236 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/spider/SpiderPanelTableModel.java | SpiderPanelTableModel.addScanResult | public void addScanResult(String uri, String method, String flags, boolean skipped) {
SpiderScanResult result = new SpiderScanResult(uri, method, flags, !skipped);
scanResults.add(result);
fireTableRowsInserted(scanResults.size() - 1, scanResults.size() - 1);
} | java | public void addScanResult(String uri, String method, String flags, boolean skipped) {
SpiderScanResult result = new SpiderScanResult(uri, method, flags, !skipped);
scanResults.add(result);
fireTableRowsInserted(scanResults.size() - 1, scanResults.size() - 1);
} | [
"public",
"void",
"addScanResult",
"(",
"String",
"uri",
",",
"String",
"method",
",",
"String",
"flags",
",",
"boolean",
"skipped",
")",
"{",
"SpiderScanResult",
"result",
"=",
"new",
"SpiderScanResult",
"(",
"uri",
",",
"method",
",",
"flags",
",",
"!",
... | Adds a new spider scan result. Method is synchronized internally.
@param uri the uri
@param method the method
@param flags the flags
@param skipped {@code true} if the result was skipped, {@code false} otherwise | [
"Adds",
"a",
"new",
"spider",
"scan",
"result",
".",
"Method",
"is",
"synchronized",
"internally",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/spider/SpiderPanelTableModel.java#L121-L125 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.enableAutoScaleAsync | public Observable<Void> enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter) {
return enableAutoScaleWithServiceResponseAsync(poolId, poolEnableAutoScaleParameter).map(new Func1<ServiceResponseWithHeaders<Void, PoolEnableAutoScaleHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, PoolEnableAutoScaleHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> enableAutoScaleAsync(String poolId, PoolEnableAutoScaleParameter poolEnableAutoScaleParameter) {
return enableAutoScaleWithServiceResponseAsync(poolId, poolEnableAutoScaleParameter).map(new Func1<ServiceResponseWithHeaders<Void, PoolEnableAutoScaleHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, PoolEnableAutoScaleHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"enableAutoScaleAsync",
"(",
"String",
"poolId",
",",
"PoolEnableAutoScaleParameter",
"poolEnableAutoScaleParameter",
")",
"{",
"return",
"enableAutoScaleWithServiceResponseAsync",
"(",
"poolId",
",",
"poolEnableAutoScaleParameter",
"... | Enables automatic scaling for a pool.
You cannot enable automatic scaling on a pool if a resize operation is in progress on the pool. If automatic scaling of the pool is currently disabled, you must specify a valid autoscale formula as part of the request. If automatic scaling of the pool is already enabled, you may specify a new autoscale formula and/or a new evaluation interval. You cannot call this API for the same pool more than once every 30 seconds.
@param poolId The ID of the pool on which to enable automatic scaling.
@param poolEnableAutoScaleParameter The parameters for the request.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Enables",
"automatic",
"scaling",
"for",
"a",
"pool",
".",
"You",
"cannot",
"enable",
"automatic",
"scaling",
"on",
"a",
"pool",
"if",
"a",
"resize",
"operation",
"is",
"in",
"progress",
"on",
"the",
"pool",
".",
"If",
"automatic",
"scaling",
"of",
"the",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L2290-L2297 |
alexvasilkov/GestureViews | library/src/main/java/com/alexvasilkov/gestures/animation/ViewPositionAnimator.java | ViewPositionAnimator.setToState | public void setToState(State state, @FloatRange(from = 0f, to = 1f) float position) {
if (position <= 0) {
throw new IllegalArgumentException("'To' position cannot be <= 0");
}
if (position > 1f) {
throw new IllegalArgumentException("'To' position cannot be > 1");
}
if (GestureDebug.isDebugAnimator()) {
Log.d(TAG, "State reset: " + state + " at " + position);
}
toPosition = position;
toState.set(state);
requestUpdateToState();
requestUpdateFromState();
} | java | public void setToState(State state, @FloatRange(from = 0f, to = 1f) float position) {
if (position <= 0) {
throw new IllegalArgumentException("'To' position cannot be <= 0");
}
if (position > 1f) {
throw new IllegalArgumentException("'To' position cannot be > 1");
}
if (GestureDebug.isDebugAnimator()) {
Log.d(TAG, "State reset: " + state + " at " + position);
}
toPosition = position;
toState.set(state);
requestUpdateToState();
requestUpdateFromState();
} | [
"public",
"void",
"setToState",
"(",
"State",
"state",
",",
"@",
"FloatRange",
"(",
"from",
"=",
"0f",
",",
"to",
"=",
"1f",
")",
"float",
"position",
")",
"{",
"if",
"(",
"position",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"("... | Specifies target ('to') state and it's position which will be used to interpolate
current state for intermediate positions (i.e. during animation or exit gesture).<br>
This allows you to set up correct state without changing current position
({@link #getPosition()}).
<p>
Only use this method if you understand what you do.
@param state Target ('to') state
@param position Target ('to') position
@see #getToPosition() | [
"Specifies",
"target",
"(",
"to",
")",
"state",
"and",
"it",
"s",
"position",
"which",
"will",
"be",
"used",
"to",
"interpolate",
"current",
"state",
"for",
"intermediate",
"positions",
"(",
"i",
".",
"e",
".",
"during",
"animation",
"or",
"exit",
"gesture... | train | https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/animation/ViewPositionAnimator.java#L454-L470 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ResourceCopy.java | ResourceCopy.copyExternalAssets | public static void copyExternalAssets(AbstractWisdomMojo mojo, MavenResourcesFiltering filtering) throws IOException {
File in = new File(mojo.basedir, Constants.ASSETS_SRC_DIR);
if (!in.exists()) {
return;
}
File out = new File(mojo.getWisdomRootDirectory(), Constants.ASSETS_DIR);
filterAndCopy(mojo, filtering, in, out);
} | java | public static void copyExternalAssets(AbstractWisdomMojo mojo, MavenResourcesFiltering filtering) throws IOException {
File in = new File(mojo.basedir, Constants.ASSETS_SRC_DIR);
if (!in.exists()) {
return;
}
File out = new File(mojo.getWisdomRootDirectory(), Constants.ASSETS_DIR);
filterAndCopy(mojo, filtering, in, out);
} | [
"public",
"static",
"void",
"copyExternalAssets",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"MavenResourcesFiltering",
"filtering",
")",
"throws",
"IOException",
"{",
"File",
"in",
"=",
"new",
"File",
"(",
"mojo",
".",
"basedir",
",",
"Constants",
".",
"ASSETS_SRC_D... | Copies the external assets from "src/main/assets" to "wisdom/assets". Copied resources are filtered.
@param mojo the mojo
@param filtering the component required to filter resources
@throws IOException if a file cannot be copied | [
"Copies",
"the",
"external",
"assets",
"from",
"src",
"/",
"main",
"/",
"assets",
"to",
"wisdom",
"/",
"assets",
".",
"Copied",
"resources",
"are",
"filtered",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ResourceCopy.java#L214-L221 |
Netflix/denominator | core/src/main/java/denominator/hook/InstanceMetadataHook.java | InstanceMetadataHook.get | public static String get(URI metadataService, String path) {
checkNotNull(metadataService, "metadataService");
checkArgument(metadataService.getPath().endsWith("/"),
"metadataService must end with '/'; %s provided",
metadataService);
checkNotNull(path, "path");
InputStream stream = null;
try {
stream = openStream(metadataService + path);
String content = slurp(new InputStreamReader(stream));
if (content.isEmpty()) {
return null;
}
return content;
} catch (IOException e) {
return null;
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
}
}
} | java | public static String get(URI metadataService, String path) {
checkNotNull(metadataService, "metadataService");
checkArgument(metadataService.getPath().endsWith("/"),
"metadataService must end with '/'; %s provided",
metadataService);
checkNotNull(path, "path");
InputStream stream = null;
try {
stream = openStream(metadataService + path);
String content = slurp(new InputStreamReader(stream));
if (content.isEmpty()) {
return null;
}
return content;
} catch (IOException e) {
return null;
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
}
}
} | [
"public",
"static",
"String",
"get",
"(",
"URI",
"metadataService",
",",
"String",
"path",
")",
"{",
"checkNotNull",
"(",
"metadataService",
",",
"\"metadataService\"",
")",
";",
"checkArgument",
"(",
"metadataService",
".",
"getPath",
"(",
")",
".",
"endsWith",... | Retrieves content at a path, if present.
@param metadataService endpoint with trailing slash. ex. {@code http://169.254.169.254/latest/meta-data/}
@param path path to the metadata desired. ex. {@code public-ipv4} or {@code
iam/security-credentials/role-name}
@return null if {@code metadataService} service cannot be contacted or no data at path. | [
"Retrieves",
"content",
"at",
"a",
"path",
"if",
"present",
"."
] | train | https://github.com/Netflix/denominator/blob/c565e3b8c6043051252e0947029511f9ac5d306f/core/src/main/java/denominator/hook/InstanceMetadataHook.java#L79-L103 |
eostermueller/headlessInTraceClient | src/main/java/org/headlessintrace/client/model/DefaultTraceEventParser.java | DefaultTraceEventParser.applyTimeToDate | public static long applyTimeToDate(Date date, Date time) throws IntraceException {
Calendar dateCal = new GregorianCalendar();
dateCal.setTime(date);
Calendar timeCal = new GregorianCalendar();
dateCal.setTime(time);
dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY )); // 24 hour clock
dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE ));
dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
dateCal.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND));
return dateCal.getTimeInMillis();
} | java | public static long applyTimeToDate(Date date, Date time) throws IntraceException {
Calendar dateCal = new GregorianCalendar();
dateCal.setTime(date);
Calendar timeCal = new GregorianCalendar();
dateCal.setTime(time);
dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY )); // 24 hour clock
dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE ));
dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
dateCal.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND));
return dateCal.getTimeInMillis();
} | [
"public",
"static",
"long",
"applyTimeToDate",
"(",
"Date",
"date",
",",
"Date",
"time",
")",
"throws",
"IntraceException",
"{",
"Calendar",
"dateCal",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"dateCal",
".",
"setTime",
"(",
"date",
")",
";",
"Calenda... | set the give time properties (hour/minute/sec/milli) onto the give data object.
@param date
@param time
@return
@throws IntraceException | [
"set",
"the",
"give",
"time",
"properties",
"(",
"hour",
"/",
"minute",
"/",
"sec",
"/",
"milli",
")",
"onto",
"the",
"give",
"data",
"object",
"."
] | train | https://github.com/eostermueller/headlessInTraceClient/blob/50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604/src/main/java/org/headlessintrace/client/model/DefaultTraceEventParser.java#L194-L209 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java | ProxiedFileSystemUtils.createProxiedFileSystem | static FileSystem createProxiedFileSystem(@NonNull final String userNameToProxyAs, Properties properties, URI fsURI,
Configuration conf) throws IOException {
Preconditions.checkArgument(properties.containsKey(AUTH_TYPE_KEY));
switch (AuthType.valueOf(properties.getProperty(AUTH_TYPE_KEY))) {
case TOKEN:
Preconditions.checkArgument(properties.containsKey(AUTH_TOKEN_PATH));
Path tokenPath = new Path(properties.getProperty(AUTH_TOKEN_PATH));
Optional<Token<?>> proxyToken = getTokenFromSeqFile(userNameToProxyAs, tokenPath);
if (proxyToken.isPresent()) {
try {
return createProxiedFileSystemUsingToken(userNameToProxyAs, proxyToken.get(), fsURI, conf);
} catch (InterruptedException e) {
throw new IOException("Failed to proxy as user " + userNameToProxyAs, e);
}
}
throw new IOException("No delegation token found for proxy user " + userNameToProxyAs);
case KEYTAB:
Preconditions.checkArgument(properties.containsKey(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)
&& properties.containsKey(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
String superUserName = properties.getProperty(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS);
Path keytabPath = new Path(properties.getProperty(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
try {
return createProxiedFileSystemUsingKeytab(userNameToProxyAs, superUserName, keytabPath, fsURI, conf);
} catch (InterruptedException e) {
throw new IOException("Failed to proxy as user " + userNameToProxyAs, e);
}
default:
throw new IOException("User proxy auth type " + properties.getProperty(AUTH_TYPE_KEY) + " not recognized.");
}
} | java | static FileSystem createProxiedFileSystem(@NonNull final String userNameToProxyAs, Properties properties, URI fsURI,
Configuration conf) throws IOException {
Preconditions.checkArgument(properties.containsKey(AUTH_TYPE_KEY));
switch (AuthType.valueOf(properties.getProperty(AUTH_TYPE_KEY))) {
case TOKEN:
Preconditions.checkArgument(properties.containsKey(AUTH_TOKEN_PATH));
Path tokenPath = new Path(properties.getProperty(AUTH_TOKEN_PATH));
Optional<Token<?>> proxyToken = getTokenFromSeqFile(userNameToProxyAs, tokenPath);
if (proxyToken.isPresent()) {
try {
return createProxiedFileSystemUsingToken(userNameToProxyAs, proxyToken.get(), fsURI, conf);
} catch (InterruptedException e) {
throw new IOException("Failed to proxy as user " + userNameToProxyAs, e);
}
}
throw new IOException("No delegation token found for proxy user " + userNameToProxyAs);
case KEYTAB:
Preconditions.checkArgument(properties.containsKey(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS)
&& properties.containsKey(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
String superUserName = properties.getProperty(ConfigurationKeys.SUPER_USER_NAME_TO_PROXY_AS_OTHERS);
Path keytabPath = new Path(properties.getProperty(ConfigurationKeys.SUPER_USER_KEY_TAB_LOCATION));
try {
return createProxiedFileSystemUsingKeytab(userNameToProxyAs, superUserName, keytabPath, fsURI, conf);
} catch (InterruptedException e) {
throw new IOException("Failed to proxy as user " + userNameToProxyAs, e);
}
default:
throw new IOException("User proxy auth type " + properties.getProperty(AUTH_TYPE_KEY) + " not recognized.");
}
} | [
"static",
"FileSystem",
"createProxiedFileSystem",
"(",
"@",
"NonNull",
"final",
"String",
"userNameToProxyAs",
",",
"Properties",
"properties",
",",
"URI",
"fsURI",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkArgument"... | Creates a {@link FileSystem} that can perform any operations allowed by the specified userNameToProxyAs.
@param userNameToProxyAs The name of the user the super user should proxy as
@param properties {@link java.util.Properties} containing initialization properties.
@param fsURI The {@link URI} for the {@link FileSystem} that should be created.
@param conf The {@link Configuration} for the {@link FileSystem} that should be created.
@return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs
@throws IOException | [
"Creates",
"a",
"{",
"@link",
"FileSystem",
"}",
"that",
"can",
"perform",
"any",
"operations",
"allowed",
"by",
"the",
"specified",
"userNameToProxyAs",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java#L81-L111 |
ziccardi/jnrpe | jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/SshUtils.java | SshUtils.getSession | public static Session getSession(final ICommandLine cl) throws Exception {
JSch jsch = new JSch();
Session session = null;
int timeout = DEFAULT_TIMEOUT;
int port = cl.hasOption("port") ? Integer.parseInt(cl.getOptionValue("port")) : +DEFAULT_PORT;
String hostname = cl.getOptionValue("hostname");
String username = cl.getOptionValue("username");
String password = cl.getOptionValue("password");
String key = cl.getOptionValue("key");
if (cl.hasOption("timeout")) {
try {
timeout = Integer.parseInt(cl.getOptionValue("timeout"));
} catch (NumberFormatException e) {
throw new MetricGatheringException("Invalid numeric value for timeout.", Status.CRITICAL, e);
}
}
session = jsch.getSession(username, hostname, port);
if (key == null) {
session.setConfig("StrictHostKeyChecking", "no");
session.setPassword(password);
} else {
jsch.addIdentity(key);
}
session.connect(timeout * 1000);
return session;
} | java | public static Session getSession(final ICommandLine cl) throws Exception {
JSch jsch = new JSch();
Session session = null;
int timeout = DEFAULT_TIMEOUT;
int port = cl.hasOption("port") ? Integer.parseInt(cl.getOptionValue("port")) : +DEFAULT_PORT;
String hostname = cl.getOptionValue("hostname");
String username = cl.getOptionValue("username");
String password = cl.getOptionValue("password");
String key = cl.getOptionValue("key");
if (cl.hasOption("timeout")) {
try {
timeout = Integer.parseInt(cl.getOptionValue("timeout"));
} catch (NumberFormatException e) {
throw new MetricGatheringException("Invalid numeric value for timeout.", Status.CRITICAL, e);
}
}
session = jsch.getSession(username, hostname, port);
if (key == null) {
session.setConfig("StrictHostKeyChecking", "no");
session.setPassword(password);
} else {
jsch.addIdentity(key);
}
session.connect(timeout * 1000);
return session;
} | [
"public",
"static",
"Session",
"getSession",
"(",
"final",
"ICommandLine",
"cl",
")",
"throws",
"Exception",
"{",
"JSch",
"jsch",
"=",
"new",
"JSch",
"(",
")",
";",
"Session",
"session",
"=",
"null",
";",
"int",
"timeout",
"=",
"DEFAULT_TIMEOUT",
";",
"int... | Starts an ssh session
@param cl the command line object
@return an ssh session
@throws Exception on any error | [
"Starts",
"an",
"ssh",
"session"
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/SshUtils.java#L51-L76 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java | TableSession.cleanBuffer | public void cleanBuffer(BaseBuffer buffer, Record record)
{
Vector<Object> vector = (Vector)buffer.getPhysicalData();
int iCurrentIndex = 0;
buffer.resetPosition(); // Start at the first field
int iFieldCount = record.getFieldCount(); // Number of fields to read in
for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
if (!buffer.skipField(field))
{
if (field.isModified())
vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // If target modified don't move data
//? else if (record.getEditMode() == DBConstants.EDIT_ADD)
// if (field.getDefault() == vector.get(iCurrentIndex))
// vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // On Add if data is the default, don't set.
iCurrentIndex++;
}
}
} | java | public void cleanBuffer(BaseBuffer buffer, Record record)
{
Vector<Object> vector = (Vector)buffer.getPhysicalData();
int iCurrentIndex = 0;
buffer.resetPosition(); // Start at the first field
int iFieldCount = record.getFieldCount(); // Number of fields to read in
for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
if (!buffer.skipField(field))
{
if (field.isModified())
vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // If target modified don't move data
//? else if (record.getEditMode() == DBConstants.EDIT_ADD)
// if (field.getDefault() == vector.get(iCurrentIndex))
// vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // On Add if data is the default, don't set.
iCurrentIndex++;
}
}
} | [
"public",
"void",
"cleanBuffer",
"(",
"BaseBuffer",
"buffer",
",",
"Record",
"record",
")",
"{",
"Vector",
"<",
"Object",
">",
"vector",
"=",
"(",
"Vector",
")",
"buffer",
".",
"getPhysicalData",
"(",
")",
";",
"int",
"iCurrentIndex",
"=",
"0",
";",
"buf... | Clean the buffer of fields that will change a field that has been modified by the client.
@param buffer The Vector buffer to clean.
@param record The target Record. | [
"Clean",
"the",
"buffer",
"of",
"fields",
"that",
"will",
"change",
"a",
"field",
"that",
"has",
"been",
"modified",
"by",
"the",
"client",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L926-L945 |
tvesalainen/util | util/src/main/java/org/vesalainen/ui/AbstractView.java | AbstractView.updatePoint | public void updatePoint(double x, double y)
{
userBounds.add(x, y);
transform.transform(x, y, transformedUserBounds::add);
} | java | public void updatePoint(double x, double y)
{
userBounds.add(x, y);
transform.transform(x, y, transformedUserBounds::add);
} | [
"public",
"void",
"updatePoint",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"userBounds",
".",
"add",
"(",
"x",
",",
"y",
")",
";",
"transform",
".",
"transform",
"(",
"x",
",",
"y",
",",
"transformedUserBounds",
"::",
"add",
")",
";",
"}"
] | Updates the limits if point is not inside visible screen.
@param x
@param y | [
"Updates",
"the",
"limits",
"if",
"point",
"is",
"not",
"inside",
"visible",
"screen",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/AbstractView.java#L99-L103 |
google/error-prone | check_api/src/main/java/com/google/errorprone/util/FindIdentifiers.java | FindIdentifiers.createFindIdentifiersScanner | private static final TreeScanner<Void, Void> createFindIdentifiersScanner(
ImmutableSet.Builder<Symbol> builder, @Nullable Tree stoppingPoint) {
return new TreeScanner<Void, Void>() {
@Override
public Void scan(Tree tree, Void unused) {
return Objects.equals(stoppingPoint, tree) ? null : super.scan(tree, unused);
}
@Override
public Void scan(Iterable<? extends Tree> iterable, Void unused) {
if (stoppingPoint != null && iterable != null) {
ImmutableList.Builder<Tree> builder = ImmutableList.builder();
for (Tree t : iterable) {
if (stoppingPoint.equals(t)) {
break;
}
builder.add(t);
}
iterable = builder.build();
}
return super.scan(iterable, unused);
}
@Override
public Void visitIdentifier(IdentifierTree identifierTree, Void unused) {
Symbol symbol = ASTHelpers.getSymbol(identifierTree);
if (symbol != null) {
builder.add(symbol);
}
return null;
}
};
} | java | private static final TreeScanner<Void, Void> createFindIdentifiersScanner(
ImmutableSet.Builder<Symbol> builder, @Nullable Tree stoppingPoint) {
return new TreeScanner<Void, Void>() {
@Override
public Void scan(Tree tree, Void unused) {
return Objects.equals(stoppingPoint, tree) ? null : super.scan(tree, unused);
}
@Override
public Void scan(Iterable<? extends Tree> iterable, Void unused) {
if (stoppingPoint != null && iterable != null) {
ImmutableList.Builder<Tree> builder = ImmutableList.builder();
for (Tree t : iterable) {
if (stoppingPoint.equals(t)) {
break;
}
builder.add(t);
}
iterable = builder.build();
}
return super.scan(iterable, unused);
}
@Override
public Void visitIdentifier(IdentifierTree identifierTree, Void unused) {
Symbol symbol = ASTHelpers.getSymbol(identifierTree);
if (symbol != null) {
builder.add(symbol);
}
return null;
}
};
} | [
"private",
"static",
"final",
"TreeScanner",
"<",
"Void",
",",
"Void",
">",
"createFindIdentifiersScanner",
"(",
"ImmutableSet",
".",
"Builder",
"<",
"Symbol",
">",
"builder",
",",
"@",
"Nullable",
"Tree",
"stoppingPoint",
")",
"{",
"return",
"new",
"TreeScanner... | Finds all identifiers in a tree. Takes an optional stop point as its argument: the depth-first
walk will stop if this node is encountered. | [
"Finds",
"all",
"identifiers",
"in",
"a",
"tree",
".",
"Takes",
"an",
"optional",
"stop",
"point",
"as",
"its",
"argument",
":",
"the",
"depth",
"-",
"first",
"walk",
"will",
"stop",
"if",
"this",
"node",
"is",
"encountered",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/FindIdentifiers.java#L304-L336 |
caelum/vraptor4 | vraptor-core/src/main/java/br/com/caelum/vraptor/observer/upload/CommonsUploadMultipartObserver.java | CommonsUploadMultipartObserver.reportSizeLimitExceeded | protected void reportSizeLimitExceeded(final SizeLimitExceededException e, Validator validator) {
validator.add(new I18nMessage("upload", "file.limit.exceeded", e.getActualSize(), e.getPermittedSize()));
logger.warn("The file size limit was exceeded. Actual {} permitted {}", e.getActualSize(), e.getPermittedSize());
} | java | protected void reportSizeLimitExceeded(final SizeLimitExceededException e, Validator validator) {
validator.add(new I18nMessage("upload", "file.limit.exceeded", e.getActualSize(), e.getPermittedSize()));
logger.warn("The file size limit was exceeded. Actual {} permitted {}", e.getActualSize(), e.getPermittedSize());
} | [
"protected",
"void",
"reportSizeLimitExceeded",
"(",
"final",
"SizeLimitExceededException",
"e",
",",
"Validator",
"validator",
")",
"{",
"validator",
".",
"add",
"(",
"new",
"I18nMessage",
"(",
"\"upload\"",
",",
"\"file.limit.exceeded\"",
",",
"e",
".",
"getActual... | This method is called when the {@link SizeLimitExceededException} was thrown. | [
"This",
"method",
"is",
"called",
"when",
"the",
"{"
] | train | https://github.com/caelum/vraptor4/blob/593ce9ad60f9d38c360881b2132417c56b8cc093/vraptor-core/src/main/java/br/com/caelum/vraptor/observer/upload/CommonsUploadMultipartObserver.java#L122-L125 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.convertNormToPixel | public static Point2D_F32 convertNormToPixel(CameraModel param , float x , float y , Point2D_F32 pixel ) {
return ImplPerspectiveOps_F32.convertNormToPixel(param, x, y, pixel);
} | java | public static Point2D_F32 convertNormToPixel(CameraModel param , float x , float y , Point2D_F32 pixel ) {
return ImplPerspectiveOps_F32.convertNormToPixel(param, x, y, pixel);
} | [
"public",
"static",
"Point2D_F32",
"convertNormToPixel",
"(",
"CameraModel",
"param",
",",
"float",
"x",
",",
"float",
"y",
",",
"Point2D_F32",
"pixel",
")",
"{",
"return",
"ImplPerspectiveOps_F32",
".",
"convertNormToPixel",
"(",
"param",
",",
"x",
",",
"y",
... | <p>
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
If speed is a concern then {@link PinholeNtoP_F64} should be used instead.
</p>
@param param Intrinsic camera parameters
@param x X-coordinate of normalized.
@param y Y-coordinate of normalized.
@param pixel Optional storage for output. If null a new instance will be declared.
@return pixel image coordinate | [
"<p",
">",
"Convenient",
"function",
"for",
"converting",
"from",
"normalized",
"image",
"coordinates",
"to",
"the",
"original",
"image",
"pixel",
"coordinate",
".",
"If",
"speed",
"is",
"a",
"concern",
"then",
"{",
"@link",
"PinholeNtoP_F64",
"}",
"should",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L393-L395 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.email_domain_new_duration_GET | public OvhOrder email_domain_new_duration_GET(String duration, String domain, OvhOfferEnum offer) throws IOException {
String qPath = "/order/email/domain/new/{duration}";
StringBuilder sb = path(qPath, duration);
query(sb, "domain", domain);
query(sb, "offer", offer);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder email_domain_new_duration_GET(String duration, String domain, OvhOfferEnum offer) throws IOException {
String qPath = "/order/email/domain/new/{duration}";
StringBuilder sb = path(qPath, duration);
query(sb, "domain", domain);
query(sb, "offer", offer);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"email_domain_new_duration_GET",
"(",
"String",
"duration",
",",
"String",
"domain",
",",
"OvhOfferEnum",
"offer",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/email/domain/new/{duration}\"",
";",
"StringBuilder",
"sb",
"=",... | Get prices and contracts information
REST: GET /order/email/domain/new/{duration}
@param domain [required] Domain name which will be linked to this mx account
@param offer [required] Offer for your new mx account
@param duration [required] Duration
@deprecated | [
"Get",
"prices",
"and",
"contracts",
"information"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4107-L4114 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.appendWithSeparators | public StrBuilder appendWithSeparators(final Object[] array, final String separator) {
if (array != null && array.length > 0) {
final String sep = Objects.toString(separator, "");
append(array[0]);
for (int i = 1; i < array.length; i++) {
append(sep);
append(array[i]);
}
}
return this;
} | java | public StrBuilder appendWithSeparators(final Object[] array, final String separator) {
if (array != null && array.length > 0) {
final String sep = Objects.toString(separator, "");
append(array[0]);
for (int i = 1; i < array.length; i++) {
append(sep);
append(array[i]);
}
}
return this;
} | [
"public",
"StrBuilder",
"appendWithSeparators",
"(",
"final",
"Object",
"[",
"]",
"array",
",",
"final",
"String",
"separator",
")",
"{",
"if",
"(",
"array",
"!=",
"null",
"&&",
"array",
".",
"length",
">",
"0",
")",
"{",
"final",
"String",
"sep",
"=",
... | Appends an array placing separators between each value, but
not before the first or after the last.
Appending a null array will have no effect.
Each object is appended using {@link #append(Object)}.
@param array the array to append
@param separator the separator to use, null means no separator
@return this, to enable chaining | [
"Appends",
"an",
"array",
"placing",
"separators",
"between",
"each",
"value",
"but",
"not",
"before",
"the",
"first",
"or",
"after",
"the",
"last",
".",
"Appending",
"a",
"null",
"array",
"will",
"have",
"no",
"effect",
".",
"Each",
"object",
"is",
"appen... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1251-L1261 |
mangstadt/biweekly | src/main/java/biweekly/component/ICalComponent.java | ICalComponent.addExperimentalProperty | public RawProperty addExperimentalProperty(String name, ICalDataType dataType, String value) {
RawProperty raw = new RawProperty(name, dataType, value);
addProperty(raw);
return raw;
} | java | public RawProperty addExperimentalProperty(String name, ICalDataType dataType, String value) {
RawProperty raw = new RawProperty(name, dataType, value);
addProperty(raw);
return raw;
} | [
"public",
"RawProperty",
"addExperimentalProperty",
"(",
"String",
"name",
",",
"ICalDataType",
"dataType",
",",
"String",
"value",
")",
"{",
"RawProperty",
"raw",
"=",
"new",
"RawProperty",
"(",
"name",
",",
"dataType",
",",
"value",
")",
";",
"addProperty",
... | Adds an experimental property to this component.
@param name the property name (e.g. "X-ALT-DESC")
@param dataType the property's data type or null if unknown
@param value the property value
@return the property object that was created | [
"Adds",
"an",
"experimental",
"property",
"to",
"this",
"component",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L241-L245 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java | ServerCommunicationLinksInner.beginCreateOrUpdateAsync | public Observable<ServerCommunicationLinkInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).map(new Func1<ServiceResponse<ServerCommunicationLinkInner>, ServerCommunicationLinkInner>() {
@Override
public ServerCommunicationLinkInner call(ServiceResponse<ServerCommunicationLinkInner> response) {
return response.body();
}
});
} | java | public Observable<ServerCommunicationLinkInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).map(new Func1<ServiceResponse<ServerCommunicationLinkInner>, ServerCommunicationLinkInner>() {
@Override
public ServerCommunicationLinkInner call(ServiceResponse<ServerCommunicationLinkInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerCommunicationLinkInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"communicationLinkName",
",",
"String",
"partnerServer",
")",
"{",
"return",
"beginCreateOrUpdateWit... | Creates a server communication link.
@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 communicationLinkName The name of the server communication link.
@param partnerServer The name of the partner server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerCommunicationLinkInner object | [
"Creates",
"a",
"server",
"communication",
"link",
"."
] | 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/ServerCommunicationLinksInner.java#L391-L398 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_http_farm_farmId_server_serverId_PUT | public void serviceName_http_farm_farmId_server_serverId_PUT(String serviceName, Long farmId, Long serverId, OvhBackendHTTPServer body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}/server/{serverId}";
StringBuilder sb = path(qPath, serviceName, farmId, serverId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_http_farm_farmId_server_serverId_PUT(String serviceName, Long farmId, Long serverId, OvhBackendHTTPServer body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}/server/{serverId}";
StringBuilder sb = path(qPath, serviceName, farmId, serverId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_http_farm_farmId_server_serverId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"farmId",
",",
"Long",
"serverId",
",",
"OvhBackendHTTPServer",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{service... | Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/http/farm/{farmId}/server/{serverId}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param farmId [required] Id of your farm
@param serverId [required] Id of your server | [
"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#L422-L426 |
TheHolyWaffle/League-of-Legends-XMPP-Chat-Library | src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java | LolChat.getFriendGroups | public List<FriendGroup> getFriendGroups() {
final ArrayList<FriendGroup> groups = new ArrayList<>();
for (final RosterGroup g : connection.getRoster().getGroups()) {
groups.add(new FriendGroup(this, connection, g));
}
return groups;
} | java | public List<FriendGroup> getFriendGroups() {
final ArrayList<FriendGroup> groups = new ArrayList<>();
for (final RosterGroup g : connection.getRoster().getGroups()) {
groups.add(new FriendGroup(this, connection, g));
}
return groups;
} | [
"public",
"List",
"<",
"FriendGroup",
">",
"getFriendGroups",
"(",
")",
"{",
"final",
"ArrayList",
"<",
"FriendGroup",
">",
"groups",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"RosterGroup",
"g",
":",
"connection",
".",
"getRoster"... | Get a list of all your FriendGroups.
@return A List of all your FriendGroups | [
"Get",
"a",
"list",
"of",
"all",
"your",
"FriendGroups",
"."
] | train | https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/blob/5e4d87d0c054ff2f6510545b0e9f838338695c70/src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java#L506-L512 |
dihedron/dihedron-commons | src/main/java/org/dihedron/core/zip/ZipArchive.java | ZipArchive.addFile | public void addFile(String zipEntry, byte[] data) throws IOException {
stream.putNextEntry(new ZipEntry(zipEntry));
stream.write(data);
} | java | public void addFile(String zipEntry, byte[] data) throws IOException {
stream.putNextEntry(new ZipEntry(zipEntry));
stream.write(data);
} | [
"public",
"void",
"addFile",
"(",
"String",
"zipEntry",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"IOException",
"{",
"stream",
".",
"putNextEntry",
"(",
"new",
"ZipEntry",
"(",
"zipEntry",
")",
")",
";",
"stream",
".",
"write",
"(",
"data",
")",
"... | Adds a file to the ZIP archive, given its content as an array of bytes.
@param zipEntry
name of the entry in the archive.
@param data
data bytes to be stored as file contents in the archive. | [
"Adds",
"a",
"file",
"to",
"the",
"ZIP",
"archive",
"given",
"its",
"content",
"as",
"an",
"array",
"of",
"bytes",
"."
] | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/zip/ZipArchive.java#L119-L122 |
pmlopes/yoke | framework/src/main/java/com/jetdrone/vertx/yoke/middleware/YokeRequest.java | YokeRequest.getFormAttribute | public String getFormAttribute(@NotNull final String name, String defaultValue) {
String value = request.formAttributes().get(name);
if (value == null) {
return defaultValue;
}
return value;
} | java | public String getFormAttribute(@NotNull final String name, String defaultValue) {
String value = request.formAttributes().get(name);
if (value == null) {
return defaultValue;
}
return value;
} | [
"public",
"String",
"getFormAttribute",
"(",
"@",
"NotNull",
"final",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"request",
".",
"formAttributes",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"value",
"=... | Allow getting form parameters in a generified way and return defaultValue if the key does not exist.
@param name The key to get
@param defaultValue value returned when the key does not exist
@return {String} The found object | [
"Allow",
"getting",
"form",
"parameters",
"in",
"a",
"generified",
"way",
"and",
"return",
"defaultValue",
"if",
"the",
"key",
"does",
"not",
"exist",
"."
] | train | https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/middleware/YokeRequest.java#L647-L655 |
beangle/beangle3 | commons/model/src/main/java/org/beangle/commons/entity/metadata/impl/DefaultModelMeta.java | DefaultModelMeta.newInstance | public <T extends Entity<ID>, ID extends Serializable> T newInstance(final Class<T> clazz, final ID id) {
EntityType type = getEntityType(clazz);
@SuppressWarnings("unchecked")
T entity = (T) type.newInstance();
try {
PropertyUtils.setProperty(entity, type.getIdName(), id);
} catch (Exception e) {
logger.error("initialize {} with id {} error", clazz, id);
}
return entity;
} | java | public <T extends Entity<ID>, ID extends Serializable> T newInstance(final Class<T> clazz, final ID id) {
EntityType type = getEntityType(clazz);
@SuppressWarnings("unchecked")
T entity = (T) type.newInstance();
try {
PropertyUtils.setProperty(entity, type.getIdName(), id);
} catch (Exception e) {
logger.error("initialize {} with id {} error", clazz, id);
}
return entity;
} | [
"public",
"<",
"T",
"extends",
"Entity",
"<",
"ID",
">",
",",
"ID",
"extends",
"Serializable",
">",
"T",
"newInstance",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"ID",
"id",
")",
"{",
"EntityType",
"type",
"=",
"getEntityType",
"(",
... | <p>
newInstance.
</p>
@param clazz a {@link java.lang.Class} object.
@param id a {@link java.io.Serializable} object.
@param <T> a T object.
@return a T object. | [
"<p",
">",
"newInstance",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/entity/metadata/impl/DefaultModelMeta.java#L70-L80 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java | FastDateFormat.parseObject | public Object parseObject(String source, ParsePosition pos) {
pos.setIndex(0);
pos.setErrorIndex(0);
return null;
} | java | public Object parseObject(String source, ParsePosition pos) {
pos.setIndex(0);
pos.setErrorIndex(0);
return null;
} | [
"public",
"Object",
"parseObject",
"(",
"String",
"source",
",",
"ParsePosition",
"pos",
")",
"{",
"pos",
".",
"setIndex",
"(",
"0",
")",
";",
"pos",
".",
"setErrorIndex",
"(",
"0",
")",
";",
"return",
"null",
";",
"}"
] | <p>Parsing is not supported.</p>
@param source the string to parse
@param pos the parsing position
@return <code>null</code> as not supported | [
"<p",
">",
"Parsing",
"is",
"not",
"supported",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java#L905-L909 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java | InMemoryMetricEmitter.cleanUsingTime | private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
if (this.historyListMapping.containsKey(metricName)
&& this.historyListMapping.get(metricName) != null) {
synchronized (this.historyListMapping.get(metricName)) {
InMemoryHistoryNode firstNode = this.historyListMapping.get(metricName).peekFirst();
long localCopyOfTimeWindow = 0;
// go ahead for clean up using latest possible value of interval
// any interval change will not affect on going clean up
synchronized (this) {
localCopyOfTimeWindow = this.timeWindow;
}
// removing objects older than Interval time from firstAllowedDate
while (firstNode != null
&& TimeUnit.MILLISECONDS
.toMillis(firstAllowedDate.getTime() - firstNode.getTimestamp().getTime())
> localCopyOfTimeWindow) {
this.historyListMapping.get(metricName).removeFirst();
firstNode = this.historyListMapping.get(metricName).peekFirst();
}
}
}
} | java | private void cleanUsingTime(final String metricName, final Date firstAllowedDate) {
if (this.historyListMapping.containsKey(metricName)
&& this.historyListMapping.get(metricName) != null) {
synchronized (this.historyListMapping.get(metricName)) {
InMemoryHistoryNode firstNode = this.historyListMapping.get(metricName).peekFirst();
long localCopyOfTimeWindow = 0;
// go ahead for clean up using latest possible value of interval
// any interval change will not affect on going clean up
synchronized (this) {
localCopyOfTimeWindow = this.timeWindow;
}
// removing objects older than Interval time from firstAllowedDate
while (firstNode != null
&& TimeUnit.MILLISECONDS
.toMillis(firstAllowedDate.getTime() - firstNode.getTimestamp().getTime())
> localCopyOfTimeWindow) {
this.historyListMapping.get(metricName).removeFirst();
firstNode = this.historyListMapping.get(metricName).peekFirst();
}
}
}
} | [
"private",
"void",
"cleanUsingTime",
"(",
"final",
"String",
"metricName",
",",
"final",
"Date",
"firstAllowedDate",
")",
"{",
"if",
"(",
"this",
".",
"historyListMapping",
".",
"containsKey",
"(",
"metricName",
")",
"&&",
"this",
".",
"historyListMapping",
".",... | Remove snapshots to maintain reporting interval
@param metricName Name of the metric
@param firstAllowedDate End date of the interval | [
"Remove",
"snapshots",
"to",
"maintain",
"reporting",
"interval"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/metric/inmemoryemitter/InMemoryMetricEmitter.java#L207-L231 |
threerings/nenya | core/src/main/java/com/threerings/resource/ResourceManager.java | ResourceManager.loadImage | public static BufferedImage loadImage (InputStream iis, boolean useFastIO)
throws IOException
{
if (iis == null) {
return null;
} else if (useFastIO) {
return FastImageIO.read(iis);
}
return ImageIO.read(iis);
} | java | public static BufferedImage loadImage (InputStream iis, boolean useFastIO)
throws IOException
{
if (iis == null) {
return null;
} else if (useFastIO) {
return FastImageIO.read(iis);
}
return ImageIO.read(iis);
} | [
"public",
"static",
"BufferedImage",
"loadImage",
"(",
"InputStream",
"iis",
",",
"boolean",
"useFastIO",
")",
"throws",
"IOException",
"{",
"if",
"(",
"iis",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"useFastIO",
")",
"{",
"... | Loads an image from the given input stream. Supports formats supported by {@link ImageIO}
as well as {@link FastImageIO} based on the useFastIO param. | [
"Loads",
"an",
"image",
"from",
"the",
"given",
"input",
"stream",
".",
"Supports",
"formats",
"supported",
"by",
"{"
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L895-L904 |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java | MonitorFileWriterImpl.fillServiceMetadata | private void fillServiceMetadata(final String serviceName, final int index) {
final int servAreaOffset = noOfServicesOffset + BitUtil.SIZE_OF_INT;
metaDataBuffer.putInt(noOfServicesOffset, metaDataBuffer.getInt(noOfServicesOffset) + 1);
int serviceNameOffset = getServiceNameOffset(servAreaOffset);
int serviceLocationOffset = serviceNameOffset + serviceName.length() + BitUtil.SIZE_OF_INT;
metaDataBuffer.putStringUtf8(serviceNameOffset, serviceName, ByteOrder.nativeOrder());
initializeServiceRefMetadata(serviceLocationOffset, index * OFFSETS_PER_SERVICE);
prevServiceOffset = serviceNameOffset;
prevServiceName = serviceName;
} | java | private void fillServiceMetadata(final String serviceName, final int index) {
final int servAreaOffset = noOfServicesOffset + BitUtil.SIZE_OF_INT;
metaDataBuffer.putInt(noOfServicesOffset, metaDataBuffer.getInt(noOfServicesOffset) + 1);
int serviceNameOffset = getServiceNameOffset(servAreaOffset);
int serviceLocationOffset = serviceNameOffset + serviceName.length() + BitUtil.SIZE_OF_INT;
metaDataBuffer.putStringUtf8(serviceNameOffset, serviceName, ByteOrder.nativeOrder());
initializeServiceRefMetadata(serviceLocationOffset, index * OFFSETS_PER_SERVICE);
prevServiceOffset = serviceNameOffset;
prevServiceName = serviceName;
} | [
"private",
"void",
"fillServiceMetadata",
"(",
"final",
"String",
"serviceName",
",",
"final",
"int",
"index",
")",
"{",
"final",
"int",
"servAreaOffset",
"=",
"noOfServicesOffset",
"+",
"BitUtil",
".",
"SIZE_OF_INT",
";",
"metaDataBuffer",
".",
"putInt",
"(",
"... | Method adding services metadata
@param monitorMetaDataBuffer - the metadata buffer | [
"Method",
"adding",
"services",
"metadata"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L210-L220 |
phax/ph-commons | ph-json/src/main/java/com/helger/json/serialize/JsonReader.java | JsonReader.isValidJson | public static boolean isValidJson (@Nonnull final Path aPath, @Nonnull final Charset aFallbackCharset)
{
return isValidJson (new FileSystemResource (aPath), aFallbackCharset);
} | java | public static boolean isValidJson (@Nonnull final Path aPath, @Nonnull final Charset aFallbackCharset)
{
return isValidJson (new FileSystemResource (aPath), aFallbackCharset);
} | [
"public",
"static",
"boolean",
"isValidJson",
"(",
"@",
"Nonnull",
"final",
"Path",
"aPath",
",",
"@",
"Nonnull",
"final",
"Charset",
"aFallbackCharset",
")",
"{",
"return",
"isValidJson",
"(",
"new",
"FileSystemResource",
"(",
"aPath",
")",
",",
"aFallbackChars... | Check if the passed Path can be resembled to valid Json content. This is
accomplished by fully parsing the Json file each time the method is called.
This consumes <b>less memory</b> than calling any of the
<code>read...</code> methods and checking for a non-<code>null</code>
result.
@param aPath
The file to be parsed. May not be <code>null</code>.
@param aFallbackCharset
The charset to be used for reading the Json file in case no BOM is
present. May not be <code>null</code>.
@return <code>true</code> if the file can be parsed without error,
<code>false</code> if not | [
"Check",
"if",
"the",
"passed",
"Path",
"can",
"be",
"resembled",
"to",
"valid",
"Json",
"content",
".",
"This",
"is",
"accomplished",
"by",
"fully",
"parsing",
"the",
"Json",
"file",
"each",
"time",
"the",
"method",
"is",
"called",
".",
"This",
"consumes"... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/serialize/JsonReader.java#L258-L261 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointClassesAxiomImpl_CustomFieldSerializer.java | OWLDisjointClassesAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDisjointClassesAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLDisjointClassesAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLDisjointClassesAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointClassesAxiomImpl_CustomFieldSerializer.java#L74-L77 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java | RouteFiltersInner.beginUpdate | public RouteFilterInner beginUpdate(String resourceGroupName, String routeFilterName, PatchRouteFilter routeFilterParameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).toBlocking().single().body();
} | java | public RouteFilterInner beginUpdate(String resourceGroupName, String routeFilterName, PatchRouteFilter routeFilterParameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).toBlocking().single().body();
} | [
"public",
"RouteFilterInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeFilterName",
",",
"PatchRouteFilter",
"routeFilterParameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeFilterName",
",... | Updates a route filter in a specified resource group.
@param resourceGroupName The name of the resource group.
@param routeFilterName The name of the route filter.
@param routeFilterParameters Parameters supplied to the update route filter operation.
@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 RouteFilterInner object if successful. | [
"Updates",
"a",
"route",
"filter",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java#L686-L688 |
geomajas/geomajas-project-server | plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java | PdfContext.moveRectangleTo | public void moveRectangleTo(Rectangle rect, float x, float y) {
float width = rect.getWidth();
float height = rect.getHeight();
rect.setLeft(x);
rect.setBottom(y);
rect.setRight(rect.getLeft() + width);
rect.setTop(rect.getBottom() + height);
} | java | public void moveRectangleTo(Rectangle rect, float x, float y) {
float width = rect.getWidth();
float height = rect.getHeight();
rect.setLeft(x);
rect.setBottom(y);
rect.setRight(rect.getLeft() + width);
rect.setTop(rect.getBottom() + height);
} | [
"public",
"void",
"moveRectangleTo",
"(",
"Rectangle",
"rect",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"float",
"width",
"=",
"rect",
".",
"getWidth",
"(",
")",
";",
"float",
"height",
"=",
"rect",
".",
"getHeight",
"(",
")",
";",
"rect",
"."... | Move this rectangle to the specified bottom-left point.
@param rect rectangle to move
@param x new x origin
@param y new y origin | [
"Move",
"this",
"rectangle",
"to",
"the",
"specified",
"bottom",
"-",
"left",
"point",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java#L302-L309 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.