repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedSasDefinition | public DeletedSasDefinitionBundle getDeletedSasDefinition(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
return getDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).toBlocking().single().body();
} | java | public DeletedSasDefinitionBundle getDeletedSasDefinition(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
return getDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).toBlocking().single().body();
} | [
"public",
"DeletedSasDefinitionBundle",
"getDeletedSasDefinition",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"sasDefinitionName",
")",
"{",
"return",
"getDeletedSasDefinitionWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAc... | Gets the specified deleted sas definition.
The Get Deleted SAS Definition operation returns the specified deleted SAS definition along with its attributes. This operation requires the storage/getsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DeletedSasDefinitionBundle object if successful. | [
"Gets",
"the",
"specified",
"deleted",
"sas",
"definition",
".",
"The",
"Get",
"Deleted",
"SAS",
"Definition",
"operation",
"returns",
"the",
"specified",
"deleted",
"SAS",
"definition",
"along",
"with",
"its",
"attributes",
".",
"This",
"operation",
"requires",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10880-L10882 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/util/MSwingUtilities.java | MSwingUtilities.getScaledInstance | public static ImageIcon getScaledInstance(ImageIcon icon, int targetWidth, int targetHeight) {
return new ImageIcon(getScaledInstance(icon.getImage(), targetWidth, targetHeight));
} | java | public static ImageIcon getScaledInstance(ImageIcon icon, int targetWidth, int targetHeight) {
return new ImageIcon(getScaledInstance(icon.getImage(), targetWidth, targetHeight));
} | [
"public",
"static",
"ImageIcon",
"getScaledInstance",
"(",
"ImageIcon",
"icon",
",",
"int",
"targetWidth",
",",
"int",
"targetHeight",
")",
"{",
"return",
"new",
"ImageIcon",
"(",
"getScaledInstance",
"(",
"icon",
".",
"getImage",
"(",
")",
",",
"targetWidth",
... | Redimensionne une ImageIcon.
@param icon ImageIcon
@param targetWidth int
@param targetHeight int
@return ImageIcon | [
"Redimensionne",
"une",
"ImageIcon",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/util/MSwingUtilities.java#L217-L219 |
m-m-m/util | value/src/main/java/net/sf/mmm/util/value/impl/ComposedValueConverterImpl.java | ComposedValueConverterImpl.addConverter | public void addConverter(ValueConverter<?, ?> converter) {
getInitializationState().requireNotInitilized();
if (this.converters == null) {
this.converters = new ArrayList<>();
}
this.converters.add(converter);
} | java | public void addConverter(ValueConverter<?, ?> converter) {
getInitializationState().requireNotInitilized();
if (this.converters == null) {
this.converters = new ArrayList<>();
}
this.converters.add(converter);
} | [
"public",
"void",
"addConverter",
"(",
"ValueConverter",
"<",
"?",
",",
"?",
">",
"converter",
")",
"{",
"getInitializationState",
"(",
")",
".",
"requireNotInitilized",
"(",
")",
";",
"if",
"(",
"this",
".",
"converters",
"==",
"null",
")",
"{",
"this",
... | This method registers the given {@code converter} to this composed converter.
@param converter is the converter to add. | [
"This",
"method",
"registers",
"the",
"given",
"{",
"@code",
"converter",
"}",
"to",
"this",
"composed",
"converter",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/value/src/main/java/net/sf/mmm/util/value/impl/ComposedValueConverterImpl.java#L71-L78 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java | SvgGraphicsContext.drawText | public void drawText(Object parent, String name, String text, Coordinate position, FontStyle style) {
if (isAttached()) {
Element element = helper.createOrUpdateElement(parent, name, "text", style);
if (text != null) {
element.setInnerText(text);
}
if (position != null) {
int fontSize = 12;
if (style != null) {
fontSize = style.getFontSize();
}
Dom.setElementAttribute(element, "x", Double.toString(position.getX()));
Dom.setElementAttribute(element, "y", Double.toString(position.getY() + fontSize));
}
}
} | java | public void drawText(Object parent, String name, String text, Coordinate position, FontStyle style) {
if (isAttached()) {
Element element = helper.createOrUpdateElement(parent, name, "text", style);
if (text != null) {
element.setInnerText(text);
}
if (position != null) {
int fontSize = 12;
if (style != null) {
fontSize = style.getFontSize();
}
Dom.setElementAttribute(element, "x", Double.toString(position.getX()));
Dom.setElementAttribute(element, "y", Double.toString(position.getY() + fontSize));
}
}
} | [
"public",
"void",
"drawText",
"(",
"Object",
"parent",
",",
"String",
"name",
",",
"String",
"text",
",",
"Coordinate",
"position",
",",
"FontStyle",
"style",
")",
"{",
"if",
"(",
"isAttached",
"(",
")",
")",
"{",
"Element",
"element",
"=",
"helper",
"."... | Draw a string of text onto the <code>GraphicsContext</code>.
@param parent
parent group object
@param name
The text's name.
@param text
The actual string content.
@param position
The upper left corner for the text to originate.
@param style
The styling object for the text. | [
"Draw",
"a",
"string",
"of",
"text",
"onto",
"the",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L493-L509 |
osglworks/java-mvc | src/main/java/org/osgl/mvc/result/ServiceUnavailable.java | ServiceUnavailable.of | public static ServiceUnavailable of(int errorCode) {
if (_localizedErrorMsg()) {
return of(errorCode, defaultMessage(SERVICE_UNAVAILABLE));
} else {
touchPayload().errorCode(errorCode);
return _INSTANCE;
}
} | java | public static ServiceUnavailable of(int errorCode) {
if (_localizedErrorMsg()) {
return of(errorCode, defaultMessage(SERVICE_UNAVAILABLE));
} else {
touchPayload().errorCode(errorCode);
return _INSTANCE;
}
} | [
"public",
"static",
"ServiceUnavailable",
"of",
"(",
"int",
"errorCode",
")",
"{",
"if",
"(",
"_localizedErrorMsg",
"(",
")",
")",
"{",
"return",
"of",
"(",
"errorCode",
",",
"defaultMessage",
"(",
"SERVICE_UNAVAILABLE",
")",
")",
";",
"}",
"else",
"{",
"t... | Returns a static ServiceUnavailable instance and set the {@link #payload} thread local
with error code and default message.
When calling the instance on {@link #getMessage()} method, it will return whatever
stored in the {@link #payload} thread local
@param errorCode the app defined error code
@return a static ServiceUnavailable instance as described above | [
"Returns",
"a",
"static",
"ServiceUnavailable",
"instance",
"and",
"set",
"the",
"{",
"@link",
"#payload",
"}",
"thread",
"local",
"with",
"error",
"code",
"and",
"default",
"message",
"."
] | train | https://github.com/osglworks/java-mvc/blob/4d2b2ec40498ac6ee7040c0424377cbeacab124b/src/main/java/org/osgl/mvc/result/ServiceUnavailable.java#L155-L162 |
tipsy/javalin | src/main/java/io/javalin/apibuilder/ApiBuilder.java | ApiBuilder.ws | public static void ws(@NotNull String path, @NotNull Consumer<WsHandler> ws) {
staticInstance().ws(prefixPath(path), ws);
} | java | public static void ws(@NotNull String path, @NotNull Consumer<WsHandler> ws) {
staticInstance().ws(prefixPath(path), ws);
} | [
"public",
"static",
"void",
"ws",
"(",
"@",
"NotNull",
"String",
"path",
",",
"@",
"NotNull",
"Consumer",
"<",
"WsHandler",
">",
"ws",
")",
"{",
"staticInstance",
"(",
")",
".",
"ws",
"(",
"prefixPath",
"(",
"path",
")",
",",
"ws",
")",
";",
"}"
] | Adds a WebSocket handler on the specified path.
The method can only be called inside a {@link Javalin#routes(EndpointGroup)}.
@see <a href="https://javalin.io/documentation#websockets">WebSockets in docs</a> | [
"Adds",
"a",
"WebSocket",
"handler",
"on",
"the",
"specified",
"path",
".",
"The",
"method",
"can",
"only",
"be",
"called",
"inside",
"a",
"{",
"@link",
"Javalin#routes",
"(",
"EndpointGroup",
")",
"}",
"."
] | train | https://github.com/tipsy/javalin/blob/68b2f7592f237db1c2b597e645697eb75fdaee53/src/main/java/io/javalin/apibuilder/ApiBuilder.java#L374-L376 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/Criteria.java | Criteria.addLessOrEqualThanField | public void addLessOrEqualThanField(String attribute, Object value)
{
// PAW
// addSelectionCriteria(FieldCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));
addSelectionCriteria(FieldCriteria.buildNotGreaterCriteria(attribute, value, getUserAlias(attribute)));
} | java | public void addLessOrEqualThanField(String attribute, Object value)
{
// PAW
// addSelectionCriteria(FieldCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));
addSelectionCriteria(FieldCriteria.buildNotGreaterCriteria(attribute, value, getUserAlias(attribute)));
} | [
"public",
"void",
"addLessOrEqualThanField",
"(",
"String",
"attribute",
",",
"Object",
"value",
")",
"{",
"// PAW\r",
"// addSelectionCriteria(FieldCriteria.buildNotGreaterCriteria(attribute, value, getAlias()));\r",
"addSelectionCriteria",
"(",
"FieldCriteria",
".",
"buildNotGrea... | Adds LessOrEqual Than (<=) criteria,
customer_id <= person_id
@param attribute The field name to be used
@param value The field name to compare with | [
"Adds",
"LessOrEqual",
"Than",
"(",
"<",
"=",
")",
"criteria",
"customer_id",
"<",
"=",
"person_id"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L449-L454 |
di2e/Argo | PluginFramework/src/main/java/ws/argo/probe/Probe.java | Probe.addRespondToURL | public void addRespondToURL(String label, String respondToURL) throws MalformedURLException {
// Sanity check on the respondToURL
// The requirement for the respondToURL is a REST POST call, so that means
// only HTTP and HTTPS schemes.
// Localhost is allowed as well as a valid response destination
String[] schemes = { "http", "https" };
UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.ALLOW_LOCAL_URLS);
if (!urlValidator.isValid(respondToURL))
throw new MalformedURLException("The probe respondTo URL is invalid: " + respondToURL);
_probe.addRespondToURL(label, respondToURL);
} | java | public void addRespondToURL(String label, String respondToURL) throws MalformedURLException {
// Sanity check on the respondToURL
// The requirement for the respondToURL is a REST POST call, so that means
// only HTTP and HTTPS schemes.
// Localhost is allowed as well as a valid response destination
String[] schemes = { "http", "https" };
UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.ALLOW_LOCAL_URLS);
if (!urlValidator.isValid(respondToURL))
throw new MalformedURLException("The probe respondTo URL is invalid: " + respondToURL);
_probe.addRespondToURL(label, respondToURL);
} | [
"public",
"void",
"addRespondToURL",
"(",
"String",
"label",
",",
"String",
"respondToURL",
")",
"throws",
"MalformedURLException",
"{",
"// Sanity check on the respondToURL",
"// The requirement for the respondToURL is a REST POST call, so that means",
"// only HTTP and HTTPS schemes.... | Add a URL that specifies where the Responder should send the response.
Provide a label as a hint to the Responder about why this URL was included.
For example: give a "internal" label for a respondToURL that is only
accessible from inside a NATed network.
@param label - hint about the URL
@param respondToURL - the URL the responder will POST a payload to
@throws MalformedURLException if the URL is bad | [
"Add",
"a",
"URL",
"that",
"specifies",
"where",
"the",
"Responder",
"should",
"send",
"the",
"response",
".",
"Provide",
"a",
"label",
"as",
"a",
"hint",
"to",
"the",
"Responder",
"about",
"why",
"this",
"URL",
"was",
"included",
".",
"For",
"example",
... | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/PluginFramework/src/main/java/ws/argo/probe/Probe.java#L214-L227 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java | SeaGlassSynthPainterImpl.paintTabbedPaneTabAreaBackground | public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) {
if (orientation == JTabbedPane.LEFT) {
AffineTransform transform = new AffineTransform();
transform.scale(-1, 1);
transform.rotate(Math.toRadians(90));
paintBackground(context, g, y, x, h, w, transform);
} else if (orientation == JTabbedPane.RIGHT) {
AffineTransform transform = new AffineTransform();
transform.rotate(Math.toRadians(90));
transform.translate(0, -(x + w));
paintBackground(context, g, y, 0, h, w, transform);
} else if (orientation == JTabbedPane.BOTTOM) {
AffineTransform transform = new AffineTransform();
transform.translate(x, y);
paintBackground(context, g, 0, 0, w, h, transform);
} else {
paintBackground(context, g, x, y, w, h, null);
}
} | java | public void paintTabbedPaneTabAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) {
if (orientation == JTabbedPane.LEFT) {
AffineTransform transform = new AffineTransform();
transform.scale(-1, 1);
transform.rotate(Math.toRadians(90));
paintBackground(context, g, y, x, h, w, transform);
} else if (orientation == JTabbedPane.RIGHT) {
AffineTransform transform = new AffineTransform();
transform.rotate(Math.toRadians(90));
transform.translate(0, -(x + w));
paintBackground(context, g, y, 0, h, w, transform);
} else if (orientation == JTabbedPane.BOTTOM) {
AffineTransform transform = new AffineTransform();
transform.translate(x, y);
paintBackground(context, g, 0, 0, w, h, transform);
} else {
paintBackground(context, g, x, y, w, h, null);
}
} | [
"public",
"void",
"paintTabbedPaneTabAreaBackground",
"(",
"SynthContext",
"context",
",",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"w",
",",
"int",
"h",
",",
"int",
"orientation",
")",
"{",
"if",
"(",
"orientation",
"==",
"JTabbedPan... | Paints the background of the area behind the tabs of a tabbed pane. This
implementation invokes the method of the same name without the
orientation.
@param context SynthContext identifying the <code>JComponent</code>
and <code>Region</code> to paint to
@param g <code>Graphics</code> to paint to
@param x X coordinate of the area to paint to
@param y Y coordinate of the area to paint to
@param w Width of the area to paint to
@param h Height of the area to paint to
@param orientation One of <code>JTabbedPane.TOP</code>, <code>
JTabbedPane.LEFT</code>, <code>
JTabbedPane.BOTTOM</code> , or <code>
JTabbedPane.RIGHT</code> | [
"Paints",
"the",
"background",
"of",
"the",
"area",
"behind",
"the",
"tabs",
"of",
"a",
"tabbed",
"pane",
".",
"This",
"implementation",
"invokes",
"the",
"method",
"of",
"the",
"same",
"name",
"without",
"the",
"orientation",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1977-L1998 |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/utils/ClassicCommands.java | ClassicCommands.getInstrumentsVersion | public static InstrumentsVersion getInstrumentsVersion() {
List<String> s = new ArrayList<>();
s.add("instruments");
Command c = new Command(s, false);
InstrumentsVersion version = new InstrumentsVersion();
c.registerListener(version);
c.executeAndWait(true);
return version;
} | java | public static InstrumentsVersion getInstrumentsVersion() {
List<String> s = new ArrayList<>();
s.add("instruments");
Command c = new Command(s, false);
InstrumentsVersion version = new InstrumentsVersion();
c.registerListener(version);
c.executeAndWait(true);
return version;
} | [
"public",
"static",
"InstrumentsVersion",
"getInstrumentsVersion",
"(",
")",
"{",
"List",
"<",
"String",
">",
"s",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"s",
".",
"add",
"(",
"\"instruments\"",
")",
";",
"Command",
"c",
"=",
"new",
"Command",
"("... | returns the version of the currently selected ( xcode-select -switch ) Xcode. | [
"returns",
"the",
"version",
"of",
"the",
"currently",
"selected",
"(",
"xcode",
"-",
"select",
"-",
"switch",
")",
"Xcode",
"."
] | train | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/ClassicCommands.java#L34-L44 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java | SarlDocumentationParser.reportError | protected static void reportError(ParsingContext context, String message, Object... parameter) {
final File file = context.getCurrentFile();
final int offset = context.getMatcher().start() + context.getStartIndex();
final int lineno = context.getLineNo();
Throwable cause = null;
for (final Object param : parameter) {
if (param instanceof Throwable) {
cause = (Throwable) param;
break;
}
}
final Object[] args = new Object[parameter.length + 3];
args[0] = file;
args[1] = lineno;
args[2] = offset;
System.arraycopy(parameter, 0, args, 3, parameter.length);
final String msg = MessageFormat.format(message, args);
if (cause != null) {
throw new ParsingException(msg, file, lineno, Throwables.getRootCause(cause));
}
throw new ParsingException(msg, file, lineno);
} | java | protected static void reportError(ParsingContext context, String message, Object... parameter) {
final File file = context.getCurrentFile();
final int offset = context.getMatcher().start() + context.getStartIndex();
final int lineno = context.getLineNo();
Throwable cause = null;
for (final Object param : parameter) {
if (param instanceof Throwable) {
cause = (Throwable) param;
break;
}
}
final Object[] args = new Object[parameter.length + 3];
args[0] = file;
args[1] = lineno;
args[2] = offset;
System.arraycopy(parameter, 0, args, 3, parameter.length);
final String msg = MessageFormat.format(message, args);
if (cause != null) {
throw new ParsingException(msg, file, lineno, Throwables.getRootCause(cause));
}
throw new ParsingException(msg, file, lineno);
} | [
"protected",
"static",
"void",
"reportError",
"(",
"ParsingContext",
"context",
",",
"String",
"message",
",",
"Object",
"...",
"parameter",
")",
"{",
"final",
"File",
"file",
"=",
"context",
".",
"getCurrentFile",
"(",
")",
";",
"final",
"int",
"offset",
"=... | Report an error.
@param context the context.
@param message the message in a format compatible with {@link MessageFormat}. The first argument is
the filename. The second argument is the line number. The third argument is the position in the file.
@param parameter additional parameter, starting at {4}. | [
"Report",
"an",
"error",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L965-L986 |
joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.populateTask | private void populateTask(Row row, Task task)
{
task.setUniqueID(row.getInteger("Z_PK"));
task.setName(row.getString("ZTITLE"));
task.setPriority(Priority.getInstance(row.getInt("ZPRIORITY")));
task.setMilestone(row.getBoolean("ZISMILESTONE"));
task.setActualFinish(row.getTimestamp("ZGIVENACTUALENDDATE_"));
task.setActualStart(row.getTimestamp("ZGIVENACTUALSTARTDATE_"));
task.setNotes(row.getString("ZOBJECTDESCRIPTION"));
task.setDuration(row.getDuration("ZGIVENDURATION_"));
task.setOvertimeWork(row.getWork("ZGIVENWORKOVERTIME_"));
task.setWork(row.getWork("ZGIVENWORK_"));
task.setLevelingDelay(row.getDuration("ZLEVELINGDELAY_"));
task.setActualOvertimeWork(row.getWork("ZGIVENACTUALWORKOVERTIME_"));
task.setActualWork(row.getWork("ZGIVENACTUALWORK_"));
task.setRemainingWork(row.getWork("ZGIVENACTUALWORK_"));
task.setGUID(row.getUUID("ZUNIQUEID"));
Integer calendarID = row.getInteger("ZGIVENCALENDAR");
if (calendarID != null)
{
ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
if (calendar != null)
{
task.setCalendar(calendar);
}
}
populateConstraints(row, task);
// Percent complete is calculated bottom up from assignments and actual work vs. planned work
m_eventManager.fireTaskReadEvent(task);
} | java | private void populateTask(Row row, Task task)
{
task.setUniqueID(row.getInteger("Z_PK"));
task.setName(row.getString("ZTITLE"));
task.setPriority(Priority.getInstance(row.getInt("ZPRIORITY")));
task.setMilestone(row.getBoolean("ZISMILESTONE"));
task.setActualFinish(row.getTimestamp("ZGIVENACTUALENDDATE_"));
task.setActualStart(row.getTimestamp("ZGIVENACTUALSTARTDATE_"));
task.setNotes(row.getString("ZOBJECTDESCRIPTION"));
task.setDuration(row.getDuration("ZGIVENDURATION_"));
task.setOvertimeWork(row.getWork("ZGIVENWORKOVERTIME_"));
task.setWork(row.getWork("ZGIVENWORK_"));
task.setLevelingDelay(row.getDuration("ZLEVELINGDELAY_"));
task.setActualOvertimeWork(row.getWork("ZGIVENACTUALWORKOVERTIME_"));
task.setActualWork(row.getWork("ZGIVENACTUALWORK_"));
task.setRemainingWork(row.getWork("ZGIVENACTUALWORK_"));
task.setGUID(row.getUUID("ZUNIQUEID"));
Integer calendarID = row.getInteger("ZGIVENCALENDAR");
if (calendarID != null)
{
ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
if (calendar != null)
{
task.setCalendar(calendar);
}
}
populateConstraints(row, task);
// Percent complete is calculated bottom up from assignments and actual work vs. planned work
m_eventManager.fireTaskReadEvent(task);
} | [
"private",
"void",
"populateTask",
"(",
"Row",
"row",
",",
"Task",
"task",
")",
"{",
"task",
".",
"setUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"Z_PK\"",
")",
")",
";",
"task",
".",
"setName",
"(",
"row",
".",
"getString",
"(",
"\"ZTITLE\"",
")"... | Read data for an individual task.
@param row task data from database
@param task Task instance | [
"Read",
"data",
"for",
"an",
"individual",
"task",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L437-L470 |
signalapp/curve25519-java | common/src/main/java/org/whispersystems/curve25519/Curve25519.java | Curve25519.generateKeyPair | public Curve25519KeyPair generateKeyPair() {
byte[] privateKey = provider.generatePrivateKey();
byte[] publicKey = provider.generatePublicKey(privateKey);
return new Curve25519KeyPair(publicKey, privateKey);
} | java | public Curve25519KeyPair generateKeyPair() {
byte[] privateKey = provider.generatePrivateKey();
byte[] publicKey = provider.generatePublicKey(privateKey);
return new Curve25519KeyPair(publicKey, privateKey);
} | [
"public",
"Curve25519KeyPair",
"generateKeyPair",
"(",
")",
"{",
"byte",
"[",
"]",
"privateKey",
"=",
"provider",
".",
"generatePrivateKey",
"(",
")",
";",
"byte",
"[",
"]",
"publicKey",
"=",
"provider",
".",
"generatePublicKey",
"(",
"privateKey",
")",
";",
... | Generates a Curve25519 keypair.
@return A randomly generated Curve25519 keypair. | [
"Generates",
"a",
"Curve25519",
"keypair",
"."
] | train | https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/common/src/main/java/org/whispersystems/curve25519/Curve25519.java#L58-L63 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/resource/BatchLinkableResource.java | BatchLinkableResource.getEObject | @Override
public EObject getEObject(String uriFragment) {
synchronized (getLock()) {
try {
if (getEncoder().isCrossLinkFragment(this, uriFragment) && !isLoadedFromStorage()) {
if (!getUnresolvableURIFragments().contains(uriFragment)) {
Triple<EObject, EReference, INode> triple = getEncoder().decode(this, uriFragment);
if (batchLinkingService.isBatchLinkable(triple.getSecond())) {
if (compilerPhases.isIndexing(this))
log.error("Don't resolve expressions during indexing!", new IllegalStateException("Resource URI : "+getURI()+", fragment : "+uriFragment));
return batchLinkingService.resolveBatched(triple.getFirst(), triple.getSecond(), uriFragment);
}
return getEObject(uriFragment, triple);
} else {
return null;
}
}
return super.getEObject(uriFragment);
} catch (RuntimeException e) {
operationCanceledManager.propagateAsErrorIfCancelException(e);
getErrors().add(new ExceptionDiagnostic(e));
log.error("resolution of uriFragment '" + uriFragment + "' failed.", e);
// wrapped because the javaDoc of this method states that WrappedExceptions are thrown
// logged because EcoreUtil.resolve will ignore any exceptions.
throw new WrappedException(e);
}
}
} | java | @Override
public EObject getEObject(String uriFragment) {
synchronized (getLock()) {
try {
if (getEncoder().isCrossLinkFragment(this, uriFragment) && !isLoadedFromStorage()) {
if (!getUnresolvableURIFragments().contains(uriFragment)) {
Triple<EObject, EReference, INode> triple = getEncoder().decode(this, uriFragment);
if (batchLinkingService.isBatchLinkable(triple.getSecond())) {
if (compilerPhases.isIndexing(this))
log.error("Don't resolve expressions during indexing!", new IllegalStateException("Resource URI : "+getURI()+", fragment : "+uriFragment));
return batchLinkingService.resolveBatched(triple.getFirst(), triple.getSecond(), uriFragment);
}
return getEObject(uriFragment, triple);
} else {
return null;
}
}
return super.getEObject(uriFragment);
} catch (RuntimeException e) {
operationCanceledManager.propagateAsErrorIfCancelException(e);
getErrors().add(new ExceptionDiagnostic(e));
log.error("resolution of uriFragment '" + uriFragment + "' failed.", e);
// wrapped because the javaDoc of this method states that WrappedExceptions are thrown
// logged because EcoreUtil.resolve will ignore any exceptions.
throw new WrappedException(e);
}
}
} | [
"@",
"Override",
"public",
"EObject",
"getEObject",
"(",
"String",
"uriFragment",
")",
"{",
"synchronized",
"(",
"getLock",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"getEncoder",
"(",
")",
".",
"isCrossLinkFragment",
"(",
"this",
",",
"uriFragment",
")",... | {@inheritDoc}
Delegates to the {@link BatchLinkingService} if the requested reference is
{@link BatchLinkingService#isBatchLinkable(EReference) linkeable in batch mode}.
Implementation detail: This specialization of {@link #getEObject(String) getEObject}
synchronizes on the {@link #getLock() lock} which is exposed by the synchronizable
resource rather than on the resource directly. This guards against reentrant resolution
from different threads that could block each other.
Usually one would want to lock only in the {@link BatchLinkingService} but we could
have intermixed {@link LazyURIEncoder#isCrossLinkFragment(org.eclipse.emf.ecore.resource.Resource, String)
lazy cross reference} and vanilla EMF cross references which again could lead to a
dead lock. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/resource/BatchLinkableResource.java#L107-L134 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java | ByteUtils.memcmp | public static boolean memcmp( byte[] a, int a_offset, byte[] b, int b_offset, int length ) {
if ((a == null) && (b == null)) {
return true;
}
if ((a == null) || (b == null)) {
return false;
}
for( int i = 0; i < length; ++i, ++a_offset, ++b_offset )
if (a[a_offset] != b[b_offset]) {
return false;
}
return true;
} | java | public static boolean memcmp( byte[] a, int a_offset, byte[] b, int b_offset, int length ) {
if ((a == null) && (b == null)) {
return true;
}
if ((a == null) || (b == null)) {
return false;
}
for( int i = 0; i < length; ++i, ++a_offset, ++b_offset )
if (a[a_offset] != b[b_offset]) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"memcmp",
"(",
"byte",
"[",
"]",
"a",
",",
"int",
"a_offset",
",",
"byte",
"[",
"]",
"b",
",",
"int",
"b_offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"(",
"a",
"==",
"null",
")",
"&&",
"(",
"b",
"==",
"null... | Compare the contents of one array of <code>bytes</code> to another.
@param a the first array
@param a_offset the start offset in <code>a</code>
@param b the second array
@param b_offset the start offset in <code>b</code>
@param length the number of <code>byte</code>s to compare.
@return DOCUMENT ME! | [
"Compare",
"the",
"contents",
"of",
"one",
"array",
"of",
"<code",
">",
"bytes<",
"/",
"code",
">",
"to",
"another",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L510-L525 |
aws/aws-sdk-java | aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/EncryptRequest.java | EncryptRequest.withEncryptionContext | public EncryptRequest withEncryptionContext(java.util.Map<String, String> encryptionContext) {
setEncryptionContext(encryptionContext);
return this;
} | java | public EncryptRequest withEncryptionContext(java.util.Map<String, String> encryptionContext) {
setEncryptionContext(encryptionContext);
return this;
} | [
"public",
"EncryptRequest",
"withEncryptionContext",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"encryptionContext",
")",
"{",
"setEncryptionContext",
"(",
"encryptionContext",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Name-value pair that specifies the encryption context to be used for authenticated encryption. If used here, the
same value must be supplied to the <code>Decrypt</code> API or decryption will fail. For more information, see <a
href="http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html">Encryption Context</a>.
</p>
@param encryptionContext
Name-value pair that specifies the encryption context to be used for authenticated encryption. If used
here, the same value must be supplied to the <code>Decrypt</code> API or decryption will fail. For more
information, see <a
href="http://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html">Encryption
Context</a>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Name",
"-",
"value",
"pair",
"that",
"specifies",
"the",
"encryption",
"context",
"to",
"be",
"used",
"for",
"authenticated",
"encryption",
".",
"If",
"used",
"here",
"the",
"same",
"value",
"must",
"be",
"supplied",
"to",
"the",
"<code",
">",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/EncryptRequest.java#L453-L456 |
RestComm/Restcomm-Connect | restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/interpreter/VoiceInterpreter.java | VoiceInterpreter.playWaitUrl | protected void playWaitUrl(final List<URI> waitUrls, final ActorRef source) {
conference.tell(new Play(waitUrls, Short.MAX_VALUE, confModeratorPresent), source);
} | java | protected void playWaitUrl(final List<URI> waitUrls, final ActorRef source) {
conference.tell(new Play(waitUrls, Short.MAX_VALUE, confModeratorPresent), source);
} | [
"protected",
"void",
"playWaitUrl",
"(",
"final",
"List",
"<",
"URI",
">",
"waitUrls",
",",
"final",
"ActorRef",
"source",
")",
"{",
"conference",
".",
"tell",
"(",
"new",
"Play",
"(",
"waitUrls",
",",
"Short",
".",
"MAX_VALUE",
",",
"confModeratorPresent",
... | Because of RMS issue https://github.com/RestComm/mediaserver/issues/158 we cannot have List<URI> for waitUrl | [
"Because",
"of",
"RMS",
"issue",
"https",
":",
"//",
"github",
".",
"com",
"/",
"RestComm",
"/",
"mediaserver",
"/",
"issues",
"/",
"158",
"we",
"cannot",
"have",
"List<URI",
">",
"for",
"waitUrl"
] | train | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/interpreter/VoiceInterpreter.java#L3251-L3253 |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/PIDStoreStartHandler.java | PIDStoreStartHandler.onNext | @Override
public synchronized void onNext(final RuntimeStart startTime) {
if (this.isPidNotWritten()) {
final long pid = OSUtils.getPID();
final File outfile = new File(PID_FILE_NAME);
LOG.log(Level.FINEST, "Storing pid `" + pid + "` in file " + outfile.getAbsolutePath());
try (final PrintWriter p = new PrintWriter(PID_FILE_NAME, "UTF-8")) {
p.write(String.valueOf(pid));
p.write("\n");
} catch (final FileNotFoundException | UnsupportedEncodingException e) {
LOG.log(Level.WARNING, "Unable to create PID file.", e);
}
this.pidIsWritten = true;
} else {
LOG.log(Level.FINEST, "PID already written.");
}
} | java | @Override
public synchronized void onNext(final RuntimeStart startTime) {
if (this.isPidNotWritten()) {
final long pid = OSUtils.getPID();
final File outfile = new File(PID_FILE_NAME);
LOG.log(Level.FINEST, "Storing pid `" + pid + "` in file " + outfile.getAbsolutePath());
try (final PrintWriter p = new PrintWriter(PID_FILE_NAME, "UTF-8")) {
p.write(String.valueOf(pid));
p.write("\n");
} catch (final FileNotFoundException | UnsupportedEncodingException e) {
LOG.log(Level.WARNING, "Unable to create PID file.", e);
}
this.pidIsWritten = true;
} else {
LOG.log(Level.FINEST, "PID already written.");
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"onNext",
"(",
"final",
"RuntimeStart",
"startTime",
")",
"{",
"if",
"(",
"this",
".",
"isPidNotWritten",
"(",
")",
")",
"{",
"final",
"long",
"pid",
"=",
"OSUtils",
".",
"getPID",
"(",
")",
";",
"final"... | This call is idempotent: It will only write the PID exactly once per instance.
@param startTime | [
"This",
"call",
"is",
"idempotent",
":",
"It",
"will",
"only",
"write",
"the",
"PID",
"exactly",
"once",
"per",
"instance",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/PIDStoreStartHandler.java#L59-L75 |
liferay/com-liferay-commerce | commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java | CPDefinitionGroupedEntryPersistenceImpl.findByCPDefinitionId | @Override
public List<CPDefinitionGroupedEntry> findByCPDefinitionId(
long CPDefinitionId, int start, int end) {
return findByCPDefinitionId(CPDefinitionId, start, end, null);
} | java | @Override
public List<CPDefinitionGroupedEntry> findByCPDefinitionId(
long CPDefinitionId, int start, int end) {
return findByCPDefinitionId(CPDefinitionId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionGroupedEntry",
">",
"findByCPDefinitionId",
"(",
"long",
"CPDefinitionId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCPDefinitionId",
"(",
"CPDefinitionId",
",",
"start",
",",
"end",
"... | Returns a range of all the cp definition grouped entries where CPDefinitionId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionGroupedEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param CPDefinitionId the cp definition ID
@param start the lower bound of the range of cp definition grouped entries
@param end the upper bound of the range of cp definition grouped entries (not inclusive)
@return the range of matching cp definition grouped entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"grouped",
"entries",
"where",
"CPDefinitionId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L1549-L1553 |
riversun/string-grabber | src/main/java/org/riversun/string_grabber/StringCropper.java | StringCropper.getAfterOfWithDetails | public StrPosition getAfterOfWithDetails(String srcStr, String token, boolean useTailSearch) {
final StrPosition retVal = new StrPosition();
if (isBlank(srcStr) || isBlank(token)) {
return retVal;
}
final int tokenStartIndex;
if (useTailSearch) {
tokenStartIndex = tailOf(srcStr, token);
} else {
tokenStartIndex = srcStr.indexOf(token);
}
if (tokenStartIndex < 0) {
return retVal;
}
int tokenEndIndex = tokenStartIndex + token.length() - 1;
int removeHeadCount = tokenEndIndex + 1;
String afterTokenStr = removeHead(srcStr, removeHeadCount);
retVal.str = afterTokenStr;
retVal.startIndex = tokenEndIndex + 1;
retVal.endIndex = srcStr.length() - 1;
return retVal;
} | java | public StrPosition getAfterOfWithDetails(String srcStr, String token, boolean useTailSearch) {
final StrPosition retVal = new StrPosition();
if (isBlank(srcStr) || isBlank(token)) {
return retVal;
}
final int tokenStartIndex;
if (useTailSearch) {
tokenStartIndex = tailOf(srcStr, token);
} else {
tokenStartIndex = srcStr.indexOf(token);
}
if (tokenStartIndex < 0) {
return retVal;
}
int tokenEndIndex = tokenStartIndex + token.length() - 1;
int removeHeadCount = tokenEndIndex + 1;
String afterTokenStr = removeHead(srcStr, removeHeadCount);
retVal.str = afterTokenStr;
retVal.startIndex = tokenEndIndex + 1;
retVal.endIndex = srcStr.length() - 1;
return retVal;
} | [
"public",
"StrPosition",
"getAfterOfWithDetails",
"(",
"String",
"srcStr",
",",
"String",
"token",
",",
"boolean",
"useTailSearch",
")",
"{",
"final",
"StrPosition",
"retVal",
"=",
"new",
"StrPosition",
"(",
")",
";",
"if",
"(",
"isBlank",
"(",
"srcStr",
")",
... | returns the string that is cropped after token with position-detail-info<br>
<br>
Method Example1 tail mode=true,<br>
<br>
getAfterOfWithDetails("AAABCDBCDEEE","BCD",true) returns str=EEE,
startIndex=9, endIndex=11<br>
<br>
<br>
Method Example2 tail mode=true,<br>
getAfterOfWithDetails("AAABCDBCDEEE","BCD",true) returns str=BCDEEE,
startIndex=6, endIndex=11
@param srcStr
@param token
@param useTailSearch
is use tail mode<br>
{@link #tailOf(String, String)}
@return | [
"returns",
"the",
"string",
"that",
"is",
"cropped",
"after",
"token",
"with",
"position",
"-",
"detail",
"-",
"info<br",
">",
"<br",
">",
"Method",
"Example1",
"tail",
"mode",
"=",
"true",
"<br",
">",
"<br",
">",
"getAfterOfWithDetails",
"(",
"AAABCDBCDEEE"... | train | https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringCropper.java#L325-L356 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java | Period.setTimeUnitInternalValue | private Period setTimeUnitInternalValue(TimeUnit unit, int value) {
int ord = unit.ordinal;
if (counts[ord] != value) {
int[] newCounts = new int[counts.length];
for (int i = 0; i < counts.length; ++i) {
newCounts[i] = counts[i];
}
newCounts[ord] = value;
return new Period(timeLimit, inFuture, newCounts);
}
return this;
} | java | private Period setTimeUnitInternalValue(TimeUnit unit, int value) {
int ord = unit.ordinal;
if (counts[ord] != value) {
int[] newCounts = new int[counts.length];
for (int i = 0; i < counts.length; ++i) {
newCounts[i] = counts[i];
}
newCounts[ord] = value;
return new Period(timeLimit, inFuture, newCounts);
}
return this;
} | [
"private",
"Period",
"setTimeUnitInternalValue",
"(",
"TimeUnit",
"unit",
",",
"int",
"value",
")",
"{",
"int",
"ord",
"=",
"unit",
".",
"ordinal",
";",
"if",
"(",
"counts",
"[",
"ord",
"]",
"!=",
"value",
")",
"{",
"int",
"[",
"]",
"newCounts",
"=",
... | Sets the period to have the provided value, 1/1000 of the
unit plus 1. Thus unset values are '0', 1' is the set value '0',
2 is the set value '1/1000', 3 is the set value '2/1000' etc.
@param p the period to change
@param value the int value as described above.
@eturn the new Period object. | [
"Sets",
"the",
"period",
"to",
"have",
"the",
"provided",
"value",
"1",
"/",
"1000",
"of",
"the",
"unit",
"plus",
"1",
".",
"Thus",
"unset",
"values",
"are",
"0",
"1",
"is",
"the",
"set",
"value",
"0",
"2",
"is",
"the",
"set",
"value",
"1",
"/",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java#L331-L342 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java | ProbeManagerImpl.addActiveProbesforListener | public void addActiveProbesforListener(ProbeListener listener, Collection<ProbeImpl> probes) {
// Add the probes for the specified listener. This is purely additive.
// Since a listener's configuration can't be updated after registration,
// we're adding probes for recently initialized / modified classes.
addProbesByListener(listener, probes);
for (ProbeImpl probe : probes) {
addListenerByProbe(probe, listener);
}
} | java | public void addActiveProbesforListener(ProbeListener listener, Collection<ProbeImpl> probes) {
// Add the probes for the specified listener. This is purely additive.
// Since a listener's configuration can't be updated after registration,
// we're adding probes for recently initialized / modified classes.
addProbesByListener(listener, probes);
for (ProbeImpl probe : probes) {
addListenerByProbe(probe, listener);
}
} | [
"public",
"void",
"addActiveProbesforListener",
"(",
"ProbeListener",
"listener",
",",
"Collection",
"<",
"ProbeImpl",
">",
"probes",
")",
"{",
"// Add the probes for the specified listener. This is purely additive.",
"// Since a listener's configuration can't be updated after registr... | Update the appropriate collections to reflect recently activated probes
for the specified listener.
@param listener the listener with recently activated probes
@param probes the collection of probes that were activated | [
"Update",
"the",
"appropriate",
"collections",
"to",
"reflect",
"recently",
"activated",
"probes",
"for",
"the",
"specified",
"listener",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java#L673-L682 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/MiscSpec.java | MiscSpec.saveInEnvironment | @Given("^I save \'(.+?)\' in variable \'(.+?)\'$")
public void saveInEnvironment(String value, String envVar) {
ThreadProperty.set(envVar, value);
} | java | @Given("^I save \'(.+?)\' in variable \'(.+?)\'$")
public void saveInEnvironment(String value, String envVar) {
ThreadProperty.set(envVar, value);
} | [
"@",
"Given",
"(",
"\"^I save \\'(.+?)\\' in variable \\'(.+?)\\'$\"",
")",
"public",
"void",
"saveInEnvironment",
"(",
"String",
"value",
",",
"String",
"envVar",
")",
"{",
"ThreadProperty",
".",
"set",
"(",
"envVar",
",",
"value",
")",
";",
"}"
] | Save value for future use.
@param value value to be saved
@param envVar thread environment variable where to store the value | [
"Save",
"value",
"for",
"future",
"use",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/MiscSpec.java#L105-L108 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/storable/GeneralStructure.java | GeneralStructure.addKeyPart | public boolean addKeyPart(String name, Basic_Field_Types type) throws IOException {
return addKeyPart(name, type.size);
} | java | public boolean addKeyPart(String name, Basic_Field_Types type) throws IOException {
return addKeyPart(name, type.size);
} | [
"public",
"boolean",
"addKeyPart",
"(",
"String",
"name",
",",
"Basic_Field_Types",
"type",
")",
"throws",
"IOException",
"{",
"return",
"addKeyPart",
"(",
"name",
",",
"type",
".",
"size",
")",
";",
"}"
] | Adds a new KeyPart. This is a wrapper method for <code>addKeyPart(String, int)</code>.
@param name
the name of the key part. With this name you can access this part
@param type
the type of the key part.
@return true if adding the key part was successful
@throws IOException | [
"Adds",
"a",
"new",
"KeyPart",
".",
"This",
"is",
"a",
"wrapper",
"method",
"for",
"<code",
">",
"addKeyPart",
"(",
"String",
"int",
")",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStructure.java#L154-L156 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/outline/SARLOutlineTreeProvider.java | SARLOutlineTreeProvider._createChildren | protected void _createChildren(DocumentRootNode parentNode, SarlScript modelElement) {
if (!Strings.isNullOrEmpty(modelElement.getPackage())) {
// Create the node for the package declaration.
createEStructuralFeatureNode(
parentNode, modelElement,
XtendPackage.Literals.XTEND_FILE__PACKAGE,
this.imageDispatcher.invoke(getClass().getPackage()),
// Do not use the text dispatcher below for avoiding to obtain
// the filename of the script.
modelElement.getPackage(),
true);
}
// Create the nodes for the import declarations.
/*if (modelElement.getImportSection() != null && !modelElement.getImportSection().getImportDeclarations().isEmpty()) {
createNode(parentNode, modelElement.getImportSection());
}*/
// Create a node per type declaration.
for (final XtendTypeDeclaration topElement : modelElement.getXtendTypes()) {
createNode(parentNode, topElement);
}
} | java | protected void _createChildren(DocumentRootNode parentNode, SarlScript modelElement) {
if (!Strings.isNullOrEmpty(modelElement.getPackage())) {
// Create the node for the package declaration.
createEStructuralFeatureNode(
parentNode, modelElement,
XtendPackage.Literals.XTEND_FILE__PACKAGE,
this.imageDispatcher.invoke(getClass().getPackage()),
// Do not use the text dispatcher below for avoiding to obtain
// the filename of the script.
modelElement.getPackage(),
true);
}
// Create the nodes for the import declarations.
/*if (modelElement.getImportSection() != null && !modelElement.getImportSection().getImportDeclarations().isEmpty()) {
createNode(parentNode, modelElement.getImportSection());
}*/
// Create a node per type declaration.
for (final XtendTypeDeclaration topElement : modelElement.getXtendTypes()) {
createNode(parentNode, topElement);
}
} | [
"protected",
"void",
"_createChildren",
"(",
"DocumentRootNode",
"parentNode",
",",
"SarlScript",
"modelElement",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"modelElement",
".",
"getPackage",
"(",
")",
")",
")",
"{",
"// Create the node for th... | Create a node for the SARL script.
@param parentNode the parent node.
@param modelElement the feature container for which a node should be created. | [
"Create",
"a",
"node",
"for",
"the",
"SARL",
"script",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/outline/SARLOutlineTreeProvider.java#L103-L123 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java | SequenceGibbsSampler.samplePosition | public double samplePosition(SequenceModel model, int[] sequence, int pos, double temperature) {
double[] distribution = model.scoresOf(sequence, pos);
if (temperature!=1.0) {
if (temperature==0.0) {
// set the max to 1.0
int argmax = ArrayMath.argmax(distribution);
Arrays.fill(distribution, Double.NEGATIVE_INFINITY);
distribution[argmax] = 0.0;
} else {
// take all to a power
// use the temperature to increase/decrease the entropy of the sampling distribution
ArrayMath.multiplyInPlace(distribution, 1.0/temperature);
}
}
ArrayMath.logNormalize(distribution);
ArrayMath.expInPlace(distribution);
int oldTag = sequence[pos];
int newTag = ArrayMath.sampleFromDistribution(distribution, random);
// System.out.println("Sampled " + oldTag + "->" + newTag);
sequence[pos] = newTag;
listener.updateSequenceElement(sequence, pos, oldTag);
return distribution[newTag];
} | java | public double samplePosition(SequenceModel model, int[] sequence, int pos, double temperature) {
double[] distribution = model.scoresOf(sequence, pos);
if (temperature!=1.0) {
if (temperature==0.0) {
// set the max to 1.0
int argmax = ArrayMath.argmax(distribution);
Arrays.fill(distribution, Double.NEGATIVE_INFINITY);
distribution[argmax] = 0.0;
} else {
// take all to a power
// use the temperature to increase/decrease the entropy of the sampling distribution
ArrayMath.multiplyInPlace(distribution, 1.0/temperature);
}
}
ArrayMath.logNormalize(distribution);
ArrayMath.expInPlace(distribution);
int oldTag = sequence[pos];
int newTag = ArrayMath.sampleFromDistribution(distribution, random);
// System.out.println("Sampled " + oldTag + "->" + newTag);
sequence[pos] = newTag;
listener.updateSequenceElement(sequence, pos, oldTag);
return distribution[newTag];
} | [
"public",
"double",
"samplePosition",
"(",
"SequenceModel",
"model",
",",
"int",
"[",
"]",
"sequence",
",",
"int",
"pos",
",",
"double",
"temperature",
")",
"{",
"double",
"[",
"]",
"distribution",
"=",
"model",
".",
"scoresOf",
"(",
"sequence",
",",
"pos"... | Samples a single position in the sequence.
Destructively modifies the sequence in place.
returns the score of the new sequence
@param sequence the sequence to start with
@param pos the position to sample. | [
"Samples",
"a",
"single",
"position",
"in",
"the",
"sequence",
".",
"Destructively",
"modifies",
"the",
"sequence",
"in",
"place",
".",
"returns",
"the",
"score",
"of",
"the",
"new",
"sequence"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java#L241-L263 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsTabbedPanel.java | CmsTabbedPanel.addWithLeftMargin | public void addWithLeftMargin(E tabContent, String tabName) {
tabContent.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll());
m_tabPanel.add(tabContent, CmsDomUtil.stripHtml(tabName));
int tabIndex = m_tabPanel.getWidgetIndex(tabContent);
Element tabElement = getTabElement(tabIndex);
if (tabElement != null) {
tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabLeftMargin());
if (!m_panelStyle.equals(CmsTabbedPanelStyle.classicTabs)) {
tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.generalCss().buttonCornerAll());
tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().borderAll());
}
}
m_tabPanel.checkTabOverflow();
} | java | public void addWithLeftMargin(E tabContent, String tabName) {
tabContent.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll());
m_tabPanel.add(tabContent, CmsDomUtil.stripHtml(tabName));
int tabIndex = m_tabPanel.getWidgetIndex(tabContent);
Element tabElement = getTabElement(tabIndex);
if (tabElement != null) {
tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().tabLeftMargin());
if (!m_panelStyle.equals(CmsTabbedPanelStyle.classicTabs)) {
tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.generalCss().buttonCornerAll());
tabElement.addClassName(I_CmsLayoutBundle.INSTANCE.tabbedPanelCss().borderAll());
}
}
m_tabPanel.checkTabOverflow();
} | [
"public",
"void",
"addWithLeftMargin",
"(",
"E",
"tabContent",
",",
"String",
"tabName",
")",
"{",
"tabContent",
".",
"addStyleName",
"(",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"generalCss",
"(",
")",
".",
"cornerAll",
"(",
")",
")",
";",
"m_tabPanel",
... | Add a new tab with the provided name and content and additional left margin.<p>
@param tabContent the widget to add as a tab
@param tabName the name of the tab to display in the tabbar | [
"Add",
"a",
"new",
"tab",
"with",
"the",
"provided",
"name",
"and",
"content",
"and",
"additional",
"left",
"margin",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsTabbedPanel.java#L352-L367 |
wildfly/wildfly-core | controller-client/src/main/java/org/jboss/as/controller/client/helpers/Operations.java | Operations.createWriteAttributeOperation | public static ModelNode createWriteAttributeOperation(final ModelNode address, final String attributeName, final boolean value) {
final ModelNode op = createNoValueWriteOperation(address, attributeName);
op.get(VALUE).set(value);
return op;
} | java | public static ModelNode createWriteAttributeOperation(final ModelNode address, final String attributeName, final boolean value) {
final ModelNode op = createNoValueWriteOperation(address, attributeName);
op.get(VALUE).set(value);
return op;
} | [
"public",
"static",
"ModelNode",
"createWriteAttributeOperation",
"(",
"final",
"ModelNode",
"address",
",",
"final",
"String",
"attributeName",
",",
"final",
"boolean",
"value",
")",
"{",
"final",
"ModelNode",
"op",
"=",
"createNoValueWriteOperation",
"(",
"address",... | Creates an operation to write an attribute value represented by the {@code attributeName} parameter.
@param address the address to create the write attribute for
@param attributeName the name of the attribute to write
@param value the value to set the attribute to
@return the operation | [
"Creates",
"an",
"operation",
"to",
"write",
"an",
"attribute",
"value",
"represented",
"by",
"the",
"{",
"@code",
"attributeName",
"}",
"parameter",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/helpers/Operations.java#L274-L278 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java | VMCommandLine.saveVMParametersIfNotSet | public static void saveVMParametersIfNotSet(String classToLaunch, String... parameters) {
if (classnameToLaunch == null || "".equals(classnameToLaunch)) { //$NON-NLS-1$
saveVMParameters(classToLaunch, parameters);
}
} | java | public static void saveVMParametersIfNotSet(String classToLaunch, String... parameters) {
if (classnameToLaunch == null || "".equals(classnameToLaunch)) { //$NON-NLS-1$
saveVMParameters(classToLaunch, parameters);
}
} | [
"public",
"static",
"void",
"saveVMParametersIfNotSet",
"(",
"String",
"classToLaunch",
",",
"String",
"...",
"parameters",
")",
"{",
"if",
"(",
"classnameToLaunch",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"classnameToLaunch",
")",
")",
"{",
"//$NON-NLS-... | Save parameters that permit to relaunch a VM with
{@link #relaunchVM()}.
@param classToLaunch is the class which contains a <code>main</code>.
@param parameters is the parameters to pass to the <code>main</code>.
@since 6.2 | [
"Save",
"parameters",
"that",
"permit",
"to",
"relaunch",
"a",
"VM",
"with",
"{",
"@link",
"#relaunchVM",
"()",
"}",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java#L354-L358 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java | FileSessionDataStore.sweepFile | public void sweepFile(long now, Path p) throws Exception {
if (p == null) {
return;
}
long expiry = getExpiryFromFilename(p.getFileName().toString());
// files with 0 expiry never expire
if (expiry > 0 && ((now - expiry) >= (5 * TimeUnit.SECONDS.toMillis(gracePeriodSec)))) {
Files.deleteIfExists(p);
if (log.isDebugEnabled()) {
log.debug("Sweep deleted " + p.getFileName());
}
}
} | java | public void sweepFile(long now, Path p) throws Exception {
if (p == null) {
return;
}
long expiry = getExpiryFromFilename(p.getFileName().toString());
// files with 0 expiry never expire
if (expiry > 0 && ((now - expiry) >= (5 * TimeUnit.SECONDS.toMillis(gracePeriodSec)))) {
Files.deleteIfExists(p);
if (log.isDebugEnabled()) {
log.debug("Sweep deleted " + p.getFileName());
}
}
} | [
"public",
"void",
"sweepFile",
"(",
"long",
"now",
",",
"Path",
"p",
")",
"throws",
"Exception",
"{",
"if",
"(",
"p",
"==",
"null",
")",
"{",
"return",
";",
"}",
"long",
"expiry",
"=",
"getExpiryFromFilename",
"(",
"p",
".",
"getFileName",
"(",
")",
... | Check to see if the expiry on the file is very old, and
delete the file if so. "Old" means that it expired at least
5 gracePeriods ago.
@param now the time now in msec
@param p the file to check
@throws Exception indicating error in sweep | [
"Check",
"to",
"see",
"if",
"the",
"expiry",
"on",
"the",
"file",
"is",
"very",
"old",
"and",
"delete",
"the",
"file",
"if",
"so",
".",
"Old",
"means",
"that",
"it",
"expired",
"at",
"least",
"5",
"gracePeriods",
"ago",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L315-L327 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java | EJSContainer.preInvoke | public EnterpriseBean preInvoke(EJSWrapper wrapper, int methodId,
EJSDeployedSupport s) throws RemoteException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "old preinvoke called by EJBDeploy, not new JACC preinvoke");
Object[] args = null; //LIDB2617.11
return preInvoke(wrapper, methodId, s, args); // f111627
} | java | public EnterpriseBean preInvoke(EJSWrapper wrapper, int methodId,
EJSDeployedSupport s) throws RemoteException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "old preinvoke called by EJBDeploy, not new JACC preinvoke");
Object[] args = null; //LIDB2617.11
return preInvoke(wrapper, methodId, s, args); // f111627
} | [
"public",
"EnterpriseBean",
"preInvoke",
"(",
"EJSWrapper",
"wrapper",
",",
"int",
"methodId",
",",
"EJSDeployedSupport",
"s",
")",
"throws",
"RemoteException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnable... | Perform container actions prior to invocation of bean method. <p>
This method is called before every bean method. It is responsible
for informing all container collaborators that a method invocation
is beginning. <p>
This method must return a <code>BeanO</code> instance that the
method may be invoked on. <p>
@param wrapper the <code>EJSWrapper</code> instance that method
is being invoked on <p>
@param methodId an int indicating which method on the bean is being
invoked <p>
@param s an instance of EJSDeployedSupport that records whether
a new transaction was started <p>
@exception RemoteException thrown if any error occur trying to set
container state; this exception will be "handled" by
postInvoke (see below) thanks to try-catch clauses in
deployed code (where preInvoke is called) <p> | [
"Perform",
"container",
"actions",
"prior",
"to",
"invocation",
"of",
"bean",
"method",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L2232-L2239 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java | VariablesInner.createOrUpdate | public VariableInner createOrUpdate(String resourceGroupName, String automationAccountName, String variableName, VariableCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName, parameters).toBlocking().single().body();
} | java | public VariableInner createOrUpdate(String resourceGroupName, String automationAccountName, String variableName, VariableCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName, parameters).toBlocking().single().body();
} | [
"public",
"VariableInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"variableName",
",",
"VariableCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"r... | Create a variable.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param variableName The variable name.
@param parameters The parameters supplied to the create or update variable operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VariableInner object if successful. | [
"Create",
"a",
"variable",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java#L105-L107 |
elki-project/elki | elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/Logging.java | Logging.debugFiner | public void debugFiner(CharSequence message, Throwable e) {
log(Level.FINER, message, e);
} | java | public void debugFiner(CharSequence message, Throwable e) {
log(Level.FINER, message, e);
} | [
"public",
"void",
"debugFiner",
"(",
"CharSequence",
"message",
",",
"Throwable",
"e",
")",
"{",
"log",
"(",
"Level",
".",
"FINER",
",",
"message",
",",
"e",
")",
";",
"}"
] | Log a message at the 'finer' debugging level.
You should check isDebugging() before building the message.
@param message Informational log message.
@param e Exception | [
"Log",
"a",
"message",
"at",
"the",
"finer",
"debugging",
"level",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/Logging.java#L491-L493 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/cache/CacheUtil.java | CacheUtil.copyWithDecompression | private static File copyWithDecompression(final File resource,
final String resourceLocation, final File copy)
throws ResourceDownloadError {
GZIPInputStream gzipis = null;
FileOutputStream fout = null;
try {
MagicNumberFileFilter mnff = new MagicNumberFileFilter(
GZIP_MAGIC_NUMBER);
if (mnff.accept(resource)) {
gzipis = new GZIPInputStream(new FileInputStream(
resource));
byte[] buffer = new byte[8192];
fout = new FileOutputStream(copy);
int length;
while ((length = gzipis.read(buffer, 0, 8192)) != -1) {
fout.write(buffer, 0, length);
}
} else {
copyFile(resource, copy);
}
} catch (IOException e) {
String msg = e.getMessage();
ResourceDownloadError r =
new ResourceDownloadError(resourceLocation, msg);
r.initCause(e);
throw r;
} finally {
// clean up all I/O resources
closeQuietly(fout);
closeQuietly(gzipis);
}
return copy;
} | java | private static File copyWithDecompression(final File resource,
final String resourceLocation, final File copy)
throws ResourceDownloadError {
GZIPInputStream gzipis = null;
FileOutputStream fout = null;
try {
MagicNumberFileFilter mnff = new MagicNumberFileFilter(
GZIP_MAGIC_NUMBER);
if (mnff.accept(resource)) {
gzipis = new GZIPInputStream(new FileInputStream(
resource));
byte[] buffer = new byte[8192];
fout = new FileOutputStream(copy);
int length;
while ((length = gzipis.read(buffer, 0, 8192)) != -1) {
fout.write(buffer, 0, length);
}
} else {
copyFile(resource, copy);
}
} catch (IOException e) {
String msg = e.getMessage();
ResourceDownloadError r =
new ResourceDownloadError(resourceLocation, msg);
r.initCause(e);
throw r;
} finally {
// clean up all I/O resources
closeQuietly(fout);
closeQuietly(gzipis);
}
return copy;
} | [
"private",
"static",
"File",
"copyWithDecompression",
"(",
"final",
"File",
"resource",
",",
"final",
"String",
"resourceLocation",
",",
"final",
"File",
"copy",
")",
"throws",
"ResourceDownloadError",
"{",
"GZIPInputStream",
"gzipis",
"=",
"null",
";",
"FileOutputS... | Copies the <tt>resource</tt> to <tt>copy</tt>. Decompression is
performed if the resource file is identified as a GZIP-encoded file.
@param resource {@link File}, the resource to copy
@param resourceLocation {@link String}, the resource location url
@param copy {@link File}, the file to copy to
@return {@link File}, the copied file
@throws ResourceDownloadError Thrown if an IO error copying the resource | [
"Copies",
"the",
"<tt",
">",
"resource<",
"/",
"tt",
">",
"to",
"<tt",
">",
"copy<",
"/",
"tt",
">",
".",
"Decompression",
"is",
"performed",
"if",
"the",
"resource",
"file",
"is",
"identified",
"as",
"a",
"GZIP",
"-",
"encoded",
"file",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/cache/CacheUtil.java#L297-L333 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrTokenizer.java | StrTokenizer.readNextToken | private int readNextToken(final char[] srcChars, int start, final int len, final StrBuilder workArea, final List<String> tokenList) {
// skip all leading whitespace, unless it is the
// field delimiter or the quote character
while (start < len) {
final int removeLen = Math.max(
getIgnoredMatcher().isMatch(srcChars, start, start, len),
getTrimmerMatcher().isMatch(srcChars, start, start, len));
if (removeLen == 0 ||
getDelimiterMatcher().isMatch(srcChars, start, start, len) > 0 ||
getQuoteMatcher().isMatch(srcChars, start, start, len) > 0) {
break;
}
start += removeLen;
}
// handle reaching end
if (start >= len) {
addToken(tokenList, StringUtils.EMPTY);
return -1;
}
// handle empty token
final int delimLen = getDelimiterMatcher().isMatch(srcChars, start, start, len);
if (delimLen > 0) {
addToken(tokenList, StringUtils.EMPTY);
return start + delimLen;
}
// handle found token
final int quoteLen = getQuoteMatcher().isMatch(srcChars, start, start, len);
if (quoteLen > 0) {
return readWithQuotes(srcChars, start + quoteLen, len, workArea, tokenList, start, quoteLen);
}
return readWithQuotes(srcChars, start, len, workArea, tokenList, 0, 0);
} | java | private int readNextToken(final char[] srcChars, int start, final int len, final StrBuilder workArea, final List<String> tokenList) {
// skip all leading whitespace, unless it is the
// field delimiter or the quote character
while (start < len) {
final int removeLen = Math.max(
getIgnoredMatcher().isMatch(srcChars, start, start, len),
getTrimmerMatcher().isMatch(srcChars, start, start, len));
if (removeLen == 0 ||
getDelimiterMatcher().isMatch(srcChars, start, start, len) > 0 ||
getQuoteMatcher().isMatch(srcChars, start, start, len) > 0) {
break;
}
start += removeLen;
}
// handle reaching end
if (start >= len) {
addToken(tokenList, StringUtils.EMPTY);
return -1;
}
// handle empty token
final int delimLen = getDelimiterMatcher().isMatch(srcChars, start, start, len);
if (delimLen > 0) {
addToken(tokenList, StringUtils.EMPTY);
return start + delimLen;
}
// handle found token
final int quoteLen = getQuoteMatcher().isMatch(srcChars, start, start, len);
if (quoteLen > 0) {
return readWithQuotes(srcChars, start + quoteLen, len, workArea, tokenList, start, quoteLen);
}
return readWithQuotes(srcChars, start, len, workArea, tokenList, 0, 0);
} | [
"private",
"int",
"readNextToken",
"(",
"final",
"char",
"[",
"]",
"srcChars",
",",
"int",
"start",
",",
"final",
"int",
"len",
",",
"final",
"StrBuilder",
"workArea",
",",
"final",
"List",
"<",
"String",
">",
"tokenList",
")",
"{",
"// skip all leading whit... | Reads character by character through the String to get the next token.
@param srcChars the character array being tokenized
@param start the first character of field
@param len the length of the character array being tokenized
@param workArea a temporary work area
@param tokenList the list of parsed tokens
@return the starting position of the next field (the character
immediately after the delimiter), or -1 if end of string found | [
"Reads",
"character",
"by",
"character",
"through",
"the",
"String",
"to",
"get",
"the",
"next",
"token",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java#L694-L728 |
samskivert/samskivert | src/main/java/com/samskivert/swing/Label.java | Label.unescapeColors | private static String unescapeColors (String txt, boolean restore)
{
if (txt == null) return null;
String prefix = restore ? "#" : "%";
return ESCAPED_PATTERN.matcher(txt).replaceAll(prefix + "$1");
} | java | private static String unescapeColors (String txt, boolean restore)
{
if (txt == null) return null;
String prefix = restore ? "#" : "%";
return ESCAPED_PATTERN.matcher(txt).replaceAll(prefix + "$1");
} | [
"private",
"static",
"String",
"unescapeColors",
"(",
"String",
"txt",
",",
"boolean",
"restore",
")",
"{",
"if",
"(",
"txt",
"==",
"null",
")",
"return",
"null",
";",
"String",
"prefix",
"=",
"restore",
"?",
"\"#\"",
":",
"\"%\"",
";",
"return",
"ESCAPE... | Un-escape escaped tags so that they look as the users intended. | [
"Un",
"-",
"escape",
"escaped",
"tags",
"so",
"that",
"they",
"look",
"as",
"the",
"users",
"intended",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/Label.java#L84-L89 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java | MasterStorableGenerator.addEnterTransaction | private Label addEnterTransaction(CodeBuilder b, String opType, LocalVariable txnVar) {
if (!alwaysHasTxn(opType)) {
return null;
}
// Repository repo = masterSupport.getRootRepository();
TypeDesc repositoryType = TypeDesc.forClass(Repository.class);
TypeDesc transactionType = TypeDesc.forClass(Transaction.class);
TypeDesc triggerSupportType = TypeDesc.forClass(TriggerSupport.class);
TypeDesc masterSupportType = TypeDesc.forClass(MasterSupport.class);
TypeDesc isolationLevelType = TypeDesc.forClass(IsolationLevel.class);
b.loadThis();
b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, triggerSupportType);
b.invokeInterface(masterSupportType, "getRootRepository",
repositoryType, null);
if (requiresTxnForUpdate(opType)) {
// Always create nested transaction.
// txn = repo.enterTransaction();
// txn.setForUpdate(true);
b.invokeInterface(repositoryType, ENTER_TRANSACTION_METHOD_NAME,
transactionType, null);
b.storeLocal(txnVar);
b.loadLocal(txnVar);
b.loadConstant(true);
b.invokeInterface(transactionType, SET_FOR_UPDATE_METHOD_NAME, null,
new TypeDesc[] {TypeDesc.BOOLEAN});
} else {
LocalVariable repoVar = b.createLocalVariable(null, repositoryType);
b.storeLocal(repoVar);
// if (repo.getTransactionIsolationLevel() != null) {
// txn = null;
// } else {
// txn = repo.enterTransaction();
// }
b.loadLocal(repoVar);
b.invokeInterface(repositoryType, GET_TRANSACTION_ISOLATION_LEVEL_METHOD_NAME,
isolationLevelType, null);
Label notInTxn = b.createLabel();
b.ifNullBranch(notInTxn, true);
b.loadNull();
Label storeTxn = b.createLabel();
b.branch(storeTxn);
notInTxn.setLocation();
b.loadLocal(repoVar);
b.invokeInterface(repositoryType, ENTER_TRANSACTION_METHOD_NAME,
transactionType, null);
storeTxn.setLocation();
b.storeLocal(txnVar);
}
return b.createLabel().setLocation();
} | java | private Label addEnterTransaction(CodeBuilder b, String opType, LocalVariable txnVar) {
if (!alwaysHasTxn(opType)) {
return null;
}
// Repository repo = masterSupport.getRootRepository();
TypeDesc repositoryType = TypeDesc.forClass(Repository.class);
TypeDesc transactionType = TypeDesc.forClass(Transaction.class);
TypeDesc triggerSupportType = TypeDesc.forClass(TriggerSupport.class);
TypeDesc masterSupportType = TypeDesc.forClass(MasterSupport.class);
TypeDesc isolationLevelType = TypeDesc.forClass(IsolationLevel.class);
b.loadThis();
b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, triggerSupportType);
b.invokeInterface(masterSupportType, "getRootRepository",
repositoryType, null);
if (requiresTxnForUpdate(opType)) {
// Always create nested transaction.
// txn = repo.enterTransaction();
// txn.setForUpdate(true);
b.invokeInterface(repositoryType, ENTER_TRANSACTION_METHOD_NAME,
transactionType, null);
b.storeLocal(txnVar);
b.loadLocal(txnVar);
b.loadConstant(true);
b.invokeInterface(transactionType, SET_FOR_UPDATE_METHOD_NAME, null,
new TypeDesc[] {TypeDesc.BOOLEAN});
} else {
LocalVariable repoVar = b.createLocalVariable(null, repositoryType);
b.storeLocal(repoVar);
// if (repo.getTransactionIsolationLevel() != null) {
// txn = null;
// } else {
// txn = repo.enterTransaction();
// }
b.loadLocal(repoVar);
b.invokeInterface(repositoryType, GET_TRANSACTION_ISOLATION_LEVEL_METHOD_NAME,
isolationLevelType, null);
Label notInTxn = b.createLabel();
b.ifNullBranch(notInTxn, true);
b.loadNull();
Label storeTxn = b.createLabel();
b.branch(storeTxn);
notInTxn.setLocation();
b.loadLocal(repoVar);
b.invokeInterface(repositoryType, ENTER_TRANSACTION_METHOD_NAME,
transactionType, null);
storeTxn.setLocation();
b.storeLocal(txnVar);
}
return b.createLabel().setLocation();
} | [
"private",
"Label",
"addEnterTransaction",
"(",
"CodeBuilder",
"b",
",",
"String",
"opType",
",",
"LocalVariable",
"txnVar",
")",
"{",
"if",
"(",
"!",
"alwaysHasTxn",
"(",
"opType",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Repository repo = masterSupport.g... | Generates code to enter a transaction, if required and if none in progress.
@param opType type of operation, Insert, Update, or Delete
@param txnVar required variable of type Transaction for storing transaction
@return optional try start label for transaction | [
"Generates",
"code",
"to",
"enter",
"a",
"transaction",
"if",
"required",
"and",
"if",
"none",
"in",
"progress",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/MasterStorableGenerator.java#L1002-L1063 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/MapModel.java | MapModel.accept | public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) {
// Paint the MapModel itself (see MapModelPainter):
visitor.visit(this, group);
// Paint the layers:
if (recursive) {
for (Layer<?> layer : layers) {
if (layer.isShowing()) {
layer.accept(visitor, group, bounds, recursive);
} else {
// JDM: paint the top part of the layer, if not we loose the map order
layer.accept(visitor, group, bounds, false);
}
}
}
// Paint the editing of a feature (if a feature is being edited):
if (featureEditor.getFeatureTransaction() != null) {
featureEditor.getFeatureTransaction().accept(visitor, group, bounds, recursive);
}
} | java | public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) {
// Paint the MapModel itself (see MapModelPainter):
visitor.visit(this, group);
// Paint the layers:
if (recursive) {
for (Layer<?> layer : layers) {
if (layer.isShowing()) {
layer.accept(visitor, group, bounds, recursive);
} else {
// JDM: paint the top part of the layer, if not we loose the map order
layer.accept(visitor, group, bounds, false);
}
}
}
// Paint the editing of a feature (if a feature is being edited):
if (featureEditor.getFeatureTransaction() != null) {
featureEditor.getFeatureTransaction().accept(visitor, group, bounds, recursive);
}
} | [
"public",
"void",
"accept",
"(",
"PainterVisitor",
"visitor",
",",
"Object",
"group",
",",
"Bbox",
"bounds",
",",
"boolean",
"recursive",
")",
"{",
"// Paint the MapModel itself (see MapModelPainter):",
"visitor",
".",
"visit",
"(",
"this",
",",
"group",
")",
";",... | Paintable implementation. First let the PainterVisitor paint this object, then if recursive is true, painter the
layers in order. | [
"Paintable",
"implementation",
".",
"First",
"let",
"the",
"PainterVisitor",
"paint",
"this",
"object",
"then",
"if",
"recursive",
"is",
"true",
"painter",
"the",
"layers",
"in",
"order",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapModel.java#L325-L345 |
stratosphere/stratosphere | stratosphere-compiler/src/main/java/eu/stratosphere/compiler/PactCompiler.java | PactCompiler.getType | private InstanceTypeDescription getType(Map<InstanceType, InstanceTypeDescription> types)
throws CompilerException
{
if (types == null || types.size() < 1) {
throw new IllegalArgumentException("No instance type found.");
}
InstanceTypeDescription retValue = null;
long totalMemory = 0;
int numInstances = 0;
final Iterator<InstanceTypeDescription> it = types.values().iterator();
while(it.hasNext())
{
final InstanceTypeDescription descr = it.next();
// skip instances for which no hardware description is available
// this means typically that no
if (descr.getHardwareDescription() == null || descr.getInstanceType() == null) {
continue;
}
final int curInstances = descr.getMaximumNumberOfAvailableInstances();
final long curMemory = curInstances * descr.getHardwareDescription().getSizeOfFreeMemory();
// get, if first, or if it has more instances and not less memory, or if it has significantly more memory
// and the same number of cores still
if ( (retValue == null) ||
(curInstances > numInstances && (int) (curMemory * 1.2f) > totalMemory) ||
(curInstances * retValue.getInstanceType().getNumberOfCores() >= numInstances &&
(int) (curMemory * 1.5f) > totalMemory)
)
{
retValue = descr;
numInstances = curInstances;
totalMemory = curMemory;
}
}
if (retValue == null) {
throw new CompilerException("No instance currently registered at the job-manager. Retry later.\n" +
"If the system has recently started, it may take a few seconds until the instances register.");
}
return retValue;
} | java | private InstanceTypeDescription getType(Map<InstanceType, InstanceTypeDescription> types)
throws CompilerException
{
if (types == null || types.size() < 1) {
throw new IllegalArgumentException("No instance type found.");
}
InstanceTypeDescription retValue = null;
long totalMemory = 0;
int numInstances = 0;
final Iterator<InstanceTypeDescription> it = types.values().iterator();
while(it.hasNext())
{
final InstanceTypeDescription descr = it.next();
// skip instances for which no hardware description is available
// this means typically that no
if (descr.getHardwareDescription() == null || descr.getInstanceType() == null) {
continue;
}
final int curInstances = descr.getMaximumNumberOfAvailableInstances();
final long curMemory = curInstances * descr.getHardwareDescription().getSizeOfFreeMemory();
// get, if first, or if it has more instances and not less memory, or if it has significantly more memory
// and the same number of cores still
if ( (retValue == null) ||
(curInstances > numInstances && (int) (curMemory * 1.2f) > totalMemory) ||
(curInstances * retValue.getInstanceType().getNumberOfCores() >= numInstances &&
(int) (curMemory * 1.5f) > totalMemory)
)
{
retValue = descr;
numInstances = curInstances;
totalMemory = curMemory;
}
}
if (retValue == null) {
throw new CompilerException("No instance currently registered at the job-manager. Retry later.\n" +
"If the system has recently started, it may take a few seconds until the instances register.");
}
return retValue;
} | [
"private",
"InstanceTypeDescription",
"getType",
"(",
"Map",
"<",
"InstanceType",
",",
"InstanceTypeDescription",
">",
"types",
")",
"throws",
"CompilerException",
"{",
"if",
"(",
"types",
"==",
"null",
"||",
"types",
".",
"size",
"(",
")",
"<",
"1",
")",
"{... | This utility method picks the instance type to be used for executing programs.
<p>
@param types The available types.
@return The type to be used for scheduling.
@throws CompilerException
@throws IllegalArgumentException | [
"This",
"utility",
"method",
"picks",
"the",
"instance",
"type",
"to",
"be",
"used",
"for",
"executing",
"programs",
".",
"<p",
">"
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/PactCompiler.java#L1577-L1622 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java | FindingReplacing.setBefore | public InclusMultiPos<S, String, String> setBefore(String right) {
return new InclusMultiPos<S, String, String>(right, right) {
@Override protected S result() {
return delegateQueue('B', left, right, pos, position, inclusive, plusminus, filltgt);
}
};
} | java | public InclusMultiPos<S, String, String> setBefore(String right) {
return new InclusMultiPos<S, String, String>(right, right) {
@Override protected S result() {
return delegateQueue('B', left, right, pos, position, inclusive, plusminus, filltgt);
}
};
} | [
"public",
"InclusMultiPos",
"<",
"S",
",",
"String",
",",
"String",
">",
"setBefore",
"(",
"String",
"right",
")",
"{",
"return",
"new",
"InclusMultiPos",
"<",
"S",
",",
"String",
",",
"String",
">",
"(",
"right",
",",
"right",
")",
"{",
"@",
"Override... | Sets the specified position substring before given right tag as the delegate string
<p><b>The look result same as {@link StrMatcher#finder()}'s behavior</b>
@see StrMatcher#finder()
@param left
@param right
@return | [
"Sets",
"the",
"specified",
"position",
"substring",
"before",
"given",
"right",
"tag",
"as",
"the",
"delegate",
"string",
"<p",
">",
"<b",
">",
"The",
"look",
"result",
"same",
"as",
"{",
"@link",
"StrMatcher#finder",
"()",
"}",
"s",
"behavior<",
"/",
"b"... | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java#L399-L406 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java | MatcherLibrary.getRelationFromSenseGlossMatchers | private char getRelationFromSenseGlossMatchers(List<ISense> sourceSenses, List<ISense> targetSenses) throws MatcherLibraryException {
char relation = IMappingElement.IDK;
if (0 < senseGlossMatchers.size()) {
for (ISense sourceSense : sourceSenses) {
//noinspection LoopStatementThatDoesntLoop
for (ISense targetSense : targetSenses) {
int k = 0;
while ((relation == IMappingElement.IDK) && (k < senseGlossMatchers.size())) {
relation = senseGlossMatchers.get(k).match(sourceSense, targetSense);
k++;
}
return relation;
}
}
}
return relation;
} | java | private char getRelationFromSenseGlossMatchers(List<ISense> sourceSenses, List<ISense> targetSenses) throws MatcherLibraryException {
char relation = IMappingElement.IDK;
if (0 < senseGlossMatchers.size()) {
for (ISense sourceSense : sourceSenses) {
//noinspection LoopStatementThatDoesntLoop
for (ISense targetSense : targetSenses) {
int k = 0;
while ((relation == IMappingElement.IDK) && (k < senseGlossMatchers.size())) {
relation = senseGlossMatchers.get(k).match(sourceSense, targetSense);
k++;
}
return relation;
}
}
}
return relation;
} | [
"private",
"char",
"getRelationFromSenseGlossMatchers",
"(",
"List",
"<",
"ISense",
">",
"sourceSenses",
",",
"List",
"<",
"ISense",
">",
"targetSenses",
")",
"throws",
"MatcherLibraryException",
"{",
"char",
"relation",
"=",
"IMappingElement",
".",
"IDK",
";",
"i... | Returns semantic relation between two sets of senses by WordNet sense-based matchers.
@param sourceSenses source senses
@param targetSenses target senses
@return semantic relation between two sets of senses
@throws MatcherLibraryException MatcherLibraryException | [
"Returns",
"semantic",
"relation",
"between",
"two",
"sets",
"of",
"senses",
"by",
"WordNet",
"sense",
"-",
"based",
"matchers",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java#L228-L244 |
MeetMe/font-compat | mock/src/main/java/android/graphics/FontFamily.java | FontFamily.addFontWeightStyle | @TargetApi(24)
public boolean addFontWeightStyle(ByteBuffer buffer, int ttcIndex, List axes, int weight, boolean isItalic) {
// Acceptable: ttcIndex==0, axes==emptyList
throw new RuntimeException();
} | java | @TargetApi(24)
public boolean addFontWeightStyle(ByteBuffer buffer, int ttcIndex, List axes, int weight, boolean isItalic) {
// Acceptable: ttcIndex==0, axes==emptyList
throw new RuntimeException();
} | [
"@",
"TargetApi",
"(",
"24",
")",
"public",
"boolean",
"addFontWeightStyle",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"ttcIndex",
",",
"List",
"axes",
",",
"int",
"weight",
",",
"boolean",
"isItalic",
")",
"{",
"// Acceptable: ttcIndex==0, axes==emptyList",
"thro... | <pre>addFontWeightStyle(ByteBuffer, int ttcIndex, List<axes>, int weight, boolean isItalic)</pre>
@since API Level 24 | [
"<pre",
">",
"addFontWeightStyle",
"(",
"ByteBuffer",
"int",
"ttcIndex",
"List<",
";",
"axes>",
";",
"int",
"weight",
"boolean",
"isItalic",
")",
"<",
"/",
"pre",
">"
] | train | https://github.com/MeetMe/font-compat/blob/db913e6533d02e1300177682e95d4a23ca47030f/mock/src/main/java/android/graphics/FontFamily.java#L51-L55 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java | HsqlTimer.addTask | protected Task addTask(final long first, final Runnable runnable,
final long period, boolean relative) {
if (this.isShutdown) {
throw new IllegalStateException("shutdown");
}
final Task task = new Task(first, runnable, period, relative);
// sychronized
this.taskQueue.addTask(task);
// sychronized
this.restart();
return task;
} | java | protected Task addTask(final long first, final Runnable runnable,
final long period, boolean relative) {
if (this.isShutdown) {
throw new IllegalStateException("shutdown");
}
final Task task = new Task(first, runnable, period, relative);
// sychronized
this.taskQueue.addTask(task);
// sychronized
this.restart();
return task;
} | [
"protected",
"Task",
"addTask",
"(",
"final",
"long",
"first",
",",
"final",
"Runnable",
"runnable",
",",
"final",
"long",
"period",
",",
"boolean",
"relative",
")",
"{",
"if",
"(",
"this",
".",
"isShutdown",
")",
"{",
"throw",
"new",
"IllegalStateException"... | Adds to the task queue a new Task object encapsulating the supplied
Runnable and scheduling arguments.
@param first the time of the task's first execution
@param runnable the Runnable to execute
@param period the task's periodicity
@param relative if true, use fixed rate else use fixed delay scheduling
@return an opaque reference to the internal task | [
"Adds",
"to",
"the",
"task",
"queue",
"a",
"new",
"Task",
"object",
"encapsulating",
"the",
"supplied",
"Runnable",
"and",
"scheduling",
"arguments",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L463-L479 |
Jasig/spring-portlet-contrib | spring-security-portlet-contrib/src/main/java/org/jasig/springframework/security/portlet/authentication/PortletPreAuthenticatedAuthenticationDetailsSource.java | PortletPreAuthenticatedAuthenticationDetailsSource.buildDetails | public PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails buildDetails(PortletRequest context) {
Collection<? extends GrantedAuthority> userGas = buildGrantedAuthorities(context);
PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails result =
new PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails(context, userGas);
return result;
} | java | public PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails buildDetails(PortletRequest context) {
Collection<? extends GrantedAuthority> userGas = buildGrantedAuthorities(context);
PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails result =
new PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails(context, userGas);
return result;
} | [
"public",
"PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails",
"buildDetails",
"(",
"PortletRequest",
"context",
")",
"{",
"Collection",
"<",
"?",
"extends",
"GrantedAuthority",
">",
"userGas",
"=",
"buildGrantedAuthorities",
"(",
"context",
")",
";",
"PreAuthe... | Builds the authentication details object.
@see org.springframework.security.authentication.AuthenticationDetailsSource#buildDetails(Object)
@param context a {@link javax.portlet.PortletRequest} object.
@return a {@link org.jasig.springframework.security.portlet.authentication.PreAuthenticatedGrantedAuthoritiesPortletAuthenticationDetails} object. | [
"Builds",
"the",
"authentication",
"details",
"object",
"."
] | train | https://github.com/Jasig/spring-portlet-contrib/blob/719240fa268ddc69900ce9775d9cad3b9c543c6b/spring-security-portlet-contrib/src/main/java/org/jasig/springframework/security/portlet/authentication/PortletPreAuthenticatedAuthenticationDetailsSource.java#L93-L101 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/protocol/protocoludp_stats.java | protocoludp_stats.get_nitro_response | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
protocoludp_stats[] resources = new protocoludp_stats[1];
protocoludp_response result = (protocoludp_response) service.get_payload_formatter().string_to_resource(protocoludp_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.protocoludp;
return resources;
} | java | protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception {
protocoludp_stats[] resources = new protocoludp_stats[1];
protocoludp_response result = (protocoludp_response) service.get_payload_formatter().string_to_resource(protocoludp_response.class, response);
if(result.errorcode != 0) {
if (result.errorcode == 444) {
service.clear_session();
}
if(result.severity != null)
{
if (result.severity.equals("ERROR"))
throw new nitro_exception(result.message,result.errorcode);
}
else
{
throw new nitro_exception(result.message,result.errorcode);
}
}
resources[0] = result.protocoludp;
return resources;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"protocoludp_stats",
"[",
"]",
"resources",
"=",
"new",
"protocoludp_stats",
"[",
"1",
"]",
";",
"protocoludp... | <pre>
converts nitro response into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"converts",
"nitro",
"response",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/protocol/protocoludp_stats.java#L184-L203 |
google/Accessibility-Test-Framework-for-Android | src/main/java/com/googlecode/eyesfree/utils/ScreenshotUtils.java | ScreenshotUtils.writeBitmapToCache | public static File writeBitmapToCache(Context context, Bitmap bitmap, String dir,
String filename) {
if ((bitmap == null) || TextUtils.isEmpty(dir) || TextUtils.isEmpty(filename)) {
return null;
}
final File dirFile = new File(context.getCacheDir(), dir);
return writeBitmapToDirectory(bitmap, filename, dirFile);
} | java | public static File writeBitmapToCache(Context context, Bitmap bitmap, String dir,
String filename) {
if ((bitmap == null) || TextUtils.isEmpty(dir) || TextUtils.isEmpty(filename)) {
return null;
}
final File dirFile = new File(context.getCacheDir(), dir);
return writeBitmapToDirectory(bitmap, filename, dirFile);
} | [
"public",
"static",
"File",
"writeBitmapToCache",
"(",
"Context",
"context",
",",
"Bitmap",
"bitmap",
",",
"String",
"dir",
",",
"String",
"filename",
")",
"{",
"if",
"(",
"(",
"bitmap",
"==",
"null",
")",
"||",
"TextUtils",
".",
"isEmpty",
"(",
"dir",
"... | Writes a {@link Bitmap} object to a file in the current context's cache directory.
@param context The current context.
@param bitmap The bitmap object to output.
@param dir The output directory name within the cache directory.
@param filename The name of the file to output.
@return A file where the Bitmap was stored, or {@code null} if the write
operation failed. | [
"Writes",
"a",
"{",
"@link",
"Bitmap",
"}",
"object",
"to",
"a",
"file",
"in",
"the",
"current",
"context",
"s",
"cache",
"directory",
"."
] | train | https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/ScreenshotUtils.java#L212-L219 |
qiniu/java-sdk | src/main/java/com/qiniu/storage/UploadManager.java | UploadManager.asyncPut | public void asyncPut(final byte[] data, final String key, final String token, StringMap params,
String mime, boolean checkCrc, UpCompletionHandler handler) throws IOException {
checkArgs(key, data, null, token);
if (mime == null) {
mime = Client.DefaultMime;
}
params = filterParam(params);
new FormUploader(client, token, key, data, params, mime, checkCrc, configuration).asyncUpload(handler);
} | java | public void asyncPut(final byte[] data, final String key, final String token, StringMap params,
String mime, boolean checkCrc, UpCompletionHandler handler) throws IOException {
checkArgs(key, data, null, token);
if (mime == null) {
mime = Client.DefaultMime;
}
params = filterParam(params);
new FormUploader(client, token, key, data, params, mime, checkCrc, configuration).asyncUpload(handler);
} | [
"public",
"void",
"asyncPut",
"(",
"final",
"byte",
"[",
"]",
"data",
",",
"final",
"String",
"key",
",",
"final",
"String",
"token",
",",
"StringMap",
"params",
",",
"String",
"mime",
",",
"boolean",
"checkCrc",
",",
"UpCompletionHandler",
"handler",
")",
... | 异步上传数据
@param data 上传的数据
@param key 上传数据保存的文件名
@param token 上传凭证
@param params 自定义参数,如 params.put("x:foo", "foo")
@param mime 指定文件mimetype
@param checkCrc 是否验证crc32
@param handler 上传完成的回调函数 | [
"异步上传数据"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/UploadManager.java#L226-L234 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/Table.java | Table.setColumnStyle | public void setColumnStyle(final int col, final TableColumnStyle ts) throws FastOdsException {
if (this.appender.isPreambleWritten()) throw new IllegalStateException();
this.builder.setColumnStyle(col, ts);
} | java | public void setColumnStyle(final int col, final TableColumnStyle ts) throws FastOdsException {
if (this.appender.isPreambleWritten()) throw new IllegalStateException();
this.builder.setColumnStyle(col, ts);
} | [
"public",
"void",
"setColumnStyle",
"(",
"final",
"int",
"col",
",",
"final",
"TableColumnStyle",
"ts",
")",
"throws",
"FastOdsException",
"{",
"if",
"(",
"this",
".",
"appender",
".",
"isPreambleWritten",
"(",
")",
")",
"throw",
"new",
"IllegalStateException",
... | Set the style of a column.
@param col The column number
@param ts The style to be used, make sure the style is of type
TableFamilyStyle.STYLEFAMILY_TABLECOLUMN
@throws FastOdsException Thrown if col has an invalid value. | [
"Set",
"the",
"style",
"of",
"a",
"column",
"."
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/Table.java#L280-L284 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildContents | public void buildContents(XMLNode node, Content contentTree) {
Content contentListTree = writer.getContentsHeader();
printedPackageHeaders = new HashSet<>();
for (PackageDoc pkg : configuration.packages) {
if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg.name())) {
writer.addLinkToPackageContent(pkg,
parsePackageName(pkg.name()),
printedPackageHeaders, contentListTree);
}
}
writer.addContentsList(contentTree, contentListTree);
} | java | public void buildContents(XMLNode node, Content contentTree) {
Content contentListTree = writer.getContentsHeader();
printedPackageHeaders = new HashSet<>();
for (PackageDoc pkg : configuration.packages) {
if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg.name())) {
writer.addLinkToPackageContent(pkg,
parsePackageName(pkg.name()),
printedPackageHeaders, contentListTree);
}
}
writer.addContentsList(contentTree, contentListTree);
} | [
"public",
"void",
"buildContents",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"{",
"Content",
"contentListTree",
"=",
"writer",
".",
"getContentsHeader",
"(",
")",
";",
"printedPackageHeaders",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for"... | Build the list of packages.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the content list will be added | [
"Build",
"the",
"list",
"of",
"packages",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java#L158-L169 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.notEmpty | @CodingStyleguideUnaware
public static <T extends Iterable <?>> T notEmpty (final T aValue, final String sName)
{
if (isEnabled ())
return notEmpty (aValue, () -> sName);
return aValue;
} | java | @CodingStyleguideUnaware
public static <T extends Iterable <?>> T notEmpty (final T aValue, final String sName)
{
if (isEnabled ())
return notEmpty (aValue, () -> sName);
return aValue;
} | [
"@",
"CodingStyleguideUnaware",
"public",
"static",
"<",
"T",
"extends",
"Iterable",
"<",
"?",
">",
">",
"T",
"notEmpty",
"(",
"final",
"T",
"aValue",
",",
"final",
"String",
"sName",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"return",
"notEmpty",... | Check that the passed {@link Iterable} is neither <code>null</code> nor
empty.
@param <T>
Type to be checked and returned
@param aValue
The String to check.
@param sName
The name of the value (e.g. the parameter name)
@return The passed value.
@throws IllegalArgumentException
if the passed value is empty | [
"Check",
"that",
"the",
"passed",
"{",
"@link",
"Iterable",
"}",
"is",
"neither",
"<code",
">",
"null<",
"/",
"code",
">",
"nor",
"empty",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L781-L787 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPreference.java | GVRPreference.getProperty | public String getProperty(String key, String defaultValue) {
return mProperties.getProperty(key, defaultValue);
} | java | public String getProperty(String key, String defaultValue) {
return mProperties.getProperty(key, defaultValue);
} | [
"public",
"String",
"getProperty",
"(",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"return",
"mProperties",
".",
"getProperty",
"(",
"key",
",",
"defaultValue",
")",
";",
"}"
] | Gets a property with a default value.
@param key
The key string.
@param defaultValue
The default value.
@return The property string. | [
"Gets",
"a",
"property",
"with",
"a",
"default",
"value",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPreference.java#L63-L65 |
amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.ofPairs | public static <T> EntryStream<T, T> ofPairs(List<T> list) {
return of(new PairPermutationSpliterator<>(list, SimpleImmutableEntry::new));
} | java | public static <T> EntryStream<T, T> ofPairs(List<T> list) {
return of(new PairPermutationSpliterator<>(list, SimpleImmutableEntry::new));
} | [
"public",
"static",
"<",
"T",
">",
"EntryStream",
"<",
"T",
",",
"T",
">",
"ofPairs",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"return",
"of",
"(",
"new",
"PairPermutationSpliterator",
"<>",
"(",
"list",
",",
"SimpleImmutableEntry",
"::",
"new",
"... | Returns a sequential ordered {@code EntryStream} containing the possible
pairs of elements taken from the provided list.
<p>
Both keys and values are taken from the input list. The index of the key
is always strictly less than the index of the value. The pairs in the
stream are lexicographically ordered. For example, for the list of three
elements the stream of three elements is created:
{@code Map.Entry(list.get(0), list.get(1))},
{@code Map.Entry(list.get(0), list.get(2))} and
{@code Map.Entry(list.get(1), list.get(2))}. The number of elements in
the resulting stream is {@code list.size()*(list.size()+1L)/2}.
<p>
The list values are accessed using {@link List#get(int)}, so the list
should provide fast random access. The list is assumed to be unmodifiable
during the stream operations.
@param <T> type of the list elements
@param list a list to take the elements from
@return a new {@code EntryStream}
@see StreamEx#ofPairs(List, BiFunction)
@since 0.3.6 | [
"Returns",
"a",
"sequential",
"ordered",
"{",
"@code",
"EntryStream",
"}",
"containing",
"the",
"possible",
"pairs",
"of",
"elements",
"taken",
"from",
"the",
"provided",
"list",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L2035-L2037 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.deleteRelationsForResource | public void deleteRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter)
throws CmsException {
if (filter.includesDefinedInContent()) {
throw new CmsIllegalArgumentException(
Messages.get().container(
Messages.ERR_DELETE_RELATION_IN_CONTENT_2,
dbc.removeSiteRoot(resource.getRootPath()),
filter.getTypes()));
}
getVfsDriver(dbc).deleteRelations(dbc, dbc.currentProject().getUuid(), resource, filter);
setDateLastModified(dbc, resource, System.currentTimeMillis());
log(
dbc,
new CmsLogEntry(
dbc,
resource.getStructureId(),
CmsLogEntryType.RESOURCE_REMOVE_RELATION,
new String[] {resource.getRootPath(), filter.toString()}),
false);
} | java | public void deleteRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter)
throws CmsException {
if (filter.includesDefinedInContent()) {
throw new CmsIllegalArgumentException(
Messages.get().container(
Messages.ERR_DELETE_RELATION_IN_CONTENT_2,
dbc.removeSiteRoot(resource.getRootPath()),
filter.getTypes()));
}
getVfsDriver(dbc).deleteRelations(dbc, dbc.currentProject().getUuid(), resource, filter);
setDateLastModified(dbc, resource, System.currentTimeMillis());
log(
dbc,
new CmsLogEntry(
dbc,
resource.getStructureId(),
CmsLogEntryType.RESOURCE_REMOVE_RELATION,
new String[] {resource.getRootPath(), filter.toString()}),
false);
} | [
"public",
"void",
"deleteRelationsForResource",
"(",
"CmsDbContext",
"dbc",
",",
"CmsResource",
"resource",
",",
"CmsRelationFilter",
"filter",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"filter",
".",
"includesDefinedInContent",
"(",
")",
")",
"{",
"throw",
"... | Deletes all relations for the given resource matching the given filter.<p>
@param dbc the current db context
@param resource the resource to delete the relations for
@param filter the filter to use for deletion
@throws CmsException if something goes wrong
@see CmsSecurityManager#deleteRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter) | [
"Deletes",
"all",
"relations",
"for",
"the",
"given",
"resource",
"matching",
"the",
"given",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2803-L2823 |
micrometer-metrics/micrometer | micrometer-spring-legacy/src/main/java/io/micrometer/spring/cache/ConcurrentMapCacheMetrics.java | ConcurrentMapCacheMetrics.monitor | public static ConcurrentMapCache monitor(MeterRegistry registry, ConcurrentMapCache cache, String... tags) {
return monitor(registry, cache, Tags.of(tags));
} | java | public static ConcurrentMapCache monitor(MeterRegistry registry, ConcurrentMapCache cache, String... tags) {
return monitor(registry, cache, Tags.of(tags));
} | [
"public",
"static",
"ConcurrentMapCache",
"monitor",
"(",
"MeterRegistry",
"registry",
",",
"ConcurrentMapCache",
"cache",
",",
"String",
"...",
"tags",
")",
"{",
"return",
"monitor",
"(",
"registry",
",",
"cache",
",",
"Tags",
".",
"of",
"(",
"tags",
")",
"... | Record metrics on a ConcurrentMapCache cache.
@param registry The registry to bind metrics to.
@param cache The cache to instrument.
@param tags Tags to apply to all recorded metrics. Must be an even number of arguments representing key/value pairs of tags.
@return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way. | [
"Record",
"metrics",
"on",
"a",
"ConcurrentMapCache",
"cache",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-spring-legacy/src/main/java/io/micrometer/spring/cache/ConcurrentMapCacheMetrics.java#L42-L44 |
graphql-java/graphql-java | src/main/java/graphql/execution/ExecutionStrategy.java | ExecutionStrategy.getFieldDef | protected GraphQLFieldDefinition getFieldDef(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Field field) {
GraphQLObjectType parentType = (GraphQLObjectType) parameters.getExecutionStepInfo().getUnwrappedNonNullType();
return getFieldDef(executionContext.getGraphQLSchema(), parentType, field);
} | java | protected GraphQLFieldDefinition getFieldDef(ExecutionContext executionContext, ExecutionStrategyParameters parameters, Field field) {
GraphQLObjectType parentType = (GraphQLObjectType) parameters.getExecutionStepInfo().getUnwrappedNonNullType();
return getFieldDef(executionContext.getGraphQLSchema(), parentType, field);
} | [
"protected",
"GraphQLFieldDefinition",
"getFieldDef",
"(",
"ExecutionContext",
"executionContext",
",",
"ExecutionStrategyParameters",
"parameters",
",",
"Field",
"field",
")",
"{",
"GraphQLObjectType",
"parentType",
"=",
"(",
"GraphQLObjectType",
")",
"parameters",
".",
... | Called to discover the field definition give the current parameters and the AST {@link Field}
@param executionContext contains the top level execution parameters
@param parameters contains the parameters holding the fields to be executed and source object
@param field the field to find the definition of
@return a {@link GraphQLFieldDefinition} | [
"Called",
"to",
"discover",
"the",
"field",
"definition",
"give",
"the",
"current",
"parameters",
"and",
"the",
"AST",
"{",
"@link",
"Field",
"}"
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStrategy.java#L699-L702 |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeLines | private void writeLines(final HttpServletResponse response, final ArrayList<String> lines, final String header)
throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeLines is called");
final PrintWriter writer = response.getWriter();
writer.println("<h1>" + header + "</h1>");
for (final String line : lines) {
writer.println(line);
writer.write("<br/>");
}
writer.write("<br/>");
} | java | private void writeLines(final HttpServletResponse response, final ArrayList<String> lines, final String header)
throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeLines is called");
final PrintWriter writer = response.getWriter();
writer.println("<h1>" + header + "</h1>");
for (final String line : lines) {
writer.println(line);
writer.write("<br/>");
}
writer.write("<br/>");
} | [
"private",
"void",
"writeLines",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"ArrayList",
"<",
"String",
">",
"lines",
",",
"final",
"String",
"header",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
... | Write lines in ArrayList to the response writer.
@param response
@param lines
@param header
@throws IOException | [
"Write",
"lines",
"in",
"ArrayList",
"to",
"the",
"response",
"writer",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L401-L414 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java | AbstractRadial.create_LCD_Image | protected BufferedImage create_LCD_Image(final int WIDTH, final int HEIGHT, final LcdColor LCD_COLOR, final Paint CUSTOM_LCD_BACKGROUND) {
return createLcdImage(new Rectangle2D.Double(0, 0, WIDTH, HEIGHT), LCD_COLOR, CUSTOM_LCD_BACKGROUND, null);
} | java | protected BufferedImage create_LCD_Image(final int WIDTH, final int HEIGHT, final LcdColor LCD_COLOR, final Paint CUSTOM_LCD_BACKGROUND) {
return createLcdImage(new Rectangle2D.Double(0, 0, WIDTH, HEIGHT), LCD_COLOR, CUSTOM_LCD_BACKGROUND, null);
} | [
"protected",
"BufferedImage",
"create_LCD_Image",
"(",
"final",
"int",
"WIDTH",
",",
"final",
"int",
"HEIGHT",
",",
"final",
"LcdColor",
"LCD_COLOR",
",",
"final",
"Paint",
"CUSTOM_LCD_BACKGROUND",
")",
"{",
"return",
"createLcdImage",
"(",
"new",
"Rectangle2D",
"... | Returns the image with the given lcd color.
@param WIDTH
@param HEIGHT
@param LCD_COLOR
@param CUSTOM_LCD_BACKGROUND
@return buffered image containing the lcd with the selected lcd color | [
"Returns",
"the",
"image",
"with",
"the",
"given",
"lcd",
"color",
"."
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L1491-L1493 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java | UnitQuaternions.dotProduct | public static double dotProduct(Quat4d q1, Quat4d q2) {
return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w;
} | java | public static double dotProduct(Quat4d q1, Quat4d q2) {
return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w;
} | [
"public",
"static",
"double",
"dotProduct",
"(",
"Quat4d",
"q1",
",",
"Quat4d",
"q2",
")",
"{",
"return",
"q1",
".",
"x",
"*",
"q2",
".",
"x",
"+",
"q1",
".",
"y",
"*",
"q2",
".",
"y",
"+",
"q1",
".",
"z",
"*",
"q2",
".",
"z",
"+",
"q1",
".... | Compute the dot (inner) product of two quaternions.
@param q1
quaternion as Quat4d object
@param q2
quaternion as Quat4d object
@return the value of the quaternion dot product | [
"Compute",
"the",
"dot",
"(",
"inner",
")",
"product",
"of",
"two",
"quaternions",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java#L218-L220 |
stapler/stapler | jelly/src/main/java/org/kohsuke/stapler/framework/adjunct/AdjunctManager.java | AdjunctManager.get | public Adjunct get(String name) throws IOException {
Adjunct a = adjuncts.get(name);
if(a!=null) return a; // found it
synchronized (this) {
a = adjuncts.get(name);
if(a!=null) return a; // one more check before we start loading
a = new Adjunct(this,name,classLoader);
adjuncts.put(name,a);
return a;
}
} | java | public Adjunct get(String name) throws IOException {
Adjunct a = adjuncts.get(name);
if(a!=null) return a; // found it
synchronized (this) {
a = adjuncts.get(name);
if(a!=null) return a; // one more check before we start loading
a = new Adjunct(this,name,classLoader);
adjuncts.put(name,a);
return a;
}
} | [
"public",
"Adjunct",
"get",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"Adjunct",
"a",
"=",
"adjuncts",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"a",
"!=",
"null",
")",
"return",
"a",
";",
"// found it",
"synchronized",
"(",
"this",... | Obtains the adjunct.
@return
always non-null.
@throws IOException
if failed to locate {@link Adjunct}. | [
"Obtains",
"the",
"adjunct",
"."
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/jelly/src/main/java/org/kohsuke/stapler/framework/adjunct/AdjunctManager.java#L140-L151 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldStruct.java | JBBPFieldStruct.mapTo | public Object mapTo(final Object objectToMap, final JBBPMapperCustomFieldProcessor customFieldProcessor) {
return JBBPMapper.map(this, objectToMap, customFieldProcessor);
} | java | public Object mapTo(final Object objectToMap, final JBBPMapperCustomFieldProcessor customFieldProcessor) {
return JBBPMapper.map(this, objectToMap, customFieldProcessor);
} | [
"public",
"Object",
"mapTo",
"(",
"final",
"Object",
"objectToMap",
",",
"final",
"JBBPMapperCustomFieldProcessor",
"customFieldProcessor",
")",
"{",
"return",
"JBBPMapper",
".",
"map",
"(",
"this",
",",
"objectToMap",
",",
"customFieldProcessor",
")",
";",
"}"
] | Map the structure fields to object fields.
@param objectToMap an object to map fields of the structure, must not be
null
@param customFieldProcessor a custom field processor to provide values for
custom mapping fields, it can be null if there is not any custom field
@return the same object from the arguments but with filled fields by values
of the structure | [
"Map",
"the",
"structure",
"fields",
"to",
"object",
"fields",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldStruct.java#L378-L380 |
aws/aws-sdk-java | aws-java-sdk-redshift/src/main/java/com/amazonaws/services/redshift/model/ClusterParameterGroupStatus.java | ClusterParameterGroupStatus.getClusterParameterStatusList | public java.util.List<ClusterParameterStatus> getClusterParameterStatusList() {
if (clusterParameterStatusList == null) {
clusterParameterStatusList = new com.amazonaws.internal.SdkInternalList<ClusterParameterStatus>();
}
return clusterParameterStatusList;
} | java | public java.util.List<ClusterParameterStatus> getClusterParameterStatusList() {
if (clusterParameterStatusList == null) {
clusterParameterStatusList = new com.amazonaws.internal.SdkInternalList<ClusterParameterStatus>();
}
return clusterParameterStatusList;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"ClusterParameterStatus",
">",
"getClusterParameterStatusList",
"(",
")",
"{",
"if",
"(",
"clusterParameterStatusList",
"==",
"null",
")",
"{",
"clusterParameterStatusList",
"=",
"new",
"com",
".",
"amazonaws",
".",... | <p>
The list of parameter statuses.
</p>
<p>
For more information about parameters and parameter groups, go to <a
href="https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html">Amazon Redshift
Parameter Groups</a> in the <i>Amazon Redshift Cluster Management Guide</i>.
</p>
@return The list of parameter statuses.</p>
<p>
For more information about parameters and parameter groups, go to <a
href="https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-parameter-groups.html">Amazon
Redshift Parameter Groups</a> in the <i>Amazon Redshift Cluster Management Guide</i>. | [
"<p",
">",
"The",
"list",
"of",
"parameter",
"statuses",
".",
"<",
"/",
"p",
">",
"<p",
">",
"For",
"more",
"information",
"about",
"parameters",
"and",
"parameter",
"groups",
"go",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
"."... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-redshift/src/main/java/com/amazonaws/services/redshift/model/ClusterParameterGroupStatus.java#L150-L155 |
kuali/ojb-1.0.4 | src/tools/org/apache/ojb/tools/mapping/reversedb2/propertyEditors/EditableTreeNodeWithProperties.java | EditableTreeNodeWithProperties.removePropertyChangeListener | public void removePropertyChangeListener (String propertyName, java.beans.PropertyChangeListener listener)
{
this.propertyChangeDelegate.removePropertyChangeListener(propertyName, listener);
} | java | public void removePropertyChangeListener (String propertyName, java.beans.PropertyChangeListener listener)
{
this.propertyChangeDelegate.removePropertyChangeListener(propertyName, listener);
} | [
"public",
"void",
"removePropertyChangeListener",
"(",
"String",
"propertyName",
",",
"java",
".",
"beans",
".",
"PropertyChangeListener",
"listener",
")",
"{",
"this",
".",
"propertyChangeDelegate",
".",
"removePropertyChangeListener",
"(",
"propertyName",
",",
"listen... | Remove a PropertyChangeListener for a specific property from this node.
This functionality has. Please note that the listener this does not remove
a listener that has been added without specifying the property it is
interested in. | [
"Remove",
"a",
"PropertyChangeListener",
"for",
"a",
"specific",
"property",
"from",
"this",
"node",
".",
"This",
"functionality",
"has",
".",
"Please",
"note",
"that",
"the",
"listener",
"this",
"does",
"not",
"remove",
"a",
"listener",
"that",
"has",
"been",... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/tools/org/apache/ojb/tools/mapping/reversedb2/propertyEditors/EditableTreeNodeWithProperties.java#L84-L87 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIKernel.java | HBCIKernel.rawDoIt | public HBCIMsgStatus rawDoIt(Message message, boolean signit, boolean cryptit) {
HBCIMsgStatus msgStatus = new HBCIMsgStatus();
try {
message.complete();
log.debug("generating raw message " + message.getName());
passport.getCallback().status(HBCICallback.STATUS_MSG_CREATE, message.getName());
// liste der rewriter erzeugen
ArrayList<Rewrite> rewriters = getRewriters(passport.getProperties().get("kernel.rewriter"));
// alle rewriter durchlaufen und plaintextnachricht patchen
for (Rewrite rewriter1 : rewriters) {
message = rewriter1.outgoingClearText(message);
}
// wenn nachricht signiert werden soll
if (signit) {
message = signMessage(message, rewriters);
}
processMessage(message, msgStatus);
String messageName = message.getName();
// soll nachricht verschlüsselt werden?
if (cryptit) {
message = cryptMessage(message, rewriters);
}
sendMessage(message, messageName, msgStatus, rewriters);
} catch (Exception e) {
// TODO: hack to be able to "disable" HKEND response message analysis
// because some credit institutes are buggy regarding HKEND responses
String paramName = "client.errors.ignoreDialogEndErrors";
if (message.getName().startsWith("DialogEnd")) {
log.error(e.getMessage(), e);
log.warn("error while receiving DialogEnd response - " +
"but ignoring it because of special setting");
} else {
msgStatus.addException(e);
}
}
return msgStatus;
} | java | public HBCIMsgStatus rawDoIt(Message message, boolean signit, boolean cryptit) {
HBCIMsgStatus msgStatus = new HBCIMsgStatus();
try {
message.complete();
log.debug("generating raw message " + message.getName());
passport.getCallback().status(HBCICallback.STATUS_MSG_CREATE, message.getName());
// liste der rewriter erzeugen
ArrayList<Rewrite> rewriters = getRewriters(passport.getProperties().get("kernel.rewriter"));
// alle rewriter durchlaufen und plaintextnachricht patchen
for (Rewrite rewriter1 : rewriters) {
message = rewriter1.outgoingClearText(message);
}
// wenn nachricht signiert werden soll
if (signit) {
message = signMessage(message, rewriters);
}
processMessage(message, msgStatus);
String messageName = message.getName();
// soll nachricht verschlüsselt werden?
if (cryptit) {
message = cryptMessage(message, rewriters);
}
sendMessage(message, messageName, msgStatus, rewriters);
} catch (Exception e) {
// TODO: hack to be able to "disable" HKEND response message analysis
// because some credit institutes are buggy regarding HKEND responses
String paramName = "client.errors.ignoreDialogEndErrors";
if (message.getName().startsWith("DialogEnd")) {
log.error(e.getMessage(), e);
log.warn("error while receiving DialogEnd response - " +
"but ignoring it because of special setting");
} else {
msgStatus.addException(e);
}
}
return msgStatus;
} | [
"public",
"HBCIMsgStatus",
"rawDoIt",
"(",
"Message",
"message",
",",
"boolean",
"signit",
",",
"boolean",
"cryptit",
")",
"{",
"HBCIMsgStatus",
"msgStatus",
"=",
"new",
"HBCIMsgStatus",
"(",
")",
";",
"try",
"{",
"message",
".",
"complete",
"(",
")",
";",
... | /* Processes the current message (mid-level API).
This method creates the message specified earlier by the methods rawNewJob() and
rawSet(), signs and encrypts it using the values of @p inst, @p user, @p signit
and @p crypit and sends it to server.
After that it waits for the response, decrypts it, checks the signature of the
received message and returns a Properties object, that contains as keys the
pathnames of all elements of the received message, and as values the corresponding
value of the element with that path
bricht diese methode mit einer exception ab, so muss die aufrufende methode
die nachricht komplett neu erzeugen.
@param signit A boolean value specifying, if the message to be sent should be signed.
@param cryptit A boolean value specifying, if the message to be sent should be encrypted.
@return A Properties object that contains a path-value-pair for each dataelement of
the received message. | [
"/",
"*",
"Processes",
"the",
"current",
"message",
"(",
"mid",
"-",
"level",
"API",
")",
"."
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIKernel.java#L78-L124 |
nguyenq/tess4j | src/main/java/com/recognition/software/jdeskew/ImageUtil.java | ImageUtil.isBlack | public static boolean isBlack(BufferedImage image, int x, int y, int luminanceCutOff) {
int pixelRGBValue;
int r;
int g;
int b;
double luminance = 0.0;
// return white on areas outside of image boundaries
if (x < 0 || y < 0 || x > image.getWidth() || y > image.getHeight()) {
return false;
}
try {
pixelRGBValue = image.getRGB(x, y);
r = (pixelRGBValue >> 16) & 0xff;
g = (pixelRGBValue >> 8) & 0xff;
b = (pixelRGBValue) & 0xff;
luminance = (r * 0.299) + (g * 0.587) + (b * 0.114);
} catch (Exception e) {
logger.warn("", e);
}
return luminance < luminanceCutOff;
} | java | public static boolean isBlack(BufferedImage image, int x, int y, int luminanceCutOff) {
int pixelRGBValue;
int r;
int g;
int b;
double luminance = 0.0;
// return white on areas outside of image boundaries
if (x < 0 || y < 0 || x > image.getWidth() || y > image.getHeight()) {
return false;
}
try {
pixelRGBValue = image.getRGB(x, y);
r = (pixelRGBValue >> 16) & 0xff;
g = (pixelRGBValue >> 8) & 0xff;
b = (pixelRGBValue) & 0xff;
luminance = (r * 0.299) + (g * 0.587) + (b * 0.114);
} catch (Exception e) {
logger.warn("", e);
}
return luminance < luminanceCutOff;
} | [
"public",
"static",
"boolean",
"isBlack",
"(",
"BufferedImage",
"image",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"luminanceCutOff",
")",
"{",
"int",
"pixelRGBValue",
";",
"int",
"r",
";",
"int",
"g",
";",
"int",
"b",
";",
"double",
"luminance",
"... | Whether the pixel is black.
@param image source image
@param x
@param y
@param luminanceCutOff
@return | [
"Whether",
"the",
"pixel",
"is",
"black",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/com/recognition/software/jdeskew/ImageUtil.java#L49-L72 |
ontop/ontop | mapping/sql/r2rml/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/R2RMLParser.java | R2RMLParser.getTermTypeAtom | private ImmutableFunctionalTerm getTermTypeAtom(String string, Object type, String joinCond) {
if (type.equals(R2RMLVocabulary.iri)) {
return getURIFunction(string, joinCond);
} else if (type.equals(R2RMLVocabulary.blankNode)) {
return getTypedFunction(string, 2, joinCond);
} else if (type.equals(R2RMLVocabulary.literal)) {
return getTypedFunction(trim(string), 3, joinCond);
}
return null;
} | java | private ImmutableFunctionalTerm getTermTypeAtom(String string, Object type, String joinCond) {
if (type.equals(R2RMLVocabulary.iri)) {
return getURIFunction(string, joinCond);
} else if (type.equals(R2RMLVocabulary.blankNode)) {
return getTypedFunction(string, 2, joinCond);
} else if (type.equals(R2RMLVocabulary.literal)) {
return getTypedFunction(trim(string), 3, joinCond);
}
return null;
} | [
"private",
"ImmutableFunctionalTerm",
"getTermTypeAtom",
"(",
"String",
"string",
",",
"Object",
"type",
",",
"String",
"joinCond",
")",
"{",
"if",
"(",
"type",
".",
"equals",
"(",
"R2RMLVocabulary",
".",
"iri",
")",
")",
"{",
"return",
"getURIFunction",
"(",
... | get a typed atom of a specific type
@param type
- iri, blanknode or literal
@param string
- the atom as string
@return the contructed Function atom | [
"get",
"a",
"typed",
"atom",
"of",
"a",
"specific",
"type"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/r2rml/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/R2RMLParser.java#L409-L424 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.setUser | public void setUser(String userName, String password){
if(userName != null && ! userName.isEmpty()){
connection.setDirectoryUser(userName, password);
}
} | java | public void setUser(String userName, String password){
if(userName != null && ! userName.isEmpty()){
connection.setDirectoryUser(userName, password);
}
} | [
"public",
"void",
"setUser",
"(",
"String",
"userName",
",",
"String",
"password",
")",
"{",
"if",
"(",
"userName",
"!=",
"null",
"&&",
"!",
"userName",
".",
"isEmpty",
"(",
")",
")",
"{",
"connection",
".",
"setDirectoryUser",
"(",
"userName",
",",
"pas... | Set the user for the DirectoryServiceClient.
It will ask the DirectoryConnection to do authentication again.
@param userName
the user name.
@param password
the password. | [
"Set",
"the",
"user",
"for",
"the",
"DirectoryServiceClient",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L198-L202 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java | TypeRegistry.getTypeIdFor | public int getTypeIdFor(String slashname, boolean allocateIfNotFound) {
if (allocateIfNotFound) {
return NameRegistry.getIdOrAllocateFor(slashname);
}
else {
return NameRegistry.getIdFor(slashname);
}
} | java | public int getTypeIdFor(String slashname, boolean allocateIfNotFound) {
if (allocateIfNotFound) {
return NameRegistry.getIdOrAllocateFor(slashname);
}
else {
return NameRegistry.getIdFor(slashname);
}
} | [
"public",
"int",
"getTypeIdFor",
"(",
"String",
"slashname",
",",
"boolean",
"allocateIfNotFound",
")",
"{",
"if",
"(",
"allocateIfNotFound",
")",
"{",
"return",
"NameRegistry",
".",
"getIdOrAllocateFor",
"(",
"slashname",
")",
";",
"}",
"else",
"{",
"return",
... | Lookup the type ID for a string. First checks those allocated but not yet registered, then those that are already
registered. If not found then a new one is allocated and recorded.
@param slashname the slashed type name, eg. a/b/c/D
@param allocateIfNotFound determines whether an id should be allocated for the type if it cannot be found
@return the unique ID number | [
"Lookup",
"the",
"type",
"ID",
"for",
"a",
"string",
".",
"First",
"checks",
"those",
"allocated",
"but",
"not",
"yet",
"registered",
"then",
"those",
"that",
"are",
"already",
"registered",
".",
"If",
"not",
"found",
"then",
"a",
"new",
"one",
"is",
"al... | train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java#L986-L993 |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getJobStatus | public JsonResponse getJobStatus(String jobId) throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put(Job.JOB_ID, jobId);
return apiGet(ApiAction.job, params);
} | java | public JsonResponse getJobStatus(String jobId) throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put(Job.JOB_ID, jobId);
return apiGet(ApiAction.job, params);
} | [
"public",
"JsonResponse",
"getJobStatus",
"(",
"String",
"jobId",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"params",
".",
"put",
"(",
... | Get status of a job
@param jobId
@return JsonResponse
@throws IOException | [
"Get",
"status",
"of",
"a",
"job"
] | train | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L405-L409 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/initialization/OstrovskyInitialMeans.java | OstrovskyInitialMeans.initialWeights | protected static <T> double initialWeights(WritableDoubleDataStore weights, Relation<? extends T> relation, DBIDs ids, T first, T second, DistanceQuery<? super T> distQ) {
double weightsum = 0.;
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
// distance will usually already be squared
T v = relation.get(it);
double weight = Math.min(distQ.distance(first, v), distQ.distance(second, v));
weights.putDouble(it, weight);
weightsum += weight;
}
return weightsum;
} | java | protected static <T> double initialWeights(WritableDoubleDataStore weights, Relation<? extends T> relation, DBIDs ids, T first, T second, DistanceQuery<? super T> distQ) {
double weightsum = 0.;
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
// distance will usually already be squared
T v = relation.get(it);
double weight = Math.min(distQ.distance(first, v), distQ.distance(second, v));
weights.putDouble(it, weight);
weightsum += weight;
}
return weightsum;
} | [
"protected",
"static",
"<",
"T",
">",
"double",
"initialWeights",
"(",
"WritableDoubleDataStore",
"weights",
",",
"Relation",
"<",
"?",
"extends",
"T",
">",
"relation",
",",
"DBIDs",
"ids",
",",
"T",
"first",
",",
"T",
"second",
",",
"DistanceQuery",
"<",
... | Initialize the weight list.
@param weights Weight list
@param ids IDs
@param relation Data relation
@param first First ID
@param second Second ID
@param distQ Distance query
@return Weight sum
@param <T> Object type | [
"Initialize",
"the",
"weight",
"list",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/initialization/OstrovskyInitialMeans.java#L161-L171 |
chennaione/sugar | library/src/main/java/com/orm/SugarDataSource.java | SugarDataSource.deleteAll | public void deleteAll(final SuccessCallback<Integer> successCallback, final ErrorCallback errorCallback) {
delete(null, null, successCallback, errorCallback);
} | java | public void deleteAll(final SuccessCallback<Integer> successCallback, final ErrorCallback errorCallback) {
delete(null, null, successCallback, errorCallback);
} | [
"public",
"void",
"deleteAll",
"(",
"final",
"SuccessCallback",
"<",
"Integer",
">",
"successCallback",
",",
"final",
"ErrorCallback",
"errorCallback",
")",
"{",
"delete",
"(",
"null",
",",
"null",
",",
"successCallback",
",",
"errorCallback",
")",
";",
"}"
] | Method that deletes all data in a SQLite table.
@param successCallback the callback that is executed if the operation is succesful
@param errorCallback the callback that is executed if there is an error | [
"Method",
"that",
"deletes",
"all",
"data",
"in",
"a",
"SQLite",
"table",
"."
] | train | https://github.com/chennaione/sugar/blob/2ff1b9d5b11563346b69b4e97324107ff680a61a/library/src/main/java/com/orm/SugarDataSource.java#L358-L360 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java | ImagePipeline.isInDiskCacheSync | public boolean isInDiskCacheSync(final Uri uri, final ImageRequest.CacheChoice cacheChoice) {
ImageRequest imageRequest = ImageRequestBuilder
.newBuilderWithSource(uri)
.setCacheChoice(cacheChoice)
.build();
return isInDiskCacheSync(imageRequest);
} | java | public boolean isInDiskCacheSync(final Uri uri, final ImageRequest.CacheChoice cacheChoice) {
ImageRequest imageRequest = ImageRequestBuilder
.newBuilderWithSource(uri)
.setCacheChoice(cacheChoice)
.build();
return isInDiskCacheSync(imageRequest);
} | [
"public",
"boolean",
"isInDiskCacheSync",
"(",
"final",
"Uri",
"uri",
",",
"final",
"ImageRequest",
".",
"CacheChoice",
"cacheChoice",
")",
"{",
"ImageRequest",
"imageRequest",
"=",
"ImageRequestBuilder",
".",
"newBuilderWithSource",
"(",
"uri",
")",
".",
"setCacheC... | Returns whether the image is stored in the disk cache.
Performs disk cache check synchronously. It is not recommended to use this
unless you know what exactly you are doing. Disk cache check is a costly operation,
the call will block the caller thread until the cache check is completed.
@param uri the uri for the image to be looked up.
@param cacheChoice the cacheChoice for the cache to be looked up.
@return true if the image was found in the disk cache, false otherwise. | [
"Returns",
"whether",
"the",
"image",
"is",
"stored",
"in",
"the",
"disk",
"cache",
".",
"Performs",
"disk",
"cache",
"check",
"synchronously",
".",
"It",
"is",
"not",
"recommended",
"to",
"use",
"this",
"unless",
"you",
"know",
"what",
"exactly",
"you",
"... | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L574-L580 |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java | Reflect.setField | public static void setField(Object instance, Class<?> type, String fieldName, Object fieldValue) {
try {
final Field field = type.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(instance, fieldValue);
} catch (Exception exception) {
throw new Error(exception);
}
} | java | public static void setField(Object instance, Class<?> type, String fieldName, Object fieldValue) {
try {
final Field field = type.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(instance, fieldValue);
} catch (Exception exception) {
throw new Error(exception);
}
} | [
"public",
"static",
"void",
"setField",
"(",
"Object",
"instance",
",",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"fieldName",
",",
"Object",
"fieldValue",
")",
"{",
"try",
"{",
"final",
"Field",
"field",
"=",
"type",
".",
"getDeclaredField",
"(",
"... | Change the field.
@param instance the instance to change.
@param type the type in which the field is declared.
@param fieldName the name of the field.
@param fieldValue the value of the field. | [
"Change",
"the",
"field",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java#L59-L67 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/attribute/TimestampAttributeAsOfAttributeToInfiniteNull.java | TimestampAttributeAsOfAttributeToInfiniteNull.setAll | public void setAll(String attributeName, String busClassNameWithDots, String busClassName, boolean isNullable, RelatedFinder relatedFinder, Map properties, boolean transactional)
{
timestampAttribute.setAll(attributeName, busClassNameWithDots, busClassName, isNullable, relatedFinder, properties, transactional);
} | java | public void setAll(String attributeName, String busClassNameWithDots, String busClassName, boolean isNullable, RelatedFinder relatedFinder, Map properties, boolean transactional)
{
timestampAttribute.setAll(attributeName, busClassNameWithDots, busClassName, isNullable, relatedFinder, properties, transactional);
} | [
"public",
"void",
"setAll",
"(",
"String",
"attributeName",
",",
"String",
"busClassNameWithDots",
",",
"String",
"busClassName",
",",
"boolean",
"isNullable",
",",
"RelatedFinder",
"relatedFinder",
",",
"Map",
"properties",
",",
"boolean",
"transactional",
")",
"{"... | /*
public Operation eq(Object other)
{
return timestampAttribute.eq(other);
}
public Operation notEq(Object other)
{
return timestampAttribute.notEq(other);
} | [
"/",
"*",
"public",
"Operation",
"eq",
"(",
"Object",
"other",
")",
"{",
"return",
"timestampAttribute",
".",
"eq",
"(",
"other",
")",
";",
"}"
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/attribute/TimestampAttributeAsOfAttributeToInfiniteNull.java#L457-L460 |
jcuda/jcudnn | JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java | JCudnn.cudnnBatchNormalizationForwardTraining | public static int cudnnBatchNormalizationForwardTraining(
cudnnHandle handle,
int mode,
Pointer alpha, /** alpha[0] = result blend factor */
Pointer beta, /** beta[0] = dest layer blend factor */
cudnnTensorDescriptor xDesc,
Pointer x, /** NxCxHxW */
cudnnTensorDescriptor yDesc,
Pointer y, /** NxCxHxW */
/**
* <pre>
* Shared desc for the next 6 tensors in the argument list.
Data type to be set as follows:
type = (typeOf(x) == double) ? double : float
Dimensions for this descriptor depend on normalization mode
- Spatial Normalization : tensors are expected to have dims 1xCx1x1
(normalization is performed across NxHxW)
- Per-Activation Normalization : tensors are expected to have dims of 1xCxHxW
* (normalization is performed across N)
* </pre>
*/
cudnnTensorDescriptor bnScaleBiasMeanVarDesc,
/** 'Gamma' and 'Beta' respectively in Ioffe and Szegedy's paper's notation */
Pointer bnScale,
Pointer bnBias,
/**
* <pre>
* MUST use factor=1 in the very first call of a complete training cycle.
Use a factor=1/(1+n) at N-th call to the function to get
Cumulative Moving Average (CMA) behavior
CMA[n] = (x[1]+...+x[n])/n
Since CMA[n+1] = (n*CMA[n]+x[n+1])/(n+1) =
((n+1)*CMA[n]-CMA[n])/(n+1) + x[n+1]/(n+1) =
* CMA[n]*(1-1/(n+1)) + x[n+1]*1/(n+1)
* </pre>
*/
double exponentialAverageFactor,
/** Used in Training phase only.
runningMean = newMean*factor + runningMean*(1-factor) */
Pointer resultRunningMean,
/** Output in training mode, input in inference. Is the moving average
of variance[x] (factor is applied in the same way as for runningMean) */
Pointer resultRunningVariance,
/** Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */
double epsilon,
/** Optionally save intermediate results from the forward pass here
- can be reused to speed up backward pass. NULL if unused */
Pointer resultSaveMean,
Pointer resultSaveInvVariance)
{
return checkResult(cudnnBatchNormalizationForwardTrainingNative(handle, mode, alpha, beta, xDesc, x, yDesc, y, bnScaleBiasMeanVarDesc, bnScale, bnBias, exponentialAverageFactor, resultRunningMean, resultRunningVariance, epsilon, resultSaveMean, resultSaveInvVariance));
} | java | public static int cudnnBatchNormalizationForwardTraining(
cudnnHandle handle,
int mode,
Pointer alpha, /** alpha[0] = result blend factor */
Pointer beta, /** beta[0] = dest layer blend factor */
cudnnTensorDescriptor xDesc,
Pointer x, /** NxCxHxW */
cudnnTensorDescriptor yDesc,
Pointer y, /** NxCxHxW */
/**
* <pre>
* Shared desc for the next 6 tensors in the argument list.
Data type to be set as follows:
type = (typeOf(x) == double) ? double : float
Dimensions for this descriptor depend on normalization mode
- Spatial Normalization : tensors are expected to have dims 1xCx1x1
(normalization is performed across NxHxW)
- Per-Activation Normalization : tensors are expected to have dims of 1xCxHxW
* (normalization is performed across N)
* </pre>
*/
cudnnTensorDescriptor bnScaleBiasMeanVarDesc,
/** 'Gamma' and 'Beta' respectively in Ioffe and Szegedy's paper's notation */
Pointer bnScale,
Pointer bnBias,
/**
* <pre>
* MUST use factor=1 in the very first call of a complete training cycle.
Use a factor=1/(1+n) at N-th call to the function to get
Cumulative Moving Average (CMA) behavior
CMA[n] = (x[1]+...+x[n])/n
Since CMA[n+1] = (n*CMA[n]+x[n+1])/(n+1) =
((n+1)*CMA[n]-CMA[n])/(n+1) + x[n+1]/(n+1) =
* CMA[n]*(1-1/(n+1)) + x[n+1]*1/(n+1)
* </pre>
*/
double exponentialAverageFactor,
/** Used in Training phase only.
runningMean = newMean*factor + runningMean*(1-factor) */
Pointer resultRunningMean,
/** Output in training mode, input in inference. Is the moving average
of variance[x] (factor is applied in the same way as for runningMean) */
Pointer resultRunningVariance,
/** Has to be >= CUDNN_BN_MIN_EPSILON. Should be the same in forward and backward functions. */
double epsilon,
/** Optionally save intermediate results from the forward pass here
- can be reused to speed up backward pass. NULL if unused */
Pointer resultSaveMean,
Pointer resultSaveInvVariance)
{
return checkResult(cudnnBatchNormalizationForwardTrainingNative(handle, mode, alpha, beta, xDesc, x, yDesc, y, bnScaleBiasMeanVarDesc, bnScale, bnBias, exponentialAverageFactor, resultRunningMean, resultRunningVariance, epsilon, resultSaveMean, resultSaveInvVariance));
} | [
"public",
"static",
"int",
"cudnnBatchNormalizationForwardTraining",
"(",
"cudnnHandle",
"handle",
",",
"int",
"mode",
",",
"Pointer",
"alpha",
",",
"/** alpha[0] = result blend factor */",
"Pointer",
"beta",
",",
"/** beta[0] = dest layer blend factor */",
"cudnnTensorDescript... | Computes y = BN(x). Also accumulates moving averages of mean and inverse variances | [
"Computes",
"y",
"=",
"BN",
"(",
"x",
")",
".",
"Also",
"accumulates",
"moving",
"averages",
"of",
"mean",
"and",
"inverse",
"variances"
] | train | https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L2274-L2325 |
JOML-CI/JOML | src/org/joml/Vector4f.java | Vector4f.set | public Vector4f set(int index, FloatBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector4f set(int index, FloatBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector4f",
"set",
"(",
"int",
"index",
",",
"FloatBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link FloatBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given FloatBuffer.
@param index
the absolute position into the FloatBuffer
@param buffer
values will be read in <code>x, y, z, w</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"FloatBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector4f.java#L495-L498 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.cpacc | public void cpacc(String sourceName, String destName) throws CmsException {
CmsResource source = readResource(sourceName);
CmsResource dest = readResource(destName);
m_securityManager.copyAccessControlEntries(m_context, source, dest);
} | java | public void cpacc(String sourceName, String destName) throws CmsException {
CmsResource source = readResource(sourceName);
CmsResource dest = readResource(destName);
m_securityManager.copyAccessControlEntries(m_context, source, dest);
} | [
"public",
"void",
"cpacc",
"(",
"String",
"sourceName",
",",
"String",
"destName",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"source",
"=",
"readResource",
"(",
"sourceName",
")",
";",
"CmsResource",
"dest",
"=",
"readResource",
"(",
"destName",
")",
... | Copies access control entries of a given resource to another resource.<p>
Already existing access control entries of the destination resource are removed.<p>
@param sourceName the name of the resource of which the access control entries are copied
@param destName the name of the resource to which the access control entries are applied
@throws CmsException if something goes wrong | [
"Copies",
"access",
"control",
"entries",
"of",
"a",
"given",
"resource",
"to",
"another",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L639-L644 |
kirgor/enklib | sql/src/main/java/com/kirgor/enklib/sql/dialect/PostgreSQLDialect.java | PostgreSQLDialect.buildStoredProcedureQuery | @Override
public String buildStoredProcedureQuery(String name, int paramsCount) {
StringBuilder sb = new StringBuilder("SELECT * FROM ");
sb.append(name);
sb.append("(");
for (int i = 0; i < paramsCount; i++) {
sb.append("?,");
}
if (paramsCount > 0) {
sb.setLength(sb.length() - 1);
}
sb.append(")");
return sb.toString();
} | java | @Override
public String buildStoredProcedureQuery(String name, int paramsCount) {
StringBuilder sb = new StringBuilder("SELECT * FROM ");
sb.append(name);
sb.append("(");
for (int i = 0; i < paramsCount; i++) {
sb.append("?,");
}
if (paramsCount > 0) {
sb.setLength(sb.length() - 1);
}
sb.append(")");
return sb.toString();
} | [
"@",
"Override",
"public",
"String",
"buildStoredProcedureQuery",
"(",
"String",
"name",
",",
"int",
"paramsCount",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"SELECT * FROM \"",
")",
";",
"sb",
".",
"append",
"(",
"name",
")",
";",
... | {@inheritDoc}
<p/>
Returns something like "SELECT * FROM get_orders(?,?,?)". | [
"{"
] | train | https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/sql/src/main/java/com/kirgor/enklib/sql/dialect/PostgreSQLDialect.java#L14-L28 |
weld/core | environments/servlet/core/src/main/java/org/jboss/weld/environment/tomcat/SecurityActions.java | SecurityActions.lookupMethod | static Method lookupMethod(Class<?> javaClass, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException {
if (System.getSecurityManager() != null) {
try {
return AccessController.doPrivileged(new MethodLookupAction(javaClass, methodName, parameterTypes));
} catch (PrivilegedActionException e) {
if (e.getCause() instanceof NoSuchMethodException) {
throw (NoSuchMethodException) e.getCause();
}
throw new WeldException(e.getCause());
}
} else {
return MethodLookupAction.lookupMethod(javaClass, methodName, parameterTypes);
}
} | java | static Method lookupMethod(Class<?> javaClass, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException {
if (System.getSecurityManager() != null) {
try {
return AccessController.doPrivileged(new MethodLookupAction(javaClass, methodName, parameterTypes));
} catch (PrivilegedActionException e) {
if (e.getCause() instanceof NoSuchMethodException) {
throw (NoSuchMethodException) e.getCause();
}
throw new WeldException(e.getCause());
}
} else {
return MethodLookupAction.lookupMethod(javaClass, methodName, parameterTypes);
}
} | [
"static",
"Method",
"lookupMethod",
"(",
"Class",
"<",
"?",
">",
"javaClass",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"throws",
"NoSuchMethodException",
"{",
"if",
"(",
"System",
".",
"getSecurityManager",
"(",
... | Does not perform {@link PrivilegedAction} unless necessary.
@param javaClass
@param methodName
@param parameterTypes
@return a method from the class or any class/interface in the inheritance hierarchy
@throws NoSuchMethodException | [
"Does",
"not",
"perform",
"{",
"@link",
"PrivilegedAction",
"}",
"unless",
"necessary",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/servlet/core/src/main/java/org/jboss/weld/environment/tomcat/SecurityActions.java#L49-L62 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchParameters.java | CmsSearchParameters.addFieldQuery | public void addFieldQuery(String fieldName, String searchQuery, Occur occur) {
CmsSearchFieldQuery newQuery = new CmsSearchFieldQuery(fieldName, searchQuery, occur);
addFieldQuery(newQuery);
} | java | public void addFieldQuery(String fieldName, String searchQuery, Occur occur) {
CmsSearchFieldQuery newQuery = new CmsSearchFieldQuery(fieldName, searchQuery, occur);
addFieldQuery(newQuery);
} | [
"public",
"void",
"addFieldQuery",
"(",
"String",
"fieldName",
",",
"String",
"searchQuery",
",",
"Occur",
"occur",
")",
"{",
"CmsSearchFieldQuery",
"newQuery",
"=",
"new",
"CmsSearchFieldQuery",
"(",
"fieldName",
",",
"searchQuery",
",",
"occur",
")",
";",
"add... | Adds an individual query for a search field.<p>
If this is used, any setting made with {@link #setQuery(String)} and {@link #setFields(List)}
will be ignored and only the individual field search settings will be used.<p>
@param fieldName the field name
@param searchQuery the search query
@param occur the occur parameter for the query in the field
@since 7.5.1 | [
"Adds",
"an",
"individual",
"query",
"for",
"a",
"search",
"field",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchParameters.java#L407-L411 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java | ObjectUtils.shallowCopy | public static void shallowCopy(Object source, Object target, final String... propertyNames) {
ObjectUtils.doShallowCopy(source, target, Boolean.FALSE, propertyNames);
} | java | public static void shallowCopy(Object source, Object target, final String... propertyNames) {
ObjectUtils.doShallowCopy(source, target, Boolean.FALSE, propertyNames);
} | [
"public",
"static",
"void",
"shallowCopy",
"(",
"Object",
"source",
",",
"Object",
"target",
",",
"final",
"String",
"...",
"propertyNames",
")",
"{",
"ObjectUtils",
".",
"doShallowCopy",
"(",
"source",
",",
"target",
",",
"Boolean",
".",
"FALSE",
",",
"prop... | Makes a shallow copy of the source object into the target one excluding properties not in
<code>propertyNames</code>.
<p>
This method differs from {@link ReflectionUtils#shallowCopyFieldState(Object, Object)} this doesn't require
source and target objects to share the same class hierarchy.
@param source
the source object.
@param target
the target object.
@param propertyNames
the property names to be processed. Never mind if property names are invalid, in such a case are
ignored. | [
"Makes",
"a",
"shallow",
"copy",
"of",
"the",
"source",
"object",
"into",
"the",
"target",
"one",
"excluding",
"properties",
"not",
"in",
"<code",
">",
"propertyNames<",
"/",
"code",
">",
".",
"<p",
">",
"This",
"method",
"differs",
"from",
"{",
"@link",
... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L136-L139 |
google/closure-compiler | src/com/google/javascript/jscomp/RemoveUnusedCode.java | RemoveUnusedCode.traverseClass | private void traverseClass(Node classNode, Scope scope) {
checkArgument(classNode.isClass());
if (NodeUtil.isClassDeclaration(classNode)) {
traverseClassDeclaration(classNode, scope);
} else {
traverseClassExpression(classNode, scope);
}
} | java | private void traverseClass(Node classNode, Scope scope) {
checkArgument(classNode.isClass());
if (NodeUtil.isClassDeclaration(classNode)) {
traverseClassDeclaration(classNode, scope);
} else {
traverseClassExpression(classNode, scope);
}
} | [
"private",
"void",
"traverseClass",
"(",
"Node",
"classNode",
",",
"Scope",
"scope",
")",
"{",
"checkArgument",
"(",
"classNode",
".",
"isClass",
"(",
")",
")",
";",
"if",
"(",
"NodeUtil",
".",
"isClassDeclaration",
"(",
"classNode",
")",
")",
"{",
"traver... | Handle a class that is not the RHS child of an assignment or a variable declaration
initializer.
<p>For
@param classNode
@param scope | [
"Handle",
"a",
"class",
"that",
"is",
"not",
"the",
"RHS",
"child",
"of",
"an",
"assignment",
"or",
"a",
"variable",
"declaration",
"initializer",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RemoveUnusedCode.java#L1198-L1205 |
rterp/GMapsFX | GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptObject.java | JavascriptObject.checkBoolean | protected Boolean checkBoolean(Object val, Boolean def) {
return (val == null) ? def : (Boolean) val;
} | java | protected Boolean checkBoolean(Object val, Boolean def) {
return (val == null) ? def : (Boolean) val;
} | [
"protected",
"Boolean",
"checkBoolean",
"(",
"Object",
"val",
",",
"Boolean",
"def",
")",
"{",
"return",
"(",
"val",
"==",
"null",
")",
"?",
"def",
":",
"(",
"Boolean",
")",
"val",
";",
"}"
] | Checks a returned Javascript value where we expect a boolean but could
get null.
@param val The value from Javascript to be checked.
@param def The default return value, which can be null.
@return The actual value, or if null, returns false. | [
"Checks",
"a",
"returned",
"Javascript",
"value",
"where",
"we",
"expect",
"a",
"boolean",
"but",
"could",
"get",
"null",
"."
] | train | https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptObject.java#L300-L302 |
alkacon/opencms-core | src/org/opencms/loader/CmsJspLoader.java | CmsJspLoader.parseJsp | protected byte[] parseJsp(
byte[] byteContent,
String encoding,
CmsFlexController controller,
Set<String> updatedFiles,
boolean isHardInclude) {
String content;
// make sure encoding is set correctly
try {
content = new String(byteContent, encoding);
} catch (UnsupportedEncodingException e) {
// encoding property is not set correctly
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_UNSUPPORTED_ENC_1,
controller.getCurrentRequest().getElementUri()),
e);
try {
encoding = OpenCms.getSystemInfo().getDefaultEncoding();
content = new String(byteContent, encoding);
} catch (UnsupportedEncodingException e2) {
// should not happen since default encoding is always a valid encoding (checked during system startup)
content = new String(byteContent);
}
}
// parse for special %(link:...) macros
content = parseJspLinkMacros(content, controller);
// parse for special <%@cms file="..." %> tag
content = parseJspCmsTag(content, controller, updatedFiles);
// parse for included files in tags
content = parseJspIncludes(content, controller, updatedFiles);
// parse for <%@page pageEncoding="..." %> tag
content = parseJspEncoding(content, encoding, isHardInclude);
// Processes magic taglib attributes in page directives
content = processTaglibAttributes(content);
// convert the result to bytes and return it
try {
return content.getBytes(encoding);
} catch (UnsupportedEncodingException e) {
// should not happen since encoding was already checked
return content.getBytes();
}
} | java | protected byte[] parseJsp(
byte[] byteContent,
String encoding,
CmsFlexController controller,
Set<String> updatedFiles,
boolean isHardInclude) {
String content;
// make sure encoding is set correctly
try {
content = new String(byteContent, encoding);
} catch (UnsupportedEncodingException e) {
// encoding property is not set correctly
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_UNSUPPORTED_ENC_1,
controller.getCurrentRequest().getElementUri()),
e);
try {
encoding = OpenCms.getSystemInfo().getDefaultEncoding();
content = new String(byteContent, encoding);
} catch (UnsupportedEncodingException e2) {
// should not happen since default encoding is always a valid encoding (checked during system startup)
content = new String(byteContent);
}
}
// parse for special %(link:...) macros
content = parseJspLinkMacros(content, controller);
// parse for special <%@cms file="..." %> tag
content = parseJspCmsTag(content, controller, updatedFiles);
// parse for included files in tags
content = parseJspIncludes(content, controller, updatedFiles);
// parse for <%@page pageEncoding="..." %> tag
content = parseJspEncoding(content, encoding, isHardInclude);
// Processes magic taglib attributes in page directives
content = processTaglibAttributes(content);
// convert the result to bytes and return it
try {
return content.getBytes(encoding);
} catch (UnsupportedEncodingException e) {
// should not happen since encoding was already checked
return content.getBytes();
}
} | [
"protected",
"byte",
"[",
"]",
"parseJsp",
"(",
"byte",
"[",
"]",
"byteContent",
",",
"String",
"encoding",
",",
"CmsFlexController",
"controller",
",",
"Set",
"<",
"String",
">",
"updatedFiles",
",",
"boolean",
"isHardInclude",
")",
"{",
"String",
"content",
... | Parses the JSP and modifies OpenCms critical directive information.<p>
@param byteContent the original JSP content
@param encoding the encoding to use for the JSP
@param controller the controller for the JSP integration
@param updatedFiles a Set containing all JSP pages that have been already updated
@param isHardInclude indicated if this page is actually a "hard" include with <code><%@ include file="..." ></code>
@return the modified JSP content | [
"Parses",
"the",
"JSP",
"and",
"modifies",
"OpenCms",
"critical",
"directive",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L1190-L1234 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java | TypeHandlerUtils.convertBlob | public static Object convertBlob(Connection conn, String value) throws SQLException {
return convertBlob(conn, value.getBytes());
} | java | public static Object convertBlob(Connection conn, String value) throws SQLException {
return convertBlob(conn, value.getBytes());
} | [
"public",
"static",
"Object",
"convertBlob",
"(",
"Connection",
"conn",
",",
"String",
"value",
")",
"throws",
"SQLException",
"{",
"return",
"convertBlob",
"(",
"conn",
",",
"value",
".",
"getBytes",
"(",
")",
")",
";",
"}"
] | Transfers data from String into sql.Blob
@param conn connection for which sql.Blob object would be created
@param value String
@return sql.Blob from String
@throws SQLException | [
"Transfers",
"data",
"from",
"String",
"into",
"sql",
".",
"Blob"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L107-L109 |
centic9/commons-dost | src/main/java/org/dstadler/commons/graphviz/DotUtils.java | DotUtils.writeln | public static void writeln(final Writer writer, final String string, int indentLevel) throws IOException {
writer.write(StringUtils.repeat("\t", indentLevel) + string);
writer.write("\n");
} | java | public static void writeln(final Writer writer, final String string, int indentLevel) throws IOException {
writer.write(StringUtils.repeat("\t", indentLevel) + string);
writer.write("\n");
} | [
"public",
"static",
"void",
"writeln",
"(",
"final",
"Writer",
"writer",
",",
"final",
"String",
"string",
",",
"int",
"indentLevel",
")",
"throws",
"IOException",
"{",
"writer",
".",
"write",
"(",
"StringUtils",
".",
"repeat",
"(",
"\"\\t\"",
",",
"indentLe... | Write out the string and a newline, appending a number of tabs to
properly indent the resulting text-file.
@param writer The writer for the .dot-file
@param string The text to write
@param indentLevel How much to indent the line
@throws IOException if writing to the Writer fails | [
"Write",
"out",
"the",
"string",
"and",
"a",
"newline",
"appending",
"a",
"number",
"of",
"tabs",
"to",
"properly",
"indent",
"the",
"resulting",
"text",
"-",
"file",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/graphviz/DotUtils.java#L45-L48 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java | ApplicationsImpl.listAsync | public ServiceFuture<List<ApplicationSummary>> listAsync(final ListOperationCallback<ApplicationSummary> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<ApplicationSummary>, ApplicationListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<ApplicationSummary>, ApplicationListHeaders>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, null);
}
},
serviceCallback);
} | java | public ServiceFuture<List<ApplicationSummary>> listAsync(final ListOperationCallback<ApplicationSummary> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listSinglePageAsync(),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<ApplicationSummary>, ApplicationListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<ApplicationSummary>, ApplicationListHeaders>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink, null);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"ApplicationSummary",
">",
">",
"listAsync",
"(",
"final",
"ListOperationCallback",
"<",
"ApplicationSummary",
">",
"serviceCallback",
")",
"{",
"return",
"AzureServiceFuture",
".",
"fromHeaderPageResponse",
"(",
"listSingleP... | Lists all of the applications available in the specified account.
This operation returns only applications and versions that are available for use on compute nodes; that is, that can be used in an application package reference. For administrator information about applications and versions that are not yet available to compute nodes, use the Azure portal or the Azure Resource Manager API.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"all",
"of",
"the",
"applications",
"available",
"in",
"the",
"specified",
"account",
".",
"This",
"operation",
"returns",
"only",
"applications",
"and",
"versions",
"that",
"are",
"available",
"for",
"use",
"on",
"compute",
"nodes",
";",
"that",
"is"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ApplicationsImpl.java#L110-L120 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/temporal/TemporalAdjusters.java | TemporalAdjusters.dayOfWeekInMonth | public static TemporalAdjuster dayOfWeekInMonth(int ordinal, DayOfWeek dayOfWeek) {
Jdk8Methods.requireNonNull(dayOfWeek, "dayOfWeek");
return new DayOfWeekInMonth(ordinal, dayOfWeek);
} | java | public static TemporalAdjuster dayOfWeekInMonth(int ordinal, DayOfWeek dayOfWeek) {
Jdk8Methods.requireNonNull(dayOfWeek, "dayOfWeek");
return new DayOfWeekInMonth(ordinal, dayOfWeek);
} | [
"public",
"static",
"TemporalAdjuster",
"dayOfWeekInMonth",
"(",
"int",
"ordinal",
",",
"DayOfWeek",
"dayOfWeek",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"dayOfWeek",
",",
"\"dayOfWeek\"",
")",
";",
"return",
"new",
"DayOfWeekInMonth",
"(",
"ordinal",
... | Returns the day-of-week in month adjuster, which returns a new date
in the same month with the ordinal day-of-week.
This is used for expressions like the 'second Tuesday in March'.
<p>
The ISO calendar system behaves as follows:<br>
The input 2011-12-15 for (1,TUESDAY) will return 2011-12-06.<br>
The input 2011-12-15 for (2,TUESDAY) will return 2011-12-13.<br>
The input 2011-12-15 for (3,TUESDAY) will return 2011-12-20.<br>
The input 2011-12-15 for (4,TUESDAY) will return 2011-12-27.<br>
The input 2011-12-15 for (5,TUESDAY) will return 2012-01-03.<br>
The input 2011-12-15 for (-1,TUESDAY) will return 2011-12-27 (last in month).<br>
The input 2011-12-15 for (-4,TUESDAY) will return 2011-12-06 (3 weeks before last in month).<br>
The input 2011-12-15 for (-5,TUESDAY) will return 2011-11-29 (4 weeks before last in month).<br>
The input 2011-12-15 for (0,TUESDAY) will return 2011-11-29 (last in previous month).<br>
<p>
For a positive or zero ordinal, the algorithm is equivalent to finding the first
day-of-week that matches within the month and then adding a number of weeks to it.
For a negative ordinal, the algorithm is equivalent to finding the last
day-of-week that matches within the month and then subtracting a number of weeks to it.
The ordinal number of weeks is not validated and is interpreted leniently
according to this algorithm. This definition means that an ordinal of zero finds
the last matching day-of-week in the previous month.
<p>
The behavior is suitable for use with most calendar systems.
It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields
and the {@code DAYS} unit, and assumes a seven day week.
@param ordinal the week within the month, unbounded but typically from -5 to 5
@param dayOfWeek the day-of-week, not null
@return the day-of-week in month adjuster, not null | [
"Returns",
"the",
"day",
"-",
"of",
"-",
"week",
"in",
"month",
"adjuster",
"which",
"returns",
"a",
"new",
"date",
"in",
"the",
"same",
"month",
"with",
"the",
"ordinal",
"day",
"-",
"of",
"-",
"week",
".",
"This",
"is",
"used",
"for",
"expressions",
... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/temporal/TemporalAdjusters.java#L319-L322 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/JwtFatActions.java | JwtFatActions.logInAndObtainJwtCookie | public Cookie logInAndObtainJwtCookie(String testName, WebClient webClient, String protectedUrl, String username, String password, String issuerRegex) throws Exception {
Expectations expectations = new Expectations();
expectations.addExpectations(CommonExpectations.successfullyReachedLoginPage(TestActions.ACTION_INVOKE_PROTECTED_RESOURCE));
expectations.addExpectations(CommonExpectations.successfullyReachedProtectedResourceWithJwtCookie(TestActions.ACTION_SUBMIT_LOGIN_CREDENTIALS, protectedUrl, username,
issuerRegex));
expectations.addExpectations(CommonExpectations.responseTextMissingCookie(TestActions.ACTION_SUBMIT_LOGIN_CREDENTIALS, JwtFatConstants.LTPA_COOKIE_NAME));
return logInAndObtainCookie(testName, webClient, protectedUrl, username, password, JwtFatConstants.JWT_COOKIE_NAME, expectations);
} | java | public Cookie logInAndObtainJwtCookie(String testName, WebClient webClient, String protectedUrl, String username, String password, String issuerRegex) throws Exception {
Expectations expectations = new Expectations();
expectations.addExpectations(CommonExpectations.successfullyReachedLoginPage(TestActions.ACTION_INVOKE_PROTECTED_RESOURCE));
expectations.addExpectations(CommonExpectations.successfullyReachedProtectedResourceWithJwtCookie(TestActions.ACTION_SUBMIT_LOGIN_CREDENTIALS, protectedUrl, username,
issuerRegex));
expectations.addExpectations(CommonExpectations.responseTextMissingCookie(TestActions.ACTION_SUBMIT_LOGIN_CREDENTIALS, JwtFatConstants.LTPA_COOKIE_NAME));
return logInAndObtainCookie(testName, webClient, protectedUrl, username, password, JwtFatConstants.JWT_COOKIE_NAME, expectations);
} | [
"public",
"Cookie",
"logInAndObtainJwtCookie",
"(",
"String",
"testName",
",",
"WebClient",
"webClient",
",",
"String",
"protectedUrl",
",",
"String",
"username",
",",
"String",
"password",
",",
"String",
"issuerRegex",
")",
"throws",
"Exception",
"{",
"Expectations... | Accesses the protected resource and logs in successfully, ensuring that a JWT SSO cookie is included in the result. | [
"Accesses",
"the",
"protected",
"resource",
"and",
"logs",
"in",
"successfully",
"ensuring",
"that",
"a",
"JWT",
"SSO",
"cookie",
"is",
"included",
"in",
"the",
"result",
"."
] | 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/JwtFatActions.java#L43-L51 |
cloudant/sync-android | cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/internal/sqlite/android/AndroidSQLCipherSQLite.java | AndroidSQLCipherSQLite.open | public static AndroidSQLCipherSQLite open(File path, KeyProvider provider) {
//Call SQLCipher-based method for opening database, or creating if database not found
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(path,
KeyUtils.sqlCipherKeyForKeyProvider(provider), null);
return new AndroidSQLCipherSQLite(db);
} | java | public static AndroidSQLCipherSQLite open(File path, KeyProvider provider) {
//Call SQLCipher-based method for opening database, or creating if database not found
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(path,
KeyUtils.sqlCipherKeyForKeyProvider(provider), null);
return new AndroidSQLCipherSQLite(db);
} | [
"public",
"static",
"AndroidSQLCipherSQLite",
"open",
"(",
"File",
"path",
",",
"KeyProvider",
"provider",
")",
"{",
"//Call SQLCipher-based method for opening database, or creating if database not found",
"SQLiteDatabase",
"db",
"=",
"SQLiteDatabase",
".",
"openOrCreateDatabase"... | Constructor for creating SQLCipher-based SQLite database.
@param path full file path of the db file
@param provider Provider object that contains the key to encrypt the SQLCipher database
@return | [
"Constructor",
"for",
"creating",
"SQLCipher",
"-",
"based",
"SQLite",
"database",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/internal/sqlite/android/AndroidSQLCipherSQLite.java#L52-L59 |
sahan/ZombieLink | zombielink/src/main/java/com/lonepulse/zombielink/request/RequestProcessorChain.java | RequestProcessorChain.onInitiate | @Override
protected HttpRequestBase onInitiate(ProcessorChainLink<HttpRequestBase, RequestProcessorException> root, Object... args) {
InvocationContext context = assertAssignable(assertNotEmpty(args)[0], InvocationContext.class);
HttpRequestBase request = RequestUtils.translateRequestMethod(context);
return root.getProcessor().run(context, request); //allow any exceptions to elevate to a chain-wide failure
} | java | @Override
protected HttpRequestBase onInitiate(ProcessorChainLink<HttpRequestBase, RequestProcessorException> root, Object... args) {
InvocationContext context = assertAssignable(assertNotEmpty(args)[0], InvocationContext.class);
HttpRequestBase request = RequestUtils.translateRequestMethod(context);
return root.getProcessor().run(context, request); //allow any exceptions to elevate to a chain-wide failure
} | [
"@",
"Override",
"protected",
"HttpRequestBase",
"onInitiate",
"(",
"ProcessorChainLink",
"<",
"HttpRequestBase",
",",
"RequestProcessorException",
">",
"root",
",",
"Object",
"...",
"args",
")",
"{",
"InvocationContext",
"context",
"=",
"assertAssignable",
"(",
"asse... | <p>Accepts the {@link InvocationContext} given to {@link #run(Object...)}} the {@link RequestProcessorChain}
and translates the request metadata to a concrete instance of {@link HttpRequestBase}. The
{@link HttpRequestBase}, together with the {@link InvocationContext} is then given to the root link
which runs the {@link UriProcessor} and returns the resulting {@link HttpRequestBase}.</p>
<p>See {@link AbstractRequestProcessor}.</p>
{@inheritDoc} | [
"<p",
">",
"Accepts",
"the",
"{",
"@link",
"InvocationContext",
"}",
"given",
"to",
"{",
"@link",
"#run",
"(",
"Object",
"...",
")",
"}}",
"the",
"{",
"@link",
"RequestProcessorChain",
"}",
"and",
"translates",
"the",
"request",
"metadata",
"to",
"a",
"con... | train | https://github.com/sahan/ZombieLink/blob/a9971add56d4f6919a4a5e84c78e9220011d8982/zombielink/src/main/java/com/lonepulse/zombielink/request/RequestProcessorChain.java#L107-L115 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java | UserManagedCacheBuilder.withSizeOfMaxObjectGraph | public UserManagedCacheBuilder<K, V, T> withSizeOfMaxObjectGraph(long size) {
UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
removeAnySizeOfEngine(otherBuilder);
otherBuilder.objectGraphSize = size;
otherBuilder.serviceCreationConfigurations.add(new DefaultSizeOfEngineProviderConfiguration(otherBuilder.maxObjectSize, otherBuilder.sizeOfUnit, otherBuilder.objectGraphSize));
return otherBuilder;
} | java | public UserManagedCacheBuilder<K, V, T> withSizeOfMaxObjectGraph(long size) {
UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
removeAnySizeOfEngine(otherBuilder);
otherBuilder.objectGraphSize = size;
otherBuilder.serviceCreationConfigurations.add(new DefaultSizeOfEngineProviderConfiguration(otherBuilder.maxObjectSize, otherBuilder.sizeOfUnit, otherBuilder.objectGraphSize));
return otherBuilder;
} | [
"public",
"UserManagedCacheBuilder",
"<",
"K",
",",
"V",
",",
"T",
">",
"withSizeOfMaxObjectGraph",
"(",
"long",
"size",
")",
"{",
"UserManagedCacheBuilder",
"<",
"K",
",",
"V",
",",
"T",
">",
"otherBuilder",
"=",
"new",
"UserManagedCacheBuilder",
"<>",
"(",
... | Adds or updates the {@link DefaultSizeOfEngineProviderConfiguration} with the specified object graph maximum size to the configured
builder.
<p>
{@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}.
@param size the maximum graph size
@return a new builder with the added / updated configuration | [
"Adds",
"or",
"updates",
"the",
"{",
"@link",
"DefaultSizeOfEngineProviderConfiguration",
"}",
"with",
"the",
"specified",
"object",
"graph",
"maximum",
"size",
"to",
"the",
"configured",
"builder",
".",
"<p",
">",
"{",
"@link",
"SizeOfEngine",
"}",
"is",
"what"... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java#L741-L747 |
haraldk/TwelveMonkeys | imageio/imageio-clippath/src/main/java/com/twelvemonkeys/imageio/path/AdobePathBuilder.java | AdobePathBuilder.pathToShape | private Path2D pathToShape(final List<List<AdobePathSegment>> paths) {
GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, paths.size());
GeneralPath subpath = null;
for (List<AdobePathSegment> points : paths) {
int length = points.size();
for (int i = 0; i < points.size(); i++) {
AdobePathSegment current = points.get(i);
int step = i == 0 ? 0 : i == length - 1 ? 2 : 1;
switch (step) {
// begin
case 0: {
subpath = new GeneralPath(Path2D.WIND_EVEN_ODD, length);
subpath.moveTo(current.apx, current.apy);
if (length > 1) {
AdobePathSegment next = points.get((i + 1));
subpath.curveTo(current.cplx, current.cply, next.cppx, next.cppy, next.apx, next.apy);
}
else {
subpath.lineTo(current.apx, current.apy);
}
break;
}
// middle
case 1: {
AdobePathSegment next = points.get((i + 1)); // we are always guaranteed one more.
subpath.curveTo(current.cplx, current.cply, next.cppx, next.cppy, next.apx, next.apy);
break;
}
// end
case 2: {
AdobePathSegment first = points.get(0);
if (first.selector == AdobePathSegment.CLOSED_SUBPATH_BEZIER_LINKED || first.selector == AdobePathSegment.CLOSED_SUBPATH_BEZIER_UNLINKED) {
subpath.curveTo(current.cplx, current.cply, first.cppx, first.cppy, first.apx, first.apy);
subpath.closePath();
path.append(subpath, false);
}
else {
subpath.lineTo(current.apx, current.apy);
path.append(subpath, true);
}
break;
}
}
}
}
return path;
} | java | private Path2D pathToShape(final List<List<AdobePathSegment>> paths) {
GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, paths.size());
GeneralPath subpath = null;
for (List<AdobePathSegment> points : paths) {
int length = points.size();
for (int i = 0; i < points.size(); i++) {
AdobePathSegment current = points.get(i);
int step = i == 0 ? 0 : i == length - 1 ? 2 : 1;
switch (step) {
// begin
case 0: {
subpath = new GeneralPath(Path2D.WIND_EVEN_ODD, length);
subpath.moveTo(current.apx, current.apy);
if (length > 1) {
AdobePathSegment next = points.get((i + 1));
subpath.curveTo(current.cplx, current.cply, next.cppx, next.cppy, next.apx, next.apy);
}
else {
subpath.lineTo(current.apx, current.apy);
}
break;
}
// middle
case 1: {
AdobePathSegment next = points.get((i + 1)); // we are always guaranteed one more.
subpath.curveTo(current.cplx, current.cply, next.cppx, next.cppy, next.apx, next.apy);
break;
}
// end
case 2: {
AdobePathSegment first = points.get(0);
if (first.selector == AdobePathSegment.CLOSED_SUBPATH_BEZIER_LINKED || first.selector == AdobePathSegment.CLOSED_SUBPATH_BEZIER_UNLINKED) {
subpath.curveTo(current.cplx, current.cply, first.cppx, first.cppy, first.apx, first.apy);
subpath.closePath();
path.append(subpath, false);
}
else {
subpath.lineTo(current.apx, current.apy);
path.append(subpath, true);
}
break;
}
}
}
}
return path;
} | [
"private",
"Path2D",
"pathToShape",
"(",
"final",
"List",
"<",
"List",
"<",
"AdobePathSegment",
">",
">",
"paths",
")",
"{",
"GeneralPath",
"path",
"=",
"new",
"GeneralPath",
"(",
"Path2D",
".",
"WIND_EVEN_ODD",
",",
"paths",
".",
"size",
"(",
")",
")",
... | The Correct Order... P1, P2, P3, P4, P5, P6 (Closed) moveTo(P1)
curveTo(P1.cpl, P2.cpp, P2.ap); curveTo(P2.cpl, P3.cppy, P3.ap);
curveTo(P3.cpl, P4.cpp, P4.ap); curveTo(P4.cpl, P5.cpp, P5.ap);
curveTo(P5.cply, P6.cpp, P6.ap); curveTo(P6.cpl, P1.cpp, P1.ap);
closePath() | [
"The",
"Correct",
"Order",
"...",
"P1",
"P2",
"P3",
"P4",
"P5",
"P6",
"(",
"Closed",
")",
"moveTo",
"(",
"P1",
")",
"curveTo",
"(",
"P1",
".",
"cpl",
"P2",
".",
"cpp",
"P2",
".",
"ap",
")",
";",
"curveTo",
"(",
"P2",
".",
"cpl",
"P3",
".",
"c... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-clippath/src/main/java/com/twelvemonkeys/imageio/path/AdobePathBuilder.java#L151-L207 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.readMultiDataPoints | public Cursor<MultiDataPoint> readMultiDataPoints(Filter filter, Interval interval) {
return readMultiDataPoints(filter, interval, DateTimeZone.getDefault(), null, null);
} | java | public Cursor<MultiDataPoint> readMultiDataPoints(Filter filter, Interval interval) {
return readMultiDataPoints(filter, interval, DateTimeZone.getDefault(), null, null);
} | [
"public",
"Cursor",
"<",
"MultiDataPoint",
">",
"readMultiDataPoints",
"(",
"Filter",
"filter",
",",
"Interval",
"interval",
")",
"{",
"return",
"readMultiDataPoints",
"(",
"filter",
",",
"interval",
",",
"DateTimeZone",
".",
"getDefault",
"(",
")",
",",
"null",... | Returns a cursor of multi-datapoints specified by a series filter.
<p>This endpoint allows one to request datapoints for multiple series in one call.
The system default timezone is used for the returned DateTimes.
@param filter The series filter
@param interval An interval of time for the query (start/end datetimes)
@return A Cursor of MultiDataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@see Filter
@see MultiDataPoint
@since 1.1.0 | [
"Returns",
"a",
"cursor",
"of",
"multi",
"-",
"datapoints",
"specified",
"by",
"a",
"series",
"filter",
"."
] | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L870-L872 |
ops4j/org.ops4j.pax.logging | pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java | ThrowableProxy.getCauseStackTraceAsString | public String getCauseStackTraceAsString(final List<String> packages, final String suffix) {
return getCauseStackTraceAsString(packages, PlainTextRenderer.getInstance(), suffix);
} | java | public String getCauseStackTraceAsString(final List<String> packages, final String suffix) {
return getCauseStackTraceAsString(packages, PlainTextRenderer.getInstance(), suffix);
} | [
"public",
"String",
"getCauseStackTraceAsString",
"(",
"final",
"List",
"<",
"String",
">",
"packages",
",",
"final",
"String",
"suffix",
")",
"{",
"return",
"getCauseStackTraceAsString",
"(",
"packages",
",",
"PlainTextRenderer",
".",
"getInstance",
"(",
")",
","... | Formats the Throwable that is the cause of this Throwable.
@param packages The List of packages to be suppressed from the trace.
@param suffix
@return The formatted Throwable that caused this Throwable. | [
"Formats",
"the",
"Throwable",
"that",
"is",
"the",
"cause",
"of",
"this",
"Throwable",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-log4j2/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java#L410-L412 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java | SarlDocumentationParser.extractDynamicName | protected void extractDynamicName(Tag tag, CharSequence name, OutParameter<String> dynamicName) {
if (tag.hasDynamicName()) {
final Pattern pattern = Pattern.compile(getDynamicNameExtractionPattern());
final Matcher matcher = pattern.matcher(name);
if (matcher.matches()) {
dynamicName.set(Strings.nullToEmpty(matcher.group(1)));
return;
}
}
dynamicName.set(name.toString());
} | java | protected void extractDynamicName(Tag tag, CharSequence name, OutParameter<String> dynamicName) {
if (tag.hasDynamicName()) {
final Pattern pattern = Pattern.compile(getDynamicNameExtractionPattern());
final Matcher matcher = pattern.matcher(name);
if (matcher.matches()) {
dynamicName.set(Strings.nullToEmpty(matcher.group(1)));
return;
}
}
dynamicName.set(name.toString());
} | [
"protected",
"void",
"extractDynamicName",
"(",
"Tag",
"tag",
",",
"CharSequence",
"name",
",",
"OutParameter",
"<",
"String",
">",
"dynamicName",
")",
"{",
"if",
"(",
"tag",
".",
"hasDynamicName",
"(",
")",
")",
"{",
"final",
"Pattern",
"pattern",
"=",
"P... | Extract the dynamic name of that from the raw text.
@param tag the tag to extract for.
@param name the raw text.
@param dynamicName the dynamic name. | [
"Extract",
"the",
"dynamic",
"name",
"of",
"that",
"from",
"the",
"raw",
"text",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L621-L631 |
kiegroup/jbpm | jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java | ClassCacheManager.findCommandCallback | public CommandCallback findCommandCallback(String name, ClassLoader cl) {
synchronized (callbackCache) {
if (!callbackCache.containsKey(name)) {
try {
CommandCallback commandCallbackInstance = (CommandCallback) Class.forName(name, true, cl).newInstance();
return commandCallbackInstance;
// callbackCache.put(name, commandCallbackInstance);
} catch (Exception ex) {
throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
}
} else {
CommandCallback cmdCallback = callbackCache.get(name);
if (!cmdCallback.getClass().getClassLoader().equals(cl)) {
callbackCache.remove(name);
try {
CommandCallback commandCallbackInstance = (CommandCallback) Class.forName(name, true, cl).newInstance();
callbackCache.put(name, commandCallbackInstance);
} catch (Exception ex) {
throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
}
}
}
}
return callbackCache.get(name);
} | java | public CommandCallback findCommandCallback(String name, ClassLoader cl) {
synchronized (callbackCache) {
if (!callbackCache.containsKey(name)) {
try {
CommandCallback commandCallbackInstance = (CommandCallback) Class.forName(name, true, cl).newInstance();
return commandCallbackInstance;
// callbackCache.put(name, commandCallbackInstance);
} catch (Exception ex) {
throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
}
} else {
CommandCallback cmdCallback = callbackCache.get(name);
if (!cmdCallback.getClass().getClassLoader().equals(cl)) {
callbackCache.remove(name);
try {
CommandCallback commandCallbackInstance = (CommandCallback) Class.forName(name, true, cl).newInstance();
callbackCache.put(name, commandCallbackInstance);
} catch (Exception ex) {
throw new IllegalArgumentException("Unknown Command implementation with name '" + name + "'");
}
}
}
}
return callbackCache.get(name);
} | [
"public",
"CommandCallback",
"findCommandCallback",
"(",
"String",
"name",
",",
"ClassLoader",
"cl",
")",
"{",
"synchronized",
"(",
"callbackCache",
")",
"{",
"if",
"(",
"!",
"callbackCache",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"try",
"{",
"Comma... | Finds command callback by FQCN and if not found loads the class and store the instance in
the cache.
@param name - fully qualified class name of the command callback
@return initialized class instance | [
"Finds",
"command",
"callback",
"by",
"FQCN",
"and",
"if",
"not",
"found",
"loads",
"the",
"class",
"and",
"store",
"the",
"instance",
"in",
"the",
"cache",
"."
] | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-executor/src/main/java/org/jbpm/executor/impl/ClassCacheManager.java#L87-L114 |
ixa-ehu/ixa-pipe-pos | src/main/java/eus/ixa/ixa/pipe/pos/Resources.java | Resources.getBinaryTaggerDict | public final URL getBinaryTaggerDict(final String lang, final String resourcesDirectory) {
return resourcesDirectory == null
? getBinaryTaggerDictFromResources(lang)
: getBinaryTaggerDictFromDirectory(lang, resourcesDirectory);
} | java | public final URL getBinaryTaggerDict(final String lang, final String resourcesDirectory) {
return resourcesDirectory == null
? getBinaryTaggerDictFromResources(lang)
: getBinaryTaggerDictFromDirectory(lang, resourcesDirectory);
} | [
"public",
"final",
"URL",
"getBinaryTaggerDict",
"(",
"final",
"String",
"lang",
",",
"final",
"String",
"resourcesDirectory",
")",
"{",
"return",
"resourcesDirectory",
"==",
"null",
"?",
"getBinaryTaggerDictFromResources",
"(",
"lang",
")",
":",
"getBinaryTaggerDictF... | The the dictionary for the {@code MorfologikMorphoTagger}.
@param lang
the language
@param resourcesDirectory
the directory where the dictionary can be found.
If {@code null}, load from package resources.
@return the URL of the dictionary | [
"The",
"the",
"dictionary",
"for",
"the",
"{",
"@code",
"MorfologikMorphoTagger",
"}",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-pos/blob/083c986103f95ae8063b8ddc89a2caa8047d29b9/src/main/java/eus/ixa/ixa/pipe/pos/Resources.java#L117-L121 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java | RelatedClassMap.addCardinality | public void addCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass,
int maxOccurrences) {
Cardinality cardinality = new Cardinality(sourceClass, targetClass, maxOccurrences);
getOrCreateCardinalities(sourceClass).addCardinality(cardinality);
} | java | public void addCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass,
int maxOccurrences) {
Cardinality cardinality = new Cardinality(sourceClass, targetClass, maxOccurrences);
getOrCreateCardinalities(sourceClass).addCardinality(cardinality);
} | [
"public",
"void",
"addCardinality",
"(",
"Class",
"<",
"?",
"extends",
"ElementBase",
">",
"sourceClass",
",",
"Class",
"<",
"?",
"extends",
"ElementBase",
">",
"targetClass",
",",
"int",
"maxOccurrences",
")",
"{",
"Cardinality",
"cardinality",
"=",
"new",
"C... | Adds cardinality relationship between source and target classes.
@param sourceClass The source class.
@param targetClass Class to be registered.
@param maxOccurrences Maximum occurrences for this relationship. | [
"Adds",
"cardinality",
"relationship",
"between",
"source",
"and",
"target",
"classes",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L151-L155 |
yasserg/crawler4j | crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java | WebCrawler.shouldVisit | public boolean shouldVisit(Page referringPage, WebURL url) {
if (myController.getConfig().isRespectNoFollow()) {
return !((referringPage != null &&
referringPage.getContentType() != null &&
referringPage.getContentType().contains("html") &&
((HtmlParseData)referringPage.getParseData())
.getMetaTagValue("robots")
.contains("nofollow")) ||
url.getAttribute("rel").contains("nofollow"));
}
return true;
} | java | public boolean shouldVisit(Page referringPage, WebURL url) {
if (myController.getConfig().isRespectNoFollow()) {
return !((referringPage != null &&
referringPage.getContentType() != null &&
referringPage.getContentType().contains("html") &&
((HtmlParseData)referringPage.getParseData())
.getMetaTagValue("robots")
.contains("nofollow")) ||
url.getAttribute("rel").contains("nofollow"));
}
return true;
} | [
"public",
"boolean",
"shouldVisit",
"(",
"Page",
"referringPage",
",",
"WebURL",
"url",
")",
"{",
"if",
"(",
"myController",
".",
"getConfig",
"(",
")",
".",
"isRespectNoFollow",
"(",
")",
")",
"{",
"return",
"!",
"(",
"(",
"referringPage",
"!=",
"null",
... | Classes that extends WebCrawler should overwrite this function to tell the
crawler whether the given url should be crawled or not. The following
default implementation indicates that all urls should be included in the crawl
except those with a nofollow flag.
@param url
the url which we are interested to know whether it should be
included in the crawl or not.
@param referringPage
The Page in which this url was found.
@return if the url should be included in the crawl it returns true,
otherwise false is returned. | [
"Classes",
"that",
"extends",
"WebCrawler",
"should",
"overwrite",
"this",
"function",
"to",
"tell",
"the",
"crawler",
"whether",
"the",
"given",
"url",
"should",
"be",
"crawled",
"or",
"not",
".",
"The",
"following",
"default",
"implementation",
"indicates",
"t... | train | https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java#L369-L381 |
zalando/problem-spring-web | problem-spring-common/src/main/java/org/zalando/problem/spring/common/Lists.java | Lists.lengthOfTrailingPartialSubList | static int lengthOfTrailingPartialSubList(final List<?> source, final List<?> target) {
final int s = source.size() - 1;
final int t = target.size() - 1;
int l = 0;
while (l <= s && l <= t && source.get(s - l).equals(target.get(t - l))) {
l++;
}
return l;
} | java | static int lengthOfTrailingPartialSubList(final List<?> source, final List<?> target) {
final int s = source.size() - 1;
final int t = target.size() - 1;
int l = 0;
while (l <= s && l <= t && source.get(s - l).equals(target.get(t - l))) {
l++;
}
return l;
} | [
"static",
"int",
"lengthOfTrailingPartialSubList",
"(",
"final",
"List",
"<",
"?",
">",
"source",
",",
"final",
"List",
"<",
"?",
">",
"target",
")",
"{",
"final",
"int",
"s",
"=",
"source",
".",
"size",
"(",
")",
"-",
"1",
";",
"final",
"int",
"t",
... | Returns the length of the longest trailing partial sublist of the
target list within the specified source list, or 0 if there is no such
occurrence. More formally, returns the length <tt>i</tt>
such that
{@code source.subList(source.size() - i, source.size()).equals(target.subList(target.size() - i, target.size()))},
or 0 if there is no such index.
@param source the list in which to search for the longest trailing partial sublist
of <tt>target</tt>.
@param target the list to search for as a trailing partial sublist of <tt>source</tt>.
@return the length of the last occurrence of trailing partial sublist the specified
target list within the specified source list, or 0 if there is no such occurrence.
@since 1.4 | [
"Returns",
"the",
"length",
"of",
"the",
"longest",
"trailing",
"partial",
"sublist",
"of",
"the",
"target",
"list",
"within",
"the",
"specified",
"source",
"list",
"or",
"0",
"if",
"there",
"is",
"no",
"such",
"occurrence",
".",
"More",
"formally",
"returns... | train | https://github.com/zalando/problem-spring-web/blob/eae45765e6838ac8679f439470c1473f4f7bab37/problem-spring-common/src/main/java/org/zalando/problem/spring/common/Lists.java#L26-L36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.