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... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 7