repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
Impetus/Kundera | src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java | ESClient.getKeyAsString | private String getKeyAsString(Object id, EntityMetadata metadata, MetamodelImpl metaModel)
{
if (metaModel.isEmbeddable(((AbstractAttribute) metadata.getIdAttribute()).getBindableJavaType()))
{
return KunderaCoreUtils.prepareCompositeKey(metadata, id);
}
return id.toString();
} | java | private String getKeyAsString(Object id, EntityMetadata metadata, MetamodelImpl metaModel)
{
if (metaModel.isEmbeddable(((AbstractAttribute) metadata.getIdAttribute()).getBindableJavaType()))
{
return KunderaCoreUtils.prepareCompositeKey(metadata, id);
}
return id.toString();
} | [
"private",
"String",
"getKeyAsString",
"(",
"Object",
"id",
",",
"EntityMetadata",
"metadata",
",",
"MetamodelImpl",
"metaModel",
")",
"{",
"if",
"(",
"metaModel",
".",
"isEmbeddable",
"(",
"(",
"(",
"AbstractAttribute",
")",
"metadata",
".",
"getIdAttribute",
"... | Gets the key as string.
@param id
the id
@param metadata
the metadata
@param metaModel
the meta model
@return the key as string | [
"Gets",
"the",
"key",
"as",
"string",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java#L883-L890 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.mixColors | public static int mixColors(float t, int rgb1, int rgb2) {
int a1 = (rgb1 >> 24) & 0xff;
int r1 = (rgb1 >> 16) & 0xff;
int g1 = (rgb1 >> 8) & 0xff;
int b1 = rgb1 & 0xff;
int a2 = (rgb2 >> 24) & 0xff;
int r2 = (rgb2 >> 16) & 0xff;
int g2 = (rgb2 >> 8) & 0xff;
int b2 = rgb2 & 0xff;
a1 = lerp(t, a1, a2);
r1 = lerp(t, r1, r2);
g1 = lerp(t, g1, g2);
b1 = lerp(t, b1, b2);
return (a1 << 24) | (r1 << 16) | (g1 << 8) | b1;
} | java | public static int mixColors(float t, int rgb1, int rgb2) {
int a1 = (rgb1 >> 24) & 0xff;
int r1 = (rgb1 >> 16) & 0xff;
int g1 = (rgb1 >> 8) & 0xff;
int b1 = rgb1 & 0xff;
int a2 = (rgb2 >> 24) & 0xff;
int r2 = (rgb2 >> 16) & 0xff;
int g2 = (rgb2 >> 8) & 0xff;
int b2 = rgb2 & 0xff;
a1 = lerp(t, a1, a2);
r1 = lerp(t, r1, r2);
g1 = lerp(t, g1, g2);
b1 = lerp(t, b1, b2);
return (a1 << 24) | (r1 << 16) | (g1 << 8) | b1;
} | [
"public",
"static",
"int",
"mixColors",
"(",
"float",
"t",
",",
"int",
"rgb1",
",",
"int",
"rgb2",
")",
"{",
"int",
"a1",
"=",
"(",
"rgb1",
">>",
"24",
")",
"&",
"0xff",
";",
"int",
"r1",
"=",
"(",
"rgb1",
">>",
"16",
")",
"&",
"0xff",
";",
"... | Linear interpolation of ARGB values.
@param t the interpolation parameter
@param rgb1 the lower interpolation range
@param rgb2 the upper interpolation range
@return the interpolated value | [
"Linear",
"interpolation",
"of",
"ARGB",
"values",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L266-L280 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/neigh/adv/DisjointMultiAdditionNeighbourhood.java | DisjointMultiAdditionNeighbourhood.getRandomMove | @Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// get set of candidate IDs for addition (fixed IDs are discarded)
Set<Integer> addCandidates = getAddCandidates(solution);
// compute number of additions
int curNumAdd = numAdditions(addCandidates, solution);
// return null if no additions are possible
if(curNumAdd == 0){
return null;
}
// pick random IDs to add to selection
Set<Integer> add = SetUtilities.getRandomSubset(addCandidates, curNumAdd, rnd);
// create and return move
return new GeneralSubsetMove(add, Collections.emptySet());
} | java | @Override
public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) {
// get set of candidate IDs for addition (fixed IDs are discarded)
Set<Integer> addCandidates = getAddCandidates(solution);
// compute number of additions
int curNumAdd = numAdditions(addCandidates, solution);
// return null if no additions are possible
if(curNumAdd == 0){
return null;
}
// pick random IDs to add to selection
Set<Integer> add = SetUtilities.getRandomSubset(addCandidates, curNumAdd, rnd);
// create and return move
return new GeneralSubsetMove(add, Collections.emptySet());
} | [
"@",
"Override",
"public",
"SubsetMove",
"getRandomMove",
"(",
"SubsetSolution",
"solution",
",",
"Random",
"rnd",
")",
"{",
"// get set of candidate IDs for addition (fixed IDs are discarded)",
"Set",
"<",
"Integer",
">",
"addCandidates",
"=",
"getAddCandidates",
"(",
"s... | Generates a move for the given subset solution that selects a random subset of currently unselected IDs.
Whenever possible, the requested number of additions is performed. However, taking into account the current
number of unselected items, the imposed maximum subset size (if set) and the fixed IDs (if any) may result in
fewer additions (as many as possible). If no items can be added, <code>null</code> is returned.
@param solution solution for which a random multi addition move is generated
@param rnd source of randomness used to generate random move
@return random multi addition move, <code>null</code> if no items can be added | [
"Generates",
"a",
"move",
"for",
"the",
"given",
"subset",
"solution",
"that",
"selects",
"a",
"random",
"subset",
"of",
"currently",
"unselected",
"IDs",
".",
"Whenever",
"possible",
"the",
"requested",
"number",
"of",
"additions",
"is",
"performed",
".",
"Ho... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/adv/DisjointMultiAdditionNeighbourhood.java#L147-L161 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/date/GosuDateUtil.java | GosuDateUtil.addYears | public static Date addYears(Date date, int iYears) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.YEAR, iYears);
return dateTime.getTime();
} | java | public static Date addYears(Date date, int iYears) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.YEAR, iYears);
return dateTime.getTime();
} | [
"public",
"static",
"Date",
"addYears",
"(",
"Date",
"date",
",",
"int",
"iYears",
")",
"{",
"Calendar",
"dateTime",
"=",
"dateToCalendar",
"(",
"date",
")",
";",
"dateTime",
".",
"add",
"(",
"Calendar",
".",
"YEAR",
",",
"iYears",
")",
";",
"return",
... | Adds the specified (signed) amount of years to the given date. For
example, to subtract 5 years from the current date, you can
achieve it by calling: <code>addYears(Date, -5)</code>.
@param date The time.
@param iYears The amount of years to add.
@return A new date with the years added. | [
"Adds",
"the",
"specified",
"(",
"signed",
")",
"amount",
"of",
"years",
"to",
"the",
"given",
"date",
".",
"For",
"example",
"to",
"subtract",
"5",
"years",
"from",
"the",
"current",
"date",
"you",
"can",
"achieve",
"it",
"by",
"calling",
":",
"<code",
... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/date/GosuDateUtil.java#L125-L129 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/Slice.java | Slice.toByteBuffer | public ByteBuffer toByteBuffer(int index, int length)
{
checkPositionIndexes(index, index + length, this.length);
index += offset;
return ByteBuffer.wrap(data, index, length).order(LITTLE_ENDIAN);
} | java | public ByteBuffer toByteBuffer(int index, int length)
{
checkPositionIndexes(index, index + length, this.length);
index += offset;
return ByteBuffer.wrap(data, index, length).order(LITTLE_ENDIAN);
} | [
"public",
"ByteBuffer",
"toByteBuffer",
"(",
"int",
"index",
",",
"int",
"length",
")",
"{",
"checkPositionIndexes",
"(",
"index",
",",
"index",
"+",
"length",
",",
"this",
".",
"length",
")",
";",
"index",
"+=",
"offset",
";",
"return",
"ByteBuffer",
".",... | Converts this buffer's sub-region into a NIO buffer. The returned
buffer shares the content with this buffer. | [
"Converts",
"this",
"buffer",
"s",
"sub",
"-",
"region",
"into",
"a",
"NIO",
"buffer",
".",
"The",
"returned",
"buffer",
"shares",
"the",
"content",
"with",
"this",
"buffer",
"."
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L613-L618 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.pbarStd | public static double pbarStd(double pbar, int sampleN) {
return Math.sqrt(pbarVariance(pbar, sampleN, Integer.MAX_VALUE));
} | java | public static double pbarStd(double pbar, int sampleN) {
return Math.sqrt(pbarVariance(pbar, sampleN, Integer.MAX_VALUE));
} | [
"public",
"static",
"double",
"pbarStd",
"(",
"double",
"pbar",
",",
"int",
"sampleN",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"pbarVariance",
"(",
"pbar",
",",
"sampleN",
",",
"Integer",
".",
"MAX_VALUE",
")",
")",
";",
"}"
] | Calculates Standard Deviation for Pbar for infinite population size
@param pbar
@param sampleN
@return | [
"Calculates",
"Standard",
"Deviation",
"for",
"Pbar",
"for",
"infinite",
"population",
"size"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L230-L232 |
korpling/ANNIS | annis-libgui/src/main/java/annis/libgui/AnnisBaseUI.java | AnnisBaseUI.handleCommonError | public static boolean handleCommonError(Throwable ex, String action)
{
if(ex != null)
{
Throwable rootCause = ex;
while(rootCause.getCause() != null)
{
rootCause = rootCause.getCause();
}
if(rootCause instanceof UniformInterfaceException)
{
UniformInterfaceException uniEx = (UniformInterfaceException) rootCause;
if(uniEx.getResponse() != null)
{
if(uniEx.getResponse().getStatus() == 503)
{
// database connection error
Notification n = new Notification(
"Can't execute " + (action == null ? "" : "\"" + action + "\"" )
+ " action because database server is not responding.<br/>"
+ "There might be too many users using this service right now.",
Notification.Type.WARNING_MESSAGE);
n.setDescription("<p><strong>Please try again later.</strong> If the error persists inform the administrator of this server.</p>"
+ "<p>Click on this message to close it.</p>"
+ "<p style=\"font-size:9pt;color:gray;\">Pinguin picture by Polar Cruises [CC BY 2.0 (http://creativecommons.org/licenses/by/2.0)], via Wikimedia Commons</p>");
n.setIcon(PINGUIN_IMAGE);
n.setHtmlContentAllowed(true);
n.setDelayMsec(15000);
n.show(Page.getCurrent());
return true;
}
}
}
}
return false;
} | java | public static boolean handleCommonError(Throwable ex, String action)
{
if(ex != null)
{
Throwable rootCause = ex;
while(rootCause.getCause() != null)
{
rootCause = rootCause.getCause();
}
if(rootCause instanceof UniformInterfaceException)
{
UniformInterfaceException uniEx = (UniformInterfaceException) rootCause;
if(uniEx.getResponse() != null)
{
if(uniEx.getResponse().getStatus() == 503)
{
// database connection error
Notification n = new Notification(
"Can't execute " + (action == null ? "" : "\"" + action + "\"" )
+ " action because database server is not responding.<br/>"
+ "There might be too many users using this service right now.",
Notification.Type.WARNING_MESSAGE);
n.setDescription("<p><strong>Please try again later.</strong> If the error persists inform the administrator of this server.</p>"
+ "<p>Click on this message to close it.</p>"
+ "<p style=\"font-size:9pt;color:gray;\">Pinguin picture by Polar Cruises [CC BY 2.0 (http://creativecommons.org/licenses/by/2.0)], via Wikimedia Commons</p>");
n.setIcon(PINGUIN_IMAGE);
n.setHtmlContentAllowed(true);
n.setDelayMsec(15000);
n.show(Page.getCurrent());
return true;
}
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"handleCommonError",
"(",
"Throwable",
"ex",
",",
"String",
"action",
")",
"{",
"if",
"(",
"ex",
"!=",
"null",
")",
"{",
"Throwable",
"rootCause",
"=",
"ex",
";",
"while",
"(",
"rootCause",
".",
"getCause",
"(",
")",
"!=",
... | Handle common errors like database/service connection problems and display a unified
error message.
This will not log the exception, only display information to the user.
@param ex
@return True if error was handled, false otherwise. | [
"Handle",
"common",
"errors",
"like",
"database",
"/",
"service",
"connection",
"problems",
"and",
"display",
"a",
"unified",
"error",
"message",
"."
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-libgui/src/main/java/annis/libgui/AnnisBaseUI.java#L381-L421 |
davidmoten/rxjava2-extras | src/main/java/com/github/davidmoten/rx2/Strings.java | Strings.splitSimple | @Experimental
@Beta
public static <T> FlowableTransformer<String, String> splitSimple(final String delimiter) {
return new FlowableTransformer<String, String>() {
@Override
public Publisher<String> apply(Flowable<String> source) {
return new FlowableStringSplitSimple(source, delimiter);
}
};
} | java | @Experimental
@Beta
public static <T> FlowableTransformer<String, String> splitSimple(final String delimiter) {
return new FlowableTransformer<String, String>() {
@Override
public Publisher<String> apply(Flowable<String> source) {
return new FlowableStringSplitSimple(source, delimiter);
}
};
} | [
"@",
"Experimental",
"@",
"Beta",
"public",
"static",
"<",
"T",
">",
"FlowableTransformer",
"<",
"String",
",",
"String",
">",
"splitSimple",
"(",
"final",
"String",
"delimiter",
")",
"{",
"return",
"new",
"FlowableTransformer",
"<",
"String",
",",
"String",
... | Splits on a string delimiter, not a pattern. Is slower than RxJavaString
1.1.1 implementation on benchmarks below but requests minimally from
upstream and is potentially much faster when the stream is significantly truncated
(for example by downstream {@code .take(), .takeUntil(), elementAt()}.
<pre>
Benchmark Mode Cnt Score Error Units
Benchmarks.splitRxJavaString thrpt 10 983.128 ± 23.833 ops/s
Benchmarks.splitRxJavaStringTake5 thrpt 10 1033.090 ± 33.083 ops/s
Benchmarks.splitSimple thrpt 10 113.727 ± 2.122 ops/s
Benchmarks.splitSimpleTake5 thrpt 10 867527.265 ± 27168.498 ops/s
Benchmarks.splitStandard thrpt 10 108.880 ± 4.428 ops/s
Benchmarks.splitStandardTake5 thrpt 10 1217.798 ± 44.237 ops/s
Benchmarks.splitStandardWithPattern thrpt 10 102.882 ± 5.083 ops/s
Benchmarks.splitStandardWithPatternTake5 thrpt 10 1054.024 ± 27.906 ops/s
</pre>
@param delimiter
string delimiter
@param <T>
type being streamed
@return stream split by delimiter | [
"Splits",
"on",
"a",
"string",
"delimiter",
"not",
"a",
"pattern",
".",
"Is",
"slower",
"than",
"RxJavaString",
"1",
".",
"1",
".",
"1",
"implementation",
"on",
"benchmarks",
"below",
"but",
"requests",
"minimally",
"from",
"upstream",
"and",
"is",
"potentia... | train | https://github.com/davidmoten/rxjava2-extras/blob/bf5ece3f97191f29a81957a6529bc3cfa4d7b328/src/main/java/com/github/davidmoten/rx2/Strings.java#L359-L369 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/property/GeoPackageJavaProperties.java | GeoPackageJavaProperties.getBooleanProperty | public static Boolean getBooleanProperty(String key, boolean required) {
Boolean value = null;
String stringValue = getProperty(key, required);
if (stringValue != null) {
value = Boolean.valueOf(stringValue);
}
return value;
} | java | public static Boolean getBooleanProperty(String key, boolean required) {
Boolean value = null;
String stringValue = getProperty(key, required);
if (stringValue != null) {
value = Boolean.valueOf(stringValue);
}
return value;
} | [
"public",
"static",
"Boolean",
"getBooleanProperty",
"(",
"String",
"key",
",",
"boolean",
"required",
")",
"{",
"Boolean",
"value",
"=",
"null",
";",
"String",
"stringValue",
"=",
"getProperty",
"(",
"key",
",",
"required",
")",
";",
"if",
"(",
"stringValue... | Get a boolean by key
@param key
key
@param required
required flag
@return property value | [
"Get",
"a",
"boolean",
"by",
"key"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/property/GeoPackageJavaProperties.java#L228-L235 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/AlarmManager.java | AlarmManager.acknowledgeAlarm | public void acknowledgeAlarm(Alarm alarm, ManagedEntity entity) throws RuntimeFault, RemoteException {
getVimService().acknowledgeAlarm(getMOR(), alarm.getMOR(), entity.getMOR());
} | java | public void acknowledgeAlarm(Alarm alarm, ManagedEntity entity) throws RuntimeFault, RemoteException {
getVimService().acknowledgeAlarm(getMOR(), alarm.getMOR(), entity.getMOR());
} | [
"public",
"void",
"acknowledgeAlarm",
"(",
"Alarm",
"alarm",
",",
"ManagedEntity",
"entity",
")",
"throws",
"RuntimeFault",
",",
"RemoteException",
"{",
"getVimService",
"(",
")",
".",
"acknowledgeAlarm",
"(",
"getMOR",
"(",
")",
",",
"alarm",
".",
"getMOR",
"... | Acknowledge the alarm for a managed entity.
@param alarm
The {@link Alarm} to acknowledge.
@param entity
The {@link ManagedEntity} which the alarm applies to.
@throws RuntimeFault
if any unhandled runtime fault occurs
@throws RemoteException
@since 4.0 | [
"Acknowledge",
"the",
"alarm",
"for",
"a",
"managed",
"entity",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/AlarmManager.java#L75-L77 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java | StringUtil.ensureIncludesAt | static String ensureIncludesAt(String pSource, String pSubstring, int pPosition) {
StringBuilder newString = new StringBuilder(pSource);
try {
String existingSubstring = pSource.substring(pPosition, pPosition + pSubstring.length());
if (!existingSubstring.equalsIgnoreCase(pSubstring)) {
newString.insert(pPosition, pSubstring);
}
}
catch (Exception e) {
// Do something!?
}
return newString.toString();
} | java | static String ensureIncludesAt(String pSource, String pSubstring, int pPosition) {
StringBuilder newString = new StringBuilder(pSource);
try {
String existingSubstring = pSource.substring(pPosition, pPosition + pSubstring.length());
if (!existingSubstring.equalsIgnoreCase(pSubstring)) {
newString.insert(pPosition, pSubstring);
}
}
catch (Exception e) {
// Do something!?
}
return newString.toString();
} | [
"static",
"String",
"ensureIncludesAt",
"(",
"String",
"pSource",
",",
"String",
"pSubstring",
",",
"int",
"pPosition",
")",
"{",
"StringBuilder",
"newString",
"=",
"new",
"StringBuilder",
"(",
"pSource",
")",
";",
"try",
"{",
"String",
"existingSubstring",
"=",... | Ensures that a string includes a given substring at a given position.
<p/>
Extends the string with a given string if it is not already there.
E.g an URL "www.vg.no", to "http://www.vg.no".
@param pSource The source string.
@param pSubstring The substring to include.
@param pPosition The location of the fill-in, the index starts with 0.
@return the string, with the substring at the given location. | [
"Ensures",
"that",
"a",
"string",
"includes",
"a",
"given",
"substring",
"at",
"a",
"given",
"position",
".",
"<p",
"/",
">",
"Extends",
"the",
"string",
"with",
"a",
"given",
"string",
"if",
"it",
"is",
"not",
"already",
"there",
".",
"E",
".",
"g",
... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/lang/StringUtil.java#L1368-L1382 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java | EventHubConnectionsInner.beginCreateOrUpdateAsync | public Observable<EventHubConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() {
@Override
public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<EventHubConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() {
@Override
public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EventHubConnectionInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"databaseName",
",",
"String",
"eventHubConnectionName",
",",
"EventHubConnectionInner",
"parameters",
"... | Creates or updates a Event Hub connection.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@param eventHubConnectionName The name of the event hub connection.
@param parameters The Event Hub connection parameters supplied to the CreateOrUpdate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EventHubConnectionInner object | [
"Creates",
"or",
"updates",
"a",
"Event",
"Hub",
"connection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L535-L542 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/BigendianEncoding.java | BigendianEncoding.longFromBase16String | static long longFromBase16String(CharSequence chars, int offset) {
Utils.checkArgument(chars.length() >= offset + LONG_BASE16, "chars too small");
return (decodeByte(chars.charAt(offset), chars.charAt(offset + 1)) & 0xFFL) << 56
| (decodeByte(chars.charAt(offset + 2), chars.charAt(offset + 3)) & 0xFFL) << 48
| (decodeByte(chars.charAt(offset + 4), chars.charAt(offset + 5)) & 0xFFL) << 40
| (decodeByte(chars.charAt(offset + 6), chars.charAt(offset + 7)) & 0xFFL) << 32
| (decodeByte(chars.charAt(offset + 8), chars.charAt(offset + 9)) & 0xFFL) << 24
| (decodeByte(chars.charAt(offset + 10), chars.charAt(offset + 11)) & 0xFFL) << 16
| (decodeByte(chars.charAt(offset + 12), chars.charAt(offset + 13)) & 0xFFL) << 8
| (decodeByte(chars.charAt(offset + 14), chars.charAt(offset + 15)) & 0xFFL);
} | java | static long longFromBase16String(CharSequence chars, int offset) {
Utils.checkArgument(chars.length() >= offset + LONG_BASE16, "chars too small");
return (decodeByte(chars.charAt(offset), chars.charAt(offset + 1)) & 0xFFL) << 56
| (decodeByte(chars.charAt(offset + 2), chars.charAt(offset + 3)) & 0xFFL) << 48
| (decodeByte(chars.charAt(offset + 4), chars.charAt(offset + 5)) & 0xFFL) << 40
| (decodeByte(chars.charAt(offset + 6), chars.charAt(offset + 7)) & 0xFFL) << 32
| (decodeByte(chars.charAt(offset + 8), chars.charAt(offset + 9)) & 0xFFL) << 24
| (decodeByte(chars.charAt(offset + 10), chars.charAt(offset + 11)) & 0xFFL) << 16
| (decodeByte(chars.charAt(offset + 12), chars.charAt(offset + 13)) & 0xFFL) << 8
| (decodeByte(chars.charAt(offset + 14), chars.charAt(offset + 15)) & 0xFFL);
} | [
"static",
"long",
"longFromBase16String",
"(",
"CharSequence",
"chars",
",",
"int",
"offset",
")",
"{",
"Utils",
".",
"checkArgument",
"(",
"chars",
".",
"length",
"(",
")",
">=",
"offset",
"+",
"LONG_BASE16",
",",
"\"chars too small\"",
")",
";",
"return",
... | Returns the {@code long} value whose base16 representation is stored in the first 16 chars of
{@code chars} starting from the {@code offset}.
@param chars the base16 representation of the {@code long}.
@param offset the starting offset in the {@code CharSequence}. | [
"Returns",
"the",
"{",
"@code",
"long",
"}",
"value",
"whose",
"base16",
"representation",
"is",
"stored",
"in",
"the",
"first",
"16",
"chars",
"of",
"{",
"@code",
"chars",
"}",
"starting",
"from",
"the",
"{",
"@code",
"offset",
"}",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/BigendianEncoding.java#L98-L108 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/java/Java.java | Java.createSource | public static synchronized void createSource(Java._ClassBody clazz)
throws IOException {
if (baseDir == null) {
throw new IOException("Base directory for output not set, use 'setBaseDirectory'");
}
String pkg = clazz.getPackage();
if (pkg == null) {
pkg = "";
// throw new IOException("Class package cannot be null");
}
pkg = pkg.replace('.', '/');
File path = new File(baseDir, pkg);
path.mkdirs();
try (PrintWriter fp = new PrintWriter(new FileWriter(new File(path, clazz.getName() + ".java")))) {
clazz.emit(0, fp);
}
} | java | public static synchronized void createSource(Java._ClassBody clazz)
throws IOException {
if (baseDir == null) {
throw new IOException("Base directory for output not set, use 'setBaseDirectory'");
}
String pkg = clazz.getPackage();
if (pkg == null) {
pkg = "";
// throw new IOException("Class package cannot be null");
}
pkg = pkg.replace('.', '/');
File path = new File(baseDir, pkg);
path.mkdirs();
try (PrintWriter fp = new PrintWriter(new FileWriter(new File(path, clazz.getName() + ".java")))) {
clazz.emit(0, fp);
}
} | [
"public",
"static",
"synchronized",
"void",
"createSource",
"(",
"Java",
".",
"_ClassBody",
"clazz",
")",
"throws",
"IOException",
"{",
"if",
"(",
"baseDir",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Base directory for output not set, use 'setBa... | Create the source file for a given class
@param clazz is the class description
@throws java.io.IOException | [
"Create",
"the",
"source",
"file",
"for",
"a",
"given",
"class"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/java/Java.java#L74-L91 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.arc | public void arc(float x1, float y1, float x2, float y2, float startAng, float extent) {
ArrayList ar = bezierArc(x1, y1, x2, y2, startAng, extent);
if (ar.isEmpty())
return;
float pt[] = (float [])ar.get(0);
moveTo(pt[0], pt[1]);
for (int k = 0; k < ar.size(); ++k) {
pt = (float [])ar.get(k);
curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]);
}
} | java | public void arc(float x1, float y1, float x2, float y2, float startAng, float extent) {
ArrayList ar = bezierArc(x1, y1, x2, y2, startAng, extent);
if (ar.isEmpty())
return;
float pt[] = (float [])ar.get(0);
moveTo(pt[0], pt[1]);
for (int k = 0; k < ar.size(); ++k) {
pt = (float [])ar.get(k);
curveTo(pt[2], pt[3], pt[4], pt[5], pt[6], pt[7]);
}
} | [
"public",
"void",
"arc",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
",",
"float",
"startAng",
",",
"float",
"extent",
")",
"{",
"ArrayList",
"ar",
"=",
"bezierArc",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
... | Draws a partial ellipse inscribed within the rectangle x1,y1,x2,y2,
starting at startAng degrees and covering extent degrees. Angles
start with 0 to the right (+x) and increase counter-clockwise.
@param x1 a corner of the enclosing rectangle
@param y1 a corner of the enclosing rectangle
@param x2 a corner of the enclosing rectangle
@param y2 a corner of the enclosing rectangle
@param startAng starting angle in degrees
@param extent angle extent in degrees | [
"Draws",
"a",
"partial",
"ellipse",
"inscribed",
"within",
"the",
"rectangle",
"x1",
"y1",
"x2",
"y2",
"starting",
"at",
"startAng",
"degrees",
"and",
"covering",
"extent",
"degrees",
".",
"Angles",
"start",
"with",
"0",
"to",
"the",
"right",
"(",
"+",
"x"... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1883-L1893 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.backgroundContourColorRes | @NonNull
public IconicsDrawable backgroundContourColorRes(@ColorRes int colorResId) {
return backgroundContourColor(ContextCompat.getColor(mContext, colorResId));
} | java | @NonNull
public IconicsDrawable backgroundContourColorRes(@ColorRes int colorResId) {
return backgroundContourColor(ContextCompat.getColor(mContext, colorResId));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"backgroundContourColorRes",
"(",
"@",
"ColorRes",
"int",
"colorResId",
")",
"{",
"return",
"backgroundContourColor",
"(",
"ContextCompat",
".",
"getColor",
"(",
"mContext",
",",
"colorResId",
")",
")",
";",
"}"
] | Set background contour color from color res.
@return The current IconicsDrawable for chaining. | [
"Set",
"background",
"contour",
"color",
"from",
"color",
"res",
"."
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L743-L746 |
cfg4j/cfg4j | cfg4j-core/src/main/java/org/cfg4j/provider/ConfigurationProviderBuilder.java | ConfigurationProviderBuilder.withMetrics | public ConfigurationProviderBuilder withMetrics(MetricRegistry metricRegistry, String prefix) {
this.prefix = requireNonNull(prefix);
this.metricRegistry = metricRegistry;
return this;
} | java | public ConfigurationProviderBuilder withMetrics(MetricRegistry metricRegistry, String prefix) {
this.prefix = requireNonNull(prefix);
this.metricRegistry = metricRegistry;
return this;
} | [
"public",
"ConfigurationProviderBuilder",
"withMetrics",
"(",
"MetricRegistry",
"metricRegistry",
",",
"String",
"prefix",
")",
"{",
"this",
".",
"prefix",
"=",
"requireNonNull",
"(",
"prefix",
")",
";",
"this",
".",
"metricRegistry",
"=",
"metricRegistry",
";",
"... | Enable metrics emission for {@link ConfigurationProvider}s built by this builder. All metrics will be registered
with {@code metricRegistry} and prefixed by {@code prefix}. Provider built by this builder will emit the following metrics:
<p>Provider-level metrics:</p>
<ul>
<li>allConfigurationAsProperties</li>
<li>getProperty</li>
<li>getPropertyGeneric</li>
<li>bind</li>
</ul>
<p>Source-level metrics</p>
<ul>
<li>source.getConfiguration</li>
<li>source.init</li>
<li>source.reload</li>
</ul>
Each of those metrics is of {@link Timer} type (i.e. includes execution time percentiles, execution count, etc.)
@param metricRegistry metric registry for registering metrics
@param prefix prefix for metric names
@return this builder | [
"Enable",
"metrics",
"emission",
"for",
"{",
"@link",
"ConfigurationProvider",
"}",
"s",
"built",
"by",
"this",
"builder",
".",
"All",
"metrics",
"will",
"be",
"registered",
"with",
"{",
"@code",
"metricRegistry",
"}",
"and",
"prefixed",
"by",
"{",
"@code",
... | train | https://github.com/cfg4j/cfg4j/blob/47d4f63e5fc820c62631e557adc34a29d8ab396d/cfg4j-core/src/main/java/org/cfg4j/provider/ConfigurationProviderBuilder.java#L123-L127 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/SelectResultSet.java | SelectResultSet.createGeneratedData | public static ResultSet createGeneratedData(long[] data, Protocol protocol,
boolean findColumnReturnsOne) {
ColumnInformation[] columns = new ColumnInformation[1];
columns[0] = ColumnInformation.create("insert_id", ColumnType.BIGINT);
List<byte[]> rows = new ArrayList<>();
for (long rowData : data) {
if (rowData != 0) {
rows.add(StandardPacketInputStream.create(String.valueOf(rowData).getBytes()));
}
}
if (findColumnReturnsOne) {
return new SelectResultSet(columns, rows, protocol, TYPE_SCROLL_SENSITIVE) {
@Override
public int findColumn(String name) {
return 1;
}
};
}
return new SelectResultSet(columns, rows, protocol, TYPE_SCROLL_SENSITIVE);
} | java | public static ResultSet createGeneratedData(long[] data, Protocol protocol,
boolean findColumnReturnsOne) {
ColumnInformation[] columns = new ColumnInformation[1];
columns[0] = ColumnInformation.create("insert_id", ColumnType.BIGINT);
List<byte[]> rows = new ArrayList<>();
for (long rowData : data) {
if (rowData != 0) {
rows.add(StandardPacketInputStream.create(String.valueOf(rowData).getBytes()));
}
}
if (findColumnReturnsOne) {
return new SelectResultSet(columns, rows, protocol, TYPE_SCROLL_SENSITIVE) {
@Override
public int findColumn(String name) {
return 1;
}
};
}
return new SelectResultSet(columns, rows, protocol, TYPE_SCROLL_SENSITIVE);
} | [
"public",
"static",
"ResultSet",
"createGeneratedData",
"(",
"long",
"[",
"]",
"data",
",",
"Protocol",
"protocol",
",",
"boolean",
"findColumnReturnsOne",
")",
"{",
"ColumnInformation",
"[",
"]",
"columns",
"=",
"new",
"ColumnInformation",
"[",
"1",
"]",
";",
... | Create a result set from given data. Useful for creating "fake" resultsets for
DatabaseMetaData, (one example is MariaDbDatabaseMetaData.getTypeInfo())
@param data - each element of this array represents a complete row in the
ResultSet. Each value is given in its string representation, as in
MariaDB text protocol, except boolean (BIT(1)) values that are
represented as "1" or "0" strings
@param protocol protocol
@param findColumnReturnsOne - special parameter, used only in generated key result sets
@return resultset | [
"Create",
"a",
"result",
"set",
"from",
"given",
"data",
".",
"Useful",
"for",
"creating",
"fake",
"resultsets",
"for",
"DatabaseMetaData",
"(",
"one",
"example",
"is",
"MariaDbDatabaseMetaData",
".",
"getTypeInfo",
"()",
")"
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/SelectResultSet.java#L271-L291 |
puniverse/galaxy | src/main/java/co/paralleluniverse/common/io/Streamables.java | Streamables.fromByteArray | public static void fromByteArray(Streamable streamable, byte[] array, int offset, int length) {
try {
final ByteArrayInputStream bais = new ByteArrayInputStream(array, offset, length);
final DataInputStream dis = new DataInputStream(bais);
streamable.read(dis);
bais.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public static void fromByteArray(Streamable streamable, byte[] array, int offset, int length) {
try {
final ByteArrayInputStream bais = new ByteArrayInputStream(array, offset, length);
final DataInputStream dis = new DataInputStream(bais);
streamable.read(dis);
bais.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"fromByteArray",
"(",
"Streamable",
"streamable",
",",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"try",
"{",
"final",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
... | Reads a {@link Streamable}'s serialized contents from a byte array.
@param streamable The object whose contents are to be read.
@param array The array from which to read the serialized form.
@param offset The offset into the array from which to start reading the serialized form.
@param length The length of the serialized form to read from the array. | [
"Reads",
"a",
"{",
"@link",
"Streamable",
"}",
"s",
"serialized",
"contents",
"from",
"a",
"byte",
"array",
"."
] | train | https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/common/io/Streamables.java#L88-L97 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java | CPDefinitionOptionValueRelPersistenceImpl.findByKey | @Override
public List<CPDefinitionOptionValueRel> findByKey(String key, int start,
int end) {
return findByKey(key, start, end, null);
} | java | @Override
public List<CPDefinitionOptionValueRel> findByKey(String key, int start,
int end) {
return findByKey(key, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionOptionValueRel",
">",
"findByKey",
"(",
"String",
"key",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByKey",
"(",
"key",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp definition option value rels where key = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionOptionValueRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param key the key
@param start the lower bound of the range of cp definition option value rels
@param end the upper bound of the range of cp definition option value rels (not inclusive)
@return the range of matching cp definition option value rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"option",
"value",
"rels",
"where",
"key",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L3114-L3118 |
jhunters/jprotobuf | android/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLGenerator.java | ProtobufIDLGenerator.getIDL | public static String getIDL(final Class<?> cls, final Set<Class<?>> cachedTypes,
final Set<Class<?>> cachedEnumTypes) {
return getIDL(cls, cachedTypes, cachedEnumTypes, false);
} | java | public static String getIDL(final Class<?> cls, final Set<Class<?>> cachedTypes,
final Set<Class<?>> cachedEnumTypes) {
return getIDL(cls, cachedTypes, cachedEnumTypes, false);
} | [
"public",
"static",
"String",
"getIDL",
"(",
"final",
"Class",
"<",
"?",
">",
"cls",
",",
"final",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"cachedTypes",
",",
"final",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"cachedEnumTypes",
")",
"{",
"return",
... | get IDL content from class.
@param cls target class to parse for IDL message.
@param cachedTypes if type already in set will not generate IDL. if a new type found will add to set
@param cachedEnumTypes if enum already in set will not generate IDL. if a new enum found will add to set
@return protobuf IDL content in string
@see Protobuf | [
"get",
"IDL",
"content",
"from",
"class",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/android/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLGenerator.java#L91-L96 |
apache/groovy | subprojects/groovy-ant/src/main/java/groovy/util/AntBuilder.java | AntBuilder.doInvokeMethod | protected Object doInvokeMethod(String methodName, Object name, Object args) {
super.doInvokeMethod(methodName, name, args);
// return the completed node
return lastCompletedNode;
} | java | protected Object doInvokeMethod(String methodName, Object name, Object args) {
super.doInvokeMethod(methodName, name, args);
// return the completed node
return lastCompletedNode;
} | [
"protected",
"Object",
"doInvokeMethod",
"(",
"String",
"methodName",
",",
"Object",
"name",
",",
"Object",
"args",
")",
"{",
"super",
".",
"doInvokeMethod",
"(",
"methodName",
",",
"name",
",",
"args",
")",
";",
"// return the completed node",
"return",
"lastCo... | We don't want to return the node as created in {@link #createNode(Object, Map, Object)}
but the one made ready by {@link #nodeCompleted(Object, Object)}
@see groovy.util.BuilderSupport#doInvokeMethod(java.lang.String, java.lang.Object, java.lang.Object) | [
"We",
"don",
"t",
"want",
"to",
"return",
"the",
"node",
"as",
"created",
"in",
"{",
"@link",
"#createNode",
"(",
"Object",
"Map",
"Object",
")",
"}",
"but",
"the",
"one",
"made",
"ready",
"by",
"{",
"@link",
"#nodeCompleted",
"(",
"Object",
"Object",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-ant/src/main/java/groovy/util/AntBuilder.java#L212-L218 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.lastIndexOfIgnoreCase | public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
return lastIndexOfIgnoreCase(str, searchStr, str.length());
} | java | public static int lastIndexOfIgnoreCase(final CharSequence str, final CharSequence searchStr) {
if (str == null || searchStr == null) {
return INDEX_NOT_FOUND;
}
return lastIndexOfIgnoreCase(str, searchStr, str.length());
} | [
"public",
"static",
"int",
"lastIndexOfIgnoreCase",
"(",
"final",
"CharSequence",
"str",
",",
"final",
"CharSequence",
"searchStr",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"searchStr",
"==",
"null",
")",
"{",
"return",
"INDEX_NOT_FOUND",
";",
"}",
"r... | <p>Case in-sensitive find of the last index within a CharSequence.</p>
<p>A {@code null} CharSequence will return {@code -1}.
A negative start position returns {@code -1}.
An empty ("") search CharSequence always matches unless the start position is negative.
A start position greater than the string length searches the whole string.</p>
<pre>
StringUtils.lastIndexOfIgnoreCase(null, *) = -1
StringUtils.lastIndexOfIgnoreCase(*, null) = -1
StringUtils.lastIndexOfIgnoreCase("aabaabaa", "A") = 7
StringUtils.lastIndexOfIgnoreCase("aabaabaa", "B") = 5
StringUtils.lastIndexOfIgnoreCase("aabaabaa", "AB") = 4
</pre>
@param str the CharSequence to check, may be null
@param searchStr the CharSequence to find, may be null
@return the first index of the search CharSequence,
-1 if no match or {@code null} string input
@since 2.5
@since 3.0 Changed signature from lastIndexOfIgnoreCase(String, String) to lastIndexOfIgnoreCase(CharSequence, CharSequence) | [
"<p",
">",
"Case",
"in",
"-",
"sensitive",
"find",
"of",
"the",
"last",
"index",
"within",
"a",
"CharSequence",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L1867-L1872 |
datastax/java-driver | core/src/main/java/com/datastax/oss/driver/internal/core/channel/InFlightHandler.java | InFlightHandler.exceptionCaught | @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable exception) throws Exception {
if (exception instanceof FrameDecodingException) {
int streamId = ((FrameDecodingException) exception).streamId;
LOG.debug("[{}] Error while decoding response on stream id {}", logPrefix, streamId);
if (streamId >= 0) {
// We know which request matches the failing response, fail that one only
ResponseCallback responseCallback = inFlight.get(streamId);
if (responseCallback != null) {
try {
responseCallback.onFailure(exception.getCause());
} catch (Throwable t) {
Loggers.warnWithException(
LOG, "[{}] Unexpected error while invoking failure handler", logPrefix, t);
}
}
release(streamId, ctx);
} else {
Loggers.warnWithException(
LOG,
"[{}] Unexpected error while decoding incoming event frame",
logPrefix,
exception.getCause());
}
} else {
// Otherwise fail all pending requests
abortAllInFlight(
(exception instanceof HeartbeatException)
? (HeartbeatException) exception
: new ClosedConnectionException("Unexpected error on channel", exception));
ctx.close();
}
} | java | @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable exception) throws Exception {
if (exception instanceof FrameDecodingException) {
int streamId = ((FrameDecodingException) exception).streamId;
LOG.debug("[{}] Error while decoding response on stream id {}", logPrefix, streamId);
if (streamId >= 0) {
// We know which request matches the failing response, fail that one only
ResponseCallback responseCallback = inFlight.get(streamId);
if (responseCallback != null) {
try {
responseCallback.onFailure(exception.getCause());
} catch (Throwable t) {
Loggers.warnWithException(
LOG, "[{}] Unexpected error while invoking failure handler", logPrefix, t);
}
}
release(streamId, ctx);
} else {
Loggers.warnWithException(
LOG,
"[{}] Unexpected error while decoding incoming event frame",
logPrefix,
exception.getCause());
}
} else {
// Otherwise fail all pending requests
abortAllInFlight(
(exception instanceof HeartbeatException)
? (HeartbeatException) exception
: new ClosedConnectionException("Unexpected error on channel", exception));
ctx.close();
}
} | [
"@",
"Override",
"public",
"void",
"exceptionCaught",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Throwable",
"exception",
")",
"throws",
"Exception",
"{",
"if",
"(",
"exception",
"instanceof",
"FrameDecodingException",
")",
"{",
"int",
"streamId",
"=",
"(",
"(",
... | Called if an exception was thrown while processing an inbound event (i.e. a response). | [
"Called",
"if",
"an",
"exception",
"was",
"thrown",
"while",
"processing",
"an",
"inbound",
"event",
"(",
"i",
".",
"e",
".",
"a",
"response",
")",
"."
] | train | https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/internal/core/channel/InFlightHandler.java#L270-L302 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/TemplateTypeMap.java | TemplateTypeMap.checkEquivalenceHelper | public boolean checkEquivalenceHelper(
TemplateTypeMap that, EquivalenceMethod eqMethod, SubtypingMode subtypingMode) {
return checkEquivalenceHelper(that, eqMethod, EqCache.create(), subtypingMode);
} | java | public boolean checkEquivalenceHelper(
TemplateTypeMap that, EquivalenceMethod eqMethod, SubtypingMode subtypingMode) {
return checkEquivalenceHelper(that, eqMethod, EqCache.create(), subtypingMode);
} | [
"public",
"boolean",
"checkEquivalenceHelper",
"(",
"TemplateTypeMap",
"that",
",",
"EquivalenceMethod",
"eqMethod",
",",
"SubtypingMode",
"subtypingMode",
")",
"{",
"return",
"checkEquivalenceHelper",
"(",
"that",
",",
"eqMethod",
",",
"EqCache",
".",
"create",
"(",
... | Determines if this map and the specified map have equivalent template
types. | [
"Determines",
"if",
"this",
"map",
"and",
"the",
"specified",
"map",
"have",
"equivalent",
"template",
"types",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/TemplateTypeMap.java#L220-L223 |
prestodb/presto-hive-apache | src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java | JsonSerDe.serialize | @Override
public Writable serialize(Object obj, ObjectInspector objInspector)
throws SerDeException {
StringBuilder sb = new StringBuilder();
try {
StructObjectInspector soi = (StructObjectInspector) objInspector;
List<? extends StructField> structFields = soi.getAllStructFieldRefs();
assert (columnNames.size() == structFields.size());
if (obj == null) {
sb.append("null");
} else {
sb.append(SerDeUtils.LBRACE);
for (int i = 0; i < structFields.size(); i++) {
if (i > 0) {
sb.append(SerDeUtils.COMMA);
}
appendWithQuotes(sb, columnNames.get(i));
sb.append(SerDeUtils.COLON);
buildJSONString(sb, soi.getStructFieldData(obj, structFields.get(i)),
structFields.get(i).getFieldObjectInspector());
}
sb.append(SerDeUtils.RBRACE);
}
} catch (IOException e) {
LOG.warn("Error generating json text from object.", e);
throw new SerDeException(e);
}
return new Text(sb.toString());
} | java | @Override
public Writable serialize(Object obj, ObjectInspector objInspector)
throws SerDeException {
StringBuilder sb = new StringBuilder();
try {
StructObjectInspector soi = (StructObjectInspector) objInspector;
List<? extends StructField> structFields = soi.getAllStructFieldRefs();
assert (columnNames.size() == structFields.size());
if (obj == null) {
sb.append("null");
} else {
sb.append(SerDeUtils.LBRACE);
for (int i = 0; i < structFields.size(); i++) {
if (i > 0) {
sb.append(SerDeUtils.COMMA);
}
appendWithQuotes(sb, columnNames.get(i));
sb.append(SerDeUtils.COLON);
buildJSONString(sb, soi.getStructFieldData(obj, structFields.get(i)),
structFields.get(i).getFieldObjectInspector());
}
sb.append(SerDeUtils.RBRACE);
}
} catch (IOException e) {
LOG.warn("Error generating json text from object.", e);
throw new SerDeException(e);
}
return new Text(sb.toString());
} | [
"@",
"Override",
"public",
"Writable",
"serialize",
"(",
"Object",
"obj",
",",
"ObjectInspector",
"objInspector",
")",
"throws",
"SerDeException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"StructObjectInspector",
"soi",
... | Given an object and object inspector pair, traverse the object
and generate a Text representation of the object. | [
"Given",
"an",
"object",
"and",
"object",
"inspector",
"pair",
"traverse",
"the",
"object",
"and",
"generate",
"a",
"Text",
"representation",
"of",
"the",
"object",
"."
] | train | https://github.com/prestodb/presto-hive-apache/blob/000f51d04c520f2096faffbc6733e51e19a4ddcc/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java#L423-L453 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsVisitorFactory.java | EditsVisitorFactory.getEditsVisitor | static public EditsVisitor getEditsVisitor(String filename,
String processor,
Tokenizer tokenizer,
boolean printToScreen) throws IOException {
if(processor.toLowerCase().equals("xml")) {
return new XmlEditsVisitor(filename, tokenizer, printToScreen);
} else if(processor.toLowerCase().equals("stats")) {
return new StatisticsEditsVisitor(filename, tokenizer, printToScreen);
} else if(processor.toLowerCase().equals("binary")) {
return new BinaryEditsVisitor(filename, tokenizer, printToScreen);
} else {
throw new IOException("Unknown proccesor " + processor +
" (valid processors: xml, binary, stats)");
}
} | java | static public EditsVisitor getEditsVisitor(String filename,
String processor,
Tokenizer tokenizer,
boolean printToScreen) throws IOException {
if(processor.toLowerCase().equals("xml")) {
return new XmlEditsVisitor(filename, tokenizer, printToScreen);
} else if(processor.toLowerCase().equals("stats")) {
return new StatisticsEditsVisitor(filename, tokenizer, printToScreen);
} else if(processor.toLowerCase().equals("binary")) {
return new BinaryEditsVisitor(filename, tokenizer, printToScreen);
} else {
throw new IOException("Unknown proccesor " + processor +
" (valid processors: xml, binary, stats)");
}
} | [
"static",
"public",
"EditsVisitor",
"getEditsVisitor",
"(",
"String",
"filename",
",",
"String",
"processor",
",",
"Tokenizer",
"tokenizer",
",",
"boolean",
"printToScreen",
")",
"throws",
"IOException",
"{",
"if",
"(",
"processor",
".",
"toLowerCase",
"(",
")",
... | Factory function that creates an EditsVisitor object
@param filename output filename
@param tokenizer input tokenizer
@return EditsVisitor for appropriate output format (binary, XML etc.) | [
"Factory",
"function",
"that",
"creates",
"an",
"EditsVisitor",
"object"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/EditsVisitorFactory.java#L36-L51 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.removeChild | private INode removeChild(INode[] pathComponents, int endPos) {
INode removedNode = pathComponents[endPos];
int startPos = removedNode.getStartPosForQuoteUpdate();
removedNode =
((INodeDirectory)pathComponents[endPos-1]).removeChild(pathComponents[endPos]);
if (removedNode != null) {
INode.DirCounts counts = new INode.DirCounts();
removedNode.spaceConsumedInTree(counts);
updateCountNoQuotaCheck(pathComponents, startPos, endPos,
-counts.getNsCount(), -counts.getDsCount());
}
return removedNode;
} | java | private INode removeChild(INode[] pathComponents, int endPos) {
INode removedNode = pathComponents[endPos];
int startPos = removedNode.getStartPosForQuoteUpdate();
removedNode =
((INodeDirectory)pathComponents[endPos-1]).removeChild(pathComponents[endPos]);
if (removedNode != null) {
INode.DirCounts counts = new INode.DirCounts();
removedNode.spaceConsumedInTree(counts);
updateCountNoQuotaCheck(pathComponents, startPos, endPos,
-counts.getNsCount(), -counts.getDsCount());
}
return removedNode;
} | [
"private",
"INode",
"removeChild",
"(",
"INode",
"[",
"]",
"pathComponents",
",",
"int",
"endPos",
")",
"{",
"INode",
"removedNode",
"=",
"pathComponents",
"[",
"endPos",
"]",
";",
"int",
"startPos",
"=",
"removedNode",
".",
"getStartPosForQuoteUpdate",
"(",
"... | Remove an inode at index pos from the namespace.
Its ancestors are stored at [0, pos-1].
Count of each ancestor with quota is also updated.
Return the removed node; null if the removal fails. | [
"Remove",
"an",
"inode",
"at",
"index",
"pos",
"from",
"the",
"namespace",
".",
"Its",
"ancestors",
"are",
"stored",
"at",
"[",
"0",
"pos",
"-",
"1",
"]",
".",
"Count",
"of",
"each",
"ancestor",
"with",
"quota",
"is",
"also",
"updated",
".",
"Return",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2593-L2605 |
joniles/mpxj | src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java | PhoenixReader.getUUID | private UUID getUUID(UUID uuid, String name)
{
return uuid == null ? UUID.nameUUIDFromBytes(name.getBytes()) : uuid;
} | java | private UUID getUUID(UUID uuid, String name)
{
return uuid == null ? UUID.nameUUIDFromBytes(name.getBytes()) : uuid;
} | [
"private",
"UUID",
"getUUID",
"(",
"UUID",
"uuid",
",",
"String",
"name",
")",
"{",
"return",
"uuid",
"==",
"null",
"?",
"UUID",
".",
"nameUUIDFromBytes",
"(",
"name",
".",
"getBytes",
"(",
")",
")",
":",
"uuid",
";",
"}"
] | Utility method. In some cases older compressed PPX files only have a name (or other string attribute)
but no UUID. This method ensures that we either use the UUID supplied, or if it is missing, we
generate a UUID from the name.
@param uuid uuid from object
@param name name from object
@return UUID instance | [
"Utility",
"method",
".",
"In",
"some",
"cases",
"older",
"compressed",
"PPX",
"files",
"only",
"have",
"a",
"name",
"(",
"or",
"other",
"string",
"attribute",
")",
"but",
"no",
"UUID",
".",
"This",
"method",
"ensures",
"that",
"we",
"either",
"use",
"th... | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L735-L738 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java | IncorrectInternalClassUse.visitClassContext | @Override
public void visitClassContext(ClassContext context) {
JavaClass cls = context.getJavaClass();
if (!isInternal(cls.getClassName())) {
ConstantPool pool = cls.getConstantPool();
int numItems = pool.getLength();
for (int i = 0; i < numItems; i++) {
Constant c = pool.getConstant(i);
if (c instanceof ConstantClass) {
String clsName = ((ConstantClass) c).getBytes(pool);
if (isInternal(clsName)) {
bugReporter.reportBug(
new BugInstance(this, BugType.IICU_INCORRECT_INTERNAL_CLASS_USE.name(), NORMAL_PRIORITY).addClass(cls).addString(clsName));
}
}
}
}
} | java | @Override
public void visitClassContext(ClassContext context) {
JavaClass cls = context.getJavaClass();
if (!isInternal(cls.getClassName())) {
ConstantPool pool = cls.getConstantPool();
int numItems = pool.getLength();
for (int i = 0; i < numItems; i++) {
Constant c = pool.getConstant(i);
if (c instanceof ConstantClass) {
String clsName = ((ConstantClass) c).getBytes(pool);
if (isInternal(clsName)) {
bugReporter.reportBug(
new BugInstance(this, BugType.IICU_INCORRECT_INTERNAL_CLASS_USE.name(), NORMAL_PRIORITY).addClass(cls).addString(clsName));
}
}
}
}
} | [
"@",
"Override",
"public",
"void",
"visitClassContext",
"(",
"ClassContext",
"context",
")",
"{",
"JavaClass",
"cls",
"=",
"context",
".",
"getJavaClass",
"(",
")",
";",
"if",
"(",
"!",
"isInternal",
"(",
"cls",
".",
"getClassName",
"(",
")",
")",
")",
"... | implements the visitor to look for classes that reference com.sun.xxx, or org.apache.xerces.xxx classes by looking for class Const in the constant pool
@param context
the context object of the currently parsed class | [
"implements",
"the",
"visitor",
"to",
"look",
"for",
"classes",
"that",
"reference",
"com",
".",
"sun",
".",
"xxx",
"or",
"org",
".",
"apache",
".",
"xerces",
".",
"xxx",
"classes",
"by",
"looking",
"for",
"class",
"Const",
"in",
"the",
"constant",
"pool... | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java#L97-L114 |
marvinlabs/android-intents | library/src/main/java/com/marvinlabs/intents/SystemIntents.java | SystemIntents.newMarketForAppIntent | public static Intent newMarketForAppIntent(Context context) {
String packageName = context.getApplicationContext().getPackageName();
return newMarketForAppIntent(context, packageName);
} | java | public static Intent newMarketForAppIntent(Context context) {
String packageName = context.getApplicationContext().getPackageName();
return newMarketForAppIntent(context, packageName);
} | [
"public",
"static",
"Intent",
"newMarketForAppIntent",
"(",
"Context",
"context",
")",
"{",
"String",
"packageName",
"=",
"context",
".",
"getApplicationContext",
"(",
")",
".",
"getPackageName",
"(",
")",
";",
"return",
"newMarketForAppIntent",
"(",
"context",
",... | Intent that should open the app store of the device on the current application page
@param context The context associated to the application
@return the intent | [
"Intent",
"that",
"should",
"open",
"the",
"app",
"store",
"of",
"the",
"device",
"on",
"the",
"current",
"application",
"page"
] | train | https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/SystemIntents.java#L33-L36 |
square/mortar | mortar-sample/src/main/java/com/example/mortar/screen/Layouts.java | Layouts.createView | public static android.view.View createView(Context context, Class<?> screenType) {
Layout screen = screenType.getAnnotation(Layout.class);
if (screen == null) {
throw new IllegalArgumentException(
String.format("@%s annotation not found on class %s", Layout.class.getSimpleName(),
screenType.getName()));
}
int layout = screen.value();
return inflateLayout(context, layout);
} | java | public static android.view.View createView(Context context, Class<?> screenType) {
Layout screen = screenType.getAnnotation(Layout.class);
if (screen == null) {
throw new IllegalArgumentException(
String.format("@%s annotation not found on class %s", Layout.class.getSimpleName(),
screenType.getName()));
}
int layout = screen.value();
return inflateLayout(context, layout);
} | [
"public",
"static",
"android",
".",
"view",
".",
"View",
"createView",
"(",
"Context",
"context",
",",
"Class",
"<",
"?",
">",
"screenType",
")",
"{",
"Layout",
"screen",
"=",
"screenType",
".",
"getAnnotation",
"(",
"Layout",
".",
"class",
")",
";",
"if... | Create an instance of the view specified in a {@link Layout} annotation. | [
"Create",
"an",
"instance",
"of",
"the",
"view",
"specified",
"in",
"a",
"{"
] | train | https://github.com/square/mortar/blob/c968b99eb96ba56c47e29912c07841be8e2cf97a/mortar-sample/src/main/java/com/example/mortar/screen/Layouts.java#L29-L39 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/util/SQSMessagingClientThreadFactory.java | SQSMessagingClientThreadFactory.newThread | public Thread newThread(Runnable r) {
Thread t;
if (threadGroup == null) {
t = new Thread(r, threadBaseName + threadCounter.incrementAndGet());
t.setDaemon(isDaemon);
} else {
t = new Thread(threadGroup, r, threadBaseName + threadCounter.incrementAndGet());
t.setDaemon(isDaemon);
}
return t;
} | java | public Thread newThread(Runnable r) {
Thread t;
if (threadGroup == null) {
t = new Thread(r, threadBaseName + threadCounter.incrementAndGet());
t.setDaemon(isDaemon);
} else {
t = new Thread(threadGroup, r, threadBaseName + threadCounter.incrementAndGet());
t.setDaemon(isDaemon);
}
return t;
} | [
"public",
"Thread",
"newThread",
"(",
"Runnable",
"r",
")",
"{",
"Thread",
"t",
";",
"if",
"(",
"threadGroup",
"==",
"null",
")",
"{",
"t",
"=",
"new",
"Thread",
"(",
"r",
",",
"threadBaseName",
"+",
"threadCounter",
".",
"incrementAndGet",
"(",
")",
"... | Constructs a new Thread. Initializes name, daemon status, and ThreadGroup
if there is any.
@param r
A runnable to be executed by new thread instance
@return The constructed thread | [
"Constructs",
"a",
"new",
"Thread",
".",
"Initializes",
"name",
"daemon",
"status",
"and",
"ThreadGroup",
"if",
"there",
"is",
"any",
"."
] | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/util/SQSMessagingClientThreadFactory.java#L61-L71 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseUnionType | private Type parseUnionType(EnclosingScope scope) {
int start = index;
Type t = parseIntersectionType(scope);
// Now, attempt to look for union and/or intersection types
if (tryAndMatch(true, VerticalBar) != null) {
// This is a union type
ArrayList<Type> types = new ArrayList<>();
types.add(t);
do {
types.add(parseIntersectionType(scope));
} while (tryAndMatch(true, VerticalBar) != null);
//
Type[] bounds = types.toArray(new Type[types.size()]);
t = annotateSourceLocation(new Type.Union(bounds), start);
}
return t;
} | java | private Type parseUnionType(EnclosingScope scope) {
int start = index;
Type t = parseIntersectionType(scope);
// Now, attempt to look for union and/or intersection types
if (tryAndMatch(true, VerticalBar) != null) {
// This is a union type
ArrayList<Type> types = new ArrayList<>();
types.add(t);
do {
types.add(parseIntersectionType(scope));
} while (tryAndMatch(true, VerticalBar) != null);
//
Type[] bounds = types.toArray(new Type[types.size()]);
t = annotateSourceLocation(new Type.Union(bounds), start);
}
return t;
} | [
"private",
"Type",
"parseUnionType",
"(",
"EnclosingScope",
"scope",
")",
"{",
"int",
"start",
"=",
"index",
";",
"Type",
"t",
"=",
"parseIntersectionType",
"(",
"scope",
")",
";",
"// Now, attempt to look for union and/or intersection types",
"if",
"(",
"tryAndMatch"... | Parse a union type, which is of the form:
<pre>
UnionType ::= IntersectionType ('|' IntersectionType)*
</pre>
@return | [
"Parse",
"a",
"union",
"type",
"which",
"is",
"of",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L3569-L3585 |
graknlabs/grakn | server/src/server/kb/concept/ConceptUtils.java | ConceptUtils.areDisjointTypes | public static boolean areDisjointTypes(SchemaConcept parent, SchemaConcept child, boolean direct) {
return parent != null && child == null || !typesCompatible(parent, child, direct) && !typesCompatible(child, parent, direct);
} | java | public static boolean areDisjointTypes(SchemaConcept parent, SchemaConcept child, boolean direct) {
return parent != null && child == null || !typesCompatible(parent, child, direct) && !typesCompatible(child, parent, direct);
} | [
"public",
"static",
"boolean",
"areDisjointTypes",
"(",
"SchemaConcept",
"parent",
",",
"SchemaConcept",
"child",
",",
"boolean",
"direct",
")",
"{",
"return",
"parent",
"!=",
"null",
"&&",
"child",
"==",
"null",
"||",
"!",
"typesCompatible",
"(",
"parent",
",... | determines disjointness of parent-child types, parent defines the bound on the child
@param parent {@link SchemaConcept}
@param child {@link SchemaConcept}
@return true if types do not belong to the same type hierarchy, also true if parent is null and false if parent non-null and child null | [
"determines",
"disjointness",
"of",
"parent",
"-",
"child",
"types",
"parent",
"defines",
"the",
"bound",
"on",
"the",
"child"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ConceptUtils.java#L108-L110 |
forge/core | scaffold/spi/src/main/java/org/jboss/forge/addon/scaffold/metawidget/inspector/propertystyle/ForgePropertyStyle.java | ForgePropertyStyle.isSetter | protected String isSetter(final Method<?, ?> method)
{
String methodName = method.getName();
if (!methodName.startsWith(ClassUtils.JAVABEAN_SET_PREFIX))
{
return null;
}
String propertyName = methodName.substring(ClassUtils.JAVABEAN_SET_PREFIX.length());
return StringUtils.decapitalize(propertyName);
} | java | protected String isSetter(final Method<?, ?> method)
{
String methodName = method.getName();
if (!methodName.startsWith(ClassUtils.JAVABEAN_SET_PREFIX))
{
return null;
}
String propertyName = methodName.substring(ClassUtils.JAVABEAN_SET_PREFIX.length());
return StringUtils.decapitalize(propertyName);
} | [
"protected",
"String",
"isSetter",
"(",
"final",
"Method",
"<",
"?",
",",
"?",
">",
"method",
")",
"{",
"String",
"methodName",
"=",
"method",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"methodName",
".",
"startsWith",
"(",
"ClassUtils",
".",
"JAVA... | Returns whether the given method is a 'setter' method.
@param method a single-parametered method. May return non-void (ie. for Fluent interfaces)
@return the property name | [
"Returns",
"whether",
"the",
"given",
"method",
"is",
"a",
"setter",
"method",
"."
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/scaffold/spi/src/main/java/org/jboss/forge/addon/scaffold/metawidget/inspector/propertystyle/ForgePropertyStyle.java#L361-L373 |
tomgibara/bits | src/main/java/com/tomgibara/bits/BitVector.java | BitVector.fromBitSet | public static BitVector fromBitSet(BitSet bitSet, int size) {
if (bitSet == null) throw new IllegalArgumentException();
if (size < 0) throw new IllegalArgumentException();
final int length = bitSet.length();
return fromBitSetImpl(bitSet, size, length);
} | java | public static BitVector fromBitSet(BitSet bitSet, int size) {
if (bitSet == null) throw new IllegalArgumentException();
if (size < 0) throw new IllegalArgumentException();
final int length = bitSet.length();
return fromBitSetImpl(bitSet, size, length);
} | [
"public",
"static",
"BitVector",
"fromBitSet",
"(",
"BitSet",
"bitSet",
",",
"int",
"size",
")",
"{",
"if",
"(",
"bitSet",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"size",
"<",
"0",
")",
"throw",
"new",
"... | Creates a {@link BitVector} by copying the bits in a <code>BitSet</code>.
@param bitSet
a <code>BitSet</code>
@param size
the size of {@link BitVector} to create, in bits
@return a bit vector containing the bits of the bit set.
@see Bits#asStore(BitSet, int) | [
"Creates",
"a",
"{",
"@link",
"BitVector",
"}",
"by",
"copying",
"the",
"bits",
"in",
"a",
"<code",
">",
"BitSet<",
"/",
"code",
">",
"."
] | train | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L217-L222 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseOffsetISO8601 | public final int parseOffsetISO8601(String text, ParsePosition pos) {
return parseOffsetISO8601(text, pos, false, null);
} | java | public final int parseOffsetISO8601(String text, ParsePosition pos) {
return parseOffsetISO8601(text, pos, false, null);
} | [
"public",
"final",
"int",
"parseOffsetISO8601",
"(",
"String",
"text",
",",
"ParsePosition",
"pos",
")",
"{",
"return",
"parseOffsetISO8601",
"(",
"text",
",",
"pos",
",",
"false",
",",
"null",
")",
";",
"}"
] | Returns offset from GMT(UTC) in milliseconds for the given ISO 8601
basic or extended time zone string. When the given string is not an ISO 8601 time
zone string, this method sets the current position as the error index
to <code>ParsePosition pos</code> and returns 0.
@param text the text contains ISO 8601 style time zone string (e.g. "-08", "-0800", "-08:00", and "Z")
at the position.
@param pos the position.
@return the offset from GMT(UTC) in milliseconds for the given ISO 8601 style
time zone string.
@see #formatOffsetISO8601Basic(int, boolean, boolean, boolean)
@see #formatOffsetISO8601Extended(int, boolean, boolean, boolean) | [
"Returns",
"offset",
"from",
"GMT",
"(",
"UTC",
")",
"in",
"milliseconds",
"for",
"the",
"given",
"ISO",
"8601",
"basic",
"or",
"extended",
"time",
"zone",
"string",
".",
"When",
"the",
"given",
"string",
"is",
"not",
"an",
"ISO",
"8601",
"time",
"zone",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L960-L962 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AccessAuditContext.java | AccessAuditContext.doAs | public static <T> T doAs(final boolean inflowed, final SecurityIdentity securityIdentity, final InetAddress remoteAddress, final PrivilegedAction<T> action) {
final AccessAuditContext previous = contextThreadLocal.get();
try {
contextThreadLocal.set(new AccessAuditContext(inflowed, securityIdentity, remoteAddress, previous));
return securityIdentity != null ? securityIdentity.runAs(action) : action.run();
} finally {
contextThreadLocal.set(previous);
}
} | java | public static <T> T doAs(final boolean inflowed, final SecurityIdentity securityIdentity, final InetAddress remoteAddress, final PrivilegedAction<T> action) {
final AccessAuditContext previous = contextThreadLocal.get();
try {
contextThreadLocal.set(new AccessAuditContext(inflowed, securityIdentity, remoteAddress, previous));
return securityIdentity != null ? securityIdentity.runAs(action) : action.run();
} finally {
contextThreadLocal.set(previous);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"doAs",
"(",
"final",
"boolean",
"inflowed",
",",
"final",
"SecurityIdentity",
"securityIdentity",
",",
"final",
"InetAddress",
"remoteAddress",
",",
"final",
"PrivilegedAction",
"<",
"T",
">",
"action",
")",
"{",
"final... | Perform work with a new {@code AccessAuditContext} as a particular {@code SecurityIdentity}
@param inflowed was the identity inflowed from a remote process?
@param securityIdentity the {@code SecurityIdentity} that the specified {@code action} will run as. May be {@code null}
@param remoteAddress the remote address of the caller.
@param action the work to perform. Cannot be {@code null}
@param <T> the type of teh return value
@return the value returned by the PrivilegedAction's <code>run</code> method
@exception NullPointerException if the specified
<code>PrivilegedExceptionAction</code> is
<code>null</code>.
@exception SecurityException if the caller does not have permission
to invoke this method. | [
"Perform",
"work",
"with",
"a",
"new",
"{",
"@code",
"AccessAuditContext",
"}",
"as",
"a",
"particular",
"{",
"@code",
"SecurityIdentity",
"}",
"@param",
"inflowed",
"was",
"the",
"identity",
"inflowed",
"from",
"a",
"remote",
"process?",
"@param",
"securityIden... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AccessAuditContext.java#L194-L202 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroupConditionBuilder.java | RolloutGroupConditionBuilder.successAction | public RolloutGroupConditionBuilder successAction(final RolloutGroupSuccessAction action, final String expression) {
conditions.setSuccessAction(action);
conditions.setSuccessActionExp(expression);
return this;
} | java | public RolloutGroupConditionBuilder successAction(final RolloutGroupSuccessAction action, final String expression) {
conditions.setSuccessAction(action);
conditions.setSuccessActionExp(expression);
return this;
} | [
"public",
"RolloutGroupConditionBuilder",
"successAction",
"(",
"final",
"RolloutGroupSuccessAction",
"action",
",",
"final",
"String",
"expression",
")",
"{",
"conditions",
".",
"setSuccessAction",
"(",
"action",
")",
";",
"conditions",
".",
"setSuccessActionExp",
"(",... | Sets the success action and expression on the builder.
@param action
the success action
@param expression
the error expression
@return the builder itself | [
"Sets",
"the",
"success",
"action",
"and",
"expression",
"on",
"the",
"builder",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroupConditionBuilder.java#L55-L59 |
kmi/iserve | iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java | ConcurrentSparqlGraphStoreManager.putGraph | @Override
public void putGraph(URI graphUri, Model data) {
if (graphUri == null || data == null)
return;
// Use HTTP protocol if possible
if (this.sparqlServiceEndpoint != null) {
datasetAccessor.putModel(graphUri.toASCIIString(), data);
} else {
this.putGraphSparqlQuery(graphUri, data);
}
log.info("Graph added to store: {}", graphUri.toASCIIString());
} | java | @Override
public void putGraph(URI graphUri, Model data) {
if (graphUri == null || data == null)
return;
// Use HTTP protocol if possible
if (this.sparqlServiceEndpoint != null) {
datasetAccessor.putModel(graphUri.toASCIIString(), data);
} else {
this.putGraphSparqlQuery(graphUri, data);
}
log.info("Graph added to store: {}", graphUri.toASCIIString());
} | [
"@",
"Override",
"public",
"void",
"putGraph",
"(",
"URI",
"graphUri",
",",
"Model",
"data",
")",
"{",
"if",
"(",
"graphUri",
"==",
"null",
"||",
"data",
"==",
"null",
")",
"return",
";",
"// Use HTTP protocol if possible",
"if",
"(",
"this",
".",
"sparqlS... | Put (create/replace) a named graph of a Dataset
@param graphUri
@param data | [
"Put",
"(",
"create",
"/",
"replace",
")",
"a",
"named",
"graph",
"of",
"a",
"Dataset"
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L546-L559 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getEvent | public Event getEvent(long id) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_EVENT_URL, Long.toString(id)));
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
Event event = null;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() == 200) {
JSONObject data = oAuthResponse.getData();
event = new Event(data);
} else {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return event;
} | java | public Event getEvent(long id) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_EVENT_URL, Long.toString(id)));
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
Event event = null;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.GET, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() == 200) {
JSONObject data = oAuthResponse.getData();
event = new Event(data);
} else {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return event;
} | [
"public",
"Event",
"getEvent",
"(",
"long",
"id",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"cleanError",
"(",
")",
";",
"prepareToken",
"(",
")",
";",
"URIBuilder",
"url",
"=",
"new",
"URIBuilder",
"(",... | Gets Event by ID.
@param id
Id of the event
@return Event
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see com.onelogin.sdk.model.Event
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/events/get-event-by-id">Get Event by ID documentation</a> | [
"Gets",
"Event",
"by",
"ID",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2122-L2146 |
elki-project/elki | elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/associationrules/AssociationRule.java | AssociationRule.appendTo | public StringBuilder appendTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) {
this.antecedent.appendTo(buf, meta);
buf.append(" --> ");
this.consequent.appendItemsTo(buf, meta);
buf.append(": ");
buf.append(union.getSupport());
buf.append(" : ");
buf.append(this.measure);
return buf;
} | java | public StringBuilder appendTo(StringBuilder buf, VectorFieldTypeInformation<BitVector> meta) {
this.antecedent.appendTo(buf, meta);
buf.append(" --> ");
this.consequent.appendItemsTo(buf, meta);
buf.append(": ");
buf.append(union.getSupport());
buf.append(" : ");
buf.append(this.measure);
return buf;
} | [
"public",
"StringBuilder",
"appendTo",
"(",
"StringBuilder",
"buf",
",",
"VectorFieldTypeInformation",
"<",
"BitVector",
">",
"meta",
")",
"{",
"this",
".",
"antecedent",
".",
"appendTo",
"(",
"buf",
",",
"meta",
")",
";",
"buf",
".",
"append",
"(",
"\" --> ... | Append to a string buffer.
@param buf Buffer
@param meta Relation metadata (for labels)
@return String buffer for chaining. | [
"Append",
"to",
"a",
"string",
"buffer",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-itemsets/src/main/java/de/lmu/ifi/dbs/elki/algorithm/itemsetmining/associationrules/AssociationRule.java#L123-L132 |
52inc/android-52Kit | library/src/main/java/com/ftinc/kit/util/IntentUtils.java | IntentUtils.pickContact | public static Intent pickContact(String scope) {
Intent intent;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ECLAIR) {
intent = new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI);
} else {
intent = new Intent(Intent.ACTION_PICK, Uri.parse("content://com.android.contacts/contacts"));
}
if (!TextUtils.isEmpty(scope)) {
intent.setType(scope);
}
return intent;
} | java | public static Intent pickContact(String scope) {
Intent intent;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ECLAIR) {
intent = new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI);
} else {
intent = new Intent(Intent.ACTION_PICK, Uri.parse("content://com.android.contacts/contacts"));
}
if (!TextUtils.isEmpty(scope)) {
intent.setType(scope);
}
return intent;
} | [
"public",
"static",
"Intent",
"pickContact",
"(",
"String",
"scope",
")",
"{",
"Intent",
"intent",
";",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"ECLAIR",
")",
"{",
"intent",
"=",
"new",
"Intent",
"(",
... | Pick contact from phone book
@param scope You can restrict selection by passing required content type. | [
"Pick",
"contact",
"from",
"phone",
"book"
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/util/IntentUtils.java#L391-L403 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/provisioning/ImportApi.java | ImportApi.getImportStatus | public ImportStatus getImportStatus(String adminName, String tenantName) throws ProvisioningApiException {
try {
GetImportStatusResponse resp = importApi.getImportStatus(adminName, tenantName);
if (resp.getStatus().getCode().intValue() != 0) {
throw new ProvisioningApiException("Error getting import status. Code: " + resp.getStatus().getCode());
}
return Converters.convertGetImportStatusResponseDataToImportStatus(resp.getData());
} catch(ApiException e) {
throw new ProvisioningApiException("Error getting import status", e);
}
} | java | public ImportStatus getImportStatus(String adminName, String tenantName) throws ProvisioningApiException {
try {
GetImportStatusResponse resp = importApi.getImportStatus(adminName, tenantName);
if (resp.getStatus().getCode().intValue() != 0) {
throw new ProvisioningApiException("Error getting import status. Code: " + resp.getStatus().getCode());
}
return Converters.convertGetImportStatusResponseDataToImportStatus(resp.getData());
} catch(ApiException e) {
throw new ProvisioningApiException("Error getting import status", e);
}
} | [
"public",
"ImportStatus",
"getImportStatus",
"(",
"String",
"adminName",
",",
"String",
"tenantName",
")",
"throws",
"ProvisioningApiException",
"{",
"try",
"{",
"GetImportStatusResponse",
"resp",
"=",
"importApi",
".",
"getImportStatus",
"(",
"adminName",
",",
"tenan... | Get import status.
Get all active imports for the specified tenant.
@param adminName The login name of an administrator for the tenant. (required)
@param tenantName The name of the tenant. (required)
@return ImportStatus object.
@throws ProvisioningApiException if the call is unsuccessful. | [
"Get",
"import",
"status",
".",
"Get",
"all",
"active",
"imports",
"for",
"the",
"specified",
"tenant",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/ImportApi.java#L116-L128 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.homographyStereoLinePt | public static DMatrixRMaj homographyStereoLinePt( DMatrixRMaj F , PairLineNorm line, AssociatedPair point) {
HomographyInducedStereoLinePt alg = new HomographyInducedStereoLinePt();
alg.setFundamental(F,null);
alg.process(line,point);
return alg.getHomography();
} | java | public static DMatrixRMaj homographyStereoLinePt( DMatrixRMaj F , PairLineNorm line, AssociatedPair point) {
HomographyInducedStereoLinePt alg = new HomographyInducedStereoLinePt();
alg.setFundamental(F,null);
alg.process(line,point);
return alg.getHomography();
} | [
"public",
"static",
"DMatrixRMaj",
"homographyStereoLinePt",
"(",
"DMatrixRMaj",
"F",
",",
"PairLineNorm",
"line",
",",
"AssociatedPair",
"point",
")",
"{",
"HomographyInducedStereoLinePt",
"alg",
"=",
"new",
"HomographyInducedStereoLinePt",
"(",
")",
";",
"alg",
".",... | Computes the homography induced from a planar surface when viewed from two views using correspondences
of a line and a point. Observations must be on the planar surface.
@see HomographyInducedStereoLinePt
@param F Fundamental matrix
@param line Line on the plane
@param point Point on the plane
@return The homography from view 1 to view 2 or null if it fails | [
"Computes",
"the",
"homography",
"induced",
"from",
"a",
"planar",
"surface",
"when",
"viewed",
"from",
"two",
"views",
"using",
"correspondences",
"of",
"a",
"line",
"and",
"a",
"point",
".",
"Observations",
"must",
"be",
"on",
"the",
"planar",
"surface",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L554-L560 |
VoltDB/voltdb | src/frontend/org/voltcore/zk/MapCache.java | MapCache.processParentEvent | private void processParentEvent(WatchedEvent event) throws Exception {
// get current children snapshot and reset this watch.
Set<String> children = new TreeSet<String>(m_zk.getChildren(m_rootNode, m_parentWatch));
// intersect to get newChildren and update m_lastChildren to the current set.
Set<String> newChildren = new HashSet<String>(children);
newChildren.removeAll(m_lastChildren);
m_lastChildren = children;
List<ByteArrayCallback> callbacks = new ArrayList<ByteArrayCallback>();
for (String child : children) {
ByteArrayCallback cb = new ByteArrayCallback();
// set watches on new children.
if(newChildren.contains(child)) {
m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), m_childWatch, cb, null);
} else {
m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), false, cb, null);
}
callbacks.add(cb);
}
HashMap<String, JSONObject> cache = new HashMap<String, JSONObject>();
for (ByteArrayCallback callback : callbacks) {
try {
byte payload[] = callback.get();
JSONObject jsObj = new JSONObject(new String(payload, "UTF-8"));
cache.put(callback.getPath(), jsObj);
} catch (KeeperException.NoNodeException e) {
// child may have been deleted between the parent trigger and getData.
}
}
m_publicCache.set(ImmutableMap.copyOf(cache));
if (m_cb != null) {
m_cb.run(m_publicCache.get());
}
} | java | private void processParentEvent(WatchedEvent event) throws Exception {
// get current children snapshot and reset this watch.
Set<String> children = new TreeSet<String>(m_zk.getChildren(m_rootNode, m_parentWatch));
// intersect to get newChildren and update m_lastChildren to the current set.
Set<String> newChildren = new HashSet<String>(children);
newChildren.removeAll(m_lastChildren);
m_lastChildren = children;
List<ByteArrayCallback> callbacks = new ArrayList<ByteArrayCallback>();
for (String child : children) {
ByteArrayCallback cb = new ByteArrayCallback();
// set watches on new children.
if(newChildren.contains(child)) {
m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), m_childWatch, cb, null);
} else {
m_zk.getData(ZKUtil.joinZKPath(m_rootNode, child), false, cb, null);
}
callbacks.add(cb);
}
HashMap<String, JSONObject> cache = new HashMap<String, JSONObject>();
for (ByteArrayCallback callback : callbacks) {
try {
byte payload[] = callback.get();
JSONObject jsObj = new JSONObject(new String(payload, "UTF-8"));
cache.put(callback.getPath(), jsObj);
} catch (KeeperException.NoNodeException e) {
// child may have been deleted between the parent trigger and getData.
}
}
m_publicCache.set(ImmutableMap.copyOf(cache));
if (m_cb != null) {
m_cb.run(m_publicCache.get());
}
} | [
"private",
"void",
"processParentEvent",
"(",
"WatchedEvent",
"event",
")",
"throws",
"Exception",
"{",
"// get current children snapshot and reset this watch.",
"Set",
"<",
"String",
">",
"children",
"=",
"new",
"TreeSet",
"<",
"String",
">",
"(",
"m_zk",
".",
"get... | Rebuild the point-in-time snapshot of the children objects
and set watches on new children.
@Param event may be null on the first initialization. | [
"Rebuild",
"the",
"point",
"-",
"in",
"-",
"time",
"snapshot",
"of",
"the",
"children",
"objects",
"and",
"set",
"watches",
"on",
"new",
"children",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/MapCache.java#L235-L271 |
apache/flink | flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/Util.java | Util.checkParameter | public static void checkParameter(boolean condition, @Nullable Object errorMessage) {
if (!condition) {
throw new ProgramParametrizationException(String.valueOf(errorMessage));
}
} | java | public static void checkParameter(boolean condition, @Nullable Object errorMessage) {
if (!condition) {
throw new ProgramParametrizationException(String.valueOf(errorMessage));
}
} | [
"public",
"static",
"void",
"checkParameter",
"(",
"boolean",
"condition",
",",
"@",
"Nullable",
"Object",
"errorMessage",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"ProgramParametrizationException",
"(",
"String",
".",
"valueOf",
"(",
"... | Checks the given boolean condition, and throws an {@code ProgramParametrizationException} if
the condition is not met (evaluates to {@code false}). The exception will have the
given error message.
@param condition The condition to check
@param errorMessage The message for the {@code ProgramParametrizationException} that is thrown if the check fails.
@throws ProgramParametrizationException Thrown, if the condition is violated.
@see Preconditions#checkNotNull(Object, String) | [
"Checks",
"the",
"given",
"boolean",
"condition",
"and",
"throws",
"an",
"{",
"@code",
"ProgramParametrizationException",
"}",
"if",
"the",
"condition",
"is",
"not",
"met",
"(",
"evaluates",
"to",
"{",
"@code",
"false",
"}",
")",
".",
"The",
"exception",
"wi... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/parameter/Util.java#L49-L53 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java | StringUtils.removeStart | public static String removeStart(String str, String remove) {
if (isNullOrEmpty(str) || isNullOrEmpty(remove)) {
return str;
}
if (str.startsWith(remove)) {
return str.substring(remove.length());
}
return str;
} | java | public static String removeStart(String str, String remove) {
if (isNullOrEmpty(str) || isNullOrEmpty(remove)) {
return str;
}
if (str.startsWith(remove)) {
return str.substring(remove.length());
}
return str;
} | [
"public",
"static",
"String",
"removeStart",
"(",
"String",
"str",
",",
"String",
"remove",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"str",
")",
"||",
"isNullOrEmpty",
"(",
"remove",
")",
")",
"{",
"return",
"str",
";",
"}",
"if",
"(",
"str",
".",
... | <p>Removes a substring only if it is at the start of a source string,
otherwise returns the source string.</p>
<p/>
<p>A {@code null} source string will return {@code null}.
An empty ("") source string will return the empty string.
A {@code null} search string will return the source string.</p>
<p/>
<pre>
StringUtils.removeStart(null, *) = null
StringUtils.removeStart("", *) = ""
StringUtils.removeStart(*, null) = *
StringUtils.removeStart("www.domain.com", "www.") = "domain.com"
StringUtils.removeStart("abc", "") = "abc"
</pre>
@param str the source String to search, may be null
@param remove the String to search for and remove, may be null
@return the substring with the string removed if found,
{@code null} if null String input | [
"<p",
">",
"Removes",
"a",
"substring",
"only",
"if",
"it",
"is",
"at",
"the",
"start",
"of",
"a",
"source",
"string",
"otherwise",
"returns",
"the",
"source",
"string",
".",
"<",
"/",
"p",
">",
"<p",
"/",
">",
"<p",
">",
"A",
"{",
"@code",
"null",... | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/util/StringUtils.java#L76-L86 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java | DocEnv.getAnnotationTypeElementDoc | public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc(
MethodSymbol meth) {
AnnotationTypeElementDocImpl result =
(AnnotationTypeElementDocImpl)methodMap.get(meth);
if (result != null) return result;
result = new AnnotationTypeElementDocImpl(this, meth);
methodMap.put(meth, result);
return result;
} | java | public AnnotationTypeElementDocImpl getAnnotationTypeElementDoc(
MethodSymbol meth) {
AnnotationTypeElementDocImpl result =
(AnnotationTypeElementDocImpl)methodMap.get(meth);
if (result != null) return result;
result = new AnnotationTypeElementDocImpl(this, meth);
methodMap.put(meth, result);
return result;
} | [
"public",
"AnnotationTypeElementDocImpl",
"getAnnotationTypeElementDoc",
"(",
"MethodSymbol",
"meth",
")",
"{",
"AnnotationTypeElementDocImpl",
"result",
"=",
"(",
"AnnotationTypeElementDocImpl",
")",
"methodMap",
".",
"get",
"(",
"meth",
")",
";",
"if",
"(",
"result",
... | Return the AnnotationTypeElementDoc for a MethodSymbol.
Should be called only on symbols representing annotation type elements. | [
"Return",
"the",
"AnnotationTypeElementDoc",
"for",
"a",
"MethodSymbol",
".",
"Should",
"be",
"called",
"only",
"on",
"symbols",
"representing",
"annotation",
"type",
"elements",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L731-L740 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.invokeGet | public Response invokeGet(String resourcePath, MultivaluedMap<String, String> params) {
logger.debug("GET {}, params: {}", getFullPath(resourcePath), params);
return invokeSignedRequest(getApiClient(), accessKey, key(!JWT_PATH.equals(resourcePath)), GET,
getEndpoint(), getFullPath(resourcePath), null, params, new byte[0]);
} | java | public Response invokeGet(String resourcePath, MultivaluedMap<String, String> params) {
logger.debug("GET {}, params: {}", getFullPath(resourcePath), params);
return invokeSignedRequest(getApiClient(), accessKey, key(!JWT_PATH.equals(resourcePath)), GET,
getEndpoint(), getFullPath(resourcePath), null, params, new byte[0]);
} | [
"public",
"Response",
"invokeGet",
"(",
"String",
"resourcePath",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"{",
"logger",
".",
"debug",
"(",
"\"GET {}, params: {}\"",
",",
"getFullPath",
"(",
"resourcePath",
")",
",",
"params",
... | Invoke a GET request to the Para API.
@param resourcePath the subpath after '/v1/', should not start with '/'
@param params query parameters
@return a {@link Response} object | [
"Invoke",
"a",
"GET",
"request",
"to",
"the",
"Para",
"API",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L324-L328 |
OpenLiberty/open-liberty | dev/com.ibm.ws.opentracing.1.1/src/com/ibm/ws/opentracing/OpentracingService.java | OpentracingService.process | public static boolean process(final URI uri, final SpanFilterType type) {
final String methodName = "process";
boolean result = true;
// Copy the static reference locally so that it doesn't matter if the static list
// is updated while we're processing since that will just overwrite the reference
final SpanFilter[] filters = allFilters;
for (int i = 0; i < filters.length; i++) {
result = filters[i].process(result, uri, type);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, "filter " + filters[i] + " set result to " + result);
}
}
return result;
} | java | public static boolean process(final URI uri, final SpanFilterType type) {
final String methodName = "process";
boolean result = true;
// Copy the static reference locally so that it doesn't matter if the static list
// is updated while we're processing since that will just overwrite the reference
final SpanFilter[] filters = allFilters;
for (int i = 0; i < filters.length; i++) {
result = filters[i].process(result, uri, type);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, "filter " + filters[i] + " set result to " + result);
}
}
return result;
} | [
"public",
"static",
"boolean",
"process",
"(",
"final",
"URI",
"uri",
",",
"final",
"SpanFilterType",
"type",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"process\"",
";",
"boolean",
"result",
"=",
"true",
";",
"// Copy the static reference locally so that it ... | Return true if a span for the specified URI and type should be included.
@param uri The URI of the request.
@param type The type of the request.
@return true if a span for the specified URI and type should be included. | [
"Return",
"true",
"if",
"a",
"span",
"for",
"the",
"specified",
"URI",
"and",
"type",
"should",
"be",
"included",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.opentracing.1.1/src/com/ibm/ws/opentracing/OpentracingService.java#L132-L150 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/BijectiveNsMap.java | BijectiveNsMap.addMapping | public String addMapping(String prefix, String uri)
{
String[] strs = mNsStrings;
int phash = prefix.hashCode();
for (int ix = mScopeStart, end = mScopeEnd; ix < end; ix += 2) {
String thisP = strs[ix];
if (thisP == prefix ||
(thisP.hashCode() == phash && thisP.equals(prefix))) {
// Overriding an existing mapping
String old = strs[ix+1];
strs[ix+1] = uri;
return old;
}
}
// no previous binding, let's just add it at the end
if (mScopeEnd >= strs.length) {
// let's just double the array sizes...
strs = DataUtil.growArrayBy(strs, strs.length);
mNsStrings = strs;
}
strs[mScopeEnd++] = prefix;
strs[mScopeEnd++] = uri;
return null;
} | java | public String addMapping(String prefix, String uri)
{
String[] strs = mNsStrings;
int phash = prefix.hashCode();
for (int ix = mScopeStart, end = mScopeEnd; ix < end; ix += 2) {
String thisP = strs[ix];
if (thisP == prefix ||
(thisP.hashCode() == phash && thisP.equals(prefix))) {
// Overriding an existing mapping
String old = strs[ix+1];
strs[ix+1] = uri;
return old;
}
}
// no previous binding, let's just add it at the end
if (mScopeEnd >= strs.length) {
// let's just double the array sizes...
strs = DataUtil.growArrayBy(strs, strs.length);
mNsStrings = strs;
}
strs[mScopeEnd++] = prefix;
strs[mScopeEnd++] = uri;
return null;
} | [
"public",
"String",
"addMapping",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"String",
"[",
"]",
"strs",
"=",
"mNsStrings",
";",
"int",
"phash",
"=",
"prefix",
".",
"hashCode",
"(",
")",
";",
"for",
"(",
"int",
"ix",
"=",
"mScopeStart",
... | Method to add a new prefix-to-URI mapping for the current scope.
Note that it should NOT be used for the default namespace
declaration
@param prefix Prefix to bind
@param uri URI to bind to the prefix
@return If the prefix was already bound, the URI it was bound to:
null if it's a new binding for the current scope. | [
"Method",
"to",
"add",
"a",
"new",
"prefix",
"-",
"to",
"-",
"URI",
"mapping",
"for",
"the",
"current",
"scope",
".",
"Note",
"that",
"it",
"should",
"NOT",
"be",
"used",
"for",
"the",
"default",
"namespace",
"declaration"
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/BijectiveNsMap.java#L226-L251 |
apache/groovy | src/main/groovy/groovy/beans/VetoableASTTransformation.java | VetoableASTTransformation.createConstrainedStatement | protected Statement createConstrainedStatement(PropertyNode propertyNode, Expression fieldExpression) {
return stmt(callThisX("fireVetoableChange", args(constX(propertyNode.getName()), fieldExpression, varX("value"))));
} | java | protected Statement createConstrainedStatement(PropertyNode propertyNode, Expression fieldExpression) {
return stmt(callThisX("fireVetoableChange", args(constX(propertyNode.getName()), fieldExpression, varX("value"))));
} | [
"protected",
"Statement",
"createConstrainedStatement",
"(",
"PropertyNode",
"propertyNode",
",",
"Expression",
"fieldExpression",
")",
"{",
"return",
"stmt",
"(",
"callThisX",
"(",
"\"fireVetoableChange\"",
",",
"args",
"(",
"constX",
"(",
"propertyNode",
".",
"getNa... | Creates a statement body similar to:
<code>this.fireVetoableChange("field", field, field = value)</code>
@param propertyNode the field node for the property
@param fieldExpression a field expression for setting the property value
@return the created statement | [
"Creates",
"a",
"statement",
"body",
"similar",
"to",
":",
"<code",
">",
"this",
".",
"fireVetoableChange",
"(",
"field",
"field",
"field",
"=",
"value",
")",
"<",
"/",
"code",
">"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/beans/VetoableASTTransformation.java#L238-L240 |
demidenko05/beigesoft-webstore | src/main/java/org/beigesoft/webstore/processor/PrcRefreshItemsInList.java | PrcRefreshItemsInList.createItemInList | protected final <I extends IHasIdLongVersionName> ItemInList createItemInList(final Map<String, Object> pReqVars, final I pItem) throws Exception {
ItemInList itemInList = new ItemInList();
itemInList.setIsNew(true);
EShopItemType itemType;
if (pItem.getClass() == InvItem.class) {
itemType = EShopItemType.GOODS;
} else if (pItem.getClass() == ServiceToSale.class) {
itemType = EShopItemType.SERVICE;
} else if (pItem.getClass() == SeGoods.class) {
itemType = EShopItemType.SEGOODS;
} else if (pItem.getClass() == SeService.class) {
itemType = EShopItemType.SESERVICE;
} else {
throw new Exception("NYI for " + pItem.getClass());
}
itemInList.setItsType(itemType);
itemInList.setItemId(pItem.getItsId());
itemInList.setItsName(pItem.getItsName());
itemInList.setAvailableQuantity(BigDecimal.ZERO);
return itemInList;
} | java | protected final <I extends IHasIdLongVersionName> ItemInList createItemInList(final Map<String, Object> pReqVars, final I pItem) throws Exception {
ItemInList itemInList = new ItemInList();
itemInList.setIsNew(true);
EShopItemType itemType;
if (pItem.getClass() == InvItem.class) {
itemType = EShopItemType.GOODS;
} else if (pItem.getClass() == ServiceToSale.class) {
itemType = EShopItemType.SERVICE;
} else if (pItem.getClass() == SeGoods.class) {
itemType = EShopItemType.SEGOODS;
} else if (pItem.getClass() == SeService.class) {
itemType = EShopItemType.SESERVICE;
} else {
throw new Exception("NYI for " + pItem.getClass());
}
itemInList.setItsType(itemType);
itemInList.setItemId(pItem.getItsId());
itemInList.setItsName(pItem.getItsName());
itemInList.setAvailableQuantity(BigDecimal.ZERO);
return itemInList;
} | [
"protected",
"final",
"<",
"I",
"extends",
"IHasIdLongVersionName",
">",
"ItemInList",
"createItemInList",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"pReqVars",
",",
"final",
"I",
"pItem",
")",
"throws",
"Exception",
"{",
"ItemInList",
"itemInList"... | <p>Create ItemInList for item.</p>
@param <I> item type
@param pReqVars additional param
@param pItem Item
@return ItemInList
@throws Exception - an exception | [
"<p",
">",
"Create",
"ItemInList",
"for",
"item",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-webstore/blob/41ed2e2f1c640d37951d5fb235f26856008b87e1/src/main/java/org/beigesoft/webstore/processor/PrcRefreshItemsInList.java#L1202-L1222 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/performance/PerformanceTracker.java | PerformanceTracker.addMemoryTransaction | public long addMemoryTransaction(int deviceId, long timeSpentNanos, long numberOfBytes) {
// default is H2H transaction
return addMemoryTransaction(deviceId, timeSpentNanos, numberOfBytes, MemcpyDirection.HOST_TO_HOST);
} | java | public long addMemoryTransaction(int deviceId, long timeSpentNanos, long numberOfBytes) {
// default is H2H transaction
return addMemoryTransaction(deviceId, timeSpentNanos, numberOfBytes, MemcpyDirection.HOST_TO_HOST);
} | [
"public",
"long",
"addMemoryTransaction",
"(",
"int",
"deviceId",
",",
"long",
"timeSpentNanos",
",",
"long",
"numberOfBytes",
")",
"{",
"// default is H2H transaction",
"return",
"addMemoryTransaction",
"(",
"deviceId",
",",
"timeSpentNanos",
",",
"numberOfBytes",
",",... | This method stores bandwidth used for given transaction.
PLEASE NOTE: Bandwidth is stored in per millisecond value.
@param deviceId device used for this transaction
@param timeSpent time spent on this transaction in nanoseconds
@param numberOfBytes number of bytes | [
"This",
"method",
"stores",
"bandwidth",
"used",
"for",
"given",
"transaction",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ops/performance/PerformanceTracker.java#L64-L67 |
nilsreiter/uima-util | src/main/java/de/unistuttgart/ims/uimautil/AnnotationUtil.java | AnnotationUtil.trimEnd | public static <T extends Annotation> T trimEnd(T annotation, char... ws) {
char[] s = annotation.getCoveredText().toCharArray();
if (s.length == 0)
return annotation;
int e = 0;
while (ArrayUtils.contains(ws, s[(s.length - 1) - e])) {
e++;
}
annotation.setEnd(annotation.getEnd() - e);
return annotation;
} | java | public static <T extends Annotation> T trimEnd(T annotation, char... ws) {
char[] s = annotation.getCoveredText().toCharArray();
if (s.length == 0)
return annotation;
int e = 0;
while (ArrayUtils.contains(ws, s[(s.length - 1) - e])) {
e++;
}
annotation.setEnd(annotation.getEnd() - e);
return annotation;
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"trimEnd",
"(",
"T",
"annotation",
",",
"char",
"...",
"ws",
")",
"{",
"char",
"[",
"]",
"s",
"=",
"annotation",
".",
"getCoveredText",
"(",
")",
".",
"toCharArray",
"(",
")",
";",
"if"... | Moves the end-index as long a character that is contained in the array is
at the end.
@param annotation
The annotation to be trimmed.
@param ws
An array of characters which are considered whitespace
@return The trimmed annotation
@since 0.4.2 | [
"Moves",
"the",
"end",
"-",
"index",
"as",
"long",
"a",
"character",
"that",
"is",
"contained",
"in",
"the",
"array",
"is",
"at",
"the",
"end",
"."
] | train | https://github.com/nilsreiter/uima-util/blob/6f3bc3b8785702fe4ab9b670b87eaa215006f593/src/main/java/de/unistuttgart/ims/uimautil/AnnotationUtil.java#L172-L183 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java | ScriptingUtils.executeGroovyScript | public static <T> T executeGroovyScript(final Resource groovyScript,
final Object[] args, final Class<T> clazz,
final boolean failOnError) {
return executeGroovyScript(groovyScript, "run", args, clazz, failOnError);
} | java | public static <T> T executeGroovyScript(final Resource groovyScript,
final Object[] args, final Class<T> clazz,
final boolean failOnError) {
return executeGroovyScript(groovyScript, "run", args, clazz, failOnError);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"executeGroovyScript",
"(",
"final",
"Resource",
"groovyScript",
",",
"final",
"Object",
"[",
"]",
"args",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"boolean",
"failOnError",
")",
"{",
"return",
... | Execute groovy script via run object.
@param <T> the type parameter
@param groovyScript the groovy script
@param args the args
@param clazz the clazz
@param failOnError the fail on error
@return the object | [
"Execute",
"groovy",
"script",
"via",
"run",
"object",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java#L135-L139 |
apache/incubator-heron | heron/packing/src/java/org/apache/heron/packing/roundrobin/ResourceCompliantRRPacking.java | ResourceCompliantRRPacking.flexibleRRpolicy | private void flexibleRRpolicy(PackingPlanBuilder planBuilder,
String componentName) throws ResourceExceededException {
// If there is not enough space on containerId look at other containers in a RR fashion
// starting from containerId.
ContainerIdScorer scorer = new ContainerIdScorer(this.containerId, this.numContainers);
this.containerId = nextContainerId(planBuilder.addInstance(scorer, componentName));
} | java | private void flexibleRRpolicy(PackingPlanBuilder planBuilder,
String componentName) throws ResourceExceededException {
// If there is not enough space on containerId look at other containers in a RR fashion
// starting from containerId.
ContainerIdScorer scorer = new ContainerIdScorer(this.containerId, this.numContainers);
this.containerId = nextContainerId(planBuilder.addInstance(scorer, componentName));
} | [
"private",
"void",
"flexibleRRpolicy",
"(",
"PackingPlanBuilder",
"planBuilder",
",",
"String",
"componentName",
")",
"throws",
"ResourceExceededException",
"{",
"// If there is not enough space on containerId look at other containers in a RR fashion",
"// starting from containerId.",
... | Performs a RR placement. Tries to place the instance on any container with space, starting at
containerId and cycling through the container set until it can be placed.
@param planBuilder packing plan builder
@param componentName the component name of the instance that needs to be placed in the container
@throws ResourceExceededException if there is no room on any container to place the instance | [
"Performs",
"a",
"RR",
"placement",
".",
"Tries",
"to",
"place",
"the",
"instance",
"on",
"any",
"container",
"with",
"space",
"starting",
"at",
"containerId",
"and",
"cycling",
"through",
"the",
"container",
"set",
"until",
"it",
"can",
"be",
"placed",
"."
... | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/packing/src/java/org/apache/heron/packing/roundrobin/ResourceCompliantRRPacking.java#L303-L309 |
medallia/Word2VecJava | src/main/java/com/medallia/word2vec/util/ProfilingTimer.java | ProfilingTimer.createLoggingSubtasks | public static ProfilingTimer createLoggingSubtasks(final Log log, final String processName, final Object... args) {
return create(log, false, null, processName, args);
} | java | public static ProfilingTimer createLoggingSubtasks(final Log log, final String processName, final Object... args) {
return create(log, false, null, processName, args);
} | [
"public",
"static",
"ProfilingTimer",
"createLoggingSubtasks",
"(",
"final",
"Log",
"log",
",",
"final",
"String",
"processName",
",",
"final",
"Object",
"...",
"args",
")",
"{",
"return",
"create",
"(",
"log",
",",
"false",
",",
"null",
",",
"processName",
... | Same as {@link #create(Log, String, Object...)} but logs subtasks as well | [
"Same",
"as",
"{"
] | train | https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/ProfilingTimer.java#L177-L179 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/RedisClient.java | RedisClient.connectSentinel | public <K, V> StatefulRedisSentinelConnection<K, V> connectSentinel(RedisCodec<K, V> codec, RedisURI redisURI) {
assertNotNull(redisURI);
return getConnection(connectSentinelAsync(codec, redisURI, redisURI.getTimeout()));
} | java | public <K, V> StatefulRedisSentinelConnection<K, V> connectSentinel(RedisCodec<K, V> codec, RedisURI redisURI) {
assertNotNull(redisURI);
return getConnection(connectSentinelAsync(codec, redisURI, redisURI.getTimeout()));
} | [
"public",
"<",
"K",
",",
"V",
">",
"StatefulRedisSentinelConnection",
"<",
"K",
",",
"V",
">",
"connectSentinel",
"(",
"RedisCodec",
"<",
"K",
",",
"V",
">",
"codec",
",",
"RedisURI",
"redisURI",
")",
"{",
"assertNotNull",
"(",
"redisURI",
")",
";",
"ret... | Open a connection to a Redis Sentinel using the supplied {@link RedisURI} and use the supplied {@link RedisCodec codec}
to encode/decode keys and values. The client {@link RedisURI} must contain one or more sentinels.
@param codec the Redis server to connect to, must not be {@literal null}
@param redisURI the Redis server to connect to, must not be {@literal null}
@param <K> Key type
@param <V> Value type
@return A new connection | [
"Open",
"a",
"connection",
"to",
"a",
"Redis",
"Sentinel",
"using",
"the",
"supplied",
"{",
"@link",
"RedisURI",
"}",
"and",
"use",
"the",
"supplied",
"{",
"@link",
"RedisCodec",
"codec",
"}",
"to",
"encode",
"/",
"decode",
"keys",
"and",
"values",
".",
... | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/RedisClient.java#L493-L498 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric_ca/sdk/HFCAAffiliation.java | HFCAAffiliation.createDecendent | public HFCAAffiliation createDecendent(String name) throws InvalidArgumentException, AffiliationException {
if (this.deleted) {
throw new AffiliationException("Affiliation has been deleted");
}
validateAffiliationNames(name);
return new HFCAAffiliation(this.name + "." + name, this.client);
} | java | public HFCAAffiliation createDecendent(String name) throws InvalidArgumentException, AffiliationException {
if (this.deleted) {
throw new AffiliationException("Affiliation has been deleted");
}
validateAffiliationNames(name);
return new HFCAAffiliation(this.name + "." + name, this.client);
} | [
"public",
"HFCAAffiliation",
"createDecendent",
"(",
"String",
"name",
")",
"throws",
"InvalidArgumentException",
",",
"AffiliationException",
"{",
"if",
"(",
"this",
".",
"deleted",
")",
"{",
"throw",
"new",
"AffiliationException",
"(",
"\"Affiliation has been deleted\... | The identities affected during request
@param name Name of the child affiliation
@return The requested child affiliation
@throws InvalidArgumentException
@throws AffiliationException | [
"The",
"identities",
"affected",
"during",
"request",
"@param",
"name",
"Name",
"of",
"the",
"child",
"affiliation"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAAffiliation.java#L147-L153 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java | FormatUtil.appendZeros | public static StringBuilder appendZeros(StringBuilder buf, int zeros) {
for(int i = zeros; i > 0; i -= ZEROPADDING.length) {
buf.append(ZEROPADDING, 0, i < ZEROPADDING.length ? i : ZEROPADDING.length);
}
return buf;
} | java | public static StringBuilder appendZeros(StringBuilder buf, int zeros) {
for(int i = zeros; i > 0; i -= ZEROPADDING.length) {
buf.append(ZEROPADDING, 0, i < ZEROPADDING.length ? i : ZEROPADDING.length);
}
return buf;
} | [
"public",
"static",
"StringBuilder",
"appendZeros",
"(",
"StringBuilder",
"buf",
",",
"int",
"zeros",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"zeros",
";",
"i",
">",
"0",
";",
"i",
"-=",
"ZEROPADDING",
".",
"length",
")",
"{",
"buf",
".",
"append",
"(... | Append zeros to a buffer.
@param buf Buffer to append to
@param zeros Number of zeros to append.
@return Buffer | [
"Append",
"zeros",
"to",
"a",
"buffer",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java#L975-L980 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/Circles.java | Circles.isInside | public static boolean isInside(Circle circle, double x, double y)
{
return distanceFromCenter(circle, x, y) < circle.getRadius();
} | java | public static boolean isInside(Circle circle, double x, double y)
{
return distanceFromCenter(circle, x, y) < circle.getRadius();
} | [
"public",
"static",
"boolean",
"isInside",
"(",
"Circle",
"circle",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"distanceFromCenter",
"(",
"circle",
",",
"x",
",",
"y",
")",
"<",
"circle",
".",
"getRadius",
"(",
")",
";",
"}"
] | Returns true if point (x, y) is inside circle
@param circle
@param x
@param y
@return | [
"Returns",
"true",
"if",
"point",
"(",
"x",
"y",
")",
"is",
"inside",
"circle"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Circles.java#L50-L53 |
samskivert/pythagoras | src/main/java/pythagoras/d/CubicCurve.java | CubicCurve.setCurve | public void setCurve (double[] coords, int offset) {
setCurve(coords[offset + 0], coords[offset + 1], coords[offset + 2], coords[offset + 3],
coords[offset + 4], coords[offset + 5], coords[offset + 6], coords[offset + 7]);
} | java | public void setCurve (double[] coords, int offset) {
setCurve(coords[offset + 0], coords[offset + 1], coords[offset + 2], coords[offset + 3],
coords[offset + 4], coords[offset + 5], coords[offset + 6], coords[offset + 7]);
} | [
"public",
"void",
"setCurve",
"(",
"double",
"[",
"]",
"coords",
",",
"int",
"offset",
")",
"{",
"setCurve",
"(",
"coords",
"[",
"offset",
"+",
"0",
"]",
",",
"coords",
"[",
"offset",
"+",
"1",
"]",
",",
"coords",
"[",
"offset",
"+",
"2",
"]",
",... | Configures the start, control and end points for this curve, using the values at the
specified offset in the {@code coords} 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/CubicCurve.java#L81-L84 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java | AlignedBox3d.setX | @Override
public void setX(double min, double max) {
if (min <= max) {
this.minxProperty.set(min);
this.maxxProperty.set(max);
} else {
this.minxProperty.set(max);
this.maxxProperty.set(min);
}
} | java | @Override
public void setX(double min, double max) {
if (min <= max) {
this.minxProperty.set(min);
this.maxxProperty.set(max);
} else {
this.minxProperty.set(max);
this.maxxProperty.set(min);
}
} | [
"@",
"Override",
"public",
"void",
"setX",
"(",
"double",
"min",
",",
"double",
"max",
")",
"{",
"if",
"(",
"min",
"<=",
"max",
")",
"{",
"this",
".",
"minxProperty",
".",
"set",
"(",
"min",
")",
";",
"this",
".",
"maxxProperty",
".",
"set",
"(",
... | Set the x bounds of the box.
@param min the min value for the x axis.
@param max the max value for the x axis. | [
"Set",
"the",
"x",
"bounds",
"of",
"the",
"box",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L671-L680 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java | UScript.hasScript | public static final boolean hasScript(int c, int sc) {
int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK;
if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) {
return sc==scriptX;
}
char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_;
int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions
if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) {
scx=scriptExtensions[scx+1];
}
if(sc>0x7fff) {
// Guard against bogus input that would
// make us go past the Script_Extensions terminator.
return false;
}
while(sc>scriptExtensions[scx]) {
++scx;
}
return sc==(scriptExtensions[scx]&0x7fff);
} | java | public static final boolean hasScript(int c, int sc) {
int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK;
if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) {
return sc==scriptX;
}
char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_;
int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions
if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) {
scx=scriptExtensions[scx+1];
}
if(sc>0x7fff) {
// Guard against bogus input that would
// make us go past the Script_Extensions terminator.
return false;
}
while(sc>scriptExtensions[scx]) {
++scx;
}
return sc==(scriptExtensions[scx]&0x7fff);
} | [
"public",
"static",
"final",
"boolean",
"hasScript",
"(",
"int",
"c",
",",
"int",
"sc",
")",
"{",
"int",
"scriptX",
"=",
"UCharacterProperty",
".",
"INSTANCE",
".",
"getAdditional",
"(",
"c",
",",
"0",
")",
"&",
"UCharacterProperty",
".",
"SCRIPT_X_MASK",
... | Do the Script_Extensions of code point c contain script sc?
If c does not have explicit Script_Extensions, then this tests whether
c has the Script property value sc.
<p>Some characters are commonly used in multiple scripts.
For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
@param c code point
@param sc script code
@return true if sc is in Script_Extensions(c) | [
"Do",
"the",
"Script_Extensions",
"of",
"code",
"point",
"c",
"contain",
"script",
"sc?",
"If",
"c",
"does",
"not",
"have",
"explicit",
"Script_Extensions",
"then",
"this",
"tests",
"whether",
"c",
"has",
"the",
"Script",
"property",
"value",
"sc",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L972-L992 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/BusGroup.java | BusGroup.generateReplySubscriptionMessage | protected SubscriptionMessage generateReplySubscriptionMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "generateReplySubscriptionMessage");
// Get the Message Handler for doing this operation.
final SubscriptionMessageHandler messageHandler =
iProxyHandler.getMessageHandler();
// Reset the message.
messageHandler.resetReplySubscriptionMessage();
if (iLocalSubscriptions.size() > 0)
// Add the local subscriptions
addToMessage(messageHandler, iLocalSubscriptions);
if (iRemoteSubscriptions.size() > 0)
// Add the remote Subscriptions
addToMessage(messageHandler, iRemoteSubscriptions);
SubscriptionMessage message = messageHandler.getSubscriptionMessage();
// Add the message back into the pool
iProxyHandler.addMessageHandler(messageHandler);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "generateReplySubscriptionMessage", message);
return message;
} | java | protected SubscriptionMessage generateReplySubscriptionMessage()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "generateReplySubscriptionMessage");
// Get the Message Handler for doing this operation.
final SubscriptionMessageHandler messageHandler =
iProxyHandler.getMessageHandler();
// Reset the message.
messageHandler.resetReplySubscriptionMessage();
if (iLocalSubscriptions.size() > 0)
// Add the local subscriptions
addToMessage(messageHandler, iLocalSubscriptions);
if (iRemoteSubscriptions.size() > 0)
// Add the remote Subscriptions
addToMessage(messageHandler, iRemoteSubscriptions);
SubscriptionMessage message = messageHandler.getSubscriptionMessage();
// Add the message back into the pool
iProxyHandler.addMessageHandler(messageHandler);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "generateReplySubscriptionMessage", message);
return message;
} | [
"protected",
"SubscriptionMessage",
"generateReplySubscriptionMessage",
"(",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"generateReplySubsc... | Generates the reply subscription message that should be sent to a
the neighbor on the Bus who sent the request.
@return a new ReplySubscriptionMessage | [
"Generates",
"the",
"reply",
"subscription",
"message",
"that",
"should",
"be",
"sent",
"to",
"a",
"the",
"neighbor",
"on",
"the",
"Bus",
"who",
"sent",
"the",
"request",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/BusGroup.java#L805-L834 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/activity/AdviceActivity.java | AdviceActivity.putAspectAdviceBean | protected void putAspectAdviceBean(String aspectId, Object adviceBean) {
if (aspectAdviceResult == null) {
aspectAdviceResult = new AspectAdviceResult();
}
aspectAdviceResult.putAspectAdviceBean(aspectId, adviceBean);
} | java | protected void putAspectAdviceBean(String aspectId, Object adviceBean) {
if (aspectAdviceResult == null) {
aspectAdviceResult = new AspectAdviceResult();
}
aspectAdviceResult.putAspectAdviceBean(aspectId, adviceBean);
} | [
"protected",
"void",
"putAspectAdviceBean",
"(",
"String",
"aspectId",
",",
"Object",
"adviceBean",
")",
"{",
"if",
"(",
"aspectAdviceResult",
"==",
"null",
")",
"{",
"aspectAdviceResult",
"=",
"new",
"AspectAdviceResult",
"(",
")",
";",
"}",
"aspectAdviceResult",... | Puts the aspect advice bean.
@param aspectId the aspect id
@param adviceBean the advice bean | [
"Puts",
"the",
"aspect",
"advice",
"bean",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/activity/AdviceActivity.java#L461-L466 |
leancloud/java-sdk-all | core/src/main/java/cn/leancloud/upload/QiniuAccessor.java | QiniuAccessor.createBlockInQiniu | public QiniuBlockResponseData createBlockInQiniu(int blockSize, int firstChunkSize,
final byte[] firstChunkData, int retry) {
try {
String endPoint = String.format(QINIU_CREATE_BLOCK_EP, this.uploadUrl, blockSize);
Request.Builder builder = new Request.Builder();
builder.url(endPoint);
builder.addHeader(HEAD_CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
builder.addHeader(HEAD_CONTENT_LENGTH, String.valueOf(firstChunkSize));
builder.addHeader(HEAD_AUTHORIZATION, "UpToken " + this.uploadToken);
LOGGER.d("createBlockInQiniu with uploadUrl: " + endPoint);
RequestBody requestBody = RequestBody.create(MediaType.parse(DEFAULT_CONTENT_TYPE), firstChunkData, 0, firstChunkSize);
builder = builder.post(requestBody);
Response response = this.client.newCall(builder.build()).execute();
return parseQiniuResponse(response, QiniuBlockResponseData.class);
} catch (Exception e) {
if (retry-- > 0) {
return createBlockInQiniu(blockSize, firstChunkSize, firstChunkData, retry);
} else {
LOGGER.w(e);
}
}
return null;
} | java | public QiniuBlockResponseData createBlockInQiniu(int blockSize, int firstChunkSize,
final byte[] firstChunkData, int retry) {
try {
String endPoint = String.format(QINIU_CREATE_BLOCK_EP, this.uploadUrl, blockSize);
Request.Builder builder = new Request.Builder();
builder.url(endPoint);
builder.addHeader(HEAD_CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
builder.addHeader(HEAD_CONTENT_LENGTH, String.valueOf(firstChunkSize));
builder.addHeader(HEAD_AUTHORIZATION, "UpToken " + this.uploadToken);
LOGGER.d("createBlockInQiniu with uploadUrl: " + endPoint);
RequestBody requestBody = RequestBody.create(MediaType.parse(DEFAULT_CONTENT_TYPE), firstChunkData, 0, firstChunkSize);
builder = builder.post(requestBody);
Response response = this.client.newCall(builder.build()).execute();
return parseQiniuResponse(response, QiniuBlockResponseData.class);
} catch (Exception e) {
if (retry-- > 0) {
return createBlockInQiniu(blockSize, firstChunkSize, firstChunkData, retry);
} else {
LOGGER.w(e);
}
}
return null;
} | [
"public",
"QiniuBlockResponseData",
"createBlockInQiniu",
"(",
"int",
"blockSize",
",",
"int",
"firstChunkSize",
",",
"final",
"byte",
"[",
"]",
"firstChunkData",
",",
"int",
"retry",
")",
"{",
"try",
"{",
"String",
"endPoint",
"=",
"String",
".",
"format",
"(... | REST API:
- POST /mkblk/<blockSize> HTTP/1.1
- Host: upload.qiniu.com
- Content-Type: application/octet-stream
- Content-Length: <firstChunkSize>
- Authorization: UpToken <UploadToken>
- <firstChunkBinary>
- Response
{
"ctx": "<Ctx string>",
"checksum": "<Checksum string>",
"crc32": <Crc32 int64>,
"offset": <Offset int64>,
"host": "<UpHost string>"
}
@param blockSize
@param firstChunkSize
@param firstChunkData
@param retry
@return | [
"REST",
"API",
":",
"-",
"POST",
"/",
"mkblk",
"/",
"<blockSize",
">",
"HTTP",
"/",
"1",
".",
"1",
"-",
"Host",
":",
"upload",
".",
"qiniu",
".",
"com",
"-",
"Content",
"-",
"Type",
":",
"application",
"/",
"octet",
"-",
"stream",
"-",
"Content",
... | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/core/src/main/java/cn/leancloud/upload/QiniuAccessor.java#L206-L231 |
stevespringett/Alpine | alpine/src/main/java/alpine/resources/AlpineResource.java | AlpineResource.logSecurityEvent | protected void logSecurityEvent(final Logger logger, final Marker marker, final String message) {
if (!(SecurityMarkers.SECURITY_AUDIT == marker ||
SecurityMarkers.SECURITY_SUCCESS == marker ||
SecurityMarkers.SECURITY_FAILURE == marker)) {
return;
}
final StringBuilder sb = new StringBuilder();
sb.append(message).append(" ");
if (getPrincipal() != null) {
sb.append("by: ").append(getPrincipal().getName()).append(" ");
}
sb.append("/ IP Address: ").append(getRemoteAddress()).append(" ");
sb.append("/ User Agent: ").append(getUserAgent());
logger.info(marker, sb.toString());
} | java | protected void logSecurityEvent(final Logger logger, final Marker marker, final String message) {
if (!(SecurityMarkers.SECURITY_AUDIT == marker ||
SecurityMarkers.SECURITY_SUCCESS == marker ||
SecurityMarkers.SECURITY_FAILURE == marker)) {
return;
}
final StringBuilder sb = new StringBuilder();
sb.append(message).append(" ");
if (getPrincipal() != null) {
sb.append("by: ").append(getPrincipal().getName()).append(" ");
}
sb.append("/ IP Address: ").append(getRemoteAddress()).append(" ");
sb.append("/ User Agent: ").append(getUserAgent());
logger.info(marker, sb.toString());
} | [
"protected",
"void",
"logSecurityEvent",
"(",
"final",
"Logger",
"logger",
",",
"final",
"Marker",
"marker",
",",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"!",
"(",
"SecurityMarkers",
".",
"SECURITY_AUDIT",
"==",
"marker",
"||",
"SecurityMarkers",
".... | Logs a security event to the security audit log. Expects one of:
{@link SecurityMarkers#SECURITY_AUDIT}
{@link SecurityMarkers#SECURITY_SUCCESS}
{@link SecurityMarkers#SECURITY_FAILURE}
@param logger the logger to use
@param marker the marker to add to the event
@param message the initial content of the event
@since 1.0.0 | [
"Logs",
"a",
"security",
"event",
"to",
"the",
"security",
"audit",
"log",
".",
"Expects",
"one",
"of",
":",
"{"
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/resources/AlpineResource.java#L395-L409 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ArrayUtils.java | ArrayUtils.addAll | public static <T> void addAll(Collection<? super T> collection, Collection<? extends T> toAdd)
{
if (collection == null || toAdd == null)
{
return;
}
if (toAdd instanceof RandomAccess)
{
List<? extends T> randomAccess = (List<? extends T>) toAdd;
for (int i = 0, size = randomAccess.size(); i < size; i++)
{
T element = randomAccess.get(i);
collection.add(element);
}
}
else
{
collection.addAll(toAdd);
}
} | java | public static <T> void addAll(Collection<? super T> collection, Collection<? extends T> toAdd)
{
if (collection == null || toAdd == null)
{
return;
}
if (toAdd instanceof RandomAccess)
{
List<? extends T> randomAccess = (List<? extends T>) toAdd;
for (int i = 0, size = randomAccess.size(); i < size; i++)
{
T element = randomAccess.get(i);
collection.add(element);
}
}
else
{
collection.addAll(toAdd);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"addAll",
"(",
"Collection",
"<",
"?",
"super",
"T",
">",
"collection",
",",
"Collection",
"<",
"?",
"extends",
"T",
">",
"toAdd",
")",
"{",
"if",
"(",
"collection",
"==",
"null",
"||",
"toAdd",
"==",
"null"... | Same as {@link Collection#addAll(Collection)} but in case of RandomAccess iterates over indices | [
"Same",
"as",
"{"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ArrayUtils.java#L234-L253 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.loadBalancing_serviceName_portsRedirection_POST | public OvhLoadBalancingTask loadBalancing_serviceName_portsRedirection_POST(String serviceName, OvhLoadBalancingPort body) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/portsRedirection";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "POST", sb.toString(), body);
return convertTo(resp, OvhLoadBalancingTask.class);
} | java | public OvhLoadBalancingTask loadBalancing_serviceName_portsRedirection_POST(String serviceName, OvhLoadBalancingPort body) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/portsRedirection";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "POST", sb.toString(), body);
return convertTo(resp, OvhLoadBalancingTask.class);
} | [
"public",
"OvhLoadBalancingTask",
"loadBalancing_serviceName_portsRedirection_POST",
"(",
"String",
"serviceName",
",",
"OvhLoadBalancingPort",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/loadBalancing/{serviceName}/portsRedirection\"",
";",
"StringB... | Add a new port redirection
REST: POST /ip/loadBalancing/{serviceName}/portsRedirection
@param body [required] The port you want to redirect to
@param serviceName [required] The internal name of your IP load balancing | [
"Add",
"a",
"new",
"port",
"redirection"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1541-L1546 |
loldevs/riotapi | rtmp/src/main/java/net/boreeas/riotapi/rtmp/RtmpClient.java | RtmpClient.sendRpcWithEndpoint | public InvokeCallback sendRpcWithEndpoint(String endpoint, String service, String method, Object... args) {
RemotingMessage message = createRemotingMessage(endpoint, service, method, args);
Invoke invoke = createAmf3InvokeSkeleton(null, message);
InvokeCallback callback = getInvokeCallback(invoke.getInvokeId());
send(invoke);
return callback;
} | java | public InvokeCallback sendRpcWithEndpoint(String endpoint, String service, String method, Object... args) {
RemotingMessage message = createRemotingMessage(endpoint, service, method, args);
Invoke invoke = createAmf3InvokeSkeleton(null, message);
InvokeCallback callback = getInvokeCallback(invoke.getInvokeId());
send(invoke);
return callback;
} | [
"public",
"InvokeCallback",
"sendRpcWithEndpoint",
"(",
"String",
"endpoint",
",",
"String",
"service",
",",
"String",
"method",
",",
"Object",
"...",
"args",
")",
"{",
"RemotingMessage",
"message",
"=",
"createRemotingMessage",
"(",
"endpoint",
",",
"service",
",... | Send a remote procedure call.
@param endpoint The endpoint of the call
@param service The service handling the call
@param method The method to call
@param args Optional args to the call
@return The callback getting called once the rpc returns a result | [
"Send",
"a",
"remote",
"procedure",
"call",
"."
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rtmp/src/main/java/net/boreeas/riotapi/rtmp/RtmpClient.java#L629-L636 |
nguillaumin/slick2d-maven | slick2d-scalar/src/main/java/org/newdawn/slick/tools/scalar/RawScale2x.java | RawScale2x.getSourcePixel | private int getSourcePixel(int x,int y)
{
x = Math.max(0,x);
x = Math.min(width-1,x);
y = Math.max(0,y);
y = Math.min(height-1,y);
return srcImage[x+(y*width)];
} | java | private int getSourcePixel(int x,int y)
{
x = Math.max(0,x);
x = Math.min(width-1,x);
y = Math.max(0,y);
y = Math.min(height-1,y);
return srcImage[x+(y*width)];
} | [
"private",
"int",
"getSourcePixel",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"x",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"x",
")",
";",
"x",
"=",
"Math",
".",
"min",
"(",
"width",
"-",
"1",
",",
"x",
")",
";",
"y",
"=",
"Math",
".",
"... | Get a pixel from the source image. This handles bonds checks
and resolves to edge pixels
@param x The x location of the pixel to retrieve
@param y The y location of the pixel to retrieve
@return The pixel value at the specified location | [
"Get",
"a",
"pixel",
"from",
"the",
"source",
"image",
".",
"This",
"handles",
"bonds",
"checks",
"and",
"resolves",
"to",
"edge",
"pixels"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-scalar/src/main/java/org/newdawn/slick/tools/scalar/RawScale2x.java#L69-L77 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/metadata/StoredProcedure.java | StoredProcedure.equalsNull | private boolean equalsNull(String value1, String value2) {
return (value1 == value2 || value1 == null || (value1 != null && value1.equalsIgnoreCase(value2)));
} | java | private boolean equalsNull(String value1, String value2) {
return (value1 == value2 || value1 == null || (value1 != null && value1.equalsIgnoreCase(value2)));
} | [
"private",
"boolean",
"equalsNull",
"(",
"String",
"value1",
",",
"String",
"value2",
")",
"{",
"return",
"(",
"value1",
"==",
"value2",
"||",
"value1",
"==",
"null",
"||",
"(",
"value1",
"!=",
"null",
"&&",
"value1",
".",
"equalsIgnoreCase",
"(",
"value2"... | Compares two values. Treats null as equal and is case insensitive
@param value1 First value to compare
@param value2 Second value to compare
@return true if two values equals | [
"Compares",
"two",
"values",
".",
"Treats",
"null",
"as",
"equal",
"and",
"is",
"case",
"insensitive"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/metadata/StoredProcedure.java#L126-L128 |
dbracewell/mango | src/main/java/com/davidbracewell/conversion/Val.java | Val.asCollection | public <E, T extends Collection<E>> T asCollection(@NonNull Class<?> collectionClass, @NonNull Class<E> genericClass) {
T rval = Convert.convert(toConvert, collectionClass, genericClass);
if (rval == null) {
return Collect.create(Cast.as(collectionClass));
}
return rval;
} | java | public <E, T extends Collection<E>> T asCollection(@NonNull Class<?> collectionClass, @NonNull Class<E> genericClass) {
T rval = Convert.convert(toConvert, collectionClass, genericClass);
if (rval == null) {
return Collect.create(Cast.as(collectionClass));
}
return rval;
} | [
"public",
"<",
"E",
",",
"T",
"extends",
"Collection",
"<",
"E",
">",
">",
"T",
"asCollection",
"(",
"@",
"NonNull",
"Class",
"<",
"?",
">",
"collectionClass",
",",
"@",
"NonNull",
"Class",
"<",
"E",
">",
"genericClass",
")",
"{",
"T",
"rval",
"=",
... | Converts the object to a collection
@param <E> the type parameter
@param <T> the type parameter
@param collectionClass The collection to convert to
@param genericClass The class of the item in the collection
@return The object as a collection | [
"Converts",
"the",
"object",
"to",
"a",
"collection"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/conversion/Val.java#L112-L118 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/SerializationHandleMap.java | SerializationHandleMap.findIndex | private int findIndex(Object key, Object[] array) {
int length = array.length;
int index = getModuloHash(key, length);
int last = (index + length - 1) % length;
while (index != last) {
if (array[index] == key || array[index] == null) {
/*
* Found the key, or the next empty spot (which means key is not
* in the table)
*/
break;
}
index = (index + 1) % length;
}
return index;
} | java | private int findIndex(Object key, Object[] array) {
int length = array.length;
int index = getModuloHash(key, length);
int last = (index + length - 1) % length;
while (index != last) {
if (array[index] == key || array[index] == null) {
/*
* Found the key, or the next empty spot (which means key is not
* in the table)
*/
break;
}
index = (index + 1) % length;
}
return index;
} | [
"private",
"int",
"findIndex",
"(",
"Object",
"key",
",",
"Object",
"[",
"]",
"array",
")",
"{",
"int",
"length",
"=",
"array",
".",
"length",
";",
"int",
"index",
"=",
"getModuloHash",
"(",
"key",
",",
"length",
")",
";",
"int",
"last",
"=",
"(",
... | Returns the index where the key is found at, or the index of the next
empty spot if the key is not found in this table. | [
"Returns",
"the",
"index",
"where",
"the",
"key",
"is",
"found",
"at",
"or",
"the",
"index",
"of",
"the",
"next",
"empty",
"spot",
"if",
"the",
"key",
"is",
"not",
"found",
"in",
"this",
"table",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/SerializationHandleMap.java#L74-L89 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/AbstractAggarwalYuOutlier.java | AbstractAggarwalYuOutlier.computeSubspace | protected DBIDs computeSubspace(int[] subspace, ArrayList<ArrayList<DBIDs>> ranges) {
HashSetModifiableDBIDs ids = DBIDUtil.newHashSet(ranges.get(subspace[0]).get(subspace[1]));
// intersect all selected dimensions
for(int i = 2, e = subspace.length - 1; i < e; i += 2) {
DBIDs current = ranges.get(subspace[i]).get(subspace[i + 1] - GENE_OFFSET);
ids.retainAll(current);
if(ids.isEmpty()) {
break;
}
}
return ids;
} | java | protected DBIDs computeSubspace(int[] subspace, ArrayList<ArrayList<DBIDs>> ranges) {
HashSetModifiableDBIDs ids = DBIDUtil.newHashSet(ranges.get(subspace[0]).get(subspace[1]));
// intersect all selected dimensions
for(int i = 2, e = subspace.length - 1; i < e; i += 2) {
DBIDs current = ranges.get(subspace[i]).get(subspace[i + 1] - GENE_OFFSET);
ids.retainAll(current);
if(ids.isEmpty()) {
break;
}
}
return ids;
} | [
"protected",
"DBIDs",
"computeSubspace",
"(",
"int",
"[",
"]",
"subspace",
",",
"ArrayList",
"<",
"ArrayList",
"<",
"DBIDs",
">",
">",
"ranges",
")",
"{",
"HashSetModifiableDBIDs",
"ids",
"=",
"DBIDUtil",
".",
"newHashSet",
"(",
"ranges",
".",
"get",
"(",
... | Method to get the ids in the given subspace.
@param subspace Subspace to process
@param ranges List of DBID ranges
@return ids | [
"Method",
"to",
"get",
"the",
"ids",
"in",
"the",
"given",
"subspace",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/AbstractAggarwalYuOutlier.java#L158-L169 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/matrix/MatrixIO.java | MatrixIO.convertFormat | public static File convertFormat(File matrix, Format current,
Format desired) throws IOException {
return convertFormat(matrix, current, desired, false);
} | java | public static File convertFormat(File matrix, Format current,
Format desired) throws IOException {
return convertFormat(matrix, current, desired, false);
} | [
"public",
"static",
"File",
"convertFormat",
"(",
"File",
"matrix",
",",
"Format",
"current",
",",
"Format",
"desired",
")",
"throws",
"IOException",
"{",
"return",
"convertFormat",
"(",
"matrix",
",",
"current",
",",
"desired",
",",
"false",
")",
";",
"}"
] | Converts the format of the input {@code matrix}, returning a temporary
file containing the matrix's data in the desired format.
@param matrix a file containing a matrix to convert
@param current the format of the {@code matrix} file
@param desired the format of the returned matrix file
@return a matrix file with the same data in the desired format
@throws IOException if any error occurs while reading the input matrix or
wring the output matrix | [
"Converts",
"the",
"format",
"of",
"the",
"input",
"{",
"@code",
"matrix",
"}",
"returning",
"a",
"temporary",
"file",
"containing",
"the",
"matrix",
"s",
"data",
"in",
"the",
"desired",
"format",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/MatrixIO.java#L219-L222 |
Red5/red5-server-common | src/main/java/org/red5/server/so/ClientSharedObject.java | ClientSharedObject.notifyUpdate | protected void notifyUpdate(String key, Map<String, Object> value) {
if (value.size() == 1) {
Map.Entry<String, Object> entry = value.entrySet().iterator().next();
notifyUpdate(entry.getKey(), entry.getValue());
return;
}
for (ISharedObjectListener listener : listeners) {
listener.onSharedObjectUpdate(this, key, value);
}
} | java | protected void notifyUpdate(String key, Map<String, Object> value) {
if (value.size() == 1) {
Map.Entry<String, Object> entry = value.entrySet().iterator().next();
notifyUpdate(entry.getKey(), entry.getValue());
return;
}
for (ISharedObjectListener listener : listeners) {
listener.onSharedObjectUpdate(this, key, value);
}
} | [
"protected",
"void",
"notifyUpdate",
"(",
"String",
"key",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"value",
")",
"{",
"if",
"(",
"value",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"... | Notify listeners on map attribute update
@param key
Updated attribute key
@param value
Updated attribute value | [
"Notify",
"listeners",
"on",
"map",
"attribute",
"update"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/ClientSharedObject.java#L225-L234 |
cdk/cdk | descriptor/cip/src/main/java/org/openscience/cdk/geometry/cip/LigancyFourChirality.java | LigancyFourChirality.project | public LigancyFourChirality project(ILigand[] newOrder) {
ITetrahedralChirality.Stereo newStereo = this.stereo;
// copy the current ordering, and work with that
ILigand[] newAtoms = new ILigand[4];
System.arraycopy(this.ligands, 0, newAtoms, 0, 4);
// now move atoms around to match the newOrder
for (int i = 0; i < 3; i++) {
if (!newAtoms[i].getLigandAtom().equals(newOrder[i].getLigandAtom())) {
// OK, not in the right position
// find the incorrect, old position
for (int j = i; j < 4; j++) {
if (newAtoms[j].getLigandAtom().equals(newOrder[i].getLigandAtom())) {
// found the incorrect position
swap(newAtoms, i, j);
// and swap the stereochemistry
if (newStereo == Stereo.CLOCKWISE) {
newStereo = Stereo.ANTI_CLOCKWISE;
} else {
newStereo = Stereo.CLOCKWISE;
}
}
}
}
}
return new LigancyFourChirality(chiralAtom, newAtoms, newStereo);
} | java | public LigancyFourChirality project(ILigand[] newOrder) {
ITetrahedralChirality.Stereo newStereo = this.stereo;
// copy the current ordering, and work with that
ILigand[] newAtoms = new ILigand[4];
System.arraycopy(this.ligands, 0, newAtoms, 0, 4);
// now move atoms around to match the newOrder
for (int i = 0; i < 3; i++) {
if (!newAtoms[i].getLigandAtom().equals(newOrder[i].getLigandAtom())) {
// OK, not in the right position
// find the incorrect, old position
for (int j = i; j < 4; j++) {
if (newAtoms[j].getLigandAtom().equals(newOrder[i].getLigandAtom())) {
// found the incorrect position
swap(newAtoms, i, j);
// and swap the stereochemistry
if (newStereo == Stereo.CLOCKWISE) {
newStereo = Stereo.ANTI_CLOCKWISE;
} else {
newStereo = Stereo.CLOCKWISE;
}
}
}
}
}
return new LigancyFourChirality(chiralAtom, newAtoms, newStereo);
} | [
"public",
"LigancyFourChirality",
"project",
"(",
"ILigand",
"[",
"]",
"newOrder",
")",
"{",
"ITetrahedralChirality",
".",
"Stereo",
"newStereo",
"=",
"this",
".",
"stereo",
";",
"// copy the current ordering, and work with that",
"ILigand",
"[",
"]",
"newAtoms",
"=",... | Recalculates the {@link LigancyFourChirality} based on the new, given atom ordering.
@param newOrder new order of atoms
@return the chirality following the new atom order | [
"Recalculates",
"the",
"{",
"@link",
"LigancyFourChirality",
"}",
"based",
"on",
"the",
"new",
"given",
"atom",
"ordering",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/cip/src/main/java/org/openscience/cdk/geometry/cip/LigancyFourChirality.java#L123-L149 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrQueryManager.java | JcrQueryManager.createQuery | public Query createQuery( QueryCommand command ) throws InvalidQueryException, RepositoryException {
session.checkLive();
if (command == null) {
// The query is not well-formed and cannot be parsed ...
throw new InvalidQueryException(JcrI18n.queryInLanguageIsNotValid.text(QueryLanguage.JCR_SQL2, command));
}
// Produce the expression string ...
String expression = Visitors.readable(command);
try {
// Parsing must be done now ...
PlanHints hints = new PlanHints();
hints.showPlan = true;
hints.hasFullTextSearch = true; // always include the score
hints.qualifyExpandedColumnNames = true; // always qualify expanded names with the selector name in JCR-SQL2
return resultWith(expression, QueryLanguage.JCR_SQL2, command, hints, null, null);
} catch (org.modeshape.jcr.query.parse.InvalidQueryException e) {
// The query was parsed, but there is an error in the query
String reason = e.getMessage();
throw new InvalidQueryException(JcrI18n.queryInLanguageIsNotValid.text(QueryLanguage.JCR_SQL2, expression, reason));
}
} | java | public Query createQuery( QueryCommand command ) throws InvalidQueryException, RepositoryException {
session.checkLive();
if (command == null) {
// The query is not well-formed and cannot be parsed ...
throw new InvalidQueryException(JcrI18n.queryInLanguageIsNotValid.text(QueryLanguage.JCR_SQL2, command));
}
// Produce the expression string ...
String expression = Visitors.readable(command);
try {
// Parsing must be done now ...
PlanHints hints = new PlanHints();
hints.showPlan = true;
hints.hasFullTextSearch = true; // always include the score
hints.qualifyExpandedColumnNames = true; // always qualify expanded names with the selector name in JCR-SQL2
return resultWith(expression, QueryLanguage.JCR_SQL2, command, hints, null, null);
} catch (org.modeshape.jcr.query.parse.InvalidQueryException e) {
// The query was parsed, but there is an error in the query
String reason = e.getMessage();
throw new InvalidQueryException(JcrI18n.queryInLanguageIsNotValid.text(QueryLanguage.JCR_SQL2, expression, reason));
}
} | [
"public",
"Query",
"createQuery",
"(",
"QueryCommand",
"command",
")",
"throws",
"InvalidQueryException",
",",
"RepositoryException",
"{",
"session",
".",
"checkLive",
"(",
")",
";",
"if",
"(",
"command",
"==",
"null",
")",
"{",
"// The query is not well-formed and ... | Creates a new JCR {@link Query} by specifying the query expression itself, the language in which the query is stated, the
{@link QueryCommand} representation. This method is more efficient than {@link #createQuery(String, String, Path, Locale)} if the
QueryCommand is created directly.
@param command the query command; may not be null
@return query the JCR query object; never null
@throws InvalidQueryException if expression is invalid or language is unsupported
@throws RepositoryException if the session is no longer live | [
"Creates",
"a",
"new",
"JCR",
"{",
"@link",
"Query",
"}",
"by",
"specifying",
"the",
"query",
"expression",
"itself",
"the",
"language",
"in",
"which",
"the",
"query",
"is",
"stated",
"the",
"{",
"@link",
"QueryCommand",
"}",
"representation",
".",
"This",
... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrQueryManager.java#L175-L195 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java | VirtualHubsInner.updateTags | public VirtualHubInner updateTags(String resourceGroupName, String virtualHubName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualHubName, tags).toBlocking().last().body();
} | java | public VirtualHubInner updateTags(String resourceGroupName, String virtualHubName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, virtualHubName, tags).toBlocking().last().body();
} | [
"public",
"VirtualHubInner",
"updateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualHubName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualHubN... | Updates VirtualHub tags.
@param resourceGroupName The resource group name of the VirtualHub.
@param virtualHubName The name of the VirtualHub.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualHubInner object if successful. | [
"Updates",
"VirtualHub",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java#L448-L450 |
google/closure-compiler | src/com/google/javascript/jscomp/InlineSimpleMethods.java | InlineSimpleMethods.replaceThis | private static void replaceThis(Node expectedGetprop, Node replacement) {
Node leftChild = expectedGetprop.getFirstChild();
if (leftChild.isThis()) {
expectedGetprop.replaceChild(leftChild, replacement);
} else {
replaceThis(leftChild, replacement);
}
} | java | private static void replaceThis(Node expectedGetprop, Node replacement) {
Node leftChild = expectedGetprop.getFirstChild();
if (leftChild.isThis()) {
expectedGetprop.replaceChild(leftChild, replacement);
} else {
replaceThis(leftChild, replacement);
}
} | [
"private",
"static",
"void",
"replaceThis",
"(",
"Node",
"expectedGetprop",
",",
"Node",
"replacement",
")",
"{",
"Node",
"leftChild",
"=",
"expectedGetprop",
".",
"getFirstChild",
"(",
")",
";",
"if",
"(",
"leftChild",
".",
"isThis",
"(",
")",
")",
"{",
"... | Finds the occurrence of "this" in the provided property tree and replaces
it with replacement | [
"Finds",
"the",
"occurrence",
"of",
"this",
"in",
"the",
"provided",
"property",
"tree",
"and",
"replaces",
"it",
"with",
"replacement"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/InlineSimpleMethods.java#L156-L163 |
apache/incubator-gobblin | gobblin-core-base/src/main/java/org/apache/gobblin/crypto/EncryptionFactory.java | EncryptionFactory.buildStreamCryptoProvider | @Synchronized
public static StreamCodec buildStreamCryptoProvider(String algorithm, Map<String, Object> parameters) {
for (EncryptionProvider provider : encryptionProviderLoader) {
log.debug("Looking for algorithm {} in provider {}", algorithm, provider.getClass().getName());
StreamCodec codec = provider.buildStreamCryptoProvider(algorithm, parameters);
if (codec != null) {
log.debug("Found algorithm {} in provider {}", algorithm, provider.getClass().getName());
return codec;
}
}
throw new IllegalArgumentException("Could not find a provider to build algorithm " + algorithm + " - is gobblin-crypto-provider in classpath?");
} | java | @Synchronized
public static StreamCodec buildStreamCryptoProvider(String algorithm, Map<String, Object> parameters) {
for (EncryptionProvider provider : encryptionProviderLoader) {
log.debug("Looking for algorithm {} in provider {}", algorithm, provider.getClass().getName());
StreamCodec codec = provider.buildStreamCryptoProvider(algorithm, parameters);
if (codec != null) {
log.debug("Found algorithm {} in provider {}", algorithm, provider.getClass().getName());
return codec;
}
}
throw new IllegalArgumentException("Could not find a provider to build algorithm " + algorithm + " - is gobblin-crypto-provider in classpath?");
} | [
"@",
"Synchronized",
"public",
"static",
"StreamCodec",
"buildStreamCryptoProvider",
"(",
"String",
"algorithm",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"for",
"(",
"EncryptionProvider",
"provider",
":",
"encryptionProviderLoader",
")"... | Return a StreamEncryptor for the given algorithm and with appropriate parameters.
@param algorithm Algorithm to build
@param parameters Parameters for algorithm
@return A StreamCodec for that algorithm
@throws IllegalArgumentException If the given algorithm/parameter pair cannot be built | [
"Return",
"a",
"StreamEncryptor",
"for",
"the",
"given",
"algorithm",
"and",
"with",
"appropriate",
"parameters",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/crypto/EncryptionFactory.java#L61-L73 |
oaqa/uima-ecd | src/main/java/edu/cmu/lti/oaqa/ecd/phase/ProcessingStepUtils.java | ProcessingStepUtils.getExecutionIdHash | public static String getExecutionIdHash(String experimentId, Trace trace, String sequenceId) {
HashFunction hf = Hashing.md5();
Hasher hasher = hf.newHasher();
hasher.putString(experimentId,StandardCharsets.UTF_8);
hasher.putString(trace.getTrace(),StandardCharsets.UTF_8);
hasher.putString(String.valueOf(sequenceId),StandardCharsets.UTF_8);
HashCode hash = hasher.hash();
final String traceHash = hash.toString();
return traceHash;
} | java | public static String getExecutionIdHash(String experimentId, Trace trace, String sequenceId) {
HashFunction hf = Hashing.md5();
Hasher hasher = hf.newHasher();
hasher.putString(experimentId,StandardCharsets.UTF_8);
hasher.putString(trace.getTrace(),StandardCharsets.UTF_8);
hasher.putString(String.valueOf(sequenceId),StandardCharsets.UTF_8);
HashCode hash = hasher.hash();
final String traceHash = hash.toString();
return traceHash;
} | [
"public",
"static",
"String",
"getExecutionIdHash",
"(",
"String",
"experimentId",
",",
"Trace",
"trace",
",",
"String",
"sequenceId",
")",
"{",
"HashFunction",
"hf",
"=",
"Hashing",
".",
"md5",
"(",
")",
";",
"Hasher",
"hasher",
"=",
"hf",
".",
"newHasher",... | Execution hash is computed from JCas currentExperimentId, trace and sequenceId
@return MD5 hash corresponding to the above mentioned elements | [
"Execution",
"hash",
"is",
"computed",
"from",
"JCas",
"currentExperimentId",
"trace",
"and",
"sequenceId"
] | train | https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/ecd/phase/ProcessingStepUtils.java#L120-L129 |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.createSequences | private void createSequences(Collection<Sequence> sequences, SchemaDescriptor schemaDescriptor, Store store) {
for (Sequence sequence : sequences) {
SequenceDesriptor sequenceDesriptor = store.create(SequenceDesriptor.class);
sequenceDesriptor.setName(sequence.getName());
sequenceDesriptor.setIncrement(sequence.getIncrement());
sequenceDesriptor.setMinimumValue(sequence.getMinimumValue().longValue());
sequenceDesriptor.setMaximumValue(sequence.getMaximumValue().longValue());
sequenceDesriptor.setCycle(sequence.isCycle());
schemaDescriptor.getSequences().add(sequenceDesriptor);
}
} | java | private void createSequences(Collection<Sequence> sequences, SchemaDescriptor schemaDescriptor, Store store) {
for (Sequence sequence : sequences) {
SequenceDesriptor sequenceDesriptor = store.create(SequenceDesriptor.class);
sequenceDesriptor.setName(sequence.getName());
sequenceDesriptor.setIncrement(sequence.getIncrement());
sequenceDesriptor.setMinimumValue(sequence.getMinimumValue().longValue());
sequenceDesriptor.setMaximumValue(sequence.getMaximumValue().longValue());
sequenceDesriptor.setCycle(sequence.isCycle());
schemaDescriptor.getSequences().add(sequenceDesriptor);
}
} | [
"private",
"void",
"createSequences",
"(",
"Collection",
"<",
"Sequence",
">",
"sequences",
",",
"SchemaDescriptor",
"schemaDescriptor",
",",
"Store",
"store",
")",
"{",
"for",
"(",
"Sequence",
"sequence",
":",
"sequences",
")",
"{",
"SequenceDesriptor",
"sequence... | Add the sequences of a schema to the schema descriptor.
@param sequences The sequences.
@param schemaDescriptor The schema descriptor.
@param store The store. | [
"Add",
"the",
"sequences",
"of",
"a",
"schema",
"to",
"the",
"schema",
"descriptor",
"."
] | train | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L317-L327 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java | AbstractElementVisitor6.visitUnknown | @Override
public R visitUnknown(Element e, P p) {
throw new UnknownElementException(e, p);
} | java | @Override
public R visitUnknown(Element e, P p) {
throw new UnknownElementException(e, p);
} | [
"@",
"Override",
"public",
"R",
"visitUnknown",
"(",
"Element",
"e",
",",
"P",
"p",
")",
"{",
"throw",
"new",
"UnknownElementException",
"(",
"e",
",",
"p",
")",
";",
"}"
] | {@inheritDoc}
@implSpec The default implementation of this method in
{@code AbstractElementVisitor6} will always throw
{@code new UnknownElementException(e, p)}.
This behavior is not required of a subclass.
@param e {@inheritDoc}
@param p {@inheritDoc}
@return a visitor-specified result
@throws UnknownElementException
a visitor implementation may optionally throw this exception | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java#L123-L126 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Widgets.java | Widgets.newTextArea | public static LimitedTextArea newTextArea (String text, int width, int height, int maxLength)
{
LimitedTextArea area = new LimitedTextArea(maxLength, width, height);
if (text != null) {
area.setText(text);
}
return area;
} | java | public static LimitedTextArea newTextArea (String text, int width, int height, int maxLength)
{
LimitedTextArea area = new LimitedTextArea(maxLength, width, height);
if (text != null) {
area.setText(text);
}
return area;
} | [
"public",
"static",
"LimitedTextArea",
"newTextArea",
"(",
"String",
"text",
",",
"int",
"width",
",",
"int",
"height",
",",
"int",
"maxLength",
")",
"{",
"LimitedTextArea",
"area",
"=",
"new",
"LimitedTextArea",
"(",
"maxLength",
",",
"width",
",",
"height",
... | Creates a limited text area with all of the configuration that you're bound to want to do.
@param width the width of the text area or -1 to use the default (or CSS styled) width. | [
"Creates",
"a",
"limited",
"text",
"area",
"with",
"all",
"of",
"the",
"configuration",
"that",
"you",
"re",
"bound",
"to",
"want",
"to",
"do",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L393-L400 |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java | Filelistener.addSubDirectory | private void addSubDirectory(Path root, Path filePath) throws IOException {
String listener = getListenerRootPath(root);
List<String> listeners = mSubDirectories.get(listener);
if (listeners != null) {
if (mSubDirectories.get(listener).contains(filePath.toAbsolutePath())) {
return;
} else {
mSubDirectories.get(listener).add(filePath.toString());
}
try {
watchDir(filePath.toFile());
} catch (IOException e) {
throw new IOException("Could not watch the subdirectories.", e);
}
}
} | java | private void addSubDirectory(Path root, Path filePath) throws IOException {
String listener = getListenerRootPath(root);
List<String> listeners = mSubDirectories.get(listener);
if (listeners != null) {
if (mSubDirectories.get(listener).contains(filePath.toAbsolutePath())) {
return;
} else {
mSubDirectories.get(listener).add(filePath.toString());
}
try {
watchDir(filePath.toFile());
} catch (IOException e) {
throw new IOException("Could not watch the subdirectories.", e);
}
}
} | [
"private",
"void",
"addSubDirectory",
"(",
"Path",
"root",
",",
"Path",
"filePath",
")",
"throws",
"IOException",
"{",
"String",
"listener",
"=",
"getListenerRootPath",
"(",
"root",
")",
";",
"List",
"<",
"String",
">",
"listeners",
"=",
"mSubDirectories",
"."... | In this method a subdirectory is being added to the system and watched.
This is necessary since the {@link WatchService} doesn't support watching
a folder with higher depths than 1.
@param root
@param filePath
@throws IOException | [
"In",
"this",
"method",
"a",
"subdirectory",
"is",
"being",
"added",
"to",
"the",
"system",
"and",
"watched",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/Filelistener.java#L413-L431 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.beginSetSharedKey | public ConnectionSharedKeyInner beginSetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKeyInner parameters) {
return beginSetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).toBlocking().single().body();
} | java | public ConnectionSharedKeyInner beginSetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, ConnectionSharedKeyInner parameters) {
return beginSetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).toBlocking().single().body();
} | [
"public",
"ConnectionSharedKeyInner",
"beginSetSharedKey",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"ConnectionSharedKeyInner",
"parameters",
")",
"{",
"return",
"beginSetSharedKeyWithServiceResponseAsync",
"(",
"resourceGroupNa... | The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The virtual network gateway connection name.
@param parameters Parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation throughNetwork resource provider.
@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 ConnectionSharedKeyInner object if successful. | [
"The",
"Put",
"VirtualNetworkGatewayConnectionSharedKey",
"operation",
"sets",
"the",
"virtual",
"network",
"gateway",
"connection",
"shared",
"key",
"for",
"passed",
"virtual",
"network",
"gateway",
"connection",
"in",
"the",
"specified",
"resource",
"group",
"through"... | 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/VirtualNetworkGatewayConnectionsInner.java#L931-L933 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java | CategoryGraph.getNumberOfNeighborConnections | private int getNumberOfNeighborConnections(int node) {
int numberOfConnections = 0;
// get the set of neighbors
Set<Integer> neighbors = getNeighbors(node);
if (neighbors.size() > 0) {
// for each pair of neighbors, test if there is a connection
Object[] nodeArray = neighbors.toArray();
// sort the Array so we can use a simple iteration with two for loops to access all pairs
Arrays.sort(nodeArray);
for (int i=0; i<neighbors.size(); i++) {
int outerNode = (Integer) nodeArray[i];
for (int j=i+1; j<neighbors.size(); j++) {
int innerNode = (Integer) nodeArray[j];
// in case of a connection - increade connection counter
// order of the nodes doesn't matter for undirected graphs
if (undirectedGraph.containsEdge(innerNode, outerNode)) {
numberOfConnections++;
}
}
}
}
// logger.info(neighbors.size() + " - " + numberOfConnections);
return numberOfConnections;
} | java | private int getNumberOfNeighborConnections(int node) {
int numberOfConnections = 0;
// get the set of neighbors
Set<Integer> neighbors = getNeighbors(node);
if (neighbors.size() > 0) {
// for each pair of neighbors, test if there is a connection
Object[] nodeArray = neighbors.toArray();
// sort the Array so we can use a simple iteration with two for loops to access all pairs
Arrays.sort(nodeArray);
for (int i=0; i<neighbors.size(); i++) {
int outerNode = (Integer) nodeArray[i];
for (int j=i+1; j<neighbors.size(); j++) {
int innerNode = (Integer) nodeArray[j];
// in case of a connection - increade connection counter
// order of the nodes doesn't matter for undirected graphs
if (undirectedGraph.containsEdge(innerNode, outerNode)) {
numberOfConnections++;
}
}
}
}
// logger.info(neighbors.size() + " - " + numberOfConnections);
return numberOfConnections;
} | [
"private",
"int",
"getNumberOfNeighborConnections",
"(",
"int",
"node",
")",
"{",
"int",
"numberOfConnections",
"=",
"0",
";",
"// get the set of neighbors",
"Set",
"<",
"Integer",
">",
"neighbors",
"=",
"getNeighbors",
"(",
"node",
")",
";",
"if",
"(",
"neighbo... | Get the number of connections that exist between the neighbors of a node.
@param node The node under consideration.
@return The number of connections that exist between the neighbors of node. | [
"Get",
"the",
"number",
"of",
"connections",
"that",
"exist",
"between",
"the",
"neighbors",
"of",
"a",
"node",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/CategoryGraph.java#L1267-L1295 |
eiichiro/gig | gig-appengine/src/main/java/org/eiichiro/gig/appengine/TextConverter.java | TextConverter.convertToType | @SuppressWarnings("rawtypes")
@Override
protected Object convertToType(Class type, Object value) throws Throwable {
return new Text(value.toString());
} | java | @SuppressWarnings("rawtypes")
@Override
protected Object convertToType(Class type, Object value) throws Throwable {
return new Text(value.toString());
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"protected",
"Object",
"convertToType",
"(",
"Class",
"type",
",",
"Object",
"value",
")",
"throws",
"Throwable",
"{",
"return",
"new",
"Text",
"(",
"value",
".",
"toString",
"(",
")",
")",
... | Converts the specified value to
{@code com.google.appengine.api.datastore.Text}.
@see org.apache.commons.beanutils.converters.AbstractConverter#convertToType(java.lang.Class, java.lang.Object) | [
"Converts",
"the",
"specified",
"value",
"to",
"{",
"@code",
"com",
".",
"google",
".",
"appengine",
".",
"api",
".",
"datastore",
".",
"Text",
"}",
"."
] | train | https://github.com/eiichiro/gig/blob/21181fb36a17d2154f989e5e8c6edbb39fc81900/gig-appengine/src/main/java/org/eiichiro/gig/appengine/TextConverter.java#L38-L42 |
osmdroid/osmdroid | osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/OsmMapShapeConverter.java | OsmMapShapeConverter.addLatLngsToMap | public static MultiMarker addLatLngsToMap(MapView map, MultiLatLng latLngs) {
MultiMarker multiMarker = new MultiMarker();
for (GeoPoint latLng : latLngs.getLatLngs()) {
Marker marker = addLatLngToMap(map, latLng, latLngs.getMarkerOptions());
multiMarker.add(marker);
}
return multiMarker;
} | java | public static MultiMarker addLatLngsToMap(MapView map, MultiLatLng latLngs) {
MultiMarker multiMarker = new MultiMarker();
for (GeoPoint latLng : latLngs.getLatLngs()) {
Marker marker = addLatLngToMap(map, latLng, latLngs.getMarkerOptions());
multiMarker.add(marker);
}
return multiMarker;
} | [
"public",
"static",
"MultiMarker",
"addLatLngsToMap",
"(",
"MapView",
"map",
",",
"MultiLatLng",
"latLngs",
")",
"{",
"MultiMarker",
"multiMarker",
"=",
"new",
"MultiMarker",
"(",
")",
";",
"for",
"(",
"GeoPoint",
"latLng",
":",
"latLngs",
".",
"getLatLngs",
"... | Add a list of LatLngs to the map
@param map
@param latLngs
@return | [
"Add",
"a",
"list",
"of",
"LatLngs",
"to",
"the",
"map"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/OsmMapShapeConverter.java#L778-L785 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.modifyInstancePassword | public void modifyInstancePassword(ModifyInstancePasswordRequest request) throws BceClientException {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
checkStringNotEmpty(request.getAdminPass(), "request adminPass should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.changePass.name(), null);
BceCredentials credentials = config.getCredentials();
if (internalRequest.getCredentials() != null) {
credentials = internalRequest.getCredentials();
}
try {
request.setAdminPass(this.aes128WithFirst16Char(request.getAdminPass(), credentials.getSecretKey()));
} catch (GeneralSecurityException e) {
throw new BceClientException("Encryption procedure exception", e);
}
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | java | public void modifyInstancePassword(ModifyInstancePasswordRequest request) throws BceClientException {
checkNotNull(request, "request should not be null.");
checkStringNotEmpty(request.getInstanceId(), "request instanceId should not be empty.");
checkStringNotEmpty(request.getAdminPass(), "request adminPass should not be empty.");
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, INSTANCE_PREFIX, request.getInstanceId());
internalRequest.addParameter(InstanceAction.changePass.name(), null);
BceCredentials credentials = config.getCredentials();
if (internalRequest.getCredentials() != null) {
credentials = internalRequest.getCredentials();
}
try {
request.setAdminPass(this.aes128WithFirst16Char(request.getAdminPass(), credentials.getSecretKey()));
} catch (GeneralSecurityException e) {
throw new BceClientException("Encryption procedure exception", e);
}
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | [
"public",
"void",
"modifyInstancePassword",
"(",
"ModifyInstancePasswordRequest",
"request",
")",
"throws",
"BceClientException",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getInstanceI... | Modifying the password of the instance.
You can reboot the instance only when the instance is Running or Stopped ,
otherwise,it's will get <code>409</code> errorCode.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getInstance(GetInstanceRequest)}
@param request The request containing all options for modifying the instance password.
@throws BceClientException | [
"Modifying",
"the",
"password",
"of",
"the",
"instance",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L537-L555 |
treasure-data/td-client-java | src/main/java/com/treasuredata/client/TDHttpClient.java | TDHttpClient.call | public String call(TDApiRequest apiRequest, Optional<String> apiKeyCache)
{
String content = submitRequest(apiRequest, apiKeyCache, stringContentHandler);
if (logger.isTraceEnabled()) {
logger.trace("response:\n{}", content);
}
return content;
} | java | public String call(TDApiRequest apiRequest, Optional<String> apiKeyCache)
{
String content = submitRequest(apiRequest, apiKeyCache, stringContentHandler);
if (logger.isTraceEnabled()) {
logger.trace("response:\n{}", content);
}
return content;
} | [
"public",
"String",
"call",
"(",
"TDApiRequest",
"apiRequest",
",",
"Optional",
"<",
"String",
">",
"apiKeyCache",
")",
"{",
"String",
"content",
"=",
"submitRequest",
"(",
"apiRequest",
",",
"apiKeyCache",
",",
"stringContentHandler",
")",
";",
"if",
"(",
"lo... | Submit an API request and get the result as String value (e.g. json)
@param apiRequest
@param apiKeyCache
@return | [
"Submit",
"an",
"API",
"request",
"and",
"get",
"the",
"result",
"as",
"String",
"value",
"(",
"e",
".",
"g",
".",
"json",
")"
] | train | https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDHttpClient.java#L481-L488 |
ttddyy/datasource-proxy | src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java | ProxyDataSourceBuilder.logSlowQueryByJUL | public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, Level logLevel) {
return logSlowQueryByJUL(thresholdTime, timeUnit, logLevel, null);
} | java | public ProxyDataSourceBuilder logSlowQueryByJUL(long thresholdTime, TimeUnit timeUnit, Level logLevel) {
return logSlowQueryByJUL(thresholdTime, timeUnit, logLevel, null);
} | [
"public",
"ProxyDataSourceBuilder",
"logSlowQueryByJUL",
"(",
"long",
"thresholdTime",
",",
"TimeUnit",
"timeUnit",
",",
"Level",
"logLevel",
")",
"{",
"return",
"logSlowQueryByJUL",
"(",
"thresholdTime",
",",
"timeUnit",
",",
"logLevel",
",",
"null",
")",
";",
"}... | Register {@link JULSlowQueryListener}.
@param thresholdTime slow query threshold time
@param timeUnit slow query threshold time unit
@param logLevel log level for JUL
@return builder
@since 1.4.1 | [
"Register",
"{",
"@link",
"JULSlowQueryListener",
"}",
"."
] | train | https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L452-L454 |
Netflix/spectator | spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileTimer.java | PercentileTimer.computeIfAbsent | private static PercentileTimer computeIfAbsent(Registry registry, Id id, long min, long max) {
Object timer = Utils.computeIfAbsent(
registry.state(), id, i -> new PercentileTimer(registry, id, min, max));
return (timer instanceof PercentileTimer)
? ((PercentileTimer) timer).withRange(min, max)
: new PercentileTimer(registry, id, min, max);
} | java | private static PercentileTimer computeIfAbsent(Registry registry, Id id, long min, long max) {
Object timer = Utils.computeIfAbsent(
registry.state(), id, i -> new PercentileTimer(registry, id, min, max));
return (timer instanceof PercentileTimer)
? ((PercentileTimer) timer).withRange(min, max)
: new PercentileTimer(registry, id, min, max);
} | [
"private",
"static",
"PercentileTimer",
"computeIfAbsent",
"(",
"Registry",
"registry",
",",
"Id",
"id",
",",
"long",
"min",
",",
"long",
"max",
")",
"{",
"Object",
"timer",
"=",
"Utils",
".",
"computeIfAbsent",
"(",
"registry",
".",
"state",
"(",
")",
","... | Only create a new instance of the counter if there is not a cached copy. The array for
keeping track of the counter per bucket is quite large (1-2k depending on pointer size)
and can lead to a high allocation rate if the timer is not reused in a high volume call
site. | [
"Only",
"create",
"a",
"new",
"instance",
"of",
"the",
"counter",
"if",
"there",
"is",
"not",
"a",
"cached",
"copy",
".",
"The",
"array",
"for",
"keeping",
"track",
"of",
"the",
"counter",
"per",
"bucket",
"is",
"quite",
"large",
"(",
"1",
"-",
"2k",
... | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/histogram/PercentileTimer.java#L75-L81 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java | RequestParam.get | public static @Nullable String get(@NotNull ServletRequest request, @NotNull String param, @Nullable String defaultValue) {
String value = request.getParameter(param);
if (value != null) {
// convert encoding to UTF-8 if not form encoding parameter is set
if (!hasFormEncodingParam(request)) {
value = convertISO88591toUTF8(value);
}
return value;
}
else {
return defaultValue;
}
} | java | public static @Nullable String get(@NotNull ServletRequest request, @NotNull String param, @Nullable String defaultValue) {
String value = request.getParameter(param);
if (value != null) {
// convert encoding to UTF-8 if not form encoding parameter is set
if (!hasFormEncodingParam(request)) {
value = convertISO88591toUTF8(value);
}
return value;
}
else {
return defaultValue;
}
} | [
"public",
"static",
"@",
"Nullable",
"String",
"get",
"(",
"@",
"NotNull",
"ServletRequest",
"request",
",",
"@",
"NotNull",
"String",
"param",
",",
"@",
"Nullable",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"request",
".",
"getParameter",
... | Returns a request parameter.<br>
In addition the method fixes problems with incorrect UTF-8 characters returned by the servlet engine.
All character data is converted from ISO-8859-1 to UTF-8 if not '_charset_' parameter is provided.
@param request Request.
@param param Parameter name.
@param defaultValue Default value.
@return Parameter value or the default value if it is not set. | [
"Returns",
"a",
"request",
"parameter",
".",
"<br",
">",
"In",
"addition",
"the",
"method",
"fixes",
"problems",
"with",
"incorrect",
"UTF",
"-",
"8",
"characters",
"returned",
"by",
"the",
"servlet",
"engine",
".",
"All",
"character",
"data",
"is",
"convert... | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L76-L88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.