repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
reactor/reactor-netty | src/main/java/reactor/netty/channel/BootstrapHandlers.java | BootstrapHandlers.channelOperationFactory | @SuppressWarnings("unchecked")
public static ChannelOperations.OnSetup channelOperationFactory(AbstractBootstrap<?, ?> b) {
Objects.requireNonNull(b, "bootstrap");
ChannelOperations.OnSetup ops =
(ChannelOperations.OnSetup) b.config()
.options()
.get(OPS_OPTION);
b.option(OPS_OPTION, null);
if (ops == null) {
return ChannelOperations.OnSetup.empty(); //will not be triggered in
}
return ops;
} | java | @SuppressWarnings("unchecked")
public static ChannelOperations.OnSetup channelOperationFactory(AbstractBootstrap<?, ?> b) {
Objects.requireNonNull(b, "bootstrap");
ChannelOperations.OnSetup ops =
(ChannelOperations.OnSetup) b.config()
.options()
.get(OPS_OPTION);
b.option(OPS_OPTION, null);
if (ops == null) {
return ChannelOperations.OnSetup.empty(); //will not be triggered in
}
return ops;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"ChannelOperations",
".",
"OnSetup",
"channelOperationFactory",
"(",
"AbstractBootstrap",
"<",
"?",
",",
"?",
">",
"b",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"b",
",",
"\"bootstra... | Obtain and remove the current {@link ChannelOperations.OnSetup} from the bootstrap.
@param b the bootstrap to scan
@return current {@link ChannelOperations.OnSetup} factory or null | [
"Obtain",
"and",
"remove",
"the",
"current",
"{",
"@link",
"ChannelOperations",
".",
"OnSetup",
"}",
"from",
"the",
"bootstrap",
"."
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/channel/BootstrapHandlers.java#L212-L224 |
icode/ameba | src/main/java/ameba/lib/Fibers.java | Fibers.runInFiberRuntime | public static void runInFiberRuntime(FiberScheduler scheduler, SuspendableRunnable target) throws InterruptedException {
FiberUtil.runInFiberRuntime(scheduler, target);
} | java | public static void runInFiberRuntime(FiberScheduler scheduler, SuspendableRunnable target) throws InterruptedException {
FiberUtil.runInFiberRuntime(scheduler, target);
} | [
"public",
"static",
"void",
"runInFiberRuntime",
"(",
"FiberScheduler",
"scheduler",
",",
"SuspendableRunnable",
"target",
")",
"throws",
"InterruptedException",
"{",
"FiberUtil",
".",
"runInFiberRuntime",
"(",
"scheduler",
",",
"target",
")",
";",
"}"
] | Runs an action in a new fiber and awaits the fiber's termination.
Unlike {@link #runInFiber(FiberScheduler, SuspendableRunnable) runInFiber} this method does not throw {@link ExecutionException}, but wraps
any checked exception thrown by the operation in a {@link RuntimeException}.
@param scheduler the {@link FiberScheduler} to use when scheduling the fiber.
@param target the operation
@throws InterruptedException | [
"Runs",
"an",
"action",
"in",
"a",
"new",
"fiber",
"and",
"awaits",
"the",
"fiber",
"s",
"termination",
".",
"Unlike",
"{",
"@link",
"#runInFiber",
"(",
"FiberScheduler",
"SuspendableRunnable",
")",
"runInFiber",
"}",
"this",
"method",
"does",
"not",
"throw",
... | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/lib/Fibers.java#L343-L345 |
dmfs/http-client-interfaces | src/org/dmfs/httpclientinterfaces/HttpStatus.java | HttpStatus.fromStatusLine | public static HttpStatus fromStatusLine(final String statusLine) throws IllegalArgumentException
{
/*
* According to RFC 7230, a valid HTTP status line always looks like
*
* HTTP-Version SP Status-Code SP Reason-Phrase CRLF
*
* This method method scans for the two spaces and tries to convert the string in between to a number.
*/
// the status code starts one character after the first space
final int start = statusLine.indexOf(' ') + 1;
if (start > 0)
{
final int end = statusLine.indexOf(' ', start);
if (end > 0)
{
try
{
final int status = Integer.parseInt(statusLine.substring(start, end));
// valid status codes are between 100 and 999
if (status < 100 || status > 999)
{
throw new IllegalArgumentException("Illegal status code " + status);
}
if (STATUS_CODES.containsKey(status))
{
return fromStatusCode(status);
}
return new HttpStatus(status, end < statusLine.length() ? statusLine.substring(end + 1) : "Unknown" /* this would be invalid actually */);
}
catch (NumberFormatException e)
{
throw new IllegalArgumentException("could not parse status code", e);
}
}
}
throw new IllegalArgumentException("Malformed status line: " + statusLine);
} | java | public static HttpStatus fromStatusLine(final String statusLine) throws IllegalArgumentException
{
/*
* According to RFC 7230, a valid HTTP status line always looks like
*
* HTTP-Version SP Status-Code SP Reason-Phrase CRLF
*
* This method method scans for the two spaces and tries to convert the string in between to a number.
*/
// the status code starts one character after the first space
final int start = statusLine.indexOf(' ') + 1;
if (start > 0)
{
final int end = statusLine.indexOf(' ', start);
if (end > 0)
{
try
{
final int status = Integer.parseInt(statusLine.substring(start, end));
// valid status codes are between 100 and 999
if (status < 100 || status > 999)
{
throw new IllegalArgumentException("Illegal status code " + status);
}
if (STATUS_CODES.containsKey(status))
{
return fromStatusCode(status);
}
return new HttpStatus(status, end < statusLine.length() ? statusLine.substring(end + 1) : "Unknown" /* this would be invalid actually */);
}
catch (NumberFormatException e)
{
throw new IllegalArgumentException("could not parse status code", e);
}
}
}
throw new IllegalArgumentException("Malformed status line: " + statusLine);
} | [
"public",
"static",
"HttpStatus",
"fromStatusLine",
"(",
"final",
"String",
"statusLine",
")",
"throws",
"IllegalArgumentException",
"{",
"/*\n\t\t * According to RFC 7230, a valid HTTP status line always looks like\n\t\t * \n\t\t * HTTP-Version SP Status-Code SP Reason-Phrase CRLF\n\t\t * \... | Parse an HTTP status line for the status code. The status line must comply to <a href="https://tools.ietf.org/html/rfc7230#section-3.1.2">RFC 7230
section 3.1.2</a>.
<p />
This method is rather tolerant. It doesn't actually verify the HTTP version nor the reason phrase.
@param statusLine
A {@link String} containing an HTTP status line.
@return The {@link HttpStatus} object.
@throws IllegalArgumentException
if the given status line doesn't contain a known status code or the status code is invalid. | [
"Parse",
"an",
"HTTP",
"status",
"line",
"for",
"the",
"status",
"code",
".",
"The",
"status",
"line",
"must",
"comply",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"rfc7230#section",
"-",
"3",
"."... | train | https://github.com/dmfs/http-client-interfaces/blob/10896c71270ccaf32ac4ed5d706dfa0001fd3862/src/org/dmfs/httpclientinterfaces/HttpStatus.java#L352-L395 |
sarxos/webcam-capture | webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java | WebcamUtils.loadRB | public static final ResourceBundle loadRB(Class<?> clazz, Locale locale) {
String pkg = WebcamUtils.class.getPackage().getName().replaceAll("\\.", "/");
return PropertyResourceBundle.getBundle(String.format("%s/i18n/%s", pkg, clazz.getSimpleName()));
} | java | public static final ResourceBundle loadRB(Class<?> clazz, Locale locale) {
String pkg = WebcamUtils.class.getPackage().getName().replaceAll("\\.", "/");
return PropertyResourceBundle.getBundle(String.format("%s/i18n/%s", pkg, clazz.getSimpleName()));
} | [
"public",
"static",
"final",
"ResourceBundle",
"loadRB",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Locale",
"locale",
")",
"{",
"String",
"pkg",
"=",
"WebcamUtils",
".",
"class",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
".",
"replaceAll",... | Get resource bundle for specific class.
@param clazz the class for which resource bundle should be found
@param locale the {@link Locale} object
@return Resource bundle | [
"Get",
"resource",
"bundle",
"for",
"specific",
"class",
"."
] | train | https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/WebcamUtils.java#L76-L79 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java | DirectoryHelper.copyDirectory | public static void copyDirectory(File srcPath, File dstPath) throws IOException
{
if (srcPath.isDirectory())
{
if (!dstPath.exists())
{
dstPath.mkdirs();
}
String files[] = srcPath.list();
for (int i = 0; i < files.length; i++)
{
copyDirectory(new File(srcPath, files[i]), new File(dstPath, files[i]));
}
}
else
{
InputStream in = null;
OutputStream out = null;
try
{
in = new FileInputStream(srcPath);
out = new FileOutputStream(dstPath);
transfer(in, out);
}
finally
{
if (in != null)
{
in.close();
}
if (out != null)
{
out.flush();
out.close();
}
}
}
} | java | public static void copyDirectory(File srcPath, File dstPath) throws IOException
{
if (srcPath.isDirectory())
{
if (!dstPath.exists())
{
dstPath.mkdirs();
}
String files[] = srcPath.list();
for (int i = 0; i < files.length; i++)
{
copyDirectory(new File(srcPath, files[i]), new File(dstPath, files[i]));
}
}
else
{
InputStream in = null;
OutputStream out = null;
try
{
in = new FileInputStream(srcPath);
out = new FileOutputStream(dstPath);
transfer(in, out);
}
finally
{
if (in != null)
{
in.close();
}
if (out != null)
{
out.flush();
out.close();
}
}
}
} | [
"public",
"static",
"void",
"copyDirectory",
"(",
"File",
"srcPath",
",",
"File",
"dstPath",
")",
"throws",
"IOException",
"{",
"if",
"(",
"srcPath",
".",
"isDirectory",
"(",
")",
")",
"{",
"if",
"(",
"!",
"dstPath",
".",
"exists",
"(",
")",
")",
"{",
... | Copy directory.
@param srcPath
source path
@param dstPath
destination path
@throws IOException
if any exception occurred | [
"Copy",
"directory",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java#L96-L137 |
selenide/selenide | src/main/java/com/codeborne/selenide/ElementsCollection.java | ElementsCollection.elementsToString | public static String elementsToString(Driver driver, Collection<WebElement> elements) {
if (elements == null) {
return "[not loaded yet...]";
}
if (elements.isEmpty()) {
return "[]";
}
StringBuilder sb = new StringBuilder(256);
sb.append("[\n\t");
for (WebElement element : elements) {
if (sb.length() > 4) {
sb.append(",\n\t");
}
sb.append(Describe.describe(driver, element));
}
sb.append("\n]");
return sb.toString();
} | java | public static String elementsToString(Driver driver, Collection<WebElement> elements) {
if (elements == null) {
return "[not loaded yet...]";
}
if (elements.isEmpty()) {
return "[]";
}
StringBuilder sb = new StringBuilder(256);
sb.append("[\n\t");
for (WebElement element : elements) {
if (sb.length() > 4) {
sb.append(",\n\t");
}
sb.append(Describe.describe(driver, element));
}
sb.append("\n]");
return sb.toString();
} | [
"public",
"static",
"String",
"elementsToString",
"(",
"Driver",
"driver",
",",
"Collection",
"<",
"WebElement",
">",
"elements",
")",
"{",
"if",
"(",
"elements",
"==",
"null",
")",
"{",
"return",
"\"[not loaded yet...]\"",
";",
"}",
"if",
"(",
"elements",
"... | Outputs string presentation of the element's collection
@param elements
@return String | [
"Outputs",
"string",
"presentation",
"of",
"the",
"element",
"s",
"collection"
] | train | https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/ElementsCollection.java#L269-L288 |
GCRC/nunaliit | nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/StreamUtils.java | StreamUtils.copyStream | static public void copyStream(Reader reader, Writer writer) throws IOException {
copyStream(reader, writer, DEFAULT_TRANSFER_BUFFER_SIZE);
} | java | static public void copyStream(Reader reader, Writer writer) throws IOException {
copyStream(reader, writer, DEFAULT_TRANSFER_BUFFER_SIZE);
} | [
"static",
"public",
"void",
"copyStream",
"(",
"Reader",
"reader",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"copyStream",
"(",
"reader",
",",
"writer",
",",
"DEFAULT_TRANSFER_BUFFER_SIZE",
")",
";",
"}"
] | Copy all the characters from a reader to a writer.
@param reader Input character stream
@param writer Output character stream
@throws IOException | [
"Copy",
"all",
"the",
"characters",
"from",
"a",
"reader",
"to",
"a",
"writer",
"."
] | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/StreamUtils.java#L52-L54 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/ClassGenericsUtil.java | ClassGenericsUtil.tryInstantiate | public static <C> C tryInstantiate(Class<C> r, Class<?> c, Parameterization config) throws ClassInstantiationException {
if(c == null) {
throw new ClassInstantiationException("Trying to instantiate 'null' class!");
}
try {
// Try a V3 parameterization class
Parameterizer par = getParameterizer(c);
if(par instanceof AbstractParameterizer) {
return r.cast(((AbstractParameterizer) par).make(config));
}
// Try a default constructor.
return r.cast(c.getConstructor().newInstance());
}
catch(InstantiationException | InvocationTargetException
| IllegalAccessException | NoSuchMethodException e) {
throw new ClassInstantiationException(e);
}
} | java | public static <C> C tryInstantiate(Class<C> r, Class<?> c, Parameterization config) throws ClassInstantiationException {
if(c == null) {
throw new ClassInstantiationException("Trying to instantiate 'null' class!");
}
try {
// Try a V3 parameterization class
Parameterizer par = getParameterizer(c);
if(par instanceof AbstractParameterizer) {
return r.cast(((AbstractParameterizer) par).make(config));
}
// Try a default constructor.
return r.cast(c.getConstructor().newInstance());
}
catch(InstantiationException | InvocationTargetException
| IllegalAccessException | NoSuchMethodException e) {
throw new ClassInstantiationException(e);
}
} | [
"public",
"static",
"<",
"C",
">",
"C",
"tryInstantiate",
"(",
"Class",
"<",
"C",
">",
"r",
",",
"Class",
"<",
"?",
">",
"c",
",",
"Parameterization",
"config",
")",
"throws",
"ClassInstantiationException",
"{",
"if",
"(",
"c",
"==",
"null",
")",
"{",
... | Instantiate a parameterizable class. When using this, consider using
{@link Parameterization#descend}!
@param <C> base type
@param r Base (restriction) class
@param c Class to instantiate
@param config Configuration to use for instantiation.
@return Instance
@throws ClassInstantiationException When a class cannot be instantiated. | [
"Instantiate",
"a",
"parameterizable",
"class",
".",
"When",
"using",
"this",
"consider",
"using",
"{",
"@link",
"Parameterization#descend",
"}",
"!"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/ClassGenericsUtil.java#L170-L187 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/ReadOnlyRecordHandler.java | ReadOnlyRecordHandler.init | public void init(Record record, BaseField field, boolean bNewOnChange)
{
super.init(record);
m_field = field;
m_bNewOnChange = bNewOnChange;
} | java | public void init(Record record, BaseField field, boolean bNewOnChange)
{
super.init(record);
m_field = field;
m_bNewOnChange = bNewOnChange;
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"BaseField",
"field",
",",
"boolean",
"bNewOnChange",
")",
"{",
"super",
".",
"init",
"(",
"record",
")",
";",
"m_field",
"=",
"field",
";",
"m_bNewOnChange",
"=",
"bNewOnChange",
";",
"}"
] | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param iMainFilesField The sequence of the date changed field in this record.
@param field The date changed field in this record.
@param bNewOnChange If true, create a new record on change. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/ReadOnlyRecordHandler.java#L76-L81 |
ludovicianul/selenium-on-steroids | src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java | WebDriverHelper.waitForTextPresentWithinPage | public void waitForTextPresentWithinPage(final String text,
final int maximumSeconds) {
WebDriverWait wait = new WebDriverWait(driver, maximumSeconds);
wait.until(ExpectedConditions.textToBePresentInElement(
By.tagName("body"), text));
} | java | public void waitForTextPresentWithinPage(final String text,
final int maximumSeconds) {
WebDriverWait wait = new WebDriverWait(driver, maximumSeconds);
wait.until(ExpectedConditions.textToBePresentInElement(
By.tagName("body"), text));
} | [
"public",
"void",
"waitForTextPresentWithinPage",
"(",
"final",
"String",
"text",
",",
"final",
"int",
"maximumSeconds",
")",
"{",
"WebDriverWait",
"wait",
"=",
"new",
"WebDriverWait",
"(",
"driver",
",",
"maximumSeconds",
")",
";",
"wait",
".",
"until",
"(",
... | Waits until a text will be displayed within the page.
@param text
text to wait for
@param maximumSeconds
maximum number of seconds to wait for the text to be present | [
"Waits",
"until",
"a",
"text",
"will",
"be",
"displayed",
"within",
"the",
"page",
"."
] | train | https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L483-L488 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMessageBoxRenderer.java | WMessageBoxRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WMessageBox messageBox = (WMessageBox) component;
XmlStringBuilder xml = renderContext.getWriter();
if (messageBox.hasMessages()) {
xml.appendTagOpen("ui:messagebox");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (messageBox.getType()) {
case SUCCESS:
xml.appendOptionalAttribute("type", "success");
break;
case INFO:
xml.appendOptionalAttribute("type", "info");
break;
case WARN:
xml.appendOptionalAttribute("type", "warn");
break;
case ERROR:
default:
xml.appendOptionalAttribute("type", "error");
break;
}
xml.appendOptionalAttribute("title", messageBox.getTitleText());
xml.appendClose();
for (String message : messageBox.getMessages()) {
xml.appendTag("ui:message");
xml.print(message);
xml.appendEndTag("ui:message");
}
xml.appendEndTag("ui:messagebox");
}
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WMessageBox messageBox = (WMessageBox) component;
XmlStringBuilder xml = renderContext.getWriter();
if (messageBox.hasMessages()) {
xml.appendTagOpen("ui:messagebox");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
switch (messageBox.getType()) {
case SUCCESS:
xml.appendOptionalAttribute("type", "success");
break;
case INFO:
xml.appendOptionalAttribute("type", "info");
break;
case WARN:
xml.appendOptionalAttribute("type", "warn");
break;
case ERROR:
default:
xml.appendOptionalAttribute("type", "error");
break;
}
xml.appendOptionalAttribute("title", messageBox.getTitleText());
xml.appendClose();
for (String message : messageBox.getMessages()) {
xml.appendTag("ui:message");
xml.print(message);
xml.appendEndTag("ui:message");
}
xml.appendEndTag("ui:messagebox");
}
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WMessageBox",
"messageBox",
"=",
"(",
"WMessageBox",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"re... | Paints the given WMessageBox.
@param component the WMessageBox to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WMessageBox",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMessageBoxRenderer.java#L24-L66 |
smurn/jPLY | jply/src/main/java/org/smurn/jply/Element.java | Element.setIntList | public void setIntList(final String propertyName, final int[] values) {
if (propertyName == null) {
throw new NullPointerException("propertyName must not be null.");
}
Integer index = propertyMap.get(propertyName);
if (index == null) {
throw new IllegalArgumentException("non existent property: '"
+ propertyName + "'.");
}
if (type.getProperties().get(index) instanceof ListProperty) {
this.data[index] = new double[values.length];
for (int i = 0; i < values.length; i++) {
this.data[index][i] = values[i];
}
} else {
if (values.length != 0) {
throw new IndexOutOfBoundsException("property is not a list");
}
this.data[index][0] = values[0];
}
} | java | public void setIntList(final String propertyName, final int[] values) {
if (propertyName == null) {
throw new NullPointerException("propertyName must not be null.");
}
Integer index = propertyMap.get(propertyName);
if (index == null) {
throw new IllegalArgumentException("non existent property: '"
+ propertyName + "'.");
}
if (type.getProperties().get(index) instanceof ListProperty) {
this.data[index] = new double[values.length];
for (int i = 0; i < values.length; i++) {
this.data[index][i] = values[i];
}
} else {
if (values.length != 0) {
throw new IndexOutOfBoundsException("property is not a list");
}
this.data[index][0] = values[0];
}
} | [
"public",
"void",
"setIntList",
"(",
"final",
"String",
"propertyName",
",",
"final",
"int",
"[",
"]",
"values",
")",
"{",
"if",
"(",
"propertyName",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"propertyName must not be null.\"",
")",
... | Sets the value of a property-list.
If the property is not a list, the first element is used.
@param propertyName Name of the property to set.
@param values Values to set for that property.
@throws NullPointerException if {@code propertyName} is {@code null}.
@throws IllegalArgumentException if the element type does not have
a property with the given name.
@throws IndexOutOfBoundsException if the property is not a list property
and the given array does not have exactly one element. | [
"Sets",
"the",
"value",
"of",
"a",
"property",
"-",
"list",
".",
"If",
"the",
"property",
"is",
"not",
"a",
"list",
"the",
"first",
"element",
"is",
"used",
"."
] | train | https://github.com/smurn/jPLY/blob/77cb8c47fff7549ae1da8d8568ad8bdf374fe89f/jply/src/main/java/org/smurn/jply/Element.java#L244-L264 |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/core/client/SdkClientBuilder.java | SdkClientBuilder.proxyCredentials | public SdkClientBuilder proxyCredentials(String user, String password) {
this.proxyCredentials = new UsernamePasswordCredentials(user, password);
return this;
} | java | public SdkClientBuilder proxyCredentials(String user, String password) {
this.proxyCredentials = new UsernamePasswordCredentials(user, password);
return this;
} | [
"public",
"SdkClientBuilder",
"proxyCredentials",
"(",
"String",
"user",
",",
"String",
"password",
")",
"{",
"this",
".",
"proxyCredentials",
"=",
"new",
"UsernamePasswordCredentials",
"(",
"user",
",",
"password",
")",
";",
"return",
"this",
";",
"}"
] | Specify proxy credentials.
@param user user
@param password password
@return current client builder | [
"Specify",
"proxy",
"credentials",
"."
] | train | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/core/client/SdkClientBuilder.java#L367-L370 |
alkacon/opencms-core | src/org/opencms/relations/CmsExternalLinksValidator.java | CmsExternalLinksValidator.checkUrl | public static boolean checkUrl(CmsObject cms, String check) {
// first, create an URI from the string representation
URI uri = null;
try {
uri = new CmsUriSplitter(check, true).toURI();
} catch (URISyntaxException exc) {
return false;
}
try {
if (!uri.isAbsolute()) {
return cms.existsResource(cms.getRequestContext().removeSiteRoot(uri.getPath()));
} else {
URL url = uri.toURL();
if ("http".equals(url.getProtocol())) {
// ensure that file is encoded properly
HttpURLConnection httpcon = (HttpURLConnection)url.openConnection();
int responseCode = httpcon.getResponseCode();
// accepting all status codes 2xx success and 3xx - redirect
return ((responseCode >= 200) && (responseCode < 400));
} else {
return true;
}
}
} catch (MalformedURLException mue) {
return false;
} catch (Exception ex) {
return false;
}
} | java | public static boolean checkUrl(CmsObject cms, String check) {
// first, create an URI from the string representation
URI uri = null;
try {
uri = new CmsUriSplitter(check, true).toURI();
} catch (URISyntaxException exc) {
return false;
}
try {
if (!uri.isAbsolute()) {
return cms.existsResource(cms.getRequestContext().removeSiteRoot(uri.getPath()));
} else {
URL url = uri.toURL();
if ("http".equals(url.getProtocol())) {
// ensure that file is encoded properly
HttpURLConnection httpcon = (HttpURLConnection)url.openConnection();
int responseCode = httpcon.getResponseCode();
// accepting all status codes 2xx success and 3xx - redirect
return ((responseCode >= 200) && (responseCode < 400));
} else {
return true;
}
}
} catch (MalformedURLException mue) {
return false;
} catch (Exception ex) {
return false;
}
} | [
"public",
"static",
"boolean",
"checkUrl",
"(",
"CmsObject",
"cms",
",",
"String",
"check",
")",
"{",
"// first, create an URI from the string representation",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"uri",
"=",
"new",
"CmsUriSplitter",
"(",
"check",
",",
"t... | Checks if the given url is valid.<p>
@param check the url to check
@param cms a OpenCms context object
@return false if the url could not be accessed | [
"Checks",
"if",
"the",
"given",
"url",
"is",
"valid",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsExternalLinksValidator.java#L70-L99 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.updateTags | public VirtualNetworkGatewayInner updateTags(String resourceGroupName, String virtualNetworkGatewayName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | java | public VirtualNetworkGatewayInner updateTags(String resourceGroupName, String virtualNetworkGatewayName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | [
"public",
"VirtualNetworkGatewayInner",
"updateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
")",
".",
"toBlocking",
... | Updates a virtual network gateway tags.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@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 VirtualNetworkGatewayInner object if successful. | [
"Updates",
"a",
"virtual",
"network",
"gateway",
"tags",
"."
] | 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/VirtualNetworkGatewaysInner.java#L611-L613 |
prestodb/presto | presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java | SemiTransactionalHiveMetastore.getTableSource | @GuardedBy("this")
private TableSource getTableSource(String databaseName, String tableName)
{
checkHoldsLock();
checkReadable();
Action<TableAndMore> tableAction = tableActions.get(new SchemaTableName(databaseName, tableName));
if (tableAction == null) {
return TableSource.PRE_EXISTING_TABLE;
}
switch (tableAction.getType()) {
case ADD:
return TableSource.CREATED_IN_THIS_TRANSACTION;
case ALTER:
throw new IllegalStateException("Tables are never altered in the current implementation");
case DROP:
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
case INSERT_EXISTING:
return TableSource.PRE_EXISTING_TABLE;
default:
throw new IllegalStateException("Unknown action type");
}
} | java | @GuardedBy("this")
private TableSource getTableSource(String databaseName, String tableName)
{
checkHoldsLock();
checkReadable();
Action<TableAndMore> tableAction = tableActions.get(new SchemaTableName(databaseName, tableName));
if (tableAction == null) {
return TableSource.PRE_EXISTING_TABLE;
}
switch (tableAction.getType()) {
case ADD:
return TableSource.CREATED_IN_THIS_TRANSACTION;
case ALTER:
throw new IllegalStateException("Tables are never altered in the current implementation");
case DROP:
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
case INSERT_EXISTING:
return TableSource.PRE_EXISTING_TABLE;
default:
throw new IllegalStateException("Unknown action type");
}
} | [
"@",
"GuardedBy",
"(",
"\"this\"",
")",
"private",
"TableSource",
"getTableSource",
"(",
"String",
"databaseName",
",",
"String",
"tableName",
")",
"{",
"checkHoldsLock",
"(",
")",
";",
"checkReadable",
"(",
")",
";",
"Action",
"<",
"TableAndMore",
">",
"table... | This method can only be called when the table is known to exist | [
"This",
"method",
"can",
"only",
"be",
"called",
"when",
"the",
"table",
"is",
"known",
"to",
"exist"
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java#L245-L267 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java | CommonExpectations.successfullyReachedProtectedResourceWithLtpaCookie | public static Expectations successfullyReachedProtectedResourceWithLtpaCookie(String testAction, WebClient webClient, String protectedUrl, String username) {
Expectations expectations = new Expectations();
expectations.addExpectations(successfullyReachedUrl(testAction, protectedUrl));
expectations.addExpectations(getResponseTextExpectationsForLtpaCookie(testAction, username));
return expectations;
} | java | public static Expectations successfullyReachedProtectedResourceWithLtpaCookie(String testAction, WebClient webClient, String protectedUrl, String username) {
Expectations expectations = new Expectations();
expectations.addExpectations(successfullyReachedUrl(testAction, protectedUrl));
expectations.addExpectations(getResponseTextExpectationsForLtpaCookie(testAction, username));
return expectations;
} | [
"public",
"static",
"Expectations",
"successfullyReachedProtectedResourceWithLtpaCookie",
"(",
"String",
"testAction",
",",
"WebClient",
"webClient",
",",
"String",
"protectedUrl",
",",
"String",
"username",
")",
"{",
"Expectations",
"expectations",
"=",
"new",
"Expectati... | Sets expectations that will check:
<ol>
<li>Successfully reached the specified URL
<li>Response text includes LTPA cookie and principal information
</ol> | [
"Sets",
"expectations",
"that",
"will",
"check",
":",
"<ol",
">",
"<li",
">",
"Successfully",
"reached",
"the",
"specified",
"URL",
"<li",
">",
"Response",
"text",
"includes",
"LTPA",
"cookie",
"and",
"principal",
"information",
"<",
"/",
"ol",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java#L57-L62 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEConfigData.java | CmsADEConfigData.hasFormatters | public boolean hasFormatters(CmsObject cms, I_CmsResourceType resType, Collection<CmsContainer> containers) {
try {
if (CmsXmlDynamicFunctionHandler.TYPE_FUNCTION.equals(resType.getTypeName())
|| CmsResourceTypeFunctionConfig.TYPE_NAME.equals(resType.getTypeName())) {
// dynamic function may match any container
return true;
}
CmsXmlContentDefinition def = CmsXmlContentDefinition.getContentDefinitionForType(
cms,
resType.getTypeName());
CmsFormatterConfiguration schemaFormatters = def.getContentHandler().getFormatterConfiguration(cms, null);
CmsFormatterConfiguration formatters = getFormatters(cms, resType, schemaFormatters);
for (CmsContainer cont : containers) {
if (cont.isEditable()
&& (formatters.getAllMatchingFormatters(cont.getType(), cont.getWidth()).size() > 0)) {
return true;
}
}
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
return false;
} | java | public boolean hasFormatters(CmsObject cms, I_CmsResourceType resType, Collection<CmsContainer> containers) {
try {
if (CmsXmlDynamicFunctionHandler.TYPE_FUNCTION.equals(resType.getTypeName())
|| CmsResourceTypeFunctionConfig.TYPE_NAME.equals(resType.getTypeName())) {
// dynamic function may match any container
return true;
}
CmsXmlContentDefinition def = CmsXmlContentDefinition.getContentDefinitionForType(
cms,
resType.getTypeName());
CmsFormatterConfiguration schemaFormatters = def.getContentHandler().getFormatterConfiguration(cms, null);
CmsFormatterConfiguration formatters = getFormatters(cms, resType, schemaFormatters);
for (CmsContainer cont : containers) {
if (cont.isEditable()
&& (formatters.getAllMatchingFormatters(cont.getType(), cont.getWidth()).size() > 0)) {
return true;
}
}
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
return false;
} | [
"public",
"boolean",
"hasFormatters",
"(",
"CmsObject",
"cms",
",",
"I_CmsResourceType",
"resType",
",",
"Collection",
"<",
"CmsContainer",
">",
"containers",
")",
"{",
"try",
"{",
"if",
"(",
"CmsXmlDynamicFunctionHandler",
".",
"TYPE_FUNCTION",
".",
"equals",
"("... | Checks if there are any matching formatters for the given set of containers.<p>
@param cms the current CMS context
@param resType the resource type for which the formatter configuration should be retrieved
@param containers the page containers
@return if there are any matching formatters | [
"Checks",
"if",
"there",
"are",
"any",
"matching",
"formatters",
"for",
"the",
"given",
"set",
"of",
"containers",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEConfigData.java#L854-L878 |
wg/lettuce | src/main/java/com/lambdaworks/redis/RedisConnection.java | RedisConnection.setTimeout | public void setTimeout(long timeout, TimeUnit unit) {
this.timeout = timeout;
this.unit = unit;
c.setTimeout(timeout, unit);
} | java | public void setTimeout(long timeout, TimeUnit unit) {
this.timeout = timeout;
this.unit = unit;
c.setTimeout(timeout, unit);
} | [
"public",
"void",
"setTimeout",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"timeout",
"=",
"timeout",
";",
"this",
".",
"unit",
"=",
"unit",
";",
"c",
".",
"setTimeout",
"(",
"timeout",
",",
"unit",
")",
";",
"}"
] | Set the command timeout for this connection.
@param timeout Command timeout.
@param unit Unit of time for the timeout. | [
"Set",
"the",
"command",
"timeout",
"for",
"this",
"connection",
"."
] | train | https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/RedisConnection.java#L49-L53 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/zeromq/ZeroMQNetworkService.java | ZeroMQNetworkService.extractEnvelope | private static EventEnvelope extractEnvelope(Socket socket) throws IOException {
// To-Do: Read the ZeroMQ socket via a NIO wrapper to support large data:
// indeed the arrays has a maximal size bounded by a native int value, and
// the real data could be larger than this limit.
byte[] data = socket.recv(ZMQ.DONTWAIT);
byte[] cdata;
int oldSize = 0;
while (socket.hasReceiveMore()) {
cdata = socket.recv(ZMQ.DONTWAIT);
oldSize = data.length;
data = Arrays.copyOf(data, data.length + cdata.length);
System.arraycopy(cdata, 0, data, oldSize, cdata.length);
}
final ByteBuffer buffer = ByteBuffer.wrap(data);
final byte[] contextId = readBlock(buffer);
assert contextId != null && contextId.length > 0;
final byte[] spaceId = readBlock(buffer);
assert spaceId != null && spaceId.length > 0;
final byte[] scope = readBlock(buffer);
assert scope != null && scope.length > 0;
final byte[] headers = readBlock(buffer);
assert headers != null && headers.length > 0;
final byte[] body = readBlock(buffer);
assert body != null && body.length > 0;
return new EventEnvelope(contextId, spaceId, scope, headers, body);
} | java | private static EventEnvelope extractEnvelope(Socket socket) throws IOException {
// To-Do: Read the ZeroMQ socket via a NIO wrapper to support large data:
// indeed the arrays has a maximal size bounded by a native int value, and
// the real data could be larger than this limit.
byte[] data = socket.recv(ZMQ.DONTWAIT);
byte[] cdata;
int oldSize = 0;
while (socket.hasReceiveMore()) {
cdata = socket.recv(ZMQ.DONTWAIT);
oldSize = data.length;
data = Arrays.copyOf(data, data.length + cdata.length);
System.arraycopy(cdata, 0, data, oldSize, cdata.length);
}
final ByteBuffer buffer = ByteBuffer.wrap(data);
final byte[] contextId = readBlock(buffer);
assert contextId != null && contextId.length > 0;
final byte[] spaceId = readBlock(buffer);
assert spaceId != null && spaceId.length > 0;
final byte[] scope = readBlock(buffer);
assert scope != null && scope.length > 0;
final byte[] headers = readBlock(buffer);
assert headers != null && headers.length > 0;
final byte[] body = readBlock(buffer);
assert body != null && body.length > 0;
return new EventEnvelope(contextId, spaceId, scope, headers, body);
} | [
"private",
"static",
"EventEnvelope",
"extractEnvelope",
"(",
"Socket",
"socket",
")",
"throws",
"IOException",
"{",
"// To-Do: Read the ZeroMQ socket via a NIO wrapper to support large data:",
"// indeed the arrays has a maximal size bounded by a native int value, and",
"// the real data ... | Receive data from the network.
@param socket
- network reader.
@return the envelope received over the network.
@throws IOException
if the envelope cannot be read from the network. | [
"Receive",
"data",
"from",
"the",
"network",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/zeromq/ZeroMQNetworkService.java#L319-L352 |
libgdx/packr | src/main/java/com/badlogicgames/packr/PackrConfig.java | PackrConfig.validate | void validate() throws IOException {
validate(platform, "platform");
validate(jdk, "JDK");
validate(executable, "executable name");
validate(mainClass, "main class");
validate(outDir, "output folder");
if (outDir.exists()) {
if (new File(".").equals(outDir)) {
throw new IOException("Output directory equals working directory, aborting");
}
if (new File("/").equals(outDir)) {
throw new IOException("Output directory points to root folder.");
}
}
if (classpath.isEmpty()) {
throw new IOException("Empty class path. Please check your commandline or configuration.");
}
} | java | void validate() throws IOException {
validate(platform, "platform");
validate(jdk, "JDK");
validate(executable, "executable name");
validate(mainClass, "main class");
validate(outDir, "output folder");
if (outDir.exists()) {
if (new File(".").equals(outDir)) {
throw new IOException("Output directory equals working directory, aborting");
}
if (new File("/").equals(outDir)) {
throw new IOException("Output directory points to root folder.");
}
}
if (classpath.isEmpty()) {
throw new IOException("Empty class path. Please check your commandline or configuration.");
}
} | [
"void",
"validate",
"(",
")",
"throws",
"IOException",
"{",
"validate",
"(",
"platform",
",",
"\"platform\"",
")",
";",
"validate",
"(",
"jdk",
",",
"\"JDK\"",
")",
";",
"validate",
"(",
"executable",
",",
"\"executable name\"",
")",
";",
"validate",
"(",
... | Sanity checks for configuration settings. Because users like to break stuff. | [
"Sanity",
"checks",
"for",
"configuration",
"settings",
".",
"Because",
"users",
"like",
"to",
"break",
"stuff",
"."
] | train | https://github.com/libgdx/packr/blob/4dd00a1fb5075dc1b6cd84f46bfdd918eb3d50e9/src/main/java/com/badlogicgames/packr/PackrConfig.java#L252-L271 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java | AbstractEJBRuntime.bindInterfaces | protected void bindInterfaces(NameSpaceBinder<?> binder, BeanMetaData bmd) throws Exception {
HomeWrapperSet homeSet = null;
EJSHome home = bmd.homeRecord.getHome();
if (home != null) {
homeSet = home.getWrapperSet();
}
int numRemoteInterfaces = countInterfaces(bmd, false);
int numLocalInterfaces = countInterfaces(bmd, true);
boolean singleGlobalInterface = (numRemoteInterfaces + numLocalInterfaces) == 1;
bindInterfaces(binder, bmd, homeSet, false, numRemoteInterfaces, singleGlobalInterface);
bindInterfaces(binder, bmd, homeSet, true, numLocalInterfaces, singleGlobalInterface);
} | java | protected void bindInterfaces(NameSpaceBinder<?> binder, BeanMetaData bmd) throws Exception {
HomeWrapperSet homeSet = null;
EJSHome home = bmd.homeRecord.getHome();
if (home != null) {
homeSet = home.getWrapperSet();
}
int numRemoteInterfaces = countInterfaces(bmd, false);
int numLocalInterfaces = countInterfaces(bmd, true);
boolean singleGlobalInterface = (numRemoteInterfaces + numLocalInterfaces) == 1;
bindInterfaces(binder, bmd, homeSet, false, numRemoteInterfaces, singleGlobalInterface);
bindInterfaces(binder, bmd, homeSet, true, numLocalInterfaces, singleGlobalInterface);
} | [
"protected",
"void",
"bindInterfaces",
"(",
"NameSpaceBinder",
"<",
"?",
">",
"binder",
",",
"BeanMetaData",
"bmd",
")",
"throws",
"Exception",
"{",
"HomeWrapperSet",
"homeSet",
"=",
"null",
";",
"EJSHome",
"home",
"=",
"bmd",
".",
"homeRecord",
".",
"getHome"... | Bind all local and remote interfaces for a bean to all binding locations.
@param binder the namespace binder
@param bmd the bean
@param homeSet the remote and local home wrappers, or <tt>null</tt> if
deferred initialization bindings should be used | [
"Bind",
"all",
"local",
"and",
"remote",
"interfaces",
"for",
"a",
"bean",
"to",
"all",
"binding",
"locations",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java#L851-L864 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/CloudantClient.java | CloudantClient.generateApiKey | public ApiKey generateApiKey() {
URI uri = new URIBase(getBaseUri()).path("_api").path("v2").path("api_keys").build();
InputStream response = couchDbClient.post(uri, null);
return getResponse(response, ApiKey.class, getGson());
} | java | public ApiKey generateApiKey() {
URI uri = new URIBase(getBaseUri()).path("_api").path("v2").path("api_keys").build();
InputStream response = couchDbClient.post(uri, null);
return getResponse(response, ApiKey.class, getGson());
} | [
"public",
"ApiKey",
"generateApiKey",
"(",
")",
"{",
"URI",
"uri",
"=",
"new",
"URIBase",
"(",
"getBaseUri",
"(",
")",
")",
".",
"path",
"(",
"\"_api\"",
")",
".",
"path",
"(",
"\"v2\"",
")",
".",
"path",
"(",
"\"api_keys\"",
")",
".",
"build",
"(",
... | Use the authorization feature to generate new API keys to access your data. An API key is
similar to a username/password pair for granting others access to your data.
<P>Example usage:
</P>
<pre>
{@code
ApiKey key = client.generateApiKey();
System.out.println(key);
}
</pre>
<P> Example output:
</P>
<pre>
{@code key: isdaingialkyciffestontsk password: XQiDHmwnkUu4tknHIjjs2P64}
</pre>
@return the generated key and password
@see Database#setPermissions(String, EnumSet) | [
"Use",
"the",
"authorization",
"feature",
"to",
"generate",
"new",
"API",
"keys",
"to",
"access",
"your",
"data",
".",
"An",
"API",
"key",
"is",
"similar",
"to",
"a",
"username",
"/",
"password",
"pair",
"for",
"granting",
"others",
"access",
"to",
"your",... | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/CloudantClient.java#L167-L171 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_name_PUT | public void installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_name_PUT(String templateName, String schemeName, String name, OvhHardwareRaid body) throws IOException {
String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardwareRaid/{name}";
StringBuilder sb = path(qPath, templateName, schemeName, name);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_name_PUT(String templateName, String schemeName, String name, OvhHardwareRaid body) throws IOException {
String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardwareRaid/{name}";
StringBuilder sb = path(qPath, templateName, schemeName, name);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"installationTemplate_templateName_partitionScheme_schemeName_hardwareRaid_name_PUT",
"(",
"String",
"templateName",
",",
"String",
"schemeName",
",",
"String",
"name",
",",
"OvhHardwareRaid",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"... | Alter this object properties
REST: PUT /me/installationTemplate/{templateName}/partitionScheme/{schemeName}/hardwareRaid/{name}
@param body [required] New object properties
@param templateName [required] This template name
@param schemeName [required] name of this partitioning scheme
@param name [required] Hardware RAID name | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3524-L3528 |
knowm/XChange | xchange-anx/src/main/java/org/knowm/xchange/anx/v2/service/ANXMarketDataService.java | ANXMarketDataService.getOrderBook | @Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
// Request data
ANXDepthWrapper anxDepthWrapper = null;
if (args != null && args.length > 0) {
if (args[0] instanceof String) {
if ("full" == args[0]) {
anxDepthWrapper = getANXFullOrderBook(currencyPair);
} else {
anxDepthWrapper = getANXPartialOrderBook(currencyPair);
}
} else {
throw new ExchangeException("Orderbook type argument must be a String!");
}
} else { // default to full orderbook
anxDepthWrapper = getANXFullOrderBook(currencyPair);
}
// Adapt to XChange DTOs
List<LimitOrder> asks =
ANXAdapters.adaptOrders(
anxDepthWrapper.getAnxDepth().getAsks(),
currencyPair.base.getCurrencyCode(),
currencyPair.counter.getCurrencyCode(),
"ask",
"");
List<LimitOrder> bids =
ANXAdapters.adaptOrders(
anxDepthWrapper.getAnxDepth().getBids(),
currencyPair.base.getCurrencyCode(),
currencyPair.counter.getCurrencyCode(),
"bid",
"");
Date date = new Date(anxDepthWrapper.getAnxDepth().getMicroTime() / 1000);
return new OrderBook(date, asks, bids);
} | java | @Override
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {
// Request data
ANXDepthWrapper anxDepthWrapper = null;
if (args != null && args.length > 0) {
if (args[0] instanceof String) {
if ("full" == args[0]) {
anxDepthWrapper = getANXFullOrderBook(currencyPair);
} else {
anxDepthWrapper = getANXPartialOrderBook(currencyPair);
}
} else {
throw new ExchangeException("Orderbook type argument must be a String!");
}
} else { // default to full orderbook
anxDepthWrapper = getANXFullOrderBook(currencyPair);
}
// Adapt to XChange DTOs
List<LimitOrder> asks =
ANXAdapters.adaptOrders(
anxDepthWrapper.getAnxDepth().getAsks(),
currencyPair.base.getCurrencyCode(),
currencyPair.counter.getCurrencyCode(),
"ask",
"");
List<LimitOrder> bids =
ANXAdapters.adaptOrders(
anxDepthWrapper.getAnxDepth().getBids(),
currencyPair.base.getCurrencyCode(),
currencyPair.counter.getCurrencyCode(),
"bid",
"");
Date date = new Date(anxDepthWrapper.getAnxDepth().getMicroTime() / 1000);
return new OrderBook(date, asks, bids);
} | [
"@",
"Override",
"public",
"OrderBook",
"getOrderBook",
"(",
"CurrencyPair",
"currencyPair",
",",
"Object",
"...",
"args",
")",
"throws",
"IOException",
"{",
"// Request data",
"ANXDepthWrapper",
"anxDepthWrapper",
"=",
"null",
";",
"if",
"(",
"args",
"!=",
"null"... | Get market depth from exchange
@param args Optional arguments. Exchange-specific. This implementation assumes: absent or
"full" -> get full OrderBook "partial" -> get partial OrderBook
@return The OrderBook
@throws java.io.IOException | [
"Get",
"market",
"depth",
"from",
"exchange"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-anx/src/main/java/org/knowm/xchange/anx/v2/service/ANXMarketDataService.java#L52-L88 |
ben-manes/caffeine | jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java | EventDispatcher.publishExpiredQuietly | public void publishExpiredQuietly(Cache<K, V> cache, K key, V value) {
publish(cache, EventType.EXPIRED, key, value, /* newValue */ null, /* quiet */ true);
} | java | public void publishExpiredQuietly(Cache<K, V> cache, K key, V value) {
publish(cache, EventType.EXPIRED, key, value, /* newValue */ null, /* quiet */ true);
} | [
"public",
"void",
"publishExpiredQuietly",
"(",
"Cache",
"<",
"K",
",",
"V",
">",
"cache",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"publish",
"(",
"cache",
",",
"EventType",
".",
"EXPIRED",
",",
"key",
",",
"value",
",",
"/* newValue */",
"null",... | Publishes a expire event for the entry to all of the interested listeners. This method does
not register the synchronous listener's future with {@link #awaitSynchronous()}.
@param cache the cache where the entry expired
@param key the entry's key
@param value the entry's value | [
"Publishes",
"a",
"expire",
"event",
"for",
"the",
"entry",
"to",
"all",
"of",
"the",
"interested",
"listeners",
".",
"This",
"method",
"does",
"not",
"register",
"the",
"synchronous",
"listener",
"s",
"future",
"with",
"{",
"@link",
"#awaitSynchronous",
"()",... | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L171-L173 |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/javadoc/JavaDocParserVisitor.java | JavaDocParserVisitor.calculateMethodIdentifier | private MethodIdentifier calculateMethodIdentifier(MethodDeclaration method) {
String[] parameters = method.getParameters().stream()
.map(p -> p.getType().asString())
.map(p -> p.replace('.', '/'))
.toArray(String[]::new);
String returnType = method.getType().asString().replace('.', '/');
if (method.isStatic()) {
return ofStatic(className, method.getNameAsString(), returnType, parameters);
}
return ofNonStatic(className, method.getNameAsString(), returnType, parameters);
} | java | private MethodIdentifier calculateMethodIdentifier(MethodDeclaration method) {
String[] parameters = method.getParameters().stream()
.map(p -> p.getType().asString())
.map(p -> p.replace('.', '/'))
.toArray(String[]::new);
String returnType = method.getType().asString().replace('.', '/');
if (method.isStatic()) {
return ofStatic(className, method.getNameAsString(), returnType, parameters);
}
return ofNonStatic(className, method.getNameAsString(), returnType, parameters);
} | [
"private",
"MethodIdentifier",
"calculateMethodIdentifier",
"(",
"MethodDeclaration",
"method",
")",
"{",
"String",
"[",
"]",
"parameters",
"=",
"method",
".",
"getParameters",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"p",
"->",
"p",
".",
"getType... | <b>Note:</b> This will not return the actual identifier but only the simple names of the types (return type & parameter types).
Doing a full type resolving with all imports adds too much complexity at this point.
This is a best-effort approach. | [
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"This",
"will",
"not",
"return",
"the",
"actual",
"identifier",
"but",
"only",
"the",
"simple",
"names",
"of",
"the",
"types",
"(",
"return",
"type",
"&",
";",
"parameter",
"types",
")",
".",
"Doing",
"a... | train | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/javadoc/JavaDocParserVisitor.java#L171-L182 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java | DateTimeFormatterBuilder.parseDefaulting | public DateTimeFormatterBuilder parseDefaulting(TemporalField field, long value) {
Jdk8Methods.requireNonNull(field, "field");
appendInternal(new DefaultingParser(field, value));
return this;
} | java | public DateTimeFormatterBuilder parseDefaulting(TemporalField field, long value) {
Jdk8Methods.requireNonNull(field, "field");
appendInternal(new DefaultingParser(field, value));
return this;
} | [
"public",
"DateTimeFormatterBuilder",
"parseDefaulting",
"(",
"TemporalField",
"field",
",",
"long",
"value",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"field",
",",
"\"field\"",
")",
";",
"appendInternal",
"(",
"new",
"DefaultingParser",
"(",
"field",
... | Appends a default value for a field to the formatter for use in parsing.
<p>
This appends an instruction to the builder to inject a default value
into the parsed result. This is especially useful in conjunction with
optional parts of the formatter.
<p>
For example, consider a formatter that parses the year, followed by
an optional month, with a further optional day-of-month. Using such a
formatter would require the calling code to check whether a full date,
year-month or just a year had been parsed. This method can be used to
default the month and day-of-month to a sensible value, such as the
first of the month, allowing the calling code to always get a date.
<p>
During formatting, this method has no effect.
<p>
During parsing, the current state of the parse is inspected.
If the specified field has no associated value, because it has not been
parsed successfully at that point, then the specified value is injected
into the parse result. Injection is immediate, thus the field-value pair
will be visible to any subsequent elements in the formatter.
As such, this method is normally called at the end of the builder.
@param field the field to default the value of, not null
@param value the value to default the field to
@return this, for chaining, not null | [
"Appends",
"a",
"default",
"value",
"for",
"a",
"field",
"to",
"the",
"formatter",
"for",
"use",
"in",
"parsing",
".",
"<p",
">",
"This",
"appends",
"an",
"instruction",
"to",
"the",
"builder",
"to",
"inject",
"a",
"default",
"value",
"into",
"the",
"par... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L322-L326 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java | CitrusAnnotations.injectAll | public static final void injectAll(final Object target, final Citrus citrusFramework) {
injectAll(target, citrusFramework, citrusFramework.createTestContext());
} | java | public static final void injectAll(final Object target, final Citrus citrusFramework) {
injectAll(target, citrusFramework, citrusFramework.createTestContext());
} | [
"public",
"static",
"final",
"void",
"injectAll",
"(",
"final",
"Object",
"target",
",",
"final",
"Citrus",
"citrusFramework",
")",
"{",
"injectAll",
"(",
"target",
",",
"citrusFramework",
",",
"citrusFramework",
".",
"createTestContext",
"(",
")",
")",
";",
"... | Creates new Citrus test context and injects all supported components and endpoints to target object using annotations.
@param target | [
"Creates",
"new",
"Citrus",
"test",
"context",
"and",
"injects",
"all",
"supported",
"components",
"and",
"endpoints",
"to",
"target",
"object",
"using",
"annotations",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java#L60-L62 |
app55/app55-java | src/support/java/com/googlecode/openbeans/DefaultPersistenceDelegate.java | DefaultPersistenceDelegate.mutatesTo | @Override
protected boolean mutatesTo(Object o1, Object o2)
{
if (this.propertyNames.length > 0)
{
if (BeansUtils.declaredEquals(o1.getClass()))
{
return o1.equals(o2);
}
}
return super.mutatesTo(o1, o2);
} | java | @Override
protected boolean mutatesTo(Object o1, Object o2)
{
if (this.propertyNames.length > 0)
{
if (BeansUtils.declaredEquals(o1.getClass()))
{
return o1.equals(o2);
}
}
return super.mutatesTo(o1, o2);
} | [
"@",
"Override",
"protected",
"boolean",
"mutatesTo",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"if",
"(",
"this",
".",
"propertyNames",
".",
"length",
">",
"0",
")",
"{",
"if",
"(",
"BeansUtils",
".",
"declaredEquals",
"(",
"o1",
".",
"getCl... | Determines whether one object mutates to the other object. If this <code>DefaultPersistenceDelegate</code> is constructed with one or more property
names, and the class of <code>o1</code> overrides the "equals(Object)" method, then <code>o2</code> is considered to mutate to <code>o1</code> if
<code>o1</code> equals to <code>o2</code>. Otherwise, the result is the same as the definition in <code>PersistenceDelegate</code>.
@param o1
one object
@param o2
the other object
@return true if second object mutates to the first object, otherwise false | [
"Determines",
"whether",
"one",
"object",
"mutates",
"to",
"the",
"other",
"object",
".",
"If",
"this",
"<code",
">",
"DefaultPersistenceDelegate<",
"/",
"code",
">",
"is",
"constructed",
"with",
"one",
"or",
"more",
"property",
"names",
"and",
"the",
"class",... | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/DefaultPersistenceDelegate.java#L281-L292 |
netty/netty | transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java | AbstractKQueueStreamChannel.doWriteMultiple | private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception {
final long maxBytesPerGatheringWrite = config().getMaxBytesPerGatheringWrite();
IovArray array = ((KQueueEventLoop) eventLoop()).cleanArray();
array.maxBytes(maxBytesPerGatheringWrite);
in.forEachFlushedMessage(array);
if (array.count() >= 1) {
// TODO: Handle the case where cnt == 1 specially.
return writeBytesMultiple(in, array);
}
// cnt == 0, which means the outbound buffer contained empty buffers only.
in.removeBytes(0);
return 0;
} | java | private int doWriteMultiple(ChannelOutboundBuffer in) throws Exception {
final long maxBytesPerGatheringWrite = config().getMaxBytesPerGatheringWrite();
IovArray array = ((KQueueEventLoop) eventLoop()).cleanArray();
array.maxBytes(maxBytesPerGatheringWrite);
in.forEachFlushedMessage(array);
if (array.count() >= 1) {
// TODO: Handle the case where cnt == 1 specially.
return writeBytesMultiple(in, array);
}
// cnt == 0, which means the outbound buffer contained empty buffers only.
in.removeBytes(0);
return 0;
} | [
"private",
"int",
"doWriteMultiple",
"(",
"ChannelOutboundBuffer",
"in",
")",
"throws",
"Exception",
"{",
"final",
"long",
"maxBytesPerGatheringWrite",
"=",
"config",
"(",
")",
".",
"getMaxBytesPerGatheringWrite",
"(",
")",
";",
"IovArray",
"array",
"=",
"(",
"(",... | Attempt to write multiple {@link ByteBuf} objects.
@param in the collection which contains objects to write.
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no
data was accepted</li>
</ul>
@throws Exception If an I/O error occurs. | [
"Attempt",
"to",
"write",
"multiple",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/AbstractKQueueStreamChannel.java#L348-L361 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/Tesseract.java | Tesseract.doOCR | private String doOCR(IIOImage oimage, String filename, Rectangle rect, int pageNum) throws TesseractException {
String text = "";
try {
setImage(oimage.getRenderedImage(), rect);
text = getOCRText(filename, pageNum);
} catch (IOException ioe) {
// skip the problematic image
logger.warn(ioe.getMessage(), ioe);
}
return text;
} | java | private String doOCR(IIOImage oimage, String filename, Rectangle rect, int pageNum) throws TesseractException {
String text = "";
try {
setImage(oimage.getRenderedImage(), rect);
text = getOCRText(filename, pageNum);
} catch (IOException ioe) {
// skip the problematic image
logger.warn(ioe.getMessage(), ioe);
}
return text;
} | [
"private",
"String",
"doOCR",
"(",
"IIOImage",
"oimage",
",",
"String",
"filename",
",",
"Rectangle",
"rect",
",",
"int",
"pageNum",
")",
"throws",
"TesseractException",
"{",
"String",
"text",
"=",
"\"\"",
";",
"try",
"{",
"setImage",
"(",
"oimage",
".",
"... | Performs OCR operation.
<br>
Note: <code>init()</code> and <code>setTessVariables()</code> must be
called before use; <code>dispose()</code> should be called afterwards.
@param oimage an <code>IIOImage</code> object
@param filename input file nam
@param rect the bounding rectangle defines the region of the image to be
recognized. A rectangle of zero dimension or <code>null</code> indicates
the whole image.
@param pageNum page number
@return the recognized text
@throws TesseractException | [
"Performs",
"OCR",
"operation",
".",
"<br",
">",
"Note",
":",
"<code",
">",
"init",
"()",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"setTessVariables",
"()",
"<",
"/",
"code",
">",
"must",
"be",
"called",
"before",
"use",
";",
"<code",
">",
"dispos... | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract.java#L353-L365 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/process/ProcessEngineDriver.java | ProcessEngineDriver.invokeService | public String invokeService(Long processId, String ownerType,
Long ownerId, String masterRequestId, String masterRequest,
Map<String,String> parameters, String responseVarName, Map<String,String> headers) throws Exception {
return invokeService(processId, ownerType, ownerId, masterRequestId, masterRequest, parameters, responseVarName, 0, null, null, headers);
} | java | public String invokeService(Long processId, String ownerType,
Long ownerId, String masterRequestId, String masterRequest,
Map<String,String> parameters, String responseVarName, Map<String,String> headers) throws Exception {
return invokeService(processId, ownerType, ownerId, masterRequestId, masterRequest, parameters, responseVarName, 0, null, null, headers);
} | [
"public",
"String",
"invokeService",
"(",
"Long",
"processId",
",",
"String",
"ownerType",
",",
"Long",
"ownerId",
",",
"String",
"masterRequestId",
",",
"String",
"masterRequest",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"String",
"re... | Invoke a real-time service process.
@return the service response | [
"Invoke",
"a",
"real",
"-",
"time",
"service",
"process",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/process/ProcessEngineDriver.java#L695-L699 |
cbeust/jcommander | src/main/java/com/beust/jcommander/Parameterized.java | Parameterized.describeClassTree | private static Set<Class<?>> describeClassTree(Class<?> inputClass) {
if(inputClass == null) {
return Collections.emptySet();
}
// create result collector
Set<Class<?>> classes = Sets.newLinkedHashSet();
// describe tree
describeClassTree(inputClass, classes);
return classes;
} | java | private static Set<Class<?>> describeClassTree(Class<?> inputClass) {
if(inputClass == null) {
return Collections.emptySet();
}
// create result collector
Set<Class<?>> classes = Sets.newLinkedHashSet();
// describe tree
describeClassTree(inputClass, classes);
return classes;
} | [
"private",
"static",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"describeClassTree",
"(",
"Class",
"<",
"?",
">",
"inputClass",
")",
"{",
"if",
"(",
"inputClass",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"//... | Given an object return the set of classes that it extends
or implements.
@param inputClass object to describe
@return set of classes that are implemented or extended by that object | [
"Given",
"an",
"object",
"return",
"the",
"set",
"of",
"classes",
"that",
"it",
"extends",
"or",
"implements",
"."
] | train | https://github.com/cbeust/jcommander/blob/85cb6f7217e15f62225185ffd97491f34b7b49bb/src/main/java/com/beust/jcommander/Parameterized.java#L78-L90 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java | DefaultFeatureForm.getValue | @Api
public void getValue(String name, LongAttribute attribute) {
attribute.setValue(toLong(formWidget.getValue(name)));
} | java | @Api
public void getValue(String name, LongAttribute attribute) {
attribute.setValue(toLong(formWidget.getValue(name)));
} | [
"@",
"Api",
"public",
"void",
"getValue",
"(",
"String",
"name",
",",
"LongAttribute",
"attribute",
")",
"{",
"attribute",
".",
"setValue",
"(",
"toLong",
"(",
"formWidget",
".",
"getValue",
"(",
"name",
")",
")",
")",
";",
"}"
] | Get a long value from the form, and place it in <code>attribute</code>.
@param name attribute name
@param attribute attribute to put value
@since 1.11.1 | [
"Get",
"a",
"long",
"value",
"from",
"the",
"form",
"and",
"place",
"it",
"in",
"<code",
">",
"attribute<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L683-L686 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectRayLine | public static float intersectRayLine(Vector2fc origin, Vector2fc dir, Vector2fc point, Vector2fc normal, float epsilon) {
return intersectRayLine(origin.x(), origin.y(), dir.x(), dir.y(), point.x(), point.y(), normal.x(), normal.y(), epsilon);
} | java | public static float intersectRayLine(Vector2fc origin, Vector2fc dir, Vector2fc point, Vector2fc normal, float epsilon) {
return intersectRayLine(origin.x(), origin.y(), dir.x(), dir.y(), point.x(), point.y(), normal.x(), normal.y(), epsilon);
} | [
"public",
"static",
"float",
"intersectRayLine",
"(",
"Vector2fc",
"origin",
",",
"Vector2fc",
"dir",
",",
"Vector2fc",
"point",
",",
"Vector2fc",
"normal",
",",
"float",
"epsilon",
")",
"{",
"return",
"intersectRayLine",
"(",
"origin",
".",
"x",
"(",
")",
"... | Test whether the ray with given <code>origin</code> and direction <code>dir</code> intersects the line
containing the given <code>point</code> and having the given <code>normal</code>, and return the
value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point.
<p>
This method returns <code>-1.0</code> if the ray does not intersect the line, because it is either parallel to the line or its direction points
away from the line or the ray's origin is on the <i>negative</i> side of the line (i.e. the line's normal points away from the ray's origin).
@param origin
the ray's origin
@param dir
the ray's direction
@param point
a point on the line
@param normal
the line's normal
@param epsilon
some small epsilon for when the ray is parallel to the line
@return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if the ray
intersects the line; <code>-1.0</code> otherwise | [
"Test",
"whether",
"the",
"ray",
"with",
"given",
"<code",
">",
"origin<",
"/",
"code",
">",
"and",
"direction",
"<code",
">",
"dir<",
"/",
"code",
">",
"intersects",
"the",
"line",
"containing",
"the",
"given",
"<code",
">",
"point<",
"/",
"code",
">",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L3950-L3952 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java | JsApiMessageImpl.getIdentifierValue | @Override
public Object getIdentifierValue(Identifier id,
boolean ignoreType)
throws BadMessageFormatMatchingException {
return getIdentifierValue(id, ignoreType, null, false);
} | java | @Override
public Object getIdentifierValue(Identifier id,
boolean ignoreType)
throws BadMessageFormatMatchingException {
return getIdentifierValue(id, ignoreType, null, false);
} | [
"@",
"Override",
"public",
"Object",
"getIdentifierValue",
"(",
"Identifier",
"id",
",",
"boolean",
"ignoreType",
")",
"throws",
"BadMessageFormatMatchingException",
"{",
"return",
"getIdentifierValue",
"(",
"id",
",",
"ignoreType",
",",
"null",
",",
"false",
")",
... | /*
Evaluate the message field determined by the given Identifier
See the following method for more information.
Javadoc description supplied by MatchSpaceKey interface. | [
"/",
"*",
"Evaluate",
"the",
"message",
"field",
"determined",
"by",
"the",
"given",
"Identifier",
"See",
"the",
"following",
"method",
"for",
"more",
"information",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L480-L485 |
reinert/requestor | requestor/core/requestor-api/src/main/java/io/reinert/requestor/SerdesManagerImpl.java | SerdesManagerImpl.getDeserializer | @SuppressWarnings("unchecked")
public <T> Deserializer<T> getDeserializer(Class<T> type, String mediaType) throws SerializationException {
checkNotNull(type, "Type (Class<T>) cannot be null.");
checkNotNull(mediaType, "Media-Type cannot be null.");
final String typeName = getClassName(type);
final Key key = new Key(typeName, mediaType);
logger.log(Level.FINE, "Querying for Deserializer of type '" + typeName + "' and " + "media-type '" + mediaType
+ "'.");
ArrayList<DeserializerHolder> holders = deserializers.get(typeName);
if (holders != null) {
for (DeserializerHolder holder : holders) {
if (holder.key.matches(key)) {
logger.log(Level.FINE, "Deserializer for type '" + holder.deserializer.handledType() + "' and " +
"media-type '" + Arrays.toString(holder.deserializer.mediaType()) + "' matched: " +
holder.deserializer.getClass().getName());
return (Deserializer<T>) holder.deserializer;
}
}
}
logger.log(Level.WARNING, "There is no Deserializer registered for " + type.getName() +
" and media-type " + mediaType + ". If you're relying on auto-generated deserializers," +
" please make sure you imported the correct GWT Module.");
return null;
} | java | @SuppressWarnings("unchecked")
public <T> Deserializer<T> getDeserializer(Class<T> type, String mediaType) throws SerializationException {
checkNotNull(type, "Type (Class<T>) cannot be null.");
checkNotNull(mediaType, "Media-Type cannot be null.");
final String typeName = getClassName(type);
final Key key = new Key(typeName, mediaType);
logger.log(Level.FINE, "Querying for Deserializer of type '" + typeName + "' and " + "media-type '" + mediaType
+ "'.");
ArrayList<DeserializerHolder> holders = deserializers.get(typeName);
if (holders != null) {
for (DeserializerHolder holder : holders) {
if (holder.key.matches(key)) {
logger.log(Level.FINE, "Deserializer for type '" + holder.deserializer.handledType() + "' and " +
"media-type '" + Arrays.toString(holder.deserializer.mediaType()) + "' matched: " +
holder.deserializer.getClass().getName());
return (Deserializer<T>) holder.deserializer;
}
}
}
logger.log(Level.WARNING, "There is no Deserializer registered for " + type.getName() +
" and media-type " + mediaType + ". If you're relying on auto-generated deserializers," +
" please make sure you imported the correct GWT Module.");
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"Deserializer",
"<",
"T",
">",
"getDeserializer",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"mediaType",
")",
"throws",
"SerializationException",
"{",
"checkNotNull",
"(",
... | Retrieve Deserializer from manager.
@param type The type class of the deserializer.
@param <T> The type of the deserializer.
@return The deserializer of the specified type.
@throws SerializationException if no deserializer was registered for the class. | [
"Retrieve",
"Deserializer",
"from",
"manager",
"."
] | train | https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/core/requestor-api/src/main/java/io/reinert/requestor/SerdesManagerImpl.java#L151-L179 |
apache/reef | lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/TokenBatchCredentialProvider.java | TokenBatchCredentialProvider.getCredentials | @Override
public BatchCredentials getCredentials() {
final TokenCredentials tokenCredentials = new TokenCredentials(null, System.getenv(AZ_BATCH_AUTH_TOKEN_ENV));
return new BatchCredentials() {
@Override
public String baseUrl() {
return azureBatchAccountUri;
}
@Override
public void applyCredentialsFilter(final OkHttpClient.Builder builder) {
tokenCredentials.applyCredentialsFilter(builder);
}
};
} | java | @Override
public BatchCredentials getCredentials() {
final TokenCredentials tokenCredentials = new TokenCredentials(null, System.getenv(AZ_BATCH_AUTH_TOKEN_ENV));
return new BatchCredentials() {
@Override
public String baseUrl() {
return azureBatchAccountUri;
}
@Override
public void applyCredentialsFilter(final OkHttpClient.Builder builder) {
tokenCredentials.applyCredentialsFilter(builder);
}
};
} | [
"@",
"Override",
"public",
"BatchCredentials",
"getCredentials",
"(",
")",
"{",
"final",
"TokenCredentials",
"tokenCredentials",
"=",
"new",
"TokenCredentials",
"(",
"null",
",",
"System",
".",
"getenv",
"(",
"AZ_BATCH_AUTH_TOKEN_ENV",
")",
")",
";",
"return",
"ne... | Returns credentials for Azure Batch account.
@return an implementation of {@link BatchCredentials} which is based on the token provided by Azure Batch. | [
"Returns",
"credentials",
"for",
"Azure",
"Batch",
"account",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/batch/TokenBatchCredentialProvider.java#L52-L68 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/GraphGenerator.java | GraphGenerator.onIfSharedByPK | private Object onIfSharedByPK(Relation relation, Object childObject, EntityMetadata childMetadata, Object entityId)
{
if (relation.isJoinedByPrimaryKey())
{
PropertyAccessorHelper.setId(childObject, childMetadata, entityId);
}
return childObject;
} | java | private Object onIfSharedByPK(Relation relation, Object childObject, EntityMetadata childMetadata, Object entityId)
{
if (relation.isJoinedByPrimaryKey())
{
PropertyAccessorHelper.setId(childObject, childMetadata, entityId);
}
return childObject;
} | [
"private",
"Object",
"onIfSharedByPK",
"(",
"Relation",
"relation",
",",
"Object",
"childObject",
",",
"EntityMetadata",
"childMetadata",
",",
"Object",
"entityId",
")",
"{",
"if",
"(",
"relation",
".",
"isJoinedByPrimaryKey",
"(",
")",
")",
"{",
"PropertyAccessor... | Check and set if relation is set via primary key.
@param relation
relation
@param childObject
target entity
@param childMetadata
target entity metadata
@param entityId
entity id
@return target entity. | [
"Check",
"and",
"set",
"if",
"relation",
"is",
"set",
"via",
"primary",
"key",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/GraphGenerator.java#L192-L200 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.updateAccountAcquisition | public AccountAcquisition updateAccountAcquisition(final String accountCode, final AccountAcquisition acquisition) {
final String path = Account.ACCOUNT_RESOURCE + "/" + accountCode + AccountAcquisition.ACCOUNT_ACQUISITION_RESOURCE;
return doPUT(path, acquisition, AccountAcquisition.class);
} | java | public AccountAcquisition updateAccountAcquisition(final String accountCode, final AccountAcquisition acquisition) {
final String path = Account.ACCOUNT_RESOURCE + "/" + accountCode + AccountAcquisition.ACCOUNT_ACQUISITION_RESOURCE;
return doPUT(path, acquisition, AccountAcquisition.class);
} | [
"public",
"AccountAcquisition",
"updateAccountAcquisition",
"(",
"final",
"String",
"accountCode",
",",
"final",
"AccountAcquisition",
"acquisition",
")",
"{",
"final",
"String",
"path",
"=",
"Account",
".",
"ACCOUNT_RESOURCE",
"+",
"\"/\"",
"+",
"accountCode",
"+",
... | Updates the acquisition details for an account
<p>
https://dev.recurly.com/docs/update-account-acquisition
@param accountCode The account's account code
@param acquisition The AccountAcquisition data
@return The created AccountAcquisition object | [
"Updates",
"the",
"acquisition",
"details",
"for",
"an",
"account",
"<p",
">",
"https",
":",
"//",
"dev",
".",
"recurly",
".",
"com",
"/",
"docs",
"/",
"update",
"-",
"account",
"-",
"acquisition"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1988-L1991 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java | AccessIdUtil.getUniqueId | public static String getUniqueId(String accessId, String realm) {
if (realm != null) {
Pattern pattern = Pattern.compile("([^:]+):(" + Pattern.quote(realm) + ")/(.*)");
Matcher m = pattern.matcher(accessId);
if (m.matches()) {
if (m.group(3).length() > 0) {
return m.group(3);
}
}
}
// if there is no match, fall back.
return getUniqueId(accessId);
} | java | public static String getUniqueId(String accessId, String realm) {
if (realm != null) {
Pattern pattern = Pattern.compile("([^:]+):(" + Pattern.quote(realm) + ")/(.*)");
Matcher m = pattern.matcher(accessId);
if (m.matches()) {
if (m.group(3).length() > 0) {
return m.group(3);
}
}
}
// if there is no match, fall back.
return getUniqueId(accessId);
} | [
"public",
"static",
"String",
"getUniqueId",
"(",
"String",
"accessId",
",",
"String",
"realm",
")",
"{",
"if",
"(",
"realm",
"!=",
"null",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"([^:]+):(\"",
"+",
"Pattern",
".",
"quote",
... | Given an accessId and realm name, extract the uniqueId.
@param accessId
@param realm
@return The uniqueId for the accessId, or {@code null} if the accessId is invalid | [
"Given",
"an",
"accessId",
"and",
"realm",
"name",
"extract",
"the",
"uniqueId",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java#L190-L203 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java | AuthenticationAPIClient.loginWithOAuthAccessToken | @SuppressWarnings("WeakerAccess")
public AuthenticationRequest loginWithOAuthAccessToken(@NonNull String token, @NonNull String connection) {
HttpUrl url = HttpUrl.parse(auth0.getDomainUrl()).newBuilder()
.addPathSegment(OAUTH_PATH)
.addPathSegment(ACCESS_TOKEN_PATH)
.build();
Map<String, Object> parameters = ParameterBuilder.newAuthenticationBuilder()
.setClientId(getClientId())
.setConnection(connection)
.setAccessToken(token)
.asDictionary();
return factory.authenticationPOST(url, client, gson)
.addAuthenticationParameters(parameters);
} | java | @SuppressWarnings("WeakerAccess")
public AuthenticationRequest loginWithOAuthAccessToken(@NonNull String token, @NonNull String connection) {
HttpUrl url = HttpUrl.parse(auth0.getDomainUrl()).newBuilder()
.addPathSegment(OAUTH_PATH)
.addPathSegment(ACCESS_TOKEN_PATH)
.build();
Map<String, Object> parameters = ParameterBuilder.newAuthenticationBuilder()
.setClientId(getClientId())
.setConnection(connection)
.setAccessToken(token)
.asDictionary();
return factory.authenticationPOST(url, client, gson)
.addAuthenticationParameters(parameters);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"AuthenticationRequest",
"loginWithOAuthAccessToken",
"(",
"@",
"NonNull",
"String",
"token",
",",
"@",
"NonNull",
"String",
"connection",
")",
"{",
"HttpUrl",
"url",
"=",
"HttpUrl",
".",
"parse",
"(... | Log in a user with a OAuth 'access_token' of a Identity Provider like Facebook or Twitter using <a href="https://auth0.com/docs/api/authentication#social-with-provider-s-access-token">'\oauth\access_token' endpoint</a>
The default scope used is 'openid'.
Example usage:
<pre>
{@code
client.loginWithOAuthAccessToken("{token}", "{connection name}")
.start(new BaseCallback<Credentials>() {
{@literal}Override
public void onSuccess(Credentials payload) { }
{@literal}Override
public void onFailure(AuthenticationException error) { }
});
}
</pre>
@param token obtained from the IdP
@param connection that will be used to authenticate the user, e.g. 'facebook'
@return a request to configure and start that will yield {@link Credentials} | [
"Log",
"in",
"a",
"user",
"with",
"a",
"OAuth",
"access_token",
"of",
"a",
"Identity",
"Provider",
"like",
"Facebook",
"or",
"Twitter",
"using",
"<a",
"href",
"=",
"https",
":",
"//",
"auth0",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"authentication#soc... | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L300-L315 |
census-instrumentation/opencensus-java | exporters/trace/zipkin/src/main/java/io/opencensus/exporter/trace/zipkin/ZipkinTraceExporter.java | ZipkinTraceExporter.createAndRegister | public static void createAndRegister(String v2Url, String serviceName) {
createAndRegister(SpanBytesEncoder.JSON_V2, URLConnectionSender.create(v2Url), serviceName);
} | java | public static void createAndRegister(String v2Url, String serviceName) {
createAndRegister(SpanBytesEncoder.JSON_V2, URLConnectionSender.create(v2Url), serviceName);
} | [
"public",
"static",
"void",
"createAndRegister",
"(",
"String",
"v2Url",
",",
"String",
"serviceName",
")",
"{",
"createAndRegister",
"(",
"SpanBytesEncoder",
".",
"JSON_V2",
",",
"URLConnectionSender",
".",
"create",
"(",
"v2Url",
")",
",",
"serviceName",
")",
... | Creates and registers the Zipkin Trace exporter to the OpenCensus library. Only one Zipkin
exporter can be registered at any point.
@param v2Url Ex http://127.0.0.1:9411/api/v2/spans
@param serviceName the {@link Span#localServiceName() local service name} of the process.
@throws IllegalStateException if a Zipkin exporter is already registered.
@since 0.12 | [
"Creates",
"and",
"registers",
"the",
"Zipkin",
"Trace",
"exporter",
"to",
"the",
"OpenCensus",
"library",
".",
"Only",
"one",
"Zipkin",
"exporter",
"can",
"be",
"registered",
"at",
"any",
"point",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/exporters/trace/zipkin/src/main/java/io/opencensus/exporter/trace/zipkin/ZipkinTraceExporter.java#L66-L68 |
Jasig/uPortal | uPortal-core/src/main/java/org/apereo/portal/security/provider/PersonImpl.java | PersonImpl.setAttributes | @Override
public void setAttributes(final Map<String, List<Object>> attrs) {
for (final Entry<String, List<Object>> attrEntry : attrs.entrySet()) {
final String key = attrEntry.getKey();
final List<Object> value = attrEntry.getValue();
setAttribute(key, value);
}
/*
* This is the method used by Authentication.authenticate() -- and
* elsewhere -- to initialize a valid IPerson in the portal. We want
* to *fail fast* if there's something wrong with that process.
*/
validateUsername();
} | java | @Override
public void setAttributes(final Map<String, List<Object>> attrs) {
for (final Entry<String, List<Object>> attrEntry : attrs.entrySet()) {
final String key = attrEntry.getKey();
final List<Object> value = attrEntry.getValue();
setAttribute(key, value);
}
/*
* This is the method used by Authentication.authenticate() -- and
* elsewhere -- to initialize a valid IPerson in the portal. We want
* to *fail fast* if there's something wrong with that process.
*/
validateUsername();
} | [
"@",
"Override",
"public",
"void",
"setAttributes",
"(",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"Object",
">",
">",
"attrs",
")",
"{",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"List",
"<",
"Object",
">",
">",
"attrEntry",
":",
"att... | Sets the specified attributes. Uses {@link #setAttribute(String, Object)} to set each.
@see IPerson#setAttributes(java.util.Map) | [
"Sets",
"the",
"specified",
"attributes",
".",
"Uses",
"{",
"@link",
"#setAttribute",
"(",
"String",
"Object",
")",
"}",
"to",
"set",
"each",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/security/provider/PersonImpl.java#L146-L159 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java | SibRaMessagingEngineConnection.createConnection | SICoreConnection createConnection(SICoreConnectionFactory factory, String name, String password, Map properties, String busName)
throws SIException, SIErrorException, Exception {
final String methodName = "createConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { factory, name, "password not traced", properties, busName });
}
SICoreConnection result;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Creating connection with Userid and password");
}
result = factory.createConnection(name, password, properties);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "createConnection", result);
}
return result;
} | java | SICoreConnection createConnection(SICoreConnectionFactory factory, String name, String password, Map properties, String busName)
throws SIException, SIErrorException, Exception {
final String methodName = "createConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object[] { factory, name, "password not traced", properties, busName });
}
SICoreConnection result;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) {
SibTr.debug(this, TRACE, "Creating connection with Userid and password");
}
result = factory.createConnection(name, password, properties);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "createConnection", result);
}
return result;
} | [
"SICoreConnection",
"createConnection",
"(",
"SICoreConnectionFactory",
"factory",
",",
"String",
"name",
",",
"String",
"password",
",",
"Map",
"properties",
",",
"String",
"busName",
")",
"throws",
"SIException",
",",
"SIErrorException",
",",
"Exception",
"{",
"fi... | Creates this connection using either the Auth Alias supplied or, if the property is set
the WAS server subject.
@param factory
The SICoreConnectionFactory used to make the connection.
@param name
The userid to use for secure connections
@param password
The password to use for secure connections
@param properties
The Map of properties to use when making the connection
@return the return value is the SICoreConnection object
@throws | [
"Creates",
"this",
"connection",
"using",
"either",
"the",
"Auth",
"Alias",
"supplied",
"or",
"if",
"the",
"property",
"is",
"set",
"the",
"WAS",
"server",
"subject",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaMessagingEngineConnection.java#L991-L1012 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.unprotectedDelete | INode unprotectedDelete(String src, long modificationTime) {
return unprotectedDelete(src, this.getExistingPathINodes(src), null,
BLOCK_DELETION_NO_LIMIT, modificationTime);
} | java | INode unprotectedDelete(String src, long modificationTime) {
return unprotectedDelete(src, this.getExistingPathINodes(src), null,
BLOCK_DELETION_NO_LIMIT, modificationTime);
} | [
"INode",
"unprotectedDelete",
"(",
"String",
"src",
",",
"long",
"modificationTime",
")",
"{",
"return",
"unprotectedDelete",
"(",
"src",
",",
"this",
".",
"getExistingPathINodes",
"(",
"src",
")",
",",
"null",
",",
"BLOCK_DELETION_NO_LIMIT",
",",
"modificationTim... | Delete a path from the name space
Update the count at each ancestor directory with quota
@param src a string representation of a path to an inode
@param modificationTime the time the inode is removed
@return the deleted target inode, null if deletion failed | [
"Delete",
"a",
"path",
"from",
"the",
"name",
"space",
"Update",
"the",
"count",
"at",
"each",
"ancestor",
"directory",
"with",
"quota"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L1443-L1446 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java | ScreenField.printScreen | public void printScreen(PrintWriter out, ResourceBundle reg)
throws DBException
{
this.getScreenFieldView().printScreen(out, reg);
} | java | public void printScreen(PrintWriter out, ResourceBundle reg)
throws DBException
{
this.getScreenFieldView().printScreen(out, reg);
} | [
"public",
"void",
"printScreen",
"(",
"PrintWriter",
"out",
",",
"ResourceBundle",
"reg",
")",
"throws",
"DBException",
"{",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"printScreen",
"(",
"out",
",",
"reg",
")",
";",
"}"
] | Display the result in html table format.
@param out The http output stream.
@param reg The resource bundle
@exception DBException File exception. | [
"Display",
"the",
"result",
"in",
"html",
"table",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L659-L663 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/JLanguageTool.java | JLanguageTool.updateOptionalLanguageModelRules | private void updateOptionalLanguageModelRules(@Nullable LanguageModel lm) {
ResourceBundle messages = getMessageBundle(language);
try {
List<Rule> rules = language.getRelevantLanguageModelCapableRules(messages, lm, userConfig, motherTongue, altLanguages);
userRules.removeIf(rule -> optionalLanguageModelRules.contains(rule.getId()));
optionalLanguageModelRules.clear();
rules.stream().map(Rule::getId).forEach(optionalLanguageModelRules::add);
userRules.addAll(rules);
} catch(Exception e) {
throw new RuntimeException("Could not load language model capable rules.", e);
}
} | java | private void updateOptionalLanguageModelRules(@Nullable LanguageModel lm) {
ResourceBundle messages = getMessageBundle(language);
try {
List<Rule> rules = language.getRelevantLanguageModelCapableRules(messages, lm, userConfig, motherTongue, altLanguages);
userRules.removeIf(rule -> optionalLanguageModelRules.contains(rule.getId()));
optionalLanguageModelRules.clear();
rules.stream().map(Rule::getId).forEach(optionalLanguageModelRules::add);
userRules.addAll(rules);
} catch(Exception e) {
throw new RuntimeException("Could not load language model capable rules.", e);
}
} | [
"private",
"void",
"updateOptionalLanguageModelRules",
"(",
"@",
"Nullable",
"LanguageModel",
"lm",
")",
"{",
"ResourceBundle",
"messages",
"=",
"getMessageBundle",
"(",
"language",
")",
";",
"try",
"{",
"List",
"<",
"Rule",
">",
"rules",
"=",
"language",
".",
... | Remove rules that can profit from a language model, recreate them with the given model and add them again
@param lm the language model or null if none is available | [
"Remove",
"rules",
"that",
"can",
"profit",
"from",
"a",
"language",
"model",
"recreate",
"them",
"with",
"the",
"given",
"model",
"and",
"add",
"them",
"again"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L453-L464 |
RestComm/sip-servlets | sip-servlets-client/src/main/java/org/mobicents/servlet/sip/SipConnector.java | SipConnector.setKeepAliveTimeout | public boolean setKeepAliveTimeout(String ipAddress, int port, long timeout) throws Exception {
MBeanServer mbeanServer = getMBeanServer();
Set<ObjectName> queryNames = mbeanServer.queryNames(new ObjectName("*:type=Service,*"), null);
boolean changed = false;
for(ObjectName objectName : queryNames) {
changed = (Boolean) mbeanServer.invoke(objectName, "setKeepAliveTimeout", new Object[]{this, ipAddress, port, timeout}, new String[] {SipConnector.class.getName() , String.class.getName(), "int" , "long"});
if(changed) {
return changed;
}
}
return false;
} | java | public boolean setKeepAliveTimeout(String ipAddress, int port, long timeout) throws Exception {
MBeanServer mbeanServer = getMBeanServer();
Set<ObjectName> queryNames = mbeanServer.queryNames(new ObjectName("*:type=Service,*"), null);
boolean changed = false;
for(ObjectName objectName : queryNames) {
changed = (Boolean) mbeanServer.invoke(objectName, "setKeepAliveTimeout", new Object[]{this, ipAddress, port, timeout}, new String[] {SipConnector.class.getName() , String.class.getName(), "int" , "long"});
if(changed) {
return changed;
}
}
return false;
} | [
"public",
"boolean",
"setKeepAliveTimeout",
"(",
"String",
"ipAddress",
",",
"int",
"port",
",",
"long",
"timeout",
")",
"throws",
"Exception",
"{",
"MBeanServer",
"mbeanServer",
"=",
"getMBeanServer",
"(",
")",
";",
"Set",
"<",
"ObjectName",
">",
"queryNames",
... | Allow to reset the RFC5626 Section 4.4.1 keeplive on a given TCP/TLS/SCTP connection
@since 1.7
@param ipAddress
@param port
@param timeout
@return
@throws Exception | [
"Allow",
"to",
"reset",
"the",
"RFC5626",
"Section",
"4",
".",
"4",
".",
"1",
"keeplive",
"on",
"a",
"given",
"TCP",
"/",
"TLS",
"/",
"SCTP",
"connection",
"@since",
"1",
".",
"7"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-client/src/main/java/org/mobicents/servlet/sip/SipConnector.java#L287-L299 |
groovy/groovy-core | subprojects/groovy-json/src/main/java/groovy/json/JsonDelegate.java | JsonDelegate.invokeMethod | public Object invokeMethod(String name, Object args) {
Object val = null;
if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
Object[] arr = (Object[]) args;
if (arr.length == 1) {
val = arr[0];
} else if (arr.length == 2 && arr[0] instanceof Collection && arr[1] instanceof Closure) {
Closure<?> closure = (Closure<?>) arr[1];
Iterator<?> iterator = ((Collection) arr[0]).iterator();
List<Object> list = new ArrayList<Object>();
while (iterator.hasNext()) {
list.add(curryDelegateAndGetContent(closure, iterator.next()));
}
val = list;
} else {
val = Arrays.asList(arr);
}
}
content.put(name, val);
return val;
} | java | public Object invokeMethod(String name, Object args) {
Object val = null;
if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
Object[] arr = (Object[]) args;
if (arr.length == 1) {
val = arr[0];
} else if (arr.length == 2 && arr[0] instanceof Collection && arr[1] instanceof Closure) {
Closure<?> closure = (Closure<?>) arr[1];
Iterator<?> iterator = ((Collection) arr[0]).iterator();
List<Object> list = new ArrayList<Object>();
while (iterator.hasNext()) {
list.add(curryDelegateAndGetContent(closure, iterator.next()));
}
val = list;
} else {
val = Arrays.asList(arr);
}
}
content.put(name, val);
return val;
} | [
"public",
"Object",
"invokeMethod",
"(",
"String",
"name",
",",
"Object",
"args",
")",
"{",
"Object",
"val",
"=",
"null",
";",
"if",
"(",
"args",
"!=",
"null",
"&&",
"Object",
"[",
"]",
".",
"class",
".",
"isAssignableFrom",
"(",
"args",
".",
"getClass... | Intercepts calls for setting a key and value for a JSON object
@param name the key name
@param args the value associated with the key | [
"Intercepts",
"calls",
"for",
"setting",
"a",
"key",
"and",
"value",
"for",
"a",
"JSON",
"object"
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-json/src/main/java/groovy/json/JsonDelegate.java#L43-L65 |
apiman/apiman | gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/CachingESRegistry.java | CachingESRegistry.getApiIdx | private String getApiIdx(String orgId, String apiId, String version) {
return "API::" + orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} | java | private String getApiIdx(String orgId, String apiId, String version) {
return "API::" + orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} | [
"private",
"String",
"getApiIdx",
"(",
"String",
"orgId",
",",
"String",
"apiId",
",",
"String",
"version",
")",
"{",
"return",
"\"API::\"",
"+",
"orgId",
"+",
"\"|\"",
"+",
"apiId",
"+",
"\"|\"",
"+",
"version",
";",
"//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$",... | Generates an in-memory key for an API, used to index the app for later quick
retrieval.
@param orgId
@param apiId
@param version
@return a API key | [
"Generates",
"an",
"in",
"-",
"memory",
"key",
"for",
"an",
"API",
"used",
"to",
"index",
"the",
"app",
"for",
"later",
"quick",
"retrieval",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/CachingESRegistry.java#L196-L198 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsyncThrowing | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, Observable<R>> toAsyncThrowing(ThrowingFunc4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> func) {
return toAsyncThrowing(func, Schedulers.computation());
} | java | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, Observable<R>> toAsyncThrowing(ThrowingFunc4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> func) {
return toAsyncThrowing(func, Schedulers.computation());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"Func4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"Observable",
"<",
"R",
">",
">",
"toAsyncThrowing",
"(",
"ThrowingFunc4",
"<",
"?",
"super",
"T1",
",",
"?... | 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#L382-L384 |
alkacon/opencms-core | src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditEntryPoint.java | CmsDirectEditEntryPoint.processEditableElement | protected CmsDirectEditButtons processEditableElement(Element elem) {
RootPanel root = RootPanel.get();
CmsDirectEditButtons result = new CmsDirectEditButtons(elem, null);
root.add(result);
result.setPosition(m_positions.get(elem.getId()), m_buttonPositions.get(elem.getId()), elem.getParentElement());
return result;
} | java | protected CmsDirectEditButtons processEditableElement(Element elem) {
RootPanel root = RootPanel.get();
CmsDirectEditButtons result = new CmsDirectEditButtons(elem, null);
root.add(result);
result.setPosition(m_positions.get(elem.getId()), m_buttonPositions.get(elem.getId()), elem.getParentElement());
return result;
} | [
"protected",
"CmsDirectEditButtons",
"processEditableElement",
"(",
"Element",
"elem",
")",
"{",
"RootPanel",
"root",
"=",
"RootPanel",
".",
"get",
"(",
")",
";",
"CmsDirectEditButtons",
"result",
"=",
"new",
"CmsDirectEditButtons",
"(",
"elem",
",",
"null",
")",
... | Adds the direct edit buttons for a single editable element.<p>
@param elem the data container element
@return the direct edit buttons widget which was created for the element | [
"Adds",
"the",
"direct",
"edit",
"buttons",
"for",
"a",
"single",
"editable",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditEntryPoint.java#L232-L239 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java | AFPChainer.calAfpDis | private static double calAfpDis(int afp1, int afp2, FatCatParameters params, AFPChain afpChain)
{
List<AFP> afpSet = afpChain.getAfpSet();
Matrix disTable1 = afpChain.getDisTable1();
Matrix disTable2 = afpChain.getDisTable2();
int fragLen = params.getFragLen();
double afpDisCut = params.getAfpDisCut();
double disCut = params.getDisCut();
double fragLenSq = params.getFragLenSq();
int i, j, ai, bi, aj, bj;
double d;
double rms = 0;
for(i = 0; i < fragLen; i ++) {
ai = afpSet.get(afp1).getP1() + i;
bi = afpSet.get(afp1).getP2() + i;
for(j = 0; j < fragLen; j ++) {
aj = afpSet.get(afp2).getP1() + j;
bj = afpSet.get(afp2).getP2() + j;
d = disTable1.get(aj,ai) - disTable2.get(bj,bi);
rms += d * d;
if(rms > afpDisCut) { return (disCut); }
}
}
return (Math.sqrt(rms / fragLenSq));
} | java | private static double calAfpDis(int afp1, int afp2, FatCatParameters params, AFPChain afpChain)
{
List<AFP> afpSet = afpChain.getAfpSet();
Matrix disTable1 = afpChain.getDisTable1();
Matrix disTable2 = afpChain.getDisTable2();
int fragLen = params.getFragLen();
double afpDisCut = params.getAfpDisCut();
double disCut = params.getDisCut();
double fragLenSq = params.getFragLenSq();
int i, j, ai, bi, aj, bj;
double d;
double rms = 0;
for(i = 0; i < fragLen; i ++) {
ai = afpSet.get(afp1).getP1() + i;
bi = afpSet.get(afp1).getP2() + i;
for(j = 0; j < fragLen; j ++) {
aj = afpSet.get(afp2).getP1() + j;
bj = afpSet.get(afp2).getP2() + j;
d = disTable1.get(aj,ai) - disTable2.get(bj,bi);
rms += d * d;
if(rms > afpDisCut) { return (disCut); }
}
}
return (Math.sqrt(rms / fragLenSq));
} | [
"private",
"static",
"double",
"calAfpDis",
"(",
"int",
"afp1",
",",
"int",
"afp2",
",",
"FatCatParameters",
"params",
",",
"AFPChain",
"afpChain",
")",
"{",
"List",
"<",
"AFP",
">",
"afpSet",
"=",
"afpChain",
".",
"getAfpSet",
"(",
")",
";",
"Matrix",
"... | return the root mean square of the distance matrix between the residues
from the segments that form the given AFP list
this value can be a measurement (2) for the connectivity of the AFPs
and its calculation is quicker than the measurement (1), rmsd
currently only deal with AFP pair
|-d1--|
|--d2---|
|---d3----|
-----------------------------------------------------------------------
this module is optimized
@param afp1
@param afp2
@return | [
"return",
"the",
"root",
"mean",
"square",
"of",
"the",
"distance",
"matrix",
"between",
"the",
"residues",
"from",
"the",
"segments",
"that",
"form",
"the",
"given",
"AFP",
"list",
"this",
"value",
"can",
"be",
"a",
"measurement",
"(",
"2",
")",
"for",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L406-L434 |
tcurdt/jdeb | src/main/java/org/vafer/jdeb/utils/Utils.java | Utils.toUnixLineEndings | public static byte[] toUnixLineEndings( InputStream input ) throws IOException {
String encoding = "ISO-8859-1";
FixCrLfFilter filter = new FixCrLfFilter(new InputStreamReader(input, encoding));
filter.setEol(FixCrLfFilter.CrLf.newInstance("unix"));
ByteArrayOutputStream filteredFile = new ByteArrayOutputStream();
Utils.copy(new ReaderInputStream(filter, encoding), filteredFile);
return filteredFile.toByteArray();
} | java | public static byte[] toUnixLineEndings( InputStream input ) throws IOException {
String encoding = "ISO-8859-1";
FixCrLfFilter filter = new FixCrLfFilter(new InputStreamReader(input, encoding));
filter.setEol(FixCrLfFilter.CrLf.newInstance("unix"));
ByteArrayOutputStream filteredFile = new ByteArrayOutputStream();
Utils.copy(new ReaderInputStream(filter, encoding), filteredFile);
return filteredFile.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"toUnixLineEndings",
"(",
"InputStream",
"input",
")",
"throws",
"IOException",
"{",
"String",
"encoding",
"=",
"\"ISO-8859-1\"",
";",
"FixCrLfFilter",
"filter",
"=",
"new",
"FixCrLfFilter",
"(",
"new",
"InputStreamReader",
"(... | Replaces new line delimiters in the input stream with the Unix line feed.
@param input | [
"Replaces",
"new",
"line",
"delimiters",
"in",
"the",
"input",
"stream",
"with",
"the",
"Unix",
"line",
"feed",
"."
] | train | https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/utils/Utils.java#L220-L229 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java | MapApi.getNullableMap | public static <A, B> Map<A, B> getNullableMap(final Map map, final Object... path) {
return getNullable(map, Map.class, path);
} | java | public static <A, B> Map<A, B> getNullableMap(final Map map, final Object... path) {
return getNullable(map, Map.class, path);
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"Map",
"<",
"A",
",",
"B",
">",
"getNullableMap",
"(",
"final",
"Map",
"map",
",",
"final",
"Object",
"...",
"path",
")",
"{",
"return",
"getNullable",
"(",
"map",
",",
"Map",
".",
"class",
",",
"path",
... | Get map value by path.
@param <A> map key type
@param <B> map value type
@param map subject
@param path nodes to walk in map
@return value | [
"Get",
"map",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L211-L213 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ControlsNotParticipant.java | ControlsNotParticipant.satisfies | @Override
public boolean satisfies(Match match, int... ind)
{
Control ctrl = (Control) match.get(ind[0]);
for (Process process : ctrl.getControlled())
{
if (process instanceof Interaction)
{
Interaction inter = (Interaction) process;
Set<Entity> participant = inter.getParticipant();
for (Controller controller : ctrl.getController())
{
if (participant.contains(controller)) return false;
}
}
}
return true;
} | java | @Override
public boolean satisfies(Match match, int... ind)
{
Control ctrl = (Control) match.get(ind[0]);
for (Process process : ctrl.getControlled())
{
if (process instanceof Interaction)
{
Interaction inter = (Interaction) process;
Set<Entity> participant = inter.getParticipant();
for (Controller controller : ctrl.getController())
{
if (participant.contains(controller)) return false;
}
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"Control",
"ctrl",
"=",
"(",
"Control",
")",
"match",
".",
"get",
"(",
"ind",
"[",
"0",
"]",
")",
";",
"for",
"(",
"Process",
"process",
"... | Checks if the controlled Interaction contains a controller as a participant. This constraint
filters out such cases.
@param match current pattern match
@param ind mapped indices
@return true if participants of teh controlled Interactions not also a controller of the
Control. | [
"Checks",
"if",
"the",
"controlled",
"Interaction",
"contains",
"a",
"controller",
"as",
"a",
"participant",
".",
"This",
"constraint",
"filters",
"out",
"such",
"cases",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ControlsNotParticipant.java#L35-L53 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java | FileOperations.getFilePropertiesFromComputeNode | public FileProperties getFilePropertiesFromComputeNode(String poolId, String nodeId, String fileName, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
FileGetPropertiesFromComputeNodeOptions options = new FileGetPropertiesFromComputeNodeOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
ServiceResponseWithHeaders<Void, FileGetPropertiesFromComputeNodeHeaders> response = this.parentBatchClient.protocolLayer().files().
getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, fileName, options).toBlocking().single();
return new FileProperties()
.withContentLength(response.headers().contentLength())
.withContentType(response.headers().contentType())
.withCreationTime(response.headers().ocpCreationTime())
.withLastModified(response.headers().lastModified())
.withFileMode(response.headers().ocpBatchFileMode());
} | java | public FileProperties getFilePropertiesFromComputeNode(String poolId, String nodeId, String fileName, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
FileGetPropertiesFromComputeNodeOptions options = new FileGetPropertiesFromComputeNodeOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
ServiceResponseWithHeaders<Void, FileGetPropertiesFromComputeNodeHeaders> response = this.parentBatchClient.protocolLayer().files().
getPropertiesFromComputeNodeWithServiceResponseAsync(poolId, nodeId, fileName, options).toBlocking().single();
return new FileProperties()
.withContentLength(response.headers().contentLength())
.withContentType(response.headers().contentType())
.withCreationTime(response.headers().ocpCreationTime())
.withLastModified(response.headers().lastModified())
.withFileMode(response.headers().ocpBatchFileMode());
} | [
"public",
"FileProperties",
"getFilePropertiesFromComputeNode",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"fileName",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
... | Gets information about a file on a compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId the ID of the compute node.
@param fileName The name of the file to retrieve.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@return A {@link FileProperties} instance containing information about the file.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Gets",
"information",
"about",
"a",
"file",
"on",
"a",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L386-L400 |
spotify/ssh-agent-proxy | src/main/java/com/spotify/sshagentproxy/AgentReplyHeaders.java | AgentReplyHeaders.intFromSubArray | private static int intFromSubArray(final byte[] bytes, final int from, final int to) {
final byte[] subBytes = Arrays.copyOfRange(bytes, from, to);
final ByteBuffer wrap = ByteBuffer.wrap(subBytes);
return wrap.getInt();
} | java | private static int intFromSubArray(final byte[] bytes, final int from, final int to) {
final byte[] subBytes = Arrays.copyOfRange(bytes, from, to);
final ByteBuffer wrap = ByteBuffer.wrap(subBytes);
return wrap.getInt();
} | [
"private",
"static",
"int",
"intFromSubArray",
"(",
"final",
"byte",
"[",
"]",
"bytes",
",",
"final",
"int",
"from",
",",
"final",
"int",
"to",
")",
"{",
"final",
"byte",
"[",
"]",
"subBytes",
"=",
"Arrays",
".",
"copyOfRange",
"(",
"bytes",
",",
"from... | Take a slice of an array of bytes and interpret it as an int.
@param bytes Array of bytes
@param from Start index in the array
@param to End index in the array
@return int | [
"Take",
"a",
"slice",
"of",
"an",
"array",
"of",
"bytes",
"and",
"interpret",
"it",
"as",
"an",
"int",
"."
] | train | https://github.com/spotify/ssh-agent-proxy/blob/b678792750c0157bd5ed3fb6a18895ff95effbc4/src/main/java/com/spotify/sshagentproxy/AgentReplyHeaders.java#L83-L87 |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java | UserService.persistNewUser | public E persistNewUser(E user, boolean encryptPassword) {
if (user.getId() != null) {
// to be sure that we are in the
// "create" case, the id must be null
return user;
}
if (encryptPassword) {
user.setPassword(passwordEncoder.encode(user.getPassword()));
}
dao.saveOrUpdate(user);
return user;
} | java | public E persistNewUser(E user, boolean encryptPassword) {
if (user.getId() != null) {
// to be sure that we are in the
// "create" case, the id must be null
return user;
}
if (encryptPassword) {
user.setPassword(passwordEncoder.encode(user.getPassword()));
}
dao.saveOrUpdate(user);
return user;
} | [
"public",
"E",
"persistNewUser",
"(",
"E",
"user",
",",
"boolean",
"encryptPassword",
")",
"{",
"if",
"(",
"user",
".",
"getId",
"(",
")",
"!=",
"null",
")",
"{",
"// to be sure that we are in the",
"// \"create\" case, the id must be null",
"return",
"user",
";",... | Persists a new user in the database.
@param user The user to create
@param encryptPassword Whether or not the current password of the user object should
be encrypted or not before the object is persisted in the db
@return The persisted user object (incl. ID value) | [
"Persists",
"a",
"new",
"user",
"in",
"the",
"database",
"."
] | train | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java#L189-L204 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.completeTransfer | public void completeTransfer(
String connId,
String parentConnId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidcompletetransferData completeData = new VoicecallsidcompletetransferData();
completeData.setParentConnId(parentConnId);
completeData.setReasons(Util.toKVList(reasons));
completeData.setExtensions(Util.toKVList(extensions));
CompleteTransferData data = new CompleteTransferData();
data.data(completeData);
ApiSuccessResponse response = this.voiceApi.completeTransfer(connId, data);
throwIfNotOk("completeTransfer", response);
} catch (ApiException e) {
throw new WorkspaceApiException("completeTransfer failed.", e);
}
} | java | public void completeTransfer(
String connId,
String parentConnId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidcompletetransferData completeData = new VoicecallsidcompletetransferData();
completeData.setParentConnId(parentConnId);
completeData.setReasons(Util.toKVList(reasons));
completeData.setExtensions(Util.toKVList(extensions));
CompleteTransferData data = new CompleteTransferData();
data.data(completeData);
ApiSuccessResponse response = this.voiceApi.completeTransfer(connId, data);
throwIfNotOk("completeTransfer", response);
} catch (ApiException e) {
throw new WorkspaceApiException("completeTransfer failed.", e);
}
} | [
"public",
"void",
"completeTransfer",
"(",
"String",
"connId",
",",
"String",
"parentConnId",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsidcompletetransferData",
"compl... | Complete a previously initiated two-step transfer using the provided IDs.
@param connId The connection ID of the consult call (established).
@param parentConnId The connection ID of the parent call (held).
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Complete",
"a",
"previously",
"initiated",
"two",
"-",
"step",
"transfer",
"using",
"the",
"provided",
"IDs",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L841-L860 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/relatedsamples/McNemar.java | McNemar.getPvalue | public static double getPvalue(int n11, int n12, int n21, int n22) {
double Chisquare=Math.pow(Math.abs(n12-n21) - 0.5,2)/(n12+n21); //McNemar with Yates's correction for continuity
double pvalue= scoreToPvalue(Chisquare);
return pvalue;
} | java | public static double getPvalue(int n11, int n12, int n21, int n22) {
double Chisquare=Math.pow(Math.abs(n12-n21) - 0.5,2)/(n12+n21); //McNemar with Yates's correction for continuity
double pvalue= scoreToPvalue(Chisquare);
return pvalue;
} | [
"public",
"static",
"double",
"getPvalue",
"(",
"int",
"n11",
",",
"int",
"n12",
",",
"int",
"n21",
",",
"int",
"n22",
")",
"{",
"double",
"Chisquare",
"=",
"Math",
".",
"pow",
"(",
"Math",
".",
"abs",
"(",
"n12",
"-",
"n21",
")",
"-",
"0.5",
","... | Calculates the p-value of null Hypothesis
@param n11
@param n12
@param n21
@param n22
@return | [
"Calculates",
"the",
"p",
"-",
"value",
"of",
"null",
"Hypothesis"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/relatedsamples/McNemar.java#L36-L42 |
js-lib-com/commons | src/main/java/js/util/Strings.java | Strings.escapeXML | public static void escapeXML(String text, Writer writer) throws IOException
{
if(text == null) {
return;
}
for(int i = 0, l = text.length(); i < l; ++i) {
char c = text.charAt(i);
switch(c) {
case '"':
writer.write(""");
break;
case '\'':
writer.write("'");
break;
case '&':
writer.write("&");
break;
case '<':
writer.write("<");
break;
case '>':
writer.write(">");
break;
default:
writer.write(c);
}
}
} | java | public static void escapeXML(String text, Writer writer) throws IOException
{
if(text == null) {
return;
}
for(int i = 0, l = text.length(); i < l; ++i) {
char c = text.charAt(i);
switch(c) {
case '"':
writer.write(""");
break;
case '\'':
writer.write("'");
break;
case '&':
writer.write("&");
break;
case '<':
writer.write("<");
break;
case '>':
writer.write(">");
break;
default:
writer.write(c);
}
}
} | [
"public",
"static",
"void",
"escapeXML",
"(",
"String",
"text",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"l",
"=",
"text",
".",... | Escape text for reserved XML characters to a specified writer. This method has the same logic as
{@link #escapeXML(String)} but result is serialized on the given writer. If <code>text</code> parameters is null
this method does nothing.
@param text string to escape,
@param writer writer to serialize resulted escaped string.
@throws IOException if writer operation fails. | [
"Escape",
"text",
"for",
"reserved",
"XML",
"characters",
"to",
"a",
"specified",
"writer",
".",
"This",
"method",
"has",
"the",
"same",
"logic",
"as",
"{",
"@link",
"#escapeXML",
"(",
"String",
")",
"}",
"but",
"result",
"is",
"serialized",
"on",
"the",
... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L892-L919 |
Bedework/bw-util | bw-util-directory/src/main/java/org/bedework/util/directory/common/Directory.java | Directory.searchBase | public boolean searchBase(String base, String filter) throws NamingException {
return search(base, filter, scopeBase);
} | java | public boolean searchBase(String base, String filter) throws NamingException {
return search(base, filter, scopeBase);
} | [
"public",
"boolean",
"searchBase",
"(",
"String",
"base",
",",
"String",
"filter",
")",
"throws",
"NamingException",
"{",
"return",
"search",
"(",
"base",
",",
"filter",
",",
"scopeBase",
")",
";",
"}"
] | Carry out a base level search. This should be the default if the scope
is not specified.
@param base
@param filter
@return DirSearchResult or null
@throws NamingException | [
"Carry",
"out",
"a",
"base",
"level",
"search",
".",
"This",
"should",
"be",
"the",
"default",
"if",
"the",
"scope",
"is",
"not",
"specified",
"."
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-directory/src/main/java/org/bedework/util/directory/common/Directory.java#L96-L98 |
cache2k/cache2k | cache2k-core/src/main/java/org/cache2k/core/HeapCache.java | HeapCache.executeWithGlobalLock | private <T> T executeWithGlobalLock(final Job<T> job, final boolean _checkClosed) {
synchronized (lock) {
if (_checkClosed) { checkClosed(); }
eviction.stop();
try {
T _result = hash.runTotalLocked(new Job<T>() {
@Override
public T call() {
if (_checkClosed) { checkClosed(); }
boolean f = eviction.drain();
if (f) {
return (T) RESTART_AFTER_EVICTION;
}
return eviction.runLocked(new Job<T>() {
@Override
public T call() {
return job.call();
}
});
}
});
if (_result == RESTART_AFTER_EVICTION) {
eviction.evictEventually();
_result = hash.runTotalLocked(new Job<T>() {
@Override
public T call() {
if (_checkClosed) { checkClosed(); }
eviction.drain();
return eviction.runLocked(new Job<T>() {
@Override
public T call() {
return job.call();
}
});
}
});
}
return _result;
} finally {
eviction.start();
}
}
} | java | private <T> T executeWithGlobalLock(final Job<T> job, final boolean _checkClosed) {
synchronized (lock) {
if (_checkClosed) { checkClosed(); }
eviction.stop();
try {
T _result = hash.runTotalLocked(new Job<T>() {
@Override
public T call() {
if (_checkClosed) { checkClosed(); }
boolean f = eviction.drain();
if (f) {
return (T) RESTART_AFTER_EVICTION;
}
return eviction.runLocked(new Job<T>() {
@Override
public T call() {
return job.call();
}
});
}
});
if (_result == RESTART_AFTER_EVICTION) {
eviction.evictEventually();
_result = hash.runTotalLocked(new Job<T>() {
@Override
public T call() {
if (_checkClosed) { checkClosed(); }
eviction.drain();
return eviction.runLocked(new Job<T>() {
@Override
public T call() {
return job.call();
}
});
}
});
}
return _result;
} finally {
eviction.start();
}
}
} | [
"private",
"<",
"T",
">",
"T",
"executeWithGlobalLock",
"(",
"final",
"Job",
"<",
"T",
">",
"job",
",",
"final",
"boolean",
"_checkClosed",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"_checkClosed",
")",
"{",
"checkClosed",
"(",
")",
"... | Execute job while making sure that no other operations are going on.
In case the eviction is connected via a queue we need to stop the queue processing.
On the other hand we needs to make sure that the queue is drained because this
method is used to access the recent statistics or check integrity. Draining the queue
is a two phase job: The draining may not do eviction since we hold the locks, after
lifting the lock with do eviction and lock again. This ensures that all
queued entries are processed up to the point when the method was called.
@param _checkClosed variant, this method is needed once without check during the close itself | [
"Execute",
"job",
"while",
"making",
"sure",
"that",
"no",
"other",
"operations",
"are",
"going",
"on",
".",
"In",
"case",
"the",
"eviction",
"is",
"connected",
"via",
"a",
"queue",
"we",
"need",
"to",
"stop",
"the",
"queue",
"processing",
".",
"On",
"th... | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/HeapCache.java#L1890-L1932 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.startAny | public static boolean startAny(String target, Integer toffset, String... startWith) {
return startAny(target, toffset, Arrays.asList(startWith));
} | java | public static boolean startAny(String target, Integer toffset, String... startWith) {
return startAny(target, toffset, Arrays.asList(startWith));
} | [
"public",
"static",
"boolean",
"startAny",
"(",
"String",
"target",
",",
"Integer",
"toffset",
",",
"String",
"...",
"startWith",
")",
"{",
"return",
"startAny",
"(",
"target",
",",
"toffset",
",",
"Arrays",
".",
"asList",
"(",
"startWith",
")",
")",
";",
... | Check if target string starts with any of an array of specified strings beginning at the specified index.
@param target
@param toffset
@param startWith
@return | [
"Check",
"if",
"target",
"string",
"starts",
"with",
"any",
"of",
"an",
"array",
"of",
"specified",
"strings",
"beginning",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L341-L343 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/histogram/AbstractObjDynamicHistogram.java | AbstractObjDynamicHistogram.putData | public void putData(double coord, T value) {
// Store in cache
if(cachefill >= 0 && cachefill < cacheposs.length) {
cacheposs[cachefill] = coord;
cachevals[cachefill++] = cloneForCache(value);
return;
}
if(coord == Double.NEGATIVE_INFINITY) {
aggregateSpecial(value, 0);
}
else if(coord == Double.POSITIVE_INFINITY) {
aggregateSpecial(value, 1);
}
else if(Double.isNaN(coord)) {
aggregateSpecial(value, 2);
}
else {
// super class will handle histogram resizing / shifting
T exist = get(coord);
data[getBinNr(coord)] = aggregate(exist, value);
}
} | java | public void putData(double coord, T value) {
// Store in cache
if(cachefill >= 0 && cachefill < cacheposs.length) {
cacheposs[cachefill] = coord;
cachevals[cachefill++] = cloneForCache(value);
return;
}
if(coord == Double.NEGATIVE_INFINITY) {
aggregateSpecial(value, 0);
}
else if(coord == Double.POSITIVE_INFINITY) {
aggregateSpecial(value, 1);
}
else if(Double.isNaN(coord)) {
aggregateSpecial(value, 2);
}
else {
// super class will handle histogram resizing / shifting
T exist = get(coord);
data[getBinNr(coord)] = aggregate(exist, value);
}
} | [
"public",
"void",
"putData",
"(",
"double",
"coord",
",",
"T",
"value",
")",
"{",
"// Store in cache",
"if",
"(",
"cachefill",
">=",
"0",
"&&",
"cachefill",
"<",
"cacheposs",
".",
"length",
")",
"{",
"cacheposs",
"[",
"cachefill",
"]",
"=",
"coord",
";",... | Put fresh data into the histogram (or into the cache).
@param coord Coordinate
@param value Value | [
"Put",
"fresh",
"data",
"into",
"the",
"histogram",
"(",
"or",
"into",
"the",
"cache",
")",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/histogram/AbstractObjDynamicHistogram.java#L132-L153 |
kaazing/gateway | transport/ssl/src/main/java/org/kaazing/gateway/transport/ssl/bridge/filter/SslHandler.java | SslHandler.messageReceived | public void messageReceived(NextFilter nextFilter, ByteBuffer buf) throws SSLException {
// append buf to inNetBuffer
if (inNetBuffer == null) {
inNetBuffer = allocator.wrap(allocator.allocate(buf.remaining())).setAutoExpander(allocator);
}
inNetBuffer.put(buf);
if (!handshakeComplete) {
handshake(nextFilter);
}
// Application data will be in the same message as the handshake
// during False Start
if (handshakeComplete) {
decrypt(nextFilter);
}
if (isInboundDone()) {
// Rewind the MINA buffer if not all data is processed and inbound is finished.
int inNetBufferPosition = inNetBuffer == null? 0 : inNetBuffer.position();
buf.position(buf.position() - inNetBufferPosition);
inNetBuffer = null;
}
} | java | public void messageReceived(NextFilter nextFilter, ByteBuffer buf) throws SSLException {
// append buf to inNetBuffer
if (inNetBuffer == null) {
inNetBuffer = allocator.wrap(allocator.allocate(buf.remaining())).setAutoExpander(allocator);
}
inNetBuffer.put(buf);
if (!handshakeComplete) {
handshake(nextFilter);
}
// Application data will be in the same message as the handshake
// during False Start
if (handshakeComplete) {
decrypt(nextFilter);
}
if (isInboundDone()) {
// Rewind the MINA buffer if not all data is processed and inbound is finished.
int inNetBufferPosition = inNetBuffer == null? 0 : inNetBuffer.position();
buf.position(buf.position() - inNetBufferPosition);
inNetBuffer = null;
}
} | [
"public",
"void",
"messageReceived",
"(",
"NextFilter",
"nextFilter",
",",
"ByteBuffer",
"buf",
")",
"throws",
"SSLException",
"{",
"// append buf to inNetBuffer",
"if",
"(",
"inNetBuffer",
"==",
"null",
")",
"{",
"inNetBuffer",
"=",
"allocator",
".",
"wrap",
"(",... | Call when data read from net. Will perform inial hanshake or decrypt provided
Buffer.
Decrytpted data reurned by getAppBuffer(), if any.
@param buf buffer to decrypt
@param nextFilter Next filter in chain
@throws SSLException on errors | [
"Call",
"when",
"data",
"read",
"from",
"net",
".",
"Will",
"perform",
"inial",
"hanshake",
"or",
"decrypt",
"provided",
"Buffer",
".",
"Decrytpted",
"data",
"reurned",
"by",
"getAppBuffer",
"()",
"if",
"any",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ssl/src/main/java/org/kaazing/gateway/transport/ssl/bridge/filter/SslHandler.java#L379-L402 |
knowm/XChange | xchange-kraken/src/main/java/org/knowm/xchange/kraken/service/KrakenAccountServiceRaw.java | KrakenAccountServiceRaw.getKrakenLedgerInfo | public Map<String, KrakenLedger> getKrakenLedgerInfo() throws IOException {
return getKrakenLedgerInfo(null, null, null, null);
} | java | public Map<String, KrakenLedger> getKrakenLedgerInfo() throws IOException {
return getKrakenLedgerInfo(null, null, null, null);
} | [
"public",
"Map",
"<",
"String",
",",
"KrakenLedger",
">",
"getKrakenLedgerInfo",
"(",
")",
"throws",
"IOException",
"{",
"return",
"getKrakenLedgerInfo",
"(",
"null",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | Retrieves the full account Ledger which represents all account asset activity.
@return
@throws IOException | [
"Retrieves",
"the",
"full",
"account",
"Ledger",
"which",
"represents",
"all",
"account",
"asset",
"activity",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-kraken/src/main/java/org/knowm/xchange/kraken/service/KrakenAccountServiceRaw.java#L188-L191 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java | PostConditionException.validateEqualTo | public static void validateEqualTo( long value, long condition, String identifier )
throws PostConditionException
{
if( value == condition )
{
return;
}
throw new PostConditionException( identifier + " was not equal to " + condition + ". Was: " + value );
} | java | public static void validateEqualTo( long value, long condition, String identifier )
throws PostConditionException
{
if( value == condition )
{
return;
}
throw new PostConditionException( identifier + " was not equal to " + condition + ". Was: " + value );
} | [
"public",
"static",
"void",
"validateEqualTo",
"(",
"long",
"value",
",",
"long",
"condition",
",",
"String",
"identifier",
")",
"throws",
"PostConditionException",
"{",
"if",
"(",
"value",
"==",
"condition",
")",
"{",
"return",
";",
"}",
"throw",
"new",
"Po... | Validates that the value under test is a particular value.
This method ensures that <code>value == condition</code>.
@param identifier The name of the object.
@param condition The condition value.
@param value The value to be tested.
@throws PostConditionException if the condition is not met. | [
"Validates",
"that",
"the",
"value",
"under",
"test",
"is",
"a",
"particular",
"value",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/PostConditionException.java#L212-L220 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/parse/cky/intdata/IntNaryTree.java | IntNaryTree.leftBinarize | public IntBinaryTree leftBinarize(IntObjectBimap<String> ntAlphabet) {
IntObjectBimap<String> alphabet = isLexical ? this.alphabet : ntAlphabet;
// Reset the symbol id according to the new alphabet.
int symbol = alphabet.lookupIndex(getSymbolLabel());
IntBinaryTree leftChild;
IntBinaryTree rightChild;
if (isLeaf()) {
leftChild = null;
rightChild = null;
} else if (children.size() == 1) {
leftChild = children.get(0).leftBinarize(ntAlphabet);
rightChild = null;
} else if (children.size() == 2) {
leftChild = children.get(0).leftBinarize(ntAlphabet);
rightChild = children.get(1).leftBinarize(ntAlphabet);
} else {
// Define the label of the new parent node as in the Berkeley grammar.
int xbarParent = alphabet.lookupIndex(GrammarConstants
.getBinarizedTag(getSymbolStr()));
LinkedList<IntNaryTree> queue = new LinkedList<IntNaryTree>(children);
// Start by binarizing the left-most child, and store as L.
leftChild = queue.removeFirst().leftBinarize(ntAlphabet);
while (true) {
// Working left-to-right, remove and binarize the next-left-most child, and store as R.
rightChild = queue.removeFirst().leftBinarize(ntAlphabet);
// Break once we've acquired the right-most child.
if (queue.isEmpty()) {
break;
}
// Then form a new binary node that has left/right children: L and R.
// That is, a node (@symbolStr --> (L) (R)).
// Store this new node as L and repeat.
leftChild = new IntBinaryTree(xbarParent, leftChild.getStart(),
rightChild.getEnd(), leftChild, rightChild, isLexical,
alphabet);
}
}
return new IntBinaryTree(symbol, start, end, leftChild, rightChild , isLexical, alphabet);
} | java | public IntBinaryTree leftBinarize(IntObjectBimap<String> ntAlphabet) {
IntObjectBimap<String> alphabet = isLexical ? this.alphabet : ntAlphabet;
// Reset the symbol id according to the new alphabet.
int symbol = alphabet.lookupIndex(getSymbolLabel());
IntBinaryTree leftChild;
IntBinaryTree rightChild;
if (isLeaf()) {
leftChild = null;
rightChild = null;
} else if (children.size() == 1) {
leftChild = children.get(0).leftBinarize(ntAlphabet);
rightChild = null;
} else if (children.size() == 2) {
leftChild = children.get(0).leftBinarize(ntAlphabet);
rightChild = children.get(1).leftBinarize(ntAlphabet);
} else {
// Define the label of the new parent node as in the Berkeley grammar.
int xbarParent = alphabet.lookupIndex(GrammarConstants
.getBinarizedTag(getSymbolStr()));
LinkedList<IntNaryTree> queue = new LinkedList<IntNaryTree>(children);
// Start by binarizing the left-most child, and store as L.
leftChild = queue.removeFirst().leftBinarize(ntAlphabet);
while (true) {
// Working left-to-right, remove and binarize the next-left-most child, and store as R.
rightChild = queue.removeFirst().leftBinarize(ntAlphabet);
// Break once we've acquired the right-most child.
if (queue.isEmpty()) {
break;
}
// Then form a new binary node that has left/right children: L and R.
// That is, a node (@symbolStr --> (L) (R)).
// Store this new node as L and repeat.
leftChild = new IntBinaryTree(xbarParent, leftChild.getStart(),
rightChild.getEnd(), leftChild, rightChild, isLexical,
alphabet);
}
}
return new IntBinaryTree(symbol, start, end, leftChild, rightChild , isLexical, alphabet);
} | [
"public",
"IntBinaryTree",
"leftBinarize",
"(",
"IntObjectBimap",
"<",
"String",
">",
"ntAlphabet",
")",
"{",
"IntObjectBimap",
"<",
"String",
">",
"alphabet",
"=",
"isLexical",
"?",
"this",
".",
"alphabet",
":",
"ntAlphabet",
";",
"// Reset the symbol id according ... | Get a left-binarized form of this tree.
This returns a binarized form that relabels the nodes just as in the
Berkeley parser.
@param ntAlphabet The alphabet to use for the non-lexical nodes. | [
"Get",
"a",
"left",
"-",
"binarized",
"form",
"of",
"this",
"tree",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/cky/intdata/IntNaryTree.java#L353-L393 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/neuralnetwork/regularizers/Max2NormRegularizer.java | Max2NormRegularizer.setMaxNorm | public void setMaxNorm(double maxNorm)
{
if(Double.isNaN(maxNorm) || Double.isInfinite(maxNorm) || maxNorm <= 0)
throw new IllegalArgumentException("The maximum norm must be a positive constant, not " + maxNorm);
this.maxNorm = maxNorm;
} | java | public void setMaxNorm(double maxNorm)
{
if(Double.isNaN(maxNorm) || Double.isInfinite(maxNorm) || maxNorm <= 0)
throw new IllegalArgumentException("The maximum norm must be a positive constant, not " + maxNorm);
this.maxNorm = maxNorm;
} | [
"public",
"void",
"setMaxNorm",
"(",
"double",
"maxNorm",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"maxNorm",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"maxNorm",
")",
"||",
"maxNorm",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",... | Sets the maximum allowed 2 norm for a single neuron's weights
@param maxNorm the maximum norm per neuron's weights | [
"Sets",
"the",
"maximum",
"allowed",
"2",
"norm",
"for",
"a",
"single",
"neuron",
"s",
"weights"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/neuralnetwork/regularizers/Max2NormRegularizer.java#L34-L39 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createSecurityGroup | public CreateSecurityGroupResponse createSecurityGroup(CreateSecurityGroupRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
checkStringNotEmpty(request.getName(), "request name should not be empty.");
if (null == request.getRules() || request.getRules().isEmpty()) {
throw new IllegalArgumentException("request rules should not be empty");
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, SECURITYGROUP_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateSecurityGroupResponse.class);
} | java | public CreateSecurityGroupResponse createSecurityGroup(CreateSecurityGroupRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
checkStringNotEmpty(request.getName(), "request name should not be empty.");
if (null == request.getRules() || request.getRules().isEmpty()) {
throw new IllegalArgumentException("request rules should not be empty");
}
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, SECURITYGROUP_PREFIX);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
return invokeHttpClient(internalRequest, CreateSecurityGroupResponse.class);
} | [
"public",
"CreateSecurityGroupResponse",
"createSecurityGroup",
"(",
"CreateSecurityGroupRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"request",
".",
"ge... | Creating a newly SecurityGroup with specified rules.
@param request The request containing all options for creating a new SecurityGroup.
@return The response with the id of SecurityGroup that was created newly. | [
"Creating",
"a",
"newly",
"SecurityGroup",
"with",
"specified",
"rules",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1524-L1537 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/config/Schema.java | Schema.getId | public UUID getId(String ksName, String cfName)
{
return cfIdMap.get(Pair.create(ksName, cfName));
} | java | public UUID getId(String ksName, String cfName)
{
return cfIdMap.get(Pair.create(ksName, cfName));
} | [
"public",
"UUID",
"getId",
"(",
"String",
"ksName",
",",
"String",
"cfName",
")",
"{",
"return",
"cfIdMap",
".",
"get",
"(",
"Pair",
".",
"create",
"(",
"ksName",
",",
"cfName",
")",
")",
";",
"}"
] | Lookup keyspace/ColumnFamily identifier
@param ksName The keyspace name
@param cfName The ColumnFamily name
@return The id for the given (ksname,cfname) pair, or null if it has been dropped. | [
"Lookup",
"keyspace",
"/",
"ColumnFamily",
"identifier"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/config/Schema.java#L321-L324 |
livetribe/livetribe-slp | core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java | StandardDirectoryAgentServer.handleUDPSrvDeReg | protected void handleUDPSrvDeReg(SrvDeReg srvDeReg, InetSocketAddress localAddress, InetSocketAddress remoteAddress)
{
try
{
boolean update = srvDeReg.isUpdating();
ServiceInfo service = ServiceInfo.from(srvDeReg);
uncacheService(service, update);
udpSrvAck.perform(localAddress, remoteAddress, srvDeReg, SLPError.NO_ERROR);
}
catch (ServiceLocationException x)
{
udpSrvAck.perform(localAddress, remoteAddress, srvDeReg, x.getSLPError());
}
} | java | protected void handleUDPSrvDeReg(SrvDeReg srvDeReg, InetSocketAddress localAddress, InetSocketAddress remoteAddress)
{
try
{
boolean update = srvDeReg.isUpdating();
ServiceInfo service = ServiceInfo.from(srvDeReg);
uncacheService(service, update);
udpSrvAck.perform(localAddress, remoteAddress, srvDeReg, SLPError.NO_ERROR);
}
catch (ServiceLocationException x)
{
udpSrvAck.perform(localAddress, remoteAddress, srvDeReg, x.getSLPError());
}
} | [
"protected",
"void",
"handleUDPSrvDeReg",
"(",
"SrvDeReg",
"srvDeReg",
",",
"InetSocketAddress",
"localAddress",
",",
"InetSocketAddress",
"remoteAddress",
")",
"{",
"try",
"{",
"boolean",
"update",
"=",
"srvDeReg",
".",
"isUpdating",
"(",
")",
";",
"ServiceInfo",
... | Handles unicast UDP SrvDeReg message arrived to this directory agent.
<br />
This directory agent will reply with an acknowledge containing the result of the deregistration.
@param srvDeReg the SrvDeReg message to handle
@param localAddress the socket address the message arrived to
@param remoteAddress the socket address the message was sent from | [
"Handles",
"unicast",
"UDP",
"SrvDeReg",
"message",
"arrived",
"to",
"this",
"directory",
"agent",
".",
"<br",
"/",
">",
"This",
"directory",
"agent",
"will",
"reply",
"with",
"an",
"acknowledge",
"containing",
"the",
"result",
"of",
"the",
"deregistration",
"... | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L571-L584 |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableMenuOverlay.java | ExpandableMenuOverlay.onLayout | @Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
if (mAdjustViewSize) {
if (!(getParent() instanceof RelativeLayout)) {
throw new IllegalStateException("Only RelativeLayout is supported as parent of this view");
}
final int sWidth = ScreenHelper.getScreenWidth(getContext());
final int sHeight = ScreenHelper.getScreenHeight(getContext());
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
params.width = (int) (sWidth * mButtonMenu.getMainButtonSize());
params.height = (int) (sWidth * mButtonMenu.getMainButtonSize());
params.setMargins(0, 0, 0, (int) (sHeight * mButtonMenu.getBottomPadding()));
}
} | java | @Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
if (mAdjustViewSize) {
if (!(getParent() instanceof RelativeLayout)) {
throw new IllegalStateException("Only RelativeLayout is supported as parent of this view");
}
final int sWidth = ScreenHelper.getScreenWidth(getContext());
final int sHeight = ScreenHelper.getScreenHeight(getContext());
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
params.width = (int) (sWidth * mButtonMenu.getMainButtonSize());
params.height = (int) (sWidth * mButtonMenu.getMainButtonSize());
params.setMargins(0, 0, 0, (int) (sHeight * mButtonMenu.getBottomPadding()));
}
} | [
"@",
"Override",
"protected",
"void",
"onLayout",
"(",
"boolean",
"changed",
",",
"int",
"l",
",",
"int",
"t",
",",
"int",
"r",
",",
"int",
"b",
")",
"{",
"super",
".",
"onLayout",
"(",
"changed",
",",
"l",
",",
"t",
",",
"r",
",",
"b",
")",
";... | Adjusts size of this view to match the underlying button menu. This allows
a smooth transition between this view and the close button behind it. | [
"Adjusts",
"size",
"of",
"this",
"view",
"to",
"match",
"the",
"underlying",
"button",
"menu",
".",
"This",
"allows",
"a",
"smooth",
"transition",
"between",
"this",
"view",
"and",
"the",
"close",
"button",
"behind",
"it",
"."
] | train | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableMenuOverlay.java#L163-L181 |
rundeck/rundeck | rundeckapp/src/main/groovy/com/dtolabs/rundeck/core/utils/Utility.java | Utility.seekBack | public static long seekBack(File f, int count, String marker) throws IOException {
return seekBack(f, count, marker, null);
} | java | public static long seekBack(File f, int count, String marker) throws IOException {
return seekBack(f, count, marker, null);
} | [
"public",
"static",
"long",
"seekBack",
"(",
"File",
"f",
",",
"int",
"count",
",",
"String",
"marker",
")",
"throws",
"IOException",
"{",
"return",
"seekBack",
"(",
"f",
",",
"count",
",",
"marker",
",",
"null",
")",
";",
"}"
] | seekBack searches backwards for certain markers in a file, and returns position of the final marker found.
count specifies how many markers to search for. if the search reaches the beginning of the file without finding
all of the markers, then 0 is returned.
@param f the file to search
@param count number of markers to find
@param marker text string marker
@return location of marker number <i>count</i> found from the end of the file, or 0
@throws IOException | [
"seekBack",
"searches",
"backwards",
"for",
"certain",
"markers",
"in",
"a",
"file",
"and",
"returns",
"position",
"of",
"the",
"final",
"marker",
"found",
".",
"count",
"specifies",
"how",
"many",
"markers",
"to",
"search",
"for",
".",
"if",
"the",
"search"... | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeckapp/src/main/groovy/com/dtolabs/rundeck/core/utils/Utility.java#L49-L51 |
zeromq/jeromq | src/main/java/org/zeromq/ZProxy.java | ZProxy.newProxy | public static ZProxy newProxy(ZContext ctx, String name, Proxy sockets, String motdelafin, Object... args)
{
return new ZProxy(ctx, name, sockets, new ZmqPump(), motdelafin, args);
} | java | public static ZProxy newProxy(ZContext ctx, String name, Proxy sockets, String motdelafin, Object... args)
{
return new ZProxy(ctx, name, sockets, new ZmqPump(), motdelafin, args);
} | [
"public",
"static",
"ZProxy",
"newProxy",
"(",
"ZContext",
"ctx",
",",
"String",
"name",
",",
"Proxy",
"sockets",
",",
"String",
"motdelafin",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ZProxy",
"(",
"ctx",
",",
"name",
",",
"sockets",
","... | Creates a new low-level proxy for better performances.
@param ctx the context used for the proxy.
Possibly null, in this case a new context will be created and automatically destroyed afterwards.
@param name the name of the proxy. Possibly null.
@param sockets the sockets creator of the proxy. Not null.
@param motdelafin the final word used to mark the end of the proxy. Null to disable this mechanism.
@param args an optional array of arguments that will be passed at the creation.
@return the created proxy. | [
"Creates",
"a",
"new",
"low",
"-",
"level",
"proxy",
"for",
"better",
"performances",
"."
] | train | https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZProxy.java#L299-L302 |
structlogging/structlogger | structlogger/src/main/java/com/github/structlogging/processor/LogInvocationScanner.java | LogInvocationScanner.visitExpressionStatement | @Override
public Object visitExpressionStatement(final ExpressionStatementTree node, final ScannerParams scannerParams) {
final JCTree.JCExpressionStatement statement = (JCTree.JCExpressionStatement) getCurrentPath().getLeaf();
final StatementInfo statementInfo = new StatementInfo(
scannerParams.getCompilationUnitTree().getLineMap().getLineNumber(statement.pos),
scannerParams.getTypeElement().getQualifiedName().toString(),
statement
);
//inner scanner to go through statement methods
final TreePathScanner scanner = new TreePathScanner<Object, ScannerParams>() {
Stack<MethodAndParameter> stack = new Stack<>();
@Override
public Object visitMethodInvocation(final MethodInvocationTree node, final ScannerParams o) {
if (node.getMethodSelect() instanceof JCTree.JCFieldAccess) { // if is call on field
try {
final JCTree.JCFieldAccess methodSelect = (JCTree.JCFieldAccess) node.getMethodSelect();
ExpressionTree parameter = null;
if (!node.getArguments().isEmpty()) {
parameter = node.getArguments().get(0);
}
// each method invocation on field is added to stack
stack.add(new MethodAndParameter(methodSelect.name, parameter));
handle(methodSelect, stack, node, statementInfo, scannerParams);
} catch (Exception e) {
e.printStackTrace();
}
}
return super.visitMethodInvocation(node, o);
}
};
scanner.scan(getCurrentPath(), scannerParams);
return super.visitExpressionStatement(node, scannerParams);
} | java | @Override
public Object visitExpressionStatement(final ExpressionStatementTree node, final ScannerParams scannerParams) {
final JCTree.JCExpressionStatement statement = (JCTree.JCExpressionStatement) getCurrentPath().getLeaf();
final StatementInfo statementInfo = new StatementInfo(
scannerParams.getCompilationUnitTree().getLineMap().getLineNumber(statement.pos),
scannerParams.getTypeElement().getQualifiedName().toString(),
statement
);
//inner scanner to go through statement methods
final TreePathScanner scanner = new TreePathScanner<Object, ScannerParams>() {
Stack<MethodAndParameter> stack = new Stack<>();
@Override
public Object visitMethodInvocation(final MethodInvocationTree node, final ScannerParams o) {
if (node.getMethodSelect() instanceof JCTree.JCFieldAccess) { // if is call on field
try {
final JCTree.JCFieldAccess methodSelect = (JCTree.JCFieldAccess) node.getMethodSelect();
ExpressionTree parameter = null;
if (!node.getArguments().isEmpty()) {
parameter = node.getArguments().get(0);
}
// each method invocation on field is added to stack
stack.add(new MethodAndParameter(methodSelect.name, parameter));
handle(methodSelect, stack, node, statementInfo, scannerParams);
} catch (Exception e) {
e.printStackTrace();
}
}
return super.visitMethodInvocation(node, o);
}
};
scanner.scan(getCurrentPath(), scannerParams);
return super.visitExpressionStatement(node, scannerParams);
} | [
"@",
"Override",
"public",
"Object",
"visitExpressionStatement",
"(",
"final",
"ExpressionStatementTree",
"node",
",",
"final",
"ScannerParams",
"scannerParams",
")",
"{",
"final",
"JCTree",
".",
"JCExpressionStatement",
"statement",
"=",
"(",
"JCTree",
".",
"JCExpres... | Checks expressions, if expression is method call on {@link StructLogger} field, it is considered structured log statement and is
expression is transformed in such way, that method chain is replaced with one call to corresponding infoEvent, errorEvent,... method
with instance of generated class of Event based on method chain | [
"Checks",
"expressions",
"if",
"expression",
"is",
"method",
"call",
"on",
"{"
] | train | https://github.com/structlogging/structlogger/blob/1fcca4e962ef53cbdb94bd72cb556de7f5f9469f/structlogger/src/main/java/com/github/structlogging/processor/LogInvocationScanner.java#L101-L141 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/AbstractRemoteTransport.java | AbstractRemoteTransport.localDoWork | public void localDoWork(Address address, DistributableWork work) throws WorkException
{
if (trace)
log.tracef("LOCAL_DO_WORK(%s, %s)", address, work);
DistributedWorkManager dwm = workManagerCoordinator.resolveDistributedWorkManager(address);
dwm.localDoWork(work);
} | java | public void localDoWork(Address address, DistributableWork work) throws WorkException
{
if (trace)
log.tracef("LOCAL_DO_WORK(%s, %s)", address, work);
DistributedWorkManager dwm = workManagerCoordinator.resolveDistributedWorkManager(address);
dwm.localDoWork(work);
} | [
"public",
"void",
"localDoWork",
"(",
"Address",
"address",
",",
"DistributableWork",
"work",
")",
"throws",
"WorkException",
"{",
"if",
"(",
"trace",
")",
"log",
".",
"tracef",
"(",
"\"LOCAL_DO_WORK(%s, %s)\"",
",",
"address",
",",
"work",
")",
";",
"Distribu... | localDoWork
@param address the logical address
@param work the work
@throws WorkException in case of error | [
"localDoWork"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/AbstractRemoteTransport.java#L816-L824 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/datastyle/NumberStyleHelper.java | NumberStyleHelper.appendGroupingAttribute | private void appendGroupingAttribute(final XMLUtil util, final Appendable appendable) throws IOException {
if (this.grouping) util.appendAttribute(appendable, "number:grouping", "true");
} | java | private void appendGroupingAttribute(final XMLUtil util, final Appendable appendable) throws IOException {
if (this.grouping) util.appendAttribute(appendable, "number:grouping", "true");
} | [
"private",
"void",
"appendGroupingAttribute",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"Appendable",
"appendable",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"grouping",
")",
"util",
".",
"appendAttribute",
"(",
"appendable",
",",
"\"number... | Append the 19.348 number:grouping attribute. Default = false.
@param util a util for XML writing
@param appendable where to write
@throws IOException If an I/O error occurs | [
"Append",
"the",
"19",
".",
"348",
"number",
":",
"grouping",
"attribute",
".",
"Default",
"=",
"false",
"."
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/datastyle/NumberStyleHelper.java#L104-L106 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.initialiseSocketClient | public SocketController initialiseSocketClient(@NonNull SessionController sessionController, ListenerListAdapter listener, APIConfig.BaseURIs baseURIs) {
SocketController socketController = new SocketController(dataMgr, listener, log, baseURIs.getSocket(), baseURIs.getProxy());
sessionController.setSocketController(socketController);
if (isSessionValid()) {
socketController.connectSocket();
}
return socketController;
} | java | public SocketController initialiseSocketClient(@NonNull SessionController sessionController, ListenerListAdapter listener, APIConfig.BaseURIs baseURIs) {
SocketController socketController = new SocketController(dataMgr, listener, log, baseURIs.getSocket(), baseURIs.getProxy());
sessionController.setSocketController(socketController);
if (isSessionValid()) {
socketController.connectSocket();
}
return socketController;
} | [
"public",
"SocketController",
"initialiseSocketClient",
"(",
"@",
"NonNull",
"SessionController",
"sessionController",
",",
"ListenerListAdapter",
"listener",
",",
"APIConfig",
".",
"BaseURIs",
"baseURIs",
")",
"{",
"SocketController",
"socketController",
"=",
"new",
"Soc... | Initialise client for managing socket connections.
@param sessionController Controller for creating and managing session.
@param listener Listener for socket events.
@param baseURIs APIs baseURIs.
@return Client for managing socket connections. | [
"Initialise",
"client",
"for",
"managing",
"socket",
"connections",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L169-L176 |
tomgibara/bits | src/main/java/com/tomgibara/bits/Bits.java | Bits.readerFrom | public static BitReader readerFrom(byte[] bytes, long size) {
if (bytes == null) throw new IllegalArgumentException("null bytes");
checkSize(size, ((long) bytes.length) << 3);
return new ByteArrayBitReader(bytes, size);
} | java | public static BitReader readerFrom(byte[] bytes, long size) {
if (bytes == null) throw new IllegalArgumentException("null bytes");
checkSize(size, ((long) bytes.length) << 3);
return new ByteArrayBitReader(bytes, size);
} | [
"public",
"static",
"BitReader",
"readerFrom",
"(",
"byte",
"[",
"]",
"bytes",
",",
"long",
"size",
")",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null bytes\"",
")",
";",
"checkSize",
"(",
"size",
",",... | A {@link BitReader} that sources its bits from an array of bytes. Bits are
read from the byte array starting at index zero. Within each byte, the
most significant bits are read first.
@param bytes
the source bytes
@param size
the number of bits that may be read, not negative and no
greater than the number of bits supplied by the array
@return a bit reader over the bytes | [
"A",
"{",
"@link",
"BitReader",
"}",
"that",
"sources",
"its",
"bits",
"from",
"an",
"array",
"of",
"bytes",
".",
"Bits",
"are",
"read",
"from",
"the",
"byte",
"array",
"starting",
"at",
"index",
"zero",
".",
"Within",
"each",
"byte",
"the",
"most",
"s... | train | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L725-L729 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/automata/transducers/MealyFilter.java | MealyFilter.retainTransitionsWithOutput | @SafeVarargs
public static <I, O> CompactMealy<I, O> retainTransitionsWithOutput(MealyMachine<?, I, ?, O> in,
Alphabet<I> inputs,
O... outputs) {
return retainTransitionsWithOutput(in, inputs, Arrays.asList(outputs));
} | java | @SafeVarargs
public static <I, O> CompactMealy<I, O> retainTransitionsWithOutput(MealyMachine<?, I, ?, O> in,
Alphabet<I> inputs,
O... outputs) {
return retainTransitionsWithOutput(in, inputs, Arrays.asList(outputs));
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"I",
",",
"O",
">",
"CompactMealy",
"<",
"I",
",",
"O",
">",
"retainTransitionsWithOutput",
"(",
"MealyMachine",
"<",
"?",
",",
"I",
",",
"?",
",",
"O",
">",
"in",
",",
"Alphabet",
"<",
"I",
">",
"inputs",... | Returns a Mealy machine with all transitions removed that have an output not among the specified values. The
resulting Mealy machine will not contain any unreachable states.
<p>
This is a convenience varargs overload of {@link #retainTransitionsWithOutput(MealyMachine, Alphabet,
Collection)}.
@param in
the input Mealy machine
@param inputs
the input alphabet
@param outputs
the outputs to retain
@return a Mealy machine with all transitions retained that have one of the specified outputs. | [
"Returns",
"a",
"Mealy",
"machine",
"with",
"all",
"transitions",
"removed",
"that",
"have",
"an",
"output",
"not",
"among",
"the",
"specified",
"values",
".",
"The",
"resulting",
"Mealy",
"machine",
"will",
"not",
"contain",
"any",
"unreachable",
"states",
".... | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/transducers/MealyFilter.java#L118-L123 |
infinispan/infinispan | core/src/main/java/org/infinispan/distribution/ch/impl/AbstractConsistentHash.java | AbstractConsistentHash.mergeLists | protected static void mergeLists(List<Address> dest, List<Address> src) {
for (Address node : src) {
if (!dest.contains(node)) {
dest.add(node);
}
}
} | java | protected static void mergeLists(List<Address> dest, List<Address> src) {
for (Address node : src) {
if (!dest.contains(node)) {
dest.add(node);
}
}
} | [
"protected",
"static",
"void",
"mergeLists",
"(",
"List",
"<",
"Address",
">",
"dest",
",",
"List",
"<",
"Address",
">",
"src",
")",
"{",
"for",
"(",
"Address",
"node",
":",
"src",
")",
"{",
"if",
"(",
"!",
"dest",
".",
"contains",
"(",
"node",
")"... | Adds all elements from <code>src</code> list that do not already exist in <code>dest</code> list to the latter.
@param dest List where elements are added
@param src List of elements to add - this is never modified | [
"Adds",
"all",
"elements",
"from",
"<code",
">",
"src<",
"/",
"code",
">",
"list",
"that",
"do",
"not",
"already",
"exist",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
"list",
"to",
"the",
"latter",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/distribution/ch/impl/AbstractConsistentHash.java#L139-L145 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newAssertionException | public static AssertionException newAssertionException(String message, Object... args) {
return newAssertionException(null, message, args);
} | java | public static AssertionException newAssertionException(String message, Object... args) {
return newAssertionException(null, message, args);
} | [
"public",
"static",
"AssertionException",
"newAssertionException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newAssertionException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link AssertionException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link AssertionException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link AssertionException} with the given {@link String message}.
@see #newAssertionException(Throwable, String, Object...)
@see org.cp.elements.lang.AssertionException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"AssertionException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L243-L245 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzleStatement.java | DrizzleStatement.getMoreResults | public boolean getMoreResults() throws SQLException {
startTimer();
try {
if (queryResult != null) {
queryResult.close();
}
queryResult = protocol.getMoreResults();
if(queryResult == null) {
this.resultSet=null;
setUpdateCount(-1);
return false;
}
warningsCleared = false;
if (queryResult.getResultSetType() == ResultSetType.SELECT) {
setResultSet(new DrizzleResultSet(queryResult, this, getProtocol()));
return true;
}
setUpdateCount((int)((ModifyQueryResult) queryResult).getUpdateCount());
return false;
} catch (QueryException e) {
throw SQLExceptionMapper.get(e);
} finally {
stopTimer();
}
} | java | public boolean getMoreResults() throws SQLException {
startTimer();
try {
if (queryResult != null) {
queryResult.close();
}
queryResult = protocol.getMoreResults();
if(queryResult == null) {
this.resultSet=null;
setUpdateCount(-1);
return false;
}
warningsCleared = false;
if (queryResult.getResultSetType() == ResultSetType.SELECT) {
setResultSet(new DrizzleResultSet(queryResult, this, getProtocol()));
return true;
}
setUpdateCount((int)((ModifyQueryResult) queryResult).getUpdateCount());
return false;
} catch (QueryException e) {
throw SQLExceptionMapper.get(e);
} finally {
stopTimer();
}
} | [
"public",
"boolean",
"getMoreResults",
"(",
")",
"throws",
"SQLException",
"{",
"startTimer",
"(",
")",
";",
"try",
"{",
"if",
"(",
"queryResult",
"!=",
"null",
")",
"{",
"queryResult",
".",
"close",
"(",
")",
";",
"}",
"queryResult",
"=",
"protocol",
".... | Moves to this <code>Statement</code> object's next result, returns <code>true</code> if it is a
<code>ResultSet</code> object, and implicitly closes any current <code>ResultSet</code> object(s) obtained with
the method <code>getResultSet</code>.
<p/>
<P>There are no more results when the following is true: <PRE> // stmt is a Statement object
((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1)) </PRE>
@return <code>true</code> if the next result is a <code>ResultSet</code> object; <code>false</code> if it is an
update count or there are no more results
@throws java.sql.SQLException if a database access error occurs or this method is called on a closed
<code>Statement</code>
@see #execute | [
"Moves",
"to",
"this",
"<code",
">",
"Statement<",
"/",
"code",
">",
"object",
"s",
"next",
"result",
"returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"it",
"is",
"a",
"<code",
">",
"ResultSet<",
"/",
"code",
">",
"object",
"and",
"implicitly"... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleStatement.java#L760-L785 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.normalizeWindowsNativeFilename | @Pure
public static File normalizeWindowsNativeFilename(String filename) {
final String fn = extractLocalPath(filename);
if (fn != null && fn.length() > 0) {
final Pattern pattern = Pattern.compile(WINDOW_NATIVE_FILENAME_PATTERN);
final Matcher matcher = pattern.matcher(fn);
if (matcher.find()) {
return new File(fn.replace(WINDOWS_SEPARATOR_CHAR, File.separatorChar));
}
}
return null;
} | java | @Pure
public static File normalizeWindowsNativeFilename(String filename) {
final String fn = extractLocalPath(filename);
if (fn != null && fn.length() > 0) {
final Pattern pattern = Pattern.compile(WINDOW_NATIVE_FILENAME_PATTERN);
final Matcher matcher = pattern.matcher(fn);
if (matcher.find()) {
return new File(fn.replace(WINDOWS_SEPARATOR_CHAR, File.separatorChar));
}
}
return null;
} | [
"@",
"Pure",
"public",
"static",
"File",
"normalizeWindowsNativeFilename",
"(",
"String",
"filename",
")",
"{",
"final",
"String",
"fn",
"=",
"extractLocalPath",
"(",
"filename",
")",
";",
"if",
"(",
"fn",
"!=",
"null",
"&&",
"fn",
".",
"length",
"(",
")",... | Normalize the given string contains a Windows® native long filename
and replies a Java-standard version.
<p>Long filenames (LFN), spelled "long file names" by Microsoft Corporation,
are Microsoft's way of implementing filenames longer than the 8.3,
or short-filename, naming scheme used in Microsoft DOS in their modern
FAT and NTFS filesystems. Because these filenames can be longer than the
8.3 filename, they can be more descriptive. Another advantage of this
scheme is that it allows for use of *nix files ending in (e.g. .jpeg,
.tiff, .html, and .xhtml) rather than specialized shortened names
(e.g. .jpg, .tif, .htm, .xht).
<p>The long filename system allows a maximum length of 255 UTF-16 characters,
including spaces and non-alphanumeric characters; excluding the following
characters, which have special meaning within the command interpreter or
the operating system kernel: <code>\</code> <code>/</code> <code>:</code>
<code>*</code> <code>?</code> <code>"</code> <code><</code>
<code>></code> <code>|</code>
@param filename the filename to test.
@return the normalized path or <code>null</code> if not a windows native path.
@see #isWindowsNativeFilename(String) | [
"Normalize",
"the",
"given",
"string",
"contains",
"a",
"Windows®",
";",
"native",
"long",
"filename",
"and",
"replies",
"a",
"Java",
"-",
"standard",
"version",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L2620-L2631 |
google/truth | core/src/main/java/com/google/common/truth/FailureMetadata.java | FailureMetadata.updateForSubject | FailureMetadata updateForSubject(Subject<?, ?> subject) {
ImmutableList<Step> steps = append(this.steps, Step.subjectCreation(subject));
return derive(messages, steps);
} | java | FailureMetadata updateForSubject(Subject<?, ?> subject) {
ImmutableList<Step> steps = append(this.steps, Step.subjectCreation(subject));
return derive(messages, steps);
} | [
"FailureMetadata",
"updateForSubject",
"(",
"Subject",
"<",
"?",
",",
"?",
">",
"subject",
")",
"{",
"ImmutableList",
"<",
"Step",
">",
"steps",
"=",
"append",
"(",
"this",
".",
"steps",
",",
"Step",
".",
"subjectCreation",
"(",
"subject",
")",
")",
";",... | Returns a new instance that includes the given subject in its chain of values. Truth users do
not need to call this method directly; Truth automatically accumulates context, starting from
the initial that(...) call and continuing into any chained calls, like {@link
ThrowableSubject#hasMessageThat}. | [
"Returns",
"a",
"new",
"instance",
"that",
"includes",
"the",
"given",
"subject",
"in",
"its",
"chain",
"of",
"values",
".",
"Truth",
"users",
"do",
"not",
"need",
"to",
"call",
"this",
"method",
"directly",
";",
"Truth",
"automatically",
"accumulates",
"con... | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/FailureMetadata.java#L128-L131 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/ScrollPanePainter.java | ScrollPanePainter.paintBorderEnabled | private void paintBorderEnabled(Graphics2D g, int width, int height) {
Shape s;
s = shapeGenerator.createRoundRectangle(0, 0, width - 1, height - 1, CornerSize.BORDER);
g.setPaint(borderColor);
g.draw(s);
} | java | private void paintBorderEnabled(Graphics2D g, int width, int height) {
Shape s;
s = shapeGenerator.createRoundRectangle(0, 0, width - 1, height - 1, CornerSize.BORDER);
g.setPaint(borderColor);
g.draw(s);
} | [
"private",
"void",
"paintBorderEnabled",
"(",
"Graphics2D",
"g",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Shape",
"s",
";",
"s",
"=",
"shapeGenerator",
".",
"createRoundRectangle",
"(",
"0",
",",
"0",
",",
"width",
"-",
"1",
",",
"height",
... | DOCUMENT ME!
@param g DOCUMENT ME!
@param width DOCUMENT ME!
@param height DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ScrollPanePainter.java#L115-L120 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java | SvgGraphicsContext.drawGroup | public Element drawGroup(Object parent, Object object, String tagName) {
if (isAttached()) {
return helper.drawGroup(parent, object, tagName);
} else {
return null;
}
} | java | public Element drawGroup(Object parent, Object object, String tagName) {
if (isAttached()) {
return helper.drawGroup(parent, object, tagName);
} else {
return null;
}
} | [
"public",
"Element",
"drawGroup",
"(",
"Object",
"parent",
",",
"Object",
"object",
",",
"String",
"tagName",
")",
"{",
"if",
"(",
"isAttached",
"(",
")",
")",
"{",
"return",
"helper",
".",
"drawGroup",
"(",
"parent",
",",
"object",
",",
"tagName",
")",
... | Creates a group element in the technology (SVG/VML/...) of this context with the specified tag name.
@param parent
parent group object
@param object
group object
@param tagName
the tag name
@return element which was drawn | [
"Creates",
"a",
"group",
"element",
"in",
"the",
"technology",
"(",
"SVG",
"/",
"VML",
"/",
"...",
")",
"of",
"this",
"context",
"with",
"the",
"specified",
"tag",
"name",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L194-L200 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.eachLine | public static <T> T eachLine(CharSequence self, @ClosureParams(value=FromString.class, options={"String","String,Integer"}) Closure<T> closure) throws IOException {
return eachLine(self.toString(), 0, closure);
} | java | public static <T> T eachLine(CharSequence self, @ClosureParams(value=FromString.class, options={"String","String,Integer"}) Closure<T> closure) throws IOException {
return eachLine(self.toString(), 0, closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"eachLine",
"(",
"CharSequence",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"String\"",
",",
"\"String,Integer\"",
"}",
")",
"Closure",
"<",
"T",
"... | Iterates through this CharSequence line by line. Each line is passed
to the given 1 or 2 arg closure. If a 2 arg closure is found
the line count is passed as the second argument.
@param self a CharSequence
@param closure a closure
@return the last value returned by the closure
@throws java.io.IOException if an error occurs
@see #eachLine(String, groovy.lang.Closure)
@since 1.8.2 | [
"Iterates",
"through",
"this",
"CharSequence",
"line",
"by",
"line",
".",
"Each",
"line",
"is",
"passed",
"to",
"the",
"given",
"1",
"or",
"2",
"arg",
"closure",
".",
"If",
"a",
"2",
"arg",
"closure",
"is",
"found",
"the",
"line",
"count",
"is",
"passe... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L594-L596 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/util/ProjectUtilities.java | ProjectUtilities.addFindBugsNature | public static void addFindBugsNature(IProject project, IProgressMonitor monitor) throws CoreException {
if (hasFindBugsNature(project)) {
return;
}
IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds();
for (int i = 0; i < prevNatures.length; i++) {
if (FindbugsPlugin.NATURE_ID.equals(prevNatures[i])) {
// nothing to do
return;
}
}
String[] newNatures = new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
newNatures[prevNatures.length] = FindbugsPlugin.NATURE_ID;
if (DEBUG) {
for (int i = 0; i < newNatures.length; i++) {
System.out.println(newNatures[i]);
}
}
description.setNatureIds(newNatures);
project.setDescription(description, monitor);
} | java | public static void addFindBugsNature(IProject project, IProgressMonitor monitor) throws CoreException {
if (hasFindBugsNature(project)) {
return;
}
IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds();
for (int i = 0; i < prevNatures.length; i++) {
if (FindbugsPlugin.NATURE_ID.equals(prevNatures[i])) {
// nothing to do
return;
}
}
String[] newNatures = new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
newNatures[prevNatures.length] = FindbugsPlugin.NATURE_ID;
if (DEBUG) {
for (int i = 0; i < newNatures.length; i++) {
System.out.println(newNatures[i]);
}
}
description.setNatureIds(newNatures);
project.setDescription(description, monitor);
} | [
"public",
"static",
"void",
"addFindBugsNature",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"hasFindBugsNature",
"(",
"project",
")",
")",
"{",
"return",
";",
"}",
"IProjectDescription",
"descrip... | Adds a FindBugs nature to a project.
@param project
The project the nature will be applied to.
@param monitor
A progress monitor. Must not be null.
@throws CoreException | [
"Adds",
"a",
"FindBugs",
"nature",
"to",
"a",
"project",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/util/ProjectUtilities.java#L56-L79 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/EventCollector.java | EventCollector.addEvent | private void addEvent(JobID jobID, AbstractEvent event) {
synchronized (this.collectedEvents) {
List<AbstractEvent> eventList = this.collectedEvents.get(jobID);
if (eventList == null) {
eventList = new ArrayList<AbstractEvent>();
this.collectedEvents.put(jobID, eventList);
}
eventList.add(event);
}
} | java | private void addEvent(JobID jobID, AbstractEvent event) {
synchronized (this.collectedEvents) {
List<AbstractEvent> eventList = this.collectedEvents.get(jobID);
if (eventList == null) {
eventList = new ArrayList<AbstractEvent>();
this.collectedEvents.put(jobID, eventList);
}
eventList.add(event);
}
} | [
"private",
"void",
"addEvent",
"(",
"JobID",
"jobID",
",",
"AbstractEvent",
"event",
")",
"{",
"synchronized",
"(",
"this",
".",
"collectedEvents",
")",
"{",
"List",
"<",
"AbstractEvent",
">",
"eventList",
"=",
"this",
".",
"collectedEvents",
".",
"get",
"("... | Adds an event to the job's event list.
@param jobID
the ID of the job the event belongs to
@param event
the event to be added to the job's event list | [
"Adds",
"an",
"event",
"to",
"the",
"job",
"s",
"event",
"list",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/EventCollector.java#L407-L419 |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.eachRow | public void eachRow(GString gstring, Closure closure) throws SQLException {
eachRow(gstring, null, closure);
} | java | public void eachRow(GString gstring, Closure closure) throws SQLException {
eachRow(gstring, null, closure);
} | [
"public",
"void",
"eachRow",
"(",
"GString",
"gstring",
",",
"Closure",
"closure",
")",
"throws",
"SQLException",
"{",
"eachRow",
"(",
"gstring",
",",
"null",
",",
"closure",
")",
";",
"}"
] | Performs the given SQL query calling the given Closure with each row of the result set.
The row will be a <code>GroovyResultSet</code> which is a <code>ResultSet</code>
that supports accessing the fields using property style notation and ordinal index values.
The query may contain GString expressions.
<p>
Example usage:
<pre>
def location = 25
sql.eachRow("select * from PERSON where location_id < $location") { row ->
println row.firstname
}
</pre>
<p>
Resource handling is performed automatically where appropriate.
@param gstring a GString containing the SQL query with embedded params
@param closure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs
@see #expand(Object) | [
"Performs",
"the",
"given",
"SQL",
"query",
"calling",
"the",
"given",
"Closure",
"with",
"each",
"row",
"of",
"the",
"result",
"set",
".",
"The",
"row",
"will",
"be",
"a",
"<code",
">",
"GroovyResultSet<",
"/",
"code",
">",
"which",
"is",
"a",
"<code",
... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1600-L1602 |
neoremind/navi | navi-mgr-console/src/main/java/com/baidu/beidou/navimgr/common/handler/GlobalExceptionHandler.java | GlobalExceptionHandler.buildBizError | private ModelAndView buildBizError(ModelAndView mvc, Map<String, Object> paramErrors) {
Map<String, Object> error = new HashMap<String, Object>();
error.put("field", paramErrors);
mvc.addObject("status", GlobalResponseStatusMsg.BIZ_ERROR.getCode());
mvc.addObject("statusInfo", error);
return mvc;
} | java | private ModelAndView buildBizError(ModelAndView mvc, Map<String, Object> paramErrors) {
Map<String, Object> error = new HashMap<String, Object>();
error.put("field", paramErrors);
mvc.addObject("status", GlobalResponseStatusMsg.BIZ_ERROR.getCode());
mvc.addObject("statusInfo", error);
return mvc;
} | [
"private",
"ModelAndView",
"buildBizError",
"(",
"ModelAndView",
"mvc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"paramErrors",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"error",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"... | 构造系统业务错误
@param mvc mvc
@param paramErrors 错误参数
@return mvc | [
"构造系统业务错误"
] | train | https://github.com/neoremind/navi/blob/d37e4b46ef07d124be2740ad3d85d87e939acc84/navi-mgr-console/src/main/java/com/baidu/beidou/navimgr/common/handler/GlobalExceptionHandler.java#L182-L188 |
probedock/probedock-rt-java | src/main/java/io/probedock/rt/client/Connector.java | Connector.notifyStart | public void notifyStart(String projectApiId, String projectVersion, String category) {
try {
if (isStarted()) {
JSONObject startNotification = new JSONObject().
put("project", new JSONObject().
put("apiId", projectApiId).
put("version", projectVersion)
).
put("category", category);
socket.emit("run:start", startNotification);
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the start notification");
}
}
catch (Exception e) {
LOGGER.log(Level.INFO, "Unable to send the start notification to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
} | java | public void notifyStart(String projectApiId, String projectVersion, String category) {
try {
if (isStarted()) {
JSONObject startNotification = new JSONObject().
put("project", new JSONObject().
put("apiId", projectApiId).
put("version", projectVersion)
).
put("category", category);
socket.emit("run:start", startNotification);
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the start notification");
}
}
catch (Exception e) {
LOGGER.log(Level.INFO, "Unable to send the start notification to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
} | [
"public",
"void",
"notifyStart",
"(",
"String",
"projectApiId",
",",
"String",
"projectVersion",
",",
"String",
"category",
")",
"{",
"try",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"JSONObject",
"startNotification",
"=",
"new",
"JSONObject",
"(",
")... | Send a starting notification to the agent
@param projectApiId The project API ID
@param projectVersion The project version
@param category The category | [
"Send",
"a",
"starting",
"notification",
"to",
"the",
"agent"
] | train | https://github.com/probedock/probedock-rt-java/blob/67b44b64303b15eb2d4808f9560a1c9554ccf3ba/src/main/java/io/probedock/rt/client/Connector.java#L62-L85 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/util/Geometry.java | Geometry.findIntersection | public static Point2D findIntersection(final int x, final int y, final MultiPath path)
{
final Point2D pointerPosition = new Point2D(x, y);
final BoundingBox box = path.getBoundingBox();
final Point2D center = findCenter(box);
// length just needs to ensure the c to xy is outside of the path
final double length = box.getWidth() + box.getHeight();
final Point2D projectionPoint = getProjection(center, pointerPosition, length);
final Point2DArray points = new Point2DArray();
points.push(center);
points.push(projectionPoint);
final Set<Point2D>[] intersects = Geometry.getCardinalIntersects(path, points);
Point2D nearest = null;
for (final Set<Point2D> set : intersects)
{
double nearesstDistance = length;
if ((set != null) && !set.isEmpty())
{
for (final Point2D p : set)
{
final double currentDistance = p.distance(pointerPosition);
if (currentDistance < nearesstDistance)
{
nearesstDistance = currentDistance;
nearest = p;
}
}
}
}
return nearest;
} | java | public static Point2D findIntersection(final int x, final int y, final MultiPath path)
{
final Point2D pointerPosition = new Point2D(x, y);
final BoundingBox box = path.getBoundingBox();
final Point2D center = findCenter(box);
// length just needs to ensure the c to xy is outside of the path
final double length = box.getWidth() + box.getHeight();
final Point2D projectionPoint = getProjection(center, pointerPosition, length);
final Point2DArray points = new Point2DArray();
points.push(center);
points.push(projectionPoint);
final Set<Point2D>[] intersects = Geometry.getCardinalIntersects(path, points);
Point2D nearest = null;
for (final Set<Point2D> set : intersects)
{
double nearesstDistance = length;
if ((set != null) && !set.isEmpty())
{
for (final Point2D p : set)
{
final double currentDistance = p.distance(pointerPosition);
if (currentDistance < nearesstDistance)
{
nearesstDistance = currentDistance;
nearest = p;
}
}
}
}
return nearest;
} | [
"public",
"static",
"Point2D",
"findIntersection",
"(",
"final",
"int",
"x",
",",
"final",
"int",
"y",
",",
"final",
"MultiPath",
"path",
")",
"{",
"final",
"Point2D",
"pointerPosition",
"=",
"new",
"Point2D",
"(",
"x",
",",
"y",
")",
";",
"final",
"Boun... | Finds intersecting point from the center of a path
@param x
@param y
@param path
@return the path's intersection point, or null if there's no intersection point | [
"Finds",
"intersecting",
"point",
"from",
"the",
"center",
"of",
"a",
"path"
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/util/Geometry.java#L1624-L1667 |
carewebframework/carewebframework-vista | org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigItem.java | ESigItem.addIssue | public ESigItemIssue addIssue(ESigItemIssueSeverity severity, String description) {
ESigItemIssue issue = new ESigItemIssue(severity, description);
if (issues == null) {
issues = new ArrayList<ESigItemIssue>();
sortIssues = false;
} else {
int i = issues.indexOf(issue);
if (i >= 0) {
return issues.get(i);
}
sortIssues = true;
}
issues.add(issue);
return issue;
} | java | public ESigItemIssue addIssue(ESigItemIssueSeverity severity, String description) {
ESigItemIssue issue = new ESigItemIssue(severity, description);
if (issues == null) {
issues = new ArrayList<ESigItemIssue>();
sortIssues = false;
} else {
int i = issues.indexOf(issue);
if (i >= 0) {
return issues.get(i);
}
sortIssues = true;
}
issues.add(issue);
return issue;
} | [
"public",
"ESigItemIssue",
"addIssue",
"(",
"ESigItemIssueSeverity",
"severity",
",",
"String",
"description",
")",
"{",
"ESigItemIssue",
"issue",
"=",
"new",
"ESigItemIssue",
"(",
"severity",
",",
"description",
")",
";",
"if",
"(",
"issues",
"==",
"null",
")",... | Adds an issue to the signature item.
@param severity Severity of the issue.
@param description Description of the issue.
@return The added issue. | [
"Adds",
"an",
"issue",
"to",
"the",
"signature",
"item",
"."
] | train | https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigItem.java#L334-L352 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.