repo stringlengths 7 59 | path stringlengths 3 222 | func_name stringlengths 3 127 | original_string stringlengths 0 466k | language stringclasses 1
value | code stringlengths 0 466k | code_tokens listlengths 0 68.3k | docstring stringlengths 0 21.3k | docstring_tokens listlengths 0 1.93k | sha stringlengths 0 40 | url stringlengths 0 339 | partition stringclasses 3
values | summary stringlengths 0 250 | instruction stringlengths 38 3.13k | input stringclasses 1
value | output stringlengths 146 466k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
intellimate/Izou | src/main/java/org/intellimate/izou/security/AudioPermissionModule.java | AudioPermissionModule.registerOrThrow | private void registerOrThrow(AddOnModel addOn, String permissionMessage) throws IzouSoundPermissionException{
Function<PluginDescriptor, Boolean> checkPlayPermission = descriptor -> {
if (descriptor.getAddOnProperties() == null)
throw new IzouPermissionException("addon_config.propert... | java | private void registerOrThrow(AddOnModel addOn, String permissionMessage) throws IzouSoundPermissionException{
Function<PluginDescriptor, Boolean> checkPlayPermission = descriptor -> {
if (descriptor.getAddOnProperties() == null)
throw new IzouPermissionException("addon_config.propert... | [
"private",
"void",
"registerOrThrow",
"(",
"AddOnModel",
"addOn",
",",
"String",
"permissionMessage",
")",
"throws",
"IzouSoundPermissionException",
"{",
"Function",
"<",
"PluginDescriptor",
",",
"Boolean",
">",
"checkPlayPermission",
"=",
"descriptor",
"->",
"{",
"if... | registers the AddOn or throws the Exception
@param addOn the AddOn to register
@param permissionMessage the message of the exception
@throws IzouSoundPermissionException if not eligible for registering | [
"registers",
"the",
"AddOn",
"or",
"throws",
"the",
"Exception"
] | 40a808b97998e17655c4a78e30ce7326148aed27 | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/AudioPermissionModule.java#L54-L70 | train | Register or throw an exception if the addon has no properties. | Create a Java method that does the following: "Register or throw an exception if the addon has no properties.". | Of course, here is the Java code you requested:
```java
private void registerOrThrow(AddOnModel addOn, String permissionMessage) throws IzouSoundPermissionException{
Function<PluginDescriptor, Boolean> checkPlayPermission = descriptor -> {
if (descriptor.getAddOnProperties() == null)
... | |
deeplearning4j/deeplearning4j | datavec/datavec-spark-inference-parent/datavec-spark-inference-model/src/main/java/org/datavec/spark/transform/model/BatchCSVRecord.java | BatchCSVRecord.getRecordsAsString | public List<List<String>> getRecordsAsString() {
if(records == null)
records = new ArrayList<>();
List<List<String>> ret = new ArrayList<>();
for(SingleCSVRecord csvRecord : records) {
ret.add(csvRecord.getValues());
}
return ret;
} | java | public List<List<String>> getRecordsAsString() {
if(records == null)
records = new ArrayList<>();
List<List<String>> ret = new ArrayList<>();
for(SingleCSVRecord csvRecord : records) {
ret.add(csvRecord.getValues());
}
return ret;
} | [
"public",
"List",
"<",
"List",
"<",
"String",
">",
">",
"getRecordsAsString",
"(",
")",
"{",
"if",
"(",
"records",
"==",
"null",
")",
"records",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"List",
"<",
"String",
">",
">",
"ret",
"=",... | Get the records as a list of strings
(basically the underlying values for
{@link SingleCSVRecord})
@return | [
"Get",
"the",
"records",
"as",
"a",
"list",
"of",
"strings",
"(",
"basically",
"the",
"underlying",
"values",
"for",
"{"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark-inference-parent/datavec-spark-inference-model/src/main/java/org/datavec/spark/transform/model/BatchCSVRecord.java#L47-L55 | train | Get the records as a String list. | Create a Java method that does the following: "Get the records as a String list.". | Of course, here is the Java code you requested:
```java
public List<List<String>> getRecordsAsString() {
if(records == null)
records = new ArrayList<>();
List<List<String>> ret = new ArrayList<>();
for(SingleCSVRecord csvRecord : records) {
ret.add(csvRecord.getValues())... | |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java | CrystalCell.transfToOrthonormal | public Matrix4d transfToOrthonormal(Matrix4d m) {
Vector3d trans = new Vector3d(m.m03,m.m13,m.m23);
transfToOrthonormal(trans);
Matrix3d rot = new Matrix3d();
m.getRotationScale(rot);
// see Giacovazzo section 2.E, eq. 2.E.1
// Rprime = MT-1 * R * MT
rot.mul(this.getMTranspose());
rot.mul(this.getMTran... | java | public Matrix4d transfToOrthonormal(Matrix4d m) {
Vector3d trans = new Vector3d(m.m03,m.m13,m.m23);
transfToOrthonormal(trans);
Matrix3d rot = new Matrix3d();
m.getRotationScale(rot);
// see Giacovazzo section 2.E, eq. 2.E.1
// Rprime = MT-1 * R * MT
rot.mul(this.getMTranspose());
rot.mul(this.getMTran... | [
"public",
"Matrix4d",
"transfToOrthonormal",
"(",
"Matrix4d",
"m",
")",
"{",
"Vector3d",
"trans",
"=",
"new",
"Vector3d",
"(",
"m",
".",
"m03",
",",
"m",
".",
"m13",
",",
"m",
".",
"m23",
")",
";",
"transfToOrthonormal",
"(",
"trans",
")",
";",
"Matrix... | Transform given Matrix4d in crystal basis to the orthonormal basis using
the PDB axes convention (NCODE=1)
@param m
@return | [
"Transform",
"given",
"Matrix4d",
"in",
"crystal",
"basis",
"to",
"the",
"orthonormal",
"basis",
"using",
"the",
"PDB",
"axes",
"convention",
"(",
"NCODE",
"=",
"1",
")"
] | a1c71a8e3d40cc32104b1d387a3d3b560b43356e | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalCell.java#L280-L292 | train | Converts a matrix in this matrix to orthonormal. | Create a Java method that does the following: "Converts a matrix in this matrix to orthonormal.". | Of course, here is the Java code you requested:
```java
public Matrix4d transfToOrthonormal(Matrix4d m) {
Vector3d trans = new Vector3d(m.m03,m.m13,m.m23);
transfToOrthonormal(trans);
Matrix3d rot = new Matrix3d();
m.getRotationScale(rot);
// see Giacovazzo section 2.E, eq. 2.E.1
// Rprime = MT-1 * R * MT... | |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/viterbi/ViterbiBuilder.java | ViterbiBuilder.build | public ViterbiLattice build(String text) {
int textLength = text.length();
ViterbiLattice lattice = new ViterbiLattice(textLength + 2);
lattice.addBos();
int unknownWordEndIndex = -1; // index of the last character of unknown word
for (int startIndex = 0; startIndex < textLeng... | java | public ViterbiLattice build(String text) {
int textLength = text.length();
ViterbiLattice lattice = new ViterbiLattice(textLength + 2);
lattice.addBos();
int unknownWordEndIndex = -1; // index of the last character of unknown word
for (int startIndex = 0; startIndex < textLeng... | [
"public",
"ViterbiLattice",
"build",
"(",
"String",
"text",
")",
"{",
"int",
"textLength",
"=",
"text",
".",
"length",
"(",
")",
";",
"ViterbiLattice",
"lattice",
"=",
"new",
"ViterbiLattice",
"(",
"textLength",
"+",
"2",
")",
";",
"lattice",
".",
"addBos"... | Build lattice from input text
@param text source text for the lattice
@return built lattice, not null | [
"Build",
"lattice",
"from",
"input",
"text"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/viterbi/ViterbiBuilder.java#L70-L106 | train | Build a Viterbi lattice from a text string. | Create a Java method that does the following: "Build a Viterbi lattice from a text string.". | Of course, here is the Java code you requested:
```java
public ViterbiLattice build(String text) {
int textLength = text.length();
ViterbiLattice lattice = new ViterbiLattice(textLength + 2);
lattice.addBos();
int unknownWordEndIndex = -1; // index of the last character of unknown wor... | |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java | JComponentFactory.newInternalFrame | public static JInternalFrame newInternalFrame(final String title, final boolean resizable,
final boolean closable, final boolean maximizable, final boolean iconifiable)
{
final JInternalFrame internalFrame = new JInternalFrame(title, resizable, closable,
maximizable, iconifiable);
return internalFrame;
} | java | public static JInternalFrame newInternalFrame(final String title, final boolean resizable,
final boolean closable, final boolean maximizable, final boolean iconifiable)
{
final JInternalFrame internalFrame = new JInternalFrame(title, resizable, closable,
maximizable, iconifiable);
return internalFrame;
} | [
"public",
"static",
"JInternalFrame",
"newInternalFrame",
"(",
"final",
"String",
"title",
",",
"final",
"boolean",
"resizable",
",",
"final",
"boolean",
"closable",
",",
"final",
"boolean",
"maximizable",
",",
"final",
"boolean",
"iconifiable",
")",
"{",
"final",... | Factory method for create a {@link JInternalFrame} object.
@param title
the title
@param resizable
the resizable
@param closable
the closable
@param maximizable
the maximizable
@param iconifiable
the iconifiable
@return the new {@link JInternalFrame}. | [
"Factory",
"method",
"for",
"create",
"a",
"{",
"@link",
"JInternalFrame",
"}",
"object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java#L165-L171 | train | Create an internal frame. | Create a Java method that does the following: "Create an internal frame.". | Of course, here is the Java code you requested:
```java
public static JInternalFrame newInternalFrame(final String title, final boolean resizable,
final boolean closable, final boolean maximizable, final boolean iconifiable)
{
final JInternalFrame internalFrame = new JInternalFrame(title, resizable, closable,
... | |
jayantk/jklol | src/com/jayantkrish/jklol/models/FactorGraph.java | FactorGraph.addVariable | public FactorGraph addVariable(String variableName, Variable variable) {
Preconditions.checkArgument(!getVariables().contains(variableName));
int varNum = getAllVariables().size() > 0 ? Ints.max(getAllVariables().getVariableNumsArray()) + 1 : 0;
return addVariableWithIndex(variableName, variable, varNum);
... | java | public FactorGraph addVariable(String variableName, Variable variable) {
Preconditions.checkArgument(!getVariables().contains(variableName));
int varNum = getAllVariables().size() > 0 ? Ints.max(getAllVariables().getVariableNumsArray()) + 1 : 0;
return addVariableWithIndex(variableName, variable, varNum);
... | [
"public",
"FactorGraph",
"addVariable",
"(",
"String",
"variableName",
",",
"Variable",
"variable",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"!",
"getVariables",
"(",
")",
".",
"contains",
"(",
"variableName",
")",
")",
";",
"int",
"varNum",
"=",
... | Gets a new {@code FactorGraph} identical to this one, except with
an additional variable. The new variable is named
{@code variableName} and has type {@code variable}. Each variable
in a factor graph must have a unique name; hence {@code this}
must not already contain a variable named {@code variableName}. | [
"Gets",
"a",
"new",
"{"
] | d27532ca83e212d51066cf28f52621acc3fd44cc | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/FactorGraph.java#L457-L461 | train | Adds a variable to the factor graph. | Create a Java method that does the following: "Adds a variable to the factor graph.". | Of course, here is the Java code you requested:
```java
public FactorGraph addVariable(String variableName, Variable variable) {
Preconditions.checkArgument(!getVariables().contains(variableName));
int varNum = getAllVariables().size() > 0 ? Ints.max(getAllVariables().getVariableNumsArray()) + 1 : 0;
retur... | |
aws/aws-sdk-java | aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/transform/ContainerSettingsMarshaller.java | ContainerSettingsMarshaller.marshall | public void marshall(ContainerSettings containerSettings, ProtocolMarshaller protocolMarshaller) {
if (containerSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(containerSettings.getContain... | java | public void marshall(ContainerSettings containerSettings, ProtocolMarshaller protocolMarshaller) {
if (containerSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(containerSettings.getContain... | [
"public",
"void",
"marshall",
"(",
"ContainerSettings",
"containerSettings",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"containerSettings",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument passed to marshal... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/transform/ContainerSettingsMarshaller.java#L52-L68 | train | marshalls the given containerSettings to the JSON object. | Create a Java method that does the following: "marshalls the given containerSettings to the JSON object.". | Of course, here is the Java code you requested:
```java
public void marshall(ContainerSettings containerSettings, ProtocolMarshaller protocolMarshaller) {
if (containerSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
... | |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/ExecutionController.java | ExecutionController.getRunningFlows | @Override
public List<Integer> getRunningFlows(final int projectId, final String flowId) {
final List<Integer> executionIds = new ArrayList<>();
try {
executionIds.addAll(getRunningFlowsHelper(projectId, flowId,
this.executorLoader.fetchUnfinishedFlows().values()));
} catch (final Executor... | java | @Override
public List<Integer> getRunningFlows(final int projectId, final String flowId) {
final List<Integer> executionIds = new ArrayList<>();
try {
executionIds.addAll(getRunningFlowsHelper(projectId, flowId,
this.executorLoader.fetchUnfinishedFlows().values()));
} catch (final Executor... | [
"@",
"Override",
"public",
"List",
"<",
"Integer",
">",
"getRunningFlows",
"(",
"final",
"int",
"projectId",
",",
"final",
"String",
"flowId",
")",
"{",
"final",
"List",
"<",
"Integer",
">",
"executionIds",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"... | Gets a list of all the unfinished (both dispatched and non-dispatched) executions for a
given project and flow {@inheritDoc}.
@see azkaban.executor.ExecutorManagerAdapter#getRunningFlows(int, java.lang.String) | [
"Gets",
"a",
"list",
"of",
"all",
"the",
"unfinished",
"(",
"both",
"dispatched",
"and",
"non",
"-",
"dispatched",
")",
"executions",
"for",
"a",
"given",
"project",
"and",
"flow",
"{",
"@inheritDoc",
"}",
"."
] | d258ea7d6e66807c6eff79c5325d6d3443618dff | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/ExecutionController.java#L164-L175 | train | Get running flows. | Create a Java method that does the following: "Get running flows.". | Of course, here is the Java code you requested:
```java
@Override
public List<Integer> getRunningFlows(final int projectId, final String flowId) {
final List<Integer> executionIds = new ArrayList<>();
try {
executionIds.addAll(getRunningFlowsHelper(projectId, flowId,
this.executorLoader.fetch... | |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/dataobjects/Dataframe.java | Dataframe.copy | @Override
public Dataframe copy() {
Dataframe d = new Dataframe(configuration);
for(Map.Entry<Integer, Record> e : entries()) {
Integer rId = e.getKey();
Record r = e.getValue();
d.set(rId, r);
}
return d;
} | java | @Override
public Dataframe copy() {
Dataframe d = new Dataframe(configuration);
for(Map.Entry<Integer, Record> e : entries()) {
Integer rId = e.getKey();
Record r = e.getValue();
d.set(rId, r);
}
return d;
} | [
"@",
"Override",
"public",
"Dataframe",
"copy",
"(",
")",
"{",
"Dataframe",
"d",
"=",
"new",
"Dataframe",
"(",
"configuration",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Record",
">",
"e",
":",
"entries",
"(",
")",
")",
"{",
... | {@inheritDoc} | [
"{"
] | 909dff0476e80834f05ecdde0624dd2390e9b0ca | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/dataobjects/Dataframe.java#L758-L768 | train | Copy the dataframe. | Create a Java method that does the following: "Copy the dataframe.". | Of course, here is the Java code you requested:
```java
@Override
public Dataframe copy() {
Dataframe d = new Dataframe(configuration);
for(Map.Entry<Integer, Record> e : entries()) {
Integer rId = e.getKey();
Record r = e.getValue();
d.set(rId, r);
}
... | |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java | PhotosApi.setContentType | public Response setContentType(String photoId, JinxConstants.ContentType contentType) throws JinxException {
JinxUtils.validateParams(photoId, contentType);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.setContentType");
params.put("photo_id", photoId);
params.put... | java | public Response setContentType(String photoId, JinxConstants.ContentType contentType) throws JinxException {
JinxUtils.validateParams(photoId, contentType);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.setContentType");
params.put("photo_id", photoId);
params.put... | [
"public",
"Response",
"setContentType",
"(",
"String",
"photoId",
",",
"JinxConstants",
".",
"ContentType",
"contentType",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
",",
"contentType",
")",
";",
"Map",
"<",
"String",
... | Set the content type of a photo.
<br>
This method requires authentication with 'write' permission.
@param photoId Required. The id of the photo to set the content of.
@param contentType Required. Content type of the photo.
@return response object with the result of the requested operation.
@throws JinxException if... | [
"Set",
"the",
"content",
"type",
"of",
"a",
"photo",
".",
"<br",
">",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6 | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L886-L893 | train | Set the content type of a photo. | Create a Java method that does the following: "Set the content type of a photo.". | Of course, here is the Java code you requested:
```java
public Response setContentType(String photoId, JinxConstants.ContentType contentType) throws JinxException {
JinxUtils.validateParams(photoId, contentType);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.setContentTy... | |
aws/aws-sdk-java | aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/waf_regional/transform/CreateWebACLRequestMarshaller.java | CreateWebACLRequestMarshaller.marshall | public void marshall(CreateWebACLRequest createWebACLRequest, ProtocolMarshaller protocolMarshaller) {
if (createWebACLRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createWebACLRequest.ge... | java | public void marshall(CreateWebACLRequest createWebACLRequest, ProtocolMarshaller protocolMarshaller) {
if (createWebACLRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createWebACLRequest.ge... | [
"public",
"void",
"marshall",
"(",
"CreateWebACLRequest",
"createWebACLRequest",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"createWebACLRequest",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument passed to m... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/waf_regional/transform/CreateWebACLRequestMarshaller.java#L48-L62 | train | Creates the given parameter object. | Create a Java method that does the following: "Creates the given parameter object.". | Of course, here is the Java code you requested:
```java
public void marshall(CreateWebACLRequest createWebACLRequest, ProtocolMarshaller protocolMarshaller) {
if (createWebACLRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
... | |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java | ScriptUtil.getScript | public static ExecutableScript getScript(String language, String source, String resource, ExpressionManager expressionManager) {
return getScript(language, source, resource, expressionManager, getScriptFactory());
} | java | public static ExecutableScript getScript(String language, String source, String resource, ExpressionManager expressionManager) {
return getScript(language, source, resource, expressionManager, getScriptFactory());
} | [
"public",
"static",
"ExecutableScript",
"getScript",
"(",
"String",
"language",
",",
"String",
"source",
",",
"String",
"resource",
",",
"ExpressionManager",
"expressionManager",
")",
"{",
"return",
"getScript",
"(",
"language",
",",
"source",
",",
"resource",
","... | Creates a new {@link ExecutableScript} from a source or resource. It excepts static and
dynamic sources and resources. Dynamic means that the source or resource is an expression
which will be evaluated during execution.
@param language the language of the script
@param source the source code of the script or an expres... | [
"Creates",
"a",
"new",
"{",
"@link",
"ExecutableScript",
"}",
"from",
"a",
"source",
"or",
"resource",
".",
"It",
"excepts",
"static",
"and",
"dynamic",
"sources",
"and",
"resources",
".",
"Dynamic",
"means",
"that",
"the",
"source",
"or",
"resource",
"is",
... | 1a464fc887ef3760e53d6f91b9e5b871a0d77cc0 | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java#L49-L51 | train | Get the script from the source and resource. | Create a Java method that does the following: "Get the script from the source and resource.". | Of course, here is the Java code you requested:
```java
public static ExecutableScript getScript(String language, String source, String resource, ExpressionManager expressionManager) {
return getScript(language, source, resource, expressionManager, getScriptFactory());
}
```
Hope this helps! | |
agentsoz/jill | jill/src/main/java/io/github/agentsoz/jill/Program.java | Program.registerExtension | public static void registerExtension(JillExtension extension) {
if (extension != null) {
GlobalState.eventHandlers.add(extension);
Main.logger.info("Registered Jill extension: " + extension);
} else {
Main.logger.warn("Cannot register null extension; will ignore.");
}
} | java | public static void registerExtension(JillExtension extension) {
if (extension != null) {
GlobalState.eventHandlers.add(extension);
Main.logger.info("Registered Jill extension: " + extension);
} else {
Main.logger.warn("Cannot register null extension; will ignore.");
}
} | [
"public",
"static",
"void",
"registerExtension",
"(",
"JillExtension",
"extension",
")",
"{",
"if",
"(",
"extension",
"!=",
"null",
")",
"{",
"GlobalState",
".",
"eventHandlers",
".",
"add",
"(",
"extension",
")",
";",
"Main",
".",
"logger",
".",
"info",
"... | Registers a new Jill extension.
@param extension the extension to register | [
"Registers",
"a",
"new",
"Jill",
"extension",
"."
] | 13126fc78350465b477386132465f84cad719426 | https://github.com/agentsoz/jill/blob/13126fc78350465b477386132465f84cad719426/jill/src/main/java/io/github/agentsoz/jill/Program.java#L129-L136 | test | Register a Jill extension. | Create a Java method that does the following: "Register a Jill extension.". | Of course, here is the Java code you requested:
```java
public static void registerExtension(JillExtension extension) {
if (extension != null) {
GlobalState.eventHandlers.add(extension);
Main.logger.info("Registered Jill extension: " + extension);
} else {
Main.logger.warn("Cannot register nu... | |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/GuildWars2Utility.java | GuildWars2Utility.removeHTMLTag | public static String removeHTMLTag(String value) {
if (value == null || value.equals("")) return "";
return value.replaceAll(TAG, "");
} | java | public static String removeHTMLTag(String value) {
if (value == null || value.equals("")) return "";
return value.replaceAll(TAG, "");
} | [
"public",
"static",
"String",
"removeHTMLTag",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"equals",
"(",
"\"\"",
")",
")",
"return",
"\"\"",
";",
"return",
"value",
".",
"replaceAll",
"(",
"TAG",
",",
"\"\""... | remove HTML tag(s) from given string<br/>
ie, "<a>this</a>, that" becomes "this, that"
@param value string to strip HTML tag from
@return string without HTML tag | [
"remove",
"HTML",
"tag",
"(",
"s",
")",
"from",
"given",
"string<br",
"/",
">",
"ie",
"<a",
">",
"this<",
"/",
"a",
">",
"that",
"becomes",
"this",
"that"
] | c8a43b51f363b032074fb152ee6efe657e33e525 | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2Utility.java#L82-L85 | train | Removes HTML tags from a string. | Create a Java method that does the following: "Removes HTML tags from a string.". | Of course, here is the Java code you requested:
```java
public static String removeHTMLTag(String value) {
if (value == null || value.equals("")) return "";
return value.replaceAll(TAG, "");
}
```
Hope this helps! | |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgMap.java | JsMsgMap.put | public Object put(String key, Object value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", new Object[]{key, PasswordUtils.replaceValueIfKeyIsPassword(key,value)});
// If the value is null (which is allowed for a Map Message) we can't tell
// quickly whether... | java | public Object put(String key, Object value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", new Object[]{key, PasswordUtils.replaceValueIfKeyIsPassword(key,value)});
// If the value is null (which is allowed for a Map Message) we can't tell
// quickly whether... | [
"public",
"Object",
"put",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
... | Once we've made one update, others don't matter so save time by not checking. d317373.1 | [
"Once",
"we",
"ve",
"made",
"one",
"update",
"others",
"don",
"t",
"matter",
"so",
"save",
"time",
"by",
"not",
"checking",
".",
"d317373",
".",
"1"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMsgMap.java#L142-L168 | train | This method is used to put a value into the map. | Create a Java method that does the following: "This method is used to put a value into the map.". | Of course, here is the Java code you requested:
```java
public Object put(String key, Object value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", new Object[]{key, PasswordUtils.replaceValueIfKeyIsPassword(key,value)});
// If the value is null (which is allowe... | |
eclipse/xtext-core | org.eclipse.xtext/src-gen/org/eclipse/xtext/parser/antlr/internal/InternalXtextParser.java | InternalXtextParser.entryRuleLiteralCondition | public final EObject entryRuleLiteralCondition() throws RecognitionException {
EObject current = null;
EObject iv_ruleLiteralCondition = null;
try {
// InternalXtext.g:1711:57: (iv_ruleLiteralCondition= ruleLiteralCondition EOF )
// InternalXtext.g:1712:2: iv_ruleLiter... | java | public final EObject entryRuleLiteralCondition() throws RecognitionException {
EObject current = null;
EObject iv_ruleLiteralCondition = null;
try {
// InternalXtext.g:1711:57: (iv_ruleLiteralCondition= ruleLiteralCondition EOF )
// InternalXtext.g:1712:2: iv_ruleLiter... | [
"public",
"final",
"EObject",
"entryRuleLiteralCondition",
"(",
")",
"throws",
"RecognitionException",
"{",
"EObject",
"current",
"=",
"null",
";",
"EObject",
"iv_ruleLiteralCondition",
"=",
"null",
";",
"try",
"{",
"// InternalXtext.g:1711:57: (iv_ruleLiteralCondition= rul... | InternalXtext.g:1711:1: entryRuleLiteralCondition returns [EObject current=null] : iv_ruleLiteralCondition= ruleLiteralCondition EOF ; | [
"InternalXtext",
".",
"g",
":",
"1711",
":",
"1",
":",
"entryRuleLiteralCondition",
"returns",
"[",
"EObject",
"current",
"=",
"null",
"]",
":",
"iv_ruleLiteralCondition",
"=",
"ruleLiteralCondition",
"EOF",
";"
] | bac941cb75cb24706519845ec174cfef874d7557 | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src-gen/org/eclipse/xtext/parser/antlr/internal/InternalXtextParser.java#L4611-L4641 | train | Use this method to look for a ruleLiteralCondition in the rules. | Create a Java method that does the following: "Use this method to look for a ruleLiteralCondition in the rules.". | Of course, here is the Java code you requested:
```java
public final EObject entryRuleLiteralCondition() throws RecognitionException {
EObject current = null;
EObject iv_ruleLiteralCondition = null;
try {
// InternalXtext.g:1711:57: (iv_ruleLiteralCondition= ruleLiteralCondition ... | |
jboss/jboss-common-core | src/main/java/org/jboss/util/threadpool/BasicTaskWrapper.java | BasicTaskWrapper.taskStarted | protected boolean taskStarted()
{
try
{
task.started(getElapsedTime());
return true;
}
catch (Throwable t)
{
log.warn("Unexpected error during 'started' for task: " + taskString, t);
return false;
}
} | java | protected boolean taskStarted()
{
try
{
task.started(getElapsedTime());
return true;
}
catch (Throwable t)
{
log.warn("Unexpected error during 'started' for task: " + taskString, t);
return false;
}
} | [
"protected",
"boolean",
"taskStarted",
"(",
")",
"{",
"try",
"{",
"task",
".",
"started",
"(",
"getElapsedTime",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"warn",
"(",
"\"Unexpected error during... | Notify the task it has started
@return true when the notification succeeds, false otherwise | [
"Notify",
"the",
"task",
"it",
"has",
"started"
] | c191bb18db83fa106c6913cf34ed47989b65dc97 | https://github.com/jboss/jboss-common-core/blob/c191bb18db83fa106c6913cf34ed47989b65dc97/src/main/java/org/jboss/util/threadpool/BasicTaskWrapper.java#L339-L351 | test | Called by the TaskTracker to check if the task has started. | Create a Java method that does the following: "Called by the TaskTracker to check if the task has started.". | Of course, here is the Java code you requested:
```java
protected boolean taskStarted()
{
try
{
task.started(getElapsedTime());
return true;
}
catch (Throwable t)
{
log.warn("Unexpected error during 'started' for task: " + taskString, t);
return fals... | |
line/centraldogma | client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java | CentralDogmaEndpointGroup.ofWatcher | public static <T> CentralDogmaEndpointGroup<T> ofWatcher(Watcher<T> watcher,
EndpointListDecoder<T> endpointListDecoder) {
return new CentralDogmaEndpointGroup<>(watcher, endpointListDecoder);
} | java | public static <T> CentralDogmaEndpointGroup<T> ofWatcher(Watcher<T> watcher,
EndpointListDecoder<T> endpointListDecoder) {
return new CentralDogmaEndpointGroup<>(watcher, endpointListDecoder);
} | [
"public",
"static",
"<",
"T",
">",
"CentralDogmaEndpointGroup",
"<",
"T",
">",
"ofWatcher",
"(",
"Watcher",
"<",
"T",
">",
"watcher",
",",
"EndpointListDecoder",
"<",
"T",
">",
"endpointListDecoder",
")",
"{",
"return",
"new",
"CentralDogmaEndpointGroup",
"<>",
... | Creates a new {@link CentralDogmaEndpointGroup}.
@param watcher a {@link Watcher}
@param endpointListDecoder an {@link EndpointListDecoder} | [
"Creates",
"a",
"new",
"{",
"@link",
"CentralDogmaEndpointGroup",
"}",
"."
] | b9e46c67fbc26628c2186ce2f46e7fb303c831e9 | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/client/java-armeria/src/main/java/com/linecorp/centraldogma/client/armeria/CentralDogmaEndpointGroup.java#L70-L73 | train | Creates a new instance of Central DogmaEndpointGroup | Create a Java method that does the following: "Creates a new instance of Central DogmaEndpointGroup". | Of course, here is the Java code you requested:
```java
public static <T> CentralDogmaEndpointGroup<T> ofWatcher(Watcher<T> watcher,
EndpointListDecoder<T> endpointListDecoder) {
return new CentralDogmaEndpointGroup<>(watcher, endpointListDecoder);
... | |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/resource/PathResourceManager.java | PathResourceManager.getSymlinkBase | private SymlinkResult getSymlinkBase(final String base, final Path file) throws IOException {
int nameCount = file.getNameCount();
Path root = fileSystem.getPath(base);
int rootCount = root.getNameCount();
Path f = file;
for (int i = nameCount - 1; i>=0; i--) {
if (Fi... | java | private SymlinkResult getSymlinkBase(final String base, final Path file) throws IOException {
int nameCount = file.getNameCount();
Path root = fileSystem.getPath(base);
int rootCount = root.getNameCount();
Path f = file;
for (int i = nameCount - 1; i>=0; i--) {
if (Fi... | [
"private",
"SymlinkResult",
"getSymlinkBase",
"(",
"final",
"String",
"base",
",",
"final",
"Path",
"file",
")",
"throws",
"IOException",
"{",
"int",
"nameCount",
"=",
"file",
".",
"getNameCount",
"(",
")",
";",
"Path",
"root",
"=",
"fileSystem",
".",
"getPa... | Returns true is some element of path inside base path is a symlink. | [
"Returns",
"true",
"is",
"some",
"element",
"of",
"path",
"inside",
"base",
"path",
"is",
"a",
"symlink",
"."
] | 87de0b856a7a4ba8faf5b659537b9af07b763263 | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/resource/PathResourceManager.java#L300-L313 | train | Get the base path of a file. | Create a Java method that does the following: "Get the base path of a file.". | Of course, here is the Java code you requested:
```java
private SymlinkResult getSymlinkBase(final String base, final Path file) throws IOException {
int nameCount = file.getNameCount();
Path root = fileSystem.getPath(base);
int rootCount = root.getNameCount();
Path f = file;
fo... | |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/impl/openldap/entry/OpenLDAPModifyPasswordRequest.java | OpenLDAPModifyPasswordRequest.getEncodedValue | public byte[] getEncodedValue()
{
final String characterEncoding = this.chaiConfiguration.getSetting( ChaiSetting.LDAP_CHARACTER_ENCODING );
final byte[] password = modifyPassword.getBytes( Charset.forName( characterEncoding ) );
final byte[] dn = modifyDn.getBytes( Charset.forName( characte... | java | public byte[] getEncodedValue()
{
final String characterEncoding = this.chaiConfiguration.getSetting( ChaiSetting.LDAP_CHARACTER_ENCODING );
final byte[] password = modifyPassword.getBytes( Charset.forName( characterEncoding ) );
final byte[] dn = modifyDn.getBytes( Charset.forName( characte... | [
"public",
"byte",
"[",
"]",
"getEncodedValue",
"(",
")",
"{",
"final",
"String",
"characterEncoding",
"=",
"this",
".",
"chaiConfiguration",
".",
"getSetting",
"(",
"ChaiSetting",
".",
"LDAP_CHARACTER_ENCODING",
")",
";",
"final",
"byte",
"[",
"]",
"password",
... | Get the BER encoded value for this operation.
@return a bytearray containing the BER sequence. | [
"Get",
"the",
"BER",
"encoded",
"value",
"for",
"this",
"operation",
"."
] | a6d4b5dbfa4e270db0ce70892512cbe39e64b874 | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/impl/openldap/entry/OpenLDAPModifyPasswordRequest.java#L142-L177 | train | Get the encoded value of the
field. | Create a Java method that does the following: "Get the encoded value of the
field.". | Of course, here is the Java code you requested:
```java
public byte[] getEncodedValue()
{
final String characterEncoding = this.chaiConfiguration.getSetting( ChaiSetting.LDAP_CHARACTER_ENCODING );
final byte[] password = modifyPassword.getBytes( Charset.forName( characterEncoding ) );
final... | |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/config/YamlProperties.java | YamlProperties.getString | public String getString(String name) {
return decryptValue((String)get(name, PropType.string));
} | java | public String getString(String name) {
return decryptValue((String)get(name, PropType.string));
} | [
"public",
"String",
"getString",
"(",
"String",
"name",
")",
"{",
"return",
"decryptValue",
"(",
"(",
"String",
")",
"get",
"(",
"name",
",",
"PropType",
".",
"string",
")",
")",
";",
"}"
] | Examples:
(in mdw.yaml):
<pre>
# structured
database:
driver: org.mariadb.jdbc.Driver
# flat
hub.url: http://localhost:8080/mdw
# mixed
git:
remote.url: https://github.com/CenturyLinkCloud/mdw.git
</pre>
<code>
getString("mdw.database.driver")
getString("mdw.hub.url")
getString("mdw.git.remote.url")
</code>
@param n... | [
"Examples",
":"
] | 91167fe65a25a5d7022cdcf8b0fae8506f5b87ce | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/config/YamlProperties.java#L84-L86 | train | Get a string property. | Create a Java method that does the following: "Get a string property.". | Of course, here is the Java code you requested:
```java
public String getString(String name) {
return decryptValue((String)get(name, PropType.string));
}
```
Hope this helps! | |
jiaqi/caff | src/main/java/org/cyclopsgroup/caff/util/ByteUtils.java | ByteUtils.readLong | public static long readLong(byte[] src, int offset) throws IllegalArgumentException {
if (src.length < offset) {
throw new IllegalArgumentException("There's nothing to read in src from offset " + offset);
}
long r = 0;
for (int i = offset, j = 0; i < src.length && j < 64; i++, j += 8) {
r +... | java | public static long readLong(byte[] src, int offset) throws IllegalArgumentException {
if (src.length < offset) {
throw new IllegalArgumentException("There's nothing to read in src from offset " + offset);
}
long r = 0;
for (int i = offset, j = 0; i < src.length && j < 64; i++, j += 8) {
r +... | [
"public",
"static",
"long",
"readLong",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"offset",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"src",
".",
"length",
"<",
"offset",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"There's ... | Read long value from given source byte array
@param src Source byte array value is read from
@param offset The starting point where value is read from
@return The long value
@throws IllegalArgumentException When the length of input byte array conflicts offset | [
"Read",
"long",
"value",
"from",
"given",
"source",
"byte",
"array"
] | dba4b937a0afc844eb37ccf74dd04dd78f0c1314 | https://github.com/jiaqi/caff/blob/dba4b937a0afc844eb37ccf74dd04dd78f0c1314/src/main/java/org/cyclopsgroup/caff/util/ByteUtils.java#L41-L51 | train | Read a long from the specified byte array at the specified offset. | Create a Java method that does the following: "Read a long from the specified byte array at the specified offset.". | Of course, here is the Java code you requested:
```java
public static long readLong(byte[] src, int offset) throws IllegalArgumentException {
if (src.length < offset) {
throw new IllegalArgumentException("There's nothing to read in src from offset " + offset);
}
long r = 0;
for (int i = offset, ... | |
Koekiebox-PTY-LTD/Fluid | fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/user/LoginClient.java | LoginClient.login | public AppRequestToken login(
String usernameParam, String passwordParam) {
//Default login is for 9 hours.
return this.login(usernameParam, passwordParam, TimeUnit.HOURS.toSeconds(9));
} | java | public AppRequestToken login(
String usernameParam, String passwordParam) {
//Default login is for 9 hours.
return this.login(usernameParam, passwordParam, TimeUnit.HOURS.toSeconds(9));
} | [
"public",
"AppRequestToken",
"login",
"(",
"String",
"usernameParam",
",",
"String",
"passwordParam",
")",
"{",
"//Default login is for 9 hours.",
"return",
"this",
".",
"login",
"(",
"usernameParam",
",",
"passwordParam",
",",
"TimeUnit",
".",
"HOURS",
".",
"toSeco... | Performs the necessary login actions against Fluid.
Please note that the actual password never travels over the wire / connection.
@param usernameParam The users Username.
@param passwordParam The users password.
@return Session token.
@see AppRequestToken | [
"Performs",
"the",
"necessary",
"login",
"actions",
"against",
"Fluid",
"."
] | 81153d865f71b84ca933532c7115717bc3979270 | https://github.com/Koekiebox-PTY-LTD/Fluid/blob/81153d865f71b84ca933532c7115717bc3979270/fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/user/LoginClient.java#L191-L196 | test | Login with the username and password. | Create a Java method that does the following: "Login with the username and password.". | Of course, here is the Java code you requested:
```java
public AppRequestToken login(
String usernameParam, String passwordParam) {
//Default login is for 9 hours.
return this.login(usernameParam, passwordParam, TimeUnit.HOURS.toSeconds(9));
}
```
Hope this helps! | |
real-logic/aeron | aeron-client/src/main/java/io/aeron/ChannelUri.java | ChannelUri.channelTag | public String channelTag()
{
return (null != tags && tags.length > CHANNEL_TAG_INDEX) ? tags[CHANNEL_TAG_INDEX] : null;
} | java | public String channelTag()
{
return (null != tags && tags.length > CHANNEL_TAG_INDEX) ? tags[CHANNEL_TAG_INDEX] : null;
} | [
"public",
"String",
"channelTag",
"(",
")",
"{",
"return",
"(",
"null",
"!=",
"tags",
"&&",
"tags",
".",
"length",
">",
"CHANNEL_TAG_INDEX",
")",
"?",
"tags",
"[",
"CHANNEL_TAG_INDEX",
"]",
":",
"null",
";",
"}"
] | Get the channel tag, if it exists, that refers to an another channel.
@return channel tag if it exists or null if not in this URI.
@see CommonContext#TAGS_PARAM_NAME
@see CommonContext#TAG_PREFIX | [
"Get",
"the",
"channel",
"tag",
"if",
"it",
"exists",
"that",
"refers",
"to",
"an",
"another",
"channel",
"."
] | 045c32f0256d1ea35d562520216affc281a41239 | https://github.com/real-logic/aeron/blob/045c32f0256d1ea35d562520216affc281a41239/aeron-client/src/main/java/io/aeron/ChannelUri.java#L220-L223 | test | Returns the channel tag. | Create a Java method that does the following: "Returns the channel tag.". | Of course, here is the Java code you requested:
```java
public String channelTag()
{
return (null != tags && tags.length > CHANNEL_TAG_INDEX) ? tags[CHANNEL_TAG_INDEX] : null;
}
```
Hope this helps! | |
pmwmedia/tinylog | benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java | WritingBenchmark.byteBufferRandomAccessFile | @Benchmark
@BenchmarkMode(Mode.AverageTime)
public void byteBufferRandomAccessFile(final Configuration configuration) throws IOException {
ByteBuffer buffer = ByteBuffer.allocate(BUFFER_CAPACITY);
try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) {
for (long i = 0; i < LINES; ++i) {... | java | @Benchmark
@BenchmarkMode(Mode.AverageTime)
public void byteBufferRandomAccessFile(final Configuration configuration) throws IOException {
ByteBuffer buffer = ByteBuffer.allocate(BUFFER_CAPACITY);
try (RandomAccessFile file = new RandomAccessFile(configuration.file, "rw")) {
for (long i = 0; i < LINES; ++i) {... | [
"@",
"Benchmark",
"@",
"BenchmarkMode",
"(",
"Mode",
".",
"AverageTime",
")",
"public",
"void",
"byteBufferRandomAccessFile",
"(",
"final",
"Configuration",
"configuration",
")",
"throws",
"IOException",
"{",
"ByteBuffer",
"buffer",
"=",
"ByteBuffer",
".",
"allocate... | Benchmarks writing via {@link RandomAccessFile} with using a {@link ByteBuffer} for buffering.
@param configuration
Configuration with target file
@throws IOException
Failed to write to target file | [
"Benchmarks",
"writing",
"via",
"{",
"@link",
"RandomAccessFile",
"}",
"with",
"using",
"a",
"{",
"@link",
"ByteBuffer",
"}",
"for",
"buffering",
"."
] | d03d4ef84a1310155037e08ca8822a91697d1086 | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/benchmarks/src/main/java/org/tinylog/benchmarks/api/WritingBenchmark.java#L184-L207 | train | Benchmarks writing a byte buffer to a file. | Create a Java method that does the following: "Benchmarks writing a byte buffer to a file.". | Of course, here is the Java code you requested:
```java
@Benchmark
@BenchmarkMode(Mode.AverageTime)
public void byteBufferRandomAccessFile(final Configuration configuration) throws IOException {
ByteBuffer buffer = ByteBuffer.allocate(BUFFER_CAPACITY);
try (RandomAccessFile file = new RandomAccessFile(configura... | |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/replicator/RemoteRequest.java | RemoteRequest.setBody | protected Request.Builder setBody(Request.Builder builder) {
// NOTE: default Builder is GET
if (body != null) {
byte[] bodyBytes = null;
try {
bodyBytes = Manager.getObjectMapper().writeValueAsBytes(body);
} catch (Exception e) {
Log.e... | java | protected Request.Builder setBody(Request.Builder builder) {
// NOTE: default Builder is GET
if (body != null) {
byte[] bodyBytes = null;
try {
bodyBytes = Manager.getObjectMapper().writeValueAsBytes(body);
} catch (Exception e) {
Log.e... | [
"protected",
"Request",
".",
"Builder",
"setBody",
"(",
"Request",
".",
"Builder",
"builder",
")",
"{",
"// NOTE: default Builder is GET",
"if",
"(",
"body",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"bodyBytes",
"=",
"null",
";",
"try",
"{",
"bodyBytes",
... | set request body | [
"set",
"request",
"body"
] | 3b275642e2d2f231fd155ad9def9c5e9eff3118e | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/replicator/RemoteRequest.java#L204-L237 | train | Set the body of the request. | Create a Java method that does the following: "Set the body of the request.". | Of course, here is the Java code you requested:
```java
protected Request.Builder setBody(Request.Builder builder) {
// NOTE: default Builder is GET
if (body != null) {
byte[] bodyBytes = null;
try {
bodyBytes = Manager.getObjectMapper().writeValueAsBytes(body);
... | |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.getTroubleshooting | public TroubleshootingResultInner getTroubleshooting(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) {
return getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | java | public TroubleshootingResultInner getTroubleshooting(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) {
return getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().last().body();
} | [
"public",
"TroubleshootingResultInner",
"getTroubleshooting",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"TroubleshootingParameters",
"parameters",
")",
"{",
"return",
"getTroubleshootingWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Initiate troubleshooting on a specified resource.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher resource.
@param parameters Parameters that define the resource to troubleshoot.
@throws IllegalArgumentException thrown if parameters fail the validation... | [
"Initiate",
"troubleshooting",
"on",
"a",
"specified",
"resource",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1464-L1466 | train | Get a Troubleshooting operation. Get a Troubleshooting operation. | Create a Java method that does the following: "Get a Troubleshooting operation. Get a Troubleshooting operation.". | Of course, here is the Java code you requested:
```java
public TroubleshootingResultInner getTroubleshooting(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) {
return getTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocki... | |
protegeproject/jpaul | src/main/java/jpaul/DataStructs/MapFacts.java | MapFacts.tree | public static <K,V> MapFactory<K,V> tree(Comparator<K> comp) {
return new TreeMapFactory<K,V>(comp);
} | java | public static <K,V> MapFactory<K,V> tree(Comparator<K> comp) {
return new TreeMapFactory<K,V>(comp);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"MapFactory",
"<",
"K",
",",
"V",
">",
"tree",
"(",
"Comparator",
"<",
"K",
">",
"comp",
")",
"{",
"return",
"new",
"TreeMapFactory",
"<",
"K",
",",
"V",
">",
"(",
"comp",
")",
";",
"}"
] | Returns a map factory that generates <code>TreeMap</code>s.
<code>TreeMap</code>s are great for applications that use many
small maps.
@param comp Comparator used internally by the generated
<code>TreeMap</code>s. | [
"Returns",
"a",
"map",
"factory",
"that",
"generates",
"<code",
">",
"TreeMap<",
"/",
"code",
">",
"s",
".",
"<code",
">",
"TreeMap<",
"/",
"code",
">",
"s",
"are",
"great",
"for",
"applications",
"that",
"use",
"many",
"small",
"maps",
"."
] | db579ffb16faaa4b0c577ec82c246f7349427714 | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/MapFacts.java#L74-L76 | train | Create a tree factory. | Create a Java method that does the following: "Create a tree factory.". | Of course, here is the Java code you requested:
```java
public static <K,V> MapFactory<K,V> tree(Comparator<K> comp) {
return new TreeMapFactory<K,V>(comp);
}
```
Hope this helps! | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Write a Java program that declares a two-dimensional array of size 10,000x10,000 and initializes it with random integer values between -1,000,000 and 1,000,000. Then, calculate the sum of all the elements in the array and print it. Additionally, find the minimum and maximum values in the array and print them.
Note: Th... | To optimize the memory usage and runtime of the program, we can generate random values and calculate the sum, minimum, and maximum values of the array simultaneously without storing the entire 10,000x10,000 array in memory.
Here's the optimized Java program:
```java
import java.util.Random;
public class ArraySumMinM... | |||||||
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_GET | public OvhEasyHuntingTimeConditions billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_GET(String billingAccount, String serviceName, Long conditionId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}";
Strin... | java | public OvhEasyHuntingTimeConditions billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_GET(String billingAccount, String serviceName, Long conditionId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}";
Strin... | [
"public",
"OvhEasyHuntingTimeConditions",
"billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"conditionId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\... | Get this object properties
REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param conditionId [required] | [
"Get",
"this",
"object",
"properties"
] | 6d531a40e56e09701943e334c25f90f640c55701 | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3325-L3330 | train | Get the details of a specific time condition | Create a Java method that does the following: "Get the details of a specific time condition". | Of course, here is the Java code you requested:
```java
public OvhEasyHuntingTimeConditions billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_GET(String billingAccount, String serviceName, Long conditionId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{servi... | |
opensourceBIM/BIMserver | PluginBase/generated/org/bimserver/models/ifc4/impl/Ifc4PackageImpl.java | Ifc4PackageImpl.getIfcValveType | @Override
public EClass getIfcValveType() {
if (ifcValveTypeEClass == null) {
ifcValveTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(748);
}
return ifcValveTypeEClass;
} | java | @Override
public EClass getIfcValveType() {
if (ifcValveTypeEClass == null) {
ifcValveTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(748);
}
return ifcValveTypeEClass;
} | [
"@",
"Override",
"public",
"EClass",
"getIfcValveType",
"(",
")",
"{",
"if",
"(",
"ifcValveTypeEClass",
"==",
"null",
")",
"{",
"ifcValveTypeEClass",
"=",
"(",
"EClass",
")",
"EPackage",
".",
"Registry",
".",
"INSTANCE",
".",
"getEPackage",
"(",
"Ifc4Package",... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 116803c3047d1b32217366757cee1bb3880fda63 | https://github.com/opensourceBIM/BIMserver/blob/116803c3047d1b32217366757cee1bb3880fda63/PluginBase/generated/org/bimserver/models/ifc4/impl/Ifc4PackageImpl.java#L38022-L38029 | train | Get the IfcValveType class. | Create a Java method that does the following: "Get the IfcValveType class.". | Of course, here is the Java code you requested:
```java
@Override
public EClass getIfcValveType() {
if (ifcValveTypeEClass == null) {
ifcValveTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(748);
}
return ifcValveTypeEClass;
}
```
Hope th... | |
deeplearning4j/nd4j | nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java | SDVariable.getShape | public long[] getShape() {
long[] initialShape = sameDiff.getShapeForVarName(getVarName());
if(initialShape == null) {
val arr = getArr();
if(arr != null)
return arr.shape();
}
return initialShape;
} | java | public long[] getShape() {
long[] initialShape = sameDiff.getShapeForVarName(getVarName());
if(initialShape == null) {
val arr = getArr();
if(arr != null)
return arr.shape();
}
return initialShape;
} | [
"public",
"long",
"[",
"]",
"getShape",
"(",
")",
"{",
"long",
"[",
"]",
"initialShape",
"=",
"sameDiff",
".",
"getShapeForVarName",
"(",
"getVarName",
"(",
")",
")",
";",
"if",
"(",
"initialShape",
"==",
"null",
")",
"{",
"val",
"arr",
"=",
"getArr",
... | Returns the shape of this variable
@return | [
"Returns",
"the",
"shape",
"of",
"this",
"variable"
] | 8f005bcecb240d1fbb83b9d390ad801d1d3b6933 | https://github.com/deeplearning4j/nd4j/blob/8f005bcecb240d1fbb83b9d390ad801d1d3b6933/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L233-L242 | test | Get the shape of the image. | Create a Java method that does the following: "Get the shape of the image.". | Of course, here is the Java code you requested:
```java
public long[] getShape() {
long[] initialShape = sameDiff.getShapeForVarName(getVarName());
if(initialShape == null) {
val arr = getArr();
if(arr != null)
return arr.shape();
}
return initi... | |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/collections/JMListTimeSeries.java | JMListTimeSeries.addAll | public void addAll(long timestamp, List<T> objectList) {
for (T object : objectList)
add(timestamp, object);
}
/*
* (non-Javadoc)
*
* @see kr.jm.utils.collections.JMTimeSeries#toString()
*/
@Override
public String toString() {
return "JMListTimeSeries(intervalSeconds=" + getIntervalSeconds(... | java | public void addAll(long timestamp, List<T> objectList) {
for (T object : objectList)
add(timestamp, object);
}
/*
* (non-Javadoc)
*
* @see kr.jm.utils.collections.JMTimeSeries#toString()
*/
@Override
public String toString() {
return "JMListTimeSeries(intervalSeconds=" + getIntervalSeconds(... | [
"public",
"void",
"addAll",
"(",
"long",
"timestamp",
",",
"List",
"<",
"T",
">",
"objectList",
")",
"{",
"for",
"(",
"T",
"object",
":",
"objectList",
")",
"add",
"(",
"timestamp",
",",
"object",
")",
";",
"}",
"/*\n\t * (non-Javadoc)\n *\n * @see k... | Add all.
@param timestamp the timestamp
@param objectList the object list | [
"Add",
"all",
"."
] | 9e407b3f28a7990418a1e877229fa8344f4d78a5 | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/collections/JMListTimeSeries.java#L41-L57 | train | Add all objects in the objectList to this TimeSeries. | Create a Java method that does the following: "Add all objects in the objectList to this TimeSeries.". | Of course, here is the Java code you requested:
```java
public void addAll(long timestamp, List<T> objectList) {
for (T object : objectList)
add(timestamp, object);
}
/*
* (non-Javadoc)
*
* @see kr.jm.utils.collections.JMTimeSeries#toString()
*/
@Override
public String toString() {
return ... | |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/checkutil/CheckUtil.java | CheckUtil.checkAdd | public static boolean checkAdd(INDArray first, INDArray second, double maxRelativeDifference,
double minAbsDifference) {
RealMatrix rmFirst = convertToApacheMatrix(first);
RealMatrix rmSecond = convertToApacheMatrix(second);
INDArray result = first.add(second);
RealM... | java | public static boolean checkAdd(INDArray first, INDArray second, double maxRelativeDifference,
double minAbsDifference) {
RealMatrix rmFirst = convertToApacheMatrix(first);
RealMatrix rmSecond = convertToApacheMatrix(second);
INDArray result = first.add(second);
RealM... | [
"public",
"static",
"boolean",
"checkAdd",
"(",
"INDArray",
"first",
",",
"INDArray",
"second",
",",
"double",
"maxRelativeDifference",
",",
"double",
"minAbsDifference",
")",
"{",
"RealMatrix",
"rmFirst",
"=",
"convertToApacheMatrix",
"(",
"first",
")",
";",
"Rea... | Same as checkMmul, but for matrix addition | [
"Same",
"as",
"checkMmul",
"but",
"for",
"matrix",
"addition"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/checkutil/CheckUtil.java#L112-L128 | train | Add to a single attribute of a single attribute matrix | Create a Java method that does the following: "Add to a single attribute of a single attribute matrix". | Of course, here is the Java code you requested:
```java
public static boolean checkAdd(INDArray first, INDArray second, double maxRelativeDifference,
double minAbsDifference) {
RealMatrix rmFirst = convertToApacheMatrix(first);
RealMatrix rmSecond = convertToApacheMatrix(second);
... | |
jboss/jboss-common-core | src/main/java/org/jboss/util/graph/Graph.java | Graph.addEdge | public boolean addEdge(Vertex<T> from, Vertex<T> to, int cost)
throws IllegalArgumentException
{
if( verticies.containsValue(from) == false )
throw new IllegalArgumentException("from is not in graph");
if( verticies.containsValue(to) == false )
throw new IllegalArgumentException("... | java | public boolean addEdge(Vertex<T> from, Vertex<T> to, int cost)
throws IllegalArgumentException
{
if( verticies.containsValue(from) == false )
throw new IllegalArgumentException("from is not in graph");
if( verticies.containsValue(to) == false )
throw new IllegalArgumentException("... | [
"public",
"boolean",
"addEdge",
"(",
"Vertex",
"<",
"T",
">",
"from",
",",
"Vertex",
"<",
"T",
">",
"to",
",",
"int",
"cost",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"verticies",
".",
"containsValue",
"(",
"from",
")",
"==",
"false",
... | Insert a directed, weighted Edge<T> into the graph.
@param from - the Edge<T> starting vertex
@param to - the Edge<T> ending vertex
@param cost - the Edge<T> weight/cost
@return true if the Edge<T> was added, false if from already has this Edge<T>
@throws IllegalArgumentException if from/to are not verticies in
the gr... | [
"Insert",
"a",
"directed",
"weighted",
"Edge<T",
">",
"into",
"the",
"graph",
"."
] | c191bb18db83fa106c6913cf34ed47989b65dc97 | https://github.com/jboss/jboss-common-core/blob/c191bb18db83fa106c6913cf34ed47989b65dc97/src/main/java/org/jboss/util/graph/Graph.java#L144-L162 | test | Add an edge between two vertices. | Create a Java method that does the following: "Add an edge between two vertices.". | Of course, here is the Java code you requested:
```java
public boolean addEdge(Vertex<T> from, Vertex<T> to, int cost)
throws IllegalArgumentException
{
if( verticies.containsValue(from) == false )
throw new IllegalArgumentException("from is not in graph");
if( verticies.containsValue(to)... | |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/BrokerHelper.java | BrokerHelper.assertValidPksForStore | public boolean assertValidPksForStore(FieldDescriptor[] fieldDescriptors, Object[] pkValues)
{
int fieldDescriptorSize = fieldDescriptors.length;
for(int i = 0; i < fieldDescriptorSize; i++)
{
FieldDescriptor fld = fieldDescriptors[i];
/**
* a pk f... | java | public boolean assertValidPksForStore(FieldDescriptor[] fieldDescriptors, Object[] pkValues)
{
int fieldDescriptorSize = fieldDescriptors.length;
for(int i = 0; i < fieldDescriptorSize; i++)
{
FieldDescriptor fld = fieldDescriptors[i];
/**
* a pk f... | [
"public",
"boolean",
"assertValidPksForStore",
"(",
"FieldDescriptor",
"[",
"]",
"fieldDescriptors",
",",
"Object",
"[",
"]",
"pkValues",
")",
"{",
"int",
"fieldDescriptorSize",
"=",
"fieldDescriptors",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | returns true if the primary key fields are valid for store, else false.
PK fields are valid if each of them is either an OJB managed
attribute (autoincrement or locking) or if it contains
a valid non-null value
@param fieldDescriptors the array of PK fielddescriptors
@param pkValues the array of PK values
@return boole... | [
"returns",
"true",
"if",
"the",
"primary",
"key",
"fields",
"are",
"valid",
"for",
"store",
"else",
"false",
".",
"PK",
"fields",
"are",
"valid",
"if",
"each",
"of",
"them",
"is",
"either",
"an",
"OJB",
"managed",
"attribute",
"(",
"autoincrement",
"or",
... | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L447-L466 | train | Assert that the specified PK values are valid for a single
CTYPE. | Create a Java method that does the following: "Assert that the specified PK values are valid for a single
CTYPE.". | Of course, here is the Java code you requested:
```java
public boolean assertValidPksForStore(FieldDescriptor[] fieldDescriptors, Object[] pkValues)
{
int fieldDescriptorSize = fieldDescriptors.length;
for(int i = 0; i < fieldDescriptorSize; i++)
{
FieldDescriptor fld = fie... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Create a class in Java that prints the Fibonacci sequence up to a given number, where the input number is greater than or equal to 2. | Here's an example of a Java class that prints the Fibonacci sequence up to a given number:
```java
public class Fibonacci {
public static void main(String[] args) {
int n = 10; // change this to the desired number
if (n < 2) {
System.out.println("Input number should be greater than or e... | |||||||
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java | PrivacyListManager.declineDefaultList | public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineDefaultList(true);
// Send the package to... | java | public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineDefaultList(true);
// Send the package to... | [
"public",
"void",
"declineDefaultList",
"(",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// The request of the list is an privacy message with an empty list",
"Privacy",
"request",
"=",
"new",
... | Client declines the use of default lists.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Client",
"declines",
"the",
"use",
"of",
"default",
"lists",
"."
] | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java#L487-L494 | train | Declines the default list of the CID language. | Create a Java method that does the following: "Declines the default list of the CID language.". | Of course, here is the Java code you requested:
```java
public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.set... | |
boonproject/boon | boon/src/main/java/org/boon/cache/FastConcurrentReadLruLfuFifoCache.java | FastConcurrentReadLruLfuFifoCache.order | private final int order() {
int order = count.incrementAndGet();
if ( order > Integer.MAX_VALUE - 100 ) {
count.set( 0 );
}
return order;
} | java | private final int order() {
int order = count.incrementAndGet();
if ( order > Integer.MAX_VALUE - 100 ) {
count.set( 0 );
}
return order;
} | [
"private",
"final",
"int",
"order",
"(",
")",
"{",
"int",
"order",
"=",
"count",
".",
"incrementAndGet",
"(",
")",
";",
"if",
"(",
"order",
">",
"Integer",
".",
"MAX_VALUE",
"-",
"100",
")",
"{",
"count",
".",
"set",
"(",
"0",
")",
";",
"}",
"ret... | Avoid overflow. | [
"Avoid",
"overflow",
"."
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/cache/FastConcurrentReadLruLfuFifoCache.java#L217-L223 | test | Get the order of the result set. | Create a Java method that does the following: "Get the order of the result set.". | Of course, here is the Java code you requested:
```java
private final int order() {
int order = count.incrementAndGet();
if ( order > Integer.MAX_VALUE - 100 ) {
count.set( 0 );
}
return order;
}
```
Hope this helps! | |
prestodb/presto | presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java | HiveSplitManager.partitionExponentially | private static <T> Iterable<List<T>> partitionExponentially(List<T> values, int minBatchSize, int maxBatchSize)
{
return () -> new AbstractIterator<List<T>>()
{
private int currentSize = minBatchSize;
private final Iterator<T> iterator = values.iterator();
@Overr... | java | private static <T> Iterable<List<T>> partitionExponentially(List<T> values, int minBatchSize, int maxBatchSize)
{
return () -> new AbstractIterator<List<T>>()
{
private int currentSize = minBatchSize;
private final Iterator<T> iterator = values.iterator();
@Overr... | [
"private",
"static",
"<",
"T",
">",
"Iterable",
"<",
"List",
"<",
"T",
">",
">",
"partitionExponentially",
"(",
"List",
"<",
"T",
">",
"values",
",",
"int",
"minBatchSize",
",",
"int",
"maxBatchSize",
")",
"{",
"return",
"(",
")",
"->",
"new",
"Abstrac... | Partition the given list in exponentially (power of 2) increasing batch sizes starting at 1 up to maxBatchSize | [
"Partition",
"the",
"given",
"list",
"in",
"exponentially",
"(",
"power",
"of",
"2",
")",
"increasing",
"batch",
"sizes",
"starting",
"at",
"1",
"up",
"to",
"maxBatchSize"
] | 89de5e379d8f85e139d292b0add8c537a2a01a88 | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/HiveSplitManager.java#L389-L414 | train | Partition the list of objects in an exponential fashion. | Create a Java method that does the following: "Partition the list of objects in an exponential fashion.". | Of course, here is the Java code you requested:
```java
private static <T> Iterable<List<T>> partitionExponentially(List<T> values, int minBatchSize, int maxBatchSize)
{
return () -> new AbstractIterator<List<T>>()
{
private int currentSize = minBatchSize;
private final Iter... | |
NICTA/t3as-snomedct-service | snomed-coder-common/src/main/java/org/t3as/metamap/SemanticTypes.java | SemanticTypes.sanitiseSemanticTypes | public static Collection<String> sanitiseSemanticTypes(final Collection<String> semanticTypes) {
if (semanticTypes == null) return ImmutableList.of();
// check that each of the given types are in the map we have, otherwise throw it away
final Set<String> s = new LinkedHashSet<>(semanticTypes);
... | java | public static Collection<String> sanitiseSemanticTypes(final Collection<String> semanticTypes) {
if (semanticTypes == null) return ImmutableList.of();
// check that each of the given types are in the map we have, otherwise throw it away
final Set<String> s = new LinkedHashSet<>(semanticTypes);
... | [
"public",
"static",
"Collection",
"<",
"String",
">",
"sanitiseSemanticTypes",
"(",
"final",
"Collection",
"<",
"String",
">",
"semanticTypes",
")",
"{",
"if",
"(",
"semanticTypes",
"==",
"null",
")",
"return",
"ImmutableList",
".",
"of",
"(",
")",
";",
"// ... | Sanitise semantic types from user input.
@param semanticTypes the semantic types to be sanitised
@return a non-null but possibly empty Collection of semantic types | [
"Sanitise",
"semantic",
"types",
"from",
"user",
"input",
"."
] | 70a82d5c889f97eef2d17a648970575c152983e9 | https://github.com/NICTA/t3as-snomedct-service/blob/70a82d5c889f97eef2d17a648970575c152983e9/snomed-coder-common/src/main/java/org/t3as/metamap/SemanticTypes.java#L93-L99 | train | Sanitize the given collection of semantic types. | Create a Java method that does the following: "Sanitize the given collection of semantic types.". | Of course, here is the Java code you requested:
```java
public static Collection<String> sanitiseSemanticTypes(final Collection<String> semanticTypes) {
if (semanticTypes == null) return ImmutableList.of();
// check that each of the given types are in the map we have, otherwise throw it away
f... | |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/application/_NavigationUtils.java | _NavigationUtils.getEvaluatedNavigationParameters | public static Map<String, List<String> > getEvaluatedNavigationParameters(
FacesContext facesContext,
Map<String, List<String> > parameters)
{
Map<String,List<String>> evaluatedParameters = null;
if (parameters != null && parameters.size() > 0)
{
evaluate... | java | public static Map<String, List<String> > getEvaluatedNavigationParameters(
FacesContext facesContext,
Map<String, List<String> > parameters)
{
Map<String,List<String>> evaluatedParameters = null;
if (parameters != null && parameters.size() > 0)
{
evaluate... | [
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"getEvaluatedNavigationParameters",
"(",
"FacesContext",
"facesContext",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"parameters",
")",
"{",
"Map",
"<",
"S... | Evaluate all EL expressions found as parameters and return a map that can be used for
redirect or render bookmark links
@param parameters parameter map retrieved from NavigationCase.getParameters()
@return | [
"Evaluate",
"all",
"EL",
"expressions",
"found",
"as",
"parameters",
"and",
"return",
"a",
"map",
"that",
"can",
"be",
"used",
"for",
"redirect",
"or",
"render",
"bookmark",
"links"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/application/_NavigationUtils.java#L37-L72 | train | Evaluate the parameters for a navigation. | Create a Java method that does the following: "Evaluate the parameters for a navigation.". | Of course, here is the Java code you requested:
```java
public static Map<String, List<String> > getEvaluatedNavigationParameters(
FacesContext facesContext,
Map<String, List<String> > parameters)
{
Map<String,List<String>> evaluatedParameters = null;
if (parameters != null... | |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java | IntegralImageOps.convolveBorder | public static GrayF32 convolveBorder(GrayF32 integral ,
IntegralKernel kernel ,
GrayF32 output , int borderX , int borderY )
{
output = InputSanityCheck.checkDeclare(integral,output);
if(BoofConcurrency.USE_CONCURRENT) {
ImplIntegralImageConvolve_MT.convolveBorder(integral, kernel, output... | java | public static GrayF32 convolveBorder(GrayF32 integral ,
IntegralKernel kernel ,
GrayF32 output , int borderX , int borderY )
{
output = InputSanityCheck.checkDeclare(integral,output);
if(BoofConcurrency.USE_CONCURRENT) {
ImplIntegralImageConvolve_MT.convolveBorder(integral, kernel, output... | [
"public",
"static",
"GrayF32",
"convolveBorder",
"(",
"GrayF32",
"integral",
",",
"IntegralKernel",
"kernel",
",",
"GrayF32",
"output",
",",
"int",
"borderX",
",",
"int",
"borderY",
")",
"{",
"output",
"=",
"InputSanityCheck",
".",
"checkDeclare",
"(",
"integral... | Convolves the kernel only across the image's border.
@param integral Integral image. Not modified.
@param kernel Convolution kernel.
@param output The convolved image. If null a new image will be created. Modified.
@param borderX Size of the image border along the horizontal axis.
@param borderY size of the image bord... | [
"Convolves",
"the",
"kernel",
"only",
"across",
"the",
"image",
"s",
"border",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L216-L229 | train | Convolves the image using the kernel and the border of the image. | Create a Java method that does the following: "Convolves the image using the kernel and the border of the image.". | Of course, here is the Java code you requested:
```java
public static GrayF32 convolveBorder(GrayF32 integral ,
IntegralKernel kernel ,
GrayF32 output , int borderX , int borderY )
{
output = InputSanityCheck.checkDeclare(integral,output);
if(BoofConcurrency.USE_CONCURRENT) {
ImplIntegra... | |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Emitter.java | Emitter.emit | public void emit(final StringBuilder out, final Block root)
{
root.removeSurroundingEmptyLines();
switch (root.type)
{
case RULER:
this.config.decorator.horizontalRuler(out);
return;
case NONE:
case XML:
break;
case HEADLIN... | java | public void emit(final StringBuilder out, final Block root)
{
root.removeSurroundingEmptyLines();
switch (root.type)
{
case RULER:
this.config.decorator.horizontalRuler(out);
return;
case NONE:
case XML:
break;
case HEADLIN... | [
"public",
"void",
"emit",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"Block",
"root",
")",
"{",
"root",
".",
"removeSurroundingEmptyLines",
"(",
")",
";",
"switch",
"(",
"root",
".",
"type",
")",
"{",
"case",
"RULER",
":",
"this",
".",
"config",... | Transforms the given block recursively into HTML.
@param out
The StringBuilder to write to.
@param root
The Block to process. | [
"Transforms",
"the",
"given",
"block",
"recursively",
"into",
"HTML",
"."
] | 108cee6b209a362843729c032c2d982625d12d98 | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Emitter.java#L63-L162 | train | Emit a block of a CRA. | Create a Java method that does the following: "Emit a block of a CRA.". | Of course, here is the Java code you requested:
```java
public void emit(final StringBuilder out, final Block root)
{
root.removeSurroundingEmptyLines();
switch (root.type)
{
case RULER:
this.config.decorator.horizontalRuler(out);
return;
case NONE:
... | |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/ScopeImpl.java | ScopeImpl.lookupProvider | <T> InternalProviderImpl<? extends T> lookupProvider(Class<T> clazz, String bindingName) {
if (clazz == null) {
throw new IllegalArgumentException("TP can't get an instance of a null class.");
}
InternalProviderImpl<? extends T> scopedProvider = getBoundProvider(clazz, bindingName);
if (scopedProv... | java | <T> InternalProviderImpl<? extends T> lookupProvider(Class<T> clazz, String bindingName) {
if (clazz == null) {
throw new IllegalArgumentException("TP can't get an instance of a null class.");
}
InternalProviderImpl<? extends T> scopedProvider = getBoundProvider(clazz, bindingName);
if (scopedProv... | [
"<",
"T",
">",
"InternalProviderImpl",
"<",
"?",
"extends",
"T",
">",
"lookupProvider",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"bindingName",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | /* @VisibleForTesting | [
"/",
"*"
] | 54476ca9a5fa48809c15a46e43e38db9ed7e1a75 | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L290-L349 | train | Lookup a provider by binding name. | Create a Java method that does the following: "Lookup a provider by binding name.". | Of course, here is the Java code you requested:
```java
<T> InternalProviderImpl<? extends T> lookupProvider(Class<T> clazz, String bindingName) {
if (clazz == null) {
throw new IllegalArgumentException("TP can't get an instance of a null class.");
}
InternalProviderImpl<? extends T> scopedProvider =... | |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_YMin.java | ST_YMin.getMinY | public static Double getMinY(Geometry geom) {
if (geom != null) {
return geom.getEnvelopeInternal().getMinY();
} else {
return null;
}
} | java | public static Double getMinY(Geometry geom) {
if (geom != null) {
return geom.getEnvelopeInternal().getMinY();
} else {
return null;
}
} | [
"public",
"static",
"Double",
"getMinY",
"(",
"Geometry",
"geom",
")",
"{",
"if",
"(",
"geom",
"!=",
"null",
")",
"{",
"return",
"geom",
".",
"getEnvelopeInternal",
"(",
")",
".",
"getMinY",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}"... | Returns the minimal y-value of the given geometry.
@param geom Geometry
@return The minimal y-value of the given geometry, or null if the geometry is null. | [
"Returns",
"the",
"minimal",
"y",
"-",
"value",
"of",
"the",
"given",
"geometry",
"."
] | 9cd70b447e6469cecbc2fc64b16774b59491df3b | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_YMin.java#L48-L54 | train | Get the min Y value of a geometry. | Create a Java method that does the following: "Get the min Y value of a geometry.". | Of course, here is the Java code you requested:
```java
public static Double getMinY(Geometry geom) {
if (geom != null) {
return geom.getEnvelopeInternal().getMinY();
} else {
return null;
}
}
```
Hope this helps! | |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/stylers/AbstractFieldStyler.java | AbstractFieldStyler.style | @Override
public <E> E style(E element, Object data) throws VectorPrintException {
if (stylerFactory.getDocumentStyler().getValue(DocumentSettings.PDFA, Boolean.class)) {
throw new VectorPrintRuntimeException("forms not supported in PDF/X-1a ");
}
bf = getFromCell(element);
if (bf ==... | java | @Override
public <E> E style(E element, Object data) throws VectorPrintException {
if (stylerFactory.getDocumentStyler().getValue(DocumentSettings.PDFA, Boolean.class)) {
throw new VectorPrintRuntimeException("forms not supported in PDF/X-1a ");
}
bf = getFromCell(element);
if (bf ==... | [
"@",
"Override",
"public",
"<",
"E",
">",
"E",
"style",
"(",
"E",
"element",
",",
"Object",
"data",
")",
"throws",
"VectorPrintException",
"{",
"if",
"(",
"stylerFactory",
".",
"getDocumentStyler",
"(",
")",
".",
"getValue",
"(",
"DocumentSettings",
".",
"... | calls {@link #create() } and {@link #setFieldValues() } and registers this
FormFieldStyler as a {@link PdfPCellEvent} when element is null or when the {@link DebuggablePdfPCell} does not
contain a {@link BaseField} yet. Subclasses should first call this style method and after this call
{@link #getFromCell(java.lang.Ob... | [
"calls",
"{",
"@link",
"#create",
"()",
"}",
"and",
"{",
"@link",
"#setFieldValues",
"()",
"}",
"and",
"registers",
"this",
"FormFieldStyler",
"as",
"a",
"{",
"@link",
"PdfPCellEvent",
"}",
"when",
"element",
"is",
"null",
"or",
"when",
"the",
"{",
"@link"... | b5fb7a89e16d9b35f557f3bf620594f821fa1552 | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/AbstractFieldStyler.java#L160-L172 | train | Override the default behavior of the style method. | Create a Java method that does the following: "Override the default behavior of the style method.". | Of course, here is the Java code you requested:
```java
@Override
public <E> E style(E element, Object data) throws VectorPrintException {
if (stylerFactory.getDocumentStyler().getValue(DocumentSettings.PDFA, Boolean.class)) {
throw new VectorPrintRuntimeException("forms not supported in PDF/X-1a ");... | |
opensourceBIM/BIMserver | PluginBase/generated/org/bimserver/models/ifc2x3tc1/impl/Ifc2x3tc1PackageImpl.java | Ifc2x3tc1PackageImpl.getIfcCurtainWallTypeEnum | public EEnum getIfcCurtainWallTypeEnum() {
if (ifcCurtainWallTypeEnumEEnum == null) {
ifcCurtainWallTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(806);
}
return ifcCurtainWallTypeEnumEEnum;
} | java | public EEnum getIfcCurtainWallTypeEnum() {
if (ifcCurtainWallTypeEnumEEnum == null) {
ifcCurtainWallTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(806);
}
return ifcCurtainWallTypeEnumEEnum;
} | [
"public",
"EEnum",
"getIfcCurtainWallTypeEnum",
"(",
")",
"{",
"if",
"(",
"ifcCurtainWallTypeEnumEEnum",
"==",
"null",
")",
"{",
"ifcCurtainWallTypeEnumEEnum",
"=",
"(",
"EEnum",
")",
"EPackage",
".",
"Registry",
".",
"INSTANCE",
".",
"getEPackage",
"(",
"Ifc2x3tc... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 116803c3047d1b32217366757cee1bb3880fda63 | https://github.com/opensourceBIM/BIMserver/blob/116803c3047d1b32217366757cee1bb3880fda63/PluginBase/generated/org/bimserver/models/ifc2x3tc1/impl/Ifc2x3tc1PackageImpl.java#L36791-L36797 | train | Get the IfcCurtainWallTypeEnum attribute of the interface. | Create a Java method that does the following: "Get the IfcCurtainWallTypeEnum attribute of the interface.". | Of course, here is the Java code you requested:
```java
public EEnum getIfcCurtainWallTypeEnum() {
if (ifcCurtainWallTypeEnumEEnum == null) {
ifcCurtainWallTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(806);
}
return ifcCurtainWallTyp... | |
oblac/jodd | jodd-proxetta/src/main/java/jodd/proxetta/ProxyTargetReplacement.java | ProxyTargetReplacement.argument | public static void argument(final MethodVisitor mv, final MethodInfo methodInfo, final int argIndex) {
checkArgumentIndex(methodInfo, argIndex);
mv.visitInsn(POP);
loadMethodArgumentAsObject(mv, methodInfo, argIndex);
} | java | public static void argument(final MethodVisitor mv, final MethodInfo methodInfo, final int argIndex) {
checkArgumentIndex(methodInfo, argIndex);
mv.visitInsn(POP);
loadMethodArgumentAsObject(mv, methodInfo, argIndex);
} | [
"public",
"static",
"void",
"argument",
"(",
"final",
"MethodVisitor",
"mv",
",",
"final",
"MethodInfo",
"methodInfo",
",",
"final",
"int",
"argIndex",
")",
"{",
"checkArgumentIndex",
"(",
"methodInfo",
",",
"argIndex",
")",
";",
"mv",
".",
"visitInsn",
"(",
... | Visits replacement code for {@link ProxyTarget#argument(int)}. | [
"Visits",
"replacement",
"code",
"for",
"{"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-proxetta/src/main/java/jodd/proxetta/ProxyTargetReplacement.java#L74-L78 | test | Generates instructions to load a method argument. | Create a Java method that does the following: "Generates instructions to load a method argument.". | Of course, here is the Java code you requested:
```java
public static void argument(final MethodVisitor mv, final MethodInfo methodInfo, final int argIndex) {
checkArgumentIndex(methodInfo, argIndex);
mv.visitInsn(POP);
loadMethodArgumentAsObject(mv, methodInfo, argIndex);
}
```
Hope this helps! | |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/roles/LeaderAppender.java | LeaderAppender.computeHeartbeatTime | private long computeHeartbeatTime() {
int quorumIndex = getQuorumIndex();
if (quorumIndex >= 0) {
return raft.getCluster().getActiveMemberStates((m1, m2) -> Long.compare(m2.getHeartbeatTime(), m1.getHeartbeatTime())).get(quorumIndex).getHeartbeatTime();
}
return System.currentTimeMillis();
} | java | private long computeHeartbeatTime() {
int quorumIndex = getQuorumIndex();
if (quorumIndex >= 0) {
return raft.getCluster().getActiveMemberStates((m1, m2) -> Long.compare(m2.getHeartbeatTime(), m1.getHeartbeatTime())).get(quorumIndex).getHeartbeatTime();
}
return System.currentTimeMillis();
} | [
"private",
"long",
"computeHeartbeatTime",
"(",
")",
"{",
"int",
"quorumIndex",
"=",
"getQuorumIndex",
"(",
")",
";",
"if",
"(",
"quorumIndex",
">=",
"0",
")",
"{",
"return",
"raft",
".",
"getCluster",
"(",
")",
".",
"getActiveMemberStates",
"(",
"(",
"m1"... | Returns the last time a majority of the cluster was contacted.
<p>
This is calculated by sorting the list of active members and getting the last time the majority of
the cluster was contacted based on the index of a majority of the members. So, in a list of 3 ACTIVE
members, index 1 (the second member) will be used to ... | [
"Returns",
"the",
"last",
"time",
"a",
"majority",
"of",
"the",
"cluster",
"was",
"contacted",
".",
"<p",
">",
"This",
"is",
"calculated",
"by",
"sorting",
"the",
"list",
"of",
"active",
"members",
"and",
"getting",
"the",
"last",
"time",
"the",
"majority"... | 3a94b7c80576d762dd0d396d4645df07a0b37c31 | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/roles/LeaderAppender.java#L227-L233 | train | Compute the heartbeat time. | Create a Java method that does the following: "Compute the heartbeat time.". | Of course, here is the Java code you requested:
```java
private long computeHeartbeatTime() {
int quorumIndex = getQuorumIndex();
if (quorumIndex >= 0) {
return raft.getCluster().getActiveMemberStates((m1, m2) -> Long.compare(m2.getHeartbeatTime(), m1.getHeartbeatTime())).get(quorumIndex).getHeartbeatTim... | |
wildfly/wildfly | connector/src/main/java/org/jboss/as/connector/subsystems/datasources/AbstractDataSourceService.java | AbstractDataSourceService.stopService | protected synchronized void stopService() {
if (deploymentMD != null) {
if (deploymentMD.getResourceAdapterKey() != null) {
try {
raRepository.getValue().unregisterResourceAdapter(deploymentMD.getResourceAdapterKey());
} catch (org.jboss.jca.core.... | java | protected synchronized void stopService() {
if (deploymentMD != null) {
if (deploymentMD.getResourceAdapterKey() != null) {
try {
raRepository.getValue().unregisterResourceAdapter(deploymentMD.getResourceAdapterKey());
} catch (org.jboss.jca.core.... | [
"protected",
"synchronized",
"void",
"stopService",
"(",
")",
"{",
"if",
"(",
"deploymentMD",
"!=",
"null",
")",
"{",
"if",
"(",
"deploymentMD",
".",
"getResourceAdapterKey",
"(",
")",
"!=",
"null",
")",
"{",
"try",
"{",
"raRepository",
".",
"getValue",
"(... | Performs the actual work of stopping the service. Should be called by {@link #stop(org.jboss.msc.service.StopContext)}
asynchronously from the MSC thread that invoked stop. | [
"Performs",
"the",
"actual",
"work",
"of",
"stopping",
"the",
"service",
".",
"Should",
"be",
"called",
"by",
"{"
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/AbstractDataSourceService.java#L207-L241 | test | Stop the service. | Create a Java method that does the following: "Stop the service.". | Of course, here is the Java code you requested:
```java
protected synchronized void stopService() {
if (deploymentMD != null) {
if (deploymentMD.getResourceAdapterKey() != null) {
try {
raRepository.getValue().unregisterResourceAdapter(deploymentMD.getResourceAd... | |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/ExceptionUtils.java | ExceptionUtils.getRuntimeException | public static RuntimeException getRuntimeException(final Throwable exc) {
Throwable e = exc;
while (e.getCause() instanceof RuntimeException) {
e = e.getCause();
}
if (e instanceof RuntimeException) {
return (RuntimeException) e;
} else {
retur... | java | public static RuntimeException getRuntimeException(final Throwable exc) {
Throwable e = exc;
while (e.getCause() instanceof RuntimeException) {
e = e.getCause();
}
if (e instanceof RuntimeException) {
return (RuntimeException) e;
} else {
retur... | [
"public",
"static",
"RuntimeException",
"getRuntimeException",
"(",
"final",
"Throwable",
"exc",
")",
"{",
"Throwable",
"e",
"=",
"exc",
";",
"while",
"(",
"e",
".",
"getCause",
"(",
")",
"instanceof",
"RuntimeException",
")",
"{",
"e",
"=",
"e",
".",
"get... | Returns a {@link RuntimeException} for the given exception.
@param exc An exception.
@return A {@link RuntimeException} | [
"Returns",
"a",
"{",
"@link",
"RuntimeException",
"}",
"for",
"the",
"given",
"exception",
"."
] | 25a452cb39f592bd8a53b20db1037703898e1e22 | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/ExceptionUtils.java#L18-L28 | train | Get a RuntimeException from an exception. | Create a Java method that does the following: "Get a RuntimeException from an exception.". | Of course, here is the Java code you requested:
```java
public static RuntimeException getRuntimeException(final Throwable exc) {
Throwable e = exc;
while (e.getCause() instanceof RuntimeException) {
e = e.getCause();
}
if (e instanceof RuntimeException) {
return... | |
lessthanoptimal/BoofCV | demonstrations/src/main/java/boofcv/demonstrations/feature/associate/VisualizeAssociationScoreApp.java | VisualizeAssociationScoreApp.processImage | private void processImage() {
final List<Point2D_F64> leftPts = new ArrayList<>();
final List<Point2D_F64> rightPts = new ArrayList<>();
final List<TupleDesc> leftDesc = new ArrayList<>();
final List<TupleDesc> rightDesc = new ArrayList<>();
final ProgressMonitor progressMonitor = new ProgressMonitor(this,
... | java | private void processImage() {
final List<Point2D_F64> leftPts = new ArrayList<>();
final List<Point2D_F64> rightPts = new ArrayList<>();
final List<TupleDesc> leftDesc = new ArrayList<>();
final List<TupleDesc> rightDesc = new ArrayList<>();
final ProgressMonitor progressMonitor = new ProgressMonitor(this,
... | [
"private",
"void",
"processImage",
"(",
")",
"{",
"final",
"List",
"<",
"Point2D_F64",
">",
"leftPts",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"List",
"<",
"Point2D_F64",
">",
"rightPts",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"fi... | Extracts image information and then passes that info onto scorePanel for display. Data is not
recycled to avoid threading issues. | [
"Extracts",
"image",
"information",
"and",
"then",
"passes",
"that",
"info",
"onto",
"scorePanel",
"for",
"display",
".",
"Data",
"is",
"not",
"recycled",
"to",
"avoid",
"threading",
"issues",
"."
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/demonstrations/src/main/java/boofcv/demonstrations/feature/associate/VisualizeAssociationScoreApp.java#L172-L192 | train | Process the image | Create a Java method that does the following: "Process the image". | Of course, here is the Java code you requested:
```java
private void processImage() {
final List<Point2D_F64> leftPts = new ArrayList<>();
final List<Point2D_F64> rightPts = new ArrayList<>();
final List<TupleDesc> leftDesc = new ArrayList<>();
final List<TupleDesc> rightDesc = new ArrayList<>();
final Prog... | |
3redronin/mu-server | src/main/java/io/muserver/rest/RestHandlerBuilder.java | RestHandlerBuilder.addRequestFilter | public RestHandlerBuilder addRequestFilter(ContainerRequestFilter filter) {
if (filter.getClass().getDeclaredAnnotation(PreMatching.class) != null) {
this.preMatchRequestFilters.add(filter);
} else {
this.requestFilters.add(filter);
}
return this;
} | java | public RestHandlerBuilder addRequestFilter(ContainerRequestFilter filter) {
if (filter.getClass().getDeclaredAnnotation(PreMatching.class) != null) {
this.preMatchRequestFilters.add(filter);
} else {
this.requestFilters.add(filter);
}
return this;
} | [
"public",
"RestHandlerBuilder",
"addRequestFilter",
"(",
"ContainerRequestFilter",
"filter",
")",
"{",
"if",
"(",
"filter",
".",
"getClass",
"(",
")",
".",
"getDeclaredAnnotation",
"(",
"PreMatching",
".",
"class",
")",
"!=",
"null",
")",
"{",
"this",
".",
"pr... | <p>Registers a request filter, which is run before a rest method is executed.</p>
<p>It will be run after the method has been matched, or if the {@link PreMatching} annotation is applied to the
filter then it will run before matching occurs.</p>
@param filter The filter to register
@return This builder | [
"<p",
">",
"Registers",
"a",
"request",
"filter",
"which",
"is",
"run",
"before",
"a",
"rest",
"method",
"is",
"executed",
".",
"<",
"/",
"p",
">",
"<p",
">",
"It",
"will",
"be",
"run",
"after",
"the",
"method",
"has",
"been",
"matched",
"or",
"if",
... | 51598606a3082a121fbd785348ee9770b40308e6 | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/rest/RestHandlerBuilder.java#L315-L322 | train | Add a request filter to the handler. | Create a Java method that does the following: "Add a request filter to the handler.". | Of course, here is the Java code you requested:
```java
public RestHandlerBuilder addRequestFilter(ContainerRequestFilter filter) {
if (filter.getClass().getDeclaredAnnotation(PreMatching.class) != null) {
this.preMatchRequestFilters.add(filter);
} else {
this.requestFilters.add... | |
ArpNetworking/commons | src/main/java/com/fasterxml/jackson/databind/deser/ThreadLocalBuilderBasedDeserializer.java | ThreadLocalBuilderBasedDeserializer.vanillaDeserializeAndFinishBuild | private Object vanillaDeserializeAndFinishBuild(
final JsonParser p,
final DeserializationContext ctxt,
final JsonToken t)
throws IOException {
try {
return ThreadLocalBuilder.buildGeneric(
_threadLocalBuilderClass,
... | java | private Object vanillaDeserializeAndFinishBuild(
final JsonParser p,
final DeserializationContext ctxt,
final JsonToken t)
throws IOException {
try {
return ThreadLocalBuilder.buildGeneric(
_threadLocalBuilderClass,
... | [
"private",
"Object",
"vanillaDeserializeAndFinishBuild",
"(",
"final",
"JsonParser",
"p",
",",
"final",
"DeserializationContext",
"ctxt",
",",
"final",
"JsonToken",
"t",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"ThreadLocalBuilder",
".",
"buildGeneric"... | Copied from {@code com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer}
and modified to use {@link ThreadLocalBuilder} instantiation and build. | [
"Copied",
"from",
"{"
] | 36e18ee63312921551ade91dfbf769eccd04dc96 | https://github.com/ArpNetworking/commons/blob/36e18ee63312921551ade91dfbf769eccd04dc96/src/main/java/com/fasterxml/jackson/databind/deser/ThreadLocalBuilderBasedDeserializer.java#L185-L229 | train | Vanilla deserialize and finish build. | Create a Java method that does the following: "Vanilla deserialize and finish build.". | Of course, here is the Java code you requested:
```java
private Object vanillaDeserializeAndFinishBuild(
final JsonParser p,
final DeserializationContext ctxt,
final JsonToken t)
throws IOException {
try {
return ThreadLocalBuilder.buildGeneric(
... | |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/ApplicationDefinition.java | ApplicationDefinition.allowsAutoTables | public boolean allowsAutoTables() {
String optValue = getOption(CommonDefs.AUTO_TABLES);
return optValue != null && optValue.equalsIgnoreCase("true");
} | java | public boolean allowsAutoTables() {
String optValue = getOption(CommonDefs.AUTO_TABLES);
return optValue != null && optValue.equalsIgnoreCase("true");
} | [
"public",
"boolean",
"allowsAutoTables",
"(",
")",
"{",
"String",
"optValue",
"=",
"getOption",
"(",
"CommonDefs",
".",
"AUTO_TABLES",
")",
";",
"return",
"optValue",
"!=",
"null",
"&&",
"optValue",
".",
"equalsIgnoreCase",
"(",
"\"true\"",
")",
";",
"}"
] | Indicate whether or not this application tables to be implicitly created.
@return True if this application tables to be implicitly created. | [
"Indicate",
"whether",
"or",
"not",
"this",
"application",
"tables",
"to",
"be",
"implicitly",
"created",
"."
] | ad64d3c37922eefda68ec8869ef089c1ca604b70 | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/ApplicationDefinition.java#L164-L167 | train | Returns true if the application uses the AUTO_TABLES option. | Create a Java method that does the following: "Returns true if the application uses the AUTO_TABLES option.". | Of course, here is the Java code you requested:
```java
public boolean allowsAutoTables() {
String optValue = getOption(CommonDefs.AUTO_TABLES);
return optValue != null && optValue.equalsIgnoreCase("true");
}
```
Hope this helps! | |
app55/app55-java | src/support/java/org/apache/harmony/beans/Handler.java | Handler.characters | @Override
public void characters(char[] text, int start, int length) throws SAXException
{
if (length > 0)
{
String data = String.valueOf(text, start, length).replace('\n', ' ').replace('\t', ' ').trim();
if (data.length() > 0)
{
Command.prn(tabCount, tabCount + ">setting data=" + data //$NON-NLS-1$
... | java | @Override
public void characters(char[] text, int start, int length) throws SAXException
{
if (length > 0)
{
String data = String.valueOf(text, start, length).replace('\n', ' ').replace('\t', ' ').trim();
if (data.length() > 0)
{
Command.prn(tabCount, tabCount + ">setting data=" + data //$NON-NLS-1$
... | [
"@",
"Override",
"public",
"void",
"characters",
"(",
"char",
"[",
"]",
"text",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"length",
">",
"0",
")",
"{",
"String",
"data",
"=",
"String",
".",
"valueOf",
"... | add data to command | [
"add",
"data",
"to",
"command"
] | 73e51d0f3141a859dfbd37ca9becef98477e553e | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/org/apache/harmony/beans/Handler.java#L76-L90 | train | Override the characters method. | Create a Java method that does the following: "Override the characters method.". | Of course, here is the Java code you requested:
```java
@Override
public void characters(char[] text, int start, int length) throws SAXException
{
if (length > 0)
{
String data = String.valueOf(text, start, length).replace('\n', ' ').replace('\t', ' ').trim();
if (data.length() > 0)
{
Command.prn(ta... | |
mkotsur/restito | src/main/java/com/xebialabs/restito/semantics/Action.java | Action.delay | public static Action delay(final Integer delay) {
return new Action(input -> {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return input;
});
} | java | public static Action delay(final Integer delay) {
return new Action(input -> {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return input;
});
} | [
"public",
"static",
"Action",
"delay",
"(",
"final",
"Integer",
"delay",
")",
"{",
"return",
"new",
"Action",
"(",
"input",
"->",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"delay",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",... | Sleeps so many milliseconds, emulating slow requests. | [
"Sleeps",
"so",
"many",
"milliseconds",
"emulating",
"slow",
"requests",
"."
] | b999293616ca84fdea1ffe929e92a5db29c7e415 | https://github.com/mkotsur/restito/blob/b999293616ca84fdea1ffe929e92a5db29c7e415/src/main/java/com/xebialabs/restito/semantics/Action.java#L289-L298 | train | Delay the action. | Create a Java method that does the following: "Delay the action.". | Of course, here is the Java code you requested:
```java
public static Action delay(final Integer delay) {
return new Action(input -> {
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
... | |
lemire/javaewah | src/main/java/com/googlecode/javaewah32/symmetric/UpdateableBitmapFunction32.java | UpdateableBitmapFunction32.fillWithLiterals | public final void fillWithLiterals(final List<EWAHPointer32> container) {
for (int k = this.litwlist.nextSetBit(0); k >= 0; k = this.litwlist
.nextSetBit(k + 1)) {
container.add(this.rw[k]);
}
} | java | public final void fillWithLiterals(final List<EWAHPointer32> container) {
for (int k = this.litwlist.nextSetBit(0); k >= 0; k = this.litwlist
.nextSetBit(k + 1)) {
container.add(this.rw[k]);
}
} | [
"public",
"final",
"void",
"fillWithLiterals",
"(",
"final",
"List",
"<",
"EWAHPointer32",
">",
"container",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"this",
".",
"litwlist",
".",
"nextSetBit",
"(",
"0",
")",
";",
"k",
">=",
"0",
";",
"k",
"=",
"this",... | append to the list the literal words as EWAHPointer
@param container where we write | [
"append",
"to",
"the",
"list",
"the",
"literal",
"words",
"as",
"EWAHPointer"
] | ff04f8eb03eb1193842cf8009d0e94c5d2e3e70e | https://github.com/lemire/javaewah/blob/ff04f8eb03eb1193842cf8009d0e94c5d2e3e70e/src/main/java/com/googlecode/javaewah32/symmetric/UpdateableBitmapFunction32.java#L80-L85 | valid | Fill with literals. | Create a Java method that does the following: "Fill with literals.". | Of course, here is the Java code you requested:
```java
public final void fillWithLiterals(final List<EWAHPointer32> container) {
for (int k = this.litwlist.nextSetBit(0); k >= 0; k = this.litwlist
.nextSetBit(k + 1)) {
container.add(this.rw[k]);
}
}
```
Hope this helps... | |
KyoriPowered/text | api/src/main/java/net/kyori/text/TextComponent.java | TextComponent.content | public @NonNull TextComponent content(final @NonNull String content) {
return new TextComponent(this.children, this.color, this.obfuscated, this.bold, this.strikethrough, this.underlined, this.italic, this.clickEvent, this.hoverEvent, this.insertion, requireNonNull(content, "content"));
} | java | public @NonNull TextComponent content(final @NonNull String content) {
return new TextComponent(this.children, this.color, this.obfuscated, this.bold, this.strikethrough, this.underlined, this.italic, this.clickEvent, this.hoverEvent, this.insertion, requireNonNull(content, "content"));
} | [
"public",
"@",
"NonNull",
"TextComponent",
"content",
"(",
"final",
"@",
"NonNull",
"String",
"content",
")",
"{",
"return",
"new",
"TextComponent",
"(",
"this",
".",
"children",
",",
"this",
".",
"color",
",",
"this",
".",
"obfuscated",
",",
"this",
".",
... | Sets the plain text content.
@param content the plain text content
@return a copy of this component | [
"Sets",
"the",
"plain",
"text",
"content",
"."
] | 4496c593bf89e8fb036dd6efe26f8ac60f7655c9 | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TextComponent.java#L231-L233 | train | Creates a phrase with the given content. | Create a Java method that does the following: "Creates a phrase with the given content.". | Of course, here is the Java code you requested:
```java
public @NonNull TextComponent content(final @NonNull String content) {
return new TextComponent(this.children, this.color, this.obfuscated, this.bold, this.strikethrough, this.underlined, this.italic, this.clickEvent, this.hoverEvent, this.insertion, requireN... | |
aws/aws-sdk-java | aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/AWSIotClient.java | AWSIotClient.startOnDemandAuditTask | @Override
public StartOnDemandAuditTaskResult startOnDemandAuditTask(StartOnDemandAuditTaskRequest request) {
request = beforeClientExecution(request);
return executeStartOnDemandAuditTask(request);
} | java | @Override
public StartOnDemandAuditTaskResult startOnDemandAuditTask(StartOnDemandAuditTaskRequest request) {
request = beforeClientExecution(request);
return executeStartOnDemandAuditTask(request);
} | [
"@",
"Override",
"public",
"StartOnDemandAuditTaskResult",
"startOnDemandAuditTask",
"(",
"StartOnDemandAuditTaskRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeStartOnDemandAuditTask",
"(",
"request",
")",... | <p>
Starts an on-demand Device Defender audit.
</p>
@param startOnDemandAuditTaskRequest
@return Result of the StartOnDemandAuditTask operation returned by the service.
@throws InvalidRequestException
The request is not valid.
@throws ThrottlingException
The rate exceeds the limit.
@throws InternalFailureException
An ... | [
"<p",
">",
"Starts",
"an",
"on",
"-",
"demand",
"Device",
"Defender",
"audit",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/AWSIotClient.java#L9333-L9337 | train | Start an on - demand audit task. | Create a Java method that does the following: "Start an on - demand audit task.". | Of course, here is the Java code you requested:
```java
@Override
public StartOnDemandAuditTaskResult startOnDemandAuditTask(StartOnDemandAuditTaskRequest request) {
request = beforeClientExecution(request);
return executeStartOnDemandAuditTask(request);
}
```
Hope this helps! | |
betfair/cougar | cougar-framework/cougar-util/src/main/java/com/betfair/cougar/util/configuration/Sets.java | Sets.fromMap | public static final Set fromMap(Map map, Object... keys) {
if (keys != null && map != null) {
Set answer = new HashSet();
for (Object key : keys) {
if (map.containsKey(key)) {
answer.add(map.get(key));
}
}
return... | java | public static final Set fromMap(Map map, Object... keys) {
if (keys != null && map != null) {
Set answer = new HashSet();
for (Object key : keys) {
if (map.containsKey(key)) {
answer.add(map.get(key));
}
}
return... | [
"public",
"static",
"final",
"Set",
"fromMap",
"(",
"Map",
"map",
",",
"Object",
"...",
"keys",
")",
"{",
"if",
"(",
"keys",
"!=",
"null",
"&&",
"map",
"!=",
"null",
")",
"{",
"Set",
"answer",
"=",
"new",
"HashSet",
"(",
")",
";",
"for",
"(",
"Ob... | Given a map and a set of keys, return a set containing the values referred-to by the keys.
If the map is null or the keys are null, the EMPTY_SET is returned.
If a passed key does not exist in the map, nothing is added to the set.
However, if the key is present and maps to null, null is added to the set. | [
"Given",
"a",
"map",
"and",
"a",
"set",
"of",
"keys",
"return",
"a",
"set",
"containing",
"the",
"values",
"referred",
"-",
"to",
"by",
"the",
"keys",
".",
"If",
"the",
"map",
"is",
"null",
"or",
"the",
"keys",
"are",
"null",
"the",
"EMPTY_SET",
"is"... | 08d1fe338fbd0e8572a9c2305bb5796402d5b1f5 | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/cougar-util/src/main/java/com/betfair/cougar/util/configuration/Sets.java#L29-L40 | train | Get a Set from a Map. | Create a Java method that does the following: "Get a Set from a Map.". | Of course, here is the Java code you requested:
```java
public static final Set fromMap(Map map, Object... keys) {
if (keys != null && map != null) {
Set answer = new HashSet();
for (Object key : keys) {
if (map.containsKey(key)) {
answer.add(map.get(... | |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/stores/PEMKeyStore.java | PEMKeyStore.engineLoad | @Override
public void engineLoad(KeyStore.LoadStoreParameter loadStoreParameter)
throws IOException, NoSuchAlgorithmException, CertificateException {
if (!(loadStoreParameter instanceof KeyStoreParametersFactory.FileStoreParameters)) {
throw new IllegalArgumentException("Unable to process parameters: "
+ ... | java | @Override
public void engineLoad(KeyStore.LoadStoreParameter loadStoreParameter)
throws IOException, NoSuchAlgorithmException, CertificateException {
if (!(loadStoreParameter instanceof KeyStoreParametersFactory.FileStoreParameters)) {
throw new IllegalArgumentException("Unable to process parameters: "
+ ... | [
"@",
"Override",
"public",
"void",
"engineLoad",
"(",
"KeyStore",
".",
"LoadStoreParameter",
"loadStoreParameter",
")",
"throws",
"IOException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
"{",
"if",
"(",
"!",
"(",
"loadStoreParameter",
"instanceof",
... | Load the keystore based on parameters in the LoadStoreParameter. The
parameter object must be an instance of FileBasedKeyStoreParameters.
@param loadStoreParameter
The parameters to load.
@throws IOException
@throws NoSuchAlgorithmException
@throws CertificateException | [
"Load",
"the",
"keystore",
"based",
"on",
"parameters",
"in",
"the",
"LoadStoreParameter",
".",
"The",
"parameter",
"object",
"must",
"be",
"an",
"instance",
"of",
"FileBasedKeyStoreParameters",
"."
] | e14f6f6636544fd84298f9cec749d626ea971930 | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/stores/PEMKeyStore.java#L294-L311 | train | Override this to load the keystore. | Create a Java method that does the following: "Override this to load the keystore.". | Of course, here is the Java code you requested:
```java
@Override
public void engineLoad(KeyStore.LoadStoreParameter loadStoreParameter)
throws IOException, NoSuchAlgorithmException, CertificateException {
if (!(loadStoreParameter instanceof KeyStoreParametersFactory.FileStoreParameters)) {
throw new IllegalA... | |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/task/execute/spout/SpoutExecutors.java | SpoutExecutors.onEvent | @Override
public void onEvent(Object event, long sequence, boolean endOfBatch) throws Exception {
try {
if (event == null) {
return;
}
Runnable runnable = null;
if (event instanceof Tuple) {
if (((TupleExt) event).isBatchTuple()... | java | @Override
public void onEvent(Object event, long sequence, boolean endOfBatch) throws Exception {
try {
if (event == null) {
return;
}
Runnable runnable = null;
if (event instanceof Tuple) {
if (((TupleExt) event).isBatchTuple()... | [
"@",
"Override",
"public",
"void",
"onEvent",
"(",
"Object",
"event",
",",
"long",
"sequence",
",",
"boolean",
"endOfBatch",
")",
"throws",
"Exception",
"{",
"try",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Runnable",
"runnabl... | Handle acker message
@see com.lmax.disruptor.EventHandler#onEvent(java.lang.Object, long, boolean) | [
"Handle",
"acker",
"message"
] | 5d6cde22dbca7df3d6e6830bf94f98a6639ab559 | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/task/execute/spout/SpoutExecutors.java#L205-L250 | train | This method is called by the event listener to process an event. | Create a Java method that does the following: "This method is called by the event listener to process an event.". | Of course, here is the Java code you requested:
```java
@Override
public void onEvent(Object event, long sequence, boolean endOfBatch) throws Exception {
try {
if (event == null) {
return;
}
Runnable runnable = null;
if (event instanceof Tuple... | |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java | UserMetadata.setFieldProtected | public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) {
FieldMetadata metaData = formModel.getFieldMetadata(fieldName);
metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField));
} | java | public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) {
FieldMetadata metaData = formModel.getFieldMetadata(fieldName);
metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField));
} | [
"public",
"static",
"void",
"setFieldProtected",
"(",
"FormModel",
"formModel",
",",
"String",
"fieldName",
",",
"boolean",
"protectedField",
")",
"{",
"FieldMetadata",
"metaData",
"=",
"formModel",
".",
"getFieldMetadata",
"(",
"fieldName",
")",
";",
"metaData",
... | defines the protectable state for a field
@param formModel the formmodel
@param fieldName the field to protect
@param protectedField if true the field will be defined as protectable otherwise false | [
"defines",
"the",
"protectable",
"state",
"for",
"a",
"field"
] | 6aad6e640b348cda8f3b0841f6e42025233f1eb8 | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java#L56-L59 | train | Sets the field protected. | Create a Java method that does the following: "Sets the field protected.". | Of course, here is the Java code you requested:
```java
public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) {
FieldMetadata metaData = formModel.getFieldMetadata(fieldName);
metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField... | |
apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/util/SetCache.java | SetCache.add | public <D extends DataSet<?>> void add(int id, D set) {
cacheSetType(id, SetType.DATA_SET);
dataSets.put(id, set);
} | java | public <D extends DataSet<?>> void add(int id, D set) {
cacheSetType(id, SetType.DATA_SET);
dataSets.put(id, set);
} | [
"public",
"<",
"D",
"extends",
"DataSet",
"<",
"?",
">",
">",
"void",
"add",
"(",
"int",
"id",
",",
"D",
"set",
")",
"{",
"cacheSetType",
"(",
"id",
",",
"SetType",
".",
"DATA_SET",
")",
";",
"dataSets",
".",
"put",
"(",
"id",
",",
"set",
")",
... | Adds the given {@link DataSet} to this cache for the given ID.
@param id Set ID
@param set DataSet to add
@param <D> DataSet class | [
"Adds",
"the",
"given",
"{",
"@link",
"DataSet",
"}",
"to",
"this",
"cache",
"for",
"the",
"given",
"ID",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/util/SetCache.java#L71-L74 | train | Adds a data set to the cache. | Create a Java method that does the following: "Adds a data set to the cache.". | Of course, here is the Java code you requested:
```java
public <D extends DataSet<?>> void add(int id, D set) {
cacheSetType(id, SetType.DATA_SET);
dataSets.put(id, set);
}
```
Hope this helps! | |
ios-driver/ios-driver | client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/RemoteUIAElement.java | RemoteUIAElement.isDisplayed | @Override
public boolean isDisplayed() {
WebDriverLikeRequest request = buildRequest(WebDriverLikeCommand.DISPLAYED);
return (Boolean) commandExecutor.execute(request);
} | java | @Override
public boolean isDisplayed() {
WebDriverLikeRequest request = buildRequest(WebDriverLikeCommand.DISPLAYED);
return (Boolean) commandExecutor.execute(request);
} | [
"@",
"Override",
"public",
"boolean",
"isDisplayed",
"(",
")",
"{",
"WebDriverLikeRequest",
"request",
"=",
"buildRequest",
"(",
"WebDriverLikeCommand",
".",
"DISPLAYED",
")",
";",
"return",
"(",
"Boolean",
")",
"commandExecutor",
".",
"execute",
"(",
"request",
... | TODO freynaud fix that server side. | [
"TODO",
"freynaud",
"fix",
"that",
"server",
"side",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/RemoteUIAElement.java#L200-L204 | train | Returns true if the node is displayed. | Create a Java method that does the following: "Returns true if the node is displayed.". | Of course, here is the Java code you requested:
```java
@Override
public boolean isDisplayed() {
WebDriverLikeRequest request = buildRequest(WebDriverLikeCommand.DISPLAYED);
return (Boolean) commandExecutor.execute(request);
}
```
Hope this helps! | |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/LogManager.java | LogManager.getContext | public static LoggerContext getContext(final boolean currentContext) {
// TODO: would it be a terrible idea to try and find the caller ClassLoader here?
try {
return factory.getContext(FQCN, null, null, currentContext, null, null);
} catch (final IllegalStateException ex) {
... | java | public static LoggerContext getContext(final boolean currentContext) {
// TODO: would it be a terrible idea to try and find the caller ClassLoader here?
try {
return factory.getContext(FQCN, null, null, currentContext, null, null);
} catch (final IllegalStateException ex) {
... | [
"public",
"static",
"LoggerContext",
"getContext",
"(",
"final",
"boolean",
"currentContext",
")",
"{",
"// TODO: would it be a terrible idea to try and find the caller ClassLoader here?",
"try",
"{",
"return",
"factory",
".",
"getContext",
"(",
"FQCN",
",",
"null",
",",
... | Returns a LoggerContext.
@param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different Lo... | [
"Returns",
"a",
"LoggerContext",
"."
] | 493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/LogManager.java#L113-L121 | train | Gets the LoggerContext. | Create a Java method that does the following: "Gets the LoggerContext.". | Of course, here is the Java code you requested:
```java
public static LoggerContext getContext(final boolean currentContext) {
// TODO: would it be a terrible idea to try and find the caller ClassLoader here?
try {
return factory.getContext(FQCN, null, null, currentContext, null, null);
... | |
knightliao/apollo | src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java | DateUtils.getRoundedDay | public static Date getRoundedDay(Date dt) {
Calendar cal = new GregorianCalendar();
cal.setTime(dt);
return new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH))
.getTime();
} | java | public static Date getRoundedDay(Date dt) {
Calendar cal = new GregorianCalendar();
cal.setTime(dt);
return new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH))
.getTime();
} | [
"public",
"static",
"Date",
"getRoundedDay",
"(",
"Date",
"dt",
")",
"{",
"Calendar",
"cal",
"=",
"new",
"GregorianCalendar",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"dt",
")",
";",
"return",
"new",
"GregorianCalendar",
"(",
"cal",
".",
"get",
"(",
... | 生成某天零时的日期对象 例如:若输入时间为(2004-08-01 11:30:58),将获得(2004-08-01 00:00:00)的日期对象
@return Date java.util.Date对象 | [
"生成某天零时的日期对象",
"例如:若输入时间为(2004",
"-",
"08",
"-",
"01",
"11",
":",
"30",
":",
"58),将获得(2004",
"-",
"08",
"-",
"01",
"00",
":",
"00",
":",
"00)的日期对象"
] | d7a283659fa3e67af6375db8969b2d065a8ce6eb | https://github.com/knightliao/apollo/blob/d7a283659fa3e67af6375db8969b2d065a8ce6eb/src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java#L501-L506 | train | Get the rounded day of the calendar. | Create a Java method that does the following: "Get the rounded day of the calendar.". | Of course, here is the Java code you requested:
```java
public static Date getRoundedDay(Date dt) {
Calendar cal = new GregorianCalendar();
cal.setTime(dt);
return new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH))
.getTime(... | |
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/AWSSimpleSystemsManagementClient.java | AWSSimpleSystemsManagementClient.describeInstanceAssociationsStatus | @Override
public DescribeInstanceAssociationsStatusResult describeInstanceAssociationsStatus(DescribeInstanceAssociationsStatusRequest request) {
request = beforeClientExecution(request);
return executeDescribeInstanceAssociationsStatus(request);
} | java | @Override
public DescribeInstanceAssociationsStatusResult describeInstanceAssociationsStatus(DescribeInstanceAssociationsStatusRequest request) {
request = beforeClientExecution(request);
return executeDescribeInstanceAssociationsStatus(request);
} | [
"@",
"Override",
"public",
"DescribeInstanceAssociationsStatusResult",
"describeInstanceAssociationsStatus",
"(",
"DescribeInstanceAssociationsStatusRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeDescribeInstanc... | <p>
The status of the associations for the instance(s).
</p>
@param describeInstanceAssociationsStatusRequest
@return Result of the DescribeInstanceAssociationsStatus operation returned by the service.
@throws InternalServerErrorException
An error occurred on the server side.
@throws InvalidInstanceIdException
The fol... | [
"<p",
">",
"The",
"status",
"of",
"the",
"associations",
"for",
"the",
"instance",
"(",
"s",
")",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/AWSSimpleSystemsManagementClient.java#L2928-L2932 | train | Retrieves the status of the instance associations. | Create a Java method that does the following: "Retrieves the status of the instance associations.". | Of course, here is the Java code you requested:
```java
@Override
public DescribeInstanceAssociationsStatusResult describeInstanceAssociationsStatus(DescribeInstanceAssociationsStatusRequest request) {
request = beforeClientExecution(request);
return executeDescribeInstanceAssociationsStatus(reques... | |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.notEquals | @Throws(IllegalEqualException.class)
public static boolean notEquals(final boolean expected, final boolean check, @Nonnull final String message) {
if (expected == check) {
throw new IllegalEqualException(message, check);
}
return check;
} | java | @Throws(IllegalEqualException.class)
public static boolean notEquals(final boolean expected, final boolean check, @Nonnull final String message) {
if (expected == check) {
throw new IllegalEqualException(message, check);
}
return check;
} | [
"@",
"Throws",
"(",
"IllegalEqualException",
".",
"class",
")",
"public",
"static",
"boolean",
"notEquals",
"(",
"final",
"boolean",
"expected",
",",
"final",
"boolean",
"check",
",",
"@",
"Nonnull",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"expect... | Ensures that a passed boolean is not equal to another boolean. The comparison is made using
<code>expected == check</code>.
@param expected
Expected value
@param check
boolean to be checked
@param message
an error message describing why the booleans must equal (will be passed to
{@code IllegalEqualException})
@return ... | [
"Ensures",
"that",
"a",
"passed",
"boolean",
"is",
"not",
"equal",
"to",
"another",
"boolean",
".",
"The",
"comparison",
"is",
"made",
"using",
"<code",
">",
"expected",
"==",
"check<",
"/",
"code",
">",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L2272-L2279 | train | Checks if two boolean values are not equals. | Create a Java method that does the following: "Checks if two boolean values are not equals.". | Of course, here is the Java code you requested:
```java
@Throws(IllegalEqualException.class)
public static boolean notEquals(final boolean expected, final boolean check, @Nonnull final String message) {
if (expected == check) {
throw new IllegalEqualException(message, check);
}
return check;
}
```
Hope th... | |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateTime.java | DateTime.toCalendar | public Calendar toCalendar(TimeZone zone) {
return toCalendar(zone, Locale.getDefault(Locale.Category.FORMAT));
} | java | public Calendar toCalendar(TimeZone zone) {
return toCalendar(zone, Locale.getDefault(Locale.Category.FORMAT));
} | [
"public",
"Calendar",
"toCalendar",
"(",
"TimeZone",
"zone",
")",
"{",
"return",
"toCalendar",
"(",
"zone",
",",
"Locale",
".",
"getDefault",
"(",
"Locale",
".",
"Category",
".",
"FORMAT",
")",
")",
";",
"}"
] | 转换为Calendar
@param zone 时区 {@link TimeZone}
@return {@link Calendar} | [
"转换为Calendar"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L530-L532 | train | Converts this object to a calendar. | Create a Java method that does the following: "Converts this object to a calendar.". | Of course, here is the Java code you requested:
```java
public Calendar toCalendar(TimeZone zone) {
return toCalendar(zone, Locale.getDefault(Locale.Category.FORMAT));
}
```
Hope this helps! | |
oblac/jodd | jodd-servlet/src/main/java/jodd/servlet/CsrfShield.java | CsrfShield.checkCsrfToken | @SuppressWarnings({"unchecked"})
public static boolean checkCsrfToken(final HttpSession session, final String tokenValue) {
Set<Token> tokenSet = (Set<Token>) session.getAttribute(CSRF_TOKEN_SET);
if ((tokenSet == null) && (tokenValue == null)) {
return true;
}
if ((tokenSet == null) || (tokenValue == null)... | java | @SuppressWarnings({"unchecked"})
public static boolean checkCsrfToken(final HttpSession session, final String tokenValue) {
Set<Token> tokenSet = (Set<Token>) session.getAttribute(CSRF_TOKEN_SET);
if ((tokenSet == null) && (tokenValue == null)) {
return true;
}
if ((tokenSet == null) || (tokenValue == null)... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"static",
"boolean",
"checkCsrfToken",
"(",
"final",
"HttpSession",
"session",
",",
"final",
"String",
"tokenValue",
")",
"{",
"Set",
"<",
"Token",
">",
"tokenSet",
"=",
"(",
"Set",
"<",... | Checks token value.
C | [
"Checks",
"token",
"value",
".",
"C"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-servlet/src/main/java/jodd/servlet/CsrfShield.java#L154-L177 | test | Check if a CSRF token is expired. | Create a Java method that does the following: "Check if a CSRF token is expired.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings({"unchecked"})
public static boolean checkCsrfToken(final HttpSession session, final String tokenValue) {
Set<Token> tokenSet = (Set<Token>) session.getAttribute(CSRF_TOKEN_SET);
if ((tokenSet == null) && (tokenValue == null)) {
return t... | |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/depdcy/AbstractExcelWriter.java | AbstractExcelWriter.getCellStyleMapping | public Map<String, CellStyle> getCellStyleMapping() {
if (this.cellStyleMapping == null) {
this.cellStyleMapping = new HashMap<String, CellStyle>(16);
}
return cellStyleMapping;
} | java | public Map<String, CellStyle> getCellStyleMapping() {
if (this.cellStyleMapping == null) {
this.cellStyleMapping = new HashMap<String, CellStyle>(16);
}
return cellStyleMapping;
} | [
"public",
"Map",
"<",
"String",
",",
"CellStyle",
">",
"getCellStyleMapping",
"(",
")",
"{",
"if",
"(",
"this",
".",
"cellStyleMapping",
"==",
"null",
")",
"{",
"this",
".",
"cellStyleMapping",
"=",
"new",
"HashMap",
"<",
"String",
",",
"CellStyle",
">",
... | 获取属性名到单元格样式的映射
@return 返回属性名到单元格样式的映射 | [
"获取属性名到单元格样式的映射"
] | d9605b7bfe0c28a05289252e12d163e114080b4a | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/depdcy/AbstractExcelWriter.java#L432-L437 | train | Gets the cellStyleMapping property. | Create a Java method that does the following: "Gets the cellStyleMapping property.". | Of course, here is the Java code you requested:
```java
public Map<String, CellStyle> getCellStyleMapping() {
if (this.cellStyleMapping == null) {
this.cellStyleMapping = new HashMap<String, CellStyle>(16);
}
return cellStyleMapping;
}
```
Hope this helps! | |
beangle/beangle3 | ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java | BeanDefinitionParser.parseReplacedMethodSubElements | public void parseReplacedMethodSubElements(Element beanEle, MethodOverrides overrides) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, REPLACED_METHOD_ELEMENT)) {
Element replacedM... | java | public void parseReplacedMethodSubElements(Element beanEle, MethodOverrides overrides) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, REPLACED_METHOD_ELEMENT)) {
Element replacedM... | [
"public",
"void",
"parseReplacedMethodSubElements",
"(",
"Element",
"beanEle",
",",
"MethodOverrides",
"overrides",
")",
"{",
"NodeList",
"nl",
"=",
"beanEle",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nl",
".",... | Parse replaced-method sub-elements of the given bean element.
@param beanEle a {@link org.w3c.dom.Element} object.
@param overrides a {@link org.springframework.beans.factory.support.MethodOverrides} object. | [
"Parse",
"replaced",
"-",
"method",
"sub",
"-",
"elements",
"of",
"the",
"given",
"bean",
"element",
"."
] | 33df2873a5f38e28ac174a1d3b8144eb2f808e64 | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L443-L461 | train | Parse the replaced method sub - elements of the given bean element. | Create a Java method that does the following: "Parse the replaced method sub - elements of the given bean element.". | Of course, here is the Java code you requested:
```java
public void parseReplacedMethodSubElements(Element beanEle, MethodOverrides overrides) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(no... | |
opensourceBIM/BIMserver | PluginBase/generated/org/bimserver/models/ifc2x3tc1/impl/Ifc2x3tc1PackageImpl.java | Ifc2x3tc1PackageImpl.getIfcComplexNumber | public EClass getIfcComplexNumber() {
if (ifcComplexNumberEClass == null) {
ifcComplexNumberEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(934);
}
return ifcComplexNumberEClass;
} | java | public EClass getIfcComplexNumber() {
if (ifcComplexNumberEClass == null) {
ifcComplexNumberEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(934);
}
return ifcComplexNumberEClass;
} | [
"public",
"EClass",
"getIfcComplexNumber",
"(",
")",
"{",
"if",
"(",
"ifcComplexNumberEClass",
"==",
"null",
")",
"{",
"ifcComplexNumberEClass",
"=",
"(",
"EClass",
")",
"EPackage",
".",
"Registry",
".",
"INSTANCE",
".",
"getEPackage",
"(",
"Ifc2x3tc1Package",
"... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 116803c3047d1b32217366757cee1bb3880fda63 | https://github.com/opensourceBIM/BIMserver/blob/116803c3047d1b32217366757cee1bb3880fda63/PluginBase/generated/org/bimserver/models/ifc2x3tc1/impl/Ifc2x3tc1PackageImpl.java#L35659-L35665 | train | Get the IfcComplexNumberEClass from the EPackage. | Create a Java method that does the following: "Get the IfcComplexNumberEClass from the EPackage.". | Of course, here is the Java code you requested:
```java
public EClass getIfcComplexNumber() {
if (ifcComplexNumberEClass == null) {
ifcComplexNumberEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(934);
}
return ifcComplexNumberEClass;
}
```... | |
datacleaner/DataCleaner | engine/core/src/main/java/org/datacleaner/extensions/ExtensionPackage.java | ExtensionPackage.getExtensionClassLoader | public static ClassLoader getExtensionClassLoader() {
final Collection<ClassLoader> childClassLoaders = new ArrayList<>();
childClassLoaders.addAll(_allExtensionClassLoaders);
childClassLoaders.add(ClassLoaderUtils.getParentClassLoader());
return new CompoundClassLoader(childClassLoaders... | java | public static ClassLoader getExtensionClassLoader() {
final Collection<ClassLoader> childClassLoaders = new ArrayList<>();
childClassLoaders.addAll(_allExtensionClassLoaders);
childClassLoaders.add(ClassLoaderUtils.getParentClassLoader());
return new CompoundClassLoader(childClassLoaders... | [
"public",
"static",
"ClassLoader",
"getExtensionClassLoader",
"(",
")",
"{",
"final",
"Collection",
"<",
"ClassLoader",
">",
"childClassLoaders",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"childClassLoaders",
".",
"addAll",
"(",
"_allExtensionClassLoaders",
")",... | Gets the classloader that represents the currently loaded extensions'
classes.
@return | [
"Gets",
"the",
"classloader",
"that",
"represents",
"the",
"currently",
"loaded",
"extensions",
"classes",
"."
] | 9aa01fdac3560cef51c55df3cb2ac5c690b57639 | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/extensions/ExtensionPackage.java#L79-L84 | train | Get the extension class loader. | Create a Java method that does the following: "Get the extension class loader.". | Of course, here is the Java code you requested:
```java
public static ClassLoader getExtensionClassLoader() {
final Collection<ClassLoader> childClassLoaders = new ArrayList<>();
childClassLoaders.addAll(_allExtensionClassLoaders);
childClassLoaders.add(ClassLoaderUtils.getParentClassLoader());... | |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java | Presence.isAway | public boolean isAway() {
return type == Type.available && (mode == Mode.away || mode == Mode.xa || mode == Mode.dnd);
} | java | public boolean isAway() {
return type == Type.available && (mode == Mode.away || mode == Mode.xa || mode == Mode.dnd);
} | [
"public",
"boolean",
"isAway",
"(",
")",
"{",
"return",
"type",
"==",
"Type",
".",
"available",
"&&",
"(",
"mode",
"==",
"Mode",
".",
"away",
"||",
"mode",
"==",
"Mode",
".",
"xa",
"||",
"mode",
"==",
"Mode",
".",
"dnd",
")",
";",
"}"
] | Returns true if the presence type is {@link Type#available available} and the presence
mode is {@link Mode#away away}, {@link Mode#xa extended away}, or
{@link Mode#dnd do not disturb}. False will be returned when the type or mode
is any other value, including when the presence type is unavailable (offline).
This is a ... | [
"Returns",
"true",
"if",
"the",
"presence",
"type",
"is",
"{",
"@link",
"Type#available",
"available",
"}",
"and",
"the",
"presence",
"mode",
"is",
"{",
"@link",
"Mode#away",
"away",
"}",
"{",
"@link",
"Mode#xa",
"extended",
"away",
"}",
"or",
"{",
"@link"... | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java#L162-L164 | train | Returns true if the session is a server - side session. | Create a Java method that does the following: "Returns true if the session is a server - side session.". | Of course, here is the Java code you requested:
```java
public boolean isAway() {
return type == Type.available && (mode == Mode.away || mode == Mode.xa || mode == Mode.dnd);
}
```
Hope this helps! | |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v2/DbxTeamClientV2.java | DbxTeamClientV2.asMember | public DbxClientV2 asMember(String memberId) {
if (memberId == null) {
throw new IllegalArgumentException("'memberId' should not be null");
}
DbxRawClientV2 asMemberClient = new DbxTeamRawClientV2(
_client.getRequestConfig(),
credential,
_client.g... | java | public DbxClientV2 asMember(String memberId) {
if (memberId == null) {
throw new IllegalArgumentException("'memberId' should not be null");
}
DbxRawClientV2 asMemberClient = new DbxTeamRawClientV2(
_client.getRequestConfig(),
credential,
_client.g... | [
"public",
"DbxClientV2",
"asMember",
"(",
"String",
"memberId",
")",
"{",
"if",
"(",
"memberId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"'memberId' should not be null\"",
")",
";",
"}",
"DbxRawClientV2",
"asMemberClient",
"=",
"... | Returns a {@link DbxClientV2} that performs requests against Dropbox API
user endpoints as the given team member.
<p> This method performs no validation of the team member ID. </p>
@param memberId Team member ID of member in this client's team, never
{@code null}.
@return Dropbox client that issues requests to user... | [
"Returns",
"a",
"{",
"@link",
"DbxClientV2",
"}",
"that",
"performs",
"requests",
"against",
"Dropbox",
"API",
"user",
"endpoints",
"as",
"the",
"given",
"team",
"member",
"."
] | d86157005fad6233c18b4b0f10f00b8d9d56ae92 | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v2/DbxTeamClientV2.java#L105-L120 | train | As member client. | Create a Java method that does the following: "As member client.". | Of course, here is the Java code you requested:
```java
public DbxClientV2 asMember(String memberId) {
if (memberId == null) {
throw new IllegalArgumentException("'memberId' should not be null");
}
DbxRawClientV2 asMemberClient = new DbxTeamRawClientV2(
_client.getReque... | |
ngageoint/geopackage-android | geopackage-sdk/src/main/java/mil/nga/geopackage/db/metadata/GeometryMetadataDataSource.java | GeometryMetadataDataSource.get | public GeometryMetadata get(long geoPackageId, String tableName, long id) {
String selection = GeometryMetadata.COLUMN_GEOPACKAGE_ID
+ " = ? AND " + GeometryMetadata.COLUMN_TABLE_NAME + " = ? AND "
+ GeometryMetadata.COLUMN_ID + " = ?";
String[] selectionArgs = new String... | java | public GeometryMetadata get(long geoPackageId, String tableName, long id) {
String selection = GeometryMetadata.COLUMN_GEOPACKAGE_ID
+ " = ? AND " + GeometryMetadata.COLUMN_TABLE_NAME + " = ? AND "
+ GeometryMetadata.COLUMN_ID + " = ?";
String[] selectionArgs = new String... | [
"public",
"GeometryMetadata",
"get",
"(",
"long",
"geoPackageId",
",",
"String",
"tableName",
",",
"long",
"id",
")",
"{",
"String",
"selection",
"=",
"GeometryMetadata",
".",
"COLUMN_GEOPACKAGE_ID",
"+",
"\" = ? AND \"",
"+",
"GeometryMetadata",
".",
"COLUMN_TABLE_... | Get a table metadata
@param geoPackageId GeoPackage id
@param tableName table name
@param id id
@return geometry metadata | [
"Get",
"a",
"table",
"metadata"
] | d19e9fcc636462c0f0ae1b7eca4acafae48de21b | https://github.com/ngageoint/geopackage-android/blob/d19e9fcc636462c0f0ae1b7eca4acafae48de21b/geopackage-sdk/src/main/java/mil/nga/geopackage/db/metadata/GeometryMetadataDataSource.java#L337-L354 | test | Get the GeometryMetadata object for a given geoPackageId tableName and id | Create a Java method that does the following: "Get the GeometryMetadata object for a given geoPackageId tableName and id". | Of course, here is the Java code you requested:
```java
public GeometryMetadata get(long geoPackageId, String tableName, long id) {
String selection = GeometryMetadata.COLUMN_GEOPACKAGE_ID
+ " = ? AND " + GeometryMetadata.COLUMN_TABLE_NAME + " = ? AND "
+ GeometryMetadata.COLUMN... | |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java | StreamSegmentReadIndex.close | void close(boolean cleanCache) {
if (!this.closed) {
this.closed = true;
// Close storage reader (and thus cancel those reads).
this.storageReadManager.close();
// Cancel registered future reads and any reads pertaining to incomplete mergers.
ArrayLi... | java | void close(boolean cleanCache) {
if (!this.closed) {
this.closed = true;
// Close storage reader (and thus cancel those reads).
this.storageReadManager.close();
// Cancel registered future reads and any reads pertaining to incomplete mergers.
ArrayLi... | [
"void",
"close",
"(",
"boolean",
"cleanCache",
")",
"{",
"if",
"(",
"!",
"this",
".",
"closed",
")",
"{",
"this",
".",
"closed",
"=",
"true",
";",
"// Close storage reader (and thus cancel those reads).",
"this",
".",
"storageReadManager",
".",
"close",
"(",
"... | Closes the ReadIndex and optionally cleans the cache.
@param cleanCache If true, the Cache will be cleaned up of all ReadIndexEntries pertaining to this ReadIndex. If
false, the Cache will not be touched. | [
"Closes",
"the",
"ReadIndex",
"and",
"optionally",
"cleans",
"the",
"cache",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L136-L160 | train | Close the instance. | Create a Java method that does the following: "Close the instance.". | Of course, here is the Java code you requested:
```java
void close(boolean cleanCache) {
if (!this.closed) {
this.closed = true;
// Close storage reader (and thus cancel those reads).
this.storageReadManager.close();
// Cancel registered future reads and any re... | |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPInputStream.java | GZIPInputStream.readHeader | private int readHeader(InputStream this_in) throws IOException {
CheckedInputStream in = new CheckedInputStream(this_in, crc);
crc.reset();
// Check header magic
if (readUShort(in) != GZIP_MAGIC) {
throw new ZipException("Not in GZIP format");
}
// Check compr... | java | private int readHeader(InputStream this_in) throws IOException {
CheckedInputStream in = new CheckedInputStream(this_in, crc);
crc.reset();
// Check header magic
if (readUShort(in) != GZIP_MAGIC) {
throw new ZipException("Not in GZIP format");
}
// Check compr... | [
"private",
"int",
"readHeader",
"(",
"InputStream",
"this_in",
")",
"throws",
"IOException",
"{",
"CheckedInputStream",
"in",
"=",
"new",
"CheckedInputStream",
"(",
"this_in",
",",
"crc",
")",
";",
"crc",
".",
"reset",
"(",
")",
";",
"// Check header magic",
"... | /*
Reads GZIP member header and returns the total byte number
of this member header. | [
"/",
"*",
"Reads",
"GZIP",
"member",
"header",
"and",
"returns",
"the",
"total",
"byte",
"number",
"of",
"this",
"member",
"header",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPInputStream.java#L161-L205 | train | Read the GZIP header. | Create a Java method that does the following: "Read the GZIP header.". | Of course, here is the Java code you requested:
```java
private int readHeader(InputStream this_in) throws IOException {
CheckedInputStream in = new CheckedInputStream(this_in, crc);
crc.reset();
// Check header magic
if (readUShort(in) != GZIP_MAGIC) {
throw new ZipExceptio... | |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XString.java | XString.fixWhiteSpace | public XMLString fixWhiteSpace(boolean trimHead, boolean trimTail,
boolean doublePunctuationSpaces)
{
// %OPT% !!!!!!!
int len = this.length();
char[] buf = new char[len];
this.getChars(0, len, buf, 0);
boolean edit = false;
int s;
for (s = 0; s < len; ... | java | public XMLString fixWhiteSpace(boolean trimHead, boolean trimTail,
boolean doublePunctuationSpaces)
{
// %OPT% !!!!!!!
int len = this.length();
char[] buf = new char[len];
this.getChars(0, len, buf, 0);
boolean edit = false;
int s;
for (s = 0; s < len; ... | [
"public",
"XMLString",
"fixWhiteSpace",
"(",
"boolean",
"trimHead",
",",
"boolean",
"trimTail",
",",
"boolean",
"doublePunctuationSpaces",
")",
"{",
"// %OPT% !!!!!!!",
"int",
"len",
"=",
"this",
".",
"length",
"(",
")",
";",
"char",
"[",
"]",
"buf",
"=",
"n... | Conditionally trim all leading and trailing whitespace in the specified String.
All strings of white space are
replaced by a single space character (#x20), except spaces after punctuation which
receive double spaces if doublePunctuationSpaces is true.
This function may be useful to a formatter, but to get first class
r... | [
"Conditionally",
"trim",
"all",
"leading",
"and",
"trailing",
"whitespace",
"in",
"the",
"specified",
"String",
".",
"All",
"strings",
"of",
"white",
"space",
"are",
"replaced",
"by",
"a",
"single",
"space",
"character",
"(",
"#x20",
")",
"except",
"spaces",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XString.java#L1025-L1112 | train | Fix whitespace in the XMLString. | Create a Java method that does the following: "Fix whitespace in the XMLString.". | Of course, here is the Java code you requested:
```java
public XMLString fixWhiteSpace(boolean trimHead, boolean trimTail,
boolean doublePunctuationSpaces)
{
// %OPT% !!!!!!!
int len = this.length();
char[] buf = new char[len];
this.getChars(0, len, buf, 0);
bo... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Implement a queue data structure in Java using a circular linked list. The queue should support the following operations:
- enqueue(element): Insert an element to the back of the queue.
- dequeue(): Remove and return the element from the front of the queue.
- peek(): Return the element at the front of the queue without... | Here is an implementation of the Queue class in Java using a circular linked list:
```java
public class Queue<T> {
private Node<T> front;
private Node<T> rear;
private int capacity;
private int size;
// Node class
private static class Node<T> {
private T data;
private Node<T> n... | |||||||
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdiameter.java | nsdiameter.get | public static nsdiameter get(nitro_service service) throws Exception{
nsdiameter obj = new nsdiameter();
nsdiameter[] response = (nsdiameter[])obj.get_resources(service);
return response[0];
} | java | public static nsdiameter get(nitro_service service) throws Exception{
nsdiameter obj = new nsdiameter();
nsdiameter[] response = (nsdiameter[])obj.get_resources(service);
return response[0];
} | [
"public",
"static",
"nsdiameter",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"nsdiameter",
"obj",
"=",
"new",
"nsdiameter",
"(",
")",
";",
"nsdiameter",
"[",
"]",
"response",
"=",
"(",
"nsdiameter",
"[",
"]",
")",
"obj",
".",
... | Use this API to fetch all the nsdiameter resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"nsdiameter",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdiameter.java#L168-L172 | train | Use this API to fetch all the nsdiameter resources that are configured on netscaler. | Create a Java method that does the following: "Use this API to fetch all the nsdiameter resources that are configured on netscaler.". | Of course, here is the Java code you requested:
```java
public static nsdiameter get(nitro_service service) throws Exception{
nsdiameter obj = new nsdiameter();
nsdiameter[] response = (nsdiameter[])obj.get_resources(service);
return response[0];
}
```
Hope this helps! | |
SimplicityApks/ReminderDatePicker | lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java | DateSpinner.setShowMonthItem | public void setShowMonthItem(boolean enable) {
if(enable && !showMonthItem) {
// create the in 1 month item
final Calendar date = Calendar.getInstance();
date.add(Calendar.MONTH, 1);
addAdapterItem(new DateItem(formatDate(date), date, R.id.date_month));
}
... | java | public void setShowMonthItem(boolean enable) {
if(enable && !showMonthItem) {
// create the in 1 month item
final Calendar date = Calendar.getInstance();
date.add(Calendar.MONTH, 1);
addAdapterItem(new DateItem(formatDate(date), date, R.id.date_month));
}
... | [
"public",
"void",
"setShowMonthItem",
"(",
"boolean",
"enable",
")",
"{",
"if",
"(",
"enable",
"&&",
"!",
"showMonthItem",
")",
"{",
"// create the in 1 month item",
"final",
"Calendar",
"date",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"date",
".",
... | Toggles showing the month item. Month mode an item in exactly one month from now.
@param enable True to enable, false to disable month mode. | [
"Toggles",
"showing",
"the",
"month",
"item",
".",
"Month",
"mode",
"an",
"item",
"in",
"exactly",
"one",
"month",
"from",
"now",
"."
] | 7596fbac77a5d26f687fec11758935a2b7db156f | https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L521-L532 | train | Enable or disable the month item. | Create a Java method that does the following: "Enable or disable the month item.". | Of course, here is the Java code you requested:
```java
public void setShowMonthItem(boolean enable) {
if(enable && !showMonthItem) {
// create the in 1 month item
final Calendar date = Calendar.getInstance();
date.add(Calendar.MONTH, 1);
addAdapterItem(new DateI... | |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrDocumentXmlContent.java | CmsSolrDocumentXmlContent.collectSchemaXpathsForSimpleValues | public static void collectSchemaXpathsForSimpleValues(
CmsObject cms,
CmsXmlContentDefinition def,
String path,
Set<String> result) {
List<I_CmsXmlSchemaType> nestedTypes = def.getTypeSequence();
for (I_CmsXmlSchemaType nestedType : nestedTypes) {
String subP... | java | public static void collectSchemaXpathsForSimpleValues(
CmsObject cms,
CmsXmlContentDefinition def,
String path,
Set<String> result) {
List<I_CmsXmlSchemaType> nestedTypes = def.getTypeSequence();
for (I_CmsXmlSchemaType nestedType : nestedTypes) {
String subP... | [
"public",
"static",
"void",
"collectSchemaXpathsForSimpleValues",
"(",
"CmsObject",
"cms",
",",
"CmsXmlContentDefinition",
"def",
",",
"String",
"path",
",",
"Set",
"<",
"String",
">",
"result",
")",
"{",
"List",
"<",
"I_CmsXmlSchemaType",
">",
"nestedTypes",
"=",... | Collects a list of all possible XPaths for a content definition.<p>
@param cms the CMS context to use
@param def the content definition
@param path the path of the given content definition
@param result the set used to collect the XPaths | [
"Collects",
"a",
"list",
"of",
"all",
"possible",
"XPaths",
"for",
"a",
"content",
"definition",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrDocumentXmlContent.java#L325-L341 | train | Collect schema Xpaths for simple values. | Create a Java method that does the following: "Collect schema Xpaths for simple values.". | Of course, here is the Java code you requested:
```java
public static void collectSchemaXpathsForSimpleValues(
CmsObject cms,
CmsXmlContentDefinition def,
String path,
Set<String> result) {
List<I_CmsXmlSchemaType> nestedTypes = def.getTypeSequence();
for (I_CmsXmlSchem... | |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java | MessagePacker.packBinaryHeader | public MessagePacker packBinaryHeader(int len)
throws IOException
{
if (len < (1 << 8)) {
writeByteAndByte(BIN8, (byte) len);
}
else if (len < (1 << 16)) {
writeByteAndShort(BIN16, (short) len);
}
else {
writeByteAndInt(BIN32, l... | java | public MessagePacker packBinaryHeader(int len)
throws IOException
{
if (len < (1 << 8)) {
writeByteAndByte(BIN8, (byte) len);
}
else if (len < (1 << 16)) {
writeByteAndShort(BIN16, (short) len);
}
else {
writeByteAndInt(BIN32, l... | [
"public",
"MessagePacker",
"packBinaryHeader",
"(",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
"<",
"(",
"1",
"<<",
"8",
")",
")",
"{",
"writeByteAndByte",
"(",
"BIN8",
",",
"(",
"byte",
")",
"len",
")",
";",
"}",
"else",
"if"... | Writes header of a Binary value.
<p>
You MUST call {@link #writePayload(byte[])} or {@link #addPayload(byte[])} method to write body binary.
@param len number of bytes of a binary to be written
@return this
@throws IOException when underlying output throws IOException | [
"Writes",
"header",
"of",
"a",
"Binary",
"value",
".",
"<p",
">",
"You",
"MUST",
"call",
"{",
"@link",
"#writePayload",
"(",
"byte",
"[]",
")",
"}",
"or",
"{",
"@link",
"#addPayload",
"(",
"byte",
"[]",
")",
"}",
"method",
"to",
"write",
"body",
"bin... | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java#L938-L951 | train | packBinaryHeader This method is used to pack a binary message header. | Create a Java method that does the following: "packBinaryHeader This method is used to pack a binary message header.". | Of course, here is the Java code you requested:
```java
public MessagePacker packBinaryHeader(int len)
throws IOException
{
if (len < (1 << 8)) {
writeByteAndByte(BIN8, (byte) len);
}
else if (len < (1 << 16)) {
writeByteAndShort(BIN16, (short) len);
... | |
czyzby/gdx-lml | lml-uedi/src/main/java/com/github/czyzby/lml/uedi/music/MusicService.java | MusicService.fadeInCurrentTheme | protected void fadeInCurrentTheme() {
if (currentTheme != null) {
currentTheme.setLooping(false);
currentTheme.setVolume(0f);
currentTheme.setOnCompletionListener(listener);
stage.addAction(
VolumeAction.setVolume(currentTheme, 0f, musicVolume.... | java | protected void fadeInCurrentTheme() {
if (currentTheme != null) {
currentTheme.setLooping(false);
currentTheme.setVolume(0f);
currentTheme.setOnCompletionListener(listener);
stage.addAction(
VolumeAction.setVolume(currentTheme, 0f, musicVolume.... | [
"protected",
"void",
"fadeInCurrentTheme",
"(",
")",
"{",
"if",
"(",
"currentTheme",
"!=",
"null",
")",
"{",
"currentTheme",
".",
"setLooping",
"(",
"false",
")",
";",
"currentTheme",
".",
"setVolume",
"(",
"0f",
")",
";",
"currentTheme",
".",
"setOnCompleti... | Smoothly fades in current theme. | [
"Smoothly",
"fades",
"in",
"current",
"theme",
"."
] | 7623b322e6afe49ad4dd636c80c230150a1cfa4e | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-uedi/src/main/java/com/github/czyzby/lml/uedi/music/MusicService.java#L229-L238 | train | Fade in current theme. | Create a Java method that does the following: "Fade in current theme.". | Of course, here is the Java code you requested:
```java
protected void fadeInCurrentTheme() {
if (currentTheme != null) {
currentTheme.setLooping(false);
currentTheme.setVolume(0f);
currentTheme.setOnCompletionListener(listener);
stage.addAction(
... | |
lucee/Lucee | core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java | CFMLExpressionInterpreter.digit | private void digit(StringBuilder rtn) {
while (cfml.isValidIndex()) {
if (!cfml.isCurrentDigit()) break;
rtn.append(cfml.getCurrentLower());
cfml.next();
}
} | java | private void digit(StringBuilder rtn) {
while (cfml.isValidIndex()) {
if (!cfml.isCurrentDigit()) break;
rtn.append(cfml.getCurrentLower());
cfml.next();
}
} | [
"private",
"void",
"digit",
"(",
"StringBuilder",
"rtn",
")",
"{",
"while",
"(",
"cfml",
".",
"isValidIndex",
"(",
")",
")",
"{",
"if",
"(",
"!",
"cfml",
".",
"isCurrentDigit",
"(",
")",
")",
"break",
";",
"rtn",
".",
"append",
"(",
"cfml",
".",
"g... | Liest die reinen Zahlen innerhalb des CFMLString aus und gibt diese als Zeichenkette zurueck.
<br />
EBNF:<br />
<code>"0"|..|"9";</code>
@param rtn | [
"Liest",
"die",
"reinen",
"Zahlen",
"innerhalb",
"des",
"CFMLString",
"aus",
"und",
"gibt",
"diese",
"als",
"Zeichenkette",
"zurueck",
".",
"<br",
"/",
">",
"EBNF",
":",
"<br",
"/",
">",
"<code",
">",
"0",
"|",
"..",
"|",
"9",
";",
"<",
"/",
"code",
... | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L1156-L1163 | train | This method is called to append a digit to a StringBuilder. | Create a Java method that does the following: "This method is called to append a digit to a StringBuilder.". | Of course, here is the Java code you requested:
```java
private void digit(StringBuilder rtn) {
while (cfml.isValidIndex()) {
if (!cfml.isCurrentDigit()) break;
rtn.append(cfml.getCurrentLower());
cfml.next();
}
}
```
Hope this helps! | |
jtablesaw/tablesaw | core/src/main/java/tech/tablesaw/api/TimeColumn.java | TimeColumn.asBytes | @Override
public byte[] asBytes(int rowNumber) {
return ByteBuffer.allocate(byteSize()).putInt(getIntInternal(rowNumber)).array();
} | java | @Override
public byte[] asBytes(int rowNumber) {
return ByteBuffer.allocate(byteSize()).putInt(getIntInternal(rowNumber)).array();
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"asBytes",
"(",
"int",
"rowNumber",
")",
"{",
"return",
"ByteBuffer",
".",
"allocate",
"(",
"byteSize",
"(",
")",
")",
".",
"putInt",
"(",
"getIntInternal",
"(",
"rowNumber",
")",
")",
".",
"array",
"(",
")"... | Returns the contents of the cell at rowNumber as a byte[] | [
"Returns",
"the",
"contents",
"of",
"the",
"cell",
"at",
"rowNumber",
"as",
"a",
"byte",
"[]"
] | 68a75b4098ac677e9486df5572cf13ec39f9f701 | https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/TimeColumn.java#L536-L539 | train | Returns a byte array containing the row number. | Create a Java method that does the following: "Returns a byte array containing the row number.". | Of course, here is the Java code you requested:
```java
@Override
public byte[] asBytes(int rowNumber) {
return ByteBuffer.allocate(byteSize()).putInt(getIntInternal(rowNumber)).array();
}
```
Hope this helps! | |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java | CmsAreaSelectPanel.setSelectPosition | private void setSelectPosition(int posX, int posY, int height, int width) {
setSelectPositionX(posX, width);
setSelectPositionY(posY, height);
} | java | private void setSelectPosition(int posX, int posY, int height, int width) {
setSelectPositionX(posX, width);
setSelectPositionY(posY, height);
} | [
"private",
"void",
"setSelectPosition",
"(",
"int",
"posX",
",",
"int",
"posY",
",",
"int",
"height",
",",
"int",
"width",
")",
"{",
"setSelectPositionX",
"(",
"posX",
",",
"width",
")",
";",
"setSelectPositionY",
"(",
"posY",
",",
"height",
")",
";",
"}... | Sets position and size of the select area.<p>
@param posX the new X position
@param posY the new Y position
@param height the new height
@param width the new width | [
"Sets",
"position",
"and",
"size",
"of",
"the",
"select",
"area",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java#L779-L783 | train | Sets the select position of the image. | Create a Java method that does the following: "Sets the select position of the image.". | Of course, here is the Java code you requested:
```java
private void setSelectPosition(int posX, int posY, int height, int width) {
setSelectPositionX(posX, width);
setSelectPositionY(posY, height);
}
```
Hope this helps! | |
GerdHolz/TOVAL | src/de/invation/code/toval/types/Multiset.java | Multiset.unionWith | public void unionWith(Multiset<O> multiset) throws ParameterException {
Validate.notNull(multiset);
for (O o : multiset.support()) {
setMultiplicity(o, Math.max(multiplicity(o), multiset.multiplicity(o)));
}
} | java | public void unionWith(Multiset<O> multiset) throws ParameterException {
Validate.notNull(multiset);
for (O o : multiset.support()) {
setMultiplicity(o, Math.max(multiplicity(o), multiset.multiplicity(o)));
}
} | [
"public",
"void",
"unionWith",
"(",
"Multiset",
"<",
"O",
">",
"multiset",
")",
"throws",
"ParameterException",
"{",
"Validate",
".",
"notNull",
"(",
"multiset",
")",
";",
"for",
"(",
"O",
"o",
":",
"multiset",
".",
"support",
"(",
")",
")",
"{",
"setM... | Combines this multiset with the given multiset.<br>
This operation changes only this multiset, not the given one.
@param multiset The multiset to include.
@throws ParameterException | [
"Combines",
"this",
"multiset",
"with",
"the",
"given",
"multiset",
".",
"<br",
">",
"This",
"operation",
"changes",
"only",
"this",
"multiset",
"not",
"the",
"given",
"one",
"."
] | 036922cdfd710fa53b18e5dbe1e07f226f731fde | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/Multiset.java#L434-L439 | train | Union the two multiset. | Create a Java method that does the following: "Union the two multiset.". | Of course, here is the Java code you requested:
```java
public void unionWith(Multiset<O> multiset) throws ParameterException {
Validate.notNull(multiset);
for (O o : multiset.support()) {
setMultiplicity(o, Math.max(multiplicity(o), multiset.multiplicity(o)));
}
}
```
Hope this helps! | |
bwkimmel/java-util | src/main/java/ca/eandb/util/auth/FileLoginManager.java | FileLoginManager.load | @CommandArgument
public void load(
@OptionArgument("filename") String filename) {
users.clear();
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
while (reader.ready()) {
User user = User.fromString(reader.readLine());
users.put(user.username, us... | java | @CommandArgument
public void load(
@OptionArgument("filename") String filename) {
users.clear();
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
while (reader.ready()) {
User user = User.fromString(reader.readLine());
users.put(user.username, us... | [
"@",
"CommandArgument",
"public",
"void",
"load",
"(",
"@",
"OptionArgument",
"(",
"\"filename\"",
")",
"String",
"filename",
")",
"{",
"users",
".",
"clear",
"(",
")",
";",
"try",
"{",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
... | Loads a users file.
@param filename The filename of the users file to load. | [
"Loads",
"a",
"users",
"file",
"."
] | 0c03664d42f0e6b111f64447f222aa73c2819e5c | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/auth/FileLoginManager.java#L117-L135 | train | Load a single user from a file. | Create a Java method that does the following: "Load a single user from a file.". | Of course, here is the Java code you requested:
```java
@CommandArgument
public void load(
@OptionArgument("filename") String filename) {
users.clear();
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
while (reader.ready()) {
User user = User.fromStrin... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Construct an array of size 20 to store integers in Java. Initialize the array with random numbers between -1000 and 1000. Calculate the sum of all the prime numbers in the array and display the result. Additionally, display the maximum and minimum prime numbers found in the array. | Here's the Java code to implement your requirements:
```java
import java.util.Random;
public class PrimeNumberArray {
public static void main(String[] args) {
int[] array = new int[20];
Random random = new Random();
// Initialize the array with random numbers between -1000 and 1000
... | |||||||
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/VersionParser.java | VersionParser.identifyWindowsVersion | static VersionNumber identifyWindowsVersion(final String userAgent) {
VersionNumber version = VersionNumber.UNKNOWN;
final List<Pattern> patterns = new ArrayList<Pattern>();
patterns.add(Pattern.compile("Windows NT\\s?((\\d+)((\\.\\d+)+)?)"));
patterns.add(Pattern.compile("Windows Phone OS ((\\d+)((\\.\\d+)+)?)... | java | static VersionNumber identifyWindowsVersion(final String userAgent) {
VersionNumber version = VersionNumber.UNKNOWN;
final List<Pattern> patterns = new ArrayList<Pattern>();
patterns.add(Pattern.compile("Windows NT\\s?((\\d+)((\\.\\d+)+)?)"));
patterns.add(Pattern.compile("Windows Phone OS ((\\d+)((\\.\\d+)+)?)... | [
"static",
"VersionNumber",
"identifyWindowsVersion",
"(",
"final",
"String",
"userAgent",
")",
"{",
"VersionNumber",
"version",
"=",
"VersionNumber",
".",
"UNKNOWN",
";",
"final",
"List",
"<",
"Pattern",
">",
"patterns",
"=",
"new",
"ArrayList",
"<",
"Pattern",
... | This method try to determine the version number of the operating system <i>Windows</i> more accurately.
@param userAgent
user agent string
@return more accurately identified version number or {@code null} | [
"This",
"method",
"try",
"to",
"determine",
"the",
"version",
"number",
"of",
"the",
"operating",
"system",
"<i",
">",
"Windows<",
"/",
"i",
">",
"more",
"accurately",
"."
] | 215fb652723c52866572cff885f52a3fe67b9db5 | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/VersionParser.java#L230-L250 | train | Identify the Windows version number from the user agent string. | Create a Java method that does the following: "Identify the Windows version number from the user agent string.". | Of course, here is the Java code you requested:
```java
static VersionNumber identifyWindowsVersion(final String userAgent) {
VersionNumber version = VersionNumber.UNKNOWN;
final List<Pattern> patterns = new ArrayList<Pattern>();
patterns.add(Pattern.compile("Windows NT\\s?((\\d+)((\\.\\d+)+)?)"));
patterns.ad... | |
seedstack/jpa-addon | src/main/java/org/seedstack/jpa/internal/specification/JpaTranslationContext.java | JpaTranslationContext.pickExpression | @SuppressWarnings("unchecked")
public <E> Expression<E> pickExpression() {
Preconditions.checkState(this.expression != null, "No expression has been set");
Expression<E> result = (Expression<E>) this.expression;
expression = null;
return result;
} | java | @SuppressWarnings("unchecked")
public <E> Expression<E> pickExpression() {
Preconditions.checkState(this.expression != null, "No expression has been set");
Expression<E> result = (Expression<E>) this.expression;
expression = null;
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
">",
"Expression",
"<",
"E",
">",
"pickExpression",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"this",
".",
"expression",
"!=",
"null",
",",
"\"No expression has been set\"",
... | Returns the expression currently active in the building context.
@param <E> the type of the expression.
@return the JPA expression. | [
"Returns",
"the",
"expression",
"currently",
"active",
"in",
"the",
"building",
"context",
"."
] | 7b49f55b0af55d83804ccee68a7211e61dd06482 | https://github.com/seedstack/jpa-addon/blob/7b49f55b0af55d83804ccee68a7211e61dd06482/src/main/java/org/seedstack/jpa/internal/specification/JpaTranslationContext.java#L51-L57 | test | Pick the expression from the current context. | Create a Java method that does the following: "Pick the expression from the current context.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public <E> Expression<E> pickExpression() {
Preconditions.checkState(this.expression != null, "No expression has been set");
Expression<E> result = (Expression<E>) this.expression;
expression = null;
... | |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTemplateRenderer.java | WTemplateRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTemplate template = (WTemplate) component;
// Setup the context
Map<String, Object> context = new HashMap<>();
// Make the component available under the "wc" key.
context.put("wc", template);
// Load the... | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTemplate template = (WTemplate) component;
// Setup the context
Map<String, Object> context = new HashMap<>();
// Make the component available under the "wc" key.
context.put("wc", template);
// Load the... | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WTemplate",
"template",
"=",
"(",
"WTemplate",
")",
"component",
";",
"// Setup the context",
"Map",
"<",
"Stri... | Paints the given WTemplate.
@param component the WTemplate to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WTemplate",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTemplateRenderer.java#L28-L56 | train | Render the given WComponent. | Create a Java method that does the following: "Render the given WComponent.". | Of course, here is the Java code you requested:
```java
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTemplate template = (WTemplate) component;
// Setup the context
Map<String, Object> context = new HashMap<>();
// Make the component available under t... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Implement a method in Java to reverse a number. The number can be positive or negative. The reversed number should have the same sign as the original number.
In addition to reversing the number, your method should also remove any leading zeros. For example, if the original number is 100, the reversed number should be ... | Here is an implementation of a method in Java to reverse a number while considering the sign and removing leading zeros:
```java
public class ReverseNumber {
public static long reverseNumber(long number) {
boolean isNegative = number < 0;
if (isNegative) {
number = -number;
}
... | |||||||
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FileNameProducer.java | FileNameProducer.generateName | private String generateName()
{
Calendar date = Calendar.getInstance();
String sDate = getStrDate(date);
String sTime = getStrTime(date);
StringBuilder fileName = new StringBuilder(backupSetName).append("-").append(sDate).append("_").append(sTime).append(".");
if (isFullB... | java | private String generateName()
{
Calendar date = Calendar.getInstance();
String sDate = getStrDate(date);
String sTime = getStrTime(date);
StringBuilder fileName = new StringBuilder(backupSetName).append("-").append(sDate).append("_").append(sTime).append(".");
if (isFullB... | [
"private",
"String",
"generateName",
"(",
")",
"{",
"Calendar",
"date",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"String",
"sDate",
"=",
"getStrDate",
"(",
"date",
")",
";",
"String",
"sTime",
"=",
"getStrTime",
"(",
"date",
")",
";",
"StringB... | Generate name for backup file (directory) based on backup set name and current time. | [
"Generate",
"name",
"for",
"backup",
"file",
"(",
"directory",
")",
"based",
"on",
"backup",
"set",
"name",
"and",
"current",
"time",
"."
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/FileNameProducer.java#L212-L232 | train | Generate a name for
| Create a Java method that does the following: "Generate a name for". | Of course, here is the Java code you requested:
```java
private String generateName()
{
Calendar date = Calendar.getInstance();
String sDate = getStrDate(date);
String sTime = getStrTime(date);
StringBuilder fileName = new StringBuilder(backupSetName).append("-").append(sDate).app... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.