repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java | CredentialsInner.getAsync | public Observable<CredentialInner> getAsync(String resourceGroupName, String automationAccountName, String credentialName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName).map(new Func1<ServiceResponse<CredentialInner>, CredentialInner>() {
@Override
public CredentialInner call(ServiceResponse<CredentialInner> response) {
return response.body();
}
});
} | java | public Observable<CredentialInner> getAsync(String resourceGroupName, String automationAccountName, String credentialName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName).map(new Func1<ServiceResponse<CredentialInner>, CredentialInner>() {
@Override
public CredentialInner call(ServiceResponse<CredentialInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CredentialInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"credentialName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccou... | Retrieve the credential identified by credential name.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param credentialName The name of credential.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CredentialInner object | [
"Retrieve",
"the",
"credential",
"identified",
"by",
"credential",
"name",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java#L222-L229 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/CaretSelectionBindImpl.java | CaretSelectionBindImpl.calculatePositionViaBreakingForwards | private int calculatePositionViaBreakingForwards(int numOfBreaks, BreakIterator breakIterator, int position) {
breakIterator.following(position);
for (int i = 1; i < numOfBreaks; i++) {
breakIterator.next(numOfBreaks);
}
return breakIterator.current();
} | java | private int calculatePositionViaBreakingForwards(int numOfBreaks, BreakIterator breakIterator, int position) {
breakIterator.following(position);
for (int i = 1; i < numOfBreaks; i++) {
breakIterator.next(numOfBreaks);
}
return breakIterator.current();
} | [
"private",
"int",
"calculatePositionViaBreakingForwards",
"(",
"int",
"numOfBreaks",
",",
"BreakIterator",
"breakIterator",
",",
"int",
"position",
")",
"{",
"breakIterator",
".",
"following",
"(",
"position",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"... | Assumes that {@code getArea().getLength != 0} is true and {@link BreakIterator#setText(String)} has been called | [
"Assumes",
"that",
"{"
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/CaretSelectionBindImpl.java#L473-L479 |
aws/aws-sdk-java | aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/model/intermediate/ShapeModel.java | ShapeModel.removeMemberByC2jName | public boolean removeMemberByC2jName(String memberC2jName, boolean ignoreCase) {
// Implicitly depending on the default equals and hashcode
// implementation of the class MemberModel
MemberModel model = tryFindMemberModelByC2jName(memberC2jName, ignoreCase);
return model == null ? false : members.remove(model);
} | java | public boolean removeMemberByC2jName(String memberC2jName, boolean ignoreCase) {
// Implicitly depending on the default equals and hashcode
// implementation of the class MemberModel
MemberModel model = tryFindMemberModelByC2jName(memberC2jName, ignoreCase);
return model == null ? false : members.remove(model);
} | [
"public",
"boolean",
"removeMemberByC2jName",
"(",
"String",
"memberC2jName",
",",
"boolean",
"ignoreCase",
")",
"{",
"// Implicitly depending on the default equals and hashcode",
"// implementation of the class MemberModel",
"MemberModel",
"model",
"=",
"tryFindMemberModelByC2jName"... | Takes in the c2j member name as input and removes if the shape contains a member with the
given name. Return false otherwise. | [
"Takes",
"in",
"the",
"c2j",
"member",
"name",
"as",
"input",
"and",
"removes",
"if",
"the",
"shape",
"contains",
"a",
"member",
"with",
"the",
"given",
"name",
".",
"Return",
"false",
"otherwise",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/model/intermediate/ShapeModel.java#L390-L395 |
tzaeschke/zoodb | src/org/zoodb/internal/util/DBLogger.java | DBLogger.newFatalDataStore | public static RuntimeException newFatalDataStore(String msg, Throwable t) {
return newEx(FATAL_DATA_STORE_EXCEPTION, msg, t);
} | java | public static RuntimeException newFatalDataStore(String msg, Throwable t) {
return newEx(FATAL_DATA_STORE_EXCEPTION, msg, t);
} | [
"public",
"static",
"RuntimeException",
"newFatalDataStore",
"(",
"String",
"msg",
",",
"Throwable",
"t",
")",
"{",
"return",
"newEx",
"(",
"FATAL_DATA_STORE_EXCEPTION",
",",
"msg",
",",
"t",
")",
";",
"}"
] | THese always result in the session being closed!
@param msg The error message
@param t The Throwable to report
@return Fatal data store exception. | [
"THese",
"always",
"result",
"in",
"the",
"session",
"being",
"closed!"
] | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/DBLogger.java#L171-L173 |
kiegroup/drools | kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/assembler/DMNAssemblerService.java | DMNAssemblerService.compilerConfigWithKModulePrefs | public static DMNCompilerConfigurationImpl compilerConfigWithKModulePrefs(ClassLoader classLoader, ChainedProperties chainedProperties, List<DMNProfile> dmnProfiles, DMNCompilerConfigurationImpl config) {
config.setRootClassLoader(classLoader);
Map<String, String> dmnPrefs = new HashMap<>();
chainedProperties.mapStartsWith(dmnPrefs, ORG_KIE_DMN_PREFIX, true);
config.setProperties(dmnPrefs);
for (DMNProfile dmnProfile : dmnProfiles) {
config.addExtensions(dmnProfile.getExtensionRegisters());
config.addDRGElementCompilers(dmnProfile.getDRGElementCompilers());
config.addFEELProfile(dmnProfile);
}
return config;
} | java | public static DMNCompilerConfigurationImpl compilerConfigWithKModulePrefs(ClassLoader classLoader, ChainedProperties chainedProperties, List<DMNProfile> dmnProfiles, DMNCompilerConfigurationImpl config) {
config.setRootClassLoader(classLoader);
Map<String, String> dmnPrefs = new HashMap<>();
chainedProperties.mapStartsWith(dmnPrefs, ORG_KIE_DMN_PREFIX, true);
config.setProperties(dmnPrefs);
for (DMNProfile dmnProfile : dmnProfiles) {
config.addExtensions(dmnProfile.getExtensionRegisters());
config.addDRGElementCompilers(dmnProfile.getDRGElementCompilers());
config.addFEELProfile(dmnProfile);
}
return config;
} | [
"public",
"static",
"DMNCompilerConfigurationImpl",
"compilerConfigWithKModulePrefs",
"(",
"ClassLoader",
"classLoader",
",",
"ChainedProperties",
"chainedProperties",
",",
"List",
"<",
"DMNProfile",
">",
"dmnProfiles",
",",
"DMNCompilerConfigurationImpl",
"config",
")",
"{",... | Returns a DMNCompilerConfiguration with the specified properties set, and applying the explicited dmnProfiles.
@param classLoader
@param chainedProperties applies properties --it does not do any classloading nor profile loading based on these properites, just passes the values.
@param dmnProfiles applies these DMNProfile(s) to the DMNCompilerConfiguration
@param config
@return | [
"Returns",
"a",
"DMNCompilerConfiguration",
"with",
"the",
"specified",
"properties",
"set",
"and",
"applying",
"the",
"explicited",
"dmnProfiles",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/assembler/DMNAssemblerService.java#L248-L263 |
hal/core | processors/src/main/java/org/jboss/hal/processors/AbstractHalProcessor.java | AbstractHalProcessor.writeCode | protected void writeCode(final String packageName, final String className, final StringBuffer code) {
try {
JavaFileObject jfo = filer.createSourceFile(packageName + "." + className);
Writer w = jfo.openWriter();
BufferedWriter bw = new BufferedWriter(w);
bw.append(code);
bw.close();
w.close();
} catch (IOException e) {
throw new GenerationException(String.format("Error writing code for %s.%s: %s",
packageName, className, e.getMessage()));
}
} | java | protected void writeCode(final String packageName, final String className, final StringBuffer code) {
try {
JavaFileObject jfo = filer.createSourceFile(packageName + "." + className);
Writer w = jfo.openWriter();
BufferedWriter bw = new BufferedWriter(w);
bw.append(code);
bw.close();
w.close();
} catch (IOException e) {
throw new GenerationException(String.format("Error writing code for %s.%s: %s",
packageName, className, e.getMessage()));
}
} | [
"protected",
"void",
"writeCode",
"(",
"final",
"String",
"packageName",
",",
"final",
"String",
"className",
",",
"final",
"StringBuffer",
"code",
")",
"{",
"try",
"{",
"JavaFileObject",
"jfo",
"=",
"filer",
".",
"createSourceFile",
"(",
"packageName",
"+",
"... | Writes the specified source code and wraps any {@code IOException} as {@link GenerationException}.
@param packageName the package name
@param className the class name
@param code the source code
@throws GenerationException if an {@code IOException occurs} | [
"Writes",
"the",
"specified",
"source",
"code",
"and",
"wraps",
"any",
"{",
"@code",
"IOException",
"}",
"as",
"{",
"@link",
"GenerationException",
"}",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/processors/src/main/java/org/jboss/hal/processors/AbstractHalProcessor.java#L249-L261 |
thiagokimo/Faker | faker-core/src/main/java/io/kimo/lib/faker/Faker.java | Faker.fillWithNumber | public void fillWithNumber(TextView view, FakerNumericComponent component) {
validateNotNullableView(view);
validateIfIsATextView(view);
validateNotNullableFakerComponent(component);
view.setText(String.valueOf(component.randomNumber()));
} | java | public void fillWithNumber(TextView view, FakerNumericComponent component) {
validateNotNullableView(view);
validateIfIsATextView(view);
validateNotNullableFakerComponent(component);
view.setText(String.valueOf(component.randomNumber()));
} | [
"public",
"void",
"fillWithNumber",
"(",
"TextView",
"view",
",",
"FakerNumericComponent",
"component",
")",
"{",
"validateNotNullableView",
"(",
"view",
")",
";",
"validateIfIsATextView",
"(",
"view",
")",
";",
"validateNotNullableFakerComponent",
"(",
"component",
"... | Fill a TextView with a specific FakerNumericComponent
@param view
@param component | [
"Fill",
"a",
"TextView",
"with",
"a",
"specific",
"FakerNumericComponent"
] | train | https://github.com/thiagokimo/Faker/blob/8b0eccd499817a2bc3377db0c6e1b50736d0f034/faker-core/src/main/java/io/kimo/lib/faker/Faker.java#L125-L131 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java | ServerUpdater.removeRolesFromUser | public ServerUpdater removeRolesFromUser(User user, Collection<Role> roles) {
delegate.removeRolesFromUser(user, roles);
return this;
} | java | public ServerUpdater removeRolesFromUser(User user, Collection<Role> roles) {
delegate.removeRolesFromUser(user, roles);
return this;
} | [
"public",
"ServerUpdater",
"removeRolesFromUser",
"(",
"User",
"user",
",",
"Collection",
"<",
"Role",
">",
"roles",
")",
"{",
"delegate",
".",
"removeRolesFromUser",
"(",
"user",
",",
"roles",
")",
";",
"return",
"this",
";",
"}"
] | Queues a collection of roles to be removed from the user.
@param user The server member the roles should be removed from.
@param roles The roles which should be removed from the user.
@return The current instance in order to chain call methods. | [
"Queues",
"a",
"collection",
"of",
"roles",
"to",
"be",
"removed",
"from",
"the",
"user",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L503-L506 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerManager.java | MessageControllerManager.getJsTopicMessageControllerFromIterable | JsTopicMessageController getJsTopicMessageControllerFromIterable(String topic, Iterable<JsTopicMessageController<?>> controllers) {
if(null == controllers || null == topic) {
return null;
}
for (JsTopicMessageController<?> jsTopicMessageController : controllers) {
JsTopicControls jsTopicControls = jsTopicControlsTools.getJsTopicControlsFromProxyClass(jsTopicMessageController.getClass());
if(null != jsTopicControls) {
JsTopicControl[] jsTopicControlList = jsTopicControls.value();
for (JsTopicControl jsTopicControl : jsTopicControlList) {
if(topic.equals(jsTopicControl.value())) {
logger.debug("Found messageController for topic '{}' from JsTopicControls annotation", topic);
return jsTopicMessageController;
}
}
}
}
return null;
} | java | JsTopicMessageController getJsTopicMessageControllerFromIterable(String topic, Iterable<JsTopicMessageController<?>> controllers) {
if(null == controllers || null == topic) {
return null;
}
for (JsTopicMessageController<?> jsTopicMessageController : controllers) {
JsTopicControls jsTopicControls = jsTopicControlsTools.getJsTopicControlsFromProxyClass(jsTopicMessageController.getClass());
if(null != jsTopicControls) {
JsTopicControl[] jsTopicControlList = jsTopicControls.value();
for (JsTopicControl jsTopicControl : jsTopicControlList) {
if(topic.equals(jsTopicControl.value())) {
logger.debug("Found messageController for topic '{}' from JsTopicControls annotation", topic);
return jsTopicMessageController;
}
}
}
}
return null;
} | [
"JsTopicMessageController",
"getJsTopicMessageControllerFromIterable",
"(",
"String",
"topic",
",",
"Iterable",
"<",
"JsTopicMessageController",
"<",
"?",
">",
">",
"controllers",
")",
"{",
"if",
"(",
"null",
"==",
"controllers",
"||",
"null",
"==",
"topic",
")",
... | without jdk8, @Repeatable doesn't work, so we use @JsTopicControls annotation and parse it
@param topic
@param controllers
@return | [
"without",
"jdk8"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerManager.java#L93-L110 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/types/Type.java | Type.convertToTypeJDBC | public Object convertToTypeJDBC(SessionInterface session, Object a,
Type type) {
return convertToType(session, a, type);
} | java | public Object convertToTypeJDBC(SessionInterface session, Object a,
Type type) {
return convertToType(session, a, type);
} | [
"public",
"Object",
"convertToTypeJDBC",
"(",
"SessionInterface",
"session",
",",
"Object",
"a",
",",
"Type",
"type",
")",
"{",
"return",
"convertToType",
"(",
"session",
",",
"a",
",",
"type",
")",
";",
"}"
] | Convert type for JDBC. Same as convertToType, but supports non-standard
SQL conversions supported by JDBC | [
"Convert",
"type",
"for",
"JDBC",
".",
"Same",
"as",
"convertToType",
"but",
"supports",
"non",
"-",
"standard",
"SQL",
"conversions",
"supported",
"by",
"JDBC"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/types/Type.java#L269-L272 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java | UnicodeSet.containsNone | public boolean containsNone(int start, int end) {
if (start < MIN_VALUE || start > MAX_VALUE) {
throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(start, 6));
}
if (end < MIN_VALUE || end > MAX_VALUE) {
throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(end, 6));
}
int i = -1;
while (true) {
if (start < list[++i]) break;
}
return ((i & 1) == 0 && end < list[i]);
} | java | public boolean containsNone(int start, int end) {
if (start < MIN_VALUE || start > MAX_VALUE) {
throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(start, 6));
}
if (end < MIN_VALUE || end > MAX_VALUE) {
throw new IllegalArgumentException("Invalid code point U+" + Utility.hex(end, 6));
}
int i = -1;
while (true) {
if (start < list[++i]) break;
}
return ((i & 1) == 0 && end < list[i]);
} | [
"public",
"boolean",
"containsNone",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"start",
"<",
"MIN_VALUE",
"||",
"start",
">",
"MAX_VALUE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid code point U+\"",
"+",
"Utility"... | Returns true if this set contains none of the characters
of the given range.
@param start first character, inclusive, of the range
@param end last character, inclusive, of the range
@return true if the test condition is met | [
"Returns",
"true",
"if",
"this",
"set",
"contains",
"none",
"of",
"the",
"characters",
"of",
"the",
"given",
"range",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L1993-L2005 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java | IntegralImageOps.block_unsafe | public static int block_unsafe(GrayS32 integral , int x0 , int y0 , int x1 , int y1 )
{
return ImplIntegralImageOps.block_unsafe(integral, x0, y0, x1, y1);
} | java | public static int block_unsafe(GrayS32 integral , int x0 , int y0 , int x1 , int y1 )
{
return ImplIntegralImageOps.block_unsafe(integral, x0, y0, x1, y1);
} | [
"public",
"static",
"int",
"block_unsafe",
"(",
"GrayS32",
"integral",
",",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"x1",
",",
"int",
"y1",
")",
"{",
"return",
"ImplIntegralImageOps",
".",
"block_unsafe",
"(",
"integral",
",",
"x0",
",",
"y0",
",",
... | <p>
Computes the value of a block inside an integral image without bounds checking. The block is
defined as follows: x0 < x ≤ x1 and y0 < y ≤ y1.
</p>
@param integral Integral image.
@param x0 Lower bound of the block. Exclusive.
@param y0 Lower bound of the block. Exclusive.
@param x1 Upper bound of the block. Inclusive.
@param y1 Upper bound of the block. Inclusive.
@return Value inside the block. | [
"<p",
">",
"Computes",
"the",
"value",
"of",
"a",
"block",
"inside",
"an",
"integral",
"image",
"without",
"bounds",
"checking",
".",
"The",
"block",
"is",
"defined",
"as",
"follows",
":",
"x0",
"<",
";",
"x",
"&le",
";",
"x1",
"and",
"y0",
"<",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L408-L411 |
alkacon/opencms-core | src/org/opencms/util/CmsHtmlConverter.java | CmsHtmlConverter.convertToStringSilent | public String convertToStringSilent(byte[] htmlInput) {
try {
return convertToString(htmlInput);
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e);
}
try {
return new String(htmlInput, getEncoding());
} catch (UnsupportedEncodingException e1) {
if (LOG.isWarnEnabled()) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e1);
}
return new String(htmlInput);
}
}
} | java | public String convertToStringSilent(byte[] htmlInput) {
try {
return convertToString(htmlInput);
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e);
}
try {
return new String(htmlInput, getEncoding());
} catch (UnsupportedEncodingException e1) {
if (LOG.isWarnEnabled()) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_CONVERSION_BYTE_FAILED_0), e1);
}
return new String(htmlInput);
}
}
} | [
"public",
"String",
"convertToStringSilent",
"(",
"byte",
"[",
"]",
"htmlInput",
")",
"{",
"try",
"{",
"return",
"convertToString",
"(",
"htmlInput",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"LOG",
".",
"isWarnEnabled",
"(",
")... | Converts the given HTML code according to the settings of this converter.<p>
If an any error occurs during the conversion process, the original input is returned unmodified.<p>
@param htmlInput HTML input stored in an array of bytes
@return string containing the converted HTML | [
"Converts",
"the",
"given",
"HTML",
"code",
"according",
"to",
"the",
"settings",
"of",
"this",
"converter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsHtmlConverter.java#L313-L330 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/internal/core/C4BlobStore.java | C4BlobStore.getContents | public FLSliceResult getContents(C4BlobKey blobKey) throws LiteCoreException {
return new FLSliceResult(getContents(handle, blobKey.getHandle()));
} | java | public FLSliceResult getContents(C4BlobKey blobKey) throws LiteCoreException {
return new FLSliceResult(getContents(handle, blobKey.getHandle()));
} | [
"public",
"FLSliceResult",
"getContents",
"(",
"C4BlobKey",
"blobKey",
")",
"throws",
"LiteCoreException",
"{",
"return",
"new",
"FLSliceResult",
"(",
"getContents",
"(",
"handle",
",",
"blobKey",
".",
"getHandle",
"(",
")",
")",
")",
";",
"}"
] | Reads the entire contents of a blob into memory. Caller is responsible for freeing it. | [
"Reads",
"the",
"entire",
"contents",
"of",
"a",
"blob",
"into",
"memory",
".",
"Caller",
"is",
"responsible",
"for",
"freeing",
"it",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/internal/core/C4BlobStore.java#L101-L103 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/res/XResourceBundle.java | XResourceBundle.loadResourceBundle | public static final XResourceBundle loadResourceBundle(
String className, Locale locale) throws MissingResourceException
{
String suffix = getResourceSuffix(locale);
//System.out.println("resource " + className + suffix);
try
{
// first try with the given locale
String resourceName = className + suffix;
return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale);
}
catch (MissingResourceException e)
{
try // try to fall back to en_US if we can't load
{
// Since we can't find the localized property file,
// fall back to en_US.
return (XResourceBundle) ResourceBundle.getBundle(
XSLT_RESOURCE, new Locale("en", "US"));
}
catch (MissingResourceException e2)
{
// Now we are really in trouble.
// very bad, definitely very bad...not going to get very far
throw new MissingResourceException(
"Could not load any resource bundles.", className, "");
}
}
} | java | public static final XResourceBundle loadResourceBundle(
String className, Locale locale) throws MissingResourceException
{
String suffix = getResourceSuffix(locale);
//System.out.println("resource " + className + suffix);
try
{
// first try with the given locale
String resourceName = className + suffix;
return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale);
}
catch (MissingResourceException e)
{
try // try to fall back to en_US if we can't load
{
// Since we can't find the localized property file,
// fall back to en_US.
return (XResourceBundle) ResourceBundle.getBundle(
XSLT_RESOURCE, new Locale("en", "US"));
}
catch (MissingResourceException e2)
{
// Now we are really in trouble.
// very bad, definitely very bad...not going to get very far
throw new MissingResourceException(
"Could not load any resource bundles.", className, "");
}
}
} | [
"public",
"static",
"final",
"XResourceBundle",
"loadResourceBundle",
"(",
"String",
"className",
",",
"Locale",
"locale",
")",
"throws",
"MissingResourceException",
"{",
"String",
"suffix",
"=",
"getResourceSuffix",
"(",
"locale",
")",
";",
"//System.out.println(\"reso... | Return a named ResourceBundle for a particular locale. This method mimics the behavior
of ResourceBundle.getBundle().
@param className Name of local-specific subclass.
@param locale the locale to prefer when searching for the bundle | [
"Return",
"a",
"named",
"ResourceBundle",
"for",
"a",
"particular",
"locale",
".",
"This",
"method",
"mimics",
"the",
"behavior",
"of",
"ResourceBundle",
".",
"getBundle",
"()",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/res/XResourceBundle.java#L56-L89 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readResource | public CmsResource readResource(CmsDbContext dbc, CmsUUID structureID, CmsResourceFilter filter)
throws CmsDataAccessException {
CmsUUID projectId = getProjectIdForContext(dbc);
// please note: the filter will be applied in the security manager later
CmsResource resource = getVfsDriver(dbc).readResource(dbc, projectId, structureID, filter.includeDeleted());
// context dates need to be updated
updateContextDates(dbc, resource);
// return the resource
return resource;
} | java | public CmsResource readResource(CmsDbContext dbc, CmsUUID structureID, CmsResourceFilter filter)
throws CmsDataAccessException {
CmsUUID projectId = getProjectIdForContext(dbc);
// please note: the filter will be applied in the security manager later
CmsResource resource = getVfsDriver(dbc).readResource(dbc, projectId, structureID, filter.includeDeleted());
// context dates need to be updated
updateContextDates(dbc, resource);
// return the resource
return resource;
} | [
"public",
"CmsResource",
"readResource",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"structureID",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsDataAccessException",
"{",
"CmsUUID",
"projectId",
"=",
"getProjectIdForContext",
"(",
"dbc",
")",
";",
"// pleas... | Reads a resource from the VFS, using the specified resource filter.<p>
@param dbc the current database context
@param structureID the structure id of the resource to read
@param filter the resource filter to use while reading
@return the resource that was read
@throws CmsDataAccessException if something goes wrong
@see CmsObject#readResource(CmsUUID, CmsResourceFilter)
@see CmsObject#readResource(CmsUUID) | [
"Reads",
"a",
"resource",
"from",
"the",
"VFS",
"using",
"the",
"specified",
"resource",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7645-L7657 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java | ExecutionEnvironment.createLocalEnvironment | private static LocalEnvironment createLocalEnvironment(Configuration configuration, int defaultParallelism) {
final LocalEnvironment localEnvironment = new LocalEnvironment(configuration);
if (defaultParallelism > 0) {
localEnvironment.setParallelism(defaultParallelism);
}
return localEnvironment;
} | java | private static LocalEnvironment createLocalEnvironment(Configuration configuration, int defaultParallelism) {
final LocalEnvironment localEnvironment = new LocalEnvironment(configuration);
if (defaultParallelism > 0) {
localEnvironment.setParallelism(defaultParallelism);
}
return localEnvironment;
} | [
"private",
"static",
"LocalEnvironment",
"createLocalEnvironment",
"(",
"Configuration",
"configuration",
",",
"int",
"defaultParallelism",
")",
"{",
"final",
"LocalEnvironment",
"localEnvironment",
"=",
"new",
"LocalEnvironment",
"(",
"configuration",
")",
";",
"if",
"... | Creates a {@link LocalEnvironment} which is used for executing Flink jobs.
@param configuration to start the {@link LocalEnvironment} with
@param defaultParallelism to initialize the {@link LocalEnvironment} with
@return {@link LocalEnvironment} | [
"Creates",
"a",
"{",
"@link",
"LocalEnvironment",
"}",
"which",
"is",
"used",
"for",
"executing",
"Flink",
"jobs",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L1149-L1157 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.isSubtypesUnchecked | public boolean isSubtypesUnchecked(List<Type> ts, List<Type> ss, Warner warn) {
while (ts.tail != null && ss.tail != null
/*inlined: ts.nonEmpty() && ss.nonEmpty()*/ &&
isSubtypeUnchecked(ts.head, ss.head, warn)) {
ts = ts.tail;
ss = ss.tail;
}
return ts.tail == null && ss.tail == null;
/*inlined: ts.isEmpty() && ss.isEmpty();*/
} | java | public boolean isSubtypesUnchecked(List<Type> ts, List<Type> ss, Warner warn) {
while (ts.tail != null && ss.tail != null
/*inlined: ts.nonEmpty() && ss.nonEmpty()*/ &&
isSubtypeUnchecked(ts.head, ss.head, warn)) {
ts = ts.tail;
ss = ss.tail;
}
return ts.tail == null && ss.tail == null;
/*inlined: ts.isEmpty() && ss.isEmpty();*/
} | [
"public",
"boolean",
"isSubtypesUnchecked",
"(",
"List",
"<",
"Type",
">",
"ts",
",",
"List",
"<",
"Type",
">",
"ss",
",",
"Warner",
"warn",
")",
"{",
"while",
"(",
"ts",
".",
"tail",
"!=",
"null",
"&&",
"ss",
".",
"tail",
"!=",
"null",
"/*inlined: t... | Are corresponding elements of ts subtypes of ss, allowing
unchecked conversions? If lists are of different length,
return false. | [
"Are",
"corresponding",
"elements",
"of",
"ts",
"subtypes",
"of",
"ss",
"allowing",
"unchecked",
"conversions?",
"If",
"lists",
"are",
"of",
"different",
"length",
"return",
"false",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L942-L951 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java | ServerDnsAliasesInner.beginAcquireAsync | public Observable<Void> beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) {
return beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginAcquireAsync(String resourceGroupName, String serverName, String dnsAliasName, String oldServerDnsAliasId) {
return beginAcquireWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName, oldServerDnsAliasId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginAcquireAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"dnsAliasName",
",",
"String",
"oldServerDnsAliasId",
")",
"{",
"return",
"beginAcquireWithServiceResponseAsync",
"(",
"resourc... | Acquires server DNS alias from another server.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server that the alias is pointing to.
@param dnsAliasName The name of the server dns alias.
@param oldServerDnsAliasId The id of the server alias that will be acquired to point to this server instead.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Acquires",
"server",
"DNS",
"alias",
"from",
"another",
"server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L945-L952 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphRemoveDependencies | public static int cuGraphRemoveDependencies(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numDependencies)
{
return checkResult(cuGraphRemoveDependenciesNative(hGraph, from, to, numDependencies));
} | java | public static int cuGraphRemoveDependencies(CUgraph hGraph, CUgraphNode from[], CUgraphNode to[], long numDependencies)
{
return checkResult(cuGraphRemoveDependenciesNative(hGraph, from, to, numDependencies));
} | [
"public",
"static",
"int",
"cuGraphRemoveDependencies",
"(",
"CUgraph",
"hGraph",
",",
"CUgraphNode",
"from",
"[",
"]",
",",
"CUgraphNode",
"to",
"[",
"]",
",",
"long",
"numDependencies",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphRemoveDependenciesNative",
"... | Removes dependency edges from a graph.<br>
<br>
The number of \p dependencies to be removed is defined by \p numDependencies.
Elements in \p from and \p to at corresponding indices define a dependency.
Each node in \p from and \p to must belong to \p hGraph.<br>
<br>
If \p numDependencies is 0, elements in \p from and \p to will be ignored.
Specifying a non-existing dependency will return an error.
@param hGraph - Graph from which to remove dependencies
@param from - Array of nodes that provide the dependencies
@param to - Array of dependent nodes
@param numDependencies - Number of dependencies to be removed
@return
CUDA_SUCCESS,
CUDA_ERROR_INVALID_VALUE
@see
JCudaDriver#cuGraphAddDependencies
JCudaDriver#cuGraphGetEdges
JCudaDriver#cuGraphNodeGetDependencies
JCudaDriver#cuGraphNodeGetDependentNodes | [
"Removes",
"dependency",
"edges",
"from",
"a",
"graph",
".",
"<br",
">",
"<br",
">",
"The",
"number",
"of",
"\\",
"p",
"dependencies",
"to",
"be",
"removed",
"is",
"defined",
"by",
"\\",
"p",
"numDependencies",
".",
"Elements",
"in",
"\\",
"p",
"from",
... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12880-L12883 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getCertificatePolicyAsync | public ServiceFuture<CertificatePolicy> getCertificatePolicyAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificatePolicy> serviceCallback) {
return ServiceFuture.fromResponse(getCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | java | public ServiceFuture<CertificatePolicy> getCertificatePolicyAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificatePolicy> serviceCallback) {
return ServiceFuture.fromResponse(getCertificatePolicyWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"CertificatePolicy",
">",
"getCertificatePolicyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"final",
"ServiceCallback",
"<",
"CertificatePolicy",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
... | Lists the policy for a certificate.
The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. This operation requires the certificates/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate in a given key vault.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"the",
"policy",
"for",
"a",
"certificate",
".",
"The",
"GetCertificatePolicy",
"operation",
"returns",
"the",
"specified",
"certificate",
"policy",
"resources",
"in",
"the",
"specified",
"key",
"vault",
".",
"This",
"operation",
"requires",
"the",
"certi... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7166-L7168 |
ZenHarbinger/l2fprod-properties-editor | src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java | PropertySheetTableModel.setValueAt | @Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
Item item = getPropertySheetElement(rowIndex);
if (item.isProperty()) {
if (columnIndex == VALUE_COLUMN) {
try {
item.getProperty().setValue(value);
} catch (Exception e) {
Logger.getLogger(PropertySheetTableModel.class.getName()).log(Level.SEVERE, null, e);
}
}
}
} | java | @Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
Item item = getPropertySheetElement(rowIndex);
if (item.isProperty()) {
if (columnIndex == VALUE_COLUMN) {
try {
item.getProperty().setValue(value);
} catch (Exception e) {
Logger.getLogger(PropertySheetTableModel.class.getName()).log(Level.SEVERE, null, e);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"setValueAt",
"(",
"Object",
"value",
",",
"int",
"rowIndex",
",",
"int",
"columnIndex",
")",
"{",
"Item",
"item",
"=",
"getPropertySheetElement",
"(",
"rowIndex",
")",
";",
"if",
"(",
"item",
".",
"isProperty",
"(",
")",... | Sets the value at the specified row and column. This will have no effect
unless the row is a property and the column is {@link #VALUE_COLUMN}.
@param value
@param rowIndex
@param columnIndex
@see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int) | [
"Sets",
"the",
"value",
"at",
"the",
"specified",
"row",
"and",
"column",
".",
"This",
"will",
"have",
"no",
"effect",
"unless",
"the",
"row",
"is",
"a",
"property",
"and",
"the",
"column",
"is",
"{",
"@link",
"#VALUE_COLUMN",
"}",
"."
] | train | https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java#L382-L394 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java | SibTr.formatBytes | public static String formatBytes (byte[] data, int start, int count) {
return formatBytes(data, start, count, true);
} | java | public static String formatBytes (byte[] data, int start, int count) {
return formatBytes(data, start, count, true);
} | [
"public",
"static",
"String",
"formatBytes",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"start",
",",
"int",
"count",
")",
"{",
"return",
"formatBytes",
"(",
"data",
",",
"start",
",",
"count",
",",
"true",
")",
";",
"}"
] | Produce a formatted view of a byte array. Duplicate output lines are
suppressed to save space.
Formatting of the byte array starts at the specified position and continues
for the specified number of bytes or the end of the data.
<p>
@param data the byte array to be formatted
@param start position to start formatting the byte array
@param count of bytes from start position that should be formatted
@return the formatted byte array | [
"Produce",
"a",
"formatted",
"view",
"of",
"a",
"byte",
"array",
".",
"Duplicate",
"output",
"lines",
"are",
"suppressed",
"to",
"save",
"space",
".",
"Formatting",
"of",
"the",
"byte",
"array",
"starts",
"at",
"the",
"specified",
"position",
"and",
"continu... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.utils/src/com/ibm/ws/sib/utils/ras/SibTr.java#L1440-L1442 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java | Annotation.getClassAccessors | public static JMapAccessor getClassAccessors(Class<?> clazz, String fieldName, boolean isOpposite){
return getAccessor(clazz, clazz.getAnnotations(),fieldName,isOpposite);
} | java | public static JMapAccessor getClassAccessors(Class<?> clazz, String fieldName, boolean isOpposite){
return getAccessor(clazz, clazz.getAnnotations(),fieldName,isOpposite);
} | [
"public",
"static",
"JMapAccessor",
"getClassAccessors",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
",",
"boolean",
"isOpposite",
")",
"{",
"return",
"getAccessor",
"(",
"clazz",
",",
"clazz",
".",
"getAnnotations",
"(",
")",
",",
"fie... | Checks if this field contains a definition of accessors for the name given as input.
@param clazz class to check
@param fieldName name to find
@param isOpposite true if accessor methods to check belong to the opposite field, false otherwise
@return JMapAccessor if exists, null otherwise | [
"Checks",
"if",
"this",
"field",
"contains",
"a",
"definition",
"of",
"accessors",
"for",
"the",
"name",
"given",
"as",
"input",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java#L131-L133 |
google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.constantCss | public static SanitizedContent constantCss(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.CSS, Dir.LTR);
} | java | public static SanitizedContent constantCss(@CompileTimeConstant final String constant) {
return fromConstant(constant, ContentKind.CSS, Dir.LTR);
} | [
"public",
"static",
"SanitizedContent",
"constantCss",
"(",
"@",
"CompileTimeConstant",
"final",
"String",
"constant",
")",
"{",
"return",
"fromConstant",
"(",
"constant",
",",
"ContentKind",
".",
"CSS",
",",
"Dir",
".",
"LTR",
")",
";",
"}"
] | Wraps an assumed-safe CSS constant.
<p>This only accepts compile-time constants, based on the assumption that CSSes that are
controlled by the application (and not user input) are considered safe. | [
"Wraps",
"an",
"assumed",
"-",
"safe",
"CSS",
"constant",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L218-L220 |
astrapi69/jaulp-wicket | jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketImageExtensions.java | WicketImageExtensions.getNonCachingImage | public static NonCachingImage getNonCachingImage(final String wicketId,
final String contentType, final Byte[] data)
{
final byte[] byteArrayData = ArrayUtils.toPrimitive(data);
return getNonCachingImage(wicketId, contentType, byteArrayData);
} | java | public static NonCachingImage getNonCachingImage(final String wicketId,
final String contentType, final Byte[] data)
{
final byte[] byteArrayData = ArrayUtils.toPrimitive(data);
return getNonCachingImage(wicketId, contentType, byteArrayData);
} | [
"public",
"static",
"NonCachingImage",
"getNonCachingImage",
"(",
"final",
"String",
"wicketId",
",",
"final",
"String",
"contentType",
",",
"final",
"Byte",
"[",
"]",
"data",
")",
"{",
"final",
"byte",
"[",
"]",
"byteArrayData",
"=",
"ArrayUtils",
".",
"toPri... | Gets a non caching image from the given wicketId, contentType and the Byte array data.
@param wicketId
the id from the image for the html template.
@param contentType
the content type of the image.
@param data
the data for the image as an Byte array.
@return the non caching image | [
"Gets",
"a",
"non",
"caching",
"image",
"from",
"the",
"given",
"wicketId",
"contentType",
"and",
"the",
"Byte",
"array",
"data",
"."
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/WicketImageExtensions.java#L94-L99 |
Bedework/bw-util | bw-util-misc/src/main/java/org/bedework/util/misc/Util.java | Util.getList | public static List<String> getList(final String val, final boolean emptyOk) throws Throwable {
List<String> l = new LinkedList<String>();
if ((val == null) || (val.length() == 0)) {
return l;
}
StringTokenizer st = new StringTokenizer(val, ",", false);
while (st.hasMoreTokens()) {
String token = st.nextToken().trim();
if ((token == null) || (token.length() == 0)) {
if (!emptyOk) {
// No empty strings
throw new Exception("List has an empty element.");
}
l.add("");
} else {
// Got non-empty element
l.add(token);
}
}
return l;
} | java | public static List<String> getList(final String val, final boolean emptyOk) throws Throwable {
List<String> l = new LinkedList<String>();
if ((val == null) || (val.length() == 0)) {
return l;
}
StringTokenizer st = new StringTokenizer(val, ",", false);
while (st.hasMoreTokens()) {
String token = st.nextToken().trim();
if ((token == null) || (token.length() == 0)) {
if (!emptyOk) {
// No empty strings
throw new Exception("List has an empty element.");
}
l.add("");
} else {
// Got non-empty element
l.add(token);
}
}
return l;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getList",
"(",
"final",
"String",
"val",
",",
"final",
"boolean",
"emptyOk",
")",
"throws",
"Throwable",
"{",
"List",
"<",
"String",
">",
"l",
"=",
"new",
"LinkedList",
"<",
"String",
">",
"(",
")",
";",... | Turn a comma separated list into a List.
Throws exception for invalid list.
@param val String comma separated list
@param emptyOk Empty elements are OK
@return List of elements, never null
@throws Throwable for invalid list | [
"Turn",
"a",
"comma",
"separated",
"list",
"into",
"a",
"List",
".",
"Throws",
"exception",
"for",
"invalid",
"list",
"."
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-misc/src/main/java/org/bedework/util/misc/Util.java#L696-L721 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java | WikipediaTemplateInfo.getPageIdsNotContainingTemplateFragments | public List<Integer> getPageIdsNotContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{
return getFragmentFilteredPageIds(templateFragments,false);
} | java | public List<Integer> getPageIdsNotContainingTemplateFragments(List<String> templateFragments) throws WikiApiException{
return getFragmentFilteredPageIds(templateFragments,false);
} | [
"public",
"List",
"<",
"Integer",
">",
"getPageIdsNotContainingTemplateFragments",
"(",
"List",
"<",
"String",
">",
"templateFragments",
")",
"throws",
"WikiApiException",
"{",
"return",
"getFragmentFilteredPageIds",
"(",
"templateFragments",
",",
"false",
")",
";",
"... | Returns a list containing the ids of all pages that contain a
template the name of which starts with any of the given Strings.
@param templateFragments
the beginning of the templates that have to be matched
@return An list with the ids of the pages that do not contain templates
beginning with any String in templateFragments
@throws WikiApiException
If there was any error retrieving the page object (most
likely if the template templates are corrupted) | [
"Returns",
"a",
"list",
"containing",
"the",
"ids",
"of",
"all",
"pages",
"that",
"contain",
"a",
"template",
"the",
"name",
"of",
"which",
"starts",
"with",
"any",
"of",
"the",
"given",
"Strings",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L721-L723 |
dwdyer/watchmaker | examples/src/java/main/org/uncommons/watchmaker/examples/sudoku/SudokuApplet.java | SudokuApplet.createTask | private SwingBackgroundTask<Sudoku> createTask(final String[] puzzle,
final int populationSize,
final int eliteCount)
{
return new SwingBackgroundTask<Sudoku>()
{
@Override
protected Sudoku performTask()
{
Random rng = new MersenneTwisterRNG();
List<EvolutionaryOperator<Sudoku>> operators = new ArrayList<EvolutionaryOperator<Sudoku>>(2);
// Cross-over rows between parents (so offspring is x rows from parent1 and
// y rows from parent2).
operators.add(new SudokuVerticalCrossover());
// Mutate the order of cells within individual rows.
operators.add(new SudokuRowMutation(new PoissonGenerator(2, rng),
new DiscreteUniformGenerator(1, 8, rng)));
EvolutionaryOperator<Sudoku> pipeline = new EvolutionPipeline<Sudoku>(operators);
EvolutionEngine<Sudoku> engine = new GenerationalEvolutionEngine<Sudoku>(new SudokuFactory(puzzle),
pipeline,
new SudokuEvaluator(),
selectionStrategy,
rng);
engine.addEvolutionObserver(new SwingEvolutionObserver<Sudoku>(new GridViewUpdater(),
100,
TimeUnit.MILLISECONDS));
engine.addEvolutionObserver(statusBar);
return engine.evolve(populationSize,
eliteCount,
new TargetFitness(0, false), // Continue until a perfect solution is found...
abortControl.getTerminationCondition()); // ...or the user aborts.
}
@Override
protected void postProcessing(Sudoku result)
{
puzzleCombo.setEnabled(true);
populationSizeSpinner.setEnabled(true);
solveButton.setEnabled(true);
abortControl.getControl().setEnabled(false);
}
};
} | java | private SwingBackgroundTask<Sudoku> createTask(final String[] puzzle,
final int populationSize,
final int eliteCount)
{
return new SwingBackgroundTask<Sudoku>()
{
@Override
protected Sudoku performTask()
{
Random rng = new MersenneTwisterRNG();
List<EvolutionaryOperator<Sudoku>> operators = new ArrayList<EvolutionaryOperator<Sudoku>>(2);
// Cross-over rows between parents (so offspring is x rows from parent1 and
// y rows from parent2).
operators.add(new SudokuVerticalCrossover());
// Mutate the order of cells within individual rows.
operators.add(new SudokuRowMutation(new PoissonGenerator(2, rng),
new DiscreteUniformGenerator(1, 8, rng)));
EvolutionaryOperator<Sudoku> pipeline = new EvolutionPipeline<Sudoku>(operators);
EvolutionEngine<Sudoku> engine = new GenerationalEvolutionEngine<Sudoku>(new SudokuFactory(puzzle),
pipeline,
new SudokuEvaluator(),
selectionStrategy,
rng);
engine.addEvolutionObserver(new SwingEvolutionObserver<Sudoku>(new GridViewUpdater(),
100,
TimeUnit.MILLISECONDS));
engine.addEvolutionObserver(statusBar);
return engine.evolve(populationSize,
eliteCount,
new TargetFitness(0, false), // Continue until a perfect solution is found...
abortControl.getTerminationCondition()); // ...or the user aborts.
}
@Override
protected void postProcessing(Sudoku result)
{
puzzleCombo.setEnabled(true);
populationSizeSpinner.setEnabled(true);
solveButton.setEnabled(true);
abortControl.getControl().setEnabled(false);
}
};
} | [
"private",
"SwingBackgroundTask",
"<",
"Sudoku",
">",
"createTask",
"(",
"final",
"String",
"[",
"]",
"puzzle",
",",
"final",
"int",
"populationSize",
",",
"final",
"int",
"eliteCount",
")",
"{",
"return",
"new",
"SwingBackgroundTask",
"<",
"Sudoku",
">",
"(",... | Helper method to create a background task for running the interactive evolutionary
algorithm.
@return A Swing task that will execute on a background thread and update
the GUI when it is done. | [
"Helper",
"method",
"to",
"create",
"a",
"background",
"task",
"for",
"running",
"the",
"interactive",
"evolutionary",
"algorithm",
"."
] | train | https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/examples/src/java/main/org/uncommons/watchmaker/examples/sudoku/SudokuApplet.java#L206-L251 |
lucee/Lucee | core/src/main/java/lucee/commons/date/JREDateTimeUtil.java | JREDateTimeUtil.getThreadCalendar | public static Calendar getThreadCalendar(Locale l, TimeZone tz) {
if (tz == null) tz = ThreadLocalPageContext.getTimeZone();
Calendar c = localeCalendar.get(tz, l);
c.setTimeZone(tz);
return c;
} | java | public static Calendar getThreadCalendar(Locale l, TimeZone tz) {
if (tz == null) tz = ThreadLocalPageContext.getTimeZone();
Calendar c = localeCalendar.get(tz, l);
c.setTimeZone(tz);
return c;
} | [
"public",
"static",
"Calendar",
"getThreadCalendar",
"(",
"Locale",
"l",
",",
"TimeZone",
"tz",
")",
"{",
"if",
"(",
"tz",
"==",
"null",
")",
"tz",
"=",
"ThreadLocalPageContext",
".",
"getTimeZone",
"(",
")",
";",
"Calendar",
"c",
"=",
"localeCalendar",
".... | important:this function returns always the same instance for a specific thread, so make sure only
use one thread calendar instance at time.
@return calendar instance | [
"important",
":",
"this",
"function",
"returns",
"always",
"the",
"same",
"instance",
"for",
"a",
"specific",
"thread",
"so",
"make",
"sure",
"only",
"use",
"one",
"thread",
"calendar",
"instance",
"at",
"time",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/date/JREDateTimeUtil.java#L289-L294 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java | FieldBuilder.buildFieldComments | public void buildFieldComments(XMLNode node, Content fieldDocTree) {
if (!configuration.nocomment) {
writer.addComments((FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
}
} | java | public void buildFieldComments(XMLNode node, Content fieldDocTree) {
if (!configuration.nocomment) {
writer.addComments((FieldDoc) fields.get(currentFieldIndex), fieldDocTree);
}
} | [
"public",
"void",
"buildFieldComments",
"(",
"XMLNode",
"node",
",",
"Content",
"fieldDocTree",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"nocomment",
")",
"{",
"writer",
".",
"addComments",
"(",
"(",
"FieldDoc",
")",
"fields",
".",
"get",
"(",
"curr... | Build the comments for the field. Do nothing if
{@link Configuration#nocomment} is set to true.
@param node the XML element that specifies which components to document
@param fieldDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"comments",
"for",
"the",
"field",
".",
"Do",
"nothing",
"if",
"{",
"@link",
"Configuration#nocomment",
"}",
"is",
"set",
"to",
"true",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java#L204-L208 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/FileUtils.java | FileUtils.setFragment | @Deprecated
public static String setFragment(final String path, final String fragment) {
final int i = path.indexOf(SHARP);
final String p = i != -1 ? path.substring(0, i) : path;
return p + (fragment != null ? (SHARP + fragment) : "");
} | java | @Deprecated
public static String setFragment(final String path, final String fragment) {
final int i = path.indexOf(SHARP);
final String p = i != -1 ? path.substring(0, i) : path;
return p + (fragment != null ? (SHARP + fragment) : "");
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"setFragment",
"(",
"final",
"String",
"path",
",",
"final",
"String",
"fragment",
")",
"{",
"final",
"int",
"i",
"=",
"path",
".",
"indexOf",
"(",
"SHARP",
")",
";",
"final",
"String",
"p",
"=",
"i",
"!... | Set fragment
@param path path
@param fragment new fragment, may be {@code null}
@return path with new fragment | [
"Set",
"fragment"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L567-L572 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/ComponentAPI.java | ComponentAPI.safeBindcomponent | public static String safeBindcomponent(String component_appid, String pre_auth_code, String redirect_uri, String auth_type) {
try {
StringBuilder sb = new StringBuilder();
sb.append(MP_URI + "/safe/bindcomponent?")
.append("action=").append("bindcomponent")
.append("&auth_type=").append(auth_type)
.append("&no_scan=").append("1")
.append("&component_appid=").append(component_appid)
.append("&pre_auth_code=").append(pre_auth_code)
.append("&redirect_uri=").append(URLEncoder.encode(redirect_uri, "utf-8"));
return sb.toString();
} catch (UnsupportedEncodingException e) {
logger.error("", e);
throw new RuntimeException(e);
}
} | java | public static String safeBindcomponent(String component_appid, String pre_auth_code, String redirect_uri, String auth_type) {
try {
StringBuilder sb = new StringBuilder();
sb.append(MP_URI + "/safe/bindcomponent?")
.append("action=").append("bindcomponent")
.append("&auth_type=").append(auth_type)
.append("&no_scan=").append("1")
.append("&component_appid=").append(component_appid)
.append("&pre_auth_code=").append(pre_auth_code)
.append("&redirect_uri=").append(URLEncoder.encode(redirect_uri, "utf-8"));
return sb.toString();
} catch (UnsupportedEncodingException e) {
logger.error("", e);
throw new RuntimeException(e);
}
} | [
"public",
"static",
"String",
"safeBindcomponent",
"(",
"String",
"component_appid",
",",
"String",
"pre_auth_code",
",",
"String",
"redirect_uri",
",",
"String",
"auth_type",
")",
"{",
"try",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";... | 生成移动端快速授权URL
@since 2.8.22
@param component_appid 第三方平台ID
@param pre_auth_code 预授权码
@param redirect_uri 重定向URI
@param auth_type 要授权的帐号类型 <br>
1 则商户扫码后,手机端仅展示公众号 <br>
2 表示仅展示小程序 <br>
3 表示公众号和小程序都展示。<br>
如果为未制定,则默认小程序和公众号都展示。第三方平台开发者可以使用本字段来控制授权的帐号类型。
@return URL | [
"生成移动端快速授权URL"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ComponentAPI.java#L82-L98 |
icode/ameba | src/main/java/ameba/mvc/template/internal/TemplateHelper.java | TemplateHelper.getBasePath | public static String getBasePath(Map<String, Object> properties, String cfgSuffix) {
String basePath = PropertiesHelper.getValue(properties,
MvcFeature.TEMPLATE_BASE_PATH + "." + cfgSuffix, String.class, null);
if (basePath == null) {
basePath = PropertiesHelper.getValue(properties, MvcFeature.TEMPLATE_BASE_PATH, "", null);
}
return basePath;
} | java | public static String getBasePath(Map<String, Object> properties, String cfgSuffix) {
String basePath = PropertiesHelper.getValue(properties,
MvcFeature.TEMPLATE_BASE_PATH + "." + cfgSuffix, String.class, null);
if (basePath == null) {
basePath = PropertiesHelper.getValue(properties, MvcFeature.TEMPLATE_BASE_PATH, "", null);
}
return basePath;
} | [
"public",
"static",
"String",
"getBasePath",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"cfgSuffix",
")",
"{",
"String",
"basePath",
"=",
"PropertiesHelper",
".",
"getValue",
"(",
"properties",
",",
"MvcFeature",
".",
"TEMPLATE... | <p>getBasePath.</p>
@param properties a {@link java.util.Map} object.
@param cfgSuffix a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"<p",
">",
"getBasePath",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/mvc/template/internal/TemplateHelper.java#L259-L266 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addCompositeEntityAsync | public Observable<UUID> addCompositeEntityAsync(UUID appId, String versionId, CompositeEntityModel compositeModelCreateObject) {
return addCompositeEntityWithServiceResponseAsync(appId, versionId, compositeModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | java | public Observable<UUID> addCompositeEntityAsync(UUID appId, String versionId, CompositeEntityModel compositeModelCreateObject) {
return addCompositeEntityWithServiceResponseAsync(appId, versionId, compositeModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UUID",
">",
"addCompositeEntityAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"CompositeEntityModel",
"compositeModelCreateObject",
")",
"{",
"return",
"addCompositeEntityWithServiceResponseAsync",
"(",
"appId",
",",
"versionI... | Adds a composite entity extractor to the application.
@param appId The application ID.
@param versionId The version ID.
@param compositeModelCreateObject A model containing the name and children of the new entity extractor.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Adds",
"a",
"composite",
"entity",
"extractor",
"to",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1577-L1584 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java | IDNA.convertIDNToUnicode | @Deprecated
public static StringBuffer convertIDNToUnicode(StringBuffer src, int options)
throws StringPrepParseException{
return convertIDNToUnicode(src.toString(), options);
} | java | @Deprecated
public static StringBuffer convertIDNToUnicode(StringBuffer src, int options)
throws StringPrepParseException{
return convertIDNToUnicode(src.toString(), options);
} | [
"@",
"Deprecated",
"public",
"static",
"StringBuffer",
"convertIDNToUnicode",
"(",
"StringBuffer",
"src",
",",
"int",
"options",
")",
"throws",
"StringPrepParseException",
"{",
"return",
"convertIDNToUnicode",
"(",
"src",
".",
"toString",
"(",
")",
",",
"options",
... | IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC.
This operation is done on complete domain names, e.g: "www.example.com".
<b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name
into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
and then convert. This function does not offer that level of granularity. The options once
set will apply to all labels in the domain name
@param src The input string as StringBuffer to be processed
@param options A bit set of options:
- IDNA.DEFAULT Use default options, i.e., do not process unassigned code points
and do not use STD3 ASCII rules
If unassigned code points are found the operation fails with
ParseException.
- IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
If this option is set, the unassigned code points are in the input
are treated as normal Unicode code points.
- IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
If this option is set and the input does not satisfy STD3 rules,
the operation will fail with ParseException
@return StringBuffer the converted String
@deprecated ICU 55 Use UTS 46 instead via {@link #getUTS46Instance(int)}.
@hide original deprecated declaration | [
"IDNA2003",
":",
"Convenience",
"function",
"that",
"implements",
"the",
"IDNToUnicode",
"operation",
"as",
"defined",
"in",
"the",
"IDNA",
"RFC",
".",
"This",
"operation",
"is",
"done",
"on",
"complete",
"domain",
"names",
"e",
".",
"g",
":",
"www",
".",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java#L813-L817 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/portal/MithraTransactionalPortal.java | MithraTransactionalPortal.checkTransactionParticipationAndWaitForOtherTransactions | private List checkTransactionParticipationAndWaitForOtherTransactions(List list, MithraTransaction tx)
{
if (list == null) return null;
List result = list;
if (this.getTxParticipationMode(tx).mustParticipateInTxOnRead())
{
for(int i=0;i<list.size();i++)
{
MithraTransactionalObject mto = (MithraTransactionalObject) list.get(i);
if (!mto.zIsParticipatingInTransaction(tx))
{
result = null;
mto.zWaitForExclusiveWriteTx(tx);
}
}
}
return result;
} | java | private List checkTransactionParticipationAndWaitForOtherTransactions(List list, MithraTransaction tx)
{
if (list == null) return null;
List result = list;
if (this.getTxParticipationMode(tx).mustParticipateInTxOnRead())
{
for(int i=0;i<list.size();i++)
{
MithraTransactionalObject mto = (MithraTransactionalObject) list.get(i);
if (!mto.zIsParticipatingInTransaction(tx))
{
result = null;
mto.zWaitForExclusiveWriteTx(tx);
}
}
}
return result;
} | [
"private",
"List",
"checkTransactionParticipationAndWaitForOtherTransactions",
"(",
"List",
"list",
",",
"MithraTransaction",
"tx",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"return",
"null",
";",
"List",
"result",
"=",
"list",
";",
"if",
"(",
"this",
".... | /* returns null if the members of the list are not all participating in the transaction | [
"/",
"*",
"returns",
"null",
"if",
"the",
"members",
"of",
"the",
"list",
"are",
"not",
"all",
"participating",
"in",
"the",
"transaction"
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/portal/MithraTransactionalPortal.java#L346-L363 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java | SVGHyperCube.drawFilled | public static Element drawFilled(SVGPlot svgp, String cls, Projection2D proj, SpatialComparable box) {
Element group = svgp.svgElement(SVGConstants.SVG_G_TAG);
ArrayList<double[]> edges = getVisibleEdges(proj, box);
final int dim = box.getDimensionality();
double[] min = new double[dim];
for(int i = 0; i < dim; i++) {
min[i] = box.getMin(i);
}
double[] rv_min = proj.fastProjectDataToRenderSpace(min);
recDrawSides(svgp, group, cls, rv_min[0], rv_min[1], edges, 0, BitsUtil.zero(edges.size()));
return group;
} | java | public static Element drawFilled(SVGPlot svgp, String cls, Projection2D proj, SpatialComparable box) {
Element group = svgp.svgElement(SVGConstants.SVG_G_TAG);
ArrayList<double[]> edges = getVisibleEdges(proj, box);
final int dim = box.getDimensionality();
double[] min = new double[dim];
for(int i = 0; i < dim; i++) {
min[i] = box.getMin(i);
}
double[] rv_min = proj.fastProjectDataToRenderSpace(min);
recDrawSides(svgp, group, cls, rv_min[0], rv_min[1], edges, 0, BitsUtil.zero(edges.size()));
return group;
} | [
"public",
"static",
"Element",
"drawFilled",
"(",
"SVGPlot",
"svgp",
",",
"String",
"cls",
",",
"Projection2D",
"proj",
",",
"SpatialComparable",
"box",
")",
"{",
"Element",
"group",
"=",
"svgp",
".",
"svgElement",
"(",
"SVGConstants",
".",
"SVG_G_TAG",
")",
... | Filled hypercube.
@param svgp SVG Plot
@param cls CSS class to use.
@param proj Visualization projection
@param box Bounding box
@return group element | [
"Filled",
"hypercube",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGHyperCube.java#L152-L163 |
JodaOrg/joda-time | src/main/java/org/joda/time/Interval.java | Interval.withDurationAfterStart | public Interval withDurationAfterStart(ReadableDuration duration) {
long durationMillis = DateTimeUtils.getDurationMillis(duration);
if (durationMillis == toDurationMillis()) {
return this;
}
Chronology chrono = getChronology();
long startMillis = getStartMillis();
long endMillis = chrono.add(startMillis, durationMillis, 1);
return new Interval(startMillis, endMillis, chrono);
} | java | public Interval withDurationAfterStart(ReadableDuration duration) {
long durationMillis = DateTimeUtils.getDurationMillis(duration);
if (durationMillis == toDurationMillis()) {
return this;
}
Chronology chrono = getChronology();
long startMillis = getStartMillis();
long endMillis = chrono.add(startMillis, durationMillis, 1);
return new Interval(startMillis, endMillis, chrono);
} | [
"public",
"Interval",
"withDurationAfterStart",
"(",
"ReadableDuration",
"duration",
")",
"{",
"long",
"durationMillis",
"=",
"DateTimeUtils",
".",
"getDurationMillis",
"(",
"duration",
")",
";",
"if",
"(",
"durationMillis",
"==",
"toDurationMillis",
"(",
")",
")",
... | Creates a new interval with the specified duration after the start instant.
@param duration the duration to add to the start to get the new end instant, null means zero
@return an interval with the start from this interval and a calculated end
@throws IllegalArgumentException if the duration is negative | [
"Creates",
"a",
"new",
"interval",
"with",
"the",
"specified",
"duration",
"after",
"the",
"start",
"instant",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Interval.java#L498-L507 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java | SPUIComponentProvider.createLastModifiedByLabel | public static Label createLastModifiedByLabel(final VaadinMessageSource i18n, final BaseEntity baseEntity) {
return createUsernameLabel(i18n.getMessage("label.modified.by"),
baseEntity == null ? "" : baseEntity.getLastModifiedBy());
} | java | public static Label createLastModifiedByLabel(final VaadinMessageSource i18n, final BaseEntity baseEntity) {
return createUsernameLabel(i18n.getMessage("label.modified.by"),
baseEntity == null ? "" : baseEntity.getLastModifiedBy());
} | [
"public",
"static",
"Label",
"createLastModifiedByLabel",
"(",
"final",
"VaadinMessageSource",
"i18n",
",",
"final",
"BaseEntity",
"baseEntity",
")",
"{",
"return",
"createUsernameLabel",
"(",
"i18n",
".",
"getMessage",
"(",
"\"label.modified.by\"",
")",
",",
"baseEnt... | Create label which represents the {@link BaseEntity#getLastModifiedBy()}
by user name
@param i18n
the i18n
@param baseEntity
the entity
@return the label | [
"Create",
"label",
"which",
"represents",
"the",
"{",
"@link",
"BaseEntity#getLastModifiedBy",
"()",
"}",
"by",
"user",
"name"
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java#L248-L251 |
kaazing/java.client | ws/ws/src/main/java/org/kaazing/gateway/client/impl/util/WebSocketUtil.java | WebSocketUtil.encodeLength | public static void encodeLength(ByteArrayOutputStream out, int length) {
LOG.entering(CLASS_NAME, "encodeLength", new Object[] { out, length });
int byteCount = 0;
long encodedLength = 0;
do {
// left shift one byte to make room for new data
encodedLength <<= 8;
// set 7 bits of length
encodedLength |= (byte) (length & 0x7f);
// right shift out the 7 bits we just set
length >>= 7;
// increment the byte count that we need to encode
byteCount++;
}
// continue if there are remaining set length bits
while (length > 0);
do {
// get byte from encoded length
byte encodedByte = (byte) (encodedLength & 0xff);
// right shift encoded length past byte we just got
encodedLength >>= 8;
// The last length byte does not have the highest bit set
if (byteCount != 1) {
// set highest bit if this is not the last
encodedByte |= (byte) 0x80;
}
// write encoded byte
out.write(encodedByte);
}
// decrement and continue if we have more bytes left
while (--byteCount > 0);
} | java | public static void encodeLength(ByteArrayOutputStream out, int length) {
LOG.entering(CLASS_NAME, "encodeLength", new Object[] { out, length });
int byteCount = 0;
long encodedLength = 0;
do {
// left shift one byte to make room for new data
encodedLength <<= 8;
// set 7 bits of length
encodedLength |= (byte) (length & 0x7f);
// right shift out the 7 bits we just set
length >>= 7;
// increment the byte count that we need to encode
byteCount++;
}
// continue if there are remaining set length bits
while (length > 0);
do {
// get byte from encoded length
byte encodedByte = (byte) (encodedLength & 0xff);
// right shift encoded length past byte we just got
encodedLength >>= 8;
// The last length byte does not have the highest bit set
if (byteCount != 1) {
// set highest bit if this is not the last
encodedByte |= (byte) 0x80;
}
// write encoded byte
out.write(encodedByte);
}
// decrement and continue if we have more bytes left
while (--byteCount > 0);
} | [
"public",
"static",
"void",
"encodeLength",
"(",
"ByteArrayOutputStream",
"out",
",",
"int",
"length",
")",
"{",
"LOG",
".",
"entering",
"(",
"CLASS_NAME",
",",
"\"encodeLength\"",
",",
"new",
"Object",
"[",
"]",
"{",
"out",
",",
"length",
"}",
")",
";",
... | /*
Length-bytes are written out in order from most to least significant, but are computed most efficiently (using bit shifts)
from least to most significant. An integer serves as a temporary storage, which is then written out in reversed order. | [
"/",
"*",
"Length",
"-",
"bytes",
"are",
"written",
"out",
"in",
"order",
"from",
"most",
"to",
"least",
"significant",
"but",
"are",
"computed",
"most",
"efficiently",
"(",
"using",
"bit",
"shifts",
")",
"from",
"least",
"to",
"most",
"significant",
".",
... | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/impl/util/WebSocketUtil.java#L38-L71 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/models/RetryStrategy.java | RetryStrategy.doWait | private void doWait( int currentTries, long optDuration_ms )
{
if ( optDuration_ms < 0 ) {
optDuration_ms = ( long ) ( firstSleep_ms * ( Math.random() + 0.5 ) * ( 1L << ( currentTries - 1 ) ) );
}
LOGGER.debug( "Will retry request after {} millis", optDuration_ms );
try {
Thread.sleep( optDuration_ms );
} catch ( InterruptedException ex ) {
throw new CStorageException( "Retry waiting interrupted", ex );
}
} | java | private void doWait( int currentTries, long optDuration_ms )
{
if ( optDuration_ms < 0 ) {
optDuration_ms = ( long ) ( firstSleep_ms * ( Math.random() + 0.5 ) * ( 1L << ( currentTries - 1 ) ) );
}
LOGGER.debug( "Will retry request after {} millis", optDuration_ms );
try {
Thread.sleep( optDuration_ms );
} catch ( InterruptedException ex ) {
throw new CStorageException( "Retry waiting interrupted", ex );
}
} | [
"private",
"void",
"doWait",
"(",
"int",
"currentTries",
",",
"long",
"optDuration_ms",
")",
"{",
"if",
"(",
"optDuration_ms",
"<",
"0",
")",
"{",
"optDuration_ms",
"=",
"(",
"long",
")",
"(",
"firstSleep_ms",
"*",
"(",
"Math",
".",
"random",
"(",
")",
... | Sleeps before retry ; default implementation is exponential back-off, or the specified duration
@param currentTries 1 after first fail, then 2, 3 ... up to nbTriesMax-1.
@param optDuration_ms if positive, the delay to apply | [
"Sleeps",
"before",
"retry",
";",
"default",
"implementation",
"is",
"exponential",
"back",
"-",
"off",
"or",
"the",
"specified",
"duration"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/RetryStrategy.java#L93-L106 |
Azure/azure-sdk-for-java | sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java | ManagedInstanceVulnerabilityAssessmentsInner.createOrUpdate | public ManagedInstanceVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body();
} | java | public ManagedInstanceVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceVulnerabilityAssessmentInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body();
} | [
"public",
"ManagedInstanceVulnerabilityAssessmentInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"ManagedInstanceVulnerabilityAssessmentInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
... | Creates or updates the managed instance's vulnerability assessment.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance for which the vulnerability assessment is defined.
@param parameters The requested resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ManagedInstanceVulnerabilityAssessmentInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"managed",
"instance",
"s",
"vulnerability",
"assessment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java#L185-L187 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java | AbstractEntityReader.setRelationToEntity | private void setRelationToEntity(Object entity, Object relationEntity, Relation relation)
{
if (relation.getTargetEntity().isAssignableFrom(getEntity(relationEntity).getClass()))
{
if (relation.isUnary())
{
PropertyAccessorHelper.set(entity, relation.getProperty(), getEntity(relationEntity));
}
else
{
Object associationObject = PropertyAccessorHelper.getObject(entity, relation.getProperty());
if (associationObject == null || ProxyHelper.isProxyOrCollection(associationObject))
{
associationObject = PropertyAccessorHelper.getCollectionInstance(relation.getProperty());
PropertyAccessorHelper.set(entity, relation.getProperty(), associationObject);
}
((Collection) associationObject).add(getEntity(relationEntity));
}
}
} | java | private void setRelationToEntity(Object entity, Object relationEntity, Relation relation)
{
if (relation.getTargetEntity().isAssignableFrom(getEntity(relationEntity).getClass()))
{
if (relation.isUnary())
{
PropertyAccessorHelper.set(entity, relation.getProperty(), getEntity(relationEntity));
}
else
{
Object associationObject = PropertyAccessorHelper.getObject(entity, relation.getProperty());
if (associationObject == null || ProxyHelper.isProxyOrCollection(associationObject))
{
associationObject = PropertyAccessorHelper.getCollectionInstance(relation.getProperty());
PropertyAccessorHelper.set(entity, relation.getProperty(), associationObject);
}
((Collection) associationObject).add(getEntity(relationEntity));
}
}
} | [
"private",
"void",
"setRelationToEntity",
"(",
"Object",
"entity",
",",
"Object",
"relationEntity",
",",
"Relation",
"relation",
")",
"{",
"if",
"(",
"relation",
".",
"getTargetEntity",
"(",
")",
".",
"isAssignableFrom",
"(",
"getEntity",
"(",
"relationEntity",
... | After successfully parsing set relational entity object within entity
object.
@param entity
@param relationEntity
@param relation | [
"After",
"successfully",
"parsing",
"set",
"relational",
"entity",
"object",
"within",
"entity",
"object",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java#L276-L297 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.getSpringExpressionParser | public SpringELExpressionParser getSpringExpressionParser() {
val configuration = new SpelParserConfiguration();
val spelExpressionParser = new SpelExpressionParser(configuration);
val parser = new SpringELExpressionParser(spelExpressionParser, this.flowBuilderServices.getConversionService());
parser.addPropertyAccessor(new ActionPropertyAccessor());
parser.addPropertyAccessor(new BeanFactoryPropertyAccessor());
parser.addPropertyAccessor(new FlowVariablePropertyAccessor());
parser.addPropertyAccessor(new MapAdaptablePropertyAccessor());
parser.addPropertyAccessor(new MessageSourcePropertyAccessor());
parser.addPropertyAccessor(new ScopeSearchingPropertyAccessor());
parser.addPropertyAccessor(new BeanExpressionContextAccessor());
parser.addPropertyAccessor(new MapAccessor());
parser.addPropertyAccessor(new MapAdaptablePropertyAccessor());
parser.addPropertyAccessor(new EnvironmentAccessor());
parser.addPropertyAccessor(new ReflectivePropertyAccessor());
return parser;
} | java | public SpringELExpressionParser getSpringExpressionParser() {
val configuration = new SpelParserConfiguration();
val spelExpressionParser = new SpelExpressionParser(configuration);
val parser = new SpringELExpressionParser(spelExpressionParser, this.flowBuilderServices.getConversionService());
parser.addPropertyAccessor(new ActionPropertyAccessor());
parser.addPropertyAccessor(new BeanFactoryPropertyAccessor());
parser.addPropertyAccessor(new FlowVariablePropertyAccessor());
parser.addPropertyAccessor(new MapAdaptablePropertyAccessor());
parser.addPropertyAccessor(new MessageSourcePropertyAccessor());
parser.addPropertyAccessor(new ScopeSearchingPropertyAccessor());
parser.addPropertyAccessor(new BeanExpressionContextAccessor());
parser.addPropertyAccessor(new MapAccessor());
parser.addPropertyAccessor(new MapAdaptablePropertyAccessor());
parser.addPropertyAccessor(new EnvironmentAccessor());
parser.addPropertyAccessor(new ReflectivePropertyAccessor());
return parser;
} | [
"public",
"SpringELExpressionParser",
"getSpringExpressionParser",
"(",
")",
"{",
"val",
"configuration",
"=",
"new",
"SpelParserConfiguration",
"(",
")",
";",
"val",
"spelExpressionParser",
"=",
"new",
"SpelExpressionParser",
"(",
"configuration",
")",
";",
"val",
"p... | Gets spring expression parser.
@return the spring expression parser | [
"Gets",
"spring",
"expression",
"parser",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L383-L399 |
baratine/baratine | web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java | InvocationDecoder.normalizeUriEscape | private static String normalizeUriEscape(byte []rawUri, int i, int len,
String encoding)
throws IOException
{
ByteToChar converter = allocateConverter();
// XXX: make this configurable
if (encoding == null) {
encoding = "utf-8";
}
try {
converter.setEncoding(encoding);
} catch (UnsupportedEncodingException e) {
log.log(Level.FINE, e.toString(), e);
}
try {
while (i < len) {
int ch = rawUri[i++] & 0xff;
if (ch == '%')
i = scanUriEscape(converter, rawUri, i, len);
else
converter.addByte(ch);
}
String result = converter.getConvertedString();
freeConverter(converter);
return result;
} catch (Exception e) {
throw new BadRequestException(L.l("The URL contains escaped bytes unsupported by the {0} encoding.", encoding));
}
} | java | private static String normalizeUriEscape(byte []rawUri, int i, int len,
String encoding)
throws IOException
{
ByteToChar converter = allocateConverter();
// XXX: make this configurable
if (encoding == null) {
encoding = "utf-8";
}
try {
converter.setEncoding(encoding);
} catch (UnsupportedEncodingException e) {
log.log(Level.FINE, e.toString(), e);
}
try {
while (i < len) {
int ch = rawUri[i++] & 0xff;
if (ch == '%')
i = scanUriEscape(converter, rawUri, i, len);
else
converter.addByte(ch);
}
String result = converter.getConvertedString();
freeConverter(converter);
return result;
} catch (Exception e) {
throw new BadRequestException(L.l("The URL contains escaped bytes unsupported by the {0} encoding.", encoding));
}
} | [
"private",
"static",
"String",
"normalizeUriEscape",
"(",
"byte",
"[",
"]",
"rawUri",
",",
"int",
"i",
",",
"int",
"len",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"ByteToChar",
"converter",
"=",
"allocateConverter",
"(",
")",
";",
"// XX... | Converts the escaped URI to a string.
@param rawUri the escaped URI
@param i index into the URI
@param len the length of the uri
@param encoding the character encoding to handle %xx
@return the converted URI | [
"Converts",
"the",
"escaped",
"URI",
"to",
"a",
"string",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java#L310-L345 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.unregisterServiceInstance | public void unregisterServiceInstance(String serviceName, String instanceId){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.UnregisterServiceInstance);
UnregisterServiceInstanceProtocol p = new UnregisterServiceInstanceProtocol(serviceName, instanceId);
connection.submitRequest(header, p, null);
} | java | public void unregisterServiceInstance(String serviceName, String instanceId){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.UnregisterServiceInstance);
UnregisterServiceInstanceProtocol p = new UnregisterServiceInstanceProtocol(serviceName, instanceId);
connection.submitRequest(header, p, null);
} | [
"public",
"void",
"unregisterServiceInstance",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
"(",
")",
";",
"header",
".",
"setType",
"(",
"ProtocolType",
".",
"UnregisterServiceInstanc... | Unregister the ServiceInstance.
@param serviceName
the service name.
@param instanceId
the instanceId. | [
"Unregister",
"the",
"ServiceInstance",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L639-L645 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.getEndpointHealthWithServiceResponseAsync | public Observable<ServiceResponse<Page<EndpointHealthDataInner>>> getEndpointHealthWithServiceResponseAsync(final String resourceGroupName, final String iotHubName) {
return getEndpointHealthSinglePageAsync(resourceGroupName, iotHubName)
.concatMap(new Func1<ServiceResponse<Page<EndpointHealthDataInner>>, Observable<ServiceResponse<Page<EndpointHealthDataInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EndpointHealthDataInner>>> call(ServiceResponse<Page<EndpointHealthDataInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getEndpointHealthNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<EndpointHealthDataInner>>> getEndpointHealthWithServiceResponseAsync(final String resourceGroupName, final String iotHubName) {
return getEndpointHealthSinglePageAsync(resourceGroupName, iotHubName)
.concatMap(new Func1<ServiceResponse<Page<EndpointHealthDataInner>>, Observable<ServiceResponse<Page<EndpointHealthDataInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EndpointHealthDataInner>>> call(ServiceResponse<Page<EndpointHealthDataInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getEndpointHealthNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"EndpointHealthDataInner",
">",
">",
">",
"getEndpointHealthWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"iotHubName",
")",
"{",
"return",
"getEndpointHe... | Get the health for routing endpoints.
Get the health for routing endpoints.
@param resourceGroupName the String value
@param iotHubName the String value
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<EndpointHealthDataInner> object | [
"Get",
"the",
"health",
"for",
"routing",
"endpoints",
".",
"Get",
"the",
"health",
"for",
"routing",
"endpoints",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2492-L2504 |
jcuda/jnvgraph | JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java | JNvgraph.nvgraphExtractSubgraphByEdge | public static int nvgraphExtractSubgraphByEdge(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
nvgraphGraphDescr subdescrG,
Pointer subedges,
long numedges)
{
return checkResult(nvgraphExtractSubgraphByEdgeNative(handle, descrG, subdescrG, subedges, numedges));
} | java | public static int nvgraphExtractSubgraphByEdge(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
nvgraphGraphDescr subdescrG,
Pointer subedges,
long numedges)
{
return checkResult(nvgraphExtractSubgraphByEdgeNative(handle, descrG, subdescrG, subedges, numedges));
} | [
"public",
"static",
"int",
"nvgraphExtractSubgraphByEdge",
"(",
"nvgraphHandle",
"handle",
",",
"nvgraphGraphDescr",
"descrG",
",",
"nvgraphGraphDescr",
"subdescrG",
",",
"Pointer",
"subedges",
",",
"long",
"numedges",
")",
"{",
"return",
"checkResult",
"(",
"nvgraphE... | create a new graph by extracting a subgraph given a list of edges | [
"create",
"a",
"new",
"graph",
"by",
"extracting",
"a",
"subgraph",
"given",
"a",
"list",
"of",
"edges"
] | train | https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L402-L410 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java | TasksImpl.reactivateAsync | public Observable<Void> reactivateAsync(String jobId, String taskId) {
return reactivateWithServiceResponseAsync(jobId, taskId).map(new Func1<ServiceResponseWithHeaders<Void, TaskReactivateHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, TaskReactivateHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> reactivateAsync(String jobId, String taskId) {
return reactivateWithServiceResponseAsync(jobId, taskId).map(new Func1<ServiceResponseWithHeaders<Void, TaskReactivateHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, TaskReactivateHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"reactivateAsync",
"(",
"String",
"jobId",
",",
"String",
"taskId",
")",
"{",
"return",
"reactivateWithServiceResponseAsync",
"(",
"jobId",
",",
"taskId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHe... | Reactivates a task, allowing it to run again even if its retry count has been exhausted.
Reactivation makes a task eligible to be retried again up to its maximum retry count. The task's state is changed to active. As the task is no longer in the completed state, any previous exit code or failure information is no longer available after reactivation. Each time a task is reactivated, its retry count is reset to 0. Reactivation will fail for tasks that are not completed or that previously completed successfully (with an exit code of 0). Additionally, it will fail if the job has completed (or is terminating or deleting).
@param jobId The ID of the job containing the task.
@param taskId The ID of the task to reactivate.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Reactivates",
"a",
"task",
"allowing",
"it",
"to",
"run",
"again",
"even",
"if",
"its",
"retry",
"count",
"has",
"been",
"exhausted",
".",
"Reactivation",
"makes",
"a",
"task",
"eligible",
"to",
"be",
"retried",
"again",
"up",
"to",
"its",
"maximum",
"ret... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L2107-L2114 |
protostuff/protostuff | protostuff-xml/src/main/java/io/protostuff/XmlXIOUtil.java | XmlXIOUtil.toByteArray | public static <T> byte[] toByteArray(T message, Schema<T> schema, LinkedBuffer buffer)
{
if (buffer.start != buffer.offset)
throw new IllegalArgumentException("Buffer previously used and had not been reset.");
final XmlXOutput output = new XmlXOutput(buffer, schema);
final String name = schema.messageName();
try
{
// header and start root element
output.tail = output.sink.writeByte(XmlXOutput.END_TAG, output,
output.sink.writeStrAscii(name, output,
output.sink.writeByte(XmlXOutput.START_TAG, output,
output.sink.writeByteArray(HEADER, output, output.tail))));
schema.writeTo(output, message);
// end root element
output.tail = output.sink.writeByte(XmlXOutput.END_TAG, output,
output.sink.writeStrAscii(name, output,
output.sink.writeByteArray(XmlXOutput.START_SLASH_TAG, output, output.tail)));
}
catch (IOException e)
{
throw new RuntimeException("Serializing to a byte array threw an IOException " +
"(should never happen).", e);
}
return output.toByteArray();
} | java | public static <T> byte[] toByteArray(T message, Schema<T> schema, LinkedBuffer buffer)
{
if (buffer.start != buffer.offset)
throw new IllegalArgumentException("Buffer previously used and had not been reset.");
final XmlXOutput output = new XmlXOutput(buffer, schema);
final String name = schema.messageName();
try
{
// header and start root element
output.tail = output.sink.writeByte(XmlXOutput.END_TAG, output,
output.sink.writeStrAscii(name, output,
output.sink.writeByte(XmlXOutput.START_TAG, output,
output.sink.writeByteArray(HEADER, output, output.tail))));
schema.writeTo(output, message);
// end root element
output.tail = output.sink.writeByte(XmlXOutput.END_TAG, output,
output.sink.writeStrAscii(name, output,
output.sink.writeByteArray(XmlXOutput.START_SLASH_TAG, output, output.tail)));
}
catch (IOException e)
{
throw new RuntimeException("Serializing to a byte array threw an IOException " +
"(should never happen).", e);
}
return output.toByteArray();
} | [
"public",
"static",
"<",
"T",
">",
"byte",
"[",
"]",
"toByteArray",
"(",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"LinkedBuffer",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"start",
"!=",
"buffer",
".",
"offset",
")",
"throw",
... | Serializes the {@code message} into a byte array using the given schema.
@return the byte array containing the data. | [
"Serializes",
"the",
"{",
"@code",
"message",
"}",
"into",
"a",
"byte",
"array",
"using",
"the",
"given",
"schema",
"."
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlXIOUtil.java#L39-L69 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/CronSequenceGenerator.java | CronSequenceGenerator.setNumberHits | private void setNumberHits(BitSet bits, String value, int min, int max) {
String[] fields = StringUtils.delimitedListToStringArray(value, ",");
for (String field : fields) {
if (!field.contains("/")) {
// Not an incrementer so it must be a range (possibly empty)
int[] range = getRange(field, min, max);
bits.set(range[0], range[1] + 1);
} else {
String[] split = StringUtils.delimitedListToStringArray(field, "/");
if (split.length > 2) {
throw new IllegalArgumentException("Incrementer has more than two fields: '" + field
+ "' in expression \"" + this.expression + "\"");
}
int[] range = getRange(split[0], min, max);
if (!split[0].contains("-")) {
range[1] = max - 1;
}
int delta = Integer.valueOf(split[1]);
for (int i = range[0]; i <= range[1]; i += delta) {
bits.set(i);
}
}
}
} | java | private void setNumberHits(BitSet bits, String value, int min, int max) {
String[] fields = StringUtils.delimitedListToStringArray(value, ",");
for (String field : fields) {
if (!field.contains("/")) {
// Not an incrementer so it must be a range (possibly empty)
int[] range = getRange(field, min, max);
bits.set(range[0], range[1] + 1);
} else {
String[] split = StringUtils.delimitedListToStringArray(field, "/");
if (split.length > 2) {
throw new IllegalArgumentException("Incrementer has more than two fields: '" + field
+ "' in expression \"" + this.expression + "\"");
}
int[] range = getRange(split[0], min, max);
if (!split[0].contains("-")) {
range[1] = max - 1;
}
int delta = Integer.valueOf(split[1]);
for (int i = range[0]; i <= range[1]; i += delta) {
bits.set(i);
}
}
}
} | [
"private",
"void",
"setNumberHits",
"(",
"BitSet",
"bits",
",",
"String",
"value",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"String",
"[",
"]",
"fields",
"=",
"StringUtils",
".",
"delimitedListToStringArray",
"(",
"value",
",",
"\",\"",
")",
";",
... | Sets the number hits.
@param bits the bits
@param value the value
@param min the min
@param max the max | [
"Sets",
"the",
"number",
"hits",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/CronSequenceGenerator.java#L322-L345 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkVariableDeclaration | private Environment checkVariableDeclaration(Decl.Variable decl, Environment environment) {
// Check type is sensible
checkNonEmpty(decl, environment);
// Check type of initialiser.
if (decl.hasInitialiser()) {
SemanticType type = checkExpression(decl.getInitialiser(), environment);
checkIsSubtype(decl.getType(), type, environment, decl.getInitialiser());
}
// Done.
return environment;
} | java | private Environment checkVariableDeclaration(Decl.Variable decl, Environment environment) {
// Check type is sensible
checkNonEmpty(decl, environment);
// Check type of initialiser.
if (decl.hasInitialiser()) {
SemanticType type = checkExpression(decl.getInitialiser(), environment);
checkIsSubtype(decl.getType(), type, environment, decl.getInitialiser());
}
// Done.
return environment;
} | [
"private",
"Environment",
"checkVariableDeclaration",
"(",
"Decl",
".",
"Variable",
"decl",
",",
"Environment",
"environment",
")",
"{",
"// Check type is sensible",
"checkNonEmpty",
"(",
"decl",
",",
"environment",
")",
";",
"// Check type of initialiser.",
"if",
"(",
... | Type check a variable declaration statement. In particular, when an
initialiser is given we must check it is well-formed and that it is a subtype
of the declared type.
@param decl
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"a",
"variable",
"declaration",
"statement",
".",
"In",
"particular",
"when",
"an",
"initialiser",
"is",
"given",
"we",
"must",
"check",
"it",
"is",
"well",
"-",
"formed",
"and",
"that",
"it",
"is",
"a",
"subtype",
"of",
"the",
"declared",... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L419-L429 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java | State.getPropAsInt | public int getPropAsInt(String key, int def) {
return Integer.parseInt(getProp(key, String.valueOf(def)));
} | java | public int getPropAsInt(String key, int def) {
return Integer.parseInt(getProp(key, String.valueOf(def)));
} | [
"public",
"int",
"getPropAsInt",
"(",
"String",
"key",
",",
"int",
"def",
")",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"getProp",
"(",
"key",
",",
"String",
".",
"valueOf",
"(",
"def",
")",
")",
")",
";",
"}"
] | Get the value of a property as an integer, using the given default value if the property is not set.
@param key property key
@param def default value
@return integer value associated with the key or the default value if the property is not set | [
"Get",
"the",
"value",
"of",
"a",
"property",
"as",
"an",
"integer",
"using",
"the",
"given",
"default",
"value",
"if",
"the",
"property",
"is",
"not",
"set",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java#L384-L386 |
alkacon/opencms-core | src-setup/org/opencms/setup/CmsSetupBean.java | CmsSetupBean.checkFilesExists | private boolean checkFilesExists(String[] requiredFiles, File childResource) {
File setupFile = null;
boolean hasMissingSetupFiles = false;
for (int j = 0; j < requiredFiles.length; j++) {
setupFile = new File(childResource.getPath() + File.separatorChar + requiredFiles[j]);
if (!setupFile.exists() || !setupFile.isFile() || !setupFile.canRead()) {
hasMissingSetupFiles = true;
System.err.println(
"[" + getClass().getName() + "] missing or unreadable database setup file: " + setupFile.getPath());
break;
}
if (!hasMissingSetupFiles) {
return true;
}
}
return false;
} | java | private boolean checkFilesExists(String[] requiredFiles, File childResource) {
File setupFile = null;
boolean hasMissingSetupFiles = false;
for (int j = 0; j < requiredFiles.length; j++) {
setupFile = new File(childResource.getPath() + File.separatorChar + requiredFiles[j]);
if (!setupFile.exists() || !setupFile.isFile() || !setupFile.canRead()) {
hasMissingSetupFiles = true;
System.err.println(
"[" + getClass().getName() + "] missing or unreadable database setup file: " + setupFile.getPath());
break;
}
if (!hasMissingSetupFiles) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"checkFilesExists",
"(",
"String",
"[",
"]",
"requiredFiles",
",",
"File",
"childResource",
")",
"{",
"File",
"setupFile",
"=",
"null",
";",
"boolean",
"hasMissingSetupFiles",
"=",
"false",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
... | Checks if the necessary files for the configuration are existent or not.<p>
@param requiredFiles the required files
@param childResource the folder to check
@return true if the files are existent | [
"Checks",
"if",
"the",
"necessary",
"files",
"for",
"the",
"configuration",
"are",
"existent",
"or",
"not",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L2768-L2788 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java | ValueFileIOHelper.writeByteArrayValue | protected long writeByteArrayValue(File file, ValueData value) throws IOException
{
OutputStream out = new FileOutputStream(file);
try
{
byte[] data = value.getAsByteArray();
out.write(data);
return data.length;
}
finally
{
out.close();
}
} | java | protected long writeByteArrayValue(File file, ValueData value) throws IOException
{
OutputStream out = new FileOutputStream(file);
try
{
byte[] data = value.getAsByteArray();
out.write(data);
return data.length;
}
finally
{
out.close();
}
} | [
"protected",
"long",
"writeByteArrayValue",
"(",
"File",
"file",
",",
"ValueData",
"value",
")",
"throws",
"IOException",
"{",
"OutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"data",
"=",
"value",
... | Write value array of bytes to a file.
@param file
File
@param value
ValueData
@return size of wrote content
@throws IOException
if error occurs | [
"Write",
"value",
"array",
"of",
"bytes",
"to",
"a",
"file",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L94-L108 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getMasteries | public Future<MasteryList> getMasteries(MasteryData data, String version, String locale) {
return new DummyFuture<>(handler.getMasteries(data, version, locale));
} | java | public Future<MasteryList> getMasteries(MasteryData data, String version, String locale) {
return new DummyFuture<>(handler.getMasteries(data, version, locale));
} | [
"public",
"Future",
"<",
"MasteryList",
">",
"getMasteries",
"(",
"MasteryData",
"data",
",",
"String",
"version",
",",
"String",
"locale",
")",
"{",
"return",
"new",
"DummyFuture",
"<>",
"(",
"handler",
".",
"getMasteries",
"(",
"data",
",",
"version",
",",... | <p>
Get a listing of all masteries
</p>
This method does not count towards the rate limit and is not affected by the throttle
@param data Additional information to retrieve
@param version Data dragon version for returned data
@param locale Locale code for returned data
@return The masteries
@see <a href=https://developer.riotgames.com/api/methods#!/649/2173>Official API documentation</a> | [
"<p",
">",
"Get",
"a",
"listing",
"of",
"all",
"masteries",
"<",
"/",
"p",
">",
"This",
"method",
"does",
"not",
"count",
"towards",
"the",
"rate",
"limit",
"and",
"is",
"not",
"affected",
"by",
"the",
"throttle"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L562-L564 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java | ListViewUrl.deleteEntityListViewUrl | public static MozuUrl deleteEntityListViewUrl(String entityListFullName, String viewName)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/views/{viewName}");
formatter.formatUrl("entityListFullName", entityListFullName);
formatter.formatUrl("viewName", viewName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteEntityListViewUrl(String entityListFullName, String viewName)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/views/{viewName}");
formatter.formatUrl("entityListFullName", entityListFullName);
formatter.formatUrl("viewName", viewName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteEntityListViewUrl",
"(",
"String",
"entityListFullName",
",",
"String",
"viewName",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/entitylists/{entityListFullName}/views/{viewName}\"",
")",
";",
... | Get Resource Url for DeleteEntityListView
@param entityListFullName The full name of the EntityList including namespace in name@nameSpace format
@param viewName The name for a view. Views are used to render data in , such as document and entity lists. Each view includes a schema, format, name, ID, and associated data types to render.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteEntityListView"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java#L162-L168 |
instacount/appengine-counter | src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java | ShardedCounterServiceImpl.assertCounterAmountMutatable | @VisibleForTesting
protected void assertCounterAmountMutatable(final String counterName, final CounterStatus counterStatus)
{
if (counterStatus != CounterStatus.AVAILABLE)
{
final String msg = String.format(
"Can't mutate the amount of counter '%s' because it's currently in the %s state but must be in in "
+ "the %s state!",
counterName, counterStatus.name(), CounterStatus.AVAILABLE);
throw new CounterNotMutableException(counterName, msg);
}
} | java | @VisibleForTesting
protected void assertCounterAmountMutatable(final String counterName, final CounterStatus counterStatus)
{
if (counterStatus != CounterStatus.AVAILABLE)
{
final String msg = String.format(
"Can't mutate the amount of counter '%s' because it's currently in the %s state but must be in in "
+ "the %s state!",
counterName, counterStatus.name(), CounterStatus.AVAILABLE);
throw new CounterNotMutableException(counterName, msg);
}
} | [
"@",
"VisibleForTesting",
"protected",
"void",
"assertCounterAmountMutatable",
"(",
"final",
"String",
"counterName",
",",
"final",
"CounterStatus",
"counterStatus",
")",
"{",
"if",
"(",
"counterStatus",
"!=",
"CounterStatus",
".",
"AVAILABLE",
")",
"{",
"final",
"S... | Helper method to determine if a counter's incrementAmount can be mutated (incremented or decremented). In order
for that to happen, the counter's status must be {@link CounterStatus#AVAILABLE}.
@param counterName
@param counterStatus
@return | [
"Helper",
"method",
"to",
"determine",
"if",
"a",
"counter",
"s",
"incrementAmount",
"can",
"be",
"mutated",
"(",
"incremented",
"or",
"decremented",
")",
".",
"In",
"order",
"for",
"that",
"to",
"happen",
"the",
"counter",
"s",
"status",
"must",
"be",
"{"... | train | https://github.com/instacount/appengine-counter/blob/60aa86ab28f173ec1642539926b69924b8bda238/src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java#L1427-L1438 |
EMCECS/nfs-client-java | src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java | RpcWrapper.callRpcChecked | private void callRpcChecked(S request, RpcResponseHandler<? extends T> responseHandler, String ipAddress)
throws IOException {
LOG.debug("server {}, port {}, request {}", _server, _port, request);
callRpcNaked(request, responseHandler.getNewResponse(), ipAddress);
if (LOG.isDebugEnabled()) {
LOG.debug("server {}, port {}, response {}", _server, _port, responseHandler.getResponse());
}
responseHandler.checkResponse(request);
} | java | private void callRpcChecked(S request, RpcResponseHandler<? extends T> responseHandler, String ipAddress)
throws IOException {
LOG.debug("server {}, port {}, request {}", _server, _port, request);
callRpcNaked(request, responseHandler.getNewResponse(), ipAddress);
if (LOG.isDebugEnabled()) {
LOG.debug("server {}, port {}, response {}", _server, _port, responseHandler.getResponse());
}
responseHandler.checkResponse(request);
} | [
"private",
"void",
"callRpcChecked",
"(",
"S",
"request",
",",
"RpcResponseHandler",
"<",
"?",
"extends",
"T",
">",
"responseHandler",
",",
"String",
"ipAddress",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"debug",
"(",
"\"server {}, port {}, request {}\"",
",... | The base functionality used by all NFS calls, which does basic return
code checking and throws an exception if this does not pass. Verbose
logging is also handled here. This method is not used by Portmap, Mount,
and Unmount calls.
@param request
The request to send.
@param responseHandler
A response handler.
@param ipAddress
The IP address to use for communication.
@throws IOException | [
"The",
"base",
"functionality",
"used",
"by",
"all",
"NFS",
"calls",
"which",
"does",
"basic",
"return",
"code",
"checking",
"and",
"throws",
"an",
"exception",
"if",
"this",
"does",
"not",
"pass",
".",
"Verbose",
"logging",
"is",
"also",
"handled",
"here",
... | train | https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/rpc/RpcWrapper.java#L266-L277 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.longConsumer | public static LongConsumer longConsumer(CheckedLongConsumer consumer, Consumer<Throwable> handler) {
return l -> {
try {
consumer.accept(l);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static LongConsumer longConsumer(CheckedLongConsumer consumer, Consumer<Throwable> handler) {
return l -> {
try {
consumer.accept(l);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"LongConsumer",
"longConsumer",
"(",
"CheckedLongConsumer",
"consumer",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"l",
"->",
"{",
"try",
"{",
"consumer",
".",
"accept",
"(",
"l",
")",
";",
"}",
"catch",
"(",... | Wrap a {@link CheckedLongConsumer} in a {@link LongConsumer} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
Arrays.stream(new long[] { 1L, 2L }).forEach(Unchecked.longConsumer(
l -> {
if (l < 0)
throw new Exception("Only positive numbers allowed");
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L779-L790 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java | MediaType.copyQualityValue | public MediaType copyQualityValue(MediaType mediaType) {
if (!mediaType.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.put(PARAM_QUALITY_FACTOR, mediaType.parameters.get(PARAM_QUALITY_FACTOR));
return new MediaType(this, params);
} | java | public MediaType copyQualityValue(MediaType mediaType) {
if (!mediaType.parameters.containsKey(PARAM_QUALITY_FACTOR)) {
return this;
}
Map<String, String> params = new LinkedHashMap<String, String>(this.parameters);
params.put(PARAM_QUALITY_FACTOR, mediaType.parameters.get(PARAM_QUALITY_FACTOR));
return new MediaType(this, params);
} | [
"public",
"MediaType",
"copyQualityValue",
"(",
"MediaType",
"mediaType",
")",
"{",
"if",
"(",
"!",
"mediaType",
".",
"parameters",
".",
"containsKey",
"(",
"PARAM_QUALITY_FACTOR",
")",
")",
"{",
"return",
"this",
";",
"}",
"Map",
"<",
"String",
",",
"String... | Return a replica of this instance with the quality value of the given MediaType.
@return the same instance if the given MediaType doesn't have a quality value, or a new one otherwise | [
"Return",
"a",
"replica",
"of",
"this",
"instance",
"with",
"the",
"quality",
"value",
"of",
"the",
"given",
"MediaType",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/MediaType.java#L582-L589 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/windows/HdfsUrlChooser.java | HdfsUrlChooser.scanHadoopConfigFiles | private boolean scanHadoopConfigFiles(final ServerInformationCatalog serverInformationCatalog,
final String selectedServer) {
final HadoopClusterInformation clusterInformation;
if (selectedServer != null) {
clusterInformation = (HadoopClusterInformation) serverInformationCatalog.getServer(selectedServer);
} else {
clusterInformation = (HadoopClusterInformation) serverInformationCatalog
.getServer(HadoopResource.DEFAULT_CLUSTERREFERENCE);
}
if (clusterInformation == null) {
return false;
}
final Configuration configuration = HdfsUtils.getHadoopConfigurationWithTimeout(clusterInformation);
_currentDirectory = new Path("/");
try {
_fileSystem = FileSystem.newInstance(configuration);
} catch (final IOException e) {
throw new IllegalArgumentException("Illegal URI when showing HDFS chooser", e);
}
final HdfsDirectoryModel model = (HdfsDirectoryModel) _fileList.getModel();
model.updateFileList();
return model._files.length > 0;
} | java | private boolean scanHadoopConfigFiles(final ServerInformationCatalog serverInformationCatalog,
final String selectedServer) {
final HadoopClusterInformation clusterInformation;
if (selectedServer != null) {
clusterInformation = (HadoopClusterInformation) serverInformationCatalog.getServer(selectedServer);
} else {
clusterInformation = (HadoopClusterInformation) serverInformationCatalog
.getServer(HadoopResource.DEFAULT_CLUSTERREFERENCE);
}
if (clusterInformation == null) {
return false;
}
final Configuration configuration = HdfsUtils.getHadoopConfigurationWithTimeout(clusterInformation);
_currentDirectory = new Path("/");
try {
_fileSystem = FileSystem.newInstance(configuration);
} catch (final IOException e) {
throw new IllegalArgumentException("Illegal URI when showing HDFS chooser", e);
}
final HdfsDirectoryModel model = (HdfsDirectoryModel) _fileList.getModel();
model.updateFileList();
return model._files.length > 0;
} | [
"private",
"boolean",
"scanHadoopConfigFiles",
"(",
"final",
"ServerInformationCatalog",
"serverInformationCatalog",
",",
"final",
"String",
"selectedServer",
")",
"{",
"final",
"HadoopClusterInformation",
"clusterInformation",
";",
"if",
"(",
"selectedServer",
"!=",
"null"... | This scans Hadoop environment variables for a directory with configuration files
@param serverInformationCatalog
@return True if a configuration was yielded. | [
"This",
"scans",
"Hadoop",
"environment",
"variables",
"for",
"a",
"directory",
"with",
"configuration",
"files"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/windows/HdfsUrlChooser.java#L519-L546 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java | JAltGridScreen.addGridDetailItems | public void addGridDetailItems(TableModel model, GridBagLayout gridbag, GridBagConstraints c)
{
m_vComponentCache = new Vector<ComponentCache>();
for (int iRow = 0; iRow < model.getRowCount(); iRow++)
{
c.weightx = 0.0;
c.gridwidth = 1;
c.anchor = GridBagConstraints.EAST; // Edit boxes right justified
c.insets.right = 5; // Add a few pixels of white space to the right
this.addGridDetailItem(model, iRow, gridbag, c);
}
} | java | public void addGridDetailItems(TableModel model, GridBagLayout gridbag, GridBagConstraints c)
{
m_vComponentCache = new Vector<ComponentCache>();
for (int iRow = 0; iRow < model.getRowCount(); iRow++)
{
c.weightx = 0.0;
c.gridwidth = 1;
c.anchor = GridBagConstraints.EAST; // Edit boxes right justified
c.insets.right = 5; // Add a few pixels of white space to the right
this.addGridDetailItem(model, iRow, gridbag, c);
}
} | [
"public",
"void",
"addGridDetailItems",
"(",
"TableModel",
"model",
",",
"GridBagLayout",
"gridbag",
",",
"GridBagConstraints",
"c",
")",
"{",
"m_vComponentCache",
"=",
"new",
"Vector",
"<",
"ComponentCache",
">",
"(",
")",
";",
"for",
"(",
"int",
"iRow",
"=",... | Read through the table model and add add the items to the grid panel.
@param model The table model to read through.
@param gridbag The screen layout.
@param c The constraint to use. | [
"Read",
"through",
"the",
"table",
"model",
"and",
"add",
"add",
"the",
"items",
"to",
"the",
"grid",
"panel",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L203-L215 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SegmentImportResource.java | SegmentImportResource.withChannelCounts | public SegmentImportResource withChannelCounts(java.util.Map<String, Integer> channelCounts) {
setChannelCounts(channelCounts);
return this;
} | java | public SegmentImportResource withChannelCounts(java.util.Map<String, Integer> channelCounts) {
setChannelCounts(channelCounts);
return this;
} | [
"public",
"SegmentImportResource",
"withChannelCounts",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Integer",
">",
"channelCounts",
")",
"{",
"setChannelCounts",
"(",
"channelCounts",
")",
";",
"return",
"this",
";",
"}"
] | The number of channel types in the imported segment.
@param channelCounts
The number of channel types in the imported segment.
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"number",
"of",
"channel",
"types",
"in",
"the",
"imported",
"segment",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SegmentImportResource.java#L77-L80 |
alkacon/opencms-core | src/org/opencms/ui/components/fileselect/CmsResourceTreeContainer.java | CmsResourceTreeContainer.getName | protected String getName(CmsObject cms, CmsResource resource, CmsUUID parentId) {
return parentId == null ? resource.getRootPath() : resource.getName();
} | java | protected String getName(CmsObject cms, CmsResource resource, CmsUUID parentId) {
return parentId == null ? resource.getRootPath() : resource.getName();
} | [
"protected",
"String",
"getName",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"CmsUUID",
"parentId",
")",
"{",
"return",
"parentId",
"==",
"null",
"?",
"resource",
".",
"getRootPath",
"(",
")",
":",
"resource",
".",
"getName",
"(",
")",
"... | Gets the name to display for the given resource.<p>
@param cms the CMS context
@param resource a resource
@param parentId the id of the parent of the resource
@return the name for the given resoure | [
"Gets",
"the",
"name",
"to",
"display",
"for",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/fileselect/CmsResourceTreeContainer.java#L336-L339 |
motown-io/motown | samples/authentication/src/main/java/io/motown/sample/authentication/rest/AuthenticationTokenProcessingFilter.java | AuthenticationTokenProcessingFilter.doFilter | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String authToken = getAuthTokenFromRequest(httpRequest);
String userName = TokenUtils.getUserNameFromToken(authToken);
if (userName != null) {
UserDetails userDetails = userService.loadUserByUsername(userName);
if (TokenUtils.validateToken(authToken, userDetails)) {
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpRequest));
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
chain.doFilter(request, response);
} | java | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
String authToken = getAuthTokenFromRequest(httpRequest);
String userName = TokenUtils.getUserNameFromToken(authToken);
if (userName != null) {
UserDetails userDetails = userService.loadUserByUsername(userName);
if (TokenUtils.validateToken(authToken, userDetails)) {
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpRequest));
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
chain.doFilter(request, response);
} | [
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"HttpServletRequest",
"httpRequest",
"=",
"(",
"HttpServletReq... | Retrieves the authorization token from the request and validates it against the {@code UserService}.
@param request servlet request.
@param response servlet response.
@param chain filter chain.
@throws IOException
@throws ServletException | [
"Retrieves",
"the",
"authorization",
"token",
"from",
"the",
"request",
"and",
"validates",
"it",
"against",
"the",
"{",
"@code",
"UserService",
"}",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/samples/authentication/src/main/java/io/motown/sample/authentication/rest/AuthenticationTokenProcessingFilter.java#L51-L69 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/database/CmsHtmlImportConverter.java | CmsHtmlImportConverter.extractHtml | public static String extractHtml(String content, String startpoint, String endpoint) {
/** Regex that matches a start body tag. */
Pattern startPattern = Pattern.compile(startpoint, Pattern.CASE_INSENSITIVE);
/** Regex that matches an end body tag. */
Pattern endPattern = Pattern.compile(endpoint, Pattern.CASE_INSENSITIVE);
Matcher startMatcher = startPattern.matcher(content);
Matcher endMatcher = endPattern.matcher(content);
int start = 0;
int end = content.length();
if (startMatcher.find()) {
start = startMatcher.end();
}
if (endMatcher.find(start)) {
end = endMatcher.start();
}
return content.substring(start, end);
} | java | public static String extractHtml(String content, String startpoint, String endpoint) {
/** Regex that matches a start body tag. */
Pattern startPattern = Pattern.compile(startpoint, Pattern.CASE_INSENSITIVE);
/** Regex that matches an end body tag. */
Pattern endPattern = Pattern.compile(endpoint, Pattern.CASE_INSENSITIVE);
Matcher startMatcher = startPattern.matcher(content);
Matcher endMatcher = endPattern.matcher(content);
int start = 0;
int end = content.length();
if (startMatcher.find()) {
start = startMatcher.end();
}
if (endMatcher.find(start)) {
end = endMatcher.start();
}
return content.substring(start, end);
} | [
"public",
"static",
"String",
"extractHtml",
"(",
"String",
"content",
",",
"String",
"startpoint",
",",
"String",
"endpoint",
")",
"{",
"/** Regex that matches a start body tag. */",
"Pattern",
"startPattern",
"=",
"Pattern",
".",
"compile",
"(",
"startpoint",
",",
... | Extracts the content of a HTML page.<p>
This method should be pretty robust and work even if the input HTML does not contains
the specified matchers.<p>
@param content the content to extract the body from
@param startpoint the point where matching starts
@param endpoint the point where matching ends
@return the extracted body tag content | [
"Extracts",
"the",
"content",
"of",
"a",
"HTML",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/database/CmsHtmlImportConverter.java#L160-L183 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.removeIf | public static <T> boolean removeIf(Iterable<T> iterable, Predicate<? super T> predicate)
{
if (iterable instanceof MutableCollection)
{
return ((MutableCollection<T>) iterable).removeIf(predicate);
}
if (iterable instanceof ArrayList)
{
return ArrayListIterate.removeIf((ArrayList<T>) iterable, predicate);
}
if (iterable instanceof List)
{
return ListIterate.removeIf((List<T>) iterable, predicate);
}
if (iterable != null)
{
return IterableIterate.removeIf(iterable, predicate);
}
throw new IllegalArgumentException("Cannot perform a remove on null");
} | java | public static <T> boolean removeIf(Iterable<T> iterable, Predicate<? super T> predicate)
{
if (iterable instanceof MutableCollection)
{
return ((MutableCollection<T>) iterable).removeIf(predicate);
}
if (iterable instanceof ArrayList)
{
return ArrayListIterate.removeIf((ArrayList<T>) iterable, predicate);
}
if (iterable instanceof List)
{
return ListIterate.removeIf((List<T>) iterable, predicate);
}
if (iterable != null)
{
return IterableIterate.removeIf(iterable, predicate);
}
throw new IllegalArgumentException("Cannot perform a remove on null");
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"removeIf",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"if",
"(",
"iterable",
"instanceof",
"MutableCollection",
")",
"{",
"return",
"(",... | Removes all elements from the iterable that evaluate to true for the specified predicate. | [
"Removes",
"all",
"elements",
"from",
"the",
"iterable",
"that",
"evaluate",
"to",
"true",
"for",
"the",
"specified",
"predicate",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L927-L946 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/io/FileUtils.java | FileUtils.assertExists | @NullSafe
public static File assertExists(File path) throws FileNotFoundException {
if (isExisting(path)) {
return path;
}
throw new FileNotFoundException(String.format("[%1$s] was not found", path));
} | java | @NullSafe
public static File assertExists(File path) throws FileNotFoundException {
if (isExisting(path)) {
return path;
}
throw new FileNotFoundException(String.format("[%1$s] was not found", path));
} | [
"@",
"NullSafe",
"public",
"static",
"File",
"assertExists",
"(",
"File",
"path",
")",
"throws",
"FileNotFoundException",
"{",
"if",
"(",
"isExisting",
"(",
"path",
")",
")",
"{",
"return",
"path",
";",
"}",
"throw",
"new",
"FileNotFoundException",
"(",
"Str... | Asserts that the given file exists.
@param path the {@link File} to assert for existence.
@return a reference back to the file.
@throws java.io.FileNotFoundException if the file does not exist.
@see #isExisting(File) | [
"Asserts",
"that",
"the",
"given",
"file",
"exists",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/io/FileUtils.java#L52-L59 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java | WorkspacePersistentDataManager.doDelete | protected void doDelete(final ItemData item, final WorkspaceStorageConnection con, ChangedSizeHandler sizeHandler)
throws RepositoryException, InvalidItemStateException
{
if (item.isNode())
{
con.delete((NodeData)item);
}
else
{
con.delete((PropertyData)item, sizeHandler);
}
} | java | protected void doDelete(final ItemData item, final WorkspaceStorageConnection con, ChangedSizeHandler sizeHandler)
throws RepositoryException, InvalidItemStateException
{
if (item.isNode())
{
con.delete((NodeData)item);
}
else
{
con.delete((PropertyData)item, sizeHandler);
}
} | [
"protected",
"void",
"doDelete",
"(",
"final",
"ItemData",
"item",
",",
"final",
"WorkspaceStorageConnection",
"con",
",",
"ChangedSizeHandler",
"sizeHandler",
")",
"throws",
"RepositoryException",
",",
"InvalidItemStateException",
"{",
"if",
"(",
"item",
".",
"isNode... | Performs actual item data deleting.
@param item
to delete
@param con
@param sizeHandler
@throws RepositoryException
@throws InvalidItemStateException
if the item is already deleted | [
"Performs",
"actual",
"item",
"data",
"deleting",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java#L1137-L1149 |
kefirfromperm/kefirbb | src/org/kefirsf/bb/DomConfigurationFactory.java | DomConfigurationFactory.parseNesting | private void parseNesting(Configuration configuration, Document dc) {
NodeList list = dc.getElementsByTagNameNS(SCHEMA_LOCATION, TAG_NESTING);
if (list.getLength() > 0) {
Node el = list.item(0);
configuration.setNestingLimit(nodeAttribute(el, TAG_NESTING_ATTR_LIMIT, Configuration.DEFAULT_NESTING_LIMIT));
configuration.setPropagateNestingException(
nodeAttribute(el, TAG_NESTING_ATTR_EXCEPTION, Configuration.DEFAULT_PROPAGATE_NESTING_EXCEPTION)
);
}
} | java | private void parseNesting(Configuration configuration, Document dc) {
NodeList list = dc.getElementsByTagNameNS(SCHEMA_LOCATION, TAG_NESTING);
if (list.getLength() > 0) {
Node el = list.item(0);
configuration.setNestingLimit(nodeAttribute(el, TAG_NESTING_ATTR_LIMIT, Configuration.DEFAULT_NESTING_LIMIT));
configuration.setPropagateNestingException(
nodeAttribute(el, TAG_NESTING_ATTR_EXCEPTION, Configuration.DEFAULT_PROPAGATE_NESTING_EXCEPTION)
);
}
} | [
"private",
"void",
"parseNesting",
"(",
"Configuration",
"configuration",
",",
"Document",
"dc",
")",
"{",
"NodeList",
"list",
"=",
"dc",
".",
"getElementsByTagNameNS",
"(",
"SCHEMA_LOCATION",
",",
"TAG_NESTING",
")",
";",
"if",
"(",
"list",
".",
"getLength",
... | Parse nesting element, which describes nesting behavior.
@param configuration parser configuration
@param dc DOM-document | [
"Parse",
"nesting",
"element",
"which",
"describes",
"nesting",
"behavior",
"."
] | train | https://github.com/kefirfromperm/kefirbb/blob/8c36fc3d3dc27459b0cdc179b87582df30420856/src/org/kefirsf/bb/DomConfigurationFactory.java#L152-L161 |
avarabyeu/restendpoint | src/main/java/com/github/avarabyeu/restendpoint/http/PreemptiveAuthInterceptor.java | PreemptiveAuthInterceptor.process | @Override
public final void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
AuthState authState = (AuthState) context.getAttribute(HttpClientContext.TARGET_AUTH_STATE);
if (authState.getAuthScheme() == null) {
HttpHost targetHost = (HttpHost) context.getAttribute(HttpCoreContext.HTTP_TARGET_HOST);
AuthCache authCache = new BasicAuthCache();
authCache.put(targetHost, new BasicScheme());
context.setAttribute(HttpClientContext.AUTH_CACHE, authCache);
}
} | java | @Override
public final void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
AuthState authState = (AuthState) context.getAttribute(HttpClientContext.TARGET_AUTH_STATE);
if (authState.getAuthScheme() == null) {
HttpHost targetHost = (HttpHost) context.getAttribute(HttpCoreContext.HTTP_TARGET_HOST);
AuthCache authCache = new BasicAuthCache();
authCache.put(targetHost, new BasicScheme());
context.setAttribute(HttpClientContext.AUTH_CACHE, authCache);
}
} | [
"@",
"Override",
"public",
"final",
"void",
"process",
"(",
"final",
"HttpRequest",
"request",
",",
"final",
"HttpContext",
"context",
")",
"throws",
"HttpException",
",",
"IOException",
"{",
"AuthState",
"authState",
"=",
"(",
"AuthState",
")",
"context",
".",
... | Adds provided auth scheme to the client if there are no another provided
auth schemes | [
"Adds",
"provided",
"auth",
"scheme",
"to",
"the",
"client",
"if",
"there",
"are",
"no",
"another",
"provided",
"auth",
"schemes"
] | train | https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/http/PreemptiveAuthInterceptor.java#L44-L55 |
WiQuery/wiquery | wiquery-core/src/main/java/org/odlabs/wiquery/core/behavior/WiQueryAbstractAjaxBehavior.java | WiQueryAbstractAjaxBehavior.renderHead | @Override
public void renderHead(Component component, IHeaderResponse response)
{
super.renderHead(component, response);
JsStatement statement = statement();
if (statement != null)
{
String statementString = statement.render().toString();
if (!Strings.isEmpty(statementString))
{
response.render(OnDomReadyHeaderItem.forScript(statementString));
}
}
} | java | @Override
public void renderHead(Component component, IHeaderResponse response)
{
super.renderHead(component, response);
JsStatement statement = statement();
if (statement != null)
{
String statementString = statement.render().toString();
if (!Strings.isEmpty(statementString))
{
response.render(OnDomReadyHeaderItem.forScript(statementString));
}
}
} | [
"@",
"Override",
"public",
"void",
"renderHead",
"(",
"Component",
"component",
",",
"IHeaderResponse",
"response",
")",
"{",
"super",
".",
"renderHead",
"(",
"component",
",",
"response",
")",
";",
"JsStatement",
"statement",
"=",
"statement",
"(",
")",
";",
... | <p>
Since wicket 6.0 {@link #statement()} is no longer needed, nearly all of WiQuery
core's inner workings have been ported to Wicket 6.0. Use
{@link #renderHead(Component, IHeaderResponse)} to render your statement.
</p>
<p>
For backward compatibility we render the output of this function in an
{@link OnDomReadyHeaderItem} if it is not empty. For your convenience this abstract
class returns null so that nothing is rendered.
<p> | [
"<p",
">",
"Since",
"wicket",
"6",
".",
"0",
"{"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-core/src/main/java/org/odlabs/wiquery/core/behavior/WiQueryAbstractAjaxBehavior.java#L75-L89 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/ri/GetMethodsLookup.java | GetMethodsLookup.collectAll | private void collectAll(MethodProvider methodProvider, Map<String, Invoker> found) {
// We do this in inverse order as in 'GetMethodLookup'. This is because GetMethodLookup
// is lazy and wants to stop when a method is found, but here we instead collect
// everything bottom up and 'overwrite' earlier results so the last one found is the
// one kept.
// First interfaces in inverse order...
MethodProvider[] itfs = methodProvider.getInterfaces();
for (int i = itfs.length - 1; i >= 0; i--) { // inverse order
collectAll(itfs[i], found);
}
// Then the superclass(es), but only if we're not an interface (interfaces do not report
// the methods of Object!
MethodProvider supr = methodProvider.getSuper();
if (supr != null && !methodProvider.isInterface()) {
collectAll(supr, found);
}
// Finally all our own public methods
for (Invoker method : methodProvider.getDeclaredMethods()) {
if (Modifier.isPublic(method.getModifiers())) {
found.put(method.getName() + method.getMethodDescriptor(), method);
}
}
} | java | private void collectAll(MethodProvider methodProvider, Map<String, Invoker> found) {
// We do this in inverse order as in 'GetMethodLookup'. This is because GetMethodLookup
// is lazy and wants to stop when a method is found, but here we instead collect
// everything bottom up and 'overwrite' earlier results so the last one found is the
// one kept.
// First interfaces in inverse order...
MethodProvider[] itfs = methodProvider.getInterfaces();
for (int i = itfs.length - 1; i >= 0; i--) { // inverse order
collectAll(itfs[i], found);
}
// Then the superclass(es), but only if we're not an interface (interfaces do not report
// the methods of Object!
MethodProvider supr = methodProvider.getSuper();
if (supr != null && !methodProvider.isInterface()) {
collectAll(supr, found);
}
// Finally all our own public methods
for (Invoker method : methodProvider.getDeclaredMethods()) {
if (Modifier.isPublic(method.getModifiers())) {
found.put(method.getName() + method.getMethodDescriptor(), method);
}
}
} | [
"private",
"void",
"collectAll",
"(",
"MethodProvider",
"methodProvider",
",",
"Map",
"<",
"String",
",",
"Invoker",
">",
"found",
")",
"{",
"// We do this in inverse order as in 'GetMethodLookup'. This is because GetMethodLookup",
"// is lazy and wants to stop when a method is fou... | Collect all public methods from methodProvider and its supertypes into the 'found' hasmap, indexed by
"name+descriptor". | [
"Collect",
"all",
"public",
"methods",
"from",
"methodProvider",
"and",
"its",
"supertypes",
"into",
"the",
"found",
"hasmap",
"indexed",
"by",
"name",
"+",
"descriptor",
"."
] | train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/ri/GetMethodsLookup.java#L40-L65 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/cdn/CdnClient.java | CdnClient.setDomainLimitRate | public void setDomainLimitRate(String domain, int limitRate) {
SetDomainLimitRateRequest request = new SetDomainLimitRateRequest()
.withDomain(domain)
.withLimitRate(limitRate);
setDomainLimitRate(request);
} | java | public void setDomainLimitRate(String domain, int limitRate) {
SetDomainLimitRateRequest request = new SetDomainLimitRateRequest()
.withDomain(domain)
.withLimitRate(limitRate);
setDomainLimitRate(request);
} | [
"public",
"void",
"setDomainLimitRate",
"(",
"String",
"domain",
",",
"int",
"limitRate",
")",
"{",
"SetDomainLimitRateRequest",
"request",
"=",
"new",
"SetDomainLimitRateRequest",
"(",
")",
".",
"withDomain",
"(",
"domain",
")",
".",
"withLimitRate",
"(",
"limitR... | Set the rate limit of specified domain acceleration.
@param domain Name of the domain.
@param limitRate The limit of downloading rate, in Bytes/s. | [
"Set",
"the",
"rate",
"limit",
"of",
"specified",
"domain",
"acceleration",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L426-L431 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/property/A_CmsPropertyEditor.java | A_CmsPropertyEditor.getTitle | protected String getTitle(Map<String, String> fieldValues) {
for (Map.Entry<String, String> entry : fieldValues.entrySet()) {
if (entry.getKey().contains("/NavText/")) {
return entry.getValue();
}
}
return null;
} | java | protected String getTitle(Map<String, String> fieldValues) {
for (Map.Entry<String, String> entry : fieldValues.entrySet()) {
if (entry.getKey().contains("/NavText/")) {
return entry.getValue();
}
}
return null;
} | [
"protected",
"String",
"getTitle",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"fieldValues",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"fieldValues",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"("... | Gets the title from a map of field values.<p>
@param fieldValues the map of field values
@return the title | [
"Gets",
"the",
"title",
"from",
"a",
"map",
"of",
"field",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/property/A_CmsPropertyEditor.java#L269-L277 |
CubeEngine/Dirigent | src/main/java/org/cubeengine/dirigent/formatter/StringFormatter.java | StringFormatter.parseObjectToString | protected String parseObjectToString(Object object, Locale locale, Arguments args)
{
final String string = String.valueOf(object);
if (args.has(LOWERCASE_FLAG))
{
return string.toLowerCase(locale);
}
if (args.has(UPPERCASE_FLAG))
{
return string.toUpperCase(locale);
}
return string;
} | java | protected String parseObjectToString(Object object, Locale locale, Arguments args)
{
final String string = String.valueOf(object);
if (args.has(LOWERCASE_FLAG))
{
return string.toLowerCase(locale);
}
if (args.has(UPPERCASE_FLAG))
{
return string.toUpperCase(locale);
}
return string;
} | [
"protected",
"String",
"parseObjectToString",
"(",
"Object",
"object",
",",
"Locale",
"locale",
",",
"Arguments",
"args",
")",
"{",
"final",
"String",
"string",
"=",
"String",
".",
"valueOf",
"(",
"object",
")",
";",
"if",
"(",
"args",
".",
"has",
"(",
"... | Parses the given object to a string depending on the context.
@param object The object to parse.
@param locale The locale to use.
@return The object as a string. | [
"Parses",
"the",
"given",
"object",
"to",
"a",
"string",
"depending",
"on",
"the",
"context",
"."
] | train | https://github.com/CubeEngine/Dirigent/blob/68587a8202754a6a6b629cc15e14c516806badaa/src/main/java/org/cubeengine/dirigent/formatter/StringFormatter.java#L80-L92 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java | CleaneLingSolver.strengthen | private void strengthen(final CLClause c, final int remove) {
if (c.dumped() || satisfied(c)) { return; }
assert this.addedlits.empty();
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit != remove && val(lit) == 0) { this.addedlits.push(lit); }
}
newPushConnectClause();
this.addedlits.clear();
dumpClause(c);
} | java | private void strengthen(final CLClause c, final int remove) {
if (c.dumped() || satisfied(c)) { return; }
assert this.addedlits.empty();
for (int i = 0; i < c.lits().size(); i++) {
final int lit = c.lits().get(i);
if (lit != remove && val(lit) == 0) { this.addedlits.push(lit); }
}
newPushConnectClause();
this.addedlits.clear();
dumpClause(c);
} | [
"private",
"void",
"strengthen",
"(",
"final",
"CLClause",
"c",
",",
"final",
"int",
"remove",
")",
"{",
"if",
"(",
"c",
".",
"dumped",
"(",
")",
"||",
"satisfied",
"(",
"c",
")",
")",
"{",
"return",
";",
"}",
"assert",
"this",
".",
"addedlits",
".... | Removes a literal in a clause.
@param c the clause
@param remove the literal to remove | [
"Removes",
"a",
"literal",
"in",
"a",
"clause",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L768-L778 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java | ArrayUtil.startsWith | public static int startsWith(String str, String[] arr)
{
if ( arr == null ) {
return -1;
}
for ( int i = 0; i < arr.length; i++ ) {
if ( arr[i].startsWith(str) ) {
return i;
}
}
return -1;
} | java | public static int startsWith(String str, String[] arr)
{
if ( arr == null ) {
return -1;
}
for ( int i = 0; i < arr.length; i++ ) {
if ( arr[i].startsWith(str) ) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"startsWith",
"(",
"String",
"str",
",",
"String",
"[",
"]",
"arr",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"len... | check if there is an element that starts with the specified string
@param str
@return int | [
"check",
"if",
"there",
"is",
"an",
"element",
"that",
"starts",
"with",
"the",
"specified",
"string"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L63-L76 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/mbtiles/MBTilesDb.java | MBTilesDb.fillMetadata | public void fillMetadata( float n, float s, float w, float e, String name, String format, int minZoom, int maxZoom )
throws Exception {
// type = baselayer
// version = 1.1
// descritpion = name
String query = toMetadataQuery("name", name);
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("description", name);
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("format", format);
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("minZoom", minZoom + "");
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("maxZoom", maxZoom + "");
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("type", "baselayer");
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("version", "1.1");
database.executeInsertUpdateDeleteSql(query);
// left, bottom, right, top
query = toMetadataQuery("bounds", w + "," + s + "," + e + "," + n);
database.executeInsertUpdateDeleteSql(query);
} | java | public void fillMetadata( float n, float s, float w, float e, String name, String format, int minZoom, int maxZoom )
throws Exception {
// type = baselayer
// version = 1.1
// descritpion = name
String query = toMetadataQuery("name", name);
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("description", name);
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("format", format);
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("minZoom", minZoom + "");
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("maxZoom", maxZoom + "");
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("type", "baselayer");
database.executeInsertUpdateDeleteSql(query);
query = toMetadataQuery("version", "1.1");
database.executeInsertUpdateDeleteSql(query);
// left, bottom, right, top
query = toMetadataQuery("bounds", w + "," + s + "," + e + "," + n);
database.executeInsertUpdateDeleteSql(query);
} | [
"public",
"void",
"fillMetadata",
"(",
"float",
"n",
",",
"float",
"s",
",",
"float",
"w",
",",
"float",
"e",
",",
"String",
"name",
",",
"String",
"format",
",",
"int",
"minZoom",
",",
"int",
"maxZoom",
")",
"throws",
"Exception",
"{",
"// type = basela... | Populate the metadata table.
@param n nord bound.
@param s south bound.
@param w west bound.
@param e east bound.
@param name name of the dataset.
@param format format of the images. png or jpg.
@param minZoom lowest zoomlevel.
@param maxZoom highest zoomlevel.
@throws Exception | [
"Populate",
"the",
"metadata",
"table",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/mbtiles/MBTilesDb.java#L169-L191 |
aws/aws-sdk-java | aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java | SimpleDBUtils.encodeRealNumberRange | public static String encodeRealNumberRange(float number, int maxDigitsLeft, int maxDigitsRight, int offsetValue) {
int shiftMultiplier = (int) Math.pow(10, maxDigitsRight);
long shiftedNumber = (long) Math.round((double) number * shiftMultiplier);
long shiftedOffset = offsetValue * shiftMultiplier;
long offsetNumber = shiftedNumber + shiftedOffset;
if (offsetNumber < 0) {
throw new IllegalArgumentException("OffsetNumber[" + offsetNumber + "] is negative - Number[" + number
+ "], maxDigitsLeft[" + maxDigitsLeft + "], maxDigitsRight[" + maxDigitsRight + "], offsetValue["
+ offsetValue + "]");
}
String longString = Long.toString(offsetNumber);
int numBeforeDecimal = longString.length();
int numZeroes = maxDigitsLeft + maxDigitsRight - numBeforeDecimal;
if (numZeroes < 0) {
throw new IllegalArgumentException("Number[" + number + "] has too many digits - maxDigitsLeft["
+ maxDigitsLeft + "], maxDigitsRight[" + maxDigitsRight + "], offsetValue[" + offsetValue + "]");
}
StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
for (int i = 0; i < numZeroes; i++) {
strBuffer.insert(i, '0');
}
strBuffer.append(longString);
return strBuffer.toString();
} | java | public static String encodeRealNumberRange(float number, int maxDigitsLeft, int maxDigitsRight, int offsetValue) {
int shiftMultiplier = (int) Math.pow(10, maxDigitsRight);
long shiftedNumber = (long) Math.round((double) number * shiftMultiplier);
long shiftedOffset = offsetValue * shiftMultiplier;
long offsetNumber = shiftedNumber + shiftedOffset;
if (offsetNumber < 0) {
throw new IllegalArgumentException("OffsetNumber[" + offsetNumber + "] is negative - Number[" + number
+ "], maxDigitsLeft[" + maxDigitsLeft + "], maxDigitsRight[" + maxDigitsRight + "], offsetValue["
+ offsetValue + "]");
}
String longString = Long.toString(offsetNumber);
int numBeforeDecimal = longString.length();
int numZeroes = maxDigitsLeft + maxDigitsRight - numBeforeDecimal;
if (numZeroes < 0) {
throw new IllegalArgumentException("Number[" + number + "] has too many digits - maxDigitsLeft["
+ maxDigitsLeft + "], maxDigitsRight[" + maxDigitsRight + "], offsetValue[" + offsetValue + "]");
}
StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
for (int i = 0; i < numZeroes; i++) {
strBuffer.insert(i, '0');
}
strBuffer.append(longString);
return strBuffer.toString();
} | [
"public",
"static",
"String",
"encodeRealNumberRange",
"(",
"float",
"number",
",",
"int",
"maxDigitsLeft",
",",
"int",
"maxDigitsRight",
",",
"int",
"offsetValue",
")",
"{",
"int",
"shiftMultiplier",
"=",
"(",
"int",
")",
"Math",
".",
"pow",
"(",
"10",
",",... | Encodes real float value into a string by offsetting and zero-padding number up to the
specified number of digits. Use this encoding method if the data range set includes both
positive and negative values.
@param number
float to be encoded
@param maxDigitsLeft
maximum number of digits left of the decimal point in the largest absolute value
in the data set
@param maxDigitsRight
maximum number of digits right of the decimal point in the largest absolute value
in the data set, i.e. precision
@param offsetValue
offset value, has to be greater than absolute value of any negative number in the
data set.
@return string representation of the integer | [
"Encodes",
"real",
"float",
"value",
"into",
"a",
"string",
"by",
"offsetting",
"and",
"zero",
"-",
"padding",
"number",
"up",
"to",
"the",
"specified",
"number",
"of",
"digits",
".",
"Use",
"this",
"encoding",
"method",
"if",
"the",
"data",
"range",
"set"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L202-L229 |
prestodb/presto | presto-spi/src/main/java/com/facebook/presto/spi/Page.java | Page.getSingleValuePage | public Page getSingleValuePage(int position)
{
Block[] singleValueBlocks = new Block[this.blocks.length];
for (int i = 0; i < this.blocks.length; i++) {
singleValueBlocks[i] = this.blocks[i].getSingleValueBlock(position);
}
return new Page(1, singleValueBlocks);
} | java | public Page getSingleValuePage(int position)
{
Block[] singleValueBlocks = new Block[this.blocks.length];
for (int i = 0; i < this.blocks.length; i++) {
singleValueBlocks[i] = this.blocks[i].getSingleValueBlock(position);
}
return new Page(1, singleValueBlocks);
} | [
"public",
"Page",
"getSingleValuePage",
"(",
"int",
"position",
")",
"{",
"Block",
"[",
"]",
"singleValueBlocks",
"=",
"new",
"Block",
"[",
"this",
".",
"blocks",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
... | Gets the values at the specified position as a single element page. The method creates independent
copy of the data. | [
"Gets",
"the",
"values",
"at",
"the",
"specified",
"position",
"as",
"a",
"single",
"element",
"page",
".",
"The",
"method",
"creates",
"independent",
"copy",
"of",
"the",
"data",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/Page.java#L110-L117 |
xmlunit/xmlunit | xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java | DefaultComparisonFormatter.appendText | protected void appendText(StringBuilder sb, Text aNode) {
sb.append("<")
.append(aNode.getParentNode().getNodeName())
.append(" ...>");
if (aNode instanceof CDATASection) {
sb.append("<![CDATA[")
.append(aNode.getNodeValue())
.append("]]>");
} else {
sb.append(aNode.getNodeValue());
}
sb.append("</")
.append(aNode.getParentNode().getNodeName())
.append(">");
} | java | protected void appendText(StringBuilder sb, Text aNode) {
sb.append("<")
.append(aNode.getParentNode().getNodeName())
.append(" ...>");
if (aNode instanceof CDATASection) {
sb.append("<![CDATA[")
.append(aNode.getNodeValue())
.append("]]>");
} else {
sb.append(aNode.getNodeValue());
}
sb.append("</")
.append(aNode.getParentNode().getNodeName())
.append(">");
} | [
"protected",
"void",
"appendText",
"(",
"StringBuilder",
"sb",
",",
"Text",
"aNode",
")",
"{",
"sb",
".",
"append",
"(",
"\"<\"",
")",
".",
"append",
"(",
"aNode",
".",
"getParentNode",
"(",
")",
".",
"getNodeName",
"(",
")",
")",
".",
"append",
"(",
... | Formats a text or CDATA node for {@link #getShortString}.
@param sb the builder to append to
@param aNode the text or CDATA node
@since XMLUnit 2.4.0 | [
"Formats",
"a",
"text",
"or",
"CDATA",
"node",
"for",
"{",
"@link",
"#getShortString",
"}",
"."
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L277-L293 |
ontop/ontop | mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/RAExpression.java | RAExpression.getJoinOnFilter | private static ImmutableList<Function> getJoinOnFilter(RAExpressionAttributes re1,
RAExpressionAttributes re2,
ImmutableSet<QuotedID> using,
TermFactory termFactory) {
return using.stream()
.map(id -> new QualifiedAttributeID(null, id))
.map(id -> {
// TODO: this will be removed later, when OBDA factory will start checking non-nulls
Term v1 = re1.getAttributes().get(id);
if (v1 == null)
throw new IllegalArgumentException("Term " + id + " not found in " + re1);
Term v2 = re2.getAttributes().get(id);
if (v2 == null)
throw new IllegalArgumentException("Term " + id + " not found in " + re2);
return termFactory.getFunctionEQ(v1, v2);
})
.collect(ImmutableCollectors.toList());
} | java | private static ImmutableList<Function> getJoinOnFilter(RAExpressionAttributes re1,
RAExpressionAttributes re2,
ImmutableSet<QuotedID> using,
TermFactory termFactory) {
return using.stream()
.map(id -> new QualifiedAttributeID(null, id))
.map(id -> {
// TODO: this will be removed later, when OBDA factory will start checking non-nulls
Term v1 = re1.getAttributes().get(id);
if (v1 == null)
throw new IllegalArgumentException("Term " + id + " not found in " + re1);
Term v2 = re2.getAttributes().get(id);
if (v2 == null)
throw new IllegalArgumentException("Term " + id + " not found in " + re2);
return termFactory.getFunctionEQ(v1, v2);
})
.collect(ImmutableCollectors.toList());
} | [
"private",
"static",
"ImmutableList",
"<",
"Function",
">",
"getJoinOnFilter",
"(",
"RAExpressionAttributes",
"re1",
",",
"RAExpressionAttributes",
"re2",
",",
"ImmutableSet",
"<",
"QuotedID",
">",
"using",
",",
"TermFactory",
"termFactory",
")",
"{",
"return",
"usi... | internal implementation of JOIN USING and NATURAL JOIN
@param re1 a {@link RAExpressionAttributes}
@param re2 a {@link RAExpressionAttributes}
@param using a {@link ImmutableSet}<{@link QuotedID}>
@return a {@Link ImmutableList}<{@link Function}> | [
"internal",
"implementation",
"of",
"JOIN",
"USING",
"and",
"NATURAL",
"JOIN"
] | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/mapping/sql/core/src/main/java/it/unibz/inf/ontop/spec/mapping/parser/impl/RAExpression.java#L150-L168 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java | TreeScanner.visitSwitch | @Override
public R visitSwitch(SwitchTree node, P p) {
R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getCases(), p, r);
return r;
} | java | @Override
public R visitSwitch(SwitchTree node, P p) {
R r = scan(node.getExpression(), p);
r = scanAndReduce(node.getCases(), p, r);
return r;
} | [
"@",
"Override",
"public",
"R",
"visitSwitch",
"(",
"SwitchTree",
"node",
",",
"P",
"p",
")",
"{",
"R",
"r",
"=",
"scan",
"(",
"node",
".",
"getExpression",
"(",
")",
",",
"p",
")",
";",
"r",
"=",
"scanAndReduce",
"(",
"node",
".",
"getCases",
"(",... | {@inheritDoc} This implementation scans the children in left to right order.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of scanning | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"scans",
"the",
"children",
"in",
"left",
"to",
"right",
"order",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L329-L334 |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java | WebACRolesProvider.dereferenceAgentGroups | private List<String> dereferenceAgentGroups(final Collection<String> agentGroups) {
final FedoraSession internalSession = sessionFactory.getInternalSession();
final IdentifierConverter<Resource, FedoraResource> translator =
new DefaultIdentifierTranslator(getJcrSession(internalSession));
final List<String> members = agentGroups.stream().flatMap(agentGroup -> {
if (agentGroup.startsWith(FEDORA_INTERNAL_PREFIX)) {
//strip off trailing hash.
final int hashIndex = agentGroup.indexOf("#");
final String agentGroupNoHash = hashIndex > 0 ?
agentGroup.substring(0, hashIndex) :
agentGroup;
final String hashedSuffix = hashIndex > 0 ? agentGroup.substring(hashIndex) : null;
final FedoraResource resource = nodeService.find(
internalSession, agentGroupNoHash.substring(FEDORA_INTERNAL_PREFIX.length()));
return getAgentMembers(translator, resource, hashedSuffix);
} else if (agentGroup.equals(FOAF_AGENT_VALUE)) {
return of(agentGroup);
} else {
LOGGER.info("Ignoring agentGroup: {}", agentGroup);
return empty();
}
}).collect(toList());
if (LOGGER.isDebugEnabled() && !agentGroups.isEmpty()) {
LOGGER.debug("Found {} members in {} agentGroups resources", members.size(), agentGroups.size());
}
return members;
} | java | private List<String> dereferenceAgentGroups(final Collection<String> agentGroups) {
final FedoraSession internalSession = sessionFactory.getInternalSession();
final IdentifierConverter<Resource, FedoraResource> translator =
new DefaultIdentifierTranslator(getJcrSession(internalSession));
final List<String> members = agentGroups.stream().flatMap(agentGroup -> {
if (agentGroup.startsWith(FEDORA_INTERNAL_PREFIX)) {
//strip off trailing hash.
final int hashIndex = agentGroup.indexOf("#");
final String agentGroupNoHash = hashIndex > 0 ?
agentGroup.substring(0, hashIndex) :
agentGroup;
final String hashedSuffix = hashIndex > 0 ? agentGroup.substring(hashIndex) : null;
final FedoraResource resource = nodeService.find(
internalSession, agentGroupNoHash.substring(FEDORA_INTERNAL_PREFIX.length()));
return getAgentMembers(translator, resource, hashedSuffix);
} else if (agentGroup.equals(FOAF_AGENT_VALUE)) {
return of(agentGroup);
} else {
LOGGER.info("Ignoring agentGroup: {}", agentGroup);
return empty();
}
}).collect(toList());
if (LOGGER.isDebugEnabled() && !agentGroups.isEmpty()) {
LOGGER.debug("Found {} members in {} agentGroups resources", members.size(), agentGroups.size());
}
return members;
} | [
"private",
"List",
"<",
"String",
">",
"dereferenceAgentGroups",
"(",
"final",
"Collection",
"<",
"String",
">",
"agentGroups",
")",
"{",
"final",
"FedoraSession",
"internalSession",
"=",
"sessionFactory",
".",
"getInternalSession",
"(",
")",
";",
"final",
"Identi... | This maps a Collection of acl:agentGroup values to a List of agents.
Any out-of-domain URIs are silently ignored. | [
"This",
"maps",
"a",
"Collection",
"of",
"acl",
":",
"agentGroup",
"values",
"to",
"a",
"List",
"of",
"agents",
".",
"Any",
"out",
"-",
"of",
"-",
"domain",
"URIs",
"are",
"silently",
"ignored",
"."
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java#L224-L253 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/json/JsonParser.java | JsonParser.parseAndClose | @Beta
public final void parseAndClose(Object destination, CustomizeJsonParser customizeParser)
throws IOException {
try {
parse(destination, customizeParser);
} finally {
close();
}
} | java | @Beta
public final void parseAndClose(Object destination, CustomizeJsonParser customizeParser)
throws IOException {
try {
parse(destination, customizeParser);
} finally {
close();
}
} | [
"@",
"Beta",
"public",
"final",
"void",
"parseAndClose",
"(",
"Object",
"destination",
",",
"CustomizeJsonParser",
"customizeParser",
")",
"throws",
"IOException",
"{",
"try",
"{",
"parse",
"(",
"destination",
",",
"customizeParser",
")",
";",
"}",
"finally",
"{... | {@link Beta} <br>
Parse a JSON Object from the given JSON parser -- which is closed after parsing completes --
into the given destination object, optionally using the given parser customizer.
<p>Before this method is called, the parser must either point to the start or end of a JSON
object or to a field name.
@param destination destination object
@param customizeParser optional parser customizer or {@code null} for none | [
"{",
"@link",
"Beta",
"}",
"<br",
">",
"Parse",
"a",
"JSON",
"Object",
"from",
"the",
"given",
"JSON",
"parser",
"--",
"which",
"is",
"closed",
"after",
"parsing",
"completes",
"--",
"into",
"the",
"given",
"destination",
"object",
"optionally",
"using",
"... | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/json/JsonParser.java#L274-L282 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java | WebJBossASClient.changeConnector | public void changeConnector(String connectorName, String attribName, String attribValue) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, connectorName);
final ModelNode op = createWriteAttributeRequest(attribName, attribValue, address);
final ModelNode response = execute(op);
if (!isSuccess(response)) {
throw new FailureException(response);
}
return;
} | java | public void changeConnector(String connectorName, String attribName, String attribValue) throws Exception {
final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, connectorName);
final ModelNode op = createWriteAttributeRequest(attribName, attribValue, address);
final ModelNode response = execute(op);
if (!isSuccess(response)) {
throw new FailureException(response);
}
return;
} | [
"public",
"void",
"changeConnector",
"(",
"String",
"connectorName",
",",
"String",
"attribName",
",",
"String",
"attribValue",
")",
"throws",
"Exception",
"{",
"final",
"Address",
"address",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",... | Use this to modify an attribute for an existing connector.
@param connectorName the existing connector whose attribute is to be changed
@param attribName the attribute to get a new value
@param attribValue the new value of the attribute
@throws Exception if failed to change the attribute on the named connector | [
"Use",
"this",
"to",
"modify",
"an",
"attribute",
"for",
"an",
"existing",
"connector",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L102-L110 |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/SchemaHelper.java | SchemaHelper.mapSchemaToPojo | public static ApiBodyMetadata mapSchemaToPojo(RamlRoot document, String schema, String basePackage, String name,
String schemaLocation) {
String resolvedName = null;
String schemaName = schema;
// Check if we have the name of a schema or an actual schema
String resolvedSchema = SchemaHelper.resolveSchema(schema, document);
if (resolvedSchema == null) {
resolvedSchema = schema;
schemaName = null;
}
// Extract name from schema
resolvedName = extractNameFromSchema(resolvedSchema, schemaName, name);
JCodeModel codeModel = buildBodyJCodeModel(basePackage, StringUtils.hasText(schemaLocation) ? schemaLocation : "classpath:/",
resolvedName, resolvedSchema, null);
if (codeModel != null) {
if (codeModel.countArtifacts() == 1) {
try {
// checking has next twice might be more efficient but this
// is more readable, if
// we ever run into speed issues here..optimise
Iterator<JPackage> packages = codeModel.packages();
// in the case that we have empty packages we need to skip
// them to get to the
// class
JPackage nextPackage = packages.next();
while (!nextPackage.classes().hasNext() && packages.hasNext()) {
nextPackage = packages.next();
}
resolvedName = nextPackage.classes().next().name();
} catch (NullPointerException npe) {
// do nothing, use previous name
}
}
return new ApiBodyMetadata(resolvedName, resolvedSchema, codeModel);
} else {
return null;
}
} | java | public static ApiBodyMetadata mapSchemaToPojo(RamlRoot document, String schema, String basePackage, String name,
String schemaLocation) {
String resolvedName = null;
String schemaName = schema;
// Check if we have the name of a schema or an actual schema
String resolvedSchema = SchemaHelper.resolveSchema(schema, document);
if (resolvedSchema == null) {
resolvedSchema = schema;
schemaName = null;
}
// Extract name from schema
resolvedName = extractNameFromSchema(resolvedSchema, schemaName, name);
JCodeModel codeModel = buildBodyJCodeModel(basePackage, StringUtils.hasText(schemaLocation) ? schemaLocation : "classpath:/",
resolvedName, resolvedSchema, null);
if (codeModel != null) {
if (codeModel.countArtifacts() == 1) {
try {
// checking has next twice might be more efficient but this
// is more readable, if
// we ever run into speed issues here..optimise
Iterator<JPackage> packages = codeModel.packages();
// in the case that we have empty packages we need to skip
// them to get to the
// class
JPackage nextPackage = packages.next();
while (!nextPackage.classes().hasNext() && packages.hasNext()) {
nextPackage = packages.next();
}
resolvedName = nextPackage.classes().next().name();
} catch (NullPointerException npe) {
// do nothing, use previous name
}
}
return new ApiBodyMetadata(resolvedName, resolvedSchema, codeModel);
} else {
return null;
}
} | [
"public",
"static",
"ApiBodyMetadata",
"mapSchemaToPojo",
"(",
"RamlRoot",
"document",
",",
"String",
"schema",
",",
"String",
"basePackage",
",",
"String",
"name",
",",
"String",
"schemaLocation",
")",
"{",
"String",
"resolvedName",
"=",
"null",
";",
"String",
... | Maps a JSON Schema to a JCodeModel using JSONSchema2Pojo and encapsulates
it along with some metadata into an {@link ApiBodyMetadata} object.
@param document
The Raml document being parsed
@param schema
The Schema (full schema or schema name to be resolved)
@param basePackage
The base package for the classes we are generating
@param name
The suggested name of the class based on the api call and
whether it's a request/response. This will only be used if no
suitable alternative is found in the schema
@param schemaLocation
Base location of this schema, will be used to create absolute
URIs for $ref tags eg "classpath:/"
@return Object representing this Body | [
"Maps",
"a",
"JSON",
"Schema",
"to",
"a",
"JCodeModel",
"using",
"JSONSchema2Pojo",
"and",
"encapsulates",
"it",
"along",
"with",
"some",
"metadata",
"into",
"an",
"{",
"@link",
"ApiBodyMetadata",
"}",
"object",
"."
] | train | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/SchemaHelper.java#L304-L344 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java | FeaturesImpl.addPhraseListAsync | public Observable<Integer> addPhraseListAsync(UUID appId, String versionId, PhraselistCreateObject phraselistCreateObject) {
return addPhraseListWithServiceResponseAsync(appId, versionId, phraselistCreateObject).map(new Func1<ServiceResponse<Integer>, Integer>() {
@Override
public Integer call(ServiceResponse<Integer> response) {
return response.body();
}
});
} | java | public Observable<Integer> addPhraseListAsync(UUID appId, String versionId, PhraselistCreateObject phraselistCreateObject) {
return addPhraseListWithServiceResponseAsync(appId, versionId, phraselistCreateObject).map(new Func1<ServiceResponse<Integer>, Integer>() {
@Override
public Integer call(ServiceResponse<Integer> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Integer",
">",
"addPhraseListAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"PhraselistCreateObject",
"phraselistCreateObject",
")",
"{",
"return",
"addPhraseListWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
","... | Creates a new phraselist feature.
@param appId The application ID.
@param versionId The version ID.
@param phraselistCreateObject A Phraselist object containing Name, comma-separated Phrases and the isExchangeable boolean. Default value for isExchangeable is true.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Integer object | [
"Creates",
"a",
"new",
"phraselist",
"feature",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java#L135-L142 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2016_06_27_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2016_06_27_preview/implementation/RegistriesInner.java | RegistriesInner.createOrUpdate | public RegistryInner createOrUpdate(String resourceGroupName, String registryName, RegistryInner registry) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, registryName, registry).toBlocking().single().body();
} | java | public RegistryInner createOrUpdate(String resourceGroupName, String registryName, RegistryInner registry) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, registryName, registry).toBlocking().single().body();
} | [
"public",
"RegistryInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"RegistryInner",
"registry",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"registry",
... | Creates or updates a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param registry The parameters for creating or updating a container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegistryInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2016_06_27_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2016_06_27_preview/implementation/RegistriesInner.java#L295-L297 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getFromFirstIncl | @Nullable
public static String getFromFirstIncl (@Nullable final String sStr, final char cSearch)
{
return _getFromFirst (sStr, cSearch, true);
} | java | @Nullable
public static String getFromFirstIncl (@Nullable final String sStr, final char cSearch)
{
return _getFromFirst (sStr, cSearch, true);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getFromFirstIncl",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"final",
"char",
"cSearch",
")",
"{",
"return",
"_getFromFirst",
"(",
"sStr",
",",
"cSearch",
",",
"true",
")",
";",
"}"
] | Get everything from the string from and including the first passed char.
@param sStr
The source string. May be <code>null</code>.
@param cSearch
The character to search.
@return <code>null</code> if the passed string does not contain the search
character. | [
"Get",
"everything",
"from",
"the",
"string",
"from",
"and",
"including",
"the",
"first",
"passed",
"char",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4934-L4938 |
labai/ted | ted-driver/src/main/java/ted/driver/TedDriver.java | TedDriver.createBatch | public Long createBatch(String batchTaskName, String data, String key1, String key2, List<TedTask> tedTasks) {
return tedDriverImpl.createBatch(batchTaskName, data, key1, key2, tedTasks);
} | java | public Long createBatch(String batchTaskName, String data, String key1, String key2, List<TedTask> tedTasks) {
return tedDriverImpl.createBatch(batchTaskName, data, key1, key2, tedTasks);
} | [
"public",
"Long",
"createBatch",
"(",
"String",
"batchTaskName",
",",
"String",
"data",
",",
"String",
"key1",
",",
"String",
"key2",
",",
"List",
"<",
"TedTask",
">",
"tedTasks",
")",
"{",
"return",
"tedDriverImpl",
".",
"createBatch",
"(",
"batchTaskName",
... | create tasks by list and batch task for them. return batch taskId | [
"create",
"tasks",
"by",
"list",
"and",
"batch",
"task",
"for",
"them",
".",
"return",
"batch",
"taskId"
] | train | https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/TedDriver.java#L101-L103 |
pravega/pravega | common/src/main/java/io/pravega/common/Exceptions.java | Exceptions.checkNotNullOrEmpty | public static String checkNotNullOrEmpty(String arg, String argName) throws NullPointerException, IllegalArgumentException {
Preconditions.checkNotNull(arg, argName);
checkArgument(arg.length() > 0, argName, "Cannot be an empty string.");
return arg;
} | java | public static String checkNotNullOrEmpty(String arg, String argName) throws NullPointerException, IllegalArgumentException {
Preconditions.checkNotNull(arg, argName);
checkArgument(arg.length() > 0, argName, "Cannot be an empty string.");
return arg;
} | [
"public",
"static",
"String",
"checkNotNullOrEmpty",
"(",
"String",
"arg",
",",
"String",
"argName",
")",
"throws",
"NullPointerException",
",",
"IllegalArgumentException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"arg",
",",
"argName",
")",
";",
"checkArgume... | Throws a NullPointerException if the arg argument is null. Throws an IllegalArgumentException if the String arg
argument has a length of zero.
@param arg The argument to check.
@param argName The name of the argument (to be included in the exception message).
@return The arg.
@throws NullPointerException If arg is null.
@throws IllegalArgumentException If arg is not null, but has a length of zero. | [
"Throws",
"a",
"NullPointerException",
"if",
"the",
"arg",
"argument",
"is",
"null",
".",
"Throws",
"an",
"IllegalArgumentException",
"if",
"the",
"String",
"arg",
"argument",
"has",
"a",
"length",
"of",
"zero",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/Exceptions.java#L155-L159 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java | SpiderService.verifyShard | public void verifyShard(TableDefinition tableDef, int shardNumber) {
assert tableDef.isSharded();
assert shardNumber > 0;
checkServiceState();
m_shardCache.verifyShard(tableDef, shardNumber);
} | java | public void verifyShard(TableDefinition tableDef, int shardNumber) {
assert tableDef.isSharded();
assert shardNumber > 0;
checkServiceState();
m_shardCache.verifyShard(tableDef, shardNumber);
} | [
"public",
"void",
"verifyShard",
"(",
"TableDefinition",
"tableDef",
",",
"int",
"shardNumber",
")",
"{",
"assert",
"tableDef",
".",
"isSharded",
"(",
")",
";",
"assert",
"shardNumber",
">",
"0",
";",
"checkServiceState",
"(",
")",
";",
"m_shardCache",
".",
... | Get the starting date of the shard with the given number in the given sharded
table. If the given table has not yet started the given shard, null is returned.
@param tableDef {@link TableDefinition} of a sharded table.
@param shardNumber Shard number (must be > 0).
@return Start date of the given shard or null if no objects have been
stored in the given shard yet. | [
"Get",
"the",
"starting",
"date",
"of",
"the",
"shard",
"with",
"the",
"given",
"number",
"in",
"the",
"given",
"sharded",
"table",
".",
"If",
"the",
"given",
"table",
"has",
"not",
"yet",
"started",
"the",
"given",
"shard",
"null",
"is",
"returned",
"."... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java#L484-L489 |
lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.getOption | String getOption(String[] options, int index) {
if ((options != null) && (options.length > index)) {
return options[index];
}
return null;
} | java | String getOption(String[] options, int index) {
if ((options != null) && (options.length > index)) {
return options[index];
}
return null;
} | [
"String",
"getOption",
"(",
"String",
"[",
"]",
"options",
",",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"options",
"!=",
"null",
")",
"&&",
"(",
"options",
".",
"length",
">",
"index",
")",
")",
"{",
"return",
"options",
"[",
"index",
"]",
";",
... | Returns an option at given index in an array of options, or null
@param options an array of Strings
@param index position of the option that is sought
@return the option or null | [
"Returns",
"an",
"option",
"at",
"given",
"index",
"in",
"an",
"array",
"of",
"options",
"or",
"null"
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L289-L294 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java | PDBDomainProvider.handleRestRequest | private static void handleRestRequest(String url, DefaultHandler handler) throws SAXException, IOException, ParserConfigurationException {
// Fetch XML stream
URL u = new URL(url);
InputStream response = URLConnectionTools.getInputStream(u);
InputSource xml = new InputSource(response);
// Parse XML
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(xml, handler);
} | java | private static void handleRestRequest(String url, DefaultHandler handler) throws SAXException, IOException, ParserConfigurationException {
// Fetch XML stream
URL u = new URL(url);
InputStream response = URLConnectionTools.getInputStream(u);
InputSource xml = new InputSource(response);
// Parse XML
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(xml, handler);
} | [
"private",
"static",
"void",
"handleRestRequest",
"(",
"String",
"url",
",",
"DefaultHandler",
"handler",
")",
"throws",
"SAXException",
",",
"IOException",
",",
"ParserConfigurationException",
"{",
"// Fetch XML stream",
"URL",
"u",
"=",
"new",
"URL",
"(",
"url",
... | Handles fetching and processing REST requests. The actual XML parsing is handled
by the handler, which is also in charge of storing interesting data.
@param url REST request
@param handler SAX XML parser
@throws SAXException
@throws IOException
@throws ParserConfigurationException | [
"Handles",
"fetching",
"and",
"processing",
"REST",
"requests",
".",
"The",
"actual",
"XML",
"parsing",
"is",
"handled",
"by",
"the",
"handler",
"which",
"is",
"also",
"in",
"charge",
"of",
"storing",
"interesting",
"data",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java#L134-L145 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java | Constraints.ltProperty | public PropertyConstraint ltProperty(String propertyName, String otherPropertyName) {
return valueProperties(propertyName, LessThan.instance(), otherPropertyName);
} | java | public PropertyConstraint ltProperty(String propertyName, String otherPropertyName) {
return valueProperties(propertyName, LessThan.instance(), otherPropertyName);
} | [
"public",
"PropertyConstraint",
"ltProperty",
"(",
"String",
"propertyName",
",",
"String",
"otherPropertyName",
")",
"{",
"return",
"valueProperties",
"(",
"propertyName",
",",
"LessThan",
".",
"instance",
"(",
")",
",",
"otherPropertyName",
")",
";",
"}"
] | Apply a "less than" constraint to two properties.
@param propertyName The first property
@param otherPropertyName The other property
@return The constraint | [
"Apply",
"a",
"less",
"than",
"constraint",
"to",
"two",
"properties",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L875-L877 |
OpenTSDB/opentsdb | src/tree/Branch.java | Branch.prependParentPath | public void prependParentPath(final Map<Integer, String> parent_path) {
if (parent_path == null) {
throw new IllegalArgumentException("Parent path was null");
}
path = new TreeMap<Integer, String>();
path.putAll(parent_path);
} | java | public void prependParentPath(final Map<Integer, String> parent_path) {
if (parent_path == null) {
throw new IllegalArgumentException("Parent path was null");
}
path = new TreeMap<Integer, String>();
path.putAll(parent_path);
} | [
"public",
"void",
"prependParentPath",
"(",
"final",
"Map",
"<",
"Integer",
",",
"String",
">",
"parent_path",
")",
"{",
"if",
"(",
"parent_path",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parent path was null\"",
")",
";",
"}... | Sets the path for this branch based off the path of the parent. This map
may be empty, in which case the branch is considered a root.
<b>Warning:</b> If the path has already been set, this will create a new
path, clearing out any existing entries
@param parent_path The map to store as the path
@throws IllegalArgumentException if the parent path is null | [
"Sets",
"the",
"path",
"for",
"this",
"branch",
"based",
"off",
"the",
"path",
"of",
"the",
"parent",
".",
"This",
"map",
"may",
"be",
"empty",
"in",
"which",
"case",
"the",
"branch",
"is",
"considered",
"a",
"root",
".",
"<b",
">",
"Warning",
":",
"... | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Branch.java#L317-L323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.