repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
esigate/esigate | esigate-core/src/main/java/org/esigate/http/OutgoingRequestContext.java | OutgoingRequestContext.removeAttribute | public Object removeAttribute(String id, boolean restore) {
Object value = removeAttribute(id);
if (restore) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history != null && !history.isEmpty()) {
Object previous = history.remove();
setAttribute(id, previous);
}
}
return value;
} | java | public Object removeAttribute(String id, boolean restore) {
Object value = removeAttribute(id);
if (restore) {
String historyAttribute = id + "history";
Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
if (history != null && !history.isEmpty()) {
Object previous = history.remove();
setAttribute(id, previous);
}
}
return value;
} | [
"public",
"Object",
"removeAttribute",
"(",
"String",
"id",
",",
"boolean",
"restore",
")",
"{",
"Object",
"value",
"=",
"removeAttribute",
"(",
"id",
")",
";",
"if",
"(",
"restore",
")",
"{",
"String",
"historyAttribute",
"=",
"id",
"+",
"\"history\"",
";... | remove attribute and restore previous attribute value
@param id
attribute name
@param restore
restore previous attribute value
@return attribute value | [
"remove",
"attribute",
"and",
"restore",
"previous",
"attribute",
"value"
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/OutgoingRequestContext.java#L116-L127 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java | ListApi.getString | public static Optional<String> getString(final List list, final Integer... path) {
return get(list, String.class, path);
} | java | public static Optional<String> getString(final List list, final Integer... path) {
return get(list, String.class, path);
} | [
"public",
"static",
"Optional",
"<",
"String",
">",
"getString",
"(",
"final",
"List",
"list",
",",
"final",
"Integer",
"...",
"path",
")",
"{",
"return",
"get",
"(",
"list",
",",
"String",
".",
"class",
",",
"path",
")",
";",
"}"
] | Get string value by path.
@param list subject
@param path nodes to walk in map
@return value | [
"Get",
"string",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java#L150-L152 |
BlueBrain/bluima | modules/bluima_banner/src/main/java/banner/Sentence.java | Sentence.getTrainingText | public String getTrainingText(TagFormat format, boolean reverse)
{
List<TaggedToken> taggedTokens = new ArrayList<TaggedToken>(getTaggedTokens());
if (reverse)
Collections.reverse(taggedTokens);
StringBuffer trainingText = new StringBuffer();
for (TaggedToken token : taggedTokens)
{
trainingText.append(token.getText(format));
trainingText.append(" ");
}
return trainingText.toString().trim();
} | java | public String getTrainingText(TagFormat format, boolean reverse)
{
List<TaggedToken> taggedTokens = new ArrayList<TaggedToken>(getTaggedTokens());
if (reverse)
Collections.reverse(taggedTokens);
StringBuffer trainingText = new StringBuffer();
for (TaggedToken token : taggedTokens)
{
trainingText.append(token.getText(format));
trainingText.append(" ");
}
return trainingText.toString().trim();
} | [
"public",
"String",
"getTrainingText",
"(",
"TagFormat",
"format",
",",
"boolean",
"reverse",
")",
"{",
"List",
"<",
"TaggedToken",
">",
"taggedTokens",
"=",
"new",
"ArrayList",
"<",
"TaggedToken",
">",
"(",
"getTaggedTokens",
"(",
")",
")",
";",
"if",
"(",
... | Returns a text representation of the tagging for this {@link Sentence}, using the specified {@link TagFormat}. In other words, each token in
the sentence is given a tag indicating its position in a mention or that the token is not a mention. Assumes that each token is tagged either 0
or 1 times.
@param format
The {@link TagFormat} to use
@param reverse
Whether to return the text in reverse order
@return A text representation of the tagging for this {@link Sentence}, using the specified {@link TagFormat} | [
"Returns",
"a",
"text",
"representation",
"of",
"the",
"tagging",
"for",
"this",
"{",
"@link",
"Sentence",
"}",
"using",
"the",
"specified",
"{",
"@link",
"TagFormat",
"}",
".",
"In",
"other",
"words",
"each",
"token",
"in",
"the",
"sentence",
"is",
"given... | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_banner/src/main/java/banner/Sentence.java#L390-L402 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/ReferNotifySender.java | ReferNotifySender.processRefer | public void processRefer(long timeout, int statusCode, String reasonPhrase, int duration,
EventHeader overrideEvent) {
setErrorMessage("");
PhoneB b = new PhoneB(timeout + 500, statusCode, reasonPhrase, duration, overrideEvent);
b.start();
} | java | public void processRefer(long timeout, int statusCode, String reasonPhrase, int duration,
EventHeader overrideEvent) {
setErrorMessage("");
PhoneB b = new PhoneB(timeout + 500, statusCode, reasonPhrase, duration, overrideEvent);
b.start();
} | [
"public",
"void",
"processRefer",
"(",
"long",
"timeout",
",",
"int",
"statusCode",
",",
"String",
"reasonPhrase",
",",
"int",
"duration",
",",
"EventHeader",
"overrideEvent",
")",
"{",
"setErrorMessage",
"(",
"\"\"",
")",
";",
"PhoneB",
"b",
"=",
"new",
"Ph... | Same as the other processRefer() except allows for a couple of overrides for testing error
handling by the far end outbound REFER side: (a) takes a duration for adding ExpiresHeader to
the REFER response (the response shouldn't have an expires header), and (b) this method takes
an EventHeader for overriding what would normally/correctly be sent back in the response
(normally same as what was received in the request). | [
"Same",
"as",
"the",
"other",
"processRefer",
"()",
"except",
"allows",
"for",
"a",
"couple",
"of",
"overrides",
"for",
"testing",
"error",
"handling",
"by",
"the",
"far",
"end",
"outbound",
"REFER",
"side",
":",
"(",
"a",
")",
"takes",
"a",
"duration",
... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/ReferNotifySender.java#L95-L101 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Sphere3dfx.java | Sphere3dfx.radiusProperty | @Pure
public DoubleProperty radiusProperty() {
if (this.radius == null) {
this.radius = new SimpleDoubleProperty(this, MathFXAttributeNames.RADIUS) {
@Override
protected void invalidated() {
if (get() < 0.) {
set(0.);
}
}
};
}
return this.radius;
} | java | @Pure
public DoubleProperty radiusProperty() {
if (this.radius == null) {
this.radius = new SimpleDoubleProperty(this, MathFXAttributeNames.RADIUS) {
@Override
protected void invalidated() {
if (get() < 0.) {
set(0.);
}
}
};
}
return this.radius;
} | [
"@",
"Pure",
"public",
"DoubleProperty",
"radiusProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"radius",
"==",
"null",
")",
"{",
"this",
".",
"radius",
"=",
"new",
"SimpleDoubleProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"RADIUS",
")",
"{"... | Replies the property that is the radius of the circle.
@return the radius property. | [
"Replies",
"the",
"property",
"that",
"is",
"the",
"radius",
"of",
"the",
"circle",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Sphere3dfx.java#L216-L229 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java | JDBC4PreparedStatement.setTime | @Override
public void setTime(int parameterIndex, Time x) throws SQLException
{
checkParameterBounds(parameterIndex);
throw SQLError.noSupport();
} | java | @Override
public void setTime(int parameterIndex, Time x) throws SQLException
{
checkParameterBounds(parameterIndex);
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"void",
"setTime",
"(",
"int",
"parameterIndex",
",",
"Time",
"x",
")",
"throws",
"SQLException",
"{",
"checkParameterBounds",
"(",
"parameterIndex",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
")",
";",
"}"
] | Sets the designated parameter to the given java.sql.Time value. | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"java",
".",
"sql",
".",
"Time",
"value",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L558-L563 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.of | public static IntStreamEx of(IntStream stream) {
return stream instanceof IntStreamEx ? (IntStreamEx) stream : new IntStreamEx(stream, StreamContext.of(stream));
} | java | public static IntStreamEx of(IntStream stream) {
return stream instanceof IntStreamEx ? (IntStreamEx) stream : new IntStreamEx(stream, StreamContext.of(stream));
} | [
"public",
"static",
"IntStreamEx",
"of",
"(",
"IntStream",
"stream",
")",
"{",
"return",
"stream",
"instanceof",
"IntStreamEx",
"?",
"(",
"IntStreamEx",
")",
"stream",
":",
"new",
"IntStreamEx",
"(",
"stream",
",",
"StreamContext",
".",
"of",
"(",
"stream",
... | Returns an {@code IntStreamEx} object which wraps given {@link IntStream}
.
<p>
The supplied stream must not be consumed or closed when this method is
called. No operation must be performed on the supplied stream after it's
wrapped.
@param stream original stream
@return the wrapped stream
@since 0.0.8 | [
"Returns",
"an",
"{",
"@code",
"IntStreamEx",
"}",
"object",
"which",
"wraps",
"given",
"{",
"@link",
"IntStream",
"}",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L2152-L2154 |
jenkinsci/jenkins | core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java | WindowsInstallerLink.runElevated | static int runElevated(File jenkinsExe, String command, TaskListener out, File pwd) throws IOException, InterruptedException {
try {
return new LocalLauncher(out).launch().cmds(jenkinsExe, command).stdout(out).pwd(pwd).join();
} catch (IOException e) {
if (e.getMessage().contains("CreateProcess") && e.getMessage().contains("=740")) {
// fall through
} else {
throw e;
}
}
// error code 740 is ERROR_ELEVATION_REQUIRED, indicating that
// we run in UAC-enabled Windows and we need to run this in an elevated privilege
SHELLEXECUTEINFO sei = new SHELLEXECUTEINFO();
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.lpVerb = "runas";
sei.lpFile = jenkinsExe.getAbsolutePath();
sei.lpParameters = "/redirect redirect.log "+command;
sei.lpDirectory = pwd.getAbsolutePath();
sei.nShow = SW_HIDE;
if (!Shell32.INSTANCE.ShellExecuteEx(sei))
throw new IOException("Failed to shellExecute: "+ Native.getLastError());
try {
return Kernel32Utils.waitForExitProcess(sei.hProcess);
} finally {
try (InputStream fin = Files.newInputStream(new File(pwd,"redirect.log").toPath())) {
IOUtils.copy(fin, out.getLogger());
} catch (InvalidPathException e) {
// ignore;
}
}
} | java | static int runElevated(File jenkinsExe, String command, TaskListener out, File pwd) throws IOException, InterruptedException {
try {
return new LocalLauncher(out).launch().cmds(jenkinsExe, command).stdout(out).pwd(pwd).join();
} catch (IOException e) {
if (e.getMessage().contains("CreateProcess") && e.getMessage().contains("=740")) {
// fall through
} else {
throw e;
}
}
// error code 740 is ERROR_ELEVATION_REQUIRED, indicating that
// we run in UAC-enabled Windows and we need to run this in an elevated privilege
SHELLEXECUTEINFO sei = new SHELLEXECUTEINFO();
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.lpVerb = "runas";
sei.lpFile = jenkinsExe.getAbsolutePath();
sei.lpParameters = "/redirect redirect.log "+command;
sei.lpDirectory = pwd.getAbsolutePath();
sei.nShow = SW_HIDE;
if (!Shell32.INSTANCE.ShellExecuteEx(sei))
throw new IOException("Failed to shellExecute: "+ Native.getLastError());
try {
return Kernel32Utils.waitForExitProcess(sei.hProcess);
} finally {
try (InputStream fin = Files.newInputStream(new File(pwd,"redirect.log").toPath())) {
IOUtils.copy(fin, out.getLogger());
} catch (InvalidPathException e) {
// ignore;
}
}
} | [
"static",
"int",
"runElevated",
"(",
"File",
"jenkinsExe",
",",
"String",
"command",
",",
"TaskListener",
"out",
",",
"File",
"pwd",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"try",
"{",
"return",
"new",
"LocalLauncher",
"(",
"out",
")",
... | Invokes jenkins.exe with a SCM management command.
<p>
If it fails in a way that indicates the presence of UAC, retry in an UAC compatible manner. | [
"Invokes",
"jenkins",
".",
"exe",
"with",
"a",
"SCM",
"management",
"command",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/lifecycle/WindowsInstallerLink.java#L286-L318 |
nightcode/yaranga | core/src/org/nightcode/common/base/Objects.java | Objects.validState | public static void validState(boolean expression, String message, Object... messageArgs) {
if (!expression) {
throw new IllegalStateException(format(message, messageArgs));
}
} | java | public static void validState(boolean expression, String message, Object... messageArgs) {
if (!expression) {
throw new IllegalStateException(format(message, messageArgs));
}
} | [
"public",
"static",
"void",
"validState",
"(",
"boolean",
"expression",
",",
"String",
"message",
",",
"Object",
"...",
"messageArgs",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"format",
"(",
"message",
"... | Checks boolean expression.
@param expression a boolean expression
@param message error message
@param messageArgs array of parameters to the message
@throws IllegalArgumentException if boolean expression is false | [
"Checks",
"boolean",
"expression",
"."
] | train | https://github.com/nightcode/yaranga/blob/f02cf8d8bcd365b6b1d55638938631a00e9ee808/core/src/org/nightcode/common/base/Objects.java#L76-L80 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/DateUtilities.java | DateUtilities.convertToUtc | public static long convertToUtc(long millis, String tz)
{
long ret = millis;
if(tz != null && tz.length() > 0)
{
DateTime dt = new DateTime(millis, DateTimeZone.forID(tz));
ret = dt.withZoneRetainFields(DateTimeZone.forID("UTC")).getMillis();
}
return ret;
} | java | public static long convertToUtc(long millis, String tz)
{
long ret = millis;
if(tz != null && tz.length() > 0)
{
DateTime dt = new DateTime(millis, DateTimeZone.forID(tz));
ret = dt.withZoneRetainFields(DateTimeZone.forID("UTC")).getMillis();
}
return ret;
} | [
"public",
"static",
"long",
"convertToUtc",
"(",
"long",
"millis",
",",
"String",
"tz",
")",
"{",
"long",
"ret",
"=",
"millis",
";",
"if",
"(",
"tz",
"!=",
"null",
"&&",
"tz",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"DateTime",
"dt",
"=",
"n... | Returns the given date converted to UTC using the given timezone.
@param millis The date to convert
@param tz The timezone associated with the date
@return The given date converted using the given timezone | [
"Returns",
"the",
"given",
"date",
"converted",
"to",
"UTC",
"using",
"the",
"given",
"timezone",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/DateUtilities.java#L379-L388 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java | MCAAuthorizationManager.obtainAuthorization | public synchronized void obtainAuthorization(Context context, ResponseListener listener, Object... params) {
authorizationProcessManager.startAuthorizationProcess(context, listener);
} | java | public synchronized void obtainAuthorization(Context context, ResponseListener listener, Object... params) {
authorizationProcessManager.startAuthorizationProcess(context, listener);
} | [
"public",
"synchronized",
"void",
"obtainAuthorization",
"(",
"Context",
"context",
",",
"ResponseListener",
"listener",
",",
"Object",
"...",
"params",
")",
"{",
"authorizationProcessManager",
".",
"startAuthorizationProcess",
"(",
"context",
",",
"listener",
")",
";... | Invoke process for obtaining authorization header. during this process
@param context Android Activity that will handle the authorization (like facebook or google)
@param listener Response listener | [
"Invoke",
"process",
"for",
"obtaining",
"authorization",
"header",
".",
"during",
"this",
"process"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java#L154-L156 |
m-m-m/util | datatype/src/main/java/net/sf/mmm/util/datatype/api/color/GenericColor.java | GenericColor.valueOf | public static GenericColor valueOf(Hue hue, Saturation saturation, Brightness brightness, Alpha alpha) {
Objects.requireNonNull(hue, "hue");
Objects.requireNonNull(saturation, "saturation");
Objects.requireNonNull(brightness, "brightness");
Objects.requireNonNull(alpha, "alpha");
GenericColor genericColor = new GenericColor();
genericColor.hue = hue;
genericColor.saturationHsb = saturation;
genericColor.brightness = brightness;
genericColor.alpha = alpha;
double b = brightness.getValueAsFactor();
double chroma = b * saturation.getValueAsFactor();
genericColor.chroma = new Chroma(chroma);
double min = b - chroma;
double lightness = (min + b) / 2;
genericColor.lightness = new Lightness(lightness);
double saturationHsl = calculateSaturationHsl(chroma, lightness);
genericColor.saturationHsl = new Saturation(saturationHsl);
calculateRgb(genericColor, hue, min, chroma);
return genericColor;
} | java | public static GenericColor valueOf(Hue hue, Saturation saturation, Brightness brightness, Alpha alpha) {
Objects.requireNonNull(hue, "hue");
Objects.requireNonNull(saturation, "saturation");
Objects.requireNonNull(brightness, "brightness");
Objects.requireNonNull(alpha, "alpha");
GenericColor genericColor = new GenericColor();
genericColor.hue = hue;
genericColor.saturationHsb = saturation;
genericColor.brightness = brightness;
genericColor.alpha = alpha;
double b = brightness.getValueAsFactor();
double chroma = b * saturation.getValueAsFactor();
genericColor.chroma = new Chroma(chroma);
double min = b - chroma;
double lightness = (min + b) / 2;
genericColor.lightness = new Lightness(lightness);
double saturationHsl = calculateSaturationHsl(chroma, lightness);
genericColor.saturationHsl = new Saturation(saturationHsl);
calculateRgb(genericColor, hue, min, chroma);
return genericColor;
} | [
"public",
"static",
"GenericColor",
"valueOf",
"(",
"Hue",
"hue",
",",
"Saturation",
"saturation",
",",
"Brightness",
"brightness",
",",
"Alpha",
"alpha",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"hue",
",",
"\"hue\"",
")",
";",
"Objects",
".",
"requ... | Creates a {@link GenericColor} from the given {@link Segment}s of {@link ColorModel#HSB}.
@param hue is the {@link Hue} part.
@param saturation is the {@link Saturation} part.
@param brightness is the {@link Brightness} part.
@param alpha is the {@link Alpha} value.
@return the {@link GenericColor}. | [
"Creates",
"a",
"{",
"@link",
"GenericColor",
"}",
"from",
"the",
"given",
"{",
"@link",
"Segment",
"}",
"s",
"of",
"{",
"@link",
"ColorModel#HSB",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/datatype/src/main/java/net/sf/mmm/util/datatype/api/color/GenericColor.java#L264-L285 |
Pi4J/pi4j | pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/pca/PCA9685GpioProvider.java | PCA9685GpioProvider.setAlwaysOn | public void setAlwaysOn(Pin pin) {
final int pwmOnValue = 0x1000;
final int pwmOffValue = 0x0000;
validatePin(pin, pwmOnValue, pwmOffValue);
final int channel = pin.getAddress();
try {
device.write(PCA9685A_LED0_ON_L + 4 * channel, (byte) 0x00);
device.write(PCA9685A_LED0_ON_H + 4 * channel, (byte) 0x10); // set bit 4 to high
device.write(PCA9685A_LED0_OFF_L + 4 * channel, (byte) 0x00);
device.write(PCA9685A_LED0_OFF_H + 4 * channel, (byte) 0x00);
} catch (IOException e) {
throw new RuntimeException("Error while trying to set channel [" + channel + "] always ON.", e);
}
cachePinValues(pin, pwmOnValue, pwmOffValue);
} | java | public void setAlwaysOn(Pin pin) {
final int pwmOnValue = 0x1000;
final int pwmOffValue = 0x0000;
validatePin(pin, pwmOnValue, pwmOffValue);
final int channel = pin.getAddress();
try {
device.write(PCA9685A_LED0_ON_L + 4 * channel, (byte) 0x00);
device.write(PCA9685A_LED0_ON_H + 4 * channel, (byte) 0x10); // set bit 4 to high
device.write(PCA9685A_LED0_OFF_L + 4 * channel, (byte) 0x00);
device.write(PCA9685A_LED0_OFF_H + 4 * channel, (byte) 0x00);
} catch (IOException e) {
throw new RuntimeException("Error while trying to set channel [" + channel + "] always ON.", e);
}
cachePinValues(pin, pwmOnValue, pwmOffValue);
} | [
"public",
"void",
"setAlwaysOn",
"(",
"Pin",
"pin",
")",
"{",
"final",
"int",
"pwmOnValue",
"=",
"0x1000",
";",
"final",
"int",
"pwmOffValue",
"=",
"0x0000",
";",
"validatePin",
"(",
"pin",
",",
"pwmOnValue",
",",
"pwmOffValue",
")",
";",
"final",
"int",
... | Permanently sets the output to High (no PWM anymore).<br>
The LEDn_ON_H output control bit 4, when set to logic 1, causes the output to be always ON.
@param pin represents channel 0..15 | [
"Permanently",
"sets",
"the",
"output",
"to",
"High",
"(",
"no",
"PWM",
"anymore",
")",
".",
"<br",
">",
"The",
"LEDn_ON_H",
"output",
"control",
"bit",
"4",
"when",
"set",
"to",
"logic",
"1",
"causes",
"the",
"output",
"to",
"be",
"always",
"ON",
"."
... | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/pca/PCA9685GpioProvider.java#L211-L225 |
groupon/monsoon | intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java | NamedResolverMap.getStringOrDefault | public String getStringOrDefault(int key, @NonNull String dfl) {
Any3<Boolean, Integer, String> value = data.getOrDefault(Any2.<Integer, String>left(key), Any3.<Boolean, Integer, String>create3(dfl));
return value.get3().orElseThrow(() -> new IllegalArgumentException("expected string argument for param " + key));
} | java | public String getStringOrDefault(int key, @NonNull String dfl) {
Any3<Boolean, Integer, String> value = data.getOrDefault(Any2.<Integer, String>left(key), Any3.<Boolean, Integer, String>create3(dfl));
return value.get3().orElseThrow(() -> new IllegalArgumentException("expected string argument for param " + key));
} | [
"public",
"String",
"getStringOrDefault",
"(",
"int",
"key",
",",
"@",
"NonNull",
"String",
"dfl",
")",
"{",
"Any3",
"<",
"Boolean",
",",
"Integer",
",",
"String",
">",
"value",
"=",
"data",
".",
"getOrDefault",
"(",
"Any2",
".",
"<",
"Integer",
",",
"... | Return the string value indicated by the given numeric key.
@param key The key of the value to return.
@param dfl The default value to return, if the key is absent.
@return The string value stored under the given key, or dfl.
@throws IllegalArgumentException if the value is present, but not a
string. | [
"Return",
"the",
"string",
"value",
"indicated",
"by",
"the",
"given",
"numeric",
"key",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L101-L104 |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/LocalResponseCache.java | LocalResponseCache.installResponseCache | @Deprecated
public static void installResponseCache(String baseURL, File cacheDir, boolean checkForUpdates)
{
ResponseCache.setDefault(new LocalResponseCache(baseURL, cacheDir, checkForUpdates));
} | java | @Deprecated
public static void installResponseCache(String baseURL, File cacheDir, boolean checkForUpdates)
{
ResponseCache.setDefault(new LocalResponseCache(baseURL, cacheDir, checkForUpdates));
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"installResponseCache",
"(",
"String",
"baseURL",
",",
"File",
"cacheDir",
",",
"boolean",
"checkForUpdates",
")",
"{",
"ResponseCache",
".",
"setDefault",
"(",
"new",
"LocalResponseCache",
"(",
"baseURL",
",",
"cache... | Sets this cache as default response cache
@param baseURL the URL, the caching should be restricted to or <code>null</code> for none
@param cacheDir the cache directory
@param checkForUpdates true if the URL is queried for newer versions of a file first
@deprecated Use {@link TileFactory#setLocalCache(LocalCache)} instead | [
"Sets",
"this",
"cache",
"as",
"default",
"response",
"cache"
] | train | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/LocalResponseCache.java#L55-L59 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java | DebugUtil.printTimestamp | public static void printTimestamp(final Calendar pCalendar, final PrintStream pPrintStream) {
if (pPrintStream == null) {
System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE);
return;
}
pPrintStream.println(getTimestamp(pCalendar));
} | java | public static void printTimestamp(final Calendar pCalendar, final PrintStream pPrintStream) {
if (pPrintStream == null) {
System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE);
return;
}
pPrintStream.println(getTimestamp(pCalendar));
} | [
"public",
"static",
"void",
"printTimestamp",
"(",
"final",
"Calendar",
"pCalendar",
",",
"final",
"PrintStream",
"pPrintStream",
")",
"{",
"if",
"(",
"pPrintStream",
"==",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"PRINTSTREAM_IS_NULL_ERROR_M... | Prints out the calendar time.
<p>
@param pCalendar the {@code java.util.Calendar} object from which to extract the date information.
@param pPrintStream the {@code java.io.PrintStream} for flushing the results.
@see <a href="http://java.sun.com/products/jdk/1.3/docs/api/java/util/Calendar.html">{@code java.util.Calendar}</a> | [
"Prints",
"out",
"the",
"calendar",
"time",
".",
"<p",
">"
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L737-L744 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/ExceptionHelper.java | ExceptionHelper.generateException | public static PersistenceBrokerSQLException generateException(SQLException ex, String sql, ClassDescriptor cld, Logger logger, Object obj)
{
return generateException(ex, sql, cld, null, logger, obj);
} | java | public static PersistenceBrokerSQLException generateException(SQLException ex, String sql, ClassDescriptor cld, Logger logger, Object obj)
{
return generateException(ex, sql, cld, null, logger, obj);
} | [
"public",
"static",
"PersistenceBrokerSQLException",
"generateException",
"(",
"SQLException",
"ex",
",",
"String",
"sql",
",",
"ClassDescriptor",
"cld",
",",
"Logger",
"logger",
",",
"Object",
"obj",
")",
"{",
"return",
"generateException",
"(",
"ex",
",",
"sql",... | Method which support the conversion of {@link java.sql.SQLException} to
OJB's runtime exception (with additional message details).
@param ex The exception to convert (mandatory).
@param sql The used sql-statement or <em>null</em>.
@param cld The {@link org.apache.ojb.broker.metadata.ClassDescriptor} of the target object or <em>null</em>.
@param logger The {@link org.apache.ojb.broker.util.logging.Logger} to log an detailed message
to the specified {@link org.apache.ojb.broker.util.logging.Logger} or <em>null</em> to skip logging message.
@param obj The target object or <em>null</em>.
@return A new created {@link org.apache.ojb.broker.PersistenceBrokerSQLException} based on the specified
arguments. | [
"Method",
"which",
"support",
"the",
"conversion",
"of",
"{",
"@link",
"java",
".",
"sql",
".",
"SQLException",
"}",
"to",
"OJB",
"s",
"runtime",
"exception",
"(",
"with",
"additional",
"message",
"details",
")",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ExceptionHelper.java#L69-L72 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java | XmlReader.getValue | private String getValue(String defaultValue, String attribute)
{
Check.notNull(attribute);
if (root.hasAttribute(attribute))
{
return root.getAttribute(attribute);
}
return defaultValue;
} | java | private String getValue(String defaultValue, String attribute)
{
Check.notNull(attribute);
if (root.hasAttribute(attribute))
{
return root.getAttribute(attribute);
}
return defaultValue;
} | [
"private",
"String",
"getValue",
"(",
"String",
"defaultValue",
",",
"String",
"attribute",
")",
"{",
"Check",
".",
"notNull",
"(",
"attribute",
")",
";",
"if",
"(",
"root",
".",
"hasAttribute",
"(",
"attribute",
")",
")",
"{",
"return",
"root",
".",
"ge... | Get the attribute value.
@param defaultValue The value returned if attribute does not exist (can be <code>null</code>).
@param attribute The attribute name (must not be <code>null</code>).
@return The attribute value.
@throws LionEngineException If attribute is not valid or does not exist. | [
"Get",
"the",
"attribute",
"value",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java#L434-L443 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/throttling/ThrottlingHttpService.java | ThrottlingHttpService.onFailure | @Override
protected HttpResponse onFailure(ServiceRequestContext ctx, HttpRequest req, @Nullable Throwable cause)
throws Exception {
return HttpResponse.of(HttpStatus.SERVICE_UNAVAILABLE);
} | java | @Override
protected HttpResponse onFailure(ServiceRequestContext ctx, HttpRequest req, @Nullable Throwable cause)
throws Exception {
return HttpResponse.of(HttpStatus.SERVICE_UNAVAILABLE);
} | [
"@",
"Override",
"protected",
"HttpResponse",
"onFailure",
"(",
"ServiceRequestContext",
"ctx",
",",
"HttpRequest",
"req",
",",
"@",
"Nullable",
"Throwable",
"cause",
")",
"throws",
"Exception",
"{",
"return",
"HttpResponse",
".",
"of",
"(",
"HttpStatus",
".",
"... | Invoked when {@code req} is throttled. By default, this method responds with the
{@link HttpStatus#SERVICE_UNAVAILABLE} status. | [
"Invoked",
"when",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/throttling/ThrottlingHttpService.java#L57-L61 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.injectAnother | @Internal
@SuppressWarnings({"WeakerAccess", "unused"})
@UsedByGeneratedCode
protected Object injectAnother(BeanResolutionContext resolutionContext, BeanContext context, Object bean) {
DefaultBeanContext defaultContext = (DefaultBeanContext) context;
if (bean == null) {
throw new BeanInstantiationException(resolutionContext, "Bean factory returned null");
}
return defaultContext.inject(resolutionContext, this, bean);
} | java | @Internal
@SuppressWarnings({"WeakerAccess", "unused"})
@UsedByGeneratedCode
protected Object injectAnother(BeanResolutionContext resolutionContext, BeanContext context, Object bean) {
DefaultBeanContext defaultContext = (DefaultBeanContext) context;
if (bean == null) {
throw new BeanInstantiationException(resolutionContext, "Bean factory returned null");
}
return defaultContext.inject(resolutionContext, this, bean);
} | [
"@",
"Internal",
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"@",
"UsedByGeneratedCode",
"protected",
"Object",
"injectAnother",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"Object",
"b... | Inject another bean, for example one created via factory.
@param resolutionContext The reslution context
@param context The context
@param bean The bean
@return The bean | [
"Inject",
"another",
"bean",
"for",
"example",
"one",
"created",
"via",
"factory",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L597-L606 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchAsynchException | public void dispatchAsynchException(ProxyQueue proxyQueue, Exception exception)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dispatchAsynchException",
new Object[] { proxyQueue, exception });
// Create a runnable with the data
AsynchExceptionThread thread = new AsynchExceptionThread(proxyQueue, exception);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dispatchAsynchException");
} | java | public void dispatchAsynchException(ProxyQueue proxyQueue, Exception exception)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "dispatchAsynchException",
new Object[] { proxyQueue, exception });
// Create a runnable with the data
AsynchExceptionThread thread = new AsynchExceptionThread(proxyQueue, exception);
dispatchThread(thread);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "dispatchAsynchException");
} | [
"public",
"void",
"dispatchAsynchException",
"(",
"ProxyQueue",
"proxyQueue",
",",
"Exception",
"exception",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"... | Dispatches the exception to the relevant proxy queue.
@param proxyQueue
@param exception | [
"Dispatches",
"the",
"exception",
"to",
"the",
"relevant",
"proxy",
"queue",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L132-L142 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsFrameDialog.java | CmsFrameDialog.showFrameDialog | public static CmsPopup showFrameDialog(
String title,
String dialogUri,
Map<String, String> parameters,
CloseHandler<PopupPanel> closeHandler) {
CmsPopup popup = new CmsPopup(title);
popup.removePadding();
popup.addStyleName(I_CmsLayoutBundle.INSTANCE.contentEditorCss().contentEditor());
popup.setGlassEnabled(true);
CmsIFrame editorFrame = new CmsIFrame(IFRAME_NAME, "");
popup.add(editorFrame);
final FormElement formElement = CmsDomUtil.generateHiddenForm(dialogUri, Method.post, IFRAME_NAME, parameters);
RootPanel.getBodyElement().appendChild(formElement);
exportDialogFunctions(popup);
popup.addCloseHandler(new CloseHandler<PopupPanel>() {
public void onClose(CloseEvent<PopupPanel> event) {
formElement.removeFromParent();
removeExportedFunctions();
}
});
if (closeHandler != null) {
popup.addCloseHandler(closeHandler);
}
popup.center();
formElement.submit();
return popup;
} | java | public static CmsPopup showFrameDialog(
String title,
String dialogUri,
Map<String, String> parameters,
CloseHandler<PopupPanel> closeHandler) {
CmsPopup popup = new CmsPopup(title);
popup.removePadding();
popup.addStyleName(I_CmsLayoutBundle.INSTANCE.contentEditorCss().contentEditor());
popup.setGlassEnabled(true);
CmsIFrame editorFrame = new CmsIFrame(IFRAME_NAME, "");
popup.add(editorFrame);
final FormElement formElement = CmsDomUtil.generateHiddenForm(dialogUri, Method.post, IFRAME_NAME, parameters);
RootPanel.getBodyElement().appendChild(formElement);
exportDialogFunctions(popup);
popup.addCloseHandler(new CloseHandler<PopupPanel>() {
public void onClose(CloseEvent<PopupPanel> event) {
formElement.removeFromParent();
removeExportedFunctions();
}
});
if (closeHandler != null) {
popup.addCloseHandler(closeHandler);
}
popup.center();
formElement.submit();
return popup;
} | [
"public",
"static",
"CmsPopup",
"showFrameDialog",
"(",
"String",
"title",
",",
"String",
"dialogUri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"CloseHandler",
"<",
"PopupPanel",
">",
"closeHandler",
")",
"{",
"CmsPopup",
"popup",
"=",... | Shows an iFrame dialog popup.<p>
@param title the dialog title
@param dialogUri the dialog URI
@param parameters the dialog post parameters
@param closeHandler the dialog close handler
@return the opened popup | [
"Shows",
"an",
"iFrame",
"dialog",
"popup",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsFrameDialog.java#L148-L177 |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java | MavenProjectUtil.getPluginGoalExecution | public static PluginExecution getPluginGoalExecution(MavenProject project, String pluginKey, String goal) throws PluginScenarioException {
Plugin plugin = project.getPlugin(pluginKey);
return getPluginGoalExecution(plugin, goal);
} | java | public static PluginExecution getPluginGoalExecution(MavenProject project, String pluginKey, String goal) throws PluginScenarioException {
Plugin plugin = project.getPlugin(pluginKey);
return getPluginGoalExecution(plugin, goal);
} | [
"public",
"static",
"PluginExecution",
"getPluginGoalExecution",
"(",
"MavenProject",
"project",
",",
"String",
"pluginKey",
",",
"String",
"goal",
")",
"throws",
"PluginScenarioException",
"{",
"Plugin",
"plugin",
"=",
"project",
".",
"getPlugin",
"(",
"pluginKey",
... | Get an execution of a plugin
@param project
@param pluginKey
@param goal
@return the execution object
@throws PluginScenarioException | [
"Get",
"an",
"execution",
"of",
"a",
"plugin"
] | train | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java#L100-L103 |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/AstaReader.java | AstaReader.processCalendar | public void processCalendar(Row calendarRow, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> workPatternAssignmentMap, Map<Integer, List<Row>> exceptionAssignmentMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap)
{
//
// Create the calendar and add the default working hours
//
ProjectCalendar calendar = m_project.addCalendar();
Integer dominantWorkPatternID = calendarRow.getInteger("DOMINANT_WORK_PATTERN");
calendar.setUniqueID(calendarRow.getInteger("CALENDARID"));
processWorkPattern(calendar, dominantWorkPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
calendar.setName(calendarRow.getString("NAMK"));
//
// Add any additional working weeks
//
List<Row> rows = workPatternAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Integer workPatternID = row.getInteger("WORK_PATTERN");
if (!workPatternID.equals(dominantWorkPatternID))
{
ProjectCalendarWeek week = calendar.addWorkWeek();
week.setDateRange(new DateRange(row.getDate("START_DATE"), row.getDate("END_DATE")));
processWorkPattern(week, workPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
}
}
}
//
// Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?
//
rows = exceptionAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Date startDate = row.getDate("STARU_DATE");
Date endDate = row.getDate("ENE_DATE");
calendar.addCalendarException(startDate, endDate);
}
}
m_eventManager.fireCalendarReadEvent(calendar);
} | java | public void processCalendar(Row calendarRow, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> workPatternAssignmentMap, Map<Integer, List<Row>> exceptionAssignmentMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap)
{
//
// Create the calendar and add the default working hours
//
ProjectCalendar calendar = m_project.addCalendar();
Integer dominantWorkPatternID = calendarRow.getInteger("DOMINANT_WORK_PATTERN");
calendar.setUniqueID(calendarRow.getInteger("CALENDARID"));
processWorkPattern(calendar, dominantWorkPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
calendar.setName(calendarRow.getString("NAMK"));
//
// Add any additional working weeks
//
List<Row> rows = workPatternAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Integer workPatternID = row.getInteger("WORK_PATTERN");
if (!workPatternID.equals(dominantWorkPatternID))
{
ProjectCalendarWeek week = calendar.addWorkWeek();
week.setDateRange(new DateRange(row.getDate("START_DATE"), row.getDate("END_DATE")));
processWorkPattern(week, workPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
}
}
}
//
// Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?
//
rows = exceptionAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Date startDate = row.getDate("STARU_DATE");
Date endDate = row.getDate("ENE_DATE");
calendar.addCalendarException(startDate, endDate);
}
}
m_eventManager.fireCalendarReadEvent(calendar);
} | [
"public",
"void",
"processCalendar",
"(",
"Row",
"calendarRow",
",",
"Map",
"<",
"Integer",
",",
"Row",
">",
"workPatternMap",
",",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"workPatternAssignmentMap",
",",
"Map",
"<",
"Integer",
",",
"List... | Creates a ProjectCalendar instance from the Asta data.
@param calendarRow basic calendar data
@param workPatternMap work pattern map
@param workPatternAssignmentMap work pattern assignment map
@param exceptionAssignmentMap exception assignment map
@param timeEntryMap time entry map
@param exceptionTypeMap exception type map | [
"Creates",
"a",
"ProjectCalendar",
"instance",
"from",
"the",
"Asta",
"data",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L1191-L1235 |
Netflix/astyanax | astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftKeyspaceImpl.java | ThriftKeyspaceImpl.toThriftColumnFamilyDefinition | private ThriftColumnFamilyDefinitionImpl toThriftColumnFamilyDefinition(Map<String, Object> options, ColumnFamily columnFamily) {
ThriftColumnFamilyDefinitionImpl def = new ThriftColumnFamilyDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
if (options != null)
internalOptions.putAll(options);
internalOptions.put("keyspace", getKeyspaceName());
if (columnFamily != null) {
internalOptions.put("name", columnFamily.getName());
if (!internalOptions.containsKey("comparator_type"))
internalOptions.put("comparator_type", columnFamily.getColumnSerializer().getComparatorType().getTypeName());
if (!internalOptions.containsKey("key_validation_class"))
internalOptions.put("key_validation_class", columnFamily.getKeySerializer().getComparatorType().getTypeName());
if (columnFamily.getDefaultValueSerializer() != null && !internalOptions.containsKey("default_validation_class"))
internalOptions.put("default_validation_class", columnFamily.getDefaultValueSerializer().getComparatorType().getTypeName());
}
def.setFields(internalOptions);
return def;
} | java | private ThriftColumnFamilyDefinitionImpl toThriftColumnFamilyDefinition(Map<String, Object> options, ColumnFamily columnFamily) {
ThriftColumnFamilyDefinitionImpl def = new ThriftColumnFamilyDefinitionImpl();
Map<String, Object> internalOptions = Maps.newHashMap();
if (options != null)
internalOptions.putAll(options);
internalOptions.put("keyspace", getKeyspaceName());
if (columnFamily != null) {
internalOptions.put("name", columnFamily.getName());
if (!internalOptions.containsKey("comparator_type"))
internalOptions.put("comparator_type", columnFamily.getColumnSerializer().getComparatorType().getTypeName());
if (!internalOptions.containsKey("key_validation_class"))
internalOptions.put("key_validation_class", columnFamily.getKeySerializer().getComparatorType().getTypeName());
if (columnFamily.getDefaultValueSerializer() != null && !internalOptions.containsKey("default_validation_class"))
internalOptions.put("default_validation_class", columnFamily.getDefaultValueSerializer().getComparatorType().getTypeName());
}
def.setFields(internalOptions);
return def;
} | [
"private",
"ThriftColumnFamilyDefinitionImpl",
"toThriftColumnFamilyDefinition",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"ColumnFamily",
"columnFamily",
")",
"{",
"ThriftColumnFamilyDefinitionImpl",
"def",
"=",
"new",
"ThriftColumnFamilyDefinitionImpl",... | Convert a Map of options to an internal thrift column family definition
@param options | [
"Convert",
"a",
"Map",
"of",
"options",
"to",
"an",
"internal",
"thrift",
"column",
"family",
"definition"
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-thrift/src/main/java/com/netflix/astyanax/thrift/ThriftKeyspaceImpl.java#L773-L794 |
Jasig/uPortal | uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java | AuthorizationImpl.getPermissionsForOwner | @Override
public IPermission[] getPermissionsForOwner(String owner, String activity, String target)
throws AuthorizationException {
return primRetrievePermissions(owner, null, activity, target);
} | java | @Override
public IPermission[] getPermissionsForOwner(String owner, String activity, String target)
throws AuthorizationException {
return primRetrievePermissions(owner, null, activity, target);
} | [
"@",
"Override",
"public",
"IPermission",
"[",
"]",
"getPermissionsForOwner",
"(",
"String",
"owner",
",",
"String",
"activity",
",",
"String",
"target",
")",
"throws",
"AuthorizationException",
"{",
"return",
"primRetrievePermissions",
"(",
"owner",
",",
"null",
... | Returns the <code>IPermissions</code> owner has granted for the specified activity and
target. Null parameters will be ignored, that is, all <code>IPermissions</code> matching the
non-null parameters are retrieved.
@return org.apereo.portal.security.IPermission[]
@param owner java.lang.String
@param activity java.lang.String
@param target java.lang.String
@exception AuthorizationException indicates authorization information could not be retrieved. | [
"Returns",
"the",
"<code",
">",
"IPermissions<",
"/",
"code",
">",
"owner",
"has",
"granted",
"for",
"the",
"specified",
"activity",
"and",
"target",
".",
"Null",
"parameters",
"will",
"be",
"ignored",
"that",
"is",
"all",
"<code",
">",
"IPermissions<",
"/",... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java#L774-L778 |
vdurmont/semver4j | src/main/java/com/vdurmont/semver4j/Requirement.java | Requirement.buildStrict | public static Requirement buildStrict(String requirement) {
return build(new Semver(requirement, Semver.SemverType.STRICT));
} | java | public static Requirement buildStrict(String requirement) {
return build(new Semver(requirement, Semver.SemverType.STRICT));
} | [
"public",
"static",
"Requirement",
"buildStrict",
"(",
"String",
"requirement",
")",
"{",
"return",
"build",
"(",
"new",
"Semver",
"(",
"requirement",
",",
"Semver",
".",
"SemverType",
".",
"STRICT",
")",
")",
";",
"}"
] | Builds a strict requirement (will test that the version is equivalent to the requirement)
@param requirement the version of the requirement
@return the generated requirement | [
"Builds",
"a",
"strict",
"requirement",
"(",
"will",
"test",
"that",
"the",
"version",
"is",
"equivalent",
"to",
"the",
"requirement",
")"
] | train | https://github.com/vdurmont/semver4j/blob/3f0266e4985ac29e9da482e04001ed15fad6c3e2/src/main/java/com/vdurmont/semver4j/Requirement.java#L74-L76 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java | JCRAssert.assertNodeTypeExists | public static void assertNodeTypeExists(final Session session, final String nodeTypeName)
throws RepositoryException {
final NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
assertTrue("NodeType " + nodeTypeName + " does not exist", ntm.hasNodeType(nodeTypeName));
} | java | public static void assertNodeTypeExists(final Session session, final String nodeTypeName)
throws RepositoryException {
final NodeTypeManager ntm = session.getWorkspace().getNodeTypeManager();
assertTrue("NodeType " + nodeTypeName + " does not exist", ntm.hasNodeType(nodeTypeName));
} | [
"public",
"static",
"void",
"assertNodeTypeExists",
"(",
"final",
"Session",
"session",
",",
"final",
"String",
"nodeTypeName",
")",
"throws",
"RepositoryException",
"{",
"final",
"NodeTypeManager",
"ntm",
"=",
"session",
".",
"getWorkspace",
"(",
")",
".",
"getNo... | Asserts that a specific node type is registered in the workspace of the session.
@param session
the session to perform the lookup
@param nodeTypeName
the name of the nodetype that is asserted to exist
@throws RepositoryException
if an error occurs | [
"Asserts",
"that",
"a",
"specific",
"node",
"type",
"is",
"registered",
"in",
"the",
"workspace",
"of",
"the",
"session",
"."
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java#L206-L211 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.getImportedKeysUsingShowCreateTable | public ResultSet getImportedKeysUsingShowCreateTable(String catalog, String table)
throws Exception {
if (catalog == null || catalog.isEmpty()) {
throw new IllegalArgumentException("catalog");
}
if (table == null || table.isEmpty()) {
throw new IllegalArgumentException("table");
}
ResultSet rs = connection.createStatement().executeQuery("SHOW CREATE TABLE "
+ MariaDbConnection.quoteIdentifier(catalog) + "." + MariaDbConnection
.quoteIdentifier(table));
if (rs.next()) {
String tableDef = rs.getString(2);
return MariaDbDatabaseMetaData.getImportedKeys(tableDef, table, catalog, connection);
}
throw new SQLException("Fail to retrieve table information using SHOW CREATE TABLE");
} | java | public ResultSet getImportedKeysUsingShowCreateTable(String catalog, String table)
throws Exception {
if (catalog == null || catalog.isEmpty()) {
throw new IllegalArgumentException("catalog");
}
if (table == null || table.isEmpty()) {
throw new IllegalArgumentException("table");
}
ResultSet rs = connection.createStatement().executeQuery("SHOW CREATE TABLE "
+ MariaDbConnection.quoteIdentifier(catalog) + "." + MariaDbConnection
.quoteIdentifier(table));
if (rs.next()) {
String tableDef = rs.getString(2);
return MariaDbDatabaseMetaData.getImportedKeys(tableDef, table, catalog, connection);
}
throw new SQLException("Fail to retrieve table information using SHOW CREATE TABLE");
} | [
"public",
"ResultSet",
"getImportedKeysUsingShowCreateTable",
"(",
"String",
"catalog",
",",
"String",
"table",
")",
"throws",
"Exception",
"{",
"if",
"(",
"catalog",
"==",
"null",
"||",
"catalog",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalAr... | GetImportedKeysUsingShowCreateTable.
@param catalog catalog
@param table table
@return resultset
@throws Exception exception | [
"GetImportedKeysUsingShowCreateTable",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L940-L959 |
JodaOrg/joda-time | src/main/java/org/joda/time/Period.java | Period.withSeconds | public Period withSeconds(int seconds) {
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.SECOND_INDEX, values, seconds);
return new Period(values, getPeriodType());
} | java | public Period withSeconds(int seconds) {
int[] values = getValues(); // cloned
getPeriodType().setIndexedField(this, PeriodType.SECOND_INDEX, values, seconds);
return new Period(values, getPeriodType());
} | [
"public",
"Period",
"withSeconds",
"(",
"int",
"seconds",
")",
"{",
"int",
"[",
"]",
"values",
"=",
"getValues",
"(",
")",
";",
"// cloned",
"getPeriodType",
"(",
")",
".",
"setIndexedField",
"(",
"this",
",",
"PeriodType",
".",
"SECOND_INDEX",
",",
"value... | Returns a new period with the specified number of seconds.
<p>
This period instance is immutable and unaffected by this method call.
@param seconds the amount of seconds to add, may be negative
@return the new period with the increased seconds
@throws UnsupportedOperationException if the field is not supported | [
"Returns",
"a",
"new",
"period",
"with",
"the",
"specified",
"number",
"of",
"seconds",
".",
"<p",
">",
"This",
"period",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L1004-L1008 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java | MapTileCollisionRendererModel.createFunctionDraw | private static void createFunctionDraw(Graphic g, CollisionFormula formula, int tw, int th)
{
for (int x = 0; x < tw; x++)
{
for (int y = 0; y < th; y++)
{
renderCollision(g, formula, th, x, y);
}
}
} | java | private static void createFunctionDraw(Graphic g, CollisionFormula formula, int tw, int th)
{
for (int x = 0; x < tw; x++)
{
for (int y = 0; y < th; y++)
{
renderCollision(g, formula, th, x, y);
}
}
} | [
"private",
"static",
"void",
"createFunctionDraw",
"(",
"Graphic",
"g",
",",
"CollisionFormula",
"formula",
",",
"int",
"tw",
",",
"int",
"th",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"tw",
";",
"x",
"++",
")",
"{",
"for",
"(",
... | Create the function draw to buffer by computing all possible locations.
@param g The graphic buffer.
@param formula The collision formula.
@param tw The tile width.
@param th The tile height. | [
"Create",
"the",
"function",
"draw",
"to",
"buffer",
"by",
"computing",
"all",
"possible",
"locations",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java#L68-L77 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java | Encodings.getWriter | static Writer getWriter(OutputStream output, String encoding)
throws UnsupportedEncodingException
{
for (int i = 0; i < _encodings.length; ++i)
{
if (_encodings[i].name.equalsIgnoreCase(encoding))
{
try
{
String javaName = _encodings[i].javaName;
OutputStreamWriter osw = new OutputStreamWriter(output,javaName);
return osw;
}
catch (java.lang.IllegalArgumentException iae) // java 1.1.8
{
// keep trying
}
catch (UnsupportedEncodingException usee)
{
// keep trying
}
}
}
try
{
return new OutputStreamWriter(output, encoding);
}
catch (java.lang.IllegalArgumentException iae) // java 1.1.8
{
throw new UnsupportedEncodingException(encoding);
}
} | java | static Writer getWriter(OutputStream output, String encoding)
throws UnsupportedEncodingException
{
for (int i = 0; i < _encodings.length; ++i)
{
if (_encodings[i].name.equalsIgnoreCase(encoding))
{
try
{
String javaName = _encodings[i].javaName;
OutputStreamWriter osw = new OutputStreamWriter(output,javaName);
return osw;
}
catch (java.lang.IllegalArgumentException iae) // java 1.1.8
{
// keep trying
}
catch (UnsupportedEncodingException usee)
{
// keep trying
}
}
}
try
{
return new OutputStreamWriter(output, encoding);
}
catch (java.lang.IllegalArgumentException iae) // java 1.1.8
{
throw new UnsupportedEncodingException(encoding);
}
} | [
"static",
"Writer",
"getWriter",
"(",
"OutputStream",
"output",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_encodings",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"... | Returns a writer for the specified encoding based on
an output stream.
<p>
This is not a public API.
@param output The output stream
@param encoding The encoding MIME name, not a Java name for the encoding.
@return A suitable writer
@throws UnsupportedEncodingException There is no convertor
to support this encoding
@xsl.usage internal | [
"Returns",
"a",
"writer",
"for",
"the",
"specified",
"encoding",
"based",
"on",
"an",
"output",
"stream",
".",
"<p",
">",
"This",
"is",
"not",
"a",
"public",
"API",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java#L67-L101 |
Jasig/uPortal | uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/search/PortletRegistryUtil.java | PortletRegistryUtil.matches | public static boolean matches(final String query, final IPortletDefinition portlet) {
/*
* The query parameter is coming in lower case always (even when upper
* or mixed case is entered by the user). We really want a case-
* insensitive comparison here anyway; for safety, we will make certain
* it is insensitive.
*/
final String lcQuery = query.toLowerCase();
final boolean titleMatch = portlet.getTitle().toLowerCase().contains(lcQuery);
final boolean nameMatch = portlet.getName().toLowerCase().contains(lcQuery);
final boolean descMatch =
portlet.getDescription() != null
&& portlet.getDescription().toLowerCase().contains(lcQuery);
final boolean fnameMatch = portlet.getFName().toLowerCase().contains(lcQuery);
return titleMatch || nameMatch || descMatch || fnameMatch;
} | java | public static boolean matches(final String query, final IPortletDefinition portlet) {
/*
* The query parameter is coming in lower case always (even when upper
* or mixed case is entered by the user). We really want a case-
* insensitive comparison here anyway; for safety, we will make certain
* it is insensitive.
*/
final String lcQuery = query.toLowerCase();
final boolean titleMatch = portlet.getTitle().toLowerCase().contains(lcQuery);
final boolean nameMatch = portlet.getName().toLowerCase().contains(lcQuery);
final boolean descMatch =
portlet.getDescription() != null
&& portlet.getDescription().toLowerCase().contains(lcQuery);
final boolean fnameMatch = portlet.getFName().toLowerCase().contains(lcQuery);
return titleMatch || nameMatch || descMatch || fnameMatch;
} | [
"public",
"static",
"boolean",
"matches",
"(",
"final",
"String",
"query",
",",
"final",
"IPortletDefinition",
"portlet",
")",
"{",
"/*\n * The query parameter is coming in lower case always (even when upper\n * or mixed case is entered by the user). We really want a cas... | Performs a case-insensitive comparison of the user's query against several important fields
from the {@link IPortletDefinition}.
@param query The user's search terms, which seem to be forced lower-case
@param portlet Definition of portlet to check name, title, and description
@return true if the query string is contained in the above 3 attributes; otherwise, false | [
"Performs",
"a",
"case",
"-",
"insensitive",
"comparison",
"of",
"the",
"user",
"s",
"query",
"against",
"several",
"important",
"fields",
"from",
"the",
"{",
"@link",
"IPortletDefinition",
"}",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/search/PortletRegistryUtil.java#L63-L78 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/ShakeAroundAPI.java | ShakeAroundAPI.deviceApplyId | public static DeviceApplyIdResult deviceApplyId(String accessToken,
DeviceApplyId deviceApplyId) {
return deviceApplyId(accessToken, JsonUtil.toJSONString(deviceApplyId));
} | java | public static DeviceApplyIdResult deviceApplyId(String accessToken,
DeviceApplyId deviceApplyId) {
return deviceApplyId(accessToken, JsonUtil.toJSONString(deviceApplyId));
} | [
"public",
"static",
"DeviceApplyIdResult",
"deviceApplyId",
"(",
"String",
"accessToken",
",",
"DeviceApplyId",
"deviceApplyId",
")",
"{",
"return",
"deviceApplyId",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"deviceApplyId",
")",
")",
";",
"}"
] | 设备管理-申请设备ID
@param accessToken accessToken
@param deviceApplyId deviceApplyId
@return result | [
"设备管理-申请设备ID"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ShakeAroundAPI.java#L144-L147 |
SimiaCryptus/utilities | java-util/src/main/java/com/simiacryptus/util/lang/StaticResourcePool.java | StaticResourcePool.run | public <U> U run(@javax.annotation.Nonnull final Function<T, U> f, final Predicate<T> filter) {
if (all.isEmpty()) throw new IllegalStateException();
T poll = get(filter);
try {
return f.apply(poll);
} finally {
this.pool.add(poll);
}
} | java | public <U> U run(@javax.annotation.Nonnull final Function<T, U> f, final Predicate<T> filter) {
if (all.isEmpty()) throw new IllegalStateException();
T poll = get(filter);
try {
return f.apply(poll);
} finally {
this.pool.add(poll);
}
} | [
"public",
"<",
"U",
">",
"U",
"run",
"(",
"@",
"javax",
".",
"annotation",
".",
"Nonnull",
"final",
"Function",
"<",
"T",
",",
"U",
">",
"f",
",",
"final",
"Predicate",
"<",
"T",
">",
"filter",
")",
"{",
"if",
"(",
"all",
".",
"isEmpty",
"(",
"... | With u.
@param <U> the type parameter
@param f the f
@param filter
@return the u | [
"With",
"u",
"."
] | train | https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/lang/StaticResourcePool.java#L128-L136 |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/AddCSRFTokenInterceptor.java | AddCSRFTokenInterceptor.call | @Override
public Result call(AddCSRFToken configuration, RequestContext context) throws Exception {
if (csrf.eligibleForCSRF(context.context())
&& (csrf.extractTokenFromRequest(context.context()) == null || configuration.newTokenOnEachRequest())) {
// Generate a new token, it will be stored in the request scope.
String token = csrf.generateToken(context.context());
// Add it to the response
return csrf.addTokenToResult(context.context(), token, context.proceed());
} else {
return context.proceed();
}
} | java | @Override
public Result call(AddCSRFToken configuration, RequestContext context) throws Exception {
if (csrf.eligibleForCSRF(context.context())
&& (csrf.extractTokenFromRequest(context.context()) == null || configuration.newTokenOnEachRequest())) {
// Generate a new token, it will be stored in the request scope.
String token = csrf.generateToken(context.context());
// Add it to the response
return csrf.addTokenToResult(context.context(), token, context.proceed());
} else {
return context.proceed();
}
} | [
"@",
"Override",
"public",
"Result",
"call",
"(",
"AddCSRFToken",
"configuration",
",",
"RequestContext",
"context",
")",
"throws",
"Exception",
"{",
"if",
"(",
"csrf",
".",
"eligibleForCSRF",
"(",
"context",
".",
"context",
"(",
")",
")",
"&&",
"(",
"csrf",... | Injects a CSRF token into the result if the request is eligible.
@param configuration the interception configuration
@param context the interception context
@return the result with the token if a token was added
@throws Exception if anything bad happen | [
"Injects",
"a",
"CSRF",
"token",
"into",
"the",
"result",
"if",
"the",
"request",
"is",
"eligible",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/AddCSRFTokenInterceptor.java#L50-L61 |
pravega/pravega | common/src/main/java/io/pravega/common/LoggerHelpers.java | LoggerHelpers.traceLeave | public static void traceLeave(Logger log, String method, long traceEnterId, Object... args) {
if (!log.isTraceEnabled()) {
return;
}
if (args.length == 0) {
log.trace("LEAVE {}@{} (elapsed={}us).", method, traceEnterId, ELAPSED_MICRO.apply(traceEnterId));
} else {
log.trace("LEAVE {}@{} {} (elapsed={}us).", method, traceEnterId, args, ELAPSED_MICRO.apply(traceEnterId));
}
} | java | public static void traceLeave(Logger log, String method, long traceEnterId, Object... args) {
if (!log.isTraceEnabled()) {
return;
}
if (args.length == 0) {
log.trace("LEAVE {}@{} (elapsed={}us).", method, traceEnterId, ELAPSED_MICRO.apply(traceEnterId));
} else {
log.trace("LEAVE {}@{} {} (elapsed={}us).", method, traceEnterId, args, ELAPSED_MICRO.apply(traceEnterId));
}
} | [
"public",
"static",
"void",
"traceLeave",
"(",
"Logger",
"log",
",",
"String",
"method",
",",
"long",
"traceEnterId",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
... | Traces the fact that a method has exited normally.
@param log The Logger to log to.
@param method The name of the method.
@param traceEnterId The correlation Id obtained from a traceEnter call.
@param args Additional arguments to log. | [
"Traces",
"the",
"fact",
"that",
"a",
"method",
"has",
"exited",
"normally",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/LoggerHelpers.java#L80-L90 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/LevelRipConverter.java | LevelRipConverter.start | public static int start(Media levelrip, MapTile map)
{
return start(levelrip, map, null, null);
} | java | public static int start(Media levelrip, MapTile map)
{
return start(levelrip, map, null, null);
} | [
"public",
"static",
"int",
"start",
"(",
"Media",
"levelrip",
",",
"MapTile",
"map",
")",
"{",
"return",
"start",
"(",
"levelrip",
",",
"map",
",",
"null",
",",
"null",
")",
";",
"}"
] | Run the converter.
@param levelrip The file containing the levelrip as an image.
@param map The destination map reference.
@return The total number of not found tiles.
@throws LionEngineException If media is <code>null</code> or image cannot be read. | [
"Run",
"the",
"converter",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/LevelRipConverter.java#L44-L47 |
operasoftware/operaprestodriver | src/com/opera/core/systems/preferences/OperaScopePreferences.java | OperaScopePreferences.updatePreferenceCache | private void updatePreferenceCache() {
for (PrefsProtos.Pref pref : service.listPrefs(true, null)) {
preferences.add(new ScopePreference(this, pref));
}
} | java | private void updatePreferenceCache() {
for (PrefsProtos.Pref pref : service.listPrefs(true, null)) {
preferences.add(new ScopePreference(this, pref));
}
} | [
"private",
"void",
"updatePreferenceCache",
"(",
")",
"{",
"for",
"(",
"PrefsProtos",
".",
"Pref",
"pref",
":",
"service",
".",
"listPrefs",
"(",
"true",
",",
"null",
")",
")",
"{",
"preferences",
".",
"add",
"(",
"new",
"ScopePreference",
"(",
"this",
"... | Invalidates the preferences cache stored locally in the driver and requests a new list of all
preferences from Opera. This should typically only be called the first time {@link
OperaScopePreferences} is instantiated.
Following that, whenever a preference is updated the driver will be responsible for keeping the
local cache up-to-date. The drawback of this is that if the user manually updates a preference
in Opera, this will not be reflected when {@link ScopePreference#getValue()} is run. We
circumvent that issue by fetching the value individually.
The reason for this is that we cannot fetch a single message "Pref" through Scope, but only
individual values. | [
"Invalidates",
"the",
"preferences",
"cache",
"stored",
"locally",
"in",
"the",
"driver",
"and",
"requests",
"a",
"new",
"list",
"of",
"all",
"preferences",
"from",
"Opera",
".",
"This",
"should",
"typically",
"only",
"be",
"called",
"the",
"first",
"time",
... | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/preferences/OperaScopePreferences.java#L121-L125 |
samskivert/pythagoras | src/main/java/pythagoras/d/QuadCurve.java | QuadCurve.setCurve | public void setCurve (XY[] points, int offset) {
setCurve(points[offset + 0].x(), points[offset + 0].y(),
points[offset + 1].x(), points[offset + 1].y(),
points[offset + 2].x(), points[offset + 2].y());
} | java | public void setCurve (XY[] points, int offset) {
setCurve(points[offset + 0].x(), points[offset + 0].y(),
points[offset + 1].x(), points[offset + 1].y(),
points[offset + 2].x(), points[offset + 2].y());
} | [
"public",
"void",
"setCurve",
"(",
"XY",
"[",
"]",
"points",
",",
"int",
"offset",
")",
"{",
"setCurve",
"(",
"points",
"[",
"offset",
"+",
"0",
"]",
".",
"x",
"(",
")",
",",
"points",
"[",
"offset",
"+",
"0",
"]",
".",
"y",
"(",
")",
",",
"p... | Configures the start, control, and end points for this curve, using the values at the
specified offset in the {@code points} array. | [
"Configures",
"the",
"start",
"control",
"and",
"end",
"points",
"for",
"this",
"curve",
"using",
"the",
"values",
"at",
"the",
"specified",
"offset",
"in",
"the",
"{"
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/QuadCurve.java#L80-L84 |
EdwardRaff/JSAT | JSAT/src/jsat/linear/vectorcollection/lsh/RandomProjectionLSH.java | RandomProjectionLSH.projectVector | private void projectVector(Vec vec, int slot, int[] projLocation, Vec projected)
{
randProjMatrix.multiply(vec, 1.0, projected);
int pos = 0;
int bitsLeft = Integer.SIZE;
int curVal = 0;
while(pos < slotsPerEntry)
{
while(bitsLeft > 0)
{
curVal <<= 1;
if(projected.get(pos*Integer.SIZE+(Integer.SIZE-bitsLeft)) >= 0)
curVal |= 1;
bitsLeft--;
}
projLocation[slot+pos] = curVal;
curVal = 0;
bitsLeft = Integer.SIZE;
pos++;
}
} | java | private void projectVector(Vec vec, int slot, int[] projLocation, Vec projected)
{
randProjMatrix.multiply(vec, 1.0, projected);
int pos = 0;
int bitsLeft = Integer.SIZE;
int curVal = 0;
while(pos < slotsPerEntry)
{
while(bitsLeft > 0)
{
curVal <<= 1;
if(projected.get(pos*Integer.SIZE+(Integer.SIZE-bitsLeft)) >= 0)
curVal |= 1;
bitsLeft--;
}
projLocation[slot+pos] = curVal;
curVal = 0;
bitsLeft = Integer.SIZE;
pos++;
}
} | [
"private",
"void",
"projectVector",
"(",
"Vec",
"vec",
",",
"int",
"slot",
",",
"int",
"[",
"]",
"projLocation",
",",
"Vec",
"projected",
")",
"{",
"randProjMatrix",
".",
"multiply",
"(",
"vec",
",",
"1.0",
",",
"projected",
")",
";",
"int",
"pos",
"="... | Projects a given vector into the array of integers.
@param vecs the vector to project
@param slot the index into the array to start placing the bit values
@param projected a vector full of zeros of the same length as
{@link #getSignatureBitLength() } to use as a temp space. | [
"Projects",
"a",
"given",
"vector",
"into",
"the",
"array",
"of",
"integers",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/vectorcollection/lsh/RandomProjectionLSH.java#L223-L244 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java | CommercePriceListPersistenceImpl.findByUUID_G | @Override
public CommercePriceList findByUUID_G(String uuid, long groupId)
throws NoSuchPriceListException {
CommercePriceList commercePriceList = fetchByUUID_G(uuid, groupId);
if (commercePriceList == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchPriceListException(msg.toString());
}
return commercePriceList;
} | java | @Override
public CommercePriceList findByUUID_G(String uuid, long groupId)
throws NoSuchPriceListException {
CommercePriceList commercePriceList = fetchByUUID_G(uuid, groupId);
if (commercePriceList == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchPriceListException(msg.toString());
}
return commercePriceList;
} | [
"@",
"Override",
"public",
"CommercePriceList",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchPriceListException",
"{",
"CommercePriceList",
"commercePriceList",
"=",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"if"... | Returns the commerce price list where uuid = ? and groupId = ? or throws a {@link NoSuchPriceListException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce price list
@throws NoSuchPriceListException if a matching commerce price list could not be found | [
"Returns",
"the",
"commerce",
"price",
"list",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchPriceListException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L672-L698 |
google/closure-compiler | src/com/google/javascript/jscomp/J2clChecksPass.java | J2clChecksPass.checkReferenceEquality | private void checkReferenceEquality(Node n, String typeName, String fileName) {
if (n.getToken() == Token.SHEQ
|| n.getToken() == Token.EQ
|| n.getToken() == Token.SHNE
|| n.getToken() == Token.NE) {
JSType firstJsType = n.getFirstChild().getJSType();
JSType lastJsType = n.getLastChild().getJSType();
boolean hasType = isType(firstJsType, fileName) || isType(lastJsType, fileName);
boolean hasNullType = isNullType(firstJsType) || isNullType(lastJsType);
if (hasType && !hasNullType) {
compiler.report(JSError.make(n, J2CL_REFERENCE_EQUALITY, typeName));
}
}
} | java | private void checkReferenceEquality(Node n, String typeName, String fileName) {
if (n.getToken() == Token.SHEQ
|| n.getToken() == Token.EQ
|| n.getToken() == Token.SHNE
|| n.getToken() == Token.NE) {
JSType firstJsType = n.getFirstChild().getJSType();
JSType lastJsType = n.getLastChild().getJSType();
boolean hasType = isType(firstJsType, fileName) || isType(lastJsType, fileName);
boolean hasNullType = isNullType(firstJsType) || isNullType(lastJsType);
if (hasType && !hasNullType) {
compiler.report(JSError.make(n, J2CL_REFERENCE_EQUALITY, typeName));
}
}
} | [
"private",
"void",
"checkReferenceEquality",
"(",
"Node",
"n",
",",
"String",
"typeName",
",",
"String",
"fileName",
")",
"{",
"if",
"(",
"n",
".",
"getToken",
"(",
")",
"==",
"Token",
".",
"SHEQ",
"||",
"n",
".",
"getToken",
"(",
")",
"==",
"Token",
... | Reports an error if the node is a reference equality check of the specified type. | [
"Reports",
"an",
"error",
"if",
"the",
"node",
"is",
"a",
"reference",
"equality",
"check",
"of",
"the",
"specified",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/J2clChecksPass.java#L56-L69 |
jbundle/jbundle | base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XButtonBox.java | XButtonBox.printDisplayControl | public void printDisplayControl(PrintWriter out, String strFieldDesc, String strFieldName, String strFieldType)
{
if (this.getScreenField().getConverter() != null)
{
this.printInputControl(out, strFieldDesc, strFieldName, null, null, null, "button", strFieldType); // Button that does nothing?
}
else if (this.getScreenField().getParentScreen() instanceof GridScreen)
{ // These are command buttons such as "Form" or "Detail"
this.printInputControl(out, null, strFieldName, null, null, null, "button", strFieldType); // Button that does nothing?
}
} | java | public void printDisplayControl(PrintWriter out, String strFieldDesc, String strFieldName, String strFieldType)
{
if (this.getScreenField().getConverter() != null)
{
this.printInputControl(out, strFieldDesc, strFieldName, null, null, null, "button", strFieldType); // Button that does nothing?
}
else if (this.getScreenField().getParentScreen() instanceof GridScreen)
{ // These are command buttons such as "Form" or "Detail"
this.printInputControl(out, null, strFieldName, null, null, null, "button", strFieldType); // Button that does nothing?
}
} | [
"public",
"void",
"printDisplayControl",
"(",
"PrintWriter",
"out",
",",
"String",
"strFieldDesc",
",",
"String",
"strFieldName",
",",
"String",
"strFieldType",
")",
"{",
"if",
"(",
"this",
".",
"getScreenField",
"(",
")",
".",
"getConverter",
"(",
")",
"!=",
... | Get the current string value in HTML.
@exception DBException File exception. | [
"Get",
"the",
"current",
"string",
"value",
"in",
"HTML",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XButtonBox.java#L200-L210 |
Sciss/abc4j | abc/src/main/java/abc/ui/swing/JTune.java | JTune.newControl | static protected Point2D newControl (Point2D start, Point2D ctrl, Point2D end) {
Point2D.Double newCtrl = new Point2D.Double();
newCtrl.x = 2 * ctrl.getX() - (start.getX() + end.getX()) / 2;
newCtrl.y = 2 * ctrl.getY() - (start.getY() + end.getY()) / 2;
return newCtrl;
} | java | static protected Point2D newControl (Point2D start, Point2D ctrl, Point2D end) {
Point2D.Double newCtrl = new Point2D.Double();
newCtrl.x = 2 * ctrl.getX() - (start.getX() + end.getX()) / 2;
newCtrl.y = 2 * ctrl.getY() - (start.getY() + end.getY()) / 2;
return newCtrl;
} | [
"static",
"protected",
"Point2D",
"newControl",
"(",
"Point2D",
"start",
",",
"Point2D",
"ctrl",
",",
"Point2D",
"end",
")",
"{",
"Point2D",
".",
"Double",
"newCtrl",
"=",
"new",
"Point2D",
".",
"Double",
"(",
")",
";",
"newCtrl",
".",
"x",
"=",
"2",
"... | implementation found at
http://forum.java.sun.com/thread.jspa?threadID=609888&messageID=3362448
This enables the bezier curve to be tangent to the control point. | [
"implementation",
"found",
"at",
"http",
":",
"//",
"forum",
".",
"java",
".",
"sun",
".",
"com",
"/",
"thread",
".",
"jspa?threadID",
"=",
"609888&messageID",
"=",
"3362448",
"This",
"enables",
"the",
"bezier",
"curve",
"to",
"be",
"tangent",
"to",
"the",... | train | https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JTune.java#L1630-L1635 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ResourceBundle.java | ResourceBundle.getBundle | public static ResourceBundle getBundle(String bundleName, Locale locale) {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
if (classLoader == null) {
classLoader = getLoader();
}
return getBundle(bundleName, locale, classLoader);
} | java | public static ResourceBundle getBundle(String bundleName, Locale locale) {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
if (classLoader == null) {
classLoader = getLoader();
}
return getBundle(bundleName, locale, classLoader);
} | [
"public",
"static",
"ResourceBundle",
"getBundle",
"(",
"String",
"bundleName",
",",
"Locale",
"locale",
")",
"{",
"ClassLoader",
"classLoader",
"=",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
";",
"if",
"(",
"classLoader",
"==",
"null",
")",
"{",
"... | Finds the named {@code ResourceBundle} for the specified {@code Locale} and the caller
{@code ClassLoader}.
@param bundleName
the name of the {@code ResourceBundle}.
@param locale
the {@code Locale}.
@return the requested resource bundle.
@throws MissingResourceException
if the resource bundle cannot be found. | [
"Finds",
"the",
"named",
"{",
"@code",
"ResourceBundle",
"}",
"for",
"the",
"specified",
"{",
"@code",
"Locale",
"}",
"and",
"the",
"caller",
"{",
"@code",
"ClassLoader",
"}",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ResourceBundle.java#L154-L160 |
facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java | NamespaceNotifierClient.removeWatch | public void removeWatch(String path, EventType watchType)
throws NotConnectedToServerException, InterruptedException,
WatchNotPlacedException {
NamespaceEvent event = new NamespaceEvent(path, watchType.getByteValue());
NamespaceEventKey eventKey = new NamespaceEventKey(path, watchType);
Object connectionLock = connectionManager.getConnectionLock();
ServerHandler.Client server;
LOG.info(listeningPort + ": removeWatch: Removing watch from " +
NotifierUtils.asString(eventKey) + " ...");
if (!watchedEvents.containsKey(eventKey)) {
LOG.warn(listeningPort + ": removeWatch: watch doesen't exist at " +
NotifierUtils.asString(eventKey) + " ...");
throw new WatchNotPlacedException();
}
synchronized (connectionLock) {
connectionManager.waitForTransparentConnect();
server = connectionManager.getServer();
try {
server.unsubscribe(connectionManager.getId(), event);
} catch (InvalidClientIdException e1) {
LOG.warn(listeningPort + ": removeWatch: server deleted us", e1);
connectionManager.failConnection(true);
} catch (ClientNotSubscribedException e2) {
LOG.error(listeningPort + ": removeWatch: event not subscribed", e2);
} catch (TException e3) {
LOG.error(listeningPort + ": removeWatch: failed communicating to" +
" server", e3);
connectionManager.failConnection(true);
}
watchedEvents.remove(eventKey);
}
if (LOG.isDebugEnabled()) {
LOG.debug(listeningPort + ": Unsubscribed from " +
NotifierUtils.asString(eventKey));
}
} | java | public void removeWatch(String path, EventType watchType)
throws NotConnectedToServerException, InterruptedException,
WatchNotPlacedException {
NamespaceEvent event = new NamespaceEvent(path, watchType.getByteValue());
NamespaceEventKey eventKey = new NamespaceEventKey(path, watchType);
Object connectionLock = connectionManager.getConnectionLock();
ServerHandler.Client server;
LOG.info(listeningPort + ": removeWatch: Removing watch from " +
NotifierUtils.asString(eventKey) + " ...");
if (!watchedEvents.containsKey(eventKey)) {
LOG.warn(listeningPort + ": removeWatch: watch doesen't exist at " +
NotifierUtils.asString(eventKey) + " ...");
throw new WatchNotPlacedException();
}
synchronized (connectionLock) {
connectionManager.waitForTransparentConnect();
server = connectionManager.getServer();
try {
server.unsubscribe(connectionManager.getId(), event);
} catch (InvalidClientIdException e1) {
LOG.warn(listeningPort + ": removeWatch: server deleted us", e1);
connectionManager.failConnection(true);
} catch (ClientNotSubscribedException e2) {
LOG.error(listeningPort + ": removeWatch: event not subscribed", e2);
} catch (TException e3) {
LOG.error(listeningPort + ": removeWatch: failed communicating to" +
" server", e3);
connectionManager.failConnection(true);
}
watchedEvents.remove(eventKey);
}
if (LOG.isDebugEnabled()) {
LOG.debug(listeningPort + ": Unsubscribed from " +
NotifierUtils.asString(eventKey));
}
} | [
"public",
"void",
"removeWatch",
"(",
"String",
"path",
",",
"EventType",
"watchType",
")",
"throws",
"NotConnectedToServerException",
",",
"InterruptedException",
",",
"WatchNotPlacedException",
"{",
"NamespaceEvent",
"event",
"=",
"new",
"NamespaceEvent",
"(",
"path",... | Removes a previously placed watch for a particular event type from the
given path. If the watch is not actually present at that path before
calling the method, nothing will happen.
To remove the watch for all event types at this path, use
{@link #removeAllWatches(String)}.
@param path the path from which the watch is removed. For the FILE_ADDED event
type, this represents the path of the directory under which the
file will be created.
@param watchType the type of the event for which don't want to receive
notifications from now on.
@return true if successfully removed watch. false if the watch wasn't
placed before calling this method.
@throws WatchNotPlacedException if the watch wasn't placed before calling
this method.
@throws NotConnectedToServerException when the Watcher.connectionSuccessful
method was not called (the connection to the server isn't
established yet) at start-up or after a Watcher.connectionFailed
call. The Watcher.connectionFailed could of happened anytime
since the last Watcher.connectionSuccessfull call until this
method returns. | [
"Removes",
"a",
"previously",
"placed",
"watch",
"for",
"a",
"particular",
"event",
"type",
"from",
"the",
"given",
"path",
".",
"If",
"the",
"watch",
"is",
"not",
"actually",
"present",
"at",
"that",
"path",
"before",
"calling",
"the",
"method",
"nothing",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NamespaceNotifierClient.java#L356-L396 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/WebhooksInner.java | WebhooksInner.createOrUpdate | public WebhookInner createOrUpdate(String resourceGroupName, String automationAccountName, String webhookName, WebhookCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, webhookName, parameters).toBlocking().single().body();
} | java | public WebhookInner createOrUpdate(String resourceGroupName, String automationAccountName, String webhookName, WebhookCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, webhookName, parameters).toBlocking().single().body();
} | [
"public",
"WebhookInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"webhookName",
",",
"WebhookCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"reso... | Create the webhook identified by webhook name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param webhookName The webhook name.
@param parameters The create or update parameters for webhook.
@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 WebhookInner object if successful. | [
"Create",
"the",
"webhook",
"identified",
"by",
"webhook",
"name",
"."
] | 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/WebhooksInner.java#L375-L377 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java | PersonGroupsImpl.updateAsync | public Observable<Void> updateAsync(String personGroupId, UpdatePersonGroupsOptionalParameter updateOptionalParameter) {
return updateWithServiceResponseAsync(personGroupId, updateOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> updateAsync(String personGroupId, UpdatePersonGroupsOptionalParameter updateOptionalParameter) {
return updateWithServiceResponseAsync(personGroupId, updateOptionalParameter).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"updateAsync",
"(",
"String",
"personGroupId",
",",
"UpdatePersonGroupsOptionalParameter",
"updateOptionalParameter",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"personGroupId",
",",
"updateOptionalParameter",
")",
"... | Update an existing person group's display name and userData. The properties which does not appear in request body will not be updated.
@param personGroupId Id referencing a particular person group.
@param updateOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Update",
"an",
"existing",
"person",
"group",
"s",
"display",
"name",
"and",
"userData",
".",
"The",
"properties",
"which",
"does",
"not",
"appear",
"in",
"request",
"body",
"will",
"not",
"be",
"updated",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupsImpl.java#L448-L455 |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/parsing/ParserUtil.java | ParserUtil.parseHeadersLine | public static SubstitutedLine parseHeadersLine(String commandLine, final CommandLineParser.CallbackHandler handler, final CommandContext ctx) throws CommandFormatException {
if (commandLine == null) {
return null;
}
final ParsingStateCallbackHandler callbackHandler = getCallbackHandler(handler);
return StateParser.parseLine(commandLine, callbackHandler, HeaderListState.INSTANCE, ctx);
} | java | public static SubstitutedLine parseHeadersLine(String commandLine, final CommandLineParser.CallbackHandler handler, final CommandContext ctx) throws CommandFormatException {
if (commandLine == null) {
return null;
}
final ParsingStateCallbackHandler callbackHandler = getCallbackHandler(handler);
return StateParser.parseLine(commandLine, callbackHandler, HeaderListState.INSTANCE, ctx);
} | [
"public",
"static",
"SubstitutedLine",
"parseHeadersLine",
"(",
"String",
"commandLine",
",",
"final",
"CommandLineParser",
".",
"CallbackHandler",
"handler",
",",
"final",
"CommandContext",
"ctx",
")",
"throws",
"CommandFormatException",
"{",
"if",
"(",
"commandLine",
... | Returns the string which was actually parsed with all the substitutions
performed | [
"Returns",
"the",
"string",
"which",
"was",
"actually",
"parsed",
"with",
"all",
"the",
"substitutions",
"performed"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/parsing/ParserUtil.java#L159-L165 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java | CompositeTextWatcher.enableWatcher | public void enableWatcher(TextWatcher watcher, boolean enabled){
int index = mWatchers.indexOfValue(watcher);
if(index >= 0){
int key = mWatchers.keyAt(index);
mEnabledKeys.put(key, enabled);
}
} | java | public void enableWatcher(TextWatcher watcher, boolean enabled){
int index = mWatchers.indexOfValue(watcher);
if(index >= 0){
int key = mWatchers.keyAt(index);
mEnabledKeys.put(key, enabled);
}
} | [
"public",
"void",
"enableWatcher",
"(",
"TextWatcher",
"watcher",
",",
"boolean",
"enabled",
")",
"{",
"int",
"index",
"=",
"mWatchers",
".",
"indexOfValue",
"(",
"watcher",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"int",
"key",
"=",
"mWatchers... | Enable or Disable a text watcher by reference
@param watcher The {@link TextWatcher} to enable or disable
@param enabled whether or not to enable or disable | [
"Enable",
"or",
"Disable",
"a",
"text",
"watcher",
"by",
"reference"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/CompositeTextWatcher.java#L130-L136 |
threerings/narya | core/src/main/java/com/threerings/nio/PolicyServer.java | PolicyServer.init | public void init (int socketPolicyPort)
{
_acceptor =
new ServerSocketChannelAcceptor(null, new int[] { socketPolicyPort }, this);
// build the XML once and for all
StringBuilder policy = new StringBuilder()
.append("<?xml version=\"1.0\"?>\n")
.append("<cross-domain-policy>\n");
// if we're running on 843, serve a master policy file
if (socketPolicyPort == MASTER_PORT) {
policy.append(" <site-control permitted-cross-domain-policies=\"master-only\"/>\n");
}
policy.append(" <allow-access-from domain=\"*\" to-ports=\"*\"/>\n");
policy.append("</cross-domain-policy>\n\n");
try {
_policy = policy.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 encoding missing; this vm is broken", e);
}
start();
} | java | public void init (int socketPolicyPort)
{
_acceptor =
new ServerSocketChannelAcceptor(null, new int[] { socketPolicyPort }, this);
// build the XML once and for all
StringBuilder policy = new StringBuilder()
.append("<?xml version=\"1.0\"?>\n")
.append("<cross-domain-policy>\n");
// if we're running on 843, serve a master policy file
if (socketPolicyPort == MASTER_PORT) {
policy.append(" <site-control permitted-cross-domain-policies=\"master-only\"/>\n");
}
policy.append(" <allow-access-from domain=\"*\" to-ports=\"*\"/>\n");
policy.append("</cross-domain-policy>\n\n");
try {
_policy = policy.toString().getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException("UTF-8 encoding missing; this vm is broken", e);
}
start();
} | [
"public",
"void",
"init",
"(",
"int",
"socketPolicyPort",
")",
"{",
"_acceptor",
"=",
"new",
"ServerSocketChannelAcceptor",
"(",
"null",
",",
"new",
"int",
"[",
"]",
"{",
"socketPolicyPort",
"}",
",",
"this",
")",
";",
"// build the XML once and for all",
"Strin... | Accepts xmlsocket requests on <code>socketPolicyPort</code> and responds any host may
connect to any port on this host. | [
"Accepts",
"xmlsocket",
"requests",
"on",
"<code",
">",
"socketPolicyPort<",
"/",
"code",
">",
"and",
"responds",
"any",
"host",
"may",
"connect",
"to",
"any",
"port",
"on",
"this",
"host",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/nio/PolicyServer.java#L80-L103 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveDataset.java | HiveDataset.resolveTemplate | public static String resolveTemplate(String rawString, Table table) {
if (StringUtils.isBlank(rawString)) {
return rawString;
}
return StringUtils.replaceEach(rawString, new String[] { DATABASE_TOKEN, TABLE_TOKEN }, new String[] { table.getDbName(), table.getTableName() });
} | java | public static String resolveTemplate(String rawString, Table table) {
if (StringUtils.isBlank(rawString)) {
return rawString;
}
return StringUtils.replaceEach(rawString, new String[] { DATABASE_TOKEN, TABLE_TOKEN }, new String[] { table.getDbName(), table.getTableName() });
} | [
"public",
"static",
"String",
"resolveTemplate",
"(",
"String",
"rawString",
",",
"Table",
"table",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"rawString",
")",
")",
"{",
"return",
"rawString",
";",
"}",
"return",
"StringUtils",
".",
"replaceEa... | Resolve {@value #DATABASE_TOKEN} and {@value #TABLE_TOKEN} in <code>rawString</code> to {@link Table#getDbName()}
and {@link Table#getTableName()} | [
"Resolve",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveDataset.java#L185-L190 |
Azure/azure-sdk-for-java | containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java | ManagedClustersInner.resetAADProfile | public void resetAADProfile(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) {
resetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body();
} | java | public void resetAADProfile(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) {
resetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body();
} | [
"public",
"void",
"resetAADProfile",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ManagedClusterAADProfile",
"parameters",
")",
"{",
"resetAADProfileWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"parameters",
")",... | Reset AAD Profile of a managed cluster.
Update the AAD Profile for a managed cluster.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the managed cluster resource.
@param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Reset",
"AAD",
"Profile",
"of",
"a",
"managed",
"cluster",
".",
"Update",
"the",
"AAD",
"Profile",
"for",
"a",
"managed",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ManagedClustersInner.java#L1675-L1677 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java | ExpressRouteCircuitsInner.beginListArpTableAsync | public Observable<ExpressRouteCircuitsArpTableListResultInner> beginListArpTableAsync(String resourceGroupName, String circuitName, String peeringName, String devicePath) {
return beginListArpTableWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCircuitsArpTableListResultInner>, ExpressRouteCircuitsArpTableListResultInner>() {
@Override
public ExpressRouteCircuitsArpTableListResultInner call(ServiceResponse<ExpressRouteCircuitsArpTableListResultInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCircuitsArpTableListResultInner> beginListArpTableAsync(String resourceGroupName, String circuitName, String peeringName, String devicePath) {
return beginListArpTableWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, devicePath).map(new Func1<ServiceResponse<ExpressRouteCircuitsArpTableListResultInner>, ExpressRouteCircuitsArpTableListResultInner>() {
@Override
public ExpressRouteCircuitsArpTableListResultInner call(ServiceResponse<ExpressRouteCircuitsArpTableListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCircuitsArpTableListResultInner",
">",
"beginListArpTableAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"peeringName",
",",
"String",
"devicePath",
")",
"{",
"return",
"beginListArpTableWith... | Gets the currently advertised ARP table associated with the express route circuit in a resource group.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param devicePath The path of the device.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCircuitsArpTableListResultInner object | [
"Gets",
"the",
"currently",
"advertised",
"ARP",
"table",
"associated",
"with",
"the",
"express",
"route",
"circuit",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L988-L995 |
calimero-project/calimero-core | src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java | TranslatorTypes.createTranslator | public static DPTXlator createTranslator(final DPT dpt, final byte... data) throws KNXException {
final DPTXlator t = createTranslator(dpt);
if (data.length > 0)
t.setData(data);
return t;
} | java | public static DPTXlator createTranslator(final DPT dpt, final byte... data) throws KNXException {
final DPTXlator t = createTranslator(dpt);
if (data.length > 0)
t.setData(data);
return t;
} | [
"public",
"static",
"DPTXlator",
"createTranslator",
"(",
"final",
"DPT",
"dpt",
",",
"final",
"byte",
"...",
"data",
")",
"throws",
"KNXException",
"{",
"final",
"DPTXlator",
"t",
"=",
"createTranslator",
"(",
"dpt",
")",
";",
"if",
"(",
"data",
".",
"len... | Creates a DPT translator for the given datapoint type.
<p>
The translation behavior of a DPT translator instance is uniquely defined by the supplied datapoint type.
<p>
If translator creation according {@link #createTranslator(int, String)} fails, all available main types are
enumerated to find an appropriate translator.
@param dpt datapoint type selecting a particular kind of value translation
@param data (optional) KNX datapoint data to set in the created translator for translation
@return the new {@link DPTXlator} object
@throws KNXException if no matching DPT translator is available or creation failed | [
"Creates",
"a",
"DPT",
"translator",
"for",
"the",
"given",
"datapoint",
"type",
".",
"<p",
">",
"The",
"translation",
"behavior",
"of",
"a",
"DPT",
"translator",
"instance",
"is",
"uniquely",
"defined",
"by",
"the",
"supplied",
"datapoint",
"type",
".",
"<p... | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java#L618-L623 |
dnsjava/dnsjava | org/xbill/DNS/Record.java | Record.fromString | public static Record
fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
Record rec;
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
TTL.check(ttl);
Tokenizer.Token t = st.get();
if (t.type == Tokenizer.IDENTIFIER && t.value.equals("\\#")) {
int length = st.getUInt16();
byte [] data = st.getHex();
if (data == null) {
data = new byte[0];
}
if (length != data.length)
throw st.exception("invalid unknown RR encoding: " +
"length mismatch");
DNSInput in = new DNSInput(data);
return newRecord(name, type, dclass, ttl, length, in);
}
st.unget();
rec = getEmptyRecord(name, type, dclass, ttl, true);
rec.rdataFromString(st, origin);
t = st.get();
if (t.type != Tokenizer.EOL && t.type != Tokenizer.EOF) {
throw st.exception("unexpected tokens at end of record");
}
return rec;
} | java | public static Record
fromString(Name name, int type, int dclass, long ttl, Tokenizer st, Name origin)
throws IOException
{
Record rec;
if (!name.isAbsolute())
throw new RelativeNameException(name);
Type.check(type);
DClass.check(dclass);
TTL.check(ttl);
Tokenizer.Token t = st.get();
if (t.type == Tokenizer.IDENTIFIER && t.value.equals("\\#")) {
int length = st.getUInt16();
byte [] data = st.getHex();
if (data == null) {
data = new byte[0];
}
if (length != data.length)
throw st.exception("invalid unknown RR encoding: " +
"length mismatch");
DNSInput in = new DNSInput(data);
return newRecord(name, type, dclass, ttl, length, in);
}
st.unget();
rec = getEmptyRecord(name, type, dclass, ttl, true);
rec.rdataFromString(st, origin);
t = st.get();
if (t.type != Tokenizer.EOL && t.type != Tokenizer.EOF) {
throw st.exception("unexpected tokens at end of record");
}
return rec;
} | [
"public",
"static",
"Record",
"fromString",
"(",
"Name",
"name",
",",
"int",
"type",
",",
"int",
"dclass",
",",
"long",
"ttl",
",",
"Tokenizer",
"st",
",",
"Name",
"origin",
")",
"throws",
"IOException",
"{",
"Record",
"rec",
";",
"if",
"(",
"!",
"name... | Builds a new Record from its textual representation
@param name The owner name of the record.
@param type The record's type.
@param dclass The record's class.
@param ttl The record's time to live.
@param st A tokenizer containing the textual representation of the rdata.
@param origin The default origin to be appended to relative domain names.
@return The new record
@throws IOException The text format was invalid. | [
"Builds",
"a",
"new",
"Record",
"from",
"its",
"textual",
"representation"
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Record.java#L445-L478 |
jqm4gwt/jqm4gwt | library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java | JQMRadioset.addRadio | public JQMRadio addRadio(String value, String text) {
JQMRadio radio = new JQMRadio(value, text);
addRadio(radio);
return radio;
} | java | public JQMRadio addRadio(String value, String text) {
JQMRadio radio = new JQMRadio(value, text);
addRadio(radio);
return radio;
} | [
"public",
"JQMRadio",
"addRadio",
"(",
"String",
"value",
",",
"String",
"text",
")",
"{",
"JQMRadio",
"radio",
"=",
"new",
"JQMRadio",
"(",
"value",
",",
"text",
")",
";",
"addRadio",
"(",
"radio",
")",
";",
"return",
"radio",
";",
"}"
] | Adds a new radio button to this radioset using the given value and text.
Returns a JQMRadio instance which can be used to change the value and
label of the radio button.
@param value
the value to associate with this radio option. This will be
the value returned by methods that query the selected value.
@param text
the label to show for this radio option.
@return a JQMRadio instance to adjust the added radio button | [
"Adds",
"a",
"new",
"radio",
"button",
"to",
"this",
"radioset",
"using",
"the",
"given",
"value",
"and",
"text",
".",
"Returns",
"a",
"JQMRadio",
"instance",
"which",
"can",
"be",
"used",
"to",
"change",
"the",
"value",
"and",
"label",
"of",
"the",
"rad... | train | https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/form/elements/JQMRadioset.java#L218-L222 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/util/Utils.java | Utils.padleft | public static String padleft(String s, int len, char c) {
s = s.trim();
if (s.length() > len) {
return s;
}
final StringBuilder sb = new StringBuilder(len);
int fill = len - s.length();
while (fill-- > 0) {
sb.append(c);
}
sb.append(s);
return sb.toString();
} | java | public static String padleft(String s, int len, char c) {
s = s.trim();
if (s.length() > len) {
return s;
}
final StringBuilder sb = new StringBuilder(len);
int fill = len - s.length();
while (fill-- > 0) {
sb.append(c);
}
sb.append(s);
return sb.toString();
} | [
"public",
"static",
"String",
"padleft",
"(",
"String",
"s",
",",
"int",
"len",
",",
"char",
"c",
")",
"{",
"s",
"=",
"s",
".",
"trim",
"(",
")",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
">",
"len",
")",
"{",
"return",
"s",
";",
"}",
"... | Pad to the left
@param s string
@param len desired len
@param c padding char
@return padded string | [
"Pad",
"to",
"the",
"left"
] | train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/util/Utils.java#L17-L29 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/sections/PESection.java | PESection.loadSectionBytes | private void loadSectionBytes() throws IOException {
Preconditions.checkState(size == (int) size,
"section is too large to dump into byte array");
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
raf.seek(offset);
byte[] bytes = new byte[(int) size];
raf.read(bytes);
sectionbytes = Optional.of(bytes);
}
} | java | private void loadSectionBytes() throws IOException {
Preconditions.checkState(size == (int) size,
"section is too large to dump into byte array");
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
raf.seek(offset);
byte[] bytes = new byte[(int) size];
raf.read(bytes);
sectionbytes = Optional.of(bytes);
}
} | [
"private",
"void",
"loadSectionBytes",
"(",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"size",
"==",
"(",
"int",
")",
"size",
",",
"\"section is too large to dump into byte array\"",
")",
";",
"try",
"(",
"RandomAccessFile",
"raf",
... | Loads the section bytes from the file using offset and size.
@throws IOException
if file can not be read
@throws IllegalStateException
if section is too large to fit into a byte array. This
happens if the size is larger than int can hold. | [
"Loads",
"the",
"section",
"bytes",
"from",
"the",
"file",
"using",
"offset",
"and",
"size",
"."
] | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/sections/PESection.java#L145-L154 |
tractionsoftware/gwt-traction | src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java | SingleListBox.findValueInListBox | public static final int findValueInListBox(ListBox list, String value) {
for (int i=0; i<list.getItemCount(); i++) {
if (value.equals(list.getValue(i))) {
return i;
}
}
return -1;
} | java | public static final int findValueInListBox(ListBox list, String value) {
for (int i=0; i<list.getItemCount(); i++) {
if (value.equals(list.getValue(i))) {
return i;
}
}
return -1;
} | [
"public",
"static",
"final",
"int",
"findValueInListBox",
"(",
"ListBox",
"list",
",",
"String",
"value",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"getItemCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"value"... | Utility function to find the first index of a value in a
ListBox. | [
"Utility",
"function",
"to",
"find",
"the",
"first",
"index",
"of",
"a",
"value",
"in",
"a",
"ListBox",
"."
] | train | https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L163-L170 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/XMLConverter.java | XMLConverter._serializeArray | private String _serializeArray(Array array, Map<Object, String> done, String id) throws ConverterException {
return _serializeList(array.toList(), done, id);
} | java | private String _serializeArray(Array array, Map<Object, String> done, String id) throws ConverterException {
return _serializeList(array.toList(), done, id);
} | [
"private",
"String",
"_serializeArray",
"(",
"Array",
"array",
",",
"Map",
"<",
"Object",
",",
"String",
">",
"done",
",",
"String",
"id",
")",
"throws",
"ConverterException",
"{",
"return",
"_serializeList",
"(",
"array",
".",
"toList",
"(",
")",
",",
"do... | serialize a Array
@param array Array to serialize
@param done
@return serialized array
@throws ConverterException | [
"serialize",
"a",
"Array"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/XMLConverter.java#L136-L138 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.addShutdownHook | public static void addShutdownHook(Object self, Closure closure) {
Runtime.getRuntime().addShutdownHook(new Thread(closure));
} | java | public static void addShutdownHook(Object self, Closure closure) {
Runtime.getRuntime().addShutdownHook(new Thread(closure));
} | [
"public",
"static",
"void",
"addShutdownHook",
"(",
"Object",
"self",
",",
"Closure",
"closure",
")",
"{",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"addShutdownHook",
"(",
"new",
"Thread",
"(",
"closure",
")",
")",
";",
"}"
] | Allows the usage of addShutdownHook without getting the runtime first.
@param self the object the method is called on (ignored)
@param closure the shutdown hook action
@since 1.5.0 | [
"Allows",
"the",
"usage",
"of",
"addShutdownHook",
"without",
"getting",
"the",
"runtime",
"first",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L659-L661 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.execBackwards | public void execBackwards(Map<String,INDArray> placeholders){
if (getFunction("grad") == null) {
createGradFunction();
}
//Collect (unique) list of gradient names...
Set<String> varGradNames = new HashSet<>();
for(Variable v : variables.values()){
if(v.getVariable().getVariableType() == VariableType.VARIABLE){
SDVariable g = v.getVariable().gradient();
if(g != null) {
//Not all variables can have gradients... for example: suppose graph has 2 independent loss functions,
// optimizing only 1 might not require changing all variables
varGradNames.add(g.getVarName());
}
}
}
//Edge case: if no variables, no variable gradients to calculate...
if(varGradNames.isEmpty()){
log.warn("Skipping gradient execution (backward pass) - no variables to be calculated (graph does not contain any VARIABLE type SDVariables).\n" +
"If gradients for other variables (such as placeholders) are required, use execBackwards(Map, List) instead");
return;
}
List<String> vargradNamesList = new ArrayList<>(varGradNames);
execBackwards(placeholders, vargradNamesList);
} | java | public void execBackwards(Map<String,INDArray> placeholders){
if (getFunction("grad") == null) {
createGradFunction();
}
//Collect (unique) list of gradient names...
Set<String> varGradNames = new HashSet<>();
for(Variable v : variables.values()){
if(v.getVariable().getVariableType() == VariableType.VARIABLE){
SDVariable g = v.getVariable().gradient();
if(g != null) {
//Not all variables can have gradients... for example: suppose graph has 2 independent loss functions,
// optimizing only 1 might not require changing all variables
varGradNames.add(g.getVarName());
}
}
}
//Edge case: if no variables, no variable gradients to calculate...
if(varGradNames.isEmpty()){
log.warn("Skipping gradient execution (backward pass) - no variables to be calculated (graph does not contain any VARIABLE type SDVariables).\n" +
"If gradients for other variables (such as placeholders) are required, use execBackwards(Map, List) instead");
return;
}
List<String> vargradNamesList = new ArrayList<>(varGradNames);
execBackwards(placeholders, vargradNamesList);
} | [
"public",
"void",
"execBackwards",
"(",
"Map",
"<",
"String",
",",
"INDArray",
">",
"placeholders",
")",
"{",
"if",
"(",
"getFunction",
"(",
"\"grad\"",
")",
"==",
"null",
")",
"{",
"createGradFunction",
"(",
")",
";",
"}",
"//Collect (unique) list of gradient... | Create (if required) and then calculate the variable gradients (backward pass) for this graph.<br>
After execution, the gradient arrays can be accessed using {@code myVariable.getGradient().getArr()}<br>
<b>Note</b>: This method by default calculates VARIABLE type SDVariable gradients only (as well as any other
gradients needed to calculate the variable gradients). That is, placeholder, constant, etc gradients are not
calculated. If these gradients are required, they can be calculated using {@link #execBackwards(Map, List)} instead,
which allows specifying the set of SDVariables to calculate the gradients for. For example,
{@code execBackwards(placeholders, Arrays.asList(myPlaceholder.gradient().getVarName())}. In some cases,
{@link #createGradFunction()} may need to be called first
@param placeholders Values for the placeholder variables in the graph. For graphs without placeholders, use null or an empty map | [
"Create",
"(",
"if",
"required",
")",
"and",
"then",
"calculate",
"the",
"variable",
"gradients",
"(",
"backward",
"pass",
")",
"for",
"this",
"graph",
".",
"<br",
">",
"After",
"execution",
"the",
"gradient",
"arrays",
"can",
"be",
"accessed",
"using",
"{... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L3208-L3235 |
ehcache/ehcache3 | core/src/main/java/org/ehcache/core/config/DefaultConfiguration.java | DefaultConfiguration.replaceCacheConfiguration | public <K, V> void replaceCacheConfiguration(final String alias, final CacheConfiguration<K, V> config, final CacheRuntimeConfiguration<K, V> runtimeConfiguration) {
if (!caches.replace(alias, config, runtimeConfiguration)) {
throw new IllegalStateException("The expected configuration doesn't match!");
}
} | java | public <K, V> void replaceCacheConfiguration(final String alias, final CacheConfiguration<K, V> config, final CacheRuntimeConfiguration<K, V> runtimeConfiguration) {
if (!caches.replace(alias, config, runtimeConfiguration)) {
throw new IllegalStateException("The expected configuration doesn't match!");
}
} | [
"public",
"<",
"K",
",",
"V",
">",
"void",
"replaceCacheConfiguration",
"(",
"final",
"String",
"alias",
",",
"final",
"CacheConfiguration",
"<",
"K",
",",
"V",
">",
"config",
",",
"final",
"CacheRuntimeConfiguration",
"<",
"K",
",",
"V",
">",
"runtimeConfig... | Replaces a {@link CacheConfiguration} with a {@link CacheRuntimeConfiguration} for the provided alias.
@param alias the alias of the cache
@param config the existing configuration
@param runtimeConfiguration the new configuration
@param <K> the key type
@param <V> the value type
@throws IllegalStateException if the replace fails | [
"Replaces",
"a",
"{",
"@link",
"CacheConfiguration",
"}",
"with",
"a",
"{",
"@link",
"CacheRuntimeConfiguration",
"}",
"for",
"the",
"provided",
"alias",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/config/DefaultConfiguration.java#L147-L151 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getInternalState | @SuppressWarnings("unchecked")
public static <T> T getInternalState(Object object, Class<T> fieldType, Class<?> where) {
if (object == null) {
throw new IllegalArgumentException("object and type are not allowed to be null");
}
try {
return (T) findFieldOrThrowException(fieldType, where).get(object);
} catch (IllegalAccessException e) {
throw new RuntimeException("Internal error: Failed to get field in method getInternalState.", e);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T getInternalState(Object object, Class<T> fieldType, Class<?> where) {
if (object == null) {
throw new IllegalArgumentException("object and type are not allowed to be null");
}
try {
return (T) findFieldOrThrowException(fieldType, where).get(object);
} catch (IllegalAccessException e) {
throw new RuntimeException("Internal error: Failed to get field in method getInternalState.", e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getInternalState",
"(",
"Object",
"object",
",",
"Class",
"<",
"T",
">",
"fieldType",
",",
"Class",
"<",
"?",
">",
"where",
")",
"{",
"if",
"(",
"object",
"=="... | Get the value of a field using reflection. Use this method when you need
to specify in which class the field is declared. The first field matching
the <tt>fieldType</tt> in <tt>where</tt> will is the field whose value
will be returned.
@param <T> the expected type of the field
@param object the object to modify
@param fieldType the type of the field
@param where which class the field is defined
@return the internal state | [
"Get",
"the",
"value",
"of",
"a",
"field",
"using",
"reflection",
".",
"Use",
"this",
"method",
"when",
"you",
"need",
"to",
"specify",
"in",
"which",
"class",
"the",
"field",
"is",
"declared",
".",
"The",
"first",
"field",
"matching",
"the",
"<tt",
">",... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L587-L598 |
Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/RetryRule.java | RetryRule.choose | public Server choose(ILoadBalancer lb, Object key) {
long requestTime = System.currentTimeMillis();
long deadline = requestTime + maxRetryMillis;
Server answer = null;
answer = subRule.choose(key);
if (((answer == null) || (!answer.isAlive()))
&& (System.currentTimeMillis() < deadline)) {
InterruptTask task = new InterruptTask(deadline
- System.currentTimeMillis());
while (!Thread.interrupted()) {
answer = subRule.choose(key);
if (((answer == null) || (!answer.isAlive()))
&& (System.currentTimeMillis() < deadline)) {
/* pause and retry hoping it's transient */
Thread.yield();
} else {
break;
}
}
task.cancel();
}
if ((answer == null) || (!answer.isAlive())) {
return null;
} else {
return answer;
}
} | java | public Server choose(ILoadBalancer lb, Object key) {
long requestTime = System.currentTimeMillis();
long deadline = requestTime + maxRetryMillis;
Server answer = null;
answer = subRule.choose(key);
if (((answer == null) || (!answer.isAlive()))
&& (System.currentTimeMillis() < deadline)) {
InterruptTask task = new InterruptTask(deadline
- System.currentTimeMillis());
while (!Thread.interrupted()) {
answer = subRule.choose(key);
if (((answer == null) || (!answer.isAlive()))
&& (System.currentTimeMillis() < deadline)) {
/* pause and retry hoping it's transient */
Thread.yield();
} else {
break;
}
}
task.cancel();
}
if ((answer == null) || (!answer.isAlive())) {
return null;
} else {
return answer;
}
} | [
"public",
"Server",
"choose",
"(",
"ILoadBalancer",
"lb",
",",
"Object",
"key",
")",
"{",
"long",
"requestTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"deadline",
"=",
"requestTime",
"+",
"maxRetryMillis",
";",
"Server",
"answer",
"... | /*
Loop if necessary. Note that the time CAN be exceeded depending on the
subRule, because we're not spawning additional threads and returning
early. | [
"/",
"*",
"Loop",
"if",
"necessary",
".",
"Note",
"that",
"the",
"time",
"CAN",
"be",
"exceeded",
"depending",
"on",
"the",
"subRule",
"because",
"we",
"re",
"not",
"spawning",
"additional",
"threads",
"and",
"returning",
"early",
"."
] | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/RetryRule.java#L78-L112 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java | ExpressRouteGatewaysInner.beginCreateOrUpdate | public ExpressRouteGatewayInner beginCreateOrUpdate(String resourceGroupName, String expressRouteGatewayName, ExpressRouteGatewayInner putExpressRouteGatewayParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters).toBlocking().single().body();
} | java | public ExpressRouteGatewayInner beginCreateOrUpdate(String resourceGroupName, String expressRouteGatewayName, ExpressRouteGatewayInner putExpressRouteGatewayParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters).toBlocking().single().body();
} | [
"public",
"ExpressRouteGatewayInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"ExpressRouteGatewayInner",
"putExpressRouteGatewayParameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"r... | Creates or updates a ExpressRoute gateway in a specified resource group.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param putExpressRouteGatewayParameters Parameters required in an ExpressRoute gateway PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRouteGatewayInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"ExpressRoute",
"gateway",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java#L345-L347 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java | ICUService.registerObject | public Factory registerObject(Object obj, String id, boolean visible) {
String canonicalID = createKey(id).canonicalID();
return registerFactory(new SimpleFactory(obj, canonicalID, visible));
} | java | public Factory registerObject(Object obj, String id, boolean visible) {
String canonicalID = createKey(id).canonicalID();
return registerFactory(new SimpleFactory(obj, canonicalID, visible));
} | [
"public",
"Factory",
"registerObject",
"(",
"Object",
"obj",
",",
"String",
"id",
",",
"boolean",
"visible",
")",
"{",
"String",
"canonicalID",
"=",
"createKey",
"(",
"id",
")",
".",
"canonicalID",
"(",
")",
";",
"return",
"registerFactory",
"(",
"new",
"S... | Register an object with the provided id. The id will be
canonicalized. The canonicalized ID will be returned by
getVisibleIDs if visible is true. | [
"Register",
"an",
"object",
"with",
"the",
"provided",
"id",
".",
"The",
"id",
"will",
"be",
"canonicalized",
".",
"The",
"canonicalized",
"ID",
"will",
"be",
"returned",
"by",
"getVisibleIDs",
"if",
"visible",
"is",
"true",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L784-L787 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/util/LoggerUtil.java | LoggerUtil.veryVerbose | public static void veryVerbose(Logger log, String format, Object... args) {
if (log.isLoggable(Level.FINER)) {
StackTraceElement[] callStack =
Thread.currentThread().getStackTrace();
// Index 0 is Thread.getStackTrace()
// Index 1 is this method
// Index 2 is the caller
// Index 3 and beyond we don't care about
StackTraceElement caller = callStack[2];
String callingClass = caller.getClassName();
String callingMethod = caller.getMethodName();
log.logp(Level.FINER, callingClass, callingMethod,
String.format(format, args));
}
} | java | public static void veryVerbose(Logger log, String format, Object... args) {
if (log.isLoggable(Level.FINER)) {
StackTraceElement[] callStack =
Thread.currentThread().getStackTrace();
// Index 0 is Thread.getStackTrace()
// Index 1 is this method
// Index 2 is the caller
// Index 3 and beyond we don't care about
StackTraceElement caller = callStack[2];
String callingClass = caller.getClassName();
String callingMethod = caller.getMethodName();
log.logp(Level.FINER, callingClass, callingMethod,
String.format(format, args));
}
} | [
"public",
"static",
"void",
"veryVerbose",
"(",
"Logger",
"log",
",",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINER",
")",
")",
"{",
"StackTraceElement",
"[",
"]",
"callStack",
... | Prints {@link Level#FINE} messages to the provided {@link Logger}. | [
"Prints",
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/LoggerUtil.java#L97-L111 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/constraint/ChocoMapper.java | ChocoMapper.mapView | public void mapView(Class<? extends ModelView> c, Class<? extends ChocoView> cc) {
views.put(c, cc);
} | java | public void mapView(Class<? extends ModelView> c, Class<? extends ChocoView> cc) {
views.put(c, cc);
} | [
"public",
"void",
"mapView",
"(",
"Class",
"<",
"?",
"extends",
"ModelView",
">",
"c",
",",
"Class",
"<",
"?",
"extends",
"ChocoView",
">",
"cc",
")",
"{",
"views",
".",
"put",
"(",
"c",
",",
"cc",
")",
";",
"}"
] | Register a mapping between an api-side view and its choco implementation.
It is expected from the implementation to exhibit a constructor that takes the api-side constraint as argument.
@param c the api-side view
@param cc the choco implementation
@throws IllegalArgumentException if there is no suitable constructor for the choco implementation | [
"Register",
"a",
"mapping",
"between",
"an",
"api",
"-",
"side",
"view",
"and",
"its",
"choco",
"implementation",
".",
"It",
"is",
"expected",
"from",
"the",
"implementation",
"to",
"exhibit",
"a",
"constructor",
"that",
"takes",
"the",
"api",
"-",
"side",
... | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/ChocoMapper.java#L152-L154 |
tvesalainen/util | vfs/src/main/java/org/vesalainen/vfs/Env.java | Env.getFileFormat | public static final FileFormat getFileFormat(Path path, Map<String, ?> env)
{
FileFormat fmt = (FileFormat) env.get(FORMAT);
String filename = path.getFileName().toString();
if (fmt == null)
{
if (filename.endsWith(".tar.gz") || filename.endsWith(".tar") || filename.endsWith(".deb"))
{
fmt = TAR_GNU;
}
else
{
fmt = CPIO_CRC;
}
}
return fmt;
} | java | public static final FileFormat getFileFormat(Path path, Map<String, ?> env)
{
FileFormat fmt = (FileFormat) env.get(FORMAT);
String filename = path.getFileName().toString();
if (fmt == null)
{
if (filename.endsWith(".tar.gz") || filename.endsWith(".tar") || filename.endsWith(".deb"))
{
fmt = TAR_GNU;
}
else
{
fmt = CPIO_CRC;
}
}
return fmt;
} | [
"public",
"static",
"final",
"FileFormat",
"getFileFormat",
"(",
"Path",
"path",
",",
"Map",
"<",
"String",
",",
"?",
">",
"env",
")",
"{",
"FileFormat",
"fmt",
"=",
"(",
"FileFormat",
")",
"env",
".",
"get",
"(",
"FORMAT",
")",
";",
"String",
"filenam... | Returns FileFormat either from env or using default value which is TAR_GNU
for tar and CPIO_CRC for others.
@param path
@param env
@return | [
"Returns",
"FileFormat",
"either",
"from",
"env",
"or",
"using",
"default",
"value",
"which",
"is",
"TAR_GNU",
"for",
"tar",
"and",
"CPIO_CRC",
"for",
"others",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/Env.java#L81-L97 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java | IntrospectionUtils.getWriteMethodName | public static String getWriteMethodName(Field field, String prefix) {
return prefix == null ? field.getName() : (prefix + getCapitalizedName(field.getName()));
} | java | public static String getWriteMethodName(Field field, String prefix) {
return prefix == null ? field.getName() : (prefix + getCapitalizedName(field.getName()));
} | [
"public",
"static",
"String",
"getWriteMethodName",
"(",
"Field",
"field",
",",
"String",
"prefix",
")",
"{",
"return",
"prefix",
"==",
"null",
"?",
"field",
".",
"getName",
"(",
")",
":",
"(",
"prefix",
"+",
"getCapitalizedName",
"(",
"field",
".",
"getNa... | Returns the name of the method that can be used to write (or set) the given field.
@param field
the name of the field
@param prefix
the prefix for the write method (e.g. set, with, etc.).
@return the name of the write method. | [
"Returns",
"the",
"name",
"of",
"the",
"method",
"that",
"can",
"be",
"used",
"to",
"write",
"(",
"or",
"set",
")",
"the",
"given",
"field",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L230-L233 |
dyu/protostuff-1.0.x | protostuff-me/src/main/java/com/dyuproject/protostuff/me/IOUtil.java | IOUtil.mergeDelimitedFrom | static int mergeDelimitedFrom(DataInput in, Object message, Schema schema,
boolean decodeNestedMessageAsGroup) throws IOException
{
final byte size = in.readByte();
final int len = 0 == (size & 0x80) ? size : CodedInput.readRawVarint32(in, size);
if(len < 0)
throw ProtobufException.negativeSize();
if(len != 0)
{
// not an empty message
if(len > CodedInput.DEFAULT_BUFFER_SIZE && in instanceof InputStream)
{
// message too big
final CodedInput input = new CodedInput(new LimitedInputStream((InputStream)in, len),
decodeNestedMessageAsGroup);
schema.mergeFrom(input, message);
input.checkLastTagWas(0);
}
else
{
final byte[] buf = new byte[len];
in.readFully(buf, 0, len);
final ByteArrayInput input = new ByteArrayInput(buf, 0, len,
decodeNestedMessageAsGroup);
try
{
schema.mergeFrom(input, message);
}
catch(ArrayIndexOutOfBoundsException e)
{
throw ProtobufException.truncatedMessage(e);
}
input.checkLastTagWas(0);
}
}
// check it since this message is embedded in the DataInput.
if(!schema.isInitialized(message))
throw new UninitializedMessageException(message, schema);
return len;
} | java | static int mergeDelimitedFrom(DataInput in, Object message, Schema schema,
boolean decodeNestedMessageAsGroup) throws IOException
{
final byte size = in.readByte();
final int len = 0 == (size & 0x80) ? size : CodedInput.readRawVarint32(in, size);
if(len < 0)
throw ProtobufException.negativeSize();
if(len != 0)
{
// not an empty message
if(len > CodedInput.DEFAULT_BUFFER_SIZE && in instanceof InputStream)
{
// message too big
final CodedInput input = new CodedInput(new LimitedInputStream((InputStream)in, len),
decodeNestedMessageAsGroup);
schema.mergeFrom(input, message);
input.checkLastTagWas(0);
}
else
{
final byte[] buf = new byte[len];
in.readFully(buf, 0, len);
final ByteArrayInput input = new ByteArrayInput(buf, 0, len,
decodeNestedMessageAsGroup);
try
{
schema.mergeFrom(input, message);
}
catch(ArrayIndexOutOfBoundsException e)
{
throw ProtobufException.truncatedMessage(e);
}
input.checkLastTagWas(0);
}
}
// check it since this message is embedded in the DataInput.
if(!schema.isInitialized(message))
throw new UninitializedMessageException(message, schema);
return len;
} | [
"static",
"int",
"mergeDelimitedFrom",
"(",
"DataInput",
"in",
",",
"Object",
"message",
",",
"Schema",
"schema",
",",
"boolean",
"decodeNestedMessageAsGroup",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"size",
"=",
"in",
".",
"readByte",
"(",
")",
";... | Used by the code generated messages that implement {@link java.io.Externalizable}.
Merges from the {@link DataInput}. | [
"Used",
"by",
"the",
"code",
"generated",
"messages",
"that",
"implement",
"{"
] | train | https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-me/src/main/java/com/dyuproject/protostuff/me/IOUtil.java#L175-L218 |
b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optEnum | public <E extends Enum<E>> E optEnum(Class<E> clazz, int index, E defaultValue) {
try {
Object val = this.opt(index);
if (JSONObject.NULL.equals(val)) {
return defaultValue;
}
if (clazz.isAssignableFrom(val.getClass())) {
// we just checked it!
@SuppressWarnings("unchecked")
E myE = (E) val;
return myE;
}
return Enum.valueOf(clazz, val.toString());
} catch (IllegalArgumentException e) {
return defaultValue;
} catch (NullPointerException e) {
return defaultValue;
}
} | java | public <E extends Enum<E>> E optEnum(Class<E> clazz, int index, E defaultValue) {
try {
Object val = this.opt(index);
if (JSONObject.NULL.equals(val)) {
return defaultValue;
}
if (clazz.isAssignableFrom(val.getClass())) {
// we just checked it!
@SuppressWarnings("unchecked")
E myE = (E) val;
return myE;
}
return Enum.valueOf(clazz, val.toString());
} catch (IllegalArgumentException e) {
return defaultValue;
} catch (NullPointerException e) {
return defaultValue;
}
} | [
"public",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"E",
"optEnum",
"(",
"Class",
"<",
"E",
">",
"clazz",
",",
"int",
"index",
",",
"E",
"defaultValue",
")",
"{",
"try",
"{",
"Object",
"val",
"=",
"this",
".",
"opt",
"(",
"index",
")",
"... | Get the enum value associated with a key.
@param <E>
Enum Type
@param clazz
The type of enum to retrieve.
@param index
The index must be between 0 and length() - 1.
@param defaultValue
The default in case the value is not found
@return The enum value at the index location or defaultValue if
the value is not found or cannot be assigned to clazz | [
"Get",
"the",
"enum",
"value",
"associated",
"with",
"a",
"key",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L678-L696 |
wisdom-framework/wisdom | core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java | ConfigurationImpl.getOrDie | @Override
public String getOrDie(String key) {
String value = get(key);
if (value == null) {
throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key));
} else {
return value;
}
} | java | @Override
public String getOrDie(String key) {
String value = get(key);
if (value == null) {
throw new IllegalArgumentException(String.format(ERROR_KEYNOTFOUND, key));
} else {
return value;
}
} | [
"@",
"Override",
"public",
"String",
"getOrDie",
"(",
"String",
"key",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
... | The "die" method forces this key to be set. Otherwise a runtime exception
will be thrown.
@param key the key
@return the String or a IllegalArgumentException will be thrown. | [
"The",
"die",
"method",
"forces",
"this",
"key",
"to",
"be",
"set",
".",
"Otherwise",
"a",
"runtime",
"exception",
"will",
"be",
"thrown",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/application-configuration/src/main/java/org/wisdom/configuration/ConfigurationImpl.java#L327-L335 |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java | HadoopUtils.fileToString | public static String fileToString(FileSystem fs, Path path) throws IOException {
if(!fs.exists(path)) {
return null;
}
InputStream is = fs.open(path);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
char[] buff = new char[256];
StringBuilder sb = new StringBuilder();
int read;
while((read = br.read(buff)) != -1) {
sb.append(buff, 0, read);
}
br.close();
return sb.toString();
} | java | public static String fileToString(FileSystem fs, Path path) throws IOException {
if(!fs.exists(path)) {
return null;
}
InputStream is = fs.open(path);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
char[] buff = new char[256];
StringBuilder sb = new StringBuilder();
int read;
while((read = br.read(buff)) != -1) {
sb.append(buff, 0, read);
}
br.close();
return sb.toString();
} | [
"public",
"static",
"String",
"fileToString",
"(",
"FileSystem",
"fs",
",",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"fs",
".",
"exists",
"(",
"path",
")",
")",
"{",
"return",
"null",
";",
"}",
"InputStream",
"is",
"=",
"fs",
... | Reads the content of a file into a String. Return null if the file does not
exist. | [
"Reads",
"the",
"content",
"of",
"a",
"file",
"into",
"a",
"String",
".",
"Return",
"null",
"if",
"the",
"file",
"does",
"not",
"exist",
"."
] | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/HadoopUtils.java#L71-L87 |
RobAustin/low-latency-primitive-concurrent-queues | src/main/java/uk/co/boundedbuffer/ConcurrentBlockingLongQueue.java | ConcurrentBlockingLongQueue.poll | public long poll(long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
final int readLocation = this.consumerReadLocation;
int nextReadLocation = blockForReadSpace(timeout, unit, readLocation);
// purposely non volatile as the read memory barrier occurred when we read 'writeLocation'
final long value = data[readLocation];
setReadLocation(nextReadLocation);
return value;
} | java | public long poll(long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
final int readLocation = this.consumerReadLocation;
int nextReadLocation = blockForReadSpace(timeout, unit, readLocation);
// purposely non volatile as the read memory barrier occurred when we read 'writeLocation'
final long value = data[readLocation];
setReadLocation(nextReadLocation);
return value;
} | [
"public",
"long",
"poll",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"final",
"int",
"readLocation",
"=",
"this",
".",
"consumerReadLocation",
";",
"int",
"nextReadLocation",
"=",
"blockFor... | Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an
element to become available.
@param timeout how long to wait before giving up, in units of <tt>unit</tt>
@param unit a <tt>TimeUnit</tt> determining how to interpret the <tt>timeout</tt> parameter
@return the head of this queue, or throws a <tt>TimeoutException</tt> if the specified waiting time
elapses before an element is available
@throws InterruptedException if interrupted while waiting
@throws java.util.concurrent.TimeoutException if timeout time is exceeded | [
"Retrieves",
"and",
"removes",
"the",
"head",
"of",
"this",
"queue",
"waiting",
"up",
"to",
"the",
"specified",
"wait",
"time",
"if",
"necessary",
"for",
"an",
"element",
"to",
"become",
"available",
"."
] | train | https://github.com/RobAustin/low-latency-primitive-concurrent-queues/blob/ffcf95a8135750c0b23cd486346a1f68a4724b1c/src/main/java/uk/co/boundedbuffer/ConcurrentBlockingLongQueue.java#L298-L310 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java | DataModelSerializer.serializeAsStream | public static void serializeAsStream(Object o, OutputStream s) throws IOException {
try {
JsonStructure builtJsonObject = findFieldsToSerialize(o).mainObject;
Map<String, Object> config = new HashMap<String, Object>();
config.put(JsonGenerator.PRETTY_PRINTING, true);
JsonWriterFactory writerFactory = Json.createWriterFactory(config);
JsonWriter streamWriter = writerFactory.createWriter(s);
streamWriter.write(builtJsonObject);
} catch (IllegalStateException ise) {
// the reflective attempt to build the object failed.
throw new IOException("Unable to build JSON for Object", ise);
} catch (JsonException e) {
throw new IOException("Unable to build JSON for Object", e);
}
} | java | public static void serializeAsStream(Object o, OutputStream s) throws IOException {
try {
JsonStructure builtJsonObject = findFieldsToSerialize(o).mainObject;
Map<String, Object> config = new HashMap<String, Object>();
config.put(JsonGenerator.PRETTY_PRINTING, true);
JsonWriterFactory writerFactory = Json.createWriterFactory(config);
JsonWriter streamWriter = writerFactory.createWriter(s);
streamWriter.write(builtJsonObject);
} catch (IllegalStateException ise) {
// the reflective attempt to build the object failed.
throw new IOException("Unable to build JSON for Object", ise);
} catch (JsonException e) {
throw new IOException("Unable to build JSON for Object", e);
}
} | [
"public",
"static",
"void",
"serializeAsStream",
"(",
"Object",
"o",
",",
"OutputStream",
"s",
")",
"throws",
"IOException",
"{",
"try",
"{",
"JsonStructure",
"builtJsonObject",
"=",
"findFieldsToSerialize",
"(",
"o",
")",
".",
"mainObject",
";",
"Map",
"<",
"... | Convert a POJO into Serialized JSON form.
@param o the POJO to serialize
@param s the OutputStream to write to..
@throws IOException when there are problems creating the JSON. | [
"Convert",
"a",
"POJO",
"into",
"Serialized",
"JSON",
"form",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/DataModelSerializer.java#L327-L341 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.isAssignable | public static void isAssignable(Class<?> superType, Class<?> subType, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
notNull(superType, "Type to check against must not be null");
if (subType == null || !superType.isAssignableFrom(subType)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
} | java | public static void isAssignable(Class<?> superType, Class<?> subType, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
notNull(superType, "Type to check against must not be null");
if (subType == null || !superType.isAssignableFrom(subType)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
} | [
"public",
"static",
"void",
"isAssignable",
"(",
"Class",
"<",
"?",
">",
"superType",
",",
"Class",
"<",
"?",
">",
"subType",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"notNull",
"(",
"... | 断言 {@code superType.isAssignableFrom(subType)} 是否为 {@code true}.
<pre class="code">
Assert.isAssignable(Number.class, myClass);
</pre>
@param superType 需要检查的父类或接口
@param subType 需要检查的子类
@param errorMsgTemplate 异常时的消息模板
@param params 参数列表
@throws IllegalArgumentException 如果子类非继承父类,抛出此异常 | [
"断言",
"{",
"@code",
"superType",
".",
"isAssignableFrom",
"(",
"subType",
")",
"}",
"是否为",
"{",
"@code",
"true",
"}",
"."
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L485-L490 |
jimmoores/quandl4j | core/src/main/java/com/jimmoores/quandl/SearchResult.java | SearchResult.getTotalDocuments | public int getTotalDocuments() {
try {
final int totalDocs = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("total_count");
return totalDocs;
} catch (JSONException ex) {
throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex);
}
} | java | public int getTotalDocuments() {
try {
final int totalDocs = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("total_count");
return totalDocs;
} catch (JSONException ex) {
throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex);
}
} | [
"public",
"int",
"getTotalDocuments",
"(",
")",
"{",
"try",
"{",
"final",
"int",
"totalDocs",
"=",
"_jsonObject",
".",
"getJSONObject",
"(",
"META_OBJECT_FIELD",
")",
".",
"getInt",
"(",
"\"total_count\"",
")",
";",
"return",
"totalDocs",
";",
"}",
"catch",
... | Get the total number of documents in this result set. Throws a QuandlRuntimeException if Quandl response doesn't contain this field,
although it should.
@return the total number of documents in this result set | [
"Get",
"the",
"total",
"number",
"of",
"documents",
"in",
"this",
"result",
"set",
".",
"Throws",
"a",
"QuandlRuntimeException",
"if",
"Quandl",
"response",
"doesn",
"t",
"contain",
"this",
"field",
"although",
"it",
"should",
"."
] | train | https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/core/src/main/java/com/jimmoores/quandl/SearchResult.java#L47-L54 |
aol/cyclops | cyclops/src/main/java/cyclops/companion/Functions.java | Functions.flatMapLongs | public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> flatMapLongs(LongFunction<? extends LongStream> b){
return a->a.longs(i->i,s->s.flatMap(b));
} | java | public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> flatMapLongs(LongFunction<? extends LongStream> b){
return a->a.longs(i->i,s->s.flatMap(b));
} | [
"public",
"static",
"Function",
"<",
"?",
"super",
"ReactiveSeq",
"<",
"Long",
">",
",",
"?",
"extends",
"ReactiveSeq",
"<",
"Long",
">",
">",
"flatMapLongs",
"(",
"LongFunction",
"<",
"?",
"extends",
"LongStream",
">",
"b",
")",
"{",
"return",
"a",
"->"... | /*
Fluent flatMap operation using primitive types
e.g.
<pre>
{@code
import static cyclops.ReactiveSeq.flatMapLongs;
ReactiveSeq.ofLongs(1,2,3)
.to(flatMapLongs(i->LongStream.of(i*2)));
//[2l,4l,6l]
}
</pre> | [
"/",
"*",
"Fluent",
"flatMap",
"operation",
"using",
"primitive",
"types",
"e",
".",
"g",
".",
"<pre",
">",
"{",
"@code",
"import",
"static",
"cyclops",
".",
"ReactiveSeq",
".",
"flatMapLongs",
";"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L414-L417 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/RepositoryFileApi.java | RepositoryFileApi.deleteFile | public void deleteFile(Object projectIdOrPath, String filePath, String branchName, String commitMessage) throws GitLabApiException {
if (filePath == null) {
throw new RuntimeException("filePath cannot be null");
}
Form form = new Form();
addFormParam(form, isApiVersion(ApiVersion.V3) ? "branch_name" : "branch", branchName, true);
addFormParam(form, "commit_message", commitMessage, true);
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
if (isApiVersion(ApiVersion.V3)) {
addFormParam(form, "file_path", filePath, true);
delete(expectedStatus, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files");
} else {
delete(expectedStatus, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filePath));
}
} | java | public void deleteFile(Object projectIdOrPath, String filePath, String branchName, String commitMessage) throws GitLabApiException {
if (filePath == null) {
throw new RuntimeException("filePath cannot be null");
}
Form form = new Form();
addFormParam(form, isApiVersion(ApiVersion.V3) ? "branch_name" : "branch", branchName, true);
addFormParam(form, "commit_message", commitMessage, true);
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
if (isApiVersion(ApiVersion.V3)) {
addFormParam(form, "file_path", filePath, true);
delete(expectedStatus, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files");
} else {
delete(expectedStatus, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filePath));
}
} | [
"public",
"void",
"deleteFile",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"filePath",
",",
"String",
"branchName",
",",
"String",
"commitMessage",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"filePath",
"==",
"null",
")",
"{",
"throw",
"new",
"... | Delete existing file in repository
<pre><code>GitLab Endpoint: DELETE /projects/:id/repository/files</code></pre>
file_path (required) - Full path to file. Ex. lib/class.rb
branch_name (required) - The name of branch
commit_message (required) - Commit message
@param projectIdOrPath the id, path of the project, or a Project instance holding the project ID or path
@param filePath full path to new file. Ex. lib/class.rb
@param branchName the name of branch
@param commitMessage the commit message
@throws GitLabApiException if any exception occurs | [
"Delete",
"existing",
"file",
"in",
"repository"
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryFileApi.java#L317-L334 |
liyiorg/weixin-popular | src/main/java/weixin/popular/util/WxaUtil.java | WxaUtil.validateUserInfo | public static WxaUserInfo validateUserInfo(String session_key, String rawData, String signature) {
try {
if (DigestUtils.shaHex(rawData + session_key).equals(signature)) {
return JsonUtil.parseObject(rawData, WxaUserInfo.class);
}
} catch (Exception e) {
logger.error("", e);
}
return null;
} | java | public static WxaUserInfo validateUserInfo(String session_key, String rawData, String signature) {
try {
if (DigestUtils.shaHex(rawData + session_key).equals(signature)) {
return JsonUtil.parseObject(rawData, WxaUserInfo.class);
}
} catch (Exception e) {
logger.error("", e);
}
return null;
} | [
"public",
"static",
"WxaUserInfo",
"validateUserInfo",
"(",
"String",
"session_key",
",",
"String",
"rawData",
",",
"String",
"signature",
")",
"{",
"try",
"{",
"if",
"(",
"DigestUtils",
".",
"shaHex",
"(",
"rawData",
"+",
"session_key",
")",
".",
"equals",
... | 校验wx.getUserInfo rawData 签名,同时返回 userinfo
@param session_key session_key
@param rawData rawData
@param signature signature
@return WxaUserInfo 签名校验失败时,返回null | [
"校验wx",
".",
"getUserInfo",
"rawData",
"签名",
"同时返回",
"userinfo"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/WxaUtil.java#L63-L72 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateSecretAsync | public ServiceFuture<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, String contentType, SecretAttributes secretAttributes, Map<String, String> tags, final ServiceCallback<SecretBundle> serviceCallback) {
return ServiceFuture.fromResponse(updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion, contentType, secretAttributes, tags), serviceCallback);
} | java | public ServiceFuture<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, String contentType, SecretAttributes secretAttributes, Map<String, String> tags, final ServiceCallback<SecretBundle> serviceCallback) {
return ServiceFuture.fromResponse(updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion, contentType, secretAttributes, tags), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"SecretBundle",
">",
"updateSecretAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"secretName",
",",
"String",
"secretVersion",
",",
"String",
"contentType",
",",
"SecretAttributes",
"secretAttributes",
",",
"Map",
"<",
"String",
... | Updates the attributes associated with a specified secret in a given key vault.
The UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires the secrets/set permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param secretName The name of the secret.
@param secretVersion The version of the secret.
@param contentType Type of the secret value such as a password.
@param secretAttributes The secret management attributes.
@param tags Application specific metadata in the form of key-value pairs.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Updates",
"the",
"attributes",
"associated",
"with",
"a",
"specified",
"secret",
"in",
"a",
"given",
"key",
"vault",
".",
"The",
"UPDATE",
"operation",
"changes",
"specified",
"attributes",
"of",
"an",
"existing",
"stored",
"secret",
".",
"Attributes",
"that",
... | 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#L3736-L3738 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/util/PGInterval.java | PGInterval.setValue | public void setValue(int years, int months, int days, int hours, int minutes, double seconds) {
setYears(years);
setMonths(months);
setDays(days);
setHours(hours);
setMinutes(minutes);
setSeconds(seconds);
} | java | public void setValue(int years, int months, int days, int hours, int minutes, double seconds) {
setYears(years);
setMonths(months);
setDays(days);
setHours(hours);
setMinutes(minutes);
setSeconds(seconds);
} | [
"public",
"void",
"setValue",
"(",
"int",
"years",
",",
"int",
"months",
",",
"int",
"days",
",",
"int",
"hours",
",",
"int",
"minutes",
",",
"double",
"seconds",
")",
"{",
"setYears",
"(",
"years",
")",
";",
"setMonths",
"(",
"months",
")",
";",
"se... | Set all values of this interval to the specified values.
@param years years
@param months months
@param days days
@param hours hours
@param minutes minutes
@param seconds seconds | [
"Set",
"all",
"values",
"of",
"this",
"interval",
"to",
"the",
"specified",
"values",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/PGInterval.java#L174-L181 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java | ProbeManagerImpl.getProbe | public synchronized ProbeImpl getProbe(Class<?> probedClass, String key) {
Map<String, ProbeImpl> classProbes = probesByKey.get(probedClass);
if (classProbes != null) {
return classProbes.get(key);
}
return null;
} | java | public synchronized ProbeImpl getProbe(Class<?> probedClass, String key) {
Map<String, ProbeImpl> classProbes = probesByKey.get(probedClass);
if (classProbes != null) {
return classProbes.get(key);
}
return null;
} | [
"public",
"synchronized",
"ProbeImpl",
"getProbe",
"(",
"Class",
"<",
"?",
">",
"probedClass",
",",
"String",
"key",
")",
"{",
"Map",
"<",
"String",
",",
"ProbeImpl",
">",
"classProbes",
"=",
"probesByKey",
".",
"get",
"(",
"probedClass",
")",
";",
"if",
... | Get an existing instance of a probe with the specified source class and
key.
@param probedClass the probe source class
@param key the probe key
@return an existing probe or null | [
"Get",
"an",
"existing",
"instance",
"of",
"a",
"probe",
"with",
"the",
"specified",
"source",
"class",
"and",
"key",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java#L617-L623 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.sortByProperty | public static <T> List<T> sortByProperty(List<T> list, String property) {
return sort(list, new PropertyComparator<>(property));
} | java | public static <T> List<T> sortByProperty(List<T> list, String property) {
return sort(list, new PropertyComparator<>(property));
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"sortByProperty",
"(",
"List",
"<",
"T",
">",
"list",
",",
"String",
"property",
")",
"{",
"return",
"sort",
"(",
"list",
",",
"new",
"PropertyComparator",
"<>",
"(",
"property",
")",
")",
";"... | 根据Bean的属性排序
@param <T> 元素类型
@param list List
@param property 属性名
@return 排序后的List
@since 4.0.6 | [
"根据Bean的属性排序"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2125-L2127 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/IOManager.java | IOManager.createBulkBlockChannelReader | public BulkBlockChannelReader createBulkBlockChannelReader(Channel.ID channelID,
List<MemorySegment> targetSegments, int numBlocks)
throws IOException
{
if (this.isClosed) {
throw new IllegalStateException("I/O-Manger is closed.");
}
return new BulkBlockChannelReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, targetSegments, numBlocks);
} | java | public BulkBlockChannelReader createBulkBlockChannelReader(Channel.ID channelID,
List<MemorySegment> targetSegments, int numBlocks)
throws IOException
{
if (this.isClosed) {
throw new IllegalStateException("I/O-Manger is closed.");
}
return new BulkBlockChannelReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, targetSegments, numBlocks);
} | [
"public",
"BulkBlockChannelReader",
"createBulkBlockChannelReader",
"(",
"Channel",
".",
"ID",
"channelID",
",",
"List",
"<",
"MemorySegment",
">",
"targetSegments",
",",
"int",
"numBlocks",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"isClosed",
")... | Creates a block channel reader that reads all blocks from the given channel directly in one bulk.
The reader draws segments to read the blocks into from a supplied list, which must contain as many
segments as the channel has blocks. After the reader is done, the list with the full segments can be
obtained from the reader.
<p>
If a channel is not to be read in one bulk, but in multiple smaller batches, a
{@link BlockChannelReader} should be used.
@param channelID The descriptor for the channel to write to.
@param targetSegments The list to take the segments from into which to read the data.
@param numBlocks The number of blocks in the channel to read.
@return A block channel reader that reads from the given channel.
@throws IOException Thrown, if the channel for the reader could not be opened. | [
"Creates",
"a",
"block",
"channel",
"reader",
"that",
"reads",
"all",
"blocks",
"from",
"the",
"given",
"channel",
"directly",
"in",
"one",
"bulk",
".",
"The",
"reader",
"draws",
"segments",
"to",
"read",
"the",
"blocks",
"into",
"from",
"a",
"supplied",
"... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/IOManager.java#L443-L452 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/curves/PrecisionRecallCurve.java | PrecisionRecallCurve.getPointAtPrecision | public Point getPointAtPrecision(double precision) {
//Find the LOWEST threshold that gives the specified precision
for (int i = 0; i < this.precision.length; i++) {
if (this.precision[i] >= precision) {
return new Point(i, threshold[i], this.precision[i], recall[i]);
}
}
//Not found, return last point. Should never happen though...
int i = threshold.length - 1;
return new Point(i, threshold[i], this.precision[i], this.recall[i]);
} | java | public Point getPointAtPrecision(double precision) {
//Find the LOWEST threshold that gives the specified precision
for (int i = 0; i < this.precision.length; i++) {
if (this.precision[i] >= precision) {
return new Point(i, threshold[i], this.precision[i], recall[i]);
}
}
//Not found, return last point. Should never happen though...
int i = threshold.length - 1;
return new Point(i, threshold[i], this.precision[i], this.recall[i]);
} | [
"public",
"Point",
"getPointAtPrecision",
"(",
"double",
"precision",
")",
"{",
"//Find the LOWEST threshold that gives the specified precision",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"precision",
".",
"length",
";",
"i",
"++",
")",
"{",
... | Get the point (index, threshold, precision, recall) at the given precision.<br>
Specifically, return the points at the lowest threshold that has precision equal to or greater than the
requested precision.
@param precision Precision to get the point for
@return point (index, threshold, precision, recall) at (or closest exceeding) the given precision | [
"Get",
"the",
"point",
"(",
"index",
"threshold",
"precision",
"recall",
")",
"at",
"the",
"given",
"precision",
".",
"<br",
">",
"Specifically",
"return",
"the",
"points",
"at",
"the",
"lowest",
"threshold",
"that",
"has",
"precision",
"equal",
"to",
"or",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/curves/PrecisionRecallCurve.java#L162-L174 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/UsersApi.java | UsersApi.getUsers | public GetUsersSuccessResponse getUsers(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException {
ApiResponse<GetUsersSuccessResponse> resp = getUsersWithHttpInfo(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid);
return resp.getData();
} | java | public GetUsersSuccessResponse getUsers(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid) throws ApiException {
ApiResponse<GetUsersSuccessResponse> resp = getUsersWithHttpInfo(limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid);
return resp.getData();
} | [
"public",
"GetUsersSuccessResponse",
"getUsers",
"(",
"Integer",
"limit",
",",
"Integer",
"offset",
",",
"String",
"order",
",",
"String",
"sortBy",
",",
"String",
"filterName",
",",
"String",
"filterParameters",
",",
"String",
"roles",
",",
"String",
"skills",
... | Get users.
Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters.
@param limit Limit the number of users the Provisioning API should return. (optional)
@param offset The number of matches the Provisioning API should skip in the returned users. (optional)
@param order The sort order. (optional)
@param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional)
@param filterName The name of a filter to use on the results. (optional)
@param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional)
@param roles Return only users who have the Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional)
@param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional)
@param userEnabled Return only enabled or disabled users. (optional)
@param userValid Return only valid or invalid users. (optional)
@return GetUsersSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"users",
".",
"Get",
"[",
"CfgPerson",
"]",
"(",
"https",
":",
"//",
"docs",
".",
"genesys",
".",
"com",
"/",
"Documentation",
"/",
"PSDK",
"/",
"latest",
"/",
"ConfigLayerRef",
"/",
"CfgPerson",
")",
"objects",
"based",
"on",
"the",
"specified",
... | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/UsersApi.java#L652-L655 |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.executeVariableAccess | private RValue executeVariableAccess(Expr.VariableAccess expr, CallStack frame) {
Decl.Variable decl = expr.getVariableDeclaration();
return frame.getLocal(decl.getName());
} | java | private RValue executeVariableAccess(Expr.VariableAccess expr, CallStack frame) {
Decl.Variable decl = expr.getVariableDeclaration();
return frame.getLocal(decl.getName());
} | [
"private",
"RValue",
"executeVariableAccess",
"(",
"Expr",
".",
"VariableAccess",
"expr",
",",
"CallStack",
"frame",
")",
"{",
"Decl",
".",
"Variable",
"decl",
"=",
"expr",
".",
"getVariableDeclaration",
"(",
")",
";",
"return",
"frame",
".",
"getLocal",
"(",
... | Execute a variable access expression at a given point in the function or
method body. This simply loads the value of the given variable from the
frame.
@param expr
--- The expression to execute
@param frame
--- The current stack frame
@return | [
"Execute",
"a",
"variable",
"access",
"expression",
"at",
"a",
"given",
"point",
"in",
"the",
"function",
"or",
"method",
"body",
".",
"This",
"simply",
"loads",
"the",
"value",
"of",
"the",
"given",
"variable",
"from",
"the",
"frame",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L813-L816 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Base64.setInitialBuffer | void setInitialBuffer(byte[] out, int outPos, int outAvail) {
// We can re-use consumer's original output array under
// special circumstances, saving on some System.arraycopy().
if (out != null && out.length == outAvail) {
buffer = out;
pos = outPos;
readPos = outPos;
}
} | java | void setInitialBuffer(byte[] out, int outPos, int outAvail) {
// We can re-use consumer's original output array under
// special circumstances, saving on some System.arraycopy().
if (out != null && out.length == outAvail) {
buffer = out;
pos = outPos;
readPos = outPos;
}
} | [
"void",
"setInitialBuffer",
"(",
"byte",
"[",
"]",
"out",
",",
"int",
"outPos",
",",
"int",
"outAvail",
")",
"{",
"// We can re-use consumer's original output array under",
"// special circumstances, saving on some System.arraycopy().",
"if",
"(",
"out",
"!=",
"null",
"&&... | Sets the streaming buffer. This is a small optimization where we try to buffer directly to the consumer's output
array for one round (if the consumer calls this method first) instead of starting our own buffer.
@param out
byte[] array to buffer directly to.
@param outPos
Position to start buffering into.
@param outAvail
Amount of bytes available for direct buffering. | [
"Sets",
"the",
"streaming",
"buffer",
".",
"This",
"is",
"a",
"small",
"optimization",
"where",
"we",
"try",
"to",
"buffer",
"directly",
"to",
"the",
"consumer",
"s",
"output",
"array",
"for",
"one",
"round",
"(",
"if",
"the",
"consumer",
"calls",
"this",
... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java#L419-L427 |
Alluxio/alluxio | core/base/src/main/java/alluxio/collections/IndexedSet.java | IndexedSet.contains | public <V> boolean contains(IndexDefinition<T, V> indexDefinition, V value) {
FieldIndex<T, V> index = (FieldIndex<T, V>) mIndices.get(indexDefinition);
if (index == null) {
throw new IllegalStateException("the given index isn't defined for this IndexedSet");
}
return index.containsField(value);
} | java | public <V> boolean contains(IndexDefinition<T, V> indexDefinition, V value) {
FieldIndex<T, V> index = (FieldIndex<T, V>) mIndices.get(indexDefinition);
if (index == null) {
throw new IllegalStateException("the given index isn't defined for this IndexedSet");
}
return index.containsField(value);
} | [
"public",
"<",
"V",
">",
"boolean",
"contains",
"(",
"IndexDefinition",
"<",
"T",
",",
"V",
">",
"indexDefinition",
",",
"V",
"value",
")",
"{",
"FieldIndex",
"<",
"T",
",",
"V",
">",
"index",
"=",
"(",
"FieldIndex",
"<",
"T",
",",
"V",
">",
")",
... | Whether there is an object with the specified index field value in the set.
@param indexDefinition the field index definition
@param value the field value
@param <V> the field type
@return true if there is one such object, otherwise false | [
"Whether",
"there",
"is",
"an",
"object",
"with",
"the",
"specified",
"index",
"field",
"value",
"in",
"the",
"set",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/collections/IndexedSet.java#L247-L253 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.newWriter | public static BufferedWriter newWriter(File file, String charset) throws IOException {
return newWriter(file, charset, false);
} | java | public static BufferedWriter newWriter(File file, String charset) throws IOException {
return newWriter(file, charset, false);
} | [
"public",
"static",
"BufferedWriter",
"newWriter",
"(",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"newWriter",
"(",
"file",
",",
"charset",
",",
"false",
")",
";",
"}"
] | Creates a buffered writer for this file, writing data without writing a
BOM, using a specified encoding.
@param file a File
@param charset the name of the encoding used to write in this file
@return a BufferedWriter
@throws IOException if an IOException occurs.
@since 1.0 | [
"Creates",
"a",
"buffered",
"writer",
"for",
"this",
"file",
"writing",
"data",
"without",
"writing",
"a",
"BOM",
"using",
"a",
"specified",
"encoding",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1972-L1974 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.developmentDefault | public static ThrottledApiHandler developmentDefault(Shard shard, String token) {
return new ThrottledApiHandler(shard, token,
new Limit(10, 10, TimeUnit.SECONDS),
new Limit(500, 10, TimeUnit.MINUTES));
} | java | public static ThrottledApiHandler developmentDefault(Shard shard, String token) {
return new ThrottledApiHandler(shard, token,
new Limit(10, 10, TimeUnit.SECONDS),
new Limit(500, 10, TimeUnit.MINUTES));
} | [
"public",
"static",
"ThrottledApiHandler",
"developmentDefault",
"(",
"Shard",
"shard",
",",
"String",
"token",
")",
"{",
"return",
"new",
"ThrottledApiHandler",
"(",
"shard",
",",
"token",
",",
"new",
"Limit",
"(",
"10",
",",
"10",
",",
"TimeUnit",
".",
"SE... | Returns a throttled api handler with the current development request limits,
which is 10 requests per 10 seconds and 500 requests per 10 minutes
@param shard The target server
@param token The api key
@return The api handler | [
"Returns",
"a",
"throttled",
"api",
"handler",
"with",
"the",
"current",
"development",
"request",
"limits",
"which",
"is",
"10",
"requests",
"per",
"10",
"seconds",
"and",
"500",
"requests",
"per",
"10",
"minutes"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1379-L1383 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java | ActivationCodeGen.writeMef | private void writeMef(Definition def, Writer out, int indent) throws IOException
{
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Get message endpoint factory\n");
writeWithIndent(out, indent, " * @return Message endpoint factory\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "public MessageEndpointFactory getMessageEndpointFactory()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return endpointFactory;");
writeRightCurlyBracket(out, indent);
writeEol(out);
} | java | private void writeMef(Definition def, Writer out, int indent) throws IOException
{
writeWithIndent(out, indent, "/**\n");
writeWithIndent(out, indent, " * Get message endpoint factory\n");
writeWithIndent(out, indent, " * @return Message endpoint factory\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "public MessageEndpointFactory getMessageEndpointFactory()");
writeLeftCurlyBracket(out, indent);
writeWithIndent(out, indent + 1, "return endpointFactory;");
writeRightCurlyBracket(out, indent);
writeEol(out);
} | [
"private",
"void",
"writeMef",
"(",
"Definition",
"def",
",",
"Writer",
"out",
",",
"int",
"indent",
")",
"throws",
"IOException",
"{",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"/**\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
... | Output message endpoint factory method
@param def definition
@param out Writer
@param indent space number
@throws IOException ioException | [
"Output",
"message",
"endpoint",
"factory",
"method"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java#L159-L172 |
bramp/ffmpeg-cli-wrapper | src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegStreamBuilder.java | AbstractFFmpegStreamBuilder.setStartOffset | public T setStartOffset(long offset, TimeUnit units) {
checkNotNull(units);
this.startOffset = units.toMillis(offset);
return getThis();
} | java | public T setStartOffset(long offset, TimeUnit units) {
checkNotNull(units);
this.startOffset = units.toMillis(offset);
return getThis();
} | [
"public",
"T",
"setStartOffset",
"(",
"long",
"offset",
",",
"TimeUnit",
"units",
")",
"{",
"checkNotNull",
"(",
"units",
")",
";",
"this",
".",
"startOffset",
"=",
"units",
".",
"toMillis",
"(",
"offset",
")",
";",
"return",
"getThis",
"(",
")",
";",
... | Decodes but discards input until the offset.
@param offset The offset
@param units The units the offset is in
@return this | [
"Decodes",
"but",
"discards",
"input",
"until",
"the",
"offset",
"."
] | train | https://github.com/bramp/ffmpeg-cli-wrapper/blob/3819b155edf9132acc75bb6af66dcef1b98c64b2/src/main/java/net/bramp/ffmpeg/builder/AbstractFFmpegStreamBuilder.java#L432-L438 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/JensenShannonDistance.java | JensenShannonDistance.prepare | final public StringWrapper prepare(String s) {
BagOfTokens bag = new BagOfTokens(s, tokenizer.tokenize(s));
double totalWeight = bag.getTotalWeight();
for (Iterator i=bag.tokenIterator(); i.hasNext(); ) {
Token tok = (Token)i.next();
double freq = bag.getWeight(tok);
bag.setWeight( tok, smoothedProbability(tok, freq, totalWeight) );
}
return bag;
} | java | final public StringWrapper prepare(String s) {
BagOfTokens bag = new BagOfTokens(s, tokenizer.tokenize(s));
double totalWeight = bag.getTotalWeight();
for (Iterator i=bag.tokenIterator(); i.hasNext(); ) {
Token tok = (Token)i.next();
double freq = bag.getWeight(tok);
bag.setWeight( tok, smoothedProbability(tok, freq, totalWeight) );
}
return bag;
} | [
"final",
"public",
"StringWrapper",
"prepare",
"(",
"String",
"s",
")",
"{",
"BagOfTokens",
"bag",
"=",
"new",
"BagOfTokens",
"(",
"s",
",",
"tokenizer",
".",
"tokenize",
"(",
"s",
")",
")",
";",
"double",
"totalWeight",
"=",
"bag",
".",
"getTotalWeight",
... | Preprocess a string by finding tokens and giving them weights W
such that W is the smoothed probability of the token appearing
in the document. | [
"Preprocess",
"a",
"string",
"by",
"finding",
"tokens",
"and",
"giving",
"them",
"weights",
"W",
"such",
"that",
"W",
"is",
"the",
"smoothed",
"probability",
"of",
"the",
"token",
"appearing",
"in",
"the",
"document",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/JensenShannonDistance.java#L50-L59 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.lookup | public PathImpl lookup(String userPath, Map<String,Object> newAttributes)
{
if (newAttributes != null) {
return lookupImpl(userPath, newAttributes, true);
}
else if (userPath == null) {
return this;
}
PathImpl path = getCache(userPath);
if (path != null) {
return path;
}
path = lookupImpl(userPath, null, true);
if (_startTime == 0) {
_startTime = System.currentTimeMillis();
putCache(userPath, path);
}
return path;
} | java | public PathImpl lookup(String userPath, Map<String,Object> newAttributes)
{
if (newAttributes != null) {
return lookupImpl(userPath, newAttributes, true);
}
else if (userPath == null) {
return this;
}
PathImpl path = getCache(userPath);
if (path != null) {
return path;
}
path = lookupImpl(userPath, null, true);
if (_startTime == 0) {
_startTime = System.currentTimeMillis();
putCache(userPath, path);
}
return path;
} | [
"public",
"PathImpl",
"lookup",
"(",
"String",
"userPath",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"newAttributes",
")",
"{",
"if",
"(",
"newAttributes",
"!=",
"null",
")",
"{",
"return",
"lookupImpl",
"(",
"userPath",
",",
"newAttributes",
",",
"tr... | Returns a new path relative to the current one.
<p>Path only handles scheme:xxx. Subclasses of Path will specialize
the xxx.
@param userPath relative or absolute path, essentially any url.
@param newAttributes attributes for the new path.
@return the new path or null if the scheme doesn't exist | [
"Returns",
"a",
"new",
"path",
"relative",
"to",
"the",
"current",
"one",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L184-L208 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.