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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kiegroup/jbpm | jbpm-bpmn2-emfextmodel/src/main/java/org/jboss/drools/impl/DocumentRootImpl.java | DocumentRootImpl.setMetaData | public void setMetaData(MetaDataType newMetaData) {
((FeatureMap.Internal)getMixed()).set(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, newMetaData);
} | java | public void setMetaData(MetaDataType newMetaData) {
((FeatureMap.Internal)getMixed()).set(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, newMetaData);
} | [
"public",
"void",
"setMetaData",
"(",
"MetaDataType",
"newMetaData",
")",
"{",
"(",
"(",
"FeatureMap",
".",
"Internal",
")",
"getMixed",
"(",
")",
")",
".",
"set",
"(",
"DroolsPackage",
".",
"Literals",
".",
"DOCUMENT_ROOT__META_DATA",
",",
"newMetaData",
")",... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | c3473c728aa382ebbea01e380c5e754a96647b82 | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-bpmn2-emfextmodel/src/main/java/org/jboss/drools/impl/DocumentRootImpl.java#L338-L340 | train | Sets the meta data of the document. | Create a Java method that does the following: "Sets the meta data of the document.". | Of course, here is the Java code you requested:
```java
public void setMetaData(MetaDataType newMetaData) {
((FeatureMap.Internal)getMixed()).set(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, newMetaData);
}
```
Hope this helps! | |
nikolavp/approval | approval-core/src/main/java/com/github/approval/reporters/Reporters.java | Reporters.imageMagick | public static Reporter imageMagick() {
return SwingInteractiveReporter.wrap(new Reporter() {
private final Reporter other = fileLauncher();
@Override
public void notTheSame(byte[] oldValue, File fileForVerification, byte[] newValue, File fileForApproval) {
... | java | public static Reporter imageMagick() {
return SwingInteractiveReporter.wrap(new Reporter() {
private final Reporter other = fileLauncher();
@Override
public void notTheSame(byte[] oldValue, File fileForVerification, byte[] newValue, File fileForApproval) {
... | [
"public",
"static",
"Reporter",
"imageMagick",
"(",
")",
"{",
"return",
"SwingInteractiveReporter",
".",
"wrap",
"(",
"new",
"Reporter",
"(",
")",
"{",
"private",
"final",
"Reporter",
"other",
"=",
"fileLauncher",
"(",
")",
";",
"@",
"Override",
"public",
"v... | A reporter that compares images. Currently this uses <a href="http://www.imagemagick.org/script/binary-releases.php">imagemagick</a>
for comparison. If you only want to view the new image on first approval and when there is a difference, then you better use the {@link #fileLauncher()}
reporter which will do this for yo... | [
"A",
"reporter",
"that",
"compares",
"images",
".",
"Currently",
"this",
"uses",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"imagemagick",
".",
"org",
"/",
"script",
"/",
"binary",
"-",
"releases",
".",
"php",
">",
"imagemagick<",
"/",
"a",
">",... | 5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8 | https://github.com/nikolavp/approval/blob/5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8/approval-core/src/main/java/com/github/approval/reporters/Reporters.java#L153-L184 | train | Creates a new instance of the image magick reporter. | Create a Java method that does the following: "Creates a new instance of the image magick reporter.". | Of course, here is the Java code you requested:
```java
public static Reporter imageMagick() {
return SwingInteractiveReporter.wrap(new Reporter() {
private final Reporter other = fileLauncher();
@Override
public void notTheSame(byte[] oldValue, File fileForVerification, ... | |
wildfly/wildfly-core | cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java | ModuleNameTabCompleter.tail | private String tail(String moduleName) {
if (moduleName.indexOf(MODULE_NAME_SEPARATOR) > 0) {
return moduleName.substring(moduleName.indexOf(MODULE_NAME_SEPARATOR) + 1);
} else {
return "";
}
} | java | private String tail(String moduleName) {
if (moduleName.indexOf(MODULE_NAME_SEPARATOR) > 0) {
return moduleName.substring(moduleName.indexOf(MODULE_NAME_SEPARATOR) + 1);
} else {
return "";
}
} | [
"private",
"String",
"tail",
"(",
"String",
"moduleName",
")",
"{",
"if",
"(",
"moduleName",
".",
"indexOf",
"(",
"MODULE_NAME_SEPARATOR",
")",
">",
"0",
")",
"{",
"return",
"moduleName",
".",
"substring",
"(",
"moduleName",
".",
"indexOf",
"(",
"MODULE_NAME... | get all parts of module name apart from first | [
"get",
"all",
"parts",
"of",
"module",
"name",
"apart",
"from",
"first"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/ModuleNameTabCompleter.java#L210-L216 | train | Get the tail of the module name. | Create a Java method that does the following: "Get the tail of the module name.". | Of course, here is the Java code you requested:
```java
private String tail(String moduleName) {
if (moduleName.indexOf(MODULE_NAME_SEPARATOR) > 0) {
return moduleName.substring(moduleName.indexOf(MODULE_NAME_SEPARATOR) + 1);
} else {
return "";
}
}
```
Hope this he... | |
lucee/Lucee | core/src/main/java/lucee/runtime/osgi/OSGiUtil.java | OSGiUtil._loadBundle | private static Bundle _loadBundle(BundleContext context, String path, InputStream is, boolean closeStream) throws BundleException {
log(Log.LEVEL_INFO, "add bundle:" + path);
try {
// we make this very simply so an old loader that is calling this still works
return context.installBundle(path, is);
}
fina... | java | private static Bundle _loadBundle(BundleContext context, String path, InputStream is, boolean closeStream) throws BundleException {
log(Log.LEVEL_INFO, "add bundle:" + path);
try {
// we make this very simply so an old loader that is calling this still works
return context.installBundle(path, is);
}
fina... | [
"private",
"static",
"Bundle",
"_loadBundle",
"(",
"BundleContext",
"context",
",",
"String",
"path",
",",
"InputStream",
"is",
",",
"boolean",
"closeStream",
")",
"throws",
"BundleException",
"{",
"log",
"(",
"Log",
".",
"LEVEL_INFO",
",",
"\"add bundle:\"",
"+... | does not check if the bundle already exists!
@param context
@param path
@param is
@param closeStream
@return
@throws BundleException | [
"does",
"not",
"check",
"if",
"the",
"bundle",
"already",
"exists!"
] | 29b153fc4e126e5edb97da937f2ee2e231b87593 | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/osgi/OSGiUtil.java#L125-L143 | train | load a bundle from an input stream | Create a Java method that does the following: "load a bundle from an input stream". | Of course, here is the Java code you requested:
```java
private static Bundle _loadBundle(BundleContext context, String path, InputStream is, boolean closeStream) throws BundleException {
log(Log.LEVEL_INFO, "add bundle:" + path);
try {
// we make this very simply so an old loader that is calling this still wo... | |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java | NonBlockingCharArrayWriter.toByteArray | @Nonnull
@ReturnsMutableCopy
public byte [] toByteArray (@Nonnull final Charset aCharset)
{
return StringHelper.encodeCharToBytes (m_aBuf, 0, m_nCount, aCharset);
} | java | @Nonnull
@ReturnsMutableCopy
public byte [] toByteArray (@Nonnull final Charset aCharset)
{
return StringHelper.encodeCharToBytes (m_aBuf, 0, m_nCount, aCharset);
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"return",
"StringHelper",
".",
"encodeCharToBytes",
"(",
"m_aBuf",
",",
"0",
",",
"m_nCount",
",",
"aCharset",
... | Returns a copy of the input data as bytes in the correct charset.
@param aCharset
The charset to be used. May not be <code>null</code>.
@return an array of bytes. Never <code>null</code>. | [
"Returns",
"a",
"copy",
"of",
"the",
"input",
"data",
"as",
"bytes",
"in",
"the",
"correct",
"charset",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingCharArrayWriter.java#L278-L283 | train | Get the bytes of this node as a byte array. | Create a Java method that does the following: "Get the bytes of this node as a byte array.". | Of course, here is the Java code you requested:
```java
@Nonnull
@ReturnsMutableCopy
public byte [] toByteArray (@Nonnull final Charset aCharset)
{
return StringHelper.encodeCharToBytes (m_aBuf, 0, m_nCount, aCharset);
}
```
Hope this helps! | |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AnnotatorFactory.java | AnnotatorFactory.getAnnotator | public Annotator getAnnotator(AnnotationStyle style) {
switch (style) {
case JACKSON:
case JACKSON2:
return new Jackson2Annotator(generationConfig);
case JACKSON1:
return new Jackson1Annotator(generationConfig);
case GSON:
... | java | public Annotator getAnnotator(AnnotationStyle style) {
switch (style) {
case JACKSON:
case JACKSON2:
return new Jackson2Annotator(generationConfig);
case JACKSON1:
return new Jackson1Annotator(generationConfig);
case GSON:
... | [
"public",
"Annotator",
"getAnnotator",
"(",
"AnnotationStyle",
"style",
")",
"{",
"switch",
"(",
"style",
")",
"{",
"case",
"JACKSON",
":",
"case",
"JACKSON2",
":",
"return",
"new",
"Jackson2Annotator",
"(",
"generationConfig",
")",
";",
"case",
"JACKSON1",
":... | Create a new {@link Annotator} that can create annotations according to
the given style.
@param style
the annotation style that dictates what kind of annotations
are required.
@return an annotator matching to given style | [
"Create",
"a",
"new",
"{",
"@link",
"Annotator",
"}",
"that",
"can",
"create",
"annotations",
"according",
"to",
"the",
"given",
"style",
"."
] | 0552b80db93214eb186e4ae45b40866cc1e7eb84 | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/AnnotatorFactory.java#L43-L61 | train | Get an annotation instance based on the annotation style. | Create a Java method that does the following: "Get an annotation instance based on the annotation style.". | Of course, here is the Java code you requested:
```java
public Annotator getAnnotator(AnnotationStyle style) {
switch (style) {
case JACKSON:
case JACKSON2:
return new Jackson2Annotator(generationConfig);
case JACKSON1:
return new Jackson1Ann... | |
tiefaces/TieFaces | src/org/tiefaces/components/websheet/service/WebSheetLoader.java | WebSheetLoader.refreshDataForCell | private void refreshDataForCell(Row row, String fullSaveAttr) {
if (fullSaveAttr != null) {
try {
String fullName = ConfigurationUtility.getFullNameFromRow(row);
if (fullName != null) {
parent.getCellHelper().restoreDataContext(fullName);
SaveAttrsUtility.refreshSheetRowFromContext(parent.g... | java | private void refreshDataForCell(Row row, String fullSaveAttr) {
if (fullSaveAttr != null) {
try {
String fullName = ConfigurationUtility.getFullNameFromRow(row);
if (fullName != null) {
parent.getCellHelper().restoreDataContext(fullName);
SaveAttrsUtility.refreshSheetRowFromContext(parent.g... | [
"private",
"void",
"refreshDataForCell",
"(",
"Row",
"row",
",",
"String",
"fullSaveAttr",
")",
"{",
"if",
"(",
"fullSaveAttr",
"!=",
"null",
")",
"{",
"try",
"{",
"String",
"fullName",
"=",
"ConfigurationUtility",
".",
"getFullNameFromRow",
"(",
"row",
")",
... | refresh data for single cell.
@param row row.
@param fullSaveAttr fullSaveAttr. | [
"refresh",
"data",
"for",
"single",
"cell",
"."
] | 3b57b9701ed0f080b5fa4fa78269cc0c422b34ba | https://github.com/tiefaces/TieFaces/blob/3b57b9701ed0f080b5fa4fa78269cc0c422b34ba/src/org/tiefaces/components/websheet/service/WebSheetLoader.java#L495-L509 | test | refreshDataForCell This method is called from the cell helper class to refresh the data for the cell. | Create a Java method that does the following: "refreshDataForCell This method is called from the cell helper class to refresh the data for the cell.". | Of course, here is the Java code you requested:
```java
private void refreshDataForCell(Row row, String fullSaveAttr) {
if (fullSaveAttr != null) {
try {
String fullName = ConfigurationUtility.getFullNameFromRow(row);
if (fullName != null) {
parent.getCellHelper().restoreDataContext(fullName);
... | |
sarxos/v4l4j | src/main/java/au/edu/jcu/v4l4j/AbstractGrabber.java | AbstractGrabber.setVideoInputNStandard | @Override
public void setVideoInputNStandard(int input, int standard) throws VideoStandardException, CaptureChannelException {
state.checkReleased();
doSetVideoInputNStandard(object, input, standard);
} | java | @Override
public void setVideoInputNStandard(int input, int standard) throws VideoStandardException, CaptureChannelException {
state.checkReleased();
doSetVideoInputNStandard(object, input, standard);
} | [
"@",
"Override",
"public",
"void",
"setVideoInputNStandard",
"(",
"int",
"input",
",",
"int",
"standard",
")",
"throws",
"VideoStandardException",
",",
"CaptureChannelException",
"{",
"state",
".",
"checkReleased",
"(",
")",
";",
"doSetVideoInputNStandard",
"(",
"ob... | /* (non-Javadoc)
@see au.edu.jcu.v4l4j.FrameGrabber#setVideoInputNStandard() | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9 | https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/AbstractGrabber.java#L258-L262 | train | Set the video input and standard for the specified input. | Create a Java method that does the following: "Set the video input and standard for the specified input.". | Of course, here is the Java code you requested:
```java
@Override
public void setVideoInputNStandard(int input, int standard) throws VideoStandardException, CaptureChannelException {
state.checkReleased();
doSetVideoInputNStandard(object, input, standard);
}
```
Hope this helps! | |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/RequirePrerequisite.java | RequirePrerequisite.execute | public void execute( EnforcerRuleHelper helper )
throws EnforcerRuleException
{
try
{
MavenProject project = (MavenProject) helper.evaluate( "${project}" );
Prerequisites prerequisites = project.getPrerequisites();
if( p... | java | public void execute( EnforcerRuleHelper helper )
throws EnforcerRuleException
{
try
{
MavenProject project = (MavenProject) helper.evaluate( "${project}" );
Prerequisites prerequisites = project.getPrerequisites();
if( p... | [
"public",
"void",
"execute",
"(",
"EnforcerRuleHelper",
"helper",
")",
"throws",
"EnforcerRuleException",
"{",
"try",
"{",
"MavenProject",
"project",
"=",
"(",
"MavenProject",
")",
"helper",
".",
"evaluate",
"(",
"\"${project}\"",
")",
";",
"Prerequisites",
"prere... | {@inheritDoc} | [
"{"
] | fa2d309af7907b17fc8eaf386f8056d77b654749 | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequirePrerequisite.java#L57-L99 | train | Executes the
rule. | Create a Java method that does the following: "Executes the
rule.". | Of course, here is the Java code you requested:
```java
public void execute( EnforcerRuleHelper helper )
throws EnforcerRuleException
{
try
{
MavenProject project = (MavenProject) helper.evaluate( "${project}" );
Prerequisites prerequisites = proj... | |
whitesource/fs-agent | src/main/java/org/whitesource/agent/DependencyInfoFactory.java | DependencyInfoFactory.extractCopyrights | private Collection<CopyrightInfo> extractCopyrights(File file) {
Collection<CopyrightInfo> copyrights = new ArrayList<>();
try {
boolean commentBlock = false;
Iterator<String> iterator = FileUtils.readLines(file).iterator();
int lineIndex = 1;
while (itera... | java | private Collection<CopyrightInfo> extractCopyrights(File file) {
Collection<CopyrightInfo> copyrights = new ArrayList<>();
try {
boolean commentBlock = false;
Iterator<String> iterator = FileUtils.readLines(file).iterator();
int lineIndex = 1;
while (itera... | [
"private",
"Collection",
"<",
"CopyrightInfo",
">",
"extractCopyrights",
"(",
"File",
"file",
")",
"{",
"Collection",
"<",
"CopyrightInfo",
">",
"copyrights",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"boolean",
"commentBlock",
"=",
"false",
... | /* --- Private methods --- | [
"/",
"*",
"---",
"Private",
"methods",
"---"
] | d6ee4842c4f08f4aeda7eb2307b24c49b6bed0e1 | https://github.com/whitesource/fs-agent/blob/d6ee4842c4f08f4aeda7eb2307b24c49b6bed0e1/src/main/java/org/whitesource/agent/DependencyInfoFactory.java#L162-L299 | train | Extract copyright information from a file. | Create a Java method that does the following: "Extract copyright information from a file.". | Of course, here is the Java code you requested:
```java
private Collection<CopyrightInfo> extractCopyrights(File file) {
Collection<CopyrightInfo> copyrights = new ArrayList<>();
try {
boolean commentBlock = false;
Iterator<String> iterator = FileUtils.readLines(file).iterator()... | |
alkacon/opencms-core | src/org/opencms/newsletter/CmsNewsletter.java | CmsNewsletter.getEmail | public Email getEmail(CmsObject cms, I_CmsNewsletterRecipient recipient) throws CmsException {
StringBuffer htmlMsg = new StringBuffer(1024);
StringBuffer txtMsg = new StringBuffer(1024);
Iterator<I_CmsNewsletterContent> contents = m_contents.iterator();
while (contents.hasNext()) {
... | java | public Email getEmail(CmsObject cms, I_CmsNewsletterRecipient recipient) throws CmsException {
StringBuffer htmlMsg = new StringBuffer(1024);
StringBuffer txtMsg = new StringBuffer(1024);
Iterator<I_CmsNewsletterContent> contents = m_contents.iterator();
while (contents.hasNext()) {
... | [
"public",
"Email",
"getEmail",
"(",
"CmsObject",
"cms",
",",
"I_CmsNewsletterRecipient",
"recipient",
")",
"throws",
"CmsException",
"{",
"StringBuffer",
"htmlMsg",
"=",
"new",
"StringBuffer",
"(",
"1024",
")",
";",
"StringBuffer",
"txtMsg",
"=",
"new",
"StringBuf... | Returns the e-mail for the newsletter.<p>
@param recipient the recipient to whom the newsletter is sent
@param cms the CmsObject
@return the e-mail for the newsletter
@throws CmsException if something goes wrong | [
"Returns",
"the",
"e",
"-",
"mail",
"for",
"the",
"newsletter",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/newsletter/CmsNewsletter.java#L105-L162 | train | Returns the email. | Create a Java method that does the following: "Returns the email.". | Of course, here is the Java code you requested:
```java
public Email getEmail(CmsObject cms, I_CmsNewsletterRecipient recipient) throws CmsException {
StringBuffer htmlMsg = new StringBuffer(1024);
StringBuffer txtMsg = new StringBuffer(1024);
Iterator<I_CmsNewsletterContent> contents = m_cont... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java | LogFileHandle.readFileHeader | private void readFileHeader()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "readFileHeader", this);
// Reset the current header information. Once reset has executed, the header
// is marked as invalid and will only become valid again once a correctly
// formatted header has ... | java | private void readFileHeader()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "readFileHeader", this);
// Reset the current header information. Once reset has executed, the header
// is marked as invalid and will only become valid again once a correctly
// formatted header has ... | [
"private",
"void",
"readFileHeader",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"readFileHeader\"",
",",
"this",
")",
";",
"// Reset the current header information. Once reset has executed, the header"... | Read the header data from the file managed by this LogFileHandle instance. Any
failure that occurs will result in the log file header ('_logFileHeader')
being marked as invalid. This can then be tested later by calling the
_logFileHeader.status() method and comparing for STATUS_INVALID. | [
"Read",
"the",
"header",
"data",
"from",
"the",
"file",
"managed",
"by",
"this",
"LogFileHandle",
"instance",
".",
"Any",
"failure",
"that",
"occurs",
"will",
"result",
"in",
"the",
"log",
"file",
"header",
"(",
"_logFileHeader",
")",
"being",
"marked",
"as"... | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/LogFileHandle.java#L782-L814 | train | Read the log header from the disk. | Create a Java method that does the following: "Read the log header from the disk.". | Of course, here is the Java code you requested:
```java
private void readFileHeader()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "readFileHeader", this);
// Reset the current header information. Once reset has executed, the header
// is marked as invalid and will only become valid... | |
naver/nbase-arc | api/java/src/main/java/com/navercorp/redis/cluster/triples/BinaryTriplesRedisClusterClient.java | BinaryTriplesRedisClusterClient.slrem | public void slrem(final byte[] keyspace, final byte[] uid, final byte[] serviceCode) {
sendCommand(Command.S3LREM, keyspace, uid, serviceCode);
} | java | public void slrem(final byte[] keyspace, final byte[] uid, final byte[] serviceCode) {
sendCommand(Command.S3LREM, keyspace, uid, serviceCode);
} | [
"public",
"void",
"slrem",
"(",
"final",
"byte",
"[",
"]",
"keyspace",
",",
"final",
"byte",
"[",
"]",
"uid",
",",
"final",
"byte",
"[",
"]",
"serviceCode",
")",
"{",
"sendCommand",
"(",
"Command",
".",
"S3LREM",
",",
"keyspace",
",",
"uid",
",",
"se... | Slrem.
@param keyspace the keyspace
@param uid the uid
@param serviceCode the service code | [
"Slrem",
"."
] | d4ce8a258527160c09b55e34acc1542651a8bbb3 | https://github.com/naver/nbase-arc/blob/d4ce8a258527160c09b55e34acc1542651a8bbb3/api/java/src/main/java/com/navercorp/redis/cluster/triples/BinaryTriplesRedisClusterClient.java#L177-L179 | valid | S3 Lrem command. | Create a Java method that does the following: "S3 Lrem command.". | Of course, here is the Java code you requested:
```java
public void slrem(final byte[] keyspace, final byte[] uid, final byte[] serviceCode) {
sendCommand(Command.S3LREM, keyspace, uid, serviceCode);
}
```
Hope this helps! | |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.performMethodInvocation | @SuppressWarnings("unchecked")
public static <T> T performMethodInvocation(Object tested, Method methodToInvoke, Object... arguments)
throws Exception {
final boolean accessible = methodToInvoke.isAccessible();
if (!accessible) {
methodToInvoke.setAccessible(true);
}
... | java | @SuppressWarnings("unchecked")
public static <T> T performMethodInvocation(Object tested, Method methodToInvoke, Object... arguments)
throws Exception {
final boolean accessible = methodToInvoke.isAccessible();
if (!accessible) {
methodToInvoke.setAccessible(true);
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"performMethodInvocation",
"(",
"Object",
"tested",
",",
"Method",
"methodToInvoke",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"final",
"boolean... | Perform method invocation.
@param <T> the generic type
@param tested the tested
@param methodToInvoke the method to invoke
@param arguments the arguments
@return the t
@throws Exception the exception | [
"Perform",
"method",
"invocation",
"."
] | e8cd68026c284c6a7efe66959809eeebd8d1f9ad | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1836-L1870 | train | Perform a method invocation. | Create a Java method that does the following: "Perform a method invocation.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public static <T> T performMethodInvocation(Object tested, Method methodToInvoke, Object... arguments)
throws Exception {
final boolean accessible = methodToInvoke.isAccessible();
if (!accessible) {
... | |
eclipse/xtext-extras | org.eclipse.xtext.xbase/xtend-gen/org/eclipse/xtext/xbase/compiler/LoopExtensions.java | LoopExtensions.forEach | public <T extends Object> void forEach(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super LoopParams> loopInitializer, final Procedure1<? super T> procedure) {
boolean _isEmpty = IterableExtensions.isEmpty(elements);
if (_isEmpty) {
return;
}
LoopParams _loopPar... | java | public <T extends Object> void forEach(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super LoopParams> loopInitializer, final Procedure1<? super T> procedure) {
boolean _isEmpty = IterableExtensions.isEmpty(elements);
if (_isEmpty) {
return;
}
LoopParams _loopPar... | [
"public",
"<",
"T",
"extends",
"Object",
">",
"void",
"forEach",
"(",
"final",
"ITreeAppendable",
"appendable",
",",
"final",
"Iterable",
"<",
"T",
">",
"elements",
",",
"final",
"Procedure1",
"<",
"?",
"super",
"LoopParams",
">",
"loopInitializer",
",",
"fi... | Iterates elements and execute the procedure.
A prefix, a separator and a suffix can be initialized with the loopInitializer lambda. | [
"Iterates",
"elements",
"and",
"execute",
"the",
"procedure",
".",
"A",
"prefix",
"a",
"separator",
"and",
"a",
"suffix",
"can",
"be",
"initialized",
"with",
"the",
"loopInitializer",
"lambda",
"."
] | 451359541295323a29f5855e633f770cec02069a | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/xtend-gen/org/eclipse/xtext/xbase/compiler/LoopExtensions.java#L26-L42 | train | Iterate over the elements in the sequence. | Create a Java method that does the following: "Iterate over the elements in the sequence.". | Of course, here is the Java code you requested:
```java
public <T extends Object> void forEach(final ITreeAppendable appendable, final Iterable<T> elements, final Procedure1<? super LoopParams> loopInitializer, final Procedure1<? super T> procedure) {
boolean _isEmpty = IterableExtensions.isEmpty(elements);
if... | |
whitesource/fs-agent | src/main/java/org/whitesource/agent/dependency/resolver/DependencyResolutionService.java | DependencyResolutionService.reduceDependencies | private void reduceDependencies(Map<ResolvedFolder, AbstractDependencyResolver> topFolderResolverMap) {
//reduce the dependencies and duplicates files
Set<String> topFolders = new HashSet<>();
topFolderResolverMap.entrySet().forEach((resolverEntry) -> topFolders.addAll(resolverEntry.getKey().get... | java | private void reduceDependencies(Map<ResolvedFolder, AbstractDependencyResolver> topFolderResolverMap) {
//reduce the dependencies and duplicates files
Set<String> topFolders = new HashSet<>();
topFolderResolverMap.entrySet().forEach((resolverEntry) -> topFolders.addAll(resolverEntry.getKey().get... | [
"private",
"void",
"reduceDependencies",
"(",
"Map",
"<",
"ResolvedFolder",
",",
"AbstractDependencyResolver",
">",
"topFolderResolverMap",
")",
"{",
"//reduce the dependencies and duplicates files",
"Set",
"<",
"String",
">",
"topFolders",
"=",
"new",
"HashSet",
"<>",
... | /* --- Private methods --- | [
"/",
"*",
"---",
"Private",
"methods",
"---"
] | d6ee4842c4f08f4aeda7eb2307b24c49b6bed0e1 | https://github.com/whitesource/fs-agent/blob/d6ee4842c4f08f4aeda7eb2307b24c49b6bed0e1/src/main/java/org/whitesource/agent/dependency/resolver/DependencyResolutionService.java#L367-L386 | train | Reduce the dependencies of the files in the given map. | Create a Java method that does the following: "Reduce the dependencies of the files in the given map.". | Of course, here is the Java code you requested:
```java
private void reduceDependencies(Map<ResolvedFolder, AbstractDependencyResolver> topFolderResolverMap) {
//reduce the dependencies and duplicates files
Set<String> topFolders = new HashSet<>();
topFolderResolverMap.entrySet().forEach((resol... | |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentQuotaStatusInner.java | ComponentQuotaStatusInner.get | public ApplicationInsightsComponentQuotaStatusInner get(String resourceGroupName, String resourceName) {
return getWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | java | public ApplicationInsightsComponentQuotaStatusInner get(String resourceGroupName, String resourceName) {
return getWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
} | [
"public",
"ApplicationInsightsComponentQuotaStatusInner",
"get",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"toBlocking",
"(",
")",
".",
"... | Returns daily data volume cap (quota) status for an Application Insights component.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thro... | [
"Returns",
"daily",
"data",
"volume",
"cap",
"(",
"quota",
")",
"status",
"for",
"an",
"Application",
"Insights",
"component",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentQuotaStatusInner.java#L70-L72 | train | Gets the quota status of an Application Insights component. | Create a Java method that does the following: "Gets the quota status of an Application Insights component.". | Of course, here is the Java code you requested:
```java
public ApplicationInsightsComponentQuotaStatusInner get(String resourceGroupName, String resourceName) {
return getWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body();
}
```
Hope this helps! | |
sarl/sarl | main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/comparison/NumberComparisonImplicitlyImportedFeatures.java | NumberComparisonImplicitlyImportedFeatures.getImportedFeatures | @SuppressWarnings("static-method")
public void getImportedFeatures(List<Class<?>> features) {
features.add(AtomicIntegerComparisonExtensions.class);
features.add(AtomicLongComparisonExtensions.class);
features.add(ByteComparisonExtensions.class);
features.add(DoubleComparisonExtensions.class);
features.add(F... | java | @SuppressWarnings("static-method")
public void getImportedFeatures(List<Class<?>> features) {
features.add(AtomicIntegerComparisonExtensions.class);
features.add(AtomicLongComparisonExtensions.class);
features.add(ByteComparisonExtensions.class);
features.add(DoubleComparisonExtensions.class);
features.add(F... | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"void",
"getImportedFeatures",
"(",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"features",
")",
"{",
"features",
".",
"add",
"(",
"AtomicIntegerComparisonExtensions",
".",
"class",
")",
";",
"fea... | Fill the given list with the implicitly imported features.
@param features the list to fill. | [
"Fill",
"the",
"given",
"list",
"with",
"the",
"implicitly",
"imported",
"features",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/comparison/NumberComparisonImplicitlyImportedFeatures.java#L44-L61 | train | Add the imported features to the list of features. | Create a Java method that does the following: "Add the imported features to the list of features.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("static-method")
public void getImportedFeatures(List<Class<?>> features) {
features.add(AtomicIntegerComparisonExtensions.class);
features.add(AtomicLongComparisonExtensions.class);
features.add(ByteComparisonExtensions.class);
feature... | |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java | ImageClient.insertImage | @BetaApi
public final Operation insertImage(Boolean forceCreate, String project, Image imageResource) {
InsertImageHttpRequest request =
InsertImageHttpRequest.newBuilder()
.setForceCreate(forceCreate)
.setProject(project)
.setImageResource(imageResource)
.... | java | @BetaApi
public final Operation insertImage(Boolean forceCreate, String project, Image imageResource) {
InsertImageHttpRequest request =
InsertImageHttpRequest.newBuilder()
.setForceCreate(forceCreate)
.setProject(project)
.setImageResource(imageResource)
.... | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertImage",
"(",
"Boolean",
"forceCreate",
",",
"String",
"project",
",",
"Image",
"imageResource",
")",
"{",
"InsertImageHttpRequest",
"request",
"=",
"InsertImageHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"... | Creates an image in the specified project using the data included in the request.
<p>Sample code:
<pre><code>
try (ImageClient imageClient = ImageClient.create()) {
Boolean forceCreate = false;
ProjectName project = ProjectName.of("[PROJECT]");
Image imageResource = Image.newBuilder().build();
Operation response = im... | [
"Creates",
"an",
"image",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
"."
] | d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/ImageClient.java#L715-L725 | train | Creates or updates an image in the specified project using the data included in the request. | Create a Java method that does the following: "Creates or updates an image in the specified project using the data included in the request.". | Of course, here is the Java code you requested:
```java
@BetaApi
public final Operation insertImage(Boolean forceCreate, String project, Image imageResource) {
InsertImageHttpRequest request =
InsertImageHttpRequest.newBuilder()
.setForceCreate(forceCreate)
.setProject(project)
... | |
ArcadiaConsulting/javapns-json-refactor | src/main/java/javapns/notification/PushNotificationManager.java | PushNotificationManager.sendNotifications | public PushedNotifications sendNotifications(Payload payload, List<Device> devices) throws CommunicationException, KeystoreException {
PushedNotifications notifications = new PushedNotifications();
for (Device device : devices)
notifications.add(sendNotification(device, payload, false, SEQUENTIAL_IDENTIFIER))... | java | public PushedNotifications sendNotifications(Payload payload, List<Device> devices) throws CommunicationException, KeystoreException {
PushedNotifications notifications = new PushedNotifications();
for (Device device : devices)
notifications.add(sendNotification(device, payload, false, SEQUENTIAL_IDENTIFIER))... | [
"public",
"PushedNotifications",
"sendNotifications",
"(",
"Payload",
"payload",
",",
"List",
"<",
"Device",
">",
"devices",
")",
"throws",
"CommunicationException",
",",
"KeystoreException",
"{",
"PushedNotifications",
"notifications",
"=",
"new",
"PushedNotifications",
... | Send a notification to a multiple devices in a single connection and close the connection.
@param payload the payload to send
@param devices the device to be notified
@return a list of pushed notifications, each with details on transmission results and error (if any)
@throws CommunicationException thrown if a communic... | [
"Send",
"a",
"notification",
"to",
"a",
"multiple",
"devices",
"in",
"a",
"single",
"connection",
"and",
"close",
"the",
"connection",
"."
] | 293575ceda910b9c74733d2f6b963dff5302d859 | https://github.com/ArcadiaConsulting/javapns-json-refactor/blob/293575ceda910b9c74733d2f6b963dff5302d859/src/main/java/javapns/notification/PushNotificationManager.java#L283-L800 | train | Sends a notification to a list of devices. | Create a Java method that does the following: "Sends a notification to a list of devices.". | Of course, here is the Java code you requested:
```java
public PushedNotifications sendNotifications(Payload payload, List<Device> devices) throws CommunicationException, KeystoreException {
PushedNotifications notifications = new PushedNotifications();
for (Device device : devices)
notifications.add(sendNot... | |
RestComm/jain-slee.xcap | resources/xcap-client/ra/src/main/java/org/restcomm/slee/resource/xcapclient/XCAPClientResourceAdaptor.java | XCAPClientResourceAdaptor.getActivity | public Object getActivity(ActivityHandle ah) {
if (tracer.isFineEnabled()) {
tracer.fine("get Activity with ActivityHandle "+ah.toString());
}
// if handle exists then recreate activity
return activities.get(ah);
} | java | public Object getActivity(ActivityHandle ah) {
if (tracer.isFineEnabled()) {
tracer.fine("get Activity with ActivityHandle "+ah.toString());
}
// if handle exists then recreate activity
return activities.get(ah);
} | [
"public",
"Object",
"getActivity",
"(",
"ActivityHandle",
"ah",
")",
"{",
"if",
"(",
"tracer",
".",
"isFineEnabled",
"(",
")",
")",
"{",
"tracer",
".",
"fine",
"(",
"\"get Activity with ActivityHandle \"",
"+",
"ah",
".",
"toString",
"(",
")",
")",
";",
"}... | /*
(non-Javadoc)
@see javax.slee.resource.ResourceAdaptor#getActivity(javax.slee.resource.ActivityHandle) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 0caa9ab481a545e52c31401f19e99bdfbbfb7bf0 | https://github.com/RestComm/jain-slee.xcap/blob/0caa9ab481a545e52c31401f19e99bdfbbfb7bf0/resources/xcap-client/ra/src/main/java/org/restcomm/slee/resource/xcapclient/XCAPClientResourceAdaptor.java#L146-L152 | train | Gets the Activity object for the given ActivityHandle. | Create a Java method that does the following: "Gets the Activity object for the given ActivityHandle.". | Of course, here is the Java code you requested:
```java
public Object getActivity(ActivityHandle ah) {
if (tracer.isFineEnabled()) {
tracer.fine("get Activity with ActivityHandle "+ah.toString());
}
// if handle exists then recreate activity
return activities.get(ah);
}
```
Hope this ... | |
kubernetes-client/java | util/src/main/java/io/kubernetes/client/informer/cache/DeltaFIFO.java | DeltaFIFO.syncKeyLocked | private void syncKeyLocked(String key) {
ApiType obj = this.knownObjects.getByKey(key);
if (obj == null) {
return;
}
String id = this.keyOf(obj);
Deque<MutablePair<DeltaType, Object>> deltas = this.items.get(id);
if (deltas != null && !(Collections.isEmptyCollection(deltas))) {
retu... | java | private void syncKeyLocked(String key) {
ApiType obj = this.knownObjects.getByKey(key);
if (obj == null) {
return;
}
String id = this.keyOf(obj);
Deque<MutablePair<DeltaType, Object>> deltas = this.items.get(id);
if (deltas != null && !(Collections.isEmptyCollection(deltas))) {
retu... | [
"private",
"void",
"syncKeyLocked",
"(",
"String",
"key",
")",
"{",
"ApiType",
"obj",
"=",
"this",
".",
"knownObjects",
".",
"getByKey",
"(",
"key",
")",
";",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
";",
"}",
"String",
"id",
"=",
"this",
... | Add Sync delta. Caller must hold the lock. | [
"Add",
"Sync",
"delta",
".",
"Caller",
"must",
"hold",
"the",
"lock",
"."
] | 7413e98bd904f09d1ad00fb60e8c6ff787f3f560 | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/informer/cache/DeltaFIFO.java#L403-L416 | train | Sync a key. | Create a Java method that does the following: "Sync a key.". | Of course, here is the Java code you requested:
```java
private void syncKeyLocked(String key) {
ApiType obj = this.knownObjects.getByKey(key);
if (obj == null) {
return;
}
String id = this.keyOf(obj);
Deque<MutablePair<DeltaType, Object>> deltas = this.items.get(id);
if (deltas != null ... | |
fastconnect/tibco-bwmaven | bw-maven-plugin/src/main/java/fr/fastconnect/factory/tibco/bw/maven/packaging/ApplicationManagement.java | ApplicationManagement.getAdapter | private Adapter getAdapter(String name) {
List<Adapter> services = getAdapterServices();
if (services != null) {
for (Adapter service : services) {
if (service.getName().equals(name)) {
return service;
}
}
}
Adapter result = new Adapter();
result.setName(name);
services.add(result);
... | java | private Adapter getAdapter(String name) {
List<Adapter> services = getAdapterServices();
if (services != null) {
for (Adapter service : services) {
if (service.getName().equals(name)) {
return service;
}
}
}
Adapter result = new Adapter();
result.setName(name);
services.add(result);
... | [
"private",
"Adapter",
"getAdapter",
"(",
"String",
"name",
")",
"{",
"List",
"<",
"Adapter",
">",
"services",
"=",
"getAdapterServices",
"(",
")",
";",
"if",
"(",
"services",
"!=",
"null",
")",
"{",
"for",
"(",
"Adapter",
"service",
":",
"services",
")",... | /application/services/adapter | [
"/",
"application",
"/",
"services",
"/",
"adapter"
] | 09637c0e9f029fff41a7d84078965b63d261aed2 | https://github.com/fastconnect/tibco-bwmaven/blob/09637c0e9f029fff41a7d84078965b63d261aed2/bw-maven-plugin/src/main/java/fr/fastconnect/factory/tibco/bw/maven/packaging/ApplicationManagement.java#L760-L780 | valid | Gets the Adapter with the given name. | Create a Java method that does the following: "Gets the Adapter with the given name.". | Of course, here is the Java code you requested:
```java
private Adapter getAdapter(String name) {
List<Adapter> services = getAdapterServices();
if (services != null) {
for (Adapter service : services) {
if (service.getName().equals(name)) {
return service;
}
}
}
Adapter result = new Adapt... | |
karlnicholas/openstates-client | src/main/java/org/openstates/api/OpenStates.java | OpenStates.query | public <T> T query(MethodMap methodMap, ArgMap argMap, Class<T> responseType ) throws OpenStatesException {
BufferedReader reader = null;
HttpURLConnection conn = null;
String charSet = "utf-8";
try {
if ( isCaching(methodMap, argMap) ) {
File file = getCacheFile(methodMap, argMap);
long fileLength ... | java | public <T> T query(MethodMap methodMap, ArgMap argMap, Class<T> responseType ) throws OpenStatesException {
BufferedReader reader = null;
HttpURLConnection conn = null;
String charSet = "utf-8";
try {
if ( isCaching(methodMap, argMap) ) {
File file = getCacheFile(methodMap, argMap);
long fileLength ... | [
"public",
"<",
"T",
">",
"T",
"query",
"(",
"MethodMap",
"methodMap",
",",
"ArgMap",
"argMap",
",",
"Class",
"<",
"T",
">",
"responseType",
")",
"throws",
"OpenStatesException",
"{",
"BufferedReader",
"reader",
"=",
"null",
";",
"HttpURLConnection",
"conn",
... | Handles the actual API calls and caching.
This is part of a static class and therefore is not thread-safe. This method
is not for public consumption. | [
"Handles",
"the",
"actual",
"API",
"calls",
"and",
"caching",
"."
] | 423dd188a093bb7d80325f087a32ae34b323c267 | https://github.com/karlnicholas/openstates-client/blob/423dd188a093bb7d80325f087a32ae34b323c267/src/main/java/org/openstates/api/OpenStates.java#L161-L208 | valid | Query the OpenStates API. | Create a Java method that does the following: "Query the OpenStates API.". | Of course, here is the Java code you requested:
```java
public <T> T query(MethodMap methodMap, ArgMap argMap, Class<T> responseType ) throws OpenStatesException {
BufferedReader reader = null;
HttpURLConnection conn = null;
String charSet = "utf-8";
try {
if ( isCaching(methodMap, argMap) ) {
File file... | |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/operations/validation/EnumValidator.java | EnumValidator.create | @SafeVarargs
public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final E... allowed) {
if (allowed == null || allowed.length == 0) {
return create(enumType, EnumSet.allOf(enumType));
}
return new EnumValidator<E>(enumType, allowed);
} | java | @SafeVarargs
public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final E... allowed) {
if (allowed == null || allowed.length == 0) {
return create(enumType, EnumSet.allOf(enumType));
}
return new EnumValidator<E>(enumType, allowed);
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"EnumValidator",
"<",
"E",
">",
"create",
"(",
"final",
"Class",
"<",
"E",
">",
"enumType",
",",
"final",
"E",
"...",
"allowed",
")",
"{",
"if",
"(",
"allowed",
... | Creates a new validator for the enum type with the allowed values defined in the {@code allowed} parameter.
@param enumType the type of the enum.
@param allowed the enum values that are allowed. If {@code null} or zero length this is interpreted as meaning all values
@param <E> the type of the enum.
@return a n... | [
"Creates",
"a",
"new",
"validator",
"for",
"the",
"enum",
"type",
"with",
"the",
"allowed",
"values",
"defined",
"in",
"the",
"{",
"@code",
"allowed",
"}",
"parameter",
"."
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/operations/validation/EnumValidator.java#L144-L150 | train | Create a new instance of the class validation class. | Create a Java method that does the following: "Create a new instance of the class validation class.". | Of course, here is the Java code you requested:
```java
@SafeVarargs
public static <E extends Enum<E>> EnumValidator<E> create(final Class<E> enumType, final E... allowed) {
if (allowed == null || allowed.length == 0) {
return create(enumType, EnumSet.allOf(enumType));
}
return ... | |
google/error-prone | check_api/src/main/java/com/google/errorprone/VisitorState.java | VisitorState.getEndPosition | public int getEndPosition(Tree node) {
JCCompilationUnit compilationUnit = (JCCompilationUnit) getPath().getCompilationUnit();
if (compilationUnit.endPositions == null) {
return -1;
}
return ((JCTree) node).getEndPosition(compilationUnit.endPositions);
} | java | public int getEndPosition(Tree node) {
JCCompilationUnit compilationUnit = (JCCompilationUnit) getPath().getCompilationUnit();
if (compilationUnit.endPositions == null) {
return -1;
}
return ((JCTree) node).getEndPosition(compilationUnit.endPositions);
} | [
"public",
"int",
"getEndPosition",
"(",
"Tree",
"node",
")",
"{",
"JCCompilationUnit",
"compilationUnit",
"=",
"(",
"JCCompilationUnit",
")",
"getPath",
"(",
")",
".",
"getCompilationUnit",
"(",
")",
";",
"if",
"(",
"compilationUnit",
".",
"endPositions",
"==",
... | Returns the end position of the node, or -1 if it is not available. | [
"Returns",
"the",
"end",
"position",
"of",
"the",
"node",
"or",
"-",
"1",
"if",
"it",
"is",
"not",
"available",
"."
] | fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/VisitorState.java#L527-L533 | train | Get the end position of a node. | Create a Java method that does the following: "Get the end position of a node.". | Of course, here is the Java code you requested:
```java
public int getEndPosition(Tree node) {
JCCompilationUnit compilationUnit = (JCCompilationUnit) getPath().getCompilationUnit();
if (compilationUnit.endPositions == null) {
return -1;
}
return ((JCTree) node).getEndPosition(compilationUnit.end... | |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/report/HDualReportScreen.java | HDualReportScreen.getPrintOptions | public int getPrintOptions()
throws DBException
{
int iHtmlOptions = super.getPrintOptions();
String strForms = this.getProperty(HtmlConstants.FORMS);
if ((strForms == null) || (strForms.length() == 0))
{
if (((DualReportScreen)this.getScreenField()).isPrintReport... | java | public int getPrintOptions()
throws DBException
{
int iHtmlOptions = super.getPrintOptions();
String strForms = this.getProperty(HtmlConstants.FORMS);
if ((strForms == null) || (strForms.length() == 0))
{
if (((DualReportScreen)this.getScreenField()).isPrintReport... | [
"public",
"int",
"getPrintOptions",
"(",
")",
"throws",
"DBException",
"{",
"int",
"iHtmlOptions",
"=",
"super",
".",
"getPrintOptions",
"(",
")",
";",
"String",
"strForms",
"=",
"this",
".",
"getProperty",
"(",
"HtmlConstants",
".",
"FORMS",
")",
";",
"if",... | display this screen in html input format.
returns true if default params were found for this form.
@ param bAddDescColumn true if form, otherwise grid format
@exception DBException File exception. | [
"display",
"this",
"screen",
"in",
"html",
"input",
"format",
".",
"returns",
"true",
"if",
"default",
"params",
"were",
"found",
"for",
"this",
"form",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/report/HDualReportScreen.java#L89-L102 | train | Get the print options for this record. | Create a Java method that does the following: "Get the print options for this record.". | Of course, here is the Java code you requested:
```java
public int getPrintOptions()
throws DBException
{
int iHtmlOptions = super.getPrintOptions();
String strForms = this.getProperty(HtmlConstants.FORMS);
if ((strForms == null) || (strForms.length() == 0))
{
if... | |
Netflix/Hystrix | hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericSetterBuilder.java | GenericSetterBuilder.build | public HystrixCommand.Setter build() throws HystrixPropertyException {
HystrixCommand.Setter setter = HystrixCommand.Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey))
.andCommandKey(HystrixCommandKey.Factory.asKey(commandKey));
if (StringUtils.isNotBlan... | java | public HystrixCommand.Setter build() throws HystrixPropertyException {
HystrixCommand.Setter setter = HystrixCommand.Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey))
.andCommandKey(HystrixCommandKey.Factory.asKey(commandKey));
if (StringUtils.isNotBlan... | [
"public",
"HystrixCommand",
".",
"Setter",
"build",
"(",
")",
"throws",
"HystrixPropertyException",
"{",
"HystrixCommand",
".",
"Setter",
"setter",
"=",
"HystrixCommand",
".",
"Setter",
".",
"withGroupKey",
"(",
"HystrixCommandGroupKey",
".",
"Factory",
".",
"asKey"... | Creates instance of {@link HystrixCommand.Setter}.
@return the instance of {@link HystrixCommand.Setter} | [
"Creates",
"instance",
"of",
"{",
"@link",
"HystrixCommand",
".",
"Setter",
"}",
"."
] | 3cb21589895e9f8f87cfcdbc9d96d9f63d48b848 | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericSetterBuilder.java#L73-L91 | train | Build the setter. | Create a Java method that does the following: "Build the setter.". | Of course, here is the Java code you requested:
```java
public HystrixCommand.Setter build() throws HystrixPropertyException {
HystrixCommand.Setter setter = HystrixCommand.Setter
.withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey))
.andCommandKey(HystrixCommandKey.Fact... | |
google/guava | guava/src/com/google/common/collect/Maps.java | Maps.toImmutableEnumMap | public static <T, K extends Enum<K>, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableEnumMap(
java.util.function.Function<? super T, ? extends K> keyFunction,
java.util.function.Function<? super T, ? extends V> valueFunction,
BinaryOperator<V> mergeFunction) {
checkNotNull(keyFunction);
chec... | java | public static <T, K extends Enum<K>, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableEnumMap(
java.util.function.Function<? super T, ? extends K> keyFunction,
java.util.function.Function<? super T, ? extends V> valueFunction,
BinaryOperator<V> mergeFunction) {
checkNotNull(keyFunction);
chec... | [
"public",
"static",
"<",
"T",
",",
"K",
"extends",
"Enum",
"<",
"K",
">",
",",
"V",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"ImmutableMap",
"<",
"K",
",",
"V",
">",
">",
"toImmutableEnumMap",
"(",
"java",
".",
"util",
".",
"function",
".",
"Fu... | Returns a {@link Collector} that accumulates elements into an {@code ImmutableMap} whose keys
and values are the result of applying the provided mapping functions to the input elements. The
resulting implementation is specialized for enum key types. The returned map and its views will
iterate over keys in their enum de... | [
"Returns",
"a",
"{",
"@link",
"Collector",
"}",
"that",
"accumulates",
"elements",
"into",
"an",
"{",
"@code",
"ImmutableMap",
"}",
"whose",
"keys",
"and",
"values",
"are",
"the",
"result",
"of",
"applying",
"the",
"provided",
"mapping",
"functions",
"to",
"... | 7155d12b70a2406fa84d94d4b8b3bc108e89abfd | https://github.com/google/guava/blob/7155d12b70a2406fa84d94d4b8b3bc108e89abfd/guava/src/com/google/common/collect/Maps.java#L252-L269 | valid | Collect an immutable enumeration map by applying the given function to each element of the input stream. | Create a Java method that does the following: "Collect an immutable enumeration map by applying the given function to each element of the input stream.". | Of course, here is the Java code you requested:
```java
public static <T, K extends Enum<K>, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableEnumMap(
java.util.function.Function<? super T, ? extends K> keyFunction,
java.util.function.Function<? super T, ? extends V> valueFunction,
BinaryOperator<V>... | |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/proxy/CollectionProxyDefaultImpl.java | CollectionProxyDefaultImpl.loadProfileIfNeeded | protected void loadProfileIfNeeded()
{
final Object key = getProfileKey();
if (key != null)
{
final MetadataManager mm = MetadataManager.getInstance();
if (!key.equals(mm.getCurrentProfileKey()))
{
mm.loadProfile(key);
... | java | protected void loadProfileIfNeeded()
{
final Object key = getProfileKey();
if (key != null)
{
final MetadataManager mm = MetadataManager.getInstance();
if (!key.equals(mm.getCurrentProfileKey()))
{
mm.loadProfile(key);
... | [
"protected",
"void",
"loadProfileIfNeeded",
"(",
")",
"{",
"final",
"Object",
"key",
"=",
"getProfileKey",
"(",
")",
";",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"final",
"MetadataManager",
"mm",
"=",
"MetadataManager",
".",
"getInstance",
"(",
")",
";",... | Reactivates metadata profile used when creating proxy, if needed.
Calls to this method should be guarded by checking
{@link #_perThreadDescriptorsEnabled} since the profile never
needs to be reloaded if not using pre-thread metadata changes. | [
"Reactivates",
"metadata",
"profile",
"used",
"when",
"creating",
"proxy",
"if",
"needed",
".",
"Calls",
"to",
"this",
"method",
"should",
"be",
"guarded",
"by",
"checking",
"{"
] | 9a544372f67ce965f662cdc71609dd03683c8f04 | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/proxy/CollectionProxyDefaultImpl.java#L116-L127 | train | Load the profile if necessary. | Create a Java method that does the following: "Load the profile if necessary.". | Of course, here is the Java code you requested:
```java
protected void loadProfileIfNeeded()
{
final Object key = getProfileKey();
if (key != null)
{
final MetadataManager mm = MetadataManager.getInstance();
if (!key.equals(mm.getCurrentProfileKey()))
... | |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SeleniumActionBuilder.java | SeleniumActionBuilder.page | public PageActionBuilder page(WebPage page) {
PageAction action = new PageAction();
action.setPage(page);
action(action);
return new PageActionBuilder(action);
} | java | public PageActionBuilder page(WebPage page) {
PageAction action = new PageAction();
action.setPage(page);
action(action);
return new PageActionBuilder(action);
} | [
"public",
"PageActionBuilder",
"page",
"(",
"WebPage",
"page",
")",
"{",
"PageAction",
"action",
"=",
"new",
"PageAction",
"(",
")",
";",
"action",
".",
"setPage",
"(",
"page",
")",
";",
"action",
"(",
"action",
")",
";",
"return",
"new",
"PageActionBuilde... | Page action. | [
"Page",
"action",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SeleniumActionBuilder.java#L125-L130 | train | Create a new PageActionBuilder with a page. | Create a Java method that does the following: "Create a new PageActionBuilder with a page.". | Of course, here is the Java code you requested:
```java
public PageActionBuilder page(WebPage page) {
PageAction action = new PageAction();
action.setPage(page);
action(action);
return new PageActionBuilder(action);
}
```
Hope this helps! | |
lisicnu/droidUtil | src/main/java/com/github/lisicnu/libDroid/util/BitmapUtils.java | BitmapUtils.load | public synchronized static Bitmap load(InputStream is, int width, int height) {
BitmapFactory.Options opt = null;
try {
opt = new BitmapFactory.Options();
if (width > 0 && height > 0) {
if (is.markSupported()) {
is.mark(is.available());
... | java | public synchronized static Bitmap load(InputStream is, int width, int height) {
BitmapFactory.Options opt = null;
try {
opt = new BitmapFactory.Options();
if (width > 0 && height > 0) {
if (is.markSupported()) {
is.mark(is.available());
... | [
"public",
"synchronized",
"static",
"Bitmap",
"load",
"(",
"InputStream",
"is",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"BitmapFactory",
".",
"Options",
"opt",
"=",
"null",
";",
"try",
"{",
"opt",
"=",
"new",
"BitmapFactory",
".",
"Options",
... | BitmapFactory fails to decode the InputStream. | [
"BitmapFactory",
"fails",
"to",
"decode",
"the",
"InputStream",
"."
] | e4d6cf3e3f60e5efb5a75672607ded94d1725519 | https://github.com/lisicnu/droidUtil/blob/e4d6cf3e3f60e5efb5a75672607ded94d1725519/src/main/java/com/github/lisicnu/libDroid/util/BitmapUtils.java#L117-L150 | train | Load a bitmap from an input stream. | Create a Java method that does the following: "Load a bitmap from an input stream.". | Of course, here is the Java code you requested:
```java
public synchronized static Bitmap load(InputStream is, int width, int height) {
BitmapFactory.Options opt = null;
try {
opt = new BitmapFactory.Options();
if (width > 0 && height > 0) {
if (is.markSupported(... | |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-data/src/main/java/com/intuit/ipp/data/ObjectFactory.java | ObjectFactory.createReimburseCharge | @XmlElementDecl(namespace = "http://schema.intuit.com/finance/v3", name = "ReimburseCharge", substitutionHeadNamespace = "http://schema.intuit.com/finance/v3", substitutionHeadName = "IntuitObject")
public JAXBElement<ReimburseCharge> createReimburseCharge(ReimburseCharge value) {
return new JAXBElement<Rei... | java | @XmlElementDecl(namespace = "http://schema.intuit.com/finance/v3", name = "ReimburseCharge", substitutionHeadNamespace = "http://schema.intuit.com/finance/v3", substitutionHeadName = "IntuitObject")
public JAXBElement<ReimburseCharge> createReimburseCharge(ReimburseCharge value) {
return new JAXBElement<Rei... | [
"@",
"XmlElementDecl",
"(",
"namespace",
"=",
"\"http://schema.intuit.com/finance/v3\"",
",",
"name",
"=",
"\"ReimburseCharge\"",
",",
"substitutionHeadNamespace",
"=",
"\"http://schema.intuit.com/finance/v3\"",
",",
"substitutionHeadName",
"=",
"\"IntuitObject\"",
")",
"public... | Create an instance of {@link JAXBElement }{@code <}{@link ReimburseCharge }{@code >}} | [
"Create",
"an",
"instance",
"of",
"{",
"@link",
"JAXBElement",
"}",
"{",
"@code",
"<",
"}",
"{",
"@link",
"ReimburseCharge",
"}",
"{",
"@code",
">",
"}}"
] | 59f988d0776d46620d0b34711c411b2b5b1da06b | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-data/src/main/java/com/intuit/ipp/data/ObjectFactory.java#L2033-L2036 | train | Create an instance of ReimburseCharge | Create a Java method that does the following: "Create an instance of ReimburseCharge". | Of course, here is the Java code you requested:
```java
@XmlElementDecl(namespace = "http://schema.intuit.com/finance/v3", name = "ReimburseCharge", substitutionHeadNamespace = "http://schema.intuit.com/finance/v3", substitutionHeadName = "IntuitObject")
public JAXBElement<ReimburseCharge> createReimburseCharge(Re... | |
alkacon/opencms-core | src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java | CmsSimpleSearchConfigurationParser.getFilterQuery | String getFilterQuery() {
String result = m_config.getFilterQuery();
if (result == null) {
result = "";
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(result) && !result.startsWith("&")) {
result = "&" + result;
}
if (!result.contains(CommonParams... | java | String getFilterQuery() {
String result = m_config.getFilterQuery();
if (result == null) {
result = "";
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(result) && !result.startsWith("&")) {
result = "&" + result;
}
if (!result.contains(CommonParams... | [
"String",
"getFilterQuery",
"(",
")",
"{",
"String",
"result",
"=",
"m_config",
".",
"getFilterQuery",
"(",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"\"\"",
";",
"}",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly... | Returns the filter query string.<p>
@return the filter query | [
"Returns",
"the",
"filter",
"query",
"string",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java#L562-L585 | train | Returns the filter query. | Create a Java method that does the following: "Returns the filter query.". | Of course, here is the Java code you requested:
```java
String getFilterQuery() {
String result = m_config.getFilterQuery();
if (result == null) {
result = "";
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(result) && !result.startsWith("&")) {
result = "&" + re... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/logging/WebContainerLogger.java | WebContainerLogger.throwableToString | public static String throwableToString(Throwable t)
{
StringWriter s = new StringWriter();
PrintWriter p = new PrintWriter(s);
t.printStackTrace(p);
return s.toString();
} | java | public static String throwableToString(Throwable t)
{
StringWriter s = new StringWriter();
PrintWriter p = new PrintWriter(s);
t.printStackTrace(p);
return s.toString();
} | [
"public",
"static",
"String",
"throwableToString",
"(",
"Throwable",
"t",
")",
"{",
"StringWriter",
"s",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"p",
"=",
"new",
"PrintWriter",
"(",
"s",
")",
";",
"t",
".",
"printStackTrace",
"(",
"p",
... | Accepts a throwable and returns a String representation.
@param t
@return string representation of stack trace | [
"Accepts",
"a",
"throwable",
"and",
"returns",
"a",
"String",
"representation",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/logging/WebContainerLogger.java#L263-L269 | train | Convert a throwable to a String. | Create a Java method that does the following: "Convert a throwable to a String.". | Of course, here is the Java code you requested:
```java
public static String throwableToString(Throwable t)
{
StringWriter s = new StringWriter();
PrintWriter p = new PrintWriter(s);
t.printStackTrace(p);
return s.toString();
}
```
Hope this helps! | |
hawkular/hawkular-apm | server/rest/src/main/java/org/hawkular/apm/server/rest/RESTServiceUtil.java | RESTServiceUtil.decodeCorrelationIdentifiers | public static void decodeCorrelationIdentifiers(Set<CorrelationIdentifier> correlations, String encoded) {
if (encoded != null && !encoded.trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(encoded, ",");
while (st.hasMoreTokens()) {
String token = st.nextToken(... | java | public static void decodeCorrelationIdentifiers(Set<CorrelationIdentifier> correlations, String encoded) {
if (encoded != null && !encoded.trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(encoded, ",");
while (st.hasMoreTokens()) {
String token = st.nextToken(... | [
"public",
"static",
"void",
"decodeCorrelationIdentifiers",
"(",
"Set",
"<",
"CorrelationIdentifier",
">",
"correlations",
",",
"String",
"encoded",
")",
"{",
"if",
"(",
"encoded",
"!=",
"null",
"&&",
"!",
"encoded",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(... | This method processes a comma separated list of correlation identifiers, defined as a scope|value pair.
@param correlations The correlation identifier set
@param encoded The string containing the encoded correlation identifiers | [
"This",
"method",
"processes",
"a",
"comma",
"separated",
"list",
"of",
"correlation",
"identifiers",
"defined",
"as",
"a",
"scope|value",
"pair",
"."
] | 57a4df0611b359597626563ea5f9ac64d4bb2533 | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/server/rest/src/main/java/org/hawkular/apm/server/rest/RESTServiceUtil.java#L73-L93 | train | Decodes the given encoded correlation identifiers into the given set of CorrelationIdentifiers. | Create a Java method that does the following: "Decodes the given encoded correlation identifiers into the given set of CorrelationIdentifiers.". | Of course, here is the Java code you requested:
```java
public static void decodeCorrelationIdentifiers(Set<CorrelationIdentifier> correlations, String encoded) {
if (encoded != null && !encoded.trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(encoded, ",");
while (st.hasMor... | |
openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java | RestRequest.requestPut | public Serializable requestPut(final String id, final Serializable object) throws SDKException {
CloseableHttpResponse response = null;
HttpPut httpPut = null;
checkToken();
try {
log.trace("Object is: " + object);
String fileJSONNode = mapper.toJson(object);
// call the api here
... | java | public Serializable requestPut(final String id, final Serializable object) throws SDKException {
CloseableHttpResponse response = null;
HttpPut httpPut = null;
checkToken();
try {
log.trace("Object is: " + object);
String fileJSONNode = mapper.toJson(object);
// call the api here
... | [
"public",
"Serializable",
"requestPut",
"(",
"final",
"String",
"id",
",",
"final",
"Serializable",
"object",
")",
"throws",
"SDKException",
"{",
"CloseableHttpResponse",
"response",
"=",
"null",
";",
"HttpPut",
"httpPut",
"=",
"null",
";",
"checkToken",
"(",
")... | Executes a http put with to a given id, while serializing the object content as json and
returning the response
@param id the id path used for the api request
@param object the object content to be serialized as json
@return a string containing the response content
@throws SDKException if the request fails | [
"Executes",
"a",
"http",
"put",
"with",
"to",
"a",
"given",
"id",
"while",
"serializing",
"the",
"object",
"content",
"as",
"json",
"and",
"returning",
"the",
"response"
] | 6ca6dd6b62a23940d312213d6fa489d5b636061a | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L900-L973 | train | Request an object from the server. | Create a Java method that does the following: "Request an object from the server.". | Of course, here is the Java code you requested:
```java
public Serializable requestPut(final String id, final Serializable object) throws SDKException {
CloseableHttpResponse response = null;
HttpPut httpPut = null;
checkToken();
try {
log.trace("Object is: " + object);
String fileJSONNode... | |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java | BitfinexSymbols.ticker | public static BitfinexTickerSymbol ticker(final String currency, final String profitCurrency) {
final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase();
return ticker(B... | java | public static BitfinexTickerSymbol ticker(final String currency, final String profitCurrency) {
final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase();
return ticker(B... | [
"public",
"static",
"BitfinexTickerSymbol",
"ticker",
"(",
"final",
"String",
"currency",
",",
"final",
"String",
"profitCurrency",
")",
"{",
"final",
"String",
"currencyNonNull",
"=",
"Objects",
".",
"requireNonNull",
"(",
"currency",
")",
".",
"toUpperCase",
"("... | returns symbol for ticker channel
@param currency of ticker
@param profitCurrency of ticker
@return symbol | [
"returns",
"symbol",
"for",
"ticker",
"channel"
] | 2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java#L182-L188 | train | Create a ticker symbol | Create a Java method that does the following: "Create a ticker symbol". | Of course, here is the Java code you requested:
```java
public static BitfinexTickerSymbol ticker(final String currency, final String profitCurrency) {
final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase();
final String profitCurrencyNonNull = Objects.requireNonNull(profit... | |
docker-java/docker-java | src/main/java/com/github/dockerjava/api/model/Device.java | Device.validDeviceMode | private static boolean validDeviceMode(String deviceMode) {
Map<String, Boolean> validModes = new HashMap<>(3);
validModes.put("r", true);
validModes.put("w", true);
validModes.put("m", true);
if (isEmpty(deviceMode)) {
return false;
}
for (char ch :... | java | private static boolean validDeviceMode(String deviceMode) {
Map<String, Boolean> validModes = new HashMap<>(3);
validModes.put("r", true);
validModes.put("w", true);
validModes.put("m", true);
if (isEmpty(deviceMode)) {
return false;
}
for (char ch :... | [
"private",
"static",
"boolean",
"validDeviceMode",
"(",
"String",
"deviceMode",
")",
"{",
"Map",
"<",
"String",
",",
"Boolean",
">",
"validModes",
"=",
"new",
"HashMap",
"<>",
"(",
"3",
")",
";",
"validModes",
".",
"put",
"(",
"\"r\"",
",",
"true",
")",
... | ValidDeviceMode checks if the mode for device is valid or not.
Valid mode is a composition of r (read), w (write), and m (mknod).
@link https://github.com/docker/docker/blob/6b4a46f28266031ce1a1315f17fb69113a06efe1/runconfig/opts/parse.go#L796 | [
"ValidDeviceMode",
"checks",
"if",
"the",
"mode",
"for",
"device",
"is",
"valid",
"or",
"not",
".",
"Valid",
"mode",
"is",
"a",
"composition",
"of",
"r",
"(",
"read",
")",
"w",
"(",
"write",
")",
"and",
"m",
"(",
"mknod",
")",
"."
] | c5c89327108abdc50aa41d7711d4743b8bac75fe | https://github.com/docker-java/docker-java/blob/c5c89327108abdc50aa41d7711d4743b8bac75fe/src/main/java/com/github/dockerjava/api/model/Device.java#L105-L124 | train | Check if the device mode is valid. | Create a Java method that does the following: "Check if the device mode is valid.". | Of course, here is the Java code you requested:
```java
private static boolean validDeviceMode(String deviceMode) {
Map<String, Boolean> validModes = new HashMap<>(3);
validModes.put("r", true);
validModes.put("w", true);
validModes.put("m", true);
if (isEmpty(deviceMode)) {
... | |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java | Apptentive.getPersonName | public static String getPersonName() {
try {
if (ApptentiveInternal.isApptentiveRegistered()) {
ConversationProxy conversation = ApptentiveInternal.getInstance().getConversationProxy();
if (conversation != null) {
return conversation.getPersonName();
}
}
} catch (Exception e) {
ApptentiveL... | java | public static String getPersonName() {
try {
if (ApptentiveInternal.isApptentiveRegistered()) {
ConversationProxy conversation = ApptentiveInternal.getInstance().getConversationProxy();
if (conversation != null) {
return conversation.getPersonName();
}
}
} catch (Exception e) {
ApptentiveL... | [
"public",
"static",
"String",
"getPersonName",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"ApptentiveInternal",
".",
"isApptentiveRegistered",
"(",
")",
")",
"{",
"ConversationProxy",
"conversation",
"=",
"ApptentiveInternal",
".",
"getInstance",
"(",
")",
".",
"getC... | Retrieves the user's name. This name may be set via {@link #setPersonName(String)},
or by the user through Message Center.
@return The person's name if set, else null. | [
"Retrieves",
"the",
"user",
"s",
"name",
".",
"This",
"name",
"may",
"be",
"set",
"via",
"{",
"@link",
"#setPersonName",
"(",
"String",
")",
"}",
"or",
"by",
"the",
"user",
"through",
"Message",
"Center",
"."
] | 887c08d7bd5ae6488a90366dfb58f58938861a93 | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L211-L224 | train | Gets the person name. | Create a Java method that does the following: "Gets the person name.". | Of course, here is the Java code you requested:
```java
public static String getPersonName() {
try {
if (ApptentiveInternal.isApptentiveRegistered()) {
ConversationProxy conversation = ApptentiveInternal.getInstance().getConversationProxy();
if (conversation != null) {
return conversation.getPersonNa... | |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/settings/ArgsParser.java | ArgsParser.parse | public static Map<Object,Object> parse(List<String> args)
{
final short START =1, VAL=2;
short state = START;
Map<Object,Object> map = new HashMap<>(args.size());
String key=null,value=null;
for (String arg : args)
{
arg = arg.trim();
switch(state)
{
case START:
if(arg.sta... | java | public static Map<Object,Object> parse(List<String> args)
{
final short START =1, VAL=2;
short state = START;
Map<Object,Object> map = new HashMap<>(args.size());
String key=null,value=null;
for (String arg : args)
{
arg = arg.trim();
switch(state)
{
case START:
if(arg.sta... | [
"public",
"static",
"Map",
"<",
"Object",
",",
"Object",
">",
"parse",
"(",
"List",
"<",
"String",
">",
"args",
")",
"{",
"final",
"short",
"START",
"=",
"1",
",",
"VAL",
"=",
"2",
";",
"short",
"state",
"=",
"START",
";",
"Map",
"<",
"Object",
"... | ------------------------------------------------ | [
"------------------------------------------------"
] | 38d5b843c76eae9762bbca20453ed0f0ad8412a9 | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/settings/ArgsParser.java#L25-L77 | train | Parses the list of String arguments and returns a Map of objects and values. | Create a Java method that does the following: "Parses the list of String arguments and returns a Map of objects and values.". | Of course, here is the Java code you requested:
```java
public static Map<Object,Object> parse(List<String> args)
{
final short START =1, VAL=2;
short state = START;
Map<Object,Object> map = new HashMap<>(args.size());
String key=null,value=null;
for (String arg : args)
{
arg = arg.trim();
... | |
nextreports/nextreports-engine | src/ro/nextreports/engine/querybuilder/sql/SelectQuery.java | SelectQuery.canAddTableToFromClause | private boolean canAddTableToFromClause(Table table, Map<Table, List<JoinCriteria>> destMap, List<Table> allTables) {
if ((table == null) || allTables.contains(table)) {
return false;
}
if ((destMap.get(table) != null) && (destMap.get(table).size() > 0)) {
List<JoinCriteria> list = destMap.ge... | java | private boolean canAddTableToFromClause(Table table, Map<Table, List<JoinCriteria>> destMap, List<Table> allTables) {
if ((table == null) || allTables.contains(table)) {
return false;
}
if ((destMap.get(table) != null) && (destMap.get(table).size() > 0)) {
List<JoinCriteria> list = destMap.ge... | [
"private",
"boolean",
"canAddTableToFromClause",
"(",
"Table",
"table",
",",
"Map",
"<",
"Table",
",",
"List",
"<",
"JoinCriteria",
">",
">",
"destMap",
",",
"List",
"<",
"Table",
">",
"allTables",
")",
"{",
"if",
"(",
"(",
"table",
"==",
"null",
")",
... | outer joins are written in Table class | [
"outer",
"joins",
"are",
"written",
"in",
"Table",
"class"
] | a847575a9298b5fce63b88961190c5b83ddccc44 | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/querybuilder/sql/SelectQuery.java#L789-L802 | train | Checks if the table can be added to from clause. | Create a Java method that does the following: "Checks if the table can be added to from clause.". | Of course, here is the Java code you requested:
```java
private boolean canAddTableToFromClause(Table table, Map<Table, List<JoinCriteria>> destMap, List<Table> allTables) {
if ((table == null) || allTables.contains(table)) {
return false;
}
if ((destMap.get(table) != null) && (destMap.get(table).... | |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/vector/Vectors.java | Vectors.immutable | public static IntegerVector immutable(IntegerVector vector) {
if (vector == null)
throw new NullPointerException("Cannot create an immutable " +
"null vector");
return new IntegerVectorView(vector, true);
} | java | public static IntegerVector immutable(IntegerVector vector) {
if (vector == null)
throw new NullPointerException("Cannot create an immutable " +
"null vector");
return new IntegerVectorView(vector, true);
} | [
"public",
"static",
"IntegerVector",
"immutable",
"(",
"IntegerVector",
"vector",
")",
"{",
"if",
"(",
"vector",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Cannot create an immutable \"",
"+",
"\"null vector\"",
")",
";",
"return",
"new",
"... | Returns an immutable view of the given {@code IntegerVector}.
@param vector The {@code IntegerVector} to decorate as immutable.
@return An immutable version of {@code vector}. | [
"Returns",
"an",
"immutable",
"view",
"of",
"the",
"given",
"{",
"@code",
"IntegerVector",
"}",
"."
] | a608102737dfd3d59038a9ead33fe60356bc6029 | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/vector/Vectors.java#L201-L206 | train | Creates an immutable version of the given integer vector. | Create a Java method that does the following: "Creates an immutable version of the given integer vector.". | Of course, here is the Java code you requested:
```java
public static IntegerVector immutable(IntegerVector vector) {
if (vector == null)
throw new NullPointerException("Cannot create an immutable " +
"null vector");
return new IntegerVectorView(ve... | |
fabric8io/fabric8-forge | addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCommandsHelper.java | CamelCommandsHelper.loadCamelComponentDetails | public static Result loadCamelComponentDetails(CamelCatalog camelCatalog, String camelComponentName, CamelComponentDetails details) {
String json = camelCatalog.componentJSonSchema(camelComponentName);
if (json == null) {
return Results.fail("Could not find catalog entry for component name: ... | java | public static Result loadCamelComponentDetails(CamelCatalog camelCatalog, String camelComponentName, CamelComponentDetails details) {
String json = camelCatalog.componentJSonSchema(camelComponentName);
if (json == null) {
return Results.fail("Could not find catalog entry for component name: ... | [
"public",
"static",
"Result",
"loadCamelComponentDetails",
"(",
"CamelCatalog",
"camelCatalog",
",",
"String",
"camelComponentName",
",",
"CamelComponentDetails",
"details",
")",
"{",
"String",
"json",
"=",
"camelCatalog",
".",
"componentJSonSchema",
"(",
"camelComponentN... | Populates the details for the given component, returning a Result if it fails. | [
"Populates",
"the",
"details",
"for",
"the",
"given",
"component",
"returning",
"a",
"Result",
"if",
"it",
"fails",
"."
] | a59871bae4d5c5d3ece10f1e8758e73663087f19 | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCommandsHelper.java#L125-L154 | train | Load CamelComponentDetails from the given CamelCatalog. | Create a Java method that does the following: "Load CamelComponentDetails from the given CamelCatalog.". | Of course, here is the Java code you requested:
```java
public static Result loadCamelComponentDetails(CamelCatalog camelCatalog, String camelComponentName, CamelComponentDetails details) {
String json = camelCatalog.componentJSonSchema(camelComponentName);
if (json == null) {
return Result... | |
Alluxio/alluxio | core/transport/src/main/java/alluxio/grpc/FreePRequest.java | FreePRequest.getOptions | public alluxio.grpc.FreePOptions getOptions() {
return options_ == null ? alluxio.grpc.FreePOptions.getDefaultInstance() : options_;
} | java | public alluxio.grpc.FreePOptions getOptions() {
return options_ == null ? alluxio.grpc.FreePOptions.getDefaultInstance() : options_;
} | [
"public",
"alluxio",
".",
"grpc",
".",
"FreePOptions",
"getOptions",
"(",
")",
"{",
"return",
"options_",
"==",
"null",
"?",
"alluxio",
".",
"grpc",
".",
"FreePOptions",
".",
"getDefaultInstance",
"(",
")",
":",
"options_",
";",
"}"
] | <code>optional .alluxio.grpc.file.FreePOptions options = 2;</code> | [
"<code",
">",
"optional",
".",
"alluxio",
".",
"grpc",
".",
"file",
".",
"FreePOptions",
"options",
"=",
"2",
";",
"<",
"/",
"code",
">"
] | af38cf3ab44613355b18217a3a4d961f8fec3a10 | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/transport/src/main/java/alluxio/grpc/FreePRequest.java#L162-L164 | train | Gets the options. | Create a Java method that does the following: "Gets the options.". | Of course, here is the Java code you requested:
```java
public alluxio.grpc.FreePOptions getOptions() {
return options_ == null ? alluxio.grpc.FreePOptions.getDefaultInstance() : options_;
}
```
Hope this helps! | |
RestComm/jss7 | map/load/src/main/java/org/restcomm/protocols/ss7/map/load/Server.java | Server.onProcessUnstructuredSSRequest | @Override
public void onProcessUnstructuredSSRequest(ProcessUnstructuredSSRequest procUnstrReqInd) {
// NetworkIdState networkIdState = this.mapStack.getMAPProvider().getNetworkIdState(0);
// if (!(networkIdState == null || networkIdState.isAvailavle() && networkIdState.getCongLevel() == 0)) {
// ... | java | @Override
public void onProcessUnstructuredSSRequest(ProcessUnstructuredSSRequest procUnstrReqInd) {
// NetworkIdState networkIdState = this.mapStack.getMAPProvider().getNetworkIdState(0);
// if (!(networkIdState == null || networkIdState.isAvailavle() && networkIdState.getCongLevel() == 0)) {
// ... | [
"@",
"Override",
"public",
"void",
"onProcessUnstructuredSSRequest",
"(",
"ProcessUnstructuredSSRequest",
"procUnstrReqInd",
")",
"{",
"// NetworkIdState networkIdState = this.mapStack.getMAPProvider().getNetworkIdState(0);",
"// if (!(networkIdState == null || networkIdState.isA... | /*
(non-Javadoc)
@see org.restcomm.protocols.ss7.map.api.service.supplementary. MAPServiceSupplementaryListener
#onProcessUnstructuredSSRequestIndication(org .mobicents.protocols.ss7.map.
api.service.supplementary.ProcessUnstructuredSSRequestIndication) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 402b4b3984e581c581e309cb5f6a858fde6dbc33 | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/map/load/src/main/java/org/restcomm/protocols/ss7/map/load/Server.java#L373-L409 | train | This method is called when an UnstructuredSSRequest is received from the server. | Create a Java method that does the following: "This method is called when an UnstructuredSSRequest is received from the server.". | Of course, here is the Java code you requested:
```java
@Override
public void onProcessUnstructuredSSRequest(ProcessUnstructuredSSRequest procUnstrReqInd) {
// NetworkIdState networkIdState = this.mapStack.getMAPProvider().getNetworkIdState(0);
// if (!(networkIdState == null || networkIdState.isAvai... | |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.copyFromUnsafe | public final void copyFromUnsafe(int offset, Object source, int sourcePointer, int numBytes) {
final long thisPointer = this.address + offset;
if (thisPointer + numBytes > addressLimit) {
throw new IndexOutOfBoundsException(
String.format("offset=%d, numBytes=%d, address=%d",
offset, numBytes, this.a... | java | public final void copyFromUnsafe(int offset, Object source, int sourcePointer, int numBytes) {
final long thisPointer = this.address + offset;
if (thisPointer + numBytes > addressLimit) {
throw new IndexOutOfBoundsException(
String.format("offset=%d, numBytes=%d, address=%d",
offset, numBytes, this.a... | [
"public",
"final",
"void",
"copyFromUnsafe",
"(",
"int",
"offset",
",",
"Object",
"source",
",",
"int",
"sourcePointer",
",",
"int",
"numBytes",
")",
"{",
"final",
"long",
"thisPointer",
"=",
"this",
".",
"address",
"+",
"offset",
";",
"if",
"(",
"thisPoin... | Bulk copy method. Copies {@code numBytes} bytes from source unsafe object and pointer.
NOTE: This is a unsafe method, no check here, please be carefully.
@param offset The position where the bytes are started to be write in this memory segment.
@param source The unsafe memory to copy the bytes from.
@param sourcePoint... | [
"Bulk",
"copy",
"method",
".",
"Copies",
"{",
"@code",
"numBytes",
"}",
"bytes",
"from",
"source",
"unsafe",
"object",
"and",
"pointer",
".",
"NOTE",
":",
"This",
"is",
"a",
"unsafe",
"method",
"no",
"check",
"here",
"please",
"be",
"carefully",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L1307-L1315 | train | Copies the contents of the given object from the given offset to this object s memory. | Create a Java method that does the following: "Copies the contents of the given object from the given offset to this object s memory.". | Of course, here is the Java code you requested:
```java
public final void copyFromUnsafe(int offset, Object source, int sourcePointer, int numBytes) {
final long thisPointer = this.address + offset;
if (thisPointer + numBytes > addressLimit) {
throw new IndexOutOfBoundsException(
String.format("offset=%d, ... | |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java | CPDefinitionPersistenceImpl.fetchByG_S_First | @Override
public CPDefinition fetchByG_S_First(long groupId, int status,
OrderByComparator<CPDefinition> orderByComparator) {
List<CPDefinition> list = findByG_S(groupId, status, 0, 1,
orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} | java | @Override
public CPDefinition fetchByG_S_First(long groupId, int status,
OrderByComparator<CPDefinition> orderByComparator) {
List<CPDefinition> list = findByG_S(groupId, status, 0, 1,
orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} | [
"@",
"Override",
"public",
"CPDefinition",
"fetchByG_S_First",
"(",
"long",
"groupId",
",",
"int",
"status",
",",
"OrderByComparator",
"<",
"CPDefinition",
">",
"orderByComparator",
")",
"{",
"List",
"<",
"CPDefinition",
">",
"list",
"=",
"findByG_S",
"(",
"grou... | Returns the first cp definition in the ordered set where groupId = ? and status = ?.
@param groupId the group ID
@param status the status
@param orderByComparator the comparator to order the set by (optionally <code>null</code>)
@return the first matching cp definition, or <code>null</code> if a matching cp de... | [
"Returns",
"the",
"first",
"cp",
"definition",
"in",
"the",
"ordered",
"set",
"where",
"groupId",
"=",
"?",
";",
"and",
"status",
"=",
"?",
";",
"."
] | 9e54362d7f59531fc684016ba49ee7cdc3a2f22b | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L3249-L3260 | train | Returns the first cp definition in the ordered set where groupId = ? ; and status = ? ;. | Create a Java method that does the following: "Returns the first cp definition in the ordered set where groupId = ? ; and status = ? ;.". | Of course, here is the Java code you requested:
```java
@Override
public CPDefinition fetchByG_S_First(long groupId, int status,
OrderByComparator<CPDefinition> orderByComparator) {
List<CPDefinition> list = findByG_S(groupId, status, 0, 1,
orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
... | |
CenturyLinkCloud/clc-java-sdk | sdk/src/main/java/com/centurylink/cloud/sdk/policy/services/dsl/domain/autoscale/filter/AutoscalePolicyFilter.java | AutoscalePolicyFilter.where | public AutoscalePolicyFilter where(Predicate<AutoscalePolicyMetadata> predicate) {
checkNotNull(predicate, "Predicate must be not a null");
this.predicate = this.predicate.and(predicate);
return this;
} | java | public AutoscalePolicyFilter where(Predicate<AutoscalePolicyMetadata> predicate) {
checkNotNull(predicate, "Predicate must be not a null");
this.predicate = this.predicate.and(predicate);
return this;
} | [
"public",
"AutoscalePolicyFilter",
"where",
"(",
"Predicate",
"<",
"AutoscalePolicyMetadata",
">",
"predicate",
")",
"{",
"checkNotNull",
"(",
"predicate",
",",
"\"Predicate must be not a null\"",
")",
";",
"this",
".",
"predicate",
"=",
"this",
".",
"predicate",
".... | Method allow to specify custom template filtering predicate
@param predicate is not null filtering expression
@return {@link AutoscalePolicyFilter} | [
"Method",
"allow",
"to",
"specify",
"custom",
"template",
"filtering",
"predicate"
] | c026322f077dea71b1acf9f2d665253d79d9bf85 | https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/policy/services/dsl/domain/autoscale/filter/AutoscalePolicyFilter.java#L67-L73 | train | Method allow to filter by autoscale policy metadata | Create a Java method that does the following: "Method allow to filter by autoscale policy metadata". | Of course, here is the Java code you requested:
```java
public AutoscalePolicyFilter where(Predicate<AutoscalePolicyMetadata> predicate) {
checkNotNull(predicate, "Predicate must be not a null");
this.predicate = this.predicate.and(predicate);
return this;
}
```
Hope this helps! | |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/internal/LettuceLists.java | LettuceLists.newList | public static <T> List<T> newList(Iterator<? extends T> elements) {
LettuceAssert.notNull(elements, "Iterator must not be null");
List<T> objects = new ArrayList<>();
while (elements.hasNext()) {
objects.add(elements.next());
}
return objects;
} | java | public static <T> List<T> newList(Iterator<? extends T> elements) {
LettuceAssert.notNull(elements, "Iterator must not be null");
List<T> objects = new ArrayList<>();
while (elements.hasNext()) {
objects.add(elements.next());
}
return objects;
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"newList",
"(",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"elements",
")",
"{",
"LettuceAssert",
".",
"notNull",
"(",
"elements",
",",
"\"Iterator must not be null\"",
")",
";",
"List",
"<",
"T",... | Creates a new {@link ArrayList} containing all elements from {@code elements}.
@param elements the elements that the list should contain, must not be {@literal null}.
@param <T> the element type
@return a new {@link ArrayList} containing all elements from {@code elements}. | [
"Creates",
"a",
"new",
"{",
"@link",
"ArrayList",
"}",
"containing",
"all",
"elements",
"from",
"{",
"@code",
"elements",
"}",
"."
] | b6de74e384dea112e3656684ca3f50cdfd6c8e0d | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/internal/LettuceLists.java#L78-L87 | train | Create a new list of all the elements in the iterator. | Create a Java method that does the following: "Create a new list of all the elements in the iterator.". | Of course, here is the Java code you requested:
```java
public static <T> List<T> newList(Iterator<? extends T> elements) {
LettuceAssert.notNull(elements, "Iterator must not be null");
List<T> objects = new ArrayList<>();
while (elements.hasNext()) {
objects.add(elements.next());
... | |
heinrichreimer/material-drawer | library/src/main/java/com/heinrichreimersoftware/materialdrawer/DrawerView.java | DrawerView.selectItemById | public DrawerView selectItemById(long id) {
mAdapterFixed.clearSelection();
int count = mAdapter.getCount();
for (int i = 0; i < count; i++) {
if (mAdapter.getItem(i).getId() == id) {
mAdapter.select(i);
return this;
}
}
re... | java | public DrawerView selectItemById(long id) {
mAdapterFixed.clearSelection();
int count = mAdapter.getCount();
for (int i = 0; i < count; i++) {
if (mAdapter.getItem(i).getId() == id) {
mAdapter.select(i);
return this;
}
}
re... | [
"public",
"DrawerView",
"selectItemById",
"(",
"long",
"id",
")",
"{",
"mAdapterFixed",
".",
"clearSelection",
"(",
")",
";",
"int",
"count",
"=",
"mAdapter",
".",
"getCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
"... | Selects an item from the drawer view
@param id The item ID | [
"Selects",
"an",
"item",
"from",
"the",
"drawer",
"view"
] | 7c2406812d73f710ef8bb73d4a0f4bbef3b275ce | https://github.com/heinrichreimer/material-drawer/blob/7c2406812d73f710ef8bb73d4a0f4bbef3b275ce/library/src/main/java/com/heinrichreimersoftware/materialdrawer/DrawerView.java#L1297-L1308 | train | Select a single item from the drawer view | Create a Java method that does the following: "Select a single item from the drawer view". | Of course, here is the Java code you requested:
```java
public DrawerView selectItemById(long id) {
mAdapterFixed.clearSelection();
int count = mAdapter.getCount();
for (int i = 0; i < count; i++) {
if (mAdapter.getItem(i).getId() == id) {
mAdapter.select(i);
... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ClassUtils.java | ClassUtils.simpleClassForName | public static Class simpleClassForName(String type, boolean logException)
{
Class returnClass = null;
try
{
returnClass = classForName(type);
}
catch (ClassNotFoundException e)
{
if (logException)
{
log.log(Level.SEV... | java | public static Class simpleClassForName(String type, boolean logException)
{
Class returnClass = null;
try
{
returnClass = classForName(type);
}
catch (ClassNotFoundException e)
{
if (logException)
{
log.log(Level.SEV... | [
"public",
"static",
"Class",
"simpleClassForName",
"(",
"String",
"type",
",",
"boolean",
"logException",
")",
"{",
"Class",
"returnClass",
"=",
"null",
";",
"try",
"{",
"returnClass",
"=",
"classForName",
"(",
"type",
")",
";",
"}",
"catch",
"(",
"ClassNotF... | Same as {link {@link #simpleClassForName(String)}, but will only
log the exception and rethrow a RunTimeException if logException is true.
@param type
@param logException - true to log/throw FacesException, false to avoid logging/throwing FacesException
@return the corresponding Class
@throws FacesException if class n... | [
"Same",
"as",
"{",
"link",
"{",
"@link",
"#simpleClassForName",
"(",
"String",
")",
"}",
"but",
"will",
"only",
"log",
"the",
"exception",
"and",
"rethrow",
"a",
"RunTimeException",
"if",
"logException",
"is",
"true",
"."
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ClassUtils.java#L227-L243 | train | Get a Class object for a simple class name. | Create a Java method that does the following: "Get a Class object for a simple class name.". | Of course, here is the Java code you requested:
```java
public static Class simpleClassForName(String type, boolean logException)
{
Class returnClass = null;
try
{
returnClass = classForName(type);
}
catch (ClassNotFoundException e)
{
if (logE... | |
pravega/pravega | common/src/main/java/io/pravega/common/util/DelimitedStringParser.java | DelimitedStringParser.extractString | public DelimitedStringParser extractString(String key, Consumer<String> consumer) {
this.extractors.put(key, new Extractor<>(consumer, s -> s));
return this;
} | java | public DelimitedStringParser extractString(String key, Consumer<String> consumer) {
this.extractors.put(key, new Extractor<>(consumer, s -> s));
return this;
} | [
"public",
"DelimitedStringParser",
"extractString",
"(",
"String",
"key",
",",
"Consumer",
"<",
"String",
">",
"consumer",
")",
"{",
"this",
".",
"extractors",
".",
"put",
"(",
"key",
",",
"new",
"Extractor",
"<>",
"(",
"consumer",
",",
"s",
"->",
"s",
"... | Associates the given consumer with the given key. This consumer will be invoked every time a Key-Value pair with
the given key is encountered (argument is the Value of the pair). Note that this may be invoked multiple times or
not at all, based on the given input.
@param key The key for which to invoke the consum... | [
"Associates",
"the",
"given",
"consumer",
"with",
"the",
"given",
"key",
".",
"This",
"consumer",
"will",
"be",
"invoked",
"every",
"time",
"a",
"Key",
"-",
"Value",
"pair",
"with",
"the",
"given",
"key",
"is",
"encountered",
"(",
"argument",
"is",
"the",
... | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/DelimitedStringParser.java#L115-L118 | train | Extract a string from the input stream. | Create a Java method that does the following: "Extract a string from the input stream.". | Of course, here is the Java code you requested:
```java
public DelimitedStringParser extractString(String key, Consumer<String> consumer) {
this.extractors.put(key, new Extractor<>(consumer, s -> s));
return this;
}
```
Hope this helps! | |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/query/HiveValidationQueryGenerator.java | HiveValidationQueryGenerator.generateDataValidationQuery | public static String generateDataValidationQuery(String sourceTable, String sourceDb, Table targetTable,
Optional<Partition> optionalPartition, boolean isNestedORC) {
StringBuilder sb = new StringBuilder();
// Query head
sb.append("SELECT count(*) FROM `")
.append(sourceDb).append("`.`").app... | java | public static String generateDataValidationQuery(String sourceTable, String sourceDb, Table targetTable,
Optional<Partition> optionalPartition, boolean isNestedORC) {
StringBuilder sb = new StringBuilder();
// Query head
sb.append("SELECT count(*) FROM `")
.append(sourceDb).append("`.`").app... | [
"public",
"static",
"String",
"generateDataValidationQuery",
"(",
"String",
"sourceTable",
",",
"String",
"sourceDb",
",",
"Table",
"targetTable",
",",
"Optional",
"<",
"Partition",
">",
"optionalPartition",
",",
"boolean",
"isNestedORC",
")",
"{",
"StringBuilder",
... | *
Generates Hive SQL that can be used to validate the quality between two {@link Table}s or optionally
{@link Partition}. The query returned is a basic join query that returns the number of records matched
between the two {@link Table}s.
The responsibility of actually comparing this value with the expected module shoul... | [
"*",
"Generates",
"Hive",
"SQL",
"that",
"can",
"be",
"used",
"to",
"validate",
"the",
"quality",
"between",
"two",
"{",
"@link",
"Table",
"}",
"s",
"or",
"optionally",
"{",
"@link",
"Partition",
"}",
".",
"The",
"query",
"returned",
"is",
"a",
"basic",
... | f029b4c0fea0fe4aa62f36dda2512344ff708bae | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/query/HiveValidationQueryGenerator.java#L109-L176 | train | Generate a data validation query for the given source table target table | Create a Java method that does the following: "Generate a data validation query for the given source table target table". | Of course, here is the Java code you requested:
```java
public static String generateDataValidationQuery(String sourceTable, String sourceDb, Table targetTable,
Optional<Partition> optionalPartition, boolean isNestedORC) {
StringBuilder sb = new StringBuilder();
// Query head
sb.append("SELECT coun... | |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/core/Util.java | Util.getStyle | public static int getStyle(String style, String errCode)
throws JspException {
int ret = DateFormat.DEFAULT;
if (style != null) {
if (DEFAULT.equalsIgnoreCase(style)) {
ret = DateFormat.DEFAULT;
} else if (SHORT.equalsIgnoreCase(style)) {
... | java | public static int getStyle(String style, String errCode)
throws JspException {
int ret = DateFormat.DEFAULT;
if (style != null) {
if (DEFAULT.equalsIgnoreCase(style)) {
ret = DateFormat.DEFAULT;
} else if (SHORT.equalsIgnoreCase(style)) {
... | [
"public",
"static",
"int",
"getStyle",
"(",
"String",
"style",
",",
"String",
"errCode",
")",
"throws",
"JspException",
"{",
"int",
"ret",
"=",
"DateFormat",
".",
"DEFAULT",
";",
"if",
"(",
"style",
"!=",
"null",
")",
"{",
"if",
"(",
"DEFAULT",
".",
"e... | /*
Converts the given string description of a formatting style for
dates and times to the corresponding java.util.DateFormat constant.
@param style String description of formatting style for dates and times
@param errCode Error code to throw if given style is invalid
@return java.util.DateFormat constant correspondin... | [
"/",
"*",
"Converts",
"the",
"given",
"string",
"description",
"of",
"a",
"formatting",
"style",
"for",
"dates",
"and",
"times",
"to",
"the",
"corresponding",
"java",
".",
"util",
".",
"DateFormat",
"constant",
"."
] | 4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/core/Util.java#L84-L105 | train | Get the DateFormat style | Create a Java method that does the following: "Get the DateFormat style". | Of course, here is the Java code you requested:
```java
public static int getStyle(String style, String errCode)
throws JspException {
int ret = DateFormat.DEFAULT;
if (style != null) {
if (DEFAULT.equalsIgnoreCase(style)) {
ret = DateFormat.DEFAULT;
... | |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/SystemObserver.java | SystemObserver.getWifiConnected | @SuppressWarnings("MissingPermission")
static boolean getWifiConnected(Context context) {
if (context != null && PackageManager.PERMISSION_GRANTED == context.checkCallingOrSelfPermission(Manifest.permission.ACCESS_NETWORK_STATE)) {
ConnectivityManager connManager = (ConnectivityManager) context.... | java | @SuppressWarnings("MissingPermission")
static boolean getWifiConnected(Context context) {
if (context != null && PackageManager.PERMISSION_GRANTED == context.checkCallingOrSelfPermission(Manifest.permission.ACCESS_NETWORK_STATE)) {
ConnectivityManager connManager = (ConnectivityManager) context.... | [
"@",
"SuppressWarnings",
"(",
"\"MissingPermission\"",
")",
"static",
"boolean",
"getWifiConnected",
"(",
"Context",
"context",
")",
"{",
"if",
"(",
"context",
"!=",
"null",
"&&",
"PackageManager",
".",
"PERMISSION_GRANTED",
"==",
"context",
".",
"checkCallingOrSelf... | <p>Use this method to query the system state to determine whether a WiFi connection is
available for use by applications installed on the device.</p>
This applies only to WiFi connections, and does not indicate whether there is
a viable Internet connection available; if connected to an offline WiFi router for instance,... | [
"<p",
">",
"Use",
"this",
"method",
"to",
"query",
"the",
"system",
"state",
"to",
"determine",
"whether",
"a",
"WiFi",
"connection",
"is",
"available",
"for",
"use",
"by",
"applications",
"installed",
"on",
"the",
"device",
".",
"<",
"/",
"p",
">",
"Thi... | e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848 | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/SystemObserver.java#L287-L298 | train | Returns true if the WiFi instance is connected to the system. | Create a Java method that does the following: "Returns true if the WiFi instance is connected to the system.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("MissingPermission")
static boolean getWifiConnected(Context context) {
if (context != null && PackageManager.PERMISSION_GRANTED == context.checkCallingOrSelfPermission(Manifest.permission.ACCESS_NETWORK_STATE)) {
Connect... | |
wildfly/wildfly | ee/src/main/java/org/jboss/as/ee/component/ComponentConfiguration.java | ComponentConfiguration.setComponentCreateServiceFactory | public void setComponentCreateServiceFactory(final ComponentCreateServiceFactory componentCreateServiceFactory) {
if (componentCreateServiceFactory == null) {
throw EeLogger.ROOT_LOGGER.nullVar("componentCreateServiceFactory", "component", getComponentName());
}
this.componentCreateS... | java | public void setComponentCreateServiceFactory(final ComponentCreateServiceFactory componentCreateServiceFactory) {
if (componentCreateServiceFactory == null) {
throw EeLogger.ROOT_LOGGER.nullVar("componentCreateServiceFactory", "component", getComponentName());
}
this.componentCreateS... | [
"public",
"void",
"setComponentCreateServiceFactory",
"(",
"final",
"ComponentCreateServiceFactory",
"componentCreateServiceFactory",
")",
"{",
"if",
"(",
"componentCreateServiceFactory",
"==",
"null",
")",
"{",
"throw",
"EeLogger",
".",
"ROOT_LOGGER",
".",
"nullVar",
"("... | Set the component create service factory for this component.
@param componentCreateServiceFactory the component create service factory | [
"Set",
"the",
"component",
"create",
"service",
"factory",
"for",
"this",
"component",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ee/src/main/java/org/jboss/as/ee/component/ComponentConfiguration.java#L526-L531 | test | Sets the component create service factory. | Create a Java method that does the following: "Sets the component create service factory.". | Of course, here is the Java code you requested:
```java
public void setComponentCreateServiceFactory(final ComponentCreateServiceFactory componentCreateServiceFactory) {
if (componentCreateServiceFactory == null) {
throw EeLogger.ROOT_LOGGER.nullVar("componentCreateServiceFactory", "component", get... | |
eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.annotationToLink | private Link annotationToLink(Siren4JLink linkAnno, EntityContext context) {
LinkBuilder builder = LinkBuilder.newInstance().setRelationship(linkAnno.rel()).setHref(linkAnno.href());
if (StringUtils.isNotBlank(linkAnno.title())) {
builder.setTitle(linkAnno.title());
}
if... | java | private Link annotationToLink(Siren4JLink linkAnno, EntityContext context) {
LinkBuilder builder = LinkBuilder.newInstance().setRelationship(linkAnno.rel()).setHref(linkAnno.href());
if (StringUtils.isNotBlank(linkAnno.title())) {
builder.setTitle(linkAnno.title());
}
if... | [
"private",
"Link",
"annotationToLink",
"(",
"Siren4JLink",
"linkAnno",
",",
"EntityContext",
"context",
")",
"{",
"LinkBuilder",
"builder",
"=",
"LinkBuilder",
".",
"newInstance",
"(",
")",
".",
"setRelationship",
"(",
"linkAnno",
".",
"rel",
"(",
")",
")",
".... | Convert a link annotation to an actual link. The href will not be resolved in the instantiated link, this will need
to be post processed.
@param linkAnno assumed not <code>null</code>.
@return new link, never <code>null</code>. | [
"Convert",
"a",
"link",
"annotation",
"to",
"an",
"actual",
"link",
".",
"The",
"href",
"will",
"not",
"be",
"resolved",
"in",
"the",
"instantiated",
"link",
"this",
"will",
"need",
"to",
"be",
"post",
"processed",
"."
] | f12e3185076ad920352ec4f6eb2a071a3683505f | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L760-L769 | train | Converts a Siren4JLink annotation to a Link object. | Create a Java method that does the following: "Converts a Siren4JLink annotation to a Link object.". | Of course, here is the Java code you requested:
```java
private Link annotationToLink(Siren4JLink linkAnno, EntityContext context) {
LinkBuilder builder = LinkBuilder.newInstance().setRelationship(linkAnno.rel()).setHref(linkAnno.href());
if (StringUtils.isNotBlank(linkAnno.title())) {
b... | |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/style/StyleUtilities.java | StyleUtilities.styleToString | public static String styleToString( Style style ) throws Exception {
StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
UserLayer layer = sf.createUserLayer();
layer.setLayerFeatureConstraints(new FeatureTypeConstraint[]{null});
sld.addStyledLayer(layer);
layer.addUser... | java | public static String styleToString( Style style ) throws Exception {
StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
UserLayer layer = sf.createUserLayer();
layer.setLayerFeatureConstraints(new FeatureTypeConstraint[]{null});
sld.addStyledLayer(layer);
layer.addUser... | [
"public",
"static",
"String",
"styleToString",
"(",
"Style",
"style",
")",
"throws",
"Exception",
"{",
"StyledLayerDescriptor",
"sld",
"=",
"sf",
".",
"createStyledLayerDescriptor",
"(",
")",
";",
"UserLayer",
"layer",
"=",
"sf",
".",
"createUserLayer",
"(",
")"... | Converts a style to its string representation to be written to file.
@param style the style to convert.
@return the style string.
@throws Exception | [
"Converts",
"a",
"style",
"to",
"its",
"string",
"representation",
"to",
"be",
"written",
"to",
"file",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/style/StyleUtilities.java#L898-L909 | train | Converts a style object to an XML string. | Create a Java method that does the following: "Converts a style object to an XML string.". | Of course, here is the Java code you requested:
```java
public static String styleToString( Style style ) throws Exception {
StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
UserLayer layer = sf.createUserLayer();
layer.setLayerFeatureConstraints(new FeatureTypeConstraint[]{null});... | |
jhy/jsoup | src/main/java/org/jsoup/nodes/Node.java | Node.siblingNodes | public List<Node> siblingNodes() {
if (parentNode == null)
return Collections.emptyList();
List<Node> nodes = parentNode.ensureChildNodes();
List<Node> siblings = new ArrayList<>(nodes.size() - 1);
for (Node node: nodes)
if (node != this)
siblings... | java | public List<Node> siblingNodes() {
if (parentNode == null)
return Collections.emptyList();
List<Node> nodes = parentNode.ensureChildNodes();
List<Node> siblings = new ArrayList<>(nodes.size() - 1);
for (Node node: nodes)
if (node != this)
siblings... | [
"public",
"List",
"<",
"Node",
">",
"siblingNodes",
"(",
")",
"{",
"if",
"(",
"parentNode",
"==",
"null",
")",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"List",
"<",
"Node",
">",
"nodes",
"=",
"parentNode",
".",
"ensureChildNodes",
"(",
... | Retrieves this node's sibling nodes. Similar to {@link #childNodes() node.parent.childNodes()}, but does not
include this node (a node is not a sibling of itself).
@return node siblings. If the node has no parent, returns an empty list. | [
"Retrieves",
"this",
"node",
"s",
"sibling",
"nodes",
".",
"Similar",
"to",
"{"
] | 68ff8cbe7ad847059737a09c567a501a7f1d251f | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Node.java#L484-L494 | train | Gets the siblings nodes of this node. | Create a Java method that does the following: "Gets the siblings nodes of this node.". | Of course, here is the Java code you requested:
```java
public List<Node> siblingNodes() {
if (parentNode == null)
return Collections.emptyList();
List<Node> nodes = parentNode.ensureChildNodes();
List<Node> siblings = new ArrayList<>(nodes.size() - 1);
for (Node node: node... | |
aws/aws-sdk-java | aws-java-sdk-rds/src/main/java/com/amazonaws/services/rds/model/DescribeDBClusterEndpointsResult.java | DescribeDBClusterEndpointsResult.setDBClusterEndpoints | public void setDBClusterEndpoints(java.util.Collection<DBClusterEndpoint> dBClusterEndpoints) {
if (dBClusterEndpoints == null) {
this.dBClusterEndpoints = null;
return;
}
this.dBClusterEndpoints = new com.amazonaws.internal.SdkInternalList<DBClusterEndpoint>(dBClusterEn... | java | public void setDBClusterEndpoints(java.util.Collection<DBClusterEndpoint> dBClusterEndpoints) {
if (dBClusterEndpoints == null) {
this.dBClusterEndpoints = null;
return;
}
this.dBClusterEndpoints = new com.amazonaws.internal.SdkInternalList<DBClusterEndpoint>(dBClusterEn... | [
"public",
"void",
"setDBClusterEndpoints",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"DBClusterEndpoint",
">",
"dBClusterEndpoints",
")",
"{",
"if",
"(",
"dBClusterEndpoints",
"==",
"null",
")",
"{",
"this",
".",
"dBClusterEndpoints",
"=",
"null",
";",
... | <p>
Contains the details of the endpoints associated with the cluster and matching any filter conditions.
</p>
@param dBClusterEndpoints
Contains the details of the endpoints associated with the cluster and matching any filter conditions. | [
"<p",
">",
"Contains",
"the",
"details",
"of",
"the",
"endpoints",
"associated",
"with",
"the",
"cluster",
"and",
"matching",
"any",
"filter",
"conditions",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-rds/src/main/java/com/amazonaws/services/rds/model/DescribeDBClusterEndpointsResult.java#L117-L124 | train | Sets the value of the dBClusterEndpoints property. | Create a Java method that does the following: "Sets the value of the dBClusterEndpoints property.". | Of course, here is the Java code you requested:
```java
public void setDBClusterEndpoints(java.util.Collection<DBClusterEndpoint> dBClusterEndpoints) {
if (dBClusterEndpoints == null) {
this.dBClusterEndpoints = null;
return;
}
this.dBClusterEndpoints = new com.amazonaw... | |
shevek/jcpp | src/main/java/org/anarres/cpp/Macro.java | Macro.getText | public String getText() {
StringBuilder buf = new StringBuilder();
boolean paste = false;
for (Token tok : tokens) {
if (tok.getType() == Token.M_PASTE) {
assert paste == false : "Two sequential pastes.";
paste = true;
continue;
... | java | public String getText() {
StringBuilder buf = new StringBuilder();
boolean paste = false;
for (Token tok : tokens) {
if (tok.getType() == Token.M_PASTE) {
assert paste == false : "Two sequential pastes.";
paste = true;
continue;
... | [
"public",
"String",
"getText",
"(",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"paste",
"=",
"false",
";",
"for",
"(",
"Token",
"tok",
":",
"tokens",
")",
"{",
"if",
"(",
"tok",
".",
"getType",
"(",
")",
... | /* Paste tokens are inserted before the first of the two pasted
tokens, so it's a kind of bytecode notation. This method
swaps them around again. We know that there will never be two
sequential paste tokens, so a boolean is sufficient. | [
"/",
"*",
"Paste",
"tokens",
"are",
"inserted",
"before",
"the",
"first",
"of",
"the",
"two",
"pasted",
"tokens",
"so",
"it",
"s",
"a",
"kind",
"of",
"bytecode",
"notation",
".",
"This",
"method",
"swaps",
"them",
"around",
"again",
".",
"We",
"know",
... | 71462c702097cabf8304202c740f780285fc35a8 | https://github.com/shevek/jcpp/blob/71462c702097cabf8304202c740f780285fc35a8/src/main/java/org/anarres/cpp/Macro.java#L146-L164 | train | Get the text of the token set. | Create a Java method that does the following: "Get the text of the token set.". | Of course, here is the Java code you requested:
```java
public String getText() {
StringBuilder buf = new StringBuilder();
boolean paste = false;
for (Token tok : tokens) {
if (tok.getType() == Token.M_PASTE) {
assert paste == false : "Two sequential pastes.";
... | |
nutzam/nutzboot | nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-tio/src/main/java/io/nutz/demo/simple/tio/SimpleHandler.java | SimpleHandler.handler | public void handler(Packet packet, ChannelContext channelContext) throws Exception {
SimplePacket pack = (SimplePacket) packet;
byte[] body = pack.getBody();
if(body!=null){
String s = new String(body, SimplePacket.CHARSET);
System.out.println("接受到客户端消息:"+s);
... | java | public void handler(Packet packet, ChannelContext channelContext) throws Exception {
SimplePacket pack = (SimplePacket) packet;
byte[] body = pack.getBody();
if(body!=null){
String s = new String(body, SimplePacket.CHARSET);
System.out.println("接受到客户端消息:"+s);
... | [
"public",
"void",
"handler",
"(",
"Packet",
"packet",
",",
"ChannelContext",
"channelContext",
")",
"throws",
"Exception",
"{",
"SimplePacket",
"pack",
"=",
"(",
"SimplePacket",
")",
"packet",
";",
"byte",
"[",
"]",
"body",
"=",
"pack",
".",
"getBody",
"(",
... | 处理消息 | [
"处理消息"
] | fd33fd4fdce058eab594f28e4d3202f997e3c66a | https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-tio/src/main/java/io/nutz/demo/simple/tio/SimpleHandler.java#L90-L100 | train | Handle a simple packet. | Create a Java method that does the following: "Handle a simple packet.". | Of course, here is the Java code you requested:
```java
public void handler(Packet packet, ChannelContext channelContext) throws Exception {
SimplePacket pack = (SimplePacket) packet;
byte[] body = pack.getBody();
if(body!=null){
String s = new String(body, SimplePacket.CHARSET);
... | |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/ImmutableList.java | ImmutableList.subList | @Override
public ImmutableList<E> subList(int fromIndex, int toIndex) {
checkPositionIndexes(fromIndex, toIndex, size());
int length = toIndex - fromIndex;
if (length == size()) {
return this;
}
switch (length) {
case 0:
return of();
case 1:
return of(get(fromInde... | java | @Override
public ImmutableList<E> subList(int fromIndex, int toIndex) {
checkPositionIndexes(fromIndex, toIndex, size());
int length = toIndex - fromIndex;
if (length == size()) {
return this;
}
switch (length) {
case 0:
return of();
case 1:
return of(get(fromInde... | [
"@",
"Override",
"public",
"ImmutableList",
"<",
"E",
">",
"subList",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"checkPositionIndexes",
"(",
"fromIndex",
",",
"toIndex",
",",
"size",
"(",
")",
")",
";",
"int",
"length",
"=",
"toIndex",
"-... | Returns an immutable list of the elements between the specified {@code
fromIndex}, inclusive, and {@code toIndex}, exclusive. (If {@code
fromIndex} and {@code toIndex} are equal, the empty immutable list is
returned.) | [
"Returns",
"an",
"immutable",
"list",
"of",
"the",
"elements",
"between",
"the",
"specified",
"{"
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/ImmutableList.java#L360-L375 | train | Override the subList method to provide a special handling for the Sequence type 2. 0. 0 | Create a Java method that does the following: "Override the subList method to provide a special handling for the Sequence type 2. 0. 0". | Of course, here is the Java code you requested:
```java
@Override
public ImmutableList<E> subList(int fromIndex, int toIndex) {
checkPositionIndexes(fromIndex, toIndex, size());
int length = toIndex - fromIndex;
if (length == size()) {
return this;
}
switch (length) {
case 0:
... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Generate a class in Java that validates if a given number is a prime or not. The number must be between 1 and 10,000,000. The class should also provide a method that returns all prime numbers within a given range, where the range must be between 1 and 100,000. The class should be able to handle large input numbers effi... | Here is an implementation of a Java class that validates if a given number is prime or not, provides a method to return all prime numbers within a given range, and generates prime numbers within a given range using an optimized algorithm:
```java
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Li... | |||||||
pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java | BookKeeperLog.fetchLastAddConfirmed | @SneakyThrows(DurableDataLogException.class)
private long fetchLastAddConfirmed(WriteLedger writeLedger, Map<Long, Long> lastAddsConfirmed) {
long ledgerId = writeLedger.ledger.getId();
long lac = lastAddsConfirmed.getOrDefault(ledgerId, -1L);
long traceId = LoggerHelpers.traceEnterWithConte... | java | @SneakyThrows(DurableDataLogException.class)
private long fetchLastAddConfirmed(WriteLedger writeLedger, Map<Long, Long> lastAddsConfirmed) {
long ledgerId = writeLedger.ledger.getId();
long lac = lastAddsConfirmed.getOrDefault(ledgerId, -1L);
long traceId = LoggerHelpers.traceEnterWithConte... | [
"@",
"SneakyThrows",
"(",
"DurableDataLogException",
".",
"class",
")",
"private",
"long",
"fetchLastAddConfirmed",
"(",
"WriteLedger",
"writeLedger",
",",
"Map",
"<",
"Long",
",",
"Long",
">",
"lastAddsConfirmed",
")",
"{",
"long",
"ledgerId",
"=",
"writeLedger",... | Reliably gets the LastAddConfirmed for the WriteLedger
@param writeLedger The WriteLedger to query.
@param lastAddsConfirmed A Map of LedgerIds to LastAddConfirmed for each known ledger id. This is used as a cache
and will be updated if necessary.
@return The LastAddConfirmed for the WriteLedger. | [
"Reliably",
"gets",
"the",
"LastAddConfirmed",
"for",
"the",
"WriteLedger"
] | 6e24df7470669b3956a07018f52b2c6b3c2a3503 | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L523-L544 | train | Fetch the LastAddConfirmed value from the given WriteLedger. | Create a Java method that does the following: "Fetch the LastAddConfirmed value from the given WriteLedger.". | Of course, here is the Java code you requested:
```java
@SneakyThrows(DurableDataLogException.class)
private long fetchLastAddConfirmed(WriteLedger writeLedger, Map<Long, Long> lastAddsConfirmed) {
long ledgerId = writeLedger.ledger.getId();
long lac = lastAddsConfirmed.getOrDefault(ledgerId, -1L);... | |
google/guice | core/src/com/google/inject/internal/DeferredLookups.java | DeferredLookups.initialize | void initialize(Errors errors) {
injector.lookups = injector;
new LookupProcessor(errors).process(injector, lookups);
} | java | void initialize(Errors errors) {
injector.lookups = injector;
new LookupProcessor(errors).process(injector, lookups);
} | [
"void",
"initialize",
"(",
"Errors",
"errors",
")",
"{",
"injector",
".",
"lookups",
"=",
"injector",
";",
"new",
"LookupProcessor",
"(",
"errors",
")",
".",
"process",
"(",
"injector",
",",
"lookups",
")",
";",
"}"
] | Initialize the specified lookups, either immediately or when the injector is created. | [
"Initialize",
"the",
"specified",
"lookups",
"either",
"immediately",
"or",
"when",
"the",
"injector",
"is",
"created",
"."
] | a0552a16d813ead98fe73737fb001db336650251 | https://github.com/google/guice/blob/a0552a16d813ead98fe73737fb001db336650251/core/src/com/google/inject/internal/DeferredLookups.java#L44-L47 | test | Initializes the object with the given errors. | Create a Java method that does the following: "Initializes the object with the given errors.". | Of course, here is the Java code you requested:
```java
void initialize(Errors errors) {
injector.lookups = injector;
new LookupProcessor(errors).process(injector, lookups);
}
```
Hope this helps! | |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java | AbstractCacheableLockManager.onSaveItems | public void onSaveItems(ItemStateChangesLog changesLog)
{
List<PlainChangesLog> chengesLogList = new ArrayList<PlainChangesLog>();
if (changesLog instanceof TransactionChangesLog)
{
ChangesLogIterator logIterator = ((TransactionChangesLog)changesLog).getLogIterator();
while (logI... | java | public void onSaveItems(ItemStateChangesLog changesLog)
{
List<PlainChangesLog> chengesLogList = new ArrayList<PlainChangesLog>();
if (changesLog instanceof TransactionChangesLog)
{
ChangesLogIterator logIterator = ((TransactionChangesLog)changesLog).getLogIterator();
while (logI... | [
"public",
"void",
"onSaveItems",
"(",
"ItemStateChangesLog",
"changesLog",
")",
"{",
"List",
"<",
"PlainChangesLog",
">",
"chengesLogList",
"=",
"new",
"ArrayList",
"<",
"PlainChangesLog",
">",
"(",
")",
";",
"if",
"(",
"changesLog",
"instanceof",
"TransactionChan... | {@inheritDoc} | [
"{"
] | 3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2 | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/cacheable/AbstractCacheableLockManager.java#L354-L465 | train | On save items. | Create a Java method that does the following: "On save items.". | Of course, here is the Java code you requested:
```java
public void onSaveItems(ItemStateChangesLog changesLog)
{
List<PlainChangesLog> chengesLogList = new ArrayList<PlainChangesLog>();
if (changesLog instanceof TransactionChangesLog)
{
ChangesLogIterator logIterator = ((TransactionChang... | |
GistLabs/mechanize | src/main/java/com/gistlabs/mechanize/cache/inMemory/InMemoryCacheEntry.java | InMemoryCacheEntry.head | @Override
public HttpResponse head() {
BasicHttpResponse response = new BasicHttpResponse(this.response.getStatusLine());
Header[] allHeaders = this.response.getAllHeaders();
for (Header allHeader : allHeaders)
response.addHeader(allHeader);
response.setEntity(new ByteArrayEntity(new byte[]{}));
return re... | java | @Override
public HttpResponse head() {
BasicHttpResponse response = new BasicHttpResponse(this.response.getStatusLine());
Header[] allHeaders = this.response.getAllHeaders();
for (Header allHeader : allHeaders)
response.addHeader(allHeader);
response.setEntity(new ByteArrayEntity(new byte[]{}));
return re... | [
"@",
"Override",
"public",
"HttpResponse",
"head",
"(",
")",
"{",
"BasicHttpResponse",
"response",
"=",
"new",
"BasicHttpResponse",
"(",
"this",
".",
"response",
".",
"getStatusLine",
"(",
")",
")",
";",
"Header",
"[",
"]",
"allHeaders",
"=",
"this",
".",
... | /* (non-Javadoc)
@see com.gistlabs.mechanize.cache.InMemoryCacheEntry#head() | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 32ddd0774439a4c08513c05d7ac7416a3899efed | https://github.com/GistLabs/mechanize/blob/32ddd0774439a4c08513c05d7ac7416a3899efed/src/main/java/com/gistlabs/mechanize/cache/inMemory/InMemoryCacheEntry.java#L164-L172 | train | Override this method to return a response object that contains all headers. | Create a Java method that does the following: "Override this method to return a response object that contains all headers.". | Of course, here is the Java code you requested:
```java
@Override
public HttpResponse head() {
BasicHttpResponse response = new BasicHttpResponse(this.response.getStatusLine());
Header[] allHeaders = this.response.getAllHeaders();
for (Header allHeader : allHeaders)
response.addHeader(allHeader);
response.... | |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfCell.java | PdfCell.getImages | public ArrayList getImages(float top, float bottom) {
// if the bottom of the page is higher than the top of the cell: do nothing
if (getTop() < bottom) {
return new ArrayList();
}
top = Math.min(getTop(), top);
// initializations
Image image;
float h... | java | public ArrayList getImages(float top, float bottom) {
// if the bottom of the page is higher than the top of the cell: do nothing
if (getTop() < bottom) {
return new ArrayList();
}
top = Math.min(getTop(), top);
// initializations
Image image;
float h... | [
"public",
"ArrayList",
"getImages",
"(",
"float",
"top",
",",
"float",
"bottom",
")",
"{",
"// if the bottom of the page is higher than the top of the cell: do nothing",
"if",
"(",
"getTop",
"(",
")",
"<",
"bottom",
")",
"{",
"return",
"new",
"ArrayList",
"(",
")",
... | Gets the images of a cell that can be drawn between certain limits.
<P>
Remark: all the lines that can be drawn are removed from the object!
@param top the top of the part of the table that can be drawn
@param bottom the bottom of the part of the table that can be drawn
@return an <CODE>ArrayList</CODE> of <CODE>Imag... | [
"Gets",
"the",
"images",
"of",
"a",
"cell",
"that",
"can",
"be",
"drawn",
"between",
"certain",
"limits",
".",
"<P",
">",
"Remark",
":",
"all",
"the",
"lines",
"that",
"can",
"be",
"drawn",
"are",
"removed",
"from",
"the",
"object!"
] | 438fc1899367fd13dfdfa8dfdca9a3c1a7783b84 | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCell.java#L624-L647 | train | Get the images in the image table. | Create a Java method that does the following: "Get the images in the image table.". | Of course, here is the Java code you requested:
```java
public ArrayList getImages(float top, float bottom) {
// if the bottom of the page is higher than the top of the cell: do nothing
if (getTop() < bottom) {
return new ArrayList();
}
top = Math.min(getTop(), top);
... | |
naver/nbase-arc | api/java/src/main/java/com/navercorp/redis/cluster/spring/RedisClusterConnection.java | RedisClusterConnection.setNX | @Override
public Boolean setNX(byte[] key, byte[] value) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.setnx(key, value), JedisConverters.longToBoolean()));
return null;
}
return JedisConverters.toBoolean(client.setnx(key,... | java | @Override
public Boolean setNX(byte[] key, byte[] value) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.setnx(key, value), JedisConverters.longToBoolean()));
return null;
}
return JedisConverters.toBoolean(client.setnx(key,... | [
"@",
"Override",
"public",
"Boolean",
"setNX",
"(",
"byte",
"[",
"]",
"key",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"try",
"{",
"if",
"(",
"isPipelined",
"(",
")",
")",
"{",
"pipeline",
"(",
"new",
"JedisResult",
"(",
"pipeline",
".",
"setnx",
"... | /*
@see org.springframework.data.redis.connection.RedisStringCommands#setNX(byte[], byte[]) | [
"/",
"*"
] | d4ce8a258527160c09b55e34acc1542651a8bbb3 | https://github.com/naver/nbase-arc/blob/d4ce8a258527160c09b55e34acc1542651a8bbb3/api/java/src/main/java/com/navercorp/redis/cluster/spring/RedisClusterConnection.java#L674-L686 | valid | Sets a single key value pair in the cache. | Create a Java method that does the following: "Sets a single key value pair in the cache.". | Of course, here is the Java code you requested:
```java
@Override
public Boolean setNX(byte[] key, byte[] value) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.setnx(key, value), JedisConverters.longToBoolean()));
return null;
}
... | |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java | AbstractMemberWriter.modifierString | protected String modifierString(MemberDoc member) {
int ms = member.modifierSpecifier();
int no = Modifier.NATIVE | Modifier.SYNCHRONIZED;
return Modifier.toString(ms & ~no);
} | java | protected String modifierString(MemberDoc member) {
int ms = member.modifierSpecifier();
int no = Modifier.NATIVE | Modifier.SYNCHRONIZED;
return Modifier.toString(ms & ~no);
} | [
"protected",
"String",
"modifierString",
"(",
"MemberDoc",
"member",
")",
"{",
"int",
"ms",
"=",
"member",
".",
"modifierSpecifier",
"(",
")",
";",
"int",
"no",
"=",
"Modifier",
".",
"NATIVE",
"|",
"Modifier",
".",
"SYNCHRONIZED",
";",
"return",
"Modifier",
... | Return a string describing the access modifier flags.
Don't include native or synchronized.
The modifier names are returned in canonical order, as
specified by <em>The Java Language Specification</em>. | [
"Return",
"a",
"string",
"describing",
"the",
"access",
"modifier",
"flags",
".",
"Don",
"t",
"include",
"native",
"or",
"synchronized",
"."
] | a53d069bbdb2c60232ed3811c19b65e41c3e60e0 | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java#L215-L219 | train | Get the string representation of the modifier of a class member. | Create a Java method that does the following: "Get the string representation of the modifier of a class member.". | Of course, here is the Java code you requested:
```java
protected String modifierString(MemberDoc member) {
int ms = member.modifierSpecifier();
int no = Modifier.NATIVE | Modifier.SYNCHRONIZED;
return Modifier.toString(ms & ~no);
}
```
Hope this helps! | |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java | SeaGlassButtonUI.getRolloverIcon | private Icon getRolloverIcon(AbstractButton b, Icon defaultIcon) {
ButtonModel model = b.getModel();
Icon icon;
if (model.isSelected()) {
icon = getIcon(b, b.getRolloverSelectedIcon(), defaultIcon, SynthConstants.MOUSE_OVER | SynthConstants.SELECTED);
} else {
... | java | private Icon getRolloverIcon(AbstractButton b, Icon defaultIcon) {
ButtonModel model = b.getModel();
Icon icon;
if (model.isSelected()) {
icon = getIcon(b, b.getRolloverSelectedIcon(), defaultIcon, SynthConstants.MOUSE_OVER | SynthConstants.SELECTED);
} else {
... | [
"private",
"Icon",
"getRolloverIcon",
"(",
"AbstractButton",
"b",
",",
"Icon",
"defaultIcon",
")",
"{",
"ButtonModel",
"model",
"=",
"b",
".",
"getModel",
"(",
")",
";",
"Icon",
"icon",
";",
"if",
"(",
"model",
".",
"isSelected",
"(",
")",
")",
"{",
"i... | DOCUMENT ME!
@param b DOCUMENT ME!
@param defaultIcon DOCUMENT ME!
@return DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | f25ecba622923d7b29b64cb7d6068dd8005989b3 | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L479-L490 | train | Get the icon for a rollover button. | Create a Java method that does the following: "Get the icon for a rollover button.". | Of course, here is the Java code you requested:
```java
private Icon getRolloverIcon(AbstractButton b, Icon defaultIcon) {
ButtonModel model = b.getModel();
Icon icon;
if (model.isSelected()) {
icon = getIcon(b, b.getRolloverSelectedIcon(), defaultIcon, SynthConstants.MOUSE_... | |
Unidata/thredds | udunits/src/main/java/ucar/units/UnitDimension.java | UnitDimension.getQuantityDimension | public QuantityDimension
getQuantityDimension()
{
Factor[] factors = getFactors();
for (int i = factors.length; --i >= 0; )
{
Factor factor = factors[i];
factors[i] =
new Factor(
((BaseUnit)factor.getBase()).getBaseQuantity(),
factor.getExponent());
}
return new QuantityDimension(f... | java | public QuantityDimension
getQuantityDimension()
{
Factor[] factors = getFactors();
for (int i = factors.length; --i >= 0; )
{
Factor factor = factors[i];
factors[i] =
new Factor(
((BaseUnit)factor.getBase()).getBaseQuantity(),
factor.getExponent());
}
return new QuantityDimension(f... | [
"public",
"QuantityDimension",
"getQuantityDimension",
"(",
")",
"{",
"Factor",
"[",
"]",
"factors",
"=",
"getFactors",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"factors",
".",
"length",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"Factor",
"factor",
... | Returns the corresponding quantity dimension.
@return The quantity dimension corresponding to this
unit dimension. | [
"Returns",
"the",
"corresponding",
"quantity",
"dimension",
"."
] | d2d68f9eee87f345625211324d71d5dc3e162ee1 | https://github.com/Unidata/thredds/blob/d2d68f9eee87f345625211324d71d5dc3e162ee1/udunits/src/main/java/ucar/units/UnitDimension.java#L97-L110 | test | Returns a new QuantityDimension object containing the base quantity and exponent. | Create a Java method that does the following: "Returns a new QuantityDimension object containing the base quantity and exponent.". | Of course, here is the Java code you requested:
```java
public QuantityDimension
getQuantityDimension()
{
Factor[] factors = getFactors();
for (int i = factors.length; --i >= 0; )
{
Factor factor = factors[i];
factors[i] =
new Factor(
((BaseUnit)factor.getBase()).getBaseQuantity(),
... | |
jeluard/semantic-versioning | api/src/main/java/org/osjava/jardiff/PublicDiffCriteria.java | PublicDiffCriteria.differs | public boolean differs(MethodInfo oldInfo, MethodInfo newInfo) {
if (Tools.isMethodAccessChange(oldInfo.getAccess(), newInfo.getAccess()))
return true;
if (oldInfo.getExceptions() == null
|| newInfo.getExceptions() == null) {
if (oldInfo.getExceptions() != newInfo.get... | java | public boolean differs(MethodInfo oldInfo, MethodInfo newInfo) {
if (Tools.isMethodAccessChange(oldInfo.getAccess(), newInfo.getAccess()))
return true;
if (oldInfo.getExceptions() == null
|| newInfo.getExceptions() == null) {
if (oldInfo.getExceptions() != newInfo.get... | [
"public",
"boolean",
"differs",
"(",
"MethodInfo",
"oldInfo",
",",
"MethodInfo",
"newInfo",
")",
"{",
"if",
"(",
"Tools",
".",
"isMethodAccessChange",
"(",
"oldInfo",
".",
"getAccess",
"(",
")",
",",
"newInfo",
".",
"getAccess",
"(",
")",
")",
")",
"return... | Check if there is a change between two versions of a method.
Returns true if the access flags differ, or if the thrown
exceptions differ.
@param oldInfo Info about the old version of the method.
@param newInfo Info about the new version of the method.
@return True if the methods differ, false otherwise. | [
"Check",
"if",
"there",
"is",
"a",
"change",
"between",
"two",
"versions",
"of",
"a",
"method",
".",
"Returns",
"true",
"if",
"the",
"access",
"flags",
"differ",
"or",
"if",
"the",
"thrown",
"exceptions",
"differ",
"."
] | d0bfbeddca8ac4202f5225810227c72a708360a9 | https://github.com/jeluard/semantic-versioning/blob/d0bfbeddca8ac4202f5225810227c72a708360a9/api/src/main/java/org/osjava/jardiff/PublicDiffCriteria.java#L102-L118 | train | Checks if two method infos differ. | Create a Java method that does the following: "Checks if two method infos differ.". | Of course, here is the Java code you requested:
```java
public boolean differs(MethodInfo oldInfo, MethodInfo newInfo) {
if (Tools.isMethodAccessChange(oldInfo.getAccess(), newInfo.getAccess()))
return true;
if (oldInfo.getExceptions() == null
|| newInfo.getExceptions() == null)... | |
Azure/azure-sdk-for-java | common/azure-common/src/main/java/com/azure/common/implementation/SwaggerMethodParser.java | SwaggerMethodParser.contextData | public ContextData contextData(Object[] swaggerMethodArguments) {
Object firstArg = swaggerMethodArguments != null && swaggerMethodArguments.length > 0 ? swaggerMethodArguments[0] : null;
if (firstArg instanceof ContextData) {
return (ContextData) firstArg;
} else {
retur... | java | public ContextData contextData(Object[] swaggerMethodArguments) {
Object firstArg = swaggerMethodArguments != null && swaggerMethodArguments.length > 0 ? swaggerMethodArguments[0] : null;
if (firstArg instanceof ContextData) {
return (ContextData) firstArg;
} else {
retur... | [
"public",
"ContextData",
"contextData",
"(",
"Object",
"[",
"]",
"swaggerMethodArguments",
")",
"{",
"Object",
"firstArg",
"=",
"swaggerMethodArguments",
"!=",
"null",
"&&",
"swaggerMethodArguments",
".",
"length",
">",
"0",
"?",
"swaggerMethodArguments",
"[",
"0",
... | Get the {@link ContextData} passed into the proxy method.
@param swaggerMethodArguments the arguments passed to the proxy method
@return the context, or null if no context was provided | [
"Get",
"the",
"{",
"@link",
"ContextData",
"}",
"passed",
"into",
"the",
"proxy",
"method",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/SwaggerMethodParser.java#L350-L357 | train | Returns the context data for the Swagger method. | Create a Java method that does the following: "Returns the context data for the Swagger method.". | Of course, here is the Java code you requested:
```java
public ContextData contextData(Object[] swaggerMethodArguments) {
Object firstArg = swaggerMethodArguments != null && swaggerMethodArguments.length > 0 ? swaggerMethodArguments[0] : null;
if (firstArg instanceof ContextData) {
return (... | |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamselector.java | streamselector.update | public static base_response update(nitro_service client, streamselector resource) throws Exception {
streamselector updateresource = new streamselector();
updateresource.name = resource.name;
updateresource.rule = resource.rule;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, streamselector resource) throws Exception {
streamselector updateresource = new streamselector();
updateresource.name = resource.name;
updateresource.rule = resource.rule;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"streamselector",
"resource",
")",
"throws",
"Exception",
"{",
"streamselector",
"updateresource",
"=",
"new",
"streamselector",
"(",
")",
";",
"updateresource",
".",
"name",
"=",
... | Use this API to update streamselector. | [
"Use",
"this",
"API",
"to",
"update",
"streamselector",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamselector.java#L141-L146 | train | Use this API to update streamselector. | Create a Java method that does the following: "Use this API to update streamselector.". | Of course, here is the Java code you requested:
```java
public static base_response update(nitro_service client, streamselector resource) throws Exception {
streamselector updateresource = new streamselector();
updateresource.name = resource.name;
updateresource.rule = resource.rule;
return updateresource.upda... | |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java | HsqlTimer.nextTask | protected Task nextTask() {
try {
while (!this.isShutdown || Thread.interrupted()) {
long now;
long next;
long wait;
Task task;
// synchronized to ensure removeTask
// applies only to the peeked task,
... | java | protected Task nextTask() {
try {
while (!this.isShutdown || Thread.interrupted()) {
long now;
long next;
long wait;
Task task;
// synchronized to ensure removeTask
// applies only to the peeked task,
... | [
"protected",
"Task",
"nextTask",
"(",
")",
"{",
"try",
"{",
"while",
"(",
"!",
"this",
".",
"isShutdown",
"||",
"Thread",
".",
"interrupted",
"(",
")",
")",
"{",
"long",
"now",
";",
"long",
"next",
";",
"long",
"wait",
";",
"Task",
"task",
";",
"//... | Retrieves the next task to execute, or null if this timer is shutdown,
the current thread is interrupted, or there are no queued tasks.
@return the next task to execute, or null | [
"Retrieves",
"the",
"next",
"task",
"to",
"execute",
"or",
"null",
"if",
"this",
"timer",
"is",
"shutdown",
"the",
"current",
"thread",
"is",
"interrupted",
"or",
"there",
"are",
"no",
"queued",
"tasks",
"."
] | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L498-L568 | train | Returns the next task in the queue. | Create a Java method that does the following: "Returns the next task in the queue.". | Of course, here is the Java code you requested:
```java
protected Task nextTask() {
try {
while (!this.isShutdown || Thread.interrupted()) {
long now;
long next;
long wait;
Task task;
// synchronized to ensure removeT... | |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/Pair.java | Pair.of | public static <T1, T2> Pair<T1, T2> of(T1 first, T2 second) {
return new Pair<>(first, second);
} | java | public static <T1, T2> Pair<T1, T2> of(T1 first, T2 second) {
return new Pair<>(first, second);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"Pair",
"<",
"T1",
",",
"T2",
">",
"of",
"(",
"T1",
"first",
",",
"T2",
"second",
")",
"{",
"return",
"new",
"Pair",
"<>",
"(",
"first",
",",
"second",
")",
";",
"}"
] | Convenience function for creating a pair, allowing the user to omit the type parameters. | [
"Convenience",
"function",
"for",
"creating",
"a",
"pair",
"allowing",
"the",
"user",
"to",
"omit",
"the",
"type",
"parameters",
"."
] | 8a462ec52f6eaab9f8996e344f2163a72cb8aa6e | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/Pair.java#L60-L62 | train | Create a Pair of two objects. | Create a Java method that does the following: "Create a Pair of two objects.". | Of course, here is the Java code you requested:
```java
public static <T1, T2> Pair<T1, T2> of(T1 first, T2 second) {
return new Pair<>(first, second);
}
```
Hope this helps! | |
PureSolTechnologies/graphs | trees/src/main/java/com/puresoltechnologies/graphs/trees/RedBlackTree.java | RedBlackTree.moveRedRight | private RedBlackTreeNode<Key, Value> moveRedRight(RedBlackTreeNode<Key, Value> h) {
// assert (h != null);
// assert isRed(h) && !h.getRight().isRed() && !isRed(h.right.left);
flipColors(h);
if (isRed(h.getLeft().getLeft())) {
h = rotateRight(h);
flipColors(h);
}
return h;
} | java | private RedBlackTreeNode<Key, Value> moveRedRight(RedBlackTreeNode<Key, Value> h) {
// assert (h != null);
// assert isRed(h) && !h.getRight().isRed() && !isRed(h.right.left);
flipColors(h);
if (isRed(h.getLeft().getLeft())) {
h = rotateRight(h);
flipColors(h);
}
return h;
} | [
"private",
"RedBlackTreeNode",
"<",
"Key",
",",
"Value",
">",
"moveRedRight",
"(",
"RedBlackTreeNode",
"<",
"Key",
",",
"Value",
">",
"h",
")",
"{",
"// assert (h != null);",
"// assert isRed(h) && !h.getRight().isRed() && !isRed(h.right.left);",
"flipColors",
"(",
"h",
... | are black, make h.right or one of its children red. | [
"are",
"black",
"make",
"h",
".",
"right",
"or",
"one",
"of",
"its",
"children",
"red",
"."
] | 35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1 | https://github.com/PureSolTechnologies/graphs/blob/35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1/trees/src/main/java/com/puresoltechnologies/graphs/trees/RedBlackTree.java#L293-L302 | train | Move the red right of a node. | Create a Java method that does the following: "Move the red right of a node.". | Of course, here is the Java code you requested:
```java
private RedBlackTreeNode<Key, Value> moveRedRight(RedBlackTreeNode<Key, Value> h) {
// assert (h != null);
// assert isRed(h) && !h.getRight().isRed() && !isRed(h.right.left);
flipColors(h);
if (isRed(h.getLeft().getLeft())) {
h = rotateRight(h);
fl... | |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchClient.java | JMElasticsearchClient.getSettingsBuilder | public static Builder getSettingsBuilder(String nodeName,
boolean clientTransportSniff, String clusterName) {
boolean isNullClusterName = Objects.isNull(clusterName);
Builder builder = Settings.builder().put(NODE_NAME, nodeName)
.put(CLIENT_TRANSPORT_SNIFF, clientTransportSni... | java | public static Builder getSettingsBuilder(String nodeName,
boolean clientTransportSniff, String clusterName) {
boolean isNullClusterName = Objects.isNull(clusterName);
Builder builder = Settings.builder().put(NODE_NAME, nodeName)
.put(CLIENT_TRANSPORT_SNIFF, clientTransportSni... | [
"public",
"static",
"Builder",
"getSettingsBuilder",
"(",
"String",
"nodeName",
",",
"boolean",
"clientTransportSniff",
",",
"String",
"clusterName",
")",
"{",
"boolean",
"isNullClusterName",
"=",
"Objects",
".",
"isNull",
"(",
"clusterName",
")",
";",
"Builder",
... | Gets settings builder.
@param nodeName the node name
@param clientTransportSniff the client transport sniff
@param clusterName the cluster name
@return the settings builder | [
"Gets",
"settings",
"builder",
"."
] | 6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638 | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchClient.java#L173-L183 | train | Get a builder for the settings. | Create a Java method that does the following: "Get a builder for the settings.". | Of course, here is the Java code you requested:
```java
public static Builder getSettingsBuilder(String nodeName,
boolean clientTransportSniff, String clusterName) {
boolean isNullClusterName = Objects.isNull(clusterName);
Builder builder = Settings.builder().put(NODE_NAME, nodeName)
... | |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java | DefaultApplicationObjectConfigurer.configureLabel | protected void configureLabel(LabelConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String labelStr = loadMessage(objectName + "." + LABEL_KEY);
if (StringUtils.hasText(labelStr)) {
LabelInfo labelInfo = LabelInfo.valueO... | java | protected void configureLabel(LabelConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String labelStr = loadMessage(objectName + "." + LABEL_KEY);
if (StringUtils.hasText(labelStr)) {
LabelInfo labelInfo = LabelInfo.valueO... | [
"protected",
"void",
"configureLabel",
"(",
"LabelConfigurable",
"configurable",
",",
"String",
"objectName",
")",
"{",
"Assert",
".",
"notNull",
"(",
"configurable",
",",
"\"configurable\"",
")",
";",
"Assert",
".",
"notNull",
"(",
"objectName",
",",
"\"objectNam... | Sets the {@link LabelInfo} of the given object. The label info is created
after loading the encoded label string from this instance's
{@link MessageSource} using a message code in the format
<pre>
<objectName>.label
</pre>
@param configurable The object to be configured. Must not be null.
@param objectName The ... | [
"Sets",
"the",
"{",
"@link",
"LabelInfo",
"}",
"of",
"the",
"given",
"object",
".",
"The",
"label",
"info",
"is",
"created",
"after",
"loading",
"the",
"encoded",
"label",
"string",
"from",
"this",
"instance",
"s",
"{",
"@link",
"MessageSource",
"}",
"usin... | 6aad6e640b348cda8f3b0841f6e42025233f1eb8 | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java#L372-L382 | train | Configures the label for the given object name. | Create a Java method that does the following: "Configures the label for the given object name.". | Of course, here is the Java code you requested:
```java
protected void configureLabel(LabelConfigurable configurable, String objectName) {
Assert.notNull(configurable, "configurable");
Assert.notNull(objectName, "objectName");
String labelStr = loadMessage(objectName + "." + LABEL_KEY);
if (StringUtils.hasTe... | |
JodaOrg/joda-time | src/main/java/org/joda/time/format/ISOPeriodFormat.java | ISOPeriodFormat.standard | public static PeriodFormatter standard() {
if (cStandard == null) {
cStandard = new PeriodFormatterBuilder()
.appendLiteral("P")
.appendYears()
.appendSuffix("Y")
.appendMonths()
.appendSuffix("M")
.appen... | java | public static PeriodFormatter standard() {
if (cStandard == null) {
cStandard = new PeriodFormatterBuilder()
.appendLiteral("P")
.appendYears()
.appendSuffix("Y")
.appendMonths()
.appendSuffix("M")
.appen... | [
"public",
"static",
"PeriodFormatter",
"standard",
"(",
")",
"{",
"if",
"(",
"cStandard",
"==",
"null",
")",
"{",
"cStandard",
"=",
"new",
"PeriodFormatterBuilder",
"(",
")",
".",
"appendLiteral",
"(",
"\"P\"",
")",
".",
"appendYears",
"(",
")",
".",
"appe... | The standard ISO format - PyYmMwWdDThHmMsS.
Milliseconds are not output.
Note that the ISO8601 standard actually indicates weeks should not
be shown if any other field is present and vice versa.
@return the formatter | [
"The",
"standard",
"ISO",
"format",
"-",
"PyYmMwWdDThHmMsS",
".",
"Milliseconds",
"are",
"not",
"output",
".",
"Note",
"that",
"the",
"ISO8601",
"standard",
"actually",
"indicates",
"weeks",
"should",
"not",
"be",
"shown",
"if",
"any",
"other",
"field",
"is",
... | bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42 | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/ISOPeriodFormat.java#L64-L86 | train | Get the standard calendar formatter | Create a Java method that does the following: "Get the standard calendar formatter". | Of course, here is the Java code you requested:
```java
public static PeriodFormatter standard() {
if (cStandard == null) {
cStandard = new PeriodFormatterBuilder()
.appendLiteral("P")
.appendYears()
.appendSuffix("Y")
.appendMonths()
... | |
gwtbootstrap3/gwtbootstrap3-extras | src/main/java/org/gwtbootstrap3/extras/select/client/ui/SelectBase.java | SelectBase.setStyle | public void setStyle(final String styleName) {
if (styleName != null)
attrMixin.setAttribute(STYLE, styleName);
else
attrMixin.removeAttribute(STYLE);
} | java | public void setStyle(final String styleName) {
if (styleName != null)
attrMixin.setAttribute(STYLE, styleName);
else
attrMixin.removeAttribute(STYLE);
} | [
"public",
"void",
"setStyle",
"(",
"final",
"String",
"styleName",
")",
"{",
"if",
"(",
"styleName",
"!=",
"null",
")",
"attrMixin",
".",
"setAttribute",
"(",
"STYLE",
",",
"styleName",
")",
";",
"else",
"attrMixin",
".",
"removeAttribute",
"(",
"STYLE",
"... | Set the customized style name to the select.<br>
<br>
Defaults to <code>null</code>.<br>
<br>
<b>IMPORTANT</b>: This method will override the style set by
{@link #setType(ButtonType)} and/or {@link #setSize(ButtonSize)}.
@param styleName | [
"Set",
"the",
"customized",
"style",
"name",
"to",
"the",
"select",
".",
"<br",
">",
"<br",
">",
"Defaults",
"to",
"<code",
">",
"null<",
"/",
"code",
">",
".",
"<br",
">",
"<br",
">",
"<b",
">",
"IMPORTANT<",
"/",
"b",
">",
":",
"This",
"method",
... | 8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94 | https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/select/client/ui/SelectBase.java#L558-L563 | train | Sets the style of the class. | Create a Java method that does the following: "Sets the style of the class.". | Of course, here is the Java code you requested:
```java
public void setStyle(final String styleName) {
if (styleName != null)
attrMixin.setAttribute(STYLE, styleName);
else
attrMixin.removeAttribute(STYLE);
}
```
Hope this helps! | |
SeleniumJT/seleniumjt-core | src/main/java/com/jt/selenium/SeleniumJT.java | SeleniumJT.verifyElementText | @LogExecTime
public void verifyElementText(String locator, String value, String message)
{
jtCore.verifyElementText(locator, value, message);
} | java | @LogExecTime
public void verifyElementText(String locator, String value, String message)
{
jtCore.verifyElementText(locator, value, message);
} | [
"@",
"LogExecTime",
"public",
"void",
"verifyElementText",
"(",
"String",
"locator",
",",
"String",
"value",
",",
"String",
"message",
")",
"{",
"jtCore",
".",
"verifyElementText",
"(",
"locator",
",",
"value",
",",
"message",
")",
";",
"}"
] | Allow custom message to verifyElementText | [
"Allow",
"custom",
"message",
"to",
"verifyElementText"
] | 8e972f69adc4846a3f1d7b8ca9c3f8d953a2d0f3 | https://github.com/SeleniumJT/seleniumjt-core/blob/8e972f69adc4846a3f1d7b8ca9c3f8d953a2d0f3/src/main/java/com/jt/selenium/SeleniumJT.java#L299-L303 | train | Verify that an element is present in the DOM. | Create a Java method that does the following: "Verify that an element is present in the DOM.". | Of course, here is the Java code you requested:
```java
@LogExecTime
public void verifyElementText(String locator, String value, String message)
{
jtCore.verifyElementText(locator, value, message);
}
```
Hope this helps! | |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.keep | public M keep(String attr) {
if (attrs.containsKey(attr)) { // prevent put null value to the newColumns
Object keepIt = attrs.get(attr);
boolean keepFlag = _getModifyFlag().contains(attr);
attrs.clear();
_getModifyFlag().clear();
attrs.put(attr, keepIt);
if (keepFlag)
_getModifyFlag().ad... | java | public M keep(String attr) {
if (attrs.containsKey(attr)) { // prevent put null value to the newColumns
Object keepIt = attrs.get(attr);
boolean keepFlag = _getModifyFlag().contains(attr);
attrs.clear();
_getModifyFlag().clear();
attrs.put(attr, keepIt);
if (keepFlag)
_getModifyFlag().ad... | [
"public",
"M",
"keep",
"(",
"String",
"attr",
")",
"{",
"if",
"(",
"attrs",
".",
"containsKey",
"(",
"attr",
")",
")",
"{",
"// prevent put null value to the newColumns\r",
"Object",
"keepIt",
"=",
"attrs",
".",
"get",
"(",
"attr",
")",
";",
"boolean",
"ke... | Keep attribute of this model and remove other attributes.
@param attr the attribute name of the model
@return this model | [
"Keep",
"attribute",
"of",
"this",
"model",
"and",
"remove",
"other",
"attributes",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L869-L884 | train | Keep the value of an attribute in the new columns. | Create a Java method that does the following: "Keep the value of an attribute in the new columns.". | Of course, here is the Java code you requested:
```java
public M keep(String attr) {
if (attrs.containsKey(attr)) { // prevent put null value to the newColumns
Object keepIt = attrs.get(attr);
boolean keepFlag = _getModifyFlag().contains(attr);
attrs.clear();
_getModifyFlag().clear();
attrs.put(... | |
alkacon/opencms-core | src/org/opencms/ade/galleries/CmsGalleryService.java | CmsGalleryService.getInitialSettingsInternal | private CmsGalleryDataBean getInitialSettingsInternal(CmsGalleryConfiguration conf) throws CmsRpcException {
CmsGalleryDataBean data = new CmsGalleryDataBean();
data.setMode(conf.getGalleryMode());
data.setResultViewType(readResultViewType());
boolean galleryShowInvalidDefault = Boolean... | java | private CmsGalleryDataBean getInitialSettingsInternal(CmsGalleryConfiguration conf) throws CmsRpcException {
CmsGalleryDataBean data = new CmsGalleryDataBean();
data.setMode(conf.getGalleryMode());
data.setResultViewType(readResultViewType());
boolean galleryShowInvalidDefault = Boolean... | [
"private",
"CmsGalleryDataBean",
"getInitialSettingsInternal",
"(",
"CmsGalleryConfiguration",
"conf",
")",
"throws",
"CmsRpcException",
"{",
"CmsGalleryDataBean",
"data",
"=",
"new",
"CmsGalleryDataBean",
"(",
")",
";",
"data",
".",
"setMode",
"(",
"conf",
".",
"getG... | Helper method for getting the initial gallery settings.<p>
@param conf the gallery configration
@return the gallery settings
@throws CmsRpcException if something goes wrong | [
"Helper",
"method",
"for",
"getting",
"the",
"initial",
"gallery",
"settings",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L2311-L2496 | train | Returns the initial settings. | Create a Java method that does the following: "Returns the initial settings.". | Of course, here is the Java code you requested:
```java
private CmsGalleryDataBean getInitialSettingsInternal(CmsGalleryConfiguration conf) throws CmsRpcException {
CmsGalleryDataBean data = new CmsGalleryDataBean();
data.setMode(conf.getGalleryMode());
data.setResultViewType(readResultViewTyp... | |
op4j/op4j | src/main/java/org/op4j/functions/Fn.java | Fn.onSetOf | public static <T> Level0SetOperator<Set<T>,T> onSetOf(final Type<T> type) {
return new Level0SetOperator<Set<T>,T>(ExecutionTarget.forFn(Normalisation.SET));
} | java | public static <T> Level0SetOperator<Set<T>,T> onSetOf(final Type<T> type) {
return new Level0SetOperator<Set<T>,T>(ExecutionTarget.forFn(Normalisation.SET));
} | [
"public",
"static",
"<",
"T",
">",
"Level0SetOperator",
"<",
"Set",
"<",
"T",
">",
",",
"T",
">",
"onSetOf",
"(",
"final",
"Type",
"<",
"T",
">",
"type",
")",
"{",
"return",
"new",
"Level0SetOperator",
"<",
"Set",
"<",
"T",
">",
",",
"T",
">",
"(... | <p>
Creates a <i>function expression</i> for building a function operating on
a target object of type Set<T>, being <tt>Type<T></tt> a type specified
as a parameter.
</p>
<p>
This is equivalent to <tt>Fn.on(Types.setOf(type))</tt>
</p>
@param type the type to be used
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"a",
"<i",
">",
"function",
"expression<",
"/",
"i",
">",
"for",
"building",
"a",
"function",
"operating",
"on",
"a",
"target",
"object",
"of",
"type",
"Set<",
";",
"T>",
";",
"being",
"<tt",
">",
"Type<",
";",
"T>",
";",
... | b577596dfe462089d3dd169666defc6de7ad289a | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Fn.java#L1081-L1083 | train | Create an instance of the class that is on the set of the given type. | Create a Java method that does the following: "Create an instance of the class that is on the set of the given type.". | Of course, here is the Java code you requested:
```java
public static <T> Level0SetOperator<Set<T>,T> onSetOf(final Type<T> type) {
return new Level0SetOperator<Set<T>,T>(ExecutionTarget.forFn(Normalisation.SET));
}
```
Hope this helps! | |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/LongStream.java | LongStream.generate | @NotNull
public static LongStream generate(@NotNull final LongSupplier s) {
Objects.requireNonNull(s);
return new LongStream(new LongGenerate(s));
} | java | @NotNull
public static LongStream generate(@NotNull final LongSupplier s) {
Objects.requireNonNull(s);
return new LongStream(new LongGenerate(s));
} | [
"@",
"NotNull",
"public",
"static",
"LongStream",
"generate",
"(",
"@",
"NotNull",
"final",
"LongSupplier",
"s",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"s",
")",
";",
"return",
"new",
"LongStream",
"(",
"new",
"LongGenerate",
"(",
"s",
")",
")",
... | Creates a {@code LongStream} by elements that generated by {@code LongSupplier}.
@param s the {@code LongSupplier} for generated elements
@return a new infinite sequential {@code LongStream}
@throws NullPointerException if {@code s} is null | [
"Creates",
"a",
"{",
"@code",
"LongStream",
"}",
"by",
"elements",
"that",
"generated",
"by",
"{",
"@code",
"LongSupplier",
"}",
"."
] | f29fd57208c20252a4549b084d55ed082c3e58f0 | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L134-L138 | train | Create a stream of generated tokens. | Create a Java method that does the following: "Create a stream of generated tokens.". | Of course, here is the Java code you requested:
```java
@NotNull
public static LongStream generate(@NotNull final LongSupplier s) {
Objects.requireNonNull(s);
return new LongStream(new LongGenerate(s));
}
```
Hope this helps! | |
dubboclub/dubbo-plus | circuitbreaker/src/main/java/net/dubboclub/cricuitbreaker/Config.java | Config.checkFunctionSwitch | public static boolean checkFunctionSwitch(Invoker<?> invoker, Invocation invocation){
//先动态从调用地址里面获取开关配置信息,这个配置可以在配置中心的动态配置{methodName.}circuit.bread=true/false
String circuitBreak = invoker.getUrl().getMethodParameter(invocation.getMethodName(),"circuit.break");
if(StringUtils.isEmpty(circuitBr... | java | public static boolean checkFunctionSwitch(Invoker<?> invoker, Invocation invocation){
//先动态从调用地址里面获取开关配置信息,这个配置可以在配置中心的动态配置{methodName.}circuit.bread=true/false
String circuitBreak = invoker.getUrl().getMethodParameter(invocation.getMethodName(),"circuit.break");
if(StringUtils.isEmpty(circuitBr... | [
"public",
"static",
"boolean",
"checkFunctionSwitch",
"(",
"Invoker",
"<",
"?",
">",
"invoker",
",",
"Invocation",
"invocation",
")",
"{",
"//先动态从调用地址里面获取开关配置信息,这个配置可以在配置中心的动态配置{methodName.}circuit.bread=true/false",
"String",
"circuitBreak",
"=",
"invoker",
".",
"getUrl",
... | 获取当前调用的服务方法是否开启了服务降级功能
@param invoker
@param invocation
@return | [
"获取当前调用的服务方法是否开启了服务降级功能"
] | defac66b2ad50d0b60d6991a0c49e06a602abb34 | https://github.com/dubboclub/dubbo-plus/blob/defac66b2ad50d0b60d6991a0c49e06a602abb34/circuitbreaker/src/main/java/net/dubboclub/cricuitbreaker/Config.java#L32-L45 | train | check if the function switch is true | Create a Java method that does the following: "check if the function switch is true". | Of course, here is the Java code you requested:
```java
public static boolean checkFunctionSwitch(Invoker<?> invoker, Invocation invocation){
//先动态从调用地址里面获取开关配置信息,这个配置可以在配置中心的动态配置{methodName.}circuit.bread=true/false
String circuitBreak = invoker.getUrl().getMethodParameter(invocation.getMethodName(),"... | |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/PropertyChangeSupport.java | PropertyChangeSupport.removePropertyChangeListener | public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
if (children == null) {
return;
}
PropertyChangeSupport child = (PropertyChangeSupport) children.get(propertyName);
if (child == null) {
return;
}
child.removePropertyChangeListener(listener);
} | java | public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
if (children == null) {
return;
}
PropertyChangeSupport child = (PropertyChangeSupport) children.get(propertyName);
if (child == null) {
return;
}
child.removePropertyChangeListener(listener);
} | [
"public",
"void",
"removePropertyChangeListener",
"(",
"String",
"propertyName",
",",
"PropertyChangeListener",
"listener",
")",
"{",
"if",
"(",
"children",
"==",
"null",
")",
"{",
"return",
";",
"}",
"PropertyChangeSupport",
"child",
"=",
"(",
"PropertyChangeSuppor... | Remove a PropertyChangeListener for a specific property.
@param propertyName The name of the property that was listened on.
@param listener The PropertyChangeListener to be removed | [
"Remove",
"a",
"PropertyChangeListener",
"for",
"a",
"specific",
"property",
"."
] | 6aad6e640b348cda8f3b0841f6e42025233f1eb8 | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/PropertyChangeSupport.java#L178-L187 | train | Removes a PropertyChangeListener for the specified property. | Create a Java method that does the following: "Removes a PropertyChangeListener for the specified property.". | Of course, here is the Java code you requested:
```java
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
if (children == null) {
return;
}
PropertyChangeSupport child = (PropertyChangeSupport) children.get(propertyName);
if (child == null) {
return;
}
c... | |
dyu/protostuff-1.0.x | protostuff-runtime/src/main/java/com/dyuproject/protostuff/runtime/DefaultIdStrategy.java | DefaultIdStrategy.registerDelegate | public <T> boolean registerDelegate(Delegate<T> delegate)
{
return null == delegateMapping.putIfAbsent(delegate.typeClass().getName(),
delegate);
} | java | public <T> boolean registerDelegate(Delegate<T> delegate)
{
return null == delegateMapping.putIfAbsent(delegate.typeClass().getName(),
delegate);
} | [
"public",
"<",
"T",
">",
"boolean",
"registerDelegate",
"(",
"Delegate",
"<",
"T",
">",
"delegate",
")",
"{",
"return",
"null",
"==",
"delegateMapping",
".",
"putIfAbsent",
"(",
"delegate",
".",
"typeClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"dele... | Registers a delegate. Returns true if registration is successful. | [
"Registers",
"a",
"delegate",
".",
"Returns",
"true",
"if",
"registration",
"is",
"successful",
"."
] | d7c964ec20da3fe44699d86ee95c2677ddffde96 | https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-runtime/src/main/java/com/dyuproject/protostuff/runtime/DefaultIdStrategy.java#L108-L112 | train | Register a new instance of a CID . | Create a Java method that does the following: "Register a new instance of a CID .". | Of course, here is the Java code you requested:
```java
public <T> boolean registerDelegate(Delegate<T> delegate)
{
return null == delegateMapping.putIfAbsent(delegate.typeClass().getName(),
delegate);
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-iotanalytics/src/main/java/com/amazonaws/services/iotanalytics/AWSIoTAnalyticsClient.java | AWSIoTAnalyticsClient.batchPutMessage | @Override
public BatchPutMessageResult batchPutMessage(BatchPutMessageRequest request) {
request = beforeClientExecution(request);
return executeBatchPutMessage(request);
} | java | @Override
public BatchPutMessageResult batchPutMessage(BatchPutMessageRequest request) {
request = beforeClientExecution(request);
return executeBatchPutMessage(request);
} | [
"@",
"Override",
"public",
"BatchPutMessageResult",
"batchPutMessage",
"(",
"BatchPutMessageRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeBatchPutMessage",
"(",
"request",
")",
";",
"}"
] | <p>
Sends messages to a channel.
</p>
@param batchPutMessageRequest
@return Result of the BatchPutMessage operation returned by the service.
@throws ResourceNotFoundException
A resource with the specified name could not be found.
@throws InvalidRequestException
The request was not valid.
@throws InternalFailureExcepti... | [
"<p",
">",
"Sends",
"messages",
"to",
"a",
"channel",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iotanalytics/src/main/java/com/amazonaws/services/iotanalytics/AWSIoTAnalyticsClient.java#L187-L191 | train | Batch put a message in an existing source. | Create a Java method that does the following: "Batch put a message in an existing source.". | Of course, here is the Java code you requested:
```java
@Override
public BatchPutMessageResult batchPutMessage(BatchPutMessageRequest request) {
request = beforeClientExecution(request);
return executeBatchPutMessage(request);
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EventFilter.java | EventFilter.setRegions | public void setRegions(java.util.Collection<String> regions) {
if (regions == null) {
this.regions = null;
return;
}
this.regions = new java.util.ArrayList<String>(regions);
} | java | public void setRegions(java.util.Collection<String> regions) {
if (regions == null) {
this.regions = null;
return;
}
this.regions = new java.util.ArrayList<String>(regions);
} | [
"public",
"void",
"setRegions",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"String",
">",
"regions",
")",
"{",
"if",
"(",
"regions",
"==",
"null",
")",
"{",
"this",
".",
"regions",
"=",
"null",
";",
"return",
";",
"}",
"this",
".",
"regions",
... | <p>
A list of AWS regions.
</p>
@param regions
A list of AWS regions. | [
"<p",
">",
"A",
"list",
"of",
"AWS",
"regions",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EventFilter.java#L361-L368 | train | Sets the value of the regions property. | Create a Java method that does the following: "Sets the value of the regions property.". | Of course, here is the Java code you requested:
```java
public void setRegions(java.util.Collection<String> regions) {
if (regions == null) {
this.regions = null;
return;
}
this.regions = new java.util.ArrayList<String>(regions);
}
```
Hope this helps! | |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java | SqlBuilderHelper.countParameterOfType | public static int countParameterOfType(ModelMethod method, TypeName parameter) {
int counter = 0;
for (Pair<String, TypeName> item : method.getParameters()) {
if (item.value1.equals(parameter)) {
counter++;
}
}
return counter;
} | java | public static int countParameterOfType(ModelMethod method, TypeName parameter) {
int counter = 0;
for (Pair<String, TypeName> item : method.getParameters()) {
if (item.value1.equals(parameter)) {
counter++;
}
}
return counter;
} | [
"public",
"static",
"int",
"countParameterOfType",
"(",
"ModelMethod",
"method",
",",
"TypeName",
"parameter",
")",
"{",
"int",
"counter",
"=",
"0",
";",
"for",
"(",
"Pair",
"<",
"String",
",",
"TypeName",
">",
"item",
":",
"method",
".",
"getParameters",
... | Count parameter of type.
@param method
the method
@param parameter
the parameter
@return the int | [
"Count",
"parameter",
"of",
"type",
"."
] | 90de2c0523d39b99e81b8d38aa996898762f594a | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L401-L410 | train | Count the number of parameters of a given type. | Create a Java method that does the following: "Count the number of parameters of a given type.". | Of course, here is the Java code you requested:
```java
public static int countParameterOfType(ModelMethod method, TypeName parameter) {
int counter = 0;
for (Pair<String, TypeName> item : method.getParameters()) {
if (item.value1.equals(parameter)) {
counter++;
}
}
return counter;
}
```
Hope this... | |
facebookarchive/hadoop-20 | src/contrib/hmon/src/java/org/apache/hadoop/mapred/LocalJobUtilization.java | LocalJobUtilization.write | @Override
public void write(DataOutput out) throws IOException {
Text.writeString(out, getJobId());
out.writeDouble(getCpuUsageGHz());
out.writeDouble(getMemUsageGB());
} | java | @Override
public void write(DataOutput out) throws IOException {
Text.writeString(out, getJobId());
out.writeDouble(getCpuUsageGHz());
out.writeDouble(getMemUsageGB());
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"Text",
".",
"writeString",
"(",
"out",
",",
"getJobId",
"(",
")",
")",
";",
"out",
".",
"writeDouble",
"(",
"getCpuUsageGHz",
"(",
")",
")",
";",
... | //////////////////////////////////////////////// | [
"////////////////////////////////////////////////"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/hmon/src/java/org/apache/hadoop/mapred/LocalJobUtilization.java#L54-L59 | train | Write the data of the ClusterInfo object to the specified output stream. | Create a Java method that does the following: "Write the data of the ClusterInfo object to the specified output stream.". | Of course, here is the Java code you requested:
```java
@Override
public void write(DataOutput out) throws IOException {
Text.writeString(out, getJobId());
out.writeDouble(getCpuUsageGHz());
out.writeDouble(getMemUsageGB());
}
```
Hope this helps! | |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java | KeyChainGroup.freshAddress | public Address freshAddress(KeyChain.KeyPurpose purpose) {
DeterministicKeyChain chain = getActiveKeyChain();
Script.ScriptType outputScriptType = chain.getOutputScriptType();
if (chain.isMarried()) {
Script outputScript = chain.freshOutputScript(purpose);
checkState(Scri... | java | public Address freshAddress(KeyChain.KeyPurpose purpose) {
DeterministicKeyChain chain = getActiveKeyChain();
Script.ScriptType outputScriptType = chain.getOutputScriptType();
if (chain.isMarried()) {
Script outputScript = chain.freshOutputScript(purpose);
checkState(Scri... | [
"public",
"Address",
"freshAddress",
"(",
"KeyChain",
".",
"KeyPurpose",
"purpose",
")",
"{",
"DeterministicKeyChain",
"chain",
"=",
"getActiveKeyChain",
"(",
")",
";",
"Script",
".",
"ScriptType",
"outputScriptType",
"=",
"chain",
".",
"getOutputScriptType",
"(",
... | Returns address for a {@link #freshKey(KeyChain.KeyPurpose)} | [
"Returns",
"address",
"for",
"a",
"{"
] | 9cf13d29315014ed59cf4fc5944e5f227e8df9a6 | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L376-L392 | train | FreshAddress Method. | Create a Java method that does the following: "FreshAddress Method.". | Of course, here is the Java code you requested:
```java
public Address freshAddress(KeyChain.KeyPurpose purpose) {
DeterministicKeyChain chain = getActiveKeyChain();
Script.ScriptType outputScriptType = chain.getOutputScriptType();
if (chain.isMarried()) {
Script outputScript = chai... | |
3redronin/mu-server | src/main/java/io/muserver/MuServerBuilder.java | MuServerBuilder.withGzip | public MuServerBuilder withGzip(long minimumGzipSize, Set<String> mimeTypesToGzip) {
this.gzipEnabled = true;
this.mimeTypesToGzip = mimeTypesToGzip;
this.minimumGzipSize = minimumGzipSize;
return this;
} | java | public MuServerBuilder withGzip(long minimumGzipSize, Set<String> mimeTypesToGzip) {
this.gzipEnabled = true;
this.mimeTypesToGzip = mimeTypesToGzip;
this.minimumGzipSize = minimumGzipSize;
return this;
} | [
"public",
"MuServerBuilder",
"withGzip",
"(",
"long",
"minimumGzipSize",
",",
"Set",
"<",
"String",
">",
"mimeTypesToGzip",
")",
"{",
"this",
".",
"gzipEnabled",
"=",
"true",
";",
"this",
".",
"mimeTypesToGzip",
"=",
"mimeTypesToGzip",
";",
"this",
".",
"minim... | Enables gzip for files of at least the specified size that match the given mime-types.
By default, gzip is enabled for text-based mime types over 1400 bytes. It is recommended
to keep the defaults and only use this method if you have very specific requirements
around GZIP.
@param minimumGzipSize The size in bytes befor... | [
"Enables",
"gzip",
"for",
"files",
"of",
"at",
"least",
"the",
"specified",
"size",
"that",
"match",
"the",
"given",
"mime",
"-",
"types",
".",
"By",
"default",
"gzip",
"is",
"enabled",
"for",
"text",
"-",
"based",
"mime",
"types",
"over",
"1400",
"bytes... | 51598606a3082a121fbd785348ee9770b40308e6 | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/MuServerBuilder.java#L121-L126 | train | Sets the gzip flag to enable gzip for the current session. | Create a Java method that does the following: "Sets the gzip flag to enable gzip for the current session.". | Of course, here is the Java code you requested:
```java
public MuServerBuilder withGzip(long minimumGzipSize, Set<String> mimeTypesToGzip) {
this.gzipEnabled = true;
this.mimeTypesToGzip = mimeTypesToGzip;
this.minimumGzipSize = minimumGzipSize;
return this;
}
```
Hope this helps! | |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.queryBlockByHash | public BlockInfo queryBlockByHash(Collection<Peer> peers, byte[] blockHash, User userContext) throws InvalidArgumentException, ProposalException {
checkChannelState();
checkPeers(peers);
userContextCheck(userContext);
if (blockHash == null) {
throw new InvalidArgumentExcept... | java | public BlockInfo queryBlockByHash(Collection<Peer> peers, byte[] blockHash, User userContext) throws InvalidArgumentException, ProposalException {
checkChannelState();
checkPeers(peers);
userContextCheck(userContext);
if (blockHash == null) {
throw new InvalidArgumentExcept... | [
"public",
"BlockInfo",
"queryBlockByHash",
"(",
"Collection",
"<",
"Peer",
">",
"peers",
",",
"byte",
"[",
"]",
"blockHash",
",",
"User",
"userContext",
")",
"throws",
"InvalidArgumentException",
",",
"ProposalException",
"{",
"checkChannelState",
"(",
")",
";",
... | Query a peer in this channel for a Block by the block hash.
@param peers the Peers to query.
@param blockHash the hash of the Block in the chain.
@param userContext the user context
@return the {@link BlockInfo} with the given block Hash
@throws InvalidArgumentException if the channel is shutdown or any of the... | [
"Query",
"a",
"peer",
"in",
"this",
"channel",
"for",
"a",
"Block",
"by",
"the",
"block",
"hash",
"."
] | 4a2d7b3408b8b0a1ed812aa36942c438159c37a0 | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L2715-L2741 | train | Query a block by hash. | Create a Java method that does the following: "Query a block by hash.". | Of course, here is the Java code you requested:
```java
public BlockInfo queryBlockByHash(Collection<Peer> peers, byte[] blockHash, User userContext) throws InvalidArgumentException, ProposalException {
checkChannelState();
checkPeers(peers);
userContextCheck(userContext);
if (blockHa... | |
alkacon/opencms-core | src/org/opencms/ade/contenteditor/CmsContentTypeVisitor.java | CmsContentTypeVisitor.collectTabInfos | private List<CmsTabInfo> collectTabInfos(CmsXmlContentDefinition definition) {
List<CmsTabInfo> result = new ArrayList<CmsTabInfo>();
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.setMessages(m_messages);
if (definition.getContentHandler().getTabs() != null) {
... | java | private List<CmsTabInfo> collectTabInfos(CmsXmlContentDefinition definition) {
List<CmsTabInfo> result = new ArrayList<CmsTabInfo>();
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.setMessages(m_messages);
if (definition.getContentHandler().getTabs() != null) {
... | [
"private",
"List",
"<",
"CmsTabInfo",
">",
"collectTabInfos",
"(",
"CmsXmlContentDefinition",
"definition",
")",
"{",
"List",
"<",
"CmsTabInfo",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsTabInfo",
">",
"(",
")",
";",
"CmsMacroResolver",
"resolver",
"=",
... | Returns the tab informations for the given content definition.<p>
@param definition the content definition
@return the tab informations | [
"Returns",
"the",
"tab",
"informations",
"for",
"the",
"given",
"content",
"definition",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentTypeVisitor.java#L481-L509 | train | Collect the tab infos from the content handler. | Create a Java method that does the following: "Collect the tab infos from the content handler.". | Of course, here is the Java code you requested:
```java
private List<CmsTabInfo> collectTabInfos(CmsXmlContentDefinition definition) {
List<CmsTabInfo> result = new ArrayList<CmsTabInfo>();
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.setMessages(m_messages);
if (d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.