repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java | ShapeGenerator.createRadioButton | public Shape createRadioButton(int x, int y, int diameter) {
return createEllipseInternal(x, y, diameter, diameter);
} | java | public Shape createRadioButton(int x, int y, int diameter) {
return createEllipseInternal(x, y, diameter, diameter);
} | [
"public",
"Shape",
"createRadioButton",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"diameter",
")",
"{",
"return",
"createEllipseInternal",
"(",
"x",
",",
"y",
",",
"diameter",
",",
"diameter",
")",
";",
"}"
] | Return a path for a radio button's concentric sections.
@param x the X coordinate of the upper-left corner of the section
@param y the Y coordinate of the upper-left corner of the section
@param diameter the diameter of the section
@return a path representing the shape. | [
"Return",
"a",
"path",
"for",
"a",
"radio",
"button",
"s",
"concentric",
"sections",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L499-L501 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_cluster.java | ns_cluster.modify_password | public static ns_cluster modify_password(nitro_service client, ns_cluster resource) throws Exception
{
return ((ns_cluster[]) resource.perform_operation(client, "modify_password"))[0];
} | java | public static ns_cluster modify_password(nitro_service client, ns_cluster resource) throws Exception
{
return ((ns_cluster[]) resource.perform_operation(client, "modify_password"))[0];
} | [
"public",
"static",
"ns_cluster",
"modify_password",
"(",
"nitro_service",
"client",
",",
"ns_cluster",
"resource",
")",
"throws",
"Exception",
"{",
"return",
"(",
"(",
"ns_cluster",
"[",
"]",
")",
"resource",
".",
"perform_operation",
"(",
"client",
",",
"\"mod... | <pre>
Use this operation to modify Cluster IP admin ns password.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"modify",
"Cluster",
"IP",
"admin",
"ns",
"password",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_cluster.java#L559-L562 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java | PyGenerator.generateEnumerationDeclaration | protected boolean generateEnumerationDeclaration(SarlEnumeration enumeration, PyAppendable it, IExtraLanguageGeneratorContext context) {
if (!Strings.isEmpty(enumeration.getName())) {
it.append("class ").append(enumeration.getName()); //$NON-NLS-1$
it.append("(Enum"); //$NON-NLS-1$
it.append(newType("enum.Enum")); //$NON-NLS-1$
it.append("):"); //$NON-NLS-1$
it.increaseIndentation().newLine();
generateDocString(getTypeBuilder().getDocumentation(enumeration), it);
int i = 0;
for (final XtendMember item : enumeration.getMembers()) {
if (context.getCancelIndicator().isCanceled()) {
return false;
}
if (item instanceof XtendEnumLiteral) {
final XtendEnumLiteral literal = (XtendEnumLiteral) item;
it.append(literal.getName()).append(" = "); //$NON-NLS-1$
it.append(Integer.toString(i));
it.newLine();
++i;
}
}
//
it.decreaseIndentation().newLine().newLine();
return true;
}
return false;
} | java | protected boolean generateEnumerationDeclaration(SarlEnumeration enumeration, PyAppendable it, IExtraLanguageGeneratorContext context) {
if (!Strings.isEmpty(enumeration.getName())) {
it.append("class ").append(enumeration.getName()); //$NON-NLS-1$
it.append("(Enum"); //$NON-NLS-1$
it.append(newType("enum.Enum")); //$NON-NLS-1$
it.append("):"); //$NON-NLS-1$
it.increaseIndentation().newLine();
generateDocString(getTypeBuilder().getDocumentation(enumeration), it);
int i = 0;
for (final XtendMember item : enumeration.getMembers()) {
if (context.getCancelIndicator().isCanceled()) {
return false;
}
if (item instanceof XtendEnumLiteral) {
final XtendEnumLiteral literal = (XtendEnumLiteral) item;
it.append(literal.getName()).append(" = "); //$NON-NLS-1$
it.append(Integer.toString(i));
it.newLine();
++i;
}
}
//
it.decreaseIndentation().newLine().newLine();
return true;
}
return false;
} | [
"protected",
"boolean",
"generateEnumerationDeclaration",
"(",
"SarlEnumeration",
"enumeration",
",",
"PyAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"enumeration",
".",
"getName",
"(",
... | Generate the given enumeration declaration.
@param enumeration the enumeration.
@param it the receiver of the generated code.
@param context the context.
@return {@code true} if a declaration was generated. {@code false} if no enumeration was generated.
@since 0.8 | [
"Generate",
"the",
"given",
"enumeration",
"declaration",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L385-L411 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java | SegmentsUtil.getFloat | public static float getFloat(MemorySegment[] segments, int offset) {
if (inFirstSegment(segments, offset, 4)) {
return segments[0].getFloat(offset);
} else {
return getFloatMultiSegments(segments, offset);
}
} | java | public static float getFloat(MemorySegment[] segments, int offset) {
if (inFirstSegment(segments, offset, 4)) {
return segments[0].getFloat(offset);
} else {
return getFloatMultiSegments(segments, offset);
}
} | [
"public",
"static",
"float",
"getFloat",
"(",
"MemorySegment",
"[",
"]",
"segments",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"inFirstSegment",
"(",
"segments",
",",
"offset",
",",
"4",
")",
")",
"{",
"return",
"segments",
"[",
"0",
"]",
".",
"getFlo... | get float from segments.
@param segments target segments.
@param offset value offset. | [
"get",
"float",
"from",
"segments",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L852-L858 |
grpc/grpc-java | services/src/main/java/io/grpc/services/BinaryLogs.java | BinaryLogs.createBinaryLog | public static BinaryLog createBinaryLog(BinaryLogSink sink, String configStr) throws IOException {
return new BinaryLogProviderImpl(sink, configStr);
} | java | public static BinaryLog createBinaryLog(BinaryLogSink sink, String configStr) throws IOException {
return new BinaryLogProviderImpl(sink, configStr);
} | [
"public",
"static",
"BinaryLog",
"createBinaryLog",
"(",
"BinaryLogSink",
"sink",
",",
"String",
"configStr",
")",
"throws",
"IOException",
"{",
"return",
"new",
"BinaryLogProviderImpl",
"(",
"sink",
",",
"configStr",
")",
";",
"}"
] | Creates a binary log with a custom {@link BinaryLogSink} for receiving the logged data,
and a config string as defined by
<a href="https://github.com/grpc/proposal/blob/master/A16-binary-logging.md">
A16-binary-logging</a>. | [
"Creates",
"a",
"binary",
"log",
"with",
"a",
"custom",
"{"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/services/src/main/java/io/grpc/services/BinaryLogs.java#L48-L50 |
apereo/cas | support/cas-server-support-electrofence/src/main/java/org/apereo/cas/impl/calcs/BaseAuthenticationRequestRiskCalculator.java | BaseAuthenticationRequestRiskCalculator.calculateScoreBasedOnEventsCount | protected BigDecimal calculateScoreBasedOnEventsCount(final Authentication authentication,
final Collection<? extends CasEvent> events,
final long count) {
if (count == events.size()) {
LOGGER.debug("Principal [{}] is assigned to the lowest risk score with attempted count of [{}]", authentication.getPrincipal(), count);
return LOWEST_RISK_SCORE;
}
return getFinalAveragedScore(count, events.size());
} | java | protected BigDecimal calculateScoreBasedOnEventsCount(final Authentication authentication,
final Collection<? extends CasEvent> events,
final long count) {
if (count == events.size()) {
LOGGER.debug("Principal [{}] is assigned to the lowest risk score with attempted count of [{}]", authentication.getPrincipal(), count);
return LOWEST_RISK_SCORE;
}
return getFinalAveragedScore(count, events.size());
} | [
"protected",
"BigDecimal",
"calculateScoreBasedOnEventsCount",
"(",
"final",
"Authentication",
"authentication",
",",
"final",
"Collection",
"<",
"?",
"extends",
"CasEvent",
">",
"events",
",",
"final",
"long",
"count",
")",
"{",
"if",
"(",
"count",
"==",
"events"... | Calculate score based on events count big decimal.
@param authentication the authentication
@param events the events
@param count the count
@return the big decimal | [
"Calculate",
"score",
"based",
"on",
"events",
"count",
"big",
"decimal",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-electrofence/src/main/java/org/apereo/cas/impl/calcs/BaseAuthenticationRequestRiskCalculator.java#L97-L105 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/AbstractEditor.java | AbstractEditor.getMessage | protected String getMessage(String key, Object[] params){
MessageSource messageSource = ValkyrieRepository.getInstance().getApplicationConfig().messageSource();
return messageSource.getMessage(key, params, Locale.getDefault());
} | java | protected String getMessage(String key, Object[] params){
MessageSource messageSource = ValkyrieRepository.getInstance().getApplicationConfig().messageSource();
return messageSource.getMessage(key, params, Locale.getDefault());
} | [
"protected",
"String",
"getMessage",
"(",
"String",
"key",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"MessageSource",
"messageSource",
"=",
"ValkyrieRepository",
".",
"getInstance",
"(",
")",
".",
"getApplicationConfig",
"(",
")",
".",
"messageSource",
"(",
... | Method to obtain a message from the message source
defined via the services locator, at the default locale. | [
"Method",
"to",
"obtain",
"a",
"message",
"from",
"the",
"message",
"source",
"defined",
"via",
"the",
"services",
"locator",
"at",
"the",
"default",
"locale",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/editor/AbstractEditor.java#L176-L179 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java | ConversionHandler.error | private String error(){
Map<String, List<ConversionMethod>> conversions = xml.conversionsLoad();
String methodName = "illegalCode";
String paramater = "";
String resource = xml.getXmlPath();
if(!isNull(resource)){
boolean isPath = isPath(resource);
methodName = !isPath ? "illegalCodeContent":"illegalCode";
if(!conversions.isEmpty() && !isNull(conversions.get(configClass.getName()))){
// if is a content, the double quotes must be handled
if(!isPath) resource = doubleQuotesHandling(resource);
paramater = write(",\"",resource,"\"");
}
}
return write("com.googlecode.jmapper.config.Error#",methodName,"(e,\"",methodToGenerate.getOriginalName(),"\",\"",configClass.getSimpleName(),"\"",paramater,");");
} | java | private String error(){
Map<String, List<ConversionMethod>> conversions = xml.conversionsLoad();
String methodName = "illegalCode";
String paramater = "";
String resource = xml.getXmlPath();
if(!isNull(resource)){
boolean isPath = isPath(resource);
methodName = !isPath ? "illegalCodeContent":"illegalCode";
if(!conversions.isEmpty() && !isNull(conversions.get(configClass.getName()))){
// if is a content, the double quotes must be handled
if(!isPath) resource = doubleQuotesHandling(resource);
paramater = write(",\"",resource,"\"");
}
}
return write("com.googlecode.jmapper.config.Error#",methodName,"(e,\"",methodToGenerate.getOriginalName(),"\",\"",configClass.getSimpleName(),"\"",paramater,");");
} | [
"private",
"String",
"error",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"ConversionMethod",
">",
">",
"conversions",
"=",
"xml",
".",
"conversionsLoad",
"(",
")",
";",
"String",
"methodName",
"=",
"\"illegalCode\"",
";",
"String",
"paramater",
... | This method surrounds the explicit conversion defined with a try-catch, to handle null pointers.
@return the body wrapped | [
"This",
"method",
"surrounds",
"the",
"explicit",
"conversion",
"defined",
"with",
"a",
"try",
"-",
"catch",
"to",
"handle",
"null",
"pointers",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java#L155-L175 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/tools/BrushedMetalFilter.java | BrushedMetalFilter.setRGB | public void setRGB(final BufferedImage IMAGE, final int X, final int Y, final int WIDTH, final int HEIGHT, final int[] PIXELS) {
int type = IMAGE.getType();
if (type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB) {
IMAGE.getRaster().setDataElements(X, Y, WIDTH, HEIGHT, PIXELS);
} else {
IMAGE.setRGB(X, Y, WIDTH, HEIGHT, PIXELS, 0, WIDTH);
}
} | java | public void setRGB(final BufferedImage IMAGE, final int X, final int Y, final int WIDTH, final int HEIGHT, final int[] PIXELS) {
int type = IMAGE.getType();
if (type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB) {
IMAGE.getRaster().setDataElements(X, Y, WIDTH, HEIGHT, PIXELS);
} else {
IMAGE.setRGB(X, Y, WIDTH, HEIGHT, PIXELS, 0, WIDTH);
}
} | [
"public",
"void",
"setRGB",
"(",
"final",
"BufferedImage",
"IMAGE",
",",
"final",
"int",
"X",
",",
"final",
"int",
"Y",
",",
"final",
"int",
"WIDTH",
",",
"final",
"int",
"HEIGHT",
",",
"final",
"int",
"[",
"]",
"PIXELS",
")",
"{",
"int",
"type",
"="... | A convenience method for setting ARGB pixels in an image. This tries to avoid the performance
penalty of BufferedImage.setRGB unmanaging the image.
@param IMAGE
@param X
@param Y
@param WIDTH
@param HEIGHT
@param PIXELS | [
"A",
"convenience",
"method",
"for",
"setting",
"ARGB",
"pixels",
"in",
"an",
"image",
".",
"This",
"tries",
"to",
"avoid",
"the",
"performance",
"penalty",
"of",
"BufferedImage",
".",
"setRGB",
"unmanaging",
"the",
"image",
"."
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/tools/BrushedMetalFilter.java#L252-L259 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java | Hierarchy.isInnerClassAccess | public static boolean isInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) {
String methodName = inv.getName(cpg);
return methodName.startsWith("access$");
} | java | public static boolean isInnerClassAccess(INVOKESTATIC inv, ConstantPoolGen cpg) {
String methodName = inv.getName(cpg);
return methodName.startsWith("access$");
} | [
"public",
"static",
"boolean",
"isInnerClassAccess",
"(",
"INVOKESTATIC",
"inv",
",",
"ConstantPoolGen",
"cpg",
")",
"{",
"String",
"methodName",
"=",
"inv",
".",
"getName",
"(",
"cpg",
")",
";",
"return",
"methodName",
".",
"startsWith",
"(",
"\"access$\"",
"... | Determine whether the given INVOKESTATIC instruction is an inner-class
field accessor method.
@param inv
the INVOKESTATIC instruction
@param cpg
the ConstantPoolGen for the method
@return true if the instruction is an inner-class field accessor, false
if not | [
"Determine",
"whether",
"the",
"given",
"INVOKESTATIC",
"instruction",
"is",
"an",
"inner",
"-",
"class",
"field",
"accessor",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L970-L973 |
JodaOrg/joda-time | src/main/java/org/joda/time/MonthDay.java | MonthDay.withChronologyRetainFields | public MonthDay withChronologyRetainFields(Chronology newChronology) {
newChronology = DateTimeUtils.getChronology(newChronology);
newChronology = newChronology.withUTC();
if (newChronology == getChronology()) {
return this;
} else {
MonthDay newMonthDay = new MonthDay(this, newChronology);
newChronology.validate(newMonthDay, getValues());
return newMonthDay;
}
} | java | public MonthDay withChronologyRetainFields(Chronology newChronology) {
newChronology = DateTimeUtils.getChronology(newChronology);
newChronology = newChronology.withUTC();
if (newChronology == getChronology()) {
return this;
} else {
MonthDay newMonthDay = new MonthDay(this, newChronology);
newChronology.validate(newMonthDay, getValues());
return newMonthDay;
}
} | [
"public",
"MonthDay",
"withChronologyRetainFields",
"(",
"Chronology",
"newChronology",
")",
"{",
"newChronology",
"=",
"DateTimeUtils",
".",
"getChronology",
"(",
"newChronology",
")",
";",
"newChronology",
"=",
"newChronology",
".",
"withUTC",
"(",
")",
";",
"if",... | Returns a copy of this month-day with the specified chronology.
This instance is immutable and unaffected by this method call.
<p>
This method retains the values of the fields, thus the result will
typically refer to a different instant.
<p>
The time zone of the specified chronology is ignored, as MonthDay
operates without a time zone.
@param newChronology the new chronology, null means ISO
@return a copy of this month-day with a different chronology, never null
@throws IllegalArgumentException if the values are invalid for the new chronology | [
"Returns",
"a",
"copy",
"of",
"this",
"month",
"-",
"day",
"with",
"the",
"specified",
"chronology",
".",
"This",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
".",
"<p",
">",
"This",
"method",
"retains",
"the",
"value... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/MonthDay.java#L455-L465 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java | AbstractBeanDefinition.getStreamOfTypeForField | @SuppressWarnings("WeakerAccess")
@Internal
protected final Stream getStreamOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, FieldInjectionPoint injectionPoint) {
return resolveBeanWithGenericsForField(resolutionContext, injectionPoint, (beanType, qualifier) ->
((DefaultBeanContext) context).streamOfType(resolutionContext, beanType, qualifier)
);
} | java | @SuppressWarnings("WeakerAccess")
@Internal
protected final Stream getStreamOfTypeForField(BeanResolutionContext resolutionContext, BeanContext context, FieldInjectionPoint injectionPoint) {
return resolveBeanWithGenericsForField(resolutionContext, injectionPoint, (beanType, qualifier) ->
((DefaultBeanContext) context).streamOfType(resolutionContext, beanType, qualifier)
);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"@",
"Internal",
"protected",
"final",
"Stream",
"getStreamOfTypeForField",
"(",
"BeanResolutionContext",
"resolutionContext",
",",
"BeanContext",
"context",
",",
"FieldInjectionPoint",
"injectionPoint",
")",
"{",
"re... | Obtains a bean definition for the field at the given index and the argument at the given index
<p>
Warning: this method is used by internal generated code and should not be called by user code.
@param resolutionContext The resolution context
@param context The context
@param injectionPoint The field injection point
@return The resolved bean | [
"Obtains",
"a",
"bean",
"definition",
"for",
"the",
"field",
"at",
"the",
"given",
"index",
"and",
"the",
"argument",
"at",
"the",
"given",
"index",
"<p",
">",
"Warning",
":",
"this",
"method",
"is",
"used",
"by",
"internal",
"generated",
"code",
"and",
... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1430-L1436 |
openzipkin-contrib/brave-opentracing | src/main/java/brave/opentracing/BraveSpan.java | BraveSpan.setTag | @Override public BraveSpan setTag(String key, Number value) {
if (finishCalled) return this;
if (trySetPeer(key, value)) return this;
// handle late sampling decision
if (Tags.SAMPLING_PRIORITY.getKey().equals(key) && value.intValue() == 0) {
delegate.abandon();
// convert the span to no-op
delegate = tracer.toSpan(delegate.context().toBuilder().sampled(false).build());
}
return setTag(key, value.toString());
} | java | @Override public BraveSpan setTag(String key, Number value) {
if (finishCalled) return this;
if (trySetPeer(key, value)) return this;
// handle late sampling decision
if (Tags.SAMPLING_PRIORITY.getKey().equals(key) && value.intValue() == 0) {
delegate.abandon();
// convert the span to no-op
delegate = tracer.toSpan(delegate.context().toBuilder().sampled(false).build());
}
return setTag(key, value.toString());
} | [
"@",
"Override",
"public",
"BraveSpan",
"setTag",
"(",
"String",
"key",
",",
"Number",
"value",
")",
"{",
"if",
"(",
"finishCalled",
")",
"return",
"this",
";",
"if",
"(",
"trySetPeer",
"(",
"key",
",",
"value",
")",
")",
"return",
"this",
";",
"// han... | <em>Note:</em>If the key is {@linkplain Tags#SAMPLING_PRIORITY} and the value is zero, the
current span will be abandoned and future references to the {@link #context()} will be
unsampled. This does not affect the active span, nor does it affect any equivalent instances of
this object. This is a best efforts means to handle late sampling decisions. | [
"<em",
">",
"Note",
":",
"<",
"/",
"em",
">",
"If",
"the",
"key",
"is",
"{"
] | train | https://github.com/openzipkin-contrib/brave-opentracing/blob/07653ac3a67beb7df71008961051ff03db2b60b7/src/main/java/brave/opentracing/BraveSpan.java#L82-L94 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.fillPayload | private void fillPayload(InternalRequest internalRequest, AbstractBceRequest bceRequest) {
if (internalRequest.getHttpMethod() == HttpMethodName.POST
|| internalRequest.getHttpMethod() == HttpMethodName.PUT) {
String strJson = JsonUtils.toJsonString(bceRequest);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
}
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
}
} | java | private void fillPayload(InternalRequest internalRequest, AbstractBceRequest bceRequest) {
if (internalRequest.getHttpMethod() == HttpMethodName.POST
|| internalRequest.getHttpMethod() == HttpMethodName.PUT) {
String strJson = JsonUtils.toJsonString(bceRequest);
byte[] requestJson = null;
try {
requestJson = strJson.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
throw new BceClientException("Unsupported encode.", e);
}
internalRequest.addHeader(Headers.CONTENT_LENGTH, String.valueOf(requestJson.length));
internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
internalRequest.setContent(RestartableInputStream.wrap(requestJson));
}
} | [
"private",
"void",
"fillPayload",
"(",
"InternalRequest",
"internalRequest",
",",
"AbstractBceRequest",
"bceRequest",
")",
"{",
"if",
"(",
"internalRequest",
".",
"getHttpMethod",
"(",
")",
"==",
"HttpMethodName",
".",
"POST",
"||",
"internalRequest",
".",
"getHttpM... | The method to fill the internalRequest's content field with bceRequest.
Only support HttpMethodName.POST or HttpMethodName.PUT
@param internalRequest A request object, populated with endpoint, resource path, ready for callers to populate
any additional headers or parameters, and execute.
@param bceRequest The original request, as created by the user. | [
"The",
"method",
"to",
"fill",
"the",
"internalRequest",
"s",
"content",
"field",
"with",
"bceRequest",
".",
"Only",
"support",
"HttpMethodName",
".",
"POST",
"or",
"HttpMethodName",
".",
"PUT"
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L188-L202 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/RegistriesInner.java | RegistriesInner.beginQueueBuild | public BuildInner beginQueueBuild(String resourceGroupName, String registryName, QueueBuildRequest buildRequest) {
return beginQueueBuildWithServiceResponseAsync(resourceGroupName, registryName, buildRequest).toBlocking().single().body();
} | java | public BuildInner beginQueueBuild(String resourceGroupName, String registryName, QueueBuildRequest buildRequest) {
return beginQueueBuildWithServiceResponseAsync(resourceGroupName, registryName, buildRequest).toBlocking().single().body();
} | [
"public",
"BuildInner",
"beginQueueBuild",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"QueueBuildRequest",
"buildRequest",
")",
"{",
"return",
"beginQueueBuildWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"buildR... | Creates a new build based on the request parameters and add it to the build queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildRequest The parameters of a build that needs to queued.
@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 BuildInner object if successful. | [
"Creates",
"a",
"new",
"build",
"based",
"on",
"the",
"request",
"parameters",
"and",
"add",
"it",
"to",
"the",
"build",
"queue",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/RegistriesInner.java#L1802-L1804 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_virtualNumbers_number_outgoing_GET | public ArrayList<Long> serviceName_virtualNumbers_number_outgoing_GET(String serviceName, String number, Date creationDatetime_from, Date creationDatetime_to, Long deliveryReceipt, Long differedDelivery, Long ptt, String receiver, String sender, String tag) throws IOException {
String qPath = "/sms/{serviceName}/virtualNumbers/{number}/outgoing";
StringBuilder sb = path(qPath, serviceName, number);
query(sb, "creationDatetime.from", creationDatetime_from);
query(sb, "creationDatetime.to", creationDatetime_to);
query(sb, "deliveryReceipt", deliveryReceipt);
query(sb, "differedDelivery", differedDelivery);
query(sb, "ptt", ptt);
query(sb, "receiver", receiver);
query(sb, "sender", sender);
query(sb, "tag", tag);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> serviceName_virtualNumbers_number_outgoing_GET(String serviceName, String number, Date creationDatetime_from, Date creationDatetime_to, Long deliveryReceipt, Long differedDelivery, Long ptt, String receiver, String sender, String tag) throws IOException {
String qPath = "/sms/{serviceName}/virtualNumbers/{number}/outgoing";
StringBuilder sb = path(qPath, serviceName, number);
query(sb, "creationDatetime.from", creationDatetime_from);
query(sb, "creationDatetime.to", creationDatetime_to);
query(sb, "deliveryReceipt", deliveryReceipt);
query(sb, "differedDelivery", differedDelivery);
query(sb, "ptt", ptt);
query(sb, "receiver", receiver);
query(sb, "sender", sender);
query(sb, "tag", tag);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_virtualNumbers_number_outgoing_GET",
"(",
"String",
"serviceName",
",",
"String",
"number",
",",
"Date",
"creationDatetime_from",
",",
"Date",
"creationDatetime_to",
",",
"Long",
"deliveryReceipt",
",",
"Long",
"diff... | Sms sent associated to the sms account
REST: GET /sms/{serviceName}/virtualNumbers/{number}/outgoing
@param sender [required] Filter the value of sender property (=)
@param receiver [required] Filter the value of receiver property (=)
@param tag [required] Filter the value of tag property (=)
@param creationDatetime_from [required] Filter the value of creationDatetime property (>=)
@param deliveryReceipt [required] Filter the value of deliveryReceipt property (=)
@param ptt [required] Filter the value of ptt property (=)
@param creationDatetime_to [required] Filter the value of creationDatetime property (<=)
@param differedDelivery [required] Filter the value of differedDelivery property (=)
@param serviceName [required] The internal name of your SMS offer
@param number [required] The virtual number | [
"Sms",
"sent",
"associated",
"to",
"the",
"sms",
"account"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L340-L353 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java | ClientAsynchEventThreadPool.dispatchConsumerSetChangeCallbackEvent | public void dispatchConsumerSetChangeCallbackEvent(ConsumerSetChangeCallback consumerSetChangeCallback,boolean isEmpty)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchConsumerSetChangeCallbackEvent",
new Object[]{consumerSetChangeCallback, isEmpty});
//Create a new ConsumerSetChangeCallbackThread and dispatch it.
final ConsumerSetChangeCallbackThread thread = new ConsumerSetChangeCallbackThread(consumerSetChangeCallback,isEmpty);
dispatchThread(thread);
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchConsumerSetChangeCallbackEvent");
} | java | public void dispatchConsumerSetChangeCallbackEvent(ConsumerSetChangeCallback consumerSetChangeCallback,boolean isEmpty)
{
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "dispatchConsumerSetChangeCallbackEvent",
new Object[]{consumerSetChangeCallback, isEmpty});
//Create a new ConsumerSetChangeCallbackThread and dispatch it.
final ConsumerSetChangeCallbackThread thread = new ConsumerSetChangeCallbackThread(consumerSetChangeCallback,isEmpty);
dispatchThread(thread);
if(TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "dispatchConsumerSetChangeCallbackEvent");
} | [
"public",
"void",
"dispatchConsumerSetChangeCallbackEvent",
"(",
"ConsumerSetChangeCallback",
"consumerSetChangeCallback",
",",
"boolean",
"isEmpty",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")"... | Dispatches a thread which will call the consumerSetChange method on the ConsumerSetChangeCallback passing in the supplied parameters.
@param consumerSetChangeCallback
@param isEmpty | [
"Dispatches",
"a",
"thread",
"which",
"will",
"call",
"the",
"consumerSetChange",
"method",
"on",
"the",
"ConsumerSetChangeCallback",
"passing",
"in",
"the",
"supplied",
"parameters",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ClientAsynchEventThreadPool.java#L209-L219 |
jboss/jboss-el-api_spec | src/main/java/javax/el/StaticFieldELResolver.java | StaticFieldELResolver.isReadOnly | @Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
if (base instanceof ELClass && property instanceof String) {
Class<?> klass = ((ELClass)base).getKlass();
context.setPropertyResolved(true);
}
return true;
} | java | @Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
if (base instanceof ELClass && property instanceof String) {
Class<?> klass = ((ELClass)base).getKlass();
context.setPropertyResolved(true);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"isReadOnly",
"(",
"ELContext",
"context",
",",
"Object",
"base",
",",
"Object",
"property",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"... | <p>Inquires whether the static field is writable.</p>
<p>If the base object is an instance of <code>ELClass</code>and the
property is a String,
the <code>propertyResolved</code> property of the
<code>ELContext</code> object must be set to <code>true</code>
by the resolver, before returning. If this property is not
<code>true</code> after this method is called, the caller can
safely assume no value has been set.</p>
<p>Always returns a <code>true</code> because writing to a static field
is not allowed.</p>
@param context The context of this evaluation.
@param base An <code>ELClass</code>.
@param property The name of the bean.
@return <code>true</code>
@throws NullPointerException if context is <code>null</code>. | [
"<p",
">",
"Inquires",
"whether",
"the",
"static",
"field",
"is",
"writable",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"the",
"base",
"object",
"is",
"an",
"instance",
"of",
"<code",
">",
"ELClass<",
"/",
"code",
">",
"and",
"the",
"property",
"is",... | train | https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/StaticFieldELResolver.java#L280-L291 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/Camera.java | Camera.createPerspective | public static Camera createPerspective(float fieldOfView, int windowWidth, int windowHeight, float near, float far) {
return new Camera(Matrix4f.createPerspective(fieldOfView, (float) windowWidth / windowHeight, near, far));
} | java | public static Camera createPerspective(float fieldOfView, int windowWidth, int windowHeight, float near, float far) {
return new Camera(Matrix4f.createPerspective(fieldOfView, (float) windowWidth / windowHeight, near, far));
} | [
"public",
"static",
"Camera",
"createPerspective",
"(",
"float",
"fieldOfView",
",",
"int",
"windowWidth",
",",
"int",
"windowHeight",
",",
"float",
"near",
",",
"float",
"far",
")",
"{",
"return",
"new",
"Camera",
"(",
"Matrix4f",
".",
"createPerspective",
"(... | Creates a new camera with a standard perspective projection matrix.
@param fieldOfView The field of view, in degrees
@param windowWidth The window width
@param windowHeight The widow height
@param near The near plane
@param far The far plane
@return The camera | [
"Creates",
"a",
"new",
"camera",
"with",
"a",
"standard",
"perspective",
"projection",
"matrix",
"."
] | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/Camera.java#L166-L168 |
martinkirch/jlcm | src/main/java/fr/liglab/jlcm/internals/Selector.java | Selector.select | final boolean select(int extension, ExplorationStep state) throws WrongFirstParentException {
if (this.allowExploration(extension, state)) {
return (this.next == null || this.next.select(extension, state));
} else {
PLCMCounters key = this.getCountersKey();
if (key != null) {
((PLCM.PLCMThread) Thread.currentThread()).counters[key.ordinal()]++;
}
return false;
}
} | java | final boolean select(int extension, ExplorationStep state) throws WrongFirstParentException {
if (this.allowExploration(extension, state)) {
return (this.next == null || this.next.select(extension, state));
} else {
PLCMCounters key = this.getCountersKey();
if (key != null) {
((PLCM.PLCMThread) Thread.currentThread()).counters[key.ordinal()]++;
}
return false;
}
} | [
"final",
"boolean",
"select",
"(",
"int",
"extension",
",",
"ExplorationStep",
"state",
")",
"throws",
"WrongFirstParentException",
"{",
"if",
"(",
"this",
".",
"allowExploration",
"(",
"extension",
",",
"state",
")",
")",
"{",
"return",
"(",
"this",
".",
"n... | This one handles chained calls
@param extension
@param state
@return false if, at the given state, trying to extend the current
pattern with the given extension is useless
@throws WrongFirstParentException | [
"This",
"one",
"handles",
"chained",
"calls"
] | train | https://github.com/martinkirch/jlcm/blob/6fbe53d3a1078028ac324c0f2382ec06925ffaa7/src/main/java/fr/liglab/jlcm/internals/Selector.java#L72-L82 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchManager.java | CmsSearchManager.getIndexSolr | public static final CmsSolrIndex getIndexSolr(CmsObject cms, Map<String, String[]> params) {
String indexName = null;
CmsSolrIndex index = null;
// try to get the index name from the parameters: 'core' or 'index'
if (params != null) {
indexName = params.get(OpenCmsSolrHandler.PARAM_CORE) != null
? params.get(OpenCmsSolrHandler.PARAM_CORE)[0]
: (params.get(OpenCmsSolrHandler.PARAM_INDEX) != null
? params.get(OpenCmsSolrHandler.PARAM_INDEX)[0]
: null);
}
if (indexName == null) {
// if no parameter is specified try to use the default online/offline indexes by context
indexName = cms.getRequestContext().getCurrentProject().isOnlineProject()
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
: CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE;
}
// try to get the index
index = indexName != null ? OpenCms.getSearchManager().getIndexSolr(indexName) : null;
if (index == null) {
// if there is exactly one index, a missing core / index parameter doesn't matter, since there is no choice.
List<CmsSolrIndex> solrs = OpenCms.getSearchManager().getAllSolrIndexes();
if ((solrs != null) && !solrs.isEmpty() && (solrs.size() == 1)) {
index = solrs.get(0);
}
}
return index;
} | java | public static final CmsSolrIndex getIndexSolr(CmsObject cms, Map<String, String[]> params) {
String indexName = null;
CmsSolrIndex index = null;
// try to get the index name from the parameters: 'core' or 'index'
if (params != null) {
indexName = params.get(OpenCmsSolrHandler.PARAM_CORE) != null
? params.get(OpenCmsSolrHandler.PARAM_CORE)[0]
: (params.get(OpenCmsSolrHandler.PARAM_INDEX) != null
? params.get(OpenCmsSolrHandler.PARAM_INDEX)[0]
: null);
}
if (indexName == null) {
// if no parameter is specified try to use the default online/offline indexes by context
indexName = cms.getRequestContext().getCurrentProject().isOnlineProject()
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
: CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE;
}
// try to get the index
index = indexName != null ? OpenCms.getSearchManager().getIndexSolr(indexName) : null;
if (index == null) {
// if there is exactly one index, a missing core / index parameter doesn't matter, since there is no choice.
List<CmsSolrIndex> solrs = OpenCms.getSearchManager().getAllSolrIndexes();
if ((solrs != null) && !solrs.isEmpty() && (solrs.size() == 1)) {
index = solrs.get(0);
}
}
return index;
} | [
"public",
"static",
"final",
"CmsSolrIndex",
"getIndexSolr",
"(",
"CmsObject",
"cms",
",",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"params",
")",
"{",
"String",
"indexName",
"=",
"null",
";",
"CmsSolrIndex",
"index",
"=",
"null",
";",
"// try t... | Returns the Solr index configured with the parameters name.
The parameters must contain a key/value pair with an existing
Solr index, otherwise <code>null</code> is returned.<p>
@param cms the current context
@param params the parameter map
@return the best matching Solr index | [
"Returns",
"the",
"Solr",
"index",
"configured",
"with",
"the",
"parameters",
"name",
".",
"The",
"parameters",
"must",
"contain",
"a",
"key",
"/",
"value",
"pair",
"with",
"an",
"existing",
"Solr",
"index",
"otherwise",
"<code",
">",
"null<",
"/",
"code",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchManager.java#L802-L830 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsImageGalleryField.java | CmsImageGalleryField.setValue | @Override
public void setValue(String value, boolean fireEvent) {
value = parseValue(value);
m_textbox.setValue(value);
if (fireEvent) {
fireChange(true);
}
} | java | @Override
public void setValue(String value, boolean fireEvent) {
value = parseValue(value);
m_textbox.setValue(value);
if (fireEvent) {
fireChange(true);
}
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"String",
"value",
",",
"boolean",
"fireEvent",
")",
"{",
"value",
"=",
"parseValue",
"(",
"value",
")",
";",
"m_textbox",
".",
"setValue",
"(",
"value",
")",
";",
"if",
"(",
"fireEvent",
")",
"{",
"f... | Sets the widget value.<p>
@param value the value to set
@param fireEvent if the change event should be fired | [
"Sets",
"the",
"widget",
"value",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsImageGalleryField.java#L206-L214 |
facebookarchive/swift | swift-generator/src/main/java/com/facebook/swift/generator/swift2thrift/Swift2ThriftGenerator.java | Swift2ThriftGenerator.verifyTypes | private boolean verifyTypes()
{
SuccessAndResult<ThriftType> output = topologicalSort(thriftTypes, new Predicate<ThriftType>()
{
@Override
public boolean apply(@Nullable ThriftType t)
{
ThriftProtocolType proto = checkNotNull(t).getProtocolType();
if (proto == ThriftProtocolType.ENUM || proto == ThriftProtocolType.STRUCT) {
return verifyStruct(t, true);
} else {
Preconditions.checkState(false, "Top-level non-enum and non-struct?");
return false; // silence compiler
}
}
});
if (output.success) {
thriftTypes = output.result;
return true;
} else {
for (ThriftType t: output.result) {
// we know it's gonna fail, we just want the precise error message
verifyStruct(t, false);
}
return false;
}
} | java | private boolean verifyTypes()
{
SuccessAndResult<ThriftType> output = topologicalSort(thriftTypes, new Predicate<ThriftType>()
{
@Override
public boolean apply(@Nullable ThriftType t)
{
ThriftProtocolType proto = checkNotNull(t).getProtocolType();
if (proto == ThriftProtocolType.ENUM || proto == ThriftProtocolType.STRUCT) {
return verifyStruct(t, true);
} else {
Preconditions.checkState(false, "Top-level non-enum and non-struct?");
return false; // silence compiler
}
}
});
if (output.success) {
thriftTypes = output.result;
return true;
} else {
for (ThriftType t: output.result) {
// we know it's gonna fail, we just want the precise error message
verifyStruct(t, false);
}
return false;
}
} | [
"private",
"boolean",
"verifyTypes",
"(",
")",
"{",
"SuccessAndResult",
"<",
"ThriftType",
">",
"output",
"=",
"topologicalSort",
"(",
"thriftTypes",
",",
"new",
"Predicate",
"<",
"ThriftType",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",... | and does a topological sort of thriftTypes in dependency order | [
"and",
"does",
"a",
"topological",
"sort",
"of",
"thriftTypes",
"in",
"dependency",
"order"
] | train | https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-generator/src/main/java/com/facebook/swift/generator/swift2thrift/Swift2ThriftGenerator.java#L211-L237 |
jclawson/jackson-dataformat-hocon | src/main/java/com/jasonclawson/jackson/dataformat/hocon/HoconFactory.java | HoconFactory.createParser | @SuppressWarnings("resource")
@Override
public HoconTreeTraversingParser createParser(String content)
throws IOException, JsonParseException
{
Reader r = new StringReader(content);
IOContext ctxt = _createContext(r, true); // true->own, can close
// [JACKSON-512]: allow wrapping with InputDecorator
if (_inputDecorator != null) {
r = _inputDecorator.decorate(ctxt, r);
}
return _createParser(r, ctxt);
} | java | @SuppressWarnings("resource")
@Override
public HoconTreeTraversingParser createParser(String content)
throws IOException, JsonParseException
{
Reader r = new StringReader(content);
IOContext ctxt = _createContext(r, true); // true->own, can close
// [JACKSON-512]: allow wrapping with InputDecorator
if (_inputDecorator != null) {
r = _inputDecorator.decorate(ctxt, r);
}
return _createParser(r, ctxt);
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"@",
"Override",
"public",
"HoconTreeTraversingParser",
"createParser",
"(",
"String",
"content",
")",
"throws",
"IOException",
",",
"JsonParseException",
"{",
"Reader",
"r",
"=",
"new",
"StringReader",
"(",
"conten... | /*
********************************************************
/* Overridden parser factory methods (for 2.1)
******************************************************** | [
"/",
"*",
"********************************************************",
"/",
"*",
"Overridden",
"parser",
"factory",
"methods",
"(",
"for",
"2",
".",
"1",
")",
"********************************************************"
] | train | https://github.com/jclawson/jackson-dataformat-hocon/blob/32149c89f5f9288ce6860f87e7bf55acea03cdbf/src/main/java/com/jasonclawson/jackson/dataformat/hocon/HoconFactory.java#L145-L157 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseInvokeExpression | private Expr parseInvokeExpression(EnclosingScope scope, int start, Identifier name, boolean terminated,
Tuple<? extends SyntacticItem> templateArguments) {
// First, parse the arguments to this invocation.
Tuple<Expr> args = parseInvocationArguments(scope);
// Second, determine what kind of invocation we have. If the name of the
// method is a local variable, then it must be an indirect invocation on
// this variable.
if (scope.isVariable(name)) {
// Indirect invocation on local variable. In this case, template arguments must
// only be lifetimes.
for(int i=0;i!=templateArguments.size();++i) {
SyntacticItem targ = templateArguments.get(i);
if (!(targ instanceof Identifier)) {
// anything other that lifetime not OK.
syntaxError("expected lifetime identifier", targ);
}
}
Tuple<Identifier> lifetimes = (Tuple<Identifier>) templateArguments;
Decl.Variable decl = scope.getVariableDeclaration(name);
Expr.VariableAccess var = annotateSourceLocation(new Expr.VariableAccess(Type.Void, decl), start);
return annotateSourceLocation(new Expr.IndirectInvoke(Type.Void, var, lifetimes, args), start);
} else {
// unqualified direct invocation
Name nm = annotateSourceLocation(new Name(name), start, start);
Decl.Link<Decl.Callable> link = new Decl.Link(nm);
return annotateSourceLocation(new Expr.Invoke(new Decl.Binding<>(link, templateArguments), args), start);
}
} | java | private Expr parseInvokeExpression(EnclosingScope scope, int start, Identifier name, boolean terminated,
Tuple<? extends SyntacticItem> templateArguments) {
// First, parse the arguments to this invocation.
Tuple<Expr> args = parseInvocationArguments(scope);
// Second, determine what kind of invocation we have. If the name of the
// method is a local variable, then it must be an indirect invocation on
// this variable.
if (scope.isVariable(name)) {
// Indirect invocation on local variable. In this case, template arguments must
// only be lifetimes.
for(int i=0;i!=templateArguments.size();++i) {
SyntacticItem targ = templateArguments.get(i);
if (!(targ instanceof Identifier)) {
// anything other that lifetime not OK.
syntaxError("expected lifetime identifier", targ);
}
}
Tuple<Identifier> lifetimes = (Tuple<Identifier>) templateArguments;
Decl.Variable decl = scope.getVariableDeclaration(name);
Expr.VariableAccess var = annotateSourceLocation(new Expr.VariableAccess(Type.Void, decl), start);
return annotateSourceLocation(new Expr.IndirectInvoke(Type.Void, var, lifetimes, args), start);
} else {
// unqualified direct invocation
Name nm = annotateSourceLocation(new Name(name), start, start);
Decl.Link<Decl.Callable> link = new Decl.Link(nm);
return annotateSourceLocation(new Expr.Invoke(new Decl.Binding<>(link, templateArguments), args), start);
}
} | [
"private",
"Expr",
"parseInvokeExpression",
"(",
"EnclosingScope",
"scope",
",",
"int",
"start",
",",
"Identifier",
"name",
",",
"boolean",
"terminated",
",",
"Tuple",
"<",
"?",
"extends",
"SyntacticItem",
">",
"templateArguments",
")",
"{",
"// First, parse the arg... | Parse an invocation expression, which has the form:
<pre>
InvokeExpr::= Identifier '(' [ Expr (',' Expr)* ] ')'
</pre>
Observe that this when this function is called, we're assuming that the
identifier and opening brace has already been matched.
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@param terminated
This indicates that the expression is known to be terminated
(or not). An expression that's known to be terminated is one
which is guaranteed to be followed by something. This is
important because it means that we can ignore any newline
characters encountered in parsing this expression, and that
we'll never overrun the end of the expression (i.e. because
there's guaranteed to be something which terminates this
expression). A classic situation where terminated is true is
when parsing an expression surrounded in braces. In such case,
we know the right-brace will always terminate this expression.
@return | [
"Parse",
"an",
"invocation",
"expression",
"which",
"has",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L2961-L2988 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/chrono/Symmetry454Chronology.java | Symmetry454Chronology.dateYearDay | @Override
public Symmetry454Date dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | java | @Override
public Symmetry454Date dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | [
"@",
"Override",
"public",
"Symmetry454Date",
"dateYearDay",
"(",
"Era",
"era",
",",
"int",
"yearOfEra",
",",
"int",
"dayOfYear",
")",
"{",
"return",
"dateYearDay",
"(",
"prolepticYear",
"(",
"era",
",",
"yearOfEra",
")",
",",
"dayOfYear",
")",
";",
"}"
] | Obtains a local date in Symmetry454 calendar system from the
era, year-of-era and day-of-year fields.
@param era the Symmetry454 era, not null
@param yearOfEra the year-of-era
@param dayOfYear the day-of-year
@return the Symmetry454 local date, not null
@throws DateTimeException if unable to create the date
@throws ClassCastException if the {@code era} is not a {@code IsoEra} | [
"Obtains",
"a",
"local",
"date",
"in",
"Symmetry454",
"calendar",
"system",
"from",
"the",
"era",
"year",
"-",
"of",
"-",
"era",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/Symmetry454Chronology.java#L280-L283 |
crawljax/crawljax | core/src/main/java/com/crawljax/stateabstractions/dom/RTED/RTED_InfoTree_Opt.java | RTED_InfoTree_Opt.nonNormalizedTreeDist | public double nonNormalizedTreeDist(LblTree t1, LblTree t2) {
init(t1, t2);
STR = new int[size1][size2];
computeOptimalStrategy();
return computeDistUsingStrArray(it1, it2);
} | java | public double nonNormalizedTreeDist(LblTree t1, LblTree t2) {
init(t1, t2);
STR = new int[size1][size2];
computeOptimalStrategy();
return computeDistUsingStrArray(it1, it2);
} | [
"public",
"double",
"nonNormalizedTreeDist",
"(",
"LblTree",
"t1",
",",
"LblTree",
"t2",
")",
"{",
"init",
"(",
"t1",
",",
"t2",
")",
";",
"STR",
"=",
"new",
"int",
"[",
"size1",
"]",
"[",
"size2",
"]",
";",
"computeOptimalStrategy",
"(",
")",
";",
"... | Computes the tree edit distance between trees t1 and t2.
@param t1
@param t2
@return tree edit distance between trees t1 and t2 | [
"Computes",
"the",
"tree",
"edit",
"distance",
"between",
"trees",
"t1",
"and",
"t2",
"."
] | train | https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/stateabstractions/dom/RTED/RTED_InfoTree_Opt.java#L100-L105 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.angleBetween3D | public static double angleBetween3D( Coordinate c1, Coordinate c2, Coordinate c3 ) {
double a = distance3d(c2, c1, null);
double b = distance3d(c2, c3, null);
double c = distance3d(c1, c3, null);
double angleInTriangle = getAngleInTriangle(a, b, c);
double degrees = toDegrees(angleInTriangle);
return degrees;
} | java | public static double angleBetween3D( Coordinate c1, Coordinate c2, Coordinate c3 ) {
double a = distance3d(c2, c1, null);
double b = distance3d(c2, c3, null);
double c = distance3d(c1, c3, null);
double angleInTriangle = getAngleInTriangle(a, b, c);
double degrees = toDegrees(angleInTriangle);
return degrees;
} | [
"public",
"static",
"double",
"angleBetween3D",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
",",
"Coordinate",
"c3",
")",
"{",
"double",
"a",
"=",
"distance3d",
"(",
"c2",
",",
"c1",
",",
"null",
")",
";",
"double",
"b",
"=",
"distance3d",
"(",
"... | Calculates the angle in degrees between 3 3D coordinates.
<p>The calculated angle is the one placed in vertex c2.</p>
@param c1 first 3D point.
@param c2 central 3D point.
@param c3 last 3D point.
@return the angle between the coordinates in degrees. | [
"Calculates",
"the",
"angle",
"in",
"degrees",
"between",
"3",
"3D",
"coordinates",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L852-L860 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerFrontendIPConfigurationsInner.java | LoadBalancerFrontendIPConfigurationsInner.listAsync | public Observable<Page<FrontendIPConfigurationInner>> listAsync(final String resourceGroupName, final String loadBalancerName) {
return listWithServiceResponseAsync(resourceGroupName, loadBalancerName)
.map(new Func1<ServiceResponse<Page<FrontendIPConfigurationInner>>, Page<FrontendIPConfigurationInner>>() {
@Override
public Page<FrontendIPConfigurationInner> call(ServiceResponse<Page<FrontendIPConfigurationInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<FrontendIPConfigurationInner>> listAsync(final String resourceGroupName, final String loadBalancerName) {
return listWithServiceResponseAsync(resourceGroupName, loadBalancerName)
.map(new Func1<ServiceResponse<Page<FrontendIPConfigurationInner>>, Page<FrontendIPConfigurationInner>>() {
@Override
public Page<FrontendIPConfigurationInner> call(ServiceResponse<Page<FrontendIPConfigurationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"FrontendIPConfigurationInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"loadBalancerName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Gets all the load balancer frontend IP configurations.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FrontendIPConfigurationInner> object | [
"Gets",
"all",
"the",
"load",
"balancer",
"frontend",
"IP",
"configurations",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerFrontendIPConfigurationsInner.java#L123-L131 |
m-m-m/util | event/src/main/java/net/sf/mmm/util/event/base/AbstractEventSource.java | AbstractEventSource.handleListenerError | protected void handleListenerError(L listener, E event, Throwable error) {
LOG.debug("The listener (" + listener + ") failed to handle event (" + event + "):", error);
} | java | protected void handleListenerError(L listener, E event, Throwable error) {
LOG.debug("The listener (" + listener + ") failed to handle event (" + event + "):", error);
} | [
"protected",
"void",
"handleListenerError",
"(",
"L",
"listener",
",",
"E",
"event",
",",
"Throwable",
"error",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"The listener (\"",
"+",
"listener",
"+",
"\") failed to handle event (\"",
"+",
"event",
"+",
"\"):\"",
",",
... | This method is called if a listener throws something while handling an event. <br>
The default implementation is log the error. Override this method to change the behaviour (e.g. ignore the problem,
remove the "evil" listener, throw the error anyways).
@param listener is the listener that caused the error.
@param event is the event that could not be handled.
@param error is the throwable caused by the {@code listener} while handling the {@code event}. | [
"This",
"method",
"is",
"called",
"if",
"a",
"listener",
"throws",
"something",
"while",
"handling",
"an",
"event",
".",
"<br",
">",
"The",
"default",
"implementation",
"is",
"log",
"the",
"error",
".",
"Override",
"this",
"method",
"to",
"change",
"the",
... | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/event/src/main/java/net/sf/mmm/util/event/base/AbstractEventSource.java#L103-L106 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/BlockTableBox.java | BlockTableBox.organizeContent | private void organizeContent()
{
table = new TableBox(el, g, ctx);
table.adoptParent(this);
table.setStyle(style);
for (Iterator<Box> it = nested.iterator(); it.hasNext(); )
{
Box box = it.next();
if (box instanceof TableCaptionBox)
{
caption = (TableCaptionBox) box;
}
else if (box instanceof BlockBox && ((BlockBox) box).isPositioned())
{
//positioned boxes are ignored
}
else //other elements belong to the table itself
{
table.addSubBox(box);
box.setContainingBlockBox(table);
box.setParent(table);
it.remove();
endChild--;
}
}
addSubBox(table);
} | java | private void organizeContent()
{
table = new TableBox(el, g, ctx);
table.adoptParent(this);
table.setStyle(style);
for (Iterator<Box> it = nested.iterator(); it.hasNext(); )
{
Box box = it.next();
if (box instanceof TableCaptionBox)
{
caption = (TableCaptionBox) box;
}
else if (box instanceof BlockBox && ((BlockBox) box).isPositioned())
{
//positioned boxes are ignored
}
else //other elements belong to the table itself
{
table.addSubBox(box);
box.setContainingBlockBox(table);
box.setParent(table);
it.remove();
endChild--;
}
}
addSubBox(table);
} | [
"private",
"void",
"organizeContent",
"(",
")",
"{",
"table",
"=",
"new",
"TableBox",
"(",
"el",
",",
"g",
",",
"ctx",
")",
";",
"table",
".",
"adoptParent",
"(",
"this",
")",
";",
"table",
".",
"setStyle",
"(",
"style",
")",
";",
"for",
"(",
"Iter... | Goes through the list of child boxes and organizes them into captions, header,
footer, etc. | [
"Goes",
"through",
"the",
"list",
"of",
"child",
"boxes",
"and",
"organizes",
"them",
"into",
"captions",
"header",
"footer",
"etc",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/BlockTableBox.java#L269-L297 |
actframework/actframework | src/main/java/act/crypto/AppCrypto.java | AppCrypto.passwordHash | public char[] passwordHash(char[] password) {
if (null == password) {
return null;
}
return BCrypt.hashpw(password, BCrypt.gensalt());
} | java | public char[] passwordHash(char[] password) {
if (null == password) {
return null;
}
return BCrypt.hashpw(password, BCrypt.gensalt());
} | [
"public",
"char",
"[",
"]",
"passwordHash",
"(",
"char",
"[",
"]",
"password",
")",
"{",
"if",
"(",
"null",
"==",
"password",
")",
"{",
"return",
"null",
";",
"}",
"return",
"BCrypt",
".",
"hashpw",
"(",
"password",
",",
"BCrypt",
".",
"gensalt",
"("... | Generate crypted hash of given password. This method is more secure than
{@link #passwordHash(String)} as it will fill the password char array
with `\0` once used.
See <a href="http://stackoverflow.com/questions/8881291/why-is-char-preferred-over-string-for-passwords-in-java">This SO for more detail</a>
@param password the password
@return the password hash | [
"Generate",
"crypted",
"hash",
"of",
"given",
"password",
".",
"This",
"method",
"is",
"more",
"secure",
"than",
"{",
"@link",
"#passwordHash",
"(",
"String",
")",
"}",
"as",
"it",
"will",
"fill",
"the",
"password",
"char",
"array",
"with",
"\\",
"0",
"o... | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/crypto/AppCrypto.java#L69-L74 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/detect/FindInconsistentSync2.java | FindInconsistentSync2.isGetterMethod | public static boolean isGetterMethod(ClassContext classContext, Method method) {
MethodGen methodGen = classContext.getMethodGen(method);
if (methodGen == null) {
return false;
}
InstructionList il = methodGen.getInstructionList();
// System.out.println("Checking getter method: " + method.getName());
if (il.getLength() > 60) {
return false;
}
int count = 0;
Iterator<InstructionHandle> it = il.iterator();
while (it.hasNext()) {
InstructionHandle ih = it.next();
switch (ih.getInstruction().getOpcode()) {
case Const.GETFIELD:
count++;
if (count > 1) {
return false;
}
break;
case Const.PUTFIELD:
case Const.BALOAD:
case Const.CALOAD:
case Const.DALOAD:
case Const.FALOAD:
case Const.IALOAD:
case Const.LALOAD:
case Const.SALOAD:
case Const.AALOAD:
case Const.BASTORE:
case Const.CASTORE:
case Const.DASTORE:
case Const.FASTORE:
case Const.IASTORE:
case Const.LASTORE:
case Const.SASTORE:
case Const.AASTORE:
case Const.PUTSTATIC:
return false;
case Const.INVOKESTATIC:
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE:
case Const.INVOKESPECIAL:
case Const.GETSTATIC:
// no-op
}
}
// System.out.println("Found getter method: " + method.getName());
return true;
} | java | public static boolean isGetterMethod(ClassContext classContext, Method method) {
MethodGen methodGen = classContext.getMethodGen(method);
if (methodGen == null) {
return false;
}
InstructionList il = methodGen.getInstructionList();
// System.out.println("Checking getter method: " + method.getName());
if (il.getLength() > 60) {
return false;
}
int count = 0;
Iterator<InstructionHandle> it = il.iterator();
while (it.hasNext()) {
InstructionHandle ih = it.next();
switch (ih.getInstruction().getOpcode()) {
case Const.GETFIELD:
count++;
if (count > 1) {
return false;
}
break;
case Const.PUTFIELD:
case Const.BALOAD:
case Const.CALOAD:
case Const.DALOAD:
case Const.FALOAD:
case Const.IALOAD:
case Const.LALOAD:
case Const.SALOAD:
case Const.AALOAD:
case Const.BASTORE:
case Const.CASTORE:
case Const.DASTORE:
case Const.FASTORE:
case Const.IASTORE:
case Const.LASTORE:
case Const.SASTORE:
case Const.AASTORE:
case Const.PUTSTATIC:
return false;
case Const.INVOKESTATIC:
case Const.INVOKEVIRTUAL:
case Const.INVOKEINTERFACE:
case Const.INVOKESPECIAL:
case Const.GETSTATIC:
// no-op
}
}
// System.out.println("Found getter method: " + method.getName());
return true;
} | [
"public",
"static",
"boolean",
"isGetterMethod",
"(",
"ClassContext",
"classContext",
",",
"Method",
"method",
")",
"{",
"MethodGen",
"methodGen",
"=",
"classContext",
".",
"getMethodGen",
"(",
"method",
")",
";",
"if",
"(",
"methodGen",
"==",
"null",
")",
"{"... | Determine whether or not the the given method is a getter method. I.e.,
if it just returns the value of an instance field.
@param classContext
the ClassContext for the class containing the method
@param method
the method | [
"Determine",
"whether",
"or",
"not",
"the",
"the",
"given",
"method",
"is",
"a",
"getter",
"method",
".",
"I",
".",
"e",
".",
"if",
"it",
"just",
"returns",
"the",
"value",
"of",
"an",
"instance",
"field",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/detect/FindInconsistentSync2.java#L813-L865 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java | PluginAdapterUtility.configureObjectFieldsWithProperties | public static Map<String, Object> configureObjectFieldsWithProperties(
final Object object,
final Map<String, Object> inputConfig
)
{
return configureObjectFieldsWithProperties(object, buildFieldProperties(object), inputConfig);
} | java | public static Map<String, Object> configureObjectFieldsWithProperties(
final Object object,
final Map<String, Object> inputConfig
)
{
return configureObjectFieldsWithProperties(object, buildFieldProperties(object), inputConfig);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"configureObjectFieldsWithProperties",
"(",
"final",
"Object",
"object",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"inputConfig",
")",
"{",
"return",
"configureObjectFieldsWithProperties",
... | Set field values on an object using introspection and input values for those properties
@param object object
@param inputConfig input
@return Map of resolved properties that were not configured in the object's fields | [
"Set",
"field",
"values",
"on",
"an",
"object",
"using",
"introspection",
"and",
"input",
"values",
"for",
"those",
"properties"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java#L380-L386 |
apache/incubator-gobblin | gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveRegistrationUnitComparator.java | HiveRegistrationUnitComparator.checkExistingIsSuperset | protected <E> void checkExistingIsSuperset(Set<E> existingSet, Set<E> newSet) {
this.result |= !existingSet.containsAll(newSet);
} | java | protected <E> void checkExistingIsSuperset(Set<E> existingSet, Set<E> newSet) {
this.result |= !existingSet.containsAll(newSet);
} | [
"protected",
"<",
"E",
">",
"void",
"checkExistingIsSuperset",
"(",
"Set",
"<",
"E",
">",
"existingSet",
",",
"Set",
"<",
"E",
">",
"newSet",
")",
"{",
"this",
".",
"result",
"|=",
"!",
"existingSet",
".",
"containsAll",
"(",
"newSet",
")",
";",
"}"
] | Compare an existing state and a new {@link Set} to ensure that the existing {@link Set} contains all entries in the new
{@link Set}, and update {@link #result} accordingly. | [
"Compare",
"an",
"existing",
"state",
"and",
"a",
"new",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveRegistrationUnitComparator.java#L197-L199 |
mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/MultiPoint.java | MultiPoint.fromLngLats | public static MultiPoint fromLngLats(@NonNull List<Point> points) {
return new MultiPoint(TYPE, null, points);
} | java | public static MultiPoint fromLngLats(@NonNull List<Point> points) {
return new MultiPoint(TYPE, null, points);
} | [
"public",
"static",
"MultiPoint",
"fromLngLats",
"(",
"@",
"NonNull",
"List",
"<",
"Point",
">",
"points",
")",
"{",
"return",
"new",
"MultiPoint",
"(",
"TYPE",
",",
"null",
",",
"points",
")",
";",
"}"
] | Create a new instance of this class by defining a list of {@link Point}s which follow the
correct specifications described in the Point documentation. Note that there should not be any
duplicate points inside the list. <p> Note that if less than 2 points are passed in, a runtime
exception will occur. </p>
@param points a list of {@link Point}s which make up the LineString geometry
@return a new instance of this class defined by the values passed inside this static factory
method
@since 3.0.0 | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"defining",
"a",
"list",
"of",
"{",
"@link",
"Point",
"}",
"s",
"which",
"follow",
"the",
"correct",
"specifications",
"described",
"in",
"the",
"Point",
"documentation",
".",
"Note",
"that",
"... | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/MultiPoint.java#L77-L79 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/JTrees.java | JTrees.applyButtonTreeCellRenderer | public static void applyButtonTreeCellRenderer(JTree tree,
Function<Object, JButton> buttonFactory,
Function<Object, String> textFactory)
{
TreeCellRenderer treeCellrenderer = new GenericTreeCellRenderer()
{
@Override
protected void prepare(Object nodeObject, JPanel container)
{
container.setLayout(new BorderLayout(3, 0));
JLabel textLabel = new JLabel();
String text = textFactory.apply(nodeObject);
textLabel.setText(text);
container.add(textLabel, BorderLayout.CENTER);
JButton button = buttonFactory.apply(nodeObject);
if (button != null)
{
container.add(button, BorderLayout.WEST);
}
}
};
tree.setCellRenderer(treeCellrenderer);
tree.setEditable(true);
DefaultCellEditor editor = new DefaultCellEditor(new JTextField())
{
/**
* Serial UID
*/
private static final long serialVersionUID = 1L;
@Override
public Component getTreeCellEditorComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row)
{
return treeCellrenderer.getTreeCellRendererComponent(
tree, value, selected, expanded, leaf, row, true);
}
@Override
public boolean isCellEditable(EventObject event)
{
return true;
}
};
tree.setCellEditor(editor);
} | java | public static void applyButtonTreeCellRenderer(JTree tree,
Function<Object, JButton> buttonFactory,
Function<Object, String> textFactory)
{
TreeCellRenderer treeCellrenderer = new GenericTreeCellRenderer()
{
@Override
protected void prepare(Object nodeObject, JPanel container)
{
container.setLayout(new BorderLayout(3, 0));
JLabel textLabel = new JLabel();
String text = textFactory.apply(nodeObject);
textLabel.setText(text);
container.add(textLabel, BorderLayout.CENTER);
JButton button = buttonFactory.apply(nodeObject);
if (button != null)
{
container.add(button, BorderLayout.WEST);
}
}
};
tree.setCellRenderer(treeCellrenderer);
tree.setEditable(true);
DefaultCellEditor editor = new DefaultCellEditor(new JTextField())
{
/**
* Serial UID
*/
private static final long serialVersionUID = 1L;
@Override
public Component getTreeCellEditorComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row)
{
return treeCellrenderer.getTreeCellRendererComponent(
tree, value, selected, expanded, leaf, row, true);
}
@Override
public boolean isCellEditable(EventObject event)
{
return true;
}
};
tree.setCellEditor(editor);
} | [
"public",
"static",
"void",
"applyButtonTreeCellRenderer",
"(",
"JTree",
"tree",
",",
"Function",
"<",
"Object",
",",
"JButton",
">",
"buttonFactory",
",",
"Function",
"<",
"Object",
",",
"String",
">",
"textFactory",
")",
"{",
"TreeCellRenderer",
"treeCellrendere... | Apply a cell renderer to the given tree that will create cells that
consist of a button and a label, based on
a {@link GenericTreeCellRenderer}.<br>
<br>
An editor will be installed for the tree, making the buttons
clickable.<br>
<br>
Some details about the exact layout of the cells are intentionally
not specified.
@param tree The tree
@param buttonFactory The factory that will receive the tree node,
and return the JButton (to which listeners may already have been
attached). If this function returns <code>null</code>, then no
button will be inserted.
@param textFactory The factory that will receive the tree node,
and return the text that should be displayed as the node label. | [
"Apply",
"a",
"cell",
"renderer",
"to",
"the",
"given",
"tree",
"that",
"will",
"create",
"cells",
"that",
"consist",
"of",
"a",
"button",
"and",
"a",
"label",
"based",
"on",
"a",
"{",
"@link",
"GenericTreeCellRenderer",
"}",
".",
"<br",
">",
"<br",
">",... | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTrees.java#L653-L699 |
arnaudroger/SimpleFlatMapper | sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/DiscriminatorJdbcBuilder.java | DiscriminatorJdbcBuilder.when | public DiscriminatorJdbcSubBuilder when(String value, TypeReference<? extends T> type) {
return when(value, type.getType());
} | java | public DiscriminatorJdbcSubBuilder when(String value, TypeReference<? extends T> type) {
return when(value, type.getType());
} | [
"public",
"DiscriminatorJdbcSubBuilder",
"when",
"(",
"String",
"value",
",",
"TypeReference",
"<",
"?",
"extends",
"T",
">",
"type",
")",
"{",
"return",
"when",
"(",
"value",
",",
"type",
".",
"getType",
"(",
")",
")",
";",
"}"
] | Add a discriminator value with its associated type specified by the type reference.
@param value the value
@param type the type reference
@return the current builder | [
"Add",
"a",
"discriminator",
"value",
"with",
"its",
"associated",
"type",
"specified",
"by",
"the",
"type",
"reference",
"."
] | train | https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/DiscriminatorJdbcBuilder.java#L77-L79 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/ViewpointsAndPerspectivesDocumentationTemplate.java | ViewpointsAndPerspectivesDocumentationTemplate.addAppendicesSection | public Section addAppendicesSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Appendices", files);
} | java | public Section addAppendicesSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Appendices", files);
} | [
"public",
"Section",
"addAppendicesSection",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"addSection",
"(",
"softwareSystem",
",",
"\"Appendices\"",
",",
"files",
")",
";",
"}"
] | Adds an "Appendices" section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files | [
"Adds",
"an",
"Appendices",
"section",
"relating",
"to",
"a",
"{",
"@link",
"SoftwareSystem",
"}",
"from",
"one",
"or",
"more",
"files",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/ViewpointsAndPerspectivesDocumentationTemplate.java#L188-L190 |
Stratio/stratio-cassandra | src/java/com/stratio/cassandra/contrib/ComparatorChain.java | ComparatorChain.addComparator | public void addComparator(Comparator<T> comparator, boolean reverse) {
checkLocked();
comparatorChain.add(comparator);
if (reverse == true) {
orderingBits.set(comparatorChain.size() - 1);
}
} | java | public void addComparator(Comparator<T> comparator, boolean reverse) {
checkLocked();
comparatorChain.add(comparator);
if (reverse == true) {
orderingBits.set(comparatorChain.size() - 1);
}
} | [
"public",
"void",
"addComparator",
"(",
"Comparator",
"<",
"T",
">",
"comparator",
",",
"boolean",
"reverse",
")",
"{",
"checkLocked",
"(",
")",
";",
"comparatorChain",
".",
"add",
"(",
"comparator",
")",
";",
"if",
"(",
"reverse",
"==",
"true",
")",
"{"... | Add a Comparator to the end of the chain using the given sortFields order
@param comparator Comparator to add to the end of the chain
@param reverse false = forward sortFields order; true = reverse sortFields order | [
"Add",
"a",
"Comparator",
"to",
"the",
"end",
"of",
"the",
"chain",
"using",
"the",
"given",
"sortFields",
"order"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/contrib/ComparatorChain.java#L135-L142 |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/api/impl/AnnotatedExtensions.java | AnnotatedExtensions.findMethod | public static Method findMethod(String name, Class<?> cls) {
for(Method method : cls.getDeclaredMethods()) {
if(method.getName().equals(name)) {
return method;
}
}
throw new ExecutionException("invalid auto-function: no '" + name + "' method declared", null);
} | java | public static Method findMethod(String name, Class<?> cls) {
for(Method method : cls.getDeclaredMethods()) {
if(method.getName().equals(name)) {
return method;
}
}
throw new ExecutionException("invalid auto-function: no '" + name + "' method declared", null);
} | [
"public",
"static",
"Method",
"findMethod",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"for",
"(",
"Method",
"method",
":",
"cls",
".",
"getDeclaredMethods",
"(",
")",
")",
"{",
"if",
"(",
"method",
".",
"getName",
"(",
")",... | Finds a named declared method on the given class.
@param name Name of declared method to retrieve
@param cls Class to retrieve method from
@return Named method on class | [
"Finds",
"a",
"named",
"declared",
"method",
"on",
"the",
"given",
"class",
"."
] | train | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/api/impl/AnnotatedExtensions.java#L57-L66 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPFriendlyURLEntryUtil.java | CPFriendlyURLEntryUtil.removeByUUID_G | public static CPFriendlyURLEntry removeByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.product.exception.NoSuchCPFriendlyURLEntryException {
return getPersistence().removeByUUID_G(uuid, groupId);
} | java | public static CPFriendlyURLEntry removeByUUID_G(String uuid, long groupId)
throws com.liferay.commerce.product.exception.NoSuchCPFriendlyURLEntryException {
return getPersistence().removeByUUID_G(uuid, groupId);
} | [
"public",
"static",
"CPFriendlyURLEntry",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"com",
".",
"liferay",
".",
"commerce",
".",
"product",
".",
"exception",
".",
"NoSuchCPFriendlyURLEntryException",
"{",
"return",
"getPersisten... | Removes the cp friendly url entry where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the cp friendly url entry that was removed | [
"Removes",
"the",
"cp",
"friendly",
"url",
"entry",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPFriendlyURLEntryUtil.java#L316-L319 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/io/FormatUtil.java | FormatUtil.normalizePath | private static Path normalizePath(Path path) {
URI uri = path.toUri();
if (uri.getScheme() == null) {
try {
uri = new URI("file", uri.getHost(), uri.getPath(), uri.getFragment());
path = new Path(uri.toString());
} catch (URISyntaxException e) {
throw new IllegalArgumentException("path is invalid", e);
}
}
return path;
} | java | private static Path normalizePath(Path path) {
URI uri = path.toUri();
if (uri.getScheme() == null) {
try {
uri = new URI("file", uri.getHost(), uri.getPath(), uri.getFragment());
path = new Path(uri.toString());
} catch (URISyntaxException e) {
throw new IllegalArgumentException("path is invalid", e);
}
}
return path;
} | [
"private",
"static",
"Path",
"normalizePath",
"(",
"Path",
"path",
")",
"{",
"URI",
"uri",
"=",
"path",
".",
"toUri",
"(",
")",
";",
"if",
"(",
"uri",
".",
"getScheme",
"(",
")",
"==",
"null",
")",
"{",
"try",
"{",
"uri",
"=",
"new",
"URI",
"(",
... | Fixes the path if it denotes a local (relative) file without the proper protocol prefix. | [
"Fixes",
"the",
"path",
"if",
"it",
"denotes",
"a",
"local",
"(",
"relative",
")",
"file",
"without",
"the",
"proper",
"protocol",
"prefix",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/io/FormatUtil.java#L169-L180 |
dlemmermann/CalendarFX | CalendarFXRecurrence/src/main/java/com/google/ical/iter/Generators.java | Generators.serialDayGenerator | static Generator serialDayGenerator(
final int interval, final DateValue dtStart) {
return new Generator() {
int year, month, date;
/** ndays in the last month encountered */
int nDays;
{
// step back one interval
DTBuilder dtStartMinus1B = new DTBuilder(dtStart);
dtStartMinus1B.day -= interval;
DateValue dtStartMinus1 = dtStartMinus1B.toDate();
year = dtStartMinus1.year();
month = dtStartMinus1.month();
date = dtStartMinus1.day();
nDays = TimeUtils.monthLength(year, month);
}
@Override
boolean generate(DTBuilder builder) {
int ndate;
if (year == builder.year && month == builder.month) {
ndate = date + interval;
if (ndate > nDays) {
return false;
}
} else {
nDays = TimeUtils.monthLength(builder.year, builder.month);
if (interval != 1) {
// Calculate the number of days between the first of the new
// month andthe old date and extend it to make it an integer
// multiple of interval
int daysBetween = TimeUtils.daysBetween(
new DateValueImpl(builder.year, builder.month, 1),
new DateValueImpl(year, month, date));
ndate = ((interval - (daysBetween % interval)) % interval) + 1;
if (ndate > nDays) {
// need to early out without updating year or month so that the
// next time we enter, with a different month, the daysBetween
// call above compares against the proper last date
return false;
}
} else {
ndate = 1;
}
year = builder.year;
month = builder.month;
}
date = builder.day = ndate;
return true;
}
@Override
public String toString() {
return "serialDayGenerator:" + interval;
}
};
} | java | static Generator serialDayGenerator(
final int interval, final DateValue dtStart) {
return new Generator() {
int year, month, date;
/** ndays in the last month encountered */
int nDays;
{
// step back one interval
DTBuilder dtStartMinus1B = new DTBuilder(dtStart);
dtStartMinus1B.day -= interval;
DateValue dtStartMinus1 = dtStartMinus1B.toDate();
year = dtStartMinus1.year();
month = dtStartMinus1.month();
date = dtStartMinus1.day();
nDays = TimeUtils.monthLength(year, month);
}
@Override
boolean generate(DTBuilder builder) {
int ndate;
if (year == builder.year && month == builder.month) {
ndate = date + interval;
if (ndate > nDays) {
return false;
}
} else {
nDays = TimeUtils.monthLength(builder.year, builder.month);
if (interval != 1) {
// Calculate the number of days between the first of the new
// month andthe old date and extend it to make it an integer
// multiple of interval
int daysBetween = TimeUtils.daysBetween(
new DateValueImpl(builder.year, builder.month, 1),
new DateValueImpl(year, month, date));
ndate = ((interval - (daysBetween % interval)) % interval) + 1;
if (ndate > nDays) {
// need to early out without updating year or month so that the
// next time we enter, with a different month, the daysBetween
// call above compares against the proper last date
return false;
}
} else {
ndate = 1;
}
year = builder.year;
month = builder.month;
}
date = builder.day = ndate;
return true;
}
@Override
public String toString() {
return "serialDayGenerator:" + interval;
}
};
} | [
"static",
"Generator",
"serialDayGenerator",
"(",
"final",
"int",
"interval",
",",
"final",
"DateValue",
"dtStart",
")",
"{",
"return",
"new",
"Generator",
"(",
")",
"{",
"int",
"year",
",",
"month",
",",
"date",
";",
"/** ndays in the last month encountered */",
... | constructs a generator that generates every day in the current month that
is an integer multiple of interval days from dtStart. | [
"constructs",
"a",
"generator",
"that",
"generates",
"every",
"day",
"in",
"the",
"current",
"month",
"that",
"is",
"an",
"integer",
"multiple",
"of",
"interval",
"days",
"from",
"dtStart",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/iter/Generators.java#L147-L204 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.copyOfRange | public static <T> List<T> copyOfRange(final List<T> c, int from, final int to, final int step) {
N.checkFromToIndex(from < to ? from : (to == -1 ? 0 : to), from < to ? to : from, c.size());
if (step == 0) {
throw new IllegalArgumentException("The input parameter 'by' can not be zero");
}
if (from == to || from < to != step > 0) {
return new ArrayList<>();
}
if (step == 1) {
return copyOfRange(c, from, to);
}
from = from > to ? N.min(c.size() - 1, from) : from;
final int len = (to - from) / step + ((to - from) % step == 0 ? 0 : 1);
List<T> result = null;
if (c instanceof RandomAccess) {
result = new ArrayList<>(len);
for (int i = 0, j = from; i < len; i++, j += step) {
result.add(c.get(j));
}
} else {
final T[] a = (T[]) c.subList(from, to).toArray();
result = createList(N.copyOfRange(a, 0, a.length, step));
}
return result;
} | java | public static <T> List<T> copyOfRange(final List<T> c, int from, final int to, final int step) {
N.checkFromToIndex(from < to ? from : (to == -1 ? 0 : to), from < to ? to : from, c.size());
if (step == 0) {
throw new IllegalArgumentException("The input parameter 'by' can not be zero");
}
if (from == to || from < to != step > 0) {
return new ArrayList<>();
}
if (step == 1) {
return copyOfRange(c, from, to);
}
from = from > to ? N.min(c.size() - 1, from) : from;
final int len = (to - from) / step + ((to - from) % step == 0 ? 0 : 1);
List<T> result = null;
if (c instanceof RandomAccess) {
result = new ArrayList<>(len);
for (int i = 0, j = from; i < len; i++, j += step) {
result.add(c.get(j));
}
} else {
final T[] a = (T[]) c.subList(from, to).toArray();
result = createList(N.copyOfRange(a, 0, a.length, step));
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"copyOfRange",
"(",
"final",
"List",
"<",
"T",
">",
"c",
",",
"int",
"from",
",",
"final",
"int",
"to",
",",
"final",
"int",
"step",
")",
"{",
"N",
".",
"checkFromToIndex",
"(",
"from",
"<... | Copy all the elements in <code>original</code>, through <code>to</code>-<code>from</code>, by <code>step</code>.
@param c
@param from
@param to
@param step
@return | [
"Copy",
"all",
"the",
"elements",
"in",
"<code",
">",
"original<",
"/",
"code",
">",
"through",
"<code",
">",
"to<",
"/",
"code",
">",
"-",
"<code",
">",
"from<",
"/",
"code",
">",
"by",
"<code",
">",
"step<",
"/",
"code",
">",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L11021-L11052 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/DataDecoder.java | DataDecoder.decodeInt | public static int decodeInt(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
int value = (src[srcOffset] << 24) | ((src[srcOffset + 1] & 0xff) << 16) |
((src[srcOffset + 2] & 0xff) << 8) | (src[srcOffset + 3] & 0xff);
return value ^ 0x80000000;
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static int decodeInt(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
int value = (src[srcOffset] << 24) | ((src[srcOffset + 1] & 0xff) << 16) |
((src[srcOffset + 2] & 0xff) << 8) | (src[srcOffset + 3] & 0xff);
return value ^ 0x80000000;
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"int",
"decodeInt",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"int",
"value",
"=",
"(",
"src",
"[",
"srcOffset",
"]",
"<<",
"24",
")",
"|",
"(",
"(",
"src",
... | Decodes a signed integer from exactly 4 bytes.
@param src source of encoded bytes
@param srcOffset offset into source array
@return signed integer value | [
"Decodes",
"a",
"signed",
"integer",
"from",
"exactly",
"4",
"bytes",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L47-L57 |
urbanairship/datacube | src/main/java/com/urbanairship/datacube/backfill/HBaseBackfillMerger.java | HBaseBackfillMerger.truncateScan | private static final Scan truncateScan(Scan scan, byte[] rangeStart, byte[] rangeEnd) {
byte[] scanStart = scan.getStartRow();
byte[] scanEnd = scan.getStopRow();
if (scanEnd.length > 0 && bytesCompare(scanEnd, rangeStart) <= 0) {
// The entire scan range is before the entire cube key range
return null;
} else if (scanStart.length > 0 && bytesCompare(scanStart, rangeEnd) >= 0) {
// The entire scan range is after the entire cube key range
return null;
} else {
// Now we now that the scan range at least partially overlaps the cube key range.
Scan truncated;
try {
truncated = new Scan(scan); // make a copy, don't modify input scan
} catch (IOException e) {
throw new RuntimeException(); // This is not plausible
}
if (scanStart.length == 0 || bytesCompare(rangeStart, scanStart) > 0) {
// The scan includes extra keys at the beginning that are not part of the cube. Move
// the scan start point so that it only touches keys belonging to the cube.
truncated.setStartRow(rangeStart);
}
if (scanEnd.length == 0 || bytesCompare(rangeEnd, scanEnd) < 0) {
// The scan includes extra keys at the end that are not part of the cube. Move the
// scan end point so it only touches keys belonging to the cube.
truncated.setStopRow(rangeEnd);
}
return truncated;
}
} | java | private static final Scan truncateScan(Scan scan, byte[] rangeStart, byte[] rangeEnd) {
byte[] scanStart = scan.getStartRow();
byte[] scanEnd = scan.getStopRow();
if (scanEnd.length > 0 && bytesCompare(scanEnd, rangeStart) <= 0) {
// The entire scan range is before the entire cube key range
return null;
} else if (scanStart.length > 0 && bytesCompare(scanStart, rangeEnd) >= 0) {
// The entire scan range is after the entire cube key range
return null;
} else {
// Now we now that the scan range at least partially overlaps the cube key range.
Scan truncated;
try {
truncated = new Scan(scan); // make a copy, don't modify input scan
} catch (IOException e) {
throw new RuntimeException(); // This is not plausible
}
if (scanStart.length == 0 || bytesCompare(rangeStart, scanStart) > 0) {
// The scan includes extra keys at the beginning that are not part of the cube. Move
// the scan start point so that it only touches keys belonging to the cube.
truncated.setStartRow(rangeStart);
}
if (scanEnd.length == 0 || bytesCompare(rangeEnd, scanEnd) < 0) {
// The scan includes extra keys at the end that are not part of the cube. Move the
// scan end point so it only touches keys belonging to the cube.
truncated.setStopRow(rangeEnd);
}
return truncated;
}
} | [
"private",
"static",
"final",
"Scan",
"truncateScan",
"(",
"Scan",
"scan",
",",
"byte",
"[",
"]",
"rangeStart",
",",
"byte",
"[",
"]",
"rangeEnd",
")",
"{",
"byte",
"[",
"]",
"scanStart",
"=",
"scan",
".",
"getStartRow",
"(",
")",
";",
"byte",
"[",
"... | Given a scan and a key range, return a new Scan whose range is truncated to only include keys in
that range. Returns null if the Scan does not overlap the given range. | [
"Given",
"a",
"scan",
"and",
"a",
"key",
"range",
"return",
"a",
"new",
"Scan",
"whose",
"range",
"is",
"truncated",
"to",
"only",
"include",
"keys",
"in",
"that",
"range",
".",
"Returns",
"null",
"if",
"the",
"Scan",
"does",
"not",
"overlap",
"the",
"... | train | https://github.com/urbanairship/datacube/blob/89c6b68744cc384c8b49f921cdb0a0f9f414ada6/src/main/java/com/urbanairship/datacube/backfill/HBaseBackfillMerger.java#L199-L230 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java | CollectionNamingConfusion.visitField | @Override
public void visitField(Field obj) {
if (checkConfusedName(obj.getName(), obj.getSignature())) {
bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this).addField(this)
.addString(obj.getName()));
}
} | java | @Override
public void visitField(Field obj) {
if (checkConfusedName(obj.getName(), obj.getSignature())) {
bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this).addField(this)
.addString(obj.getName()));
}
} | [
"@",
"Override",
"public",
"void",
"visitField",
"(",
"Field",
"obj",
")",
"{",
"if",
"(",
"checkConfusedName",
"(",
"obj",
".",
"getName",
"(",
")",
",",
"obj",
".",
"getSignature",
"(",
")",
")",
")",
"{",
"bugReporter",
".",
"reportBug",
"(",
"new",... | overrides the visitor to look for fields where the name has 'Map', 'Set', 'List' in it but the type of that field isn't that.
@param obj
the currently parsed field | [
"overrides",
"the",
"visitor",
"to",
"look",
"for",
"fields",
"where",
"the",
"name",
"has",
"Map",
"Set",
"List",
"in",
"it",
"but",
"the",
"type",
"of",
"that",
"field",
"isn",
"t",
"that",
"."
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L97-L103 |
j256/simplejmx | src/main/java/com/j256/simplejmx/client/JmxClient.java | JmxClient.getOperationsInfo | public MBeanOperationInfo[] getOperationsInfo(String domainName, String beanName) throws JMException {
return getOperationsInfo(ObjectNameUtil.makeObjectName(domainName, beanName));
} | java | public MBeanOperationInfo[] getOperationsInfo(String domainName, String beanName) throws JMException {
return getOperationsInfo(ObjectNameUtil.makeObjectName(domainName, beanName));
} | [
"public",
"MBeanOperationInfo",
"[",
"]",
"getOperationsInfo",
"(",
"String",
"domainName",
",",
"String",
"beanName",
")",
"throws",
"JMException",
"{",
"return",
"getOperationsInfo",
"(",
"ObjectNameUtil",
".",
"makeObjectName",
"(",
"domainName",
",",
"beanName",
... | Return an array of the operations associated with the bean name. | [
"Return",
"an",
"array",
"of",
"the",
"operations",
"associated",
"with",
"the",
"bean",
"name",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L267-L269 |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/ConnectionHandle.java | ConnectionHandle.recreateConnectionHandle | public ConnectionHandle recreateConnectionHandle() throws SQLException{
ConnectionHandle handle = new ConnectionHandle(this.connection, this.originatingPartition, this.pool, true);
handle.originatingPartition = this.originatingPartition;
handle.connectionCreationTimeInMs = this.connectionCreationTimeInMs;
handle.connectionLastResetInMs = this.connectionLastResetInMs;
handle.connectionLastUsedInMs = this.connectionLastUsedInMs;
handle.preparedStatementCache = this.preparedStatementCache;
handle.callableStatementCache = this.callableStatementCache;
handle.statementCachingEnabled = this.statementCachingEnabled;
handle.connectionHook = this.connectionHook;
handle.possiblyBroken = this.possiblyBroken;
handle.debugHandle = this.debugHandle;
this.connection = null;
return handle;
} | java | public ConnectionHandle recreateConnectionHandle() throws SQLException{
ConnectionHandle handle = new ConnectionHandle(this.connection, this.originatingPartition, this.pool, true);
handle.originatingPartition = this.originatingPartition;
handle.connectionCreationTimeInMs = this.connectionCreationTimeInMs;
handle.connectionLastResetInMs = this.connectionLastResetInMs;
handle.connectionLastUsedInMs = this.connectionLastUsedInMs;
handle.preparedStatementCache = this.preparedStatementCache;
handle.callableStatementCache = this.callableStatementCache;
handle.statementCachingEnabled = this.statementCachingEnabled;
handle.connectionHook = this.connectionHook;
handle.possiblyBroken = this.possiblyBroken;
handle.debugHandle = this.debugHandle;
this.connection = null;
return handle;
} | [
"public",
"ConnectionHandle",
"recreateConnectionHandle",
"(",
")",
"throws",
"SQLException",
"{",
"ConnectionHandle",
"handle",
"=",
"new",
"ConnectionHandle",
"(",
"this",
".",
"connection",
",",
"this",
".",
"originatingPartition",
",",
"this",
".",
"pool",
",",
... | Creates the connection handle again. We use this method to create a brand new connection
handle. That way if the application (wrongly) tries to do something else with the connection
that has already been "closed", it will fail.
@return ConnectionHandle
@throws SQLException | [
"Creates",
"the",
"connection",
"handle",
"again",
".",
"We",
"use",
"this",
"method",
"to",
"create",
"a",
"brand",
"new",
"connection",
"handle",
".",
"That",
"way",
"if",
"the",
"application",
"(",
"wrongly",
")",
"tries",
"to",
"do",
"something",
"else... | train | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/ConnectionHandle.java#L279-L294 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/locale/ContinentHelper.java | ContinentHelper._register | private static void _register (@Nonnull @Nonempty final String sCountryCode, @Nonnull final EContinent... aContinents)
{
final Locale aCountry = CountryCache.getInstance ().getCountry (sCountryCode);
if (s_aMap.containsKey (aCountry))
throw new IllegalArgumentException ("Country code '" + sCountryCode + "' is already registered!");
for (final EContinent eContinent : aContinents)
s_aMap.putSingle (aCountry, eContinent);
} | java | private static void _register (@Nonnull @Nonempty final String sCountryCode, @Nonnull final EContinent... aContinents)
{
final Locale aCountry = CountryCache.getInstance ().getCountry (sCountryCode);
if (s_aMap.containsKey (aCountry))
throw new IllegalArgumentException ("Country code '" + sCountryCode + "' is already registered!");
for (final EContinent eContinent : aContinents)
s_aMap.putSingle (aCountry, eContinent);
} | [
"private",
"static",
"void",
"_register",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sCountryCode",
",",
"@",
"Nonnull",
"final",
"EContinent",
"...",
"aContinents",
")",
"{",
"final",
"Locale",
"aCountry",
"=",
"CountryCache",
".",
"getInstance",... | Register assignment
@param sCountryCode
Country code to be used. May not be <code>null</code> nor empty
@param aContinents
The enum to be used. May not be <code>null</code> but may contain a
single <code>null</code> element. | [
"Register",
"assignment"
] | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/locale/ContinentHelper.java#L309-L316 |
duracloud/duracloud | retrievaltool/src/main/java/org/duracloud/retrieval/mgmt/RetrievalWorker.java | RetrievalWorker.retrieveToFile | protected Map<String, String> retrieveToFile(File localFile, RetrievalListener listener) throws IOException {
try {
contentStream = new Retrier(5, 4000, 3).execute(() -> {
return source.getSourceContent(contentItem, listener);
});
} catch (Exception ex) {
throw new IOException(ex);
}
try (
InputStream inStream = contentStream.getStream();
OutputStream outStream = new FileOutputStream(localFile);
) {
IOUtils.copyLarge(inStream, outStream);
} catch (IOException e) {
try {
deleteFile(localFile);
} catch (IOException ioe) {
logger.error("Exception deleting local file " +
localFile.getAbsolutePath() + " due to: " + ioe.getMessage());
}
throw e;
}
if (!checksumsMatch(localFile, contentStream.getChecksum())) {
deleteFile(localFile);
throw new IOException("Calculated checksum value for retrieved " +
"file does not match properties checksum.");
}
// Set time stamps
if (applyTimestamps) {
applyTimestamps(contentStream, localFile);
}
return contentStream.getProperties();
} | java | protected Map<String, String> retrieveToFile(File localFile, RetrievalListener listener) throws IOException {
try {
contentStream = new Retrier(5, 4000, 3).execute(() -> {
return source.getSourceContent(contentItem, listener);
});
} catch (Exception ex) {
throw new IOException(ex);
}
try (
InputStream inStream = contentStream.getStream();
OutputStream outStream = new FileOutputStream(localFile);
) {
IOUtils.copyLarge(inStream, outStream);
} catch (IOException e) {
try {
deleteFile(localFile);
} catch (IOException ioe) {
logger.error("Exception deleting local file " +
localFile.getAbsolutePath() + " due to: " + ioe.getMessage());
}
throw e;
}
if (!checksumsMatch(localFile, contentStream.getChecksum())) {
deleteFile(localFile);
throw new IOException("Calculated checksum value for retrieved " +
"file does not match properties checksum.");
}
// Set time stamps
if (applyTimestamps) {
applyTimestamps(contentStream, localFile);
}
return contentStream.getProperties();
} | [
"protected",
"Map",
"<",
"String",
",",
"String",
">",
"retrieveToFile",
"(",
"File",
"localFile",
",",
"RetrievalListener",
"listener",
")",
"throws",
"IOException",
"{",
"try",
"{",
"contentStream",
"=",
"new",
"Retrier",
"(",
"5",
",",
"4000",
",",
"3",
... | Transfers the remote file stream to the local file
@param localFile
@param listener
@return
@throws IOException
@returns the checksum of the File upon successful retrieval. Successful
retrieval means the checksum of the local file and remote file match,
otherwise an IOException is thrown. | [
"Transfers",
"the",
"remote",
"file",
"stream",
"to",
"the",
"local",
"file"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/retrievaltool/src/main/java/org/duracloud/retrieval/mgmt/RetrievalWorker.java#L233-L269 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java | SubWriterHolderWriter.addMemberTree | public void addMemberTree(Content memberSummaryTree, Content memberTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(memberTree));
memberSummaryTree.addContent(htmlTree);
} else {
memberSummaryTree.addContent(getMemberTree(memberTree));
}
} | java | public void addMemberTree(Content memberSummaryTree, Content memberTree) {
if (configuration.allowTag(HtmlTag.SECTION)) {
HtmlTree htmlTree = HtmlTree.SECTION(getMemberTree(memberTree));
memberSummaryTree.addContent(htmlTree);
} else {
memberSummaryTree.addContent(getMemberTree(memberTree));
}
} | [
"public",
"void",
"addMemberTree",
"(",
"Content",
"memberSummaryTree",
",",
"Content",
"memberTree",
")",
"{",
"if",
"(",
"configuration",
".",
"allowTag",
"(",
"HtmlTag",
".",
"SECTION",
")",
")",
"{",
"HtmlTree",
"htmlTree",
"=",
"HtmlTree",
".",
"SECTION",... | Add the member tree.
@param memberSummaryTree the content tree representing the member summary
@param memberTree the content tree representing the member | [
"Add",
"the",
"member",
"tree",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java#L312-L319 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/Criteria.java | Criteria.addGroupBy | public void addGroupBy(String fieldName)
{
if (fieldName != null)
{
_getGroupby().add(new FieldHelper(fieldName, false));
}
} | java | public void addGroupBy(String fieldName)
{
if (fieldName != null)
{
_getGroupby().add(new FieldHelper(fieldName, false));
}
} | [
"public",
"void",
"addGroupBy",
"(",
"String",
"fieldName",
")",
"{",
"if",
"(",
"fieldName",
"!=",
"null",
")",
"{",
"_getGroupby",
"(",
")",
".",
"add",
"(",
"new",
"FieldHelper",
"(",
"fieldName",
",",
"false",
")",
")",
";",
"}",
"}"
] | Adds a groupby fieldName for ReportQueries.
@param fieldName The groupby to set
@deprecated use QueryByCriteria#addGroupBy | [
"Adds",
"a",
"groupby",
"fieldName",
"for",
"ReportQueries",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L962-L968 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionUtils.java | FunctionUtils.resolveFunction | public static String resolveFunction(String functionString, TestContext context) {
String functionExpression = VariableUtils.cutOffVariablesPrefix(functionString);
if (!functionExpression.contains("(") || !functionExpression.endsWith(")") || !functionExpression.contains(":")) {
throw new InvalidFunctionUsageException("Unable to resolve function: " + functionExpression);
}
String functionPrefix = functionExpression.substring(0, functionExpression.indexOf(':') + 1);
String parameterString = functionExpression.substring(functionExpression.indexOf('(') + 1, functionExpression.length() - 1);
String function = functionExpression.substring(functionPrefix.length(), functionExpression.indexOf('('));
FunctionLibrary library = context.getFunctionRegistry().getLibraryForPrefix(functionPrefix);
parameterString = VariableUtils.replaceVariablesInString(parameterString, context, false);
parameterString = replaceFunctionsInString(parameterString, context);
String value = library.getFunction(function).execute(FunctionParameterHelper.getParameterList(parameterString), context);
if (value == null) {
return "";
} else {
return value;
}
} | java | public static String resolveFunction(String functionString, TestContext context) {
String functionExpression = VariableUtils.cutOffVariablesPrefix(functionString);
if (!functionExpression.contains("(") || !functionExpression.endsWith(")") || !functionExpression.contains(":")) {
throw new InvalidFunctionUsageException("Unable to resolve function: " + functionExpression);
}
String functionPrefix = functionExpression.substring(0, functionExpression.indexOf(':') + 1);
String parameterString = functionExpression.substring(functionExpression.indexOf('(') + 1, functionExpression.length() - 1);
String function = functionExpression.substring(functionPrefix.length(), functionExpression.indexOf('('));
FunctionLibrary library = context.getFunctionRegistry().getLibraryForPrefix(functionPrefix);
parameterString = VariableUtils.replaceVariablesInString(parameterString, context, false);
parameterString = replaceFunctionsInString(parameterString, context);
String value = library.getFunction(function).execute(FunctionParameterHelper.getParameterList(parameterString), context);
if (value == null) {
return "";
} else {
return value;
}
} | [
"public",
"static",
"String",
"resolveFunction",
"(",
"String",
"functionString",
",",
"TestContext",
"context",
")",
"{",
"String",
"functionExpression",
"=",
"VariableUtils",
".",
"cutOffVariablesPrefix",
"(",
"functionString",
")",
";",
"if",
"(",
"!",
"functionE... | This method resolves a custom function to its respective result.
@param functionString to evaluate.
@throws com.consol.citrus.exceptions.CitrusRuntimeException
@return evaluated result | [
"This",
"method",
"resolves",
"a",
"custom",
"function",
"to",
"its",
"respective",
"result",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionUtils.java#L127-L150 |
jbundle/jbundle | thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java | BaseMessageFilter.updateFilterTree | public final void updateFilterTree(String strKey, Object objValue)
{
Object[][] mxProperties = this.cloneMatrix(this.getNameValueTree());
mxProperties = this.addNameValue(mxProperties, strKey, objValue); // Add/replace this property
this.setFilterTree(mxProperties); // Update any remote copy of this.
} | java | public final void updateFilterTree(String strKey, Object objValue)
{
Object[][] mxProperties = this.cloneMatrix(this.getNameValueTree());
mxProperties = this.addNameValue(mxProperties, strKey, objValue); // Add/replace this property
this.setFilterTree(mxProperties); // Update any remote copy of this.
} | [
"public",
"final",
"void",
"updateFilterTree",
"(",
"String",
"strKey",
",",
"Object",
"objValue",
")",
"{",
"Object",
"[",
"]",
"[",
"]",
"mxProperties",
"=",
"this",
".",
"cloneMatrix",
"(",
"this",
".",
"getNameValueTree",
"(",
")",
")",
";",
"mxPropert... | Update this object's filter with this new tree information.
@param strKey The tree key to add or change.
@param objValue Changes to the property tree key. | [
"Update",
"this",
"object",
"s",
"filter",
"with",
"this",
"new",
"tree",
"information",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L457-L462 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/GrammaticalStructure.java | GrammaticalStructure.printDependencies | public static void printDependencies(GrammaticalStructure gs, Collection<TypedDependency> deps, Tree tree, boolean conllx, boolean extraSep) {
System.out.println(dependenciesToString(gs, deps, tree, conllx, extraSep));
} | java | public static void printDependencies(GrammaticalStructure gs, Collection<TypedDependency> deps, Tree tree, boolean conllx, boolean extraSep) {
System.out.println(dependenciesToString(gs, deps, tree, conllx, extraSep));
} | [
"public",
"static",
"void",
"printDependencies",
"(",
"GrammaticalStructure",
"gs",
",",
"Collection",
"<",
"TypedDependency",
">",
"deps",
",",
"Tree",
"tree",
",",
"boolean",
"conllx",
",",
"boolean",
"extraSep",
")",
"{",
"System",
".",
"out",
".",
"println... | Print typed dependencies in either the Stanford dependency representation
or in the conllx format.
@param deps
Typed dependencies to print
@param tree
Tree corresponding to typed dependencies (only necessary if conllx
== true)
@param conllx
If true use conllx format, otherwise use Stanford representation
@param extraSep
If true, in the Stanford representation, the extra dependencies
(which do not preserve the tree structure) are printed after the
basic dependencies | [
"Print",
"typed",
"dependencies",
"in",
"either",
"the",
"Stanford",
"dependency",
"representation",
"or",
"in",
"the",
"conllx",
"format",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/GrammaticalStructure.java#L861-L863 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/util/AuthConfigFactory.java | AuthConfigFactory.extendedAuthentication | private AuthConfig extendedAuthentication(AuthConfig standardAuthConfig, String registry) throws IOException, MojoExecutionException {
EcrExtendedAuth ecr = new EcrExtendedAuth(log, registry);
if (ecr.isAwsRegistry()) {
return ecr.extendedAuth(standardAuthConfig);
}
return standardAuthConfig;
} | java | private AuthConfig extendedAuthentication(AuthConfig standardAuthConfig, String registry) throws IOException, MojoExecutionException {
EcrExtendedAuth ecr = new EcrExtendedAuth(log, registry);
if (ecr.isAwsRegistry()) {
return ecr.extendedAuth(standardAuthConfig);
}
return standardAuthConfig;
} | [
"private",
"AuthConfig",
"extendedAuthentication",
"(",
"AuthConfig",
"standardAuthConfig",
",",
"String",
"registry",
")",
"throws",
"IOException",
",",
"MojoExecutionException",
"{",
"EcrExtendedAuth",
"ecr",
"=",
"new",
"EcrExtendedAuth",
"(",
"log",
",",
"registry",... | Try various extended authentication method. Currently only supports amazon ECR
@param standardAuthConfig The locally stored credentials.
@param registry The registry to authenticated against.
@return The given credentials, if registry does not need extended authentication;
else, the credentials after authentication.
@throws IOException
@throws MojoExecutionException | [
"Try",
"various",
"extended",
"authentication",
"method",
".",
"Currently",
"only",
"supports",
"amazon",
"ECR"
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/util/AuthConfigFactory.java#L157-L163 |
undertow-io/undertow | core/src/main/java/io/undertow/util/HttpString.java | HttpString.copyTo | public void copyTo(int srcOffs, byte[] dst, int offs, int len) {
arraycopy(bytes, srcOffs, dst, offs, len);
} | java | public void copyTo(int srcOffs, byte[] dst, int offs, int len) {
arraycopy(bytes, srcOffs, dst, offs, len);
} | [
"public",
"void",
"copyTo",
"(",
"int",
"srcOffs",
",",
"byte",
"[",
"]",
"dst",
",",
"int",
"offs",
",",
"int",
"len",
")",
"{",
"arraycopy",
"(",
"bytes",
",",
"srcOffs",
",",
"dst",
",",
"offs",
",",
"len",
")",
";",
"}"
] | Copy {@code len} bytes from this string at offset {@code srcOffs} to the given array at the given offset.
@param srcOffs the source offset
@param dst the destination
@param offs the destination offset
@param len the number of bytes to copy | [
"Copy",
"{",
"@code",
"len",
"}",
"bytes",
"from",
"this",
"string",
"at",
"offset",
"{",
"@code",
"srcOffs",
"}",
"to",
"the",
"given",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/HttpString.java#L192-L194 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java | ModelSerializer.restoreMultiLayerNetwork | public static MultiLayerNetwork restoreMultiLayerNetwork(@NonNull String path, boolean loadUpdater)
throws IOException {
return restoreMultiLayerNetwork(new File(path), loadUpdater);
} | java | public static MultiLayerNetwork restoreMultiLayerNetwork(@NonNull String path, boolean loadUpdater)
throws IOException {
return restoreMultiLayerNetwork(new File(path), loadUpdater);
} | [
"public",
"static",
"MultiLayerNetwork",
"restoreMultiLayerNetwork",
"(",
"@",
"NonNull",
"String",
"path",
",",
"boolean",
"loadUpdater",
")",
"throws",
"IOException",
"{",
"return",
"restoreMultiLayerNetwork",
"(",
"new",
"File",
"(",
"path",
")",
",",
"loadUpdate... | Load a MultilayerNetwork model from a file
@param path path to the model file, to get the computation graph from
@return the loaded computation graph
@throws IOException | [
"Load",
"a",
"MultilayerNetwork",
"model",
"from",
"a",
"file",
"@param",
"path",
"path",
"to",
"the",
"model",
"file",
"to",
"get",
"the",
"computation",
"graph",
"from",
"@return",
"the",
"loaded",
"computation",
"graph"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L389-L392 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.divideAndRound | private static BigInteger divideAndRound(BigInteger bdividend, BigInteger bdivisor, int roundingMode) {
boolean isRemainderZero; // record remainder is zero or not
int qsign; // quotient sign
// Descend into mutables for faster remainder checks
MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
MutableBigInteger mq = new MutableBigInteger();
MutableBigInteger mdivisor = new MutableBigInteger(bdivisor.mag);
MutableBigInteger mr = mdividend.divide(mdivisor, mq);
isRemainderZero = mr.isZero();
qsign = (bdividend.signum != bdivisor.signum) ? -1 : 1;
if (!isRemainderZero) {
if (needIncrement(mdivisor, roundingMode, qsign, mq, mr)) {
mq.add(MutableBigInteger.ONE);
}
}
return mq.toBigInteger(qsign);
} | java | private static BigInteger divideAndRound(BigInteger bdividend, BigInteger bdivisor, int roundingMode) {
boolean isRemainderZero; // record remainder is zero or not
int qsign; // quotient sign
// Descend into mutables for faster remainder checks
MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
MutableBigInteger mq = new MutableBigInteger();
MutableBigInteger mdivisor = new MutableBigInteger(bdivisor.mag);
MutableBigInteger mr = mdividend.divide(mdivisor, mq);
isRemainderZero = mr.isZero();
qsign = (bdividend.signum != bdivisor.signum) ? -1 : 1;
if (!isRemainderZero) {
if (needIncrement(mdivisor, roundingMode, qsign, mq, mr)) {
mq.add(MutableBigInteger.ONE);
}
}
return mq.toBigInteger(qsign);
} | [
"private",
"static",
"BigInteger",
"divideAndRound",
"(",
"BigInteger",
"bdividend",
",",
"BigInteger",
"bdivisor",
",",
"int",
"roundingMode",
")",
"{",
"boolean",
"isRemainderZero",
";",
"// record remainder is zero or not",
"int",
"qsign",
";",
"// quotient sign",
"/... | Divides {@code BigInteger} value by {@code BigInteger} value and
do rounding based on the passed in roundingMode. | [
"Divides",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L4293-L4309 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java | StyleUtil.setColor | public static CellStyle setColor(CellStyle cellStyle, short color, FillPatternType fillPattern) {
cellStyle.setFillForegroundColor(color);
cellStyle.setFillPattern(fillPattern);
return cellStyle;
} | java | public static CellStyle setColor(CellStyle cellStyle, short color, FillPatternType fillPattern) {
cellStyle.setFillForegroundColor(color);
cellStyle.setFillPattern(fillPattern);
return cellStyle;
} | [
"public",
"static",
"CellStyle",
"setColor",
"(",
"CellStyle",
"cellStyle",
",",
"short",
"color",
",",
"FillPatternType",
"fillPattern",
")",
"{",
"cellStyle",
".",
"setFillForegroundColor",
"(",
"color",
")",
";",
"cellStyle",
".",
"setFillPattern",
"(",
"fillPa... | 给cell设置颜色
@param cellStyle {@link CellStyle}
@param color 背景颜色
@param fillPattern 填充方式 {@link FillPatternType}枚举
@return {@link CellStyle} | [
"给cell设置颜色"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L105-L109 |
qos-ch/slf4j | jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java | SLF4JLog.warn | public void warn(Object message, Throwable t) {
logger.warn(String.valueOf(message), t);
} | java | public void warn(Object message, Throwable t) {
logger.warn(String.valueOf(message), t);
} | [
"public",
"void",
"warn",
"(",
"Object",
"message",
",",
"Throwable",
"t",
")",
"{",
"logger",
".",
"warn",
"(",
"String",
".",
"valueOf",
"(",
"message",
")",
",",
"t",
")",
";",
"}"
] | Converts the first input parameter to String and then delegates to the
wrapped <code>org.slf4j.Logger</code> instance.
@param message
the message to log. Converted to {@link String}
@param t
the exception to log | [
"Converts",
"the",
"first",
"input",
"parameter",
"to",
"String",
"and",
"then",
"delegates",
"to",
"the",
"wrapped",
"<code",
">",
"org",
".",
"slf4j",
".",
"Logger<",
"/",
"code",
">",
"instance",
"."
] | train | https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java#L188-L190 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedConnection.java | MemcachedConnection.handleReadsAndWrites | private void handleReadsAndWrites(final SelectionKey sk, final MemcachedNode node) throws IOException {
if (sk.isValid() && sk.isReadable()) {
handleReads(node);
}
if (sk.isValid() && sk.isWritable()) {
handleWrites(node);
}
} | java | private void handleReadsAndWrites(final SelectionKey sk, final MemcachedNode node) throws IOException {
if (sk.isValid() && sk.isReadable()) {
handleReads(node);
}
if (sk.isValid() && sk.isWritable()) {
handleWrites(node);
}
} | [
"private",
"void",
"handleReadsAndWrites",
"(",
"final",
"SelectionKey",
"sk",
",",
"final",
"MemcachedNode",
"node",
")",
"throws",
"IOException",
"{",
"if",
"(",
"sk",
".",
"isValid",
"(",
")",
"&&",
"sk",
".",
"isReadable",
"(",
")",
")",
"{",
"handleRe... | A helper method for {@link #handleIO(java.nio.channels.SelectionKey)} to
handle reads and writes if appropriate.
@param sk the selection key to use.
@param node th enode to read write from.
@throws IOException if an error occurs during read/write. | [
"A",
"helper",
"method",
"for",
"{",
"@link",
"#handleIO",
"(",
"java",
".",
"nio",
".",
"channels",
".",
"SelectionKey",
")",
"}",
"to",
"handle",
"reads",
"and",
"writes",
"if",
"appropriate",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedConnection.java#L733-L741 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java | InputSanityCheck.checkDeclare | public static <In extends ImageGray,Out extends ImageGray>
Out checkDeclare(In input, Out output , Class<Out> typeOut) {
if (output == null) {
output = (Out) GeneralizedImageOps.createSingleBand(typeOut, input.width, input.height);
} else {
output.reshape(input.width, input.height);
}
return output;
} | java | public static <In extends ImageGray,Out extends ImageGray>
Out checkDeclare(In input, Out output , Class<Out> typeOut) {
if (output == null) {
output = (Out) GeneralizedImageOps.createSingleBand(typeOut, input.width, input.height);
} else {
output.reshape(input.width, input.height);
}
return output;
} | [
"public",
"static",
"<",
"In",
"extends",
"ImageGray",
",",
"Out",
"extends",
"ImageGray",
">",
"Out",
"checkDeclare",
"(",
"In",
"input",
",",
"Out",
"output",
",",
"Class",
"<",
"Out",
">",
"typeOut",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",... | If the output has not been declared a new instance is declared. If an instance of the output
is provided its bounds are checked. | [
"If",
"the",
"output",
"has",
"not",
"been",
"declared",
"a",
"new",
"instance",
"is",
"declared",
".",
"If",
"an",
"instance",
"of",
"the",
"output",
"is",
"provided",
"its",
"bounds",
"are",
"checked",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java#L71-L79 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java | PMContext.getBoolean | public boolean getBoolean(String key, boolean def) {
try {
if (!contains(key)) {
return def;
}
return (Boolean) get(key);
} catch (Exception e) {
return def;
}
} | java | public boolean getBoolean(String key, boolean def) {
try {
if (!contains(key)) {
return def;
}
return (Boolean) get(key);
} catch (Exception e) {
return def;
}
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"def",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"contains",
"(",
"key",
")",
")",
"{",
"return",
"def",
";",
"}",
"return",
"(",
"Boolean",
")",
"get",
"(",
"key",
")",
";",
"}... | Getter for a boolean value.
@param key The key
@param def Default value if there is no item at key
@return A boolean | [
"Getter",
"for",
"a",
"boolean",
"value",
"."
] | train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L315-L324 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.newOutputStream | public static OutputStream newOutputStream(final WritableByteChannel ch) {
checkNotNull(ch, "ch");
return new OutputStream() {
private ByteBuffer bb = null;
private byte[] bs = null; // Invoker's previous array
private byte[] b1 = null;
public synchronized void write(int b) throws IOException {
if (b1 == null)
b1 = new byte[1];
b1[0] = (byte)b;
this.write(b1);
}
public synchronized void write(byte[] bs, int off, int len)
throws IOException
{
if ((off < 0) || (off > bs.length) || (len < 0) ||
((off + len) > bs.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
ByteBuffer bb = ((this.bs == bs)
? this.bb
: ByteBuffer.wrap(bs));
bb.limit(Math.min(off + len, bb.capacity()));
bb.position(off);
this.bb = bb;
this.bs = bs;
Channels.writeFully(ch, bb);
}
public void close() throws IOException {
ch.close();
}
};
} | java | public static OutputStream newOutputStream(final WritableByteChannel ch) {
checkNotNull(ch, "ch");
return new OutputStream() {
private ByteBuffer bb = null;
private byte[] bs = null; // Invoker's previous array
private byte[] b1 = null;
public synchronized void write(int b) throws IOException {
if (b1 == null)
b1 = new byte[1];
b1[0] = (byte)b;
this.write(b1);
}
public synchronized void write(byte[] bs, int off, int len)
throws IOException
{
if ((off < 0) || (off > bs.length) || (len < 0) ||
((off + len) > bs.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
ByteBuffer bb = ((this.bs == bs)
? this.bb
: ByteBuffer.wrap(bs));
bb.limit(Math.min(off + len, bb.capacity()));
bb.position(off);
this.bb = bb;
this.bs = bs;
Channels.writeFully(ch, bb);
}
public void close() throws IOException {
ch.close();
}
};
} | [
"public",
"static",
"OutputStream",
"newOutputStream",
"(",
"final",
"WritableByteChannel",
"ch",
")",
"{",
"checkNotNull",
"(",
"ch",
",",
"\"ch\"",
")",
";",
"return",
"new",
"OutputStream",
"(",
")",
"{",
"private",
"ByteBuffer",
"bb",
"=",
"null",
";",
"... | Constructs a stream that writes bytes to the given channel.
<p> The <tt>write</tt> methods of the resulting stream will throw an
{@link IllegalBlockingModeException} if invoked while the underlying
channel is in non-blocking mode. The stream will not be buffered. The
stream will be safe for access by multiple concurrent threads. Closing
the stream will in turn cause the channel to be closed. </p>
@param ch
The channel to which bytes will be written
@return A new output stream | [
"Constructs",
"a",
"stream",
"that",
"writes",
"bytes",
"to",
"the",
"given",
"channel",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L143-L183 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/storage/StorageFacade.java | StorageFacade.forProvider | public static StorageBuilder forProvider( String providerName )
{
Class<?> providerClass = PROVIDERS.get( providerName );
if ( providerClass == null ) {
throw new IllegalArgumentException( "No provider implementation registered for name: " + providerName );
}
return new StorageBuilder( providerName, providerClass );
} | java | public static StorageBuilder forProvider( String providerName )
{
Class<?> providerClass = PROVIDERS.get( providerName );
if ( providerClass == null ) {
throw new IllegalArgumentException( "No provider implementation registered for name: " + providerName );
}
return new StorageBuilder( providerName, providerClass );
} | [
"public",
"static",
"StorageBuilder",
"forProvider",
"(",
"String",
"providerName",
")",
"{",
"Class",
"<",
"?",
">",
"providerClass",
"=",
"PROVIDERS",
".",
"get",
"(",
"providerName",
")",
";",
"if",
"(",
"providerClass",
"==",
"null",
")",
"{",
"throw",
... | Get a {@link StorageBuilder} by its name
@param providerName The provider name
@return The builder used to configure a {@link StorageProvider} | [
"Get",
"a",
"{",
"@link",
"StorageBuilder",
"}",
"by",
"its",
"name"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/storage/StorageFacade.java#L78-L87 |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java | AbstractLauncher.setConf | public T setConf(String key, String value) {
checkNotNull(key, "key");
checkNotNull(value, "value");
checkArgument(key.startsWith("spark."), "'key' must start with 'spark.'");
builder.conf.put(key, value);
return self();
} | java | public T setConf(String key, String value) {
checkNotNull(key, "key");
checkNotNull(value, "value");
checkArgument(key.startsWith("spark."), "'key' must start with 'spark.'");
builder.conf.put(key, value);
return self();
} | [
"public",
"T",
"setConf",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"checkNotNull",
"(",
"key",
",",
"\"key\"",
")",
";",
"checkNotNull",
"(",
"value",
",",
"\"value\"",
")",
";",
"checkArgument",
"(",
"key",
".",
"startsWith",
"(",
"\"spar... | Set a single configuration value for the application.
@param key Configuration key.
@param value The value to use.
@return This launcher. | [
"Set",
"a",
"single",
"configuration",
"value",
"for",
"the",
"application",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L58-L64 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/wsspi/pmi/factory/StatsFactory.java | StatsFactory.createStatsInstance | public static StatsInstance createStatsInstance(String instanceName, String statsTemplate, ObjectName mBean, StatisticActions listener)
throws StatsFactoryException {
if (tc.isEntryEnabled())
Tr.entry(tc, new StringBuffer("createStatsInstance:name=").append(instanceName).append(";template=").
append(statsTemplate).append(";mBean=").append((mBean == null) ? null : mBean.toString()).toString());
checkPMIService(instanceName);
StatsInstance instance;
try {
instance = StatsInstanceImpl.createInstance(instanceName, statsTemplate, mBean, false, listener);
} catch (StatsFactoryException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Exception:", e);
if (tc.isEntryEnabled())
Tr.exit(tc, "createStatsInstance");
throw e;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "createStatsInstance");
return instance;
} | java | public static StatsInstance createStatsInstance(String instanceName, String statsTemplate, ObjectName mBean, StatisticActions listener)
throws StatsFactoryException {
if (tc.isEntryEnabled())
Tr.entry(tc, new StringBuffer("createStatsInstance:name=").append(instanceName).append(";template=").
append(statsTemplate).append(";mBean=").append((mBean == null) ? null : mBean.toString()).toString());
checkPMIService(instanceName);
StatsInstance instance;
try {
instance = StatsInstanceImpl.createInstance(instanceName, statsTemplate, mBean, false, listener);
} catch (StatsFactoryException e) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Exception:", e);
if (tc.isEntryEnabled())
Tr.exit(tc, "createStatsInstance");
throw e;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "createStatsInstance");
return instance;
} | [
"public",
"static",
"StatsInstance",
"createStatsInstance",
"(",
"String",
"instanceName",
",",
"String",
"statsTemplate",
",",
"ObjectName",
"mBean",
",",
"StatisticActions",
"listener",
")",
"throws",
"StatsFactoryException",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabl... | Create a StatsInstance using the Stats template and add to the PMI tree at the root level.
This method will associate the MBean provided by the caller to the Stats instance.
@param instanceName name of the instance
@param statsTemplate location of the Stats template XML file
@param mBean MBean that needs to be associated with the Stats instance
@param listener A StatisticActions object. This object will be called when events occur on statistics created for this instance
@return Stats instance
@exception StatsFactoryException if error while creating Stats instance | [
"Create",
"a",
"StatsInstance",
"using",
"the",
"Stats",
"template",
"and",
"add",
"to",
"the",
"PMI",
"tree",
"at",
"the",
"root",
"level",
".",
"This",
"method",
"will",
"associate",
"the",
"MBean",
"provided",
"by",
"the",
"caller",
"to",
"the",
"Stats"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/wsspi/pmi/factory/StatsFactory.java#L256-L281 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/pool/WrapperInvocationHandler.java | WrapperInvocationHandler.getCreatedOrPreparedStatementSurrogate | protected Object getCreatedOrPreparedStatementSurrogate(
final Method method, final Object[] args) throws Throwable {
WrapperInvocationHandler handler;
Object stmt = null;
StatementKey key = new StatementKey(method, args);
StatementPool pool = this.statementPool;
if (pool != null) {
stmt = pool.checkOut(key);
}
if (stmt == null) {
stmt = method.invoke(this.delegate, args);
}
handler = new WrapperInvocationHandler(stmt, this);
handler.statementKey = key;
if (this.statements == null) {
this.statements = new HashSet();
}
statements.add(handler);
return handler.surrogate;
} | java | protected Object getCreatedOrPreparedStatementSurrogate(
final Method method, final Object[] args) throws Throwable {
WrapperInvocationHandler handler;
Object stmt = null;
StatementKey key = new StatementKey(method, args);
StatementPool pool = this.statementPool;
if (pool != null) {
stmt = pool.checkOut(key);
}
if (stmt == null) {
stmt = method.invoke(this.delegate, args);
}
handler = new WrapperInvocationHandler(stmt, this);
handler.statementKey = key;
if (this.statements == null) {
this.statements = new HashSet();
}
statements.add(handler);
return handler.surrogate;
} | [
"protected",
"Object",
"getCreatedOrPreparedStatementSurrogate",
"(",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"WrapperInvocationHandler",
"handler",
";",
"Object",
"stmt",
"=",
"null",
";",
"StatementKe... | Surrogate for any method of the delegate that returns an instance of
<tt>Statement</tt>. <p>
@param method returning instance of <tt>Statement</tt>
@param args to the method
@throws java.lang.Throwable the exception, if any, thrown by invoking
the given method with the given arguments upon the delegate
@return surrogate for the delegate Statement object | [
"Surrogate",
"for",
"any",
"method",
"of",
"the",
"delegate",
"that",
"returns",
"an",
"instance",
"of",
"<tt",
">",
"Statement<",
"/",
"tt",
">",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/pool/WrapperInvocationHandler.java#L896-L922 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java | JsonRpcBasicServer.findBestMethodForVarargs | private AMethodWithItsArgs findBestMethodForVarargs(Set<Method> methods, JsonNode paramsNode) {
for (Method method : methods) {
if (method.getParameterTypes().length != 1) {
continue;
}
if (method.isVarArgs()) {
return new AMethodWithItsArgs(method, paramsNode);
}
}
return null;
} | java | private AMethodWithItsArgs findBestMethodForVarargs(Set<Method> methods, JsonNode paramsNode) {
for (Method method : methods) {
if (method.getParameterTypes().length != 1) {
continue;
}
if (method.isVarArgs()) {
return new AMethodWithItsArgs(method, paramsNode);
}
}
return null;
} | [
"private",
"AMethodWithItsArgs",
"findBestMethodForVarargs",
"(",
"Set",
"<",
"Method",
">",
"methods",
",",
"JsonNode",
"paramsNode",
")",
"{",
"for",
"(",
"Method",
"method",
":",
"methods",
")",
"{",
"if",
"(",
"method",
".",
"getParameterTypes",
"(",
")",
... | Finds the {@link Method} from the supplied {@link Set} that
matches the method name annotation and have varargs.
it as a {@link AMethodWithItsArgs} class.
@param methods the {@link Method}s
@param paramsNode the {@link JsonNode} of request
@return the {@link AMethodWithItsArgs} | [
"Finds",
"the",
"{",
"@link",
"Method",
"}",
"from",
"the",
"supplied",
"{",
"@link",
"Set",
"}",
"that",
"matches",
"the",
"method",
"name",
"annotation",
"and",
"have",
"varargs",
".",
"it",
"as",
"a",
"{",
"@link",
"AMethodWithItsArgs",
"}",
"class",
... | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java#L696-L706 |
mokies/ratelimitj | ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java | RequestLimitRule.of | public static RequestLimitRule of(Duration duration, long limit) {
checkDuration(duration);
if (limit < 0) {
throw new IllegalArgumentException("limit must be greater than zero.");
}
int durationSeconds = (int) duration.getSeconds();
return new RequestLimitRule(durationSeconds, limit, durationSeconds);
} | java | public static RequestLimitRule of(Duration duration, long limit) {
checkDuration(duration);
if (limit < 0) {
throw new IllegalArgumentException("limit must be greater than zero.");
}
int durationSeconds = (int) duration.getSeconds();
return new RequestLimitRule(durationSeconds, limit, durationSeconds);
} | [
"public",
"static",
"RequestLimitRule",
"of",
"(",
"Duration",
"duration",
",",
"long",
"limit",
")",
"{",
"checkDuration",
"(",
"duration",
")",
";",
"if",
"(",
"limit",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"limit must be gre... | Initialise a request rate limit. Imagine the whole duration window as being one large bucket with a single count.
@param duration The time the limit will be applied over. The duration must be greater than 1 second.
@param limit A number representing the maximum operations that can be performed in the given duration.
@return A limit rule. | [
"Initialise",
"a",
"request",
"rate",
"limit",
".",
"Imagine",
"the",
"whole",
"duration",
"window",
"as",
"being",
"one",
"large",
"bucket",
"with",
"a",
"single",
"count",
"."
] | train | https://github.com/mokies/ratelimitj/blob/eb15ec42055c46b2b3f6f84131d86f570e489c32/ratelimitj-core/src/main/java/es/moki/ratelimitj/core/limiter/request/RequestLimitRule.java#L55-L62 |
beangle/beangle3 | ioc/spring/src/main/java/org/beangle/inject/spring/web/ServletContextResource.java | ServletContextResource.createRelative | @Override
public Resource createRelative(String relativePath) {
String pathToUse = StringUtils.applyRelativePath(this.path, relativePath);
return new ServletContextResource(this.servletContext, pathToUse);
} | java | @Override
public Resource createRelative(String relativePath) {
String pathToUse = StringUtils.applyRelativePath(this.path, relativePath);
return new ServletContextResource(this.servletContext, pathToUse);
} | [
"@",
"Override",
"public",
"Resource",
"createRelative",
"(",
"String",
"relativePath",
")",
"{",
"String",
"pathToUse",
"=",
"StringUtils",
".",
"applyRelativePath",
"(",
"this",
".",
"path",
",",
"relativePath",
")",
";",
"return",
"new",
"ServletContextResource... | This implementation creates a ServletContextResource, applying the given path
relative to the path of the underlying file of this resource descriptor. | [
"This",
"implementation",
"creates",
"a",
"ServletContextResource",
"applying",
"the",
"given",
"path",
"relative",
"to",
"the",
"path",
"of",
"the",
"underlying",
"file",
"of",
"this",
"resource",
"descriptor",
"."
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/web/ServletContextResource.java#L143-L147 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java | MappingUtils.returnStaticField | public static Object returnStaticField(Class clazz, String fieldName) throws MjdbcException {
Object result = null;
Field field = null;
try {
field = clazz.getField(fieldName);
result = field.get(null);
} catch (NoSuchFieldException ex) {
throw new MjdbcException(ex);
} catch (IllegalAccessException ex) {
throw new MjdbcException(ex);
}
return result;
} | java | public static Object returnStaticField(Class clazz, String fieldName) throws MjdbcException {
Object result = null;
Field field = null;
try {
field = clazz.getField(fieldName);
result = field.get(null);
} catch (NoSuchFieldException ex) {
throw new MjdbcException(ex);
} catch (IllegalAccessException ex) {
throw new MjdbcException(ex);
}
return result;
} | [
"public",
"static",
"Object",
"returnStaticField",
"(",
"Class",
"clazz",
",",
"String",
"fieldName",
")",
"throws",
"MjdbcException",
"{",
"Object",
"result",
"=",
"null",
";",
"Field",
"field",
"=",
"null",
";",
"try",
"{",
"field",
"=",
"clazz",
".",
"g... | Returns class static field value
Is used to return Constants
@param clazz Class static field of which would be returned
@param fieldName field name
@return field value
@throws org.midao.jdbc.core.exception.MjdbcException if field is not present or access is prohibited | [
"Returns",
"class",
"static",
"field",
"value",
"Is",
"used",
"to",
"return",
"Constants"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L426-L440 |
Sciss/abc4j | abc/src/main/java/abc/ui/swing/JScoreComponent.java | JScoreComponent.setSelectedItem | public void setSelectedItem(JScoreElement elmnt){
if (m_selectedItems!=null) {
for (Object m_selectedItem : m_selectedItems) {
((JScoreElement) m_selectedItem).setColor(null);
}
m_selectedItems = null;
}
if (elmnt!=null) {
m_selectedItems = new Vector(1, 0);
m_selectedItems.add(elmnt);
elmnt.setColor(SELECTED_ITEM_COLOR);
}
repaint();
} | java | public void setSelectedItem(JScoreElement elmnt){
if (m_selectedItems!=null) {
for (Object m_selectedItem : m_selectedItems) {
((JScoreElement) m_selectedItem).setColor(null);
}
m_selectedItems = null;
}
if (elmnt!=null) {
m_selectedItems = new Vector(1, 0);
m_selectedItems.add(elmnt);
elmnt.setColor(SELECTED_ITEM_COLOR);
}
repaint();
} | [
"public",
"void",
"setSelectedItem",
"(",
"JScoreElement",
"elmnt",
")",
"{",
"if",
"(",
"m_selectedItems",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"m_selectedItem",
":",
"m_selectedItems",
")",
"{",
"(",
"(",
"JScoreElement",
")",
"m_selectedItem",
")",... | Highlights the given score element in the score.
If an item was previously selected, this previous item
is unselected.
@param elmnt The score rendition element to be highlighted in the
score. <TT>null</TT> can be specified to remove
highlighting.
@see #setSelectedItem(MusicElement) | [
"Highlights",
"the",
"given",
"score",
"element",
"in",
"the",
"score",
".",
"If",
"an",
"item",
"was",
"previously",
"selected",
"this",
"previous",
"item",
"is",
"unselected",
"."
] | train | https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JScoreComponent.java#L335-L348 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java | DefaultFeatureForm.getValue | @Api
public void getValue(String name, ImageUrlAttribute attribute) {
attribute.setValue((String) formWidget.getValue(name));
} | java | @Api
public void getValue(String name, ImageUrlAttribute attribute) {
attribute.setValue((String) formWidget.getValue(name));
} | [
"@",
"Api",
"public",
"void",
"getValue",
"(",
"String",
"name",
",",
"ImageUrlAttribute",
"attribute",
")",
"{",
"attribute",
".",
"setValue",
"(",
"(",
"String",
")",
"formWidget",
".",
"getValue",
"(",
"name",
")",
")",
";",
"}"
] | Get an image value from the form, and place it in <code>attribute</code>.
@param name attribute name
@param attribute attribute to put value
@since 1.11.1 | [
"Get",
"an",
"image",
"value",
"from",
"the",
"form",
"and",
"place",
"it",
"in",
"<code",
">",
"attribute<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L752-L755 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/I18nObject.java | I18nObject.getI18n | protected String getI18n(final String aMessageKey, final long aLongDetail) {
return StringUtils.normalizeWS(myBundle.get(aMessageKey, Long.toString(aLongDetail)));
} | java | protected String getI18n(final String aMessageKey, final long aLongDetail) {
return StringUtils.normalizeWS(myBundle.get(aMessageKey, Long.toString(aLongDetail)));
} | [
"protected",
"String",
"getI18n",
"(",
"final",
"String",
"aMessageKey",
",",
"final",
"long",
"aLongDetail",
")",
"{",
"return",
"StringUtils",
".",
"normalizeWS",
"(",
"myBundle",
".",
"get",
"(",
"aMessageKey",
",",
"Long",
".",
"toString",
"(",
"aLongDetai... | Gets the internationalized value for the supplied message key, using a long as additional information.
@param aMessageKey A message key
@param aLongDetail Additional details for the message
@return The internationalized message | [
"Gets",
"the",
"internationalized",
"value",
"for",
"the",
"supplied",
"message",
"key",
"using",
"a",
"long",
"as",
"additional",
"information",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/I18nObject.java#L57-L59 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.createPipeline | public CreatePipelineResponse createPipeline(
String pipelineName, String sourceBucket, String targetBucket) {
return createPipeline(pipelineName, null, sourceBucket, targetBucket, DEFAULT_PIPELINE_CAPACITY);
} | java | public CreatePipelineResponse createPipeline(
String pipelineName, String sourceBucket, String targetBucket) {
return createPipeline(pipelineName, null, sourceBucket, targetBucket, DEFAULT_PIPELINE_CAPACITY);
} | [
"public",
"CreatePipelineResponse",
"createPipeline",
"(",
"String",
"pipelineName",
",",
"String",
"sourceBucket",
",",
"String",
"targetBucket",
")",
"{",
"return",
"createPipeline",
"(",
"pipelineName",
",",
"null",
",",
"sourceBucket",
",",
"targetBucket",
",",
... | Creates a pipeline which enable you to perform multiple transcodes in parallel.
@param pipelineName The name of the new pipeline.
@param sourceBucket The name of source bucket in Bos.
@param targetBucket The name of target bucket in Bos. | [
"Creates",
"a",
"pipeline",
"which",
"enable",
"you",
"to",
"perform",
"multiple",
"transcodes",
"in",
"parallel",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L518-L521 |
js-lib-com/commons | src/main/java/js/util/Params.java | Params.LT | public static void LT(char parameter, char value, String name) throws IllegalArgumentException {
if (parameter >= value) {
throw new IllegalArgumentException(String.format("%s is not less than %c.", name, value));
}
} | java | public static void LT(char parameter, char value, String name) throws IllegalArgumentException {
if (parameter >= value) {
throw new IllegalArgumentException(String.format("%s is not less than %c.", name, value));
}
} | [
"public",
"static",
"void",
"LT",
"(",
"char",
"parameter",
",",
"char",
"value",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
">=",
"value",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",... | Test if character parameter is strictly less than given character value.
@param parameter invocation character parameter,
@param value threshold value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not less than character value. | [
"Test",
"if",
"character",
"parameter",
"is",
"strictly",
"less",
"than",
"given",
"character",
"value",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L457-L461 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java | X509CertImpl.getExtendedKeyUsage | public static List<String> getExtendedKeyUsage(X509Certificate cert)
throws CertificateParsingException {
try {
byte[] ext = cert.getExtensionValue(EXTENDED_KEY_USAGE_OID);
if (ext == null)
return null;
DerValue val = new DerValue(ext);
byte[] data = val.getOctetString();
ExtendedKeyUsageExtension ekuExt =
new ExtendedKeyUsageExtension(Boolean.FALSE, data);
return Collections.unmodifiableList(ekuExt.getExtendedKeyUsage());
} catch (IOException ioe) {
throw new CertificateParsingException(ioe);
}
} | java | public static List<String> getExtendedKeyUsage(X509Certificate cert)
throws CertificateParsingException {
try {
byte[] ext = cert.getExtensionValue(EXTENDED_KEY_USAGE_OID);
if (ext == null)
return null;
DerValue val = new DerValue(ext);
byte[] data = val.getOctetString();
ExtendedKeyUsageExtension ekuExt =
new ExtendedKeyUsageExtension(Boolean.FALSE, data);
return Collections.unmodifiableList(ekuExt.getExtendedKeyUsage());
} catch (IOException ioe) {
throw new CertificateParsingException(ioe);
}
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getExtendedKeyUsage",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertificateParsingException",
"{",
"try",
"{",
"byte",
"[",
"]",
"ext",
"=",
"cert",
".",
"getExtensionValue",
"(",
"EXTENDED_KEY_USAGE_OID",
")"... | This static method is the default implementation of the
getExtendedKeyUsage method in X509Certificate. A
X509Certificate provider generally should overwrite this to
provide among other things caching for better performance. | [
"This",
"static",
"method",
"is",
"the",
"default",
"implementation",
"of",
"the",
"getExtendedKeyUsage",
"method",
"in",
"X509Certificate",
".",
"A",
"X509Certificate",
"provider",
"generally",
"should",
"overwrite",
"this",
"to",
"provide",
"among",
"other",
"thin... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L1511-L1526 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/ServletUtil.java | ServletUtil.getDevice | public static DeviceType getDevice(final HttpServletRequest request) {
// User agent
String userAgent = ((HttpServletRequest) request).getHeader("User-Agent");
if (Util.empty(userAgent)) {
LOG.warn("No User-Agent details in the request headers. Will assume normal device.");
return DeviceType.NORMAL;
}
// Check for device type
UAgentInfo agentInfo = new UAgentInfo(userAgent, null);
if (agentInfo.detectMobileQuick()) {
return DeviceType.MOBILE;
} else if (agentInfo.detectTierTablet()) {
return DeviceType.TABLET;
}
return DeviceType.NORMAL;
} | java | public static DeviceType getDevice(final HttpServletRequest request) {
// User agent
String userAgent = ((HttpServletRequest) request).getHeader("User-Agent");
if (Util.empty(userAgent)) {
LOG.warn("No User-Agent details in the request headers. Will assume normal device.");
return DeviceType.NORMAL;
}
// Check for device type
UAgentInfo agentInfo = new UAgentInfo(userAgent, null);
if (agentInfo.detectMobileQuick()) {
return DeviceType.MOBILE;
} else if (agentInfo.detectTierTablet()) {
return DeviceType.TABLET;
}
return DeviceType.NORMAL;
} | [
"public",
"static",
"DeviceType",
"getDevice",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"// User agent",
"String",
"userAgent",
"=",
"(",
"(",
"HttpServletRequest",
")",
"request",
")",
".",
"getHeader",
"(",
"\"User-Agent\"",
")",
";",
"if",
"("... | Determine the user's device type from the {@link HttpServletRequest}.
@param request the request being processed
@return the device type | [
"Determine",
"the",
"user",
"s",
"device",
"type",
"from",
"the",
"{",
"@link",
"HttpServletRequest",
"}",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/ServletUtil.java#L718-L734 |
nutzam/nutzboot | nutzboot-starter/nutzboot-starter-fastdfs/src/main/java/org/nutz/boot/starter/fastdfs/FastdfsService.java | FastdfsService.uploadFile | public String uploadFile(byte[] file, String ext, Map<String, String> metaInfo) {
String path = "";
TrackerServer trackerServer = null;
StorageClient1 storageClient1 = null;
try {
trackerServer = fastDfsClientPool.borrowObject();
storageClient1 = new StorageClient1(trackerServer, null);
NameValuePair data[] = null;
if (Lang.isNotEmpty(metaInfo)) {
data = new NameValuePair[metaInfo.size()];
int index = 0;
for (Map.Entry<String, String> entry : metaInfo.entrySet()) {
data[index] = new NameValuePair(entry.getKey(), entry.getValue());
index++;
}
}
path = storageClient1.uploadFile1(file, ext, data);
} catch (Exception e) {
throw Lang.makeThrow("[FastdfsService] upload file error : %s", e.getMessage());
} finally {
if (trackerServer != null)
fastDfsClientPool.returnObject(trackerServer);
storageClient1 = null;
}
return path;
} | java | public String uploadFile(byte[] file, String ext, Map<String, String> metaInfo) {
String path = "";
TrackerServer trackerServer = null;
StorageClient1 storageClient1 = null;
try {
trackerServer = fastDfsClientPool.borrowObject();
storageClient1 = new StorageClient1(trackerServer, null);
NameValuePair data[] = null;
if (Lang.isNotEmpty(metaInfo)) {
data = new NameValuePair[metaInfo.size()];
int index = 0;
for (Map.Entry<String, String> entry : metaInfo.entrySet()) {
data[index] = new NameValuePair(entry.getKey(), entry.getValue());
index++;
}
}
path = storageClient1.uploadFile1(file, ext, data);
} catch (Exception e) {
throw Lang.makeThrow("[FastdfsService] upload file error : %s", e.getMessage());
} finally {
if (trackerServer != null)
fastDfsClientPool.returnObject(trackerServer);
storageClient1 = null;
}
return path;
} | [
"public",
"String",
"uploadFile",
"(",
"byte",
"[",
"]",
"file",
",",
"String",
"ext",
",",
"Map",
"<",
"String",
",",
"String",
">",
"metaInfo",
")",
"{",
"String",
"path",
"=",
"\"\"",
";",
"TrackerServer",
"trackerServer",
"=",
"null",
";",
"StorageCl... | 上传文件(一次性读取全部字节,尽量不要使用,比较耗内存)
@param file 文件字节
@param ext 后缀名
@param metaInfo 元信息
@return | [
"上传文件",
"(",
"一次性读取全部字节",
"尽量不要使用",
"比较耗内存",
")"
] | train | https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-starter/nutzboot-starter-fastdfs/src/main/java/org/nutz/boot/starter/fastdfs/FastdfsService.java#L199-L224 |
Quickhull3d/quickhull3d | src/main/java/com/github/quickhull3d/Vector3d.java | Vector3d.setRandom | protected void setRandom(double lower, double upper, Random generator) {
double range = upper - lower;
x = generator.nextDouble() * range + lower;
y = generator.nextDouble() * range + lower;
z = generator.nextDouble() * range + lower;
} | java | protected void setRandom(double lower, double upper, Random generator) {
double range = upper - lower;
x = generator.nextDouble() * range + lower;
y = generator.nextDouble() * range + lower;
z = generator.nextDouble() * range + lower;
} | [
"protected",
"void",
"setRandom",
"(",
"double",
"lower",
",",
"double",
"upper",
",",
"Random",
"generator",
")",
"{",
"double",
"range",
"=",
"upper",
"-",
"lower",
";",
"x",
"=",
"generator",
".",
"nextDouble",
"(",
")",
"*",
"range",
"+",
"lower",
... | Sets the elements of this vector to uniformly distributed random values
in a specified range, using a supplied random number generator.
@param lower
lower random value (inclusive)
@param upper
upper random value (exclusive)
@param generator
random number generator | [
"Sets",
"the",
"elements",
"of",
"this",
"vector",
"to",
"uniformly",
"distributed",
"random",
"values",
"in",
"a",
"specified",
"range",
"using",
"a",
"supplied",
"random",
"number",
"generator",
"."
] | train | https://github.com/Quickhull3d/quickhull3d/blob/3f80953b86c46385e84730e5d2a1745cbfa12703/src/main/java/com/github/quickhull3d/Vector3d.java#L369-L375 |
beanshell/beanshell | src/main/java/bsh/Types.java | Types.isBshAssignable | static boolean isBshAssignable( Class toType, Class fromType )
{
try {
return castObject(
toType, fromType, null/*fromValue*/,
ASSIGNMENT, true/*checkOnly*/
) == VALID_CAST;
} catch ( UtilEvalError e ) {
// This should not happen with checkOnly true
throw new InterpreterError("err in cast check: "+e, e);
}
} | java | static boolean isBshAssignable( Class toType, Class fromType )
{
try {
return castObject(
toType, fromType, null/*fromValue*/,
ASSIGNMENT, true/*checkOnly*/
) == VALID_CAST;
} catch ( UtilEvalError e ) {
// This should not happen with checkOnly true
throw new InterpreterError("err in cast check: "+e, e);
}
} | [
"static",
"boolean",
"isBshAssignable",
"(",
"Class",
"toType",
",",
"Class",
"fromType",
")",
"{",
"try",
"{",
"return",
"castObject",
"(",
"toType",
",",
"fromType",
",",
"null",
"/*fromValue*/",
",",
"ASSIGNMENT",
",",
"true",
"/*checkOnly*/",
")",
"==",
... | Test if a type can be converted to another type via BeanShell
extended syntax rules (a superset of Java conversion rules). | [
"Test",
"if",
"a",
"type",
"can",
"be",
"converted",
"to",
"another",
"type",
"via",
"BeanShell",
"extended",
"syntax",
"rules",
"(",
"a",
"superset",
"of",
"Java",
"conversion",
"rules",
")",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Types.java#L370-L381 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/Controller.java | Controller.mapOutField | void mapOutField(Object from, String from_out, Object to, String to_field) {
if (from == ca.getComponent()) {
throw new ComponentException("wrong connect:" + to_field);
}
ComponentAccess ca_from = lookup(from);
Access from_access = ca_from.output(from_out);
checkFA(from_access, from, from_out);
try {
FieldContent.FA f = new FieldContent.FA(to, to_field);
ca_from.setOutput(from_out, new FieldObjectAccess(from_access, f, ens));
if (log.isLoggable(Level.CONFIG)) {
log.config(String.format("@Out(%s) -> field(%s)", from_access, f.toString()));
}
} catch (Exception E) {
throw new ComponentException("No such field '" + to.getClass().getCanonicalName() + "." + to_field + "'");
}
} | java | void mapOutField(Object from, String from_out, Object to, String to_field) {
if (from == ca.getComponent()) {
throw new ComponentException("wrong connect:" + to_field);
}
ComponentAccess ca_from = lookup(from);
Access from_access = ca_from.output(from_out);
checkFA(from_access, from, from_out);
try {
FieldContent.FA f = new FieldContent.FA(to, to_field);
ca_from.setOutput(from_out, new FieldObjectAccess(from_access, f, ens));
if (log.isLoggable(Level.CONFIG)) {
log.config(String.format("@Out(%s) -> field(%s)", from_access, f.toString()));
}
} catch (Exception E) {
throw new ComponentException("No such field '" + to.getClass().getCanonicalName() + "." + to_field + "'");
}
} | [
"void",
"mapOutField",
"(",
"Object",
"from",
",",
"String",
"from_out",
",",
"Object",
"to",
",",
"String",
"to_field",
")",
"{",
"if",
"(",
"from",
"==",
"ca",
".",
"getComponent",
"(",
")",
")",
"{",
"throw",
"new",
"ComponentException",
"(",
"\"wrong... | Map a object to an output field.
@param from
@param from_out
@param to
@param to_field | [
"Map",
"a",
"object",
"to",
"an",
"output",
"field",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Controller.java#L191-L209 |
googleads/googleads-java-lib | examples/adwords_axis/src/main/java/adwords/axis/v201809/extensions/AddSiteLinks.java | AddSiteLinks.createSiteLinkFeedItem | private static SitelinkFeedItem createSiteLinkFeedItem(String sitelinkText, String sitelinkUrl) {
SitelinkFeedItem sitelinkFeedItem = new SitelinkFeedItem();
sitelinkFeedItem.setSitelinkText(sitelinkText);
sitelinkFeedItem.setSitelinkFinalUrls(new UrlList(new String[] {sitelinkUrl}));
return sitelinkFeedItem;
} | java | private static SitelinkFeedItem createSiteLinkFeedItem(String sitelinkText, String sitelinkUrl) {
SitelinkFeedItem sitelinkFeedItem = new SitelinkFeedItem();
sitelinkFeedItem.setSitelinkText(sitelinkText);
sitelinkFeedItem.setSitelinkFinalUrls(new UrlList(new String[] {sitelinkUrl}));
return sitelinkFeedItem;
} | [
"private",
"static",
"SitelinkFeedItem",
"createSiteLinkFeedItem",
"(",
"String",
"sitelinkText",
",",
"String",
"sitelinkUrl",
")",
"{",
"SitelinkFeedItem",
"sitelinkFeedItem",
"=",
"new",
"SitelinkFeedItem",
"(",
")",
";",
"sitelinkFeedItem",
".",
"setSitelinkText",
"... | Creates a new {@link SitelinkFeedItem} with the specified attributes.
@param sitelinkText the text for the sitelink
@param sitelinkUrl the URL for the sitelink
@return a new SitelinkFeedItem | [
"Creates",
"a",
"new",
"{",
"@link",
"SitelinkFeedItem",
"}",
"with",
"the",
"specified",
"attributes",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/extensions/AddSiteLinks.java#L254-L259 |
networknt/light-4j | dump/src/main/java/com/networknt/dump/CookiesDumper.java | CookiesDumper.putDumpInfoTo | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(this.cookieMap.size() > 0) {
result.put(DumpConstants.COOKIES, cookieMap);
}
} | java | @Override
protected void putDumpInfoTo(Map<String, Object> result) {
if(this.cookieMap.size() > 0) {
result.put(DumpConstants.COOKIES, cookieMap);
}
} | [
"@",
"Override",
"protected",
"void",
"putDumpInfoTo",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"if",
"(",
"this",
".",
"cookieMap",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"result",
".",
"put",
"(",
"DumpConstants",
".",... | put cookieMap to result
@param result a Map you want to put dumping info to. | [
"put",
"cookieMap",
"to",
"result"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/CookiesDumper.java#L80-L85 |
sniffy/sniffy | sniffy-core/src/main/java/io/sniffy/LegacySpy.java | LegacySpy.verifyNever | @Deprecated
public C verifyNever(Threads threadMatcher, Query query) throws WrongNumberOfQueriesError {
return verify(SqlQueries.noneQueries().threads(threadMatcher).type(adapter(query)));
} | java | @Deprecated
public C verifyNever(Threads threadMatcher, Query query) throws WrongNumberOfQueriesError {
return verify(SqlQueries.noneQueries().threads(threadMatcher).type(adapter(query)));
} | [
"@",
"Deprecated",
"public",
"C",
"verifyNever",
"(",
"Threads",
"threadMatcher",
",",
"Query",
"query",
")",
"throws",
"WrongNumberOfQueriesError",
"{",
"return",
"verify",
"(",
"SqlQueries",
".",
"noneQueries",
"(",
")",
".",
"threads",
"(",
"threadMatcher",
"... | Alias for {@link #verifyBetween(int, int, Threads, Query)} with arguments 0, 0, {@code threads}, {@code queryType}
@since 2.2 | [
"Alias",
"for",
"{"
] | train | https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L197-L200 |
GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/InMemoryGlobberFileSystem.java | InMemoryGlobberFileSystem.createInstance | public static FileSystem createInstance(
Configuration config, Path workingDirectory, Collection<FileStatus> fileStatuses) {
checkNotNull(config, "configuration can not be null");
FileSystem fileSystem = new InMemoryGlobberFileSystem(workingDirectory, fileStatuses);
fileSystem.setConf(config);
return fileSystem;
} | java | public static FileSystem createInstance(
Configuration config, Path workingDirectory, Collection<FileStatus> fileStatuses) {
checkNotNull(config, "configuration can not be null");
FileSystem fileSystem = new InMemoryGlobberFileSystem(workingDirectory, fileStatuses);
fileSystem.setConf(config);
return fileSystem;
} | [
"public",
"static",
"FileSystem",
"createInstance",
"(",
"Configuration",
"config",
",",
"Path",
"workingDirectory",
",",
"Collection",
"<",
"FileStatus",
">",
"fileStatuses",
")",
"{",
"checkNotNull",
"(",
"config",
",",
"\"configuration can not be null\"",
")",
";",... | Factory method for constructing and initializing an instance of InMemoryGlobberFileSystem which
is ready to list/get FileStatus entries corresponding to {@code fileStatuses}. | [
"Factory",
"method",
"for",
"constructing",
"and",
"initializing",
"an",
"instance",
"of",
"InMemoryGlobberFileSystem",
"which",
"is",
"ready",
"to",
"list",
"/",
"get",
"FileStatus",
"entries",
"corresponding",
"to",
"{"
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/InMemoryGlobberFileSystem.java#L52-L60 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/World.java | World.actorFor | public <T> T actorFor(final Class<T> protocol, final Definition definition) {
if (isTerminated()) {
throw new IllegalStateException("vlingo/actors: Stopped.");
}
return stage().actorFor(protocol, definition);
} | java | public <T> T actorFor(final Class<T> protocol, final Definition definition) {
if (isTerminated()) {
throw new IllegalStateException("vlingo/actors: Stopped.");
}
return stage().actorFor(protocol, definition);
} | [
"public",
"<",
"T",
">",
"T",
"actorFor",
"(",
"final",
"Class",
"<",
"T",
">",
"protocol",
",",
"final",
"Definition",
"definition",
")",
"{",
"if",
"(",
"isTerminated",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"vlingo/actors: S... | Answers the {@code T} protocol of the newly created {@code Actor} that is defined by
the parameters of {@code definition} that implements the {@code protocol}.
@param protocol the {@code Class<T>} protocol that the {@code Actor} supports
@param <T> the protocol type
@param definition the {@code Definition} providing parameters to the {@code Actor}
@return T | [
"Answers",
"the",
"{"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L120-L126 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java | KeyVaultClientCustomImpl.listKeys | public PagedList<KeyItem> listKeys(final String vaultBaseUrl, final Integer maxresults) {
return getKeys(vaultBaseUrl, maxresults);
} | java | public PagedList<KeyItem> listKeys(final String vaultBaseUrl, final Integer maxresults) {
return getKeys(vaultBaseUrl, maxresults);
} | [
"public",
"PagedList",
"<",
"KeyItem",
">",
"listKeys",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"Integer",
"maxresults",
")",
"{",
"return",
"getKeys",
"(",
"vaultBaseUrl",
",",
"maxresults",
")",
";",
"}"
] | List keys in the specified vault.
@param vaultBaseUrl
The vault name, e.g. https://myvault.vault.azure.net
@param maxresults
Maximum number of results to return in a page. If not specified
the service will return up to 25 results.
@return the PagedList<KeyItem> if successful. | [
"List",
"keys",
"in",
"the",
"specified",
"vault",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L882-L884 |
mjdbc/mjdbc | src/main/java/com/github/mjdbc/DbPreparedStatement.java | DbPreparedStatement.bindBean | public DbPreparedStatement<T> bindBean(@NotNull Object bean) throws SQLException {
return bindBean(dbConnection.db, bean, true);
} | java | public DbPreparedStatement<T> bindBean(@NotNull Object bean) throws SQLException {
return bindBean(dbConnection.db, bean, true);
} | [
"public",
"DbPreparedStatement",
"<",
"T",
">",
"bindBean",
"(",
"@",
"NotNull",
"Object",
"bean",
")",
"throws",
"SQLException",
"{",
"return",
"bindBean",
"(",
"dbConnection",
".",
"db",
",",
"bean",
",",
"true",
")",
";",
"}"
] | Sets all bean properties to named parameters.
@param bean bean to map to named SQL parameters.
@return this.
@throws SQLException if anything bad happens during SQL operations or bean field accessors calls. | [
"Sets",
"all",
"bean",
"properties",
"to",
"named",
"parameters",
"."
] | train | https://github.com/mjdbc/mjdbc/blob/9db720a5b3218df38a1e5e59459045234bb6386b/src/main/java/com/github/mjdbc/DbPreparedStatement.java#L242-L244 |
fernandospr/javapns-jdk16 | src/main/java/javapns/notification/Payload.java | Payload.estimatePayloadSizeAfterAdding | public int estimatePayloadSizeAfterAdding(String propertyName, Object propertyValue) {
try {
int maximumPayloadSize = getMaximumPayloadSize();
int currentPayloadSize = getPayloadAsBytesUnchecked().length;
int estimatedSize = currentPayloadSize;
if (propertyName != null && propertyValue != null) {
estimatedSize += 5; // "":""
estimatedSize += propertyName.getBytes(getCharacterEncoding()).length;
int estimatedValueSize = 0;
if (propertyValue instanceof String || propertyValue instanceof Number) estimatedValueSize = propertyValue.toString().getBytes(getCharacterEncoding()).length;
estimatedSize += estimatedValueSize;
}
return estimatedSize;
} catch (Exception e) {
try {
return getPayloadSize();
} catch (Exception e1) {
return 0;
}
}
} | java | public int estimatePayloadSizeAfterAdding(String propertyName, Object propertyValue) {
try {
int maximumPayloadSize = getMaximumPayloadSize();
int currentPayloadSize = getPayloadAsBytesUnchecked().length;
int estimatedSize = currentPayloadSize;
if (propertyName != null && propertyValue != null) {
estimatedSize += 5; // "":""
estimatedSize += propertyName.getBytes(getCharacterEncoding()).length;
int estimatedValueSize = 0;
if (propertyValue instanceof String || propertyValue instanceof Number) estimatedValueSize = propertyValue.toString().getBytes(getCharacterEncoding()).length;
estimatedSize += estimatedValueSize;
}
return estimatedSize;
} catch (Exception e) {
try {
return getPayloadSize();
} catch (Exception e1) {
return 0;
}
}
} | [
"public",
"int",
"estimatePayloadSizeAfterAdding",
"(",
"String",
"propertyName",
",",
"Object",
"propertyValue",
")",
"{",
"try",
"{",
"int",
"maximumPayloadSize",
"=",
"getMaximumPayloadSize",
"(",
")",
";",
"int",
"currentPayloadSize",
"=",
"getPayloadAsBytesUnchecke... | Estimate the size that this payload will take after adding a given property.
For performance reasons, this estimate is not as reliable as actually adding
the property and checking the payload size afterwards.
Currently works well with strings and numbers.
@param propertyName the name of the property to use for calculating the estimation
@param propertyValue the value of the property to use for calculating the estimation
@return an estimated payload size if the property were to be added to the payload | [
"Estimate",
"the",
"size",
"that",
"this",
"payload",
"will",
"take",
"after",
"adding",
"a",
"given",
"property",
".",
"For",
"performance",
"reasons",
"this",
"estimate",
"is",
"not",
"as",
"reliable",
"as",
"actually",
"adding",
"the",
"property",
"and",
... | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/notification/Payload.java#L200-L222 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java | ProxyTask.getNextObjectParam | public Object getNextObjectParam(InputStream in, String strName, Map<String, Object> properties)
{
String strParam = this.getNextStringParam(in, strName, properties);
strParam = Base64.decode(strParam);
return org.jbundle.thin.base.remote.proxy.transport.BaseTransport.convertStringToObject(strParam);
} | java | public Object getNextObjectParam(InputStream in, String strName, Map<String, Object> properties)
{
String strParam = this.getNextStringParam(in, strName, properties);
strParam = Base64.decode(strParam);
return org.jbundle.thin.base.remote.proxy.transport.BaseTransport.convertStringToObject(strParam);
} | [
"public",
"Object",
"getNextObjectParam",
"(",
"InputStream",
"in",
",",
"String",
"strName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"strParam",
"=",
"this",
".",
"getNextStringParam",
"(",
"in",
",",
"strName",
",",... | Get the next (String) param.
@param strName The param name (in most implementations this is optional).
@param properties The temporary remote session properties
@return The next param as a string. | [
"Get",
"the",
"next",
"(",
"String",
")",
"param",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java#L294-L299 |
kubernetes-client/java | kubernetes/src/main/java/io/kubernetes/client/ApiClient.java | ApiClient.updateParamsForAuth | public void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams) {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
auth.applyToParams(queryParams, headerParams);
}
} | java | public void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams) {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
auth.applyToParams(queryParams, headerParams);
}
} | [
"public",
"void",
"updateParamsForAuth",
"(",
"String",
"[",
"]",
"authNames",
",",
"List",
"<",
"Pair",
">",
"queryParams",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headerParams",
")",
"{",
"for",
"(",
"String",
"authName",
":",
"authNames",
")",
... | Update query and header parameters based on authentication settings.
@param authNames The authentications to apply
@param queryParams List of query parameters
@param headerParams Map of header parameters | [
"Update",
"query",
"and",
"header",
"parameters",
"based",
"on",
"authentication",
"settings",
"."
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/ApiClient.java#L1043-L1049 |
weld/core | impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java | AnnotatedTypes.compareAnnotatedParameters | public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) {
return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2);
} | java | public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) {
return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2);
} | [
"public",
"static",
"boolean",
"compareAnnotatedParameters",
"(",
"AnnotatedParameter",
"<",
"?",
">",
"p1",
",",
"AnnotatedParameter",
"<",
"?",
">",
"p2",
")",
"{",
"return",
"compareAnnotatedCallable",
"(",
"p1",
".",
"getDeclaringCallable",
"(",
")",
",",
"p... | Compares two annotated parameters and returns true if they are equal | [
"Compares",
"two",
"annotated",
"parameters",
"and",
"returns",
"true",
"if",
"they",
"are",
"equal"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L450-L452 |
ReactiveX/RxJavaGuava | src/main/java/rx/transformer/GuavaTransformers.java | GuavaTransformers.toImmutableList | public static <T> Observable.Transformer<T,ImmutableList<T>> toImmutableList() {
return new Observable.Transformer<T, ImmutableList<T>>() {
@Override
public Observable<ImmutableList<T>> call(Observable<T> source) {
return source.collect(new Func0<ImmutableList.Builder<T>>() {
@Override
public ImmutableList.Builder<T> call() {
return ImmutableList.builder();
}
}, new Action2<ImmutableList.Builder<T>, T>() {
@Override
public void call(ImmutableList.Builder<T> builder, T t) {
builder.add(t);
}
})
.map(new Func1<ImmutableList.Builder<T>, ImmutableList<T>>() {
@Override
public ImmutableList<T> call(ImmutableList.Builder<T> builder) {
return builder.build();
}
});
}
};
} | java | public static <T> Observable.Transformer<T,ImmutableList<T>> toImmutableList() {
return new Observable.Transformer<T, ImmutableList<T>>() {
@Override
public Observable<ImmutableList<T>> call(Observable<T> source) {
return source.collect(new Func0<ImmutableList.Builder<T>>() {
@Override
public ImmutableList.Builder<T> call() {
return ImmutableList.builder();
}
}, new Action2<ImmutableList.Builder<T>, T>() {
@Override
public void call(ImmutableList.Builder<T> builder, T t) {
builder.add(t);
}
})
.map(new Func1<ImmutableList.Builder<T>, ImmutableList<T>>() {
@Override
public ImmutableList<T> call(ImmutableList.Builder<T> builder) {
return builder.build();
}
});
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Observable",
".",
"Transformer",
"<",
"T",
",",
"ImmutableList",
"<",
"T",
">",
">",
"toImmutableList",
"(",
")",
"{",
"return",
"new",
"Observable",
".",
"Transformer",
"<",
"T",
",",
"ImmutableList",
"<",
"T",
">",
... | Returns a Transformer<T,ImmutableList<T>> that maps an Observable<T> to an Observable<ImmutableList<T>> | [
"Returns",
"a",
"Transformer<",
";",
"T",
"ImmutableList<",
";",
"T>",
";",
">",
"that",
"maps",
"an",
"Observable<",
";",
"T>",
";",
"to",
"an",
"Observable<",
";",
"ImmutableList<",
";",
"T>",
";",
">",
";"
] | train | https://github.com/ReactiveX/RxJavaGuava/blob/bfb5da6e073364a96da23d57f47c6b706fb733aa/src/main/java/rx/transformer/GuavaTransformers.java#L38-L61 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java | JawrRequestHandler.initResourceReaderHandler | protected ResourceReaderHandler initResourceReaderHandler() {
ResourceReaderHandler rsHandler = null;
if (servletContext != null) {
try {
rsHandler = new ServletContextResourceReaderHandler(servletContext, jawrConfig, generatorRegistry);
} catch (IOException e) {
throw new BundlingProcessException(e);
}
}
return rsHandler;
} | java | protected ResourceReaderHandler initResourceReaderHandler() {
ResourceReaderHandler rsHandler = null;
if (servletContext != null) {
try {
rsHandler = new ServletContextResourceReaderHandler(servletContext, jawrConfig, generatorRegistry);
} catch (IOException e) {
throw new BundlingProcessException(e);
}
}
return rsHandler;
} | [
"protected",
"ResourceReaderHandler",
"initResourceReaderHandler",
"(",
")",
"{",
"ResourceReaderHandler",
"rsHandler",
"=",
"null",
";",
"if",
"(",
"servletContext",
"!=",
"null",
")",
"{",
"try",
"{",
"rsHandler",
"=",
"new",
"ServletContextResourceReaderHandler",
"... | Initialize the resource reader handler
@return the resource reader handler | [
"Initialize",
"the",
"resource",
"reader",
"handler"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java#L582-L593 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/document/RtfDocument.java | RtfDocument.subMatch | private static boolean subMatch(final String str, int soff, final byte[] m)
{
for(int k = 0; k < m.length; k++) {
if(str.charAt(soff++) != m[k]) {
return false;
}
}
return true;
} | java | private static boolean subMatch(final String str, int soff, final byte[] m)
{
for(int k = 0; k < m.length; k++) {
if(str.charAt(soff++) != m[k]) {
return false;
}
}
return true;
} | [
"private",
"static",
"boolean",
"subMatch",
"(",
"final",
"String",
"str",
",",
"int",
"soff",
",",
"final",
"byte",
"[",
"]",
"m",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"m",
".",
"length",
";",
"k",
"++",
")",
"{",
"if",
... | Returns <code>true</code> if <tt>m.length</tt> characters in <tt>str</tt>, starting at offset <tt>soff</tt>
match the bytes in the given array <tt>m</tt>.
@param str the string to search for a match
@param soff the starting offset in str
@param m the array to match
@return <code>true</code> if there is match | [
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"<tt",
">",
"m",
".",
"length<",
"/",
"tt",
">",
"characters",
"in",
"<tt",
">",
"str<",
"/",
"tt",
">",
"starting",
"at",
"offset",
"<tt",
">",
"soff<",
"/",
"tt",
">",
"match",
"the",
"b... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/document/RtfDocument.java#L314-L322 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.