repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/FrameworkManager.java | FrameworkManager.introspectFramework | public void introspectFramework(String timestamp, Set<JavaDumpAction> javaDumpActions) {
"""
Introspect the framework
Get all IntrospectableService from OSGi bundle context, and dump a running
server status from them.
@param timestamp
Create a unique dump folder based on the time stamp string.
@param javaDumpActions
The java dumps to create, or null for the default set.
"""
Tr.audit(tc, "info.introspect.request.received");
File dumpDir = config.getOutputFile(BootstrapConstants.SERVER_DUMP_FOLDER_PREFIX + timestamp + "/");
if (!dumpDir.exists()) {
throw new IllegalStateException("dump directory does not exist.");
}
// generate java dumps if needed, and move them to the dump directory.
if (javaDumpActions != null) {
File javaDumpLocations = new File(dumpDir, BootstrapConstants.SERVER_DUMPED_FILE_LOCATIONS);
dumpJava(javaDumpActions, javaDumpLocations);
}
IntrospectionContext introspectionCtx = new IntrospectionContext(systemBundleCtx, dumpDir);
introspectionCtx.introspectAll();
// create dumped flag file
File dumpedFlag = new File(dumpDir, BootstrapConstants.SERVER_DUMPED_FLAG_FILE_NAME);
try {
dumpedFlag.createNewFile();
} catch (IOException e) {
Tr.warning(tc, "warn.unableWriteFile", dumpedFlag, e.getMessage());
}
} | java | public void introspectFramework(String timestamp, Set<JavaDumpAction> javaDumpActions) {
Tr.audit(tc, "info.introspect.request.received");
File dumpDir = config.getOutputFile(BootstrapConstants.SERVER_DUMP_FOLDER_PREFIX + timestamp + "/");
if (!dumpDir.exists()) {
throw new IllegalStateException("dump directory does not exist.");
}
// generate java dumps if needed, and move them to the dump directory.
if (javaDumpActions != null) {
File javaDumpLocations = new File(dumpDir, BootstrapConstants.SERVER_DUMPED_FILE_LOCATIONS);
dumpJava(javaDumpActions, javaDumpLocations);
}
IntrospectionContext introspectionCtx = new IntrospectionContext(systemBundleCtx, dumpDir);
introspectionCtx.introspectAll();
// create dumped flag file
File dumpedFlag = new File(dumpDir, BootstrapConstants.SERVER_DUMPED_FLAG_FILE_NAME);
try {
dumpedFlag.createNewFile();
} catch (IOException e) {
Tr.warning(tc, "warn.unableWriteFile", dumpedFlag, e.getMessage());
}
} | [
"public",
"void",
"introspectFramework",
"(",
"String",
"timestamp",
",",
"Set",
"<",
"JavaDumpAction",
">",
"javaDumpActions",
")",
"{",
"Tr",
".",
"audit",
"(",
"tc",
",",
"\"info.introspect.request.received\"",
")",
";",
"File",
"dumpDir",
"=",
"config",
".",... | Introspect the framework
Get all IntrospectableService from OSGi bundle context, and dump a running
server status from them.
@param timestamp
Create a unique dump folder based on the time stamp string.
@param javaDumpActions
The java dumps to create, or null for the default set. | [
"Introspect",
"the",
"framework",
"Get",
"all",
"IntrospectableService",
"from",
"OSGi",
"bundle",
"context",
"and",
"dump",
"a",
"running",
"server",
"status",
"from",
"them",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.nested/src/com/ibm/ws/kernel/launch/internal/FrameworkManager.java#L1061-L1085 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java | CmsDomUtil.createHiddenInput | private static InputElement createHiddenInput(String name, String value) {
"""
Creates a hidden input field with the given name and value.<p>
@param name the field name
@param value the field value
@return the input element
"""
InputElement input = Document.get().createHiddenInputElement();
input.setName(name);
input.setValue(value);
return input;
} | java | private static InputElement createHiddenInput(String name, String value) {
InputElement input = Document.get().createHiddenInputElement();
input.setName(name);
input.setValue(value);
return input;
} | [
"private",
"static",
"InputElement",
"createHiddenInput",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"InputElement",
"input",
"=",
"Document",
".",
"get",
"(",
")",
".",
"createHiddenInputElement",
"(",
")",
";",
"input",
".",
"setName",
"(",
"... | Creates a hidden input field with the given name and value.<p>
@param name the field name
@param value the field value
@return the input element | [
"Creates",
"a",
"hidden",
"input",
"field",
"with",
"the",
"given",
"name",
"and",
"value",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L2112-L2118 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/ScriptConverter.java | ScriptConverter._serializeDateTime | private void _serializeDateTime(DateTime dateTime, StringBuilder sb) throws ConverterException {
"""
serialize a DateTime
@param dateTime DateTime to serialize
@param sb
@throws ConverterException
"""
try {
TimeZone tz = ThreadLocalPageContext.getTimeZone();
sb.append(goIn());
sb.append("createDateTime(");
sb.append(DateFormat.call(null, dateTime, "yyyy,m,d", tz));
sb.append(',');
sb.append(TimeFormat.call(null, dateTime, "H,m,s,l,", tz));
sb.append('"').append(tz.getID()).append('"');
sb.append(')');
}
catch (PageException e) {
throw toConverterException(e);
}
} | java | private void _serializeDateTime(DateTime dateTime, StringBuilder sb) throws ConverterException {
try {
TimeZone tz = ThreadLocalPageContext.getTimeZone();
sb.append(goIn());
sb.append("createDateTime(");
sb.append(DateFormat.call(null, dateTime, "yyyy,m,d", tz));
sb.append(',');
sb.append(TimeFormat.call(null, dateTime, "H,m,s,l,", tz));
sb.append('"').append(tz.getID()).append('"');
sb.append(')');
}
catch (PageException e) {
throw toConverterException(e);
}
} | [
"private",
"void",
"_serializeDateTime",
"(",
"DateTime",
"dateTime",
",",
"StringBuilder",
"sb",
")",
"throws",
"ConverterException",
"{",
"try",
"{",
"TimeZone",
"tz",
"=",
"ThreadLocalPageContext",
".",
"getTimeZone",
"(",
")",
";",
"sb",
".",
"append",
"(",
... | serialize a DateTime
@param dateTime DateTime to serialize
@param sb
@throws ConverterException | [
"serialize",
"a",
"DateTime"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/ScriptConverter.java#L126-L141 |
aws/aws-sdk-java | aws-java-sdk-budgets/src/main/java/com/amazonaws/services/budgets/model/Budget.java | Budget.withCostFilters | public Budget withCostFilters(java.util.Map<String, java.util.List<String>> costFilters) {
"""
<p>
The cost filters, such as service or region, that are applied to a budget.
</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
</ul>
@param costFilters
The cost filters, such as service or region, that are applied to a budget.</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together.
"""
setCostFilters(costFilters);
return this;
} | java | public Budget withCostFilters(java.util.Map<String, java.util.List<String>> costFilters) {
setCostFilters(costFilters);
return this;
} | [
"public",
"Budget",
"withCostFilters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"costFilters",
")",
"{",
"setCostFilters",
"(",
"costFilters",
")",
";",
"return",
"this",
";",
... | <p>
The cost filters, such as service or region, that are applied to a budget.
</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
</ul>
@param costFilters
The cost filters, such as service or region, that are applied to a budget.</p>
<p>
AWS Budgets supports the following services as a filter for RI budgets:
</p>
<ul>
<li>
<p>
Amazon Elastic Compute Cloud - Compute
</p>
</li>
<li>
<p>
Amazon Redshift
</p>
</li>
<li>
<p>
Amazon Relational Database Service
</p>
</li>
<li>
<p>
Amazon ElastiCache
</p>
</li>
<li>
<p>
Amazon Elasticsearch Service
</p>
</li>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"cost",
"filters",
"such",
"as",
"service",
"or",
"region",
"that",
"are",
"applied",
"to",
"a",
"budget",
".",
"<",
"/",
"p",
">",
"<p",
">",
"AWS",
"Budgets",
"supports",
"the",
"following",
"services",
"as",
"a",
"filter",
"for",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-budgets/src/main/java/com/amazonaws/services/budgets/model/Budget.java#L474-L477 |
threerings/nenya | core/src/main/java/com/threerings/media/image/ImageManager.java | ImageManager.getMirage | public Mirage getMirage (ImageKey key, Rectangle bounds, Colorization[] zations) {
"""
Like {@link #getMirage(ImageKey,Colorization[])} except that the mirage is created using
only the specified subset of the original image.
"""
BufferedImage src = null;
if (bounds == null) {
// if they specified no bounds, we need to load up the raw image and determine its
// bounds so that we can pass those along to the created mirage
src = getImage(key, zations);
bounds = new Rectangle(0, 0, src.getWidth(), src.getHeight());
}
return new CachedVolatileMirage(this, key, bounds, zations);
} | java | public Mirage getMirage (ImageKey key, Rectangle bounds, Colorization[] zations)
{
BufferedImage src = null;
if (bounds == null) {
// if they specified no bounds, we need to load up the raw image and determine its
// bounds so that we can pass those along to the created mirage
src = getImage(key, zations);
bounds = new Rectangle(0, 0, src.getWidth(), src.getHeight());
}
return new CachedVolatileMirage(this, key, bounds, zations);
} | [
"public",
"Mirage",
"getMirage",
"(",
"ImageKey",
"key",
",",
"Rectangle",
"bounds",
",",
"Colorization",
"[",
"]",
"zations",
")",
"{",
"BufferedImage",
"src",
"=",
"null",
";",
"if",
"(",
"bounds",
"==",
"null",
")",
"{",
"// if they specified no bounds, we ... | Like {@link #getMirage(ImageKey,Colorization[])} except that the mirage is created using
only the specified subset of the original image. | [
"Like",
"{"
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageManager.java#L356-L367 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java | GVRRigidBody.setIgnoreCollisionCheck | public void setIgnoreCollisionCheck(GVRRigidBody collisionObject, boolean ignore) {
"""
Set a {@linkplain GVRRigidBody rigid body} to be ignored (true) or not (false)
@param collisionObject rigidbody object on the collision check
@param ignore boolean to indicate if the specified object will be ignored or not
"""
Native3DRigidBody.setIgnoreCollisionCheck(getNative(), collisionObject.getNative(), ignore);
} | java | public void setIgnoreCollisionCheck(GVRRigidBody collisionObject, boolean ignore) {
Native3DRigidBody.setIgnoreCollisionCheck(getNative(), collisionObject.getNative(), ignore);
} | [
"public",
"void",
"setIgnoreCollisionCheck",
"(",
"GVRRigidBody",
"collisionObject",
",",
"boolean",
"ignore",
")",
"{",
"Native3DRigidBody",
".",
"setIgnoreCollisionCheck",
"(",
"getNative",
"(",
")",
",",
"collisionObject",
".",
"getNative",
"(",
")",
",",
"ignore... | Set a {@linkplain GVRRigidBody rigid body} to be ignored (true) or not (false)
@param collisionObject rigidbody object on the collision check
@param ignore boolean to indicate if the specified object will be ignored or not | [
"Set",
"a",
"{",
"@linkplain",
"GVRRigidBody",
"rigid",
"body",
"}",
"to",
"be",
"ignored",
"(",
"true",
")",
"or",
"not",
"(",
"false",
")"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java#L361-L363 |
milaboratory/milib | src/main/java/com/milaboratory/core/sequence/SequenceQuality.java | SequenceQuality.encodeTo | public void encodeTo(QualityFormat format, byte[] buffer, int offset) {
"""
Encodes current quality line with given offset. Common values for offset are 33 and 64.
@param offset offset
@return bytes encoded quality values
"""
byte vo = format.getOffset();
for (int i = 0; i < data.length; ++i)
buffer[offset++] = (byte) (data[i] + vo);
}
/**
* Encodes current quality line with given offset. Common values for offset are 33 and 64.
*
* @param offset offset
* @return bytes encoded quality values
*/
public byte[] encode(int offset) {
if (offset < 0 || offset > 70)
throw new IllegalArgumentException();
byte[] copy = new byte[data.length];
for (int i = copy.length - 1; i >= 0; --i)
copy[i] += data[i] + offset;
return copy;
} | java | public void encodeTo(QualityFormat format, byte[] buffer, int offset) {
byte vo = format.getOffset();
for (int i = 0; i < data.length; ++i)
buffer[offset++] = (byte) (data[i] + vo);
}
/**
* Encodes current quality line with given offset. Common values for offset are 33 and 64.
*
* @param offset offset
* @return bytes encoded quality values
*/
public byte[] encode(int offset) {
if (offset < 0 || offset > 70)
throw new IllegalArgumentException();
byte[] copy = new byte[data.length];
for (int i = copy.length - 1; i >= 0; --i)
copy[i] += data[i] + offset;
return copy;
} | [
"public",
"void",
"encodeTo",
"(",
"QualityFormat",
"format",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"byte",
"vo",
"=",
"format",
".",
"getOffset",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
... | Encodes current quality line with given offset. Common values for offset are 33 and 64.
@param offset offset
@return bytes encoded quality values | [
"Encodes",
"current",
"quality",
"line",
"with",
"given",
"offset",
".",
"Common",
"values",
"for",
"offset",
"are",
"33",
"and",
"64",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/sequence/SequenceQuality.java#L246-L266 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/model/SQLiteDaoDefinition.java | SQLiteDaoDefinition.resolveTypeVariable | void resolveTypeVariable(SQLiteModelMethod value) {
"""
Convert type variable in correct type. This must be done before work on
SQLMethod
@param value
the value
"""
// before proceed, we need to resolve typeVariables
for (Pair<String, TypeName> item : value.getParameters()) {
item.value1 = typeVariableResolver.resolve(item.value1);
}
value.setReturnClass(typeVariableResolver.resolve(value.getReturnClass()));
} | java | void resolveTypeVariable(SQLiteModelMethod value) {
// before proceed, we need to resolve typeVariables
for (Pair<String, TypeName> item : value.getParameters()) {
item.value1 = typeVariableResolver.resolve(item.value1);
}
value.setReturnClass(typeVariableResolver.resolve(value.getReturnClass()));
} | [
"void",
"resolveTypeVariable",
"(",
"SQLiteModelMethod",
"value",
")",
"{",
"// before proceed, we need to resolve typeVariables",
"for",
"(",
"Pair",
"<",
"String",
",",
"TypeName",
">",
"item",
":",
"value",
".",
"getParameters",
"(",
")",
")",
"{",
"item",
".",... | Convert type variable in correct type. This must be done before work on
SQLMethod
@param value
the value | [
"Convert",
"type",
"variable",
"in",
"correct",
"type",
".",
"This",
"must",
"be",
"done",
"before",
"work",
"on",
"SQLMethod"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/model/SQLiteDaoDefinition.java#L84-L92 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.stateChange | public static Pattern stateChange(Pattern p, String ctrlLabel) {
"""
Pattern for a Conversion has an input PhysicalEntity and another output PhysicalEntity that
belongs to the same EntityReference.
@param p pattern to update
@param ctrlLabel label
@return the pattern
"""
if (p == null) p = new Pattern(Conversion.class, "Conversion");
if (ctrlLabel == null) p.add(new Participant(RelType.INPUT), "Conversion", "input PE");
else p.add(new Participant(RelType.INPUT, true), ctrlLabel, "Conversion", "input PE");
p.add(linkToSpecific(), "input PE", "input simple PE");
p.add(peToER(), "input simple PE", "changed generic ER");
p.add(new ConversionSide(ConversionSide.Type.OTHER_SIDE), "input PE", "Conversion", "output PE");
p.add(equal(false), "input PE", "output PE");
p.add(linkToSpecific(), "output PE", "output simple PE");
p.add(peToER(), "output simple PE", "changed generic ER");
p.add(linkedER(false), "changed generic ER", "changed ER");
return p;
} | java | public static Pattern stateChange(Pattern p, String ctrlLabel)
{
if (p == null) p = new Pattern(Conversion.class, "Conversion");
if (ctrlLabel == null) p.add(new Participant(RelType.INPUT), "Conversion", "input PE");
else p.add(new Participant(RelType.INPUT, true), ctrlLabel, "Conversion", "input PE");
p.add(linkToSpecific(), "input PE", "input simple PE");
p.add(peToER(), "input simple PE", "changed generic ER");
p.add(new ConversionSide(ConversionSide.Type.OTHER_SIDE), "input PE", "Conversion", "output PE");
p.add(equal(false), "input PE", "output PE");
p.add(linkToSpecific(), "output PE", "output simple PE");
p.add(peToER(), "output simple PE", "changed generic ER");
p.add(linkedER(false), "changed generic ER", "changed ER");
return p;
} | [
"public",
"static",
"Pattern",
"stateChange",
"(",
"Pattern",
"p",
",",
"String",
"ctrlLabel",
")",
"{",
"if",
"(",
"p",
"==",
"null",
")",
"p",
"=",
"new",
"Pattern",
"(",
"Conversion",
".",
"class",
",",
"\"Conversion\"",
")",
";",
"if",
"(",
"ctrlLa... | Pattern for a Conversion has an input PhysicalEntity and another output PhysicalEntity that
belongs to the same EntityReference.
@param p pattern to update
@param ctrlLabel label
@return the pattern | [
"Pattern",
"for",
"a",
"Conversion",
"has",
"an",
"input",
"PhysicalEntity",
"and",
"another",
"output",
"PhysicalEntity",
"that",
"belongs",
"to",
"the",
"same",
"EntityReference",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L180-L195 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/logging/hpel/LogRecordContext.java | LogRecordContext.addExtension | public static void addExtension(String extensionName, String extensionValue) {
"""
Adds an extension key/value to the context.
@param extensionName
String extensionName key name for the new extension
@param extensionValue
String extensionValue key value for the new extension
@throws IllegalArgumentException
if parameter <code>extensionName</code> or
<code>extensionValue</code> are <code>null</code>
"""
if (extensionName == null || extensionValue == null) {
throw new IllegalArgumentException(
"Neither 'extensionName' nor 'extensionValue' parameter can be null. Extension Name="
+ extensionName
+ " Extension Value="
+ extensionValue);
}
HashMap<String, String> ext = extensions.get();
if (ext == null) {
ext = new HashMap<>();
extensions.set(ext);
}
ext.put(extensionName, extensionValue);
} | java | public static void addExtension(String extensionName, String extensionValue) {
if (extensionName == null || extensionValue == null) {
throw new IllegalArgumentException(
"Neither 'extensionName' nor 'extensionValue' parameter can be null. Extension Name="
+ extensionName
+ " Extension Value="
+ extensionValue);
}
HashMap<String, String> ext = extensions.get();
if (ext == null) {
ext = new HashMap<>();
extensions.set(ext);
}
ext.put(extensionName, extensionValue);
} | [
"public",
"static",
"void",
"addExtension",
"(",
"String",
"extensionName",
",",
"String",
"extensionValue",
")",
"{",
"if",
"(",
"extensionName",
"==",
"null",
"||",
"extensionValue",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"N... | Adds an extension key/value to the context.
@param extensionName
String extensionName key name for the new extension
@param extensionValue
String extensionValue key value for the new extension
@throws IllegalArgumentException
if parameter <code>extensionName</code> or
<code>extensionValue</code> are <code>null</code> | [
"Adds",
"an",
"extension",
"key",
"/",
"value",
"to",
"the",
"context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/logging/hpel/LogRecordContext.java#L192-L206 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java | MatrixFeatures_DSCC.isSameStructure | public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) {
"""
Checks to see if the two matrices have the same shape and same pattern of non-zero elements
@param a Matrix
@param b Matrix
@return true if the structure is the same
"""
if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) {
for (int i = 0; i <= a.numCols; i++) {
if( a.col_idx[i] != b.col_idx[i] )
return false;
}
for (int i = 0; i < a.nz_length; i++) {
if( a.nz_rows[i] != b.nz_rows[i] )
return false;
}
return true;
}
return false;
} | java | public static boolean isSameStructure(DMatrixSparseCSC a , DMatrixSparseCSC b) {
if( a.numRows == b.numRows && a.numCols == b.numCols && a.nz_length == b.nz_length) {
for (int i = 0; i <= a.numCols; i++) {
if( a.col_idx[i] != b.col_idx[i] )
return false;
}
for (int i = 0; i < a.nz_length; i++) {
if( a.nz_rows[i] != b.nz_rows[i] )
return false;
}
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isSameStructure",
"(",
"DMatrixSparseCSC",
"a",
",",
"DMatrixSparseCSC",
"b",
")",
"{",
"if",
"(",
"a",
".",
"numRows",
"==",
"b",
".",
"numRows",
"&&",
"a",
".",
"numCols",
"==",
"b",
".",
"numCols",
"&&",
"a",
".",
"nz... | Checks to see if the two matrices have the same shape and same pattern of non-zero elements
@param a Matrix
@param b Matrix
@return true if the structure is the same | [
"Checks",
"to",
"see",
"if",
"the",
"two",
"matrices",
"have",
"the",
"same",
"shape",
"and",
"same",
"pattern",
"of",
"non",
"-",
"zero",
"elements"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java#L97-L110 |
fuinorg/objects4j | src/main/java/org/fuin/objects4j/ui/TextFieldInfo.java | TextFieldInfo.create | public static TextFieldInfo create(@NotNull final Field field, @NotNull final Locale locale) {
"""
Return the text field information for a given field.
@param field
Field to check for <code>@TextField</code> annotation.
@param locale
Locale to use.
@return Information or <code>null</code>.
"""
final TextField textField = field.getAnnotation(TextField.class);
if (textField == null) {
return null;
}
return new TextFieldInfo(field, textField.width());
} | java | public static TextFieldInfo create(@NotNull final Field field, @NotNull final Locale locale) {
final TextField textField = field.getAnnotation(TextField.class);
if (textField == null) {
return null;
}
return new TextFieldInfo(field, textField.width());
} | [
"public",
"static",
"TextFieldInfo",
"create",
"(",
"@",
"NotNull",
"final",
"Field",
"field",
",",
"@",
"NotNull",
"final",
"Locale",
"locale",
")",
"{",
"final",
"TextField",
"textField",
"=",
"field",
".",
"getAnnotation",
"(",
"TextField",
".",
"class",
... | Return the text field information for a given field.
@param field
Field to check for <code>@TextField</code> annotation.
@param locale
Locale to use.
@return Information or <code>null</code>. | [
"Return",
"the",
"text",
"field",
"information",
"for",
"a",
"given",
"field",
"."
] | train | https://github.com/fuinorg/objects4j/blob/e7f278b5bae073ebb6a76053650571c718f36246/src/main/java/org/fuin/objects4j/ui/TextFieldInfo.java#L107-L115 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java | XHTMLManager.setServiceEnabled | public static synchronized void setServiceEnabled(XMPPConnection connection, boolean enabled) {
"""
Enables or disables the XHTML support on a given connection.<p>
Before starting to send XHTML messages to a user, check that the user can handle XHTML
messages. Enable the XHTML support to indicate that this client handles XHTML messages.
@param connection the connection where the service will be enabled or disabled
@param enabled indicates if the service will be enabled or disabled
"""
if (isServiceEnabled(connection) == enabled)
return;
if (enabled) {
ServiceDiscoveryManager.getInstanceFor(connection).addFeature(XHTMLExtension.NAMESPACE);
}
else {
ServiceDiscoveryManager.getInstanceFor(connection).removeFeature(XHTMLExtension.NAMESPACE);
}
} | java | public static synchronized void setServiceEnabled(XMPPConnection connection, boolean enabled) {
if (isServiceEnabled(connection) == enabled)
return;
if (enabled) {
ServiceDiscoveryManager.getInstanceFor(connection).addFeature(XHTMLExtension.NAMESPACE);
}
else {
ServiceDiscoveryManager.getInstanceFor(connection).removeFeature(XHTMLExtension.NAMESPACE);
}
} | [
"public",
"static",
"synchronized",
"void",
"setServiceEnabled",
"(",
"XMPPConnection",
"connection",
",",
"boolean",
"enabled",
")",
"{",
"if",
"(",
"isServiceEnabled",
"(",
"connection",
")",
"==",
"enabled",
")",
"return",
";",
"if",
"(",
"enabled",
")",
"{... | Enables or disables the XHTML support on a given connection.<p>
Before starting to send XHTML messages to a user, check that the user can handle XHTML
messages. Enable the XHTML support to indicate that this client handles XHTML messages.
@param connection the connection where the service will be enabled or disabled
@param enabled indicates if the service will be enabled or disabled | [
"Enables",
"or",
"disables",
"the",
"XHTML",
"support",
"on",
"a",
"given",
"connection",
".",
"<p",
">"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java#L104-L114 |
opentelecoms-org/zrtp-java | src/zorg/platform/android/AndroidCryptoUtils.java | AndroidCryptoUtils.aesDecrypt | @Override
public byte[] aesDecrypt(byte[] data, int offset, int length, byte[] key,
byte[] initVector) throws CryptoException {
"""
/* (non-Javadoc)
@see zorg.platform.CryptoUtils#aesDecrypt(byte[], int, int, byte[], byte[])
"""
try {
SecretKeySpec scs = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding", "ZBC");
IvParameterSpec iv = new IvParameterSpec(initVector);
ByteArrayOutputStream baos = new ByteArrayOutputStream(length);
cipher.init(Cipher.DECRYPT_MODE, scs, iv);
CipherOutputStream out = new CipherOutputStream(baos, cipher);
out.write(data, offset, length);
out.close();
baos.close();
return baos.toByteArray();
} catch (Exception e) {
throw new CryptoException(e);
}
} | java | @Override
public byte[] aesDecrypt(byte[] data, int offset, int length, byte[] key,
byte[] initVector) throws CryptoException {
try {
SecretKeySpec scs = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES/CFB/NoPadding", "ZBC");
IvParameterSpec iv = new IvParameterSpec(initVector);
ByteArrayOutputStream baos = new ByteArrayOutputStream(length);
cipher.init(Cipher.DECRYPT_MODE, scs, iv);
CipherOutputStream out = new CipherOutputStream(baos, cipher);
out.write(data, offset, length);
out.close();
baos.close();
return baos.toByteArray();
} catch (Exception e) {
throw new CryptoException(e);
}
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"aesDecrypt",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"byte",
"[",
"]",
"key",
",",
"byte",
"[",
"]",
"initVector",
")",
"throws",
"CryptoException",
"{",
"try",
"{"... | /* (non-Javadoc)
@see zorg.platform.CryptoUtils#aesDecrypt(byte[], int, int, byte[], byte[]) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/android/AndroidCryptoUtils.java#L48-L65 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/utils/TextUtils.java | TextUtils.splitUnescape | public static String[] splitUnescape(String input, char separator, char echar, char[] special) {
"""
Split the input on the given separator char, and unescape each portion using the escape char and special chars
@param input input string
@param separator char separating each component
@param echar escape char
@param special chars that are escaped
@return results
"""
return splitUnescape(input, new char[]{separator}, echar, special);
} | java | public static String[] splitUnescape(String input, char separator, char echar, char[] special) {
return splitUnescape(input, new char[]{separator}, echar, special);
} | [
"public",
"static",
"String",
"[",
"]",
"splitUnescape",
"(",
"String",
"input",
",",
"char",
"separator",
",",
"char",
"echar",
",",
"char",
"[",
"]",
"special",
")",
"{",
"return",
"splitUnescape",
"(",
"input",
",",
"new",
"char",
"[",
"]",
"{",
"se... | Split the input on the given separator char, and unescape each portion using the escape char and special chars
@param input input string
@param separator char separating each component
@param echar escape char
@param special chars that are escaped
@return results | [
"Split",
"the",
"input",
"on",
"the",
"given",
"separator",
"char",
"and",
"unescape",
"each",
"portion",
"using",
"the",
"escape",
"char",
"and",
"special",
"chars"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/TextUtils.java#L218-L220 |
alkacon/opencms-core | src/org/opencms/gwt/CmsAliasHelper.java | CmsAliasHelper.saveAliases | public void saveAliases(CmsUUID structureId, List<CmsAliasBean> aliasBeans) throws CmsException {
"""
Saves aliases.<p>
@param structureId the structure id
@param aliasBeans the alias beans
@throws CmsException if something goes wrong
"""
CmsAliasManager aliasManager = OpenCms.getAliasManager();
CmsObject cms = m_cms;
List<CmsAlias> aliases = new ArrayList<CmsAlias>();
for (CmsAliasBean aliasBean : aliasBeans) {
CmsAlias alias = new CmsAlias(
structureId,
cms.getRequestContext().getSiteRoot(),
aliasBean.getSitePath(),
aliasBean.getMode());
aliases.add(alias);
}
aliasManager.saveAliases(cms, structureId, aliases);
} | java | public void saveAliases(CmsUUID structureId, List<CmsAliasBean> aliasBeans) throws CmsException {
CmsAliasManager aliasManager = OpenCms.getAliasManager();
CmsObject cms = m_cms;
List<CmsAlias> aliases = new ArrayList<CmsAlias>();
for (CmsAliasBean aliasBean : aliasBeans) {
CmsAlias alias = new CmsAlias(
structureId,
cms.getRequestContext().getSiteRoot(),
aliasBean.getSitePath(),
aliasBean.getMode());
aliases.add(alias);
}
aliasManager.saveAliases(cms, structureId, aliases);
} | [
"public",
"void",
"saveAliases",
"(",
"CmsUUID",
"structureId",
",",
"List",
"<",
"CmsAliasBean",
">",
"aliasBeans",
")",
"throws",
"CmsException",
"{",
"CmsAliasManager",
"aliasManager",
"=",
"OpenCms",
".",
"getAliasManager",
"(",
")",
";",
"CmsObject",
"cms",
... | Saves aliases.<p>
@param structureId the structure id
@param aliasBeans the alias beans
@throws CmsException if something goes wrong | [
"Saves",
"aliases",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsAliasHelper.java#L120-L134 |
google/closure-templates | java/src/com/google/template/soy/sharedpasses/render/EvalVisitor.java | EvalVisitor.maybeMarkBadProtoAccess | private static void maybeMarkBadProtoAccess(ExprNode expr, SoyValue value) {
"""
If the value is a proto, then set the current access location since we are about to access it
incorrectly.
"""
if (value instanceof SoyProtoValue) {
((SoyProtoValue) value).setAccessLocationKey(expr.getSourceLocation());
}
} | java | private static void maybeMarkBadProtoAccess(ExprNode expr, SoyValue value) {
if (value instanceof SoyProtoValue) {
((SoyProtoValue) value).setAccessLocationKey(expr.getSourceLocation());
}
} | [
"private",
"static",
"void",
"maybeMarkBadProtoAccess",
"(",
"ExprNode",
"expr",
",",
"SoyValue",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"SoyProtoValue",
")",
"{",
"(",
"(",
"SoyProtoValue",
")",
"value",
")",
".",
"setAccessLocationKey",
"(",
"e... | If the value is a proto, then set the current access location since we are about to access it
incorrectly. | [
"If",
"the",
"value",
"is",
"a",
"proto",
"then",
"set",
"the",
"current",
"access",
"location",
"since",
"we",
"are",
"about",
"to",
"access",
"it",
"incorrectly",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/EvalVisitor.java#L481-L485 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notEmpty | public static String notEmpty(String text, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
"""
检查给定字符串是否为空,为空抛出 {@link IllegalArgumentException}
<pre class="code">
Assert.notEmpty(name, "Name must not be empty");
</pre>
@param text 被检查字符串
@param errorMsgTemplate 错误消息模板,变量使用{}表示
@param params 参数
@return 非空字符串
@see StrUtil#isNotEmpty(CharSequence)
@throws IllegalArgumentException 被检查字符串为空
"""
if (StrUtil.isEmpty(text)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return text;
} | java | public static String notEmpty(String text, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (StrUtil.isEmpty(text)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return text;
} | [
"public",
"static",
"String",
"notEmpty",
"(",
"String",
"text",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"text",
")",
")",
"{",
"throw",
"ne... | 检查给定字符串是否为空,为空抛出 {@link IllegalArgumentException}
<pre class="code">
Assert.notEmpty(name, "Name must not be empty");
</pre>
@param text 被检查字符串
@param errorMsgTemplate 错误消息模板,变量使用{}表示
@param params 参数
@return 非空字符串
@see StrUtil#isNotEmpty(CharSequence)
@throws IllegalArgumentException 被检查字符串为空 | [
"检查给定字符串是否为空,为空抛出",
"{",
"@link",
"IllegalArgumentException",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L168-L173 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java | InnerMetricContext.getTimers | @Override
public SortedMap<String, Timer> getTimers(MetricFilter filter) {
"""
See {@link com.codahale.metrics.MetricRegistry#getTimers(com.codahale.metrics.MetricFilter)}.
<p>
This method will return fully-qualified metric names if the {@link MetricContext} is configured
to report fully-qualified metric names.
</p>
"""
return getSimplyNamedMetrics(Timer.class, Optional.of(filter));
} | java | @Override
public SortedMap<String, Timer> getTimers(MetricFilter filter) {
return getSimplyNamedMetrics(Timer.class, Optional.of(filter));
} | [
"@",
"Override",
"public",
"SortedMap",
"<",
"String",
",",
"Timer",
">",
"getTimers",
"(",
"MetricFilter",
"filter",
")",
"{",
"return",
"getSimplyNamedMetrics",
"(",
"Timer",
".",
"class",
",",
"Optional",
".",
"of",
"(",
"filter",
")",
")",
";",
"}"
] | See {@link com.codahale.metrics.MetricRegistry#getTimers(com.codahale.metrics.MetricFilter)}.
<p>
This method will return fully-qualified metric names if the {@link MetricContext} is configured
to report fully-qualified metric names.
</p> | [
"See",
"{",
"@link",
"com",
".",
"codahale",
".",
"metrics",
".",
"MetricRegistry#getTimers",
"(",
"com",
".",
"codahale",
".",
"metrics",
".",
"MetricFilter",
")",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java#L242-L245 |
StripesFramework/stripes-stuff | src/main/java/org/stripesstuff/plugin/waitpage/WaitPageInterceptor.java | WaitPageInterceptor.copyFlashScope | protected void copyFlashScope(FlashScope source, FlashScope destination) {
"""
Copy source flash scope content (including messages) from to destination flash scope.
@param source flash scope to copy
@param destination where source flash scope content will be copied
"""
for (Map.Entry<String,Object> entry: source.entrySet()) {
destination.put(entry.getKey(), entry.getValue());
}
} | java | protected void copyFlashScope(FlashScope source, FlashScope destination) {
for (Map.Entry<String,Object> entry: source.entrySet()) {
destination.put(entry.getKey(), entry.getValue());
}
} | [
"protected",
"void",
"copyFlashScope",
"(",
"FlashScope",
"source",
",",
"FlashScope",
"destination",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"source",
".",
"entrySet",
"(",
")",
")",
"{",
"destination",
... | Copy source flash scope content (including messages) from to destination flash scope.
@param source flash scope to copy
@param destination where source flash scope content will be copied | [
"Copy",
"source",
"flash",
"scope",
"content",
"(",
"including",
"messages",
")",
"from",
"to",
"destination",
"flash",
"scope",
"."
] | train | https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/waitpage/WaitPageInterceptor.java#L358-L362 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_spla_id_PUT | public void serviceName_spla_id_PUT(String serviceName, Long id, OvhSpla body) throws IOException {
"""
Alter this object properties
REST: PUT /dedicated/server/{serviceName}/spla/{id}
@param body [required] New object properties
@param serviceName [required] The internal name of your dedicated server
@param id [required] License id
"""
String qPath = "/dedicated/server/{serviceName}/spla/{id}";
StringBuilder sb = path(qPath, serviceName, id);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_spla_id_PUT(String serviceName, Long id, OvhSpla body) throws IOException {
String qPath = "/dedicated/server/{serviceName}/spla/{id}";
StringBuilder sb = path(qPath, serviceName, id);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_spla_id_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"id",
",",
"OvhSpla",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/spla/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
... | Alter this object properties
REST: PUT /dedicated/server/{serviceName}/spla/{id}
@param body [required] New object properties
@param serviceName [required] The internal name of your dedicated server
@param id [required] License id | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L679-L683 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java | OpenPgpManager.announceSupportAndPublish | public void announceSupportAndPublish()
throws NoSuchAlgorithmException, NoSuchProviderException, InterruptedException,
PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, SmackException.NoResponseException, IOException,
InvalidAlgorithmParameterException, SmackException.NotLoggedInException, PGPException {
"""
Generate a fresh OpenPGP key pair, given we don't have one already.
Publish the public key to the Public Key Node and update the Public Key Metadata Node with our keys fingerprint.
Lastly register a {@link PepListener} which listens for updates to Public Key Metadata Nodes.
@throws NoSuchAlgorithmException if we are missing an algorithm to generate a fresh key pair.
@throws NoSuchProviderException if we are missing a suitable {@link java.security.Provider}.
@throws InterruptedException if the thread gets interrupted.
@throws PubSubException.NotALeafNodeException if one of the PubSub nodes is not a {@link LeafNode}.
@throws XMPPException.XMPPErrorException in case of an XMPP protocol error.
@throws SmackException.NotConnectedException if we are not connected.
@throws SmackException.NoResponseException if the server doesn't respond.
@throws IOException IO is dangerous.
@throws InvalidAlgorithmParameterException if illegal algorithm parameters are used for key generation.
@throws SmackException.NotLoggedInException if we are not logged in.
@throws PGPException if something goes wrong during key loading/generating
"""
throwIfNoProviderSet();
throwIfNotAuthenticated();
OpenPgpV4Fingerprint primaryFingerprint = getOurFingerprint();
if (primaryFingerprint == null) {
primaryFingerprint = generateAndImportKeyPair(getJidOrThrow());
}
// Create <pubkey/> element
PubkeyElement pubkeyElement;
try {
pubkeyElement = createPubkeyElement(getJidOrThrow(), primaryFingerprint, new Date());
} catch (MissingOpenPgpKeyException e) {
throw new AssertionError("Cannot publish our public key, since it is missing (MUST NOT happen!)");
}
// publish it
publishPublicKey(pepManager, pubkeyElement, primaryFingerprint);
// Subscribe to public key changes
PepManager.getInstanceFor(connection()).addPepListener(metadataListener);
ServiceDiscoveryManager.getInstanceFor(connection())
.addFeature(PEP_NODE_PUBLIC_KEYS_NOTIFY);
} | java | public void announceSupportAndPublish()
throws NoSuchAlgorithmException, NoSuchProviderException, InterruptedException,
PubSubException.NotALeafNodeException, XMPPException.XMPPErrorException,
SmackException.NotConnectedException, SmackException.NoResponseException, IOException,
InvalidAlgorithmParameterException, SmackException.NotLoggedInException, PGPException {
throwIfNoProviderSet();
throwIfNotAuthenticated();
OpenPgpV4Fingerprint primaryFingerprint = getOurFingerprint();
if (primaryFingerprint == null) {
primaryFingerprint = generateAndImportKeyPair(getJidOrThrow());
}
// Create <pubkey/> element
PubkeyElement pubkeyElement;
try {
pubkeyElement = createPubkeyElement(getJidOrThrow(), primaryFingerprint, new Date());
} catch (MissingOpenPgpKeyException e) {
throw new AssertionError("Cannot publish our public key, since it is missing (MUST NOT happen!)");
}
// publish it
publishPublicKey(pepManager, pubkeyElement, primaryFingerprint);
// Subscribe to public key changes
PepManager.getInstanceFor(connection()).addPepListener(metadataListener);
ServiceDiscoveryManager.getInstanceFor(connection())
.addFeature(PEP_NODE_PUBLIC_KEYS_NOTIFY);
} | [
"public",
"void",
"announceSupportAndPublish",
"(",
")",
"throws",
"NoSuchAlgorithmException",
",",
"NoSuchProviderException",
",",
"InterruptedException",
",",
"PubSubException",
".",
"NotALeafNodeException",
",",
"XMPPException",
".",
"XMPPErrorException",
",",
"SmackExcept... | Generate a fresh OpenPGP key pair, given we don't have one already.
Publish the public key to the Public Key Node and update the Public Key Metadata Node with our keys fingerprint.
Lastly register a {@link PepListener} which listens for updates to Public Key Metadata Nodes.
@throws NoSuchAlgorithmException if we are missing an algorithm to generate a fresh key pair.
@throws NoSuchProviderException if we are missing a suitable {@link java.security.Provider}.
@throws InterruptedException if the thread gets interrupted.
@throws PubSubException.NotALeafNodeException if one of the PubSub nodes is not a {@link LeafNode}.
@throws XMPPException.XMPPErrorException in case of an XMPP protocol error.
@throws SmackException.NotConnectedException if we are not connected.
@throws SmackException.NoResponseException if the server doesn't respond.
@throws IOException IO is dangerous.
@throws InvalidAlgorithmParameterException if illegal algorithm parameters are used for key generation.
@throws SmackException.NotLoggedInException if we are not logged in.
@throws PGPException if something goes wrong during key loading/generating | [
"Generate",
"a",
"fresh",
"OpenPGP",
"key",
"pair",
"given",
"we",
"don",
"t",
"have",
"one",
"already",
".",
"Publish",
"the",
"public",
"key",
"to",
"the",
"Public",
"Key",
"Node",
"and",
"update",
"the",
"Public",
"Key",
"Metadata",
"Node",
"with",
"o... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpManager.java#L255-L284 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java | BatchUpdateDaemon.pushExternalCacheFragment | public synchronized void pushExternalCacheFragment(ExternalInvalidation externalCacheFragment, DCache cache) {
"""
This allows an external cache fragment to be added to the
BatchUpdateDaemon.
@param cacheEntry The external cache fragment to be added.
"""
BatchUpdateList bul = getUpdateList(cache);
bul.pushECFEvents.add(externalCacheFragment);
} | java | public synchronized void pushExternalCacheFragment(ExternalInvalidation externalCacheFragment, DCache cache) {
BatchUpdateList bul = getUpdateList(cache);
bul.pushECFEvents.add(externalCacheFragment);
} | [
"public",
"synchronized",
"void",
"pushExternalCacheFragment",
"(",
"ExternalInvalidation",
"externalCacheFragment",
",",
"DCache",
"cache",
")",
"{",
"BatchUpdateList",
"bul",
"=",
"getUpdateList",
"(",
"cache",
")",
";",
"bul",
".",
"pushECFEvents",
".",
"add",
"(... | This allows an external cache fragment to be added to the
BatchUpdateDaemon.
@param cacheEntry The external cache fragment to be added. | [
"This",
"allows",
"an",
"external",
"cache",
"fragment",
"to",
"be",
"added",
"to",
"the",
"BatchUpdateDaemon",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java#L202-L205 |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java | IgnoredNonAffectedServerGroupsUtil.addCurrentServerGroupsToHostInfoModel | public static ModelNode addCurrentServerGroupsToHostInfoModel(boolean ignoreUnaffectedServerGroups, Resource hostModel, ModelNode model) {
"""
Used by the slave host when creating the host info dmr sent across to the DC during the registration process
@param ignoreUnaffectedServerGroups whether the slave host is set up to ignore config for server groups it does not have servers for
@param hostModel the resource containing the host model
@param model the dmr sent across to theDC
@return the modified dmr
"""
if (!ignoreUnaffectedServerGroups) {
return model;
}
model.get(IGNORE_UNUSED_CONFIG).set(ignoreUnaffectedServerGroups);
addServerGroupsToModel(hostModel, model);
return model;
} | java | public static ModelNode addCurrentServerGroupsToHostInfoModel(boolean ignoreUnaffectedServerGroups, Resource hostModel, ModelNode model) {
if (!ignoreUnaffectedServerGroups) {
return model;
}
model.get(IGNORE_UNUSED_CONFIG).set(ignoreUnaffectedServerGroups);
addServerGroupsToModel(hostModel, model);
return model;
} | [
"public",
"static",
"ModelNode",
"addCurrentServerGroupsToHostInfoModel",
"(",
"boolean",
"ignoreUnaffectedServerGroups",
",",
"Resource",
"hostModel",
",",
"ModelNode",
"model",
")",
"{",
"if",
"(",
"!",
"ignoreUnaffectedServerGroups",
")",
"{",
"return",
"model",
";",... | Used by the slave host when creating the host info dmr sent across to the DC during the registration process
@param ignoreUnaffectedServerGroups whether the slave host is set up to ignore config for server groups it does not have servers for
@param hostModel the resource containing the host model
@param model the dmr sent across to theDC
@return the modified dmr | [
"Used",
"by",
"the",
"slave",
"host",
"when",
"creating",
"the",
"host",
"info",
"dmr",
"sent",
"across",
"to",
"the",
"DC",
"during",
"the",
"registration",
"process"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java#L84-L91 |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/payload/MySQLPacketPayload.java | MySQLPacketPayload.readStringNulByBytes | public byte[] readStringNulByBytes() {
"""
Read null terminated string from byte buffers and return bytes.
@see <a href="https://dev.mysql.com/doc/internals/en/string.html#packet-Protocol::NulTerminatedString">NulTerminatedString</a>
@return null terminated bytes
"""
byte[] result = new byte[byteBuf.bytesBefore((byte) 0)];
byteBuf.readBytes(result);
byteBuf.skipBytes(1);
return result;
} | java | public byte[] readStringNulByBytes() {
byte[] result = new byte[byteBuf.bytesBefore((byte) 0)];
byteBuf.readBytes(result);
byteBuf.skipBytes(1);
return result;
} | [
"public",
"byte",
"[",
"]",
"readStringNulByBytes",
"(",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"byteBuf",
".",
"bytesBefore",
"(",
"(",
"byte",
")",
"0",
")",
"]",
";",
"byteBuf",
".",
"readBytes",
"(",
"result",
")",
";",
... | Read null terminated string from byte buffers and return bytes.
@see <a href="https://dev.mysql.com/doc/internals/en/string.html#packet-Protocol::NulTerminatedString">NulTerminatedString</a>
@return null terminated bytes | [
"Read",
"null",
"terminated",
"string",
"from",
"byte",
"buffers",
"and",
"return",
"bytes",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/payload/MySQLPacketPayload.java#L380-L385 |
rubenlagus/TelegramBots | telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java | BaseAbilityBot.getUser | protected User getUser(String username) {
"""
Gets the user with the specified username.
@param username the username of the required user
@return the user
"""
Integer id = userIds().get(username.toLowerCase());
if (id == null) {
throw new IllegalStateException(format("Could not find ID corresponding to username [%s]", username));
}
return getUser(id);
} | java | protected User getUser(String username) {
Integer id = userIds().get(username.toLowerCase());
if (id == null) {
throw new IllegalStateException(format("Could not find ID corresponding to username [%s]", username));
}
return getUser(id);
} | [
"protected",
"User",
"getUser",
"(",
"String",
"username",
")",
"{",
"Integer",
"id",
"=",
"userIds",
"(",
")",
".",
"get",
"(",
"username",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStat... | Gets the user with the specified username.
@param username the username of the required user
@return the user | [
"Gets",
"the",
"user",
"with",
"the",
"specified",
"username",
"."
] | train | https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java#L248-L255 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/table/GenericTableModel.java | GenericTableModel.insertRow | public void insertRow(int index, Object element) {
"""
Add the given element as one row of the table
@param index The row index
@param element The element
"""
elements.add(index, element);
fireTableRowsInserted(index, index);
} | java | public void insertRow(int index, Object element)
{
elements.add(index, element);
fireTableRowsInserted(index, index);
} | [
"public",
"void",
"insertRow",
"(",
"int",
"index",
",",
"Object",
"element",
")",
"{",
"elements",
".",
"add",
"(",
"index",
",",
"element",
")",
";",
"fireTableRowsInserted",
"(",
"index",
",",
"index",
")",
";",
"}"
] | Add the given element as one row of the table
@param index The row index
@param element The element | [
"Add",
"the",
"given",
"element",
"as",
"one",
"row",
"of",
"the",
"table"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/GenericTableModel.java#L203-L207 |
bazaarvoice/jersey-hmac-auth | common/src/main/java/com/bazaarvoice/auth/hmac/server/AbstractAuthenticator.java | AbstractAuthenticator.validateTimestamp | private boolean validateTimestamp(String timestamp) {
"""
To protect against replay attacks, make sure the timestamp on the request is valid
by ensuring that the difference between the request time and the current time on the
server does not fall outside the acceptable time range. Note that the request time
may have been generated on a different machine and so it may be ahead or behind the
current server time.
@param timestamp the timestamp specified on the request (in standard ISO8601 format)
@return true if the timestamp is valid
"""
DateTime requestTime = TimeUtils.parse(timestamp);
long difference = Math.abs(new Duration(requestTime, nowInUTC()).getMillis());
return difference <= allowedTimestampRange;
} | java | private boolean validateTimestamp(String timestamp) {
DateTime requestTime = TimeUtils.parse(timestamp);
long difference = Math.abs(new Duration(requestTime, nowInUTC()).getMillis());
return difference <= allowedTimestampRange;
} | [
"private",
"boolean",
"validateTimestamp",
"(",
"String",
"timestamp",
")",
"{",
"DateTime",
"requestTime",
"=",
"TimeUtils",
".",
"parse",
"(",
"timestamp",
")",
";",
"long",
"difference",
"=",
"Math",
".",
"abs",
"(",
"new",
"Duration",
"(",
"requestTime",
... | To protect against replay attacks, make sure the timestamp on the request is valid
by ensuring that the difference between the request time and the current time on the
server does not fall outside the acceptable time range. Note that the request time
may have been generated on a different machine and so it may be ahead or behind the
current server time.
@param timestamp the timestamp specified on the request (in standard ISO8601 format)
@return true if the timestamp is valid | [
"To",
"protect",
"against",
"replay",
"attacks",
"make",
"sure",
"the",
"timestamp",
"on",
"the",
"request",
"is",
"valid",
"by",
"ensuring",
"that",
"the",
"difference",
"between",
"the",
"request",
"time",
"and",
"the",
"current",
"time",
"on",
"the",
"ser... | train | https://github.com/bazaarvoice/jersey-hmac-auth/blob/17e2a40a4b7b783de4d77ad97f8a623af6baf688/common/src/main/java/com/bazaarvoice/auth/hmac/server/AbstractAuthenticator.java#L101-L105 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java | ParsedScheduleExpression.advanceYear | private boolean advanceYear(Calendar cal, int year) {
"""
Moves the value of the year field forward in time to satisfy the year
constraint.
@param year the current year
@return <tt>true</tt> if a higher year was found
"""
year = years.nextSetBit(year + 1 - ScheduleExpressionParser.MINIMUM_YEAR); // d665298
if (year >= 0)
{
cal.set(Calendar.YEAR, year + ScheduleExpressionParser.MINIMUM_YEAR); // d665298
return true;
}
return false;
} | java | private boolean advanceYear(Calendar cal, int year)
{
year = years.nextSetBit(year + 1 - ScheduleExpressionParser.MINIMUM_YEAR); // d665298
if (year >= 0)
{
cal.set(Calendar.YEAR, year + ScheduleExpressionParser.MINIMUM_YEAR); // d665298
return true;
}
return false;
} | [
"private",
"boolean",
"advanceYear",
"(",
"Calendar",
"cal",
",",
"int",
"year",
")",
"{",
"year",
"=",
"years",
".",
"nextSetBit",
"(",
"year",
"+",
"1",
"-",
"ScheduleExpressionParser",
".",
"MINIMUM_YEAR",
")",
";",
"// d665298",
"if",
"(",
"year",
">="... | Moves the value of the year field forward in time to satisfy the year
constraint.
@param year the current year
@return <tt>true</tt> if a higher year was found | [
"Moves",
"the",
"value",
"of",
"the",
"year",
"field",
"forward",
"in",
"time",
"to",
"satisfy",
"the",
"year",
"constraint",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java#L1082-L1092 |
att/AAF | cadi/aaf/src/main/java/com/att/cadi/aaf/client/ErrMessage.java | ErrMessage.printErr | public void printErr(PrintStream ps, String attErrJson) throws APIException {
"""
AT&T Requires a specific Error Format for RESTful Services, which AAF complies with.
This code will create a meaningful string from this format.
@param ps
@param df
@param r
@throws APIException
"""
StringBuilder sb = new StringBuilder();
Error err = errDF.newData().in(TYPE.JSON).load(attErrJson).asObject();
ps.println(toMsg(sb,err));
} | java | public void printErr(PrintStream ps, String attErrJson) throws APIException {
StringBuilder sb = new StringBuilder();
Error err = errDF.newData().in(TYPE.JSON).load(attErrJson).asObject();
ps.println(toMsg(sb,err));
} | [
"public",
"void",
"printErr",
"(",
"PrintStream",
"ps",
",",
"String",
"attErrJson",
")",
"throws",
"APIException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Error",
"err",
"=",
"errDF",
".",
"newData",
"(",
")",
".",
"in",
... | AT&T Requires a specific Error Format for RESTful Services, which AAF complies with.
This code will create a meaningful string from this format.
@param ps
@param df
@param r
@throws APIException | [
"AT&T",
"Requires",
"a",
"specific",
"Error",
"Format",
"for",
"RESTful",
"Services",
"which",
"AAF",
"complies",
"with",
"."
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/aaf/src/main/java/com/att/cadi/aaf/client/ErrMessage.java#L34-L38 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/inventory/message/OpenInventoryMessage.java | OpenInventoryMessage.process | @Override
public void process(Packet message, MessageContext ctx) {
"""
Handles the received {@link Packet} on the client.<br>
Opens the GUI for the {@link MalisisInventory}
@param message the message
@param ctx the ctx
"""
EntityPlayerSP player = (EntityPlayerSP) Utils.getClientPlayer();
if (message.type == ContainerType.TYPE_TILEENTITY)
{
IDirectInventoryProvider inventoryProvider = TileEntityUtils.getTileEntity( IDirectInventoryProvider.class,
Utils.getClientWorld(),
message.pos);
if (inventoryProvider != null)
MalisisInventory.open(player, inventoryProvider, message.windowId);
}
else if (message.type == ContainerType.TYPE_ITEM)
{
//TODO: send and use slot number instead of limited to equipped
ItemStack itemStack = player.getHeldItemMainhand();
if (itemStack == null || !(itemStack.getItem() instanceof IDeferredInventoryProvider<?>))
return;
@SuppressWarnings("unchecked")
IDeferredInventoryProvider<ItemStack> inventoryProvider = (IDeferredInventoryProvider<ItemStack>) itemStack.getItem();
MalisisInventory.open(player, inventoryProvider, itemStack, message.windowId);
}
} | java | @Override
public void process(Packet message, MessageContext ctx)
{
EntityPlayerSP player = (EntityPlayerSP) Utils.getClientPlayer();
if (message.type == ContainerType.TYPE_TILEENTITY)
{
IDirectInventoryProvider inventoryProvider = TileEntityUtils.getTileEntity( IDirectInventoryProvider.class,
Utils.getClientWorld(),
message.pos);
if (inventoryProvider != null)
MalisisInventory.open(player, inventoryProvider, message.windowId);
}
else if (message.type == ContainerType.TYPE_ITEM)
{
//TODO: send and use slot number instead of limited to equipped
ItemStack itemStack = player.getHeldItemMainhand();
if (itemStack == null || !(itemStack.getItem() instanceof IDeferredInventoryProvider<?>))
return;
@SuppressWarnings("unchecked")
IDeferredInventoryProvider<ItemStack> inventoryProvider = (IDeferredInventoryProvider<ItemStack>) itemStack.getItem();
MalisisInventory.open(player, inventoryProvider, itemStack, message.windowId);
}
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"Packet",
"message",
",",
"MessageContext",
"ctx",
")",
"{",
"EntityPlayerSP",
"player",
"=",
"(",
"EntityPlayerSP",
")",
"Utils",
".",
"getClientPlayer",
"(",
")",
";",
"if",
"(",
"message",
".",
"type",
... | Handles the received {@link Packet} on the client.<br>
Opens the GUI for the {@link MalisisInventory}
@param message the message
@param ctx the ctx | [
"Handles",
"the",
"received",
"{",
"@link",
"Packet",
"}",
"on",
"the",
"client",
".",
"<br",
">",
"Opens",
"the",
"GUI",
"for",
"the",
"{",
"@link",
"MalisisInventory",
"}"
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/inventory/message/OpenInventoryMessage.java#L74-L98 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_mitigationProfiles_ipMitigationProfile_DELETE | public void ip_mitigationProfiles_ipMitigationProfile_DELETE(String ip, String ipMitigationProfile) throws IOException {
"""
Delete mitigation profile
REST: DELETE /ip/{ip}/mitigationProfiles/{ipMitigationProfile}
@param ip [required]
@param ipMitigationProfile [required]
"""
String qPath = "/ip/{ip}/mitigationProfiles/{ipMitigationProfile}";
StringBuilder sb = path(qPath, ip, ipMitigationProfile);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void ip_mitigationProfiles_ipMitigationProfile_DELETE(String ip, String ipMitigationProfile) throws IOException {
String qPath = "/ip/{ip}/mitigationProfiles/{ipMitigationProfile}";
StringBuilder sb = path(qPath, ip, ipMitigationProfile);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"ip_mitigationProfiles_ipMitigationProfile_DELETE",
"(",
"String",
"ip",
",",
"String",
"ipMitigationProfile",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/mitigationProfiles/{ipMitigationProfile}\"",
";",
"StringBuilder",
"sb",
"="... | Delete mitigation profile
REST: DELETE /ip/{ip}/mitigationProfiles/{ipMitigationProfile}
@param ip [required]
@param ipMitigationProfile [required] | [
"Delete",
"mitigation",
"profile"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L928-L932 |
apache/incubator-druid | server/src/main/java/org/apache/druid/initialization/Initialization.java | Initialization.getHadoopDependencyFilesToLoad | public static File[] getHadoopDependencyFilesToLoad(
List<String> hadoopDependencyCoordinates,
ExtensionsConfig extensionsConfig
) {
"""
Find all the hadoop dependencies that should be loaded by druid
@param hadoopDependencyCoordinates e.g.["org.apache.hadoop:hadoop-client:2.3.0"]
@param extensionsConfig ExtensionsConfig configured by druid.extensions.xxx
@return an array of hadoop dependency files that will be loaded by druid process
"""
final File rootHadoopDependenciesDir = new File(extensionsConfig.getHadoopDependenciesDir());
if (rootHadoopDependenciesDir.exists() && !rootHadoopDependenciesDir.isDirectory()) {
throw new ISE("Root Hadoop dependencies directory [%s] is not a directory!?", rootHadoopDependenciesDir);
}
final File[] hadoopDependenciesToLoad = new File[hadoopDependencyCoordinates.size()];
int i = 0;
for (final String coordinate : hadoopDependencyCoordinates) {
final DefaultArtifact artifact = new DefaultArtifact(coordinate);
final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId());
final File versionDir = new File(hadoopDependencyDir, artifact.getVersion());
// find the hadoop dependency with the version specified in coordinate
if (!hadoopDependencyDir.isDirectory() || !versionDir.isDirectory()) {
throw new ISE("Hadoop dependency [%s] didn't exist!?", versionDir.getAbsolutePath());
}
hadoopDependenciesToLoad[i++] = versionDir;
}
return hadoopDependenciesToLoad;
} | java | public static File[] getHadoopDependencyFilesToLoad(
List<String> hadoopDependencyCoordinates,
ExtensionsConfig extensionsConfig
)
{
final File rootHadoopDependenciesDir = new File(extensionsConfig.getHadoopDependenciesDir());
if (rootHadoopDependenciesDir.exists() && !rootHadoopDependenciesDir.isDirectory()) {
throw new ISE("Root Hadoop dependencies directory [%s] is not a directory!?", rootHadoopDependenciesDir);
}
final File[] hadoopDependenciesToLoad = new File[hadoopDependencyCoordinates.size()];
int i = 0;
for (final String coordinate : hadoopDependencyCoordinates) {
final DefaultArtifact artifact = new DefaultArtifact(coordinate);
final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId());
final File versionDir = new File(hadoopDependencyDir, artifact.getVersion());
// find the hadoop dependency with the version specified in coordinate
if (!hadoopDependencyDir.isDirectory() || !versionDir.isDirectory()) {
throw new ISE("Hadoop dependency [%s] didn't exist!?", versionDir.getAbsolutePath());
}
hadoopDependenciesToLoad[i++] = versionDir;
}
return hadoopDependenciesToLoad;
} | [
"public",
"static",
"File",
"[",
"]",
"getHadoopDependencyFilesToLoad",
"(",
"List",
"<",
"String",
">",
"hadoopDependencyCoordinates",
",",
"ExtensionsConfig",
"extensionsConfig",
")",
"{",
"final",
"File",
"rootHadoopDependenciesDir",
"=",
"new",
"File",
"(",
"exten... | Find all the hadoop dependencies that should be loaded by druid
@param hadoopDependencyCoordinates e.g.["org.apache.hadoop:hadoop-client:2.3.0"]
@param extensionsConfig ExtensionsConfig configured by druid.extensions.xxx
@return an array of hadoop dependency files that will be loaded by druid process | [
"Find",
"all",
"the",
"hadoop",
"dependencies",
"that",
"should",
"be",
"loaded",
"by",
"druid"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/initialization/Initialization.java#L264-L286 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsShowWorkplace.java | CmsShowWorkplace.openWorkplace | public static void openWorkplace(final CmsUUID structureId, final boolean classic) {
"""
Opens the workplace.<p>
@param structureId the structure id of the resource for which the workplace should be opened
@param classic if true, opens the old workplace, else the new workplace
"""
CmsRpcAction<String> callback = new CmsRpcAction<String>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(0, true);
CmsCoreProvider.getService().getWorkplaceLink(structureId, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(String result) {
stop(false);
Window.Location.assign(result);
}
};
callback.execute();
} | java | public static void openWorkplace(final CmsUUID structureId, final boolean classic) {
CmsRpcAction<String> callback = new CmsRpcAction<String>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
start(0, true);
CmsCoreProvider.getService().getWorkplaceLink(structureId, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
protected void onResponse(String result) {
stop(false);
Window.Location.assign(result);
}
};
callback.execute();
} | [
"public",
"static",
"void",
"openWorkplace",
"(",
"final",
"CmsUUID",
"structureId",
",",
"final",
"boolean",
"classic",
")",
"{",
"CmsRpcAction",
"<",
"String",
">",
"callback",
"=",
"new",
"CmsRpcAction",
"<",
"String",
">",
"(",
")",
"{",
"/**\n ... | Opens the workplace.<p>
@param structureId the structure id of the resource for which the workplace should be opened
@param classic if true, opens the old workplace, else the new workplace | [
"Opens",
"the",
"workplace",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/contextmenu/CmsShowWorkplace.java#L88-L113 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.executeUpdate | public int executeUpdate(String sql, Object[] params) throws SQLException {
"""
Executes the given SQL update with parameters.
<p>
An Object array variant of {@link #executeUpdate(String, List)}.
@param sql the SQL statement
@param params an array of parameters
@return the number of rows updated or 0 for SQL statements that return nothing
@throws SQLException if a database access error occurs
"""
return executeUpdate(sql, Arrays.asList(params));
} | java | public int executeUpdate(String sql, Object[] params) throws SQLException {
return executeUpdate(sql, Arrays.asList(params));
} | [
"public",
"int",
"executeUpdate",
"(",
"String",
"sql",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"executeUpdate",
"(",
"sql",
",",
"Arrays",
".",
"asList",
"(",
"params",
")",
")",
";",
"}"
] | Executes the given SQL update with parameters.
<p>
An Object array variant of {@link #executeUpdate(String, List)}.
@param sql the SQL statement
@param params an array of parameters
@return the number of rows updated or 0 for SQL statements that return nothing
@throws SQLException if a database access error occurs | [
"Executes",
"the",
"given",
"SQL",
"update",
"with",
"parameters",
".",
"<p",
">",
"An",
"Object",
"array",
"variant",
"of",
"{",
"@link",
"#executeUpdate",
"(",
"String",
"List",
")",
"}",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2958-L2960 |
soi-toolkit/soi-toolkit-mule | tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/model/ModelFactory.java | ModelFactory.newModel | public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, DeploymentModelEnum deploymentModel, List<TransportEnum> transports) {
"""
Constructor-method to use when service descriptors are not required (e.g. schema and wsdl for services)
@param groupId
@param artifactId
@param version
@param service
@param deploymentModel
@return the new model instance
"""
return doCreateNewModel(groupId, artifactId, version, service, muleVersion, deploymentModel, transports, null, null, TransformerEnum.JAVA, null, null);
} | java | public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, DeploymentModelEnum deploymentModel, List<TransportEnum> transports) {
return doCreateNewModel(groupId, artifactId, version, service, muleVersion, deploymentModel, transports, null, null, TransformerEnum.JAVA, null, null);
} | [
"public",
"static",
"IModel",
"newModel",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
",",
"String",
"service",
",",
"MuleVersionEnum",
"muleVersion",
",",
"DeploymentModelEnum",
"deploymentModel",
",",
"List",
"<",
"TransportEnu... | Constructor-method to use when service descriptors are not required (e.g. schema and wsdl for services)
@param groupId
@param artifactId
@param version
@param service
@param deploymentModel
@return the new model instance | [
"Constructor",
"-",
"method",
"to",
"use",
"when",
"service",
"descriptors",
"are",
"not",
"required",
"(",
"e",
".",
"g",
".",
"schema",
"and",
"wsdl",
"for",
"services",
")"
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/model/ModelFactory.java#L109-L111 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenuItem.java | WMenuItem.handleRequest | @Override
public void handleRequest(final Request request) {
"""
Override handleRequest in order to perform processing for this component. This implementation checks for
selection of the menu item, and executes the associated action if it has been set.
@param request the request being responded to.
"""
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
String requestValue = request.getParameter(getId());
if (requestValue != null) {
// Only process on a POST
if (!"POST".equals(request.getMethod())) {
LOG.warn("Menu item on a request that is not a POST. Will be ignored.");
return;
}
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(), this.
getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
}
} | java | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
String requestValue = request.getParameter(getId());
if (requestValue != null) {
// Only process on a POST
if (!"POST".equals(request.getMethod())) {
LOG.warn("Menu item on a request that is not a POST. Will be ignored.");
return;
}
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(), this.
getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"// Protect against client-side tampering of disabled/read-only fields.",
"return",
";",
"}",
"if",
"(",
"isMenuPresent",
"... | Override handleRequest in order to perform processing for this component. This implementation checks for
selection of the menu item, and executes the associated action if it has been set.
@param request the request being responded to. | [
"Override",
"handleRequest",
"in",
"order",
"to",
"perform",
"processing",
"for",
"this",
"component",
".",
"This",
"implementation",
"checks",
"for",
"selection",
"of",
"the",
"menu",
"item",
"and",
"executes",
"the",
"associated",
"action",
"if",
"it",
"has",
... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenuItem.java#L428-L463 |
kirgor/enklib | ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java | Bean.createProxy | protected <T> T createProxy(Class<T> interfaceClass, Session session) throws Exception {
"""
Creates data proxy of specified class for specified session.
@param interfaceClass Class of the proxy interface.
@param session Session instance for the proxy.
@param <T> Type of the proxy interface.
@throws Exception
"""
return configBean.getConfig().getStoredProcedureProxyFactory().getProxy(interfaceClass, session);
} | java | protected <T> T createProxy(Class<T> interfaceClass, Session session) throws Exception {
return configBean.getConfig().getStoredProcedureProxyFactory().getProxy(interfaceClass, session);
} | [
"protected",
"<",
"T",
">",
"T",
"createProxy",
"(",
"Class",
"<",
"T",
">",
"interfaceClass",
",",
"Session",
"session",
")",
"throws",
"Exception",
"{",
"return",
"configBean",
".",
"getConfig",
"(",
")",
".",
"getStoredProcedureProxyFactory",
"(",
")",
".... | Creates data proxy of specified class for specified session.
@param interfaceClass Class of the proxy interface.
@param session Session instance for the proxy.
@param <T> Type of the proxy interface.
@throws Exception | [
"Creates",
"data",
"proxy",
"of",
"specified",
"class",
"for",
"specified",
"session",
"."
] | train | https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/ejb/src/main/java/com/kirgor/enklib/ejb/Bean.java#L189-L191 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/Utils.java | Utils.copyResourceToLocalFile | public static File copyResourceToLocalFile(String sourceResource, String destFileName) throws Exception {
"""
Copies file from a resource to a local temp file
@param sourceResource
@return Absolute filename of the temp file
@throws Exception
"""
try {
Resource keystoreFile = new ClassPathResource(sourceResource);
InputStream in = keystoreFile.getInputStream();
File outKeyStoreFile = new File(destFileName);
FileOutputStream fop = new FileOutputStream(outKeyStoreFile);
byte[] buf = new byte[512];
int num;
while ((num = in.read(buf)) != -1) {
fop.write(buf, 0, num);
}
fop.flush();
fop.close();
in.close();
return outKeyStoreFile;
} catch (IOException ioe) {
throw new Exception("Could not copy keystore file: " + ioe.getMessage());
}
} | java | public static File copyResourceToLocalFile(String sourceResource, String destFileName) throws Exception {
try {
Resource keystoreFile = new ClassPathResource(sourceResource);
InputStream in = keystoreFile.getInputStream();
File outKeyStoreFile = new File(destFileName);
FileOutputStream fop = new FileOutputStream(outKeyStoreFile);
byte[] buf = new byte[512];
int num;
while ((num = in.read(buf)) != -1) {
fop.write(buf, 0, num);
}
fop.flush();
fop.close();
in.close();
return outKeyStoreFile;
} catch (IOException ioe) {
throw new Exception("Could not copy keystore file: " + ioe.getMessage());
}
} | [
"public",
"static",
"File",
"copyResourceToLocalFile",
"(",
"String",
"sourceResource",
",",
"String",
"destFileName",
")",
"throws",
"Exception",
"{",
"try",
"{",
"Resource",
"keystoreFile",
"=",
"new",
"ClassPathResource",
"(",
"sourceResource",
")",
";",
"InputSt... | Copies file from a resource to a local temp file
@param sourceResource
@return Absolute filename of the temp file
@throws Exception | [
"Copies",
"file",
"from",
"a",
"resource",
"to",
"a",
"local",
"temp",
"file"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/Utils.java#L100-L119 |
javactic/javactic | src/main/java/com/github/javactic/futures/ExecutionContext.java | ExecutionContext.combined | public <G, ERR> OrFuture<Vector<G>, Every<ERR>>
combined(Iterable<? extends OrFuture<? extends G, ? extends Every<? extends ERR>>> input) {
"""
Combines an Iterable of OrFutures of type OrFuture<G, EVERY<ERR>> (where
EVERY is some subtype of Every) into a single OrFuture of type
OrFuture<Vector<G>, Every<ERR>>.
<p>
This method differs from sequence in that it will accumulate every error in the returned
future before completing.
@param <G> the success type
@param <ERR> the failure type
@param input the iterable containing OrFutures to combine
@return an OrFuture that completes with all the success values or with all the errors
"""
return combined(input, Vector.collector());
} | java | public <G, ERR> OrFuture<Vector<G>, Every<ERR>>
combined(Iterable<? extends OrFuture<? extends G, ? extends Every<? extends ERR>>> input) {
return combined(input, Vector.collector());
} | [
"public",
"<",
"G",
",",
"ERR",
">",
"OrFuture",
"<",
"Vector",
"<",
"G",
">",
",",
"Every",
"<",
"ERR",
">",
">",
"combined",
"(",
"Iterable",
"<",
"?",
"extends",
"OrFuture",
"<",
"?",
"extends",
"G",
",",
"?",
"extends",
"Every",
"<",
"?",
"ex... | Combines an Iterable of OrFutures of type OrFuture<G, EVERY<ERR>> (where
EVERY is some subtype of Every) into a single OrFuture of type
OrFuture<Vector<G>, Every<ERR>>.
<p>
This method differs from sequence in that it will accumulate every error in the returned
future before completing.
@param <G> the success type
@param <ERR> the failure type
@param input the iterable containing OrFutures to combine
@return an OrFuture that completes with all the success values or with all the errors | [
"Combines",
"an",
"Iterable",
"of",
"OrFutures",
"of",
"type",
"OrFuture<",
";",
"G",
"EVERY<",
";",
"ERR>",
";",
">",
";",
"(",
"where",
"EVERY",
"is",
"some",
"subtype",
"of",
"Every",
")",
"into",
"a",
"single",
"OrFuture",
"of",
"type",
"OrFu... | train | https://github.com/javactic/javactic/blob/dfa040062178c259c3067fd9b59cb4498022d8bc/src/main/java/com/github/javactic/futures/ExecutionContext.java#L459-L462 |
ops4j/org.ops4j.pax.swissbox | pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java | BndUtils.createBundle | public static InputStream createBundle( final InputStream jarInputStream,
final Properties instructions,
final String jarInfo,
final OverwriteMode overwriteMode )
throws IOException {
"""
Processes the input jar and generates the necessary OSGi headers using specified instructions.
@param jarInputStream input stream for the jar to be processed. Cannot be null.
@param instructions bnd specific processing instructions. Cannot be null.
@param jarInfo information about the jar to be processed. Usually the jar url. Cannot be null or empty.
@param overwriteMode manifets overwrite mode
@return an input stream for the generated bundle
@throws NullArgumentException if any of the parameters is null
@throws IOException re-thron during jar processing
"""
NullArgumentException.validateNotNull( jarInputStream, "Jar URL" );
NullArgumentException.validateNotNull( instructions, "Instructions" );
NullArgumentException.validateNotEmpty( jarInfo, "Jar info" );
LOG.debug( "Creating bundle for [" + jarInfo + "]" );
LOG.debug( "Overwrite mode: " + overwriteMode );
LOG.trace( "Using instructions " + instructions );
final Jar jar = new Jar( "dot", jarInputStream );
Manifest manifest = null;
try
{
manifest = jar.getManifest();
}
catch ( Exception e )
{
jar.close();
throw new Ops4jException( e );
}
// Make the jar a bundle if it is not already a bundle
if( manifest == null
|| OverwriteMode.KEEP != overwriteMode
|| ( manifest.getMainAttributes().getValue( Analyzer.EXPORT_PACKAGE ) == null
&& manifest.getMainAttributes().getValue( Analyzer.IMPORT_PACKAGE ) == null )
)
{
// Do not use instructions as default for properties because it looks like BND uses the props
// via some other means then getProperty() and so the instructions will not be used at all
// So, just copy instructions to properties
final Properties properties = new Properties();
properties.putAll( instructions );
properties.put( "Generated-By-Ops4j-Pax-From", jarInfo );
final Analyzer analyzer = new Analyzer();
analyzer.setJar( jar );
analyzer.setProperties( properties );
if( manifest != null && OverwriteMode.MERGE == overwriteMode )
{
analyzer.mergeManifest( manifest );
}
checkMandatoryProperties( analyzer, jar, jarInfo );
try
{
Manifest newManifest = analyzer.calcManifest();
jar.setManifest( newManifest );
}
catch ( Exception e )
{
jar.close();
throw new Ops4jException( e );
}
}
return createInputStream( jar );
} | java | public static InputStream createBundle( final InputStream jarInputStream,
final Properties instructions,
final String jarInfo,
final OverwriteMode overwriteMode )
throws IOException
{
NullArgumentException.validateNotNull( jarInputStream, "Jar URL" );
NullArgumentException.validateNotNull( instructions, "Instructions" );
NullArgumentException.validateNotEmpty( jarInfo, "Jar info" );
LOG.debug( "Creating bundle for [" + jarInfo + "]" );
LOG.debug( "Overwrite mode: " + overwriteMode );
LOG.trace( "Using instructions " + instructions );
final Jar jar = new Jar( "dot", jarInputStream );
Manifest manifest = null;
try
{
manifest = jar.getManifest();
}
catch ( Exception e )
{
jar.close();
throw new Ops4jException( e );
}
// Make the jar a bundle if it is not already a bundle
if( manifest == null
|| OverwriteMode.KEEP != overwriteMode
|| ( manifest.getMainAttributes().getValue( Analyzer.EXPORT_PACKAGE ) == null
&& manifest.getMainAttributes().getValue( Analyzer.IMPORT_PACKAGE ) == null )
)
{
// Do not use instructions as default for properties because it looks like BND uses the props
// via some other means then getProperty() and so the instructions will not be used at all
// So, just copy instructions to properties
final Properties properties = new Properties();
properties.putAll( instructions );
properties.put( "Generated-By-Ops4j-Pax-From", jarInfo );
final Analyzer analyzer = new Analyzer();
analyzer.setJar( jar );
analyzer.setProperties( properties );
if( manifest != null && OverwriteMode.MERGE == overwriteMode )
{
analyzer.mergeManifest( manifest );
}
checkMandatoryProperties( analyzer, jar, jarInfo );
try
{
Manifest newManifest = analyzer.calcManifest();
jar.setManifest( newManifest );
}
catch ( Exception e )
{
jar.close();
throw new Ops4jException( e );
}
}
return createInputStream( jar );
} | [
"public",
"static",
"InputStream",
"createBundle",
"(",
"final",
"InputStream",
"jarInputStream",
",",
"final",
"Properties",
"instructions",
",",
"final",
"String",
"jarInfo",
",",
"final",
"OverwriteMode",
"overwriteMode",
")",
"throws",
"IOException",
"{",
"NullArg... | Processes the input jar and generates the necessary OSGi headers using specified instructions.
@param jarInputStream input stream for the jar to be processed. Cannot be null.
@param instructions bnd specific processing instructions. Cannot be null.
@param jarInfo information about the jar to be processed. Usually the jar url. Cannot be null or empty.
@param overwriteMode manifets overwrite mode
@return an input stream for the generated bundle
@throws NullArgumentException if any of the parameters is null
@throws IOException re-thron during jar processing | [
"Processes",
"the",
"input",
"jar",
"and",
"generates",
"the",
"necessary",
"OSGi",
"headers",
"using",
"specified",
"instructions",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java#L109-L172 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/expressions/Expressions.java | Expressions.isLessThan | public static IsLessThan isLessThan(ComparableExpression<Number> left, ComparableExpression<Number> right) {
"""
Creates an IsLessThan expression from the given expressions.
@param left The left expression.
@param right The right expression.
@return A new is less than binary expression.
"""
return new IsLessThan(left, right);
} | java | public static IsLessThan isLessThan(ComparableExpression<Number> left, ComparableExpression<Number> right) {
return new IsLessThan(left, right);
} | [
"public",
"static",
"IsLessThan",
"isLessThan",
"(",
"ComparableExpression",
"<",
"Number",
">",
"left",
",",
"ComparableExpression",
"<",
"Number",
">",
"right",
")",
"{",
"return",
"new",
"IsLessThan",
"(",
"left",
",",
"right",
")",
";",
"}"
] | Creates an IsLessThan expression from the given expressions.
@param left The left expression.
@param right The right expression.
@return A new is less than binary expression. | [
"Creates",
"an",
"IsLessThan",
"expression",
"from",
"the",
"given",
"expressions",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L323-L325 |
coursera/courier | typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java | TSSyntax.escapeKeyword | private static String escapeKeyword(String symbol, EscapeStrategy strategy) {
"""
Returns the escaped Pegasus symbol for use in Typescript source code.
Pegasus symbols must be of the form [A-Za-z_], so this routine simply checks if the
symbol collides with a typescript keyword, and if so, escapes it.
@param symbol the symbol to escape
@param strategy which strategy to use in escaping
@return the escaped Pegasus symbol.
"""
if (tsKeywords.contains(symbol)) {
if (strategy.equals(EscapeStrategy.MANGLE)) {
return symbol + "$";
} else {
return "\"" + symbol + "\"";
}
} else {
return symbol;
}
} | java | private static String escapeKeyword(String symbol, EscapeStrategy strategy) {
if (tsKeywords.contains(symbol)) {
if (strategy.equals(EscapeStrategy.MANGLE)) {
return symbol + "$";
} else {
return "\"" + symbol + "\"";
}
} else {
return symbol;
}
} | [
"private",
"static",
"String",
"escapeKeyword",
"(",
"String",
"symbol",
",",
"EscapeStrategy",
"strategy",
")",
"{",
"if",
"(",
"tsKeywords",
".",
"contains",
"(",
"symbol",
")",
")",
"{",
"if",
"(",
"strategy",
".",
"equals",
"(",
"EscapeStrategy",
".",
... | Returns the escaped Pegasus symbol for use in Typescript source code.
Pegasus symbols must be of the form [A-Za-z_], so this routine simply checks if the
symbol collides with a typescript keyword, and if so, escapes it.
@param symbol the symbol to escape
@param strategy which strategy to use in escaping
@return the escaped Pegasus symbol. | [
"Returns",
"the",
"escaped",
"Pegasus",
"symbol",
"for",
"use",
"in",
"Typescript",
"source",
"code",
"."
] | train | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java#L161-L171 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java | JenkinsServer.deleteJob | public JenkinsServer deleteJob(FolderJob folder, String jobName) throws IOException {
"""
Delete a job from Jenkins within a folder.
@param folder The folder where the given job is located.
@param jobName The job which should be deleted.
@throws IOException in case of an error.
"""
return deleteJob(folder, jobName, false);
} | java | public JenkinsServer deleteJob(FolderJob folder, String jobName) throws IOException {
return deleteJob(folder, jobName, false);
} | [
"public",
"JenkinsServer",
"deleteJob",
"(",
"FolderJob",
"folder",
",",
"String",
"jobName",
")",
"throws",
"IOException",
"{",
"return",
"deleteJob",
"(",
"folder",
",",
"jobName",
",",
"false",
")",
";",
"}"
] | Delete a job from Jenkins within a folder.
@param folder The folder where the given job is located.
@param jobName The job which should be deleted.
@throws IOException in case of an error. | [
"Delete",
"a",
"job",
"from",
"Jenkins",
"within",
"a",
"folder",
"."
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L692-L694 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DoubleList.java | DoubleList.noneMatch | public <E extends Exception> boolean noneMatch(Try.DoublePredicate<E> filter) throws E {
"""
Returns whether no elements of this List match the provided predicate.
@param filter
@return
"""
return noneMatch(0, size(), filter);
} | java | public <E extends Exception> boolean noneMatch(Try.DoublePredicate<E> filter) throws E {
return noneMatch(0, size(), filter);
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"noneMatch",
"(",
"Try",
".",
"DoublePredicate",
"<",
"E",
">",
"filter",
")",
"throws",
"E",
"{",
"return",
"noneMatch",
"(",
"0",
",",
"size",
"(",
")",
",",
"filter",
")",
";",
"}"
] | Returns whether no elements of this List match the provided predicate.
@param filter
@return | [
"Returns",
"whether",
"no",
"elements",
"of",
"this",
"List",
"match",
"the",
"provided",
"predicate",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DoubleList.java#L951-L953 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java | AbstractManagedType.onStrategyType | private InheritanceModel onStrategyType(InheritanceModel model, InheritanceType strategyType, String descriminator,
String descriminatorValue, String tableName, String schemaName) {
"""
On strategy type.
@param model
the model
@param strategyType
the strategy type
@param descriminator
the descriminator
@param descriminatorValue
the descriminator value
@param tableName
the table name
@param schemaName
the schema name
@return the inheritance model
"""
switch (strategyType)
{
case SINGLE_TABLE:
// if single table
if (superClazzType.getJavaType().isAnnotationPresent(DiscriminatorColumn.class))
{
descriminator = superClazzType.getJavaType().getAnnotation(DiscriminatorColumn.class).name();
descriminatorValue = getJavaType().getAnnotation(DiscriminatorValue.class).value();
}
model = new InheritanceModel(InheritanceType.SINGLE_TABLE, descriminator, descriminatorValue, tableName,
schemaName);
break;
case JOINED:
// if join table
// TODOO: PRIMARY KEY JOIN COLUMN
model = new InheritanceModel(InheritanceType.JOINED, tableName, schemaName);
break;
case TABLE_PER_CLASS:
// don't override, use original ones.
model = new InheritanceModel(InheritanceType.TABLE_PER_CLASS, null, null);
break;
default:
// do nothing.
break;
}
return model;
} | java | private InheritanceModel onStrategyType(InheritanceModel model, InheritanceType strategyType, String descriminator,
String descriminatorValue, String tableName, String schemaName)
{
switch (strategyType)
{
case SINGLE_TABLE:
// if single table
if (superClazzType.getJavaType().isAnnotationPresent(DiscriminatorColumn.class))
{
descriminator = superClazzType.getJavaType().getAnnotation(DiscriminatorColumn.class).name();
descriminatorValue = getJavaType().getAnnotation(DiscriminatorValue.class).value();
}
model = new InheritanceModel(InheritanceType.SINGLE_TABLE, descriminator, descriminatorValue, tableName,
schemaName);
break;
case JOINED:
// if join table
// TODOO: PRIMARY KEY JOIN COLUMN
model = new InheritanceModel(InheritanceType.JOINED, tableName, schemaName);
break;
case TABLE_PER_CLASS:
// don't override, use original ones.
model = new InheritanceModel(InheritanceType.TABLE_PER_CLASS, null, null);
break;
default:
// do nothing.
break;
}
return model;
} | [
"private",
"InheritanceModel",
"onStrategyType",
"(",
"InheritanceModel",
"model",
",",
"InheritanceType",
"strategyType",
",",
"String",
"descriminator",
",",
"String",
"descriminatorValue",
",",
"String",
"tableName",
",",
"String",
"schemaName",
")",
"{",
"switch",
... | On strategy type.
@param model
the model
@param strategyType
the strategy type
@param descriminator
the descriminator
@param descriminatorValue
the descriminator value
@param tableName
the table name
@param schemaName
the schema name
@return the inheritance model | [
"On",
"strategy",
"type",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L1324-L1364 |
google/closure-compiler | src/com/google/javascript/jscomp/parsing/parser/FeatureSet.java | FeatureSet.with | public FeatureSet with(Feature feature) {
"""
Returns a feature set combining all the features from {@code this} and {@code feature}.
"""
if (features.contains(feature)) {
return this;
}
return new FeatureSet(add(features, feature));
} | java | public FeatureSet with(Feature feature) {
if (features.contains(feature)) {
return this;
}
return new FeatureSet(add(features, feature));
} | [
"public",
"FeatureSet",
"with",
"(",
"Feature",
"feature",
")",
"{",
"if",
"(",
"features",
".",
"contains",
"(",
"feature",
")",
")",
"{",
"return",
"this",
";",
"}",
"return",
"new",
"FeatureSet",
"(",
"add",
"(",
"features",
",",
"feature",
")",
")"... | Returns a feature set combining all the features from {@code this} and {@code feature}. | [
"Returns",
"a",
"feature",
"set",
"combining",
"all",
"the",
"features",
"from",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/parser/FeatureSet.java#L359-L364 |
hawkular/hawkular-commons | hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/bus/BusEndpointProcessors.java | BusEndpointProcessors.initialize | public void initialize(@Observes @Initialized(ApplicationScoped.class) Object ignore) {
"""
This creates the bi-function listener-producers that will create listeners which will
create JMS bus listeners for each websocket session that gets created in the future.
@param ignore unused
"""
log.debugf("Initializing [%s]", this.getClass().getName());
try {
feedSessionListenerProducer = new BiFunction<String, Session, WsSessionListener>() {
@Override
public WsSessionListener apply(String key, Session session) {
// In the future, if we need other queues/topics that need to be listened to, we add them here.
final Endpoint endpoint = Constants.FEED_COMMAND_QUEUE;
BasicMessageListener<BasicMessage> busEndpointListener = new FeedBusEndpointListener(session, key,
endpoint);
return new BusWsSessionListener(Constants.HEADER_FEEDID, key, endpoint, busEndpointListener);
}
};
wsEndpoints.getFeedSessions().addWsSessionListenerProducer(feedSessionListenerProducer);
uiClientSessionListenerProducer = new BiFunction<String, Session, WsSessionListener>() {
@Override
public WsSessionListener apply(String key, Session session) {
// In the future, if we need other queues/topics that need to be listened to, we add them here.
final Endpoint endpoint = Constants.UI_COMMAND_QUEUE;
BasicMessageListener<BasicMessage> busEndpointListener = new UiClientBusEndpointListener(
commandContextFactory, busCommands, endpoint);
return new BusWsSessionListener(Constants.HEADER_UICLIENTID, key, endpoint, busEndpointListener);
}
};
wsEndpoints.getUiClientSessions().addWsSessionListenerProducer(uiClientSessionListenerProducer);
} catch (Exception e) {
log.errorCouldNotInitialize(e, this.getClass().getName());
}
} | java | public void initialize(@Observes @Initialized(ApplicationScoped.class) Object ignore) {
log.debugf("Initializing [%s]", this.getClass().getName());
try {
feedSessionListenerProducer = new BiFunction<String, Session, WsSessionListener>() {
@Override
public WsSessionListener apply(String key, Session session) {
// In the future, if we need other queues/topics that need to be listened to, we add them here.
final Endpoint endpoint = Constants.FEED_COMMAND_QUEUE;
BasicMessageListener<BasicMessage> busEndpointListener = new FeedBusEndpointListener(session, key,
endpoint);
return new BusWsSessionListener(Constants.HEADER_FEEDID, key, endpoint, busEndpointListener);
}
};
wsEndpoints.getFeedSessions().addWsSessionListenerProducer(feedSessionListenerProducer);
uiClientSessionListenerProducer = new BiFunction<String, Session, WsSessionListener>() {
@Override
public WsSessionListener apply(String key, Session session) {
// In the future, if we need other queues/topics that need to be listened to, we add them here.
final Endpoint endpoint = Constants.UI_COMMAND_QUEUE;
BasicMessageListener<BasicMessage> busEndpointListener = new UiClientBusEndpointListener(
commandContextFactory, busCommands, endpoint);
return new BusWsSessionListener(Constants.HEADER_UICLIENTID, key, endpoint, busEndpointListener);
}
};
wsEndpoints.getUiClientSessions().addWsSessionListenerProducer(uiClientSessionListenerProducer);
} catch (Exception e) {
log.errorCouldNotInitialize(e, this.getClass().getName());
}
} | [
"public",
"void",
"initialize",
"(",
"@",
"Observes",
"@",
"Initialized",
"(",
"ApplicationScoped",
".",
"class",
")",
"Object",
"ignore",
")",
"{",
"log",
".",
"debugf",
"(",
"\"Initializing [%s]\"",
",",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
... | This creates the bi-function listener-producers that will create listeners which will
create JMS bus listeners for each websocket session that gets created in the future.
@param ignore unused | [
"This",
"creates",
"the",
"bi",
"-",
"function",
"listener",
"-",
"producers",
"that",
"will",
"create",
"listeners",
"which",
"will",
"create",
"JMS",
"bus",
"listeners",
"for",
"each",
"websocket",
"session",
"that",
"gets",
"created",
"in",
"the",
"future",... | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/bus/BusEndpointProcessors.java#L256-L286 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/InitOnceFieldHandler.java | InitOnceFieldHandler.doSetData | public int doSetData(Object objData, boolean bDisplayOption, int iMoveMode) {
"""
Move the physical binary data to this field.
If this is an init set, only does it until the first change.
@param objData the raw data to set the basefield to.
@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).
"""
int iErrorCode = DBConstants.NORMAL_RETURN;
if ((m_bFirstTime) || (iMoveMode == DBConstants.READ_MOVE) || (iMoveMode == DBConstants.SCREEN_MOVE))
iErrorCode = super.doSetData(objData, bDisplayOption, iMoveMode);
m_bFirstTime = false; // No more Inits allowed
return iErrorCode;
} | java | public int doSetData(Object objData, boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
if ((m_bFirstTime) || (iMoveMode == DBConstants.READ_MOVE) || (iMoveMode == DBConstants.SCREEN_MOVE))
iErrorCode = super.doSetData(objData, bDisplayOption, iMoveMode);
m_bFirstTime = false; // No more Inits allowed
return iErrorCode;
} | [
"public",
"int",
"doSetData",
"(",
"Object",
"objData",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iErrorCode",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"if",
"(",
"(",
"m_bFirstTime",
")",
"||",
"(",
"iMoveMode",
"=="... | Move the physical binary data to this field.
If this is an init set, only does it until the first change.
@param objData the raw data to set the basefield to.
@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). | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"field",
".",
"If",
"this",
"is",
"an",
"init",
"set",
"only",
"does",
"it",
"until",
"the",
"first",
"change",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitOnceFieldHandler.java#L120-L127 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/WhitelistingApi.java | WhitelistingApi.uploadCSV | public UploadIdEnvelope uploadCSV(String dtid, byte[] file) throws ApiException {
"""
Upload a CSV file related to the Device Type.
Upload a CSV file related to the Device Type.
@param dtid Device Type ID. (required)
@param file Device Type ID. (required)
@return UploadIdEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<UploadIdEnvelope> resp = uploadCSVWithHttpInfo(dtid, file);
return resp.getData();
} | java | public UploadIdEnvelope uploadCSV(String dtid, byte[] file) throws ApiException {
ApiResponse<UploadIdEnvelope> resp = uploadCSVWithHttpInfo(dtid, file);
return resp.getData();
} | [
"public",
"UploadIdEnvelope",
"uploadCSV",
"(",
"String",
"dtid",
",",
"byte",
"[",
"]",
"file",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"UploadIdEnvelope",
">",
"resp",
"=",
"uploadCSVWithHttpInfo",
"(",
"dtid",
",",
"file",
")",
";",
"return"... | Upload a CSV file related to the Device Type.
Upload a CSV file related to the Device Type.
@param dtid Device Type ID. (required)
@param file Device Type ID. (required)
@return UploadIdEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Upload",
"a",
"CSV",
"file",
"related",
"to",
"the",
"Device",
"Type",
".",
"Upload",
"a",
"CSV",
"file",
"related",
"to",
"the",
"Device",
"Type",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/WhitelistingApi.java#L1152-L1155 |
meertensinstituut/mtas | src/main/java/mtas/codec/tree/IntervalTree.java | IntervalTree.printBalance | final private String printBalance(Integer p, N n) {
"""
Prints the balance.
@param p the p
@param n the n
@return the string
"""
StringBuilder text = new StringBuilder();
if (n != null) {
text.append(printBalance((p + 1), n.leftChild));
String format = "%" + (3 * p) + "s";
text.append(String.format(format, ""));
if (n.left == n.right) {
text.append("[" + n.left + "] (" + n.max + ") : " + n.lists.size()
+ " lists\n");
} else {
text.append("[" + n.left + "-" + n.right + "] (" + n.max + ") : "
+ n.lists.size() + " lists\n");
}
text.append(printBalance((p + 1), n.rightChild));
}
return text.toString();
} | java | final private String printBalance(Integer p, N n) {
StringBuilder text = new StringBuilder();
if (n != null) {
text.append(printBalance((p + 1), n.leftChild));
String format = "%" + (3 * p) + "s";
text.append(String.format(format, ""));
if (n.left == n.right) {
text.append("[" + n.left + "] (" + n.max + ") : " + n.lists.size()
+ " lists\n");
} else {
text.append("[" + n.left + "-" + n.right + "] (" + n.max + ") : "
+ n.lists.size() + " lists\n");
}
text.append(printBalance((p + 1), n.rightChild));
}
return text.toString();
} | [
"final",
"private",
"String",
"printBalance",
"(",
"Integer",
"p",
",",
"N",
"n",
")",
"{",
"StringBuilder",
"text",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"n",
"!=",
"null",
")",
"{",
"text",
".",
"append",
"(",
"printBalance",
"(",
... | Prints the balance.
@param p the p
@param n the n
@return the string | [
"Prints",
"the",
"balance",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/tree/IntervalTree.java#L83-L99 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLeadingCharCount | @Nonnegative
public static int getLeadingCharCount (@Nullable final String s, final char c) {
"""
Get the number of specified chars, the passed string starts with.
@param s
The string to be parsed. May be <code>null</code>.
@param c
The char to be searched.
@return Always ≥ 0.
"""
int ret = 0;
if (s != null)
{
final int nMax = s.length ();
while (ret < nMax && s.charAt (ret) == c)
++ret;
}
return ret;
} | java | @Nonnegative
public static int getLeadingCharCount (@Nullable final String s, final char c)
{
int ret = 0;
if (s != null)
{
final int nMax = s.length ();
while (ret < nMax && s.charAt (ret) == c)
++ret;
}
return ret;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getLeadingCharCount",
"(",
"@",
"Nullable",
"final",
"String",
"s",
",",
"final",
"char",
"c",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"final",
"int",
"nMax",
"=",... | Get the number of specified chars, the passed string starts with.
@param s
The string to be parsed. May be <code>null</code>.
@param c
The char to be searched.
@return Always ≥ 0. | [
"Get",
"the",
"number",
"of",
"specified",
"chars",
"the",
"passed",
"string",
"starts",
"with",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L839-L850 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java | AmazonDynamoDBClient.putItem | public PutItemResult putItem(PutItemRequest putItemRequest)
throws AmazonServiceException, AmazonClientException {
"""
<p>
Creates a new item, or replaces an old item with a new item (including
all the attributes).
</p>
<p>
If an item already exists in the specified table with the same primary
key, the new item completely replaces the existing item. You can
perform a conditional put (insert a new item if one with the specified
primary key doesn't exist), or replace an existing item if it has
certain attribute values.
</p>
@param putItemRequest Container for the necessary parameters to
execute the PutItem service method on AmazonDynamoDB.
@return The response from the PutItem service method, as returned by
AmazonDynamoDB.
@throws LimitExceededException
@throws ProvisionedThroughputExceededException
@throws ConditionalCheckFailedException
@throws InternalServerErrorException
@throws ResourceNotFoundException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue.
"""
ExecutionContext executionContext = createExecutionContext(putItemRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<PutItemRequest> request = marshall(putItemRequest,
new PutItemRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<PutItemResult, JsonUnmarshallerContext> unmarshaller = new PutItemResultJsonUnmarshaller();
JsonResponseHandler<PutItemResult> responseHandler = new JsonResponseHandler<PutItemResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | java | public PutItemResult putItem(PutItemRequest putItemRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(putItemRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<PutItemRequest> request = marshall(putItemRequest,
new PutItemRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<PutItemResult, JsonUnmarshallerContext> unmarshaller = new PutItemResultJsonUnmarshaller();
JsonResponseHandler<PutItemResult> responseHandler = new JsonResponseHandler<PutItemResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | [
"public",
"PutItemResult",
"putItem",
"(",
"PutItemRequest",
"putItemRequest",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"ExecutionContext",
"executionContext",
"=",
"createExecutionContext",
"(",
"putItemRequest",
")",
";",
"AWSRequestMetric... | <p>
Creates a new item, or replaces an old item with a new item (including
all the attributes).
</p>
<p>
If an item already exists in the specified table with the same primary
key, the new item completely replaces the existing item. You can
perform a conditional put (insert a new item if one with the specified
primary key doesn't exist), or replace an existing item if it has
certain attribute values.
</p>
@param putItemRequest Container for the necessary parameters to
execute the PutItem service method on AmazonDynamoDB.
@return The response from the PutItem service method, as returned by
AmazonDynamoDB.
@throws LimitExceededException
@throws ProvisionedThroughputExceededException
@throws ConditionalCheckFailedException
@throws InternalServerErrorException
@throws ResourceNotFoundException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue. | [
"<p",
">",
"Creates",
"a",
"new",
"item",
"or",
"replaces",
"an",
"old",
"item",
"with",
"a",
"new",
"item",
"(",
"including",
"all",
"the",
"attributes",
")",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"an",
"item",
"already",
"exists",
"in",
"the"... | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L548-L560 |
grails/grails-core | grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java | GroovyPagesUriSupport.getNoSuffixViewURI | public String getNoSuffixViewURI(GroovyObject controller, String viewName) {
"""
Obtains a view URI of the given controller and view name without the suffix
@param controller The name of the controller
@param viewName The name of the view
@return The view URI
"""
return getNoSuffixViewURI(getLogicalControllerName(controller), viewName);
} | java | public String getNoSuffixViewURI(GroovyObject controller, String viewName) {
return getNoSuffixViewURI(getLogicalControllerName(controller), viewName);
} | [
"public",
"String",
"getNoSuffixViewURI",
"(",
"GroovyObject",
"controller",
",",
"String",
"viewName",
")",
"{",
"return",
"getNoSuffixViewURI",
"(",
"getLogicalControllerName",
"(",
"controller",
")",
",",
"viewName",
")",
";",
"}"
] | Obtains a view URI of the given controller and view name without the suffix
@param controller The name of the controller
@param viewName The name of the view
@return The view URI | [
"Obtains",
"a",
"view",
"URI",
"of",
"the",
"given",
"controller",
"and",
"view",
"name",
"without",
"the",
"suffix"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java#L79-L81 |
joniles/mpxj | src/main/java/net/sf/mpxj/CustomFieldContainer.java | CustomFieldContainer.getCustomField | public CustomField getCustomField(FieldType field) {
"""
Retrieve configuration details for a given custom field.
@param field required custom field
@return configuration detail
"""
CustomField result = m_configMap.get(field);
if (result == null)
{
result = new CustomField(field, this);
m_configMap.put(field, result);
}
return result;
} | java | public CustomField getCustomField(FieldType field)
{
CustomField result = m_configMap.get(field);
if (result == null)
{
result = new CustomField(field, this);
m_configMap.put(field, result);
}
return result;
} | [
"public",
"CustomField",
"getCustomField",
"(",
"FieldType",
"field",
")",
"{",
"CustomField",
"result",
"=",
"m_configMap",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"CustomField",
"(",
"field",... | Retrieve configuration details for a given custom field.
@param field required custom field
@return configuration detail | [
"Retrieve",
"configuration",
"details",
"for",
"a",
"given",
"custom",
"field",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CustomFieldContainer.java#L44-L53 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java | DataContextUtils.replaceDataReferencesConverter | public static Converter<String,String> replaceDataReferencesConverter(final Map<String, Map<String, String>> data) {
"""
Return a converter that can expand the property references within a string
@param data property context data
@return a Converter to expand property values within a string
"""
return replaceDataReferencesConverter(data, null, false);
} | java | public static Converter<String,String> replaceDataReferencesConverter(final Map<String, Map<String, String>> data) {
return replaceDataReferencesConverter(data, null, false);
} | [
"public",
"static",
"Converter",
"<",
"String",
",",
"String",
">",
"replaceDataReferencesConverter",
"(",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"data",
")",
"{",
"return",
"replaceDataReferencesConverter",
"(",
"da... | Return a converter that can expand the property references within a string
@param data property context data
@return a Converter to expand property values within a string | [
"Return",
"a",
"converter",
"that",
"can",
"expand",
"the",
"property",
"references",
"within",
"a",
"string"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java#L325-L327 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newRuleException | public static RuleException newRuleException(Throwable cause, String message, Object... args) {
"""
Constructs and initializes a new {@link RuleException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link RuleException} was thrown.
@param message {@link String} describing the {@link RuleException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link RuleException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.biz.rules.RuleException
"""
return new RuleException(format(message, args), cause);
} | java | public static RuleException newRuleException(Throwable cause, String message, Object... args) {
return new RuleException(format(message, args), cause);
} | [
"public",
"static",
"RuleException",
"newRuleException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"RuleException",
"(",
"format",
"(",
"message",
",",
"args",
")",
",",
"cause",
")",
";",
... | Constructs and initializes a new {@link RuleException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link RuleException} was thrown.
@param message {@link String} describing the {@link RuleException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link RuleException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.biz.rules.RuleException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"RuleException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L107-L109 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/tree/LocalVariableAnnotationNode.java | LocalVariableAnnotationNode.accept | public void accept(final MethodVisitor mv, boolean visible) {
"""
Makes the given visitor visit this type annotation.
@param mv
the visitor that must visit this annotation.
@param visible
<tt>true</tt> if the annotation is visible at runtime.
"""
Label[] start = new Label[this.start.size()];
Label[] end = new Label[this.end.size()];
int[] index = new int[this.index.size()];
for (int i = 0; i < start.length; ++i) {
start[i] = this.start.get(i).getLabel();
end[i] = this.end.get(i).getLabel();
index[i] = this.index.get(i);
}
accept(mv.visitLocalVariableAnnotation(typeRef, typePath, start, end,
index, desc, true));
} | java | public void accept(final MethodVisitor mv, boolean visible) {
Label[] start = new Label[this.start.size()];
Label[] end = new Label[this.end.size()];
int[] index = new int[this.index.size()];
for (int i = 0; i < start.length; ++i) {
start[i] = this.start.get(i).getLabel();
end[i] = this.end.get(i).getLabel();
index[i] = this.index.get(i);
}
accept(mv.visitLocalVariableAnnotation(typeRef, typePath, start, end,
index, desc, true));
} | [
"public",
"void",
"accept",
"(",
"final",
"MethodVisitor",
"mv",
",",
"boolean",
"visible",
")",
"{",
"Label",
"[",
"]",
"start",
"=",
"new",
"Label",
"[",
"this",
".",
"start",
".",
"size",
"(",
")",
"]",
";",
"Label",
"[",
"]",
"end",
"=",
"new",... | Makes the given visitor visit this type annotation.
@param mv
the visitor that must visit this annotation.
@param visible
<tt>true</tt> if the annotation is visible at runtime. | [
"Makes",
"the",
"given",
"visitor",
"visit",
"this",
"type",
"annotation",
"."
] | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/tree/LocalVariableAnnotationNode.java#L145-L156 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/EntityLockService.java | EntityLockService.newWriteLock | public IEntityLock newWriteLock(EntityIdentifier entityID, String owner)
throws LockingException {
"""
Returns a write lock for the <code>IBasicEntity</code> and owner.
@return org.apereo.portal.concurrency.locking.IEntityLock
@param entityID EntityIdentifier
@param owner String
@exception LockingException
"""
return lockService.newLock(
entityID.getType(), entityID.getKey(), IEntityLockService.WRITE_LOCK, owner);
} | java | public IEntityLock newWriteLock(EntityIdentifier entityID, String owner)
throws LockingException {
return lockService.newLock(
entityID.getType(), entityID.getKey(), IEntityLockService.WRITE_LOCK, owner);
} | [
"public",
"IEntityLock",
"newWriteLock",
"(",
"EntityIdentifier",
"entityID",
",",
"String",
"owner",
")",
"throws",
"LockingException",
"{",
"return",
"lockService",
".",
"newLock",
"(",
"entityID",
".",
"getType",
"(",
")",
",",
"entityID",
".",
"getKey",
"(",... | Returns a write lock for the <code>IBasicEntity</code> and owner.
@return org.apereo.portal.concurrency.locking.IEntityLock
@param entityID EntityIdentifier
@param owner String
@exception LockingException | [
"Returns",
"a",
"write",
"lock",
"for",
"the",
"<code",
">",
"IBasicEntity<",
"/",
"code",
">",
"and",
"owner",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/services/EntityLockService.java#L205-L209 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java | AbstractIndexWriter.addDescription | protected void addDescription(Element member, Content dlTree, SearchIndexItem si) {
"""
Add description for Class, Field, Method or Constructor.
@param member the member of the Class Kind
@param dlTree the content tree to which the description will be added
@param si search index item
"""
si.setContainingPackage(utils.getPackageName(utils.containingPackage(member)));
si.setContainingClass(utils.getSimpleName(utils.getEnclosingTypeElement(member)));
String name = utils.getSimpleName(member);
if (utils.isExecutableElement(member)) {
ExecutableElement ee = (ExecutableElement)member;
name = name + utils.flatSignature(ee);
si.setLabel(name);
if (!((utils.signature(ee)).equals(utils.flatSignature(ee)))) {
si.setUrl(getName(getAnchor(ee)));
}
} else {
si.setLabel(name);
}
si.setCategory(resources.getText("doclet.Members"));
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
Content dt = HtmlTree.DT(span);
dt.addContent(" - ");
addMemberDesc(member, dt);
dlTree.addContent(dt);
Content dd = new HtmlTree(HtmlTag.DD);
addComment(member, dd);
dlTree.addContent(dd);
} | java | protected void addDescription(Element member, Content dlTree, SearchIndexItem si) {
si.setContainingPackage(utils.getPackageName(utils.containingPackage(member)));
si.setContainingClass(utils.getSimpleName(utils.getEnclosingTypeElement(member)));
String name = utils.getSimpleName(member);
if (utils.isExecutableElement(member)) {
ExecutableElement ee = (ExecutableElement)member;
name = name + utils.flatSignature(ee);
si.setLabel(name);
if (!((utils.signature(ee)).equals(utils.flatSignature(ee)))) {
si.setUrl(getName(getAnchor(ee)));
}
} else {
si.setLabel(name);
}
si.setCategory(resources.getText("doclet.Members"));
Content span = HtmlTree.SPAN(HtmlStyle.memberNameLink,
getDocLink(LinkInfoImpl.Kind.INDEX, member, name));
Content dt = HtmlTree.DT(span);
dt.addContent(" - ");
addMemberDesc(member, dt);
dlTree.addContent(dt);
Content dd = new HtmlTree(HtmlTag.DD);
addComment(member, dd);
dlTree.addContent(dd);
} | [
"protected",
"void",
"addDescription",
"(",
"Element",
"member",
",",
"Content",
"dlTree",
",",
"SearchIndexItem",
"si",
")",
"{",
"si",
".",
"setContainingPackage",
"(",
"utils",
".",
"getPackageName",
"(",
"utils",
".",
"containingPackage",
"(",
"member",
")",... | Add description for Class, Field, Method or Constructor.
@param member the member of the Class Kind
@param dlTree the content tree to which the description will be added
@param si search index item | [
"Add",
"description",
"for",
"Class",
"Field",
"Method",
"or",
"Constructor",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L309-L335 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.generateFilenameForKey | static String generateFilenameForKey(SQLDatabase db, String keyString)
throws NameGenerationException {
"""
Iterate candidate filenames generated from the filenameRandom generator
until we find one which doesn't already exist.
We try inserting the new record into attachments_key_filename to find a
unique filename rather than checking on disk filenames. This is because we
can make use of the fact that this method is called on a serial database
queue to make sure our name is unique, whereas we don't have that guarantee
for on-disk filenames. This works because filename is declared
UNIQUE in the attachments_key_filename table.
We allow up to 200 random name generations, which should give us many millions
of files before a name fails to be generated and makes sure this method doesn't
loop forever.
@param db database to use
@param keyString blob's key
"""
String filename = null;
long result = -1; // -1 is error for insert call
int tries = 0;
while (result == -1 && tries < 200) {
byte[] randomBytes = new byte[20];
filenameRandom.nextBytes(randomBytes);
String candidate = keyToString(randomBytes);
ContentValues contentValues = new ContentValues();
contentValues.put("key", keyString);
contentValues.put("filename", candidate);
result = db.insert(ATTACHMENTS_KEY_FILENAME, contentValues);
if (result != -1) { // i.e., insert worked, filename unique
filename = candidate;
}
tries++;
}
if (filename != null) {
return filename;
} else {
throw new NameGenerationException(String.format(
"Couldn't generate unique filename for attachment with key %s", keyString));
}
} | java | static String generateFilenameForKey(SQLDatabase db, String keyString)
throws NameGenerationException {
String filename = null;
long result = -1; // -1 is error for insert call
int tries = 0;
while (result == -1 && tries < 200) {
byte[] randomBytes = new byte[20];
filenameRandom.nextBytes(randomBytes);
String candidate = keyToString(randomBytes);
ContentValues contentValues = new ContentValues();
contentValues.put("key", keyString);
contentValues.put("filename", candidate);
result = db.insert(ATTACHMENTS_KEY_FILENAME, contentValues);
if (result != -1) { // i.e., insert worked, filename unique
filename = candidate;
}
tries++;
}
if (filename != null) {
return filename;
} else {
throw new NameGenerationException(String.format(
"Couldn't generate unique filename for attachment with key %s", keyString));
}
} | [
"static",
"String",
"generateFilenameForKey",
"(",
"SQLDatabase",
"db",
",",
"String",
"keyString",
")",
"throws",
"NameGenerationException",
"{",
"String",
"filename",
"=",
"null",
";",
"long",
"result",
"=",
"-",
"1",
";",
"// -1 is error for insert call",
"int",
... | Iterate candidate filenames generated from the filenameRandom generator
until we find one which doesn't already exist.
We try inserting the new record into attachments_key_filename to find a
unique filename rather than checking on disk filenames. This is because we
can make use of the fact that this method is called on a serial database
queue to make sure our name is unique, whereas we don't have that guarantee
for on-disk filenames. This works because filename is declared
UNIQUE in the attachments_key_filename table.
We allow up to 200 random name generations, which should give us many millions
of files before a name fails to be generated and makes sure this method doesn't
loop forever.
@param db database to use
@param keyString blob's key | [
"Iterate",
"candidate",
"filenames",
"generated",
"from",
"the",
"filenameRandom",
"generator",
"until",
"we",
"find",
"one",
"which",
"doesn",
"t",
"already",
"exist",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L552-L582 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/ogc/OGCGeometry.java | OGCGeometry.createFromEsriCursor | public static OGCGeometry createFromEsriCursor(GeometryCursor gc,
SpatialReference sr) {
"""
Create an OGCGeometry instance from the GeometryCursor.
@param gc
@param sr
@return Geometry instance created from the geometry cursor.
"""
return createFromEsriCursor(gc, sr, false);
} | java | public static OGCGeometry createFromEsriCursor(GeometryCursor gc,
SpatialReference sr) {
return createFromEsriCursor(gc, sr, false);
} | [
"public",
"static",
"OGCGeometry",
"createFromEsriCursor",
"(",
"GeometryCursor",
"gc",
",",
"SpatialReference",
"sr",
")",
"{",
"return",
"createFromEsriCursor",
"(",
"gc",
",",
"sr",
",",
"false",
")",
";",
"}"
] | Create an OGCGeometry instance from the GeometryCursor.
@param gc
@param sr
@return Geometry instance created from the geometry cursor. | [
"Create",
"an",
"OGCGeometry",
"instance",
"from",
"the",
"GeometryCursor",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/ogc/OGCGeometry.java#L563-L566 |
alkacon/opencms-core | src/org/opencms/configuration/CmsParameterConfiguration.java | CmsParameterConfiguration.countPreceding | protected static int countPreceding(String line, int index, char ch) {
"""
Counts the number of successive times 'ch' appears in the
'line' before the position indicated by the 'index'.<p>
@param line the line to count
@param index the index position to start
@param ch the character to count
@return the number of successive times 'ch' appears in the 'line'
before the position indicated by the 'index'
"""
int i;
for (i = index - 1; i >= 0; i--) {
if (line.charAt(i) != ch) {
break;
}
}
return index - 1 - i;
} | java | protected static int countPreceding(String line, int index, char ch) {
int i;
for (i = index - 1; i >= 0; i--) {
if (line.charAt(i) != ch) {
break;
}
}
return index - 1 - i;
} | [
"protected",
"static",
"int",
"countPreceding",
"(",
"String",
"line",
",",
"int",
"index",
",",
"char",
"ch",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"index",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"line",... | Counts the number of successive times 'ch' appears in the
'line' before the position indicated by the 'index'.<p>
@param line the line to count
@param index the index position to start
@param ch the character to count
@return the number of successive times 'ch' appears in the 'line'
before the position indicated by the 'index' | [
"Counts",
"the",
"number",
"of",
"successive",
"times",
"ch",
"appears",
"in",
"the",
"line",
"before",
"the",
"position",
"indicated",
"by",
"the",
"index",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsParameterConfiguration.java#L334-L343 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddZ.java | ST_AddZ.addZ | public static Geometry addZ(Geometry geometry, double z) throws SQLException {
"""
Add a z with to the existing value (do the sum). NaN values are not
updated.
@param geometry
@param z
@return
@throws java.sql.SQLException
"""
if(geometry == null){
return null;
}
geometry.apply(new AddZCoordinateSequenceFilter(z));
return geometry;
} | java | public static Geometry addZ(Geometry geometry, double z) throws SQLException {
if(geometry == null){
return null;
}
geometry.apply(new AddZCoordinateSequenceFilter(z));
return geometry;
} | [
"public",
"static",
"Geometry",
"addZ",
"(",
"Geometry",
"geometry",
",",
"double",
"z",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"geometry",
".",
"apply",
"(",
"new",
"AddZCoordinateSeq... | Add a z with to the existing value (do the sum). NaN values are not
updated.
@param geometry
@param z
@return
@throws java.sql.SQLException | [
"Add",
"a",
"z",
"with",
"to",
"the",
"existing",
"value",
"(",
"do",
"the",
"sum",
")",
".",
"NaN",
"values",
"are",
"not",
"updated",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_AddZ.java#L58-L64 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/JTables.java | JTables.setDerivedFont | private static void setDerivedFont(JTable t, float size) {
"""
Set a derived font with the given size for the given
table and its header
@param t The table
@param size The font size
"""
t.setFont(t.getFont().deriveFont(size));
t.getTableHeader().setFont(
t.getTableHeader().getFont().deriveFont(size));
} | java | private static void setDerivedFont(JTable t, float size)
{
t.setFont(t.getFont().deriveFont(size));
t.getTableHeader().setFont(
t.getTableHeader().getFont().deriveFont(size));
} | [
"private",
"static",
"void",
"setDerivedFont",
"(",
"JTable",
"t",
",",
"float",
"size",
")",
"{",
"t",
".",
"setFont",
"(",
"t",
".",
"getFont",
"(",
")",
".",
"deriveFont",
"(",
"size",
")",
")",
";",
"t",
".",
"getTableHeader",
"(",
")",
".",
"s... | Set a derived font with the given size for the given
table and its header
@param t The table
@param size The font size | [
"Set",
"a",
"derived",
"font",
"with",
"the",
"given",
"size",
"for",
"the",
"given",
"table",
"and",
"its",
"header"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTables.java#L168-L173 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java | ApplicationGatewaysInner.beginStop | public void beginStop(String resourceGroupName, String applicationGatewayName) {
"""
Stops the specified application gateway in a resource group.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
beginStopWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body();
} | java | public void beginStop(String resourceGroupName, String applicationGatewayName) {
beginStopWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body();
} | [
"public",
"void",
"beginStop",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationGatewayName",
")",
"{",
"beginStopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"applicationGatewayName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")... | Stops the specified application gateway in a resource group.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Stops",
"the",
"specified",
"application",
"gateway",
"in",
"a",
"resource",
"group",
"."
] | 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/ApplicationGatewaysInner.java#L1320-L1322 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/items/ImageItem.java | ImageItem.bindView | @Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
"""
binds the data of this item onto the viewHolder
@param viewHolder the viewHolder of this item
"""
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//define our data for the view
viewHolder.imageName.setText(mName);
viewHolder.imageDescription.setText(mDescription);
viewHolder.imageView.setImageBitmap(null);
//we pre-style our heart :D
style(viewHolder.imageLovedOn, mStarred ? 1 : 0);
style(viewHolder.imageLovedOff, mStarred ? 0 : 1);
//load glide
Glide.with(ctx).load(mImageUrl).animate(R.anim.alpha_on).into(viewHolder.imageView);
} | java | @Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//get the context
Context ctx = viewHolder.itemView.getContext();
//define our data for the view
viewHolder.imageName.setText(mName);
viewHolder.imageDescription.setText(mDescription);
viewHolder.imageView.setImageBitmap(null);
//we pre-style our heart :D
style(viewHolder.imageLovedOn, mStarred ? 1 : 0);
style(viewHolder.imageLovedOff, mStarred ? 0 : 1);
//load glide
Glide.with(ctx).load(mImageUrl).animate(R.anim.alpha_on).into(viewHolder.imageView);
} | [
"@",
"Override",
"public",
"void",
"bindView",
"(",
"ViewHolder",
"viewHolder",
",",
"List",
"<",
"Object",
">",
"payloads",
")",
"{",
"super",
".",
"bindView",
"(",
"viewHolder",
",",
"payloads",
")",
";",
"//get the context",
"Context",
"ctx",
"=",
"viewHo... | binds the data of this item onto the viewHolder
@param viewHolder the viewHolder of this item | [
"binds",
"the",
"data",
"of",
"this",
"item",
"onto",
"the",
"viewHolder"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/ImageItem.java#L85-L103 |
amaembo/streamex | src/main/java/one/util/streamex/DoubleStreamEx.java | DoubleStreamEx.maxByLong | public OptionalDouble maxByLong(DoubleToLongFunction keyExtractor) {
"""
Returns the maximum element of this stream according to the provided key
extractor function.
<p>
This is a terminal operation.
@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalDouble} describing the first element of this
stream for which the highest value was returned by key extractor,
or an empty {@code OptionalDouble} if the stream is empty
@since 0.1.2
"""
return collect(PrimitiveBox::new, (box, d) -> {
long key = keyExtractor.applyAsLong(d);
if (!box.b || box.l < key) {
box.b = true;
box.l = key;
box.d = d;
}
}, PrimitiveBox.MAX_LONG).asDouble();
} | java | public OptionalDouble maxByLong(DoubleToLongFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, d) -> {
long key = keyExtractor.applyAsLong(d);
if (!box.b || box.l < key) {
box.b = true;
box.l = key;
box.d = d;
}
}, PrimitiveBox.MAX_LONG).asDouble();
} | [
"public",
"OptionalDouble",
"maxByLong",
"(",
"DoubleToLongFunction",
"keyExtractor",
")",
"{",
"return",
"collect",
"(",
"PrimitiveBox",
"::",
"new",
",",
"(",
"box",
",",
"d",
")",
"->",
"{",
"long",
"key",
"=",
"keyExtractor",
".",
"applyAsLong",
"(",
"d"... | Returns the maximum element of this stream according to the provided key
extractor function.
<p>
This is a terminal operation.
@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalDouble} describing the first element of this
stream for which the highest value was returned by key extractor,
or an empty {@code OptionalDouble} if the stream is empty
@since 0.1.2 | [
"Returns",
"the",
"maximum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"provided",
"key",
"extractor",
"function",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L1052-L1061 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageResponse.java | MessageResponse.withResult | public MessageResponse withResult(java.util.Map<String, MessageResult> result) {
"""
A map containing a multi part response for each address, with the address as the key(Email address, phone number
or push token) and the result as the value.
@param result
A map containing a multi part response for each address, with the address as the key(Email address, phone
number or push token) and the result as the value.
@return Returns a reference to this object so that method calls can be chained together.
"""
setResult(result);
return this;
} | java | public MessageResponse withResult(java.util.Map<String, MessageResult> result) {
setResult(result);
return this;
} | [
"public",
"MessageResponse",
"withResult",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"MessageResult",
">",
"result",
")",
"{",
"setResult",
"(",
"result",
")",
";",
"return",
"this",
";",
"}"
] | A map containing a multi part response for each address, with the address as the key(Email address, phone number
or push token) and the result as the value.
@param result
A map containing a multi part response for each address, with the address as the key(Email address, phone
number or push token) and the result as the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"map",
"containing",
"a",
"multi",
"part",
"response",
"for",
"each",
"address",
"with",
"the",
"address",
"as",
"the",
"key",
"(",
"Email",
"address",
"phone",
"number",
"or",
"push",
"token",
")",
"and",
"the",
"result",
"as",
"the",
"value",
"."
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageResponse.java#L208-L211 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Parameters.java | Parameters.setBlob | @NonNull
public Parameters setBlob(@NonNull String name, Blob value) {
"""
Set the Blob value to the query parameter referenced by the given name. A query parameter
is defined by using the Expression's parameter(String name) function.
@param name The parameter name.
@param value The Blob value.
@return The self object.
"""
return setValue(name, value);
} | java | @NonNull
public Parameters setBlob(@NonNull String name, Blob value) {
return setValue(name, value);
} | [
"@",
"NonNull",
"public",
"Parameters",
"setBlob",
"(",
"@",
"NonNull",
"String",
"name",
",",
"Blob",
"value",
")",
"{",
"return",
"setValue",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set the Blob value to the query parameter referenced by the given name. A query parameter
is defined by using the Expression's parameter(String name) function.
@param name The parameter name.
@param value The Blob value.
@return The self object. | [
"Set",
"the",
"Blob",
"value",
"to",
"the",
"query",
"parameter",
"referenced",
"by",
"the",
"given",
"name",
".",
"A",
"query",
"parameter",
"is",
"defined",
"by",
"using",
"the",
"Expression",
"s",
"parameter",
"(",
"String",
"name",
")",
"function",
"."... | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L183-L186 |
ModeShape/modeshape | modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/sequencer/Sequencer.java | Sequencer.registerNamespace | protected boolean registerNamespace( String namespacePrefix,
String namespaceUri,
NamespaceRegistry namespaceRegistry ) throws RepositoryException {
"""
Registers a namespace using the given {@link NamespaceRegistry}, if the namespace has not been previously registered.
@param namespacePrefix a non-null {@code String}
@param namespaceUri a non-null {@code String}
@param namespaceRegistry a {@code NamespaceRegistry} instance.
@return true if the namespace has been registered, or false if it was already registered
@throws RepositoryException if anything fails during the registration process
"""
if (namespacePrefix == null || namespaceUri == null) {
throw new IllegalArgumentException("Neither the namespace prefix, nor the uri should be null");
}
try {
// if the call succeeds, means it was previously registered
namespaceRegistry.getPrefix(namespaceUri);
return false;
} catch (NamespaceException e) {
// namespace not registered yet
namespaceRegistry.registerNamespace(namespacePrefix, namespaceUri);
return true;
}
} | java | protected boolean registerNamespace( String namespacePrefix,
String namespaceUri,
NamespaceRegistry namespaceRegistry ) throws RepositoryException {
if (namespacePrefix == null || namespaceUri == null) {
throw new IllegalArgumentException("Neither the namespace prefix, nor the uri should be null");
}
try {
// if the call succeeds, means it was previously registered
namespaceRegistry.getPrefix(namespaceUri);
return false;
} catch (NamespaceException e) {
// namespace not registered yet
namespaceRegistry.registerNamespace(namespacePrefix, namespaceUri);
return true;
}
} | [
"protected",
"boolean",
"registerNamespace",
"(",
"String",
"namespacePrefix",
",",
"String",
"namespaceUri",
",",
"NamespaceRegistry",
"namespaceRegistry",
")",
"throws",
"RepositoryException",
"{",
"if",
"(",
"namespacePrefix",
"==",
"null",
"||",
"namespaceUri",
"=="... | Registers a namespace using the given {@link NamespaceRegistry}, if the namespace has not been previously registered.
@param namespacePrefix a non-null {@code String}
@param namespaceUri a non-null {@code String}
@param namespaceRegistry a {@code NamespaceRegistry} instance.
@return true if the namespace has been registered, or false if it was already registered
@throws RepositoryException if anything fails during the registration process | [
"Registers",
"a",
"namespace",
"using",
"the",
"given",
"{",
"@link",
"NamespaceRegistry",
"}",
"if",
"the",
"namespace",
"has",
"not",
"been",
"previously",
"registered",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/sequencer/Sequencer.java#L239-L254 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.getPath | private static String getPath(final List pathStack, final char separatorChar) {
"""
Gets path from a <code>List</code> of <code>String</code>s.
@param pathStack <code>List</code> of <code>String</code>s to be concated as a path.
@param separatorChar <code>char</code> to be used as separator between names in path
@return <code>String</code>, never <code>null</code>
"""
final StringBuilder buffer = new StringBuilder();
final Iterator iter = pathStack.iterator();
if (iter.hasNext()) {
buffer.append(iter.next());
}
while (iter.hasNext()) {
buffer.append(separatorChar);
buffer.append(iter.next());
}
return buffer.toString();
} | java | private static String getPath(final List pathStack, final char separatorChar) {
final StringBuilder buffer = new StringBuilder();
final Iterator iter = pathStack.iterator();
if (iter.hasNext()) {
buffer.append(iter.next());
}
while (iter.hasNext()) {
buffer.append(separatorChar);
buffer.append(iter.next());
}
return buffer.toString();
} | [
"private",
"static",
"String",
"getPath",
"(",
"final",
"List",
"pathStack",
",",
"final",
"char",
"separatorChar",
")",
"{",
"final",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"Iterator",
"iter",
"=",
"pathStack",
".",
... | Gets path from a <code>List</code> of <code>String</code>s.
@param pathStack <code>List</code> of <code>String</code>s to be concated as a path.
@param separatorChar <code>char</code> to be used as separator between names in path
@return <code>String</code>, never <code>null</code> | [
"Gets",
"path",
"from",
"a",
"<code",
">",
"List<",
"/",
"code",
">",
"of",
"<code",
">",
"String<",
"/",
"code",
">",
"s",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L2594-L2606 |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/CalibrationPlanarGridZhang99.java | CalibrationPlanarGridZhang99.applyDistortion | public static void applyDistortion(Point2D_F64 normPt, double[] radial, double t1 , double t2 ) {
"""
Applies radial and tangential distortion to the normalized image coordinate.
@param normPt point in normalized image coordinates
@param radial radial distortion parameters
@param t1 tangential parameter
@param t2 tangential parameter
"""
final double x = normPt.x;
final double y = normPt.y;
double a = 0;
double r2 = x*x + y*y;
double r2i = r2;
for( int i = 0; i < radial.length; i++ ) {
a += radial[i]*r2i;
r2i *= r2;
}
normPt.x = x + x*a + 2*t1*x*y + t2*(r2 + 2*x*x);
normPt.y = y + y*a + t1*(r2 + 2*y*y) + 2*t2*x*y;
} | java | public static void applyDistortion(Point2D_F64 normPt, double[] radial, double t1 , double t2 )
{
final double x = normPt.x;
final double y = normPt.y;
double a = 0;
double r2 = x*x + y*y;
double r2i = r2;
for( int i = 0; i < radial.length; i++ ) {
a += radial[i]*r2i;
r2i *= r2;
}
normPt.x = x + x*a + 2*t1*x*y + t2*(r2 + 2*x*x);
normPt.y = y + y*a + t1*(r2 + 2*y*y) + 2*t2*x*y;
} | [
"public",
"static",
"void",
"applyDistortion",
"(",
"Point2D_F64",
"normPt",
",",
"double",
"[",
"]",
"radial",
",",
"double",
"t1",
",",
"double",
"t2",
")",
"{",
"final",
"double",
"x",
"=",
"normPt",
".",
"x",
";",
"final",
"double",
"y",
"=",
"norm... | Applies radial and tangential distortion to the normalized image coordinate.
@param normPt point in normalized image coordinates
@param radial radial distortion parameters
@param t1 tangential parameter
@param t2 tangential parameter | [
"Applies",
"radial",
"and",
"tangential",
"distortion",
"to",
"the",
"normalized",
"image",
"coordinate",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/CalibrationPlanarGridZhang99.java#L303-L318 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java | WebApp.addMappingFilter | public void addMappingFilter(IServletConfig sConfig, IFilterConfig config) {
"""
Adds a filter against a specified servlet config into this context
@param sConfig
@param config
"""
IFilterMapping fmapping = new FilterMapping(null, config, sConfig);
_addMapingFilter(config, fmapping);
} | java | public void addMappingFilter(IServletConfig sConfig, IFilterConfig config) {
IFilterMapping fmapping = new FilterMapping(null, config, sConfig);
_addMapingFilter(config, fmapping);
} | [
"public",
"void",
"addMappingFilter",
"(",
"IServletConfig",
"sConfig",
",",
"IFilterConfig",
"config",
")",
"{",
"IFilterMapping",
"fmapping",
"=",
"new",
"FilterMapping",
"(",
"null",
",",
"config",
",",
"sConfig",
")",
";",
"_addMapingFilter",
"(",
"config",
... | Adds a filter against a specified servlet config into this context
@param sConfig
@param config | [
"Adds",
"a",
"filter",
"against",
"a",
"specified",
"servlet",
"config",
"into",
"this",
"context"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java#L5554-L5557 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_resiliationTerms_GET | public OvhResiliationTerms packName_resiliationTerms_GET(String packName, Date resiliationDate) throws IOException {
"""
Get resiliation terms
REST: GET /pack/xdsl/{packName}/resiliationTerms
@param resiliationDate [required] The desired resiliation date
@param packName [required] The internal name of your pack
"""
String qPath = "/pack/xdsl/{packName}/resiliationTerms";
StringBuilder sb = path(qPath, packName);
query(sb, "resiliationDate", resiliationDate);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhResiliationTerms.class);
} | java | public OvhResiliationTerms packName_resiliationTerms_GET(String packName, Date resiliationDate) throws IOException {
String qPath = "/pack/xdsl/{packName}/resiliationTerms";
StringBuilder sb = path(qPath, packName);
query(sb, "resiliationDate", resiliationDate);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhResiliationTerms.class);
} | [
"public",
"OvhResiliationTerms",
"packName_resiliationTerms_GET",
"(",
"String",
"packName",
",",
"Date",
"resiliationDate",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/resiliationTerms\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"... | Get resiliation terms
REST: GET /pack/xdsl/{packName}/resiliationTerms
@param resiliationDate [required] The desired resiliation date
@param packName [required] The internal name of your pack | [
"Get",
"resiliation",
"terms"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L743-L749 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java | AbstractLogger.catching | protected void catching(final String fqcn, final Level level, final Throwable t) {
"""
Logs a Throwable that has been caught with location information.
@param fqcn The fully qualified class name of the <b>caller</b>.
@param level The logging level.
@param t The Throwable.
"""
if (isEnabled(level, CATCHING_MARKER, (Object) null, null)) {
logMessageSafely(fqcn, level, CATCHING_MARKER, catchingMsg(t), t);
}
} | java | protected void catching(final String fqcn, final Level level, final Throwable t) {
if (isEnabled(level, CATCHING_MARKER, (Object) null, null)) {
logMessageSafely(fqcn, level, CATCHING_MARKER, catchingMsg(t), t);
}
} | [
"protected",
"void",
"catching",
"(",
"final",
"String",
"fqcn",
",",
"final",
"Level",
"level",
",",
"final",
"Throwable",
"t",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"level",
",",
"CATCHING_MARKER",
",",
"(",
"Object",
")",
"null",
",",
"null",
")",
... | Logs a Throwable that has been caught with location information.
@param fqcn The fully qualified class name of the <b>caller</b>.
@param level The logging level.
@param t The Throwable. | [
"Logs",
"a",
"Throwable",
"that",
"has",
"been",
"caught",
"with",
"location",
"information",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java#L176-L180 |
rythmengine/rythmengine | src/main/java/org/rythmengine/toString/ToStringOption.java | ToStringOption.setUpToClass | public ToStringOption setUpToClass(Class<?> c) {
"""
Return a <code>ToStringOption</code> instance with {@link #upToClass} option set.
if the current instance is not {@link #DEFAULT_OPTION default instance} then set
on the current instance and return the current instance. Otherwise, clone the default
instance and set on the clone and return the clone
@param c
@return this option instance or clone if this is the {@link #DEFAULT_OPTION}
"""
ToStringOption op = this;
if (this == DEFAULT_OPTION) {
op = new ToStringOption(this.appendStatic, this.appendTransient);
}
op.upToClass = c;
return op;
} | java | public ToStringOption setUpToClass(Class<?> c) {
ToStringOption op = this;
if (this == DEFAULT_OPTION) {
op = new ToStringOption(this.appendStatic, this.appendTransient);
}
op.upToClass = c;
return op;
} | [
"public",
"ToStringOption",
"setUpToClass",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"ToStringOption",
"op",
"=",
"this",
";",
"if",
"(",
"this",
"==",
"DEFAULT_OPTION",
")",
"{",
"op",
"=",
"new",
"ToStringOption",
"(",
"this",
".",
"appendStatic",
"... | Return a <code>ToStringOption</code> instance with {@link #upToClass} option set.
if the current instance is not {@link #DEFAULT_OPTION default instance} then set
on the current instance and return the current instance. Otherwise, clone the default
instance and set on the clone and return the clone
@param c
@return this option instance or clone if this is the {@link #DEFAULT_OPTION} | [
"Return",
"a",
"<code",
">",
"ToStringOption<",
"/",
"code",
">",
"instance",
"with",
"{",
"@link",
"#upToClass",
"}",
"option",
"set",
".",
"if",
"the",
"current",
"instance",
"is",
"not",
"{",
"@link",
"#DEFAULT_OPTION",
"default",
"instance",
"}",
"then",... | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringOption.java#L125-L132 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.setPatternFill | public void setPatternFill(PdfPatternPainter p, Color color) {
"""
Sets the fill color to an uncolored pattern.
@param p the pattern
@param color the color of the pattern
"""
if (ExtendedColor.getType(color) == ExtendedColor.TYPE_SEPARATION)
setPatternFill(p, color, ((SpotColor)color).getTint());
else
setPatternFill(p, color, 0);
} | java | public void setPatternFill(PdfPatternPainter p, Color color) {
if (ExtendedColor.getType(color) == ExtendedColor.TYPE_SEPARATION)
setPatternFill(p, color, ((SpotColor)color).getTint());
else
setPatternFill(p, color, 0);
} | [
"public",
"void",
"setPatternFill",
"(",
"PdfPatternPainter",
"p",
",",
"Color",
"color",
")",
"{",
"if",
"(",
"ExtendedColor",
".",
"getType",
"(",
"color",
")",
"==",
"ExtendedColor",
".",
"TYPE_SEPARATION",
")",
"setPatternFill",
"(",
"p",
",",
"color",
"... | Sets the fill color to an uncolored pattern.
@param p the pattern
@param color the color of the pattern | [
"Sets",
"the",
"fill",
"color",
"to",
"an",
"uncolored",
"pattern",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2343-L2348 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java | Dropbox.parseCFile | private CFile parseCFile( JSONObject jObj ) {
"""
Generates a CFile from its json representation
@param jObj JSON object representing a CFile
@return the CFile object corresponding to the JSON object
"""
CFile cfile;
if ( jObj.optBoolean( "is_dir", false ) ) {
cfile = new CFolder( new CPath( jObj.getString( "path" ) ) );
} else {
cfile = new CBlob( new CPath( jObj.getString( "path" ) ), jObj.getLong( "bytes" ), jObj.getString( "mime_type" ) );
String stringDate = jObj.getString( "modified" );
try {
// stringDate looks like: "Fri, 07 Mar 2014 17:47:55 +0000"
SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US );
Date modified = sdf.parse( stringDate );
cfile.setModificationDate( modified );
} catch ( ParseException ex ) {
throw new CStorageException( "Can't parse date modified: " + stringDate + " (" + ex.getMessage() + ")", ex );
}
}
return cfile;
} | java | private CFile parseCFile( JSONObject jObj )
{
CFile cfile;
if ( jObj.optBoolean( "is_dir", false ) ) {
cfile = new CFolder( new CPath( jObj.getString( "path" ) ) );
} else {
cfile = new CBlob( new CPath( jObj.getString( "path" ) ), jObj.getLong( "bytes" ), jObj.getString( "mime_type" ) );
String stringDate = jObj.getString( "modified" );
try {
// stringDate looks like: "Fri, 07 Mar 2014 17:47:55 +0000"
SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US );
Date modified = sdf.parse( stringDate );
cfile.setModificationDate( modified );
} catch ( ParseException ex ) {
throw new CStorageException( "Can't parse date modified: " + stringDate + " (" + ex.getMessage() + ")", ex );
}
}
return cfile;
} | [
"private",
"CFile",
"parseCFile",
"(",
"JSONObject",
"jObj",
")",
"{",
"CFile",
"cfile",
";",
"if",
"(",
"jObj",
".",
"optBoolean",
"(",
"\"is_dir\"",
",",
"false",
")",
")",
"{",
"cfile",
"=",
"new",
"CFolder",
"(",
"new",
"CPath",
"(",
"jObj",
".",
... | Generates a CFile from its json representation
@param jObj JSON object representing a CFile
@return the CFile object corresponding to the JSON object | [
"Generates",
"a",
"CFile",
"from",
"its",
"json",
"representation"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java#L447-L470 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipHandlerImpl.java | MembershipHandlerImpl.preSave | private void preSave(Membership membership, boolean isNew) throws Exception {
"""
Notifying listeners before membership creation.
@param membership
the membership which is used in create operation
@param isNew
true, if we have a deal with new membership, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event
"""
for (MembershipEventListener listener : listeners)
{
listener.preSave(membership, isNew);
}
} | java | private void preSave(Membership membership, boolean isNew) throws Exception
{
for (MembershipEventListener listener : listeners)
{
listener.preSave(membership, isNew);
}
} | [
"private",
"void",
"preSave",
"(",
"Membership",
"membership",
",",
"boolean",
"isNew",
")",
"throws",
"Exception",
"{",
"for",
"(",
"MembershipEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"preSave",
"(",
"membership",
",",
"isNew",
... | Notifying listeners before membership creation.
@param membership
the membership which is used in create operation
@param isNew
true, if we have a deal with new membership, otherwise it is false
which mean update operation is in progress
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"before",
"membership",
"creation",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipHandlerImpl.java#L704-L710 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageItemInfo.java | GoogleCloudStorageItemInfo.metadataEquals | public boolean metadataEquals(Map<String, byte[]> otherMetadata) {
"""
Helper for checking logical equality of metadata maps, checking equality of keySet() between
this.metadata and otherMetadata, and then using Arrays.equals to compare contents of
corresponding byte arrays.
"""
if (metadata == otherMetadata) {
// Fast-path for common cases where the same actual default metadata instance may be used in
// multiple different item infos.
return true;
}
// No need to check if other `metadata` is not null,
// because previous `if` checks if both of them are null.
if (metadata == null || otherMetadata == null) {
return false;
}
if (!metadata.keySet().equals(otherMetadata.keySet())) {
return false;
}
// Compare each byte[] with Arrays.equals.
for (Map.Entry<String, byte[]> metadataEntry : metadata.entrySet()) {
if (!Arrays.equals(metadataEntry.getValue(), otherMetadata.get(metadataEntry.getKey()))) {
return false;
}
}
return true;
} | java | public boolean metadataEquals(Map<String, byte[]> otherMetadata) {
if (metadata == otherMetadata) {
// Fast-path for common cases where the same actual default metadata instance may be used in
// multiple different item infos.
return true;
}
// No need to check if other `metadata` is not null,
// because previous `if` checks if both of them are null.
if (metadata == null || otherMetadata == null) {
return false;
}
if (!metadata.keySet().equals(otherMetadata.keySet())) {
return false;
}
// Compare each byte[] with Arrays.equals.
for (Map.Entry<String, byte[]> metadataEntry : metadata.entrySet()) {
if (!Arrays.equals(metadataEntry.getValue(), otherMetadata.get(metadataEntry.getKey()))) {
return false;
}
}
return true;
} | [
"public",
"boolean",
"metadataEquals",
"(",
"Map",
"<",
"String",
",",
"byte",
"[",
"]",
">",
"otherMetadata",
")",
"{",
"if",
"(",
"metadata",
"==",
"otherMetadata",
")",
"{",
"// Fast-path for common cases where the same actual default metadata instance may be used in",... | Helper for checking logical equality of metadata maps, checking equality of keySet() between
this.metadata and otherMetadata, and then using Arrays.equals to compare contents of
corresponding byte arrays. | [
"Helper",
"for",
"checking",
"logical",
"equality",
"of",
"metadata",
"maps",
"checking",
"equality",
"of",
"keySet",
"()",
"between",
"this",
".",
"metadata",
"and",
"otherMetadata",
"and",
"then",
"using",
"Arrays",
".",
"equals",
"to",
"compare",
"contents",
... | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageItemInfo.java#L317-L339 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java | ObjectUtils.getPropertyValue | @SuppressWarnings("unchecked")
public static <T, Q> T getPropertyValue(Q bean, String propertyName, Class<T> propertyType) {
"""
Gets the value of a given property into a given bean.
@param <T>
the property type.
@param <Q>
the bean type.
@param bean
the bean itself.
@param propertyName
the property name.
@param propertyType
the property type.
@return the property value.
@see PropertyAccessorFactory
"""
Assert.notNull(bean, "bean");
Assert.notNull(propertyName, "propertyName");
final PropertyAccessor propertyAccessor = PropertyAccessorFactory.forDirectFieldAccess(bean);
try {
Assert.isAssignable(propertyType, propertyAccessor.getPropertyType(propertyName));
} catch (InvalidPropertyException e) {
throw new IllegalStateException("Invalid property \"" + propertyName + "\"", e);
}
return (T) propertyAccessor.getPropertyValue(propertyName);
} | java | @SuppressWarnings("unchecked")
public static <T, Q> T getPropertyValue(Q bean, String propertyName, Class<T> propertyType) {
Assert.notNull(bean, "bean");
Assert.notNull(propertyName, "propertyName");
final PropertyAccessor propertyAccessor = PropertyAccessorFactory.forDirectFieldAccess(bean);
try {
Assert.isAssignable(propertyType, propertyAccessor.getPropertyType(propertyName));
} catch (InvalidPropertyException e) {
throw new IllegalStateException("Invalid property \"" + propertyName + "\"", e);
}
return (T) propertyAccessor.getPropertyValue(propertyName);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
",",
"Q",
">",
"T",
"getPropertyValue",
"(",
"Q",
"bean",
",",
"String",
"propertyName",
",",
"Class",
"<",
"T",
">",
"propertyType",
")",
"{",
"Assert",
".",
"notNull",
"(... | Gets the value of a given property into a given bean.
@param <T>
the property type.
@param <Q>
the bean type.
@param bean
the bean itself.
@param propertyName
the property name.
@param propertyType
the property type.
@return the property value.
@see PropertyAccessorFactory | [
"Gets",
"the",
"value",
"of",
"a",
"given",
"property",
"into",
"a",
"given",
"bean",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L88-L103 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java | MSPDIReader.readExceptions | private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc) {
"""
Reads any exceptions present in the file. This is only used in MSPDI
file versions saved by Project 2007 and later.
@param calendar XML calendar
@param bc MPXJ calendar
"""
Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions();
if (exceptions != null)
{
for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException())
{
readException(bc, exception);
}
}
} | java | private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc)
{
Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions();
if (exceptions != null)
{
for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException())
{
readException(bc, exception);
}
}
} | [
"private",
"void",
"readExceptions",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"calendar",
",",
"ProjectCalendar",
"bc",
")",
"{",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
"exceptions",
"=",
"calendar",
".",
"getExceptions",
"(",... | Reads any exceptions present in the file. This is only used in MSPDI
file versions saved by Project 2007 and later.
@param calendar XML calendar
@param bc MPXJ calendar | [
"Reads",
"any",
"exceptions",
"present",
"in",
"the",
"file",
".",
"This",
"is",
"only",
"used",
"in",
"MSPDI",
"file",
"versions",
"saved",
"by",
"Project",
"2007",
"and",
"later",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L586-L596 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java | CompareFixture.differenceBetweenExplicitWhitespaceAnd | public String differenceBetweenExplicitWhitespaceAnd(String first, String second) {
"""
Determines difference between two strings, visualizing various forms of whitespace.
@param first first string to compare.
@param second second string to compare.
@return HTML of difference between the two.
"""
Formatter whitespaceFormatter = new Formatter() {
@Override
public String format(String value) {
return explicitWhitespace(value);
}
};
return getDifferencesHtml(first, second, whitespaceFormatter);
} | java | public String differenceBetweenExplicitWhitespaceAnd(String first, String second) {
Formatter whitespaceFormatter = new Formatter() {
@Override
public String format(String value) {
return explicitWhitespace(value);
}
};
return getDifferencesHtml(first, second, whitespaceFormatter);
} | [
"public",
"String",
"differenceBetweenExplicitWhitespaceAnd",
"(",
"String",
"first",
",",
"String",
"second",
")",
"{",
"Formatter",
"whitespaceFormatter",
"=",
"new",
"Formatter",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"format",
"(",
"String",
"valu... | Determines difference between two strings, visualizing various forms of whitespace.
@param first first string to compare.
@param second second string to compare.
@return HTML of difference between the two. | [
"Determines",
"difference",
"between",
"two",
"strings",
"visualizing",
"various",
"forms",
"of",
"whitespace",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java#L37-L45 |
BigBadaboom/androidsvg | androidsvg/src/main/java/com/caverock/androidsvg/SimpleAssetResolver.java | SimpleAssetResolver.resolveFont | @Override
public Typeface resolveFont(String fontFamily, int fontWeight, String fontStyle) {
"""
Attempt to find the specified font in the "assets" folder and return a Typeface object.
For the font name "Foo", first the file "Foo.ttf" will be tried and if that fails, "Foo.otf".
"""
Log.i(TAG, "resolveFont("+fontFamily+","+fontWeight+","+fontStyle+")");
// Try font name with suffix ".ttf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".ttf");
}
catch (RuntimeException ignored) {}
// That failed, so try ".otf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".otf");
}
catch (RuntimeException e)
{
return null;
}
} | java | @Override
public Typeface resolveFont(String fontFamily, int fontWeight, String fontStyle)
{
Log.i(TAG, "resolveFont("+fontFamily+","+fontWeight+","+fontStyle+")");
// Try font name with suffix ".ttf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".ttf");
}
catch (RuntimeException ignored) {}
// That failed, so try ".otf"
try
{
return Typeface.createFromAsset(assetManager, fontFamily + ".otf");
}
catch (RuntimeException e)
{
return null;
}
} | [
"@",
"Override",
"public",
"Typeface",
"resolveFont",
"(",
"String",
"fontFamily",
",",
"int",
"fontWeight",
",",
"String",
"fontStyle",
")",
"{",
"Log",
".",
"i",
"(",
"TAG",
",",
"\"resolveFont(\"",
"+",
"fontFamily",
"+",
"\",\"",
"+",
"fontWeight",
"+",
... | Attempt to find the specified font in the "assets" folder and return a Typeface object.
For the font name "Foo", first the file "Foo.ttf" will be tried and if that fails, "Foo.otf". | [
"Attempt",
"to",
"find",
"the",
"specified",
"font",
"in",
"the",
"assets",
"folder",
"and",
"return",
"a",
"Typeface",
"object",
".",
"For",
"the",
"font",
"name",
"Foo",
"first",
"the",
"file",
"Foo",
".",
"ttf",
"will",
"be",
"tried",
"and",
"if",
"... | train | https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SimpleAssetResolver.java#L78-L99 |
jbundle/jbundle | base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java | BaseHttpTask.setStatusText | public void setStatusText(String strStatus, int iWarningLevel) {
"""
Display this status message in the status box or at the bottom of the browser.
@param bWarning If true, display a message box that the user must dismiss.
"""
if (strStatus == null)
strStatus = Constants.BLANK;
m_strCurrentStatus = strStatus;
m_iCurrentWarningLevel = iWarningLevel;
} | java | public void setStatusText(String strStatus, int iWarningLevel)
{
if (strStatus == null)
strStatus = Constants.BLANK;
m_strCurrentStatus = strStatus;
m_iCurrentWarningLevel = iWarningLevel;
} | [
"public",
"void",
"setStatusText",
"(",
"String",
"strStatus",
",",
"int",
"iWarningLevel",
")",
"{",
"if",
"(",
"strStatus",
"==",
"null",
")",
"strStatus",
"=",
"Constants",
".",
"BLANK",
";",
"m_strCurrentStatus",
"=",
"strStatus",
";",
"m_iCurrentWarningLeve... | Display this status message in the status box or at the bottom of the browser.
@param bWarning If true, display a message box that the user must dismiss. | [
"Display",
"this",
"status",
"message",
"in",
"the",
"status",
"box",
"or",
"at",
"the",
"bottom",
"of",
"the",
"browser",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L516-L522 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/BooleanTerm.java | BooleanTerm.resolveWith | public BooleanTerm resolveWith(Features features, boolean coerceUndefinedToFalse) {
"""
Applies the feature values specified in <code>features</code> to the term
and returns a new term with the resolved result. A result of null
indicates the term is false. An empty term indicates the the term is true
@param features
the varialbe names and values to resolve with
@param coerceUndefinedToFalse
if true, undefined features will be treated as false
@return the result
"""
if (isEmpty()) {
return this;
}
Set<BooleanVar> term = new HashSet<BooleanVar>();
for (BooleanVar var : this) {
if (features.contains(var.name) || coerceUndefinedToFalse) {
boolean featureState = features.isFeature(var.name);
if (featureState && var.state || !featureState && !var.state) {
// The var is true. Don't add to term
} else {
return BooleanTerm.FALSE;
}
} else {
term.add(var);
}
}
return term.isEmpty() ? BooleanTerm.TRUE : new BooleanTerm(term);
} | java | public BooleanTerm resolveWith(Features features, boolean coerceUndefinedToFalse) {
if (isEmpty()) {
return this;
}
Set<BooleanVar> term = new HashSet<BooleanVar>();
for (BooleanVar var : this) {
if (features.contains(var.name) || coerceUndefinedToFalse) {
boolean featureState = features.isFeature(var.name);
if (featureState && var.state || !featureState && !var.state) {
// The var is true. Don't add to term
} else {
return BooleanTerm.FALSE;
}
} else {
term.add(var);
}
}
return term.isEmpty() ? BooleanTerm.TRUE : new BooleanTerm(term);
} | [
"public",
"BooleanTerm",
"resolveWith",
"(",
"Features",
"features",
",",
"boolean",
"coerceUndefinedToFalse",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"Set",
"<",
"BooleanVar",
">",
"term",
"=",
"new",
"HashSet",
"<"... | Applies the feature values specified in <code>features</code> to the term
and returns a new term with the resolved result. A result of null
indicates the term is false. An empty term indicates the the term is true
@param features
the varialbe names and values to resolve with
@param coerceUndefinedToFalse
if true, undefined features will be treated as false
@return the result | [
"Applies",
"the",
"feature",
"values",
"specified",
"in",
"<code",
">",
"features<",
"/",
"code",
">",
"to",
"the",
"term",
"and",
"returns",
"a",
"new",
"term",
"with",
"the",
"resolved",
"result",
".",
"A",
"result",
"of",
"null",
"indicates",
"the",
"... | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/BooleanTerm.java#L127-L145 |
phax/ph-commons | ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java | AbstractMapBasedWALDAO.internalMarkItemUndeleted | @MustBeLocked (ELockType.WRITE)
protected final void internalMarkItemUndeleted (@Nonnull final IMPLTYPE aItem, final boolean bInvokeCallbacks) {
"""
Mark an item as "no longer deleted" without actually adding it to the map.
This method only triggers the update action but does not alter the item.
Must only be invoked inside a write-lock.
@param aItem
The item that was marked as "no longer deleted"
@param bInvokeCallbacks
<code>true</code> to invoke callbacks, <code>false</code> to not do
so.
@since 9.2.1
"""
// Trigger save changes
super.markAsChanged (aItem, EDAOActionType.UPDATE);
if (bInvokeCallbacks)
{
// Invoke callbacks
m_aCallbacks.forEach (aCB -> aCB.onMarkItemUndeleted (aItem));
}
} | java | @MustBeLocked (ELockType.WRITE)
protected final void internalMarkItemUndeleted (@Nonnull final IMPLTYPE aItem, final boolean bInvokeCallbacks)
{
// Trigger save changes
super.markAsChanged (aItem, EDAOActionType.UPDATE);
if (bInvokeCallbacks)
{
// Invoke callbacks
m_aCallbacks.forEach (aCB -> aCB.onMarkItemUndeleted (aItem));
}
} | [
"@",
"MustBeLocked",
"(",
"ELockType",
".",
"WRITE",
")",
"protected",
"final",
"void",
"internalMarkItemUndeleted",
"(",
"@",
"Nonnull",
"final",
"IMPLTYPE",
"aItem",
",",
"final",
"boolean",
"bInvokeCallbacks",
")",
"{",
"// Trigger save changes",
"super",
".",
... | Mark an item as "no longer deleted" without actually adding it to the map.
This method only triggers the update action but does not alter the item.
Must only be invoked inside a write-lock.
@param aItem
The item that was marked as "no longer deleted"
@param bInvokeCallbacks
<code>true</code> to invoke callbacks, <code>false</code> to not do
so.
@since 9.2.1 | [
"Mark",
"an",
"item",
"as",
"no",
"longer",
"deleted",
"without",
"actually",
"adding",
"it",
"to",
"the",
"map",
".",
"This",
"method",
"only",
"triggers",
"the",
"update",
"action",
"but",
"does",
"not",
"alter",
"the",
"item",
".",
"Must",
"only",
"be... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java#L493-L504 |
baneizalfe/PullToDismissPager | PullToDismissPager/src/main/java/com/mrbug/pulltodismisspager/PullToDismissPager.java | PullToDismissPager.smoothSlideTo | boolean smoothSlideTo(float slideOffset, int velocity) {
"""
Smoothly animate mDraggingPane to the target X position within its range.
@param slideOffset position to animate to
@param velocity initial velocity in case of fling, or 0.
"""
if (!isSlidingEnabled()) {
// Nothing to do.
return false;
}
int panelTop = computePanelTopPosition(slideOffset);
if (mDragHelper.smoothSlideViewTo(mSlideableView, mSlideableView.getLeft(), panelTop)) {
setAllChildrenVisible();
ViewCompat.postInvalidateOnAnimation(this);
return true;
}
return false;
} | java | boolean smoothSlideTo(float slideOffset, int velocity) {
if (!isSlidingEnabled()) {
// Nothing to do.
return false;
}
int panelTop = computePanelTopPosition(slideOffset);
if (mDragHelper.smoothSlideViewTo(mSlideableView, mSlideableView.getLeft(), panelTop)) {
setAllChildrenVisible();
ViewCompat.postInvalidateOnAnimation(this);
return true;
}
return false;
} | [
"boolean",
"smoothSlideTo",
"(",
"float",
"slideOffset",
",",
"int",
"velocity",
")",
"{",
"if",
"(",
"!",
"isSlidingEnabled",
"(",
")",
")",
"{",
"// Nothing to do.",
"return",
"false",
";",
"}",
"int",
"panelTop",
"=",
"computePanelTopPosition",
"(",
"slideO... | Smoothly animate mDraggingPane to the target X position within its range.
@param slideOffset position to animate to
@param velocity initial velocity in case of fling, or 0. | [
"Smoothly",
"animate",
"mDraggingPane",
"to",
"the",
"target",
"X",
"position",
"within",
"its",
"range",
"."
] | train | https://github.com/baneizalfe/PullToDismissPager/blob/14b12725f8ab9274b2499432d85e1b8b2b1850a5/PullToDismissPager/src/main/java/com/mrbug/pulltodismisspager/PullToDismissPager.java#L836-L849 |
epam/parso | src/main/java/com/epam/parso/impl/CSVMetadataWriterImpl.java | CSVMetadataWriterImpl.constructPropertiesString | private void constructPropertiesString(String propertyName, Object property) throws IOException {
"""
The method to output string containing information about passed property using writer.
@param propertyName the string containing name of a property.
@param property a property value.
@throws IOException appears if the output into writer is impossible.
"""
getWriter().write(propertyName + String.valueOf(property) + "\n");
} | java | private void constructPropertiesString(String propertyName, Object property) throws IOException {
getWriter().write(propertyName + String.valueOf(property) + "\n");
} | [
"private",
"void",
"constructPropertiesString",
"(",
"String",
"propertyName",
",",
"Object",
"property",
")",
"throws",
"IOException",
"{",
"getWriter",
"(",
")",
".",
"write",
"(",
"propertyName",
"+",
"String",
".",
"valueOf",
"(",
"property",
")",
"+",
"\"... | The method to output string containing information about passed property using writer.
@param propertyName the string containing name of a property.
@param property a property value.
@throws IOException appears if the output into writer is impossible. | [
"The",
"method",
"to",
"output",
"string",
"containing",
"information",
"about",
"passed",
"property",
"using",
"writer",
"."
] | train | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/CSVMetadataWriterImpl.java#L198-L200 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/comp/Infer.java | Infer.instantiatePolymorphicSignatureInstance | Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env,
MethodSymbol spMethod, // sig. poly. method or null if none
Resolve.MethodResolutionContext resolveContext,
List<Type> argtypes) {
"""
Compute a synthetic method type corresponding to the requested polymorphic
method signature. The target return type is computed from the immediately
enclosing scope surrounding the polymorphic-signature call.
"""
final Type restype;
//The return type for a polymorphic signature call is computed from
//the enclosing tree E, as follows: if E is a cast, then use the
//target type of the cast expression as a return type; if E is an
//expression statement, the return type is 'void' - otherwise the
//return type is simply 'Object'. A correctness check ensures that
//env.next refers to the lexically enclosing environment in which
//the polymorphic signature call environment is nested.
switch (env.next.tree.getTag()) {
case TYPECAST:
JCTypeCast castTree = (JCTypeCast)env.next.tree;
restype = (TreeInfo.skipParens(castTree.expr) == env.tree) ?
castTree.clazz.type :
syms.objectType;
break;
case EXEC:
JCTree.JCExpressionStatement execTree =
(JCTree.JCExpressionStatement)env.next.tree;
restype = (TreeInfo.skipParens(execTree.expr) == env.tree) ?
syms.voidType :
syms.objectType;
break;
default:
restype = syms.objectType;
}
List<Type> paramtypes = Type.map(argtypes, new ImplicitArgType(spMethod, resolveContext.step));
List<Type> exType = spMethod != null ?
spMethod.getThrownTypes() :
List.of(syms.throwableType); // make it throw all exceptions
MethodType mtype = new MethodType(paramtypes,
restype,
exType,
syms.methodClass);
return mtype;
} | java | Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env,
MethodSymbol spMethod, // sig. poly. method or null if none
Resolve.MethodResolutionContext resolveContext,
List<Type> argtypes) {
final Type restype;
//The return type for a polymorphic signature call is computed from
//the enclosing tree E, as follows: if E is a cast, then use the
//target type of the cast expression as a return type; if E is an
//expression statement, the return type is 'void' - otherwise the
//return type is simply 'Object'. A correctness check ensures that
//env.next refers to the lexically enclosing environment in which
//the polymorphic signature call environment is nested.
switch (env.next.tree.getTag()) {
case TYPECAST:
JCTypeCast castTree = (JCTypeCast)env.next.tree;
restype = (TreeInfo.skipParens(castTree.expr) == env.tree) ?
castTree.clazz.type :
syms.objectType;
break;
case EXEC:
JCTree.JCExpressionStatement execTree =
(JCTree.JCExpressionStatement)env.next.tree;
restype = (TreeInfo.skipParens(execTree.expr) == env.tree) ?
syms.voidType :
syms.objectType;
break;
default:
restype = syms.objectType;
}
List<Type> paramtypes = Type.map(argtypes, new ImplicitArgType(spMethod, resolveContext.step));
List<Type> exType = spMethod != null ?
spMethod.getThrownTypes() :
List.of(syms.throwableType); // make it throw all exceptions
MethodType mtype = new MethodType(paramtypes,
restype,
exType,
syms.methodClass);
return mtype;
} | [
"Type",
"instantiatePolymorphicSignatureInstance",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"MethodSymbol",
"spMethod",
",",
"// sig. poly. method or null if none",
"Resolve",
".",
"MethodResolutionContext",
"resolveContext",
",",
"List",
"<",
"Type",
">",
"argtyp... | Compute a synthetic method type corresponding to the requested polymorphic
method signature. The target return type is computed from the immediately
enclosing scope surrounding the polymorphic-signature call. | [
"Compute",
"a",
"synthetic",
"method",
"type",
"corresponding",
"to",
"the",
"requested",
"polymorphic",
"method",
"signature",
".",
"The",
"target",
"return",
"type",
"is",
"computed",
"from",
"the",
"immediately",
"enclosing",
"scope",
"surrounding",
"the",
"pol... | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Infer.java#L404-L446 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.flip | public static void flip(Image image, ImageOutputStream out) throws IORuntimeException {
"""
水平翻转图像,写出格式为JPG
@param image 图像
@param out 输出
@throws IORuntimeException IO异常
@since 3.2.2
"""
writeJpg(flip(image), out);
} | java | public static void flip(Image image, ImageOutputStream out) throws IORuntimeException {
writeJpg(flip(image), out);
} | [
"public",
"static",
"void",
"flip",
"(",
"Image",
"image",
",",
"ImageOutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"writeJpg",
"(",
"flip",
"(",
"image",
")",
",",
"out",
")",
";",
"}"
] | 水平翻转图像,写出格式为JPG
@param image 图像
@param out 输出
@throws IORuntimeException IO异常
@since 3.2.2 | [
"水平翻转图像,写出格式为JPG"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1106-L1108 |
yanzhenjie/SwipeRecyclerView | support/src/main/java/com/yanzhenjie/recyclerview/SwipeRecyclerView.java | SwipeRecyclerView.setSwipeItemMenuEnabled | public void setSwipeItemMenuEnabled(int position, boolean enabled) {
"""
Set the item menu to enable status.
@param position the position of the item.
@param enabled true means available, otherwise not available; default is true.
"""
if (enabled) {
if (mDisableSwipeItemMenuList.contains(position)) {
mDisableSwipeItemMenuList.remove(Integer.valueOf(position));
}
} else {
if (!mDisableSwipeItemMenuList.contains(position)) {
mDisableSwipeItemMenuList.add(position);
}
}
} | java | public void setSwipeItemMenuEnabled(int position, boolean enabled) {
if (enabled) {
if (mDisableSwipeItemMenuList.contains(position)) {
mDisableSwipeItemMenuList.remove(Integer.valueOf(position));
}
} else {
if (!mDisableSwipeItemMenuList.contains(position)) {
mDisableSwipeItemMenuList.add(position);
}
}
} | [
"public",
"void",
"setSwipeItemMenuEnabled",
"(",
"int",
"position",
",",
"boolean",
"enabled",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"if",
"(",
"mDisableSwipeItemMenuList",
".",
"contains",
"(",
"position",
")",
")",
"{",
"mDisableSwipeItemMenuList",
".",
... | Set the item menu to enable status.
@param position the position of the item.
@param enabled true means available, otherwise not available; default is true. | [
"Set",
"the",
"item",
"menu",
"to",
"enable",
"status",
"."
] | train | https://github.com/yanzhenjie/SwipeRecyclerView/blob/69aa14d05da09beaeb880240c62f7de6f4f1bb39/support/src/main/java/com/yanzhenjie/recyclerview/SwipeRecyclerView.java#L157-L167 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/parser/PdfContentReaderTool.java | PdfContentReaderTool.getDictionaryDetail | static public String getDictionaryDetail(PdfDictionary dic, int depth) {
"""
Shows the detail of a dictionary.
@param dic the dictionary of which you want the detail
@param depth the depth of the current dictionary (for nested dictionaries)
@return a String representation of the dictionary
"""
StringBuffer builder = new StringBuffer();
builder.append('(');
List subDictionaries = new ArrayList();
for (Iterator i = dic.getKeys().iterator(); i.hasNext(); ) {
PdfName key = (PdfName)i.next();
PdfObject val = dic.getDirectObject(key);
if (val.isDictionary())
subDictionaries.add(key);
builder.append(key);
builder.append('=');
builder.append(val);
builder.append(", ");
}
builder.setLength(builder.length()-2);
builder.append(')');
PdfName pdfSubDictionaryName;
for (Iterator it = subDictionaries.iterator(); it.hasNext(); ) {
pdfSubDictionaryName = (PdfName)it.next();
builder.append('\n');
for(int i = 0; i < depth+1; i++){
builder.append('\t');
}
builder.append("Subdictionary ");
builder.append(pdfSubDictionaryName);
builder.append(" = ");
builder.append(getDictionaryDetail(dic.getAsDict(pdfSubDictionaryName), depth+1));
}
return builder.toString();
} | java | static public String getDictionaryDetail(PdfDictionary dic, int depth){
StringBuffer builder = new StringBuffer();
builder.append('(');
List subDictionaries = new ArrayList();
for (Iterator i = dic.getKeys().iterator(); i.hasNext(); ) {
PdfName key = (PdfName)i.next();
PdfObject val = dic.getDirectObject(key);
if (val.isDictionary())
subDictionaries.add(key);
builder.append(key);
builder.append('=');
builder.append(val);
builder.append(", ");
}
builder.setLength(builder.length()-2);
builder.append(')');
PdfName pdfSubDictionaryName;
for (Iterator it = subDictionaries.iterator(); it.hasNext(); ) {
pdfSubDictionaryName = (PdfName)it.next();
builder.append('\n');
for(int i = 0; i < depth+1; i++){
builder.append('\t');
}
builder.append("Subdictionary ");
builder.append(pdfSubDictionaryName);
builder.append(" = ");
builder.append(getDictionaryDetail(dic.getAsDict(pdfSubDictionaryName), depth+1));
}
return builder.toString();
} | [
"static",
"public",
"String",
"getDictionaryDetail",
"(",
"PdfDictionary",
"dic",
",",
"int",
"depth",
")",
"{",
"StringBuffer",
"builder",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"List",
"subDictionaries... | Shows the detail of a dictionary.
@param dic the dictionary of which you want the detail
@param depth the depth of the current dictionary (for nested dictionaries)
@return a String representation of the dictionary | [
"Shows",
"the",
"detail",
"of",
"a",
"dictionary",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/parser/PdfContentReaderTool.java#L87-L116 |
Netflix/eureka | eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java | AwsAsgUtil.isASGEnabledinAWS | private Boolean isASGEnabledinAWS(String asgAccountid, String asgName) {
"""
Queries AWS to see if the load balancer flag is suspended.
@param asgAccountid the accountId this asg resides in, if applicable (null will use the default accountId)
@param asgName the name of the asg
@return true, if the load balancer flag is not suspended, false otherwise.
"""
try {
Stopwatch t = this.loadASGInfoTimer.start();
boolean returnValue = !isAddToLoadBalancerSuspended(asgAccountid, asgName);
t.stop();
return returnValue;
} catch (Throwable e) {
logger.error("Could not get ASG information from AWS: ", e);
}
return Boolean.TRUE;
} | java | private Boolean isASGEnabledinAWS(String asgAccountid, String asgName) {
try {
Stopwatch t = this.loadASGInfoTimer.start();
boolean returnValue = !isAddToLoadBalancerSuspended(asgAccountid, asgName);
t.stop();
return returnValue;
} catch (Throwable e) {
logger.error("Could not get ASG information from AWS: ", e);
}
return Boolean.TRUE;
} | [
"private",
"Boolean",
"isASGEnabledinAWS",
"(",
"String",
"asgAccountid",
",",
"String",
"asgName",
")",
"{",
"try",
"{",
"Stopwatch",
"t",
"=",
"this",
".",
"loadASGInfoTimer",
".",
"start",
"(",
")",
";",
"boolean",
"returnValue",
"=",
"!",
"isAddToLoadBalan... | Queries AWS to see if the load balancer flag is suspended.
@param asgAccountid the accountId this asg resides in, if applicable (null will use the default accountId)
@param asgName the name of the asg
@return true, if the load balancer flag is not suspended, false otherwise. | [
"Queries",
"AWS",
"to",
"see",
"if",
"the",
"load",
"balancer",
"flag",
"is",
"suspended",
"."
] | train | https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/aws/AwsAsgUtil.java#L326-L336 |
twitter/cloudhopper-commons | ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java | DataCoding.createMessageClassGroup | static public DataCoding createMessageClassGroup(byte characterEncoding, byte messageClass) throws IllegalArgumentException {
"""
Creates a "Message Class" group data coding scheme where 2 different
languages are supported (8BIT or DEFAULT). This method validates the
message class.
@param characterEncoding Either CHAR_ENC_DEFAULT or CHAR_ENC_8BIT
@param messageClass The 4 different possible message classes (0-3)
@return A new immutable DataCoding instance representing this data coding scheme
@throws IllegalArgumentException Thrown if the range is not supported.
"""
// only default or 8bit are valid
if (!(characterEncoding == CHAR_ENC_DEFAULT || characterEncoding == CHAR_ENC_8BIT)) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only default or 8bit supported for message class group");
}
// validate the message class
if (messageClass < 0 || messageClass > 3) {
throw new IllegalArgumentException("Invalid messageClass [0x" + HexUtil.toHexString(messageClass) + "] value used: 0x00-0x03 only valid range");
}
// need to build this dcs value (top 4 bits are 1, start with 0xF0)
byte dcs = (byte)0xF0;
// 8bit encoding means bit 2 goes on
if (characterEncoding == CHAR_ENC_8BIT) {
dcs |= (byte)0x04;
}
// merge in the message class (bottom 2 bits)
dcs |= messageClass;
return new DataCoding(dcs, Group.MESSAGE_CLASS, characterEncoding, messageClass, false);
} | java | static public DataCoding createMessageClassGroup(byte characterEncoding, byte messageClass) throws IllegalArgumentException {
// only default or 8bit are valid
if (!(characterEncoding == CHAR_ENC_DEFAULT || characterEncoding == CHAR_ENC_8BIT)) {
throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only default or 8bit supported for message class group");
}
// validate the message class
if (messageClass < 0 || messageClass > 3) {
throw new IllegalArgumentException("Invalid messageClass [0x" + HexUtil.toHexString(messageClass) + "] value used: 0x00-0x03 only valid range");
}
// need to build this dcs value (top 4 bits are 1, start with 0xF0)
byte dcs = (byte)0xF0;
// 8bit encoding means bit 2 goes on
if (characterEncoding == CHAR_ENC_8BIT) {
dcs |= (byte)0x04;
}
// merge in the message class (bottom 2 bits)
dcs |= messageClass;
return new DataCoding(dcs, Group.MESSAGE_CLASS, characterEncoding, messageClass, false);
} | [
"static",
"public",
"DataCoding",
"createMessageClassGroup",
"(",
"byte",
"characterEncoding",
",",
"byte",
"messageClass",
")",
"throws",
"IllegalArgumentException",
"{",
"// only default or 8bit are valid",
"if",
"(",
"!",
"(",
"characterEncoding",
"==",
"CHAR_ENC_DEFAULT... | Creates a "Message Class" group data coding scheme where 2 different
languages are supported (8BIT or DEFAULT). This method validates the
message class.
@param characterEncoding Either CHAR_ENC_DEFAULT or CHAR_ENC_8BIT
@param messageClass The 4 different possible message classes (0-3)
@return A new immutable DataCoding instance representing this data coding scheme
@throws IllegalArgumentException Thrown if the range is not supported. | [
"Creates",
"a",
"Message",
"Class",
"group",
"data",
"coding",
"scheme",
"where",
"2",
"different",
"languages",
"are",
"supported",
"(",
"8BIT",
"or",
"DEFAULT",
")",
".",
"This",
"method",
"validates",
"the",
"message",
"class",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L220-L242 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java | DPathUtils.getValue | public static JsonNode getValue(JsonNode node, String dPath) {
"""
Extract a value from the target {@link JsonNode} using DPath expression.
@param node
@param dPath
@since 0.6.2
"""
String[] paths = splitDpath(dPath);
Object result = node;
for (String path : paths) {
result = extractValue(result, path);
}
if (result instanceof POJONode) {
result = extractValue((POJONode) result);
}
return result != null
? result instanceof JsonNode ? ((JsonNode) result) : JacksonUtils.toJson(result)
: null;
} | java | public static JsonNode getValue(JsonNode node, String dPath) {
String[] paths = splitDpath(dPath);
Object result = node;
for (String path : paths) {
result = extractValue(result, path);
}
if (result instanceof POJONode) {
result = extractValue((POJONode) result);
}
return result != null
? result instanceof JsonNode ? ((JsonNode) result) : JacksonUtils.toJson(result)
: null;
} | [
"public",
"static",
"JsonNode",
"getValue",
"(",
"JsonNode",
"node",
",",
"String",
"dPath",
")",
"{",
"String",
"[",
"]",
"paths",
"=",
"splitDpath",
"(",
"dPath",
")",
";",
"Object",
"result",
"=",
"node",
";",
"for",
"(",
"String",
"path",
":",
"pat... | Extract a value from the target {@link JsonNode} using DPath expression.
@param node
@param dPath
@since 0.6.2 | [
"Extract",
"a",
"value",
"from",
"the",
"target",
"{",
"@link",
"JsonNode",
"}",
"using",
"DPath",
"expression",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L491-L503 |
devnull-tools/kodo | src/main/java/tools/devnull/kodo/Expectation.java | Expectation.be | public <T> Predicate<T> be(T value) {
"""
Indicates that the value should
{@link java.lang.Object#equals(Object) eq} the given value.
"""
return create(obj -> Objects.equals(obj, value));
} | java | public <T> Predicate<T> be(T value) {
return create(obj -> Objects.equals(obj, value));
} | [
"public",
"<",
"T",
">",
"Predicate",
"<",
"T",
">",
"be",
"(",
"T",
"value",
")",
"{",
"return",
"create",
"(",
"obj",
"->",
"Objects",
".",
"equals",
"(",
"obj",
",",
"value",
")",
")",
";",
"}"
] | Indicates that the value should
{@link java.lang.Object#equals(Object) eq} the given value. | [
"Indicates",
"that",
"the",
"value",
"should",
"{"
] | train | https://github.com/devnull-tools/kodo/blob/02448b8fe8308a78116de650bc077e196b100999/src/main/java/tools/devnull/kodo/Expectation.java#L57-L59 |
alkacon/opencms-core | src/org/opencms/ade/galleries/CmsGalleryService.java | CmsGalleryService.getSearch | public static CmsGallerySearchBean getSearch(HttpServletRequest request, CmsGalleryDataBean config) {
"""
Returns the initial search data.<p>
@param request the current request
@param config the gallery configuration
@return the search data
"""
CmsGalleryService srv = new CmsGalleryService();
srv.setCms(CmsFlexController.getCmsObject(request));
srv.setRequest(request);
CmsGallerySearchBean result = null;
try {
result = srv.getSearch(config);
} finally {
srv.clearThreadStorage();
}
return result;
} | java | public static CmsGallerySearchBean getSearch(HttpServletRequest request, CmsGalleryDataBean config) {
CmsGalleryService srv = new CmsGalleryService();
srv.setCms(CmsFlexController.getCmsObject(request));
srv.setRequest(request);
CmsGallerySearchBean result = null;
try {
result = srv.getSearch(config);
} finally {
srv.clearThreadStorage();
}
return result;
} | [
"public",
"static",
"CmsGallerySearchBean",
"getSearch",
"(",
"HttpServletRequest",
"request",
",",
"CmsGalleryDataBean",
"config",
")",
"{",
"CmsGalleryService",
"srv",
"=",
"new",
"CmsGalleryService",
"(",
")",
";",
"srv",
".",
"setCms",
"(",
"CmsFlexController",
... | Returns the initial search data.<p>
@param request the current request
@param config the gallery configuration
@return the search data | [
"Returns",
"the",
"initial",
"search",
"data",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L457-L469 |
otto-de/edison-hal | src/main/java/de/otto/edison/hal/paging/SkipLimitPaging.java | SkipLimitPaging.pageUri | private String pageUri(final UriTemplate uriTemplate, final int skip, final int limit) {
"""
Return the URI of the page with N skipped items and a page limitted to pages of size M.
@param uriTemplate the template used to create the link
@param skip the number of skipped items
@param limit the page size
@return href
"""
if (limit == MAX_VALUE) {
return uriTemplate.expand();
}
return uriTemplate.set(skipVar(), skip).set(limitVar(), limit).expand();
} | java | private String pageUri(final UriTemplate uriTemplate, final int skip, final int limit) {
if (limit == MAX_VALUE) {
return uriTemplate.expand();
}
return uriTemplate.set(skipVar(), skip).set(limitVar(), limit).expand();
} | [
"private",
"String",
"pageUri",
"(",
"final",
"UriTemplate",
"uriTemplate",
",",
"final",
"int",
"skip",
",",
"final",
"int",
"limit",
")",
"{",
"if",
"(",
"limit",
"==",
"MAX_VALUE",
")",
"{",
"return",
"uriTemplate",
".",
"expand",
"(",
")",
";",
"}",
... | Return the URI of the page with N skipped items and a page limitted to pages of size M.
@param uriTemplate the template used to create the link
@param skip the number of skipped items
@param limit the page size
@return href | [
"Return",
"the",
"URI",
"of",
"the",
"page",
"with",
"N",
"skipped",
"items",
"and",
"a",
"page",
"limitted",
"to",
"pages",
"of",
"size",
"M",
"."
] | train | https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/paging/SkipLimitPaging.java#L295-L300 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.