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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/WhiteSpaceFilterStateMachine.java | WhiteSpaceFilterStateMachine.nextState | public StateChange nextState(final char c) {
StateChange change = currentState.getChange(c);
currentState = change.getNewState();
return change;
} | java | public StateChange nextState(final char c) {
StateChange change = currentState.getChange(c);
currentState = change.getNewState();
return change;
} | [
"public",
"StateChange",
"nextState",
"(",
"final",
"char",
"c",
")",
"{",
"StateChange",
"change",
"=",
"currentState",
".",
"getChange",
"(",
"c",
")",
";",
"currentState",
"=",
"change",
".",
"getNewState",
"(",
")",
";",
"return",
"change",
";",
"}"
] | Moves the machine to the next state, based on the input character.
@param c the input character.
@return the state change. | [
"Moves",
"the",
"machine",
"to",
"the",
"next",
"state",
"based",
"on",
"the",
"input",
"character",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/WhiteSpaceFilterStateMachine.java#L647-L652 | train | Move the current state to the next state. | Create a Java method that does the following: "Move the current state to the next state.". | Of course, here is the Java code you requested:
```java
public StateChange nextState(final char c) {
StateChange change = currentState.getChange(c);
currentState = change.getNewState();
return change;
}
```
Hope this helps! | |
google/guava | guava/src/com/google/common/collect/Multisets.java | Multisets.immutableEntry | public static <E> Multiset.Entry<E> immutableEntry(@Nullable E e, int n) {
return new ImmutableEntry<E>(e, n);
} | java | public static <E> Multiset.Entry<E> immutableEntry(@Nullable E e, int n) {
return new ImmutableEntry<E>(e, n);
} | [
"public",
"static",
"<",
"E",
">",
"Multiset",
".",
"Entry",
"<",
"E",
">",
"immutableEntry",
"(",
"@",
"Nullable",
"E",
"e",
",",
"int",
"n",
")",
"{",
"return",
"new",
"ImmutableEntry",
"<",
"E",
">",
"(",
"e",
",",
"n",
")",
";",
"}"
] | Returns an immutable multiset entry with the specified element and count. The entry will be
serializable if {@code e} is.
@param e the element to be associated with the returned entry
@param n the count to be associated with the returned entry
@throws IllegalArgumentException if {@code n} is negative | [
"Returns",
"an",
"immutable",
"multiset",
"entry",
"with",
"the",
"specified",
"element",
"and",
"count",
".",
"The",
"entry",
"will",
"be",
"serializable",
"if",
"{",
"@code",
"e",
"}",
"is",
"."
] | 7155d12b70a2406fa84d94d4b8b3bc108e89abfd | https://github.com/google/guava/blob/7155d12b70a2406fa84d94d4b8b3bc108e89abfd/guava/src/com/google/common/collect/Multisets.java#L244-L246 | valid | Returns an immutable entry of the specified element. | Create a Java method that does the following: "Returns an immutable entry of the specified element.". | Of course, here is the Java code you requested:
```java
public static <E> Multiset.Entry<E> immutableEntry(@Nullable E e, int n) {
return new ImmutableEntry<E>(e, n);
}
```
Hope this helps! | |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/CronCalendar.java | CronCalendar.setCronExpression | public void setCronExpression (@Nonnull final String expression) throws ParseException
{
final CronExpression newExp = new CronExpression (expression);
setCronExpression (newExp);
} | java | public void setCronExpression (@Nonnull final String expression) throws ParseException
{
final CronExpression newExp = new CronExpression (expression);
setCronExpression (newExp);
} | [
"public",
"void",
"setCronExpression",
"(",
"@",
"Nonnull",
"final",
"String",
"expression",
")",
"throws",
"ParseException",
"{",
"final",
"CronExpression",
"newExp",
"=",
"new",
"CronExpression",
"(",
"expression",
")",
";",
"setCronExpression",
"(",
"newExp",
"... | Sets the cron expression for the calendar to a new value
@param expression
the new string value to build a cron expression from
@throws ParseException
if the string expression cannot be parsed | [
"Sets",
"the",
"cron",
"expression",
"for",
"the",
"calendar",
"to",
"a",
"new",
"value"
] | b000790b46a9f8d23ad44cc20591f753d07c0229 | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/CronCalendar.java#L249-L254 | train | Sets the CronExpression. | Create a Java method that does the following: "Sets the CronExpression.". | Of course, here is the Java code you requested:
```java
public void setCronExpression (@Nonnull final String expression) throws ParseException
{
final CronExpression newExp = new CronExpression (expression);
setCronExpression (newExp);
}
```
Hope this helps! | |
facebookarchive/hadoop-20 | src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/OfflineAnonymizer.java | OfflineAnonymizer.anonymize | public void anonymize() throws Exception {
EventRecord er = null;
SerializedRecord sr = null;
BufferedWriter bfw = new BufferedWriter(new FileWriter(logfile.getName()
+ ".anonymized"));
System.out.println("Anonymizing log records...");
while ((er = parser.getNext()) != null) {
if (er... | java | public void anonymize() throws Exception {
EventRecord er = null;
SerializedRecord sr = null;
BufferedWriter bfw = new BufferedWriter(new FileWriter(logfile.getName()
+ ".anonymized"));
System.out.println("Anonymizing log records...");
while ((er = parser.getNext()) != null) {
if (er... | [
"public",
"void",
"anonymize",
"(",
")",
"throws",
"Exception",
"{",
"EventRecord",
"er",
"=",
"null",
";",
"SerializedRecord",
"sr",
"=",
"null",
";",
"BufferedWriter",
"bfw",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"logfile",
".",
"get... | Performs anonymization for the log file. Log entries are
read one by one and EventRecords are created, which are then
anonymized and written to the output. | [
"Performs",
"anonymization",
"for",
"the",
"log",
"file",
".",
"Log",
"entries",
"are",
"read",
"one",
"by",
"one",
"and",
"EventRecords",
"are",
"created",
"which",
"are",
"then",
"anonymized",
"and",
"written",
"to",
"the",
"output",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/OfflineAnonymizer.java#L75-L100 | train | Anonymize the log file. | Create a Java method that does the following: "Anonymize the log file.". | Of course, here is the Java code you requested:
```java
public void anonymize() throws Exception {
EventRecord er = null;
SerializedRecord sr = null;
BufferedWriter bfw = new BufferedWriter(new FileWriter(logfile.getName()
+ ".anonymized"));
System.out.println("Anonymizing log records...");
... | |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java | SarlLinkFactory.getLinkForAnnotationType | protected void getLinkForAnnotationType(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.type = type.asAnnotatedType().underlyingType();
link.addContent(getLink(linkInfo));
} | java | protected void getLinkForAnnotationType(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.type = type.asAnnotatedType().underlyingType();
link.addContent(getLink(linkInfo));
} | [
"protected",
"void",
"getLinkForAnnotationType",
"(",
"Content",
"link",
",",
"LinkInfo",
"linkInfo",
",",
"Type",
"type",
")",
"{",
"link",
".",
"addContent",
"(",
"getTypeAnnotationLinks",
"(",
"linkInfo",
")",
")",
";",
"linkInfo",
".",
"type",
"=",
"type",... | Build the link for the annotation type.
@param link the link.
@param linkInfo the information on the link.
@param type the type. | [
"Build",
"the",
"link",
"for",
"the",
"annotation",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L75-L79 | train | Get the link for an annotation type. | Create a Java method that does the following: "Get the link for an annotation type.". | Of course, here is the Java code you requested:
```java
protected void getLinkForAnnotationType(Content link, LinkInfo linkInfo, Type type) {
link.addContent(getTypeAnnotationLinks(linkInfo));
linkInfo.type = type.asAnnotatedType().underlyingType();
link.addContent(getLink(linkInfo));
}
```
Hope this helps! | |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/provisioning/ImportApi.java | ImportApi.getImportStatus | public ImportStatus getImportStatus(String adminName, String tenantName) throws ProvisioningApiException {
try {
GetImportStatusResponse resp = importApi.getImportStatus(adminName, tenantName);
if (resp.getStatus().getCode().intValue() != 0) {
throw new ProvisioningApiException("Error getting impor... | java | public ImportStatus getImportStatus(String adminName, String tenantName) throws ProvisioningApiException {
try {
GetImportStatusResponse resp = importApi.getImportStatus(adminName, tenantName);
if (resp.getStatus().getCode().intValue() != 0) {
throw new ProvisioningApiException("Error getting impor... | [
"public",
"ImportStatus",
"getImportStatus",
"(",
"String",
"adminName",
",",
"String",
"tenantName",
")",
"throws",
"ProvisioningApiException",
"{",
"try",
"{",
"GetImportStatusResponse",
"resp",
"=",
"importApi",
".",
"getImportStatus",
"(",
"adminName",
",",
"tenan... | Get import status.
Get all active imports for the specified tenant.
@param adminName The login name of an administrator for the tenant. (required)
@param tenantName The name of the tenant. (required)
@return ImportStatus object.
@throws ProvisioningApiException if the call is unsuccessful. | [
"Get",
"import",
"status",
".",
"Get",
"all",
"active",
"imports",
"for",
"the",
"specified",
"tenant",
"."
] | 1ad594c3767cec83052168e350994f922a26f75e | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/ImportApi.java#L116-L128 | train | Get the status of an existing import. | Create a Java method that does the following: "Get the status of an existing import.". | Of course, here is the Java code you requested:
```java
public ImportStatus getImportStatus(String adminName, String tenantName) throws ProvisioningApiException {
try {
GetImportStatusResponse resp = importApi.getImportStatus(adminName, tenantName);
if (resp.getStatus().getCode().intValue() != 0) {
... | |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT | public void organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT(String organizationName, String exchangeService, String path, Long allowedAccountId, OvhExchangePublicFolderPermission body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeS... | java | public void organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT(String organizationName, String exchangeService, String path, Long allowedAccountId, OvhExchangePublicFolderPermission body) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeS... | [
"public",
"void",
"organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"path",
",",
"Long",
"allowedAccountId",
",",
"OvhExchangePublicFolderPermission",
"bo... | Alter this object properties
REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}/permission/{allowedAccountId}
@param body [required] New object properties
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The int... | [
"Alter",
"this",
"object",
"properties"
] | 6d531a40e56e09701943e334c25f90f640c55701 | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L265-L269 | train | Update public folder permission | Create a Java method that does the following: "Update public folder permission". | Of course, here is the Java code you requested:
```java
public void organizationName_service_exchangeService_publicFolder_path_permission_allowedAccountId_PUT(String organizationName, String exchangeService, String path, Long allowedAccountId, OvhExchangePublicFolderPermission body) throws IOException {
String qPath... | |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/DualInputSemanticProperties.java | DualInputSemanticProperties.addReadFields2 | public void addReadFields2(FieldSet readFields) {
if(this.readFields2 == null) {
this.readFields2 = new FieldSet(readFields);
} else {
this.readFields2.addAll(readFields);
}
} | java | public void addReadFields2(FieldSet readFields) {
if(this.readFields2 == null) {
this.readFields2 = new FieldSet(readFields);
} else {
this.readFields2.addAll(readFields);
}
} | [
"public",
"void",
"addReadFields2",
"(",
"FieldSet",
"readFields",
")",
"{",
"if",
"(",
"this",
".",
"readFields2",
"==",
"null",
")",
"{",
"this",
".",
"readFields2",
"=",
"new",
"FieldSet",
"(",
"readFields",
")",
";",
"}",
"else",
"{",
"this",
".",
... | Adds, to the existing information, field(s) that are read in
the source record(s) from the second input.
@param readFields the position(s) in the source record(s) | [
"Adds",
"to",
"the",
"existing",
"information",
"field",
"(",
"s",
")",
"that",
"are",
"read",
"in",
"the",
"source",
"record",
"(",
"s",
")",
"from",
"the",
"second",
"input",
"."
] | c543a08f9676c5b2b0a7088123bd6e795a8ae0c8 | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/DualInputSemanticProperties.java#L215-L221 | train | Adds the given FieldSet to the read fields 2. | Create a Java method that does the following: "Adds the given FieldSet to the read fields 2.". | Of course, here is the Java code you requested:
```java
public void addReadFields2(FieldSet readFields) {
if(this.readFields2 == null) {
this.readFields2 = new FieldSet(readFields);
} else {
this.readFields2.addAll(readFields);
}
}
```
Hope this helps! | |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/Host2NodesMap.java | Host2NodesMap.getDatanodeByHost | @Deprecated
DatanodeDescriptor getDatanodeByHost(String host) {
if (host==null) {
return null;
}
hostmapLock.readLock().lock();
try {
DatanodeDescriptor[] nodes = map.get(host);
// no entry
if (nodes== null) {
return null;
}
// one node
if (node... | java | @Deprecated
DatanodeDescriptor getDatanodeByHost(String host) {
if (host==null) {
return null;
}
hostmapLock.readLock().lock();
try {
DatanodeDescriptor[] nodes = map.get(host);
// no entry
if (nodes== null) {
return null;
}
// one node
if (node... | [
"@",
"Deprecated",
"DatanodeDescriptor",
"getDatanodeByHost",
"(",
"String",
"host",
")",
"{",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"hostmapLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Dat... | get a data node by its host.
@deprecated use {@link #getDataNodeByIpPort(String)}
@return DatanodeDescriptor if found; otherwise null. | [
"get",
"a",
"data",
"node",
"by",
"its",
"host",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/Host2NodesMap.java#L134-L156 | train | Get the DatanodeDescriptor for a given host. | Create a Java method that does the following: "Get the DatanodeDescriptor for a given host.". | Of course, here is the Java code you requested:
```java
@Deprecated
DatanodeDescriptor getDatanodeByHost(String host) {
if (host==null) {
return null;
}
hostmapLock.readLock().lock();
try {
DatanodeDescriptor[] nodes = map.get(host);
// no entry
if (nodes== null) {
... | |
aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/GetTransitGatewayRouteTablePropagationsResult.java | GetTransitGatewayRouteTablePropagationsResult.setTransitGatewayRouteTablePropagations | public void setTransitGatewayRouteTablePropagations(java.util.Collection<TransitGatewayRouteTablePropagation> transitGatewayRouteTablePropagations) {
if (transitGatewayRouteTablePropagations == null) {
this.transitGatewayRouteTablePropagations = null;
return;
}
this.tran... | java | public void setTransitGatewayRouteTablePropagations(java.util.Collection<TransitGatewayRouteTablePropagation> transitGatewayRouteTablePropagations) {
if (transitGatewayRouteTablePropagations == null) {
this.transitGatewayRouteTablePropagations = null;
return;
}
this.tran... | [
"public",
"void",
"setTransitGatewayRouteTablePropagations",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"TransitGatewayRouteTablePropagation",
">",
"transitGatewayRouteTablePropagations",
")",
"{",
"if",
"(",
"transitGatewayRouteTablePropagations",
"==",
"null",
")",
... | <p>
Information about the route table propagations.
</p>
@param transitGatewayRouteTablePropagations
Information about the route table propagations. | [
"<p",
">",
"Information",
"about",
"the",
"route",
"table",
"propagations",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/GetTransitGatewayRouteTablePropagationsResult.java#L65-L73 | train | Sets the value of the transitGatewayRouteTablePropagations property. | Create a Java method that does the following: "Sets the value of the transitGatewayRouteTablePropagations property.". | Of course, here is the Java code you requested:
```java
public void setTransitGatewayRouteTablePropagations(java.util.Collection<TransitGatewayRouteTablePropagation> transitGatewayRouteTablePropagations) {
if (transitGatewayRouteTablePropagations == null) {
this.transitGatewayRouteTablePropagations... | |
buschmais/jqa-plugin-common | src/main/java/com/buschmais/jqassistant/plugin/common/api/scanner/ContainerFileResolver.java | ContainerFileResolver.flush | public void flush() {
createHierarchy();
sync(fileContainerDescriptor.getRequires(), requiredFiles);
sync(fileContainerDescriptor.getContains(), containedFiles);
} | java | public void flush() {
createHierarchy();
sync(fileContainerDescriptor.getRequires(), requiredFiles);
sync(fileContainerDescriptor.getContains(), containedFiles);
} | [
"public",
"void",
"flush",
"(",
")",
"{",
"createHierarchy",
"(",
")",
";",
"sync",
"(",
"fileContainerDescriptor",
".",
"getRequires",
"(",
")",
",",
"requiredFiles",
")",
";",
"sync",
"(",
"fileContainerDescriptor",
".",
"getContains",
"(",
")",
",",
"cont... | Flush the caches to the store. | [
"Flush",
"the",
"caches",
"to",
"the",
"store",
"."
] | 061e98f8262dffedd89b1d81736ef0aa8879b4f5 | https://github.com/buschmais/jqa-plugin-common/blob/061e98f8262dffedd89b1d81736ef0aa8879b4f5/src/main/java/com/buschmais/jqassistant/plugin/common/api/scanner/ContainerFileResolver.java#L51-L55 | valid | Flushes the cache. | Create a Java method that does the following: "Flushes the cache.". | Of course, here is the Java code you requested:
```java
public void flush() {
createHierarchy();
sync(fileContainerDescriptor.getRequires(), requiredFiles);
sync(fileContainerDescriptor.getContains(), containedFiles);
}
```
Hope this helps! | |
baratine/baratine | web/src/main/java/com/caucho/v5/log/impl/EnvironmentLogger.java | EnvironmentLogger.isLoggable | @Override
public final boolean isLoggable(Level level)
{
if (level == null)
return false;
int intValue = level.intValue();
if (intValue < _finestEffectiveLevelValue)
return false;
else if (! _hasLocalEffectiveLevel) {
return true;
}
else {
Integer localValue = _... | java | @Override
public final boolean isLoggable(Level level)
{
if (level == null)
return false;
int intValue = level.intValue();
if (intValue < _finestEffectiveLevelValue)
return false;
else if (! _hasLocalEffectiveLevel) {
return true;
}
else {
Integer localValue = _... | [
"@",
"Override",
"public",
"final",
"boolean",
"isLoggable",
"(",
"Level",
"level",
")",
"{",
"if",
"(",
"level",
"==",
"null",
")",
"return",
"false",
";",
"int",
"intValue",
"=",
"level",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"intValue",
"<",
... | True if the level is loggable | [
"True",
"if",
"the",
"level",
"is",
"loggable"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/log/impl/EnvironmentLogger.java#L274-L305 | train | Check if the log level is at least as low as the local or system level. | Create a Java method that does the following: "Check if the log level is at least as low as the local or system level.". | Of course, here is the Java code you requested:
```java
@Override
public final boolean isLoggable(Level level)
{
if (level == null)
return false;
int intValue = level.intValue();
if (intValue < _finestEffectiveLevelValue)
return false;
else if (! _hasLocalEffectiveLevel) {
r... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2InboundLink.java | H2InboundLink.changeInitialWindowSizeAllStreams | public synchronized void changeInitialWindowSizeAllStreams(int newSize) throws FlowControlException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "changeInitialWindowSizeAllStreams entry: newSize: " + newSize);
}
this.initialWindowSize = newSize;
... | java | public synchronized void changeInitialWindowSizeAllStreams(int newSize) throws FlowControlException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "changeInitialWindowSizeAllStreams entry: newSize: " + newSize);
}
this.initialWindowSize = newSize;
... | [
"public",
"synchronized",
"void",
"changeInitialWindowSizeAllStreams",
"(",
"int",
"newSize",
")",
"throws",
"FlowControlException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr"... | Update the initial window size for all open streams. Additionally, call updateInitialWindowsUpdateSize()
on each stream to notify it of the increase (and possible write out queued data)
@param int newSize
@throws FlowControlException | [
"Update",
"the",
"initial",
"window",
"size",
"for",
"all",
"open",
"streams",
".",
"Additionally",
"call",
"updateInitialWindowsUpdateSize",
"()",
"on",
"each",
"stream",
"to",
"notify",
"it",
"of",
"the",
"increase",
"(",
"and",
"possible",
"write",
"out",
"... | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2InboundLink.java#L832-L843 | train | Change the initial window size of all streams. | Create a Java method that does the following: "Change the initial window size of all streams.". | Of course, here is the Java code you requested:
```java
public synchronized void changeInitialWindowSizeAllStreams(int newSize) throws FlowControlException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "changeInitialWindowSizeAllStreams entry: newSize: " + newSiz... | |
apache/incubator-gobblin | gobblin-core-base/src/main/java/org/apache/gobblin/compression/CompressionConfigParser.java | CompressionConfigParser.getCompressionType | public static String getCompressionType(Map<String, Object> properties) {
return (String) properties.get(COMPRESSION_TYPE_KEY);
} | java | public static String getCompressionType(Map<String, Object> properties) {
return (String) properties.get(COMPRESSION_TYPE_KEY);
} | [
"public",
"static",
"String",
"getCompressionType",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"return",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"COMPRESSION_TYPE_KEY",
")",
";",
"}"
] | Return compression type
@param properties Compression config settings
@return String representing compression type, null if none exists | [
"Return",
"compression",
"type"
] | f029b4c0fea0fe4aa62f36dda2512344ff708bae | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/compression/CompressionConfigParser.java#L57-L59 | train | Get compression type from properties. | Create a Java method that does the following: "Get compression type from properties.". | Of course, here is the Java code you requested:
```java
public static String getCompressionType(Map<String, Object> properties) {
return (String) properties.get(COMPRESSION_TYPE_KEY);
}
```
Hope this helps! | |
wro4j/wro4j | wro4j-core/src/main/java/ro/isdc/wro/util/provider/ProviderFinder.java | ProviderFinder.lookupProviders | @SuppressWarnings("unchecked")
<P> Iterator<P> lookupProviders(final Class<P> providerClass) {
LOG.debug("searching for providers of type : {}", providerClass);
try {
final Class<?> serviceLoader = getClass().getClassLoader().loadClass("java.util.ServiceLoader");
LOG.debug("using {} to lookupProvi... | java | @SuppressWarnings("unchecked")
<P> Iterator<P> lookupProviders(final Class<P> providerClass) {
LOG.debug("searching for providers of type : {}", providerClass);
try {
final Class<?> serviceLoader = getClass().getClassLoader().loadClass("java.util.ServiceLoader");
LOG.debug("using {} to lookupProvi... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"<",
"P",
">",
"Iterator",
"<",
"P",
">",
"lookupProviders",
"(",
"final",
"Class",
"<",
"P",
">",
"providerClass",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"searching for providers of type : {}\"",
",",
"provid... | This method is useful for mocking the lookup operation. The implementation will try to use java.util.ServiceLoader
by default (available in jdk6) and will fallback to ServiceRegistry for earlier JDK versions. The reason for this
is to support GAE environment which doesn't contain the ServiceRegistry in its whitelist.
... | [
"This",
"method",
"is",
"useful",
"for",
"mocking",
"the",
"lookup",
"operation",
".",
"The",
"implementation",
"will",
"try",
"to",
"use",
"java",
".",
"util",
".",
"ServiceLoader",
"by",
"default",
"(",
"available",
"in",
"jdk6",
")",
"and",
"will",
"fal... | d2a3de71ab8bf0af7061fb6327501e08198338df | https://github.com/wro4j/wro4j/blob/d2a3de71ab8bf0af7061fb6327501e08198338df/wro4j-core/src/main/java/ro/isdc/wro/util/provider/ProviderFinder.java#L101-L113 | test | Lookup all providers of a given type. | Create a Java method that does the following: "Lookup all providers of a given type.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
<P> Iterator<P> lookupProviders(final Class<P> providerClass) {
LOG.debug("searching for providers of type : {}", providerClass);
try {
final Class<?> serviceLoader = getClass().getClassLoader().loadClass("java.util.... | |
opensourceBIM/BIMserver | PluginBase/generated/org/bimserver/models/ifc2x3tc1/impl/Ifc2x3tc1PackageImpl.java | Ifc2x3tc1PackageImpl.getIfcLuminousIntensityDistributionMeasure | public EClass getIfcLuminousIntensityDistributionMeasure() {
if (ifcLuminousIntensityDistributionMeasureEClass == null) {
ifcLuminousIntensityDistributionMeasureEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(701);
}
return ifcLuminousIntensit... | java | public EClass getIfcLuminousIntensityDistributionMeasure() {
if (ifcLuminousIntensityDistributionMeasureEClass == null) {
ifcLuminousIntensityDistributionMeasureEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(701);
}
return ifcLuminousIntensit... | [
"public",
"EClass",
"getIfcLuminousIntensityDistributionMeasure",
"(",
")",
"{",
"if",
"(",
"ifcLuminousIntensityDistributionMeasureEClass",
"==",
"null",
")",
"{",
"ifcLuminousIntensityDistributionMeasureEClass",
"=",
"(",
"EClass",
")",
"EPackage",
".",
"Registry",
".",
... | <!-- 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#L33709-L33715 | train | Get the IfcLuminousIntensityDistributionMeasure object from the Registry. | Create a Java method that does the following: "Get the IfcLuminousIntensityDistributionMeasure object from the Registry.". | Of course, here is the Java code you requested:
```java
public EClass getIfcLuminousIntensityDistributionMeasure() {
if (ifcLuminousIntensityDistributionMeasureEClass == null) {
ifcLuminousIntensityDistributionMeasureEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEC... | |
google/j2objc | jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Segment.java | Segment.push | public Segment push(Segment segment) {
segment.prev = this;
segment.next = next;
next.prev = segment;
next = segment;
return segment;
} | java | public Segment push(Segment segment) {
segment.prev = this;
segment.next = next;
next.prev = segment;
next = segment;
return segment;
} | [
"public",
"Segment",
"push",
"(",
"Segment",
"segment",
")",
"{",
"segment",
".",
"prev",
"=",
"this",
";",
"segment",
".",
"next",
"=",
"next",
";",
"next",
".",
"prev",
"=",
"segment",
";",
"next",
"=",
"segment",
";",
"return",
"segment",
";",
"}"... | Appends {@code segment} after this segment in the circularly-linked list.
Returns the pushed segment. | [
"Appends",
"{"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Segment.java#L93-L99 | train | Push a segment onto the end of the list. | Create a Java method that does the following: "Push a segment onto the end of the list.". | Of course, here is the Java code you requested:
```java
public Segment push(Segment segment) {
segment.prev = this;
segment.next = next;
next.prev = segment;
next = segment;
return segment;
}
```
Hope this helps! | |
citygml4j/citygml4j | src-gen/main/java/net/opengis/gml/ObjectFactory.java | ObjectFactory.createDatumID | @XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "datumID")
public JAXBElement<IdentifierType> createDatumID(IdentifierType value) {
return new JAXBElement<IdentifierType>(_DatumID_QNAME, IdentifierType.class, null, value);
} | java | @XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "datumID")
public JAXBElement<IdentifierType> createDatumID(IdentifierType value) {
return new JAXBElement<IdentifierType>(_DatumID_QNAME, IdentifierType.class, null, value);
} | [
"@",
"XmlElementDecl",
"(",
"namespace",
"=",
"\"http://www.opengis.net/gml\"",
",",
"name",
"=",
"\"datumID\"",
")",
"public",
"JAXBElement",
"<",
"IdentifierType",
">",
"createDatumID",
"(",
"IdentifierType",
"value",
")",
"{",
"return",
"new",
"JAXBElement",
"<",... | Create an instance of {@link JAXBElement }{@code <}{@link IdentifierType }{@code >}
@param value
Java instance representing xml element's value.
@return
the new instance of {@link JAXBElement }{@code <}{@link IdentifierType }{@code >} | [
"Create",
"an",
"instance",
"of",
"{",
"@link",
"JAXBElement",
"}",
"{",
"@code",
"<",
"}",
"{",
"@link",
"IdentifierType",
"}",
"{",
"@code",
">",
"}"
] | 9155997d5ecf7e8f19411a02ba047f13375b97b9 | https://github.com/citygml4j/citygml4j/blob/9155997d5ecf7e8f19411a02ba047f13375b97b9/src-gen/main/java/net/opengis/gml/ObjectFactory.java#L7188-L7191 | train | Create an instance of a DatumID specification. | Create a Java method that does the following: "Create an instance of a DatumID specification.". | Of course, here is the Java code you requested:
```java
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "datumID")
public JAXBElement<IdentifierType> createDatumID(IdentifierType value) {
return new JAXBElement<IdentifierType>(_DatumID_QNAME, IdentifierType.class, null, value);
}
```
... | |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalLinearPoint7.java | TrifocalLinearPoint7.process | public boolean process( List<AssociatedTriple> observations , TrifocalTensor solution ) {
if( observations.size() < 7 )
throw new IllegalArgumentException(
"At least 7 correspondences must be provided. Found "+observations.size());
// compute normalization to reduce numerical errors
LowLevelMultiViewOps... | java | public boolean process( List<AssociatedTriple> observations , TrifocalTensor solution ) {
if( observations.size() < 7 )
throw new IllegalArgumentException(
"At least 7 correspondences must be provided. Found "+observations.size());
// compute normalization to reduce numerical errors
LowLevelMultiViewOps... | [
"public",
"boolean",
"process",
"(",
"List",
"<",
"AssociatedTriple",
">",
"observations",
",",
"TrifocalTensor",
"solution",
")",
"{",
"if",
"(",
"observations",
".",
"size",
"(",
")",
"<",
"7",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"At leas... | Estimates the trifocal tensor given the set of observations
@param observations Set of observations
@param solution Output: Where the solution is written to
@return true if successful and false if it fails | [
"Estimates",
"the",
"trifocal",
"tensor",
"given",
"the",
"set",
"of",
"observations"
] | f01c0243da0ec086285ee722183804d5923bc3ac | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/TrifocalLinearPoint7.java#L97-L122 | train | Computes the trifocal tensor from the set of observations. | Create a Java method that does the following: "Computes the trifocal tensor from the set of observations.". | Of course, here is the Java code you requested:
```java
public boolean process( List<AssociatedTriple> observations , TrifocalTensor solution ) {
if( observations.size() < 7 )
throw new IllegalArgumentException(
"At least 7 correspondences must be provided. Found "+observations.size());
// compute normal... | |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/CalendarDate.java | CalendarDate.setEra | public CalendarDate setEra(Era era) {
if (this.era == era) {
return this;
}
this.era = era;
normalized = false;
return this;
} | java | public CalendarDate setEra(Era era) {
if (this.era == era) {
return this;
}
this.era = era;
normalized = false;
return this;
} | [
"public",
"CalendarDate",
"setEra",
"(",
"Era",
"era",
")",
"{",
"if",
"(",
"this",
".",
"era",
"==",
"era",
")",
"{",
"return",
"this",
";",
"}",
"this",
".",
"era",
"=",
"era",
";",
"normalized",
"=",
"false",
";",
"return",
"this",
";",
"}"
] | Sets the era of the date to the specified era. The default
implementation of this method accepts any Era value, including
<code>null</code>.
@exception NullPointerException if the calendar system for this
<code>CalendarDate</code> requires eras and the specified era
is null.
@exception IllegalArgumentException if the ... | [
"Sets",
"the",
"era",
"of",
"the",
"date",
"to",
"the",
"specified",
"era",
".",
"The",
"default",
"implementation",
"of",
"this",
"method",
"accepts",
"any",
"Era",
"value",
"including",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/CalendarDate.java#L113-L120 | train | Sets the era of the calendar. | Create a Java method that does the following: "Sets the era of the calendar.". | Of course, here is the Java code you requested:
```java
public CalendarDate setEra(Era era) {
if (this.era == era) {
return this;
}
this.era = era;
normalized = false;
return this;
}
```
Hope this helps! | |
opensourceBIM/BIMserver | PluginBase/generated/org/bimserver/models/ifc4/impl/Ifc4PackageImpl.java | Ifc4PackageImpl.getIfcHumidifierType | @Override
public EClass getIfcHumidifierType() {
if (ifcHumidifierTypeEClass == null) {
ifcHumidifierTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(315);
}
return ifcHumidifierTypeEClass;
} | java | @Override
public EClass getIfcHumidifierType() {
if (ifcHumidifierTypeEClass == null) {
ifcHumidifierTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(315);
}
return ifcHumidifierTypeEClass;
} | [
"@",
"Override",
"public",
"EClass",
"getIfcHumidifierType",
"(",
")",
"{",
"if",
"(",
"ifcHumidifierTypeEClass",
"==",
"null",
")",
"{",
"ifcHumidifierTypeEClass",
"=",
"(",
"EClass",
")",
"EPackage",
".",
"Registry",
".",
"INSTANCE",
".",
"getEPackage",
"(",
... | <!-- 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#L19720-L19727 | train | Get the IfcHumidifierType attribute of the interface. | Create a Java method that does the following: "Get the IfcHumidifierType attribute of the interface.". | Of course, here is the Java code you requested:
```java
@Override
public EClass getIfcHumidifierType() {
if (ifcHumidifierTypeEClass == null) {
ifcHumidifierTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(315);
}
return ifcHumidifierTypeECla... | |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/ProtoUtils.java | ProtoUtils.getDefaultInstanceMethod | private static MethodRef getDefaultInstanceMethod(Descriptor descriptor) {
TypeInfo message = messageRuntimeType(descriptor);
return MethodRef.createStaticMethod(
message, new Method("getDefaultInstance", message.type(), NO_METHOD_ARGS))
.asNonNullable();
} | java | private static MethodRef getDefaultInstanceMethod(Descriptor descriptor) {
TypeInfo message = messageRuntimeType(descriptor);
return MethodRef.createStaticMethod(
message, new Method("getDefaultInstance", message.type(), NO_METHOD_ARGS))
.asNonNullable();
} | [
"private",
"static",
"MethodRef",
"getDefaultInstanceMethod",
"(",
"Descriptor",
"descriptor",
")",
"{",
"TypeInfo",
"message",
"=",
"messageRuntimeType",
"(",
"descriptor",
")",
";",
"return",
"MethodRef",
".",
"createStaticMethod",
"(",
"message",
",",
"new",
"Met... | Returns the {@link MethodRef} for the generated defaultInstance method. | [
"Returns",
"the",
"{"
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ProtoUtils.java#L1253-L1258 | train | Get the default instance method. | Create a Java method that does the following: "Get the default instance method.". | Of course, here is the Java code you requested:
```java
private static MethodRef getDefaultInstanceMethod(Descriptor descriptor) {
TypeInfo message = messageRuntimeType(descriptor);
return MethodRef.createStaticMethod(
message, new Method("getDefaultInstance", message.type(), NO_METHOD_ARGS))
... | |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java | DefaultDataEditorWidget.setSelectedSearch | public Object setSelectedSearch(Object criteria) {
// filterField leegmaken
if (getTableWidget().getTextFilterField() != null) {
getTableWidget().getTextFilterField().setText("");
}
// if Referable == null, empty filterForm and execute filter
if (criteria == null) {
if (dataProvider.supportsFiltering())... | java | public Object setSelectedSearch(Object criteria) {
// filterField leegmaken
if (getTableWidget().getTextFilterField() != null) {
getTableWidget().getTextFilterField().setText("");
}
// if Referable == null, empty filterForm and execute filter
if (criteria == null) {
if (dataProvider.supportsFiltering())... | [
"public",
"Object",
"setSelectedSearch",
"(",
"Object",
"criteria",
")",
"{",
"// filterField leegmaken",
"if",
"(",
"getTableWidget",
"(",
")",
".",
"getTextFilterField",
"(",
")",
"!=",
"null",
")",
"{",
"getTableWidget",
"(",
")",
".",
"getTextFilterField",
"... | note: differs from previous method to allow setting of formObject on
filterForm. Will probably end up in refactoring of dataeditorwidget.
@param criteria
formObject to set on FilterForm.
@return | [
"note",
":",
"differs",
"from",
"previous",
"method",
"to",
"allow",
"setting",
"of",
"formObject",
"on",
"filterForm",
".",
"Will",
"probably",
"end",
"up",
"in",
"refactoring",
"of",
"dataeditorwidget",
"."
] | 6aad6e640b348cda8f3b0841f6e42025233f1eb8 | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/editor/DefaultDataEditorWidget.java#L700-L731 | train | Sets the selected search. | Create a Java method that does the following: "Sets the selected search.". | Of course, here is the Java code you requested:
```java
public Object setSelectedSearch(Object criteria) {
// filterField leegmaken
if (getTableWidget().getTextFilterField() != null) {
getTableWidget().getTextFilterField().setText("");
}
// if Referable == null, empty filterForm and execute filter
if (cri... | |
aws/aws-sdk-java | aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/transform/ObjectAttributeUpdateMarshaller.java | ObjectAttributeUpdateMarshaller.marshall | public void marshall(ObjectAttributeUpdate objectAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (objectAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(objectAttributeU... | java | public void marshall(ObjectAttributeUpdate objectAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (objectAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(objectAttributeU... | [
"public",
"void",
"marshall",
"(",
"ObjectAttributeUpdate",
"objectAttributeUpdate",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"objectAttributeUpdate",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument passe... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/transform/ObjectAttributeUpdateMarshaller.java#L44-L56 | train | marshalls the given ObjectAttributeUpdate to the JSON - compatible parameter object. | Create a Java method that does the following: "marshalls the given ObjectAttributeUpdate to the JSON - compatible parameter object.". | Of course, here is the Java code you requested:
```java
public void marshall(ObjectAttributeUpdate objectAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (objectAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {... | |
jbundle/jbundle | main/msg/src/main/java/org/jbundle/main/msg/app/MessageServerActivator.java | MessageServerActivator.init | public void init()
{
super.init();
if (this.getProperty(DBParams.APP_NAME) == null)
this.setProperty(DBParams.APP_NAME, this.getClass().getName());
} | java | public void init()
{
super.init();
if (this.getProperty(DBParams.APP_NAME) == null)
this.setProperty(DBParams.APP_NAME, this.getClass().getName());
} | [
"public",
"void",
"init",
"(",
")",
"{",
"super",
".",
"init",
"(",
")",
";",
"if",
"(",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"APP_NAME",
")",
"==",
"null",
")",
"this",
".",
"setProperty",
"(",
"DBParams",
".",
"APP_NAME",
",",
"this",
... | Init Method. | [
"Init",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/app/MessageServerActivator.java#L60-L66 | train | Initialize the
banner. | Create a Java method that does the following: "Initialize the
banner.". | Of course, here is the Java code you requested:
```java
public void init()
{
super.init();
if (this.getProperty(DBParams.APP_NAME) == null)
this.setProperty(DBParams.APP_NAME, this.getClass().getName());
}
```
Hope this helps! | |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/scroll/EndlessScrollHelper.java | EndlessScrollHelper.withNewItemsDeliveredTo | public EndlessScrollHelper<Model> withNewItemsDeliveredTo(@NonNull ModelAdapter<Model, ?> modelItemAdapter, @NonNull OnNewItemsListener<Model> extraOnNewItemsListener) {
mOnNewItemsListener = new DeliverToModelAdapter2<>(modelItemAdapter, extraOnNewItemsListener);
return this;
} | java | public EndlessScrollHelper<Model> withNewItemsDeliveredTo(@NonNull ModelAdapter<Model, ?> modelItemAdapter, @NonNull OnNewItemsListener<Model> extraOnNewItemsListener) {
mOnNewItemsListener = new DeliverToModelAdapter2<>(modelItemAdapter, extraOnNewItemsListener);
return this;
} | [
"public",
"EndlessScrollHelper",
"<",
"Model",
">",
"withNewItemsDeliveredTo",
"(",
"@",
"NonNull",
"ModelAdapter",
"<",
"Model",
",",
"?",
">",
"modelItemAdapter",
",",
"@",
"NonNull",
"OnNewItemsListener",
"<",
"Model",
">",
"extraOnNewItemsListener",
")",
"{",
... | An overload of {@link #withNewItemsDeliveredTo(ModelAdapter) withNewItemsDeliveredTo()}
that allows additional callbacks.
@param modelItemAdapter
@param extraOnNewItemsListener
@return | [
"An",
"overload",
"of",
"{",
"@link",
"#withNewItemsDeliveredTo",
"(",
"ModelAdapter",
")",
"withNewItemsDeliveredTo",
"()",
"}",
"that",
"allows",
"additional",
"callbacks",
"."
] | 3b2412abe001ba58422e0125846b704d4dba4ae9 | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/scroll/EndlessScrollHelper.java#L203-L206 | train | Adds a DeliverToModelAdapter2 to the endless scroll helper. | Create a Java method that does the following: "Adds a DeliverToModelAdapter2 to the endless scroll helper.". | Of course, here is the Java code you requested:
```java
public EndlessScrollHelper<Model> withNewItemsDeliveredTo(@NonNull ModelAdapter<Model, ?> modelItemAdapter, @NonNull OnNewItemsListener<Model> extraOnNewItemsListener) {
mOnNewItemsListener = new DeliverToModelAdapter2<>(modelItemAdapter, extraOnNewItemsL... | |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/utils/RestfulApiClient.java | RestfulApiClient.httpPost | public T httpPost(final URI uri, final List<Pair<String, String>> params) throws IOException {
// shortcut if the passed url is invalid.
if (null == uri) {
logger.error(" unable to perform httpPost as the passed uri is null.");
return null;
}
final HttpPost post = new HttpPost(uri);
ret... | java | public T httpPost(final URI uri, final List<Pair<String, String>> params) throws IOException {
// shortcut if the passed url is invalid.
if (null == uri) {
logger.error(" unable to perform httpPost as the passed uri is null.");
return null;
}
final HttpPost post = new HttpPost(uri);
ret... | [
"public",
"T",
"httpPost",
"(",
"final",
"URI",
"uri",
",",
"final",
"List",
"<",
"Pair",
"<",
"String",
",",
"String",
">",
">",
"params",
")",
"throws",
"IOException",
"{",
"// shortcut if the passed url is invalid.",
"if",
"(",
"null",
"==",
"uri",
")",
... | function to perform a Post http request.
@param uri the URI of the request.
@param params the form params to be posted, optional.
@return the response object type of which is specified by user.
@throws UnsupportedEncodingException, IOException | [
"function",
"to",
"perform",
"a",
"Post",
"http",
"request",
"."
] | d258ea7d6e66807c6eff79c5325d6d3443618dff | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/utils/RestfulApiClient.java#L117-L126 | train | Perform an HTTP POST request. | Create a Java method that does the following: "Perform an HTTP POST request.". | Of course, here is the Java code you requested:
```java
public T httpPost(final URI uri, final List<Pair<String, String>> params) throws IOException {
// shortcut if the passed url is invalid.
if (null == uri) {
logger.error(" unable to perform httpPost as the passed uri is null.");
return null;
... | |
LableOrg/java-uniqueid | uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ZooKeeperHelper.java | ZooKeeperHelper.mkdirp | static void mkdirp(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
boolean createPath = false;
for (String path : pathParts(znode)) {
if (!createPath) {
Stat stat = zookeeper.exists(path, false);
if (stat == null) {
... | java | static void mkdirp(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
boolean createPath = false;
for (String path : pathParts(znode)) {
if (!createPath) {
Stat stat = zookeeper.exists(path, false);
if (stat == null) {
... | [
"static",
"void",
"mkdirp",
"(",
"ZooKeeper",
"zookeeper",
",",
"String",
"znode",
")",
"throws",
"KeeperException",
",",
"InterruptedException",
"{",
"boolean",
"createPath",
"=",
"false",
";",
"for",
"(",
"String",
"path",
":",
"pathParts",
"(",
"znode",
")"... | Recursively create empty znodes (if missing) analogous to {@code mkdir -p}.
@param zookeeper ZooKeeper instance to work with.
@param znode Path to create.
@throws org.apache.zookeeper.KeeperException
@throws InterruptedException | [
"Recursively",
"create",
"empty",
"znodes",
"(",
"if",
"missing",
")",
"analogous",
"to",
"{",
"@code",
"mkdir",
"-",
"p",
"}",
"."
] | 554e30b2277765f365e7c7f598108de0ab5744f4 | https://github.com/LableOrg/java-uniqueid/blob/554e30b2277765f365e7c7f598108de0ab5744f4/uniqueid-zookeeper/src/main/java/org/lable/oss/uniqueid/zookeeper/ZooKeeperHelper.java#L40-L53 | train | Create the directory for the given znode. | Create a Java method that does the following: "Create the directory for the given znode.". | Of course, here is the Java code you requested:
```java
static void mkdirp(ZooKeeper zookeeper, String znode) throws KeeperException, InterruptedException {
boolean createPath = false;
for (String path : pathParts(znode)) {
if (!createPath) {
Stat stat = zookeeper.exists(pat... | |
fcrepo3/fcrepo | fcrepo-security/fcrepo-security-jaas/src/main/java/org/fcrepo/server/security/jaas/AuthFilterJAAS.java | AuthFilterJAAS.addRolesToSubject | private void addRolesToSubject(Subject subject, Set<String> userRoles) {
if (userRoles == null) {
userRoles = Collections.emptySet();
}
Map<String, Set<String>> attributes =
SubjectUtils.getAttributes(subject);
Set<String> roles = attributes.get(ROLE_KEY);
... | java | private void addRolesToSubject(Subject subject, Set<String> userRoles) {
if (userRoles == null) {
userRoles = Collections.emptySet();
}
Map<String, Set<String>> attributes =
SubjectUtils.getAttributes(subject);
Set<String> roles = attributes.get(ROLE_KEY);
... | [
"private",
"void",
"addRolesToSubject",
"(",
"Subject",
"subject",
",",
"Set",
"<",
"String",
">",
"userRoles",
")",
"{",
"if",
"(",
"userRoles",
"==",
"null",
")",
"{",
"userRoles",
"=",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"Map",
"<",
... | Adds roles to the Subject object.
@param subject
the subject that was returned from authentication.
@param userRoles
the set of user roles that were found. | [
"Adds",
"roles",
"to",
"the",
"Subject",
"object",
"."
] | 37df51b9b857fd12c6ab8269820d406c3c4ad774 | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-jaas/src/main/java/org/fcrepo/server/security/jaas/AuthFilterJAAS.java#L516-L536 | train | Add roles to subject. | Create a Java method that does the following: "Add roles to subject.". | Of course, here is the Java code you requested:
```java
private void addRolesToSubject(Subject subject, Set<String> userRoles) {
if (userRoles == null) {
userRoles = Collections.emptySet();
}
Map<String, Set<String>> attributes =
SubjectUtils.getAttributes(subject);... | |
drewwills/cernunnos | cernunnos-core/src/main/java/org/danann/cernunnos/runtime/web/ServletStatusCodeTask.java | ServletStatusCodeTask.perform | public void perform(TaskRequest req, TaskResponse res) {
HttpServletResponse resp = (HttpServletResponse) response.evaluate(req, res);
Integer sc = (Integer) statusCode.evaluate(req, res);
resp.setStatus(sc);
} | java | public void perform(TaskRequest req, TaskResponse res) {
HttpServletResponse resp = (HttpServletResponse) response.evaluate(req, res);
Integer sc = (Integer) statusCode.evaluate(req, res);
resp.setStatus(sc);
} | [
"public",
"void",
"perform",
"(",
"TaskRequest",
"req",
",",
"TaskResponse",
"res",
")",
"{",
"HttpServletResponse",
"resp",
"=",
"(",
"HttpServletResponse",
")",
"response",
".",
"evaluate",
"(",
"req",
",",
"res",
")",
";",
"Integer",
"sc",
"=",
"(",
"In... | {@inheritDoc } | [
"{"
] | dc6848e0253775e22b6c869fd06506d4ddb6d728 | https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/runtime/web/ServletStatusCodeTask.java#L81-L87 | train | Perform the task. | Create a Java method that does the following: "Perform the task.". | Of course, here is the Java code you requested:
```java
public void perform(TaskRequest req, TaskResponse res) {
HttpServletResponse resp = (HttpServletResponse) response.evaluate(req, res);
Integer sc = (Integer) statusCode.evaluate(req, res);
resp.setStatus(sc);
}
```
Hope this helps! | |
cdk/cdk | descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/PubchemFingerprinter.java | PubchemFingerprinter.decode | public static BitSet decode(String enc) {
byte[] fp = base64Decode(enc);
if (fp.length < 4) {
throw new IllegalArgumentException("Input is not a proper PubChem base64 encoded fingerprint");
}
int len = (fp[0] << 24) | (fp[1] << 16) | (fp[2] << 8) | (fp[3] & 0xff);
if... | java | public static BitSet decode(String enc) {
byte[] fp = base64Decode(enc);
if (fp.length < 4) {
throw new IllegalArgumentException("Input is not a proper PubChem base64 encoded fingerprint");
}
int len = (fp[0] << 24) | (fp[1] << 16) | (fp[2] << 8) | (fp[3] & 0xff);
if... | [
"public",
"static",
"BitSet",
"decode",
"(",
"String",
"enc",
")",
"{",
"byte",
"[",
"]",
"fp",
"=",
"base64Decode",
"(",
"enc",
")",
";",
"if",
"(",
"fp",
".",
"length",
"<",
"4",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Input is ... | Returns a fingerprint from a Base64 encoded Pubchem fingerprint.
@param enc The Base64 encoded fingerprint
@return A BitSet corresponding to the input fingerprint | [
"Returns",
"a",
"fingerprint",
"from",
"a",
"Base64",
"encoded",
"Pubchem",
"fingerprint",
"."
] | c3d0f16502bf08df50365fee392e11d7c9856657 | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/PubchemFingerprinter.java#L346-L369 | train | Decode a PubChem base64 encoded fingerprint into a BitSet. | Create a Java method that does the following: "Decode a PubChem base64 encoded fingerprint into a BitSet.". | Of course, here is the Java code you requested:
```java
public static BitSet decode(String enc) {
byte[] fp = base64Decode(enc);
if (fp.length < 4) {
throw new IllegalArgumentException("Input is not a proper PubChem base64 encoded fingerprint");
}
int len = (fp[0] << 24) | ... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Write a Java method called `binarySearch` that takes in an array of integers and a target integer, and returns the index of the target in the array if it exists, or -1 if it does not. The array is assumed to be sorted in ascending order.
Provide a time complexity analysis for the `binarySearch` method. | Here is the implementation of the `binarySearch` method:
```java
public static int binarySearch(int[] array, int target) {
int left = 0;
int right = array.length - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (array[mid] == target) {
return mid;
}... | |||||||
dickschoeller/gedbrowser | gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/finder/RootFinder.java | RootFinder.getDbName | @Override
public String getDbName(final FinderObject owner) {
final Root root = (Root) owner;
return root.getTheDbName();
} | java | @Override
public String getDbName(final FinderObject owner) {
final Root root = (Root) owner;
return root.getTheDbName();
} | [
"@",
"Override",
"public",
"String",
"getDbName",
"(",
"final",
"FinderObject",
"owner",
")",
"{",
"final",
"Root",
"root",
"=",
"(",
"Root",
")",
"owner",
";",
"return",
"root",
".",
"getTheDbName",
"(",
")",
";",
"}"
] | {@inheritDoc} | [
"{"
] | e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1 | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/finder/RootFinder.java#L67-L71 | train | Get the database name. | Create a Java method that does the following: "Get the database name.". | Of course, here is the Java code you requested:
```java
@Override
public String getDbName(final FinderObject owner) {
final Root root = (Root) owner;
return root.getTheDbName();
}
```
Hope this helps! | |
google/closure-templates | java/src/com/google/template/soy/incrementaldomsrc/GenIncrementalDomCodeVisitor.java | GenIncrementalDomCodeVisitor.generateGetParamMethodForSoyElementClass | private MethodDeclaration generateGetParamMethodForSoyElementClass(
TemplateParam param, boolean isAbstract) {
JsType jsType = JsType.forIncrementalDomState(param.type());
String accessorSuffix =
Ascii.toUpperCase(param.name().substring(0, 1)) + param.name().substring(1);
if (isAbstract) {
... | java | private MethodDeclaration generateGetParamMethodForSoyElementClass(
TemplateParam param, boolean isAbstract) {
JsType jsType = JsType.forIncrementalDomState(param.type());
String accessorSuffix =
Ascii.toUpperCase(param.name().substring(0, 1)) + param.name().substring(1);
if (isAbstract) {
... | [
"private",
"MethodDeclaration",
"generateGetParamMethodForSoyElementClass",
"(",
"TemplateParam",
"param",
",",
"boolean",
"isAbstract",
")",
"{",
"JsType",
"jsType",
"=",
"JsType",
".",
"forIncrementalDomState",
"(",
"param",
".",
"type",
"(",
")",
")",
";",
"Strin... | Generates `get[X]` for a given parameter value. | [
"Generates",
"get",
"[",
"X",
"]",
"for",
"a",
"given",
"parameter",
"value",
"."
] | cc61e1dff70ae97f24f417a57410081bc498bd56 | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/incrementaldomsrc/GenIncrementalDomCodeVisitor.java#L588-L626 | train | Generate get param method for SoyElement class. | Create a Java method that does the following: "Generate get param method for SoyElement class.". | Of course, here is the Java code you requested:
```java
private MethodDeclaration generateGetParamMethodForSoyElementClass(
TemplateParam param, boolean isAbstract) {
JsType jsType = JsType.forIncrementalDomState(param.type());
String accessorSuffix =
Ascii.toUpperCase(param.name().substring(0, 1... | |
PinaeOS/timon | src/main/java/org/pinae/timon/session/SqlSessionHelper.java | SqlSessionHelper.getSessionFactory | public static SqlSessionFactory getSessionFactory() throws IOException {
SqlSessionFactory sessionFactory = THREAD_SESSION_FACTORY.get();
try {
if (sessionFactory == null) {
sessionFactory = new DefaultSqlSessionFactory();
THREAD_SESSION_FACTORY.set(sessionFactory);
}
} catch (Exception e) { ... | java | public static SqlSessionFactory getSessionFactory() throws IOException {
SqlSessionFactory sessionFactory = THREAD_SESSION_FACTORY.get();
try {
if (sessionFactory == null) {
sessionFactory = new DefaultSqlSessionFactory();
THREAD_SESSION_FACTORY.set(sessionFactory);
}
} catch (Exception e) { ... | [
"public",
"static",
"SqlSessionFactory",
"getSessionFactory",
"(",
")",
"throws",
"IOException",
"{",
"SqlSessionFactory",
"sessionFactory",
"=",
"THREAD_SESSION_FACTORY",
".",
"get",
"(",
")",
";",
"try",
"{",
"if",
"(",
"sessionFactory",
"==",
"null",
")",
"{",
... | 获取当前线程的会话工厂类
@return 会话工厂类
@throws IOException IO异常处理 | [
"获取当前线程的会话工厂类"
] | b8c66868624e3eb1b36f6ecda3c556c456a30cd3 | https://github.com/PinaeOS/timon/blob/b8c66868624e3eb1b36f6ecda3c556c456a30cd3/src/main/java/org/pinae/timon/session/SqlSessionHelper.java#L24-L35 | train | Gets the SessionFactory. | Create a Java method that does the following: "Gets the SessionFactory.". | Of course, here is the Java code you requested:
```java
public static SqlSessionFactory getSessionFactory() throws IOException {
SqlSessionFactory sessionFactory = THREAD_SESSION_FACTORY.get();
try {
if (sessionFactory == null) {
sessionFactory = new DefaultSqlSessionFactory();
THREAD_SESSION_FACTO... | |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/NamingException.java | NamingException.getResolvedName | public Name getResolvedName() {
if (getCause() instanceof javax.naming.NamingException) {
return ((javax.naming.NamingException) getCause())
.getResolvedName();
}
return null;
} | java | public Name getResolvedName() {
if (getCause() instanceof javax.naming.NamingException) {
return ((javax.naming.NamingException) getCause())
.getResolvedName();
}
return null;
} | [
"public",
"Name",
"getResolvedName",
"(",
")",
"{",
"if",
"(",
"getCause",
"(",
")",
"instanceof",
"javax",
".",
"naming",
".",
"NamingException",
")",
"{",
"return",
"(",
"(",
"javax",
".",
"naming",
".",
"NamingException",
")",
"getCause",
"(",
")",
")... | Convenience method to get the leading portion of the resolved name
associated with this exception, if the root cause was an instance of
{@link javax.naming.NamingException}.
@return a composite name describing the the leading portion of the name
that was resolved successfully if the root cause is an instance
of javax.... | [
"Convenience",
"method",
"to",
"get",
"the",
"leading",
"portion",
"of",
"the",
"resolved",
"name",
"associated",
"with",
"this",
"exception",
"if",
"the",
"root",
"cause",
"was",
"an",
"instance",
"of",
"{",
"@link",
"javax",
".",
"naming",
".",
"NamingExce... | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/NamingException.java#L136-L142 | train | Gets the resolved name of the exception. | Create a Java method that does the following: "Gets the resolved name of the exception.". | Of course, here is the Java code you requested:
```java
public Name getResolvedName() {
if (getCause() instanceof javax.naming.NamingException) {
return ((javax.naming.NamingException) getCause())
.getResolvedName();
}
return null;
}
```
Hope this help... | |
dmak/jaxb-xew-plugin | src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java | XmlElementWrapperPlugin.moveInnerClassToParent | private boolean moveInnerClassToParent(Outline outline, Candidate candidate) {
// Skip basic parametrisations like "List<String>":
if (candidate.getFieldParametrisationClass() == null) {
return false;
}
JDefinedClass fieldParametrisationImpl = candidate.getFieldParametrisationImpl();
if (candidate.getCla... | java | private boolean moveInnerClassToParent(Outline outline, Candidate candidate) {
// Skip basic parametrisations like "List<String>":
if (candidate.getFieldParametrisationClass() == null) {
return false;
}
JDefinedClass fieldParametrisationImpl = candidate.getFieldParametrisationImpl();
if (candidate.getCla... | [
"private",
"boolean",
"moveInnerClassToParent",
"(",
"Outline",
"outline",
",",
"Candidate",
"candidate",
")",
"{",
"// Skip basic parametrisations like \"List<String>\":",
"if",
"(",
"candidate",
".",
"getFieldParametrisationClass",
"(",
")",
"==",
"null",
")",
"{",
"r... | If candidate class contains the inner class which is collection parametrisation (type), then this inner class has
to be moved to top class. For example from<br>
{@code TypeClass (is a collection type) -> ContainerClass (marked for removal) -> ElementClass}<br>
we need to get<br>
{@code TypeClass -> ElementClass}.<br>
A... | [
"If",
"candidate",
"class",
"contains",
"the",
"inner",
"class",
"which",
"is",
"collection",
"parametrisation",
"(",
"type",
")",
"then",
"this",
"inner",
"class",
"has",
"to",
"be",
"moved",
"to",
"top",
"class",
".",
"For",
"example",
"from<br",
">",
"{... | d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3 | https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java#L540-L570 | train | Move the inner class of the candidate to the parent class of the candidate. | Create a Java method that does the following: "Move the inner class of the candidate to the parent class of the candidate.". | Of course, here is the Java code you requested:
```java
private boolean moveInnerClassToParent(Outline outline, Candidate candidate) {
// Skip basic parametrisations like "List<String>":
if (candidate.getFieldParametrisationClass() == null) {
return false;
}
JDefinedClass fieldParametrisationImpl = candida... | |
apache/flink | flink-scala-shell/src/main/java/org/apache/flink/api/java/JarHelper.java | JarHelper.jarDir | private void jarDir(File dirOrFile2jar, JarOutputStream jos, String path)
throws IOException {
if (mVerbose) {
System.out.println("checking " + dirOrFile2jar);
}
if (dirOrFile2jar.isDirectory()) {
String[] dirList = dirOrFile2jar.list();
String subPath = (path == null) ? "" : (path + dirOrFile2jar.getN... | java | private void jarDir(File dirOrFile2jar, JarOutputStream jos, String path)
throws IOException {
if (mVerbose) {
System.out.println("checking " + dirOrFile2jar);
}
if (dirOrFile2jar.isDirectory()) {
String[] dirList = dirOrFile2jar.list();
String subPath = (path == null) ? "" : (path + dirOrFile2jar.getN... | [
"private",
"void",
"jarDir",
"(",
"File",
"dirOrFile2jar",
",",
"JarOutputStream",
"jos",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mVerbose",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"checking \"",
"+",
"dirOrFile2j... | Recursively jars up the given path under the given directory. | [
"Recursively",
"jars",
"up",
"the",
"given",
"path",
"under",
"the",
"given",
"directory",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-scala-shell/src/main/java/org/apache/flink/api/java/JarHelper.java#L154-L203 | train | This method is used to write a directory to a jar file. | Create a Java method that does the following: "This method is used to write a directory to a jar file.". | Of course, here is the Java code you requested:
```java
private void jarDir(File dirOrFile2jar, JarOutputStream jos, String path)
throws IOException {
if (mVerbose) {
System.out.println("checking " + dirOrFile2jar);
}
if (dirOrFile2jar.isDirectory()) {
String[] dirList = dirOrFile2jar.list();
String s... | |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java | OptimalCECPMain.alignPermuted | public AFPChain alignPermuted(Atom[] ca1, Atom[] ca2, Object param, int cp) throws StructureException {
// initial permutation
permuteArray(ca2,cp);
// perform alignment
AFPChain afpChain = super.align(ca1, ca2, param);
// un-permute alignment
permuteAFPChain(afpChain, -cp);
if(afpChain.getName2() != n... | java | public AFPChain alignPermuted(Atom[] ca1, Atom[] ca2, Object param, int cp) throws StructureException {
// initial permutation
permuteArray(ca2,cp);
// perform alignment
AFPChain afpChain = super.align(ca1, ca2, param);
// un-permute alignment
permuteAFPChain(afpChain, -cp);
if(afpChain.getName2() != n... | [
"public",
"AFPChain",
"alignPermuted",
"(",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2",
",",
"Object",
"param",
",",
"int",
"cp",
")",
"throws",
"StructureException",
"{",
"// initial permutation",
"permuteArray",
"(",
"ca2",
",",
"cp",
")",
";"... | Aligns ca1 with ca2 permuted by <i>cp</i> residues.
<p><strong>WARNING:</strong> Modifies ca2 during the permutation. Be sure
to make a copy before calling this method.
@param ca1
@param ca2
@param param
@param cp
@return
@throws StructureException | [
"Aligns",
"ca1",
"with",
"ca2",
"permuted",
"by",
"<i",
">",
"cp<",
"/",
"i",
">",
"residues",
".",
"<p",
">",
"<strong",
">",
"WARNING",
":",
"<",
"/",
"strong",
">",
"Modifies",
"ca2",
"during",
"the",
"permutation",
".",
"Be",
"sure",
"to",
"make"... | a1c71a8e3d40cc32104b1d387a3d3b560b43356e | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java#L193-L209 | train | Permute the alignment of two aligned atoms. | Create a Java method that does the following: "Permute the alignment of two aligned atoms.". | Of course, here is the Java code you requested:
```java
public AFPChain alignPermuted(Atom[] ca1, Atom[] ca2, Object param, int cp) throws StructureException {
// initial permutation
permuteArray(ca2,cp);
// perform alignment
AFPChain afpChain = super.align(ca1, ca2, param);
// un-permute alignment
permu... | |
korpling/ANNIS | annis-widgets/src/main/java/annis/gui/widgets/gwt/client/ui/VSimpleCanvas.java | VSimpleCanvas.updateFromUIDL | @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client)
{
// This call should be made first.
// It handles sizes, captions, tooltips, etc. automatically.
if(client.updateComponent(this, uidl, true))
{
// If client.updateComponent returns true there has been no changes a... | java | @Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client)
{
// This call should be made first.
// It handles sizes, captions, tooltips, etc. automatically.
if(client.updateComponent(this, uidl, true))
{
// If client.updateComponent returns true there has been no changes a... | [
"@",
"Override",
"public",
"void",
"updateFromUIDL",
"(",
"UIDL",
"uidl",
",",
"ApplicationConnection",
"client",
")",
"{",
"// This call should be made first. ",
"// It handles sizes, captions, tooltips, etc. automatically.",
"if",
"(",
"client",
".",
"updateComponent",
"(",... | Called whenever an update is received from the server | [
"Called",
"whenever",
"an",
"update",
"is",
"received",
"from",
"the",
"server"
] | 152a2e34832e015f73ac8ce8a7d4c32641641324 | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-widgets/src/main/java/annis/gui/widgets/gwt/client/ui/VSimpleCanvas.java#L84-L132 | train | Update the widget from a UIDL. | Create a Java method that does the following: "Update the widget from a UIDL.". | Of course, here is the Java code you requested:
```java
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client)
{
// This call should be made first.
// It handles sizes, captions, tooltips, etc. automatically.
if(client.updateComponent(this, uidl, true))
{
// If client... | |
rupertlssmith/lojix | lojix/text_model/src/main/com/thesett/text/impl/model/TextTableImpl.java | TextTableImpl.remove | public String remove(Integer col, Integer row)
{
String result = grid.remove((long) col, (long) row);
updateListeners(col, row);
return result;
} | java | public String remove(Integer col, Integer row)
{
String result = grid.remove((long) col, (long) row);
updateListeners(col, row);
return result;
} | [
"public",
"String",
"remove",
"(",
"Integer",
"col",
",",
"Integer",
"row",
")",
"{",
"String",
"result",
"=",
"grid",
".",
"remove",
"(",
"(",
"long",
")",
"col",
",",
"(",
"long",
")",
"row",
")",
";",
"updateListeners",
"(",
"col",
",",
"row",
"... | {@inheritDoc} | [
"{"
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/text_model/src/main/com/thesett/text/impl/model/TextTableImpl.java#L141-L148 | test | Removes a single SECTYPE from the image. | Create a Java method that does the following: "Removes a single SECTYPE from the image.". | Of course, here is the Java code you requested:
```java
public String remove(Integer col, Integer row)
{
String result = grid.remove((long) col, (long) row);
updateListeners(col, row);
return result;
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-support/src/main/java/com/amazonaws/services/support/model/Service.java | Service.getCategories | public java.util.List<Category> getCategories() {
if (categories == null) {
categories = new com.amazonaws.internal.SdkInternalList<Category>();
}
return categories;
} | java | public java.util.List<Category> getCategories() {
if (categories == null) {
categories = new com.amazonaws.internal.SdkInternalList<Category>();
}
return categories;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"Category",
">",
"getCategories",
"(",
")",
"{",
"if",
"(",
"categories",
"==",
"null",
")",
"{",
"categories",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"SdkInternalList",
"<",
"Category"... | <p>
A list of categories that describe the type of support issue a case describes. Categories consist of a category
name and a category code. Category names and codes are passed to AWS Support when you call <a>CreateCase</a>.
</p>
@return A list of categories that describe the type of support issue a case describes. C... | [
"<p",
">",
"A",
"list",
"of",
"categories",
"that",
"describe",
"the",
"type",
"of",
"support",
"issue",
"a",
"case",
"describes",
".",
"Categories",
"consist",
"of",
"a",
"category",
"name",
"and",
"a",
"category",
"code",
".",
"Category",
"names",
"and",... | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-support/src/main/java/com/amazonaws/services/support/model/Service.java#L149-L154 | train | Gets the value of the categories property. | Create a Java method that does the following: "Gets the value of the categories property.". | Of course, here is the Java code you requested:
```java
public java.util.List<Category> getCategories() {
if (categories == null) {
categories = new com.amazonaws.internal.SdkInternalList<Category>();
}
return categories;
}
```
Hope this helps! | |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/MemberSelectorManager.java | MemberSelectorManager.createSelector | public MemberSelector createSelector(CommunicationStrategy selectionStrategy) {
MemberSelector selector = new MemberSelector(leader, members, selectionStrategy, this);
selectors.add(selector);
return selector;
} | java | public MemberSelector createSelector(CommunicationStrategy selectionStrategy) {
MemberSelector selector = new MemberSelector(leader, members, selectionStrategy, this);
selectors.add(selector);
return selector;
} | [
"public",
"MemberSelector",
"createSelector",
"(",
"CommunicationStrategy",
"selectionStrategy",
")",
"{",
"MemberSelector",
"selector",
"=",
"new",
"MemberSelector",
"(",
"leader",
",",
"members",
",",
"selectionStrategy",
",",
"this",
")",
";",
"selectors",
".",
"... | Creates a new address selector.
@param selectionStrategy The server selection strategy.
@return A new address selector. | [
"Creates",
"a",
"new",
"address",
"selector",
"."
] | 3a94b7c80576d762dd0d396d4645df07a0b37c31 | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/MemberSelectorManager.java#L80-L84 | train | Creates a new member selector. | Create a Java method that does the following: "Creates a new member selector.". | Of course, here is the Java code you requested:
```java
public MemberSelector createSelector(CommunicationStrategy selectionStrategy) {
MemberSelector selector = new MemberSelector(leader, members, selectionStrategy, this);
selectors.add(selector);
return selector;
}
```
Hope this helps! | |
momokan/LWJGFont | src/main/java/net/chocolapod/lwjgfont/packager/LwjgFontFactory.java | LwjgFontFactory.extractCharacterFilesFromDir | private void extractCharacterFilesFromDir(URL urlCharacters) throws URISyntaxException, IOException {
File dir = new File(urlCharacters.toURI());
String pathMask = urlCharacters.getPath();
ResourceExtractor resourceExtractor = new ResourceExtractor();
// Windows 環境では絶対パスの先頭に / がつかないので、取り除く
if ((File... | java | private void extractCharacterFilesFromDir(URL urlCharacters) throws URISyntaxException, IOException {
File dir = new File(urlCharacters.toURI());
String pathMask = urlCharacters.getPath();
ResourceExtractor resourceExtractor = new ResourceExtractor();
// Windows 環境では絶対パスの先頭に / がつかないので、取り除く
if ((File... | [
"private",
"void",
"extractCharacterFilesFromDir",
"(",
"URL",
"urlCharacters",
")",
"throws",
"URISyntaxException",
",",
"IOException",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"urlCharacters",
".",
"toURI",
"(",
")",
")",
";",
"String",
"pathMask",
"=",
... | TODO リファクタ | [
"TODO",
"リファクタ"
] | f2d6138b73d84a7e2c1271bae25b4c76488d9ec2 | https://github.com/momokan/LWJGFont/blob/f2d6138b73d84a7e2c1271bae25b4c76488d9ec2/src/main/java/net/chocolapod/lwjgfont/packager/LwjgFontFactory.java#L333-L354 | train | Extract the character files from the directory. | Create a Java method that does the following: "Extract the character files from the directory.". | Of course, here is the Java code you requested:
```java
private void extractCharacterFilesFromDir(URL urlCharacters) throws URISyntaxException, IOException {
File dir = new File(urlCharacters.toURI());
String pathMask = urlCharacters.getPath();
ResourceExtractor resourceExtractor = new ResourceExtractor(... | |
CenturyLinkCloud/mdw | mdw-workflow/assets/com/centurylink/mdw/microservice/OrchestratorActivity.java | OrchestratorActivity.getSubflow | protected Process getSubflow(Microservice service) throws ActivityException {
AssetVersionSpec spec = new AssetVersionSpec(service.getSubflow());
try {
Process process = ProcessCache.getProcessSmart(spec);
if (process == null)
throw new ActivityException("Subflow ... | java | protected Process getSubflow(Microservice service) throws ActivityException {
AssetVersionSpec spec = new AssetVersionSpec(service.getSubflow());
try {
Process process = ProcessCache.getProcessSmart(spec);
if (process == null)
throw new ActivityException("Subflow ... | [
"protected",
"Process",
"getSubflow",
"(",
"Microservice",
"service",
")",
"throws",
"ActivityException",
"{",
"AssetVersionSpec",
"spec",
"=",
"new",
"AssetVersionSpec",
"(",
"service",
".",
"getSubflow",
"(",
")",
")",
";",
"try",
"{",
"Process",
"process",
"=... | Can be a process or template. | [
"Can",
"be",
"a",
"process",
"or",
"template",
"."
] | 91167fe65a25a5d7022cdcf8b0fae8506f5b87ce | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/assets/com/centurylink/mdw/microservice/OrchestratorActivity.java#L150-L161 | train | Get the Subflow from the microservice | Create a Java method that does the following: "Get the Subflow from the microservice". | Of course, here is the Java code you requested:
```java
protected Process getSubflow(Microservice service) throws ActivityException {
AssetVersionSpec spec = new AssetVersionSpec(service.getSubflow());
try {
Process process = ProcessCache.getProcessSmart(spec);
if (process == nu... | |
hsiafan/apk-parser | src/main/java/net/dongliu/apk/parser/struct/resource/ResourceMapEntry.java | ResourceMapEntry.toStringValue | public String toStringValue(ResourceTable resourceTable, Locale locale) {
if (resourceTableMaps.length > 0) {
return resourceTableMaps[0].toString();
} else {
return null;
}
} | java | public String toStringValue(ResourceTable resourceTable, Locale locale) {
if (resourceTableMaps.length > 0) {
return resourceTableMaps[0].toString();
} else {
return null;
}
} | [
"public",
"String",
"toStringValue",
"(",
"ResourceTable",
"resourceTable",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"resourceTableMaps",
".",
"length",
">",
"0",
")",
"{",
"return",
"resourceTableMaps",
"[",
"0",
"]",
".",
"toString",
"(",
")",
";",
... | get value as string
@return | [
"get",
"value",
"as",
"string"
] | 8993ddd52017b37b8f2e784ae0a15417d9ede932 | https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/struct/resource/ResourceMapEntry.java#L55-L61 | train | Get the value of the first resource table in the list of resource tables. | Create a Java method that does the following: "Get the value of the first resource table in the list of resource tables.". | Of course, here is the Java code you requested:
```java
public String toStringValue(ResourceTable resourceTable, Locale locale) {
if (resourceTableMaps.length > 0) {
return resourceTableMaps[0].toString();
} else {
return null;
}
}
```
Hope this helps! | |
hal/core | gui/src/main/java/org/jboss/as/console/client/shared/subsys/io/IOPresenter.java | IOPresenter.launchAddBufferPoolDialog | public void launchAddBufferPoolDialog() {
if (addBufferPoolDialog == null) {
addBufferPoolDialog = new AddResourceDialog(
securityFramework.getSecurityContext(getProxy().getNameToken()),
resourceDescriptionRegistry.lookup(bufferPoolAddressTemplate),
... | java | public void launchAddBufferPoolDialog() {
if (addBufferPoolDialog == null) {
addBufferPoolDialog = new AddResourceDialog(
securityFramework.getSecurityContext(getProxy().getNameToken()),
resourceDescriptionRegistry.lookup(bufferPoolAddressTemplate),
... | [
"public",
"void",
"launchAddBufferPoolDialog",
"(",
")",
"{",
"if",
"(",
"addBufferPoolDialog",
"==",
"null",
")",
"{",
"addBufferPoolDialog",
"=",
"new",
"AddResourceDialog",
"(",
"securityFramework",
".",
"getSecurityContext",
"(",
"getProxy",
"(",
")",
".",
"ge... | ------------------------------------------------------ buffer pool methods | [
"------------------------------------------------------",
"buffer",
"pool",
"methods"
] | d6d03f0bb128dc0470f5dc75fdb1ea1014400602 | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/shared/subsys/io/IOPresenter.java#L197-L226 | train | Launch a AddBufferPoolDialog. | Create a Java method that does the following: "Launch a AddBufferPoolDialog.". | Of course, here is the Java code you requested:
```java
public void launchAddBufferPoolDialog() {
if (addBufferPoolDialog == null) {
addBufferPoolDialog = new AddResourceDialog(
securityFramework.getSecurityContext(getProxy().getNameToken()),
resourceDescript... | |
softindex/datakernel | cloud-lsmt-cube/src/main/java/io/datakernel/cube/Cube.java | Cube.consume | public <T> StreamConsumerWithResult<T, CubeDiff> consume(Class<T> inputClass, Map<String, String> dimensionFields, Map<String, String> measureFields,
AggregationPredicate dataPredicate) {
logger.info("Started consuming data. Dimensions: {}. Measures: {}", dimensionFields.keySet(), measureFields.keySet());
Strea... | java | public <T> StreamConsumerWithResult<T, CubeDiff> consume(Class<T> inputClass, Map<String, String> dimensionFields, Map<String, String> measureFields,
AggregationPredicate dataPredicate) {
logger.info("Started consuming data. Dimensions: {}. Measures: {}", dimensionFields.keySet(), measureFields.keySet());
Strea... | [
"public",
"<",
"T",
">",
"StreamConsumerWithResult",
"<",
"T",
",",
"CubeDiff",
">",
"consume",
"(",
"Class",
"<",
"T",
">",
"inputClass",
",",
"Map",
"<",
"String",
",",
"String",
">",
"dimensionFields",
",",
"Map",
"<",
"String",
",",
"String",
">",
... | Provides a {@link StreamConsumer} for streaming data to this cube.
The returned {@link StreamConsumer} writes to {@link Aggregation}'s chosen using the specified dimensions, measures and input class.
@param inputClass class of input records
@param <T> data records type
@return consumer for streaming data to cub... | [
"Provides",
"a",
"{",
"@link",
"StreamConsumer",
"}",
"for",
"streaming",
"data",
"to",
"this",
"cube",
".",
"The",
"returned",
"{",
"@link",
"StreamConsumer",
"}",
"writes",
"to",
"{",
"@link",
"Aggregation",
"}",
"s",
"chosen",
"using",
"the",
"specified",... | 090ca1116416c14d463d49d275cb1daaafa69c56 | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/cloud-lsmt-cube/src/main/java/io/datakernel/cube/Cube.java#L493-L526 | train | This method is used to consume data from the Cube. | Create a Java method that does the following: "This method is used to consume data from the Cube.". | Of course, here is the Java code you requested:
```java
public <T> StreamConsumerWithResult<T, CubeDiff> consume(Class<T> inputClass, Map<String, String> dimensionFields, Map<String, String> measureFields,
AggregationPredicate dataPredicate) {
logger.info("Started consuming data. Dimensions: {}. Measures: {}", di... | |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/partition/impl/MigrationThread.java | MigrationThread.doRun | private void doRun() throws InterruptedException {
boolean migrating = false;
for (; ; ) {
if (!migrationManager.areMigrationTasksAllowed()) {
break;
}
MigrationRunnable runnable = queue.poll(1, TimeUnit.SECONDS);
if (runnable == null) {
... | java | private void doRun() throws InterruptedException {
boolean migrating = false;
for (; ; ) {
if (!migrationManager.areMigrationTasksAllowed()) {
break;
}
MigrationRunnable runnable = queue.poll(1, TimeUnit.SECONDS);
if (runnable == null) {
... | [
"private",
"void",
"doRun",
"(",
")",
"throws",
"InterruptedException",
"{",
"boolean",
"migrating",
"=",
"false",
";",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"!",
"migrationManager",
".",
"areMigrationTasksAllowed",
"(",
")",
")",
"{",
"break",
";",
... | Polls the migration queue and processes the tasks, sleeping if there are no tasks, if migration is not allowed or
if configured to do so (see {@link GroupProperty#PARTITION_MIGRATION_INTERVAL}).
@throws InterruptedException if the sleep was interrupted | [
"Polls",
"the",
"migration",
"queue",
"and",
"processes",
"the",
"tasks",
"sleeping",
"if",
"there",
"are",
"no",
"tasks",
"if",
"migration",
"is",
"not",
"allowed",
"or",
"if",
"configured",
"to",
"do",
"so",
"(",
"see",
"{",
"@link",
"GroupProperty#PARTITI... | 8c4bc10515dbbfb41a33e0302c0caedf3cda1baf | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/impl/MigrationThread.java#L86-L113 | train | Run the migration process. | Create a Java method that does the following: "Run the migration process.". | Of course, here is the Java code you requested:
```java
private void doRun() throws InterruptedException {
boolean migrating = false;
for (; ; ) {
if (!migrationManager.areMigrationTasksAllowed()) {
break;
}
MigrationRunnable runnable = queue.poll(1, ... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.servlet.4.0/src/com/ibm/ws/webcontainer40/osgi/response/IResponse40Impl.java | IResponse40Impl.setTrailers | @Override
public void setTrailers(Map<String, String> trailers) {
Iterator<String> trailerIterator = trailers.keySet().iterator();
while (trailerIterator.hasNext()) {
String trailerName = trailerIterator.next();
this.response.setTrailer(trailerName, trailers.get(trailerName)... | java | @Override
public void setTrailers(Map<String, String> trailers) {
Iterator<String> trailerIterator = trailers.keySet().iterator();
while (trailerIterator.hasNext()) {
String trailerName = trailerIterator.next();
this.response.setTrailer(trailerName, trailers.get(trailerName)... | [
"@",
"Override",
"public",
"void",
"setTrailers",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"trailers",
")",
"{",
"Iterator",
"<",
"String",
">",
"trailerIterator",
"=",
"trailers",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
... | {@inheritDoc} | [
"{"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.servlet.4.0/src/com/ibm/ws/webcontainer40/osgi/response/IResponse40Impl.java#L41-L56 | train | Set the trailers. | Create a Java method that does the following: "Set the trailers.". | Of course, here is the Java code you requested:
```java
@Override
public void setTrailers(Map<String, String> trailers) {
Iterator<String> trailerIterator = trailers.keySet().iterator();
while (trailerIterator.hasNext()) {
String trailerName = trailerIterator.next();
this.r... | |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEConfigData.java | CmsADEConfigData.applyAllFormatterChanges | public void applyAllFormatterChanges(
Map<CmsUUID, I_CmsFormatterBean> formatters,
CmsFormatterConfigurationCacheState formatterCacheState) {
for (CmsFormatterChangeSet changeSet : getFormatterChangeSets()) {
changeSet.applyToFormatters(formatters, formatterCacheState);
}
... | java | public void applyAllFormatterChanges(
Map<CmsUUID, I_CmsFormatterBean> formatters,
CmsFormatterConfigurationCacheState formatterCacheState) {
for (CmsFormatterChangeSet changeSet : getFormatterChangeSets()) {
changeSet.applyToFormatters(formatters, formatterCacheState);
}
... | [
"public",
"void",
"applyAllFormatterChanges",
"(",
"Map",
"<",
"CmsUUID",
",",
"I_CmsFormatterBean",
">",
"formatters",
",",
"CmsFormatterConfigurationCacheState",
"formatterCacheState",
")",
"{",
"for",
"(",
"CmsFormatterChangeSet",
"changeSet",
":",
"getFormatterChangeSet... | Applies the formatter change sets of this and all parent configurations to a map of external (non-schema) formatters.<p>
@param formatters the external formatter map which will be modified
@param formatterCacheState the formatter cache state from which new external formatters should be fetched | [
"Applies",
"the",
"formatter",
"change",
"sets",
"of",
"this",
"and",
"all",
"parent",
"configurations",
"to",
"a",
"map",
"of",
"external",
"(",
"non",
"-",
"schema",
")",
"formatters",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEConfigData.java#L284-L291 | train | Applies all formatter changes to the given formatters. | Create a Java method that does the following: "Applies all formatter changes to the given formatters.". | Of course, here is the Java code you requested:
```java
public void applyAllFormatterChanges(
Map<CmsUUID, I_CmsFormatterBean> formatters,
CmsFormatterConfigurationCacheState formatterCacheState) {
for (CmsFormatterChangeSet changeSet : getFormatterChangeSets()) {
changeSet.applyTo... | |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java | TextCache.saveRows | protected synchronized void saveRows(CachedObject[] rows, int offset,
int count) {
if (count == 0) {
return;
}
for (int i = offset; i < offset + count; i++) {
CachedObject r = rows[i];
uncommittedCache.put(r.getPos()... | java | protected synchronized void saveRows(CachedObject[] rows, int offset,
int count) {
if (count == 0) {
return;
}
for (int i = offset; i < offset + count; i++) {
CachedObject r = rows[i];
uncommittedCache.put(r.getPos()... | [
"protected",
"synchronized",
"void",
"saveRows",
"(",
"CachedObject",
"[",
"]",
"rows",
",",
"int",
"offset",
",",
"int",
"count",
")",
"{",
"if",
"(",
"count",
"==",
"0",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"offset",
";",
"i... | This is called internally when old rows need to be removed from the
cache. Text table rows that have not been saved are those that have not
been committed yet. So we don't save them but add them to the
uncommitted cache until such time that they are committed or rolled
back- fredt | [
"This",
"is",
"called",
"internally",
"when",
"old",
"rows",
"need",
"to",
"be",
"removed",
"from",
"the",
"cache",
".",
"Text",
"table",
"rows",
"that",
"have",
"not",
"been",
"saved",
"are",
"those",
"that",
"have",
"not",
"been",
"committed",
"yet",
"... | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/TextCache.java#L697-L711 | train | Saves the rows in the array to the uncommitted cache. | Create a Java method that does the following: "Saves the rows in the array to the uncommitted cache.". | Of course, here is the Java code you requested:
```java
protected synchronized void saveRows(CachedObject[] rows, int offset,
int count) {
if (count == 0) {
return;
}
for (int i = offset; i < offset + count; i++) {
CachedObject ... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java | JsHdrsImpl.getMessageWaitTime | public final Long getMessageWaitTime() {
/* If the transient has never been set, get the value in the message */
if (cachedMessageWaitTime == null) {
cachedMessageWaitTime = (Long) getHdr2().getField(JsHdr2Access.MESSAGEWAITTIME);
}
return cachedMessageWaitTime;
} | java | public final Long getMessageWaitTime() {
/* If the transient has never been set, get the value in the message */
if (cachedMessageWaitTime == null) {
cachedMessageWaitTime = (Long) getHdr2().getField(JsHdr2Access.MESSAGEWAITTIME);
}
return cachedMessageWaitTime;
} | [
"public",
"final",
"Long",
"getMessageWaitTime",
"(",
")",
"{",
"/* If the transient has never been set, get the value in the message */",
"if",
"(",
"cachedMessageWaitTime",
"==",
"null",
")",
"{",
"cachedMessageWaitTime",
"=",
"(",
"Long",
")",
"getHdr2",
"(",
")",
".... | /*
Get the value of the MessageWaitTime field from the message header.
Javadoc description supplied by JsMessage interface. | [
"/",
"*",
"Get",
"the",
"value",
"of",
"the",
"MessageWaitTime",
"field",
"from",
"the",
"message",
"header",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java#L583-L589 | train | Gets the message wait time. | Create a Java method that does the following: "Gets the message wait time.". | Of course, here is the Java code you requested:
```java
public final Long getMessageWaitTime() {
/* If the transient has never been set, get the value in the message */
if (cachedMessageWaitTime == null) {
cachedMessageWaitTime = (Long) getHdr2().getField(JsHdr2Access.MESSAGEWAITTIME);
... | |
casmi/casmi | src/main/java/casmi/graphics/color/HSBColor.java | HSBColor.getComplementaryColor | public HSBColor getComplementaryColor() {
double[] rgb = HSBColor.getRGB(hue, saturation, brightness);
double[] hsb = HSBColor.getHSB(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
return new HSBColor(hsb[0], hsb[1], hsb[2]);
} | java | public HSBColor getComplementaryColor() {
double[] rgb = HSBColor.getRGB(hue, saturation, brightness);
double[] hsb = HSBColor.getHSB(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
return new HSBColor(hsb[0], hsb[1], hsb[2]);
} | [
"public",
"HSBColor",
"getComplementaryColor",
"(",
")",
"{",
"double",
"[",
"]",
"rgb",
"=",
"HSBColor",
".",
"getRGB",
"(",
"hue",
",",
"saturation",
",",
"brightness",
")",
";",
"double",
"[",
"]",
"hsb",
"=",
"HSBColor",
".",
"getHSB",
"(",
"1.0",
... | Returns a Color object that shows a complementary color.
@return a complementary Color object. | [
"Returns",
"a",
"Color",
"object",
"that",
"shows",
"a",
"complementary",
"color",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/HSBColor.java#L287-L291 | train | Get the complementary color of this color. | Create a Java method that does the following: "Get the complementary color of this color.". | Of course, here is the Java code you requested:
```java
public HSBColor getComplementaryColor() {
double[] rgb = HSBColor.getRGB(hue, saturation, brightness);
double[] hsb = HSBColor.getHSB(1.0 - rgb[0], 1.0 - rgb[1], 1.0 - rgb[2]);
return new HSBColor(hsb[0], hsb[1], hsb[2]);
}
```
Hope t... | |
dbmdz/iiif-apis | src/main/java/de/digitalcollections/iiif/model/search/SearchResult.java | SearchResult.addWithin | @Override
public SearchResult addWithin(Resource first, Resource... rest) throws IllegalArgumentException {
if (!(first instanceof SearchLayer) || Arrays.stream(rest).anyMatch(r -> !(r instanceof SearchLayer))) {
throw new IllegalArgumentException("SearchResult can only be within a SearchLayer.");
}
... | java | @Override
public SearchResult addWithin(Resource first, Resource... rest) throws IllegalArgumentException {
if (!(first instanceof SearchLayer) || Arrays.stream(rest).anyMatch(r -> !(r instanceof SearchLayer))) {
throw new IllegalArgumentException("SearchResult can only be within a SearchLayer.");
}
... | [
"@",
"Override",
"public",
"SearchResult",
"addWithin",
"(",
"Resource",
"first",
",",
"Resource",
"...",
"rest",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"!",
"(",
"first",
"instanceof",
"SearchLayer",
")",
"||",
"Arrays",
".",
"stream",
"("... | Add a new containing resource. Must be an instance of {@link SearchLayer}
@throws IllegalArgumentException if the resource is not a {@link SearchLayer} | [
"Add",
"a",
"new",
"containing",
"resource",
".",
"Must",
"be",
"an",
"instance",
"of",
"{",
"@link",
"SearchLayer",
"}"
] | 3e77c1044ca4bf4acabb38269c7d72af2f042fc8 | https://github.com/dbmdz/iiif-apis/blob/3e77c1044ca4bf4acabb38269c7d72af2f042fc8/src/main/java/de/digitalcollections/iiif/model/search/SearchResult.java#L73-L80 | test | Add a SearchResult to the SearchResult | Create a Java method that does the following: "Add a SearchResult to the SearchResult". | Of course, here is the Java code you requested:
```java
@Override
public SearchResult addWithin(Resource first, Resource... rest) throws IllegalArgumentException {
if (!(first instanceof SearchLayer) || Arrays.stream(rest).anyMatch(r -> !(r instanceof SearchLayer))) {
throw new IllegalArgumentException("Se... | |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpSelf.java | OpenPgpSelf.getAnnouncedPublicKeys | @Override
public PGPPublicKeyRingCollection getAnnouncedPublicKeys() throws IOException, PGPException {
PGPSecretKeyRing secretKeys = getSigningKeyRing();
PGPPublicKeyRing publicKeys = getAnyPublicKeys().getPublicKeyRing(secretKeys.getPublicKey().getKeyID());
publicKeys = BCUtil.removeUnasso... | java | @Override
public PGPPublicKeyRingCollection getAnnouncedPublicKeys() throws IOException, PGPException {
PGPSecretKeyRing secretKeys = getSigningKeyRing();
PGPPublicKeyRing publicKeys = getAnyPublicKeys().getPublicKeyRing(secretKeys.getPublicKey().getKeyID());
publicKeys = BCUtil.removeUnasso... | [
"@",
"Override",
"public",
"PGPPublicKeyRingCollection",
"getAnnouncedPublicKeys",
"(",
")",
"throws",
"IOException",
",",
"PGPException",
"{",
"PGPSecretKeyRing",
"secretKeys",
"=",
"getSigningKeyRing",
"(",
")",
";",
"PGPPublicKeyRing",
"publicKeys",
"=",
"getAnyPublicK... | Return a {@link PGPPublicKeyRingCollection} containing only the public keys belonging to our signing key ring.
TODO: Add support for public keys of other devices of the owner.
@return public keys
@throws IOException IO is dangerous.
@throws PGPException PGP is brittle. | [
"Return",
"a",
"{",
"@link",
"PGPPublicKeyRingCollection",
"}",
"containing",
"only",
"the",
"public",
"keys",
"belonging",
"to",
"our",
"signing",
"key",
"ring",
".",
"TODO",
":",
"Add",
"support",
"for",
"public",
"keys",
"of",
"other",
"devices",
"of",
"t... | 870756997faec1e1bfabfac0cd6c2395b04da873 | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpSelf.java#L116-L122 | train | Get the announced public keys. | Create a Java method that does the following: "Get the announced public keys.". | Of course, here is the Java code you requested:
```java
@Override
public PGPPublicKeyRingCollection getAnnouncedPublicKeys() throws IOException, PGPException {
PGPSecretKeyRing secretKeys = getSigningKeyRing();
PGPPublicKeyRing publicKeys = getAnyPublicKeys().getPublicKeyRing(secretKeys.getPublicKe... | |
phax/ph-web | ph-web/src/main/java/com/helger/web/scope/singleton/AbstractGlobalWebSingleton.java | AbstractGlobalWebSingleton.getGlobalSingletonIfInstantiated | @Nullable
public static final <T extends AbstractGlobalWebSingleton> T getGlobalSingletonIfInstantiated (@Nonnull final Class <T> aClass)
{
return getSingletonIfInstantiated (_getStaticScope (false), aClass);
} | java | @Nullable
public static final <T extends AbstractGlobalWebSingleton> T getGlobalSingletonIfInstantiated (@Nonnull final Class <T> aClass)
{
return getSingletonIfInstantiated (_getStaticScope (false), aClass);
} | [
"@",
"Nullable",
"public",
"static",
"final",
"<",
"T",
"extends",
"AbstractGlobalWebSingleton",
">",
"T",
"getGlobalSingletonIfInstantiated",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"T",
">",
"aClass",
")",
"{",
"return",
"getSingletonIfInstantiated",
"(",
"_... | Get the singleton object if it is already instantiated inside the current
global web scope or <code>null</code> if it is not instantiated.
@param <T>
The type to be returned
@param aClass
The class to be checked. May not be <code>null</code>.
@return The singleton for the specified class is already instantiated,
<code... | [
"Get",
"the",
"singleton",
"object",
"if",
"it",
"is",
"already",
"instantiated",
"inside",
"the",
"current",
"global",
"web",
"scope",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"is",
"not",
"instantiated",
"."
] | d445fd25184605b62682c93c9782409acf0ae813 | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/scope/singleton/AbstractGlobalWebSingleton.java#L79-L83 | train | Get the global singleton if instantiated. | Create a Java method that does the following: "Get the global singleton if instantiated.". | Of course, here is the Java code you requested:
```java
@Nullable
public static final <T extends AbstractGlobalWebSingleton> T getGlobalSingletonIfInstantiated (@Nonnull final Class <T> aClass)
{
return getSingletonIfInstantiated (_getStaticScope (false), aClass);
}
```
Hope this helps! | |
opensourceBIM/BIMserver | PluginBase/generated/org/bimserver/models/ifc4/impl/Ifc4PackageImpl.java | Ifc4PackageImpl.getIfcConnectionCurveGeometry | @Override
public EClass getIfcConnectionCurveGeometry() {
if (ifcConnectionCurveGeometryEClass == null) {
ifcConnectionCurveGeometryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(121);
}
return ifcConnectionCurveGeometryEClass;
} | java | @Override
public EClass getIfcConnectionCurveGeometry() {
if (ifcConnectionCurveGeometryEClass == null) {
ifcConnectionCurveGeometryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(121);
}
return ifcConnectionCurveGeometryEClass;
} | [
"@",
"Override",
"public",
"EClass",
"getIfcConnectionCurveGeometry",
"(",
")",
"{",
"if",
"(",
"ifcConnectionCurveGeometryEClass",
"==",
"null",
")",
"{",
"ifcConnectionCurveGeometryEClass",
"=",
"(",
"EClass",
")",
"EPackage",
".",
"Registry",
".",
"INSTANCE",
"."... | <!-- 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#L13054-L13061 | train | Get the IfcConnectionCurveGeometryEClass attribute of the interface. | Create a Java method that does the following: "Get the IfcConnectionCurveGeometryEClass attribute of the interface.". | Of course, here is the Java code you requested:
```java
@Override
public EClass getIfcConnectionCurveGeometry() {
if (ifcConnectionCurveGeometryEClass == null) {
ifcConnectionCurveGeometryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(121);
}
r... | |
rapidoid/rapidoid | rapidoid-jpa/src/main/java/org/rapidoid/jpa/DAO.java | DAO.inferEntityType | private static Class<?> inferEntityType(Class<? extends DAO<?>> daoClass) {
U.must(daoClass.getSuperclass() == DAO.class, "Expected DAO to be superclass of %s, but found: %s!", daoClass,
daoClass.getSuperclass());
Type type = daoClass.getGenericSuperclass();
ParameterizedType genericDao = (type instanceof Pa... | java | private static Class<?> inferEntityType(Class<? extends DAO<?>> daoClass) {
U.must(daoClass.getSuperclass() == DAO.class, "Expected DAO to be superclass of %s, but found: %s!", daoClass,
daoClass.getSuperclass());
Type type = daoClass.getGenericSuperclass();
ParameterizedType genericDao = (type instanceof Pa... | [
"private",
"static",
"Class",
"<",
"?",
">",
"inferEntityType",
"(",
"Class",
"<",
"?",
"extends",
"DAO",
"<",
"?",
">",
">",
"daoClass",
")",
"{",
"U",
".",
"must",
"(",
"daoClass",
".",
"getSuperclass",
"(",
")",
"==",
"DAO",
".",
"class",
",",
"... | e.g. IF PersonService extends DAO<Person> THEN entity == Person | [
"e",
".",
"g",
".",
"IF",
"PersonService",
"extends",
"DAO<",
";",
"Person>",
";",
"THEN",
"entity",
"==",
"Person"
] | 1775344bcf4abbee289d474b34d553ff6bc821b0 | https://github.com/rapidoid/rapidoid/blob/1775344bcf4abbee289d474b34d553ff6bc821b0/rapidoid-jpa/src/main/java/org/rapidoid/jpa/DAO.java#L41-L55 | train | Infer entity type from DAO class. | Create a Java method that does the following: "Infer entity type from DAO class.". | Of course, here is the Java code you requested:
```java
private static Class<?> inferEntityType(Class<? extends DAO<?>> daoClass) {
U.must(daoClass.getSuperclass() == DAO.class, "Expected DAO to be superclass of %s, but found: %s!", daoClass,
daoClass.getSuperclass());
Type type = daoClass.getGenericSuperclas... | |
awin/rabbiteasy | rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageReader.java | MessageReader.readBodyAsString | public String readBodyAsString() {
Charset charset = readCharset();
byte[] bodyContent = message.getBodyContent();
return new String(bodyContent, charset);
} | java | public String readBodyAsString() {
Charset charset = readCharset();
byte[] bodyContent = message.getBodyContent();
return new String(bodyContent, charset);
} | [
"public",
"String",
"readBodyAsString",
"(",
")",
"{",
"Charset",
"charset",
"=",
"readCharset",
"(",
")",
";",
"byte",
"[",
"]",
"bodyContent",
"=",
"message",
".",
"getBodyContent",
"(",
")",
";",
"return",
"new",
"String",
"(",
"bodyContent",
",",
"char... | Extracts the message body and interprets it
as a string.
@return The message body as string | [
"Extracts",
"the",
"message",
"body",
"and",
"interprets",
"it",
"as",
"a",
"string",
"."
] | c161efda6c0f7ef319aedf09dfe40a4a90165510 | https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/MessageReader.java#L80-L84 | train | Reads the message body as a string. | Create a Java method that does the following: "Reads the message body as a string.". | Of course, here is the Java code you requested:
```java
public String readBodyAsString() {
Charset charset = readCharset();
byte[] bodyContent = message.getBodyContent();
return new String(bodyContent, charset);
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/AmazonApiGatewayClient.java | AmazonApiGatewayClient.createUsagePlanKey | @Override
public CreateUsagePlanKeyResult createUsagePlanKey(CreateUsagePlanKeyRequest request) {
request = beforeClientExecution(request);
return executeCreateUsagePlanKey(request);
} | java | @Override
public CreateUsagePlanKeyResult createUsagePlanKey(CreateUsagePlanKeyRequest request) {
request = beforeClientExecution(request);
return executeCreateUsagePlanKey(request);
} | [
"@",
"Override",
"public",
"CreateUsagePlanKeyResult",
"createUsagePlanKey",
"(",
"CreateUsagePlanKeyRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeCreateUsagePlanKey",
"(",
"request",
")",
";",
"}"
] | <p>
Creates a usage plan key for adding an existing API key to a usage plan.
</p>
@param createUsagePlanKeyRequest
The POST request to create a usage plan key for adding an existing API key to a usage plan.
@return Result of the CreateUsagePlanKey operation returned by the service.
@throws BadRequestException
The subm... | [
"<p",
">",
"Creates",
"a",
"usage",
"plan",
"key",
"for",
"adding",
"an",
"existing",
"API",
"key",
"to",
"a",
"usage",
"plan",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/AmazonApiGatewayClient.java#L1152-L1156 | train | Creates a usage plan key. | Create a Java method that does the following: "Creates a usage plan key.". | Of course, here is the Java code you requested:
```java
@Override
public CreateUsagePlanKeyResult createUsagePlanKey(CreateUsagePlanKeyRequest request) {
request = beforeClientExecution(request);
return executeCreateUsagePlanKey(request);
}
```
Hope this helps! | |
matiwinnetou/spring-soy-view | spring-soy-view-ajax-compiler/src/main/java/pl/matisoft/soy/ajax/utils/I18nUtils.java | I18nUtils.getLocaleFromString | public static Locale getLocaleFromString(String localeString) {
if (localeString == null) {
return null;
}
localeString = localeString.trim();
if (localeString.toLowerCase().equals("default")) {
return Locale.getDefault();
}
// Extract language
... | java | public static Locale getLocaleFromString(String localeString) {
if (localeString == null) {
return null;
}
localeString = localeString.trim();
if (localeString.toLowerCase().equals("default")) {
return Locale.getDefault();
}
// Extract language
... | [
"public",
"static",
"Locale",
"getLocaleFromString",
"(",
"String",
"localeString",
")",
"{",
"if",
"(",
"localeString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"localeString",
"=",
"localeString",
".",
"trim",
"(",
")",
";",
"if",
"(",
"locale... | Convert a string based locale into a Locale Object.
Assumes the string has form "{language}_{country}_{variant}".
Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr_MAC"
@param localeString The String
@return the Locale | [
"Convert",
"a",
"string",
"based",
"locale",
"into",
"a",
"Locale",
"Object",
".",
"Assumes",
"the",
"string",
"has",
"form",
"{",
"language",
"}",
"_",
"{",
"country",
"}",
"_",
"{",
"variant",
"}",
".",
"Examples",
":",
"en",
"de_DE",
"_GB",
"en_US_W... | a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1 | https://github.com/matiwinnetou/spring-soy-view/blob/a27c1b2bc76b074a2753ddd7b0c7f685c883d1d1/spring-soy-view-ajax-compiler/src/main/java/pl/matisoft/soy/ajax/utils/I18nUtils.java#L44-L76 | train | Gets the Locale from a String. | Create a Java method that does the following: "Gets the Locale from a String.". | Of course, here is the Java code you requested:
```java
public static Locale getLocaleFromString(String localeString) {
if (localeString == null) {
return null;
}
localeString = localeString.trim();
if (localeString.toLowerCase().equals("default")) {
return Local... | |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/Respoke.java | Respoke.createClient | public RespokeClient createClient(Context appContext)
{
context = appContext;
RespokeClient newClient = new RespokeClient();
instances.add(newClient);
return newClient;
} | java | public RespokeClient createClient(Context appContext)
{
context = appContext;
RespokeClient newClient = new RespokeClient();
instances.add(newClient);
return newClient;
} | [
"public",
"RespokeClient",
"createClient",
"(",
"Context",
"appContext",
")",
"{",
"context",
"=",
"appContext",
";",
"RespokeClient",
"newClient",
"=",
"new",
"RespokeClient",
"(",
")",
";",
"instances",
".",
"add",
"(",
"newClient",
")",
";",
"return",
"newC... | This is one of two possible entry points for interacting with the library. This method creates a new Client object
which represents your app's connection to the cloud infrastructure. This method does NOT automatically call the
client.connect() method after the client is created, so your app will need to call it when i... | [
"This",
"is",
"one",
"of",
"two",
"possible",
"entry",
"points",
"for",
"interacting",
"with",
"the",
"library",
".",
"This",
"method",
"creates",
"a",
"new",
"Client",
"object",
"which",
"represents",
"your",
"app",
"s",
"connection",
"to",
"the",
"cloud",
... | 34a15f0558d29b1f1bc8481bbc5c505e855e05ef | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/Respoke.java#L126-L134 | train | Create a new RespokeClient instance | Create a Java method that does the following: "Create a new RespokeClient instance". | Of course, here is the Java code you requested:
```java
public RespokeClient createClient(Context appContext)
{
context = appContext;
RespokeClient newClient = new RespokeClient();
instances.add(newClient);
return newClient;
}
```
Hope this helps! | |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/extras/Indicator.java | Indicator.setSymbolType | public void setSymbolType(final SymbolType SYMBOL_TYPE) {
symbolType = SYMBOL_TYPE;
init(getInnerBounds().width, getInnerBounds().height);
repaint(getInnerBounds());
} | java | public void setSymbolType(final SymbolType SYMBOL_TYPE) {
symbolType = SYMBOL_TYPE;
init(getInnerBounds().width, getInnerBounds().height);
repaint(getInnerBounds());
} | [
"public",
"void",
"setSymbolType",
"(",
"final",
"SymbolType",
"SYMBOL_TYPE",
")",
"{",
"symbolType",
"=",
"SYMBOL_TYPE",
";",
"init",
"(",
"getInnerBounds",
"(",
")",
".",
"width",
",",
"getInnerBounds",
"(",
")",
".",
"height",
")",
";",
"repaint",
"(",
... | Sets the type of symbol that will be drawn on the indicator
@param SYMBOL_TYPE | [
"Sets",
"the",
"type",
"of",
"symbol",
"that",
"will",
"be",
"drawn",
"on",
"the",
"indicator"
] | c2f7b45a477757ef21bbb6a1174ddedb2250ae57 | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Indicator.java#L207-L211 | train | Sets the symbol type of the image. | Create a Java method that does the following: "Sets the symbol type of the image.". | Of course, here is the Java code you requested:
```java
public void setSymbolType(final SymbolType SYMBOL_TYPE) {
symbolType = SYMBOL_TYPE;
init(getInnerBounds().width, getInnerBounds().height);
repaint(getInnerBounds());
}
```
Hope this helps! | |
leanix/leanix-sdk-java | src/main/java/net/leanix/api/common/ApiClient.java | ApiClient.setDateFormat | public ApiClient setDateFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat;
// also set the date format for model (de)serialization with Date properties
this.json.setDateFormat((DateFormat) dateFormat.clone());
return this;
} | java | public ApiClient setDateFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat;
// also set the date format for model (de)serialization with Date properties
this.json.setDateFormat((DateFormat) dateFormat.clone());
return this;
} | [
"public",
"ApiClient",
"setDateFormat",
"(",
"DateFormat",
"dateFormat",
")",
"{",
"this",
".",
"dateFormat",
"=",
"dateFormat",
";",
"// also set the date format for model (de)serialization with Date properties",
"this",
".",
"json",
".",
"setDateFormat",
"(",
"(",
"Date... | Set the date format used to parse/format date parameters. | [
"Set",
"the",
"date",
"format",
"used",
"to",
"parse",
"/",
"format",
"date",
"parameters",
"."
] | 9516ac593d6a8f73baccc516a45877b4e5920c47 | https://github.com/leanix/leanix-sdk-java/blob/9516ac593d6a8f73baccc516a45877b4e5920c47/src/main/java/net/leanix/api/common/ApiClient.java#L327-L332 | test | Sets the date format for the API client | Create a Java method that does the following: "Sets the date format for the API client". | Of course, here is the Java code you requested:
```java
public ApiClient setDateFormat(DateFormat dateFormat) {
this.dateFormat = dateFormat;
// also set the date format for model (de)serialization with Date properties
this.json.setDateFormat((DateFormat) dateFormat.clone());
return this;
}
```
Hope... | |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java | CmsCloneModuleThread.adjustModuleResources | private void adjustModuleResources(
CmsModule sourceModule,
CmsModule targetModule,
String sourcePathPart,
String targetPathPart,
Map<String, String> iconPaths) {
List<String> newTargetResources = adjustModuleResourcePaths(
targetModule.getResources(),
... | java | private void adjustModuleResources(
CmsModule sourceModule,
CmsModule targetModule,
String sourcePathPart,
String targetPathPart,
Map<String, String> iconPaths) {
List<String> newTargetResources = adjustModuleResourcePaths(
targetModule.getResources(),
... | [
"private",
"void",
"adjustModuleResources",
"(",
"CmsModule",
"sourceModule",
",",
"CmsModule",
"targetModule",
",",
"String",
"sourcePathPart",
",",
"String",
"targetPathPart",
",",
"Map",
"<",
"String",
",",
"String",
">",
"iconPaths",
")",
"{",
"List",
"<",
"... | Adjusts the paths of the module resources from the source path to the target path.<p>
@param sourceModule the source module
@param targetModule the target module
@param sourcePathPart the path part of the source module
@param targetPathPart the path part of the target module
@param iconPaths the path where resource ty... | [
"Adjusts",
"the",
"paths",
"of",
"the",
"module",
"resources",
"from",
"the",
"source",
"path",
"to",
"the",
"target",
"path",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java#L443-L467 | train | Method adjustModuleResources. | Create a Java method that does the following: "Method adjustModuleResources.". | Of course, here is the Java code you requested:
```java
private void adjustModuleResources(
CmsModule sourceModule,
CmsModule targetModule,
String sourcePathPart,
String targetPathPart,
Map<String, String> iconPaths) {
List<String> newTargetResources = adjustModuleResou... | |
dkmfbk/knowledgestore | ks-core/src/main/java/eu/fbk/knowledgestore/internal/Compression.java | Compression.forFileName | @Nullable
public static Compression forFileName(final String fileName,
@Nullable final Compression fallback) {
final int index = fileName.lastIndexOf('.');
final String extension = (index < 0 ? fileName : fileName.substring(index + 1))
.toLowerCase();
for (final C... | java | @Nullable
public static Compression forFileName(final String fileName,
@Nullable final Compression fallback) {
final int index = fileName.lastIndexOf('.');
final String extension = (index < 0 ? fileName : fileName.substring(index + 1))
.toLowerCase();
for (final C... | [
"@",
"Nullable",
"public",
"static",
"Compression",
"forFileName",
"(",
"final",
"String",
"fileName",
",",
"@",
"Nullable",
"final",
"Compression",
"fallback",
")",
"{",
"final",
"int",
"index",
"=",
"fileName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
... | Returns the registered {@code Compression} format matching the extension in the file name
supplied, or the {@code fallback} specified if none matches.
@param fileName
the file name, not null
@param fallback
the {@code Compression} to return if none matches
@return the matching {@code Compression}, or the {@code fallba... | [
"Returns",
"the",
"registered",
"{",
"@code",
"Compression",
"}",
"format",
"matching",
"the",
"extension",
"in",
"the",
"file",
"name",
"supplied",
"or",
"the",
"{",
"@code",
"fallback",
"}",
"specified",
"if",
"none",
"matches",
"."
] | a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a | https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-core/src/main/java/eu/fbk/knowledgestore/internal/Compression.java#L320-L338 | train | Get a compression for a file name. | Create a Java method that does the following: "Get a compression for a file name.". | Of course, here is the Java code you requested:
```java
@Nullable
public static Compression forFileName(final String fileName,
@Nullable final Compression fallback) {
final int index = fileName.lastIndexOf('.');
final String extension = (index < 0 ? fileName : fileName.substring(index +... | |
scaleset/scaleset-geo | src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java | GoogleMapsTileMath.tileBbox | public Envelope tileBbox(int tx, int ty, int zoomLevel) {
Coordinate topLeft = tileTopLeft(tx, ty, zoomLevel);
// upperLeft of tx+1,ty+1 == lowRight
Coordinate lowerRight = tileTopLeft(tx + 1, ty + 1, zoomLevel);
Envelope result = new Envelope(topLeft, lowerRight);
return result;... | java | public Envelope tileBbox(int tx, int ty, int zoomLevel) {
Coordinate topLeft = tileTopLeft(tx, ty, zoomLevel);
// upperLeft of tx+1,ty+1 == lowRight
Coordinate lowerRight = tileTopLeft(tx + 1, ty + 1, zoomLevel);
Envelope result = new Envelope(topLeft, lowerRight);
return result;... | [
"public",
"Envelope",
"tileBbox",
"(",
"int",
"tx",
",",
"int",
"ty",
",",
"int",
"zoomLevel",
")",
"{",
"Coordinate",
"topLeft",
"=",
"tileTopLeft",
"(",
"tx",
",",
"ty",
",",
"zoomLevel",
")",
";",
"// upperLeft of tx+1,ty+1 == lowRight",
"Coordinate",
"lowe... | Returns the EPSG:3857 bounding of the specified tile coordinate
@param tx The tile x coordinate
@param ty The tile y coordinate
@param zoomLevel The tile zoom level
@return the EPSG:3857 bounding box | [
"Returns",
"the",
"EPSG",
":",
"3857",
"bounding",
"of",
"the",
"specified",
"tile",
"coordinate"
] | 5cff2349668037dc287928a6c1a1f67c76d96b02 | https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L285-L291 | train | Get the bounding box of the tile | Create a Java method that does the following: "Get the bounding box of the tile". | Of course, here is the Java code you requested:
```java
public Envelope tileBbox(int tx, int ty, int zoomLevel) {
Coordinate topLeft = tileTopLeft(tx, ty, zoomLevel);
// upperLeft of tx+1,ty+1 == lowRight
Coordinate lowerRight = tileTopLeft(tx + 1, ty + 1, zoomLevel);
Envelope result = ... | |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java | SingleDbJDBCConnection.findNodeMainPropertiesByParentIdentifierCQ | @Override
protected ResultSet findNodeMainPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
if (findNodeMainPropertiesByParentIdentifierCQ == null)
{
findNodeMainPropertiesByParentIdentifierCQ =
dbConnection.prepareStatement(FIND_NODE_MAIN_PROPERTIES_BY... | java | @Override
protected ResultSet findNodeMainPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
if (findNodeMainPropertiesByParentIdentifierCQ == null)
{
findNodeMainPropertiesByParentIdentifierCQ =
dbConnection.prepareStatement(FIND_NODE_MAIN_PROPERTIES_BY... | [
"@",
"Override",
"protected",
"ResultSet",
"findNodeMainPropertiesByParentIdentifierCQ",
"(",
"String",
"parentIdentifier",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"findNodeMainPropertiesByParentIdentifierCQ",
"==",
"null",
")",
"{",
"findNodeMainPropertiesByParentIdenti... | {@inheritDoc} | [
"{"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SingleDbJDBCConnection.java#L939-L955 | train | Method findNodeMainPropertiesByParentIdentifierCQ. | Create a Java method that does the following: "Method findNodeMainPropertiesByParentIdentifierCQ.". | Of course, here is the Java code you requested:
```java
@Override
protected ResultSet findNodeMainPropertiesByParentIdentifierCQ(String parentIdentifier) throws SQLException
{
if (findNodeMainPropertiesByParentIdentifierCQ == null)
{
findNodeMainPropertiesByParentIdentifierCQ =
d... | |
sababado/CircularView | library/src/main/java/com/sababado/circularview/CircularView.java | CircularView.getDefaultSize | public static int getDefaultSize(final int size, final int measureSpec) {
final int result;
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
switch (specMode) {
case MeasureSpec.AT_MOST:
result = Ma... | java | public static int getDefaultSize(final int size, final int measureSpec) {
final int result;
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
switch (specMode) {
case MeasureSpec.AT_MOST:
result = Ma... | [
"public",
"static",
"int",
"getDefaultSize",
"(",
"final",
"int",
"size",
",",
"final",
"int",
"measureSpec",
")",
"{",
"final",
"int",
"result",
";",
"final",
"int",
"specMode",
"=",
"MeasureSpec",
".",
"getMode",
"(",
"measureSpec",
")",
";",
"final",
"i... | Utility to return a default size. Uses the supplied size if the
MeasureSpec imposed no constraints. Will get larger if allowed
by the MeasureSpec.
@param size Default size for this view
@param measureSpec Constraints imposed by the parent
@return The size this view should be. | [
"Utility",
"to",
"return",
"a",
"default",
"size",
".",
"Uses",
"the",
"supplied",
"size",
"if",
"the",
"MeasureSpec",
"imposed",
"no",
"constraints",
".",
"Will",
"get",
"larger",
"if",
"allowed",
"by",
"the",
"MeasureSpec",
"."
] | c9ab818d063bcc0796183616f8a82166a9b80aac | https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularView.java#L203-L220 | train | Get the default size of a single class. | Create a Java method that does the following: "Get the default size of a single class.". | Of course, here is the Java code you requested:
```java
public static int getDefaultSize(final int size, final int measureSpec) {
final int result;
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
switch (specMode) {
... | |
immutables/immutables | gson/src/org/immutables/gson/stream/JsonParserReader.java | JsonParserReader.nextTokenBuffer | public final TokenBuffer nextTokenBuffer() throws IOException {
TokenBuffer buffer = new TokenBuffer(parser);
// if token is consumed, but undelying parser is still sitting on this token, we move forward
requirePeek();
buffer.copyCurrentStructure(parser);
// when we will return to reading from reade... | java | public final TokenBuffer nextTokenBuffer() throws IOException {
TokenBuffer buffer = new TokenBuffer(parser);
// if token is consumed, but undelying parser is still sitting on this token, we move forward
requirePeek();
buffer.copyCurrentStructure(parser);
// when we will return to reading from reade... | [
"public",
"final",
"TokenBuffer",
"nextTokenBuffer",
"(",
")",
"throws",
"IOException",
"{",
"TokenBuffer",
"buffer",
"=",
"new",
"TokenBuffer",
"(",
"parser",
")",
";",
"// if token is consumed, but undelying parser is still sitting on this token, we move forward",
"requirePee... | Reads current value including objects and array as effiecient token buffer.
Use of Jackson's own mechanisms is important to preserve custom elements
such as special embedded objects in BSON or other data formats.
@return {@link TokenBuffer}
@throws IOException if error occured | [
"Reads",
"current",
"value",
"including",
"objects",
"and",
"array",
"as",
"effiecient",
"token",
"buffer",
".",
"Use",
"of",
"Jackson",
"s",
"own",
"mechanisms",
"is",
"important",
"to",
"preserve",
"custom",
"elements",
"such",
"as",
"special",
"embedded",
"... | 909fd91fe6065e785f88a31a506554cec2ad7ee4 | https://github.com/immutables/immutables/blob/909fd91fe6065e785f88a31a506554cec2ad7ee4/gson/src/org/immutables/gson/stream/JsonParserReader.java#L247-L255 | valid | This method is called by the parser when the next token is consumed. | Create a Java method that does the following: "This method is called by the parser when the next token is consumed.". | Of course, here is the Java code you requested:
```java
public final TokenBuffer nextTokenBuffer() throws IOException {
TokenBuffer buffer = new TokenBuffer(parser);
// if token is consumed, but undelying parser is still sitting on this token, we move forward
requirePeek();
buffer.copyCurrentStructure(... | |
facebookarchive/hadoop-20 | src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NotifierUtils.java | NotifierUtils.getAllAncestors | public static List<String> getAllAncestors(String eventPath) {
// check if the path is valid.
if (eventPath == null || !eventPath.startsWith(Path.SEPARATOR)) {
return null;
}
if (eventPath.equals(Path.SEPARATOR)) {
return Arrays.asList(Path.SEPARATOR);
}
List<String> ancest... | java | public static List<String> getAllAncestors(String eventPath) {
// check if the path is valid.
if (eventPath == null || !eventPath.startsWith(Path.SEPARATOR)) {
return null;
}
if (eventPath.equals(Path.SEPARATOR)) {
return Arrays.asList(Path.SEPARATOR);
}
List<String> ancest... | [
"public",
"static",
"List",
"<",
"String",
">",
"getAllAncestors",
"(",
"String",
"eventPath",
")",
"{",
"// check if the path is valid.",
"if",
"(",
"eventPath",
"==",
"null",
"||",
"!",
"eventPath",
".",
"startsWith",
"(",
"Path",
".",
"SEPARATOR",
")",
")",... | return all the ancestors of the given path, include itself.
@param eventPath
@return | [
"return",
"all",
"the",
"ancestors",
"of",
"the",
"given",
"path",
"include",
"itself",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/NotifierUtils.java#L110-L129 | train | Get all ancestors of the given event path. | Create a Java method that does the following: "Get all ancestors of the given event path.". | Of course, here is the Java code you requested:
```java
public static List<String> getAllAncestors(String eventPath) {
// check if the path is valid.
if (eventPath == null || !eventPath.startsWith(Path.SEPARATOR)) {
return null;
}
if (eventPath.equals(Path.SEPARATOR)) {
return Arrays.a... | |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Period.java | Period.plusMonths | public Period plusMonths(long monthsToAdd) {
if (monthsToAdd == 0) {
return this;
}
return create(years, Math.toIntExact(Math.addExact(months, monthsToAdd)), days);
} | java | public Period plusMonths(long monthsToAdd) {
if (monthsToAdd == 0) {
return this;
}
return create(years, Math.toIntExact(Math.addExact(months, monthsToAdd)), days);
} | [
"public",
"Period",
"plusMonths",
"(",
"long",
"monthsToAdd",
")",
"{",
"if",
"(",
"monthsToAdd",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"return",
"create",
"(",
"years",
",",
"Math",
".",
"toIntExact",
"(",
"Math",
".",
"addExact",
"(",
"mon... | Returns a copy of this period with the specified months added.
<p>
This adds the amount to the months unit in a copy of this period.
The years and days units are unaffected.
For example, "1 year, 6 months and 3 days" plus 2 months returns "1 year, 8 months and 3 days".
<p>
This instance is immutable and unaffected by t... | [
"Returns",
"a",
"copy",
"of",
"this",
"period",
"with",
"the",
"specified",
"months",
"added",
".",
"<p",
">",
"This",
"adds",
"the",
"amount",
"to",
"the",
"months",
"unit",
"in",
"a",
"copy",
"of",
"this",
"period",
".",
"The",
"years",
"and",
"days"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Period.java#L660-L665 | train | Gets a new period with the specified number of months. | Create a Java method that does the following: "Gets a new period with the specified number of months.". | Of course, here is the Java code you requested:
```java
public Period plusMonths(long monthsToAdd) {
if (monthsToAdd == 0) {
return this;
}
return create(years, Math.toIntExact(Math.addExact(months, monthsToAdd)), days);
}
```
Hope this helps! | |
knowm/Sundial | src/main/java/org/quartz/QuartzScheduler.java | QuartzScheduler.scheduleJob | @Override
public Date scheduleJob(JobDetail jobDetail, OperableTrigger trigger) throws SchedulerException {
validateState();
if (jobDetail == null) {
throw new SchedulerException("JobDetail cannot be null");
}
if (trigger == null) {
throw new SchedulerException("Trigger cannot be null")... | java | @Override
public Date scheduleJob(JobDetail jobDetail, OperableTrigger trigger) throws SchedulerException {
validateState();
if (jobDetail == null) {
throw new SchedulerException("JobDetail cannot be null");
}
if (trigger == null) {
throw new SchedulerException("Trigger cannot be null")... | [
"@",
"Override",
"public",
"Date",
"scheduleJob",
"(",
"JobDetail",
"jobDetail",
",",
"OperableTrigger",
"trigger",
")",
"throws",
"SchedulerException",
"{",
"validateState",
"(",
")",
";",
"if",
"(",
"jobDetail",
"==",
"null",
")",
"{",
"throw",
"new",
"Sched... | Add the <code>{@link org.quartz.jobs.Job}</code> identified by the given <code>
{@link org.quartz.jobs.JobDetail}</code> to the Scheduler, and associate the given <code>
{@link org.quartz.triggers.Trigger}</code> with it.
<p>If the given Trigger does not reference any <code>Job</code>, then it will be set to
reference... | [
"Add",
"the",
"<code",
">",
"{",
"@link",
"org",
".",
"quartz",
".",
"jobs",
".",
"Job",
"}",
"<",
"/",
"code",
">",
"identified",
"by",
"the",
"given",
"<code",
">",
"{",
"@link",
"org",
".",
"quartz",
".",
"jobs",
".",
"JobDetail",
"}",
"<",
"/... | 0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62 | https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/quartz/QuartzScheduler.java#L388-L439 | train | Schedule a job. | Create a Java method that does the following: "Schedule a job.". | Of course, here is the Java code you requested:
```java
@Override
public Date scheduleJob(JobDetail jobDetail, OperableTrigger trigger) throws SchedulerException {
validateState();
if (jobDetail == null) {
throw new SchedulerException("JobDetail cannot be null");
}
if (trigger == null) {
... | |
pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java | BookKeeperLog.updateMetadata | private LogMetadata updateMetadata(LogMetadata currentMetadata, LedgerHandle newLedger, boolean clearEmptyLedgers) throws DurableDataLogException {
boolean create = currentMetadata == null;
if (create) {
// This is the first ledger ever in the metadata.
currentMetadata = new LogM... | java | private LogMetadata updateMetadata(LogMetadata currentMetadata, LedgerHandle newLedger, boolean clearEmptyLedgers) throws DurableDataLogException {
boolean create = currentMetadata == null;
if (create) {
// This is the first ledger ever in the metadata.
currentMetadata = new LogM... | [
"private",
"LogMetadata",
"updateMetadata",
"(",
"LogMetadata",
"currentMetadata",
",",
"LedgerHandle",
"newLedger",
",",
"boolean",
"clearEmptyLedgers",
")",
"throws",
"DurableDataLogException",
"{",
"boolean",
"create",
"=",
"currentMetadata",
"==",
"null",
";",
"if",... | Updates the metadata and persists it as a result of adding a new Ledger.
@param currentMetadata The current metadata.
@param newLedger The newly added Ledger.
@param clearEmptyLedgers If true, the new metadata will not not contain any pointers to empty Ledgers. Setting this
to true will not remove a pointer ... | [
"Updates",
"the",
"metadata",
"and",
"persists",
"it",
"as",
"a",
"result",
"of",
"adding",
"a",
"new",
"Ledger",
"."
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L742-L770 | train | Updates the metadata. | Create a Java method that does the following: "Updates the metadata.". | Of course, here is the Java code you requested:
```java
private LogMetadata updateMetadata(LogMetadata currentMetadata, LedgerHandle newLedger, boolean clearEmptyLedgers) throws DurableDataLogException {
boolean create = currentMetadata == null;
if (create) {
// This is the first ledger eve... | |
voldemort/voldemort | src/java/voldemort/utils/StoreDefinitionUtils.java | StoreDefinitionUtils.getStoreNames | public static List<String> getStoreNames(List<StoreDefinition> storeDefList) {
List<String> storeList = new ArrayList<String>();
for(StoreDefinition def: storeDefList) {
storeList.add(def.getName());
}
return storeList;
} | java | public static List<String> getStoreNames(List<StoreDefinition> storeDefList) {
List<String> storeList = new ArrayList<String>();
for(StoreDefinition def: storeDefList) {
storeList.add(def.getName());
}
return storeList;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getStoreNames",
"(",
"List",
"<",
"StoreDefinition",
">",
"storeDefList",
")",
"{",
"List",
"<",
"String",
">",
"storeList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"StoreDe... | Given a list of store definitions return a list of store names
@param storeDefList The list of store definitions
@return Returns a list of store names | [
"Given",
"a",
"list",
"of",
"store",
"definitions",
"return",
"a",
"list",
"of",
"store",
"names"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/StoreDefinitionUtils.java#L74-L80 | train | Get the store names from a list of store definitions. | Create a Java method that does the following: "Get the store names from a list of store definitions.". | Of course, here is the Java code you requested:
```java
public static List<String> getStoreNames(List<StoreDefinition> storeDefList) {
List<String> storeList = new ArrayList<String>();
for(StoreDefinition def: storeDefList) {
storeList.add(def.getName());
}
return storeList;... | |
itfsw/mybatis-generator-plugin | src/main/java/com/itfsw/mybatis/generator/plugins/BatchInsertPlugin.java | BatchInsertPlugin.clientGenerated | @Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
// 1. batchInsert
FullyQualifiedJavaType listType = FullyQualifiedJavaType.getNewListInstance();
listType.addTypeArgument(introspectedTable.getRules().calculateAl... | java | @Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
// 1. batchInsert
FullyQualifiedJavaType listType = FullyQualifiedJavaType.getNewListInstance();
listType.addTypeArgument(introspectedTable.getRules().calculateAl... | [
"@",
"Override",
"public",
"boolean",
"clientGenerated",
"(",
"Interface",
"interfaze",
",",
"TopLevelClass",
"topLevelClass",
",",
"IntrospectedTable",
"introspectedTable",
")",
"{",
"// 1. batchInsert",
"FullyQualifiedJavaType",
"listType",
"=",
"FullyQualifiedJavaType",
... | Java Client Methods 生成
具体执行顺序 http://www.mybatis.org/generator/reference/pluggingIn.html
@param interfaze
@param topLevelClass
@param introspectedTable
@return | [
"Java",
"Client",
"Methods",
"生成",
"具体执行顺序",
"http",
":",
"//",
"www",
".",
"mybatis",
".",
"org",
"/",
"generator",
"/",
"reference",
"/",
"pluggingIn",
".",
"html"
] | c2746d9567952cabe0eed8c533beb8c1a8bc1dce | https://github.com/itfsw/mybatis-generator-plugin/blob/c2746d9567952cabe0eed8c533beb8c1a8bc1dce/src/main/java/com/itfsw/mybatis/generator/plugins/BatchInsertPlugin.java#L89-L121 | valid | This method is called by the client generated code. | Create a Java method that does the following: "This method is called by the client generated code.". | Of course, here is the Java code you requested:
```java
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
// 1. batchInsert
FullyQualifiedJavaType listType = FullyQualifiedJavaType.getNewListInstance();
listType... | |
lucee/Lucee | core/src/main/java/lucee/commons/io/ini/IniFile.java | IniFile.getKeyValueEL | public String getKeyValueEL(String strSection, String key) {
Map map = getSectionEL(strSection);
if (map == null) return null;
Object o = map.get(key.toLowerCase());
if (o == null) return null;
return (String) o;
} | java | public String getKeyValueEL(String strSection, String key) {
Map map = getSectionEL(strSection);
if (map == null) return null;
Object o = map.get(key.toLowerCase());
if (o == null) return null;
return (String) o;
} | [
"public",
"String",
"getKeyValueEL",
"(",
"String",
"strSection",
",",
"String",
"key",
")",
"{",
"Map",
"map",
"=",
"getSectionEL",
"(",
"strSection",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"return",
"null",
";",
"Object",
"o",
"=",
"map",
"."... | Gets the KeyValue attribute of the IniFile object, if not exist return null
@param strSection section to get
@param key key to get
@return matching alue | [
"Gets",
"the",
"KeyValue",
"attribute",
"of",
"the",
"IniFile",
"object",
"if",
"not",
"exist",
"return",
"null"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/ini/IniFile.java#L157-L164 | train | get the value of a key in a section | Create a Java method that does the following: "get the value of a key in a section". | Of course, here is the Java code you requested:
```java
public String getKeyValueEL(String strSection, String key) {
Map map = getSectionEL(strSection);
if (map == null) return null;
Object o = map.get(key.toLowerCase());
if (o == null) return null;
return (String) o;
}
```
Hope this helps! | |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.bitcoinSerializeToStream | protected void bitcoinSerializeToStream(OutputStream stream, boolean useSegwit) throws IOException {
// version
uint32ToByteStreamLE(version, stream);
// marker, flag
if (useSegwit) {
stream.write(0);
stream.write(1);
}
// txin_count, txins
... | java | protected void bitcoinSerializeToStream(OutputStream stream, boolean useSegwit) throws IOException {
// version
uint32ToByteStreamLE(version, stream);
// marker, flag
if (useSegwit) {
stream.write(0);
stream.write(1);
}
// txin_count, txins
... | [
"protected",
"void",
"bitcoinSerializeToStream",
"(",
"OutputStream",
"stream",
",",
"boolean",
"useSegwit",
")",
"throws",
"IOException",
"{",
"// version",
"uint32ToByteStreamLE",
"(",
"version",
",",
"stream",
")",
";",
"// marker, flag",
"if",
"(",
"useSegwit",
... | Serialize according to <a href="https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki">BIP144</a> or the
<a href="https://en.bitcoin.it/wiki/Protocol_documentation#tx">classic format</a>, depending on if segwit is
desired. | [
"Serialize",
"according",
"to",
"<a",
"href",
"=",
"https",
":",
"//",
"github",
".",
"com",
"/",
"bitcoin",
"/",
"bips",
"/",
"blob",
"/",
"master",
"/",
"bip",
"-",
"0144",
".",
"mediawiki",
">",
"BIP144<",
"/",
"a",
">",
"or",
"the",
"<a",
"href... | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1436-L1460 | train | Serialize this transaction to the given output stream. | Create a Java method that does the following: "Serialize this transaction to the given output stream.". | Of course, here is the Java code you requested:
```java
protected void bitcoinSerializeToStream(OutputStream stream, boolean useSegwit) throws IOException {
// version
uint32ToByteStreamLE(version, stream);
// marker, flag
if (useSegwit) {
stream.write(0);
stream... | |
cdk/cdk | app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java | DepictionGenerator.prepareCoords | private void prepareCoords(Iterable<IAtomContainer> mols) throws CDKException {
for (IAtomContainer mol : mols) {
if (!ensure2dLayout(mol) && mol.getBondCount() > 0) {
final double factor = GeometryUtil.getScaleFactor(mol, 1.5);
GeometryUtil.scaleMolecule(mol, factor)... | java | private void prepareCoords(Iterable<IAtomContainer> mols) throws CDKException {
for (IAtomContainer mol : mols) {
if (!ensure2dLayout(mol) && mol.getBondCount() > 0) {
final double factor = GeometryUtil.getScaleFactor(mol, 1.5);
GeometryUtil.scaleMolecule(mol, factor)... | [
"private",
"void",
"prepareCoords",
"(",
"Iterable",
"<",
"IAtomContainer",
">",
"mols",
")",
"throws",
"CDKException",
"{",
"for",
"(",
"IAtomContainer",
"mol",
":",
"mols",
")",
"{",
"if",
"(",
"!",
"ensure2dLayout",
"(",
"mol",
")",
"&&",
"mol",
".",
... | Prepare a collection of molecules for rendering. If coordinates are not
present they are generated, if coordinates exists they are scaled to
be consistent (length=1.5).
@param mols molecules
@return coordinates
@throws CDKException | [
"Prepare",
"a",
"collection",
"of",
"molecules",
"for",
"rendering",
".",
"If",
"coordinates",
"are",
"not",
"present",
"they",
"are",
"generated",
"if",
"coordinates",
"exists",
"they",
"are",
"scaled",
"to",
"be",
"consistent",
"(",
"length",
"=",
"1",
"."... | c3d0f16502bf08df50365fee392e11d7c9856657 | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/DepictionGenerator.java#L390-L397 | train | Prepare coordinates for a set of mols. | Create a Java method that does the following: "Prepare coordinates for a set of mols.". | Of course, here is the Java code you requested:
```java
private void prepareCoords(Iterable<IAtomContainer> mols) throws CDKException {
for (IAtomContainer mol : mols) {
if (!ensure2dLayout(mol) && mol.getBondCount() > 0) {
final double factor = GeometryUtil.getScaleFactor(mol, 1.5)... | |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java | PackageSummaryBuilder.buildEnumSummary | public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
String enumTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Enum_Summary"),
configuration.getText("doclet.enums"));
List<String> enumT... | java | public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
String enumTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Enum_Summary"),
configuration.getText("doclet.enums"));
List<String> enumT... | [
"public",
"void",
"buildEnumSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"summaryContentTree",
")",
"{",
"String",
"enumTableSummary",
"=",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"",
",",
"configuration",
".",
"getText",
"(",
"\"docl... | Build the summary for the enums in this package.
@param node the XML element that specifies which components to document
@param summaryContentTree the summary tree to which the enum summary will
be added | [
"Build",
"the",
"summary",
"for",
"the",
"enums",
"in",
"this",
"package",
"."
] | a53d069bbdb2c60232ed3811c19b65e41c3e60e0 | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java#L227-L243 | train | Build the summary for the enumeration. | Create a Java method that does the following: "Build the summary for the enumeration.". | Of course, here is the Java code you requested:
```java
public void buildEnumSummary(XMLNode node, Content summaryContentTree) {
String enumTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Enum_Summary"),
configura... | |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/Setting.java | Setting.get | public String get(String group, String key) {
return this.groupedMap.get(group, key);
} | java | public String get(String group, String key) {
return this.groupedMap.get(group, key);
} | [
"public",
"String",
"get",
"(",
"String",
"group",
",",
"String",
"key",
")",
"{",
"return",
"this",
".",
"groupedMap",
".",
"get",
"(",
"group",
",",
"key",
")",
";",
"}"
] | 获取分组对应的值,如果分组不存在或者值不存在则返回null
@param group 分组
@param key 键
@return 值,如果分组不存在或者值不存在则返回null | [
"获取分组对应的值,如果分组不存在或者值不存在则返回null"
] | bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/Setting.java#L409-L411 | train | Gets the value of the specified key in the specified group. | Create a Java method that does the following: "Gets the value of the specified key in the specified group.". | Of course, here is the Java code you requested:
```java
public String get(String group, String key) {
return this.groupedMap.get(group, key);
}
```
Hope this helps! | |
killbill/killbill | catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java | StandaloneCatalog.findCurrentPlan | @Override
public DefaultPlan findCurrentPlan(final String name) throws CatalogApiException {
if (name == null || plans == null) {
throw new CatalogApiException(ErrorCode.CAT_NO_SUCH_PLAN, name);
}
final DefaultPlan result = (DefaultPlan) plans.findByName(name);
if (result... | java | @Override
public DefaultPlan findCurrentPlan(final String name) throws CatalogApiException {
if (name == null || plans == null) {
throw new CatalogApiException(ErrorCode.CAT_NO_SUCH_PLAN, name);
}
final DefaultPlan result = (DefaultPlan) plans.findByName(name);
if (result... | [
"@",
"Override",
"public",
"DefaultPlan",
"findCurrentPlan",
"(",
"final",
"String",
"name",
")",
"throws",
"CatalogApiException",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"plans",
"==",
"null",
")",
"{",
"throw",
"new",
"CatalogApiException",
"(",
"ErrorCo... | //////////////////////////////////////////////////////////////////////////// | [
"////////////////////////////////////////////////////////////////////////////"
] | 6457b485fb32a182c76197a83f428123331f1380 | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java#L214-L224 | train | Find the current plan by name. | Create a Java method that does the following: "Find the current plan by name.". | Of course, here is the Java code you requested:
```java
@Override
public DefaultPlan findCurrentPlan(final String name) throws CatalogApiException {
if (name == null || plans == null) {
throw new CatalogApiException(ErrorCode.CAT_NO_SUCH_PLAN, name);
}
final DefaultPlan result =... | |
GerdHolz/TOVAL | src/de/invation/code/toval/graphic/diagrams/panels/TickInfo.java | TickInfo.setTicks | private void setTicks() {
double range, z;
if(zeroBased) {
firstTick = 0.0;
} else {
range = Math.abs(minValue);
z = (range % getMinorTickSpacing())==0 ? 0 : 1;
firstTick = Math.signum(minValue)*getMinorTickSpacing()*(Math.floor(range/getMinorTickSpacing())+z);
}
range = Math.... | java | private void setTicks() {
double range, z;
if(zeroBased) {
firstTick = 0.0;
} else {
range = Math.abs(minValue);
z = (range % getMinorTickSpacing())==0 ? 0 : 1;
firstTick = Math.signum(minValue)*getMinorTickSpacing()*(Math.floor(range/getMinorTickSpacing())+z);
}
range = Math.... | [
"private",
"void",
"setTicks",
"(",
")",
"{",
"double",
"range",
",",
"z",
";",
"if",
"(",
"zeroBased",
")",
"{",
"firstTick",
"=",
"0.0",
";",
"}",
"else",
"{",
"range",
"=",
"Math",
".",
"abs",
"(",
"minValue",
")",
";",
"z",
"=",
"(",
"range",... | Sets tick values and tick range according to the current operation mode.<br>
In zero based mode the first tick is 0 and the last tick is determined on the basis of the first tick and the number of overall ticks.
Otherwise the first tick equals {@link #minValue}. | [
"Sets",
"tick",
"values",
"and",
"tick",
"range",
"according",
"to",
"the",
"current",
"operation",
"mode",
".",
"<br",
">",
"In",
"zero",
"based",
"mode",
"the",
"first",
"tick",
"is",
"0",
"and",
"the",
"last",
"tick",
"is",
"determined",
"on",
"the",
... | 036922cdfd710fa53b18e5dbe1e07f226f731fde | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/diagrams/panels/TickInfo.java#L109-L127 | train | Sets the tick values. | Create a Java method that does the following: "Sets the tick values.". | Of course, here is the Java code you requested:
```java
private void setTicks() {
double range, z;
if(zeroBased) {
firstTick = 0.0;
} else {
range = Math.abs(minValue);
z = (range % getMinorTickSpacing())==0 ? 0 : 1;
firstTick = Math.signum(minValue)*getMinorTickSpacing()*(Math.floor(r... | |
Unidata/thredds | visad/src/main/java/ucar/nc2/iosp/gempak/AbstractGempakStationFileReader.java | AbstractGempakStationFileReader.init | protected boolean init(boolean fullCheck) throws IOException {
//Trace.startTrace();
if (!super.init(fullCheck)) {
return false;
}
if ((dmLabel.kftype != MFSN) && (dmLabel.kftype != MFSF)) {
logError("not a point data file ");
return false;
}
return true;
} | java | protected boolean init(boolean fullCheck) throws IOException {
//Trace.startTrace();
if (!super.init(fullCheck)) {
return false;
}
if ((dmLabel.kftype != MFSN) && (dmLabel.kftype != MFSF)) {
logError("not a point data file ");
return false;
}
return true;
} | [
"protected",
"boolean",
"init",
"(",
"boolean",
"fullCheck",
")",
"throws",
"IOException",
"{",
"//Trace.startTrace();",
"if",
"(",
"!",
"super",
".",
"init",
"(",
"fullCheck",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"dmLabel",
".",
"... | Initialize this reader. Get the Grid specific info
@param fullCheck check to make sure there are grids we can handle
@return true if successful
@throws IOException problem reading the data | [
"Initialize",
"this",
"reader",
".",
"Get",
"the",
"Grid",
"specific",
"info"
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/visad/src/main/java/ucar/nc2/iosp/gempak/AbstractGempakStationFileReader.java#L116-L129 | test | This method is called to initialize the data structure. | Create a Java method that does the following: "This method is called to initialize the data structure.". | Of course, here is the Java code you requested:
```java
protected boolean init(boolean fullCheck) throws IOException {
//Trace.startTrace();
if (!super.init(fullCheck)) {
return false;
}
if ((dmLabel.kftype != MFSN) && (dmLabel.kftype != MFSF)) {
logError("not a point data file ");
... | |
dbracewell/mango | src/main/java/com/davidbracewell/string/StringUtils.java | StringUtils.rightTrim | public static String rightTrim(CharSequence input) {
if (input == null) {
return null;
}
return StringFunctions.RIGHT_TRIM.apply(input.toString());
} | java | public static String rightTrim(CharSequence input) {
if (input == null) {
return null;
}
return StringFunctions.RIGHT_TRIM.apply(input.toString());
} | [
"public",
"static",
"String",
"rightTrim",
"(",
"CharSequence",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"StringFunctions",
".",
"RIGHT_TRIM",
".",
"apply",
"(",
"input",
".",
"toString",
"(",
"... | Right trim.
@param input the input
@return the string | [
"Right",
"trim",
"."
] | 2cec08826f1fccd658694dd03abce10fc97618ec | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/string/StringUtils.java#L472-L477 | train | Right trim. | Create a Java method that does the following: "Right trim.". | Of course, here is the Java code you requested:
```java
public static String rightTrim(CharSequence input) {
if (input == null) {
return null;
}
return StringFunctions.RIGHT_TRIM.apply(input.toString());
}
```
Hope this helps! | |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspContentAttachmentsBean.java | CmsJspContentAttachmentsBean.getAttachmentLocales | public static List<String> getAttachmentLocales(CmsObject cms, CmsResource content) {
List<CmsResource> detailOnlyResources = CmsDetailOnlyContainerUtil.getDetailOnlyResources(cms, content);
Set<String> validLocaleNames = Sets.newHashSet();
List<String> result = Lists.newArrayList();
fo... | java | public static List<String> getAttachmentLocales(CmsObject cms, CmsResource content) {
List<CmsResource> detailOnlyResources = CmsDetailOnlyContainerUtil.getDetailOnlyResources(cms, content);
Set<String> validLocaleNames = Sets.newHashSet();
List<String> result = Lists.newArrayList();
fo... | [
"public",
"static",
"List",
"<",
"String",
">",
"getAttachmentLocales",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"content",
")",
"{",
"List",
"<",
"CmsResource",
">",
"detailOnlyResources",
"=",
"CmsDetailOnlyContainerUtil",
".",
"getDetailOnlyResources",
"(",
"... | Gets the list of locales for which attachments / detail-only containers are available.<p>
@param cms the current CMS context
@param content the content resource
@return the list of locales for which there are attachments | [
"Gets",
"the",
"list",
"of",
"locales",
"for",
"which",
"attachments",
"/",
"detail",
"-",
"only",
"containers",
"are",
"available",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspContentAttachmentsBean.java#L116-L135 | train | Gets the attachment locales. | Create a Java method that does the following: "Gets the attachment locales.". | Of course, here is the Java code you requested:
```java
public static List<String> getAttachmentLocales(CmsObject cms, CmsResource content) {
List<CmsResource> detailOnlyResources = CmsDetailOnlyContainerUtil.getDetailOnlyResources(cms, content);
Set<String> validLocaleNames = Sets.newHashSet();
... | |
alkacon/opencms-core | src/org/opencms/relations/CmsCategoryService.java | CmsCategoryService.readCategory | public CmsCategory readCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException {
// iterate all possible category repositories, starting with the most global one
Iterator<String> it = getCategoryRepositories(cms, referencePath).iterator();
while (it.hasNext()) {
... | java | public CmsCategory readCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException {
// iterate all possible category repositories, starting with the most global one
Iterator<String> it = getCategoryRepositories(cms, referencePath).iterator();
while (it.hasNext()) {
... | [
"public",
"CmsCategory",
"readCategory",
"(",
"CmsObject",
"cms",
",",
"String",
"categoryPath",
",",
"String",
"referencePath",
")",
"throws",
"CmsException",
"{",
"// iterate all possible category repositories, starting with the most global one",
"Iterator",
"<",
"String",
... | Reads all categories identified by the given category path for the given reference path.<p>
@param cms the current cms context
@param categoryPath the path of the category to read
@param referencePath the reference path to find all the category repositories
@return a list of matching categories, could also be empty, ... | [
"Reads",
"all",
"categories",
"identified",
"by",
"the",
"given",
"category",
"path",
"for",
"the",
"given",
"reference",
"path",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L552-L569 | train | Reads a category from the category repository. | Create a Java method that does the following: "Reads a category from the category repository.". | Of course, here is the Java code you requested:
```java
public CmsCategory readCategory(CmsObject cms, String categoryPath, String referencePath) throws CmsException {
// iterate all possible category repositories, starting with the most global one
Iterator<String> it = getCategoryRepositories(cms, re... | |
padrig64/ValidationFramework | validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/AnchorLink.java | AnchorLink.getRelativeSlaveLocation | public Point getRelativeSlaveLocation(final Dimension masterSize, final Dimension slaveSize) {
return getRelativeSlaveLocation(masterSize.width, masterSize.height, slaveSize.width, slaveSize.height);
} | java | public Point getRelativeSlaveLocation(final Dimension masterSize, final Dimension slaveSize) {
return getRelativeSlaveLocation(masterSize.width, masterSize.height, slaveSize.width, slaveSize.height);
} | [
"public",
"Point",
"getRelativeSlaveLocation",
"(",
"final",
"Dimension",
"masterSize",
",",
"final",
"Dimension",
"slaveSize",
")",
"{",
"return",
"getRelativeSlaveLocation",
"(",
"masterSize",
".",
"width",
",",
"masterSize",
".",
"height",
",",
"slaveSize",
".",
... | Computes the location of the slave component (whose size is specified) that is slaved to the master component
(whose size is specified) using this anchor link.
@param masterSize Size of the master component to which the other component is slaved.
@param slaveSize Size of the slave component that is slaved to the mast... | [
"Computes",
"the",
"location",
"of",
"the",
"slave",
"component",
"(",
"whose",
"size",
"is",
"specified",
")",
"that",
"is",
"slaved",
"to",
"the",
"master",
"component",
"(",
"whose",
"size",
"is",
"specified",
")",
"using",
"this",
"anchor",
"link",
"."... | 2dd3c7b3403993db366d24a927645f467ccd1dda | https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/AnchorLink.java#L127-L129 | train | Get the relative location of the slave image. | Create a Java method that does the following: "Get the relative location of the slave image.". | Of course, here is the Java code you requested:
```java
public Point getRelativeSlaveLocation(final Dimension masterSize, final Dimension slaveSize) {
return getRelativeSlaveLocation(masterSize.width, masterSize.height, slaveSize.width, slaveSize.height);
}
```
Hope this helps! | |
liaohuqiu/cube-sdk | core/src/in/srain/cube/image/ImageTask.java | ImageTask.joinSizeInfoToKey | public static String joinSizeInfoToKey(String key, int w, int h) {
if (w > 0 && h != Integer.MAX_VALUE && h > 0 && h != Integer.MAX_VALUE) {
return new StringBuilder(key).append(SIZE_SP).append(w).append(SIZE_SP).append(h).toString();
}
return key;
} | java | public static String joinSizeInfoToKey(String key, int w, int h) {
if (w > 0 && h != Integer.MAX_VALUE && h > 0 && h != Integer.MAX_VALUE) {
return new StringBuilder(key).append(SIZE_SP).append(w).append(SIZE_SP).append(h).toString();
}
return key;
} | [
"public",
"static",
"String",
"joinSizeInfoToKey",
"(",
"String",
"key",
",",
"int",
"w",
",",
"int",
"h",
")",
"{",
"if",
"(",
"w",
">",
"0",
"&&",
"h",
"!=",
"Integer",
".",
"MAX_VALUE",
"&&",
"h",
">",
"0",
"&&",
"h",
"!=",
"Integer",
".",
"MA... | Join the key and the size information.
@param key
@param w
@param h
@return "$key" + "_" + "$w" + "_" + "$h" | [
"Join",
"the",
"key",
"and",
"the",
"size",
"information",
"."
] | 4446b1f156ad609fe72a4e7cd5de3c4c95761d96 | https://github.com/liaohuqiu/cube-sdk/blob/4446b1f156ad609fe72a4e7cd5de3c4c95761d96/core/src/in/srain/cube/image/ImageTask.java#L457-L462 | valid | Join size info to key. | Create a Java method that does the following: "Join size info to key.". | Of course, here is the Java code you requested:
```java
public static String joinSizeInfoToKey(String key, int w, int h) {
if (w > 0 && h != Integer.MAX_VALUE && h > 0 && h != Integer.MAX_VALUE) {
return new StringBuilder(key).append(SIZE_SP).append(w).append(SIZE_SP).append(h).toString();
... | |
vakinge/jeesuite-libs | jeesuite-cache/src/main/java/com/jeesuite/cache/command/RedisObject.java | RedisObject.set | public boolean set(Object value, long seconds) {
if (value == null)
return false;
try {
boolean result = false;
if(isCluster(groupName)){
result = getBinaryJedisClusterCommands(groupName).set(keyBytes, valueSerialize(value)).equals(RESP_OK);
}else{
result = getBinaryJedisCommands(groupName).set... | java | public boolean set(Object value, long seconds) {
if (value == null)
return false;
try {
boolean result = false;
if(isCluster(groupName)){
result = getBinaryJedisClusterCommands(groupName).set(keyBytes, valueSerialize(value)).equals(RESP_OK);
}else{
result = getBinaryJedisCommands(groupName).set... | [
"public",
"boolean",
"set",
"(",
"Object",
"value",
",",
"long",
"seconds",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"false",
";",
"try",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"isCluster",
"(",
"groupName",
")",
")... | 设置缓存指定过期时间间隔
@param value
@param seconds (过期秒数 ,小于等于0时 不设置)
@return | [
"设置缓存指定过期时间间隔"
] | c48fe2c7fbd294892cf4030dbec96e744dd3e386 | https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-cache/src/main/java/com/jeesuite/cache/command/RedisObject.java#L69-L90 | train | Set the value in the cache. | Create a Java method that does the following: "Set the value in the cache.". | Of course, here is the Java code you requested:
```java
public boolean set(Object value, long seconds) {
if (value == null)
return false;
try {
boolean result = false;
if(isCluster(groupName)){
result = getBinaryJedisClusterCommands(groupName).set(keyBytes, valueSerialize(value)).equals(RESP_OK);
... | |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateVersion.java | CertificateVersion.delete | public void delete(String name) throws IOException {
if (name.equalsIgnoreCase(VERSION)) {
version = V1;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet: CertificateVersion.");
}
} | java | public void delete(String name) throws IOException {
if (name.equalsIgnoreCase(VERSION)) {
version = V1;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet: CertificateVersion.");
}
} | [
"public",
"void",
"delete",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"name",
".",
"equalsIgnoreCase",
"(",
"VERSION",
")",
")",
"{",
"version",
"=",
"V1",
";",
"}",
"else",
"{",
"throw",
"new",
"IOException",
"(",
"\"Attribute... | Delete the attribute value. | [
"Delete",
"the",
"attribute",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateVersion.java#L206-L213 | train | Deletes the attribute value. | Create a Java method that does the following: "Deletes the attribute value.". | Of course, here is the Java code you requested:
```java
public void delete(String name) throws IOException {
if (name.equalsIgnoreCase(VERSION)) {
version = V1;
} else {
throw new IOException("Attribute name not recognized by " +
"CertAttrSet: C... | |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java | CurationManager.mapRelations | private JSONArray mapRelations(String oid) {
// We want our parsed data for reading
JsonSimple formData = parsedFormData(oid);
if (formData == null) {
log.error("Error parsing form data");
return null;
}
// And raw data to see existing relations and write new ones
JsonSimple rawData = getDataFromStor... | java | private JSONArray mapRelations(String oid) {
// We want our parsed data for reading
JsonSimple formData = parsedFormData(oid);
if (formData == null) {
log.error("Error parsing form data");
return null;
}
// And raw data to see existing relations and write new ones
JsonSimple rawData = getDataFromStor... | [
"private",
"JSONArray",
"mapRelations",
"(",
"String",
"oid",
")",
"{",
"// We want our parsed data for reading",
"JsonSimple",
"formData",
"=",
"parsedFormData",
"(",
"oid",
")",
";",
"if",
"(",
"formData",
"==",
"null",
")",
"{",
"log",
".",
"error",
"(",
"\... | Map all the relationships buried in this record's data
@param oid
The object ID being curated
@returns True is ready to proceed, otherwise False | [
"Map",
"all",
"the",
"relationships",
"buried",
"in",
"this",
"record",
"s",
"data"
] | 1db230f218031b85c48c8603cbb04fce7ac6de0c | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L283-L358 | train | Maps the relations for the given object. | Create a Java method that does the following: "Maps the relations for the given object.". | Of course, here is the Java code you requested:
```java
private JSONArray mapRelations(String oid) {
// We want our parsed data for reading
JsonSimple formData = parsedFormData(oid);
if (formData == null) {
log.error("Error parsing form data");
return null;
}
// And raw data to see existing relations ... | |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dictionary/ts/BaseChineseDictionary.java | BaseChineseDictionary.load | static boolean load(String path, AhoCorasickDoubleArrayTrie<String> trie, boolean reverse)
{
String datPath = path;
if (reverse)
{
datPath += Predefine.REVERSE_EXT;
}
if (loadDat(datPath, trie)) return true;
// 从文本中载入并且尝试生成dat
TreeMap<String, Strin... | java | static boolean load(String path, AhoCorasickDoubleArrayTrie<String> trie, boolean reverse)
{
String datPath = path;
if (reverse)
{
datPath += Predefine.REVERSE_EXT;
}
if (loadDat(datPath, trie)) return true;
// 从文本中载入并且尝试生成dat
TreeMap<String, Strin... | [
"static",
"boolean",
"load",
"(",
"String",
"path",
",",
"AhoCorasickDoubleArrayTrie",
"<",
"String",
">",
"trie",
",",
"boolean",
"reverse",
")",
"{",
"String",
"datPath",
"=",
"path",
";",
"if",
"(",
"reverse",
")",
"{",
"datPath",
"+=",
"Predefine",
"."... | 读取词典
@param path
@param trie
@param reverse 是否将其翻转
@return | [
"读取词典"
] | a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dictionary/ts/BaseChineseDictionary.java#L109-L125 | train | Load a single AhoCorasickDoubleArrayTrie. | Create a Java method that does the following: "Load a single AhoCorasickDoubleArrayTrie.". | Of course, here is the Java code you requested:
```java
static boolean load(String path, AhoCorasickDoubleArrayTrie<String> trie, boolean reverse)
{
String datPath = path;
if (reverse)
{
datPath += Predefine.REVERSE_EXT;
}
if (loadDat(datPath, trie)) return true;... | |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java | CachedRemoteTable.get | public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException
{
return this.cacheGetMove(iRowIndex, iRowCount, iRowIndex, true);
} | java | public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException
{
return this.cacheGetMove(iRowIndex, iRowCount, iRowIndex, true);
} | [
"public",
"Object",
"get",
"(",
"int",
"iRowIndex",
",",
"int",
"iRowCount",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"return",
"this",
".",
"cacheGetMove",
"(",
"iRowIndex",
",",
"iRowCount",
",",
"iRowIndex",
",",
"true",
")",
";",
"}"
] | Receive this relative record in the table.
<p>Note: This is usually used only by thin clients, as thick clients have the code to
fake absolute access.
@param iRowIndex The row to retrieve.
@param iRowCount The number of rows to retrieve (Used only by EjbCachedTable).
@return The record(s) or an error code as an Integer... | [
"Receive",
"this",
"relative",
"record",
"in",
"the",
"table",
".",
"<p",
">",
"Note",
":",
"This",
"is",
"usually",
"used",
"only",
"by",
"thin",
"clients",
"as",
"thick",
"clients",
"have",
"the",
"code",
"to",
"fake",
"absolute",
"access",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L511-L514 | train | Get the object at this row index. | Create a Java method that does the following: "Get the object at this row index.". | Of course, here is the Java code you requested:
```java
public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException
{
return this.cacheGetMove(iRowIndex, iRowCount, iRowIndex, true);
}
```
Hope this helps! | |
ggrandes/packer | src/main/java/org/javastack/packer/Packer.java | Packer.putStringMap | public Packer putStringMap(final Map<String, String> map) {
putVInt(map.size());
for (final Entry<String, String> e : map.entrySet()) {
final String key = e.getKey();
final String value = e.getValue();
putString(key);
putString(value);
}
return this;
} | java | public Packer putStringMap(final Map<String, String> map) {
putVInt(map.size());
for (final Entry<String, String> e : map.entrySet()) {
final String key = e.getKey();
final String value = e.getValue();
putString(key);
putString(value);
}
return this;
} | [
"public",
"Packer",
"putStringMap",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"putVInt",
"(",
"map",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"String",
">",
"e",
":",
"map",
... | Put a Map<String, String> in UTF-8 format
@param value
@return
@see #getStringMap(Map) | [
"Put",
"a",
"Map<String",
"String",
">",
"in",
"UTF",
"-",
"8",
"format"
] | 0b37b286a3d0555050eb2e65419dd74f8d8d3e78 | https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L774-L783 | train | Put a map of strings into the buffer. | Create a Java method that does the following: "Put a map of strings into the buffer.". | Of course, here is the Java code you requested:
```java
public Packer putStringMap(final Map<String, String> map) {
putVInt(map.size());
for (final Entry<String, String> e : map.entrySet()) {
final String key = e.getKey();
final String value = e.getValue();
putString(key);
putString(value);
}
retur... | |
Omertron/api-rottentomatoes | src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java | RottenTomatoesApi.getNewReleaseDvds | public List<RTMovie> getNewReleaseDvds(String country) throws RottenTomatoesException {
return getNewReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT);
} | java | public List<RTMovie> getNewReleaseDvds(String country) throws RottenTomatoesException {
return getNewReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT);
} | [
"public",
"List",
"<",
"RTMovie",
">",
"getNewReleaseDvds",
"(",
"String",
"country",
")",
"throws",
"RottenTomatoesException",
"{",
"return",
"getNewReleaseDvds",
"(",
"country",
",",
"DEFAULT_PAGE",
",",
"DEFAULT_PAGE_LIMIT",
")",
";",
"}"
] | Retrieves new release DVDs
@param country Provides localized data for the selected country
@return
@throws RottenTomatoesException | [
"Retrieves",
"new",
"release",
"DVDs"
] | abaf1833acafc6ada593d52b14ff1bacb4e441ee | https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L439-L441 | train | Get the list of new release DVDs for a given country. | Create a Java method that does the following: "Get the list of new release DVDs for a given country.". | Of course, here is the Java code you requested:
```java
public List<RTMovie> getNewReleaseDvds(String country) throws RottenTomatoesException {
return getNewReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT);
}
```
Hope this helps! | |
rupertlssmith/lojix | lojix/power_model/src/main/com/thesett/aima/attribute/impl/EnumAttribute.java | EnumAttribute.getFactoryForClass | public static EnumAttributeFactory getFactoryForClass(Class cls)
{
// Check that the requested class is actually an enum.
if (!cls.isEnum())
{
throw new IllegalArgumentException("Can only create enum attribute factories for classes that are enums.");
}
return Enu... | java | public static EnumAttributeFactory getFactoryForClass(Class cls)
{
// Check that the requested class is actually an enum.
if (!cls.isEnum())
{
throw new IllegalArgumentException("Can only create enum attribute factories for classes that are enums.");
}
return Enu... | [
"public",
"static",
"EnumAttributeFactory",
"getFactoryForClass",
"(",
"Class",
"cls",
")",
"{",
"// Check that the requested class is actually an enum.",
"if",
"(",
"!",
"cls",
".",
"isEnum",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can... | Generates a factory for building enum attributes of the specified enum class.
@param cls The class type of enum to get an enum attribute factory for.
@return The enum attribute factory for the enum class type specified. | [
"Generates",
"a",
"factory",
"for",
"building",
"enum",
"attributes",
"of",
"the",
"specified",
"enum",
"class",
"."
] | ad494dc8bce2345567de7689d42291d4b30fbd51 | https://github.com/rupertlssmith/lojix/blob/ad494dc8bce2345567de7689d42291d4b30fbd51/lojix/power_model/src/main/com/thesett/aima/attribute/impl/EnumAttribute.java#L76-L85 | test | Get the EnumAttributeFactory for the given class. | Create a Java method that does the following: "Get the EnumAttributeFactory for the given class.". | Of course, here is the Java code you requested:
```java
public static EnumAttributeFactory getFactoryForClass(Class cls)
{
// Check that the requested class is actually an enum.
if (!cls.isEnum())
{
throw new IllegalArgumentException("Can only create enum attribute factories for... | |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/channels/sel/ChannelSelector.java | ChannelSelector.select | public int select(long timeout) throws IOException
{
fine("select("+timeout+")");
lock.lock();
try
{
ensureAllRunning();
try
{
SelKey sk = queue.poll(timeout, TimeUnit.MILLISECONDS);
if (sk != null)
... | java | public int select(long timeout) throws IOException
{
fine("select("+timeout+")");
lock.lock();
try
{
ensureAllRunning();
try
{
SelKey sk = queue.poll(timeout, TimeUnit.MILLISECONDS);
if (sk != null)
... | [
"public",
"int",
"select",
"(",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"fine",
"(",
"\"select(\"",
"+",
"timeout",
"+",
"\")\"",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"ensureAllRunning",
"(",
")",
";",
"try",
"{",
"... | Selects and waits .
@param timeout Milliseconds.
@return
@throws IOException | [
"Selects",
"and",
"waits",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/sel/ChannelSelector.java#L194-L227 | train | Reads a single SEXTIMEDOUT from the underlying file. | Create a Java method that does the following: "Reads a single SEXTIMEDOUT from the underlying file.". | Of course, here is the Java code you requested:
```java
public int select(long timeout) throws IOException
{
fine("select("+timeout+")");
lock.lock();
try
{
ensureAllRunning();
try
{
SelKey sk = queue.poll(timeout, TimeUni... | |
mockito/mockito | src/main/java/org/mockito/AdditionalAnswers.java | AdditionalAnswers.returnsElementsOf | public static <T> Answer<T> returnsElementsOf(Collection<?> elements) {
return (Answer<T>) new ReturnsElementsOf(elements);
} | java | public static <T> Answer<T> returnsElementsOf(Collection<?> elements) {
return (Answer<T>) new ReturnsElementsOf(elements);
} | [
"public",
"static",
"<",
"T",
">",
"Answer",
"<",
"T",
">",
"returnsElementsOf",
"(",
"Collection",
"<",
"?",
">",
"elements",
")",
"{",
"return",
"(",
"Answer",
"<",
"T",
">",
")",
"new",
"ReturnsElementsOf",
"(",
"elements",
")",
";",
"}"
] | Returns elements of the collection. Keeps returning the last element forever.
Might be useful on occasion when you have a collection of elements to return.
<p>
<pre class="code"><code class="java">
//this:
when(mock.foo()).thenReturn(1, 2, 3);
//is equivalent to:
when(mock.foo()).thenAnswer(new ReturnsElementsOf(Array... | [
"Returns",
"elements",
"of",
"the",
"collection",
".",
"Keeps",
"returning",
"the",
"last",
"element",
"forever",
".",
"Might",
"be",
"useful",
"on",
"occasion",
"when",
"you",
"have",
"a",
"collection",
"of",
"elements",
"to",
"return",
".",
"<p",
">",
"<... | c5e2b80af76e3192cae7c9550b70c4d1ab312034 | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/AdditionalAnswers.java#L319-L321 | train | Returns elements of. | Create a Java method that does the following: "Returns elements of.". | Of course, here is the Java code you requested:
```java
public static <T> Answer<T> returnsElementsOf(Collection<?> elements) {
return (Answer<T>) new ReturnsElementsOf(elements);
}
```
Hope this helps! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.