repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
samskivert/samskivert | src/main/java/com/samskivert/velocity/FormTool.java | FormTool.submitExtra | public String submitExtra (String name, String text, String extra)
{
return fixedInput("submit", name, text, extra);
} | java | public String submitExtra (String name, String text, String extra)
{
return fixedInput("submit", name, text, extra);
} | [
"public",
"String",
"submitExtra",
"(",
"String",
"name",
",",
"String",
"text",
",",
"String",
"extra",
")",
"{",
"return",
"fixedInput",
"(",
"\"submit\"",
",",
"name",
",",
"text",
",",
"extra",
")",
";",
"}"
] | Constructs a submit element with the specified parameter name and
the specified button text with the specified extra text. | [
"Constructs",
"a",
"submit",
"element",
"with",
"the",
"specified",
"parameter",
"name",
"and",
"the",
"specified",
"button",
"text",
"with",
"the",
"specified",
"extra",
"text",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/velocity/FormTool.java#L176-L179 |
brutusin/commons | src/main/java/org/brutusin/commons/utils/Miscellaneous.java | Miscellaneous.pipeAsynchronously | public static Thread pipeAsynchronously(final InputStream is, final ErrorHandler errorHandler, final boolean closeResources, final OutputStream... os) {
Thread t = new Thread() {
@Override
public void run() {
try {
pipeSynchronously(is, closeResources, os);
} catch (Throwable th) {
if (errorHandler != null) {
errorHandler.onThrowable(th);
}
}
}
};
t.setDaemon(true);
t.start();
return t;
} | java | public static Thread pipeAsynchronously(final InputStream is, final ErrorHandler errorHandler, final boolean closeResources, final OutputStream... os) {
Thread t = new Thread() {
@Override
public void run() {
try {
pipeSynchronously(is, closeResources, os);
} catch (Throwable th) {
if (errorHandler != null) {
errorHandler.onThrowable(th);
}
}
}
};
t.setDaemon(true);
t.start();
return t;
} | [
"public",
"static",
"Thread",
"pipeAsynchronously",
"(",
"final",
"InputStream",
"is",
",",
"final",
"ErrorHandler",
"errorHandler",
",",
"final",
"boolean",
"closeResources",
",",
"final",
"OutputStream",
"...",
"os",
")",
"{",
"Thread",
"t",
"=",
"new",
"Threa... | Asynchronous writing from is to os
@param is
@param errorHandler
@param closeResources
@param os
@return | [
"Asynchronous",
"writing",
"from",
"is",
"to",
"os"
] | train | https://github.com/brutusin/commons/blob/70685df2b2456d0bf1e6a4754d72c87bba4949df/src/main/java/org/brutusin/commons/utils/Miscellaneous.java#L451-L467 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Searcher.java | Searcher.searchFor | public <T extends View> boolean searchFor(Set<T> uniqueViews, Class<T> viewClass, final int index) {
ArrayList<T> allViews = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(viewClass, true));
int uniqueViewsFound = (getNumberOfUniqueViews(uniqueViews, allViews));
if(uniqueViewsFound > 0 && index < uniqueViewsFound) {
return true;
}
if(uniqueViewsFound > 0 && index == 0) {
return true;
}
return false;
} | java | public <T extends View> boolean searchFor(Set<T> uniqueViews, Class<T> viewClass, final int index) {
ArrayList<T> allViews = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(viewClass, true));
int uniqueViewsFound = (getNumberOfUniqueViews(uniqueViews, allViews));
if(uniqueViewsFound > 0 && index < uniqueViewsFound) {
return true;
}
if(uniqueViewsFound > 0 && index == 0) {
return true;
}
return false;
} | [
"public",
"<",
"T",
"extends",
"View",
">",
"boolean",
"searchFor",
"(",
"Set",
"<",
"T",
">",
"uniqueViews",
",",
"Class",
"<",
"T",
">",
"viewClass",
",",
"final",
"int",
"index",
")",
"{",
"ArrayList",
"<",
"T",
">",
"allViews",
"=",
"RobotiumUtils"... | Searches for a view class.
@param uniqueViews the set of unique views
@param viewClass the view class to search for
@param index the index of the view class
@return true if view class if found a given number of times | [
"Searches",
"for",
"a",
"view",
"class",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Searcher.java#L141-L154 |
spring-projects/spring-security-oauth | spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/expression/OAuth2SecurityExpressionMethods.java | OAuth2SecurityExpressionMethods.throwOnError | public boolean throwOnError(boolean decision) {
if (!decision && !missingScopes.isEmpty()) {
Throwable failure = new InsufficientScopeException("Insufficient scope for this resource", missingScopes);
throw new AccessDeniedException(failure.getMessage(), failure);
}
return decision;
} | java | public boolean throwOnError(boolean decision) {
if (!decision && !missingScopes.isEmpty()) {
Throwable failure = new InsufficientScopeException("Insufficient scope for this resource", missingScopes);
throw new AccessDeniedException(failure.getMessage(), failure);
}
return decision;
} | [
"public",
"boolean",
"throwOnError",
"(",
"boolean",
"decision",
")",
"{",
"if",
"(",
"!",
"decision",
"&&",
"!",
"missingScopes",
".",
"isEmpty",
"(",
")",
")",
"{",
"Throwable",
"failure",
"=",
"new",
"InsufficientScopeException",
"(",
"\"Insufficient scope fo... | Check if any scope decisions have been denied in the current context and throw an exception if so. This method
automatically wraps any expressions when using {@link OAuth2MethodSecurityExpressionHandler} or
{@link OAuth2WebSecurityExpressionHandler}.
OAuth2Example usage:
<pre>
access = "#oauth2.hasScope('read') or (#oauth2.hasScope('other') and hasRole('ROLE_USER'))"
</pre>
Will automatically be wrapped to ensure that explicit errors are propagated rather than a generic error when
returning false:
<pre>
access = "#oauth2.throwOnError(#oauth2.hasScope('read') or (#oauth2.hasScope('other') and hasRole('ROLE_USER'))"
</pre>
N.B. normally this method will be automatically wrapped around all your access expressions. You could use it
explicitly to get more control, or if you have registered your own <code>ExpressionParser</code> you might need
it.
@param decision the existing access decision
@return true if the OAuth2 token has one of these scopes
@throws InsufficientScopeException if the scope is invalid and we the flag is set to throw the exception | [
"Check",
"if",
"any",
"scope",
"decisions",
"have",
"been",
"denied",
"in",
"the",
"current",
"context",
"and",
"throw",
"an",
"exception",
"if",
"so",
".",
"This",
"method",
"automatically",
"wraps",
"any",
"expressions",
"when",
"using",
"{",
"@link",
"OAu... | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/expression/OAuth2SecurityExpressionMethods.java#L69-L75 |
ocelotds/ocelot | ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java | DataServiceVisitorJsBuilder.writeArguments | void writeArguments(Iterator<String> names, Writer writer) throws IOException {
while(names.hasNext()) {
String name = names.next();
writer.append(name); // argname
if(names.hasNext()) {
writer.append(COMMA).append(SPACEOPTIONAL); //,
}
}
} | java | void writeArguments(Iterator<String> names, Writer writer) throws IOException {
while(names.hasNext()) {
String name = names.next();
writer.append(name); // argname
if(names.hasNext()) {
writer.append(COMMA).append(SPACEOPTIONAL); //,
}
}
} | [
"void",
"writeArguments",
"(",
"Iterator",
"<",
"String",
">",
"names",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"names",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"name",
"=",
"names",
".",
"next",
"(",
")",
";",
... | Write argument whit comma if necessary
@param names
@param writer
@throws IOException | [
"Write",
"argument",
"whit",
"comma",
"if",
"necessary"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L92-L100 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generate | public static BufferedImage generate(String content, BarcodeFormat format, QrConfig config) {
final BitMatrix bitMatrix = encode(content, format, config);
final BufferedImage image = toImage(bitMatrix, config.foreColor, config.backColor);
final Image logoImg = config.img;
if (null != logoImg && BarcodeFormat.QR_CODE == format) {
// 只有二维码可以贴图
final int qrWidth = image.getWidth();
final int qrHeight = image.getHeight();
int width;
int height;
// 按照最短的边做比例缩放
if (qrWidth < qrHeight) {
width = qrWidth / config.ratio;
height = logoImg.getHeight(null) * width / logoImg.getWidth(null);
} else {
height = qrHeight / config.ratio;
width = logoImg.getWidth(null) * height / logoImg.getHeight(null);
}
Img.from(image).pressImage(//
Img.from(logoImg).round(0.3).getImg(), // 圆角
new Rectangle(width, height), //
1//
);
}
return image;
} | java | public static BufferedImage generate(String content, BarcodeFormat format, QrConfig config) {
final BitMatrix bitMatrix = encode(content, format, config);
final BufferedImage image = toImage(bitMatrix, config.foreColor, config.backColor);
final Image logoImg = config.img;
if (null != logoImg && BarcodeFormat.QR_CODE == format) {
// 只有二维码可以贴图
final int qrWidth = image.getWidth();
final int qrHeight = image.getHeight();
int width;
int height;
// 按照最短的边做比例缩放
if (qrWidth < qrHeight) {
width = qrWidth / config.ratio;
height = logoImg.getHeight(null) * width / logoImg.getWidth(null);
} else {
height = qrHeight / config.ratio;
width = logoImg.getWidth(null) * height / logoImg.getHeight(null);
}
Img.from(image).pressImage(//
Img.from(logoImg).round(0.3).getImg(), // 圆角
new Rectangle(width, height), //
1//
);
}
return image;
} | [
"public",
"static",
"BufferedImage",
"generate",
"(",
"String",
"content",
",",
"BarcodeFormat",
"format",
",",
"QrConfig",
"config",
")",
"{",
"final",
"BitMatrix",
"bitMatrix",
"=",
"encode",
"(",
"content",
",",
"format",
",",
"config",
")",
";",
"final",
... | 生成二维码或条形码图片<br>
只有二维码时QrConfig中的图片才有效
@param content 文本内容
@param format 格式,可选二维码、条形码等
@param config 二维码配置,包括长、宽、边距、颜色等
@return 二维码图片(黑白)
@since 4.1.14 | [
"生成二维码或条形码图片<br",
">",
"只有二维码时QrConfig中的图片才有效"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L172-L198 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java | LocalTime.plusNanos | public LocalTime plusNanos(long nanosToAdd) {
if (nanosToAdd == 0) {
return this;
}
long nofd = toNanoOfDay();
long newNofd = ((nanosToAdd % NANOS_PER_DAY) + nofd + NANOS_PER_DAY) % NANOS_PER_DAY;
if (nofd == newNofd) {
return this;
}
int newHour = (int) (newNofd / NANOS_PER_HOUR);
int newMinute = (int) ((newNofd / NANOS_PER_MINUTE) % MINUTES_PER_HOUR);
int newSecond = (int) ((newNofd / NANOS_PER_SECOND) % SECONDS_PER_MINUTE);
int newNano = (int) (newNofd % NANOS_PER_SECOND);
return create(newHour, newMinute, newSecond, newNano);
} | java | public LocalTime plusNanos(long nanosToAdd) {
if (nanosToAdd == 0) {
return this;
}
long nofd = toNanoOfDay();
long newNofd = ((nanosToAdd % NANOS_PER_DAY) + nofd + NANOS_PER_DAY) % NANOS_PER_DAY;
if (nofd == newNofd) {
return this;
}
int newHour = (int) (newNofd / NANOS_PER_HOUR);
int newMinute = (int) ((newNofd / NANOS_PER_MINUTE) % MINUTES_PER_HOUR);
int newSecond = (int) ((newNofd / NANOS_PER_SECOND) % SECONDS_PER_MINUTE);
int newNano = (int) (newNofd % NANOS_PER_SECOND);
return create(newHour, newMinute, newSecond, newNano);
} | [
"public",
"LocalTime",
"plusNanos",
"(",
"long",
"nanosToAdd",
")",
"{",
"if",
"(",
"nanosToAdd",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"long",
"nofd",
"=",
"toNanoOfDay",
"(",
")",
";",
"long",
"newNofd",
"=",
"(",
"(",
"nanosToAdd",
"%",
... | Returns a copy of this {@code LocalTime} with the specified number of nanoseconds added.
<p>
This adds the specified number of nanoseconds to this time, returning a new time.
The calculation wraps around midnight.
<p>
This instance is immutable and unaffected by this method call.
@param nanosToAdd the nanos to add, may be negative
@return a {@code LocalTime} based on this time with the nanoseconds added, not null | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"LocalTime",
"}",
"with",
"the",
"specified",
"number",
"of",
"nanoseconds",
"added",
".",
"<p",
">",
"This",
"adds",
"the",
"specified",
"number",
"of",
"nanoseconds",
"to",
"this",
"time",
"returning",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java#L1137-L1151 |
Cleveroad/AdaptiveTableLayout | library/src/main/java/com/cleveroad/adaptivetablelayout/AdaptiveTableLayout.java | AdaptiveTableLayout.setDraggingToColumn | @SuppressWarnings("unused")
private void setDraggingToColumn(int column, boolean isDragging) {
Collection<ViewHolder> holders = mViewHolders.getColumnItems(column);
for (ViewHolder holder : holders) {
holder.setIsDragging(isDragging);
}
ViewHolder holder = mHeaderColumnViewHolders.get(column);
if (holder != null) {
holder.setIsDragging(isDragging);
}
} | java | @SuppressWarnings("unused")
private void setDraggingToColumn(int column, boolean isDragging) {
Collection<ViewHolder> holders = mViewHolders.getColumnItems(column);
for (ViewHolder holder : holders) {
holder.setIsDragging(isDragging);
}
ViewHolder holder = mHeaderColumnViewHolders.get(column);
if (holder != null) {
holder.setIsDragging(isDragging);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"void",
"setDraggingToColumn",
"(",
"int",
"column",
",",
"boolean",
"isDragging",
")",
"{",
"Collection",
"<",
"ViewHolder",
">",
"holders",
"=",
"mViewHolders",
".",
"getColumnItems",
"(",
"column",
"... | Method set dragging flag to all view holders in the specific column
@param column specific column
@param isDragging flag to set | [
"Method",
"set",
"dragging",
"flag",
"to",
"all",
"view",
"holders",
"in",
"the",
"specific",
"column"
] | train | https://github.com/Cleveroad/AdaptiveTableLayout/blob/188213b35e05e635497b03fe741799782dde7208/library/src/main/java/com/cleveroad/adaptivetablelayout/AdaptiveTableLayout.java#L1470-L1481 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/randomizers/text/StringRandomizer.java | StringRandomizer.aNewStringRandomizer | public static StringRandomizer aNewStringRandomizer(final Charset charset, final int maxLength, final long seed) {
return new StringRandomizer(charset, maxLength, seed);
} | java | public static StringRandomizer aNewStringRandomizer(final Charset charset, final int maxLength, final long seed) {
return new StringRandomizer(charset, maxLength, seed);
} | [
"public",
"static",
"StringRandomizer",
"aNewStringRandomizer",
"(",
"final",
"Charset",
"charset",
",",
"final",
"int",
"maxLength",
",",
"final",
"long",
"seed",
")",
"{",
"return",
"new",
"StringRandomizer",
"(",
"charset",
",",
"maxLength",
",",
"seed",
")",... | Create a new {@link StringRandomizer}.
@param charset to use
@param maxLength of the String to generate
@param seed initial seed
@return a new {@link StringRandomizer}. | [
"Create",
"a",
"new",
"{",
"@link",
"StringRandomizer",
"}",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/text/StringRandomizer.java#L233-L235 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/util/ResourceUtil.java | ResourceUtil.getOrCreateChild | public static Resource getOrCreateChild(Resource resource, String relPath, String primaryTypes)
throws RepositoryException {
Resource child = null;
if (resource != null) {
ResourceResolver resolver = resource.getResourceResolver();
String path = resource.getPath();
while (relPath.startsWith("/")) {
relPath = relPath.substring(1);
}
if (StringUtils.isNotBlank(relPath)) {
path += "/" + relPath;
}
child = getOrCreateResource(resolver, path, primaryTypes);
}
return child;
} | java | public static Resource getOrCreateChild(Resource resource, String relPath, String primaryTypes)
throws RepositoryException {
Resource child = null;
if (resource != null) {
ResourceResolver resolver = resource.getResourceResolver();
String path = resource.getPath();
while (relPath.startsWith("/")) {
relPath = relPath.substring(1);
}
if (StringUtils.isNotBlank(relPath)) {
path += "/" + relPath;
}
child = getOrCreateResource(resolver, path, primaryTypes);
}
return child;
} | [
"public",
"static",
"Resource",
"getOrCreateChild",
"(",
"Resource",
"resource",
",",
"String",
"relPath",
",",
"String",
"primaryTypes",
")",
"throws",
"RepositoryException",
"{",
"Resource",
"child",
"=",
"null",
";",
"if",
"(",
"resource",
"!=",
"null",
")",
... | Retrieves the resources child resource, creates this child if not existing.
@param resource the resource to extend
@param relPath the path to the requested child resource
@param primaryTypes the 'path' of primary types for the new nodes (optional, can be 'null')
@return the requested child | [
"Retrieves",
"the",
"resources",
"child",
"resource",
"creates",
"this",
"child",
"if",
"not",
"existing",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/ResourceUtil.java#L374-L389 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java | InstanceHelpers.findInstanceByPath | public static Instance findInstanceByPath( Instance rootInstance, String instancePath ) {
Application tempApplication = new Application( new ApplicationTemplate());
if( rootInstance != null )
tempApplication.getRootInstances().add( rootInstance );
return findInstanceByPath( tempApplication, instancePath );
} | java | public static Instance findInstanceByPath( Instance rootInstance, String instancePath ) {
Application tempApplication = new Application( new ApplicationTemplate());
if( rootInstance != null )
tempApplication.getRootInstances().add( rootInstance );
return findInstanceByPath( tempApplication, instancePath );
} | [
"public",
"static",
"Instance",
"findInstanceByPath",
"(",
"Instance",
"rootInstance",
",",
"String",
"instancePath",
")",
"{",
"Application",
"tempApplication",
"=",
"new",
"Application",
"(",
"new",
"ApplicationTemplate",
"(",
")",
")",
";",
"if",
"(",
"rootInst... | Finds an instance by name.
@param rootInstance a root instance
@param instancePath the instance path
@return an instance, or null if it was not found | [
"Finds",
"an",
"instance",
"by",
"name",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L297-L304 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/chrono/HijrahDate.java | HijrahDate.getDayOfCycle | private static int getDayOfCycle(long epochDay, int cycleNumber) {
Long day;
try {
day = ADJUSTED_CYCLES[cycleNumber];
} catch (ArrayIndexOutOfBoundsException e) {
day = null;
}
if (day == null) {
day = Long.valueOf(cycleNumber * 10631);
}
return (int) (epochDay - day.longValue());
} | java | private static int getDayOfCycle(long epochDay, int cycleNumber) {
Long day;
try {
day = ADJUSTED_CYCLES[cycleNumber];
} catch (ArrayIndexOutOfBoundsException e) {
day = null;
}
if (day == null) {
day = Long.valueOf(cycleNumber * 10631);
}
return (int) (epochDay - day.longValue());
} | [
"private",
"static",
"int",
"getDayOfCycle",
"(",
"long",
"epochDay",
",",
"int",
"cycleNumber",
")",
"{",
"Long",
"day",
";",
"try",
"{",
"day",
"=",
"ADJUSTED_CYCLES",
"[",
"cycleNumber",
"]",
";",
"}",
"catch",
"(",
"ArrayIndexOutOfBoundsException",
"e",
... | Returns day of cycle from the epoch day and cycle number.
@param epochDay an epoch day
@param cycleNumber a cycle number
@return a day of cycle | [
"Returns",
"day",
"of",
"cycle",
"from",
"the",
"epoch",
"day",
"and",
"cycle",
"number",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/HijrahDate.java#L919-L931 |
OpenTSDB/opentsdb | src/meta/TSMeta.java | TSMeta.getStorageJSON | private byte[] getStorageJSON() {
// 256 bytes is a good starting value, assumes default info
final ByteArrayOutputStream output = new ByteArrayOutputStream(256);
try {
final JsonGenerator json = JSON.getFactory().createGenerator(output);
json.writeStartObject();
json.writeStringField("tsuid", tsuid);
json.writeStringField("displayName", display_name);
json.writeStringField("description", description);
json.writeStringField("notes", notes);
json.writeNumberField("created", created);
if (custom == null) {
json.writeNullField("custom");
} else {
json.writeObjectFieldStart("custom");
for (Map.Entry<String, String> entry : custom.entrySet()) {
json.writeStringField(entry.getKey(), entry.getValue());
}
json.writeEndObject();
}
json.writeStringField("units", units);
json.writeStringField("dataType", data_type);
json.writeNumberField("retention", retention);
json.writeNumberField("max", max);
json.writeNumberField("min", min);
json.writeEndObject();
json.close();
return output.toByteArray();
} catch (IOException e) {
throw new RuntimeException("Unable to serialize TSMeta", e);
}
} | java | private byte[] getStorageJSON() {
// 256 bytes is a good starting value, assumes default info
final ByteArrayOutputStream output = new ByteArrayOutputStream(256);
try {
final JsonGenerator json = JSON.getFactory().createGenerator(output);
json.writeStartObject();
json.writeStringField("tsuid", tsuid);
json.writeStringField("displayName", display_name);
json.writeStringField("description", description);
json.writeStringField("notes", notes);
json.writeNumberField("created", created);
if (custom == null) {
json.writeNullField("custom");
} else {
json.writeObjectFieldStart("custom");
for (Map.Entry<String, String> entry : custom.entrySet()) {
json.writeStringField(entry.getKey(), entry.getValue());
}
json.writeEndObject();
}
json.writeStringField("units", units);
json.writeStringField("dataType", data_type);
json.writeNumberField("retention", retention);
json.writeNumberField("max", max);
json.writeNumberField("min", min);
json.writeEndObject();
json.close();
return output.toByteArray();
} catch (IOException e) {
throw new RuntimeException("Unable to serialize TSMeta", e);
}
} | [
"private",
"byte",
"[",
"]",
"getStorageJSON",
"(",
")",
"{",
"// 256 bytes is a good starting value, assumes default info",
"final",
"ByteArrayOutputStream",
"output",
"=",
"new",
"ByteArrayOutputStream",
"(",
"256",
")",
";",
"try",
"{",
"final",
"JsonGenerator",
"jso... | Formats the JSON output for writing to storage. It drops objects we don't
need or want to store (such as the UIDMeta objects or the total dps) to
save space. It also serializes in order so that we can make a proper CAS
call. Otherwise the POJO serializer may place the fields in any order
and CAS calls would fail all the time.
@return A byte array to write to storage | [
"Formats",
"the",
"JSON",
"output",
"for",
"writing",
"to",
"storage",
".",
"It",
"drops",
"objects",
"we",
"don",
"t",
"need",
"or",
"want",
"to",
"store",
"(",
"such",
"as",
"the",
"UIDMeta",
"objects",
"or",
"the",
"total",
"dps",
")",
"to",
"save",... | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/TSMeta.java#L845-L877 |
UrielCh/ovh-java-sdk | ovh-java-sdk-licenseworklight/src/main/java/net/minidev/ovh/api/ApiOvhLicenseworklight.java | ApiOvhLicenseworklight.serviceName_tasks_GET | public ArrayList<Long> serviceName_tasks_GET(String serviceName, OvhActionType action, OvhTaskStateEnum status) throws IOException {
String qPath = "/license/worklight/{serviceName}/tasks";
StringBuilder sb = path(qPath, serviceName);
query(sb, "action", action);
query(sb, "status", status);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<Long> serviceName_tasks_GET(String serviceName, OvhActionType action, OvhTaskStateEnum status) throws IOException {
String qPath = "/license/worklight/{serviceName}/tasks";
StringBuilder sb = path(qPath, serviceName);
query(sb, "action", action);
query(sb, "status", status);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_tasks_GET",
"(",
"String",
"serviceName",
",",
"OvhActionType",
"action",
",",
"OvhTaskStateEnum",
"status",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/license/worklight/{serviceName}/tasks\"",
";... | Tasks linked to this license
REST: GET /license/worklight/{serviceName}/tasks
@param status [required] Filter the value of status property (=)
@param action [required] Filter the value of action property (=)
@param serviceName [required] The name of your WorkLight license | [
"Tasks",
"linked",
"to",
"this",
"license"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licenseworklight/src/main/java/net/minidev/ovh/api/ApiOvhLicenseworklight.java#L78-L85 |
beanshell/beanshell | src/main/java/bsh/BSHAllocationExpression.java | BSHAllocationExpression.arrayNewInstance | private Object arrayNewInstance(
Class<?> type, BSHArrayDimensions dimensionsNode,
CallStack callstack, Interpreter interpreter) throws EvalError {
if ( dimensionsNode.numUndefinedDims > 0 ) {
Object proto = Array.newInstance(
type, new int [dimensionsNode.numUndefinedDims] ); // zeros
type = proto.getClass();
}
try {
Object arr = Array.newInstance(
type, dimensionsNode.definedDimensions);
if ( !interpreter.getStrictJava() )
arrayFillDefaultValue(arr);
return arr;
} catch( NegativeArraySizeException e1 ) {
throw new TargetError( e1, this, callstack );
} catch( Exception e ) {
throw new EvalError("Can't construct primitive array: "
+ e.getMessage(), this, callstack, e);
}
} | java | private Object arrayNewInstance(
Class<?> type, BSHArrayDimensions dimensionsNode,
CallStack callstack, Interpreter interpreter) throws EvalError {
if ( dimensionsNode.numUndefinedDims > 0 ) {
Object proto = Array.newInstance(
type, new int [dimensionsNode.numUndefinedDims] ); // zeros
type = proto.getClass();
}
try {
Object arr = Array.newInstance(
type, dimensionsNode.definedDimensions);
if ( !interpreter.getStrictJava() )
arrayFillDefaultValue(arr);
return arr;
} catch( NegativeArraySizeException e1 ) {
throw new TargetError( e1, this, callstack );
} catch( Exception e ) {
throw new EvalError("Can't construct primitive array: "
+ e.getMessage(), this, callstack, e);
}
} | [
"private",
"Object",
"arrayNewInstance",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"BSHArrayDimensions",
"dimensionsNode",
",",
"CallStack",
"callstack",
",",
"Interpreter",
"interpreter",
")",
"throws",
"EvalError",
"{",
"if",
"(",
"dimensionsNode",
".",
"numUnde... | Create an array of the dimensions specified in dimensionsNode.
dimensionsNode may contain a number of "undefined" as well as "defined"
dimensions.
<p>
Background: in Java arrays are implemented in arrays-of-arrays style
where, for example, a two dimensional array is a an array of arrays of
some base type. Each dimension-type has a Java class type associated
with it... so if foo = new int[5][5] then the type of foo is
int [][] and the type of foo[0] is int[], etc. Arrays may also be
specified with undefined trailing dimensions - meaning that the lower
order arrays are not allocated as objects. e.g.
if foo = new int [5][]; then foo[0] == null //true; and can later be
assigned with the appropriate type, e.g. foo[0] = new int[5];
(See Learning Java, O'Reilly & Associates more background).
<p>
To create an array with undefined trailing dimensions using the
reflection API we must use an array type to represent the lower order
(undefined) dimensions as the "base" type for the array creation...
Java will then create the correct type by adding the dimensions of the
base type to specified allocated dimensions yielding an array of
dimensionality base + specified with the base dimensons unallocated.
To create the "base" array type we simply create a prototype, zero
length in each dimension, array and use it to get its class
(Actually, I think there is a way we could do it with Class.forName()
but I don't trust this). The code is simpler than the explanation...
see below. | [
"Create",
"an",
"array",
"of",
"the",
"dimensions",
"specified",
"in",
"dimensionsNode",
".",
"dimensionsNode",
"may",
"contain",
"a",
"number",
"of",
"undefined",
"as",
"well",
"as",
"defined",
"dimensions",
".",
"<p",
">"
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/BSHAllocationExpression.java#L292-L313 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/IsbnValidator.java | IsbnValidator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString;
if (ignoreSeparators) {
valueAsString =
Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("-", StringUtils.EMPTY);
} else {
valueAsString = Objects.toString(pvalue, null);
}
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (!StringUtils.isNumeric(valueAsString)) {
return false;
}
if (valueAsString.length() == Isbn10Validator.ISBN10_LENGTH) {
// we do have 10 digits, lets test the checksum
return CHECK_ISBN10.isValid(valueAsString);
}
if (valueAsString.length() == Isbn13Validator.ISBN13_LENGTH) {
// we do have 13 digits, lets test the checksum
return CHECK_ISBN13.isValid(valueAsString);
}
// other sizes are wrong, but this is reported by AlternateSize
return true;
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString;
if (ignoreSeparators) {
valueAsString =
Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("-", StringUtils.EMPTY);
} else {
valueAsString = Objects.toString(pvalue, null);
}
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (!StringUtils.isNumeric(valueAsString)) {
return false;
}
if (valueAsString.length() == Isbn10Validator.ISBN10_LENGTH) {
// we do have 10 digits, lets test the checksum
return CHECK_ISBN10.isValid(valueAsString);
}
if (valueAsString.length() == Isbn13Validator.ISBN13_LENGTH) {
// we do have 13 digits, lets test the checksum
return CHECK_ISBN13.isValid(valueAsString);
}
// other sizes are wrong, but this is reported by AlternateSize
return true;
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"final",
"String",
"valueAsString",
";",
"if",
"(",
"ignoreSeparators",
")",
"{",
"valueAsString",
"=",
... | {@inheritDoc} check if given string is a valid isbn.
@see javax.validation.ConstraintValidator#isValid(java.lang.Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"string",
"is",
"a",
"valid",
"isbn",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/IsbnValidator.java#L68-L93 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java | DomHelper.drawGroup | public Element drawGroup(Object parent, Object object, String tagName) {
switch (namespace) {
case SVG:
return createGroup(Dom.NS_SVG, parent, object, tagName);
case VML:
return createGroup(Dom.NS_VML, parent, object, tagName);
case HTML:
default:
return createGroup(Dom.NS_HTML, parent, object, tagName);
}
} | java | public Element drawGroup(Object parent, Object object, String tagName) {
switch (namespace) {
case SVG:
return createGroup(Dom.NS_SVG, parent, object, tagName);
case VML:
return createGroup(Dom.NS_VML, parent, object, tagName);
case HTML:
default:
return createGroup(Dom.NS_HTML, parent, object, tagName);
}
} | [
"public",
"Element",
"drawGroup",
"(",
"Object",
"parent",
",",
"Object",
"object",
",",
"String",
"tagName",
")",
"{",
"switch",
"(",
"namespace",
")",
"{",
"case",
"SVG",
":",
"return",
"createGroup",
"(",
"Dom",
".",
"NS_SVG",
",",
"parent",
",",
"obj... | Creates a group element in the technology (SVG/VML/...) of this context with the specified tag name.
@param parent
parent group object
@param object
group object
@param tagName
the tag name
@return element for the group | [
"Creates",
"a",
"group",
"element",
"in",
"the",
"technology",
"(",
"SVG",
"/",
"VML",
"/",
"...",
")",
"of",
"this",
"context",
"with",
"the",
"specified",
"tag",
"name",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L212-L222 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java | CmsPositionBean.checkCollision | public static boolean checkCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) {
// check for non collision is easier
if ((posA.getLeft() - margin) >= (posB.getLeft() + posB.getWidth())) {
// posA is right of posB
return false;
}
if ((posA.getLeft() + posA.getWidth()) <= (posB.getLeft() - margin)) {
// posA is left of posB
return false;
}
if ((posA.getTop() - margin) >= (posB.getTop() + posB.getHeight())) {
// posA is bellow posB
return false;
}
if ((posA.getTop() + posA.getHeight()) <= (posB.getTop() - margin)) {
// posA is above posB
return false;
}
// in any other case the position rectangles collide
return true;
} | java | public static boolean checkCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) {
// check for non collision is easier
if ((posA.getLeft() - margin) >= (posB.getLeft() + posB.getWidth())) {
// posA is right of posB
return false;
}
if ((posA.getLeft() + posA.getWidth()) <= (posB.getLeft() - margin)) {
// posA is left of posB
return false;
}
if ((posA.getTop() - margin) >= (posB.getTop() + posB.getHeight())) {
// posA is bellow posB
return false;
}
if ((posA.getTop() + posA.getHeight()) <= (posB.getTop() - margin)) {
// posA is above posB
return false;
}
// in any other case the position rectangles collide
return true;
} | [
"public",
"static",
"boolean",
"checkCollision",
"(",
"CmsPositionBean",
"posA",
",",
"CmsPositionBean",
"posB",
",",
"int",
"margin",
")",
"{",
"// check for non collision is easier",
"if",
"(",
"(",
"posA",
".",
"getLeft",
"(",
")",
"-",
"margin",
")",
">=",
... | Checks whether the two position rectangles collide.<p>
@param posA the first position to check
@param posB the second position to check
@param margin the required margin
@return <code>true</code> if the two position rectangles collide | [
"Checks",
"whether",
"the",
"two",
"position",
"rectangles",
"collide",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java#L206-L228 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.pack | public static void pack(File sourceDir, OutputStream os, int compressionLevel) {
pack(sourceDir, os, IdentityNameMapper.INSTANCE, compressionLevel);
} | java | public static void pack(File sourceDir, OutputStream os, int compressionLevel) {
pack(sourceDir, os, IdentityNameMapper.INSTANCE, compressionLevel);
} | [
"public",
"static",
"void",
"pack",
"(",
"File",
"sourceDir",
",",
"OutputStream",
"os",
",",
"int",
"compressionLevel",
")",
"{",
"pack",
"(",
"sourceDir",
",",
"os",
",",
"IdentityNameMapper",
".",
"INSTANCE",
",",
"compressionLevel",
")",
";",
"}"
] | Compresses the given directory and all of its sub-directories into the passed in
stream. It is the responsibility of the caller to close the passed in
stream properly.
@param sourceDir
root directory.
@param os
output stream (will be buffered in this method).
@param compressionLevel
compression level
@since 1.10 | [
"Compresses",
"the",
"given",
"directory",
"and",
"all",
"of",
"its",
"sub",
"-",
"directories",
"into",
"the",
"passed",
"in",
"stream",
".",
"It",
"is",
"the",
"responsibility",
"of",
"the",
"caller",
"to",
"close",
"the",
"passed",
"in",
"stream",
"prop... | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1652-L1654 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java | RingPlacer.partitionNonRingPartners | public void partitionNonRingPartners(IAtom atom, IRing ring, IAtomContainer ringAtoms, IAtomContainer nonRingAtoms) {
List atoms = molecule.getConnectedAtomsList(atom);
for (int i = 0; i < atoms.size(); i++) {
IAtom curAtom = (IAtom) atoms.get(i);
if (!ring.contains(curAtom)) {
nonRingAtoms.addAtom(curAtom);
} else {
ringAtoms.addAtom(curAtom);
}
}
} | java | public void partitionNonRingPartners(IAtom atom, IRing ring, IAtomContainer ringAtoms, IAtomContainer nonRingAtoms) {
List atoms = molecule.getConnectedAtomsList(atom);
for (int i = 0; i < atoms.size(); i++) {
IAtom curAtom = (IAtom) atoms.get(i);
if (!ring.contains(curAtom)) {
nonRingAtoms.addAtom(curAtom);
} else {
ringAtoms.addAtom(curAtom);
}
}
} | [
"public",
"void",
"partitionNonRingPartners",
"(",
"IAtom",
"atom",
",",
"IRing",
"ring",
",",
"IAtomContainer",
"ringAtoms",
",",
"IAtomContainer",
"nonRingAtoms",
")",
"{",
"List",
"atoms",
"=",
"molecule",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
... | Partition the bonding partners of a given atom into ring atoms and non-ring atoms
@param atom The atom whose bonding partners are to be partitioned
@param ring The ring against which the bonding partners are checked
@param ringAtoms An AtomContainer to store the ring bonding partners
@param nonRingAtoms An AtomContainer to store the non-ring bonding partners | [
"Partition",
"the",
"bonding",
"partners",
"of",
"a",
"given",
"atom",
"into",
"ring",
"atoms",
"and",
"non",
"-",
"ring",
"atoms"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java#L666-L676 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Collectors.java | Collectors.toMap | @NotNull
public static <T, K, V, M extends Map<K, V>> Collector<T, ?, M> toMap(
@NotNull final Function<? super T, ? extends K> keyMapper,
@NotNull final Function<? super T, ? extends V> valueMapper,
@NotNull final BinaryOperator<V> mergeFunction,
@NotNull final Supplier<M> mapFactory) {
return new CollectorsImpl<T, M, M>(
mapFactory,
new BiConsumer<M, T>() {
@Override
public void accept(@NotNull M map, T t) {
final K key = keyMapper.apply(t);
final V value = valueMapper.apply(t);
mapMerge(map, key, value, mergeFunction);
}
}
);
} | java | @NotNull
public static <T, K, V, M extends Map<K, V>> Collector<T, ?, M> toMap(
@NotNull final Function<? super T, ? extends K> keyMapper,
@NotNull final Function<? super T, ? extends V> valueMapper,
@NotNull final BinaryOperator<V> mergeFunction,
@NotNull final Supplier<M> mapFactory) {
return new CollectorsImpl<T, M, M>(
mapFactory,
new BiConsumer<M, T>() {
@Override
public void accept(@NotNull M map, T t) {
final K key = keyMapper.apply(t);
final V value = valueMapper.apply(t);
mapMerge(map, key, value, mergeFunction);
}
}
);
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
",",
"K",
",",
"V",
",",
"M",
"extends",
"Map",
"<",
"K",
",",
"V",
">",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"M",
">",
"toMap",
"(",
"@",
"NotNull",
"final",
"Function",
"<",
"?",
"super",
... | Returns a {@code Collector} that fills new {@code Map} with input elements.
If the mapped keys contain duplicates, the value mapping function is applied
to each equal element, and the results are merged using the provided merging function.
@param <T> the type of the input elements
@param <K> the result type of key mapping function
@param <V> the result type of value mapping function
@param <M> the type of the resulting {@code Map}
@param keyMapper a mapping function to produce keys
@param valueMapper a mapping function to produce values
@param mergeFunction a merge function, used to resolve collisions between
values associated with the same key
@param mapFactory a supplier function that provides new {@code Map}
@return a {@code Collector}
@since 1.2.0 | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"that",
"fills",
"new",
"{",
"@code",
"Map",
"}",
"with",
"input",
"elements",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L321-L340 |
inversoft/restify | src/main/java/com/inversoft/net/ssl/SSLTools.java | SSLTools.signWithRSA | public static String signWithRSA(String string, String keyString) throws GeneralSecurityException, IOException {
try {
RSAPrivateKey privateKey;
// If PKCS#1
if (keyString.contains(PKCS_1_KEY_START)) {
byte[] bytes = parseDERFromPEM(keyString, PKCS_1_KEY_START, PKCS_1_KEY_END);
privateKey = generatePrivateKeyFromPKCS10DER(bytes);
} else {
// else, assume PKCS#8
byte[] bytes = parseDERFromPEM(keyString, P8_KEY_START, P8_KEY_END);
privateKey = generatePrivateKeyFromPKCS8DER(bytes);
}
Signature rsa = Signature.getInstance("NONEwithRSA");
rsa.initSign(privateKey);
rsa.update(string.getBytes());
byte[] signed = rsa.sign();
return new String(Base64.getEncoder().encode(signed));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
} | java | public static String signWithRSA(String string, String keyString) throws GeneralSecurityException, IOException {
try {
RSAPrivateKey privateKey;
// If PKCS#1
if (keyString.contains(PKCS_1_KEY_START)) {
byte[] bytes = parseDERFromPEM(keyString, PKCS_1_KEY_START, PKCS_1_KEY_END);
privateKey = generatePrivateKeyFromPKCS10DER(bytes);
} else {
// else, assume PKCS#8
byte[] bytes = parseDERFromPEM(keyString, P8_KEY_START, P8_KEY_END);
privateKey = generatePrivateKeyFromPKCS8DER(bytes);
}
Signature rsa = Signature.getInstance("NONEwithRSA");
rsa.initSign(privateKey);
rsa.update(string.getBytes());
byte[] signed = rsa.sign();
return new String(Base64.getEncoder().encode(signed));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"String",
"signWithRSA",
"(",
"String",
"string",
",",
"String",
"keyString",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"try",
"{",
"RSAPrivateKey",
"privateKey",
";",
"// If PKCS#1",
"if",
"(",
"keyString",
".",
"cont... | Sign the provided string with the private key and the provided signature. The provided private key string is expected to be in one of
the two formats: PKCS#1 or PKCS#8.
@param string The string to sign.
@param keyString The private to use when signing the string.
@return the signed string. | [
"Sign",
"the",
"provided",
"string",
"with",
"the",
"private",
"key",
"and",
"the",
"provided",
"signature",
".",
"The",
"provided",
"private",
"key",
"string",
"is",
"expected",
"to",
"be",
"in",
"one",
"of",
"the",
"two",
"formats",
":",
"PKCS#1",
"or",
... | train | https://github.com/inversoft/restify/blob/f2426d9082e00a9d958af28f78ccda61802c6700/src/main/java/com/inversoft/net/ssl/SSLTools.java#L181-L203 |
GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/CredentialFactory.java | CredentialFactory.getApplicationDefaultCredentials | public Credential getApplicationDefaultCredentials(List<String> scopes, HttpTransport transport)
throws IOException, GeneralSecurityException {
logger.atFine().log("getApplicationDefaultCredential(%s)", scopes);
return GoogleCredentialWithRetry.fromGoogleCredential(
GoogleCredential.getApplicationDefault(transport, JSON_FACTORY).createScoped(scopes));
} | java | public Credential getApplicationDefaultCredentials(List<String> scopes, HttpTransport transport)
throws IOException, GeneralSecurityException {
logger.atFine().log("getApplicationDefaultCredential(%s)", scopes);
return GoogleCredentialWithRetry.fromGoogleCredential(
GoogleCredential.getApplicationDefault(transport, JSON_FACTORY).createScoped(scopes));
} | [
"public",
"Credential",
"getApplicationDefaultCredentials",
"(",
"List",
"<",
"String",
">",
"scopes",
",",
"HttpTransport",
"transport",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
"{",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"get... | Get Google Application Default Credentials as described in <a
href="https://developers.google.com/identity/protocols/application-default-credentials#callingjava"
>Google Application Default Credentials</a>
@param scopes The OAuth scopes that the credential should be valid for. | [
"Get",
"Google",
"Application",
"Default",
"Credentials",
"as",
"described",
"in",
"<a",
"href",
"=",
"https",
":",
"//",
"developers",
".",
"google",
".",
"com",
"/",
"identity",
"/",
"protocols",
"/",
"application",
"-",
"default",
"-",
"credentials#callingj... | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/CredentialFactory.java#L377-L382 |
qubole/qds-sdk-java | src/main/java/com/qubole/qds/sdk/java/client/ResultLatch.java | ResultLatch.awaitResult | public ResultValue awaitResult(long maxWait, TimeUnit timeUnit) throws Exception
{
if (!await(maxWait, timeUnit))
{
throw new TimeoutException();
}
return getResultValue();
} | java | public ResultValue awaitResult(long maxWait, TimeUnit timeUnit) throws Exception
{
if (!await(maxWait, timeUnit))
{
throw new TimeoutException();
}
return getResultValue();
} | [
"public",
"ResultValue",
"awaitResult",
"(",
"long",
"maxWait",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"await",
"(",
"maxWait",
",",
"timeUnit",
")",
")",
"{",
"throw",
"new",
"TimeoutException",
"(",
")",
";",
"}",
... | Await up to a maximum time for the result
@param maxWait max wait time
@param timeUnit time unit
@return the result
@throws Exception errors | [
"Await",
"up",
"to",
"a",
"maximum",
"time",
"for",
"the",
"result"
] | train | https://github.com/qubole/qds-sdk-java/blob/c652374075c7b72071f73db960f5f3a43f922afd/src/main/java/com/qubole/qds/sdk/java/client/ResultLatch.java#L205-L212 |
infinispan/infinispan | core/src/main/java/org/infinispan/affinity/KeyAffinityServiceFactory.java | KeyAffinityServiceFactory.newKeyAffinityService | public static <K, V> KeyAffinityService<K> newKeyAffinityService(Cache<K, V> cache, Executor ex, KeyGenerator<K> keyGenerator, int keyBufferSize) {
return newKeyAffinityService(cache, ex, keyGenerator, keyBufferSize, true);
} | java | public static <K, V> KeyAffinityService<K> newKeyAffinityService(Cache<K, V> cache, Executor ex, KeyGenerator<K> keyGenerator, int keyBufferSize) {
return newKeyAffinityService(cache, ex, keyGenerator, keyBufferSize, true);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"KeyAffinityService",
"<",
"K",
">",
"newKeyAffinityService",
"(",
"Cache",
"<",
"K",
",",
"V",
">",
"cache",
",",
"Executor",
"ex",
",",
"KeyGenerator",
"<",
"K",
">",
"keyGenerator",
",",
"int",
"keyBufferSi... | Same as {@link #newKeyAffinityService(org.infinispan.Cache, java.util.concurrent.Executor, KeyGenerator, int,
boolean)} with start == true; | [
"Same",
"as",
"{"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/affinity/KeyAffinityServiceFactory.java#L49-L51 |
wcm-io/wcm-io-sling | commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java | RequestParam.getBoolean | public static boolean getBoolean(@NotNull ServletRequest request, @NotNull String param) {
return getBoolean(request, param, false);
} | java | public static boolean getBoolean(@NotNull ServletRequest request, @NotNull String param) {
return getBoolean(request, param, false);
} | [
"public",
"static",
"boolean",
"getBoolean",
"(",
"@",
"NotNull",
"ServletRequest",
"request",
",",
"@",
"NotNull",
"String",
"param",
")",
"{",
"return",
"getBoolean",
"(",
"request",
",",
"param",
",",
"false",
")",
";",
"}"
] | Returns a request parameter as boolean.
@param request Request.
@param param Parameter name.
@return Parameter value or <code>false</code> if it does not exist or cannot be interpreted as boolean. | [
"Returns",
"a",
"request",
"parameter",
"as",
"boolean",
"."
] | train | https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L233-L235 |
lucee/Lucee | core/src/main/java/lucee/transformer/cfml/expression/AbstrCFMLExprTransformer.java | AbstrCFMLExprTransformer.startElement | private Variable startElement(Data data, Identifier name, Position line) throws TemplateException {
// check function
if (data.srcCode.isCurrent('(')) {
FunctionMember func = getFunctionMember(data, name, true);
Variable var = name.getFactory().createVariable(line, data.srcCode.getPosition());
var.addMember(func);
comments(data);
return var;
}
// check scope
Variable var = scope(data, name, line);
if (var != null) return var;
// undefined variable
var = name.getFactory().createVariable(line, data.srcCode.getPosition());
var.addMember(data.factory.createDataMember(name));
comments(data);
return var;
} | java | private Variable startElement(Data data, Identifier name, Position line) throws TemplateException {
// check function
if (data.srcCode.isCurrent('(')) {
FunctionMember func = getFunctionMember(data, name, true);
Variable var = name.getFactory().createVariable(line, data.srcCode.getPosition());
var.addMember(func);
comments(data);
return var;
}
// check scope
Variable var = scope(data, name, line);
if (var != null) return var;
// undefined variable
var = name.getFactory().createVariable(line, data.srcCode.getPosition());
var.addMember(data.factory.createDataMember(name));
comments(data);
return var;
} | [
"private",
"Variable",
"startElement",
"(",
"Data",
"data",
",",
"Identifier",
"name",
",",
"Position",
"line",
")",
"throws",
"TemplateException",
"{",
"// check function",
"if",
"(",
"data",
".",
"srcCode",
".",
"isCurrent",
"(",
"'",
"'",
")",
")",
"{",
... | Extrahiert den Start Element einer Variale, dies ist entweder eine Funktion, eine Scope
Definition oder eine undefinierte Variable. <br />
EBNF:<br />
<code>identifier "(" functionArg ")" | scope | identifier;</code>
@param name Einstiegsname
@return CFXD Element
@throws TemplateException | [
"Extrahiert",
"den",
"Start",
"Element",
"einer",
"Variale",
"dies",
"ist",
"entweder",
"eine",
"Funktion",
"eine",
"Scope",
"Definition",
"oder",
"eine",
"undefinierte",
"Variable",
".",
"<br",
"/",
">",
"EBNF",
":",
"<br",
"/",
">",
"<code",
">",
"identifi... | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/expression/AbstrCFMLExprTransformer.java#L1593-L1616 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java | AbstractRedisStorage.releaseOrphanedTriggers | protected void releaseOrphanedTriggers(RedisTriggerState currentState, RedisTriggerState newState, T jedis) throws JobPersistenceException {
for (Tuple triggerTuple : jedis.zrangeWithScores(redisSchema.triggerStateKey(currentState), 0, -1)) {
final String lockId = jedis.get(redisSchema.triggerLockKey(redisSchema.triggerKey(triggerTuple.getElement())));
if(isNullOrEmpty(lockId) || !isActiveInstance(lockId, jedis)){
// Lock key has expired. We can safely alter the trigger's state.
logger.debug(String.format("Changing state of orphaned trigger %s from %s to %s.", triggerTuple.getElement(), currentState, newState));
setTriggerState(newState, triggerTuple.getScore(), triggerTuple.getElement(), jedis);
}
}
} | java | protected void releaseOrphanedTriggers(RedisTriggerState currentState, RedisTriggerState newState, T jedis) throws JobPersistenceException {
for (Tuple triggerTuple : jedis.zrangeWithScores(redisSchema.triggerStateKey(currentState), 0, -1)) {
final String lockId = jedis.get(redisSchema.triggerLockKey(redisSchema.triggerKey(triggerTuple.getElement())));
if(isNullOrEmpty(lockId) || !isActiveInstance(lockId, jedis)){
// Lock key has expired. We can safely alter the trigger's state.
logger.debug(String.format("Changing state of orphaned trigger %s from %s to %s.", triggerTuple.getElement(), currentState, newState));
setTriggerState(newState, triggerTuple.getScore(), triggerTuple.getElement(), jedis);
}
}
} | [
"protected",
"void",
"releaseOrphanedTriggers",
"(",
"RedisTriggerState",
"currentState",
",",
"RedisTriggerState",
"newState",
",",
"T",
"jedis",
")",
"throws",
"JobPersistenceException",
"{",
"for",
"(",
"Tuple",
"triggerTuple",
":",
"jedis",
".",
"zrangeWithScores",
... | Release triggers from the given current state to the new state if its locking scheduler has not
registered as alive in the last 10 minutes
@param currentState the current state of the orphaned trigger
@param newState the new state of the orphaned trigger
@param jedis a thread-safe Redis connection | [
"Release",
"triggers",
"from",
"the",
"given",
"current",
"state",
"to",
"the",
"new",
"state",
"if",
"its",
"locking",
"scheduler",
"has",
"not",
"registered",
"as",
"alive",
"in",
"the",
"last",
"10",
"minutes"
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L672-L681 |
agmip/agmip-common-functions | src/main/java/org/agmip/functions/SoilHelper.java | SoilHelper.getGrowthFactor | protected static String getGrowthFactor(String mid, String pp, String k, String m) {
if (compare(mid, pp, CompareMode.NOTGREATER)) {
return m;
} else {
return multiply(m, exp(multiply(k, substract(mid, pp))));
}
} | java | protected static String getGrowthFactor(String mid, String pp, String k, String m) {
if (compare(mid, pp, CompareMode.NOTGREATER)) {
return m;
} else {
return multiply(m, exp(multiply(k, substract(mid, pp))));
}
} | [
"protected",
"static",
"String",
"getGrowthFactor",
"(",
"String",
"mid",
",",
"String",
"pp",
",",
"String",
"k",
",",
"String",
"m",
")",
"{",
"if",
"(",
"compare",
"(",
"mid",
",",
"pp",
",",
"CompareMode",
".",
"NOTGREATER",
")",
")",
"{",
"return"... | soil factors which decline exponentially between PP and RD (units depend
on variable, same units as M (Maximum value, will use default value 1)
@param mid The mid point value between two layers
@param pp depth of top soil, or pivot point of curve (cm)
@param k exponential decay rate
@param m Maximum value in the top PP cm of soil (units depend on
@return The growth factor (0-m) | [
"soil",
"factors",
"which",
"decline",
"exponentially",
"between",
"PP",
"and",
"RD",
"(",
"units",
"depend",
"on",
"variable",
"same",
"units",
"as",
"M",
"(",
"Maximum",
"value",
"will",
"use",
"default",
"value",
"1",
")"
] | train | https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/SoilHelper.java#L150-L156 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java | RefinePolyLineCorner.optimize | protected int optimize( List<Point2D_I32> contour , int c0,int c1,int c2 ) {
double bestDistance = computeCost(contour,c0,c1,c2,0);
int bestIndex = 0;
for( int i = -searchRadius; i <= searchRadius; i++ ) {
if( i == 0 ) {
// if it found a better point in the first half stop the search since that's probably the correct
// direction. Could be improved by remember past search direction
if( bestIndex != 0 )
break;
} else {
double found = computeCost(contour, c0, c1, c2, i);
if (found < bestDistance) {
bestDistance = found;
bestIndex = i;
}
}
}
return CircularIndex.addOffset(c1, bestIndex, contour.size());
} | java | protected int optimize( List<Point2D_I32> contour , int c0,int c1,int c2 ) {
double bestDistance = computeCost(contour,c0,c1,c2,0);
int bestIndex = 0;
for( int i = -searchRadius; i <= searchRadius; i++ ) {
if( i == 0 ) {
// if it found a better point in the first half stop the search since that's probably the correct
// direction. Could be improved by remember past search direction
if( bestIndex != 0 )
break;
} else {
double found = computeCost(contour, c0, c1, c2, i);
if (found < bestDistance) {
bestDistance = found;
bestIndex = i;
}
}
}
return CircularIndex.addOffset(c1, bestIndex, contour.size());
} | [
"protected",
"int",
"optimize",
"(",
"List",
"<",
"Point2D_I32",
">",
"contour",
",",
"int",
"c0",
",",
"int",
"c1",
",",
"int",
"c2",
")",
"{",
"double",
"bestDistance",
"=",
"computeCost",
"(",
"contour",
",",
"c0",
",",
"c1",
",",
"c2",
",",
"0",
... | Searches around the current c1 point for the best place to put the corner
@return location of best corner in local search region | [
"Searches",
"around",
"the",
"current",
"c1",
"point",
"for",
"the",
"best",
"place",
"to",
"put",
"the",
"corner"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/RefinePolyLineCorner.java#L133-L152 |
spotify/docker-client | src/main/java/com/spotify/docker/client/DockerConfigReader.java | DockerConfigReader.fromConfig | @Deprecated
public RegistryAuth fromConfig(final Path configPath, final String serverAddress)
throws IOException {
return authForRegistry(configPath, serverAddress);
} | java | @Deprecated
public RegistryAuth fromConfig(final Path configPath, final String serverAddress)
throws IOException {
return authForRegistry(configPath, serverAddress);
} | [
"@",
"Deprecated",
"public",
"RegistryAuth",
"fromConfig",
"(",
"final",
"Path",
"configPath",
",",
"final",
"String",
"serverAddress",
")",
"throws",
"IOException",
"{",
"return",
"authForRegistry",
"(",
"configPath",
",",
"serverAddress",
")",
";",
"}"
] | Returns the RegistryAuth for the config file for the given registry server name.
@throws IllegalArgumentException if the config file does not contain registry auth info for the
registry
@deprecated In favor of {@link #authForRegistry(Path, String)} | [
"Returns",
"the",
"RegistryAuth",
"for",
"the",
"config",
"file",
"for",
"the",
"given",
"registry",
"server",
"name",
"."
] | train | https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DockerConfigReader.java#L71-L75 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java | ByteUtils.bigIntegerToBytes | public static final void bigIntegerToBytes( BigInteger n, byte[] data, int[] offset ) {
byte[] bytes = n.toByteArray();
intToBytes(bytes.length, data, offset);
offset[0] += memcpy(data, offset[0], bytes, 0, bytes.length);
} | java | public static final void bigIntegerToBytes( BigInteger n, byte[] data, int[] offset ) {
byte[] bytes = n.toByteArray();
intToBytes(bytes.length, data, offset);
offset[0] += memcpy(data, offset[0], bytes, 0, bytes.length);
} | [
"public",
"static",
"final",
"void",
"bigIntegerToBytes",
"(",
"BigInteger",
"n",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"[",
"]",
"offset",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"n",
".",
"toByteArray",
"(",
")",
";",
"intToBytes",
"(",
"byt... | Write the bytes representing <code>n</code> into the byte array
<code>data</code>, starting at index <code>offset [0]</code>, and
increment <code>offset [0]</code> by the number of bytes written; if
<code>data == null</code>, increment <code>offset [0]</code> by the
number of bytes that would have been written otherwise.
@param n the <code>BigInteger</code> to encode
@param data The byte array to store into, or <code>null</code>.
@param offset A single element array whose first element is the index in
data to begin writing at on function entry, and which on
function exit has been incremented by the number of bytes
written. | [
"Write",
"the",
"bytes",
"representing",
"<code",
">",
"n<",
"/",
"code",
">",
"into",
"the",
"byte",
"array",
"<code",
">",
"data<",
"/",
"code",
">",
"starting",
"at",
"index",
"<code",
">",
"offset",
"[",
"0",
"]",
"<",
"/",
"code",
">",
"and",
... | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L380-L384 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/thumbnail/ThumbnailRenderer.java | ThumbnailRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Thumbnail thumbnail = (Thumbnail) component;
ResponseWriter rw = context.getResponseWriter();
UIComponent capt;
capt = thumbnail.getFacet("caption");
if (capt != null ) {
rw.startElement("div", thumbnail);
rw.writeAttribute("class", "caption", "class");
capt.encodeAll(context);
rw.endElement("div");
}
rw.endElement("div");
Tooltip.activateTooltips(context, thumbnail);
endResponsiveWrapper(component, rw);
} | java | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Thumbnail thumbnail = (Thumbnail) component;
ResponseWriter rw = context.getResponseWriter();
UIComponent capt;
capt = thumbnail.getFacet("caption");
if (capt != null ) {
rw.startElement("div", thumbnail);
rw.writeAttribute("class", "caption", "class");
capt.encodeAll(context);
rw.endElement("div");
}
rw.endElement("div");
Tooltip.activateTooltips(context, thumbnail);
endResponsiveWrapper(component, rw);
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Thumbnail",
"thumbnai... | This methods generates the HTML code of the current b:thumbnail.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:thumbnail.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"thumbnail",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framework"... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/thumbnail/ThumbnailRenderer.java#L84-L104 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.betn | public static Betner betn(String target, String left, String right) {
return betn(target).between(left, right);
} | java | public static Betner betn(String target, String left, String right) {
return betn(target).between(left, right);
} | [
"public",
"static",
"Betner",
"betn",
"(",
"String",
"target",
",",
"String",
"left",
",",
"String",
"right",
")",
"{",
"return",
"betn",
"(",
"target",
")",
".",
"between",
"(",
"left",
",",
"right",
")",
";",
"}"
] | Returns a {@code String} between matcher that matches any character in a given range
@param target
@param left
@param right
@return | [
"Returns",
"a",
"{",
"@code",
"String",
"}",
"between",
"matcher",
"that",
"matches",
"any",
"character",
"in",
"a",
"given",
"range"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L431-L433 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/helper/CompensationUtil.java | CompensationUtil.throwCompensationEvent | public static void throwCompensationEvent(List<EventSubscriptionEntity> eventSubscriptions, ActivityExecution execution, boolean async) {
// first spawn the compensating executions
for (EventSubscriptionEntity eventSubscription : eventSubscriptions) {
// check whether compensating execution is already created
// (which is the case when compensating an embedded subprocess,
// where the compensating execution is created when leaving the subprocess
// and holds snapshot data).
ExecutionEntity compensatingExecution = getCompensatingExecution(eventSubscription);
if (compensatingExecution != null) {
if (compensatingExecution.getParent() != execution) {
// move the compensating execution under this execution if this is not the case yet
compensatingExecution.setParent((PvmExecutionImpl) execution);
}
compensatingExecution.setEventScope(false);
} else {
compensatingExecution = (ExecutionEntity) execution.createExecution();
eventSubscription.setConfiguration(compensatingExecution.getId());
}
compensatingExecution.setConcurrent(true);
}
// signal compensation events in REVERSE order of their 'created' timestamp
Collections.sort(eventSubscriptions, new Comparator<EventSubscriptionEntity>() {
@Override
public int compare(EventSubscriptionEntity o1, EventSubscriptionEntity o2) {
return o2.getCreated().compareTo(o1.getCreated());
}
});
for (EventSubscriptionEntity compensateEventSubscriptionEntity : eventSubscriptions) {
compensateEventSubscriptionEntity.eventReceived(null, async);
}
} | java | public static void throwCompensationEvent(List<EventSubscriptionEntity> eventSubscriptions, ActivityExecution execution, boolean async) {
// first spawn the compensating executions
for (EventSubscriptionEntity eventSubscription : eventSubscriptions) {
// check whether compensating execution is already created
// (which is the case when compensating an embedded subprocess,
// where the compensating execution is created when leaving the subprocess
// and holds snapshot data).
ExecutionEntity compensatingExecution = getCompensatingExecution(eventSubscription);
if (compensatingExecution != null) {
if (compensatingExecution.getParent() != execution) {
// move the compensating execution under this execution if this is not the case yet
compensatingExecution.setParent((PvmExecutionImpl) execution);
}
compensatingExecution.setEventScope(false);
} else {
compensatingExecution = (ExecutionEntity) execution.createExecution();
eventSubscription.setConfiguration(compensatingExecution.getId());
}
compensatingExecution.setConcurrent(true);
}
// signal compensation events in REVERSE order of their 'created' timestamp
Collections.sort(eventSubscriptions, new Comparator<EventSubscriptionEntity>() {
@Override
public int compare(EventSubscriptionEntity o1, EventSubscriptionEntity o2) {
return o2.getCreated().compareTo(o1.getCreated());
}
});
for (EventSubscriptionEntity compensateEventSubscriptionEntity : eventSubscriptions) {
compensateEventSubscriptionEntity.eventReceived(null, async);
}
} | [
"public",
"static",
"void",
"throwCompensationEvent",
"(",
"List",
"<",
"EventSubscriptionEntity",
">",
"eventSubscriptions",
",",
"ActivityExecution",
"execution",
",",
"boolean",
"async",
")",
"{",
"// first spawn the compensating executions",
"for",
"(",
"EventSubscripti... | we create a separate execution for each compensation handler invocation. | [
"we",
"create",
"a",
"separate",
"execution",
"for",
"each",
"compensation",
"handler",
"invocation",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/helper/CompensationUtil.java#L55-L89 |
sarxos/win-registry | src/main/java/com/github/sarxos/winreg/WindowsRegistry.java | WindowsRegistry.readStringSubKeys | public List<String> readStringSubKeys(HKey hk, String key, String charsetName) throws RegistryException {
try {
return ReflectedMethods.readStringSubKeys(hk.root(), hk.hex(), key, charsetName);
} catch (Exception e) {
throw new RegistryException("Cannot read sub keys from key " + key, e);
}
} | java | public List<String> readStringSubKeys(HKey hk, String key, String charsetName) throws RegistryException {
try {
return ReflectedMethods.readStringSubKeys(hk.root(), hk.hex(), key, charsetName);
} catch (Exception e) {
throw new RegistryException("Cannot read sub keys from key " + key, e);
}
} | [
"public",
"List",
"<",
"String",
">",
"readStringSubKeys",
"(",
"HKey",
"hk",
",",
"String",
"key",
",",
"String",
"charsetName",
")",
"throws",
"RegistryException",
"{",
"try",
"{",
"return",
"ReflectedMethods",
".",
"readStringSubKeys",
"(",
"hk",
".",
"root... | Read the value name(s) from a given key
@param hk the HKEY
@param key the key
@param charsetName which charset to use
@return the value name(s)
@throws RegistryException when something is not right | [
"Read",
"the",
"value",
"name",
"(",
"s",
")",
"from",
"a",
"given",
"key"
] | train | https://github.com/sarxos/win-registry/blob/5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437/src/main/java/com/github/sarxos/winreg/WindowsRegistry.java#L117-L123 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java | SQLExpressions.nthValue | public static <T> WindowOver<T> nthValue(Expression<T> expr, Number n) {
return nthValue(expr, ConstantImpl.create(n));
} | java | public static <T> WindowOver<T> nthValue(Expression<T> expr, Number n) {
return nthValue(expr, ConstantImpl.create(n));
} | [
"public",
"static",
"<",
"T",
">",
"WindowOver",
"<",
"T",
">",
"nthValue",
"(",
"Expression",
"<",
"T",
">",
"expr",
",",
"Number",
"n",
")",
"{",
"return",
"nthValue",
"(",
"expr",
",",
"ConstantImpl",
".",
"create",
"(",
"n",
")",
")",
";",
"}"
... | NTH_VALUE returns the expr value of the nth row in the window defined by the analytic clause.
The returned value has the data type of the expr.
@param expr measure expression
@param n one based row index
@return nth_value(expr, n) | [
"NTH_VALUE",
"returns",
"the",
"expr",
"value",
"of",
"the",
"nth",
"row",
"in",
"the",
"window",
"defined",
"by",
"the",
"analytic",
"clause",
".",
"The",
"returned",
"value",
"has",
"the",
"data",
"type",
"of",
"the",
"expr",
"."
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L680-L682 |
liferay/com-liferay-commerce | commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java | CPDefinitionGroupedEntryPersistenceImpl.findAll | @Override
public List<CPDefinitionGroupedEntry> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CPDefinitionGroupedEntry> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionGroupedEntry",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp definition grouped entries.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionGroupedEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of cp definition grouped entries
@param end the upper bound of the range of cp definition grouped entries (not inclusive)
@return the range of cp definition grouped entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"grouped",
"entries",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L2944-L2947 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/GalleriesApi.java | GalleriesApi.getPhotos | public Photos getPhotos(String galleryId, EnumSet<JinxConstants.PhotoExtras> extras) throws JinxException {
JinxUtils.validateParams(galleryId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.galleries.getPhotos");
params.put("gallery_id", galleryId);
if (!JinxUtils.isNullOrEmpty(extras)) {
params.put("extras", JinxUtils.buildCommaDelimitedList(extras));
}
return jinx.flickrGet(params, Photos.class);
} | java | public Photos getPhotos(String galleryId, EnumSet<JinxConstants.PhotoExtras> extras) throws JinxException {
JinxUtils.validateParams(galleryId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.galleries.getPhotos");
params.put("gallery_id", galleryId);
if (!JinxUtils.isNullOrEmpty(extras)) {
params.put("extras", JinxUtils.buildCommaDelimitedList(extras));
}
return jinx.flickrGet(params, Photos.class);
} | [
"public",
"Photos",
"getPhotos",
"(",
"String",
"galleryId",
",",
"EnumSet",
"<",
"JinxConstants",
".",
"PhotoExtras",
">",
"extras",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"galleryId",
")",
";",
"Map",
"<",
"String",
","... | Return the list of photos for a gallery
<br>
This method does not require authentication.
<br>
Note: The Flickr documentation includes a per_page and page argument. However, galleries are limited to
18 photos, and Flickr ignores the page and per_page parameters. Since they are not actually used, Jinx
does not support them.
<br>
@param galleryId Required. The ID of the gallery of photos to return.
@param extras Optional. Extra information to fetch for the primary photo.
@return photos in the gallery.
@throws JinxException if required parameters are null or empty, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.galleries.getPhotos.html">flickr.galleries.getPhotos</a> | [
"Return",
"the",
"list",
"of",
"photos",
"for",
"a",
"gallery",
"<br",
">",
"This",
"method",
"does",
"not",
"require",
"authentication",
".",
"<br",
">",
"Note",
":",
"The",
"Flickr",
"documentation",
"includes",
"a",
"per_page",
"and",
"page",
"argument",
... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GalleriesApi.java#L256-L265 |
ganglia/jmxetric | src/main/java/info/ganglia/jmxetric/CommandLineArgs.java | CommandLineArgs.getTagValue | private String getTagValue(String tag, String[] input, String defaultValue) {
for (String arg : input) {
Matcher matcher = CommandLineArgs.pattern.matcher(arg);
// Get tagname and contents of tag
if (matcher.find()) {
String tagname = matcher.group(1);
if (tag.equals(tagname)) {
return matcher.group(2);
}
}
}
return defaultValue;
} | java | private String getTagValue(String tag, String[] input, String defaultValue) {
for (String arg : input) {
Matcher matcher = CommandLineArgs.pattern.matcher(arg);
// Get tagname and contents of tag
if (matcher.find()) {
String tagname = matcher.group(1);
if (tag.equals(tagname)) {
return matcher.group(2);
}
}
}
return defaultValue;
} | [
"private",
"String",
"getTagValue",
"(",
"String",
"tag",
",",
"String",
"[",
"]",
"input",
",",
"String",
"defaultValue",
")",
"{",
"for",
"(",
"String",
"arg",
":",
"input",
")",
"{",
"Matcher",
"matcher",
"=",
"CommandLineArgs",
".",
"pattern",
".",
"... | /*
Parses the string array, input, looking for a pattern tag=value
@param tag the tag to search for
@param input the array list
@param defaultValue the default value if tag is not found
@return tha value | [
"/",
"*",
"Parses",
"the",
"string",
"array",
"input",
"looking",
"for",
"a",
"pattern",
"tag",
"=",
"value"
] | train | https://github.com/ganglia/jmxetric/blob/0b21edb9bd75e0b2df8370ad1c77a1ea47f502ca/src/main/java/info/ganglia/jmxetric/CommandLineArgs.java#L70-L82 |
VoltDB/voltdb | src/frontend/org/voltdb/sysprocs/AdHocNTBase.java | AdHocNTBase.processExplainDefaultProc | static CompletableFuture<ClientResponse> processExplainDefaultProc(AdHocPlannedStmtBatch planBatch) {
Database db = VoltDB.instance().getCatalogContext().database;
// there better be one statement if this is really SQL
// from a default procedure
assert(planBatch.getPlannedStatementCount() == 1);
AdHocPlannedStatement ahps = planBatch.getPlannedStatement(0);
String sql = new String(ahps.sql, StandardCharsets.UTF_8);
String explain = planBatch.explainStatement(0, db, false);
VoltTable vt = new VoltTable(new VoltTable.ColumnInfo("STATEMENT_NAME", VoltType.STRING),
new VoltTable.ColumnInfo( "SQL_STATEMENT", VoltType.STRING),
new VoltTable.ColumnInfo( "EXECUTION_PLAN", VoltType.STRING));
vt.addRow("sql0", sql, explain);
ClientResponseImpl response =
new ClientResponseImpl(
ClientResponseImpl.SUCCESS,
ClientResponse.UNINITIALIZED_APP_STATUS_CODE,
null,
new VoltTable[] { vt },
null);
CompletableFuture<ClientResponse> fut = new CompletableFuture<>();
fut.complete(response);
return fut;
} | java | static CompletableFuture<ClientResponse> processExplainDefaultProc(AdHocPlannedStmtBatch planBatch) {
Database db = VoltDB.instance().getCatalogContext().database;
// there better be one statement if this is really SQL
// from a default procedure
assert(planBatch.getPlannedStatementCount() == 1);
AdHocPlannedStatement ahps = planBatch.getPlannedStatement(0);
String sql = new String(ahps.sql, StandardCharsets.UTF_8);
String explain = planBatch.explainStatement(0, db, false);
VoltTable vt = new VoltTable(new VoltTable.ColumnInfo("STATEMENT_NAME", VoltType.STRING),
new VoltTable.ColumnInfo( "SQL_STATEMENT", VoltType.STRING),
new VoltTable.ColumnInfo( "EXECUTION_PLAN", VoltType.STRING));
vt.addRow("sql0", sql, explain);
ClientResponseImpl response =
new ClientResponseImpl(
ClientResponseImpl.SUCCESS,
ClientResponse.UNINITIALIZED_APP_STATUS_CODE,
null,
new VoltTable[] { vt },
null);
CompletableFuture<ClientResponse> fut = new CompletableFuture<>();
fut.complete(response);
return fut;
} | [
"static",
"CompletableFuture",
"<",
"ClientResponse",
">",
"processExplainDefaultProc",
"(",
"AdHocPlannedStmtBatch",
"planBatch",
")",
"{",
"Database",
"db",
"=",
"VoltDB",
".",
"instance",
"(",
")",
".",
"getCatalogContext",
"(",
")",
".",
"database",
";",
"// t... | Explain Proc for a default proc is routed through the regular Explain
path using ad hoc planning and all. Take the result from that async
process and format it like other explains for procedures. | [
"Explain",
"Proc",
"for",
"a",
"default",
"proc",
"is",
"routed",
"through",
"the",
"regular",
"Explain",
"path",
"using",
"ad",
"hoc",
"planning",
"and",
"all",
".",
"Take",
"the",
"result",
"from",
"that",
"async",
"process",
"and",
"format",
"it",
"like... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/AdHocNTBase.java#L414-L440 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.node2String | public static String node2String(final Node node) throws UnsupportedEncodingException
{
return node2String(node, true, Constants.DEFAULT_XML_CHARSET);
} | java | public static String node2String(final Node node) throws UnsupportedEncodingException
{
return node2String(node, true, Constants.DEFAULT_XML_CHARSET);
} | [
"public",
"static",
"String",
"node2String",
"(",
"final",
"Node",
"node",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"node2String",
"(",
"node",
",",
"true",
",",
"Constants",
".",
"DEFAULT_XML_CHARSET",
")",
";",
"}"
] | Converts XML node in pretty mode using UTF-8 encoding to string.
@param node XML document or element
@return XML string
@throws Exception if some error occurs | [
"Converts",
"XML",
"node",
"in",
"pretty",
"mode",
"using",
"UTF",
"-",
"8",
"encoding",
"to",
"string",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L444-L447 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/converter/json/ObjectToJsonConverter.java | ObjectToJsonConverter.setInnerValue | public Object setInnerValue(Object pOuterObject, Object pNewValue, List<String> pPathParts)
throws AttributeNotFoundException, IllegalAccessException, InvocationTargetException {
String lastPathElement = pPathParts.remove(pPathParts.size()-1);
Stack<String> extraStack = EscapeUtil.reversePath(pPathParts);
// Get the object pointed to do with path-1
// We are using no limits here, since a path must have been given (see above), and hence we should
// be save anyway.
Object inner = extractObjectWithContext(pOuterObject, extraStack, JsonConvertOptions.DEFAULT, false);
// Set the attribute pointed to by the path elements
// (depending of the parent object's type)
return setObjectValue(inner, lastPathElement, pNewValue);
} | java | public Object setInnerValue(Object pOuterObject, Object pNewValue, List<String> pPathParts)
throws AttributeNotFoundException, IllegalAccessException, InvocationTargetException {
String lastPathElement = pPathParts.remove(pPathParts.size()-1);
Stack<String> extraStack = EscapeUtil.reversePath(pPathParts);
// Get the object pointed to do with path-1
// We are using no limits here, since a path must have been given (see above), and hence we should
// be save anyway.
Object inner = extractObjectWithContext(pOuterObject, extraStack, JsonConvertOptions.DEFAULT, false);
// Set the attribute pointed to by the path elements
// (depending of the parent object's type)
return setObjectValue(inner, lastPathElement, pNewValue);
} | [
"public",
"Object",
"setInnerValue",
"(",
"Object",
"pOuterObject",
",",
"Object",
"pNewValue",
",",
"List",
"<",
"String",
">",
"pPathParts",
")",
"throws",
"AttributeNotFoundException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"String",
... | Set an inner value of a complex object. A given path must point to the attribute/index to set within the outer object.
@param pOuterObject the object to dive in
@param pNewValue the value to set
@param pPathParts the path within the outer object. This object will be modified and be a modifiable list.
@return the old value
@throws AttributeNotFoundException
@throws IllegalAccessException
@throws InvocationTargetException | [
"Set",
"an",
"inner",
"value",
"of",
"a",
"complex",
"object",
".",
"A",
"given",
"path",
"must",
"point",
"to",
"the",
"attribute",
"/",
"index",
"to",
"set",
"within",
"the",
"outer",
"object",
"."
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/ObjectToJsonConverter.java#L127-L140 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/DatabaseSpec.java | DatabaseSpec.truncateTableInMongo | @Given("^I drop every document at a MongoDB database '(.+?)' and table '(.+?)'")
public void truncateTableInMongo(String database, String table) {
commonspec.getMongoDBClient().connectToMongoDBDataBase(database);
commonspec.getMongoDBClient().dropAllDataMongoDBCollection(table);
} | java | @Given("^I drop every document at a MongoDB database '(.+?)' and table '(.+?)'")
public void truncateTableInMongo(String database, String table) {
commonspec.getMongoDBClient().connectToMongoDBDataBase(database);
commonspec.getMongoDBClient().dropAllDataMongoDBCollection(table);
} | [
"@",
"Given",
"(",
"\"^I drop every document at a MongoDB database '(.+?)' and table '(.+?)'\"",
")",
"public",
"void",
"truncateTableInMongo",
"(",
"String",
"database",
",",
"String",
"table",
")",
"{",
"commonspec",
".",
"getMongoDBClient",
"(",
")",
".",
"connectToMon... | Truncate table in MongoDB.
@param database Mongo database
@param table Mongo table | [
"Truncate",
"table",
"in",
"MongoDB",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L325-L329 |
ttddyy/datasource-proxy | src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java | ProxyDataSourceBuilder.autoRetrieveGeneratedKeys | public ProxyDataSourceBuilder autoRetrieveGeneratedKeys(boolean autoClose, ResultSetProxyLogicFactory factory) {
this.autoRetrieveGeneratedKeys = true;
this.autoCloseGeneratedKeys = autoClose;
this.generatedKeysProxyLogicFactory = factory;
return this;
} | java | public ProxyDataSourceBuilder autoRetrieveGeneratedKeys(boolean autoClose, ResultSetProxyLogicFactory factory) {
this.autoRetrieveGeneratedKeys = true;
this.autoCloseGeneratedKeys = autoClose;
this.generatedKeysProxyLogicFactory = factory;
return this;
} | [
"public",
"ProxyDataSourceBuilder",
"autoRetrieveGeneratedKeys",
"(",
"boolean",
"autoClose",
",",
"ResultSetProxyLogicFactory",
"factory",
")",
"{",
"this",
".",
"autoRetrieveGeneratedKeys",
"=",
"true",
";",
"this",
".",
"autoCloseGeneratedKeys",
"=",
"autoClose",
";",
... | Enable auto retrieval of generated keys with proxy created by specified factory.
See detail on {@link #autoRetrieveGeneratedKeys(boolean)}.
@param autoClose set {@code true} to close the generated-keys {@link java.sql.ResultSet} after query listener execution
@param factory a factory to create a generated-keys proxy
@return builder
@since 1.4.5 | [
"Enable",
"auto",
"retrieval",
"of",
"generated",
"keys",
"with",
"proxy",
"created",
"by",
"specified",
"factory",
"."
] | train | https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L769-L774 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/AppEventsLogger.java | AppEventsLogger.newLogger | public static AppEventsLogger newLogger(Context context, Session session) {
return new AppEventsLogger(context, null, session);
} | java | public static AppEventsLogger newLogger(Context context, Session session) {
return new AppEventsLogger(context, null, session);
} | [
"public",
"static",
"AppEventsLogger",
"newLogger",
"(",
"Context",
"context",
",",
"Session",
"session",
")",
"{",
"return",
"new",
"AppEventsLogger",
"(",
"context",
",",
"null",
",",
"session",
")",
";",
"}"
] | Build an AppEventsLogger instance to log events through.
@param context Used to access the attributionId for non-authenticated users.
@param session Explicitly specified Session to log events against. If null, the activeSession
will be used if it's open, otherwise the logging will happen against the default
app ID specified via the app ID specified in the package metadata.
@return AppEventsLogger instance to invoke log* methods on. | [
"Build",
"an",
"AppEventsLogger",
"instance",
"to",
"log",
"events",
"through",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/AppEventsLogger.java#L356-L358 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/PipelineApi.java | PipelineApi.createPipeline | public Pipeline createPipeline(Object projectIdOrPath, String ref) throws GitLabApiException {
return (createPipeline(projectIdOrPath, ref, null));
} | java | public Pipeline createPipeline(Object projectIdOrPath, String ref) throws GitLabApiException {
return (createPipeline(projectIdOrPath, ref, null));
} | [
"public",
"Pipeline",
"createPipeline",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"ref",
")",
"throws",
"GitLabApiException",
"{",
"return",
"(",
"createPipeline",
"(",
"projectIdOrPath",
",",
"ref",
",",
"null",
")",
")",
";",
"}"
] | Create a pipelines in a project.
<pre><code>GitLab Endpoint: POST /projects/:id/pipeline</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param ref reference to commit
@return a Pipeline instance with the newly created pipeline info
@throws GitLabApiException if any exception occurs during execution | [
"Create",
"a",
"pipelines",
"in",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PipelineApi.java#L228-L230 |
lessthanoptimal/BoofCV | examples/src/main/java/boofcv/examples/features/ExampleTemplateMatching.java | ExampleTemplateMatching.showMatchIntensity | public static void showMatchIntensity(GrayF32 image, GrayF32 template, GrayF32 mask) {
// create algorithm for computing intensity image
TemplateMatchingIntensity<GrayF32> matchIntensity =
FactoryTemplateMatching.createIntensity(TemplateScoreType.SUM_DIFF_SQ, GrayF32.class);
// apply the template to the image
matchIntensity.setInputImage(image);
matchIntensity.process(template, mask);
// get the results
GrayF32 intensity = matchIntensity.getIntensity();
// adjust the intensity image so that white indicates a good match and black a poor match
// the scale is kept linear to highlight how ambiguous the solution is
float min = ImageStatistics.min(intensity);
float max = ImageStatistics.max(intensity);
float range = max - min;
PixelMath.plus(intensity, -min, intensity);
PixelMath.divide(intensity, range, intensity);
PixelMath.multiply(intensity, 255.0f, intensity);
BufferedImage output = new BufferedImage(image.width, image.height, BufferedImage.TYPE_INT_BGR);
VisualizeImageData.grayMagnitude(intensity, output, -1);
ShowImages.showWindow(output, "Match Intensity", true);
} | java | public static void showMatchIntensity(GrayF32 image, GrayF32 template, GrayF32 mask) {
// create algorithm for computing intensity image
TemplateMatchingIntensity<GrayF32> matchIntensity =
FactoryTemplateMatching.createIntensity(TemplateScoreType.SUM_DIFF_SQ, GrayF32.class);
// apply the template to the image
matchIntensity.setInputImage(image);
matchIntensity.process(template, mask);
// get the results
GrayF32 intensity = matchIntensity.getIntensity();
// adjust the intensity image so that white indicates a good match and black a poor match
// the scale is kept linear to highlight how ambiguous the solution is
float min = ImageStatistics.min(intensity);
float max = ImageStatistics.max(intensity);
float range = max - min;
PixelMath.plus(intensity, -min, intensity);
PixelMath.divide(intensity, range, intensity);
PixelMath.multiply(intensity, 255.0f, intensity);
BufferedImage output = new BufferedImage(image.width, image.height, BufferedImage.TYPE_INT_BGR);
VisualizeImageData.grayMagnitude(intensity, output, -1);
ShowImages.showWindow(output, "Match Intensity", true);
} | [
"public",
"static",
"void",
"showMatchIntensity",
"(",
"GrayF32",
"image",
",",
"GrayF32",
"template",
",",
"GrayF32",
"mask",
")",
"{",
"// create algorithm for computing intensity image",
"TemplateMatchingIntensity",
"<",
"GrayF32",
">",
"matchIntensity",
"=",
"FactoryT... | Computes the template match intensity image and displays the results. Brighter intensity indicates
a better match to the template. | [
"Computes",
"the",
"template",
"match",
"intensity",
"image",
"and",
"displays",
"the",
"results",
".",
"Brighter",
"intensity",
"indicates",
"a",
"better",
"match",
"to",
"the",
"template",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleTemplateMatching.java#L76-L101 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/TargetInfo.java | TargetInfo.getSourceHistories | public SourceHistory[] getSourceHistories(final String basePath) {
final SourceHistory[] histories = new SourceHistory[this.sources.length];
for (int i = 0; i < this.sources.length; i++) {
final String relativeName = CUtil.getRelativePath(basePath, this.sources[i]);
final long lastModified = this.sources[i].lastModified();
histories[i] = new SourceHistory(relativeName, lastModified);
}
return histories;
} | java | public SourceHistory[] getSourceHistories(final String basePath) {
final SourceHistory[] histories = new SourceHistory[this.sources.length];
for (int i = 0; i < this.sources.length; i++) {
final String relativeName = CUtil.getRelativePath(basePath, this.sources[i]);
final long lastModified = this.sources[i].lastModified();
histories[i] = new SourceHistory(relativeName, lastModified);
}
return histories;
} | [
"public",
"SourceHistory",
"[",
"]",
"getSourceHistories",
"(",
"final",
"String",
"basePath",
")",
"{",
"final",
"SourceHistory",
"[",
"]",
"histories",
"=",
"new",
"SourceHistory",
"[",
"this",
".",
"sources",
".",
"length",
"]",
";",
"for",
"(",
"int",
... | Returns an array of SourceHistory objects (contains relative path and
last modified time) for the source[s] of this target | [
"Returns",
"an",
"array",
"of",
"SourceHistory",
"objects",
"(",
"contains",
"relative",
"path",
"and",
"last",
"modified",
"time",
")",
"for",
"the",
"source",
"[",
"s",
"]",
"of",
"this",
"target"
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/TargetInfo.java#L101-L109 |
paypal/SeLion | client/src/main/java/com/paypal/selion/platform/html/Table.java | Table.checkCheckboxInCell | public void checkCheckboxInCell(int row, int column) {
String checkboxLocator = getXPathBase() + "tr[" + row + "]/td[" + column + "]/input";
CheckBox cb = new CheckBox(checkboxLocator);
cb.check();
} | java | public void checkCheckboxInCell(int row, int column) {
String checkboxLocator = getXPathBase() + "tr[" + row + "]/td[" + column + "]/input";
CheckBox cb = new CheckBox(checkboxLocator);
cb.check();
} | [
"public",
"void",
"checkCheckboxInCell",
"(",
"int",
"row",
",",
"int",
"column",
")",
"{",
"String",
"checkboxLocator",
"=",
"getXPathBase",
"(",
")",
"+",
"\"tr[\"",
"+",
"row",
"+",
"\"]/td[\"",
"+",
"column",
"+",
"\"]/input\"",
";",
"CheckBox",
"cb",
... | Tick the checkbox in a cell of a table indicated by input row and column indices
@param row
int number of row for cell
@param column
int number of column for cell | [
"Tick",
"the",
"checkbox",
"in",
"a",
"cell",
"of",
"a",
"table",
"indicated",
"by",
"input",
"row",
"and",
"column",
"indices"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/platform/html/Table.java#L310-L314 |
Jasig/uPortal | uPortal-security/uPortal-security-core/src/main/java/org/apereo/portal/security/firewall/RequestParameterPolicyEnforcementFilter.java | RequestParameterPolicyEnforcementFilter.requireNotMultiValued | static void requireNotMultiValued(final Set<String> parametersToCheck, final Map parameterMap) {
for (final String parameterName : parametersToCheck) {
if (parameterMap.containsKey(parameterName)) {
final String[] values = (String[]) parameterMap.get(parameterName);
if (values.length > 1) {
throw new IllegalStateException(
"Parameter ["
+ parameterName
+ "] had multiple values ["
+ Arrays.toString(values)
+ "] but at most one value is allowable.");
}
}
}
} | java | static void requireNotMultiValued(final Set<String> parametersToCheck, final Map parameterMap) {
for (final String parameterName : parametersToCheck) {
if (parameterMap.containsKey(parameterName)) {
final String[] values = (String[]) parameterMap.get(parameterName);
if (values.length > 1) {
throw new IllegalStateException(
"Parameter ["
+ parameterName
+ "] had multiple values ["
+ Arrays.toString(values)
+ "] but at most one value is allowable.");
}
}
}
} | [
"static",
"void",
"requireNotMultiValued",
"(",
"final",
"Set",
"<",
"String",
">",
"parametersToCheck",
",",
"final",
"Map",
"parameterMap",
")",
"{",
"for",
"(",
"final",
"String",
"parameterName",
":",
"parametersToCheck",
")",
"{",
"if",
"(",
"parameterMap",... | For each parameter to check, verify that it has zero or one value.
<p>The Set of parameters to check MAY be empty. The parameter map MAY NOT contain any given
parameter to check.
<p>This method is an implementation detail and is not exposed API. This method is only
non-private to allow JUnit testing.
<p>Static, stateless method.
@param parametersToCheck non-null potentially empty Set of String names of parameters
@param parameterMap non-null Map from String name of parameter to String[] values
@throws IllegalStateException if a parameterToCheck is present in the parameterMap with
multiple values. | [
"For",
"each",
"parameter",
"to",
"check",
"verify",
"that",
"it",
"has",
"zero",
"or",
"one",
"value",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-core/src/main/java/org/apereo/portal/security/firewall/RequestParameterPolicyEnforcementFilter.java#L434-L449 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java | CPOptionValuePersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPOptionValue cpOptionValue : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpOptionValue);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPOptionValue cpOptionValue : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpOptionValue);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CPOptionValue",
"cpOptionValue",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil"... | Removes all the cp option values where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"cp",
"option",
"values",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java#L1400-L1406 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/RadioButtonGroup.java | RadioButtonGroup.isMatched | public boolean isMatched(String value, Boolean defaultValue)
{
// @todo: there isn't a defaultValue for radio button, what should we do here?
if (value == null)
return false;
if (_match != null)
return value.equals(_match);
if (_defaultRadio != null)
return value.equals(_defaultRadio);
return false;
} | java | public boolean isMatched(String value, Boolean defaultValue)
{
// @todo: there isn't a defaultValue for radio button, what should we do here?
if (value == null)
return false;
if (_match != null)
return value.equals(_match);
if (_defaultRadio != null)
return value.equals(_defaultRadio);
return false;
} | [
"public",
"boolean",
"isMatched",
"(",
"String",
"value",
",",
"Boolean",
"defaultValue",
")",
"{",
"// @todo: there isn't a defaultValue for radio button, what should we do here?",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"_match",
"!... | Does the specified value match one of those we are looking for?
@param value Value to be compared | [
"Does",
"the",
"specified",
"value",
"match",
"one",
"of",
"those",
"we",
"are",
"looking",
"for?"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/RadioButtonGroup.java#L254-L265 |
jkrasnay/sqlbuilder | src/main/java/ca/krasnay/sqlbuilder/Predicates.java | Predicates.anyBitsSet | public static Predicate anyBitsSet(final String expr, final long bits) {
return new Predicate() {
private String param;
public void init(AbstractSqlCreator creator) {
param = creator.allocateParameter();
creator.setParameter(param, bits);
}
public String toSql() {
return String.format("(%s & :%s) > 0", expr, param);
}
};
} | java | public static Predicate anyBitsSet(final String expr, final long bits) {
return new Predicate() {
private String param;
public void init(AbstractSqlCreator creator) {
param = creator.allocateParameter();
creator.setParameter(param, bits);
}
public String toSql() {
return String.format("(%s & :%s) > 0", expr, param);
}
};
} | [
"public",
"static",
"Predicate",
"anyBitsSet",
"(",
"final",
"String",
"expr",
",",
"final",
"long",
"bits",
")",
"{",
"return",
"new",
"Predicate",
"(",
")",
"{",
"private",
"String",
"param",
";",
"public",
"void",
"init",
"(",
"AbstractSqlCreator",
"creat... | Adds a clause that checks whether ANY set bits in a bitmask are present
in a numeric expression.
@param expr
SQL numeric expression to check.
@param bits
Integer containing the bits for which to check. | [
"Adds",
"a",
"clause",
"that",
"checks",
"whether",
"ANY",
"set",
"bits",
"in",
"a",
"bitmask",
"are",
"present",
"in",
"a",
"numeric",
"expression",
"."
] | train | https://github.com/jkrasnay/sqlbuilder/blob/8e6acedc51cfad0527263376af51e1ef052f7147/src/main/java/ca/krasnay/sqlbuilder/Predicates.java#L74-L85 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java | ClusterManagerClient.listClusters | public final ListClustersResponse listClusters(String projectId, String zone) {
ListClustersRequest request =
ListClustersRequest.newBuilder().setProjectId(projectId).setZone(zone).build();
return listClusters(request);
} | java | public final ListClustersResponse listClusters(String projectId, String zone) {
ListClustersRequest request =
ListClustersRequest.newBuilder().setProjectId(projectId).setZone(zone).build();
return listClusters(request);
} | [
"public",
"final",
"ListClustersResponse",
"listClusters",
"(",
"String",
"projectId",
",",
"String",
"zone",
")",
"{",
"ListClustersRequest",
"request",
"=",
"ListClustersRequest",
".",
"newBuilder",
"(",
")",
".",
"setProjectId",
"(",
"projectId",
")",
".",
"set... | Lists all clusters owned by a project in either the specified zone or all zones.
<p>Sample code:
<pre><code>
try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) {
String projectId = "";
String zone = "";
ListClustersResponse response = clusterManagerClient.listClusters(projectId, zone);
}
</code></pre>
@param projectId Deprecated. The Google Developers Console [project ID or project
number](https://support.google.com/cloud/answer/6158840). This field has been deprecated
and replaced by the parent field.
@param zone Deprecated. The name of the Google Compute Engine
[zone](/compute/docs/zones#available) in which the cluster resides, or "-" for all zones.
This field has been deprecated and replaced by the parent field.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Lists",
"all",
"clusters",
"owned",
"by",
"a",
"project",
"in",
"either",
"the",
"specified",
"zone",
"or",
"all",
"zones",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L213-L218 |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java | BoneCPConfig.setConnectionTimeout | public void setConnectionTimeout(long connectionTimeout, TimeUnit timeUnit) {
this.connectionTimeoutInMs = TimeUnit.MILLISECONDS.convert(connectionTimeout, timeUnit);
} | java | public void setConnectionTimeout(long connectionTimeout, TimeUnit timeUnit) {
this.connectionTimeoutInMs = TimeUnit.MILLISECONDS.convert(connectionTimeout, timeUnit);
} | [
"public",
"void",
"setConnectionTimeout",
"(",
"long",
"connectionTimeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"this",
".",
"connectionTimeoutInMs",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"connectionTimeout",
",",
"timeUnit",
")",
";",
"}"
... | Sets the maximum time to wait before a call to getConnection is timed out.
Setting this to zero is similar to setting it to Long.MAX_VALUE
@param connectionTimeout
@param timeUnit the unit of the connectionTimeout argument | [
"Sets",
"the",
"maximum",
"time",
"to",
"wait",
"before",
"a",
"call",
"to",
"getConnection",
"is",
"timed",
"out",
"."
] | train | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/BoneCPConfig.java#L1027-L1029 |
casmi/casmi | src/main/java/casmi/graphics/object/Camera.java | Camera.setOrientation | public void setOrientation(double upX, double upY, double upZ) {
this.upX = upX;
this.upY = upY;
this.upZ = upZ;
} | java | public void setOrientation(double upX, double upY, double upZ) {
this.upX = upX;
this.upY = upY;
this.upZ = upZ;
} | [
"public",
"void",
"setOrientation",
"(",
"double",
"upX",
",",
"double",
"upY",
",",
"double",
"upZ",
")",
"{",
"this",
".",
"upX",
"=",
"upX",
";",
"this",
".",
"upY",
"=",
"upY",
";",
"this",
".",
"upZ",
"=",
"upZ",
";",
"}"
] | Sets which axis is facing upward.
@param upX
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0.
@param upY
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0.
@param upZ
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0. | [
"Sets",
"which",
"axis",
"is",
"facing",
"upward",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/object/Camera.java#L179-L183 |
aws/aws-cloudtrail-processing-library | src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/reader/EventReader.java | EventReader.cleanupMessage | private void cleanupMessage(boolean filterSourceOut, boolean downloadLogsSuccess, boolean processSourceSuccess, CloudTrailSource source) {
if (filterSourceOut) {
deleteMessageAfterProcessSource(ProgressState.deleteFilteredMessage, source);
} else if (processSourceSuccess || sqsManager.shouldDeleteMessageUponFailure(!downloadLogsSuccess)) {
deleteMessageAfterProcessSource(ProgressState.deleteMessage, source);
}
} | java | private void cleanupMessage(boolean filterSourceOut, boolean downloadLogsSuccess, boolean processSourceSuccess, CloudTrailSource source) {
if (filterSourceOut) {
deleteMessageAfterProcessSource(ProgressState.deleteFilteredMessage, source);
} else if (processSourceSuccess || sqsManager.shouldDeleteMessageUponFailure(!downloadLogsSuccess)) {
deleteMessageAfterProcessSource(ProgressState.deleteMessage, source);
}
} | [
"private",
"void",
"cleanupMessage",
"(",
"boolean",
"filterSourceOut",
",",
"boolean",
"downloadLogsSuccess",
",",
"boolean",
"processSourceSuccess",
",",
"CloudTrailSource",
"source",
")",
"{",
"if",
"(",
"filterSourceOut",
")",
"{",
"deleteMessageAfterProcessSource",
... | Clean up the message after CPL finishes the processing.
<p>
<li>If the source is filtered out, the message will be deleted with {@link ProgressState#deleteFilteredMessage}.</li>
<li>If the processing is successful, the message with be deleted with {@link ProgressState#deleteMessage}.</li>
<li>If the processing failed due to downloading logs, the message will not be deleted regardless of
{@link ProcessingConfiguration#isDeleteMessageUponFailure()} value. Otherwise, this property controls the
deletion decision.</li>
</p> | [
"Clean",
"up",
"the",
"message",
"after",
"CPL",
"finishes",
"the",
"processing",
".",
"<p",
">",
"<li",
">",
"If",
"the",
"source",
"is",
"filtered",
"out",
"the",
"message",
"will",
"be",
"deleted",
"with",
"{"
] | train | https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/reader/EventReader.java#L209-L215 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.getRelativeY | public static int getRelativeY(int y, Element target) {
return (y - target.getAbsoluteTop()) + /* target.getScrollTop() +*/target.getOwnerDocument().getScrollTop();
} | java | public static int getRelativeY(int y, Element target) {
return (y - target.getAbsoluteTop()) + /* target.getScrollTop() +*/target.getOwnerDocument().getScrollTop();
} | [
"public",
"static",
"int",
"getRelativeY",
"(",
"int",
"y",
",",
"Element",
"target",
")",
"{",
"return",
"(",
"y",
"-",
"target",
".",
"getAbsoluteTop",
"(",
")",
")",
"+",
"/* target.getScrollTop() +*/",
"target",
".",
"getOwnerDocument",
"(",
")",
".",
... | Gets the vertical position of the given y-coordinate relative to a given element.<p>
@param y the coordinate to use
@param target the element whose coordinate system is to be used
@return the relative vertical position
@see com.google.gwt.event.dom.client.MouseEvent#getRelativeY(com.google.gwt.dom.client.Element) | [
"Gets",
"the",
"vertical",
"position",
"of",
"the",
"given",
"y",
"-",
"coordinate",
"relative",
"to",
"a",
"given",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L1494-L1497 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java | Hierarchy.isMonitorNotify | public static boolean isMonitorNotify(Instruction ins, ConstantPoolGen cpg) {
if (!(ins instanceof InvokeInstruction)) {
return false;
}
if (ins.getOpcode() == Const.INVOKESTATIC) {
return false;
}
InvokeInstruction inv = (InvokeInstruction) ins;
String methodName = inv.getMethodName(cpg);
String methodSig = inv.getSignature(cpg);
return isMonitorNotify(methodName, methodSig);
} | java | public static boolean isMonitorNotify(Instruction ins, ConstantPoolGen cpg) {
if (!(ins instanceof InvokeInstruction)) {
return false;
}
if (ins.getOpcode() == Const.INVOKESTATIC) {
return false;
}
InvokeInstruction inv = (InvokeInstruction) ins;
String methodName = inv.getMethodName(cpg);
String methodSig = inv.getSignature(cpg);
return isMonitorNotify(methodName, methodSig);
} | [
"public",
"static",
"boolean",
"isMonitorNotify",
"(",
"Instruction",
"ins",
",",
"ConstantPoolGen",
"cpg",
")",
"{",
"if",
"(",
"!",
"(",
"ins",
"instanceof",
"InvokeInstruction",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"ins",
".",
"getOpco... | Determine if given Instruction is a monitor wait.
@param ins
the Instruction
@param cpg
the ConstantPoolGen for the Instruction
@return true if the instruction is a monitor wait, false if not | [
"Determine",
"if",
"given",
"Instruction",
"is",
"a",
"monitor",
"wait",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L204-L217 |
js-lib-com/commons | src/main/java/js/util/Params.java | Params.GT | public static void GT(char parameter, char expected, String name) throws IllegalArgumentException {
if (parameter <= expected) {
throw new IllegalArgumentException(String.format("%s is not greater than %c.", name, expected));
}
} | java | public static void GT(char parameter, char expected, String name) throws IllegalArgumentException {
if (parameter <= expected) {
throw new IllegalArgumentException(String.format("%s is not greater than %c.", name, expected));
}
} | [
"public",
"static",
"void",
"GT",
"(",
"char",
"parameter",
",",
"char",
"expected",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"<=",
"expected",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"St... | Test if character parameter is strictly greater than given character value.
@param parameter invocation character parameter,
@param expected expected character value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not greater than threshold character. | [
"Test",
"if",
"character",
"parameter",
"is",
"strictly",
"greater",
"than",
"given",
"character",
"value",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L373-L377 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java | RotatableBondsCountDescriptor.isAmide | private boolean isAmide(IAtom atom0, IAtom atom1, IAtomContainer ac) {
if (atom0.getSymbol().equals("C") && atom1.getSymbol().equals("N")) {
for (IAtom neighbor : ac.getConnectedAtomsList(atom0)) {
if (neighbor.getSymbol().equals("O")
&& ac.getBond(atom0, neighbor).getOrder() == Order.DOUBLE) {
return true;
}
}
}
return false;
} | java | private boolean isAmide(IAtom atom0, IAtom atom1, IAtomContainer ac) {
if (atom0.getSymbol().equals("C") && atom1.getSymbol().equals("N")) {
for (IAtom neighbor : ac.getConnectedAtomsList(atom0)) {
if (neighbor.getSymbol().equals("O")
&& ac.getBond(atom0, neighbor).getOrder() == Order.DOUBLE) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"isAmide",
"(",
"IAtom",
"atom0",
",",
"IAtom",
"atom1",
",",
"IAtomContainer",
"ac",
")",
"{",
"if",
"(",
"atom0",
".",
"getSymbol",
"(",
")",
".",
"equals",
"(",
"\"C\"",
")",
"&&",
"atom1",
".",
"getSymbol",
"(",
")",
".",
"e... | Checks whether both atoms are involved in an amide C-N bond: *N(*)C(*)=O.
Only the most common constitution is considered. Tautomeric, O\C(*)=N\*,
and charged forms, [O-]\C(*)=N\*, are ignored.
@param atom0 the first bonding partner
@param atom1 the second bonding partner
@param ac the parent container
@return if both partners are involved in an amide C-N bond | [
"Checks",
"whether",
"both",
"atoms",
"are",
"involved",
"in",
"an",
"amide",
"C",
"-",
"N",
"bond",
":",
"*",
"N",
"(",
"*",
")",
"C",
"(",
"*",
")",
"=",
"O",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/RotatableBondsCountDescriptor.java#L203-L214 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/FileListUtils.java | FileListUtils.listFilesToCopyAtPath | public static List<FileStatus> listFilesToCopyAtPath(FileSystem fs, Path path, PathFilter fileFilter,
boolean includeEmptyDirectories) throws IOException {
return listFilesToCopyAtPath(fs, path, fileFilter, false, includeEmptyDirectories);
} | java | public static List<FileStatus> listFilesToCopyAtPath(FileSystem fs, Path path, PathFilter fileFilter,
boolean includeEmptyDirectories) throws IOException {
return listFilesToCopyAtPath(fs, path, fileFilter, false, includeEmptyDirectories);
} | [
"public",
"static",
"List",
"<",
"FileStatus",
">",
"listFilesToCopyAtPath",
"(",
"FileSystem",
"fs",
",",
"Path",
"path",
",",
"PathFilter",
"fileFilter",
",",
"boolean",
"includeEmptyDirectories",
")",
"throws",
"IOException",
"{",
"return",
"listFilesToCopyAtPath",... | Given a path to copy, list all files rooted at the given path to copy
@param fs the file system of the path
@param path root path to copy
@param fileFilter a filter only applied to root
@param includeEmptyDirectories a control to include empty directories for copy | [
"Given",
"a",
"path",
"to",
"copy",
"list",
"all",
"files",
"rooted",
"at",
"the",
"given",
"path",
"to",
"copy"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/FileListUtils.java#L84-L87 |
windup/windup | forks/jdt/src/main/java/org/eclipse/jdt/internal/compiler/Compiler.java | Compiler.reportProgress | protected void reportProgress(String taskDecription) {
if (this.progress != null) {
if (this.progress.isCanceled()) {
// Only AbortCompilation can stop the compiler cleanly.
// We check cancellation again following the call to compile.
throw new AbortCompilation(true, null);
}
this.progress.setTaskName(taskDecription);
}
} | java | protected void reportProgress(String taskDecription) {
if (this.progress != null) {
if (this.progress.isCanceled()) {
// Only AbortCompilation can stop the compiler cleanly.
// We check cancellation again following the call to compile.
throw new AbortCompilation(true, null);
}
this.progress.setTaskName(taskDecription);
}
} | [
"protected",
"void",
"reportProgress",
"(",
"String",
"taskDecription",
")",
"{",
"if",
"(",
"this",
".",
"progress",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"progress",
".",
"isCanceled",
"(",
")",
")",
"{",
"// Only AbortCompilation can stop the comp... | Checks whether the compilation has been canceled and reports the given progress to the compiler progress. | [
"Checks",
"whether",
"the",
"compilation",
"has",
"been",
"canceled",
"and",
"reports",
"the",
"given",
"progress",
"to",
"the",
"compiler",
"progress",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/forks/jdt/src/main/java/org/eclipse/jdt/internal/compiler/Compiler.java#L414-L423 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsResourceTypeConfig.java | CmsResourceTypeConfig.getFolderPath | public String getFolderPath(CmsObject cms, String pageFolderRootPath) {
checkInitialized();
if (m_folderOrName != null) {
return m_folderOrName.getFolderPath(cms, pageFolderRootPath);
} else {
String siteRoot = null;
if (pageFolderRootPath != null) {
siteRoot = OpenCms.getSiteManager().getSiteRoot(pageFolderRootPath);
}
if (siteRoot == null) {
siteRoot = cms.getRequestContext().getSiteRoot();
}
return CmsStringUtil.joinPaths(siteRoot, CmsADEManager.CONTENT_FOLDER_NAME, m_typeName);
}
} | java | public String getFolderPath(CmsObject cms, String pageFolderRootPath) {
checkInitialized();
if (m_folderOrName != null) {
return m_folderOrName.getFolderPath(cms, pageFolderRootPath);
} else {
String siteRoot = null;
if (pageFolderRootPath != null) {
siteRoot = OpenCms.getSiteManager().getSiteRoot(pageFolderRootPath);
}
if (siteRoot == null) {
siteRoot = cms.getRequestContext().getSiteRoot();
}
return CmsStringUtil.joinPaths(siteRoot, CmsADEManager.CONTENT_FOLDER_NAME, m_typeName);
}
} | [
"public",
"String",
"getFolderPath",
"(",
"CmsObject",
"cms",
",",
"String",
"pageFolderRootPath",
")",
"{",
"checkInitialized",
"(",
")",
";",
"if",
"(",
"m_folderOrName",
"!=",
"null",
")",
"{",
"return",
"m_folderOrName",
".",
"getFolderPath",
"(",
"cms",
"... | Computes the folder path for this resource type.<p>
@param cms the cms context to use
@param pageFolderRootPath root path of the folder containing the current container page
@return the folder root path for this resource type | [
"Computes",
"the",
"folder",
"path",
"for",
"this",
"resource",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L474-L489 |
structr/structr | structr-ui/src/main/java/org/structr/web/common/FileHelper.java | FileHelper.createFile | public static <T extends File> T createFile(final SecurityContext securityContext, final InputStream fileStream, final String contentType, final Class<T> fileType, final String name, final Folder parentFolder)
throws FrameworkException, IOException {
final PropertyMap props = new PropertyMap();
props.put(StructrApp.key(AbstractFile.class, "name"), name);
props.put(StructrApp.key(File.class, "contentType"), contentType);
if (parentFolder != null) {
props.put(StructrApp.key(File.class, "hasParent"), true);
props.put(StructrApp.key(File.class, "parent"), parentFolder);
}
return createFile(securityContext, fileStream, fileType, props);
} | java | public static <T extends File> T createFile(final SecurityContext securityContext, final InputStream fileStream, final String contentType, final Class<T> fileType, final String name, final Folder parentFolder)
throws FrameworkException, IOException {
final PropertyMap props = new PropertyMap();
props.put(StructrApp.key(AbstractFile.class, "name"), name);
props.put(StructrApp.key(File.class, "contentType"), contentType);
if (parentFolder != null) {
props.put(StructrApp.key(File.class, "hasParent"), true);
props.put(StructrApp.key(File.class, "parent"), parentFolder);
}
return createFile(securityContext, fileStream, fileType, props);
} | [
"public",
"static",
"<",
"T",
"extends",
"File",
">",
"T",
"createFile",
"(",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"InputStream",
"fileStream",
",",
"final",
"String",
"contentType",
",",
"final",
"Class",
"<",
"T",
">",
"fileType",
","... | Create a new file node from the given input stream and sets the parentFolder
@param <T>
@param securityContext
@param fileStream
@param contentType
@param fileType defaults to File.class if null
@param name
@param parentFolder
@return file
@throws FrameworkException
@throws IOException | [
"Create",
"a",
"new",
"file",
"node",
"from",
"the",
"given",
"input",
"stream",
"and",
"sets",
"the",
"parentFolder"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L152-L168 |
Netflix/astyanax | astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeColumnEntityMapper.java | CompositeColumnEntityMapper.fillMutationBatch | public void fillMutationBatch(ColumnListMutation<ByteBuffer> clm, Object entity) throws IllegalArgumentException, IllegalAccessException {
List<?> list = (List<?>) containerField.get(entity);
if (list != null) {
for (Object element : list) {
fillColumnMutation(clm, element);
}
}
} | java | public void fillMutationBatch(ColumnListMutation<ByteBuffer> clm, Object entity) throws IllegalArgumentException, IllegalAccessException {
List<?> list = (List<?>) containerField.get(entity);
if (list != null) {
for (Object element : list) {
fillColumnMutation(clm, element);
}
}
} | [
"public",
"void",
"fillMutationBatch",
"(",
"ColumnListMutation",
"<",
"ByteBuffer",
">",
"clm",
",",
"Object",
"entity",
")",
"throws",
"IllegalArgumentException",
",",
"IllegalAccessException",
"{",
"List",
"<",
"?",
">",
"list",
"=",
"(",
"List",
"<",
"?",
... | Iterate through the list and create a column for each element
@param clm
@param entity
@throws IllegalArgumentException
@throws IllegalAccessException | [
"Iterate",
"through",
"the",
"list",
"and",
"create",
"a",
"column",
"for",
"each",
"element"
] | train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeColumnEntityMapper.java#L111-L118 |
elki-project/elki | addons/3dpc/src/main/java/de/lmu/ifi/dbs/elki/visualization/parallel3d/util/Simple1DOFCamera.java | Simple1DOFCamera.squaredDistanceFromCamera | public double squaredDistanceFromCamera(double x, double y) {
double dx = (distance * sinZ) - x;
double dy = (distance * -cosZ) - y;
return dx * dx + dy * dy;
} | java | public double squaredDistanceFromCamera(double x, double y) {
double dx = (distance * sinZ) - x;
double dy = (distance * -cosZ) - y;
return dx * dx + dy * dy;
} | [
"public",
"double",
"squaredDistanceFromCamera",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"double",
"dx",
"=",
"(",
"distance",
"*",
"sinZ",
")",
"-",
"x",
";",
"double",
"dy",
"=",
"(",
"distance",
"*",
"-",
"cosZ",
")",
"-",
"y",
";",
"r... | Distance from camera
@param x X position
@param y Y position
@return Squared distance | [
"Distance",
"from",
"camera"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/3dpc/src/main/java/de/lmu/ifi/dbs/elki/visualization/parallel3d/util/Simple1DOFCamera.java#L291-L295 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java | LiveEventsInner.beginStop | public void beginStop(String resourceGroupName, String accountName, String liveEventName, Boolean removeOutputsOnStop) {
beginStopWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, removeOutputsOnStop).toBlocking().single().body();
} | java | public void beginStop(String resourceGroupName, String accountName, String liveEventName, Boolean removeOutputsOnStop) {
beginStopWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, removeOutputsOnStop).toBlocking().single().body();
} | [
"public",
"void",
"beginStop",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
",",
"Boolean",
"removeOutputsOnStop",
")",
"{",
"beginStopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"liv... | Stop Live Event.
Stops an existing Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@param removeOutputsOnStop The flag indicates if remove LiveOutputs on Stop.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Stop",
"Live",
"Event",
".",
"Stops",
"an",
"existing",
"Live",
"Event",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L1553-L1555 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitIdentity.java | WeightInitIdentity.setIdentityConv | private INDArray setIdentityConv(long[] shape, char order, INDArray paramView) {
final INDArrayIndex[] indArrayIndices = new INDArrayIndex[shape.length];
for(int i = 2; i < shape.length; i++) {
if(shape[i] % 2 == 0) {
throw new IllegalStateException("Cannot use IDENTITY init with parameters of shape "
+ Arrays.toString(shape) + "! Must have odd sized kernels!");
}
indArrayIndices[i] = NDArrayIndex.point(shape[i] / 2);
}
paramView.assign(Nd4j.zeros(paramView.shape()));
final INDArray params =paramView.reshape(order, shape);
for (int i = 0; i < shape[0]; i++) {
indArrayIndices[0] = NDArrayIndex.point(i);
indArrayIndices[1] = NDArrayIndex.point(i);
params.put(indArrayIndices, Nd4j.ones(1));
}
return params;
} | java | private INDArray setIdentityConv(long[] shape, char order, INDArray paramView) {
final INDArrayIndex[] indArrayIndices = new INDArrayIndex[shape.length];
for(int i = 2; i < shape.length; i++) {
if(shape[i] % 2 == 0) {
throw new IllegalStateException("Cannot use IDENTITY init with parameters of shape "
+ Arrays.toString(shape) + "! Must have odd sized kernels!");
}
indArrayIndices[i] = NDArrayIndex.point(shape[i] / 2);
}
paramView.assign(Nd4j.zeros(paramView.shape()));
final INDArray params =paramView.reshape(order, shape);
for (int i = 0; i < shape[0]; i++) {
indArrayIndices[0] = NDArrayIndex.point(i);
indArrayIndices[1] = NDArrayIndex.point(i);
params.put(indArrayIndices, Nd4j.ones(1));
}
return params;
} | [
"private",
"INDArray",
"setIdentityConv",
"(",
"long",
"[",
"]",
"shape",
",",
"char",
"order",
",",
"INDArray",
"paramView",
")",
"{",
"final",
"INDArrayIndex",
"[",
"]",
"indArrayIndices",
"=",
"new",
"INDArrayIndex",
"[",
"shape",
".",
"length",
"]",
";",... | Set identity mapping for convolution layers. When viewed as an NxM matrix of kernel tensors,
identity mapping is when parameters is a diagonal matrix of identity kernels.
@param shape Shape of parameters
@param order Order of parameters
@param paramView View of parameters
@return A reshaped view of paramView which results in identity mapping when used in convolution layers | [
"Set",
"identity",
"mapping",
"for",
"convolution",
"layers",
".",
"When",
"viewed",
"as",
"an",
"NxM",
"matrix",
"of",
"kernel",
"tensors",
"identity",
"mapping",
"is",
"when",
"parameters",
"is",
"a",
"diagonal",
"matrix",
"of",
"identity",
"kernels",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitIdentity.java#L59-L77 |
JM-Lab/utils-java9 | src/main/java/kr/jm/utils/helper/JMJson.java | JMJson.toJsonFile | public static <D> File toJsonFile(D dataObject, File returnJsonFile) {
try {
jsonMapper.writeValue(returnJsonFile, dataObject);
return returnJsonFile;
} catch (Exception e) {
return JMExceptionManager.handleExceptionAndReturnNull(log, e,
"toJsonFile", dataObject);
}
} | java | public static <D> File toJsonFile(D dataObject, File returnJsonFile) {
try {
jsonMapper.writeValue(returnJsonFile, dataObject);
return returnJsonFile;
} catch (Exception e) {
return JMExceptionManager.handleExceptionAndReturnNull(log, e,
"toJsonFile", dataObject);
}
} | [
"public",
"static",
"<",
"D",
">",
"File",
"toJsonFile",
"(",
"D",
"dataObject",
",",
"File",
"returnJsonFile",
")",
"{",
"try",
"{",
"jsonMapper",
".",
"writeValue",
"(",
"returnJsonFile",
",",
"dataObject",
")",
";",
"return",
"returnJsonFile",
";",
"}",
... | To json file file.
@param <D> the type parameter
@param dataObject the data object
@param returnJsonFile the return json file
@return the file | [
"To",
"json",
"file",
"file",
"."
] | train | https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L105-L113 |
VoltDB/voltdb | third_party/java/src/org/apache/commons_voltpatches/cli/Options.java | Options.addOption | public Options addOption(String opt, String longOpt, boolean hasArg, String description)
{
addOption(new Option(opt, longOpt, hasArg, description));
return this;
} | java | public Options addOption(String opt, String longOpt, boolean hasArg, String description)
{
addOption(new Option(opt, longOpt, hasArg, description));
return this;
} | [
"public",
"Options",
"addOption",
"(",
"String",
"opt",
",",
"String",
"longOpt",
",",
"boolean",
"hasArg",
",",
"String",
"description",
")",
"{",
"addOption",
"(",
"new",
"Option",
"(",
"opt",
",",
"longOpt",
",",
"hasArg",
",",
"description",
")",
")",
... | Add an option that contains a short-name and a long-name.
It may be specified as requiring an argument.
@param opt Short single-character name of the option.
@param longOpt Long multi-character name of the option.
@param hasArg flag signally if an argument is required after this option
@param description Self-documenting description
@return the resulting Options instance | [
"Add",
"an",
"option",
"that",
"contains",
"a",
"short",
"-",
"name",
"and",
"a",
"long",
"-",
"name",
".",
"It",
"may",
"be",
"specified",
"as",
"requiring",
"an",
"argument",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/Options.java#L140-L144 |
DDTH/ddth-kafka | src/main/java/com/github/ddth/kafka/KafkaClient.java | KafkaClient.commmit | public boolean commmit(KafkaMessage msg, String groupId) {
KafkaMsgConsumer kafkaConsumer = cacheConsumers.get(groupId);
return kafkaConsumer != null ? kafkaConsumer.commit(msg) : false;
} | java | public boolean commmit(KafkaMessage msg, String groupId) {
KafkaMsgConsumer kafkaConsumer = cacheConsumers.get(groupId);
return kafkaConsumer != null ? kafkaConsumer.commit(msg) : false;
} | [
"public",
"boolean",
"commmit",
"(",
"KafkaMessage",
"msg",
",",
"String",
"groupId",
")",
"{",
"KafkaMsgConsumer",
"kafkaConsumer",
"=",
"cacheConsumers",
".",
"get",
"(",
"groupId",
")",
";",
"return",
"kafkaConsumer",
"!=",
"null",
"?",
"kafkaConsumer",
".",
... | Commit the specified offsets for the last consumed message.
@param msg
@param groupId
@return {@code true} if the topic is in subscription list, {@code false}
otherwise
@since 1.3.2 | [
"Commit",
"the",
"specified",
"offsets",
"for",
"the",
"last",
"consumed",
"message",
"."
] | train | https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/KafkaClient.java#L566-L569 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasClassAdapter.java | AbstractRasClassAdapter.visit | @Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
this.classVersion = version;
this.classType = Type.getObjectType(name);
this.isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
this.isSynthetic = (access & Opcodes.ACC_SYNTHETIC) != 0;
super.visit(version, access, name, signature, superName, interfaces);
} | java | @Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
this.classVersion = version;
this.classType = Type.getObjectType(name);
this.isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
this.isSynthetic = (access & Opcodes.ACC_SYNTHETIC) != 0;
super.visit(version, access, name, signature, superName, interfaces);
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"int",
"version",
",",
"int",
"access",
",",
"String",
"name",
",",
"String",
"signature",
",",
"String",
"superName",
",",
"String",
"[",
"]",
"interfaces",
")",
"{",
"this",
".",
"classVersion",
"=",
"ve... | Begin processing a class. We save some of the header information that
we only get from the header to assist with processing. | [
"Begin",
"processing",
"a",
"class",
".",
"We",
"save",
"some",
"of",
"the",
"header",
"information",
"that",
"we",
"only",
"get",
"from",
"the",
"header",
"to",
"assist",
"with",
"processing",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasClassAdapter.java#L135-L143 |
bekkopen/NoCommons | src/main/java/no/bekk/bekkopen/person/FodselsnummerValidator.java | FodselsnummerValidator.isValid | public boolean isValid(String fodselsnummer, ConstraintValidatorContext constraintValidatorContext) {
if(fodselsnummer == null){
return true;
}
return isValid(fodselsnummer);
} | java | public boolean isValid(String fodselsnummer, ConstraintValidatorContext constraintValidatorContext) {
if(fodselsnummer == null){
return true;
}
return isValid(fodselsnummer);
} | [
"public",
"boolean",
"isValid",
"(",
"String",
"fodselsnummer",
",",
"ConstraintValidatorContext",
"constraintValidatorContext",
")",
"{",
"if",
"(",
"fodselsnummer",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"return",
"isValid",
"(",
"fodselsnummer",
")... | Validation method used by a JSR303 validator. Normally it is better to call the static methods directly.
@param fodselsnummer
The fodselsnummer to be validated
@param constraintValidatorContext
context sent in by a validator
@return boolean
whether or not the given fodselsnummer is valid | [
"Validation",
"method",
"used",
"by",
"a",
"JSR303",
"validator",
".",
"Normally",
"it",
"is",
"better",
"to",
"call",
"the",
"static",
"methods",
"directly",
"."
] | train | https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/person/FodselsnummerValidator.java#L122-L128 |
livetribe/livetribe-slp | osgi/bundle/src/main/java/org/livetribe/slp/osgi/ByServicePropertiesServiceTracker.java | ByServicePropertiesServiceTracker.modifiedService | @Override
public void modifiedService(ServiceReference reference, Object service)
{
LOGGER.entering(CLASS_NAME, "modifiedService", new Object[]{reference, service});
ServiceInfo serviceInfo = (ServiceInfo)service;
serviceAgent.deregister(serviceInfo.getServiceURL(), serviceInfo.getLanguage());
serviceInfo = generateServiceInfo(reference);
serviceAgent.register(serviceInfo);
LOGGER.exiting(CLASS_NAME, "modifiedService");
} | java | @Override
public void modifiedService(ServiceReference reference, Object service)
{
LOGGER.entering(CLASS_NAME, "modifiedService", new Object[]{reference, service});
ServiceInfo serviceInfo = (ServiceInfo)service;
serviceAgent.deregister(serviceInfo.getServiceURL(), serviceInfo.getLanguage());
serviceInfo = generateServiceInfo(reference);
serviceAgent.register(serviceInfo);
LOGGER.exiting(CLASS_NAME, "modifiedService");
} | [
"@",
"Override",
"public",
"void",
"modifiedService",
"(",
"ServiceReference",
"reference",
",",
"Object",
"service",
")",
"{",
"LOGGER",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"modifiedService\"",
",",
"new",
"Object",
"[",
"]",
"{",
"reference",
",",
"se... | Deregister the instance of {@link ServiceInfo} from the {@link ServiceAgent},
effectively unregistering the SLP service URL, and reregister a new
{@link ServiceInfo} which was created from the modified OSGi service
reference's properties.
@param reference The reference to the OSGi service that implicitly registered the SLP service URL.
@param service The instance of {@link ServiceInfo} to deregister.
@see org.osgi.util.tracker.ServiceTracker#removedService(ServiceReference, Object)
@see org.livetribe.slp.sa.ServiceAgent#deregister(org.livetribe.slp.ServiceURL, String)
@see org.livetribe.slp.sa.ServiceAgent#register(org.livetribe.slp.ServiceInfo) | [
"Deregister",
"the",
"instance",
"of",
"{",
"@link",
"ServiceInfo",
"}",
"from",
"the",
"{",
"@link",
"ServiceAgent",
"}",
"effectively",
"unregistering",
"the",
"SLP",
"service",
"URL",
"and",
"reregister",
"a",
"new",
"{",
"@link",
"ServiceInfo",
"}",
"which... | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/osgi/bundle/src/main/java/org/livetribe/slp/osgi/ByServicePropertiesServiceTracker.java#L181-L193 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/TransformationsInner.java | TransformationsInner.createOrReplace | public TransformationInner createOrReplace(String resourceGroupName, String jobName, String transformationName, TransformationInner transformation) {
return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, transformationName, transformation).toBlocking().single().body();
} | java | public TransformationInner createOrReplace(String resourceGroupName, String jobName, String transformationName, TransformationInner transformation) {
return createOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, transformationName, transformation).toBlocking().single().body();
} | [
"public",
"TransformationInner",
"createOrReplace",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"transformationName",
",",
"TransformationInner",
"transformation",
")",
"{",
"return",
"createOrReplaceWithServiceResponseAsync",
"(",
"resourceGr... | Creates a transformation or replaces an already existing transformation under an existing streaming job.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@param transformationName The name of the transformation.
@param transformation The definition of the transformation that will be used to create a new transformation or replace the existing one under the streaming job.
@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 TransformationInner object if successful. | [
"Creates",
"a",
"transformation",
"or",
"replaces",
"an",
"already",
"existing",
"transformation",
"under",
"an",
"existing",
"streaming",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/TransformationsInner.java#L87-L89 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java | ASegment.getPairPunctuationText | protected String getPairPunctuationText( int c ) throws IOException
{
//StringBuilder isb = new StringBuilder();
isb.clear();
char echar = StringUtil.getPunctuationPair( (char) c);
boolean matched = false;
int j, ch;
//replaced with IntArrayList at 2013-09-08
//ArrayList<Integer> chArr = new ArrayList<Integer>(config.PPT_MAX_LENGTH);
ialist.clear();
for ( j = 0; j < config.PPT_MAX_LENGTH; j++ ) {
ch = readNext();
if ( ch == -1 ) break;
if ( ch == echar ) {
matched = true;
pushBack(ch); //push the pair punc back.
break;
}
isb.append( (char) ch );
ialist.add(ch);
}
if ( matched == false ) {
for ( int i = j - 1; i >= 0; i-- )
pushBack( ialist.get(i) );
return null;
}
return isb.toString();
}
/**
* an abstract method to gain a CJK word from the
* current position. simpleSeg and ComplexSeg is different to deal this,
* so make it a abstract method here
*
* @param chars
* @param index
* @return IChunk
* @throws IOException
*/
protected abstract IChunk getBestCJKChunk(char chars[], int index) throws IOException;
} | java | protected String getPairPunctuationText( int c ) throws IOException
{
//StringBuilder isb = new StringBuilder();
isb.clear();
char echar = StringUtil.getPunctuationPair( (char) c);
boolean matched = false;
int j, ch;
//replaced with IntArrayList at 2013-09-08
//ArrayList<Integer> chArr = new ArrayList<Integer>(config.PPT_MAX_LENGTH);
ialist.clear();
for ( j = 0; j < config.PPT_MAX_LENGTH; j++ ) {
ch = readNext();
if ( ch == -1 ) break;
if ( ch == echar ) {
matched = true;
pushBack(ch); //push the pair punc back.
break;
}
isb.append( (char) ch );
ialist.add(ch);
}
if ( matched == false ) {
for ( int i = j - 1; i >= 0; i-- )
pushBack( ialist.get(i) );
return null;
}
return isb.toString();
}
/**
* an abstract method to gain a CJK word from the
* current position. simpleSeg and ComplexSeg is different to deal this,
* so make it a abstract method here
*
* @param chars
* @param index
* @return IChunk
* @throws IOException
*/
protected abstract IChunk getBestCJKChunk(char chars[], int index) throws IOException;
} | [
"protected",
"String",
"getPairPunctuationText",
"(",
"int",
"c",
")",
"throws",
"IOException",
"{",
"//StringBuilder isb = new StringBuilder();",
"isb",
".",
"clear",
"(",
")",
";",
"char",
"echar",
"=",
"StringUtil",
".",
"getPunctuationPair",
"(",
"(",
"char",
... | find pair punctuation of the given punctuation char
the purpose is to get the text between them
@param c
@throws IOException | [
"find",
"pair",
"punctuation",
"of",
"the",
"given",
"punctuation",
"char",
"the",
"purpose",
"is",
"to",
"get",
"the",
"text",
"between",
"them"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java#L1607-L1653 |
khmarbaise/sapm | src/main/java/com/soebes/subversion/sapm/AccessRule.java | AccessRule.getAccess | public AccessLevel getAccess(String user, String repository, String path) {
AccessLevel result = AccessLevel.NOTHING;
if (getRepositoryName() == null) {
Path localRepositoryPath = new Path(getRepositoryPath());
if (localRepositoryPath.contains(path)) {
result = getAccessForPrincipal(user);
}
} else {
if (getRepositoryName().equals(repository)) {
Path localRepositoryPath = new Path(getRepositoryPath());
if (localRepositoryPath.contains(path)) {
result = getAccessForPrincipal(user);
}
}
}
return result;
} | java | public AccessLevel getAccess(String user, String repository, String path) {
AccessLevel result = AccessLevel.NOTHING;
if (getRepositoryName() == null) {
Path localRepositoryPath = new Path(getRepositoryPath());
if (localRepositoryPath.contains(path)) {
result = getAccessForPrincipal(user);
}
} else {
if (getRepositoryName().equals(repository)) {
Path localRepositoryPath = new Path(getRepositoryPath());
if (localRepositoryPath.contains(path)) {
result = getAccessForPrincipal(user);
}
}
}
return result;
} | [
"public",
"AccessLevel",
"getAccess",
"(",
"String",
"user",
",",
"String",
"repository",
",",
"String",
"path",
")",
"{",
"AccessLevel",
"result",
"=",
"AccessLevel",
".",
"NOTHING",
";",
"if",
"(",
"getRepositoryName",
"(",
")",
"==",
"null",
")",
"{",
"... | Get the {@link AccessLevel} for the user who want's to get access to the path
inside the given repository.
@param user The user who will be checked against the permission rules.
@param repository The repository to which the user tries to get access.
@param path The path within the repository.
@return AccessLevel of the user within the given path and repository. | [
"Get",
"the",
"{",
"@link",
"AccessLevel",
"}",
"for",
"the",
"user",
"who",
"want",
"s",
"to",
"get",
"access",
"to",
"the",
"path",
"inside",
"the",
"given",
"repository",
"."
] | train | https://github.com/khmarbaise/sapm/blob/b5da5b0d8929324f03cb3a4233a3534813f93eea/src/main/java/com/soebes/subversion/sapm/AccessRule.java#L203-L220 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java | AbstractManagedType.addPluralAttribute | public void addPluralAttribute(String attributeName, PluralAttribute<X, ?, ?> attribute)
{
if (declaredPluralAttributes == null)
{
declaredPluralAttributes = new HashMap<String, PluralAttribute<X, ?, ?>>();
}
declaredPluralAttributes.put(attributeName, attribute);
onValidateAttributeConstraints((Field) attribute.getJavaMember());
onEmbeddableAttribute((Field) attribute.getJavaMember());
} | java | public void addPluralAttribute(String attributeName, PluralAttribute<X, ?, ?> attribute)
{
if (declaredPluralAttributes == null)
{
declaredPluralAttributes = new HashMap<String, PluralAttribute<X, ?, ?>>();
}
declaredPluralAttributes.put(attributeName, attribute);
onValidateAttributeConstraints((Field) attribute.getJavaMember());
onEmbeddableAttribute((Field) attribute.getJavaMember());
} | [
"public",
"void",
"addPluralAttribute",
"(",
"String",
"attributeName",
",",
"PluralAttribute",
"<",
"X",
",",
"?",
",",
"?",
">",
"attribute",
")",
"{",
"if",
"(",
"declaredPluralAttributes",
"==",
"null",
")",
"{",
"declaredPluralAttributes",
"=",
"new",
"Ha... | Adds the plural attribute.
@param attributeName
the attribute name
@param attribute
the attribute | [
"Adds",
"the",
"plural",
"attribute",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L841-L853 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/support/PropertyChangeSupportUtils.java | PropertyChangeSupportUtils.addPropertyChangeListener | public static void addPropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) {
Assert.notNull(propertyName, "The property name must not be null.");
Assert.notNull(listener, "The listener must not be null.");
if (bean instanceof PropertyChangePublisher) {
((PropertyChangePublisher)bean).addPropertyChangeListener(propertyName, listener);
}
else {
Class beanClass = bean.getClass();
Method namedPCLAdder = getNamedPCLAdder(beanClass);
if (namedPCLAdder == null)
throw new FatalBeanException("Could not find the bean method"
+ "/npublic void addPropertyChangeListener(String, PropertyChangeListener);/nin bean '" + bean
+ "'");
try {
namedPCLAdder.invoke(bean, new Object[] {propertyName, listener});
}
catch (InvocationTargetException e) {
throw new FatalBeanException("Due to an InvocationTargetException we failed to add "
+ "a named PropertyChangeListener to bean '" + bean + "'", e);
}
catch (IllegalAccessException e) {
throw new FatalBeanException("Due to an IllegalAccessException we failed to add "
+ "a named PropertyChangeListener to bean '" + bean + "'", e);
}
}
} | java | public static void addPropertyChangeListener(Object bean, String propertyName, PropertyChangeListener listener) {
Assert.notNull(propertyName, "The property name must not be null.");
Assert.notNull(listener, "The listener must not be null.");
if (bean instanceof PropertyChangePublisher) {
((PropertyChangePublisher)bean).addPropertyChangeListener(propertyName, listener);
}
else {
Class beanClass = bean.getClass();
Method namedPCLAdder = getNamedPCLAdder(beanClass);
if (namedPCLAdder == null)
throw new FatalBeanException("Could not find the bean method"
+ "/npublic void addPropertyChangeListener(String, PropertyChangeListener);/nin bean '" + bean
+ "'");
try {
namedPCLAdder.invoke(bean, new Object[] {propertyName, listener});
}
catch (InvocationTargetException e) {
throw new FatalBeanException("Due to an InvocationTargetException we failed to add "
+ "a named PropertyChangeListener to bean '" + bean + "'", e);
}
catch (IllegalAccessException e) {
throw new FatalBeanException("Due to an IllegalAccessException we failed to add "
+ "a named PropertyChangeListener to bean '" + bean + "'", e);
}
}
} | [
"public",
"static",
"void",
"addPropertyChangeListener",
"(",
"Object",
"bean",
",",
"String",
"propertyName",
",",
"PropertyChangeListener",
"listener",
")",
"{",
"Assert",
".",
"notNull",
"(",
"propertyName",
",",
"\"The property name must not be null.\"",
")",
";",
... | Adds a named property change listener to the given JavaBean. The bean
must provide the optional support for listening on named properties
as described in section 7.4.5 of the
<a href="http://java.sun.com/products/javabeans/docs/spec.html">Java Bean
Specification</a>. The bean class must provide the method:
<pre>
public void addPropertyChangeListener(String, PropertyChangeListener);
</pre>
@param bean the JavaBean to add a property change handler
@param propertyName the name of the property to be observed
@param listener the listener to add
@throws PropertyNotBindableException
if the property change handler cannot be added successfully | [
"Adds",
"a",
"named",
"property",
"change",
"listener",
"to",
"the",
"given",
"JavaBean",
".",
"The",
"bean",
"must",
"provide",
"the",
"optional",
"support",
"for",
"listening",
"on",
"named",
"properties",
"as",
"described",
"in",
"section",
"7",
".",
"4",... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/support/PropertyChangeSupportUtils.java#L77-L102 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Flowable.java | Flowable.subscribeOn | @CheckReturnValue
@BackpressureSupport(BackpressureKind.PASS_THROUGH)
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final Flowable<T> subscribeOn(@NonNull Scheduler scheduler) {
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
return subscribeOn(scheduler, !(this instanceof FlowableCreate));
} | java | @CheckReturnValue
@BackpressureSupport(BackpressureKind.PASS_THROUGH)
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final Flowable<T> subscribeOn(@NonNull Scheduler scheduler) {
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
return subscribeOn(scheduler, !(this instanceof FlowableCreate));
} | [
"@",
"CheckReturnValue",
"@",
"BackpressureSupport",
"(",
"BackpressureKind",
".",
"PASS_THROUGH",
")",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"CUSTOM",
")",
"public",
"final",
"Flowable",
"<",
"T",
">",
"subscribeOn",
"(",
"@",
"NonNull",
"Schedul... | Asynchronously subscribes Subscribers to this Publisher on the specified {@link Scheduler}.
<p>
If there is a {@link #create(FlowableOnSubscribe, BackpressureStrategy)} type source up in the
chain, it is recommended to use {@code subscribeOn(scheduler, false)} instead
to avoid same-pool deadlock because requests may pile up behind an eager/blocking emitter.
<p>
<img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/subscribeOn.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>The operator doesn't interfere with backpressure which is determined by the source {@code Publisher}'s backpressure
behavior.</dd>
<dt><b>Scheduler:</b></dt>
<dd>You specify which {@link Scheduler} this operator will use.</dd>
</dl>
@param scheduler
the {@link Scheduler} to perform subscription actions on
@return the source Publisher modified so that its subscriptions happen on the
specified {@link Scheduler}
@see <a href="http://reactivex.io/documentation/operators/subscribeon.html">ReactiveX operators documentation: SubscribeOn</a>
@see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
@see #observeOn
@see #subscribeOn(Scheduler, boolean) | [
"Asynchronously",
"subscribes",
"Subscribers",
"to",
"this",
"Publisher",
"on",
"the",
"specified",
"{",
"@link",
"Scheduler",
"}",
".",
"<p",
">",
"If",
"there",
"is",
"a",
"{",
"@link",
"#create",
"(",
"FlowableOnSubscribe",
"BackpressureStrategy",
")",
"}",
... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L14565-L14571 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java | AttributeRenderer.renderSelectionLink | public void renderSelectionLink(AnchorTag.State state, TreeElement elem)
{
ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_SELECTION_LINK];
assert(al != null);
if (al.size() == 0)
return;
int cnt = al.size();
for (int i = 0; i < cnt; i++) {
TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i);
state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue());
}
} | java | public void renderSelectionLink(AnchorTag.State state, TreeElement elem)
{
ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_SELECTION_LINK];
assert(al != null);
if (al.size() == 0)
return;
int cnt = al.size();
for (int i = 0; i < cnt; i++) {
TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i);
state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue());
}
} | [
"public",
"void",
"renderSelectionLink",
"(",
"AnchorTag",
".",
"State",
"state",
",",
"TreeElement",
"elem",
")",
"{",
"ArrayList",
"al",
"=",
"_lists",
"[",
"TreeHtmlAttributeInfo",
".",
"HTML_LOCATION_SELECTION_LINK",
"]",
";",
"assert",
"(",
"al",
"!=",
"nul... | This method will render the values assocated with the selection link.
@param state
@param elem | [
"This",
"method",
"will",
"render",
"the",
"values",
"assocated",
"with",
"the",
"selection",
"link",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java#L188-L201 |
actframework/actframework | src/main/java/act/handler/builtin/ResourceGetter.java | ResourceGetter.verifyBase | private FastRequestHandler verifyBase(URL baseUrl, String baseSupplied) {
if (null == baseUrl) {
if ("META-INF/resources/webjars".equalsIgnoreCase(baseSupplied)) {
// webjars not provided, just ignore it.
} else {
logger.warn("URL base not exists: " + baseSupplied);
}
return AlwaysNotFound.INSTANCE;
}
return null;
} | java | private FastRequestHandler verifyBase(URL baseUrl, String baseSupplied) {
if (null == baseUrl) {
if ("META-INF/resources/webjars".equalsIgnoreCase(baseSupplied)) {
// webjars not provided, just ignore it.
} else {
logger.warn("URL base not exists: " + baseSupplied);
}
return AlwaysNotFound.INSTANCE;
}
return null;
} | [
"private",
"FastRequestHandler",
"verifyBase",
"(",
"URL",
"baseUrl",
",",
"String",
"baseSupplied",
")",
"{",
"if",
"(",
"null",
"==",
"baseUrl",
")",
"{",
"if",
"(",
"\"META-INF/resources/webjars\"",
".",
"equalsIgnoreCase",
"(",
"baseSupplied",
")",
")",
"{",... | /*
If base is valid then return null
otherwise return delegate request handler | [
"/",
"*",
"If",
"base",
"is",
"valid",
"then",
"return",
"null",
"otherwise",
"return",
"delegate",
"request",
"handler"
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/handler/builtin/ResourceGetter.java#L414-L424 |
cloudendpoints/endpoints-management-java | endpoints-control/src/main/java/com/google/api/control/model/ReportRequestInfo.java | ReportRequestInfo.asReportRequest | public ReportRequest asReportRequest(ReportingRule rules, Clock clock) {
Preconditions.checkState(!Strings.isNullOrEmpty(getServiceName()),
"a service name must be set");
// Populate metrics and labels if they can be associated with a method/operation
Operation.Builder o = asOperation(clock).toBuilder();
if (!Strings.isNullOrEmpty(o.getOperationId())
&& !Strings.isNullOrEmpty(o.getOperationName())) {
Map<String, String> addedLabels = Maps.newHashMap();
for (KnownLabels l : rules.getLabels()) {
l.performUpdate(this, addedLabels);
}
// Forcibly add platform reporting here, as the base service config does not specify it as a
// label.
if (!o.getLabelsMap().containsKey(KnownLabels.SCC_PLATFORM.getName())) {
KnownLabels.SCC_PLATFORM.performUpdate(this, addedLabels);
}
o.putAllLabels(getSystemLabels());
o.putAllLabels(addedLabels);
KnownMetrics[] metrics = rules.getMetrics();
for (KnownMetrics m : metrics) {
m.performUpdate(this, o);
}
}
String[] logs = rules.getLogs();
long timestampMillis = clock.currentTimeMillis();
for (String l : logs) {
o.addLogEntries(asLogEntry(l, timestampMillis));
}
return ReportRequest.newBuilder().addOperations(o).setServiceName(getServiceName()).build();
} | java | public ReportRequest asReportRequest(ReportingRule rules, Clock clock) {
Preconditions.checkState(!Strings.isNullOrEmpty(getServiceName()),
"a service name must be set");
// Populate metrics and labels if they can be associated with a method/operation
Operation.Builder o = asOperation(clock).toBuilder();
if (!Strings.isNullOrEmpty(o.getOperationId())
&& !Strings.isNullOrEmpty(o.getOperationName())) {
Map<String, String> addedLabels = Maps.newHashMap();
for (KnownLabels l : rules.getLabels()) {
l.performUpdate(this, addedLabels);
}
// Forcibly add platform reporting here, as the base service config does not specify it as a
// label.
if (!o.getLabelsMap().containsKey(KnownLabels.SCC_PLATFORM.getName())) {
KnownLabels.SCC_PLATFORM.performUpdate(this, addedLabels);
}
o.putAllLabels(getSystemLabels());
o.putAllLabels(addedLabels);
KnownMetrics[] metrics = rules.getMetrics();
for (KnownMetrics m : metrics) {
m.performUpdate(this, o);
}
}
String[] logs = rules.getLogs();
long timestampMillis = clock.currentTimeMillis();
for (String l : logs) {
o.addLogEntries(asLogEntry(l, timestampMillis));
}
return ReportRequest.newBuilder().addOperations(o).setServiceName(getServiceName()).build();
} | [
"public",
"ReportRequest",
"asReportRequest",
"(",
"ReportingRule",
"rules",
",",
"Clock",
"clock",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"getServiceName",
"(",
")",
")",
",",
"\"a service name must be set\"",
... | Make a {@code LogEntry} from the instance.
@param rules ReportingRules
@param clock Clock
@return the corresponding {@code ReportRequest} | [
"Make",
"a",
"{",
"@code",
"LogEntry",
"}",
"from",
"the",
"instance",
"."
] | train | https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/ReportRequestInfo.java#L136-L168 |
apache/flink | flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerBase.java | FlinkKafkaProducerBase.invoke | @Override
public void invoke(IN next, Context context) throws Exception {
// propagate asynchronous errors
checkErroneous();
byte[] serializedKey = schema.serializeKey(next);
byte[] serializedValue = schema.serializeValue(next);
String targetTopic = schema.getTargetTopic(next);
if (targetTopic == null) {
targetTopic = defaultTopicId;
}
int[] partitions = this.topicPartitionsMap.get(targetTopic);
if (null == partitions) {
partitions = getPartitionsByTopic(targetTopic, producer);
this.topicPartitionsMap.put(targetTopic, partitions);
}
ProducerRecord<byte[], byte[]> record;
if (flinkKafkaPartitioner == null) {
record = new ProducerRecord<>(targetTopic, serializedKey, serializedValue);
} else {
record = new ProducerRecord<>(
targetTopic,
flinkKafkaPartitioner.partition(next, serializedKey, serializedValue, targetTopic, partitions),
serializedKey,
serializedValue);
}
if (flushOnCheckpoint) {
synchronized (pendingRecordsLock) {
pendingRecords++;
}
}
producer.send(record, callback);
} | java | @Override
public void invoke(IN next, Context context) throws Exception {
// propagate asynchronous errors
checkErroneous();
byte[] serializedKey = schema.serializeKey(next);
byte[] serializedValue = schema.serializeValue(next);
String targetTopic = schema.getTargetTopic(next);
if (targetTopic == null) {
targetTopic = defaultTopicId;
}
int[] partitions = this.topicPartitionsMap.get(targetTopic);
if (null == partitions) {
partitions = getPartitionsByTopic(targetTopic, producer);
this.topicPartitionsMap.put(targetTopic, partitions);
}
ProducerRecord<byte[], byte[]> record;
if (flinkKafkaPartitioner == null) {
record = new ProducerRecord<>(targetTopic, serializedKey, serializedValue);
} else {
record = new ProducerRecord<>(
targetTopic,
flinkKafkaPartitioner.partition(next, serializedKey, serializedValue, targetTopic, partitions),
serializedKey,
serializedValue);
}
if (flushOnCheckpoint) {
synchronized (pendingRecordsLock) {
pendingRecords++;
}
}
producer.send(record, callback);
} | [
"@",
"Override",
"public",
"void",
"invoke",
"(",
"IN",
"next",
",",
"Context",
"context",
")",
"throws",
"Exception",
"{",
"// propagate asynchronous errors",
"checkErroneous",
"(",
")",
";",
"byte",
"[",
"]",
"serializedKey",
"=",
"schema",
".",
"serializeKey"... | Called when new data arrives to the sink, and forwards it to Kafka.
@param next
The incoming data | [
"Called",
"when",
"new",
"data",
"arrives",
"to",
"the",
"sink",
"and",
"forwards",
"it",
"to",
"Kafka",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaProducerBase.java#L280-L314 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLibFactory.java | TagLibFactory.startElement | @Override
public void startElement(String uri, String name, String qName, Attributes attributes) {
inside = qName;
this.attributes = attributes;
if (qName.equals("tag")) startTag();
else if (qName.equals("attribute")) startAtt();
else if (qName.equals("script")) startScript();
} | java | @Override
public void startElement(String uri, String name, String qName, Attributes attributes) {
inside = qName;
this.attributes = attributes;
if (qName.equals("tag")) startTag();
else if (qName.equals("attribute")) startAtt();
else if (qName.equals("script")) startScript();
} | [
"@",
"Override",
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"qName",
",",
"Attributes",
"attributes",
")",
"{",
"inside",
"=",
"qName",
";",
"this",
".",
"attributes",
"=",
"attributes",
";",
"if",
"(",
... | Geerbte Methode von org.xml.sax.ContentHandler, wird bei durchparsen des XML, beim Auftreten
eines Start-Tag aufgerufen.
@see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) | [
"Geerbte",
"Methode",
"von",
"org",
".",
"xml",
".",
"sax",
".",
"ContentHandler",
"wird",
"bei",
"durchparsen",
"des",
"XML",
"beim",
"Auftreten",
"eines",
"Start",
"-",
"Tag",
"aufgerufen",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibFactory.java#L192-L201 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java | PredictionsImpl.predictImageUrlWithNoStoreAsync | public Observable<ImagePrediction> predictImageUrlWithNoStoreAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) {
return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, predictImageUrlWithNoStoreOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() {
@Override
public ImagePrediction call(ServiceResponse<ImagePrediction> response) {
return response.body();
}
});
} | java | public Observable<ImagePrediction> predictImageUrlWithNoStoreAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) {
return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, predictImageUrlWithNoStoreOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() {
@Override
public ImagePrediction call(ServiceResponse<ImagePrediction> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImagePrediction",
">",
"predictImageUrlWithNoStoreAsync",
"(",
"UUID",
"projectId",
",",
"PredictImageUrlWithNoStoreOptionalParameter",
"predictImageUrlWithNoStoreOptionalParameter",
")",
"{",
"return",
"predictImageUrlWithNoStoreWithServiceResponseAsync",... | Predict an image url without saving the result.
@param projectId The project id
@param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImagePrediction object | [
"Predict",
"an",
"image",
"url",
"without",
"saving",
"the",
"result",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L300-L307 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java | JobOperations.enableJob | public void enableJob(String jobId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobEnableOptions options = new JobEnableOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobs().enable(jobId, options);
} | java | public void enableJob(String jobId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobEnableOptions options = new JobEnableOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobs().enable(jobId, options);
} | [
"public",
"void",
"enableJob",
"(",
"String",
"jobId",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobEnableOptions",
"options",
"=",
"new",
"JobEnableOptions",
"(",
")",
";... | Enables the specified job, allowing new tasks to run.
@param jobId The ID of the job.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Enables",
"the",
"specified",
"job",
"allowing",
"new",
"tasks",
"to",
"run",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L410-L416 |
mikepenz/MaterialDrawer | app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/CustomUrlBasePrimaryDrawerItem.java | CustomUrlBasePrimaryDrawerItem.bindViewHelper | protected void bindViewHelper(CustomBaseViewHolder viewHolder) {
Context ctx = viewHolder.itemView.getContext();
//set the identifier from the drawerItem here. It can be used to run tests
viewHolder.itemView.setId(hashCode());
//set the item selected if it is
viewHolder.itemView.setSelected(isSelected());
//get the correct color for the background
int selectedColor = getSelectedColor(ctx);
//get the correct color for the text
int color = getColor(ctx);
int selectedTextColor = getSelectedTextColor(ctx);
//set the background for the item
themeDrawerItem(ctx, viewHolder.view, selectedColor, isSelectedBackgroundAnimated());
//set the text for the name
StringHolder.applyTo(this.getName(), viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(this.getDescription(), viewHolder.description);
//set the colors for textViews
viewHolder.name.setTextColor(getTextColorStateList(color, selectedTextColor));
//set the description text color
ColorHolder.applyToOr(getDescriptionTextColor(), viewHolder.description, getTextColorStateList(color, selectedTextColor));
//define the typeface for our textViews
if (getTypeface() != null) {
viewHolder.name.setTypeface(getTypeface());
viewHolder.description.setTypeface(getTypeface());
}
//we make sure we reset the image first before setting the new one in case there is an empty one
DrawerImageLoader.getInstance().cancelImage(viewHolder.icon);
viewHolder.icon.setImageBitmap(null);
//get the drawables for our icon and set it
ImageHolder.applyTo(icon, viewHolder.icon, "customUrlItem");
//for android API 17 --> Padding not applied via xml
DrawerUIUtils.setDrawerVerticalPadding(viewHolder.view);
} | java | protected void bindViewHelper(CustomBaseViewHolder viewHolder) {
Context ctx = viewHolder.itemView.getContext();
//set the identifier from the drawerItem here. It can be used to run tests
viewHolder.itemView.setId(hashCode());
//set the item selected if it is
viewHolder.itemView.setSelected(isSelected());
//get the correct color for the background
int selectedColor = getSelectedColor(ctx);
//get the correct color for the text
int color = getColor(ctx);
int selectedTextColor = getSelectedTextColor(ctx);
//set the background for the item
themeDrawerItem(ctx, viewHolder.view, selectedColor, isSelectedBackgroundAnimated());
//set the text for the name
StringHolder.applyTo(this.getName(), viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(this.getDescription(), viewHolder.description);
//set the colors for textViews
viewHolder.name.setTextColor(getTextColorStateList(color, selectedTextColor));
//set the description text color
ColorHolder.applyToOr(getDescriptionTextColor(), viewHolder.description, getTextColorStateList(color, selectedTextColor));
//define the typeface for our textViews
if (getTypeface() != null) {
viewHolder.name.setTypeface(getTypeface());
viewHolder.description.setTypeface(getTypeface());
}
//we make sure we reset the image first before setting the new one in case there is an empty one
DrawerImageLoader.getInstance().cancelImage(viewHolder.icon);
viewHolder.icon.setImageBitmap(null);
//get the drawables for our icon and set it
ImageHolder.applyTo(icon, viewHolder.icon, "customUrlItem");
//for android API 17 --> Padding not applied via xml
DrawerUIUtils.setDrawerVerticalPadding(viewHolder.view);
} | [
"protected",
"void",
"bindViewHelper",
"(",
"CustomBaseViewHolder",
"viewHolder",
")",
"{",
"Context",
"ctx",
"=",
"viewHolder",
".",
"itemView",
".",
"getContext",
"(",
")",
";",
"//set the identifier from the drawerItem here. It can be used to run tests",
"viewHolder",
".... | a helper method to have the logic for all secondaryDrawerItems only once
@param viewHolder | [
"a",
"helper",
"method",
"to",
"have",
"the",
"logic",
"for",
"all",
"secondaryDrawerItems",
"only",
"once"
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/app/src/main/java/com/mikepenz/materialdrawer/app/drawerItems/CustomUrlBasePrimaryDrawerItem.java#L70-L111 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java | UserService.resetExpiredPassword | public void resetExpiredPassword(ModeledUser user, Credentials credentials)
throws GuacamoleException {
UserModel userModel = user.getModel();
// Get username
String username = user.getIdentifier();
// Pull new password from HTTP request
HttpServletRequest request = credentials.getRequest();
String newPassword = request.getParameter(NEW_PASSWORD_PARAMETER);
String confirmNewPassword = request.getParameter(CONFIRM_NEW_PASSWORD_PARAMETER);
// Require new password if account is expired
if (newPassword == null || confirmNewPassword == null) {
logger.info("The password of user \"{}\" has expired and must be reset.", username);
throw new GuacamoleInsufficientCredentialsException("LOGIN.INFO_PASSWORD_EXPIRED", EXPIRED_PASSWORD);
}
// New password must be different from old password
if (newPassword.equals(credentials.getPassword()))
throw new GuacamoleClientException("LOGIN.ERROR_PASSWORD_SAME");
// New password must not be blank
if (newPassword.isEmpty())
throw new GuacamoleClientException("LOGIN.ERROR_PASSWORD_BLANK");
// Confirm that the password was entered correctly twice
if (!newPassword.equals(confirmNewPassword))
throw new GuacamoleClientException("LOGIN.ERROR_PASSWORD_MISMATCH");
// Verify new password does not violate defined policies
passwordPolicyService.verifyPassword(username, newPassword);
// Change password and reset expiration flag
userModel.setExpired(false);
user.setPassword(newPassword);
userMapper.update(userModel);
logger.info("Expired password of user \"{}\" has been reset.", username);
} | java | public void resetExpiredPassword(ModeledUser user, Credentials credentials)
throws GuacamoleException {
UserModel userModel = user.getModel();
// Get username
String username = user.getIdentifier();
// Pull new password from HTTP request
HttpServletRequest request = credentials.getRequest();
String newPassword = request.getParameter(NEW_PASSWORD_PARAMETER);
String confirmNewPassword = request.getParameter(CONFIRM_NEW_PASSWORD_PARAMETER);
// Require new password if account is expired
if (newPassword == null || confirmNewPassword == null) {
logger.info("The password of user \"{}\" has expired and must be reset.", username);
throw new GuacamoleInsufficientCredentialsException("LOGIN.INFO_PASSWORD_EXPIRED", EXPIRED_PASSWORD);
}
// New password must be different from old password
if (newPassword.equals(credentials.getPassword()))
throw new GuacamoleClientException("LOGIN.ERROR_PASSWORD_SAME");
// New password must not be blank
if (newPassword.isEmpty())
throw new GuacamoleClientException("LOGIN.ERROR_PASSWORD_BLANK");
// Confirm that the password was entered correctly twice
if (!newPassword.equals(confirmNewPassword))
throw new GuacamoleClientException("LOGIN.ERROR_PASSWORD_MISMATCH");
// Verify new password does not violate defined policies
passwordPolicyService.verifyPassword(username, newPassword);
// Change password and reset expiration flag
userModel.setExpired(false);
user.setPassword(newPassword);
userMapper.update(userModel);
logger.info("Expired password of user \"{}\" has been reset.", username);
} | [
"public",
"void",
"resetExpiredPassword",
"(",
"ModeledUser",
"user",
",",
"Credentials",
"credentials",
")",
"throws",
"GuacamoleException",
"{",
"UserModel",
"userModel",
"=",
"user",
".",
"getModel",
"(",
")",
";",
"// Get username",
"String",
"username",
"=",
... | Resets the password of the given user to the new password specified via
the "new-password" and "confirm-new-password" parameters from the
provided credentials. If these parameters are missing or invalid,
additional credentials will be requested.
@param user
The user whose password should be reset.
@param credentials
The credentials from which the parameters required for password
reset should be retrieved.
@throws GuacamoleException
If the password reset parameters within the given credentials are
invalid or missing. | [
"Resets",
"the",
"password",
"of",
"the",
"given",
"user",
"to",
"the",
"new",
"password",
"specified",
"via",
"the",
"new",
"-",
"password",
"and",
"confirm",
"-",
"new",
"-",
"password",
"parameters",
"from",
"the",
"provided",
"credentials",
".",
"If",
... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserService.java#L481-L521 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfLayer.java | PdfLayer.setPrint | public void setPrint(String subtype, boolean printstate) {
PdfDictionary usage = getUsage();
PdfDictionary dic = new PdfDictionary();
dic.put(PdfName.SUBTYPE, new PdfName(subtype));
dic.put(PdfName.PRINTSTATE, printstate ? PdfName.ON : PdfName.OFF);
usage.put(PdfName.PRINT, dic);
} | java | public void setPrint(String subtype, boolean printstate) {
PdfDictionary usage = getUsage();
PdfDictionary dic = new PdfDictionary();
dic.put(PdfName.SUBTYPE, new PdfName(subtype));
dic.put(PdfName.PRINTSTATE, printstate ? PdfName.ON : PdfName.OFF);
usage.put(PdfName.PRINT, dic);
} | [
"public",
"void",
"setPrint",
"(",
"String",
"subtype",
",",
"boolean",
"printstate",
")",
"{",
"PdfDictionary",
"usage",
"=",
"getUsage",
"(",
")",
";",
"PdfDictionary",
"dic",
"=",
"new",
"PdfDictionary",
"(",
")",
";",
"dic",
".",
"put",
"(",
"PdfName",... | Specifies that the content in this group is intended for
use in printing
@param subtype a name specifying the kind of content controlled by the group;
for example, <B>Trapping</B>, <B>PrintersMarks</B> and <B>Watermark</B>
@param printstate indicates that the group should be
set to that state when the document is printed from a viewer application | [
"Specifies",
"that",
"the",
"content",
"in",
"this",
"group",
"is",
"intended",
"for",
"use",
"in",
"printing"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfLayer.java#L274-L280 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/TrainsImpl.java | TrainsImpl.trainVersion | public EnqueueTrainingResponse trainVersion(UUID appId, String versionId) {
return trainVersionWithServiceResponseAsync(appId, versionId).toBlocking().single().body();
} | java | public EnqueueTrainingResponse trainVersion(UUID appId, String versionId) {
return trainVersionWithServiceResponseAsync(appId, versionId).toBlocking().single().body();
} | [
"public",
"EnqueueTrainingResponse",
"trainVersion",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
")",
"{",
"return",
"trainVersionWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"bo... | Sends a training request for a version of a specified LUIS app. This POST request initiates a request asynchronously. To determine whether the training request is successful, submit a GET request to get training status. Note: The application version is not fully trained unless all the models (intents and entities) are trained successfully or are up to date. To verify training success, get the training status at least once after training is complete.
@param appId The application ID.
@param versionId The version ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EnqueueTrainingResponse object if successful. | [
"Sends",
"a",
"training",
"request",
"for",
"a",
"version",
"of",
"a",
"specified",
"LUIS",
"app",
".",
"This",
"POST",
"request",
"initiates",
"a",
"request",
"asynchronously",
".",
"To",
"determine",
"whether",
"the",
"training",
"request",
"is",
"successful... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/TrainsImpl.java#L80-L82 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java | AgentLoader.attachAgent | private static void attachAgent(Class<?> vmClass, URL agentJarURL) throws Exception {
String pid = getPID();
String agentAbsolutePath = new File(agentJarURL.toURI().getSchemeSpecificPart()).getAbsolutePath();
Object vm = getAttachMethod(vmClass).invoke(null, new Object[] { pid });
getLoadAgentMethod(vmClass).invoke(vm, new Object[] { agentAbsolutePath });
getDetachMethod(vmClass).invoke(vm);
} | java | private static void attachAgent(Class<?> vmClass, URL agentJarURL) throws Exception {
String pid = getPID();
String agentAbsolutePath = new File(agentJarURL.toURI().getSchemeSpecificPart()).getAbsolutePath();
Object vm = getAttachMethod(vmClass).invoke(null, new Object[] { pid });
getLoadAgentMethod(vmClass).invoke(vm, new Object[] { agentAbsolutePath });
getDetachMethod(vmClass).invoke(vm);
} | [
"private",
"static",
"void",
"attachAgent",
"(",
"Class",
"<",
"?",
">",
"vmClass",
",",
"URL",
"agentJarURL",
")",
"throws",
"Exception",
"{",
"String",
"pid",
"=",
"getPID",
"(",
")",
";",
"String",
"agentAbsolutePath",
"=",
"new",
"File",
"(",
"agentJar... | Attaches jar where this class belongs to the current VirtualMachine as an
agent.
@param vmClass
VirtualMachine
@throws Exception
If unexpected behavior | [
"Attaches",
"jar",
"where",
"this",
"class",
"belongs",
"to",
"the",
"current",
"VirtualMachine",
"as",
"an",
"agent",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/agent/AgentLoader.java#L116-L123 |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java | ExcelFunctions.fixed | public static String fixed(EvaluationContext ctx, Object number, @IntegerDefault(2) Object decimals, @BooleanDefault(false) Object noCommas) {
BigDecimal _number = Conversions.toDecimal(number, ctx);
_number = _number.setScale(Conversions.toInteger(decimals, ctx), RoundingMode.HALF_UP);
DecimalFormat format = new DecimalFormat();
format.setMaximumFractionDigits(9);
format.setGroupingUsed(!Conversions.toBoolean(noCommas, ctx));
return format.format(_number);
} | java | public static String fixed(EvaluationContext ctx, Object number, @IntegerDefault(2) Object decimals, @BooleanDefault(false) Object noCommas) {
BigDecimal _number = Conversions.toDecimal(number, ctx);
_number = _number.setScale(Conversions.toInteger(decimals, ctx), RoundingMode.HALF_UP);
DecimalFormat format = new DecimalFormat();
format.setMaximumFractionDigits(9);
format.setGroupingUsed(!Conversions.toBoolean(noCommas, ctx));
return format.format(_number);
} | [
"public",
"static",
"String",
"fixed",
"(",
"EvaluationContext",
"ctx",
",",
"Object",
"number",
",",
"@",
"IntegerDefault",
"(",
"2",
")",
"Object",
"decimals",
",",
"@",
"BooleanDefault",
"(",
"false",
")",
"Object",
"noCommas",
")",
"{",
"BigDecimal",
"_n... | Formats the given number in decimal format using a period and commas | [
"Formats",
"the",
"given",
"number",
"in",
"decimal",
"format",
"using",
"a",
"period",
"and",
"commas"
] | train | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java#L66-L74 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java | CDownloadRequest.getByteSink | public ByteSink getByteSink()
{
ByteSink bs = byteSink;
if ( progressListener != null ) {
bs = new ProgressByteSink( bs, progressListener );
}
return bs;
} | java | public ByteSink getByteSink()
{
ByteSink bs = byteSink;
if ( progressListener != null ) {
bs = new ProgressByteSink( bs, progressListener );
}
return bs;
} | [
"public",
"ByteSink",
"getByteSink",
"(",
")",
"{",
"ByteSink",
"bs",
"=",
"byteSink",
";",
"if",
"(",
"progressListener",
"!=",
"null",
")",
"{",
"bs",
"=",
"new",
"ProgressByteSink",
"(",
"bs",
",",
"progressListener",
")",
";",
"}",
"return",
"bs",
";... | If no progress listener has been set, return the byte sink defined in constructor, otherwise decorate it.
@return the byte sink to be used for download operations. | [
"If",
"no",
"progress",
"listener",
"has",
"been",
"set",
"return",
"the",
"byte",
"sink",
"defined",
"in",
"constructor",
"otherwise",
"decorate",
"it",
"."
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java#L132-L139 |
cdk/cdk | base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/Mappings.java | Mappings.toSubstructures | public Iterable<IAtomContainer> toSubstructures() {
return FluentIterable.from(map(new ToAtomBondMap(query, target)))
.transform(new Function<Map<IChemObject, IChemObject>, IAtomContainer>() {
@Override
public IAtomContainer apply(Map<IChemObject, IChemObject> map) {
final IAtomContainer submol = target.getBuilder()
.newInstance(IAtomContainer.class,
query.getAtomCount(), target.getBondCount(), 0, 0);
for (IAtom atom : query.atoms())
submol.addAtom((IAtom)map.get(atom));
for (IBond bond : query.bonds())
submol.addBond((IBond)map.get(bond));
return submol;
}
});
} | java | public Iterable<IAtomContainer> toSubstructures() {
return FluentIterable.from(map(new ToAtomBondMap(query, target)))
.transform(new Function<Map<IChemObject, IChemObject>, IAtomContainer>() {
@Override
public IAtomContainer apply(Map<IChemObject, IChemObject> map) {
final IAtomContainer submol = target.getBuilder()
.newInstance(IAtomContainer.class,
query.getAtomCount(), target.getBondCount(), 0, 0);
for (IAtom atom : query.atoms())
submol.addAtom((IAtom)map.get(atom));
for (IBond bond : query.bonds())
submol.addBond((IBond)map.get(bond));
return submol;
}
});
} | [
"public",
"Iterable",
"<",
"IAtomContainer",
">",
"toSubstructures",
"(",
")",
"{",
"return",
"FluentIterable",
".",
"from",
"(",
"map",
"(",
"new",
"ToAtomBondMap",
"(",
"query",
",",
"target",
")",
")",
")",
".",
"transform",
"(",
"new",
"Function",
"<",... | Obtain the mapped substructures (atoms/bonds) of the target compound. The atoms
and bonds are the same as in the target molecule but there may be less of them.
<blockquote><pre>
IAtomContainer query, target
Mappings mappings = ...;
for (IAtomContainer mol : mol.toSubstructures()) {
for (IAtom atom : mol.atoms())
target.contains(atom); // always true
for (IAtom atom : target.atoms())
mol.contains(atom): // not always true
}
</pre></blockquote>
@return lazy iterable of molecules | [
"Obtain",
"the",
"mapped",
"substructures",
"(",
"atoms",
"/",
"bonds",
")",
"of",
"the",
"target",
"compound",
".",
"The",
"atoms",
"and",
"bonds",
"are",
"the",
"same",
"as",
"in",
"the",
"target",
"molecule",
"but",
"there",
"may",
"be",
"less",
"of",... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/Mappings.java#L463-L478 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_billingAccountSite_POST | public void billingAccount_billingAccountSite_POST(String billingAccount, String billingAccountSite) throws IOException {
String qPath = "/telephony/{billingAccount}/billingAccountSite";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "billingAccountSite", billingAccountSite);
exec(qPath, "POST", sb.toString(), o);
} | java | public void billingAccount_billingAccountSite_POST(String billingAccount, String billingAccountSite) throws IOException {
String qPath = "/telephony/{billingAccount}/billingAccountSite";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "billingAccountSite", billingAccountSite);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"billingAccount_billingAccountSite_POST",
"(",
"String",
"billingAccount",
",",
"String",
"billingAccountSite",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/billingAccountSite\"",
";",
"StringBuilder",
"sb",
"=",
... | Used to overwrite current billing account feature by the billing account site
REST: POST /telephony/{billingAccount}/billingAccountSite
@param billingAccountSite [required] Billing account site (master billing account)
@param billingAccount [required] The name of your billingAccount | [
"Used",
"to",
"overwrite",
"current",
"billing",
"account",
"feature",
"by",
"the",
"billing",
"account",
"site"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5048-L5054 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java | MathUtils.ssError | public static double ssError(double[] predictedValues, double[] targetAttribute) {
double ret = 0;
for (int i = 0; i < predictedValues.length; i++) {
ret += Math.pow(targetAttribute[i] - predictedValues[i], 2);
}
return ret;
} | java | public static double ssError(double[] predictedValues, double[] targetAttribute) {
double ret = 0;
for (int i = 0; i < predictedValues.length; i++) {
ret += Math.pow(targetAttribute[i] - predictedValues[i], 2);
}
return ret;
} | [
"public",
"static",
"double",
"ssError",
"(",
"double",
"[",
"]",
"predictedValues",
",",
"double",
"[",
"]",
"targetAttribute",
")",
"{",
"double",
"ret",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"predictedValues",
".",
"length"... | How much of the variance is NOT explained by the regression
@param predictedValues predicted values
@param targetAttribute data for target attribute
@return the sum squares of regression | [
"How",
"much",
"of",
"the",
"variance",
"is",
"NOT",
"explained",
"by",
"the",
"regression"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L188-L195 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsAfterPublishStaticExportHandler.java | CmsAfterPublishStaticExportHandler.exportAfterPublish | protected void exportAfterPublish(CmsUUID publishHistoryId, I_CmsReport report)
throws CmsException, IOException, ServletException {
// first check if the test resource was published already
// if not, we must do a complete export of all static resources
String rfsName = CmsFileUtil.normalizePath(
OpenCms.getStaticExportManager().getExportPath(OpenCms.getStaticExportManager().getTestResource())
+ OpenCms.getStaticExportManager().getTestResource());
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_CHECKING_TEST_RESOURCE_1, rfsName));
}
File file = new File(rfsName);
if (!file.exists()) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_TEST_RESOURCE_NOT_EXISTANT_0));
}
// the file is not there, so export everything
OpenCms.getStaticExportManager().exportFullStaticRender(true, report);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_TEST_RESOURCE_EXISTS_0));
}
// delete all resources deleted during the publish process, and retrieve the list of resources to actually export
List<CmsPublishedResource> publishedResources = scrubExportFolders(publishHistoryId);
// do the export
doExportAfterPublish(publishedResources, report);
}
} | java | protected void exportAfterPublish(CmsUUID publishHistoryId, I_CmsReport report)
throws CmsException, IOException, ServletException {
// first check if the test resource was published already
// if not, we must do a complete export of all static resources
String rfsName = CmsFileUtil.normalizePath(
OpenCms.getStaticExportManager().getExportPath(OpenCms.getStaticExportManager().getTestResource())
+ OpenCms.getStaticExportManager().getTestResource());
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_CHECKING_TEST_RESOURCE_1, rfsName));
}
File file = new File(rfsName);
if (!file.exists()) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_TEST_RESOURCE_NOT_EXISTANT_0));
}
// the file is not there, so export everything
OpenCms.getStaticExportManager().exportFullStaticRender(true, report);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_TEST_RESOURCE_EXISTS_0));
}
// delete all resources deleted during the publish process, and retrieve the list of resources to actually export
List<CmsPublishedResource> publishedResources = scrubExportFolders(publishHistoryId);
// do the export
doExportAfterPublish(publishedResources, report);
}
} | [
"protected",
"void",
"exportAfterPublish",
"(",
"CmsUUID",
"publishHistoryId",
",",
"I_CmsReport",
"report",
")",
"throws",
"CmsException",
",",
"IOException",
",",
"ServletException",
"{",
"// first check if the test resource was published already",
"// if not, we must do a comp... | Starts the static export on publish.<p>
Exports all modified resources after a publish process into the real FS.<p>
@param publishHistoryId the publichHistoryId of the published project
@param report an <code>{@link I_CmsReport}</code> instance to print output message, or <code>null</code> to write messages to the log file
@throws CmsException in case of errors accessing the VFS
@throws IOException in case of errors writing to the export output stream
@throws ServletException in case of errors accessing the servlet | [
"Starts",
"the",
"static",
"export",
"on",
"publish",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsAfterPublishStaticExportHandler.java#L247-L278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.