repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
raydac/netbeans-mmd-plugin | mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java | Utils.findFirstElement | @Nullable
public static Element findFirstElement(@Nonnull final Element node, @Nonnull final String elementName) {
Element result = null;
for (final Element l : Utils.findDirectChildrenForName(node, elementName)) {
result = l;
break;
}
return result;
} | java | @Nullable
public static Element findFirstElement(@Nonnull final Element node, @Nonnull final String elementName) {
Element result = null;
for (final Element l : Utils.findDirectChildrenForName(node, elementName)) {
result = l;
break;
}
return result;
} | [
"@",
"Nullable",
"public",
"static",
"Element",
"findFirstElement",
"(",
"@",
"Nonnull",
"final",
"Element",
"node",
",",
"@",
"Nonnull",
"final",
"String",
"elementName",
")",
"{",
"Element",
"result",
"=",
"null",
";",
"for",
"(",
"final",
"Element",
"l",
... | Get first direct child for name.
@param node element to find children
@param elementName name of child element
@return found first child or null if not found
@since 1.4.0 | [
"Get",
"first",
"direct",
"child",
"for",
"name",
"."
] | train | https://github.com/raydac/netbeans-mmd-plugin/blob/997493d23556a25354372b6419a64a0fbd0ac6ba/mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java#L209-L217 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/KeyRange.java | KeyRange.closedClosed | public static KeyRange closedClosed(Key start, Key end) {
return new KeyRange(checkNotNull(start), Endpoint.CLOSED, checkNotNull(end), Endpoint.CLOSED);
} | java | public static KeyRange closedClosed(Key start, Key end) {
return new KeyRange(checkNotNull(start), Endpoint.CLOSED, checkNotNull(end), Endpoint.CLOSED);
} | [
"public",
"static",
"KeyRange",
"closedClosed",
"(",
"Key",
"start",
",",
"Key",
"end",
")",
"{",
"return",
"new",
"KeyRange",
"(",
"checkNotNull",
"(",
"start",
")",
",",
"Endpoint",
".",
"CLOSED",
",",
"checkNotNull",
"(",
"end",
")",
",",
"Endpoint",
... | Returns a key range from {@code start} inclusive to {@code end} inclusive. | [
"Returns",
"a",
"key",
"range",
"from",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/KeyRange.java#L157-L159 |
tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getParameterTypes | public static final Class[] getParameterTypes(Object bean, String property)
{
Type type = (Type) doFor(
bean,
property,
null,
(Object a, int i)->{Object o = Array.get(a, i);return o!=null?o.getClass().getComponentType():null;},
(List l, int i)->{return l.get(i).getClass().getGenericSuperclass();},
(Object o, Class c, String p)->{return getField(c, p).getGenericType();},
(Object o, Method m)->{return m.getGenericReturnType();});
if (type instanceof ParameterizedType)
{
ParameterizedType pt = (ParameterizedType) type;
Type[] ata = pt.getActualTypeArguments();
if (ata.length > 0)
{
Class[] ca = new Class[ata.length];
for (int ii=0;ii<ca.length;ii++)
{
ca[ii] = (Class) ata[ii];
}
return ca;
}
}
if (type instanceof Class)
{
Class cls = (Class) type;
if (cls.isArray())
{
cls = cls.getComponentType();
}
return new Class[] {cls};
}
return null;
} | java | public static final Class[] getParameterTypes(Object bean, String property)
{
Type type = (Type) doFor(
bean,
property,
null,
(Object a, int i)->{Object o = Array.get(a, i);return o!=null?o.getClass().getComponentType():null;},
(List l, int i)->{return l.get(i).getClass().getGenericSuperclass();},
(Object o, Class c, String p)->{return getField(c, p).getGenericType();},
(Object o, Method m)->{return m.getGenericReturnType();});
if (type instanceof ParameterizedType)
{
ParameterizedType pt = (ParameterizedType) type;
Type[] ata = pt.getActualTypeArguments();
if (ata.length > 0)
{
Class[] ca = new Class[ata.length];
for (int ii=0;ii<ca.length;ii++)
{
ca[ii] = (Class) ata[ii];
}
return ca;
}
}
if (type instanceof Class)
{
Class cls = (Class) type;
if (cls.isArray())
{
cls = cls.getComponentType();
}
return new Class[] {cls};
}
return null;
} | [
"public",
"static",
"final",
"Class",
"[",
"]",
"getParameterTypes",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"{",
"Type",
"type",
"=",
"(",
"Type",
")",
"doFor",
"(",
"bean",
",",
"property",
",",
"null",
",",
"(",
"Object",
"a",
",",
... | Returns actual parameter types for property
@param bean
@param property
@return | [
"Returns",
"actual",
"parameter",
"types",
"for",
"property"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L227-L261 |
killbill/killbill | api/src/main/java/org/killbill/billing/callcontext/InternalCallContext.java | InternalCallContext.toCallContext | public CallContext toCallContext(final UUID accountId, final UUID tenantId) {
return new DefaultCallContext(accountId, tenantId, createdBy, callOrigin, contextUserType, reasonCode, comments, userToken, createdDate, updatedDate);
} | java | public CallContext toCallContext(final UUID accountId, final UUID tenantId) {
return new DefaultCallContext(accountId, tenantId, createdBy, callOrigin, contextUserType, reasonCode, comments, userToken, createdDate, updatedDate);
} | [
"public",
"CallContext",
"toCallContext",
"(",
"final",
"UUID",
"accountId",
",",
"final",
"UUID",
"tenantId",
")",
"{",
"return",
"new",
"DefaultCallContext",
"(",
"accountId",
",",
"tenantId",
",",
"createdBy",
",",
"callOrigin",
",",
"contextUserType",
",",
"... | Unfortunately not true as some APIs ae hidden in object -- e.g OverdueStateApplicator is doing subscription.cancelEntitlementWithDateOverrideBillingPolicy | [
"Unfortunately",
"not",
"true",
"as",
"some",
"APIs",
"ae",
"hidden",
"in",
"object",
"--",
"e",
".",
"g",
"OverdueStateApplicator",
"is",
"doing",
"subscription",
".",
"cancelEntitlementWithDateOverrideBillingPolicy"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/api/src/main/java/org/killbill/billing/callcontext/InternalCallContext.java#L107-L109 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java | FindingReplacing.setBetnNext | public AsymmMultiPos<S, String, String> setBetnNext(String leftSameWithRight) {
return new AsymmMultiPos<S, String, String>(leftSameWithRight, leftSameWithRight) {
@Override protected S result() {
if (Strs.isEmpty(asymmLR)) {
return delegateQueue('N', left, right, pos, position, inclusive, plusminus, filltgt);
} else { return delegateQueue('Z', left, left, pos, asymmLR, inclusive, plusminus, filltgt); }
}
};
} | java | public AsymmMultiPos<S, String, String> setBetnNext(String leftSameWithRight) {
return new AsymmMultiPos<S, String, String>(leftSameWithRight, leftSameWithRight) {
@Override protected S result() {
if (Strs.isEmpty(asymmLR)) {
return delegateQueue('N', left, right, pos, position, inclusive, plusminus, filltgt);
} else { return delegateQueue('Z', left, left, pos, asymmLR, inclusive, plusminus, filltgt); }
}
};
} | [
"public",
"AsymmMultiPos",
"<",
"S",
",",
"String",
",",
"String",
">",
"setBetnNext",
"(",
"String",
"leftSameWithRight",
")",
"{",
"return",
"new",
"AsymmMultiPos",
"<",
"S",
",",
"String",
",",
"String",
">",
"(",
"leftSameWithRight",
",",
"leftSameWithRigh... | Sets the substrings in given same left tag and right tag as the result string, Adjacent tag matches
<p><b>The look result same as {@link StrMatcher#finder()}'s behavior</b>
@see StrMatcher#finder()
@param leftSameWithRight
@return | [
"Sets",
"the",
"substrings",
"in",
"given",
"same",
"left",
"tag",
"and",
"right",
"tag",
"as",
"the",
"result",
"string",
"Adjacent",
"tag",
"matches",
"<p",
">",
"<b",
">",
"The",
"look",
"result",
"same",
"as",
"{",
"@link",
"StrMatcher#finder",
"()",
... | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java#L454-L463 |
mbenson/therian | core/src/main/java/therian/util/Types.java | Types.resolveAt | public static Type resolveAt(Object o, TypeVariable<?> var) {
Validate.notNull(var, "no variable to read");
final GenericDeclaration genericDeclaration = var.getGenericDeclaration();
Validate.isInstanceOf(Class.class, genericDeclaration, "%s is not declared by a Class",
TypeUtils.toLongString(var));
return resolveAt(o, var, TypeUtils.getTypeArguments(o.getClass(), (Class<?>) genericDeclaration));
} | java | public static Type resolveAt(Object o, TypeVariable<?> var) {
Validate.notNull(var, "no variable to read");
final GenericDeclaration genericDeclaration = var.getGenericDeclaration();
Validate.isInstanceOf(Class.class, genericDeclaration, "%s is not declared by a Class",
TypeUtils.toLongString(var));
return resolveAt(o, var, TypeUtils.getTypeArguments(o.getClass(), (Class<?>) genericDeclaration));
} | [
"public",
"static",
"Type",
"resolveAt",
"(",
"Object",
"o",
",",
"TypeVariable",
"<",
"?",
">",
"var",
")",
"{",
"Validate",
".",
"notNull",
"(",
"var",
",",
"\"no variable to read\"",
")",
";",
"final",
"GenericDeclaration",
"genericDeclaration",
"=",
"var",... | Tries to "read" a {@link TypeVariable} from an object instance, taking into account {@link BindTypeVariable} and
{@link Typed} before falling back to basic type
@param o
@param var
@return Type resolved or {@code null} | [
"Tries",
"to",
"read",
"a",
"{",
"@link",
"TypeVariable",
"}",
"from",
"an",
"object",
"instance",
"taking",
"into",
"account",
"{",
"@link",
"BindTypeVariable",
"}",
"and",
"{",
"@link",
"Typed",
"}",
"before",
"falling",
"back",
"to",
"basic",
"type"
] | train | https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Types.java#L94-L100 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/MergeTableHandler.java | MergeTableHandler.init | public void init(BaseField field, Record mergeTable, Record subTable, ScreenParent gridScreen)
{
super.init(field);
m_gridScreen = gridScreen;
m_mergeRecord = mergeTable;
m_subRecord = subTable;
if (subTable != null)
{ // Remove this listener when the file closes
FileListener listener = new FileRemoveBOnCloseHandler(this); // If this closes first, this will remove FileListener
subTable.addListener(listener); // Remove this if you close the file first
}
} | java | public void init(BaseField field, Record mergeTable, Record subTable, ScreenParent gridScreen)
{
super.init(field);
m_gridScreen = gridScreen;
m_mergeRecord = mergeTable;
m_subRecord = subTable;
if (subTable != null)
{ // Remove this listener when the file closes
FileListener listener = new FileRemoveBOnCloseHandler(this); // If this closes first, this will remove FileListener
subTable.addListener(listener); // Remove this if you close the file first
}
} | [
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"Record",
"mergeTable",
",",
"Record",
"subTable",
",",
"ScreenParent",
"gridScreen",
")",
"{",
"super",
".",
"init",
"(",
"field",
")",
";",
"m_gridScreen",
"=",
"gridScreen",
";",
"m_mergeRecord",
"... | Constructor.
@param field The basefield owner of this listener (usually null and set on setOwner()).
@param mergeTable The parent merge record.
@param subTable The sub-record to add and remove from the parent merge record.
@param gridScreen The (optional) grid screen to requery on change. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MergeTableHandler.java#L71-L82 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/PropertiesField.java | PropertiesField.getNewValue | public String getNewValue(String strKey, String strReadValue, String strOrigValue, String strCurrentValue)
{
String strNewValue = null;
if (((strCurrentValue != null) && (strCurrentValue.equals(strOrigValue)))
|| ((strCurrentValue == null) && (strOrigValue == null)))
{ // I have't changed it, so use the read value
strNewValue = strReadValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strOrigValue)))
|| ((strReadValue == null) && (strOrigValue == null)))
{ // Someone else didn't change it, use current value
strNewValue = strCurrentValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strCurrentValue)))
|| ((strReadValue == null) && (strCurrentValue == null)))
{ // The read value and my value are the same... good, use it
strNewValue = strCurrentValue;
}
else
{ // All three values are different... figure out which to use
strNewValue = this.mergeKey(strKey, strReadValue, strCurrentValue); // I HAVE changed it, so I need to figure out which one is better
}
return strNewValue;
} | java | public String getNewValue(String strKey, String strReadValue, String strOrigValue, String strCurrentValue)
{
String strNewValue = null;
if (((strCurrentValue != null) && (strCurrentValue.equals(strOrigValue)))
|| ((strCurrentValue == null) && (strOrigValue == null)))
{ // I have't changed it, so use the read value
strNewValue = strReadValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strOrigValue)))
|| ((strReadValue == null) && (strOrigValue == null)))
{ // Someone else didn't change it, use current value
strNewValue = strCurrentValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strCurrentValue)))
|| ((strReadValue == null) && (strCurrentValue == null)))
{ // The read value and my value are the same... good, use it
strNewValue = strCurrentValue;
}
else
{ // All three values are different... figure out which to use
strNewValue = this.mergeKey(strKey, strReadValue, strCurrentValue); // I HAVE changed it, so I need to figure out which one is better
}
return strNewValue;
} | [
"public",
"String",
"getNewValue",
"(",
"String",
"strKey",
",",
"String",
"strReadValue",
",",
"String",
"strOrigValue",
",",
"String",
"strCurrentValue",
")",
"{",
"String",
"strNewValue",
"=",
"null",
";",
"if",
"(",
"(",
"(",
"strCurrentValue",
"!=",
"null... | Given the read, original, and current values for this key, decide which to use.
@param strKey
@param strReadValue
@param strOrigValue
@param strCurrentValue
@return | [
"Given",
"the",
"read",
"original",
"and",
"current",
"values",
"for",
"this",
"key",
"decide",
"which",
"to",
"use",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L557-L580 |
vladmihalcea/flexy-pool | flexy-dropwizard3-metrics/src/main/java/com/vladmihalcea/flexypool/metric/codahale/Slf4jMetricReporter.java | Slf4jMetricReporter.init | @Override
public Slf4jMetricReporter init(ConfigurationProperties configurationProperties, MetricRegistry metricRegistry) {
metricLogReporterMillis = configurationProperties.getMetricLogReporterMillis();
if (metricLogReporterMillis > 0) {
this.slf4jReporter = Slf4jReporter
.forRegistry(metricRegistry)
.outputTo(LOGGER)
.build();
}
return this;
} | java | @Override
public Slf4jMetricReporter init(ConfigurationProperties configurationProperties, MetricRegistry metricRegistry) {
metricLogReporterMillis = configurationProperties.getMetricLogReporterMillis();
if (metricLogReporterMillis > 0) {
this.slf4jReporter = Slf4jReporter
.forRegistry(metricRegistry)
.outputTo(LOGGER)
.build();
}
return this;
} | [
"@",
"Override",
"public",
"Slf4jMetricReporter",
"init",
"(",
"ConfigurationProperties",
"configurationProperties",
",",
"MetricRegistry",
"metricRegistry",
")",
"{",
"metricLogReporterMillis",
"=",
"configurationProperties",
".",
"getMetricLogReporterMillis",
"(",
")",
";",... | Create a Log Reporter and activate it if the metricLogReporterMillis property is greater than zero.
@param configurationProperties configuration properties
@param metricRegistry metric registry
@return {@link Slf4jMetricReporter} | [
"Create",
"a",
"Log",
"Reporter",
"and",
"activate",
"it",
"if",
"the",
"metricLogReporterMillis",
"property",
"is",
"greater",
"than",
"zero",
"."
] | train | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-dropwizard3-metrics/src/main/java/com/vladmihalcea/flexypool/metric/codahale/Slf4jMetricReporter.java#L32-L42 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.noNullElements | public <T extends Iterable<?>> T noNullElements(final T iterable, final String message, final Object... values) {
notNull(iterable);
final int index = indexOfNullElement(iterable);
if (index != -1) {
fail(String.format(message, ArrayUtils.addAll(this, values, index)));
}
return iterable;
} | java | public <T extends Iterable<?>> T noNullElements(final T iterable, final String message, final Object... values) {
notNull(iterable);
final int index = indexOfNullElement(iterable);
if (index != -1) {
fail(String.format(message, ArrayUtils.addAll(this, values, index)));
}
return iterable;
} | [
"public",
"<",
"T",
"extends",
"Iterable",
"<",
"?",
">",
">",
"T",
"noNullElements",
"(",
"final",
"T",
"iterable",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"notNull",
"(",
"iterable",
")",
";",
"final",
"i... | <p>Validate that the specified argument iterable is neither {@code null} nor contains any elements that are {@code null}; otherwise throwing an exception with the specified message. </p>
<pre>Validate.noNullElements(myCollection, "The collection contains null at position %d");</pre>
<p>If the iterable is {@code null}, then the message in the exception is "The validated object is null".</p><p>If the iterable has a {@code null} element, then the iteration index of
the invalid element is appended to the {@code values} argument.</p>
@param <T>
the iterable type
@param iterable
the iterable to check, validated not null by this method
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@return the validated iterable (never {@code null} method for chaining)
@throws NullPointerValidationException
if the array is {@code null}
@throws IllegalArgumentException
if an element is {@code null}
@see #noNullElements(Iterable) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"iterable",
"is",
"neither",
"{",
"@code",
"null",
"}",
"nor",
"contains",
"any",
"elements",
"that",
"are",
"{",
"@code",
"null",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L892-L900 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/selectBooleanCheckbox/SelectBooleanCheckboxRenderer.java | SelectBooleanCheckboxRenderer.renderInputTagEnd | protected void renderInputTagEnd(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox)
throws IOException {
rw.endElement("input");
String caption = selectBooleanCheckbox.getCaption();
if (null != caption) {
if (selectBooleanCheckbox.isEscape()) {
rw.writeText(" " + caption, null);
} else {
rw.append(" " + caption);
}
}
rw.endElement("label");
rw.endElement("div");
} | java | protected void renderInputTagEnd(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox)
throws IOException {
rw.endElement("input");
String caption = selectBooleanCheckbox.getCaption();
if (null != caption) {
if (selectBooleanCheckbox.isEscape()) {
rw.writeText(" " + caption, null);
} else {
rw.append(" " + caption);
}
}
rw.endElement("label");
rw.endElement("div");
} | [
"protected",
"void",
"renderInputTagEnd",
"(",
"ResponseWriter",
"rw",
",",
"SelectBooleanCheckbox",
"selectBooleanCheckbox",
")",
"throws",
"IOException",
"{",
"rw",
".",
"endElement",
"(",
"\"input\"",
")",
";",
"String",
"caption",
"=",
"selectBooleanCheckbox",
"."... | Closes the input tag. This method is protected in order to allow
third-party frameworks to derive from it.
@param rw
the response writer
@param selectBooleanCheckbox
the component to render
@throws IOException
may be thrown by the response writer | [
"Closes",
"the",
"input",
"tag",
".",
"This",
"method",
"is",
"protected",
"in",
"order",
"to",
"allow",
"third",
"-",
"party",
"frameworks",
"to",
"derive",
"from",
"it",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectBooleanCheckbox/SelectBooleanCheckboxRenderer.java#L340-L353 |
icode/ameba | src/main/java/ameba/container/Container.java | Container.registerBinder | protected void registerBinder(ResourceConfig configuration) {
configuration.register(new AbstractBinder() {
@Override
protected void configure() {
bind(Container.this).to(Container.class).proxy(false);
}
});
configuration.registerInstances(new ContainerLifecycleListener() {
@Override
public void onStartup(org.glassfish.jersey.server.spi.Container container) {
SystemEventBus.publish(new StartupEvent(Container.this, application));
logger.trace(Messages.get("info.container.startup"));
}
@Override
public void onReload(org.glassfish.jersey.server.spi.Container container) {
SystemEventBus.publish(new ReloadedEvent(Container.this, application));
logger.trace(Messages.get("info.container.reload"));
}
@Override
public void onShutdown(org.glassfish.jersey.server.spi.Container container) {
logger.info("Container onShutdown");
SystemEventBus.publish(new ShutdownEvent(Container.this, application));
logger.trace(Messages.get("info.container.shutdown"));
}
});
} | java | protected void registerBinder(ResourceConfig configuration) {
configuration.register(new AbstractBinder() {
@Override
protected void configure() {
bind(Container.this).to(Container.class).proxy(false);
}
});
configuration.registerInstances(new ContainerLifecycleListener() {
@Override
public void onStartup(org.glassfish.jersey.server.spi.Container container) {
SystemEventBus.publish(new StartupEvent(Container.this, application));
logger.trace(Messages.get("info.container.startup"));
}
@Override
public void onReload(org.glassfish.jersey.server.spi.Container container) {
SystemEventBus.publish(new ReloadedEvent(Container.this, application));
logger.trace(Messages.get("info.container.reload"));
}
@Override
public void onShutdown(org.glassfish.jersey.server.spi.Container container) {
logger.info("Container onShutdown");
SystemEventBus.publish(new ShutdownEvent(Container.this, application));
logger.trace(Messages.get("info.container.shutdown"));
}
});
} | [
"protected",
"void",
"registerBinder",
"(",
"ResourceConfig",
"configuration",
")",
"{",
"configuration",
".",
"register",
"(",
"new",
"AbstractBinder",
"(",
")",
"{",
"@",
"Override",
"protected",
"void",
"configure",
"(",
")",
"{",
"bind",
"(",
"Container",
... | <p>registerBinder.</p>
@param configuration a {@link org.glassfish.jersey.server.ResourceConfig} object.
@since 0.1.6e | [
"<p",
">",
"registerBinder",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/container/Container.java#L75-L102 |
liferay/com-liferay-commerce | commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java | CPDefinitionGroupedEntryPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPDefinitionGroupedEntry cpDefinitionGroupedEntry : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinitionGroupedEntry);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPDefinitionGroupedEntry cpDefinitionGroupedEntry : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinitionGroupedEntry);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CPDefinitionGroupedEntry",
"cpDefinitionGroupedEntry",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS"... | Removes all the cp definition grouped entries where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"cp",
"definition",
"grouped",
"entries",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L1418-L1424 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/writer/vml/geometry/PointWriter.java | PointWriter.writeObject | public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
document.writeElement("vml:shape", asChild);
Point p = (Point) o;
String adj = document.getFormatter().format(p.getX()) + ","
+ document.getFormatter().format(p.getY());
document.writeAttribute("adj", adj);
} | java | public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
document.writeElement("vml:shape", asChild);
Point p = (Point) o;
String adj = document.getFormatter().format(p.getX()) + ","
+ document.getFormatter().format(p.getY());
document.writeAttribute("adj", adj);
} | [
"public",
"void",
"writeObject",
"(",
"Object",
"o",
",",
"GraphicsDocument",
"document",
",",
"boolean",
"asChild",
")",
"throws",
"RenderException",
"{",
"document",
".",
"writeElement",
"(",
"\"vml:shape\"",
",",
"asChild",
")",
";",
"Point",
"p",
"=",
"(",... | Writes the object to the specified document, optionally creating a child
element. The object in this case should be a point.
@param o the object (of type Point).
@param document the document to write to.
@param asChild create child element if true.
@throws RenderException | [
"Writes",
"the",
"object",
"to",
"the",
"specified",
"document",
"optionally",
"creating",
"a",
"child",
"element",
".",
"The",
"object",
"in",
"this",
"case",
"should",
"be",
"a",
"point",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/writer/vml/geometry/PointWriter.java#L38-L44 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/autoscale/autoscalepolicy_stats.java | autoscalepolicy_stats.get | public static autoscalepolicy_stats get(nitro_service service, String name) throws Exception{
autoscalepolicy_stats obj = new autoscalepolicy_stats();
obj.set_name(name);
autoscalepolicy_stats response = (autoscalepolicy_stats) obj.stat_resource(service);
return response;
} | java | public static autoscalepolicy_stats get(nitro_service service, String name) throws Exception{
autoscalepolicy_stats obj = new autoscalepolicy_stats();
obj.set_name(name);
autoscalepolicy_stats response = (autoscalepolicy_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"autoscalepolicy_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"autoscalepolicy_stats",
"obj",
"=",
"new",
"autoscalepolicy_stats",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
... | Use this API to fetch statistics of autoscalepolicy_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"autoscalepolicy_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/autoscale/autoscalepolicy_stats.java#L169-L174 |
google/closure-templates | java/src/com/google/template/soy/error/SoyErrors.java | SoyErrors.getClosest | @Nullable
@VisibleForTesting
static String getClosest(Iterable<String> allNames, String wrongName) {
// only suggest matches that are closer than this. This magic heuristic is based on what llvm
// and javac do
int shortest = (wrongName.length() + 2) / 3 + 1;
String closestName = null;
for (String otherName : allNames) {
if (otherName.equals(wrongName)) {
throw new IllegalArgumentException("'" + wrongName + "' is contained in " + allNames);
}
int distance = distance(otherName, wrongName, shortest);
if (distance < shortest) {
shortest = distance;
closestName = otherName;
if (distance == 0) {
return closestName;
}
}
}
return closestName;
} | java | @Nullable
@VisibleForTesting
static String getClosest(Iterable<String> allNames, String wrongName) {
// only suggest matches that are closer than this. This magic heuristic is based on what llvm
// and javac do
int shortest = (wrongName.length() + 2) / 3 + 1;
String closestName = null;
for (String otherName : allNames) {
if (otherName.equals(wrongName)) {
throw new IllegalArgumentException("'" + wrongName + "' is contained in " + allNames);
}
int distance = distance(otherName, wrongName, shortest);
if (distance < shortest) {
shortest = distance;
closestName = otherName;
if (distance == 0) {
return closestName;
}
}
}
return closestName;
} | [
"@",
"Nullable",
"@",
"VisibleForTesting",
"static",
"String",
"getClosest",
"(",
"Iterable",
"<",
"String",
">",
"allNames",
",",
"String",
"wrongName",
")",
"{",
"// only suggest matches that are closer than this. This magic heuristic is based on what llvm",
"// and javac do... | Returns the member of {@code allNames} that is closest to {@code wrongName}, or {@code null} if
{@code allNames} is empty.
<p>The distance metric is a case insensitive Levenshtein distance.
@throws IllegalArgumentException if {@code wrongName} is a member of {@code allNames} | [
"Returns",
"the",
"member",
"of",
"{",
"@code",
"allNames",
"}",
"that",
"is",
"closest",
"to",
"{",
"@code",
"wrongName",
"}",
"or",
"{",
"@code",
"null",
"}",
"if",
"{",
"@code",
"allNames",
"}",
"is",
"empty",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/error/SoyErrors.java#L69-L90 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withValueCopier | public CacheConfigurationBuilder<K, V> withValueCopier(Copier<V> valueCopier) {
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(valueCopier, "Null value copier"), DefaultCopierConfiguration.Type.VALUE));
} | java | public CacheConfigurationBuilder<K, V> withValueCopier(Copier<V> valueCopier) {
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(valueCopier, "Null value copier"), DefaultCopierConfiguration.Type.VALUE));
} | [
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withValueCopier",
"(",
"Copier",
"<",
"V",
">",
"valueCopier",
")",
"{",
"return",
"withCopier",
"(",
"new",
"DefaultCopierConfiguration",
"<>",
"(",
"requireNonNull",
"(",
"valueCopier",
",",
"\"N... | Adds by-value semantic using the provided {@link Copier} for the value on heap.
<p>
{@link Copier}s are what enable control of by-reference / by-value semantics for on-heap tier.
@param valueCopier the value copier to use
@return a new builder with the added value copier | [
"Adds",
"by",
"-",
"value",
"semantic",
"using",
"the",
"provided",
"{",
"@link",
"Copier",
"}",
"for",
"the",
"value",
"on",
"heap",
".",
"<p",
">",
"{",
"@link",
"Copier",
"}",
"s",
"are",
"what",
"enable",
"control",
"of",
"by",
"-",
"reference",
... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L432-L434 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java | BoofConcurrency.loopFor | public static void loopFor(int start , int endExclusive , int step , IntConsumer consumer ) {
try {
int range = endExclusive-start;
pool.submit(() ->IntStream.range(0, range/step).parallel().forEach(i-> consumer.accept(start+i*step))).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
} | java | public static void loopFor(int start , int endExclusive , int step , IntConsumer consumer ) {
try {
int range = endExclusive-start;
pool.submit(() ->IntStream.range(0, range/step).parallel().forEach(i-> consumer.accept(start+i*step))).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
} | [
"public",
"static",
"void",
"loopFor",
"(",
"int",
"start",
",",
"int",
"endExclusive",
",",
"int",
"step",
",",
"IntConsumer",
"consumer",
")",
"{",
"try",
"{",
"int",
"range",
"=",
"endExclusive",
"-",
"start",
";",
"pool",
".",
"submit",
"(",
"(",
"... | Concurrent for loop. Each loop with spawn as a thread up to the maximum number of threads.
@param start starting value, inclusive
@param endExclusive ending value, exclusive
@param consumer The consumer | [
"Concurrent",
"for",
"loop",
".",
"Each",
"loop",
"with",
"spawn",
"as",
"a",
"thread",
"up",
"to",
"the",
"maximum",
"number",
"of",
"threads",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L75-L82 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vpc/VpcClient.java | VpcClient.createVpc | public CreateVpcResponse createVpc(String name, String cidr) {
CreateVpcRequest request = new CreateVpcRequest();
request.withName(name).withCidr(cidr);
return createVpc(request);
} | java | public CreateVpcResponse createVpc(String name, String cidr) {
CreateVpcRequest request = new CreateVpcRequest();
request.withName(name).withCidr(cidr);
return createVpc(request);
} | [
"public",
"CreateVpcResponse",
"createVpc",
"(",
"String",
"name",
",",
"String",
"cidr",
")",
"{",
"CreateVpcRequest",
"request",
"=",
"new",
"CreateVpcRequest",
"(",
")",
";",
"request",
".",
"withName",
"(",
"name",
")",
".",
"withCidr",
"(",
"cidr",
")",... | Create a vpc with the specified options.
@param name The name of vpc
@param cidr The CIDR of vpc
@return List of vpcId newly created | [
"Create",
"a",
"vpc",
"with",
"the",
"specified",
"options",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vpc/VpcClient.java#L156-L160 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java | JarPluginProviderLoader.createCachedJar | protected File createCachedJar(final File dir, final String jarName) throws PluginException {
File cachedJar;
try {
cachedJar = new File(dir, jarName);
cachedJar.deleteOnExit();
FileUtils.fileCopy(pluginJar, cachedJar, true);
} catch (IOException e) {
throw new PluginException(e);
}
return cachedJar;
} | java | protected File createCachedJar(final File dir, final String jarName) throws PluginException {
File cachedJar;
try {
cachedJar = new File(dir, jarName);
cachedJar.deleteOnExit();
FileUtils.fileCopy(pluginJar, cachedJar, true);
} catch (IOException e) {
throw new PluginException(e);
}
return cachedJar;
} | [
"protected",
"File",
"createCachedJar",
"(",
"final",
"File",
"dir",
",",
"final",
"String",
"jarName",
")",
"throws",
"PluginException",
"{",
"File",
"cachedJar",
";",
"try",
"{",
"cachedJar",
"=",
"new",
"File",
"(",
"dir",
",",
"jarName",
")",
";",
"cac... | Creates a single cached version of the pluginJar located within pluginJarCacheDirectory
deleting all existing versions of pluginJar
@param jarName | [
"Creates",
"a",
"single",
"cached",
"version",
"of",
"the",
"pluginJar",
"located",
"within",
"pluginJarCacheDirectory",
"deleting",
"all",
"existing",
"versions",
"of",
"pluginJar"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java#L405-L415 |
structurizr/java | structurizr-core/src/com/structurizr/model/DeploymentNode.java | DeploymentNode.addDeploymentNode | public DeploymentNode addDeploymentNode(String name, String description, String technology, int instances) {
return addDeploymentNode(name, description, technology, instances, null);
} | java | public DeploymentNode addDeploymentNode(String name, String description, String technology, int instances) {
return addDeploymentNode(name, description, technology, instances, null);
} | [
"public",
"DeploymentNode",
"addDeploymentNode",
"(",
"String",
"name",
",",
"String",
"description",
",",
"String",
"technology",
",",
"int",
"instances",
")",
"{",
"return",
"addDeploymentNode",
"(",
"name",
",",
"description",
",",
"technology",
",",
"instances... | Adds a child deployment node.
@param name the name of the deployment node
@param description a short description
@param technology the technology
@param instances the number of instances
@return a DeploymentNode object | [
"Adds",
"a",
"child",
"deployment",
"node",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/DeploymentNode.java#L78-L80 |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java | TimeSensor.setEnabled | public void setEnabled(boolean enable, GVRContext gvrContext) {
if (this.enabled != enabled ) {
// a change in the animation stopping / starting
for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) {
if (enable) gvrKeyFrameAnimation.start(gvrContext.getAnimationEngine());
else {
gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.ONCE);
}
}
this.enabled = enable;
}
} | java | public void setEnabled(boolean enable, GVRContext gvrContext) {
if (this.enabled != enabled ) {
// a change in the animation stopping / starting
for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) {
if (enable) gvrKeyFrameAnimation.start(gvrContext.getAnimationEngine());
else {
gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.ONCE);
}
}
this.enabled = enable;
}
} | [
"public",
"void",
"setEnabled",
"(",
"boolean",
"enable",
",",
"GVRContext",
"gvrContext",
")",
"{",
"if",
"(",
"this",
".",
"enabled",
"!=",
"enabled",
")",
"{",
"// a change in the animation stopping / starting",
"for",
"(",
"GVRNodeAnimation",
"gvrKeyFrameAnimation... | setEnabled will set the TimeSensor enable variable.
if true, then it will started the animation
if fase, then it changes repeat mode to ONCE so the animation will conclude.
There is no simple stop() animation
@param enable
@param gvrContext | [
"setEnabled",
"will",
"set",
"the",
"TimeSensor",
"enable",
"variable",
".",
"if",
"true",
"then",
"it",
"will",
"started",
"the",
"animation",
"if",
"fase",
"then",
"it",
"changes",
"repeat",
"mode",
"to",
"ONCE",
"so",
"the",
"animation",
"will",
"conclude... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java#L76-L87 |
mguymon/naether | src/main/java/com/tobedevoured/naether/maven/Project.java | Project.toXml | public String toXml() throws ProjectException {
log.debug("Writing xml");
Project copy = this;
copy.removeProperty( "project.basedir" );
StringWriter writer = new StringWriter();
MavenXpp3Writer pomWriter = new MavenXpp3Writer();
try {
pomWriter.write(writer, copy.mavenModel);
} catch (IOException e) {
throw new ProjectException("Failed to create pom xml", e);
}
writer.flush();
return writer.toString();
} | java | public String toXml() throws ProjectException {
log.debug("Writing xml");
Project copy = this;
copy.removeProperty( "project.basedir" );
StringWriter writer = new StringWriter();
MavenXpp3Writer pomWriter = new MavenXpp3Writer();
try {
pomWriter.write(writer, copy.mavenModel);
} catch (IOException e) {
throw new ProjectException("Failed to create pom xml", e);
}
writer.flush();
return writer.toString();
} | [
"public",
"String",
"toXml",
"(",
")",
"throws",
"ProjectException",
"{",
"log",
".",
"debug",
"(",
"\"Writing xml\"",
")",
";",
"Project",
"copy",
"=",
"this",
";",
"copy",
".",
"removeProperty",
"(",
"\"project.basedir\"",
")",
";",
"StringWriter",
"writer",... | Convert Project to POM XML
@return String
@throws ProjectException exception | [
"Convert",
"Project",
"to",
"POM",
"XML"
] | train | https://github.com/mguymon/naether/blob/218d8fd36c0b8b6e16d66e5715975570b4560ec4/src/main/java/com/tobedevoured/naether/maven/Project.java#L543-L560 |
Stratio/cassandra-lucene-index | plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/BitemporalMapper.java | BitemporalMapper.readBitemporalDate | BitemporalDateTime readBitemporalDate(Columns columns, String field) {
return parseBitemporalDate(columns.valueForField(field));
} | java | BitemporalDateTime readBitemporalDate(Columns columns, String field) {
return parseBitemporalDate(columns.valueForField(field));
} | [
"BitemporalDateTime",
"readBitemporalDate",
"(",
"Columns",
"columns",
",",
"String",
"field",
")",
"{",
"return",
"parseBitemporalDate",
"(",
"columns",
".",
"valueForField",
"(",
"field",
")",
")",
";",
"}"
] | Returns a {@link BitemporalDateTime} read from the specified {@link Columns}.
@param columns the column where the data is
@param field the name of the field to be read from {@code columns}
@return a bitemporal date time | [
"Returns",
"a",
"{",
"@link",
"BitemporalDateTime",
"}",
"read",
"from",
"the",
"specified",
"{",
"@link",
"Columns",
"}",
"."
] | train | https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/schema/mapping/BitemporalMapper.java#L173-L175 |
aws/aws-sdk-java | aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/DocumentationUtils.java | DocumentationUtils.createLinkToServiceDocumentation | public static String createLinkToServiceDocumentation(Metadata metadata, String name) {
if (isCrossLinkingEnabledForService(metadata)) {
return String.format("@see <a href=\"http://%s/goto/WebAPI/%s/%s\" target=\"_top\">AWS API Documentation</a>",
AWS_DOCS_HOST,
metadata.getUid(),
name);
}
return "";
} | java | public static String createLinkToServiceDocumentation(Metadata metadata, String name) {
if (isCrossLinkingEnabledForService(metadata)) {
return String.format("@see <a href=\"http://%s/goto/WebAPI/%s/%s\" target=\"_top\">AWS API Documentation</a>",
AWS_DOCS_HOST,
metadata.getUid(),
name);
}
return "";
} | [
"public",
"static",
"String",
"createLinkToServiceDocumentation",
"(",
"Metadata",
"metadata",
",",
"String",
"name",
")",
"{",
"if",
"(",
"isCrossLinkingEnabledForService",
"(",
"metadata",
")",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"@see <a href=\\\"... | Create the HTML for a link to the operation/shape core AWS docs site
@param metadata the UID for the service from that services metadata
@param name the name of the shape/request/operation
@return a '@see also' HTML link to the doc | [
"Create",
"the",
"HTML",
"for",
"a",
"link",
"to",
"the",
"operation",
"/",
"shape",
"core",
"AWS",
"docs",
"site"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/DocumentationUtils.java#L130-L138 |
primefaces/primefaces | src/main/java/org/primefaces/expression/SearchExpressionFacade.java | SearchExpressionFacade.resolveComponent | public static UIComponent resolveComponent(FacesContext context, UIComponent source, String expression) {
return resolveComponent(context, source, expression, SearchExpressionHint.NONE);
} | java | public static UIComponent resolveComponent(FacesContext context, UIComponent source, String expression) {
return resolveComponent(context, source, expression, SearchExpressionHint.NONE);
} | [
"public",
"static",
"UIComponent",
"resolveComponent",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"source",
",",
"String",
"expression",
")",
"{",
"return",
"resolveComponent",
"(",
"context",
",",
"source",
",",
"expression",
",",
"SearchExpressionHint",
"... | Resolves a {@link UIComponent} for the given expression.
@param context The {@link FacesContext}.
@param source The source component. E.g. a button.
@param expression The search expression.
@return A resolved {@link UIComponent} or <code>null</code>. | [
"Resolves",
"a",
"{",
"@link",
"UIComponent",
"}",
"for",
"the",
"given",
"expression",
"."
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/expression/SearchExpressionFacade.java#L419-L422 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/in/SigninPanel.java | SigninPanel.newPasswordTextField | protected LabeledPasswordTextFieldPanel<String, T> newPasswordTextField(final String id,
final IModel<T> model)
{
final IModel<String> labelModel = ResourceModelFactory
.newResourceModel("global.password.label", this);
final IModel<String> placeholderModel = ResourceModelFactory
.newResourceModel("global.enter.your.password.label", this);
final LabeledPasswordTextFieldPanel<String, T> pwTextField = new LabeledPasswordTextFieldPanel<String, T>(
id, model, labelModel)
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected PasswordTextField newPasswordTextField(final String id, final IModel<T> model)
{
final PasswordTextField pwTextField = new PasswordTextField(id,
new PropertyModel<>(model, "password"));
pwTextField.setOutputMarkupId(true);
if (placeholderModel != null)
{
pwTextField.add(new AttributeAppender("placeholder", placeholderModel));
}
return pwTextField;
}
};
return pwTextField;
} | java | protected LabeledPasswordTextFieldPanel<String, T> newPasswordTextField(final String id,
final IModel<T> model)
{
final IModel<String> labelModel = ResourceModelFactory
.newResourceModel("global.password.label", this);
final IModel<String> placeholderModel = ResourceModelFactory
.newResourceModel("global.enter.your.password.label", this);
final LabeledPasswordTextFieldPanel<String, T> pwTextField = new LabeledPasswordTextFieldPanel<String, T>(
id, model, labelModel)
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected PasswordTextField newPasswordTextField(final String id, final IModel<T> model)
{
final PasswordTextField pwTextField = new PasswordTextField(id,
new PropertyModel<>(model, "password"));
pwTextField.setOutputMarkupId(true);
if (placeholderModel != null)
{
pwTextField.add(new AttributeAppender("placeholder", placeholderModel));
}
return pwTextField;
}
};
return pwTextField;
} | [
"protected",
"LabeledPasswordTextFieldPanel",
"<",
"String",
",",
"T",
">",
"newPasswordTextField",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"T",
">",
"model",
")",
"{",
"final",
"IModel",
"<",
"String",
">",
"labelModel",
"=",
"ResourceModel... | Factory method for creating the EmailTextField for the password. This method is invoked in
the constructor from the derived classes and can be overridden so users can provide their own
version of a EmailTextField for the password.
@param id
the id
@param model
the model
@return the text field LabeledPasswordTextFieldPanel | [
"Factory",
"method",
"for",
"creating",
"the",
"EmailTextField",
"for",
"the",
"password",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/in/SigninPanel.java#L121-L152 |
ixa-ehu/ixa-pipe-ml | src/main/java/eus/ixa/ixa/pipe/ml/document/DocClassifierCrossValidator.java | DocClassifierCrossValidator.evaluate | public void evaluate(ObjectStream<DocSample> samples, int nFolds)
throws IOException {
CrossValidationPartitioner<DocSample> partitioner = new CrossValidationPartitioner<>(
samples, nFolds);
while (partitioner.hasNext()) {
CrossValidationPartitioner.TrainingSampleStream<DocSample> trainingSampleStream = partitioner
.next();
DocumentClassifierModel model = DocumentClassifierME.train(languageCode,
trainingSampleStream, params, factory);
DocumentClassifierEvaluator evaluator = new DocumentClassifierEvaluator(
new DocumentClassifierME(model), listeners);
evaluator.evaluate(trainingSampleStream.getTestSampleStream());
documentAccuracy.add(evaluator.getAccuracy(),
evaluator.getDocumentCount());
}
} | java | public void evaluate(ObjectStream<DocSample> samples, int nFolds)
throws IOException {
CrossValidationPartitioner<DocSample> partitioner = new CrossValidationPartitioner<>(
samples, nFolds);
while (partitioner.hasNext()) {
CrossValidationPartitioner.TrainingSampleStream<DocSample> trainingSampleStream = partitioner
.next();
DocumentClassifierModel model = DocumentClassifierME.train(languageCode,
trainingSampleStream, params, factory);
DocumentClassifierEvaluator evaluator = new DocumentClassifierEvaluator(
new DocumentClassifierME(model), listeners);
evaluator.evaluate(trainingSampleStream.getTestSampleStream());
documentAccuracy.add(evaluator.getAccuracy(),
evaluator.getDocumentCount());
}
} | [
"public",
"void",
"evaluate",
"(",
"ObjectStream",
"<",
"DocSample",
">",
"samples",
",",
"int",
"nFolds",
")",
"throws",
"IOException",
"{",
"CrossValidationPartitioner",
"<",
"DocSample",
">",
"partitioner",
"=",
"new",
"CrossValidationPartitioner",
"<>",
"(",
"... | Starts the evaluation.
@param samples
the data to train and test
@param nFolds
number of folds
@throws IOException if io error | [
"Starts",
"the",
"evaluation",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/document/DocClassifierCrossValidator.java#L60-L83 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getRewrittenHrefURI | public static String getRewrittenHrefURI( ServletContext servletContext, HttpServletRequest request,
HttpServletResponse response, String path, Map params,
String fragment, boolean forXML )
throws URISyntaxException
{
return rewriteResourceOrHrefURL( servletContext, request, response, path, params, fragment, forXML, URLType.ACTION );
} | java | public static String getRewrittenHrefURI( ServletContext servletContext, HttpServletRequest request,
HttpServletResponse response, String path, Map params,
String fragment, boolean forXML )
throws URISyntaxException
{
return rewriteResourceOrHrefURL( servletContext, request, response, path, params, fragment, forXML, URLType.ACTION );
} | [
"public",
"static",
"String",
"getRewrittenHrefURI",
"(",
"ServletContext",
"servletContext",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"path",
",",
"Map",
"params",
",",
"String",
"fragment",
",",
"boolean",
"forXML"... | Create a fully-rewritten URI given a path and parameters.
<p> Calls the rewriter service using a type of {@link URLType#ACTION}. </p>
@param servletContext the current ServletContext.
@param request the current HttpServletRequest.
@param response the current HttpServletResponse.
@param path the path to process into a fully-rewritten URI.
@param params the additional parameters to include in the URI query.
@param fragment the fragment (anchor or location) for this URI.
@param forXML flag indicating that the query of the uri should be written
using the "&amp;" entity, rather than the character, '&'.
@return a fully-rewritten URI for the given action.
@throws URISyntaxException if there's a problem converting the action URI (derived
from processing the given action name) into a MutableURI. | [
"Create",
"a",
"fully",
"-",
"rewritten",
"URI",
"given",
"a",
"path",
"and",
"parameters",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1571-L1577 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/in/form/SigninFormPanel.java | SigninFormPanel.newPasswordForgottenLink | protected MarkupContainer newPasswordForgottenLink(final String id, final IModel<T> model)
{
final LinkPanel linkPanel = new LinkPanel(id,
ResourceModelFactory.newResourceModel(ResourceBundleKey.builder()
.key("password.forgotten.label").defaultValue("Password forgotten").build()))
{
/**
* The serialVersionUID
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
public void onClick(final AjaxRequestTarget target)
{
onPasswordForgotten(target, form);
}
};
return linkPanel;
} | java | protected MarkupContainer newPasswordForgottenLink(final String id, final IModel<T> model)
{
final LinkPanel linkPanel = new LinkPanel(id,
ResourceModelFactory.newResourceModel(ResourceBundleKey.builder()
.key("password.forgotten.label").defaultValue("Password forgotten").build()))
{
/**
* The serialVersionUID
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
public void onClick(final AjaxRequestTarget target)
{
onPasswordForgotten(target, form);
}
};
return linkPanel;
} | [
"protected",
"MarkupContainer",
"newPasswordForgottenLink",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"T",
">",
"model",
")",
"{",
"final",
"LinkPanel",
"linkPanel",
"=",
"new",
"LinkPanel",
"(",
"id",
",",
"ResourceModelFactory",
".",
"newResou... | Factory method for create the new {@link MarkupContainer} of the {@link Link} for the
password forgotten. This method is invoked in the constructor from the derived classes and
can be overridden so users can provide their own version of a new {@link MarkupContainer} of
the {@link Link} for the password forgotten.
@param id
the id
@param model
the model
@return the new {@link MarkupContainer} of the {@link Link} for the password forgotten. | [
"Factory",
"method",
"for",
"create",
"the",
"new",
"{",
"@link",
"MarkupContainer",
"}",
"of",
"the",
"{",
"@link",
"Link",
"}",
"for",
"the",
"password",
"forgotten",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"der... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/in/form/SigninFormPanel.java#L173-L195 |
amaembo/streamex | src/main/java/one/util/streamex/MoreCollectors.java | MoreCollectors.onlyOne | public static <T> Collector<T, ?, Optional<T>> onlyOne(Predicate<? super T> predicate) {
return filtering(predicate, onlyOne());
} | java | public static <T> Collector<T, ?, Optional<T>> onlyOne(Predicate<? super T> predicate) {
return filtering(predicate, onlyOne());
} | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"Optional",
"<",
"T",
">",
">",
"onlyOne",
"(",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"return",
"filtering",
"(",
"predicate",
",",
"onlyOne",
"(",
... | Returns a {@code Collector} which collects the stream element satisfying the predicate
if there is only one such element.
<p>
This method returns a
<a href="package-summary.html#ShortCircuitReduction">short-circuiting
collector</a>.
@param predicate a predicate to be applied to the stream elements
@param <T> the type of the input elements
@return a collector which returns an {@link Optional} describing the only
element of the stream satisfying the predicate. If stream contains no elements satisfying the predicate,
or more than one such element, an empty {@code Optional} is returned.
@since 0.6.7 | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"which",
"collects",
"the",
"stream",
"element",
"satisfying",
"the",
"predicate",
"if",
"there",
"is",
"only",
"one",
"such",
"element",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/MoreCollectors.java#L531-L533 |
ltsopensource/light-task-scheduler | lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java | WebUtils.decode | public static String decode(String value, String charset) {
String result = null;
if (!StringUtils.isEmpty(value)) {
try {
result = URLDecoder.decode(value, charset);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return result;
} | java | public static String decode(String value, String charset) {
String result = null;
if (!StringUtils.isEmpty(value)) {
try {
result = URLDecoder.decode(value, charset);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return result;
} | [
"public",
"static",
"String",
"decode",
"(",
"String",
"value",
",",
"String",
"charset",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"value",
")",
")",
"{",
"try",
"{",
"result",
"=",
"URLDecoder... | 使用指定的字符集反编码请求参数值。
@param value 参数值
@param charset 字符集
@return 反编码后的参数值 | [
"使用指定的字符集反编码请求参数值。"
] | train | https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java#L313-L323 |
onepf/OpenIAB | library/src/main/java/org/onepf/oms/OpenIabHelper.java | OpenIabHelper.getStoreSku | @NotNull
public static String getStoreSku(@NotNull final String appStoreName, @NotNull String sku) {
return SkuManager.getInstance().getStoreSku(appStoreName, sku);
} | java | @NotNull
public static String getStoreSku(@NotNull final String appStoreName, @NotNull String sku) {
return SkuManager.getInstance().getStoreSku(appStoreName, sku);
} | [
"@",
"NotNull",
"public",
"static",
"String",
"getStoreSku",
"(",
"@",
"NotNull",
"final",
"String",
"appStoreName",
",",
"@",
"NotNull",
"String",
"sku",
")",
"{",
"return",
"SkuManager",
".",
"getInstance",
"(",
")",
".",
"getStoreSku",
"(",
"appStoreName",
... | Return the previously mapped store SKU for the internal SKU
@param appStoreName The store name
@param sku The internal SKU
@return SKU used in the store for the specified internal SKU
@see org.onepf.oms.SkuManager#mapSku(String, String, String)
@deprecated Use {@link org.onepf.oms.SkuManager#getStoreSku(String, String)}
<p/> | [
"Return",
"the",
"previously",
"mapped",
"store",
"SKU",
"for",
"the",
"internal",
"SKU"
] | train | https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/OpenIabHelper.java#L367-L370 |
JOML-CI/JOML | src/org/joml/Matrix3x2d.java | Matrix3x2d.scaleAround | public Matrix3x2d scaleAround(double sx, double sy, double ox, double oy) {
return scaleAround(sx, sy, ox, oy, this);
} | java | public Matrix3x2d scaleAround(double sx, double sy, double ox, double oy) {
return scaleAround(sx, sy, ox, oy, this);
} | [
"public",
"Matrix3x2d",
"scaleAround",
"(",
"double",
"sx",
",",
"double",
"sy",
",",
"double",
"ox",
",",
"double",
"oy",
")",
"{",
"return",
"scaleAround",
"(",
"sx",
",",
"sy",
",",
"ox",
",",
"oy",
",",
"this",
")",
";",
"}"
] | Apply scaling to this matrix by scaling the base axes by the given sx and
sy factors while using <code>(ox, oy)</code> as the scaling origin.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the
scaling will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy).scale(sx, sy).translate(-ox, -oy)</code>
@param sx
the scaling factor of the x component
@param sy
the scaling factor of the y component
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@return this | [
"Apply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"sx",
"and",
"sy",
"factors",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
")",
"<",
"/",
"code",
">",
"as",
"the",
"scaling",
"origin",
"."... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L1464-L1466 |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.distinct | public Stream<T> distinct() {
final ArrayList<T> passed = new ArrayList<>();
return filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T value) {
if (passed.contains(value))
return false;
passed.add(value);
return true;
}
});
} | java | public Stream<T> distinct() {
final ArrayList<T> passed = new ArrayList<>();
return filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T value) {
if (passed.contains(value))
return false;
passed.add(value);
return true;
}
});
} | [
"public",
"Stream",
"<",
"T",
">",
"distinct",
"(",
")",
"{",
"final",
"ArrayList",
"<",
"T",
">",
"passed",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"return",
"filter",
"(",
"new",
"Func1",
"<",
"T",
",",
"Boolean",
">",
"(",
")",
"{",
"@",... | Returns a new stream that filters out duplicate items off the current stream.
<p/>
This operator keeps a list of all items that has been passed to
compare it against next items.
@return a new stream that filters out duplicate items off the current stream. | [
"Returns",
"a",
"new",
"stream",
"that",
"filters",
"out",
"duplicate",
"items",
"off",
"the",
"current",
"stream",
".",
"<p",
"/",
">",
"This",
"operator",
"keeps",
"a",
"list",
"of",
"all",
"items",
"that",
"has",
"been",
"passed",
"to",
"compare",
"it... | train | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L482-L493 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/msg/ReadFileRecordRequest.java | ReadFileRecordRequest.readData | public void readData(DataInput din) throws IOException {
int byteCount = din.readUnsignedByte();
int recordCount = byteCount / 7;
records = new RecordRequest[recordCount];
for (int i = 0; i < recordCount; i++) {
if (din.readByte() != 6) {
throw new IOException();
}
int file = din.readUnsignedShort();
int record = din.readUnsignedShort();
if (record < 0 || record >= 10000) {
throw new IOException();
}
int count = din.readUnsignedShort();
records[i] = new RecordRequest(file, record, count);
}
} | java | public void readData(DataInput din) throws IOException {
int byteCount = din.readUnsignedByte();
int recordCount = byteCount / 7;
records = new RecordRequest[recordCount];
for (int i = 0; i < recordCount; i++) {
if (din.readByte() != 6) {
throw new IOException();
}
int file = din.readUnsignedShort();
int record = din.readUnsignedShort();
if (record < 0 || record >= 10000) {
throw new IOException();
}
int count = din.readUnsignedShort();
records[i] = new RecordRequest(file, record, count);
}
} | [
"public",
"void",
"readData",
"(",
"DataInput",
"din",
")",
"throws",
"IOException",
"{",
"int",
"byteCount",
"=",
"din",
".",
"readUnsignedByte",
"(",
")",
";",
"int",
"recordCount",
"=",
"byteCount",
"/",
"7",
";",
"records",
"=",
"new",
"RecordRequest",
... | readData -- read all the data for this request.
@throws java.io.IOException If the data cannot be read | [
"readData",
"--",
"read",
"all",
"the",
"data",
"for",
"this",
"request",
"."
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/msg/ReadFileRecordRequest.java#L175-L196 |
Javen205/IJPay | src/main/java/com/jpay/util/IOUtils.java | IOUtils.toFile | public static void toFile(InputStream input, File file) throws IOException {
OutputStream os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
while ((bytesRead = input.read(buffer, 0, DEFAULT_BUFFER_SIZE)) != -1) {
os.write(buffer, 0, bytesRead);
}
IOUtils.closeQuietly(os);
IOUtils.closeQuietly(input);
} | java | public static void toFile(InputStream input, File file) throws IOException {
OutputStream os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
while ((bytesRead = input.read(buffer, 0, DEFAULT_BUFFER_SIZE)) != -1) {
os.write(buffer, 0, bytesRead);
}
IOUtils.closeQuietly(os);
IOUtils.closeQuietly(input);
} | [
"public",
"static",
"void",
"toFile",
"(",
"InputStream",
"input",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"OutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"int",
"bytesRead",
"=",
"0",
";",
"byte",
"[",
"]",
"... | InputStream to File
@param input the <code>InputStream</code> to read from
@param file the File to write
@throws IOException id异常 | [
"InputStream",
"to",
"File"
] | train | https://github.com/Javen205/IJPay/blob/78da6be4b70675abc6a41df74817532fa257ef29/src/main/java/com/jpay/util/IOUtils.java#L66-L75 |
stapler/stapler | groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/SimpleTemplateParser.java | SimpleTemplateParser.groovySection | private void groovySection(Reader reader, StringWriter sw) throws IOException {
sw.write("\"\"\");");
int c;
while ((c = reader.read()) != -1) {
if (c == '%') {
c = reader.read();
if (c != '>') {
sw.write('%');
} else {
break;
}
}
/* Don't eat EOL chars in sections - as they are valid instruction separators.
* See http://jira.codehaus.org/browse/GROOVY-980
*/
// if (c != '\n' && c != '\r') {
sw.write(c);
//}
}
sw.write(";\n"+printCommand()+"(\"\"\"");
} | java | private void groovySection(Reader reader, StringWriter sw) throws IOException {
sw.write("\"\"\");");
int c;
while ((c = reader.read()) != -1) {
if (c == '%') {
c = reader.read();
if (c != '>') {
sw.write('%');
} else {
break;
}
}
/* Don't eat EOL chars in sections - as they are valid instruction separators.
* See http://jira.codehaus.org/browse/GROOVY-980
*/
// if (c != '\n' && c != '\r') {
sw.write(c);
//}
}
sw.write(";\n"+printCommand()+"(\"\"\"");
} | [
"private",
"void",
"groovySection",
"(",
"Reader",
"reader",
",",
"StringWriter",
"sw",
")",
"throws",
"IOException",
"{",
"sw",
".",
"write",
"(",
"\"\\\"\\\"\\\");\"",
")",
";",
"int",
"c",
";",
"while",
"(",
"(",
"c",
"=",
"reader",
".",
"read",
"(",
... | Closes the currently open write and writes the following text as normal Groovy script code until it reaches an end %>.
@param reader a reader for the template text
@param sw a StringWriter to write expression content
@throws IOException if something goes wrong | [
"Closes",
"the",
"currently",
"open",
"write",
"and",
"writes",
"the",
"following",
"text",
"as",
"normal",
"Groovy",
"script",
"code",
"until",
"it",
"reaches",
"an",
"end",
"%",
">",
"."
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/SimpleTemplateParser.java#L161-L181 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsXmlGroupContainer.java | CmsXmlGroupContainer.fillResource | protected void fillResource(CmsObject cms, Element element, CmsResource res) {
String xpath = element.getPath();
int pos = xpath.lastIndexOf("/" + XmlNode.GroupContainers.name() + "/");
if (pos > 0) {
xpath = xpath.substring(pos + 1);
}
CmsRelationType type = getHandler().getRelationType(xpath);
CmsXmlVfsFileValue.fillEntry(element, res.getStructureId(), res.getRootPath(), type);
} | java | protected void fillResource(CmsObject cms, Element element, CmsResource res) {
String xpath = element.getPath();
int pos = xpath.lastIndexOf("/" + XmlNode.GroupContainers.name() + "/");
if (pos > 0) {
xpath = xpath.substring(pos + 1);
}
CmsRelationType type = getHandler().getRelationType(xpath);
CmsXmlVfsFileValue.fillEntry(element, res.getStructureId(), res.getRootPath(), type);
} | [
"protected",
"void",
"fillResource",
"(",
"CmsObject",
"cms",
",",
"Element",
"element",
",",
"CmsResource",
"res",
")",
"{",
"String",
"xpath",
"=",
"element",
".",
"getPath",
"(",
")",
";",
"int",
"pos",
"=",
"xpath",
".",
"lastIndexOf",
"(",
"\"/\"",
... | Fills a {@link CmsXmlVfsFileValue} with the resource identified by the given id.<p>
@param cms the current CMS context
@param element the XML element to fill
@param res the resource to use | [
"Fills",
"a",
"{",
"@link",
"CmsXmlVfsFileValue",
"}",
"with",
"the",
"resource",
"identified",
"by",
"the",
"given",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlGroupContainer.java#L281-L290 |
pmayweg/sonar-groovy | sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportMerger.java | JaCoCoReportMerger.mergeReports | public static void mergeReports(File reportOverall, File... reports) {
SessionInfoStore infoStore = new SessionInfoStore();
ExecutionDataStore dataStore = new ExecutionDataStore();
boolean isCurrentVersionFormat = loadSourceFiles(infoStore, dataStore, reports);
try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall))) {
Object visitor;
if (isCurrentVersionFormat) {
visitor = new ExecutionDataWriter(outputStream);
} else {
visitor = new org.jacoco.previous.core.data.ExecutionDataWriter(outputStream);
}
infoStore.accept((ISessionInfoVisitor) visitor);
dataStore.accept((IExecutionDataVisitor) visitor);
} catch (IOException e) {
throw new IllegalStateException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e);
}
} | java | public static void mergeReports(File reportOverall, File... reports) {
SessionInfoStore infoStore = new SessionInfoStore();
ExecutionDataStore dataStore = new ExecutionDataStore();
boolean isCurrentVersionFormat = loadSourceFiles(infoStore, dataStore, reports);
try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall))) {
Object visitor;
if (isCurrentVersionFormat) {
visitor = new ExecutionDataWriter(outputStream);
} else {
visitor = new org.jacoco.previous.core.data.ExecutionDataWriter(outputStream);
}
infoStore.accept((ISessionInfoVisitor) visitor);
dataStore.accept((IExecutionDataVisitor) visitor);
} catch (IOException e) {
throw new IllegalStateException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e);
}
} | [
"public",
"static",
"void",
"mergeReports",
"(",
"File",
"reportOverall",
",",
"File",
"...",
"reports",
")",
"{",
"SessionInfoStore",
"infoStore",
"=",
"new",
"SessionInfoStore",
"(",
")",
";",
"ExecutionDataStore",
"dataStore",
"=",
"new",
"ExecutionDataStore",
... | Merge all reports in reportOverall.
@param reportOverall destination file of merge.
@param reports files to be merged. | [
"Merge",
"all",
"reports",
"in",
"reportOverall",
"."
] | train | https://github.com/pmayweg/sonar-groovy/blob/2d78d6578304601613db928795d81de340e6fa34/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportMerger.java#L49-L66 |
kite-sdk/kite | kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/tool/SchemaTool.java | SchemaTool.getSchemaStringsFromJar | private List<String> getSchemaStringsFromJar(String jarPath,
String directoryPath) {
LOG.info("Getting schema strings in: " + directoryPath + ", from jar: "
+ jarPath);
JarFile jar;
try {
jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new DatasetException(e);
} catch (IOException e) {
throw new DatasetException(e);
}
Enumeration<JarEntry> entries = jar.entries();
List<String> schemaStrings = new ArrayList<String>();
while (entries.hasMoreElements()) {
JarEntry jarEntry = entries.nextElement();
if (jarEntry.getName().startsWith(directoryPath)
&& jarEntry.getName().endsWith(".avsc")) {
LOG.info("Found schema: " + jarEntry.getName());
InputStream inputStream;
try {
inputStream = jar.getInputStream(jarEntry);
} catch (IOException e) {
throw new DatasetException(e);
}
String schemaString = AvroUtils.inputStreamToString(inputStream);
schemaStrings.add(schemaString);
}
}
return schemaStrings;
} | java | private List<String> getSchemaStringsFromJar(String jarPath,
String directoryPath) {
LOG.info("Getting schema strings in: " + directoryPath + ", from jar: "
+ jarPath);
JarFile jar;
try {
jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new DatasetException(e);
} catch (IOException e) {
throw new DatasetException(e);
}
Enumeration<JarEntry> entries = jar.entries();
List<String> schemaStrings = new ArrayList<String>();
while (entries.hasMoreElements()) {
JarEntry jarEntry = entries.nextElement();
if (jarEntry.getName().startsWith(directoryPath)
&& jarEntry.getName().endsWith(".avsc")) {
LOG.info("Found schema: " + jarEntry.getName());
InputStream inputStream;
try {
inputStream = jar.getInputStream(jarEntry);
} catch (IOException e) {
throw new DatasetException(e);
}
String schemaString = AvroUtils.inputStreamToString(inputStream);
schemaStrings.add(schemaString);
}
}
return schemaStrings;
} | [
"private",
"List",
"<",
"String",
">",
"getSchemaStringsFromJar",
"(",
"String",
"jarPath",
",",
"String",
"directoryPath",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Getting schema strings in: \"",
"+",
"directoryPath",
"+",
"\", from jar: \"",
"+",
"jarPath",
")",
";... | Gets the list of HBase Common Avro schema strings from a directory in the
Jar. It recursively searches the directory in the jar to find files that
end in .avsc to locate thos strings.
@param jarPath
The path to the jar to search
@param directoryPath
The directory in the jar to find avro schema strings
@return The list of schema strings. | [
"Gets",
"the",
"list",
"of",
"HBase",
"Common",
"Avro",
"schema",
"strings",
"from",
"a",
"directory",
"in",
"the",
"Jar",
".",
"It",
"recursively",
"searches",
"the",
"directory",
"in",
"the",
"jar",
"to",
"find",
"files",
"that",
"end",
"in",
".",
"avs... | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/tool/SchemaTool.java#L497-L527 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java | CertificateOperations.cancelDeleteCertificate | public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException {
cancelDeleteCertificate(thumbprintAlgorithm, thumbprint, null);
} | java | public void cancelDeleteCertificate(String thumbprintAlgorithm, String thumbprint) throws BatchErrorException, IOException {
cancelDeleteCertificate(thumbprintAlgorithm, thumbprint, null);
} | [
"public",
"void",
"cancelDeleteCertificate",
"(",
"String",
"thumbprintAlgorithm",
",",
"String",
"thumbprint",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"cancelDeleteCertificate",
"(",
"thumbprintAlgorithm",
",",
"thumbprint",
",",
"null",
")",
";"... | Cancels a failed deletion of the specified certificate. This operation can be performed only when
the certificate is in the {@link com.microsoft.azure.batch.protocol.models.CertificateState#DELETE_FAILED Delete Failed} state, and restores
the certificate to the {@link com.microsoft.azure.batch.protocol.models.CertificateState#ACTIVE Active} state.
@param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1.
@param thumbprint The thumbprint of the certificate that failed to delete.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Cancels",
"a",
"failed",
"deletion",
"of",
"the",
"specified",
"certificate",
".",
"This",
"operation",
"can",
"be",
"performed",
"only",
"when",
"the",
"certificate",
"is",
"in",
"the",
"{",
"@link",
"com",
".",
"microsoft",
".",
"azure",
".",
"batch",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L165-L167 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java | JspFunctions.buildQueryParamsMapForSortExpression | public static Map buildQueryParamsMapForSortExpression(DataGridURLBuilder urlBuilder, String sortExpression) {
if(urlBuilder == null || sortExpression == null)
return null;
return urlBuilder.buildSortQueryParamsMap(sortExpression);
} | java | public static Map buildQueryParamsMapForSortExpression(DataGridURLBuilder urlBuilder, String sortExpression) {
if(urlBuilder == null || sortExpression == null)
return null;
return urlBuilder.buildSortQueryParamsMap(sortExpression);
} | [
"public",
"static",
"Map",
"buildQueryParamsMapForSortExpression",
"(",
"DataGridURLBuilder",
"urlBuilder",
",",
"String",
"sortExpression",
")",
"{",
"if",
"(",
"urlBuilder",
"==",
"null",
"||",
"sortExpression",
"==",
"null",
")",
"return",
"null",
";",
"return",
... | <p>
Utility method used to build a query parameter map which includes the list of parameters needed to change the
direction of a sort related to the given sort expression. This method uses a {@link DataGridURLBuilder}
instance to call its {@link DataGridURLBuilder#buildSortQueryParamsMap(String)} method from JSP EL.
</p>
@param urlBuilder the data grid URL builder associated with a
{@link org.apache.beehive.netui.databinding.datagrid.api.DataGridState} object that is used to
build lists of query parameters
@param sortExpression the sort expression whose direction to change
@return a {@link Map} of key / value pairs for query parameters
@netui:jspfunction name="buildQueryParamsMapForSortExpression"
signature="java.util.Map buildQueryParamsMapForSortExpression(org.apache.beehive.netui.databinding.datagrid.api.DataGridURLBuilder,java.lang.String)" | [
"<p",
">",
"Utility",
"method",
"used",
"to",
"build",
"a",
"query",
"parameter",
"map",
"which",
"includes",
"the",
"list",
"of",
"parameters",
"needed",
"to",
"change",
"the",
"direction",
"of",
"a",
"sort",
"related",
"to",
"the",
"given",
"sort",
"expr... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java#L99-L104 |
aalmiray/Json-lib | src/main/java/net/sf/json/JsonConfig.java | JsonConfig.registerJsonValueProcessor | public void registerJsonValueProcessor( String key, JsonValueProcessor jsonValueProcessor ) {
if( key != null && jsonValueProcessor != null ) {
keyMap.put( key, jsonValueProcessor );
}
} | java | public void registerJsonValueProcessor( String key, JsonValueProcessor jsonValueProcessor ) {
if( key != null && jsonValueProcessor != null ) {
keyMap.put( key, jsonValueProcessor );
}
} | [
"public",
"void",
"registerJsonValueProcessor",
"(",
"String",
"key",
",",
"JsonValueProcessor",
"jsonValueProcessor",
")",
"{",
"if",
"(",
"key",
"!=",
"null",
"&&",
"jsonValueProcessor",
"!=",
"null",
")",
"{",
"keyMap",
".",
"put",
"(",
"key",
",",
"jsonVal... | Registers a JsonValueProcessor.<br>
[Java -> JSON]
@param key the property name to use as key
@param jsonValueProcessor the processor to register | [
"Registers",
"a",
"JsonValueProcessor",
".",
"<br",
">",
"[",
"Java",
"-",
">",
";",
"JSON",
"]"
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L853-L857 |
finnyb/javampd | src/main/java/org/bff/javampd/monitor/MPDConnectionMonitor.java | MPDConnectionMonitor.fireConnectionChangeEvent | protected synchronized void fireConnectionChangeEvent(boolean isConnected) {
ConnectionChangeEvent cce = new ConnectionChangeEvent(this, isConnected);
for (ConnectionChangeListener ccl : connectionListeners) {
ccl.connectionChangeEventReceived(cce);
}
} | java | protected synchronized void fireConnectionChangeEvent(boolean isConnected) {
ConnectionChangeEvent cce = new ConnectionChangeEvent(this, isConnected);
for (ConnectionChangeListener ccl : connectionListeners) {
ccl.connectionChangeEventReceived(cce);
}
} | [
"protected",
"synchronized",
"void",
"fireConnectionChangeEvent",
"(",
"boolean",
"isConnected",
")",
"{",
"ConnectionChangeEvent",
"cce",
"=",
"new",
"ConnectionChangeEvent",
"(",
"this",
",",
"isConnected",
")",
";",
"for",
"(",
"ConnectionChangeListener",
"ccl",
":... | Sends the appropriate {@link org.bff.javampd.server.ConnectionChangeEvent} to all registered
{@link ConnectionChangeListener}s.
@param isConnected the connection status | [
"Sends",
"the",
"appropriate",
"{",
"@link",
"org",
".",
"bff",
".",
"javampd",
".",
"server",
".",
"ConnectionChangeEvent",
"}",
"to",
"all",
"registered",
"{",
"@link",
"ConnectionChangeListener",
"}",
"s",
"."
] | train | https://github.com/finnyb/javampd/blob/186736e85fc238b4208cc9ee23373f9249376b4c/src/main/java/org/bff/javampd/monitor/MPDConnectionMonitor.java#L48-L54 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.document_id_PUT | public void document_id_PUT(String id, OvhDocument body) throws IOException {
String qPath = "/me/document/{id}";
StringBuilder sb = path(qPath, id);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void document_id_PUT(String id, OvhDocument body) throws IOException {
String qPath = "/me/document/{id}";
StringBuilder sb = path(qPath, id);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"document_id_PUT",
"(",
"String",
"id",
",",
"OvhDocument",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/document/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"id",
")",
";",
"exec",
"(",... | Alter this object properties
REST: PUT /me/document/{id}
@param body [required] New object properties
@param id [required] Document id | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2559-L2563 |
algolia/instantsearch-android | ui/src/main/java/com/algolia/instantsearch/ui/databinding/RenderingHelper.java | RenderingHelper.addHighlight | Integer addHighlight(@NonNull View view, @NonNull String attribute, @ColorInt int colorId) {
final Pair<Integer, String> pair = new Pair<>(view.getId(), attribute);
highlightedAttributes.add(pair);
return attributeColors.put(pair, colorId);
} | java | Integer addHighlight(@NonNull View view, @NonNull String attribute, @ColorInt int colorId) {
final Pair<Integer, String> pair = new Pair<>(view.getId(), attribute);
highlightedAttributes.add(pair);
return attributeColors.put(pair, colorId);
} | [
"Integer",
"addHighlight",
"(",
"@",
"NonNull",
"View",
"view",
",",
"@",
"NonNull",
"String",
"attribute",
",",
"@",
"ColorInt",
"int",
"colorId",
")",
"{",
"final",
"Pair",
"<",
"Integer",
",",
"String",
">",
"pair",
"=",
"new",
"Pair",
"<>",
"(",
"v... | Enables highlighting for this view/attribute pair.
@param attribute the attribute to color.
@param colorId a {@link ColorInt} to associate with this attribute.
@return the previous color associated with this attribute or {@code null} if there was none. | [
"Enables",
"highlighting",
"for",
"this",
"view",
"/",
"attribute",
"pair",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/databinding/RenderingHelper.java#L108-L112 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.serviceName_glueRecord_host_DELETE | public net.minidev.ovh.api.domain.OvhTask serviceName_glueRecord_host_DELETE(String serviceName, String host) throws IOException {
String qPath = "/domain/{serviceName}/glueRecord/{host}";
StringBuilder sb = path(qPath, serviceName, host);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.domain.OvhTask.class);
} | java | public net.minidev.ovh.api.domain.OvhTask serviceName_glueRecord_host_DELETE(String serviceName, String host) throws IOException {
String qPath = "/domain/{serviceName}/glueRecord/{host}";
StringBuilder sb = path(qPath, serviceName, host);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, net.minidev.ovh.api.domain.OvhTask.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"domain",
".",
"OvhTask",
"serviceName_glueRecord_host_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"host",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/{serviceName}/g... | Delete the glue record
REST: DELETE /domain/{serviceName}/glueRecord/{host}
@param serviceName [required] The internal name of your domain
@param host [required] Host of the glue record | [
"Delete",
"the",
"glue",
"record"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1212-L1217 |
leancloud/java-sdk-all | android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/DeleteTokenApi.java | DeleteTokenApi.onConnect | @Override
public void onConnect(final int rst, final HuaweiApiClient client) {
//需要在子线程中执行删除TOKEN操作
ThreadUtil.INST.excute(new Runnable() {
@Override
public void run() {
//调用删除TOKEN需要传入通过getToken接口获取到TOKEN,并且需要对TOKEN进行非空判断
if (!TextUtils.isEmpty(token)){
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onDeleteTokenResult(rst);
} else {
try {
HuaweiPush.HuaweiPushApi.deleteToken(client, token);
onDeleteTokenResult(HMSAgent.AgentResultCode.HMSAGENT_SUCCESS);
} catch (Exception e) {
HMSAgentLog.e("删除TOKEN失败:" + e.getMessage());
onDeleteTokenResult(HMSAgent.AgentResultCode.CALL_EXCEPTION);
}
}
} else {
HMSAgentLog.e("删除TOKEN失败: 要删除的token为空");
onDeleteTokenResult(HMSAgent.AgentResultCode.EMPTY_PARAM);
}
}
});
} | java | @Override
public void onConnect(final int rst, final HuaweiApiClient client) {
//需要在子线程中执行删除TOKEN操作
ThreadUtil.INST.excute(new Runnable() {
@Override
public void run() {
//调用删除TOKEN需要传入通过getToken接口获取到TOKEN,并且需要对TOKEN进行非空判断
if (!TextUtils.isEmpty(token)){
if (client == null || !ApiClientMgr.INST.isConnect(client)) {
HMSAgentLog.e("client not connted");
onDeleteTokenResult(rst);
} else {
try {
HuaweiPush.HuaweiPushApi.deleteToken(client, token);
onDeleteTokenResult(HMSAgent.AgentResultCode.HMSAGENT_SUCCESS);
} catch (Exception e) {
HMSAgentLog.e("删除TOKEN失败:" + e.getMessage());
onDeleteTokenResult(HMSAgent.AgentResultCode.CALL_EXCEPTION);
}
}
} else {
HMSAgentLog.e("删除TOKEN失败: 要删除的token为空");
onDeleteTokenResult(HMSAgent.AgentResultCode.EMPTY_PARAM);
}
}
});
} | [
"@",
"Override",
"public",
"void",
"onConnect",
"(",
"final",
"int",
"rst",
",",
"final",
"HuaweiApiClient",
"client",
")",
"{",
"//需要在子线程中执行删除TOKEN操作\r",
"ThreadUtil",
".",
"INST",
".",
"excute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"publ... | HuaweiApiClient 连接结果回调
@param rst 结果码
@param client HuaweiApiClient 实例 | [
"HuaweiApiClient",
"连接结果回调"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/DeleteTokenApi.java#L39-L65 |
PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/event/PacketDistributer.java | PacketDistributer.addHandler | public synchronized void addHandler(final short packetID, final PacketHandler packetHandler)
{
if (registry.containsKey(packetID)) throw new IllegalArgumentException("Handler for ID: " + packetID + " already exists");
registry.put(packetID, packetHandler);
} | java | public synchronized void addHandler(final short packetID, final PacketHandler packetHandler)
{
if (registry.containsKey(packetID)) throw new IllegalArgumentException("Handler for ID: " + packetID + " already exists");
registry.put(packetID, packetHandler);
} | [
"public",
"synchronized",
"void",
"addHandler",
"(",
"final",
"short",
"packetID",
",",
"final",
"PacketHandler",
"packetHandler",
")",
"{",
"if",
"(",
"registry",
".",
"containsKey",
"(",
"packetID",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\... | Adds a new handler for this specific Packet ID
@param packetID Packet ID to add handler for
@param packetHandler Handler for given Packet ID
@throws IllegalArgumentException when Packet ID already has a registered handler | [
"Adds",
"a",
"new",
"handler",
"for",
"this",
"specific",
"Packet",
"ID"
] | train | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/event/PacketDistributer.java#L70-L74 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/run/Notifier.java | Notifier.notifyOne | public static void notifyOne(String correlationId, Object component, Parameters args) throws ApplicationException {
if (component instanceof INotifiable)
((INotifiable) component).notify(correlationId, args);
} | java | public static void notifyOne(String correlationId, Object component, Parameters args) throws ApplicationException {
if (component instanceof INotifiable)
((INotifiable) component).notify(correlationId, args);
} | [
"public",
"static",
"void",
"notifyOne",
"(",
"String",
"correlationId",
",",
"Object",
"component",
",",
"Parameters",
"args",
")",
"throws",
"ApplicationException",
"{",
"if",
"(",
"component",
"instanceof",
"INotifiable",
")",
"(",
"(",
"INotifiable",
")",
"c... | Notifies specific component.
To be notiied components must implement INotifiable interface. If they don't
the call to this method has no effect.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param component the component that is to be notified.
@param args notifiation arguments.
@throws ApplicationException when errors occured.
@see INotifiable | [
"Notifies",
"specific",
"component",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/run/Notifier.java#L25-L29 |
pmwmedia/tinylog | tinylog-impl/src/main/java/org/tinylog/writers/AbstractFormatPatternWriter.java | AbstractFormatPatternWriter.getFileName | protected static String getFileName(final Map<String, String> properties) {
String fileName = properties.get("file");
if (fileName == null) {
throw new IllegalArgumentException("File name is missing for file writer");
} else {
return fileName;
}
} | java | protected static String getFileName(final Map<String, String> properties) {
String fileName = properties.get("file");
if (fileName == null) {
throw new IllegalArgumentException("File name is missing for file writer");
} else {
return fileName;
}
} | [
"protected",
"static",
"String",
"getFileName",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"String",
"fileName",
"=",
"properties",
".",
"get",
"(",
"\"file\"",
")",
";",
"if",
"(",
"fileName",
"==",
"null",
")",
"{",... | Extracts the log file name from configuration.
@param properties
Configuration for writer
@return Log file name
@throws IllegalArgumentException
Log file is not defined in configuration | [
"Extracts",
"the",
"log",
"file",
"name",
"from",
"configuration",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/writers/AbstractFormatPatternWriter.java#L81-L88 |
fuwjax/ev-oss | funco/src/main/java/org/fuwjax/oss/util/assertion/Assert2.java | Assert2.assertEquals | public static void assertEquals(final Path expected, final Path actual) throws IOException {
containsAll(actual, expected);
if(Files.exists(expected)) {
containsAll(expected, actual);
walkFileTree(expected, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
final Path sub = relativize(expected, file);
final Path therePath = resolve(actual, sub);
final long hereSize = Files.size(file);
final long thereSize = Files.size(therePath);
assertThat(thereSize, asserts(() -> sub + " is " + hereSize + " bytes", t -> t == hereSize));
assertByteEquals(sub, file, therePath);
return super.visitFile(file, attrs);
}
});
}
} | java | public static void assertEquals(final Path expected, final Path actual) throws IOException {
containsAll(actual, expected);
if(Files.exists(expected)) {
containsAll(expected, actual);
walkFileTree(expected, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
final Path sub = relativize(expected, file);
final Path therePath = resolve(actual, sub);
final long hereSize = Files.size(file);
final long thereSize = Files.size(therePath);
assertThat(thereSize, asserts(() -> sub + " is " + hereSize + " bytes", t -> t == hereSize));
assertByteEquals(sub, file, therePath);
return super.visitFile(file, attrs);
}
});
}
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"final",
"Path",
"expected",
",",
"final",
"Path",
"actual",
")",
"throws",
"IOException",
"{",
"containsAll",
"(",
"actual",
",",
"expected",
")",
";",
"if",
"(",
"Files",
".",
"exists",
"(",
"expected",
")... | Asserts that two paths are deeply byte-equivalent.
@param expected one of the paths
@param actual the other path
@throws IOException if the paths cannot be traversed | [
"Asserts",
"that",
"two",
"paths",
"are",
"deeply",
"byte",
"-",
"equivalent",
"."
] | train | https://github.com/fuwjax/ev-oss/blob/cbd88592e9b2fa9547c3bdd41e52e790061a2253/funco/src/main/java/org/fuwjax/oss/util/assertion/Assert2.java#L126-L143 |
libgdx/gdx-ai | gdx-ai/src/com/badlogic/gdx/ai/steer/behaviors/Jump.java | Jump.calculateAirborneTimeAndVelocity | public float calculateAirborneTimeAndVelocity (T outVelocity, JumpDescriptor<T> jumpDescriptor, float maxLinearSpeed) {
float g = gravityComponentHandler.getComponent(gravity);
// Calculate the first jump time, see time of flight at http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html
// Notice that the equation has 2 solutions. We'd ideally like to achieve the jump in the fastest time
// possible, so we want to use the smaller of the two values. However, this time value might give us
// an impossible launch velocity (required speed greater than the max), so we need to check and
// use the higher value if necessary.
float sqrtTerm = (float)Math.sqrt(2f * g * gravityComponentHandler.getComponent(jumpDescriptor.delta)
+ maxVerticalVelocity * maxVerticalVelocity);
float time = (-maxVerticalVelocity + sqrtTerm) / g;
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "1st jump time = " + time);
// Check if we can use it
if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
// Otherwise try the other time
time = (-maxVerticalVelocity - sqrtTerm) / g;
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "2nd jump time = " + time);
if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
return -1f; // Unachievable jump
}
}
return time; // Achievable jump
} | java | public float calculateAirborneTimeAndVelocity (T outVelocity, JumpDescriptor<T> jumpDescriptor, float maxLinearSpeed) {
float g = gravityComponentHandler.getComponent(gravity);
// Calculate the first jump time, see time of flight at http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html
// Notice that the equation has 2 solutions. We'd ideally like to achieve the jump in the fastest time
// possible, so we want to use the smaller of the two values. However, this time value might give us
// an impossible launch velocity (required speed greater than the max), so we need to check and
// use the higher value if necessary.
float sqrtTerm = (float)Math.sqrt(2f * g * gravityComponentHandler.getComponent(jumpDescriptor.delta)
+ maxVerticalVelocity * maxVerticalVelocity);
float time = (-maxVerticalVelocity + sqrtTerm) / g;
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "1st jump time = " + time);
// Check if we can use it
if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
// Otherwise try the other time
time = (-maxVerticalVelocity - sqrtTerm) / g;
if (DEBUG_ENABLED) GdxAI.getLogger().info("Jump", "2nd jump time = " + time);
if (!checkAirborneTimeAndCalculateVelocity(outVelocity, time, jumpDescriptor, maxLinearSpeed)) {
return -1f; // Unachievable jump
}
}
return time; // Achievable jump
} | [
"public",
"float",
"calculateAirborneTimeAndVelocity",
"(",
"T",
"outVelocity",
",",
"JumpDescriptor",
"<",
"T",
">",
"jumpDescriptor",
",",
"float",
"maxLinearSpeed",
")",
"{",
"float",
"g",
"=",
"gravityComponentHandler",
".",
"getComponent",
"(",
"gravity",
")",
... | Returns the airborne time and sets the {@code outVelocity} vector to the airborne planar velocity required to achieve the
jump. If the jump is not achievable -1 is returned and the {@code outVelocity} vector remains unchanged.
<p>
Be aware that you should avoid using unlimited or very high max velocity, because this might produce a time of flight close
to 0. Actually, the motion equation for T has 2 solutions and Jump always try to use the fastest time.
@param outVelocity the output vector where the airborne planar velocity is calculated
@param jumpDescriptor the jump descriptor
@param maxLinearSpeed the maximum linear speed that can be used to achieve the jump
@return the time of flight or -1 if the jump is not achievable using the given max linear speed. | [
"Returns",
"the",
"airborne",
"time",
"and",
"sets",
"the",
"{"
] | train | https://github.com/libgdx/gdx-ai/blob/2d1523a97193a45e18e11a4837c6800d08f177c5/gdx-ai/src/com/badlogic/gdx/ai/steer/behaviors/Jump.java#L134-L157 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/onesample/Binomial.java | Binomial.scoreToPvalue | private static double scoreToPvalue(double score, int n, double p) {
/*
if(n<=20) {
//calculate it from binomial distribution
}
*/
double z=(score+0.5-n*p)/Math.sqrt(n*p*(1.0-p));
return ContinuousDistributions.gaussCdf(z);
} | java | private static double scoreToPvalue(double score, int n, double p) {
/*
if(n<=20) {
//calculate it from binomial distribution
}
*/
double z=(score+0.5-n*p)/Math.sqrt(n*p*(1.0-p));
return ContinuousDistributions.gaussCdf(z);
} | [
"private",
"static",
"double",
"scoreToPvalue",
"(",
"double",
"score",
",",
"int",
"n",
",",
"double",
"p",
")",
"{",
"/*\n if(n<=20) {\n //calculate it from binomial distribution\n }\n */",
"double",
"z",
"=",
"(",
"score",
"+",
"0.5",
... | Returns the Pvalue for a particular score
@param score
@param n
@param p
@return | [
"Returns",
"the",
"Pvalue",
"for",
"a",
"particular",
"score"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/onesample/Binomial.java#L64-L74 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/OptionalInt.java | OptionalInt.ifPresentOrElse | public void ifPresentOrElse(@NotNull IntConsumer consumer, @NotNull Runnable emptyAction) {
if (isPresent) {
consumer.accept(value);
} else {
emptyAction.run();
}
} | java | public void ifPresentOrElse(@NotNull IntConsumer consumer, @NotNull Runnable emptyAction) {
if (isPresent) {
consumer.accept(value);
} else {
emptyAction.run();
}
} | [
"public",
"void",
"ifPresentOrElse",
"(",
"@",
"NotNull",
"IntConsumer",
"consumer",
",",
"@",
"NotNull",
"Runnable",
"emptyAction",
")",
"{",
"if",
"(",
"isPresent",
")",
"{",
"consumer",
".",
"accept",
"(",
"value",
")",
";",
"}",
"else",
"{",
"emptyActi... | If a value is present, performs the given action with the value,
otherwise performs the empty-based action.
@param consumer the consumer function to be executed, if a value is present
@param emptyAction the empty-based action to be performed, if no value is present
@throws NullPointerException if a value is present and the given consumer function is null,
or no value is present and the given empty-based action is null.
@since 1.1.4 | [
"If",
"a",
"value",
"is",
"present",
"performs",
"the",
"given",
"action",
"with",
"the",
"value",
"otherwise",
"performs",
"the",
"empty",
"-",
"based",
"action",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/OptionalInt.java#L141-L147 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DCacheBase.java | DCacheBase.setValue | public void setValue(EntryInfo entryInfo, Object value, boolean directive) {
setValue(entryInfo, value, !shouldPull(entryInfo.getSharingPolicy(), entryInfo.id), directive);
} | java | public void setValue(EntryInfo entryInfo, Object value, boolean directive) {
setValue(entryInfo, value, !shouldPull(entryInfo.getSharingPolicy(), entryInfo.id), directive);
} | [
"public",
"void",
"setValue",
"(",
"EntryInfo",
"entryInfo",
",",
"Object",
"value",
",",
"boolean",
"directive",
")",
"{",
"setValue",
"(",
"entryInfo",
",",
"value",
",",
"!",
"shouldPull",
"(",
"entryInfo",
".",
"getSharingPolicy",
"(",
")",
",",
"entryIn... | This sets the actual value (JSP or command) of an entry in the cache.
@param entryInfo
The cache entry
@param value
The value to cache in the entry
@param directive
boolean to indicate CACHE_NEW_CONTENT or USE_CACHED_VALUE | [
"This",
"sets",
"the",
"actual",
"value",
"(",
"JSP",
"or",
"command",
")",
"of",
"an",
"entry",
"in",
"the",
"cache",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/DCacheBase.java#L535-L537 |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java | JdkLog.logIfEnabled | private void logIfEnabled(String callerFQCN, Level level, Throwable throwable, String format, Object[] arguments){
if(logger.isLoggable(level)){
LogRecord record = new LogRecord(level, StrUtil.format(format, arguments));
record.setLoggerName(getName());
record.setThrown(throwable);
fillCallerData(callerFQCN, record);
logger.log(record);
}
} | java | private void logIfEnabled(String callerFQCN, Level level, Throwable throwable, String format, Object[] arguments){
if(logger.isLoggable(level)){
LogRecord record = new LogRecord(level, StrUtil.format(format, arguments));
record.setLoggerName(getName());
record.setThrown(throwable);
fillCallerData(callerFQCN, record);
logger.log(record);
}
} | [
"private",
"void",
"logIfEnabled",
"(",
"String",
"callerFQCN",
",",
"Level",
"level",
",",
"Throwable",
"throwable",
",",
"String",
"format",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"level",
")",
")",
... | 打印对应等级的日志
@param callerFQCN
@param level 等级
@param throwable 异常对象
@param format 消息模板
@param arguments 参数 | [
"打印对应等级的日志"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java#L180-L188 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/request/JmxListRequest.java | JmxListRequest.newCreator | static RequestCreator<JmxListRequest> newCreator() {
return new RequestCreator<JmxListRequest>() {
/** {@inheritDoc} */
public JmxListRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException {
return new JmxListRequest(
prepareExtraArgs(pStack), // path
pParams);
}
/** {@inheritDoc} */
public JmxListRequest create(Map<String, ?> requestMap, ProcessingParameters pParams)
throws MalformedObjectNameException {
return new JmxListRequest(requestMap,pParams);
}
};
} | java | static RequestCreator<JmxListRequest> newCreator() {
return new RequestCreator<JmxListRequest>() {
/** {@inheritDoc} */
public JmxListRequest create(Stack<String> pStack, ProcessingParameters pParams) throws MalformedObjectNameException {
return new JmxListRequest(
prepareExtraArgs(pStack), // path
pParams);
}
/** {@inheritDoc} */
public JmxListRequest create(Map<String, ?> requestMap, ProcessingParameters pParams)
throws MalformedObjectNameException {
return new JmxListRequest(requestMap,pParams);
}
};
} | [
"static",
"RequestCreator",
"<",
"JmxListRequest",
">",
"newCreator",
"(",
")",
"{",
"return",
"new",
"RequestCreator",
"<",
"JmxListRequest",
">",
"(",
")",
"{",
"/** {@inheritDoc} */",
"public",
"JmxListRequest",
"create",
"(",
"Stack",
"<",
"String",
">",
"pS... | Create a new creator used for creating list requests
@return creator | [
"Create",
"a",
"new",
"creator",
"used",
"for",
"creating",
"list",
"requests"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/request/JmxListRequest.java#L72-L87 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/samplers/ProbabilitySampler.java | ProbabilitySampler.create | static ProbabilitySampler create(double probability) {
Utils.checkArgument(
probability >= 0.0 && probability <= 1.0, "probability must be in range [0.0, 1.0]");
long idUpperBound;
// Special case the limits, to avoid any possible issues with lack of precision across
// double/long boundaries. For probability == 0.0, we use Long.MIN_VALUE as this guarantees
// that we will never sample a trace, even in the case where the id == Long.MIN_VALUE, since
// Math.Abs(Long.MIN_VALUE) == Long.MIN_VALUE.
if (probability == 0.0) {
idUpperBound = Long.MIN_VALUE;
} else if (probability == 1.0) {
idUpperBound = Long.MAX_VALUE;
} else {
idUpperBound = (long) (probability * Long.MAX_VALUE);
}
return new AutoValue_ProbabilitySampler(probability, idUpperBound);
} | java | static ProbabilitySampler create(double probability) {
Utils.checkArgument(
probability >= 0.0 && probability <= 1.0, "probability must be in range [0.0, 1.0]");
long idUpperBound;
// Special case the limits, to avoid any possible issues with lack of precision across
// double/long boundaries. For probability == 0.0, we use Long.MIN_VALUE as this guarantees
// that we will never sample a trace, even in the case where the id == Long.MIN_VALUE, since
// Math.Abs(Long.MIN_VALUE) == Long.MIN_VALUE.
if (probability == 0.0) {
idUpperBound = Long.MIN_VALUE;
} else if (probability == 1.0) {
idUpperBound = Long.MAX_VALUE;
} else {
idUpperBound = (long) (probability * Long.MAX_VALUE);
}
return new AutoValue_ProbabilitySampler(probability, idUpperBound);
} | [
"static",
"ProbabilitySampler",
"create",
"(",
"double",
"probability",
")",
"{",
"Utils",
".",
"checkArgument",
"(",
"probability",
">=",
"0.0",
"&&",
"probability",
"<=",
"1.0",
",",
"\"probability must be in range [0.0, 1.0]\"",
")",
";",
"long",
"idUpperBound",
... | Returns a new {@link ProbabilitySampler}. The probability of sampling a trace is equal to that
of the specified probability.
@param probability The desired probability of sampling. Must be within [0.0, 1.0].
@return a new {@link ProbabilitySampler}.
@throws IllegalArgumentException if {@code probability} is out of range | [
"Returns",
"a",
"new",
"{",
"@link",
"ProbabilitySampler",
"}",
".",
"The",
"probability",
"of",
"sampling",
"a",
"trace",
"is",
"equal",
"to",
"that",
"of",
"the",
"specified",
"probability",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/samplers/ProbabilitySampler.java#L55-L71 |
ludovicianul/selenium-on-steroids | src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java | WebDriverHelper.authenticateOnNextAlert | public void authenticateOnNextAlert(String username, String password) {
Credentials credentials = new UserAndPassword(username, password);
Alert alert = driver.switchTo().alert();
alert.authenticateUsing(credentials);
} | java | public void authenticateOnNextAlert(String username, String password) {
Credentials credentials = new UserAndPassword(username, password);
Alert alert = driver.switchTo().alert();
alert.authenticateUsing(credentials);
} | [
"public",
"void",
"authenticateOnNextAlert",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"Credentials",
"credentials",
"=",
"new",
"UserAndPassword",
"(",
"username",
",",
"password",
")",
";",
"Alert",
"alert",
"=",
"driver",
".",
"switchTo"... | Authenticates the user using the given username and password. This will
work only if the credentials are requested through an alert window.
@param username
the user name
@param password
the password | [
"Authenticates",
"the",
"user",
"using",
"the",
"given",
"username",
"and",
"password",
".",
"This",
"will",
"work",
"only",
"if",
"the",
"credentials",
"are",
"requested",
"through",
"an",
"alert",
"window",
"."
] | train | https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L165-L170 |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java | GVRScriptManager.attachScriptFile | @Override
public void attachScriptFile(IScriptable target, IScriptFile scriptFile) {
mScriptMap.put(target, scriptFile);
scriptFile.invokeFunction("onAttach", new Object[] { target });
} | java | @Override
public void attachScriptFile(IScriptable target, IScriptFile scriptFile) {
mScriptMap.put(target, scriptFile);
scriptFile.invokeFunction("onAttach", new Object[] { target });
} | [
"@",
"Override",
"public",
"void",
"attachScriptFile",
"(",
"IScriptable",
"target",
",",
"IScriptFile",
"scriptFile",
")",
"{",
"mScriptMap",
".",
"put",
"(",
"target",
",",
"scriptFile",
")",
";",
"scriptFile",
".",
"invokeFunction",
"(",
"\"onAttach\"",
",",
... | Attach a script file to a scriptable target.
@param target The scriptable target.
@param scriptFile The script file object. | [
"Attach",
"a",
"script",
"file",
"to",
"a",
"scriptable",
"target",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L186-L190 |
damianszczepanik/cucumber-reporting | src/main/java/net/masterthought/cucumber/Configuration.java | Configuration.addClassifications | public void addClassifications(String name, String value) {
classifications.add(new AbstractMap.SimpleEntry<>(name, value));
} | java | public void addClassifications(String name, String value) {
classifications.add(new AbstractMap.SimpleEntry<>(name, value));
} | [
"public",
"void",
"addClassifications",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"classifications",
".",
"add",
"(",
"new",
"AbstractMap",
".",
"SimpleEntry",
"<>",
"(",
"name",
",",
"value",
")",
")",
";",
"}"
] | Adds metadata that will be displayed at the main page of the report. It is useful when there is a few reports are
generated at the same time but with different parameters/configurations.
@param name name of the property
@param value value of the property | [
"Adds",
"metadata",
"that",
"will",
"be",
"displayed",
"at",
"the",
"main",
"page",
"of",
"the",
"report",
".",
"It",
"is",
"useful",
"when",
"there",
"is",
"a",
"few",
"reports",
"are",
"generated",
"at",
"the",
"same",
"time",
"but",
"with",
"different... | train | https://github.com/damianszczepanik/cucumber-reporting/blob/9ffe0d4a9c0aec161b0988a930a8312ba36dc742/src/main/java/net/masterthought/cucumber/Configuration.java#L197-L199 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java | ExpressRouteCrossConnectionPeeringsInner.listAsync | public Observable<Page<ExpressRouteCrossConnectionPeeringInner>> listAsync(final String resourceGroupName, final String crossConnectionName) {
return listWithServiceResponseAsync(resourceGroupName, crossConnectionName)
.map(new Func1<ServiceResponse<Page<ExpressRouteCrossConnectionPeeringInner>>, Page<ExpressRouteCrossConnectionPeeringInner>>() {
@Override
public Page<ExpressRouteCrossConnectionPeeringInner> call(ServiceResponse<Page<ExpressRouteCrossConnectionPeeringInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ExpressRouteCrossConnectionPeeringInner>> listAsync(final String resourceGroupName, final String crossConnectionName) {
return listWithServiceResponseAsync(resourceGroupName, crossConnectionName)
.map(new Func1<ServiceResponse<Page<ExpressRouteCrossConnectionPeeringInner>>, Page<ExpressRouteCrossConnectionPeeringInner>>() {
@Override
public Page<ExpressRouteCrossConnectionPeeringInner> call(ServiceResponse<Page<ExpressRouteCrossConnectionPeeringInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ExpressRouteCrossConnectionPeeringInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"crossConnectionName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupN... | Gets all peerings in a specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ExpressRouteCrossConnectionPeeringInner> object | [
"Gets",
"all",
"peerings",
"in",
"a",
"specified",
"ExpressRouteCrossConnection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java#L143-L151 |
kiegroup/drools | kie-pmml/src/main/java/org/kie/pmml/assembler/PMMLAssemblerService.java | PMMLAssemblerService.generatedResourcesToPackageDescr | private List<PackageDescr> generatedResourcesToPackageDescr(Resource resource, List<PMMLResource> resources)
throws DroolsParserException {
List<PackageDescr> pkgDescrs = new ArrayList<>();
DrlParser parser = new DrlParser(configuration.getLanguageLevel());
for (PMMLResource res : resources) {
for (Map.Entry<String, String> entry : res.getRules().entrySet()) {
String key = entry.getKey();
String src = entry.getValue();
PackageDescr descr = null;
descr = parser.parse(false, src);
if (descr != null) {
descr.setResource(resource);
pkgDescrs.add(descr);
dumpGeneratedRule(descr, key, src);
} else {
kbuilder.addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0));
}
}
}
return pkgDescrs;
} | java | private List<PackageDescr> generatedResourcesToPackageDescr(Resource resource, List<PMMLResource> resources)
throws DroolsParserException {
List<PackageDescr> pkgDescrs = new ArrayList<>();
DrlParser parser = new DrlParser(configuration.getLanguageLevel());
for (PMMLResource res : resources) {
for (Map.Entry<String, String> entry : res.getRules().entrySet()) {
String key = entry.getKey();
String src = entry.getValue();
PackageDescr descr = null;
descr = parser.parse(false, src);
if (descr != null) {
descr.setResource(resource);
pkgDescrs.add(descr);
dumpGeneratedRule(descr, key, src);
} else {
kbuilder.addBuilderResult(new ParserError(resource, "Parser returned a null Package", 0, 0));
}
}
}
return pkgDescrs;
} | [
"private",
"List",
"<",
"PackageDescr",
">",
"generatedResourcesToPackageDescr",
"(",
"Resource",
"resource",
",",
"List",
"<",
"PMMLResource",
">",
"resources",
")",
"throws",
"DroolsParserException",
"{",
"List",
"<",
"PackageDescr",
">",
"pkgDescrs",
"=",
"new",
... | Creates a list of PackageDescr objects from the PMMLResources (which includes the generated DRL)
@param resource
@param resources
@return
@throws DroolsParserException | [
"Creates",
"a",
"list",
"of",
"PackageDescr",
"objects",
"from",
"the",
"PMMLResources",
"(",
"which",
"includes",
"the",
"generated",
"DRL",
")"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-pmml/src/main/java/org/kie/pmml/assembler/PMMLAssemblerService.java#L139-L159 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java | TermOfUsePanel.newFulfilmentAndJurisdictionPlacePanel | protected Component newFulfilmentAndJurisdictionPlacePanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new FulfilmentAndJurisdictionPlacePanel(id, Model.of(model.getObject()));
} | java | protected Component newFulfilmentAndJurisdictionPlacePanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new FulfilmentAndJurisdictionPlacePanel(id, Model.of(model.getObject()));
} | [
"protected",
"Component",
"newFulfilmentAndJurisdictionPlacePanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"HeaderContentListModelBean",
">",
"model",
")",
"{",
"return",
"new",
"FulfilmentAndJurisdictionPlacePanel",
"(",
"id",
",",
"Model",
".",
"... | Factory method for creating the new {@link Component} for the fulfilment and jurisdiction
place. This method is invoked in the constructor from the derived classes and can be
overridden so users can provide their own version of a new {@link Component} for the
fulfilment and jurisdiction place.
@param id
the id
@param model
the model
@return the new {@link Component} for the fulfilment and jurisdiction place | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"fulfilment",
"and",
"jurisdiction",
"place",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L260-L264 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.getBulk | @Override
public Map<String, Object> getBulk(Iterator<String> keyIter) {
return getBulk(keyIter, transcoder);
} | java | @Override
public Map<String, Object> getBulk(Iterator<String> keyIter) {
return getBulk(keyIter, transcoder);
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getBulk",
"(",
"Iterator",
"<",
"String",
">",
"keyIter",
")",
"{",
"return",
"getBulk",
"(",
"keyIter",
",",
"transcoder",
")",
";",
"}"
] | Get the values for multiple keys from the cache.
@param keyIter Iterator that produces the keys
@return a map of the values (for each value that exists)
@throws OperationTimeoutException if the global operation timeout is
exceeded
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Get",
"the",
"values",
"for",
"multiple",
"keys",
"from",
"the",
"cache",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1581-L1584 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContextProperties.java | ProcessContextProperties.addDataUsage | private String addDataUsage(String attribute, Set<DataUsage> usages) throws PropertyException {
Validate.notNull(attribute);
Validate.notEmpty(attribute);
Validate.notNull(usages);
Validate.noNullElements(usages);
String dataUsageName = String.format(DATA_USAGE_FORMAT, getNextDataUsageIndex());
props.setProperty(dataUsageName, String.format(DATA_USAGE_VALUE_FORMAT, attribute, ArrayUtils.toString(usages.toArray())));
addDataUsageNameToList(dataUsageName);
return dataUsageName;
} | java | private String addDataUsage(String attribute, Set<DataUsage> usages) throws PropertyException {
Validate.notNull(attribute);
Validate.notEmpty(attribute);
Validate.notNull(usages);
Validate.noNullElements(usages);
String dataUsageName = String.format(DATA_USAGE_FORMAT, getNextDataUsageIndex());
props.setProperty(dataUsageName, String.format(DATA_USAGE_VALUE_FORMAT, attribute, ArrayUtils.toString(usages.toArray())));
addDataUsageNameToList(dataUsageName);
return dataUsageName;
} | [
"private",
"String",
"addDataUsage",
"(",
"String",
"attribute",
",",
"Set",
"<",
"DataUsage",
">",
"usages",
")",
"throws",
"PropertyException",
"{",
"Validate",
".",
"notNull",
"(",
"attribute",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"attribute",
")",
... | Adds the given data usage to the context properties.<br>
This requires to generate a new name for the data usage (e.g.
DATA_USAGE_1) <br>
and storing a string-representation of this data usage under this
name.<br>
Additionally, the new data usage name is stored in the property field
which is summing up all data usage names (ACTIVITY_DATA_USAGES).
@return The newly generated name for the data usage under which it is
accessible.
@throws ParameterException if the given data usage parameters are
invalid.
@throws PropertyException if the data usage property name cannot be
generated or the data usage cannot be stored.
@see #getNextDataUsageIndex()
@see #addDataUsageNameToList(String) | [
"Adds",
"the",
"given",
"data",
"usage",
"to",
"the",
"context",
"properties",
".",
"<br",
">",
"This",
"requires",
"to",
"generate",
"a",
"new",
"name",
"for",
"the",
"data",
"usage",
"(",
"e",
".",
"g",
".",
"DATA_USAGE_1",
")",
"<br",
">",
"and",
... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContextProperties.java#L103-L112 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseAbuttingOffsetFields | private int parseAbuttingOffsetFields(String text, int start, int[] parsedLen) {
final int MAXDIGITS = 6;
int[] digits = new int[MAXDIGITS];
int[] parsed = new int[MAXDIGITS]; // accumulative offsets
// Parse digits into int[]
int idx = start;
int[] len = {0};
int numDigits = 0;
for (int i = 0; i < MAXDIGITS; i++) {
digits[i] = parseSingleLocalizedDigit(text, idx, len);
if (digits[i] < 0) {
break;
}
idx += len[0];
parsed[i] = idx - start;
numDigits++;
}
if (numDigits == 0) {
parsedLen[0] = 0;
return 0;
}
int offset = 0;
while (numDigits > 0) {
int hour = 0;
int min = 0;
int sec = 0;
assert(numDigits > 0 && numDigits <= 6);
switch (numDigits) {
case 1: // H
hour = digits[0];
break;
case 2: // HH
hour = digits[0] * 10 + digits[1];
break;
case 3: // Hmm
hour = digits[0];
min = digits[1] * 10 + digits[2];
break;
case 4: // HHmm
hour = digits[0] * 10 + digits[1];
min = digits[2] * 10 + digits[3];
break;
case 5: // Hmmss
hour = digits[0];
min = digits[1] * 10 + digits[2];
sec = digits[3] * 10 + digits[4];
break;
case 6: // HHmmss
hour = digits[0] * 10 + digits[1];
min = digits[2] * 10 + digits[3];
sec = digits[4] * 10 + digits[5];
break;
}
if (hour <= MAX_OFFSET_HOUR && min <= MAX_OFFSET_MINUTE && sec <= MAX_OFFSET_SECOND) {
// found a valid combination
offset = hour * MILLIS_PER_HOUR + min * MILLIS_PER_MINUTE + sec * MILLIS_PER_SECOND;
parsedLen[0] = parsed[numDigits - 1];
break;
}
numDigits--;
}
return offset;
} | java | private int parseAbuttingOffsetFields(String text, int start, int[] parsedLen) {
final int MAXDIGITS = 6;
int[] digits = new int[MAXDIGITS];
int[] parsed = new int[MAXDIGITS]; // accumulative offsets
// Parse digits into int[]
int idx = start;
int[] len = {0};
int numDigits = 0;
for (int i = 0; i < MAXDIGITS; i++) {
digits[i] = parseSingleLocalizedDigit(text, idx, len);
if (digits[i] < 0) {
break;
}
idx += len[0];
parsed[i] = idx - start;
numDigits++;
}
if (numDigits == 0) {
parsedLen[0] = 0;
return 0;
}
int offset = 0;
while (numDigits > 0) {
int hour = 0;
int min = 0;
int sec = 0;
assert(numDigits > 0 && numDigits <= 6);
switch (numDigits) {
case 1: // H
hour = digits[0];
break;
case 2: // HH
hour = digits[0] * 10 + digits[1];
break;
case 3: // Hmm
hour = digits[0];
min = digits[1] * 10 + digits[2];
break;
case 4: // HHmm
hour = digits[0] * 10 + digits[1];
min = digits[2] * 10 + digits[3];
break;
case 5: // Hmmss
hour = digits[0];
min = digits[1] * 10 + digits[2];
sec = digits[3] * 10 + digits[4];
break;
case 6: // HHmmss
hour = digits[0] * 10 + digits[1];
min = digits[2] * 10 + digits[3];
sec = digits[4] * 10 + digits[5];
break;
}
if (hour <= MAX_OFFSET_HOUR && min <= MAX_OFFSET_MINUTE && sec <= MAX_OFFSET_SECOND) {
// found a valid combination
offset = hour * MILLIS_PER_HOUR + min * MILLIS_PER_MINUTE + sec * MILLIS_PER_SECOND;
parsedLen[0] = parsed[numDigits - 1];
break;
}
numDigits--;
}
return offset;
} | [
"private",
"int",
"parseAbuttingOffsetFields",
"(",
"String",
"text",
",",
"int",
"start",
",",
"int",
"[",
"]",
"parsedLen",
")",
"{",
"final",
"int",
"MAXDIGITS",
"=",
"6",
";",
"int",
"[",
"]",
"digits",
"=",
"new",
"int",
"[",
"MAXDIGITS",
"]",
";"... | Parses abutting localized GMT offset fields (such as 0800) into offset.
@param text the input text
@param start the start index
@param parsedLen the parsed length, or 0 on failure
@return the parsed offset in milliseconds. | [
"Parses",
"abutting",
"localized",
"GMT",
"offset",
"fields",
"(",
"such",
"as",
"0800",
")",
"into",
"offset",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2492-L2558 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java | B2BAccountUrl.removeUserRoleAsyncUrl | public static MozuUrl removeUserRoleAsyncUrl(Integer accountId, Integer roleId, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles/{roleId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("roleId", roleId);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl removeUserRoleAsyncUrl(Integer accountId, Integer roleId, String userId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles/{roleId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("roleId", roleId);
formatter.formatUrl("userId", userId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"removeUserRoleAsyncUrl",
"(",
"Integer",
"accountId",
",",
"Integer",
"roleId",
",",
"String",
"userId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/r... | Get Resource Url for RemoveUserRoleAsync
@param accountId Unique identifier of the customer account.
@param roleId
@param userId Unique identifier of the user whose tenant scopes you want to retrieve.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"RemoveUserRoleAsync"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java#L273-L280 |
JCTools/JCTools | jctools-core/src/main/java/org/jctools/queues/atomic/BaseMpscLinkedAtomicArrayQueue.java | BaseMpscLinkedAtomicArrayQueue.offerSlowPath | private int offerSlowPath(long mask, long pIndex, long producerLimit) {
final long cIndex = lvConsumerIndex();
long bufferCapacity = getCurrentBufferCapacity(mask);
if (cIndex + bufferCapacity > pIndex) {
if (!casProducerLimit(producerLimit, cIndex + bufferCapacity)) {
// retry from top
return RETRY;
} else {
// continue to pIndex CAS
return CONTINUE_TO_P_INDEX_CAS;
}
} else // full and cannot grow
if (availableInQueue(pIndex, cIndex) <= 0) {
// offer should return false;
return QUEUE_FULL;
} else // grab index for resize -> set lower bit
if (casProducerIndex(pIndex, pIndex + 1)) {
// trigger a resize
return QUEUE_RESIZE;
} else {
// failed resize attempt, retry from top
return RETRY;
}
} | java | private int offerSlowPath(long mask, long pIndex, long producerLimit) {
final long cIndex = lvConsumerIndex();
long bufferCapacity = getCurrentBufferCapacity(mask);
if (cIndex + bufferCapacity > pIndex) {
if (!casProducerLimit(producerLimit, cIndex + bufferCapacity)) {
// retry from top
return RETRY;
} else {
// continue to pIndex CAS
return CONTINUE_TO_P_INDEX_CAS;
}
} else // full and cannot grow
if (availableInQueue(pIndex, cIndex) <= 0) {
// offer should return false;
return QUEUE_FULL;
} else // grab index for resize -> set lower bit
if (casProducerIndex(pIndex, pIndex + 1)) {
// trigger a resize
return QUEUE_RESIZE;
} else {
// failed resize attempt, retry from top
return RETRY;
}
} | [
"private",
"int",
"offerSlowPath",
"(",
"long",
"mask",
",",
"long",
"pIndex",
",",
"long",
"producerLimit",
")",
"{",
"final",
"long",
"cIndex",
"=",
"lvConsumerIndex",
"(",
")",
";",
"long",
"bufferCapacity",
"=",
"getCurrentBufferCapacity",
"(",
"mask",
")"... | We do not inline resize into this method because we do not resize on fill. | [
"We",
"do",
"not",
"inline",
"resize",
"into",
"this",
"method",
"because",
"we",
"do",
"not",
"resize",
"on",
"fill",
"."
] | train | https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-core/src/main/java/org/jctools/queues/atomic/BaseMpscLinkedAtomicArrayQueue.java#L339-L362 |
lightoze/gwt-i18n-server | src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java | LocaleFactory.getEncoder | public static <T extends Messages> T getEncoder(Class<T> cls) {
return get(cls, ENCODER);
} | java | public static <T extends Messages> T getEncoder(Class<T> cls) {
return get(cls, ENCODER);
} | [
"public",
"static",
"<",
"T",
"extends",
"Messages",
">",
"T",
"getEncoder",
"(",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"return",
"get",
"(",
"cls",
",",
"ENCODER",
")",
";",
"}"
] | Get <em>encoding</em> localization object, which will encode all requests so that they can be decoded later by {@link net.lightoze.gwt.i18n.server.LocaleProxy#decode}.
<p>
The purpose is to separate complex (e.g. template-based) text generation and its localization for particular locale into two separate phases.
<p>
<strong>Supported only on server side.</strong>
@param cls localization interface class
@param <T> localization interface class
@return object implementing specified class | [
"Get",
"<em",
">",
"encoding<",
"/",
"em",
">",
"localization",
"object",
"which",
"will",
"encode",
"all",
"requests",
"so",
"that",
"they",
"can",
"be",
"decoded",
"later",
"by",
"{",
"@link",
"net",
".",
"lightoze",
".",
"gwt",
".",
"i18n",
".",
"se... | train | https://github.com/lightoze/gwt-i18n-server/blob/96de53288e9bf31721d7b0e2a1d9f7b6ce1a7e83/src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java#L46-L48 |
biojava/biojava | biojava-structure-gui/src/main/java/demo/DemoShowLargeAssembly.java | DemoShowLargeAssembly.readStructure | public static Structure readStructure(String pdbId, int bioAssemblyId) {
// pre-computed files use lower case PDB IDs
pdbId = pdbId.toLowerCase();
// we just need this to track where to store PDB files
// this checks the PDB_DIR property (and uses a tmp location if not set)
AtomCache cache = new AtomCache();
cache.setUseMmCif(true);
FileParsingParameters p = cache.getFileParsingParams();
// some bio assemblies are large, we want an all atom representation and avoid
// switching to a Calpha-only representation for large molecules
// note, this requires several GB of memory for some of the largest assemblies, such a 1MX4
p.setAtomCaThreshold(Integer.MAX_VALUE);
// parse remark 350
p.setParseBioAssembly(true);
// download missing files
Structure structure = null;
try {
structure = StructureIO.getBiologicalAssembly(pdbId,bioAssemblyId);
} catch (Exception e){
e.printStackTrace();
return null;
}
return structure;
} | java | public static Structure readStructure(String pdbId, int bioAssemblyId) {
// pre-computed files use lower case PDB IDs
pdbId = pdbId.toLowerCase();
// we just need this to track where to store PDB files
// this checks the PDB_DIR property (and uses a tmp location if not set)
AtomCache cache = new AtomCache();
cache.setUseMmCif(true);
FileParsingParameters p = cache.getFileParsingParams();
// some bio assemblies are large, we want an all atom representation and avoid
// switching to a Calpha-only representation for large molecules
// note, this requires several GB of memory for some of the largest assemblies, such a 1MX4
p.setAtomCaThreshold(Integer.MAX_VALUE);
// parse remark 350
p.setParseBioAssembly(true);
// download missing files
Structure structure = null;
try {
structure = StructureIO.getBiologicalAssembly(pdbId,bioAssemblyId);
} catch (Exception e){
e.printStackTrace();
return null;
}
return structure;
} | [
"public",
"static",
"Structure",
"readStructure",
"(",
"String",
"pdbId",
",",
"int",
"bioAssemblyId",
")",
"{",
"// pre-computed files use lower case PDB IDs",
"pdbId",
"=",
"pdbId",
".",
"toLowerCase",
"(",
")",
";",
"// we just need this to track where to store PDB files... | Load a specific biological assembly for a PDB entry
@param pdbId .. the PDB ID
@param bioAssemblyId .. the first assembly has the bioAssemblyId 1
@return a Structure object or null if something went wrong. | [
"Load",
"a",
"specific",
"biological",
"assembly",
"for",
"a",
"PDB",
"entry"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/demo/DemoShowLargeAssembly.java#L72-L101 |
amaembo/streamex | src/main/java/one/util/streamex/DoubleStreamEx.java | DoubleStreamEx.of | public static DoubleStreamEx of(DoubleStream stream) {
return stream instanceof DoubleStreamEx ? (DoubleStreamEx) stream
: new DoubleStreamEx(stream, StreamContext.of(stream));
} | java | public static DoubleStreamEx of(DoubleStream stream) {
return stream instanceof DoubleStreamEx ? (DoubleStreamEx) stream
: new DoubleStreamEx(stream, StreamContext.of(stream));
} | [
"public",
"static",
"DoubleStreamEx",
"of",
"(",
"DoubleStream",
"stream",
")",
"{",
"return",
"stream",
"instanceof",
"DoubleStreamEx",
"?",
"(",
"DoubleStreamEx",
")",
"stream",
":",
"new",
"DoubleStreamEx",
"(",
"stream",
",",
"StreamContext",
".",
"of",
"(",... | Returns a {@code DoubleStreamEx} object which wraps given
{@link DoubleStream}.
<p>
The supplied stream must not be consumed or closed when this method is
called. No operation must be performed on the supplied stream after it's
wrapped.
@param stream original stream
@return the wrapped stream
@since 0.0.8 | [
"Returns",
"a",
"{",
"@code",
"DoubleStreamEx",
"}",
"object",
"which",
"wraps",
"given",
"{",
"@link",
"DoubleStream",
"}",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L1607-L1610 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.getResource | public static URL getResource(final Class<?> clasz, final String name) {
checkNotNull("clasz", clasz);
checkNotNull("name", name);
final String nameAndPath = SLASH + getPackagePath(clasz) + SLASH + name;
return clasz.getResource(nameAndPath);
} | java | public static URL getResource(final Class<?> clasz, final String name) {
checkNotNull("clasz", clasz);
checkNotNull("name", name);
final String nameAndPath = SLASH + getPackagePath(clasz) + SLASH + name;
return clasz.getResource(nameAndPath);
} | [
"public",
"static",
"URL",
"getResource",
"(",
"final",
"Class",
"<",
"?",
">",
"clasz",
",",
"final",
"String",
"name",
")",
"{",
"checkNotNull",
"(",
"\"clasz\"",
",",
"clasz",
")",
";",
"checkNotNull",
"(",
"\"name\"",
",",
"name",
")",
";",
"final",
... | Get the path to a resource located in the same package as a given class.
@param clasz
Class with the same package where the resource is located - Cannot be <code>null</code>.
@param name
Filename of the resource - Cannot be <code>null</code>.
@return Resource URL. | [
"Get",
"the",
"path",
"to",
"a",
"resource",
"located",
"in",
"the",
"same",
"package",
"as",
"a",
"given",
"class",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L133-L138 |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/api/PalDB.java | PalDB.createReader | public static StoreReader createReader(File file, Configuration config) {
return StoreImpl.createReader(file, config);
} | java | public static StoreReader createReader(File file, Configuration config) {
return StoreImpl.createReader(file, config);
} | [
"public",
"static",
"StoreReader",
"createReader",
"(",
"File",
"file",
",",
"Configuration",
"config",
")",
"{",
"return",
"StoreImpl",
".",
"createReader",
"(",
"file",
",",
"config",
")",
";",
"}"
] | Creates a store reader from the specified <code>file</code>.
<p>
The file must exists.
@param file a PalDB store file
@param config configuration
@return a store reader | [
"Creates",
"a",
"store",
"reader",
"from",
"the",
"specified",
"<code",
">",
"file<",
"/",
"code",
">",
".",
"<p",
">",
"The",
"file",
"must",
"exists",
"."
] | train | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/api/PalDB.java#L58-L60 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/ColumnMajorSparseMatrix.java | ColumnMajorSparseMatrix.from1DArray | public static ColumnMajorSparseMatrix from1DArray(int rows, int columns, double[] array) {
return CCSMatrix.from1DArray(rows, columns, array);
} | java | public static ColumnMajorSparseMatrix from1DArray(int rows, int columns, double[] array) {
return CCSMatrix.from1DArray(rows, columns, array);
} | [
"public",
"static",
"ColumnMajorSparseMatrix",
"from1DArray",
"(",
"int",
"rows",
",",
"int",
"columns",
",",
"double",
"[",
"]",
"array",
")",
"{",
"return",
"CCSMatrix",
".",
"from1DArray",
"(",
"rows",
",",
"columns",
",",
"array",
")",
";",
"}"
] | Creates a new {@link ColumnMajorSparseMatrix} from the given 1D {@code array} with
compressing (copying) the underlying array. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/ColumnMajorSparseMatrix.java#L99-L101 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/msvc/VisualStudioNETProjectWriter.java | VisualStudioNETProjectWriter.addAttribute | private static void addAttribute(final AttributesImpl attributes, final String attrName, final String attrValue) {
if (attrName == null) {
throw new IllegalArgumentException("attrName");
}
if (attrValue != null) {
attributes.addAttribute(null, attrName, attrName, "#PCDATA", attrValue);
}
} | java | private static void addAttribute(final AttributesImpl attributes, final String attrName, final String attrValue) {
if (attrName == null) {
throw new IllegalArgumentException("attrName");
}
if (attrValue != null) {
attributes.addAttribute(null, attrName, attrName, "#PCDATA", attrValue);
}
} | [
"private",
"static",
"void",
"addAttribute",
"(",
"final",
"AttributesImpl",
"attributes",
",",
"final",
"String",
"attrName",
",",
"final",
"String",
"attrValue",
")",
"{",
"if",
"(",
"attrName",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | Adds an non-namespace-qualified attribute to attribute list.
@param attributes
list of attributes.
@param attrName
attribute name, may not be null.
@param attrValue
attribute value, if null attribute is not added. | [
"Adds",
"an",
"non",
"-",
"namespace",
"-",
"qualified",
"attribute",
"to",
"attribute",
"list",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/msvc/VisualStudioNETProjectWriter.java#L65-L72 |
jbundle/osgi | core/src/main/java/org/jbundle/util/osgi/bundle/BaseBundleActivator.java | BaseBundleActivator.getService | public Object getService(String interfaceClassName, String serviceClassName, String versionRange, Dictionary<String,String> filter)
{
return ClassServiceUtility.getClassService().getClassFinder(context).getClassBundleService(interfaceClassName, serviceClassName, versionRange, filter, -1);
} | java | public Object getService(String interfaceClassName, String serviceClassName, String versionRange, Dictionary<String,String> filter)
{
return ClassServiceUtility.getClassService().getClassFinder(context).getClassBundleService(interfaceClassName, serviceClassName, versionRange, filter, -1);
} | [
"public",
"Object",
"getService",
"(",
"String",
"interfaceClassName",
",",
"String",
"serviceClassName",
",",
"String",
"versionRange",
",",
"Dictionary",
"<",
"String",
",",
"String",
">",
"filter",
")",
"{",
"return",
"ClassServiceUtility",
".",
"getClassService"... | Convenience method to get the service for this implementation class.
@param interfaceClassName
@return | [
"Convenience",
"method",
"to",
"get",
"the",
"service",
"for",
"this",
"implementation",
"class",
"."
] | train | https://github.com/jbundle/osgi/blob/beb02aef78736a4f799aaac001c8f0327bf0536c/core/src/main/java/org/jbundle/util/osgi/bundle/BaseBundleActivator.java#L284-L287 |
groovy/groovy-core | src/main/org/codehaus/groovy/syntax/Types.java | Types.canMean | public static boolean canMean( int actual, int preferred ) {
if( actual == preferred ) {
return true;
}
switch( preferred ) {
case SYNTH_PARAMETER_DECLARATION:
case IDENTIFIER:
switch( actual ) {
case IDENTIFIER:
case KEYWORD_DEF:
case KEYWORD_DEFMACRO:
case KEYWORD_CLASS:
case KEYWORD_INTERFACE:
case KEYWORD_MIXIN:
return true;
}
break;
case SYNTH_CLASS:
case SYNTH_INTERFACE:
case SYNTH_MIXIN:
case SYNTH_METHOD:
case SYNTH_PROPERTY:
return actual == IDENTIFIER;
case SYNTH_LIST:
case SYNTH_MAP:
return actual == LEFT_SQUARE_BRACKET;
case SYNTH_CAST:
return actual == LEFT_PARENTHESIS;
case SYNTH_BLOCK:
case SYNTH_CLOSURE:
return actual == LEFT_CURLY_BRACE;
case SYNTH_LABEL:
return actual == COLON;
case SYNTH_VARIABLE_DECLARATION:
return actual == IDENTIFIER;
}
return false;
} | java | public static boolean canMean( int actual, int preferred ) {
if( actual == preferred ) {
return true;
}
switch( preferred ) {
case SYNTH_PARAMETER_DECLARATION:
case IDENTIFIER:
switch( actual ) {
case IDENTIFIER:
case KEYWORD_DEF:
case KEYWORD_DEFMACRO:
case KEYWORD_CLASS:
case KEYWORD_INTERFACE:
case KEYWORD_MIXIN:
return true;
}
break;
case SYNTH_CLASS:
case SYNTH_INTERFACE:
case SYNTH_MIXIN:
case SYNTH_METHOD:
case SYNTH_PROPERTY:
return actual == IDENTIFIER;
case SYNTH_LIST:
case SYNTH_MAP:
return actual == LEFT_SQUARE_BRACKET;
case SYNTH_CAST:
return actual == LEFT_PARENTHESIS;
case SYNTH_BLOCK:
case SYNTH_CLOSURE:
return actual == LEFT_CURLY_BRACE;
case SYNTH_LABEL:
return actual == COLON;
case SYNTH_VARIABLE_DECLARATION:
return actual == IDENTIFIER;
}
return false;
} | [
"public",
"static",
"boolean",
"canMean",
"(",
"int",
"actual",
",",
"int",
"preferred",
")",
"{",
"if",
"(",
"actual",
"==",
"preferred",
")",
"{",
"return",
"true",
";",
"}",
"switch",
"(",
"preferred",
")",
"{",
"case",
"SYNTH_PARAMETER_DECLARATION",
":... | Given two types, returns true if the first can be viewed as the second.
NOTE that <code>canMean()</code> is orthogonal to <code>ofType()</code>. | [
"Given",
"two",
"types",
"returns",
"true",
"if",
"the",
"first",
"can",
"be",
"viewed",
"as",
"the",
"second",
".",
"NOTE",
"that",
"<code",
">",
"canMean",
"()",
"<",
"/",
"code",
">",
"is",
"orthogonal",
"to",
"<code",
">",
"ofType",
"()",
"<",
"/... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/syntax/Types.java#L854-L901 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java | BinaryRowProtocol.getInternalTime | public Time getInternalTime(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case TIMESTAMP:
case DATETIME:
Timestamp ts = getInternalTimestamp(columnInfo, cal, timeZone);
return (ts == null) ? null : new Time(ts.getTime());
case DATE:
throw new SQLException("Cannot read Time using a Types.DATE field");
default:
Calendar calendar = Calendar.getInstance();
calendar.clear();
int day = 0;
int hour = 0;
int minutes = 0;
int seconds = 0;
boolean negate = false;
if (length > 0) {
negate = (buf[pos] & 0xff) == 0x01;
}
if (length > 4) {
day = ((buf[pos + 1] & 0xff)
+ ((buf[pos + 2] & 0xff) << 8)
+ ((buf[pos + 3] & 0xff) << 16)
+ ((buf[pos + 4] & 0xff) << 24));
}
if (length > 7) {
hour = buf[pos + 5];
minutes = buf[pos + 6];
seconds = buf[pos + 7];
}
calendar
.set(1970, Calendar.JANUARY, ((negate ? -1 : 1) * day) + 1, (negate ? -1 : 1) * hour,
minutes, seconds);
int nanoseconds = 0;
if (length > 8) {
nanoseconds = ((buf[pos + 8] & 0xff)
+ ((buf[pos + 9] & 0xff) << 8)
+ ((buf[pos + 10] & 0xff) << 16)
+ ((buf[pos + 11] & 0xff) << 24));
}
calendar.set(Calendar.MILLISECOND, nanoseconds / 1000);
return new Time(calendar.getTimeInMillis());
}
} | java | public Time getInternalTime(ColumnInformation columnInfo, Calendar cal, TimeZone timeZone)
throws SQLException {
if (lastValueWasNull()) {
return null;
}
switch (columnInfo.getColumnType()) {
case TIMESTAMP:
case DATETIME:
Timestamp ts = getInternalTimestamp(columnInfo, cal, timeZone);
return (ts == null) ? null : new Time(ts.getTime());
case DATE:
throw new SQLException("Cannot read Time using a Types.DATE field");
default:
Calendar calendar = Calendar.getInstance();
calendar.clear();
int day = 0;
int hour = 0;
int minutes = 0;
int seconds = 0;
boolean negate = false;
if (length > 0) {
negate = (buf[pos] & 0xff) == 0x01;
}
if (length > 4) {
day = ((buf[pos + 1] & 0xff)
+ ((buf[pos + 2] & 0xff) << 8)
+ ((buf[pos + 3] & 0xff) << 16)
+ ((buf[pos + 4] & 0xff) << 24));
}
if (length > 7) {
hour = buf[pos + 5];
minutes = buf[pos + 6];
seconds = buf[pos + 7];
}
calendar
.set(1970, Calendar.JANUARY, ((negate ? -1 : 1) * day) + 1, (negate ? -1 : 1) * hour,
minutes, seconds);
int nanoseconds = 0;
if (length > 8) {
nanoseconds = ((buf[pos + 8] & 0xff)
+ ((buf[pos + 9] & 0xff) << 8)
+ ((buf[pos + 10] & 0xff) << 16)
+ ((buf[pos + 11] & 0xff) << 24));
}
calendar.set(Calendar.MILLISECOND, nanoseconds / 1000);
return new Time(calendar.getTimeInMillis());
}
} | [
"public",
"Time",
"getInternalTime",
"(",
"ColumnInformation",
"columnInfo",
",",
"Calendar",
"cal",
",",
"TimeZone",
"timeZone",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
... | Get time from raw binary format.
@param columnInfo column information
@param cal calendar
@param timeZone time zone
@return Time value
@throws SQLException if column cannot be converted to Time | [
"Get",
"time",
"from",
"raw",
"binary",
"format",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/BinaryRowProtocol.java#L801-L851 |
tzaeschke/zoodb | src/org/zoodb/internal/util/FormattedStringBuilder.java | FormattedStringBuilder.fill | public FormattedStringBuilder fill(int newLength, char c) {
int lineStart = _delegate.lastIndexOf(NL);
if (lineStart == -1) {
return fillBuffer(newLength, c);
}
lineStart += NL.length();
return fillBuffer(lineStart + newLength, c);
} | java | public FormattedStringBuilder fill(int newLength, char c) {
int lineStart = _delegate.lastIndexOf(NL);
if (lineStart == -1) {
return fillBuffer(newLength, c);
}
lineStart += NL.length();
return fillBuffer(lineStart + newLength, c);
} | [
"public",
"FormattedStringBuilder",
"fill",
"(",
"int",
"newLength",
",",
"char",
"c",
")",
"{",
"int",
"lineStart",
"=",
"_delegate",
".",
"lastIndexOf",
"(",
"NL",
")",
";",
"if",
"(",
"lineStart",
"==",
"-",
"1",
")",
"{",
"return",
"fillBuffer",
"(",... | Attempts to append <tt>c</tt> until the current line gets the length <tt>
newLength</tt>. If the line is already as long or longer than <tt>
newLength</tt>, then nothing is appended.
@param newLength Minimal new length of the last line.
@param c Character to append.
@return The updated instance of FormattedStringBuilder. | [
"Attempts",
"to",
"append",
"<tt",
">",
"c<",
"/",
"tt",
">",
"until",
"the",
"current",
"line",
"gets",
"the",
"length",
"<tt",
">",
"newLength<",
"/",
"tt",
">",
".",
"If",
"the",
"line",
"is",
"already",
"as",
"long",
"or",
"longer",
"than",
"<tt"... | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/FormattedStringBuilder.java#L191-L198 |
cycorp/api-suite | core-api/src/main/java/com/cyc/session/exception/SessionCommunicationException.java | SessionCommunicationException.fromThrowable | public static SessionCommunicationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionCommunicationException && Objects.equals(message, cause.getMessage()))
? (SessionCommunicationException) cause
: new SessionCommunicationException(message, cause);
} | java | public static SessionCommunicationException fromThrowable(String message, Throwable cause) {
return (cause instanceof SessionCommunicationException && Objects.equals(message, cause.getMessage()))
? (SessionCommunicationException) cause
: new SessionCommunicationException(message, cause);
} | [
"public",
"static",
"SessionCommunicationException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"SessionCommunicationException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
... | Converts a Throwable to a SessionCommunicationException with the specified detail message. If the
Throwable is a SessionCommunicationException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new SessionCommunicationException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a SessionCommunicationException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"SessionCommunicationException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"SessionCommunicationException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/session/exception/SessionCommunicationException.java#L62-L66 |
vekexasia/android-edittext-validator | library/src/com/andreabaccega/widget/FormAutoCompleteTextView.java | FormAutoCompleteTextView.setError | @Override
public void setError(CharSequence error, Drawable icon) {
super.setError(error, icon);
lastErrorIcon = icon;
// if the error is not null, and we are in JB, force
// the error to show
if (error != null /* !isFocused() && */) {
showErrorIconHax(icon);
}
} | java | @Override
public void setError(CharSequence error, Drawable icon) {
super.setError(error, icon);
lastErrorIcon = icon;
// if the error is not null, and we are in JB, force
// the error to show
if (error != null /* !isFocused() && */) {
showErrorIconHax(icon);
}
} | [
"@",
"Override",
"public",
"void",
"setError",
"(",
"CharSequence",
"error",
",",
"Drawable",
"icon",
")",
"{",
"super",
".",
"setError",
"(",
"error",
",",
"icon",
")",
";",
"lastErrorIcon",
"=",
"icon",
";",
"// if the error is not null, and we are in JB, force"... | Resolve an issue where the error icon is hidden under some cases in JB
due to a bug http://code.google.com/p/android/issues/detail?id=40417 | [
"Resolve",
"an",
"issue",
"where",
"the",
"error",
"icon",
"is",
"hidden",
"under",
"some",
"cases",
"in",
"JB",
"due",
"to",
"a",
"bug",
"http",
":",
"//",
"code",
".",
"google",
".",
"com",
"/",
"p",
"/",
"android",
"/",
"issues",
"/",
"detail?id",... | train | https://github.com/vekexasia/android-edittext-validator/blob/4a100e3d708b232133f4dd8ceb37ad7447fc7a1b/library/src/com/andreabaccega/widget/FormAutoCompleteTextView.java#L92-L102 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/HubVirtualNetworkConnectionsInner.java | HubVirtualNetworkConnectionsInner.listAsync | public Observable<Page<HubVirtualNetworkConnectionInner>> listAsync(final String resourceGroupName, final String virtualHubName) {
return listWithServiceResponseAsync(resourceGroupName, virtualHubName)
.map(new Func1<ServiceResponse<Page<HubVirtualNetworkConnectionInner>>, Page<HubVirtualNetworkConnectionInner>>() {
@Override
public Page<HubVirtualNetworkConnectionInner> call(ServiceResponse<Page<HubVirtualNetworkConnectionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<HubVirtualNetworkConnectionInner>> listAsync(final String resourceGroupName, final String virtualHubName) {
return listWithServiceResponseAsync(resourceGroupName, virtualHubName)
.map(new Func1<ServiceResponse<Page<HubVirtualNetworkConnectionInner>>, Page<HubVirtualNetworkConnectionInner>>() {
@Override
public Page<HubVirtualNetworkConnectionInner> call(ServiceResponse<Page<HubVirtualNetworkConnectionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"HubVirtualNetworkConnectionInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"virtualHubName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",... | Retrieves the details of all HubVirtualNetworkConnections.
@param resourceGroupName The resource group name of the VirtualHub.
@param virtualHubName The name of the VirtualHub.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<HubVirtualNetworkConnectionInner> object | [
"Retrieves",
"the",
"details",
"of",
"all",
"HubVirtualNetworkConnections",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/HubVirtualNetworkConnectionsInner.java#L214-L222 |
wildfly-extras/wildfly-camel | subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java | CamelEndpointDeployerService.doDeploy | void doDeploy(URI uri, Consumer<EndpointServlet> endpointServletConsumer, Consumer<DeploymentInfo> deploymentInfoConsumer, Consumer<DeploymentImpl> deploymentConsumer) {
final ServletInfo servletInfo = Servlets.servlet(EndpointServlet.NAME, EndpointServlet.class).addMapping("/*")
.setAsyncSupported(true);
final DeploymentInfo mainDeploymentInfo = deploymentInfoSupplier.getValue();
DeploymentInfo endPointDeplyomentInfo = adaptDeploymentInfo(mainDeploymentInfo, uri, servletInfo);
deploymentInfoConsumer.accept(endPointDeplyomentInfo);
CamelLogger.LOGGER.debug("Deploying endpoint {}", endPointDeplyomentInfo.getDeploymentName());
final ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(endPointDeplyomentInfo.getClassLoader());
try {
final DeploymentManager manager = servletContainerServiceSupplier.getValue().getServletContainer()
.addDeployment(endPointDeplyomentInfo);
manager.deploy();
final Deployment deployment = manager.getDeployment();
try {
deploymentConsumer.accept((DeploymentImpl) deployment);
manager.start();
hostSupplier.getValue().registerDeployment(deployment, deployment.getHandler());
ManagedServlet managedServlet = deployment.getServlets().getManagedServlet(EndpointServlet.NAME);
EndpointServlet servletInstance = (EndpointServlet) managedServlet.getServlet().getInstance();
endpointServletConsumer.accept(servletInstance);
} catch (ServletException ex) {
throw new IllegalStateException(ex);
}
synchronized (deployments) {
deployments.put(uri, manager);
}
} finally {
Thread.currentThread().setContextClassLoader(old);
}
} | java | void doDeploy(URI uri, Consumer<EndpointServlet> endpointServletConsumer, Consumer<DeploymentInfo> deploymentInfoConsumer, Consumer<DeploymentImpl> deploymentConsumer) {
final ServletInfo servletInfo = Servlets.servlet(EndpointServlet.NAME, EndpointServlet.class).addMapping("/*")
.setAsyncSupported(true);
final DeploymentInfo mainDeploymentInfo = deploymentInfoSupplier.getValue();
DeploymentInfo endPointDeplyomentInfo = adaptDeploymentInfo(mainDeploymentInfo, uri, servletInfo);
deploymentInfoConsumer.accept(endPointDeplyomentInfo);
CamelLogger.LOGGER.debug("Deploying endpoint {}", endPointDeplyomentInfo.getDeploymentName());
final ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(endPointDeplyomentInfo.getClassLoader());
try {
final DeploymentManager manager = servletContainerServiceSupplier.getValue().getServletContainer()
.addDeployment(endPointDeplyomentInfo);
manager.deploy();
final Deployment deployment = manager.getDeployment();
try {
deploymentConsumer.accept((DeploymentImpl) deployment);
manager.start();
hostSupplier.getValue().registerDeployment(deployment, deployment.getHandler());
ManagedServlet managedServlet = deployment.getServlets().getManagedServlet(EndpointServlet.NAME);
EndpointServlet servletInstance = (EndpointServlet) managedServlet.getServlet().getInstance();
endpointServletConsumer.accept(servletInstance);
} catch (ServletException ex) {
throw new IllegalStateException(ex);
}
synchronized (deployments) {
deployments.put(uri, manager);
}
} finally {
Thread.currentThread().setContextClassLoader(old);
}
} | [
"void",
"doDeploy",
"(",
"URI",
"uri",
",",
"Consumer",
"<",
"EndpointServlet",
">",
"endpointServletConsumer",
",",
"Consumer",
"<",
"DeploymentInfo",
">",
"deploymentInfoConsumer",
",",
"Consumer",
"<",
"DeploymentImpl",
">",
"deploymentConsumer",
")",
"{",
"final... | The stuff common for {@link #deploy(URI, EndpointHttpHandler)} and {@link #deploy(URI, HttpHandler)}.
@param uri
@param endpointServletConsumer customize the {@link EndpointServlet}
@param deploymentInfoConsumer customize the {@link DeploymentInfo}
@param deploymentConsumer customize the {@link DeploymentImpl} | [
"The",
"stuff",
"common",
"for",
"{",
"@link",
"#deploy",
"(",
"URI",
"EndpointHttpHandler",
")",
"}",
"and",
"{",
"@link",
"#deploy",
"(",
"URI",
"HttpHandler",
")",
"}",
"."
] | train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/core/src/main/java/org/wildfly/extension/camel/service/CamelEndpointDeployerService.java#L465-L501 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java | CmsImportExportUserDialog.getExportUserDialogForOU | public static CmsImportExportUserDialog getExportUserDialogForOU(
String ou,
Window window,
boolean allowTechnicalFieldsExport) {
CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, null, window, allowTechnicalFieldsExport);
return res;
} | java | public static CmsImportExportUserDialog getExportUserDialogForOU(
String ou,
Window window,
boolean allowTechnicalFieldsExport) {
CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, null, window, allowTechnicalFieldsExport);
return res;
} | [
"public",
"static",
"CmsImportExportUserDialog",
"getExportUserDialogForOU",
"(",
"String",
"ou",
",",
"Window",
"window",
",",
"boolean",
"allowTechnicalFieldsExport",
")",
"{",
"CmsImportExportUserDialog",
"res",
"=",
"new",
"CmsImportExportUserDialog",
"(",
"ou",
",",
... | Gets an dialog instance for fixed group.<p>
@param ou ou name
@param window window
@param allowTechnicalFieldsExport flag indicates if technical field export option should be available
@return an instance of this class | [
"Gets",
"an",
"dialog",
"instance",
"for",
"fixed",
"group",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java#L471-L478 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendParameter | private void appendParameter(Object value, StringBuffer buf)
{
if (value instanceof Query)
{
appendSubQuery((Query) value, buf);
}
else
{
buf.append("?");
}
} | java | private void appendParameter(Object value, StringBuffer buf)
{
if (value instanceof Query)
{
appendSubQuery((Query) value, buf);
}
else
{
buf.append("?");
}
} | [
"private",
"void",
"appendParameter",
"(",
"Object",
"value",
",",
"StringBuffer",
"buf",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Query",
")",
"{",
"appendSubQuery",
"(",
"(",
"Query",
")",
"value",
",",
"buf",
")",
";",
"}",
"else",
"{",
"buf",
"... | Append the Parameter
Add the place holder ? or the SubQuery
@param value the value of the criteria | [
"Append",
"the",
"Parameter",
"Add",
"the",
"place",
"holder",
"?",
"or",
"the",
"SubQuery"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L955-L965 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.logf | public void logf(String loggerFqcn, Level level, Throwable t, String format, Object... params) {
doLogf(level, loggerFqcn, format, params, t);
} | java | public void logf(String loggerFqcn, Level level, Throwable t, String format, Object... params) {
doLogf(level, loggerFqcn, format, params, t);
} | [
"public",
"void",
"logf",
"(",
"String",
"loggerFqcn",
",",
"Level",
"level",
",",
"Throwable",
"t",
",",
"String",
"format",
",",
"Object",
"...",
"params",
")",
"{",
"doLogf",
"(",
"level",
",",
"loggerFqcn",
",",
"format",
",",
"params",
",",
"t",
"... | Log a message at the given level.
@param loggerFqcn the logger class name
@param level the level
@param t the throwable cause
@param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
@param params the message parameters | [
"Log",
"a",
"message",
"at",
"the",
"given",
"level",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L2444-L2446 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/util/AbstractLog.java | AbstractLog.mandatoryNote | public void mandatoryNote(final JavaFileObject file, String key, Object ... args) {
report(diags.mandatoryNote(getSource(file), key, args));
} | java | public void mandatoryNote(final JavaFileObject file, String key, Object ... args) {
report(diags.mandatoryNote(getSource(file), key, args));
} | [
"public",
"void",
"mandatoryNote",
"(",
"final",
"JavaFileObject",
"file",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"report",
"(",
"diags",
".",
"mandatoryNote",
"(",
"getSource",
"(",
"file",
")",
",",
"key",
",",
"args",
")",
")",
... | Provide a non-fatal notification, unless suppressed by the -nowarn option.
@param key The key for the localized notification message.
@param args Fields of the notification message. | [
"Provide",
"a",
"non",
"-",
"fatal",
"notification",
"unless",
"suppressed",
"by",
"the",
"-",
"nowarn",
"option",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/util/AbstractLog.java#L238-L240 |
alkacon/opencms-core | src/org/opencms/ui/apps/sitemanager/CmsCreateSiteThread.java | CmsCreateSiteThread.createSitemapContentFolder | private void createSitemapContentFolder(CmsObject cms, CmsResource subSitemapFolder, String contentFolder)
throws CmsException, CmsLoaderException {
CmsResource configFile = null;
String sitePath = cms.getSitePath(subSitemapFolder);
String folderName = CmsStringUtil.joinPaths(sitePath, CmsADEManager.CONTENT_FOLDER_NAME + "/");
String sitemapConfigName = CmsStringUtil.joinPaths(folderName, CmsADEManager.CONFIG_FILE_NAME);
if (!cms.existsResource(folderName)) {
cms.createResource(
folderName,
OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_FOLDER_TYPE));
}
I_CmsResourceType configType = OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE);
if (cms.existsResource(sitemapConfigName)) {
configFile = cms.readResource(sitemapConfigName);
if (!OpenCms.getResourceManager().getResourceType(configFile).getTypeName().equals(
configType.getTypeName())) {
throw new CmsException(
Messages.get().container(
Messages.ERR_CREATING_SUB_SITEMAP_WRONG_CONFIG_FILE_TYPE_2,
sitemapConfigName,
CmsADEManager.CONFIG_TYPE));
}
} else {
configFile = cms.createResource(
sitemapConfigName,
OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE));
}
if (configFile != null) {
try {
CmsResource newFolder = m_cms.createResource(
contentFolder + NEW,
OpenCms.getResourceManager().getResourceType(CmsResourceTypeFolder.RESOURCE_TYPE_NAME));
I_CmsResourceType containerType = OpenCms.getResourceManager().getResourceType(
org.opencms.file.types.CmsResourceTypeXmlContainerPage.RESOURCE_TYPE_NAME);
CmsResource modelPage = m_cms.createResource(newFolder.getRootPath() + BLANK_HTML, containerType);
String defTitle = Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key(
Messages.GUI_DEFAULT_MODEL_TITLE_1,
m_site.getTitle());
String defDes = Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key(
Messages.GUI_DEFAULT_MODEL_DESCRIPTION_1,
m_site.getTitle());
CmsProperty prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, defTitle, defTitle);
m_cms.writePropertyObject(modelPage.getRootPath(), prop);
prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_DESCRIPTION, defDes, defDes);
m_cms.writePropertyObject(modelPage.getRootPath(), prop);
CmsFile file = m_cms.readFile(configFile);
CmsXmlContent con = CmsXmlContentFactory.unmarshal(m_cms, file);
con.addValue(m_cms, MODEL_PAGE, Locale.ENGLISH, 0);
I_CmsXmlContentValue val = con.getValue(MODEL_PAGE_PAGE, Locale.ENGLISH);
val.setStringValue(m_cms, modelPage.getRootPath());
file.setContents(con.marshal());
m_cms.writeFile(file);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} | java | private void createSitemapContentFolder(CmsObject cms, CmsResource subSitemapFolder, String contentFolder)
throws CmsException, CmsLoaderException {
CmsResource configFile = null;
String sitePath = cms.getSitePath(subSitemapFolder);
String folderName = CmsStringUtil.joinPaths(sitePath, CmsADEManager.CONTENT_FOLDER_NAME + "/");
String sitemapConfigName = CmsStringUtil.joinPaths(folderName, CmsADEManager.CONFIG_FILE_NAME);
if (!cms.existsResource(folderName)) {
cms.createResource(
folderName,
OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_FOLDER_TYPE));
}
I_CmsResourceType configType = OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE);
if (cms.existsResource(sitemapConfigName)) {
configFile = cms.readResource(sitemapConfigName);
if (!OpenCms.getResourceManager().getResourceType(configFile).getTypeName().equals(
configType.getTypeName())) {
throw new CmsException(
Messages.get().container(
Messages.ERR_CREATING_SUB_SITEMAP_WRONG_CONFIG_FILE_TYPE_2,
sitemapConfigName,
CmsADEManager.CONFIG_TYPE));
}
} else {
configFile = cms.createResource(
sitemapConfigName,
OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE));
}
if (configFile != null) {
try {
CmsResource newFolder = m_cms.createResource(
contentFolder + NEW,
OpenCms.getResourceManager().getResourceType(CmsResourceTypeFolder.RESOURCE_TYPE_NAME));
I_CmsResourceType containerType = OpenCms.getResourceManager().getResourceType(
org.opencms.file.types.CmsResourceTypeXmlContainerPage.RESOURCE_TYPE_NAME);
CmsResource modelPage = m_cms.createResource(newFolder.getRootPath() + BLANK_HTML, containerType);
String defTitle = Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key(
Messages.GUI_DEFAULT_MODEL_TITLE_1,
m_site.getTitle());
String defDes = Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key(
Messages.GUI_DEFAULT_MODEL_DESCRIPTION_1,
m_site.getTitle());
CmsProperty prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, defTitle, defTitle);
m_cms.writePropertyObject(modelPage.getRootPath(), prop);
prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_DESCRIPTION, defDes, defDes);
m_cms.writePropertyObject(modelPage.getRootPath(), prop);
CmsFile file = m_cms.readFile(configFile);
CmsXmlContent con = CmsXmlContentFactory.unmarshal(m_cms, file);
con.addValue(m_cms, MODEL_PAGE, Locale.ENGLISH, 0);
I_CmsXmlContentValue val = con.getValue(MODEL_PAGE_PAGE, Locale.ENGLISH);
val.setStringValue(m_cms, modelPage.getRootPath());
file.setContents(con.marshal());
m_cms.writeFile(file);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} | [
"private",
"void",
"createSitemapContentFolder",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"subSitemapFolder",
",",
"String",
"contentFolder",
")",
"throws",
"CmsException",
",",
"CmsLoaderException",
"{",
"CmsResource",
"configFile",
"=",
"null",
";",
"String",
"s... | Helper method for creating the .content folder of a sub-sitemap.<p>
@param cms the current CMS context
@param subSitemapFolder the sub-sitemap folder in which the .content folder should be created
@param contentFolder the content folder path
@throws CmsException if something goes wrong
@throws CmsLoaderException if something goes wrong | [
"Helper",
"method",
"for",
"creating",
"the",
".",
"content",
"folder",
"of",
"a",
"sub",
"-",
"sitemap",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sitemanager/CmsCreateSiteThread.java#L334-L392 |
osglworks/java-tool | src/main/java/org/osgl/util/IO.java | IO.zipInto | public static void zipInto(File target, File... files) {
ZipOutputStream zos = null;
try {
zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(target)));
byte[] buffer = new byte[128];
for (File f : files) {
ZipEntry entry = new ZipEntry(f.getName());
InputStream is = new BufferedInputStream(new FileInputStream(f));
zos.putNextEntry(entry);
int read = 0;
while ((read = is.read(buffer)) != -1) {
zos.write(buffer, 0, read);
}
zos.closeEntry();
IO.close(is);
}
} catch (IOException e) {
throw E.ioException(e);
} finally {
IO.close(zos);
}
} | java | public static void zipInto(File target, File... files) {
ZipOutputStream zos = null;
try {
zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(target)));
byte[] buffer = new byte[128];
for (File f : files) {
ZipEntry entry = new ZipEntry(f.getName());
InputStream is = new BufferedInputStream(new FileInputStream(f));
zos.putNextEntry(entry);
int read = 0;
while ((read = is.read(buffer)) != -1) {
zos.write(buffer, 0, read);
}
zos.closeEntry();
IO.close(is);
}
} catch (IOException e) {
throw E.ioException(e);
} finally {
IO.close(zos);
}
} | [
"public",
"static",
"void",
"zipInto",
"(",
"File",
"target",
",",
"File",
"...",
"files",
")",
"{",
"ZipOutputStream",
"zos",
"=",
"null",
";",
"try",
"{",
"zos",
"=",
"new",
"ZipOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStre... | Zip a list of files into specified target file.
@param target
the target file as the zip package
@param files
the files to be zipped. | [
"Zip",
"a",
"list",
"of",
"files",
"into",
"specified",
"target",
"file",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L2131-L2152 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/NewOnChangeHandler.java | NewOnChangeHandler.fieldChanged | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
try {
m_recTarget.addNew();
} catch (DBException e) {
return e.getErrorCode();
}
return DBConstants.NORMAL_RETURN;
} | java | public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
try {
m_recTarget.addNew();
} catch (DBException e) {
return e.getErrorCode();
}
return DBConstants.NORMAL_RETURN;
} | [
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"try",
"{",
"m_recTarget",
".",
"addNew",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"return",
"e",
".",
"getErrorCode",
"(",
")",
... | The Field has Changed.
Do an addNew() on the target record.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
Field Changed, do an addNew on this record. | [
"The",
"Field",
"has",
"Changed",
".",
"Do",
"an",
"addNew",
"()",
"on",
"the",
"target",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/NewOnChangeHandler.java#L75-L83 |
revelc/formatter-maven-plugin | src/main/java/net/revelc/code/formatter/FormatterMojo.java | FormatterMojo.formatFile | private void formatFile(File file, ResultCollector rc, Properties hashCache, String basedirPath)
throws MojoFailureException, MojoExecutionException {
try {
doFormatFile(file, rc, hashCache, basedirPath, false);
} catch (IOException | MalformedTreeException | BadLocationException e) {
rc.failCount++;
getLog().warn(e);
}
} | java | private void formatFile(File file, ResultCollector rc, Properties hashCache, String basedirPath)
throws MojoFailureException, MojoExecutionException {
try {
doFormatFile(file, rc, hashCache, basedirPath, false);
} catch (IOException | MalformedTreeException | BadLocationException e) {
rc.failCount++;
getLog().warn(e);
}
} | [
"private",
"void",
"formatFile",
"(",
"File",
"file",
",",
"ResultCollector",
"rc",
",",
"Properties",
"hashCache",
",",
"String",
"basedirPath",
")",
"throws",
"MojoFailureException",
",",
"MojoExecutionException",
"{",
"try",
"{",
"doFormatFile",
"(",
"file",
",... | Format file.
@param file
the file
@param rc
the rc
@param hashCache
the hash cache
@param basedirPath
the basedir path | [
"Format",
"file",
"."
] | train | https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L461-L469 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java | JaxWsUtils.getServiceQName | public static QName getServiceQName(ClassInfo classInfo, String seiClassName, String targetNamespace) {
AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "Service QName");
if (annotationInfo == null) {
return null;
}
//serviceName can only be defined in implementation bean, targetNamespace should be the implemented one.
return getQName(classInfo, targetNamespace, annotationInfo.getValue(JaxWsConstants.SERVICENAME_ATTRIBUTE).getStringValue(),
JaxWsConstants.SERVICENAME_ATTRIBUTE_SUFFIX);
} | java | public static QName getServiceQName(ClassInfo classInfo, String seiClassName, String targetNamespace) {
AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "Service QName");
if (annotationInfo == null) {
return null;
}
//serviceName can only be defined in implementation bean, targetNamespace should be the implemented one.
return getQName(classInfo, targetNamespace, annotationInfo.getValue(JaxWsConstants.SERVICENAME_ATTRIBUTE).getStringValue(),
JaxWsConstants.SERVICENAME_ATTRIBUTE_SUFFIX);
} | [
"public",
"static",
"QName",
"getServiceQName",
"(",
"ClassInfo",
"classInfo",
",",
"String",
"seiClassName",
",",
"String",
"targetNamespace",
")",
"{",
"AnnotationInfo",
"annotationInfo",
"=",
"getAnnotationInfoFromClass",
"(",
"classInfo",
",",
"\"Service QName\"",
"... | Get serviceName's QName of Web Service
@param classInfo
@return | [
"Get",
"serviceName",
"s",
"QName",
"of",
"Web",
"Service"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java#L92-L102 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageHeaderReaderAbstract.java | ImageHeaderReaderAbstract.checkHeader | private static boolean checkHeader(InputStream input, int[] header) throws IOException
{
for (final int b : header)
{
if (b != input.read())
{
return false;
}
}
return true;
} | java | private static boolean checkHeader(InputStream input, int[] header) throws IOException
{
for (final int b : header)
{
if (b != input.read())
{
return false;
}
}
return true;
} | [
"private",
"static",
"boolean",
"checkHeader",
"(",
"InputStream",
"input",
",",
"int",
"[",
"]",
"header",
")",
"throws",
"IOException",
"{",
"for",
"(",
"final",
"int",
"b",
":",
"header",
")",
"{",
"if",
"(",
"b",
"!=",
"input",
".",
"read",
"(",
... | Check header data.
@param input The input stream to check.
@param header The expected header.
@return <code>true</code> if right header, <code>false</code> else.
@throws IOException If unable to read header. | [
"Check",
"header",
"data",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageHeaderReaderAbstract.java#L104-L114 |
baratine/baratine | core/src/main/java/com/caucho/v5/inject/impl/InjectorImpl.java | InjectorImpl.addBinding | private <T> void addBinding(Class<T> type, BindingAmp<T> binding)
{
synchronized (_bindingSetMap) {
BindingSet<T> set = (BindingSet) _bindingSetMap.get(type);
if (set == null) {
set = new BindingSet<>(type);
_bindingSetMap.put(type, set);
}
set.addBinding(binding);
}
} | java | private <T> void addBinding(Class<T> type, BindingAmp<T> binding)
{
synchronized (_bindingSetMap) {
BindingSet<T> set = (BindingSet) _bindingSetMap.get(type);
if (set == null) {
set = new BindingSet<>(type);
_bindingSetMap.put(type, set);
}
set.addBinding(binding);
}
} | [
"private",
"<",
"T",
">",
"void",
"addBinding",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"BindingAmp",
"<",
"T",
">",
"binding",
")",
"{",
"synchronized",
"(",
"_bindingSetMap",
")",
"{",
"BindingSet",
"<",
"T",
">",
"set",
"=",
"(",
"BindingSet",
"... | Adds a new injection producer to the discovered producer list. | [
"Adds",
"a",
"new",
"injection",
"producer",
"to",
"the",
"discovered",
"producer",
"list",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/inject/impl/InjectorImpl.java#L754-L766 |
eyp/serfj | src/main/java/net/sf/serfj/ServletHelper.java | ServletHelper.inheritedStrategy | private Object inheritedStrategy(UrlInfo urlInfo, ResponseHelper responseHelper) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException,
InvocationTargetException, InstantiationException {
Class<?> clazz = Class.forName(urlInfo.getController());
Method setResponseHelper = clazz.getMethod("setResponseHelper", new Class<?>[] { ResponseHelper.class });
LOGGER.debug("Instantiating controller {}", clazz.getCanonicalName());
Object controllerInstance = clazz.newInstance();
LOGGER.debug("Calling {}.setResponseHelper(ResponseHelper)", clazz.getCanonicalName());
setResponseHelper.invoke(controllerInstance, responseHelper);
Method action = clazz.getMethod(urlInfo.getAction(), new Class[] {});
LOGGER.debug("Calling {}.{}()", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(action);
return this.invokeAction(controllerInstance, action, urlInfo);
} | java | private Object inheritedStrategy(UrlInfo urlInfo, ResponseHelper responseHelper) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException,
InvocationTargetException, InstantiationException {
Class<?> clazz = Class.forName(urlInfo.getController());
Method setResponseHelper = clazz.getMethod("setResponseHelper", new Class<?>[] { ResponseHelper.class });
LOGGER.debug("Instantiating controller {}", clazz.getCanonicalName());
Object controllerInstance = clazz.newInstance();
LOGGER.debug("Calling {}.setResponseHelper(ResponseHelper)", clazz.getCanonicalName());
setResponseHelper.invoke(controllerInstance, responseHelper);
Method action = clazz.getMethod(urlInfo.getAction(), new Class[] {});
LOGGER.debug("Calling {}.{}()", urlInfo.getController(), urlInfo.getAction());
responseHelper.notRenderPage(action);
return this.invokeAction(controllerInstance, action, urlInfo);
} | [
"private",
"Object",
"inheritedStrategy",
"(",
"UrlInfo",
"urlInfo",
",",
"ResponseHelper",
"responseHelper",
")",
"throws",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
",",
"InstantiationException",
... | Invokes URL's action using INHERIT strategy. It means that controller
inherits from {@link RestController}, so the framework will inject
{@link ResponseHelper} to controller by RestAction.setResposeHelper
method. Furthermore, controller's actions signatures don't have
arguments.
@param urlInfo
Information of REST's URL.
@param responseHelper
ResponseHelper object to inject into the controller.
@throws ClassNotFoundException
if controller's class doesn't exist.
@throws NoSuchMethodException
if doesn't exist a method for action required in the URL.
@throws IllegalArgumentException
if controller's method for action has arguments.
@throws IllegalAccessException
if the controller or its method are not accessibles-
@throws InvocationTargetException
if the controller's method raise an exception.
@throws InstantiationException
if it isn't possible to instantiate the controller. | [
"Invokes",
"URL",
"s",
"action",
"using",
"INHERIT",
"strategy",
".",
"It",
"means",
"that",
"controller",
"inherits",
"from",
"{",
"@link",
"RestController",
"}",
"so",
"the",
"framework",
"will",
"inject",
"{",
"@link",
"ResponseHelper",
"}",
"to",
"controll... | train | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ServletHelper.java#L170-L182 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.buildSerialUIDInfo | public void buildSerialUIDInfo(XMLNode node, Content classTree) {
Content serialUidTree = writer.getSerialUIDInfoHeader();
FieldDoc[] fields = currentClass.fields(false);
for (int i = 0; i < fields.length; i++) {
if (fields[i].name().equals("serialVersionUID") &&
fields[i].constantValueExpression() != null) {
writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
fields[i].constantValueExpression(), serialUidTree);
break;
}
}
classTree.addContent(serialUidTree);
} | java | public void buildSerialUIDInfo(XMLNode node, Content classTree) {
Content serialUidTree = writer.getSerialUIDInfoHeader();
FieldDoc[] fields = currentClass.fields(false);
for (int i = 0; i < fields.length; i++) {
if (fields[i].name().equals("serialVersionUID") &&
fields[i].constantValueExpression() != null) {
writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
fields[i].constantValueExpression(), serialUidTree);
break;
}
}
classTree.addContent(serialUidTree);
} | [
"public",
"void",
"buildSerialUIDInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"classTree",
")",
"{",
"Content",
"serialUidTree",
"=",
"writer",
".",
"getSerialUIDInfoHeader",
"(",
")",
";",
"FieldDoc",
"[",
"]",
"fields",
"=",
"currentClass",
".",
"fields",
... | Build the serial UID information for the given class.
@param node the XML element that specifies which components to document
@param classTree content tree to which the serial UID information will be added | [
"Build",
"the",
"serial",
"UID",
"information",
"for",
"the",
"given",
"class",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L240-L252 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java | WorkflowsInner.listAsync | public Observable<Page<WorkflowInner>> listAsync(final Integer top, final String filter) {
return listWithServiceResponseAsync(top, filter)
.map(new Func1<ServiceResponse<Page<WorkflowInner>>, Page<WorkflowInner>>() {
@Override
public Page<WorkflowInner> call(ServiceResponse<Page<WorkflowInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<WorkflowInner>> listAsync(final Integer top, final String filter) {
return listWithServiceResponseAsync(top, filter)
.map(new Func1<ServiceResponse<Page<WorkflowInner>>, Page<WorkflowInner>>() {
@Override
public Page<WorkflowInner> call(ServiceResponse<Page<WorkflowInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"WorkflowInner",
">",
">",
"listAsync",
"(",
"final",
"Integer",
"top",
",",
"final",
"String",
"filter",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"top",
",",
"filter",
")",
".",
"map",
"(",
"new",
... | Gets a list of workflows by subscription.
@param top The number of items to be included in the result.
@param filter The filter to apply on the operation. Options for filters include: State, Trigger, and ReferencedResourceId.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<WorkflowInner> object | [
"Gets",
"a",
"list",
"of",
"workflows",
"by",
"subscription",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L294-L302 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.